@algolia/client-personalization 5.0.0-alpha.111 → 5.0.0-alpha.112

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.
@@ -4,7 +4,7 @@ var clientCommon = require('@algolia/client-common');
4
4
  var requesterNodeHttp = require('@algolia/requester-node-http');
5
5
 
6
6
  // 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.
7
- const apiClientVersion = '5.0.0-alpha.111';
7
+ const apiClientVersion = '5.0.0-alpha.112';
8
8
  const REGIONS = ['eu', 'us'];
9
9
  function getDefaultHosts(region) {
10
10
  const url = 'personalization.{region}.algolia.com'.replace('{region}', region);
@@ -158,13 +158,13 @@ function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption,
158
158
  return transporter.request(request, requestOptions);
159
159
  },
160
160
  /**
161
- * Delete the user profile and all its associated data. Returns, as part of the response, a date until which the data can safely be considered as deleted for the given user. This means if you send events for the given user before this date, they will be ignored. Any data received after the deletedUntil date will start building a new user profile. It might take a couple hours for the deletion request to be fully processed.
161
+ * Deletes a user profile. The response includes a date and time when the user profile can safely be considered deleted.
162
162
  *
163
163
  * Required API Key ACLs:
164
164
  * - recommendation.
165
165
  *
166
166
  * @param deleteUserProfile - The deleteUserProfile object.
167
- * @param deleteUserProfile.userToken - UserToken representing the user for which to fetch the Personalization profile.
167
+ * @param deleteUserProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
168
168
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
169
169
  */
170
170
  deleteUserProfile({ userToken }, requestOptions) {
@@ -183,7 +183,7 @@ function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption,
183
183
  return transporter.request(request, requestOptions);
184
184
  },
185
185
  /**
186
- * The strategy contains information on the events and facets that impact user profiles and personalized search results.
186
+ * Retrieves the current personalization strategy.
187
187
  *
188
188
  * Required API Key ACLs:
189
189
  * - recommendation.
@@ -203,13 +203,13 @@ function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption,
203
203
  return transporter.request(request, requestOptions);
204
204
  },
205
205
  /**
206
- * Get the user profile built from Personalization strategy. The profile is structured by facet name used in the strategy. Each facet value is mapped to its score. Each score represents the user affinity for a specific facet value given the userToken past events and the Personalization strategy defined. Scores are bounded to 20. The last processed event timestamp is provided using the ISO 8601 format for debugging purposes.
206
+ * Retrieves a user profile and their affinities for different facets.
207
207
  *
208
208
  * Required API Key ACLs:
209
209
  * - recommendation.
210
210
  *
211
211
  * @param getUserTokenProfile - The getUserTokenProfile object.
212
- * @param getUserTokenProfile.userToken - UserToken representing the user for which to fetch the Personalization profile.
212
+ * @param getUserTokenProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
213
213
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
214
214
  */
215
215
  getUserTokenProfile({ userToken }, requestOptions) {
@@ -228,7 +228,7 @@ function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption,
228
228
  return transporter.request(request, requestOptions);
229
229
  },
230
230
  /**
231
- * A strategy defines the events and facets that impact user profiles and personalized search results.
231
+ * Creates a new personalization strategy.
232
232
  *
233
233
  * Required API Key ACLs:
234
234
  * - recommendation.
@@ -449,16 +449,13 @@ function createTransporter({
449
449
  if (host === undefined) {
450
450
  throw new RetryError(stackTraceWithoutCredentials(stackTrace));
451
451
  }
452
- let responseTimeout = requestOptions.timeout;
453
- if (responseTimeout === undefined) {
454
- responseTimeout = isRead ? timeouts.read : timeouts.write;
455
- }
452
+ let responseTimeout = isRead ? requestOptions.timeouts?.read || timeouts.read : requestOptions.timeouts?.write || timeouts.write;
456
453
  const payload = {
457
454
  data,
458
455
  headers,
459
456
  method: request.method,
460
457
  url: serializeUrl(host, request.path, queryParameters),
461
- connectTimeout: getTimeout(timeoutsCount, timeouts.connect),
458
+ connectTimeout: getTimeout(timeoutsCount, requestOptions.timeouts?.connect || timeouts.connect),
462
459
  responseTimeout: getTimeout(timeoutsCount, responseTimeout)
463
460
  };
464
461
  /**
@@ -686,7 +683,7 @@ function createXhrRequester() {
686
683
  }
687
684
 
688
685
  // 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.
689
- const apiClientVersion = '5.0.0-alpha.111';
686
+ const apiClientVersion = '5.0.0-alpha.112';
690
687
  const REGIONS = ['eu', 'us'];
691
688
  function getDefaultHosts(region) {
692
689
  const url = 'personalization.{region}.algolia.com'.replace('{region}', region);
@@ -840,13 +837,13 @@ function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption,
840
837
  return transporter.request(request, requestOptions);
841
838
  },
842
839
  /**
843
- * Delete the user profile and all its associated data. Returns, as part of the response, a date until which the data can safely be considered as deleted for the given user. This means if you send events for the given user before this date, they will be ignored. Any data received after the deletedUntil date will start building a new user profile. It might take a couple hours for the deletion request to be fully processed.
840
+ * Deletes a user profile. The response includes a date and time when the user profile can safely be considered deleted.
844
841
  *
845
842
  * Required API Key ACLs:
846
843
  * - recommendation.
847
844
  *
848
845
  * @param deleteUserProfile - The deleteUserProfile object.
849
- * @param deleteUserProfile.userToken - UserToken representing the user for which to fetch the Personalization profile.
846
+ * @param deleteUserProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
850
847
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
851
848
  */
852
849
  deleteUserProfile({ userToken }, requestOptions) {
@@ -865,7 +862,7 @@ function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption,
865
862
  return transporter.request(request, requestOptions);
866
863
  },
867
864
  /**
868
- * The strategy contains information on the events and facets that impact user profiles and personalized search results.
865
+ * Retrieves the current personalization strategy.
869
866
  *
870
867
  * Required API Key ACLs:
871
868
  * - recommendation.
@@ -885,13 +882,13 @@ function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption,
885
882
  return transporter.request(request, requestOptions);
886
883
  },
887
884
  /**
888
- * Get the user profile built from Personalization strategy. The profile is structured by facet name used in the strategy. Each facet value is mapped to its score. Each score represents the user affinity for a specific facet value given the userToken past events and the Personalization strategy defined. Scores are bounded to 20. The last processed event timestamp is provided using the ISO 8601 format for debugging purposes.
885
+ * Retrieves a user profile and their affinities for different facets.
889
886
  *
890
887
  * Required API Key ACLs:
891
888
  * - recommendation.
892
889
  *
893
890
  * @param getUserTokenProfile - The getUserTokenProfile object.
894
- * @param getUserTokenProfile.userToken - UserToken representing the user for which to fetch the Personalization profile.
891
+ * @param getUserTokenProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
895
892
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
896
893
  */
897
894
  getUserTokenProfile({ userToken }, requestOptions) {
@@ -910,7 +907,7 @@ function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption,
910
907
  return transporter.request(request, requestOptions);
911
908
  },
912
909
  /**
913
- * A strategy defines the events and facets that impact user profiles and personalized search results.
910
+ * Creates a new personalization strategy.
914
911
  *
915
912
  * Required API Key ACLs:
916
913
  * - recommendation.
@@ -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.111';
5
+ const apiClientVersion = '5.0.0-alpha.112';
6
6
  const REGIONS = ['eu', 'us'];
7
7
  function getDefaultHosts(region) {
8
8
  const url = 'personalization.{region}.algolia.com'.replace('{region}', region);
@@ -156,13 +156,13 @@ function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption,
156
156
  return transporter.request(request, requestOptions);
157
157
  },
158
158
  /**
159
- * Delete the user profile and all its associated data. Returns, as part of the response, a date until which the data can safely be considered as deleted for the given user. This means if you send events for the given user before this date, they will be ignored. Any data received after the deletedUntil date will start building a new user profile. It might take a couple hours for the deletion request to be fully processed.
159
+ * Deletes a user profile. The response includes a date and time when the user profile can safely be considered deleted.
160
160
  *
161
161
  * Required API Key ACLs:
162
162
  * - recommendation.
163
163
  *
164
164
  * @param deleteUserProfile - The deleteUserProfile object.
165
- * @param deleteUserProfile.userToken - UserToken representing the user for which to fetch the Personalization profile.
165
+ * @param deleteUserProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
166
166
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
167
167
  */
168
168
  deleteUserProfile({ userToken }, requestOptions) {
@@ -181,7 +181,7 @@ function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption,
181
181
  return transporter.request(request, requestOptions);
182
182
  },
183
183
  /**
184
- * The strategy contains information on the events and facets that impact user profiles and personalized search results.
184
+ * Retrieves the current personalization strategy.
185
185
  *
186
186
  * Required API Key ACLs:
187
187
  * - recommendation.
@@ -201,13 +201,13 @@ function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption,
201
201
  return transporter.request(request, requestOptions);
202
202
  },
203
203
  /**
204
- * Get the user profile built from Personalization strategy. The profile is structured by facet name used in the strategy. Each facet value is mapped to its score. Each score represents the user affinity for a specific facet value given the userToken past events and the Personalization strategy defined. Scores are bounded to 20. The last processed event timestamp is provided using the ISO 8601 format for debugging purposes.
204
+ * Retrieves a user profile and their affinities for different facets.
205
205
  *
206
206
  * Required API Key ACLs:
207
207
  * - recommendation.
208
208
  *
209
209
  * @param getUserTokenProfile - The getUserTokenProfile object.
210
- * @param getUserTokenProfile.userToken - UserToken representing the user for which to fetch the Personalization profile.
210
+ * @param getUserTokenProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
211
211
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
212
212
  */
213
213
  getUserTokenProfile({ userToken }, requestOptions) {
@@ -226,7 +226,7 @@ function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption,
226
226
  return transporter.request(request, requestOptions);
227
227
  },
228
228
  /**
229
- * A strategy defines the events and facets that impact user profiles and personalized search results.
229
+ * Creates a new personalization strategy.
230
230
  *
231
231
  * Required API Key ACLs:
232
232
  * - recommendation.
@@ -1,2 +1,2 @@
1
- /*! client-personalization.umd.js | 5.0.0-alpha.111 | © 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-personalization"]={})}(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)||"{}")}function o(e){s().setItem(r,JSON.stringify(e))}return{get:(t,r,s={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>(function(){const t=e.timeToLive?1e3*e.timeToLive:null,r=a(),s=Object.fromEntries(Object.entries(r).filter((([,e])=>void 0!==e.timestamp)));if(o(s),!t)return;o(Object.fromEntries(Object.entries(s).filter((([,e])=>{const r=(new Date).getTime();return!(e.timestamp+t<r)}))))}(),a()[JSON.stringify(t)]))).then((e=>Promise.all([e?e.value:r(),void 0!==e]))).then((([e,t])=>Promise.all([e,t||s.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const o=a();return o[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},s().setItem(r,JSON.stringify(o)),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,o={miss:()=>Promise.resolve()})=>s.get(e,a,o).catch((()=>r({caches:t}).get(e,a,o))),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 o=JSON.stringify(r);if(o in t)return Promise.resolve(e.serializable?JSON.parse(t[o]):t[o]);const n=s();return n.then((e=>a.miss(e))).then((()=>n))},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 o(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 n(e){var t=function(e,t){if("object"!=typeof e||!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:t+""}function i(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class c extends Error{constructor(e,t){super(e),i(this,"name","AlgoliaError"),t&&(this.name=t)}}class u extends c{constructor(e,t,r){super(e,r),i(this,"stackTrace",void 0),this.stackTrace=t}}class l extends u{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, please create a ticket at https://support.algolia.com/ sharing steps we can use to reproduce the issue.",e,"RetryError")}}class m extends u{constructor(e,t,r,s="ApiError"){super(e,r,s),i(this,"status",void 0),this.status=t}}class h extends c{constructor(e,t){super(e,"DeserializationError"),i(this,"response",void 0),this.response=t}}class d extends m{constructor(e,t,r,s){super(e,t,s,"DetailedApiError"),i(this,"error",void 0),this.error=r}}function p(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]).replaceAll("+","%20")}`)).join("&")}(r);let a=`${e.protocol}://${e.url}${e.port?`:${e.port}`:""}/${"/"===t.charAt(0)?t.substring(1):t}`;return s.length&&(a+=`?${s}`),a}function g(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 f({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:s,algoliaAgent:a,timeouts:n,requester:i,requestsCache:c,responsesCache:u}){async function f(c,u,f=!0){const y=[],P=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,u),w=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,u.headers),v="GET"===c.method?{...c.data,...u.data}:{},q={...s,...c.queryParameters,...v};if(a.value&&(q["x-algolia-agent"]=a.value),u&&u.queryParameters)for(const e of Object.keys(u.queryParameters))u.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(u.queryParameters[e])?q[e]=u.queryParameters[e].toString():q[e]=u.queryParameters[e];let T=0;const b=async(e,r)=>{const s=e.pop();if(void 0===s)throw new l(function(e){return e.map((e=>g(e)))}(y));let a=u.timeout;void 0===a&&(a=f?n.read:n.write);const v={data:P,headers:w,method:c.method,url:p(s,c.path,q),connectTimeout:r(T,n.connect),responseTimeout:r(T,a)},O=t=>{const r={request:v,response:t,host:s,triesLeft:e.length};return y.push(r),r},S=await i.send(v);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&!~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(S)){const a=O(S);return S.isTimedOut&&T++,console.log("Retryable failure",g(a)),await t.set(s,o(s,S.isTimedOut?"timed out":"down")),b(e,r)}if(function({status:e}){return 2==~~(e/100)}(S))return function(e){try{return JSON.parse(e.content)}catch(t){throw new h(t.message,e)}}(S);throw O(S),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 m(s.message,t,r)}catch(e){}return new m(e,t,r)}(S,y)},O=e.filter((e=>"readWrite"===e.accept||(f?"read"===e.accept:"write"===e.accept))),S=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(o(e))))))),s=r.filter((e=>e.isUp())),a=r.filter((e=>e.isTimedOut())),n=[...s,...a];return{hosts:n.length>0?n:e,getTimeout:(e,t)=>(0===a.length&&0===e?1:a.length+3+e)*t}}(O);return b([...S.hosts].reverse(),S.getTimeout)}return{hostsCache:t,requester:i,timeouts:n,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 o=()=>f(e,t);if(!0!==(t.cacheable||e.cacheable))return o();const n={request:e,requestOptions:t,transporter:{queryParameters:s,headers:r}};return u.get(n,(()=>c.get(n,(()=>c.set(n,o()).then((e=>Promise.all([c.delete(n),e])),(e=>Promise.all([c.delete(n),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>u.set(n,e)})},requestsCache:c,responsesCache:u}}function y({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 P="5.0.0-alpha.111",w=["eu","us"];e.apiClientVersion=P,e.personalizationClient=function(e,a,o,n){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!a||"string"!=typeof a)throw new Error("`apiKey` is missing.");if(!o||o&&("string"!=typeof o||!w.includes(o)))throw new Error(`\`region\` is required and must be one of the following: ${w.join(", ")}`);return function({appId:e,apiKey:t,authMode:r,algoliaAgents:s,region:a,...o}){const n=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=f({hosts:(c=a,[{url:"personalization.{region}.algolia.com".replace("{region}",c),accept:"readWrite",protocol:"https"}]),...o,algoliaAgent:y({algoliaAgents:s,client:"Personalization",version:P}),baseHeaders:{"content-type":"text/plain",...n.headers(),...o.baseHeaders},baseQueryParameters:{...n.queryParameters(),...o.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})},customDelete({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");const s={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(s,r)},customGet({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");const s={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(s,r)},customPost({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");const a={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(a,s)},customPut({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");const a={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(a,s)},deleteUserProfile({userToken:e},t){if(!e)throw new Error("Parameter `userToken` is required when calling `deleteUserProfile`.");const r={method:"DELETE",path:"/1/profiles/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)},getPersonalizationStrategy(e){const t={method:"GET",path:"/1/strategies/personalization",queryParameters:{},headers:{}};return i.request(t,e)},getUserTokenProfile({userToken:e},t){if(!e)throw new Error("Parameter `userToken` is required when calling `getUserTokenProfile`.");const r={method:"GET",path:"/1/profiles/personalization/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)},setPersonalizationStrategy(e,t){if(!e)throw new Error("Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.");if(!e.eventScoring)throw new Error("Parameter `personalizationStrategyParams.eventScoring` is required when calling `setPersonalizationStrategy`.");if(!e.facetScoring)throw new Error("Parameter `personalizationStrategyParams.facetScoring` is required when calling `setPersonalizationStrategy`.");if(!e.personalizationImpact)throw new Error("Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.");const r={method:"POST",path:"/1/strategies/personalization",queryParameters:{},headers:{},data:e};return i.request(r,t)}}}({appId:e,apiKey:a,region:o,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 o;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===o&&(clearTimeout(a),o=s(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(a),clearTimeout(o),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(a),clearTimeout(o),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:`${P}-${e}`}),s()]}),...n})}}));
1
+ /*! client-personalization.umd.js | 5.0.0-alpha.112 | © 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-personalization"]={})}(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)||"{}")}function o(e){s().setItem(r,JSON.stringify(e))}return{get:(t,r,s={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>(function(){const t=e.timeToLive?1e3*e.timeToLive:null,r=a(),s=Object.fromEntries(Object.entries(r).filter((([,e])=>void 0!==e.timestamp)));if(o(s),!t)return;o(Object.fromEntries(Object.entries(s).filter((([,e])=>{const r=(new Date).getTime();return!(e.timestamp+t<r)}))))}(),a()[JSON.stringify(t)]))).then((e=>Promise.all([e?e.value:r(),void 0!==e]))).then((([e,t])=>Promise.all([e,t||s.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const o=a();return o[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},s().setItem(r,JSON.stringify(o)),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,o={miss:()=>Promise.resolve()})=>s.get(e,a,o).catch((()=>r({caches:t}).get(e,a,o))),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 o=JSON.stringify(r);if(o in t)return Promise.resolve(e.serializable?JSON.parse(t[o]):t[o]);const n=s();return n.then((e=>a.miss(e))).then((()=>n))},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 o(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 n(e){var t=function(e,t){if("object"!=typeof e||!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:t+""}function i(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class c extends Error{constructor(e,t){super(e),i(this,"name","AlgoliaError"),t&&(this.name=t)}}class u extends c{constructor(e,t,r){super(e,r),i(this,"stackTrace",void 0),this.stackTrace=t}}class l extends u{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, please create a ticket at https://support.algolia.com/ sharing steps we can use to reproduce the issue.",e,"RetryError")}}class m extends u{constructor(e,t,r,s="ApiError"){super(e,r,s),i(this,"status",void 0),this.status=t}}class h extends c{constructor(e,t){super(e,"DeserializationError"),i(this,"response",void 0),this.response=t}}class d extends m{constructor(e,t,r,s){super(e,t,s,"DetailedApiError"),i(this,"error",void 0),this.error=r}}function p(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]).replaceAll("+","%20")}`)).join("&")}(r);let a=`${e.protocol}://${e.url}${e.port?`:${e.port}`:""}/${"/"===t.charAt(0)?t.substring(1):t}`;return s.length&&(a+=`?${s}`),a}function g(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 f({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:s,algoliaAgent:a,timeouts:n,requester:i,requestsCache:c,responsesCache:u}){async function f(c,u,f=!0){const y=[],P=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,u),w=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,u.headers),v="GET"===c.method?{...c.data,...u.data}:{},q={...s,...c.queryParameters,...v};if(a.value&&(q["x-algolia-agent"]=a.value),u&&u.queryParameters)for(const e of Object.keys(u.queryParameters))u.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(u.queryParameters[e])?q[e]=u.queryParameters[e].toString():q[e]=u.queryParameters[e];let T=0;const b=async(e,r)=>{const s=e.pop();if(void 0===s)throw new l(function(e){return e.map((e=>g(e)))}(y));let a=f?u.timeouts?.read||n.read:u.timeouts?.write||n.write;const v={data:P,headers:w,method:c.method,url:p(s,c.path,q),connectTimeout:r(T,u.timeouts?.connect||n.connect),responseTimeout:r(T,a)},O=t=>{const r={request:v,response:t,host:s,triesLeft:e.length};return y.push(r),r},S=await i.send(v);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&!~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(S)){const a=O(S);return S.isTimedOut&&T++,console.log("Retryable failure",g(a)),await t.set(s,o(s,S.isTimedOut?"timed out":"down")),b(e,r)}if(function({status:e}){return 2==~~(e/100)}(S))return function(e){try{return JSON.parse(e.content)}catch(t){throw new h(t.message,e)}}(S);throw O(S),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 m(s.message,t,r)}catch(e){}return new m(e,t,r)}(S,y)},O=e.filter((e=>"readWrite"===e.accept||(f?"read"===e.accept:"write"===e.accept))),S=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(o(e))))))),s=r.filter((e=>e.isUp())),a=r.filter((e=>e.isTimedOut())),n=[...s,...a];return{hosts:n.length>0?n:e,getTimeout:(e,t)=>(0===a.length&&0===e?1:a.length+3+e)*t}}(O);return b([...S.hosts].reverse(),S.getTimeout)}return{hostsCache:t,requester:i,timeouts:n,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 o=()=>f(e,t);if(!0!==(t.cacheable||e.cacheable))return o();const n={request:e,requestOptions:t,transporter:{queryParameters:s,headers:r}};return u.get(n,(()=>c.get(n,(()=>c.set(n,o()).then((e=>Promise.all([c.delete(n),e])),(e=>Promise.all([c.delete(n),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>u.set(n,e)})},requestsCache:c,responsesCache:u}}function y({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 P="5.0.0-alpha.112",w=["eu","us"];e.apiClientVersion=P,e.personalizationClient=function(e,a,o,n){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!a||"string"!=typeof a)throw new Error("`apiKey` is missing.");if(!o||o&&("string"!=typeof o||!w.includes(o)))throw new Error(`\`region\` is required and must be one of the following: ${w.join(", ")}`);return function({appId:e,apiKey:t,authMode:r,algoliaAgents:s,region:a,...o}){const n=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=f({hosts:(c=a,[{url:"personalization.{region}.algolia.com".replace("{region}",c),accept:"readWrite",protocol:"https"}]),...o,algoliaAgent:y({algoliaAgents:s,client:"Personalization",version:P}),baseHeaders:{"content-type":"text/plain",...n.headers(),...o.baseHeaders},baseQueryParameters:{...n.queryParameters(),...o.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})},customDelete({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");const s={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(s,r)},customGet({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");const s={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(s,r)},customPost({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");const a={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(a,s)},customPut({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");const a={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(a,s)},deleteUserProfile({userToken:e},t){if(!e)throw new Error("Parameter `userToken` is required when calling `deleteUserProfile`.");const r={method:"DELETE",path:"/1/profiles/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)},getPersonalizationStrategy(e){const t={method:"GET",path:"/1/strategies/personalization",queryParameters:{},headers:{}};return i.request(t,e)},getUserTokenProfile({userToken:e},t){if(!e)throw new Error("Parameter `userToken` is required when calling `getUserTokenProfile`.");const r={method:"GET",path:"/1/profiles/personalization/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)},setPersonalizationStrategy(e,t){if(!e)throw new Error("Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.");if(!e.eventScoring)throw new Error("Parameter `personalizationStrategyParams.eventScoring` is required when calling `setPersonalizationStrategy`.");if(!e.facetScoring)throw new Error("Parameter `personalizationStrategyParams.facetScoring` is required when calling `setPersonalizationStrategy`.");if(!e.personalizationImpact)throw new Error("Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.");const r={method:"POST",path:"/1/strategies/personalization",queryParameters:{},headers:{},data:e};return i.request(r,t)}}}({appId:e,apiKey:a,region:o,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 o;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===o&&(clearTimeout(a),o=s(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(a),clearTimeout(o),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(a),clearTimeout(o),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:`${P}-${e}`}),s()]}),...n})}}));
@@ -63,7 +63,7 @@ export type CustomPutProps = {
63
63
  */
64
64
  export type DeleteUserProfileProps = {
65
65
  /**
66
- * UserToken representing the user for which to fetch the Personalization profile.
66
+ * Unique identifier representing a user for which to fetch the personalization profile.
67
67
  */
68
68
  userToken: string;
69
69
  };
@@ -72,7 +72,7 @@ export type DeleteUserProfileProps = {
72
72
  */
73
73
  export type GetUserTokenProfileProps = {
74
74
  /**
75
- * UserToken representing the user for which to fetch the Personalization profile.
75
+ * Unique identifier representing a user for which to fetch the personalization profile.
76
76
  */
77
77
  userToken: string;
78
78
  };
@@ -1,10 +1,10 @@
1
1
  export type DeleteUserProfileResponse = {
2
2
  /**
3
- * UserToken representing the user for which to fetch the Personalization profile.
3
+ * Unique pseudonymous or anonymous user identifier. This helps with analytics and click and conversion events. For more information, see [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/).
4
4
  */
5
5
  userToken: string;
6
6
  /**
7
- * A date until which the data can safely be considered as deleted for the given user. Any data received after the `deletedUntil` date will start building a new user profile.
7
+ * Date and time when the user profile can be safely considered to be deleted. Any events received after the `deletedUntil` date start a new user profile.
8
8
  */
9
9
  deletedUntil: string;
10
10
  };
@@ -1,15 +1,13 @@
1
+ import type { EventType } from './eventType';
1
2
  export type EventScoring = {
2
3
  /**
3
- * The score for the event.
4
+ * Event score.
4
5
  */
5
6
  score: number;
6
7
  /**
7
- * The name of the event.
8
+ * Event name.
8
9
  */
9
10
  eventName: string;
10
- /**
11
- * The type of the event.
12
- */
13
- eventType: string;
11
+ eventType: EventType;
14
12
  };
15
13
  //# sourceMappingURL=eventScoring.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"eventScoring.d.ts","sourceRoot":"","sources":["../../model/eventScoring.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
1
+ {"version":3,"file":"eventScoring.d.ts","sourceRoot":"","sources":["../../model/eventScoring.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Event type.
3
+ */
4
+ export type EventType = 'click' | 'conversion' | 'view';
5
+ //# sourceMappingURL=eventType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eventType.d.ts","sourceRoot":"","sources":["../../model/eventType.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,YAAY,GAAG,MAAM,CAAC"}
@@ -1,10 +1,10 @@
1
1
  export type FacetScoring = {
2
2
  /**
3
- * The score for the event.
3
+ * Event score.
4
4
  */
5
5
  score: number;
6
6
  /**
7
- * The name of the facet.
7
+ * Facet attribute name.
8
8
  */
9
9
  facetName: string;
10
10
  };
@@ -1,14 +1,14 @@
1
1
  export type GetUserTokenResponse = {
2
2
  /**
3
- * UserToken representing the user for which to fetch the Personalization profile.
3
+ * Unique pseudonymous or anonymous user identifier. This helps with analytics and click and conversion events. For more information, see [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/).
4
4
  */
5
5
  userToken: string;
6
6
  /**
7
- * Date of last event update. (ISO-8601 format).
7
+ * Date and time of the last event from this user, in RFC 3339 format.
8
8
  */
9
9
  lastEventAt: string;
10
10
  /**
11
- * The userToken scores.
11
+ * Scores for different facet values. Scores represent the user affinity for a user profile towards specific facet values, given the personalization strategy and past events.
12
12
  */
13
13
  scores: Record<string, any>;
14
14
  };
@@ -1,6 +1,7 @@
1
1
  export * from './deleteUserProfileResponse';
2
2
  export * from './errorBase';
3
3
  export * from './eventScoring';
4
+ export * from './eventType';
4
5
  export * from './facetScoring';
5
6
  export * from './getUserTokenResponse';
6
7
  export * from './personalizationStrategyParams';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../model/index.ts"],"names":[],"mappings":"AAEA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,iCAAiC,CAAC;AAChD,cAAc,sCAAsC,CAAC;AACrD,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../model/index.ts"],"names":[],"mappings":"AAEA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,iCAAiC,CAAC;AAChD,cAAc,sCAAsC,CAAC;AACrD,cAAc,qBAAqB,CAAC"}
@@ -2,15 +2,15 @@ import type { EventScoring } from './eventScoring';
2
2
  import type { FacetScoring } from './facetScoring';
3
3
  export type PersonalizationStrategyParams = {
4
4
  /**
5
- * Scores associated with the events.
5
+ * Scores associated with each event. The higher the scores, the higher the impact of those events on the personalization of search results.
6
6
  */
7
7
  eventScoring: EventScoring[];
8
8
  /**
9
- * Scores associated with the facets.
9
+ * Scores associated with each facet. The higher the scores, the higher the impact of those events on the personalization of search results.
10
10
  */
11
11
  facetScoring: FacetScoring[];
12
12
  /**
13
- * The impact that personalization has on search results: a number between 0 (personalization disabled) and 100 (personalization fully enabled).
13
+ * Impact of personalization on the search results. If set to 0, personalization has no impact on the search results.
14
14
  */
15
15
  personalizationImpact: number;
16
16
  };
@@ -4,7 +4,7 @@ import type { DeleteUserProfileResponse } from '../model/deleteUserProfileRespon
4
4
  import type { GetUserTokenResponse } from '../model/getUserTokenResponse';
5
5
  import type { PersonalizationStrategyParams } from '../model/personalizationStrategyParams';
6
6
  import type { SetPersonalizationStrategyResponse } from '../model/setPersonalizationStrategyResponse';
7
- export declare const apiClientVersion = "5.0.0-alpha.111";
7
+ export declare const apiClientVersion = "5.0.0-alpha.112";
8
8
  export declare const REGIONS: readonly ["eu", "us"];
9
9
  export type Region = (typeof REGIONS)[number];
10
10
  export declare function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & {
@@ -69,18 +69,18 @@ export declare function createPersonalizationClient({ appId: appIdOption, apiKey
69
69
  */
70
70
  customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, any>>;
71
71
  /**
72
- * Delete the user profile and all its associated data. Returns, as part of the response, a date until which the data can safely be considered as deleted for the given user. This means if you send events for the given user before this date, they will be ignored. Any data received after the deletedUntil date will start building a new user profile. It might take a couple hours for the deletion request to be fully processed.
72
+ * Deletes a user profile. The response includes a date and time when the user profile can safely be considered deleted.
73
73
  *
74
74
  * Required API Key ACLs:
75
75
  * - recommendation.
76
76
  *
77
77
  * @param deleteUserProfile - The deleteUserProfile object.
78
- * @param deleteUserProfile.userToken - UserToken representing the user for which to fetch the Personalization profile.
78
+ * @param deleteUserProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
79
79
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
80
80
  */
81
81
  deleteUserProfile({ userToken }: DeleteUserProfileProps, requestOptions?: RequestOptions): Promise<DeleteUserProfileResponse>;
82
82
  /**
83
- * The strategy contains information on the events and facets that impact user profiles and personalized search results.
83
+ * Retrieves the current personalization strategy.
84
84
  *
85
85
  * Required API Key ACLs:
86
86
  * - recommendation.
@@ -89,18 +89,18 @@ export declare function createPersonalizationClient({ appId: appIdOption, apiKey
89
89
  */
90
90
  getPersonalizationStrategy(requestOptions?: RequestOptions): Promise<PersonalizationStrategyParams>;
91
91
  /**
92
- * Get the user profile built from Personalization strategy. The profile is structured by facet name used in the strategy. Each facet value is mapped to its score. Each score represents the user affinity for a specific facet value given the userToken past events and the Personalization strategy defined. Scores are bounded to 20. The last processed event timestamp is provided using the ISO 8601 format for debugging purposes.
92
+ * Retrieves a user profile and their affinities for different facets.
93
93
  *
94
94
  * Required API Key ACLs:
95
95
  * - recommendation.
96
96
  *
97
97
  * @param getUserTokenProfile - The getUserTokenProfile object.
98
- * @param getUserTokenProfile.userToken - UserToken representing the user for which to fetch the Personalization profile.
98
+ * @param getUserTokenProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
99
99
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
100
100
  */
101
101
  getUserTokenProfile({ userToken }: GetUserTokenProfileProps, requestOptions?: RequestOptions): Promise<GetUserTokenResponse>;
102
102
  /**
103
- * A strategy defines the events and facets that impact user profiles and personalized search results.
103
+ * Creates a new personalization strategy.
104
104
  *
105
105
  * Required API Key ACLs:
106
106
  * - recommendation.
@@ -69,7 +69,7 @@ export type CustomPutProps = {
69
69
  */
70
70
  export type DeleteUserProfileProps = {
71
71
  /**
72
- * UserToken representing the user for which to fetch the Personalization profile.
72
+ * Unique identifier representing a user for which to fetch the personalization profile.
73
73
  */
74
74
  userToken: string;
75
75
  };
@@ -79,7 +79,7 @@ export type DeleteUserProfileProps = {
79
79
  */
80
80
  export type GetUserTokenProfileProps = {
81
81
  /**
82
- * UserToken representing the user for which to fetch the Personalization profile.
82
+ * Unique identifier representing a user for which to fetch the personalization profile.
83
83
  */
84
84
  userToken: string;
85
85
  };
@@ -2,12 +2,12 @@
2
2
 
3
3
  export type DeleteUserProfileResponse = {
4
4
  /**
5
- * UserToken representing the user for which to fetch the Personalization profile.
5
+ * Unique pseudonymous or anonymous user identifier. This helps with analytics and click and conversion events. For more information, see [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/).
6
6
  */
7
7
  userToken: string;
8
8
 
9
9
  /**
10
- * A date until which the data can safely be considered as deleted for the given user. Any data received after the `deletedUntil` date will start building a new user profile.
10
+ * Date and time when the user profile can be safely considered to be deleted. Any events received after the `deletedUntil` date start a new user profile.
11
11
  */
12
12
  deletedUntil: string;
13
13
  };
@@ -1,18 +1,17 @@
1
1
  // 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.
2
2
 
3
+ import type { EventType } from './eventType';
4
+
3
5
  export type EventScoring = {
4
6
  /**
5
- * The score for the event.
7
+ * Event score.
6
8
  */
7
9
  score: number;
8
10
 
9
11
  /**
10
- * The name of the event.
12
+ * Event name.
11
13
  */
12
14
  eventName: string;
13
15
 
14
- /**
15
- * The type of the event.
16
- */
17
- eventType: string;
16
+ eventType: EventType;
18
17
  };
@@ -0,0 +1,6 @@
1
+ // 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.
2
+
3
+ /**
4
+ * Event type.
5
+ */
6
+ export type EventType = 'click' | 'conversion' | 'view';
@@ -2,12 +2,12 @@
2
2
 
3
3
  export type FacetScoring = {
4
4
  /**
5
- * The score for the event.
5
+ * Event score.
6
6
  */
7
7
  score: number;
8
8
 
9
9
  /**
10
- * The name of the facet.
10
+ * Facet attribute name.
11
11
  */
12
12
  facetName: string;
13
13
  };
@@ -2,17 +2,17 @@
2
2
 
3
3
  export type GetUserTokenResponse = {
4
4
  /**
5
- * UserToken representing the user for which to fetch the Personalization profile.
5
+ * Unique pseudonymous or anonymous user identifier. This helps with analytics and click and conversion events. For more information, see [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/).
6
6
  */
7
7
  userToken: string;
8
8
 
9
9
  /**
10
- * Date of last event update. (ISO-8601 format).
10
+ * Date and time of the last event from this user, in RFC 3339 format.
11
11
  */
12
12
  lastEventAt: string;
13
13
 
14
14
  /**
15
- * The userToken scores.
15
+ * Scores for different facet values. Scores represent the user affinity for a user profile towards specific facet values, given the personalization strategy and past events.
16
16
  */
17
17
  scores: Record<string, any>;
18
18
  };
package/model/index.ts CHANGED
@@ -3,6 +3,7 @@
3
3
  export * from './deleteUserProfileResponse';
4
4
  export * from './errorBase';
5
5
  export * from './eventScoring';
6
+ export * from './eventType';
6
7
  export * from './facetScoring';
7
8
  export * from './getUserTokenResponse';
8
9
  export * from './personalizationStrategyParams';
@@ -5,17 +5,17 @@ import type { FacetScoring } from './facetScoring';
5
5
 
6
6
  export type PersonalizationStrategyParams = {
7
7
  /**
8
- * Scores associated with the events.
8
+ * Scores associated with each event. The higher the scores, the higher the impact of those events on the personalization of search results.
9
9
  */
10
10
  eventScoring: EventScoring[];
11
11
 
12
12
  /**
13
- * Scores associated with the facets.
13
+ * Scores associated with each facet. The higher the scores, the higher the impact of those events on the personalization of search results.
14
14
  */
15
15
  facetScoring: FacetScoring[];
16
16
 
17
17
  /**
18
- * The impact that personalization has on search results: a number between 0 (personalization disabled) and 100 (personalization fully enabled).
18
+ * Impact of personalization on the search results. If set to 0, personalization has no impact on the search results.
19
19
  */
20
20
  personalizationImpact: number;
21
21
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@algolia/client-personalization",
3
- "version": "5.0.0-alpha.111",
3
+ "version": "5.0.0-alpha.112",
4
4
  "description": "JavaScript client for client-personalization",
5
5
  "repository": "algolia/algoliasearch-client-javascript",
6
6
  "license": "MIT",
@@ -39,14 +39,14 @@
39
39
  "clean": "rm -rf ./dist || true"
40
40
  },
41
41
  "dependencies": {
42
- "@algolia/client-common": "5.0.0-alpha.112",
43
- "@algolia/requester-browser-xhr": "5.0.0-alpha.112",
44
- "@algolia/requester-node-http": "5.0.0-alpha.112"
42
+ "@algolia/client-common": "5.0.0-alpha.113",
43
+ "@algolia/requester-browser-xhr": "5.0.0-alpha.113",
44
+ "@algolia/requester-node-http": "5.0.0-alpha.113"
45
45
  },
46
46
  "devDependencies": {
47
- "@types/node": "20.12.5",
48
- "rollup": "4.14.0",
49
- "typescript": "5.4.4"
47
+ "@types/node": "20.12.7",
48
+ "rollup": "4.14.2",
49
+ "typescript": "5.4.5"
50
50
  },
51
51
  "engines": {
52
52
  "node": ">= 14.0.0"