PageSourceSearch

https://pangaia.com/cdn/shop/t/1551/assets/get-custom-recommendations-e86db0aa.js

js pangaia.com collected 2026-09-24 17:34:28 UTC 1,899 bytes, 1 lines download raw bytes

1import{f as g}from"./fetchClient-9c476553.js";import{K as s}from"./KlevuTypeOfRecord-2906fd5a.js";import"./fetchWithRetry-e2da8d4b.js";const m=(c,e)=>{const t=window.env.KLEVU_API_KEY,r=new URL(`https://config-cdn.ksearchnet.com/recommendations/${t}/settings/${c}`);return e!=null&&e.categoryPath&&r.searchParams.append("cp",e.categoryPath),e!=null&&e.currentProductId?r.searchParams.append("pid",e.currentProductId):e!=null&&e.cartVariantsIds&&e.cartVariantsIds.length>0&&r.searchParams.append("pid",e.cartVariantsIds[0]),e!=null&&e.itemGroupId?r.searchParams.append("gpid",e.itemGroupId):e!=null&&e.cartProductsIds&&e.cartProductsIds.length>0&&r.searchParams.append("gpid",e.cartProductsIds[0]),r.toString()},n=(c,e)=>{const t=c.map(r=>({...r,id:(e==null?void 0:e.id)??"kmcrecommendation"}));if(e!=null&&e.categoryPath)for(const r of t)r.settings||(r.settings={}),r.settings.query||(r.settings.query={}),r.settings.query.categoryPath=e.categoryPath;if(e!=null&&e.currentProductId)for(const r of t)r.settings||(r.settings={}),r.settings.context||(r.settings.context={}),e.itemGroupId&&(r.settings.excludeIds=[{key:"itemGroupId",value:e.itemGroupId}]),r.settings.context.recentObjects=[{typeOfRecord:s.Product,records:[{id:e.currentProductId}]}];if(e!=null&&e.cartVariantsIds)for(const r of t)r.settings||(r.settings={}),r.settings.context||(r.settings.context={}),e.cartProductsIds&&(r.settings.excludeIds=e.cartProductsIds.map(a=>({key:"itemGroupId",value:a}))),r.settings.context.recentObjects=[{typeOfRecord:s.Product,records:e.cartVariantsIds.map(a=>({id:a}))}];return t},P=async(c,e)=>{try{const t=m(c,e),r=await fetch(t),a=await new Response(r.body).text(),u=JSON.parse(a),f=JSON.parse(u.search.payload),d=n(f.recordQueries,e);return{klevuResponse:await g(d),typeOfRequest:d[0].typeOfRequest}}catch(t){return console.error("Error fetching Klevu KMC recommendations",t),null}};export{P as g};

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.