@kizenapps/cli 1.13.0 → 1.14.0-cf33224

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/README.md +11 -238
  2. package/dist/index.js +164 -806
  3. package/dist/index.js.map +1 -1
  4. package/dist/viewer/assets/{AppDetailPage-CsAJGeXG.js → AppDetailPage-CGrukEIj.js} +1 -1
  5. package/dist/viewer/assets/CodeStepsPage-Cu9UiRy9.js +1 -0
  6. package/dist/viewer/assets/{ConfigurationPage-DUiOAiMK.js → ConfigurationPage-CI0pRNJ0.js} +1 -1
  7. package/dist/viewer/assets/CredentialsContext-Cwl_xyt_.js +1 -0
  8. package/dist/viewer/assets/{DevSidebar-CkLpkWSy.js → DevSidebar-BFsoIbMt.js} +1 -1
  9. package/dist/viewer/assets/{SandboxPage-D3Qdh_0M.js → SandboxPage-Dyb8i7vf.js} +1 -1
  10. package/dist/viewer/assets/{SecretsPage-CQVPedWl.js → SecretsPage-g2FF7d-B.js} +1 -1
  11. package/dist/viewer/assets/{WhenBadge-CV5t88Iv.js → WhenBadge-DKz8ukwo.js} +1 -1
  12. package/dist/viewer/assets/api--pW2v3sH.js +11 -0
  13. package/dist/viewer/assets/{bootstrapQuery-WnoB2iya.js → bootstrapQuery-DTAPKOf-.js} +1 -1
  14. package/dist/viewer/assets/index-GvAPdgKb.js +5 -0
  15. package/dist/viewer/assets/{useCompleteSetup-BgC9V-FN.js → useCompleteSetup-QS3W9RRO.js} +4 -4
  16. package/dist/viewer/assets/{usePluginConfig-mg5WevIz.js → usePluginConfig--4sAyik4.js} +1 -1
  17. package/dist/viewer/index.html +4 -4
  18. package/package.json +20 -26
  19. package/dist/index.css +0 -2
  20. package/dist/index.css.map +0 -1
  21. package/dist/viewer/assets/CodeStepsPage-Dd84cmbe.js +0 -1
  22. package/dist/viewer/assets/CredentialsContext-p3i8s7a6.js +0 -1
  23. package/dist/viewer/assets/api-C4R44YCL.js +0 -11
  24. package/dist/viewer/assets/index-B1r1yKD-.js +0 -5
@@ -1 +1 @@
1
- import{F as e}from"./fa-core-BSqLAjHu.js";import{t}from"./useParams-D3awshYI.js";import{t as n}from"./useQuery-JKMI40WO.js";import{t as r}from"./bundleQuery-BE1Gb8Ii.js";import{t as i}from"./Card-Sa52PGkn.js";import{n as a,t as o}from"./blockDimensions-BhWxVVcK.js";import{n as s,t as c}from"./setupAssistant-DtI9NWXr.js";import{t as l}from"./formatBytes-BXYIMbyB.js";var u=e(),d=({title:e,config:t})=>{let n=s(t),r=t.fields??[];return(0,u.jsxs)(i,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:e}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:n===void 0?r.length:`view`})]}),n===void 0?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Field`}),(0,u.jsx)(`span`,{className:`shrink-0`,children:`Type`})]}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:r.map((e,t)=>(0,u.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-neutral-900`,children:`label`in e?e.label??e.key:e.type}),(0,u.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 font-mono text-[10px] text-neutral-500`,children:e.type})]},t))})]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`div`,{className:`mb-1 text-[10px] text-neutral-400`,children:`View`}),(0,u.jsx)(`div`,{className:`truncate py-1.5 font-mono text-[11px] text-neutral-900`,children:n}),(0,u.jsx)(`p`,{className:`m-0 mt-1 text-[12px] text-neutral-400`,children:`This assistant declares no fields. The view renders setup and saves its own config.`})]})]})},f=()=>{let{apiName:e}=t({strict:!1}),{data:s,isLoading:f,isError:p}=n(r);if(f)return(0,u.jsx)(i,{children:(0,u.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(p)return(0,u.jsx)(i,{children:(0,u.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});let m=s?.find(t=>t.api_name===e);if(!m)return(0,u.jsx)(i,{children:(0,u.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,u.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:e}),`.`]})});let{floating_frames:h,data_adornments:g,routable_pages:_,toolbar_items:v,js_action_templates:y,route_scripts:b,object_settings_menu_items:x,automation_action_configs:S,calendar_sources:C,custom_blocks:w}=m.artifacts,T=h.length>0||g.length>0||_.length>0||v.length>0||y.length>0||b.length>0||x.length>0||S.length>0||C.length>0||w.length>0,E=s?new TextEncoder().encode(JSON.stringify(s,null,2)).length:null,D=m.base_config,O=D?.setup_assistant,k=D?.user_setup_assistant,A=c(O),j=c(k);return(0,u.jsxs)(`div`,{className:`space-y-4 text-[13px]`,children:[(0,u.jsx)(i,{children:(0,u.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`h1`,{className:`text-lg font-bold leading-tight text-neutral-900`,children:m.name}),(0,u.jsx)(`p`,{className:`mt-0.5 font-mono text-[11px] text-neutral-400`,children:m.api_name})]}),m.description&&(0,u.jsx)(`p`,{className:`text-[13px] leading-relaxed text-neutral-600`,children:m.description}),(0,u.jsxs)(`div`,{className:`divide-y divide-black/5`,children:[m.version&&(0,u.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,u.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-neutral-600`,children:[`v`,m.version]}),(0,u.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`App version`})]}),m.engine&&(0,u.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,u.jsxs)(`span`,{className:`shrink-0 rounded bg-blue-50 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-blue-600`,children:[`engine: `,m.engine]}),(0,u.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Plugin engine version`})]}),(0,u.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,u.jsx)(`span`,{className:`shrink-0 rounded px-2 py-0.5 text-[11px] font-semibold tracking-wide ${m.published?`bg-green-100 text-green-700`:`bg-neutral-100 text-neutral-500`}`,children:m.published?`published`:`unpublished`}),(0,u.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Whether this app is publicly available`})]}),m.release_environments?.map(e=>(0,u.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,u.jsx)(`span`,{className:`shrink-0 rounded bg-violet-50 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-violet-600`,children:e}),(0,u.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Release environment`})]},e)),m.block_loading_for_setup&&(0,u.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,u.jsx)(`span`,{className:`shrink-0 rounded bg-amber-100 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-amber-700`,children:`blocks app loading`}),(0,u.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Whether this app blocks loading of Kizen UI until resources are fetched and processed`})]}),m.developer_business_id&&(typeof m.developer_business_id==`string`?(0,u.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,u.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-2 py-0.5 font-mono text-[11px] tracking-wide text-neutral-500`,children:[`biz: `,m.developer_business_id]}),(0,u.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Developer business ID`})]}):Object.entries(m.developer_business_id).map(([e,t])=>(0,u.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,u.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-2 py-0.5 font-mono text-[11px] tracking-wide text-neutral-500`,children:[`biz (`,e,`): `,t]}),(0,u.jsxs)(`span`,{className:`text-[12px] text-neutral-500`,children:[`Developer business ID (`,e,`)`]})]},e))),E!==null&&(0,u.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,u.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-neutral-600`,children:[`bundle: `,l(E)]}),(0,u.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Total size of bundle.json`})]})]})]})}),T||A||j||m.releaseNotes?(0,u.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3`,children:[h.length>0&&(0,u.jsxs)(i,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Floating Frames`}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:h.length})]}),(0,u.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`}),(0,u.jsx)(`span`,{className:`shrink-0`,children:`Position`})]}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:h.map((e,t)=>(0,u.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,u.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.default_position&&(0,u.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 text-[10px] text-neutral-500`,children:e.default_position})]},t))})]}),g.length>0&&(0,u.jsxs)(i,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Data Adornments`}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:g.length})]}),(0,u.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Field`}),(0,u.jsx)(`span`,{className:`shrink-0`,children:`Type`})]}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:g.map((e,t)=>(0,u.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[e.config.color&&(0,u.jsx)(`span`,{className:`h-3 w-4 shrink-0 rounded-sm border border-black/10`,style:{backgroundColor:e.config.color}}),e.config.icon&&(0,u.jsx)(a,{name:e.config.icon,className:`shrink-0 text-[10px]`}),(0,u.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-neutral-900`,children:e.config.tooltip||e.field_type}),(0,u.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 font-mono text-[10px] text-neutral-500`,children:e.field_type})]},t))})]}),_.length>0&&(0,u.jsxs)(i,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Routable Pages`}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:_.length})]}),(0,u.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Page`}),(0,u.jsx)(`span`,{className:`shrink-0`,children:`Type`})]}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:_.map((e,t)=>(0,u.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,u.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.iframe_url&&(0,u.jsx)(`span`,{className:`shrink-0 rounded bg-purple-100 px-1.5 py-0.5 text-[10px] font-semibold text-purple-600`,children:`iframe`})]},t))})]}),w.length>0&&(0,u.jsxs)(i,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Content Blocks`}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:w.length})]}),(0,u.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Block`}),(0,u.jsx)(`span`,{className:`shrink-0`,children:`Grid (w×h)`})]}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:w.map((e,t)=>{let n=o(e);return(0,u.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,u.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),(e.types??[]).map(e=>(0,u.jsx)(`span`,{className:`shrink-0 rounded bg-blue-50 px-1.5 py-0.5 text-[10px] font-semibold text-blue-600`,children:e},e)),(0,u.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 font-mono text-[10px] text-neutral-500`,children:[n.minW,`–`,n.maxW,`×`,n.minH,`–`,n.maxH]})]},t)})})]}),v.length>0&&(0,u.jsxs)(i,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Toolbar Items`}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:v.length})]}),(0,u.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Label`}),(0,u.jsx)(`span`,{className:`shrink-0`,children:`Icon`})]}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:v.map((e,t)=>(0,u.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[e.color&&(0,u.jsx)(`span`,{className:`h-3 w-4 shrink-0 rounded-sm border border-black/10`,style:{backgroundColor:e.color}}),(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.label}),(0,u.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.icon&&(0,u.jsx)(a,{name:e.icon,className:`shrink-0 text-[10px]`})]},t))})]}),y.length>0&&(0,u.jsxs)(i,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`JS Action Templates`}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:y.length})]}),(0,u.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`}),(0,u.jsx)(`span`,{className:`shrink-0`,children:`Object`})]}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:y.map((e,t)=>(0,u.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,u.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.hint_object_name&&(0,u.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 text-[10px] text-neutral-500`,children:e.hint_object_name})]},t))})]}),b.length>0&&(0,u.jsxs)(i,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Route Scripts`}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:b.length})]}),(0,u.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`}),(0,u.jsx)(`span`,{className:`shrink-0`,children:`Routes`})]}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:b.map((e,t)=>(0,u.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name||e.api_name}),e.name&&(0,u.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.routes.length>0&&(0,u.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 text-[10px] text-neutral-500`,children:[e.routes.length,` route`,e.routes.length===1?``:`s`]})]},t))})]}),x.length>0&&(0,u.jsxs)(i,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Object Settings`}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:x.length})]}),(0,u.jsx)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Label`})}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:x.map((e,t)=>(0,u.jsx)(`div`,{className:`flex items-center gap-2 py-1.5`,children:(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.label}),(0,u.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]})},t))})]}),S.length>0&&(0,u.jsxs)(i,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Automation Actions`}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:S.length})]}),(0,u.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`}),(0,u.jsx)(`span`,{className:`shrink-0`,children:`Type`})]}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:S.map((e,t)=>(0,u.jsx)(`div`,{className:`flex items-center gap-2 py-1.5`,children:(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,u.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.action_step_api_name})]})},t))})]}),C.length>0&&(0,u.jsxs)(i,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Calendar Sources`}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:C.length})]}),(0,u.jsx)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`})}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:C.map((e,t)=>(0,u.jsx)(`div`,{className:`flex items-center gap-2 py-1.5`,children:(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,u.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]})},t))})]}),A&&O&&(0,u.jsx)(d,{title:`Setup Assistant`,config:O}),j&&k&&(0,u.jsx)(d,{title:`User Setup Assistant`,config:k}),m.releaseNotes&&(0,u.jsxs)(i,{children:[(0,u.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Release Notes`}),(0,u.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-[12px] leading-relaxed text-neutral-700`,children:m.releaseNotes})]})]}):(0,u.jsx)(i,{children:(0,u.jsx)(`p`,{className:`text-[13px] text-neutral-400`,children:`No plugin assets defined.`})})]})};export{f as AppDetailPage};
1
+ import{F as e}from"./fa-core-BSqLAjHu.js";import{t}from"./useParams-D3awshYI.js";import{t as n}from"./useQuery-JKMI40WO.js";import{t as r}from"./bundleQuery-BE1Gb8Ii.js";import{t as i}from"./Card-Sa52PGkn.js";import{n as a,t as o}from"./blockDimensions-BhWxVVcK.js";import{n as s,t as c}from"./setupAssistant-DtI9NWXr.js";import{t as l}from"./formatBytes-BXYIMbyB.js";var u=e(),d=({title:e,config:t})=>{let n=s(t),r=t.fields??[];return(0,u.jsxs)(i,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:e}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:n===void 0?r.length:`view`})]}),n===void 0?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Field`}),(0,u.jsx)(`span`,{className:`shrink-0`,children:`Type`})]}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:r.map((e,t)=>(0,u.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-neutral-900`,children:`label`in e?e.label??e.key:e.type}),(0,u.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 font-mono text-[10px] text-neutral-500`,children:e.type})]},t))})]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`div`,{className:`mb-1 text-[10px] text-neutral-400`,children:`View`}),(0,u.jsx)(`div`,{className:`truncate py-1.5 font-mono text-[11px] text-neutral-900`,children:n}),(0,u.jsx)(`p`,{className:`m-0 mt-1 text-[12px] text-neutral-400`,children:`This assistant declares no fields. The view renders setup and saves its own config.`})]})]})},f=()=>{let{apiName:e}=t({strict:!1}),{data:s,isLoading:f,isError:p}=n(r);if(f)return(0,u.jsx)(i,{children:(0,u.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(p)return(0,u.jsx)(i,{children:(0,u.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});let m=s?.find(t=>t.api_name===e);if(!m)return(0,u.jsx)(i,{children:(0,u.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,u.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:e}),`.`]})});let{floating_frames:h,data_adornments:g,routable_pages:_,toolbar_items:v,js_action_templates:y,route_scripts:b,object_settings_menu_items:x,automation_action_configs:S,calendar_sources:C,custom_blocks:w}=m.artifacts,T=h.length>0||g.length>0||_.length>0||v.length>0||y.length>0||b.length>0||x.length>0||S.length>0||C.length>0||w.length>0,E=s?new TextEncoder().encode(JSON.stringify(s,null,2)).length:null,D=m.base_config,O=D?.setup_assistant,k=D?.user_setup_assistant,A=c(O),j=c(k);return(0,u.jsxs)(`div`,{className:`space-y-4 text-[13px]`,children:[(0,u.jsx)(i,{children:(0,u.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`h1`,{className:`text-lg font-bold leading-tight text-neutral-900`,children:m.name}),(0,u.jsx)(`p`,{className:`mt-0.5 font-mono text-[11px] text-neutral-400`,children:m.api_name})]}),m.description&&(0,u.jsx)(`p`,{className:`text-[13px] leading-relaxed text-neutral-600`,children:m.description}),(0,u.jsxs)(`div`,{className:`divide-y divide-black/5`,children:[m.version&&(0,u.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,u.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-neutral-600`,children:[`v`,m.version]}),(0,u.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`App version`})]}),m.engine&&(0,u.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,u.jsxs)(`span`,{className:`shrink-0 rounded bg-blue-50 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-blue-600`,children:[`engine: `,m.engine]}),(0,u.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Plugin engine version`})]}),(0,u.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,u.jsx)(`span`,{className:`shrink-0 rounded px-2 py-0.5 text-[11px] font-semibold tracking-wide ${m.published?`bg-green-100 text-green-700`:`bg-neutral-100 text-neutral-500`}`,children:m.published?`published`:`unpublished`}),(0,u.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Whether this app is publicly available`})]}),m.release_environments?.map(e=>(0,u.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,u.jsx)(`span`,{className:`shrink-0 rounded bg-violet-50 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-violet-600`,children:e}),(0,u.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Release environment`})]},e)),m.block_loading_for_setup&&(0,u.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,u.jsx)(`span`,{className:`shrink-0 rounded bg-amber-100 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-amber-700`,children:`blocks app loading`}),(0,u.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Whether this app blocks loading of Kizen UI until resources are fetched and processed`})]}),m.developer_business_id&&(typeof m.developer_business_id==`string`?(0,u.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,u.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-2 py-0.5 font-mono text-[11px] tracking-wide text-neutral-500`,children:[`biz: `,m.developer_business_id]}),(0,u.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Developer business ID`})]}):Object.entries(m.developer_business_id).map(([e,t])=>(0,u.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,u.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-2 py-0.5 font-mono text-[11px] tracking-wide text-neutral-500`,children:[`biz (`,e,`): `,t]}),(0,u.jsxs)(`span`,{className:`text-[12px] text-neutral-500`,children:[`Developer business ID (`,e,`)`]})]},e))),E!==null&&(0,u.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,u.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-neutral-600`,children:[`bundle: `,l(E)]}),(0,u.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Total size of bundle.json`})]})]})]})}),T||A||j||m.releaseNotes?(0,u.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3`,children:[h.length>0&&(0,u.jsxs)(i,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Floating Frames`}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:h.length})]}),(0,u.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`}),(0,u.jsx)(`span`,{className:`shrink-0`,children:`Position`})]}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:h.map((e,t)=>(0,u.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,u.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.default_position&&(0,u.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 text-[10px] text-neutral-500`,children:e.default_position})]},t))})]}),g.length>0&&(0,u.jsxs)(i,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Data Adornments`}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:g.length})]}),(0,u.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Field`}),(0,u.jsx)(`span`,{className:`shrink-0`,children:`Type`})]}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:g.map((e,t)=>(0,u.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[e.config.color&&(0,u.jsx)(`span`,{className:`h-3 w-4 shrink-0 rounded-sm border border-black/10`,style:{backgroundColor:e.config.color}}),e.config.icon&&(0,u.jsx)(a,{name:e.config.icon,className:`shrink-0 text-[10px]`}),(0,u.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-neutral-900`,children:e.config.tooltip||e.field_type}),(0,u.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 font-mono text-[10px] text-neutral-500`,children:e.field_type})]},t))})]}),_.length>0&&(0,u.jsxs)(i,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Routable Pages`}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:_.length})]}),(0,u.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Page`}),(0,u.jsx)(`span`,{className:`shrink-0`,children:`Type`})]}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:_.map((e,t)=>(0,u.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,u.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.iframe_url&&(0,u.jsx)(`span`,{className:`shrink-0 rounded bg-purple-100 px-1.5 py-0.5 text-[10px] font-semibold text-purple-600`,children:`iframe`})]},t))})]}),w.length>0&&(0,u.jsxs)(i,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Content Blocks`}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:w.length})]}),(0,u.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Block`}),(0,u.jsx)(`span`,{className:`shrink-0`,children:`Grid (w×h)`})]}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:w.map((e,t)=>{let n=o(e);return(0,u.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,u.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),(e.types??[]).map(e=>(0,u.jsx)(`span`,{className:`shrink-0 rounded bg-blue-50 px-1.5 py-0.5 text-[10px] font-semibold text-blue-600`,children:e},e)),(0,u.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 font-mono text-[10px] text-neutral-500`,children:[n.minW,`–`,n.maxW,`×`,n.minH,`–`,n.maxH]})]},t)})})]}),v.length>0&&(0,u.jsxs)(i,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Toolbar Items`}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:v.length})]}),(0,u.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Label`}),(0,u.jsx)(`span`,{className:`shrink-0`,children:`Icon`})]}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:v.map((e,t)=>(0,u.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[e.color&&(0,u.jsx)(`span`,{className:`h-3 w-4 shrink-0 rounded-sm border border-black/10`,style:{backgroundColor:e.color}}),(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.label}),(0,u.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.icon&&(0,u.jsx)(a,{name:e.icon,className:`shrink-0 text-[10px]`})]},t))})]}),y.length>0&&(0,u.jsxs)(i,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`JS Action Templates`}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:y.length})]}),(0,u.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`}),(0,u.jsx)(`span`,{className:`shrink-0`,children:`Object`})]}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:y.map((e,t)=>(0,u.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,u.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.hint_object_name&&(0,u.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 text-[10px] text-neutral-500`,children:e.hint_object_name})]},t))})]}),b.length>0&&(0,u.jsxs)(i,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Route Scripts`}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:b.length})]}),(0,u.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`}),(0,u.jsx)(`span`,{className:`shrink-0`,children:`Routes`})]}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:b.map((e,t)=>(0,u.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name||e.api_name}),e.name&&(0,u.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.routes.length>0&&(0,u.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 text-[10px] text-neutral-500`,children:[e.routes.length,` route`,e.routes.length===1?``:`s`]})]},t))})]}),x.length>0&&(0,u.jsxs)(i,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Object Settings`}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:x.length})]}),(0,u.jsx)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Label`})}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:x.map((e,t)=>(0,u.jsx)(`div`,{className:`flex items-center gap-2 py-1.5`,children:(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.label}),(0,u.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]})},t))})]}),S.length>0&&(0,u.jsxs)(i,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Automation Actions`}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:S.length})]}),(0,u.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`}),(0,u.jsx)(`span`,{className:`shrink-0`,children:`Runtime`})]}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:S.map((e,t)=>(0,u.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,u.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.action_step_api_name})]}),(0,u.jsx)(`span`,{className:`shrink-0 rounded bg-blue-50 px-1.5 py-0.5 text-[10px] font-semibold text-blue-600`,children:e.script_runtime})]},t))})]}),C.length>0&&(0,u.jsxs)(i,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Calendar Sources`}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:C.length})]}),(0,u.jsx)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`})}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:C.map((e,t)=>(0,u.jsx)(`div`,{className:`flex items-center gap-2 py-1.5`,children:(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,u.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]})},t))})]}),A&&O&&(0,u.jsx)(d,{title:`Setup Assistant`,config:O}),j&&k&&(0,u.jsx)(d,{title:`User Setup Assistant`,config:k}),m.releaseNotes&&(0,u.jsxs)(i,{children:[(0,u.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Release Notes`}),(0,u.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-[12px] leading-relaxed text-neutral-700`,children:m.releaseNotes})]})]}):(0,u.jsx)(i,{children:(0,u.jsx)(`p`,{className:`text-[13px] text-neutral-400`,children:`No plugin assets defined.`})})]})};export{f as AppDetailPage};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{A as t,E as n,F as r,I as i,P as a,a as o,s}from"./fa-core-BSqLAjHu.js";import{t as c}from"./useNavigate-BL0GTcH4.js";import{t as l}from"./useParams-D3awshYI.js";import{t as u}from"./useQuery-JKMI40WO.js";import{t as d}from"./bundleQuery-BE1Gb8Ii.js";import{i as f}from"./api--pW2v3sH.js";import{t as p}from"./Card-Sa52PGkn.js";import{t as m}from"./CodeViewer-CVECJY4e.js";import{t as h}from"./useLocalStorage-wp83IS34.js";import{t as g}from"./usePluginConfig--4sAyik4.js";import{t as _}from"./WhenBadge-DKz8ukwo.js";var v=e(i(),1);function y(e){return e==null||e.trim()===``?null:e}function b(e,t){return Object.fromEntries(e.map(e=>[e,y(t[e])]))}var x=r(),S=({title:e,defaultOpen:t=!1,children:n})=>{let[r,i]=(0,v.useState)(t);return(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`button`,{onClick:()=>{i(e=>!e)},className:`flex w-full items-center gap-1.5 py-1 text-[11px] font-semibold uppercase tracking-widest text-neutral-400 hover:text-neutral-600`,children:[(0,x.jsx)(a,{icon:r?o:s,className:`w-2.5`}),e]}),r&&(0,x.jsx)(`div`,{className:`pb-2`,children:n})]})},C=({result:e})=>{let t=Object.entries(e.outputValues);return(0,x.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-black/10 bg-white p-4`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(`span`,{className:`rounded px-2 py-0.5 text-[11px] font-semibold ${e.success?`bg-green-100 text-green-700`:`bg-red-100 text-red-700`}`,children:e.success?`Success`:`Error`}),(0,x.jsxs)(`span`,{className:`text-[11px] text-neutral-400`,children:[String(e.durationMs),`ms`]}),e.exitCode!==0&&(0,x.jsxs)(`span`,{className:`text-[11px] text-neutral-400`,children:[`exit code `,String(e.exitCode)]}),(0,x.jsx)(`button`,{onClick:e=>{let t=e.currentTarget;for(;t;){if(t.scrollHeight>t.clientHeight){t.scrollTo({top:0,behavior:`smooth`});return}t=t.parentElement}},className:`ml-auto text-[11px] text-neutral-400 hover:text-neutral-600`,children:`↑ top`})]}),e.error&&(0,x.jsx)(`pre`,{className:`overflow-auto rounded bg-red-50 p-3 font-mono text-[12px] text-red-800`,children:e.error}),t.length>0&&(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`div`,{className:`mb-1 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Outputs`}),(0,x.jsx)(`div`,{className:`divide-y divide-black/5`,children:t.map(([e,t])=>(0,x.jsxs)(`div`,{className:`flex items-start gap-2 py-1.5`,children:[(0,x.jsx)(`span`,{className:`shrink-0 font-mono text-[12px] text-neutral-600`,children:e}),(0,x.jsx)(`span`,{className:`text-[11px] text-neutral-300`,children:`=`}),(0,x.jsx)(`pre`,{className:`min-w-0 flex-1 overflow-auto font-mono text-[12px] text-neutral-800`,children:typeof t==`string`?t:JSON.stringify(t,null,2)})]},e))})]}),e.logs.length>0&&(0,x.jsx)(S,{title:`Logs (${String(e.logs.length)})`,children:(0,x.jsx)(`div`,{className:`space-y-0.5`,children:e.logs.map((e,t)=>(0,x.jsx)(`div`,{className:`font-mono text-[12px] text-neutral-600`,children:e},t))})}),e.stdout&&(0,x.jsx)(S,{title:`Stdout`,children:(0,x.jsx)(`pre`,{className:`overflow-auto rounded bg-neutral-50 p-3 font-mono text-[12px] text-neutral-700`,children:e.stdout})}),e.stderr&&(0,x.jsx)(S,{title:`Stderr`,children:(0,x.jsx)(`pre`,{className:`overflow-auto rounded bg-neutral-50 p-3 font-mono text-[12px] text-neutral-700`,children:e.stderr})}),e.httpRequests&&e.httpRequests.count>0&&(0,x.jsx)(S,{title:`Network (${String(e.httpRequests.count)}${e.httpRequests.notLogged>0?`, ${String(e.httpRequests.notLogged)} not logged`:``})`,children:(0,x.jsx)(`div`,{className:`space-y-1.5`,children:e.httpRequests.requests.map((e,t)=>(0,x.jsx)(E,{request:e},t))})})]})},w=e=>{switch(e.toUpperCase()){case`GET`:return`bg-blue-100 text-blue-700`;case`POST`:return`bg-green-100 text-green-700`;case`PUT`:case`PATCH`:return`bg-amber-100 text-amber-700`;case`DELETE`:return`bg-red-100 text-red-700`;default:return`bg-neutral-100 text-neutral-700`}},T=(e,t)=>t||e>=500?`text-red-700`:e>=400?`text-amber-700`:e>=200?`text-green-700`:`text-neutral-600`,E=({request:e})=>{let[t,n]=(0,v.useState)(!1),r=e.requestErrorType!==null;return(0,x.jsxs)(`div`,{className:`rounded border border-black/5 bg-neutral-50`,children:[(0,x.jsxs)(`button`,{onClick:()=>{n(e=>!e)},className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left hover:bg-neutral-100`,children:[(0,x.jsx)(a,{icon:t?o:s,className:`w-2.5 text-neutral-400`}),(0,x.jsx)(`span`,{className:`rounded px-1.5 py-0.5 font-mono text-[10px] font-semibold ${w(e.method)}`,children:e.method}),(0,x.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12px] text-neutral-700`,children:e.url}),(0,x.jsx)(`span`,{className:`font-mono text-[11px] font-semibold ${T(e.responseStatusCode,r)}`,children:r?e.requestErrorType:e.responseStatusCode}),(0,x.jsxs)(`span`,{className:`font-mono text-[10px] text-neutral-400`,children:[(e.duration*1e3).toFixed(0),`ms`]})]}),t&&(0,x.jsxs)(`div`,{className:`space-y-2 border-t border-black/5 p-2.5`,children:[(0,x.jsx)(D,{title:`Request Headers`,data:e.headers}),e.body&&(0,x.jsx)(O,{title:`Request Body`,body:e.body}),(0,x.jsx)(D,{title:`Response Headers`,data:e.responseHeaders}),e.responseBody&&(0,x.jsx)(O,{title:`Response Body`,body:e.responseBody})]})]})},D=({title:e,data:t})=>{let n=Object.entries(t);return n.length===0?null:(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-widest text-neutral-400`,children:e}),(0,x.jsx)(`div`,{className:`divide-y divide-black/5 rounded border border-black/5 bg-white`,children:n.map(([e,t])=>(0,x.jsxs)(`div`,{className:`flex gap-2 px-2 py-1 font-mono text-[11px]`,children:[(0,x.jsxs)(`span`,{className:`shrink-0 text-neutral-500`,children:[e,`:`]}),(0,x.jsx)(`span`,{className:`min-w-0 flex-1 break-all text-neutral-800`,children:t})]},e))})]})},O=({title:e,body:t})=>(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-widest text-neutral-400`,children:e}),(0,x.jsx)(`pre`,{className:`overflow-auto rounded border border-black/5 bg-white p-2 font-mono text-[11px] text-neutral-800`,children:t})]}),k=[`python-3-12`,`python-3-13`],A=`python-3-13`,j={string:`s`,number:`n`,boolean:`b`,date:`d`,datetime:`dt`,phone_number:`p`,uuid:`u`,employee:`u`,entity:`u`};function M(e,t,n){let r=typeof e==`string`?j[e.toLowerCase()]:void 0;if(r===void 0){let r=e===void 0?`missing`:JSON.stringify(e);throw Error(`${t} "${n}" has data_type ${r}, which is not a valid automation data type. Valid values: ${Object.keys(j).join(`, `)}. Rebuild the plugin to see the full validation report.`)}return r}function N(e){return k.includes(e)}function P(e,t){let n=Object.keys(e);if(n.length===0)return null;let r={};for(let i of n)r[i]={t:M(t[i],`Input`,i),v:y(e[i])};return r}function F(e){let t=Object.keys(e);if(t.length===0)return null;let n={};for(let r of t)n[r]=M(e[r],`Output`,r);return n}function I(e){if(!e)return{};let t={};for(let[n,r]of Object.entries(e))t[n]=r.v;return t}function L(e){if(!e)return;let t=e.requests.map(e=>({method:e.method,url:e.url,headers:e.headers,body:e.body,requestSubmittedAt:e.requestSubmittedAt,session:e.session,responseStatusCode:e.responseStatusCode,responseHeaders:e.responseHeaders,responseBody:e.responseBody,requestErrorType:e.requestErrorType,duration:e.duration}));return{count:e.count,notLogged:e.not_logged,requests:t}}async function R(e,t){let n=Date.now(),r=t.scriptRuntime||A;if(!N(r))return{success:!1,outputValues:{},logs:[],stdout:``,stderr:``,error:`Unsupported runtime "${r}". Supported runtimes: ${k.join(`, `)}. Update the step's config.json "runtime" field (e.g. "python 3.13").`,exitCode:1,durationMs:Date.now()-n};let i={user_script:t.script,runtime:r,secrets:t.secretNames.length>0?t.secretNames:void 0,inputs:P(t.inputs,t.inputTypes),output_types:F(t.outputTypes)};try{let t=await e(`/coderunner/run`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)}),r=Date.now()-n;if(!t.ok){let e=await t.text();return{success:!1,outputValues:{},logs:[],stdout:``,stderr:``,error:`Remote runner returned ${String(t.status)}: ${e}`,exitCode:1,durationMs:r}}let a=await t.json(),o=a.error!==null,s=L(a.http_requests),c={success:!o,outputValues:I(a.values),logs:a.logs??[],stdout:``,stderr:``,exitCode:+!!o,durationMs:a.duration_ms??r,...s&&{httpRequests:s}};return o&&a.error&&(c.error=a.error.detail?`${a.error.error}\n${a.error.detail}`:a.error.error),c}catch(e){return{success:!1,outputValues:{},logs:[],stdout:``,stderr:``,error:`Remote execution failed: ${e instanceof Error?e.message:String(e)}`,exitCode:1,durationMs:Date.now()-n}}}var z=()=>{let{apiName:e,stepApiName:r}=l({strict:!1}),i=c(),{data:o,isLoading:s,isError:y}=u(d),S=f(),[w,T]=(0,v.useState)(!1),[E,D]=(0,v.useState)(null),[O,k]=h(`kizen-step-inputs:${e??``}:${r??``}`,{}),[A,j]=h(`kizen-step-secrets:${e??``}:${r??``}`,{}),[M,N]=h(`kizen-code-runner-mode`,`local`),P=(0,v.useMemo)(()=>o?.find(t=>t.api_name===e),[o,e]),F=(0,v.useMemo)(()=>P?.artifacts.automation_action_configs??[],[P]),I=F.find(e=>e.action_step_api_name===r)??F[0],L=P?.base_config,{whenState:z}=g(e,L,P?.config_template);if((0,v.useEffect)(()=>{if(!r&&F.length>0&&e){let t=F[0];t&&i({to:`/$apiName/code-steps/$stepApiName`,params:{apiName:e,stepApiName:t.action_step_api_name},replace:!0})}},[r,F,e,i]),(0,v.useEffect)(()=>{D(null)},[r]),s)return(0,x.jsx)(p,{children:(0,x.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(y)return(0,x.jsx)(p,{children:(0,x.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});if(!P)return(0,x.jsx)(p,{children:(0,x.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,x.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:e}),`.`]})});if(F.length===0)return(0,x.jsx)(p,{children:(0,x.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:`This app has no automation code steps.`})});if(!I)return(0,x.jsx)(p,{children:(0,x.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`Step not found: `,(0,x.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:r}),`.`]})});let B=async()=>{T(!0),D(null);try{let t=b(I.inputs.map(e=>e.name),O),n;n=M===`remote`?await R(S,{script:I.script,scriptRuntime:I.script_runtime,inputs:t,inputTypes:Object.fromEntries(I.inputs.map(e=>[e.name,e.data_type])),outputTypes:Object.fromEntries(I.outputs.map(e=>[e.name,e.data_type])),secretNames:I.secrets.map(t=>`${e??``}__${t}`)}):await(await fetch(`/api/execute-step`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({script:I.script,scriptRuntime:I.script_runtime,inputs:t,secrets:Object.fromEntries(I.secrets.map(t=>[`${e??``}__${t}`,A[t]??``]))})})).json(),D(n)}catch(e){D({success:!1,outputValues:{},logs:[],stdout:``,stderr:``,error:e instanceof Error?e.message:String(e),exitCode:1,durationMs:0})}finally{T(!1)}};return(0,x.jsxs)(`div`,{className:`space-y-4`,children:[(0,x.jsxs)(p,{children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,x.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Code Step`}),(0,x.jsx)(`select`,{value:I.action_step_api_name,onChange:t=>{e&&i({to:`/$apiName/code-steps/$stepApiName`,params:{apiName:e,stepApiName:t.target.value}})},className:`rounded border border-black/10 bg-transparent px-2 py-0.5 text-[13px] font-mono text-neutral-700 focus:outline-none`,children:F.map(e=>(0,x.jsx)(`option`,{value:e.action_step_api_name,children:e.name},e.action_step_api_name))}),(0,x.jsx)(`div`,{className:`flex-1`}),(0,x.jsx)(`span`,{className:`rounded bg-blue-50 px-1.5 py-0.5 text-[10px] font-semibold text-blue-600`,children:I.script_runtime})]}),I.action_description&&(0,x.jsx)(`p`,{className:`mt-2 text-[12px] text-neutral-500`,children:I.action_description}),I.when&&(0,x.jsx)(`div`,{className:`mt-2`,children:(0,x.jsx)(_,{when:I.when,whenState:z})})]}),(0,x.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-3`,children:[(0,x.jsxs)(p,{children:[(0,x.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Inputs`}),I.inputs.length>0?(0,x.jsx)(`div`,{className:`space-y-3`,children:I.inputs.map(e=>(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`label`,{className:`mb-1 block text-[12px] text-neutral-700`,children:[e.label,e.required&&(0,x.jsx)(`span`,{className:`ml-0.5 text-red-500`,children:`*`})]}),(0,x.jsx)(`input`,{type:`text`,value:O[e.name]??``,onChange:t=>{k({...O,[e.name]:t.target.value})},placeholder:e.name,className:`w-full rounded border border-black/10 bg-white px-2.5 py-1.5 font-mono text-[13px] text-neutral-800 placeholder:text-neutral-300 focus:border-blue-300 focus:outline-none`}),(0,x.jsx)(`div`,{className:`mt-0.5 font-mono text-[10px] text-neutral-400`,children:e.name})]},e.name))}):(0,x.jsx)(`p`,{className:`m-0 text-[12px] text-neutral-400`,children:`None defined.`})]}),(0,x.jsxs)(p,{children:[(0,x.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Outputs`}),I.outputs.length>0?(0,x.jsx)(`div`,{className:`space-y-2`,children:I.outputs.map(e=>(0,x.jsxs)(`div`,{className:`flex items-baseline gap-2 rounded border border-black/5 bg-neutral-50 px-2.5 py-1.5`,children:[(0,x.jsx)(`span`,{className:`text-[13px] text-neutral-700`,children:e.label}),(0,x.jsx)(`span`,{className:`font-mono text-[10px] text-neutral-400`,children:e.name}),(0,x.jsx)(`span`,{className:`ml-auto rounded bg-white px-1.5 py-0.5 font-mono text-[10px] text-neutral-500`,children:e.data_type})]},e.name))}):(0,x.jsx)(`p`,{className:`m-0 text-[12px] text-neutral-400`,children:`None defined.`})]}),(0,x.jsxs)(p,{children:[(0,x.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Secrets`}),M===`remote`&&(0,x.jsx)(`p`,{className:`mb-3 rounded border border-blue-100 bg-blue-50 px-2.5 py-1.5 text-[12px] text-blue-700`,children:`Remote runner uses secrets from your business context.`}),I.secrets.length>0?(0,x.jsx)(`div`,{className:`space-y-3`,children:I.secrets.map(e=>(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`mb-1 block text-[12px] text-neutral-700`,children:e}),(0,x.jsx)(`input`,{type:`password`,value:A[e]??``,onChange:t=>{j({...A,[e]:t.target.value})},placeholder:e,disabled:M===`remote`,className:`w-full rounded border border-black/10 bg-white px-2.5 py-1.5 font-mono text-[13px] text-neutral-800 placeholder:text-neutral-300 focus:border-blue-300 focus:outline-none disabled:cursor-not-allowed disabled:bg-neutral-50 disabled:text-neutral-400`})]},e))}):(0,x.jsx)(`p`,{className:`m-0 text-[12px] text-neutral-400`,children:`None defined.`})]})]}),(0,x.jsx)(m,{code:I.script,language:`python`,onRun:()=>void B(),isRunning:w,executionMode:M,onModeChange:N}),(0,x.jsx)(`div`,{className:`sticky bottom-0 z-10 max-h-[60vh] overflow-y-auto rounded-lg shadow-[0_-8px_24px_-12px_rgba(0,0,0,0.18)]`,children:E?(0,x.jsx)(C,{result:E}):(0,x.jsx)(`div`,{className:`flex items-center gap-2 rounded-lg border border-dashed border-black/10 bg-white px-4 py-3`,children:w?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(a,{icon:t,className:`animate-spin text-neutral-400`}),(0,x.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Running step…`})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(a,{icon:n,className:`text-neutral-300`}),(0,x.jsx)(`span`,{className:`text-[12px] text-neutral-400`,children:`Run the step to see output, logs, and network activity here.`})]})})})]})};export{z as CodeStepsPage};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{A as t,F as n,I as r,P as i}from"./fa-core-BSqLAjHu.js";import{t as a}from"./useParams-D3awshYI.js";import{t as o}from"./useQuery-JKMI40WO.js";import{n as s}from"./BootstrapContext-CS2e3X9Y.js";import{S as c,a as l,c as u,d,h as f,i as p,l as m,m as h,n as g,p as _,r as v,s as y,t as b}from"./useCompleteSetup-BgC9V-FN.js";import{t as x}from"./bundleQuery-BE1Gb8Ii.js";import{n as S}from"./CredentialsContext-p3i8s7a6.js";import{I as C,P as ee,T as w,n as te,r as T,t as E}from"./api-C4R44YCL.js";import{n as D,t as O}from"./Dialog-C3QoiHOt.js";import{o as k}from"./storageKeys-BDp-0diL.js";import{t as A}from"./Card-Sa52PGkn.js";import{n as j,t as M}from"./setupAssistant-DtI9NWXr.js";import{t as N}from"./CodeViewer-CVECJY4e.js";import{a as P,c as F,f as I,i as L,l as R,m as z,n as B,o as V,p as H,r as U,s as W,t as G}from"./usePluginConfig-mg5WevIz.js";var K=e(r(),1);function q(e,t){try{return localStorage.getItem(k(e,t))!==null}catch{return!1}}function ne(e,t,n){try{return localStorage.setItem(k(e,t),n),Promise.resolve()}catch(e){return Promise.reject(e instanceof Error?e:Error(`Could not save secret locally`))}}function re(e,t){localStorage.removeItem(k(e,t))}var J=n(),ie=e=>e?JSON.stringify(e,null,2):`{}`,ae=({apiName:e,configTemplate:t})=>{let n=F(e),r=ie(t),[i,a]=(0,K.useState)(n?.__kizen_clean_config?JSON.stringify(n.__kizen_clean_config,null,2):r),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1);return(0,J.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,J.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,J.jsxs)(`p`,{className:`text-[13px] text-neutral-500 m-0`,children:[`No setup assistant defined. Enter configuration as JSON.`,t?` Pre-populated from config_template.`:``]})}),(0,J.jsx)(`textarea`,{value:i,onChange:e=>{a(e.target.value),s(null),l(!1)},spellCheck:!1,className:`w-full min-h-[300px] rounded border p-3 text-[13px] font-mono leading-relaxed focus:outline-none focus:ring-1 ${o?`border-red-300 focus:ring-red-400`:`border-black/10 focus:ring-blue-400`}`}),o&&(0,J.jsxs)(`span`,{className:`text-[12px] text-red-500`,children:[`Parse error: `,o]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`button`,{onClick:()=>{try{H(e,JSON.parse(i)),s(null),l(!0),setTimeout(()=>{l(!1)},2e3)}catch(e){s(e instanceof Error?e.message:`Invalid JSON`),l(!1)}},className:`rounded bg-blue-600 px-4 py-1.5 text-[13px] font-medium text-white hover:bg-blue-700 active:bg-blue-800`,children:`Save Configuration`}),(0,J.jsx)(`button`,{onClick:()=>{V(e),a(r),s(null),l(!1)},className:`rounded border border-black/10 px-4 py-1.5 text-[13px] font-medium text-neutral-600 hover:bg-neutral-50 active:bg-neutral-100`,children:`Reset`}),c&&(0,J.jsx)(`span`,{className:`text-[12px] text-green-600 font-medium`,children:`Saved`})]})]})},Y=({open:e,onClose:t,apiName:n,loadFn:r,label:i})=>{let a=(0,K.useMemo)(()=>e?r(n)?.__kizen_clean_config??null:null,[e,n,r]),o=(0,K.useMemo)(()=>a?JSON.stringify(a,null,2):``,[a]),[s,c]=(0,K.useState)(!1);return(0,K.useEffect)(()=>{e||c(!1)},[e]),(0,J.jsx)(O,{open:e,size:`xl`,ariaModal:!0,onBackdropClick:t,header:(0,J.jsx)(D,{title:`Stored JSON — ${i}`,onClose:t}),footer:a?(0,J.jsx)(`button`,{onClick:()=>{navigator.clipboard.writeText(o).then(()=>{c(!0),setTimeout(()=>{c(!1)},1200)})},className:`rounded border border-black/10 px-3 py-1 text-[12px] font-medium text-neutral-600 hover:bg-neutral-50 active:bg-neutral-100`,children:s?`Copied`:`Copy`}):void 0,children:(0,J.jsxs)(`div`,{className:`px-5 py-4`,children:[(0,J.jsxs)(`p`,{className:`m-0 mb-3 text-[12px] text-neutral-500`,children:[`This is the saved JSON the plugin runtime will see as`,` `,(0,J.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:i}),`. Save the form to refresh.`]}),a?(0,J.jsx)(N,{code:o,language:`json`}):(0,J.jsx)(`div`,{className:`rounded border border-dashed border-black/10 px-4 py-6 text-center text-[12px] text-neutral-400`,children:`No saved configuration yet. Save the form to populate this view.`})]})})},X=e=>JSON.stringify(e,null,2),oe=({open:e,onClose:t,value:n,onChange:r})=>{let[i,a]=(0,K.useState)(()=>X(n)),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1);return(0,K.useEffect)(()=>{e&&(a(X(n)),s(null),l(!1))},[e]),(0,J.jsx)(O,{open:e,size:`lg`,ariaModal:!0,onBackdropClick:t,header:(0,J.jsx)(D,{title:`Plan & Entitlements (local simulation)`,onClose:t}),footer:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`button`,{onClick:()=>{B(),r?.({plan:{},entitlements:{}}),a(X({plan:{},entitlements:{}})),s(null),l(!1)},className:`rounded border border-black/10 px-3 py-1 text-[12px] font-medium text-neutral-600 hover:bg-neutral-50 active:bg-neutral-100`,children:`Clear`}),(0,J.jsx)(`button`,{onClick:()=>{try{let e=JSON.parse(i);if(!U(e)){s(`Expected { "plan": { [type]: { [key]: value } }, "entitlements": { [key]: value } }`),l(!1);return}L(e),r?.(e),s(null),l(!0),setTimeout(()=>{l(!1)},1500)}catch(e){s(e instanceof Error?e.message:`Invalid JSON`),l(!1)}},className:`rounded bg-blue-600 px-3 py-1 text-[12px] font-medium text-white hover:bg-blue-700 active:bg-blue-800`,children:`Apply`})]}),children:(0,J.jsxs)(`div`,{className:`px-5 py-4`,children:[(0,J.jsxs)(`p`,{className:`m-0 mb-3 text-[12px] text-neutral-500`,children:[`Fakes the values a plugin reads via`,` `,(0,J.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:`{{plan.<type>.<key>}}`}),` `,`and`,` `,(0,J.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:`{{entitlement.<key>}}`}),`in `,(0,J.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:`when`}),` and radio-option`,` `,(0,J.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:`disabled`}),` `,`expressions. Applies to every plugin's assistant while this credential profile is active — there is no real plan/entitlements backend here, so an unset key always resolves to`,` `,(0,J.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:`null`}),`, same as production.`]}),(0,J.jsx)(`textarea`,{value:i,onChange:e=>{a(e.target.value),s(null),l(!1)},spellCheck:!1,rows:12,className:`w-full rounded border p-3 text-[13px] font-mono leading-relaxed focus:outline-none focus:ring-1 ${o?`border-red-300 focus:ring-red-400`:`border-black/10 focus:ring-blue-400`}`}),o&&(0,J.jsxs)(`p`,{className:`mt-2 text-[12px] text-red-500`,children:[`Parse error: `,o]}),c&&(0,J.jsx)(`p`,{className:`mt-2 text-[12px] font-medium text-green-600`,children:`Applied`})]})})},se=({config:e,apiName:t,loadFn:n,saveFn:r,clearFn:i,plan:a,entitlements:o})=>{let s=n(t)?.__kizen_setup_assistant_values,c=(0,K.useMemo)(()=>w(e).filter(e=>e.type===`api_key`),[e]),l=(0,K.useMemo)(()=>{let e={...s??{}};return c.forEach(n=>{n.secret&&(e[n.key]={type:`api_key`,hasValue:q(t,n.secret)})}),e},[s,c,t]),{getObjectByAPIName:d,getCustomObjectDetails:p}=y();return(0,J.jsx)(f,{config:e,value:l,disabledKeys:[],getObjectByAPIName:d,getCustomObjectDetails:p,plan:a,entitlements:o,children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.fields?.map(e=>(0,J.jsx)(u,{field:e,pluginApiName:t},e.key)),(0,J.jsx)(ce,{apiName:t,config:e,saveFn:r,clearFn:i})]})})},ce=({apiName:e,config:t,saveFn:n,clearFn:r})=>{let{state:i,setState:a,validateForm:o}=c(),[s,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(null),f=(0,K.useCallback)(({pluginApiName:e,secretName:t,value:n})=>ne(e,t,n),[]),p=async()=>{d(null);let{isValid:r,includedKeys:s}=await o();if(!r){d(`Fix the highlighted fields before saving.`);return}try{let{partialNewConfig:r}=await T(i,t,{pluginApiName:e,saveSecret:f,includedKeys:s}),o=r.__kizen_setup_assistant_values;n(e,o,t),a(o),l(!0),setTimeout(()=>{l(!1)},2e3)}catch(e){d(e instanceof Error?e.message:`Could not save configuration`)}};return(0,J.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,J.jsx)(`button`,{onClick:()=>{p()},className:`rounded bg-blue-600 px-4 py-1.5 text-[13px] font-medium text-white hover:bg-blue-700 active:bg-blue-800`,children:`Save Configuration`}),(0,J.jsx)(`button`,{onClick:()=>{w(t).filter(e=>e.type===`api_key`).forEach(t=>{t.secret&&re(e,t.secret)}),r(e),window.location.reload()},className:`rounded border border-black/10 px-4 py-1.5 text-[13px] font-medium text-neutral-600 hover:bg-neutral-50 active:bg-neutral-100`,children:`Reset`}),u&&(0,J.jsx)(`span`,{className:`text-[12px] text-red-500`,children:u}),s&&(0,J.jsx)(`span`,{className:`text-[12px] text-green-600 font-medium`,children:`Saved`})]})},Z=({children:e})=>(0,J.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:e}),le=({page:e,viewApiName:t})=>e?(0,J.jsx)(p,{page:e,className:`h-[520px] w-full overflow-hidden rounded border border-black/10`,iframeAllow:_}):(0,J.jsxs)(`p`,{className:`m-0 rounded border border-dashed border-amber-300 bg-amber-50 px-3 py-2.5 text-[12px] text-amber-800`,children:[`This setup assistant delegates to view `,(0,J.jsx)(Z,{children:t}),`, which this plugin does not define. Add a `,(0,J.jsx)(Z,{children:`views/${t}/`}),` component, or drop`,` `,(0,J.jsx)(Z,{children:`view`}),` from the manifest to go back to the declarative assistant.`]}),Q=({level:e,isViewBased:t})=>{let n=e===`user`?`this.userConfig`:`this.config`;return t?(0,J.jsxs)(J.Fragment,{children:[`Setup for this plugin is a view, so it saves its own`,` `,e===`user`?`per-user`:`business-level`,` config by calling`,` `,(0,J.jsx)(Z,{children:`this.completeSetup()`}),` — there is no form or Save button here. Whatever it writes becomes `,(0,J.jsx)(Z,{children:n}),`; use View JSON to inspect it.`]}):e===`user`?(0,J.jsxs)(J.Fragment,{children:[`Configure the per-user setup assistant fields. These values are scoped to the logged-in user and exposed to plugin scripts at `,(0,J.jsx)(Z,{children:n}),`.`]}):(0,J.jsxs)(J.Fragment,{children:[`Configure the business-level setup assistant fields. These values are shared across the whole business and exposed to plugin scripts at `,(0,J.jsx)(Z,{children:n}),`.`]})},$=({config:e,apiName:n,loadFn:r,saveFn:a,clearFn:o,level:c,views:u,userConfigs:f,onConfigWrite:p,plan:m,entitlements:_})=>{let y=s(),x=te(),w=(0,K.useMemo)(()=>ee(x),[x]),{environment:T}=S(),D=C[T],[O,k]=(0,K.useState)(!1),[A,M]=(0,K.useState)(!1),{onMonitoringException:N,dialog:P}=g(),{showToast:F,clearToasts:I}=d(),L=b(c,p),R=j(e),z=l(u,R);return y?(0,J.jsx)(h,{appPath:D,user:{id:y.team.user,crm_client_id:``},business:y.business,userConfigs:f,clientObject:y.business.client_object?{id:y.business.client_object.id,objectName:y.business.client_object.object_name}:void 0,teamMember:y.team,onNavigate:()=>{},performFileUpload:()=>Promise.resolve({url:``}),monitoringExceptionHelper:N,performRequest:E(w),onCompleteSetup:L,modal:{showing:O,show:A,showPrompt:()=>{k(!0),M(!0)},onConfirm:()=>{k(!1),M(!1)},onHide:()=>{k(!1),M(!1)}},showToast:F,clearToasts:I,children:({showPluginModal:t,derivedModalState:i,pluginApiName:s})=>(0,J.jsxs)(J.Fragment,{children:[R===void 0?(0,J.jsx)(se,{config:e,apiName:n,loadFn:r,saveFn:a,clearFn:o,plan:m,entitlements:_}):(0,J.jsx)(le,{page:z,viewApiName:R}),(0,J.jsx)(v,{show:t,config:i.config,pluginApiName:s,onConfirm:i.props.onConfirm,onHide:i.props.onHide,pages:u}),P]})}):(0,J.jsx)(i,{icon:t,className:`animate-spin text-neutral-400`})},ue=()=>{let{apiName:e}=a({strict:!1}),{data:t,isLoading:n,isError:r}=o(x),[i,s]=(0,K.useState)(null),c=P(),[l,u]=(0,K.useState)(!1),d=(0,K.useMemo)(()=>t?.find(t=>t.api_name===e),[t,e]),f=d?.base_config,{configArgs:p,userConfigs:m,refreshConfig:h}=G(e,f,d?.config_template),g=(0,K.useMemo)(()=>d?d.artifacts.routable_pages.map(e=>({...e,plugin_api_name:d.api_name,args:p})):[],[d,p]);if(n)return(0,J.jsx)(A,{children:(0,J.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(r)return(0,J.jsx)(A,{children:(0,J.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});if(!d)return(0,J.jsx)(A,{children:(0,J.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,J.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:e}),`.`]})});let _=f?.setup_assistant,v=f?.user_setup_assistant,y=M(_),b=M(v);return!y&&!b?(0,J.jsx)(A,{children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`Configuration`}),(0,J.jsx)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,children:`Enter plugin configuration as JSON.`})]}),(0,J.jsx)(ae,{apiName:e??``,configTemplate:d.config_template})]})}):(0,J.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start`,children:[y&&_&&(0,J.jsx)(A,{className:`lg:flex-1 lg:min-w-0`,children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`Business Configuration`}),(0,J.jsx)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,children:(0,J.jsx)(Q,{level:`business`,isViewBased:j(_)!==void 0})})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,J.jsx)(`button`,{onClick:()=>{u(!0)},className:`rounded border border-black/10 px-3 py-1.5 text-[12px] font-medium text-neutral-600 hover:bg-neutral-50 active:bg-neutral-100`,children:`Plan & Entitlements`}),(0,J.jsx)(`button`,{onClick:()=>{s(`business`)},className:`rounded border border-black/10 px-3 py-1.5 text-[12px] font-medium text-neutral-600 hover:bg-neutral-50 active:bg-neutral-100`,children:`View JSON`})]})]}),(0,J.jsx)($,{config:_,apiName:e??``,loadFn:F,saveFn:I,clearFn:V,level:`business`,views:g,userConfigs:m,onConfigWrite:h,plan:c.plan,entitlements:c.entitlements})]})}),b&&v&&(0,J.jsx)(A,{className:`lg:flex-1 lg:min-w-0`,children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`User Configuration`}),(0,J.jsx)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,children:(0,J.jsx)(Q,{level:`user`,isViewBased:j(v)!==void 0})})]}),(0,J.jsx)(`button`,{onClick:()=>{s(`user`)},className:`shrink-0 rounded border border-black/10 px-3 py-1.5 text-[12px] font-medium text-neutral-600 hover:bg-neutral-50 active:bg-neutral-100`,children:`View JSON`})]}),(0,J.jsx)($,{config:v,apiName:e??``,loadFn:R,saveFn:z,clearFn:W,level:`user`,views:g,userConfigs:m,onConfigWrite:h,plan:c.plan,entitlements:c.entitlements})]})}),(0,J.jsx)(Y,{open:i===`business`,onClose:()=>{s(null)},apiName:e??``,loadFn:F,label:`this.config`}),(0,J.jsx)(Y,{open:i===`user`,onClose:()=>{s(null)},apiName:e??``,loadFn:R,label:`this.userConfig`}),(0,J.jsx)(oe,{open:l,onClose:()=>{u(!1)},value:c})]})},de=()=>(0,J.jsx)(m,{children:(0,J.jsx)(ue,{})});export{de as ConfigurationPage};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{A as t,F as n,I as r,P as i}from"./fa-core-BSqLAjHu.js";import{t as a}from"./useParams-D3awshYI.js";import{t as o}from"./useQuery-JKMI40WO.js";import{n as s}from"./BootstrapContext-CS2e3X9Y.js";import{S as c,a as l,c as u,d,h as f,i as p,l as m,m as h,n as g,p as _,r as v,s as y,t as b}from"./useCompleteSetup-QS3W9RRO.js";import{t as x}from"./bundleQuery-BE1Gb8Ii.js";import{n as S}from"./CredentialsContext-Cwl_xyt_.js";import{D as C,I as ee,a as w,i as te,n as T,r as E}from"./api--pW2v3sH.js";import{n as D,t as O}from"./Dialog-C3QoiHOt.js";import{o as k}from"./storageKeys-BDp-0diL.js";import{t as A}from"./Card-Sa52PGkn.js";import{n as j,t as M}from"./setupAssistant-DtI9NWXr.js";import{t as N}from"./CodeViewer-CVECJY4e.js";import{a as P,c as F,f as I,i as L,l as R,m as z,n as B,o as V,p as H,r as U,s as W,t as G}from"./usePluginConfig--4sAyik4.js";var K=e(r(),1);function q(e,t){try{return localStorage.getItem(k(e,t))!==null}catch{return!1}}function ne(e,t,n){try{return localStorage.setItem(k(e,t),n),Promise.resolve()}catch(e){return Promise.reject(e instanceof Error?e:Error(`Could not save secret locally`))}}function re(e,t){localStorage.removeItem(k(e,t))}var J=n(),ie=e=>e?JSON.stringify(e,null,2):`{}`,ae=({apiName:e,configTemplate:t})=>{let n=F(e),r=ie(t),[i,a]=(0,K.useState)(n?.__kizen_clean_config?JSON.stringify(n.__kizen_clean_config,null,2):r),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1);return(0,J.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,J.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,J.jsxs)(`p`,{className:`text-[13px] text-neutral-500 m-0`,children:[`No setup assistant defined. Enter configuration as JSON.`,t?` Pre-populated from config_template.`:``]})}),(0,J.jsx)(`textarea`,{value:i,onChange:e=>{a(e.target.value),s(null),l(!1)},spellCheck:!1,className:`w-full min-h-[300px] rounded border p-3 text-[13px] font-mono leading-relaxed focus:outline-none focus:ring-1 ${o?`border-red-300 focus:ring-red-400`:`border-black/10 focus:ring-blue-400`}`}),o&&(0,J.jsxs)(`span`,{className:`text-[12px] text-red-500`,children:[`Parse error: `,o]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`button`,{onClick:()=>{try{H(e,JSON.parse(i)),s(null),l(!0),setTimeout(()=>{l(!1)},2e3)}catch(e){s(e instanceof Error?e.message:`Invalid JSON`),l(!1)}},className:`rounded bg-blue-600 px-4 py-1.5 text-[13px] font-medium text-white hover:bg-blue-700 active:bg-blue-800`,children:`Save Configuration`}),(0,J.jsx)(`button`,{onClick:()=>{V(e),a(r),s(null),l(!1)},className:`rounded border border-black/10 px-4 py-1.5 text-[13px] font-medium text-neutral-600 hover:bg-neutral-50 active:bg-neutral-100`,children:`Reset`}),c&&(0,J.jsx)(`span`,{className:`text-[12px] text-green-600 font-medium`,children:`Saved`})]})]})},Y=({open:e,onClose:t,apiName:n,loadFn:r,label:i})=>{let a=(0,K.useMemo)(()=>e?r(n)?.__kizen_clean_config??null:null,[e,n,r]),o=(0,K.useMemo)(()=>a?JSON.stringify(a,null,2):``,[a]),[s,c]=(0,K.useState)(!1);return(0,K.useEffect)(()=>{e||c(!1)},[e]),(0,J.jsx)(O,{open:e,size:`xl`,ariaModal:!0,onBackdropClick:t,header:(0,J.jsx)(D,{title:`Stored JSON — ${i}`,onClose:t}),footer:a?(0,J.jsx)(`button`,{onClick:()=>{navigator.clipboard.writeText(o).then(()=>{c(!0),setTimeout(()=>{c(!1)},1200)})},className:`rounded border border-black/10 px-3 py-1 text-[12px] font-medium text-neutral-600 hover:bg-neutral-50 active:bg-neutral-100`,children:s?`Copied`:`Copy`}):void 0,children:(0,J.jsxs)(`div`,{className:`px-5 py-4`,children:[(0,J.jsxs)(`p`,{className:`m-0 mb-3 text-[12px] text-neutral-500`,children:[`This is the saved JSON the plugin runtime will see as`,` `,(0,J.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:i}),`. Save the form to refresh.`]}),a?(0,J.jsx)(N,{code:o,language:`json`}):(0,J.jsx)(`div`,{className:`rounded border border-dashed border-black/10 px-4 py-6 text-center text-[12px] text-neutral-400`,children:`No saved configuration yet. Save the form to populate this view.`})]})})},X=e=>JSON.stringify(e,null,2),oe=({open:e,onClose:t,value:n,onChange:r})=>{let[i,a]=(0,K.useState)(()=>X(n)),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1);return(0,K.useEffect)(()=>{e&&(a(X(n)),s(null),l(!1))},[e]),(0,J.jsx)(O,{open:e,size:`lg`,ariaModal:!0,onBackdropClick:t,header:(0,J.jsx)(D,{title:`Plan & Entitlements (local simulation)`,onClose:t}),footer:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`button`,{onClick:()=>{B(),r?.({plan:{},entitlements:{}}),a(X({plan:{},entitlements:{}})),s(null),l(!1)},className:`rounded border border-black/10 px-3 py-1 text-[12px] font-medium text-neutral-600 hover:bg-neutral-50 active:bg-neutral-100`,children:`Clear`}),(0,J.jsx)(`button`,{onClick:()=>{try{let e=JSON.parse(i);if(!U(e)){s(`Expected { "plan": { [type]: { [key]: value } }, "entitlements": { [key]: value } }`),l(!1);return}L(e),r?.(e),s(null),l(!0),setTimeout(()=>{l(!1)},1500)}catch(e){s(e instanceof Error?e.message:`Invalid JSON`),l(!1)}},className:`rounded bg-blue-600 px-3 py-1 text-[12px] font-medium text-white hover:bg-blue-700 active:bg-blue-800`,children:`Apply`})]}),children:(0,J.jsxs)(`div`,{className:`px-5 py-4`,children:[(0,J.jsxs)(`p`,{className:`m-0 mb-3 text-[12px] text-neutral-500`,children:[`Fakes the values a plugin reads via`,` `,(0,J.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:`{{plan.<type>.<key>}}`}),` `,`and`,` `,(0,J.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:`{{entitlement.<key>}}`}),`in `,(0,J.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:`when`}),` and radio-option`,` `,(0,J.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:`disabled`}),` `,`expressions. Applies to every plugin's assistant while this credential profile is active — there is no real plan/entitlements backend here, so an unset key always resolves to`,` `,(0,J.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:`null`}),`, same as production.`]}),(0,J.jsx)(`textarea`,{value:i,onChange:e=>{a(e.target.value),s(null),l(!1)},spellCheck:!1,rows:12,className:`w-full rounded border p-3 text-[13px] font-mono leading-relaxed focus:outline-none focus:ring-1 ${o?`border-red-300 focus:ring-red-400`:`border-black/10 focus:ring-blue-400`}`}),o&&(0,J.jsxs)(`p`,{className:`mt-2 text-[12px] text-red-500`,children:[`Parse error: `,o]}),c&&(0,J.jsx)(`p`,{className:`mt-2 text-[12px] font-medium text-green-600`,children:`Applied`})]})})},se=({config:e,apiName:t,loadFn:n,saveFn:r,clearFn:i,plan:a,entitlements:o})=>{let s=n(t)?.__kizen_setup_assistant_values,c=(0,K.useMemo)(()=>C(e).filter(e=>e.type===`api_key`),[e]),l=(0,K.useMemo)(()=>{let e={...s??{}};return c.forEach(n=>{n.secret&&(e[n.key]={type:`api_key`,hasValue:q(t,n.secret)})}),e},[s,c,t]),{getObjectByAPIName:d,getCustomObjectDetails:p}=y();return(0,J.jsx)(f,{config:e,value:l,disabledKeys:[],getObjectByAPIName:d,getCustomObjectDetails:p,plan:a,entitlements:o,children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.fields?.map(e=>(0,J.jsx)(u,{field:e,pluginApiName:t},e.key)),(0,J.jsx)(ce,{apiName:t,config:e,saveFn:r,clearFn:i})]})})},ce=({apiName:e,config:t,saveFn:n,clearFn:r})=>{let{state:i,setState:a,validateForm:o}=c(),[s,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(null),f=(0,K.useCallback)(({pluginApiName:e,secretName:t,value:n})=>ne(e,t,n),[]),p=async()=>{d(null);let{isValid:r,includedKeys:s}=await o();if(!r){d(`Fix the highlighted fields before saving.`);return}try{let{partialNewConfig:r}=await w(i,t,{pluginApiName:e,saveSecret:f,includedKeys:s}),o=r.__kizen_setup_assistant_values;n(e,o,t),a(o),l(!0),setTimeout(()=>{l(!1)},2e3)}catch(e){d(e instanceof Error?e.message:`Could not save configuration`)}};return(0,J.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,J.jsx)(`button`,{onClick:()=>{p()},className:`rounded bg-blue-600 px-4 py-1.5 text-[13px] font-medium text-white hover:bg-blue-700 active:bg-blue-800`,children:`Save Configuration`}),(0,J.jsx)(`button`,{onClick:()=>{C(t).filter(e=>e.type===`api_key`).forEach(t=>{t.secret&&re(e,t.secret)}),r(e),window.location.reload()},className:`rounded border border-black/10 px-4 py-1.5 text-[13px] font-medium text-neutral-600 hover:bg-neutral-50 active:bg-neutral-100`,children:`Reset`}),u&&(0,J.jsx)(`span`,{className:`text-[12px] text-red-500`,children:u}),s&&(0,J.jsx)(`span`,{className:`text-[12px] text-green-600 font-medium`,children:`Saved`})]})},Z=({children:e})=>(0,J.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:e}),le=({page:e,viewApiName:t})=>e?(0,J.jsx)(p,{page:e,className:`h-[520px] w-full overflow-hidden rounded border border-black/10`,iframeAllow:_}):(0,J.jsxs)(`p`,{className:`m-0 rounded border border-dashed border-amber-300 bg-amber-50 px-3 py-2.5 text-[12px] text-amber-800`,children:[`This setup assistant delegates to view `,(0,J.jsx)(Z,{children:t}),`, which this plugin does not define. Add a `,(0,J.jsx)(Z,{children:`views/${t}/`}),` component, or drop`,` `,(0,J.jsx)(Z,{children:`view`}),` from the manifest to go back to the declarative assistant.`]}),Q=({level:e,isViewBased:t})=>{let n=e===`user`?`this.userConfig`:`this.config`;return t?(0,J.jsxs)(J.Fragment,{children:[`Setup for this plugin is a view, so it saves its own`,` `,e===`user`?`per-user`:`business-level`,` config by calling`,` `,(0,J.jsx)(Z,{children:`this.completeSetup()`}),` — there is no form or Save button here. Whatever it writes becomes `,(0,J.jsx)(Z,{children:n}),`; use View JSON to inspect it.`]}):e===`user`?(0,J.jsxs)(J.Fragment,{children:[`Configure the per-user setup assistant fields. These values are scoped to the logged-in user and exposed to plugin scripts at `,(0,J.jsx)(Z,{children:n}),`.`]}):(0,J.jsxs)(J.Fragment,{children:[`Configure the business-level setup assistant fields. These values are shared across the whole business and exposed to plugin scripts at `,(0,J.jsx)(Z,{children:n}),`.`]})},$=({config:e,apiName:n,loadFn:r,saveFn:a,clearFn:o,level:c,views:u,userConfigs:f,onConfigWrite:p,plan:m,entitlements:_})=>{let y=s(),x=te(),C=(0,K.useMemo)(()=>ee(x),[x]),{environment:w}=S(),D=T[w],[O,k]=(0,K.useState)(!1),[A,M]=(0,K.useState)(!1),{onMonitoringException:N,dialog:P}=g(),{showToast:F,clearToasts:I}=d(),L=b(c,p),R=j(e),z=l(u,R);return y?(0,J.jsx)(h,{appPath:D,user:{id:y.team.user,crm_client_id:``},business:y.business,userConfigs:f,clientObject:y.business.client_object?{id:y.business.client_object.id,objectName:y.business.client_object.object_name}:void 0,teamMember:y.team,onNavigate:()=>{},performFileUpload:()=>Promise.resolve({url:``}),monitoringExceptionHelper:N,performRequest:E(C),onCompleteSetup:L,modal:{showing:O,show:A,showPrompt:()=>{k(!0),M(!0)},onConfirm:()=>{k(!1),M(!1)},onHide:()=>{k(!1),M(!1)}},showToast:F,clearToasts:I,children:({showPluginModal:t,derivedModalState:i,pluginApiName:s})=>(0,J.jsxs)(J.Fragment,{children:[R===void 0?(0,J.jsx)(se,{config:e,apiName:n,loadFn:r,saveFn:a,clearFn:o,plan:m,entitlements:_}):(0,J.jsx)(le,{page:z,viewApiName:R}),(0,J.jsx)(v,{show:t,config:i.config,pluginApiName:s,onConfirm:i.props.onConfirm,onHide:i.props.onHide,pages:u}),P]})}):(0,J.jsx)(i,{icon:t,className:`animate-spin text-neutral-400`})},ue=()=>{let{apiName:e}=a({strict:!1}),{data:t,isLoading:n,isError:r}=o(x),[i,s]=(0,K.useState)(null),c=P(),[l,u]=(0,K.useState)(!1),d=(0,K.useMemo)(()=>t?.find(t=>t.api_name===e),[t,e]),f=d?.base_config,{configArgs:p,userConfigs:m,refreshConfig:h}=G(e,f,d?.config_template),g=(0,K.useMemo)(()=>d?d.artifacts.routable_pages.map(e=>({...e,plugin_api_name:d.api_name,args:p})):[],[d,p]);if(n)return(0,J.jsx)(A,{children:(0,J.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(r)return(0,J.jsx)(A,{children:(0,J.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});if(!d)return(0,J.jsx)(A,{children:(0,J.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,J.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:e}),`.`]})});let _=f?.setup_assistant,v=f?.user_setup_assistant,y=M(_),b=M(v);return!y&&!b?(0,J.jsx)(A,{children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`Configuration`}),(0,J.jsx)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,children:`Enter plugin configuration as JSON.`})]}),(0,J.jsx)(ae,{apiName:e??``,configTemplate:d.config_template})]})}):(0,J.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start`,children:[y&&_&&(0,J.jsx)(A,{className:`lg:flex-1 lg:min-w-0`,children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`Business Configuration`}),(0,J.jsx)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,children:(0,J.jsx)(Q,{level:`business`,isViewBased:j(_)!==void 0})})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,J.jsx)(`button`,{onClick:()=>{u(!0)},className:`rounded border border-black/10 px-3 py-1.5 text-[12px] font-medium text-neutral-600 hover:bg-neutral-50 active:bg-neutral-100`,children:`Plan & Entitlements`}),(0,J.jsx)(`button`,{onClick:()=>{s(`business`)},className:`rounded border border-black/10 px-3 py-1.5 text-[12px] font-medium text-neutral-600 hover:bg-neutral-50 active:bg-neutral-100`,children:`View JSON`})]})]}),(0,J.jsx)($,{config:_,apiName:e??``,loadFn:F,saveFn:I,clearFn:V,level:`business`,views:g,userConfigs:m,onConfigWrite:h,plan:c.plan,entitlements:c.entitlements})]})}),b&&v&&(0,J.jsx)(A,{className:`lg:flex-1 lg:min-w-0`,children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`User Configuration`}),(0,J.jsx)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,children:(0,J.jsx)(Q,{level:`user`,isViewBased:j(v)!==void 0})})]}),(0,J.jsx)(`button`,{onClick:()=>{s(`user`)},className:`shrink-0 rounded border border-black/10 px-3 py-1.5 text-[12px] font-medium text-neutral-600 hover:bg-neutral-50 active:bg-neutral-100`,children:`View JSON`})]}),(0,J.jsx)($,{config:v,apiName:e??``,loadFn:R,saveFn:z,clearFn:W,level:`user`,views:g,userConfigs:m,onConfigWrite:h,plan:c.plan,entitlements:c.entitlements})]})}),(0,J.jsx)(Y,{open:i===`business`,onClose:()=>{s(null)},apiName:e??``,loadFn:F,label:`this.config`}),(0,J.jsx)(Y,{open:i===`user`,onClose:()=>{s(null)},apiName:e??``,loadFn:R,label:`this.userConfig`}),(0,J.jsx)(oe,{open:l,onClose:()=>{u(!1)},value:c})]})},de=()=>(0,J.jsx)(m,{children:(0,J.jsx)(ue,{})});export{de as ConfigurationPage};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{I as t}from"./fa-core-BSqLAjHu.js";var n=e(t(),1),r=[`go`,`fmo`,`staging`,`integration`,`test1`],i=(0,n.createContext)({apiKey:``,userId:``,businessId:``,environment:`go`}),a=()=>(0,n.useContext)(i);export{a as n,r,i as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{F as t,I as n,N as r,P as i,a,s as o}from"./fa-core-BSqLAjHu.js";import{r as s}from"./CredentialsContext-p3i8s7a6.js";import{n as c,t as l}from"./Dialog-C3QoiHOt.js";import{n as u}from"./storageKeys-BDp-0diL.js";import{t as d}from"./Tooltip-JYkgiL8J.js";var f=e(n(),1),p=t(),m=`integration:route-change`,h=`w-full rounded bg-neutral-800 border border-neutral-700 px-2 py-1 text-[12px] font-mono text-neutral-200 focus:outline-none focus:border-neutral-500`,g=`block text-[11px] font-semibold uppercase tracking-widest text-neutral-600 mb-1`;function _(e){return e.toTimeString().slice(0,8)}var v=()=>{let[e,t]=(0,f.useState)(`/`),[n,r]=(0,f.useState)(``),[i,a]=(0,f.useState)(``),[o,s]=(0,f.useState)([]),c=(0,f.useRef)(null);(0,f.useEffect)(()=>{c.current?.scrollIntoView({behavior:`smooth`})},[o]),(0,f.useEffect)(()=>{let e=e=>{let t=e;s(e=>[...e,{time:new Date,location:t.detail.location}].slice(-50))};return window.addEventListener(m,e),()=>{window.removeEventListener(m,e)}},[]);let l=()=>{let t=n&&!n.startsWith(`?`)?`?${n}`:n,r=i&&!i.startsWith(`#`)?`#${i}`:i,a={host:window.location.host,origin:window.location.origin,port:window.location.port,protocol:window.location.protocol,pathname:e,search:t,hash:r,href:`${window.location.origin}${e}${t}${r}`};window.dispatchEvent(new CustomEvent(m,{detail:{location:a}}))},u=e=>{e.key===`Enter`&&l()};return(0,p.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 pb-3`,children:[(0,p.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,p.jsxs)(`div`,{className:`flex gap-2`,children:[(0,p.jsxs)(`div`,{className:`flex-1`,children:[(0,p.jsx)(`label`,{className:g,children:`Search`}),(0,p.jsx)(`input`,{type:`text`,className:h,value:n,onChange:e=>{r(e.target.value)},onKeyDown:u,placeholder:`?tab=notes`,spellCheck:!1})]}),(0,p.jsxs)(`div`,{className:`flex-1`,children:[(0,p.jsx)(`label`,{className:g,children:`Hash`}),(0,p.jsx)(`input`,{type:`text`,className:h,value:i,onChange:e=>{a(e.target.value)},onKeyDown:u,placeholder:`#section`,spellCheck:!1})]})]}),(0,p.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,p.jsxs)(`div`,{className:`flex-1`,children:[(0,p.jsx)(`label`,{className:g,children:`Pathname`}),(0,p.jsx)(`input`,{type:`text`,className:h,value:e,onChange:e=>{t(e.target.value)},onKeyDown:u,placeholder:`/client/abc-123/overview`,spellCheck:!1})]}),(0,p.jsx)(`button`,{onClick:l,className:`rounded bg-neutral-700 px-3 py-1.5 text-[12px] font-semibold text-neutral-200 hover:bg-neutral-600 active:bg-neutral-500`,children:`Dispatch`})]})]}),(0,p.jsxs)(`div`,{className:`flex flex-col border-t border-neutral-800 pt-2`,children:[(0,p.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,p.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-500`,children:`Navigation Event Stream`}),o.length>0&&(0,p.jsx)(`button`,{onClick:()=>{s([])},className:`text-[11px] text-neutral-600 hover:text-neutral-300`,children:`clear`})]}),(0,p.jsxs)(`div`,{className:`max-h-40 overflow-y-auto`,children:[o.length===0?(0,p.jsx)(`p`,{className:`text-[12px] text-neutral-600`,children:`No events yet.`}):o.map((e,t)=>(0,p.jsxs)(`div`,{className:`px-2 py-0.5 font-mono text-[11px] leading-5 ${t%2==0?`bg-neutral-900`:`bg-neutral-800/40`}`,children:[(0,p.jsx)(`span`,{className:`text-neutral-600`,children:_(e.time)}),(0,p.jsx)(`span`,{className:`ml-2 text-neutral-300`,children:e.location.pathname}),e.location.search&&(0,p.jsx)(`span`,{className:`text-neutral-500`,children:e.location.search}),e.location.hash&&(0,p.jsx)(`span`,{className:`text-neutral-500`,children:e.location.hash})]},t)),(0,p.jsx)(`div`,{ref:c})]})]})]})},y=`w-full rounded bg-neutral-800 border border-neutral-700 px-2 py-1 text-[12px] font-mono text-neutral-200 focus:outline-none focus:border-neutral-500`,b=`block text-[11px] font-semibold uppercase tracking-widest text-neutral-600 mb-1`,x=`text-[11px] font-semibold uppercase tracking-widest text-neutral-500`,S={log:`text-neutral-400`,info:`text-blue-400`,warn:`text-yellow-400`,error:`text-red-400`};function C(e){try{let t=new WeakSet,n=JSON.stringify(e,(e,n)=>{if(typeof n==`bigint`)return`${n.toString()}n`;if(typeof n==`function`)return`[Function: ${n.name||`anonymous`}]`;if(typeof n==`object`&&n){if(t.has(n))return`[Circular]`;t.add(n)}return n},2);return typeof n==`string`?n:`[unserializable]`}catch{return`[unserializable]`}}function w(e,t=16){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,t)}…`}function T(e){if(typeof e==`function`){let t=e,n=t.toString();return{label:`ƒ ${t.name||`anonymous`}`,preview:w(n),full:n}}if(Array.isArray(e)){let t=C(e);return{label:`Array(${String(e.length)})`,preview:w(t),full:t}}if(e instanceof Error){let t=`${e.name}: ${e.message}`;return{label:e.name||`Error`,preview:w(e.message),full:e.stack?`${t}\n${e.stack}`:t}}if(e instanceof Date){let t=e.toISOString();return{label:`Date`,preview:w(t,20),full:t}}if(e instanceof Map){let t=C(Object.fromEntries(e));return{label:`Map(${String(e.size)})`,preview:w(t),full:t}}if(e instanceof Set){let t=C([...e]);return{label:`Set(${String(e.size)})`,preview:w(t),full:t}}if(typeof Node<`u`&&e instanceof Node){let t=e.nodeName.toLowerCase(),n=(e instanceof Element?e.outerHTML:e.textContent)??`<${t}>`;return{label:`<${t}>`,preview:w(n),full:n}}let t=e.constructor?.name,n=t&&t!==`Object`?t:`Object`,r=C(e);return{label:n,preview:w(r),full:r}}var E=({value:e})=>{let[t,n]=(0,f.useState)(!1);if(e===null)return(0,p.jsx)(`span`,{className:`italic text-neutral-500`,children:`null`});if(e===void 0)return(0,p.jsx)(`span`,{className:`italic text-neutral-500`,children:`undefined`});if(typeof e==`string`)return(0,p.jsx)(`span`,{children:e});if(typeof e==`number`||typeof e==`bigint`||typeof e==`boolean`||typeof e==`symbol`)return(0,p.jsx)(`span`,{children:String(e)});let{label:r,preview:i,full:a}=T(e);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`button`,{type:`button`,onClick:()=>{n(!0)},className:`inline-block rounded bg-neutral-700/70 px-1.5 py-0 align-baseline text-[11px] font-mono text-neutral-200 hover:bg-neutral-600`,children:[r,i!==``&&(0,p.jsx)(`span`,{className:`ml-1.5 font-normal text-neutral-400`,children:i})]}),(0,p.jsx)(l,{open:t,size:`xl`,onBackdropClick:()=>{n(!1)},header:(0,p.jsx)(c,{title:r,onClose:()=>{n(!1)}}),children:(0,p.jsx)(`pre`,{className:`m-0 max-h-[60vh] overflow-auto whitespace-pre px-5 py-3 text-[12px] leading-5 text-neutral-800`,children:a})})]})},D=({logs:e,height:t})=>{let n=(0,f.useRef)(null);return(0,f.useEffect)(()=>{n.current?.scrollIntoView({behavior:`smooth`})},[e]),(0,p.jsxs)(`div`,{className:`${t} overflow-x-auto overflow-y-auto pb-4`,children:[e.length===0?(0,p.jsx)(`p`,{className:`px-4 text-[12px] text-neutral-600`,children:`No output yet.`}):e.map((e,t)=>(0,p.jsx)(`div`,{className:`whitespace-pre px-4 py-0.5 text-[12px] leading-5 ${S[e.level]} ${t%2==0?`bg-neutral-900`:`bg-neutral-800/40`}`,children:e.args.map((e,t)=>(0,p.jsxs)(`span`,{children:[t>0&&` `,(0,p.jsx)(E,{value:e})]},t))},t)),(0,p.jsx)(`div`,{ref:n})]})},O=({logs:e,height:t})=>{let n=(0,f.useRef)(null);return(0,f.useEffect)(()=>{n.current?.scrollIntoView({behavior:`smooth`})},[e]),(0,p.jsxs)(`div`,{className:`${t} overflow-x-auto overflow-y-auto pb-4`,children:[e.length===0?(0,p.jsx)(`p`,{className:`px-4 text-[12px] text-neutral-600`,children:`No output yet.`}):e.map((e,t)=>(0,p.jsx)(`div`,{className:`whitespace-pre px-4 text-[12px] leading-5 text-neutral-500`,children:e},t)),(0,p.jsx)(`div`,{ref:n})]})};function k(e){switch(e.toUpperCase()){case`GET`:return`bg-blue-900/60 text-blue-300`;case`POST`:return`bg-green-900/60 text-green-300`;case`PUT`:return`bg-amber-900/60 text-amber-300`;case`PATCH`:return`bg-orange-900/60 text-orange-300`;case`DELETE`:return`bg-red-900/60 text-red-300`;default:return`bg-neutral-800 text-neutral-400`}}function A(e){return e===0?`bg-neutral-800 text-neutral-400`:e<300?`bg-green-900/60 text-green-300`:e<400?`bg-yellow-900/60 text-yellow-300`:e<500?`bg-orange-900/60 text-orange-300`:`bg-red-900/60 text-red-300`}var j=({logs:e,height:t})=>{let n=(0,f.useRef)(null);return(0,f.useEffect)(()=>{n.current?.scrollIntoView({behavior:`smooth`})},[e]),(0,p.jsx)(p.Fragment,{children:(0,p.jsxs)(`div`,{className:`${t} overflow-x-auto overflow-y-auto pb-4`,children:[e.length===0?(0,p.jsx)(`p`,{className:`px-4 text-[12px] text-neutral-600`,children:`No output yet.`}):e.map((e,t)=>(0,p.jsx)(`div`,{className:`flex items-center gap-1.5 px-3 py-0.5 text-[11px] ${t%2==0?`bg-neutral-900`:`bg-neutral-800/40`}`,children:e.kind===`info`?(0,p.jsx)(`span`,{className:`text-neutral-500`,children:e.message}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`span`,{className:`w-12 shrink-0 rounded text-center font-mono font-semibold ${k(e.method)}`,children:e.method}),(0,p.jsx)(`span`,{className:`w-8 shrink-0 rounded text-center font-mono font-semibold ${A(e.status)}`,children:e.status===0?`ERR`:e.status}),e.upstreamStatus!==void 0&&(0,p.jsx)(d,{text:`Third-party API returned ${String(e.upstreamStatus)} (the proxy call itself returned ${String(e.status)})`,children:(0,p.jsxs)(`span`,{className:`flex w-12 shrink-0 cursor-default items-center justify-center gap-1.5 rounded text-center font-mono font-semibold ${A(e.upstreamStatus)}`,children:[(0,p.jsx)(`span`,{className:`text-neutral-500`,children:`→`}),e.upstreamStatus]})}),(0,p.jsx)(`span`,{className:`w-14 shrink-0 rounded text-center font-mono font-semibold ${e.fromCache?`bg-violet-900/60 text-violet-300`:`bg-neutral-800 text-neutral-400`}`,children:e.fromCache?`cache`:`network`}),(0,p.jsx)(d,{text:e.url,children:(0,p.jsx)(`span`,{className:`min-w-0 truncate cursor-default font-mono text-neutral-400`,children:e.url})})]})},t)),(0,p.jsx)(`div`,{ref:n})]})})},M=({onClose:e,buildLogs:t,proxyLogs:n,consoleLogs:c,onClearConsole:l,credentials:d,onCredentialsChange:m,width:h=416,onWidthChange:g})=>{let[_,S]=(0,f.useState)(()=>{let e=localStorage.getItem(u.credsPanelOpen);return e===null?!(d.apiKey&&d.userId&&d.businessId):e!==`false`}),[C,w]=(0,f.useState)([]),[T,E]=(0,f.useState)(void 0),k=(0,f.useCallback)(async()=>{try{let e=await fetch(`/api/credential-profiles`);if(!e.ok)return;let t=await e.json();w(t.profiles),E(t.active)}catch{}},[]);(0,f.useEffect)(()=>{k()},[k]);let A=(0,f.useCallback)(async e=>{let t=e===``?void 0:e;try{await fetch(`/api/credentials/switch`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({profile:t})}),await fetch(`/api/proxy-cache/clear`),E(t)}catch{}},[]),[M,N]=(0,f.useState)(()=>localStorage.getItem(u.routesPanelOpen)!==`false`),[P,F]=(0,f.useState)(()=>localStorage.getItem(u.consolePanelOpen)!==`false`),[I,L]=(0,f.useState)(()=>localStorage.getItem(u.proxyPanelOpen)!==`false`),[R,z]=(0,f.useState)(()=>localStorage.getItem(u.buildPanelOpen)!==`false`),B=(e,t)=>{t(t=>{let n=!t;return localStorage.setItem(e,String(n)),n})},V=(0,f.useRef)(!1),H=(0,f.useCallback)(e=>{e.preventDefault(),V.current=!0;let t=e=>{if(!V.current)return;let t=Math.min(800,Math.max(280,window.innerWidth-e.clientX));g?.(t)},n=()=>{V.current=!1,document.removeEventListener(`mousemove`,t),document.removeEventListener(`mouseup`,n)};document.addEventListener(`mousemove`,t),document.addEventListener(`mouseup`,n)},[g]);return(0,p.jsxs)(`aside`,{className:`relative flex shrink-0 flex-col border-l border-neutral-800 bg-neutral-900 text-neutral-100`,style:{width:h},children:[(0,p.jsx)(`div`,{onMouseDown:H,className:`absolute left-0 top-0 z-10 h-full w-1 cursor-col-resize transition-colors hover:bg-neutral-600`}),(0,p.jsxs)(`div`,{className:`flex items-center justify-between border-b border-neutral-800 px-4 py-3`,children:[(0,p.jsx)(`span`,{className:`text-[12px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Dev Tools`}),(0,p.jsx)(`button`,{onClick:e,className:`text-neutral-500 hover:text-neutral-200`,"aria-label":`Close dev tools`,children:(0,p.jsx)(i,{icon:r,size:`sm`})})]}),(0,p.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:[(0,p.jsxs)(`div`,{className:`flex flex-1 flex-col min-h-0`,children:[(0,p.jsxs)(`div`,{className:`flex shrink-0 flex-col border-b border-neutral-800`,children:[(0,p.jsxs)(`button`,{className:`flex items-center justify-between px-4 py-2 hover:bg-neutral-800/50`,onClick:()=>{B(u.credsPanelOpen,S),k()},children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`span`,{className:x,children:`Credentials`}),!_&&(0,p.jsx)(`span`,{className:`text-[11px] font-mono text-neutral-400`,children:d.environment})]}),(0,p.jsx)(i,{icon:_?a:o,className:`text-neutral-600`,size:`xs`})]}),_&&(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 pb-3`,children:[C.length>1&&(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:b,children:`Profile`}),(0,p.jsx)(`select`,{className:y,value:T??``,onChange:e=>{A(e.target.value)},children:C.map(e=>(0,p.jsx)(`option`,{value:e.isDefault?``:e.name,children:e.isDefault?`Default`:e.name},e.name))})]}),(0,p.jsxs)(`div`,{className:`flex gap-2`,children:[(0,p.jsxs)(`div`,{className:`flex-1`,children:[(0,p.jsx)(`label`,{className:b,children:`Environment`}),(0,p.jsx)(`select`,{className:y,value:d.environment,onChange:e=>{m({...d,environment:e.target.value})},children:s.map(e=>(0,p.jsx)(`option`,{value:e,children:e},e))})]}),(0,p.jsxs)(`div`,{className:`flex-1`,children:[(0,p.jsx)(`label`,{className:b,children:`Business ID`}),(0,p.jsx)(`input`,{type:`text`,className:y,value:d.businessId,onChange:e=>{m({...d,businessId:e.target.value})},placeholder:`x-business-id`,autoComplete:`off`})]})]}),(0,p.jsxs)(`div`,{className:`flex gap-2`,children:[(0,p.jsxs)(`div`,{className:`flex-1`,children:[(0,p.jsx)(`label`,{className:b,children:`User ID`}),(0,p.jsx)(`input`,{type:`text`,className:y,value:d.userId,onChange:e=>{m({...d,userId:e.target.value})},placeholder:`x-user-id`,autoComplete:`off`})]}),(0,p.jsxs)(`div`,{className:`flex-1`,children:[(0,p.jsx)(`label`,{className:b,children:`API Key`}),(0,p.jsx)(`input`,{type:`password`,className:y,value:d.apiKey,onChange:e=>{m({...d,apiKey:e.target.value})},placeholder:`x-api-key`,autoComplete:`off`})]})]}),(0,p.jsx)(`button`,{onClick:()=>{localStorage.clear(),window.location.reload()},className:`text-[11px] text-neutral-600 hover:text-red-400 self-start`,children:`clear storage`})]})]}),(0,p.jsxs)(`div`,{className:`flex shrink-0 flex-col border-t border-neutral-800 overflow-hidden`,children:[(0,p.jsxs)(`button`,{className:`flex items-center justify-between px-4 py-2 hover:bg-neutral-800/50`,onClick:()=>{B(u.routesPanelOpen,N)},children:[(0,p.jsx)(`span`,{className:x,children:`Routes`}),(0,p.jsx)(i,{icon:M?a:o,className:`text-neutral-600`,size:`xs`})]}),M&&(0,p.jsx)(v,{})]}),(0,p.jsxs)(`div`,{className:`flex shrink-0 flex-col border-t border-neutral-800`,children:[(0,p.jsxs)(`div`,{className:`flex items-center px-4 py-2`,children:[(0,p.jsxs)(`button`,{className:`flex flex-1 items-center gap-2 hover:opacity-70`,onClick:()=>{B(u.consolePanelOpen,F)},children:[(0,p.jsx)(`span`,{className:x,children:`Browser Console`}),(0,p.jsx)(i,{icon:P?a:o,className:`text-neutral-600`,size:`xs`})]}),P&&c.length>0&&(0,p.jsx)(`button`,{onClick:l,className:`text-[11px] text-neutral-600 hover:text-neutral-300`,children:`clear`})]}),P&&(0,p.jsx)(D,{logs:c,height:`min-h-32 max-h-64`})]}),(0,p.jsxs)(`div`,{className:`flex flex-1 flex-col min-h-0 border-t border-neutral-800`,children:[(0,p.jsxs)(`div`,{className:`flex items-center px-4 py-2`,children:[(0,p.jsxs)(`button`,{className:`flex flex-1 items-center gap-2 hover:opacity-70`,onClick:()=>{B(u.proxyPanelOpen,L)},children:[(0,p.jsx)(`span`,{className:x,children:`Network Requests`}),(0,p.jsx)(i,{icon:I?a:o,className:`text-neutral-600`,size:`xs`})]}),I&&(0,p.jsx)(`button`,{onClick:()=>{fetch(`/api/proxy-cache/clear`)},className:`text-[11px] text-neutral-600 hover:text-neutral-300`,children:`clear cache`})]}),I&&(0,p.jsx)(j,{logs:n,height:`flex-1 min-h-0`})]})]}),(0,p.jsxs)(`div`,{className:`flex flex-col border-t border-neutral-800`,children:[(0,p.jsxs)(`button`,{className:`flex items-center justify-between px-4 py-2 hover:bg-neutral-800/50`,onClick:()=>{B(u.buildPanelOpen,z)},children:[(0,p.jsx)(`span`,{className:x,children:`Build Log`}),(0,p.jsx)(i,{icon:R?a:o,className:`text-neutral-600`,size:`xs`})]}),R&&(0,p.jsx)(O,{logs:t,height:`max-h-[60px]`})]})]})]})};export{M as DevSidebar};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{F as t,I as n,N as r,P as i,a,s as o}from"./fa-core-BSqLAjHu.js";import{r as s}from"./CredentialsContext-Cwl_xyt_.js";import{n as c,t as l}from"./Dialog-C3QoiHOt.js";import{n as u}from"./storageKeys-BDp-0diL.js";import{t as d}from"./Tooltip-JYkgiL8J.js";var f=e(n(),1),p=t(),m=`integration:route-change`,h=`w-full rounded bg-neutral-800 border border-neutral-700 px-2 py-1 text-[12px] font-mono text-neutral-200 focus:outline-none focus:border-neutral-500`,g=`block text-[11px] font-semibold uppercase tracking-widest text-neutral-600 mb-1`;function _(e){return e.toTimeString().slice(0,8)}var v=()=>{let[e,t]=(0,f.useState)(`/`),[n,r]=(0,f.useState)(``),[i,a]=(0,f.useState)(``),[o,s]=(0,f.useState)([]),c=(0,f.useRef)(null);(0,f.useEffect)(()=>{c.current?.scrollIntoView({behavior:`smooth`})},[o]),(0,f.useEffect)(()=>{let e=e=>{let t=e;s(e=>[...e,{time:new Date,location:t.detail.location}].slice(-50))};return window.addEventListener(m,e),()=>{window.removeEventListener(m,e)}},[]);let l=()=>{let t=n&&!n.startsWith(`?`)?`?${n}`:n,r=i&&!i.startsWith(`#`)?`#${i}`:i,a={host:window.location.host,origin:window.location.origin,port:window.location.port,protocol:window.location.protocol,pathname:e,search:t,hash:r,href:`${window.location.origin}${e}${t}${r}`};window.dispatchEvent(new CustomEvent(m,{detail:{location:a}}))},u=e=>{e.key===`Enter`&&l()};return(0,p.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 pb-3`,children:[(0,p.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,p.jsxs)(`div`,{className:`flex gap-2`,children:[(0,p.jsxs)(`div`,{className:`flex-1`,children:[(0,p.jsx)(`label`,{className:g,children:`Search`}),(0,p.jsx)(`input`,{type:`text`,className:h,value:n,onChange:e=>{r(e.target.value)},onKeyDown:u,placeholder:`?tab=notes`,spellCheck:!1})]}),(0,p.jsxs)(`div`,{className:`flex-1`,children:[(0,p.jsx)(`label`,{className:g,children:`Hash`}),(0,p.jsx)(`input`,{type:`text`,className:h,value:i,onChange:e=>{a(e.target.value)},onKeyDown:u,placeholder:`#section`,spellCheck:!1})]})]}),(0,p.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,p.jsxs)(`div`,{className:`flex-1`,children:[(0,p.jsx)(`label`,{className:g,children:`Pathname`}),(0,p.jsx)(`input`,{type:`text`,className:h,value:e,onChange:e=>{t(e.target.value)},onKeyDown:u,placeholder:`/client/abc-123/overview`,spellCheck:!1})]}),(0,p.jsx)(`button`,{onClick:l,className:`rounded bg-neutral-700 px-3 py-1.5 text-[12px] font-semibold text-neutral-200 hover:bg-neutral-600 active:bg-neutral-500`,children:`Dispatch`})]})]}),(0,p.jsxs)(`div`,{className:`flex flex-col border-t border-neutral-800 pt-2`,children:[(0,p.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,p.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-500`,children:`Navigation Event Stream`}),o.length>0&&(0,p.jsx)(`button`,{onClick:()=>{s([])},className:`text-[11px] text-neutral-600 hover:text-neutral-300`,children:`clear`})]}),(0,p.jsxs)(`div`,{className:`max-h-40 overflow-y-auto`,children:[o.length===0?(0,p.jsx)(`p`,{className:`text-[12px] text-neutral-600`,children:`No events yet.`}):o.map((e,t)=>(0,p.jsxs)(`div`,{className:`px-2 py-0.5 font-mono text-[11px] leading-5 ${t%2==0?`bg-neutral-900`:`bg-neutral-800/40`}`,children:[(0,p.jsx)(`span`,{className:`text-neutral-600`,children:_(e.time)}),(0,p.jsx)(`span`,{className:`ml-2 text-neutral-300`,children:e.location.pathname}),e.location.search&&(0,p.jsx)(`span`,{className:`text-neutral-500`,children:e.location.search}),e.location.hash&&(0,p.jsx)(`span`,{className:`text-neutral-500`,children:e.location.hash})]},t)),(0,p.jsx)(`div`,{ref:c})]})]})]})},y=`w-full rounded bg-neutral-800 border border-neutral-700 px-2 py-1 text-[12px] font-mono text-neutral-200 focus:outline-none focus:border-neutral-500`,b=`block text-[11px] font-semibold uppercase tracking-widest text-neutral-600 mb-1`,x=`text-[11px] font-semibold uppercase tracking-widest text-neutral-500`,S={log:`text-neutral-400`,info:`text-blue-400`,warn:`text-yellow-400`,error:`text-red-400`};function C(e){try{let t=new WeakSet,n=JSON.stringify(e,(e,n)=>{if(typeof n==`bigint`)return`${n.toString()}n`;if(typeof n==`function`)return`[Function: ${n.name||`anonymous`}]`;if(typeof n==`object`&&n){if(t.has(n))return`[Circular]`;t.add(n)}return n},2);return typeof n==`string`?n:`[unserializable]`}catch{return`[unserializable]`}}function w(e,t=16){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,t)}…`}function T(e){if(typeof e==`function`){let t=e,n=t.toString();return{label:`ƒ ${t.name||`anonymous`}`,preview:w(n),full:n}}if(Array.isArray(e)){let t=C(e);return{label:`Array(${String(e.length)})`,preview:w(t),full:t}}if(e instanceof Error){let t=`${e.name}: ${e.message}`;return{label:e.name||`Error`,preview:w(e.message),full:e.stack?`${t}\n${e.stack}`:t}}if(e instanceof Date){let t=e.toISOString();return{label:`Date`,preview:w(t,20),full:t}}if(e instanceof Map){let t=C(Object.fromEntries(e));return{label:`Map(${String(e.size)})`,preview:w(t),full:t}}if(e instanceof Set){let t=C([...e]);return{label:`Set(${String(e.size)})`,preview:w(t),full:t}}if(typeof Node<`u`&&e instanceof Node){let t=e.nodeName.toLowerCase(),n=(e instanceof Element?e.outerHTML:e.textContent)??`<${t}>`;return{label:`<${t}>`,preview:w(n),full:n}}let t=e.constructor?.name,n=t&&t!==`Object`?t:`Object`,r=C(e);return{label:n,preview:w(r),full:r}}var E=({value:e})=>{let[t,n]=(0,f.useState)(!1);if(e===null)return(0,p.jsx)(`span`,{className:`italic text-neutral-500`,children:`null`});if(e===void 0)return(0,p.jsx)(`span`,{className:`italic text-neutral-500`,children:`undefined`});if(typeof e==`string`)return(0,p.jsx)(`span`,{children:e});if(typeof e==`number`||typeof e==`bigint`||typeof e==`boolean`||typeof e==`symbol`)return(0,p.jsx)(`span`,{children:String(e)});let{label:r,preview:i,full:a}=T(e);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`button`,{type:`button`,onClick:()=>{n(!0)},className:`inline-block rounded bg-neutral-700/70 px-1.5 py-0 align-baseline text-[11px] font-mono text-neutral-200 hover:bg-neutral-600`,children:[r,i!==``&&(0,p.jsx)(`span`,{className:`ml-1.5 font-normal text-neutral-400`,children:i})]}),(0,p.jsx)(l,{open:t,size:`xl`,onBackdropClick:()=>{n(!1)},header:(0,p.jsx)(c,{title:r,onClose:()=>{n(!1)}}),children:(0,p.jsx)(`pre`,{className:`m-0 max-h-[60vh] overflow-auto whitespace-pre px-5 py-3 text-[12px] leading-5 text-neutral-800`,children:a})})]})},D=({logs:e,height:t})=>{let n=(0,f.useRef)(null);return(0,f.useEffect)(()=>{n.current?.scrollIntoView({behavior:`smooth`})},[e]),(0,p.jsxs)(`div`,{className:`${t} overflow-x-auto overflow-y-auto pb-4`,children:[e.length===0?(0,p.jsx)(`p`,{className:`px-4 text-[12px] text-neutral-600`,children:`No output yet.`}):e.map((e,t)=>(0,p.jsx)(`div`,{className:`whitespace-pre px-4 py-0.5 text-[12px] leading-5 ${S[e.level]} ${t%2==0?`bg-neutral-900`:`bg-neutral-800/40`}`,children:e.args.map((e,t)=>(0,p.jsxs)(`span`,{children:[t>0&&` `,(0,p.jsx)(E,{value:e})]},t))},t)),(0,p.jsx)(`div`,{ref:n})]})},O=({logs:e,height:t})=>{let n=(0,f.useRef)(null);return(0,f.useEffect)(()=>{n.current?.scrollIntoView({behavior:`smooth`})},[e]),(0,p.jsxs)(`div`,{className:`${t} overflow-x-auto overflow-y-auto pb-4`,children:[e.length===0?(0,p.jsx)(`p`,{className:`px-4 text-[12px] text-neutral-600`,children:`No output yet.`}):e.map((e,t)=>(0,p.jsx)(`div`,{className:`whitespace-pre px-4 text-[12px] leading-5 text-neutral-500`,children:e},t)),(0,p.jsx)(`div`,{ref:n})]})};function k(e){switch(e.toUpperCase()){case`GET`:return`bg-blue-900/60 text-blue-300`;case`POST`:return`bg-green-900/60 text-green-300`;case`PUT`:return`bg-amber-900/60 text-amber-300`;case`PATCH`:return`bg-orange-900/60 text-orange-300`;case`DELETE`:return`bg-red-900/60 text-red-300`;default:return`bg-neutral-800 text-neutral-400`}}function A(e){return e===0?`bg-neutral-800 text-neutral-400`:e<300?`bg-green-900/60 text-green-300`:e<400?`bg-yellow-900/60 text-yellow-300`:e<500?`bg-orange-900/60 text-orange-300`:`bg-red-900/60 text-red-300`}var j=({logs:e,height:t})=>{let n=(0,f.useRef)(null);return(0,f.useEffect)(()=>{n.current?.scrollIntoView({behavior:`smooth`})},[e]),(0,p.jsx)(p.Fragment,{children:(0,p.jsxs)(`div`,{className:`${t} overflow-x-auto overflow-y-auto pb-4`,children:[e.length===0?(0,p.jsx)(`p`,{className:`px-4 text-[12px] text-neutral-600`,children:`No output yet.`}):e.map((e,t)=>(0,p.jsx)(`div`,{className:`flex items-center gap-1.5 px-3 py-0.5 text-[11px] ${t%2==0?`bg-neutral-900`:`bg-neutral-800/40`}`,children:e.kind===`info`?(0,p.jsx)(`span`,{className:`text-neutral-500`,children:e.message}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`span`,{className:`w-12 shrink-0 rounded text-center font-mono font-semibold ${k(e.method)}`,children:e.method}),(0,p.jsx)(`span`,{className:`w-8 shrink-0 rounded text-center font-mono font-semibold ${A(e.status)}`,children:e.status===0?`ERR`:e.status}),e.upstreamStatus!==void 0&&(0,p.jsx)(d,{text:`Third-party API returned ${String(e.upstreamStatus)} (the proxy call itself returned ${String(e.status)})`,children:(0,p.jsxs)(`span`,{className:`flex w-12 shrink-0 cursor-default items-center justify-center gap-1.5 rounded text-center font-mono font-semibold ${A(e.upstreamStatus)}`,children:[(0,p.jsx)(`span`,{className:`text-neutral-500`,children:`→`}),e.upstreamStatus]})}),(0,p.jsx)(`span`,{className:`w-14 shrink-0 rounded text-center font-mono font-semibold ${e.fromCache?`bg-violet-900/60 text-violet-300`:`bg-neutral-800 text-neutral-400`}`,children:e.fromCache?`cache`:`network`}),(0,p.jsx)(d,{text:e.url,children:(0,p.jsx)(`span`,{className:`min-w-0 truncate cursor-default font-mono text-neutral-400`,children:e.url})})]})},t)),(0,p.jsx)(`div`,{ref:n})]})})},M=({onClose:e,buildLogs:t,proxyLogs:n,consoleLogs:c,onClearConsole:l,credentials:d,onCredentialsChange:m,width:h=416,onWidthChange:g})=>{let[_,S]=(0,f.useState)(()=>{let e=localStorage.getItem(u.credsPanelOpen);return e===null?!(d.apiKey&&d.userId&&d.businessId):e!==`false`}),[C,w]=(0,f.useState)([]),[T,E]=(0,f.useState)(void 0),k=(0,f.useCallback)(async()=>{try{let e=await fetch(`/api/credential-profiles`);if(!e.ok)return;let t=await e.json();w(t.profiles),E(t.active)}catch{}},[]);(0,f.useEffect)(()=>{k()},[k]);let A=(0,f.useCallback)(async e=>{let t=e===``?void 0:e;try{await fetch(`/api/credentials/switch`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({profile:t})}),await fetch(`/api/proxy-cache/clear`),E(t)}catch{}},[]),[M,N]=(0,f.useState)(()=>localStorage.getItem(u.routesPanelOpen)!==`false`),[P,F]=(0,f.useState)(()=>localStorage.getItem(u.consolePanelOpen)!==`false`),[I,L]=(0,f.useState)(()=>localStorage.getItem(u.proxyPanelOpen)!==`false`),[R,z]=(0,f.useState)(()=>localStorage.getItem(u.buildPanelOpen)!==`false`),B=(e,t)=>{t(t=>{let n=!t;return localStorage.setItem(e,String(n)),n})},V=(0,f.useRef)(!1),H=(0,f.useCallback)(e=>{e.preventDefault(),V.current=!0;let t=e=>{if(!V.current)return;let t=Math.min(800,Math.max(280,window.innerWidth-e.clientX));g?.(t)},n=()=>{V.current=!1,document.removeEventListener(`mousemove`,t),document.removeEventListener(`mouseup`,n)};document.addEventListener(`mousemove`,t),document.addEventListener(`mouseup`,n)},[g]);return(0,p.jsxs)(`aside`,{className:`relative flex shrink-0 flex-col border-l border-neutral-800 bg-neutral-900 text-neutral-100`,style:{width:h},children:[(0,p.jsx)(`div`,{onMouseDown:H,className:`absolute left-0 top-0 z-10 h-full w-1 cursor-col-resize transition-colors hover:bg-neutral-600`}),(0,p.jsxs)(`div`,{className:`flex items-center justify-between border-b border-neutral-800 px-4 py-3`,children:[(0,p.jsx)(`span`,{className:`text-[12px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Dev Tools`}),(0,p.jsx)(`button`,{onClick:e,className:`text-neutral-500 hover:text-neutral-200`,"aria-label":`Close dev tools`,children:(0,p.jsx)(i,{icon:r,size:`sm`})})]}),(0,p.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:[(0,p.jsxs)(`div`,{className:`flex flex-1 flex-col min-h-0`,children:[(0,p.jsxs)(`div`,{className:`flex shrink-0 flex-col border-b border-neutral-800`,children:[(0,p.jsxs)(`button`,{className:`flex items-center justify-between px-4 py-2 hover:bg-neutral-800/50`,onClick:()=>{B(u.credsPanelOpen,S),k()},children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`span`,{className:x,children:`Credentials`}),!_&&(0,p.jsx)(`span`,{className:`text-[11px] font-mono text-neutral-400`,children:d.environment})]}),(0,p.jsx)(i,{icon:_?a:o,className:`text-neutral-600`,size:`xs`})]}),_&&(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 pb-3`,children:[C.length>1&&(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:b,children:`Profile`}),(0,p.jsx)(`select`,{className:y,value:T??``,onChange:e=>{A(e.target.value)},children:C.map(e=>(0,p.jsx)(`option`,{value:e.isDefault?``:e.name,children:e.isDefault?`Default`:e.name},e.name))})]}),(0,p.jsxs)(`div`,{className:`flex gap-2`,children:[(0,p.jsxs)(`div`,{className:`flex-1`,children:[(0,p.jsx)(`label`,{className:b,children:`Environment`}),(0,p.jsx)(`select`,{className:y,value:d.environment,onChange:e=>{m({...d,environment:e.target.value})},children:s.map(e=>(0,p.jsx)(`option`,{value:e,children:e},e))})]}),(0,p.jsxs)(`div`,{className:`flex-1`,children:[(0,p.jsx)(`label`,{className:b,children:`Business ID`}),(0,p.jsx)(`input`,{type:`text`,className:y,value:d.businessId,onChange:e=>{m({...d,businessId:e.target.value})},placeholder:`x-business-id`,autoComplete:`off`})]})]}),(0,p.jsxs)(`div`,{className:`flex gap-2`,children:[(0,p.jsxs)(`div`,{className:`flex-1`,children:[(0,p.jsx)(`label`,{className:b,children:`User ID`}),(0,p.jsx)(`input`,{type:`text`,className:y,value:d.userId,onChange:e=>{m({...d,userId:e.target.value})},placeholder:`x-user-id`,autoComplete:`off`})]}),(0,p.jsxs)(`div`,{className:`flex-1`,children:[(0,p.jsx)(`label`,{className:b,children:`API Key`}),(0,p.jsx)(`input`,{type:`password`,className:y,value:d.apiKey,onChange:e=>{m({...d,apiKey:e.target.value})},placeholder:`x-api-key`,autoComplete:`off`})]})]}),(0,p.jsx)(`button`,{onClick:()=>{localStorage.clear(),window.location.reload()},className:`text-[11px] text-neutral-600 hover:text-red-400 self-start`,children:`clear storage`})]})]}),(0,p.jsxs)(`div`,{className:`flex shrink-0 flex-col border-t border-neutral-800 overflow-hidden`,children:[(0,p.jsxs)(`button`,{className:`flex items-center justify-between px-4 py-2 hover:bg-neutral-800/50`,onClick:()=>{B(u.routesPanelOpen,N)},children:[(0,p.jsx)(`span`,{className:x,children:`Routes`}),(0,p.jsx)(i,{icon:M?a:o,className:`text-neutral-600`,size:`xs`})]}),M&&(0,p.jsx)(v,{})]}),(0,p.jsxs)(`div`,{className:`flex shrink-0 flex-col border-t border-neutral-800`,children:[(0,p.jsxs)(`div`,{className:`flex items-center px-4 py-2`,children:[(0,p.jsxs)(`button`,{className:`flex flex-1 items-center gap-2 hover:opacity-70`,onClick:()=>{B(u.consolePanelOpen,F)},children:[(0,p.jsx)(`span`,{className:x,children:`Browser Console`}),(0,p.jsx)(i,{icon:P?a:o,className:`text-neutral-600`,size:`xs`})]}),P&&c.length>0&&(0,p.jsx)(`button`,{onClick:l,className:`text-[11px] text-neutral-600 hover:text-neutral-300`,children:`clear`})]}),P&&(0,p.jsx)(D,{logs:c,height:`min-h-32 max-h-64`})]}),(0,p.jsxs)(`div`,{className:`flex flex-1 flex-col min-h-0 border-t border-neutral-800`,children:[(0,p.jsxs)(`div`,{className:`flex items-center px-4 py-2`,children:[(0,p.jsxs)(`button`,{className:`flex flex-1 items-center gap-2 hover:opacity-70`,onClick:()=>{B(u.proxyPanelOpen,L)},children:[(0,p.jsx)(`span`,{className:x,children:`Network Requests`}),(0,p.jsx)(i,{icon:I?a:o,className:`text-neutral-600`,size:`xs`})]}),I&&(0,p.jsx)(`button`,{onClick:()=>{fetch(`/api/proxy-cache/clear`)},className:`text-[11px] text-neutral-600 hover:text-neutral-300`,children:`clear cache`})]}),I&&(0,p.jsx)(j,{logs:n,height:`flex-1 min-h-0`})]})]}),(0,p.jsxs)(`div`,{className:`flex flex-col border-t border-neutral-800`,children:[(0,p.jsxs)(`button`,{className:`flex items-center justify-between px-4 py-2 hover:bg-neutral-800/50`,onClick:()=>{B(u.buildPanelOpen,z)},children:[(0,p.jsx)(`span`,{className:x,children:`Build Log`}),(0,p.jsx)(i,{icon:R?a:o,className:`text-neutral-600`,size:`xs`})]}),R&&(0,p.jsx)(O,{logs:t,height:`max-h-[60px]`})]})]})]})};export{M as DevSidebar};