import{REGISTRY_APIS_API_URL as t}from"../../constants/common.js";import{logger as o}from"../../tools/notifiers/logger.js";const a=async(p,e,r)=>{if(!r.variables?.idpAccessToken)return o.warnProd("Cannot fetch custom fields: access token not found"),e.props||{};if(!t)return o.warnProd("Cannot fetch custom fields: API URL not found in env"),e.props||{};const n={};try{const s=await fetch(t+"?limit=2000",{headers:{Cookie:`accessToken=${r.variables.idpAccessToken}`}});if(s.status!==200)return o.warnProd(`Failed to fetch custom fields. API response status: ${s.status}. Request URL: ${t}`),e.props||{};const i=await s.json();for(const c of i.items)n[c.contentPath]=c.customFields||{}}catch(s){o.warnProd("Failed to fetch custom fields: "+s.message)}return{...e.props,customFields:n}};var d=a;export{d as default};
