@algolia/recommend-core
Advanced tools
Comparing version 1.8.2 to 1.9.0
export * from './getFrequentlyBoughtTogether'; | ||
export * from './getRecommendations'; | ||
export * from './getRelatedProducts'; | ||
export * from './getLookingSimilar'; | ||
export * from './getTrendingFacets'; | ||
export * from './getTrendingItems'; | ||
export * from './types'; |
export * from './getFrequentlyBoughtTogether'; | ||
export * from './getRecommendations'; | ||
export * from './getRelatedProducts'; | ||
export * from './getLookingSimilar'; | ||
export * from './getTrendingFacets'; | ||
export * from './getTrendingItems'; | ||
export * from './types'; |
@@ -1,1 +0,1 @@ | ||
export declare const version = "1.8.2"; | ||
export declare const version = "1.9.0"; |
@@ -1,1 +0,1 @@ | ||
export const version = '1.8.2'; | ||
export const version = '1.9.0'; |
@@ -1,3 +0,3 @@ | ||
/*! @algolia/recommend-core 1.8.2 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/recommend */ | ||
!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/recommend-core"]={})}(this,(function(e){"use strict";function t({hits:e,maxRecommendations:t,nrOfObjs:n}){const o={};e.forEach((e=>{e.forEach(((e,t)=>{o[e.objectID]?o[e.objectID]={indexSum:o[e.objectID].indexSum+t,nr:o[e.objectID].nr+1}:o[e.objectID]={indexSum:t,nr:1}}))}));const a=((e,t)=>{const n=[];for(const o of Object.keys(e))e[o].nr<2&&(e[o].indexSum+=100),n.push({objectID:o,avgOfIndices:e[o].indexSum/t});return n.sort(((e,t)=>e.avgOfIndices>t.avgOfIndices?1:-1))})(o,n);return a.reduce(((t,n)=>{const o=e.flat().find((e=>e.objectID===n.objectID));return o?t.concat(o):t}),[]).slice(0,t&&t>0?t:void 0)}function n({hits:e,maxRecommendations:t}){return function(e,t){const n=[...t];return n.sort(e),n}(((e,t)=>(e._score||0)>(t._score||0)?-1:1),e).slice(0,t&&t>0?t:void 0)}const o="1.8.2";e.getFrequentlyBoughtTogether=function({objectIDs:e,recommendClient:n,transformItems:a=(e=>e),indexName:m,maxRecommendations:r,queryParameters:s,threshold:c}){const d=e.map((e=>({indexName:m,maxRecommendations:r,objectID:e,queryParameters:s,threshold:c})));return n.addAlgoliaAgent("recommend-core",o),n.getFrequentlyBoughtTogether(d).then((n=>t({maxRecommendations:r,hits:n.results.map((e=>e.hits)),nrOfObjs:e.length}))).then((e=>({recommendations:a(e)})))},e.getRecommendations=function({objectIDs:e,recommendClient:n,transformItems:a=(e=>e),fallbackParameters:m,indexName:r,maxRecommendations:s,model:c,queryParameters:d,threshold:i}){const l=e.map((e=>({fallbackParameters:m,indexName:r,maxRecommendations:s,model:c,objectID:e,queryParameters:d,threshold:i})));return n.addAlgoliaAgent("recommend-core",o),n.getRecommendations(l).then((n=>t({maxRecommendations:s,hits:n.results.map((e=>e.hits)),nrOfObjs:e.length}))).then((e=>({recommendations:a(e)})))},e.getRelatedProducts=function({objectIDs:e,recommendClient:n,transformItems:a=(e=>e),fallbackParameters:m,indexName:r,maxRecommendations:s,queryParameters:c,threshold:d}){const i=e.map((e=>({fallbackParameters:m,indexName:r,maxRecommendations:s,objectID:e,queryParameters:c,threshold:d})));return n.addAlgoliaAgent("recommend-core",o),n.getRelatedProducts(i).then((n=>t({maxRecommendations:s,hits:n.results.map((e=>e.hits)),nrOfObjs:e.length}))).then((e=>({recommendations:a(e)})))},e.getTrendingFacets=function({recommendClient:e,transformItems:t=(e=>e),indexName:a,maxRecommendations:m,threshold:r,facetName:s}){const c={indexName:a,maxRecommendations:m,threshold:r,facetName:s};return e.addAlgoliaAgent("recommend-core",o),e.getTrendingFacets([c]).then((e=>n({maxRecommendations:m,hits:e.results.map((e=>e.hits)).flat()}))).then((e=>({recommendations:t(e)})))},e.getTrendingItems=function({recommendClient:e,transformItems:t=(e=>e),fallbackParameters:a,indexName:m,maxRecommendations:r,queryParameters:s,threshold:c,facetName:d,facetValue:i}){const l={fallbackParameters:a,indexName:m,maxRecommendations:r,queryParameters:s,threshold:c,facetName:d,facetValue:i};return e.addAlgoliaAgent("recommend-core",o),e.getTrendingItems([l]).then((e=>{return n({maxRecommendations:r,hits:(t="objectID",o=e.results.map((e=>e.hits)).flat(),[...new Map(o.map((e=>[e[t],e]))).values()])});var t,o})).then((e=>({recommendations:t(e)})))}})); | ||
/*! @algolia/recommend-core 1.9.0 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/recommend */ | ||
!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/recommend-core"]={})}(this,(function(e){"use strict";function t({hits:e,maxRecommendations:t,nrOfObjs:n}){const o={};e.forEach((e=>{e.forEach(((e,t)=>{o[e.objectID]?o[e.objectID]={indexSum:o[e.objectID].indexSum+t,nr:o[e.objectID].nr+1}:o[e.objectID]={indexSum:t,nr:1}}))}));const a=((e,t)=>{const n=[];for(const o of Object.keys(e))e[o].nr<2&&(e[o].indexSum+=100),n.push({objectID:o,avgOfIndices:e[o].indexSum/t});return n.sort(((e,t)=>e.avgOfIndices>t.avgOfIndices?1:-1))})(o,n);return a.reduce(((t,n)=>{const o=e.flat().find((e=>e.objectID===n.objectID));return o?t.concat(o):t}),[]).slice(0,t&&t>0?t:void 0)}function n({hits:e,maxRecommendations:t}){return function(e,t){const n=[...t];return n.sort(e),n}(((e,t)=>(e._score||0)>(t._score||0)?-1:1),e).slice(0,t&&t>0?t:void 0)}const o="1.9.0";e.getFrequentlyBoughtTogether=function({objectIDs:e,recommendClient:n,transformItems:a=(e=>e),indexName:m,maxRecommendations:r,queryParameters:s,threshold:c}){const i=e.map((e=>({indexName:m,maxRecommendations:r,objectID:e,queryParameters:s,threshold:c})));return n.addAlgoliaAgent("recommend-core",o),n.getFrequentlyBoughtTogether(i).then((n=>t({maxRecommendations:r,hits:n.results.map((e=>e.hits)),nrOfObjs:e.length}))).then((e=>({recommendations:a(e)})))},e.getLookingSimilar=function({objectIDs:e,recommendClient:n,transformItems:a=(e=>e),fallbackParameters:m,indexName:r,maxRecommendations:s,queryParameters:c,threshold:i}){const d=e.map((e=>({fallbackParameters:m,indexName:r,maxRecommendations:s,objectID:e,queryParameters:c,threshold:i})));return n.addAlgoliaAgent("recommend-core",o),n.getLookingSimilar(d).then((n=>t({maxRecommendations:s,hits:n.results.map((e=>e.hits)),nrOfObjs:e.length}))).then((e=>({recommendations:a(e)})))},e.getRecommendations=function({objectIDs:e,recommendClient:n,transformItems:a=(e=>e),fallbackParameters:m,indexName:r,maxRecommendations:s,model:c,queryParameters:i,threshold:d}){const l=e.map((e=>({fallbackParameters:m,indexName:r,maxRecommendations:s,model:c,objectID:e,queryParameters:i,threshold:d})));return n.addAlgoliaAgent("recommend-core",o),n.getRecommendations(l).then((n=>t({maxRecommendations:s,hits:n.results.map((e=>e.hits)),nrOfObjs:e.length}))).then((e=>({recommendations:a(e)})))},e.getRelatedProducts=function({objectIDs:e,recommendClient:n,transformItems:a=(e=>e),fallbackParameters:m,indexName:r,maxRecommendations:s,queryParameters:c,threshold:i}){const d=e.map((e=>({fallbackParameters:m,indexName:r,maxRecommendations:s,objectID:e,queryParameters:c,threshold:i})));return n.addAlgoliaAgent("recommend-core",o),n.getRelatedProducts(d).then((n=>t({maxRecommendations:s,hits:n.results.map((e=>e.hits)),nrOfObjs:e.length}))).then((e=>({recommendations:a(e)})))},e.getTrendingFacets=function({recommendClient:e,transformItems:t=(e=>e),indexName:a,maxRecommendations:m,threshold:r,facetName:s}){const c={indexName:a,maxRecommendations:m,threshold:r,facetName:s};return e.addAlgoliaAgent("recommend-core",o),e.getTrendingFacets([c]).then((e=>n({maxRecommendations:m,hits:e.results.map((e=>e.hits)).flat()}))).then((e=>({recommendations:t(e)})))},e.getTrendingItems=function({recommendClient:e,transformItems:t=(e=>e),fallbackParameters:a,indexName:m,maxRecommendations:r,queryParameters:s,threshold:c,facetName:i,facetValue:d}){const l={fallbackParameters:a,indexName:m,maxRecommendations:r,queryParameters:s,threshold:c,facetName:i,facetValue:d};return e.addAlgoliaAgent("recommend-core",o),e.getTrendingItems([l]).then((e=>{return n({maxRecommendations:r,hits:(t="objectID",o=e.results.map((e=>e.hits)).flat(),[...new Map(o.map((e=>[e[t],e]))).values()])});var t,o})).then((e=>({recommendations:t(e)})))}})); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@algolia/recommend-core", | ||
"version": "1.8.2", | ||
"version": "1.9.0", | ||
"license": "MIT", | ||
@@ -31,3 +31,3 @@ "homepage": "https://github.com/algolia/recommend", | ||
"peerDependencies": { | ||
"@algolia/recommend": "^4.14.3" | ||
"@algolia/recommend": "^4.19.1" | ||
}, | ||
@@ -34,0 +34,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39201
52
440