PageSourceSearch

https://www.lyleandscott.com/cdn/shop/t/458/assets/algolia-recommendations.js?v=89549844892896911331788772181

js lyleandscott.com collected 2026-09-24 22:59:46 UTC 1,817 bytes, 2 lines download raw bytes

1export async function fetchProductRecommendations(algolia,settings,signal){const{appId,apiKey,indexName,defaultFilters=""}=algolia||{};if(!settings?.enabled||!appId||!apiKey||!indexName)return[];const productIds=(settings.productIds||[]).map(id=>String(id||"").trim()).filter(Boolean),rules=(settings.rules||[]).map(rule=>String(rule||"").trim()).filter(Boolean),filters=[String(settings.queryFilters||"").trim(),defaultFilters].filter(Boolean).join(" AND "),fallbackFilters=String(settings.fallbackFilters||"").trim(),requests=(settings.type==="trending-items"?[null]:productIds).map(objectID=>({indexName,model:settings.type,threshold:Number(settings.threshold)||0,maxRecommendations:20,...objectID?{objectID}:{},queryParameters:{clickAnalytics:!0,filters,...rules.length?{ruleContexts:rules}:{}},...fallbackFilters?{fallbackParameters:{filters:fallbackFilters}}:{}}));if(!requests.length)return[];const response=await fetch(`https://${appId}.algolia.net/1/indexes/*/recommendations`,{method:"POST",signal,headers:{"Content-Type":"application/json","x-algolia-api-key":apiKey,"x-algolia-application-id":appId},body:JSON.stringify({requests})});if(!response.ok)return[];const{results=[]}=await response.json(),products=[],excluded=new Set(settings.cartHandles||[]),max=Number(settings.max)||4,length=Math.max(0,...results.map(result=>result.hits?.length||0));for(let index=0;index<length&&products.length<max;index++)for(const result of[...results].reverse()){const hit=result.hits?.[index];if(!(!hit?.handle||excluded.has(hit.handle))&&(excluded.add(hit.handle),products.push({...hit,__indexName:indexName,__queryID:result.queryID,__position:products.length+1}),products.length===max))break}return products}
2//# sourceMappingURL=/cdn/shop/t/458/assets/algolia-recommendations.js.map?v=89549844892896911331788772181

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.