import{REGISTRY_APIS_API_URL as t}from"../../constants/common.js";import{logger as o}from"../../utils/index.js";async function a(f,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 c=await s.json();for(const i of c.items)n[i.contentPath]=i.customFields||{}}catch(s){o.warnProd("Failed to fetch custom fields: "+s.message)}return{...e.props,customFields:n}}export{a as default};
