@kizenapps/cli 1.10.0-0a9fae5 → 1.10.0
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.
- package/README.md +172 -15
- package/dist/THIRD-PARTY-NOTICES.txt +4342 -0
- package/dist/index.js +24 -24
- package/dist/index.js.map +1 -1
- package/dist/viewer/assets/AppDetailPage-D9xr-bY8.js +1 -0
- package/dist/viewer/assets/{CodeStepsPage-BjnqiAQX.js → CodeStepsPage-CvCrJCQn.js} +1 -1
- package/dist/viewer/assets/{ConfigurationPage-XUysfO8v.js → ConfigurationPage-5qOX-sx0.js} +1 -1
- package/dist/viewer/assets/IconReferencePage-BxPfyqlV.js +1 -0
- package/dist/viewer/assets/SandboxPage-DuCHX1FY.js +1 -0
- package/dist/viewer/assets/{SecretsPage-BwDfBKbY.js → SecretsPage-Da55-e_S.js} +1 -1
- package/dist/viewer/assets/{SourceBrowserPage-D9z0jLNw.js → SourceBrowserPage-DluS8U4q.js} +1 -1
- package/dist/viewer/assets/blockDimensions-BhWxVVcK.js +1 -0
- package/dist/viewer/assets/{index-C570aZ49.js → index-Du4zThGL.js} +2 -2
- package/dist/viewer/assets/index-MRuQEa3q.css +2 -0
- package/dist/viewer/assets/{useCompleteSetup-3RGdCYrc.js → useCompleteSetup-DUHoBgca.js} +1 -1
- package/dist/viewer/assets/{usePluginConfig-XFnehL_S.js → usePluginConfig-C8d13THZ.js} +1 -1
- package/dist/viewer/assets/validIcons-D8mhuO5s.js +1 -0
- package/dist/viewer/index.html +2 -2
- package/package.json +27 -8
- package/dist/viewer/assets/AppDetailPage-CKDgNuvS.js +0 -1
- package/dist/viewer/assets/IconReferencePage-CN9Tha2W.js +0 -1
- package/dist/viewer/assets/SandboxPage-DbMklAzy.js +0 -1
- package/dist/viewer/assets/blockDimensions-XngD6WWh.js +0 -1
- package/dist/viewer/assets/fa-pro-icons-B6J9phvt.js +0 -1
- package/dist/viewer/assets/iconMap-B-cS2yrx.js +0 -1
- package/dist/viewer/assets/index-CortCmDi.css +0 -2
- /package/dist/viewer/assets/{CodeViewer-DpJLTTab.js → CodeViewer-CVECJY4e.js} +0 -0
- /package/dist/viewer/assets/{VersionsPage-CRnStnQ-.js → VersionsPage-yNilRkEf.js} +0 -0
- /package/dist/viewer/assets/{WhenBadge-Dm7YHpxd.js → WhenBadge-B7s7fns2.js} +0 -0
- /package/dist/viewer/assets/{formatBytes-BV6bvmhE.js → formatBytes-BXYIMbyB.js} +0 -0
- /package/dist/viewer/assets/{setupAssistant-C-3V_Vj3.js → setupAssistant-DtI9NWXr.js} +0 -0
- /package/dist/viewer/assets/{useLocalStorage-BZr9ZJI5.js → useLocalStorage-wp83IS34.js} +0 -0
|
@@ -0,0 +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.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})]}),e.action_type&&(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.action_type})]},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 +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--Ax6VWLq.js";import{t as p}from"./Card-Sa52PGkn.js";import{t as m}from"./CodeViewer-DpJLTTab.js";import{t as h}from"./useLocalStorage-BZr9ZJI5.js";import{t as g}from"./usePluginConfig-XFnehL_S.js";import{t as _}from"./WhenBadge-Dm7YHpxd.js";var v=e(i(),1),y=r(),b=({title:e,defaultOpen:t=!1,children:n})=>{let[r,i]=(0,v.useState)(t);return(0,y.jsxs)(`div`,{children:[(0,y.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,y.jsx)(a,{icon:r?o:s,className:`w-2.5`}),e]}),r&&(0,y.jsx)(`div`,{className:`pb-2`,children:n})]})},x=({result:e})=>{let t=Object.entries(e.outputValues);return(0,y.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-black/10 bg-white p-4`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.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,y.jsxs)(`span`,{className:`text-[11px] text-neutral-400`,children:[String(e.durationMs),`ms`]}),e.exitCode!==0&&(0,y.jsxs)(`span`,{className:`text-[11px] text-neutral-400`,children:[`exit code `,String(e.exitCode)]}),(0,y.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,y.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,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`mb-1 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Outputs`}),(0,y.jsx)(`div`,{className:`divide-y divide-black/5`,children:t.map(([e,t])=>(0,y.jsxs)(`div`,{className:`flex items-start gap-2 py-1.5`,children:[(0,y.jsx)(`span`,{className:`shrink-0 font-mono text-[12px] text-neutral-600`,children:e}),(0,y.jsx)(`span`,{className:`text-[11px] text-neutral-300`,children:`=`}),(0,y.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,y.jsx)(b,{title:`Logs (${String(e.logs.length)})`,children:(0,y.jsx)(`div`,{className:`space-y-0.5`,children:e.logs.map((e,t)=>(0,y.jsx)(`div`,{className:`font-mono text-[12px] text-neutral-600`,children:e},t))})}),e.stdout&&(0,y.jsx)(b,{title:`Stdout`,children:(0,y.jsx)(`pre`,{className:`overflow-auto rounded bg-neutral-50 p-3 font-mono text-[12px] text-neutral-700`,children:e.stdout})}),e.stderr&&(0,y.jsx)(b,{title:`Stderr`,children:(0,y.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,y.jsx)(b,{title:`Network (${String(e.httpRequests.count)}${e.httpRequests.notLogged>0?`, ${String(e.httpRequests.notLogged)} not logged`:``})`,children:(0,y.jsx)(`div`,{className:`space-y-1.5`,children:e.httpRequests.requests.map((e,t)=>(0,y.jsx)(w,{request:e},t))})})]})},S=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`}},C=(e,t)=>t||e>=500?`text-red-700`:e>=400?`text-amber-700`:e>=200?`text-green-700`:`text-neutral-600`,w=({request:e})=>{let[t,n]=(0,v.useState)(!1),r=e.requestErrorType!==null;return(0,y.jsxs)(`div`,{className:`rounded border border-black/5 bg-neutral-50`,children:[(0,y.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,y.jsx)(a,{icon:t?o:s,className:`w-2.5 text-neutral-400`}),(0,y.jsx)(`span`,{className:`rounded px-1.5 py-0.5 font-mono text-[10px] font-semibold ${S(e.method)}`,children:e.method}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12px] text-neutral-700`,children:e.url}),(0,y.jsx)(`span`,{className:`font-mono text-[11px] font-semibold ${C(e.responseStatusCode,r)}`,children:r?e.requestErrorType:e.responseStatusCode}),(0,y.jsxs)(`span`,{className:`font-mono text-[10px] text-neutral-400`,children:[(e.duration*1e3).toFixed(0),`ms`]})]}),t&&(0,y.jsxs)(`div`,{className:`space-y-2 border-t border-black/5 p-2.5`,children:[(0,y.jsx)(T,{title:`Request Headers`,data:e.headers}),e.body&&(0,y.jsx)(E,{title:`Request Body`,body:e.body}),(0,y.jsx)(T,{title:`Response Headers`,data:e.responseHeaders}),e.responseBody&&(0,y.jsx)(E,{title:`Response Body`,body:e.responseBody})]})]})},T=({title:e,data:t})=>{let n=Object.entries(t);return n.length===0?null:(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-widest text-neutral-400`,children:e}),(0,y.jsx)(`div`,{className:`divide-y divide-black/5 rounded border border-black/5 bg-white`,children:n.map(([e,t])=>(0,y.jsxs)(`div`,{className:`flex gap-2 px-2 py-1 font-mono text-[11px]`,children:[(0,y.jsxs)(`span`,{className:`shrink-0 text-neutral-500`,children:[e,`:`]}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 break-all text-neutral-800`,children:t})]},e))})]})},E=({title:e,body:t})=>(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-widest text-neutral-400`,children:e}),(0,y.jsx)(`pre`,{className:`overflow-auto rounded border border-black/5 bg-white p-2 font-mono text-[11px] text-neutral-800`,children:t})]}),D=[`python-3-12`,`python-3-13`],O=`python-3-13`,k={text:`s`,string:`s`,number:`n`,integer:`n`,boolean:`b`,date:`d`,datetime:`dt`,phone:`p`,phonenumber:`p`,uuid:`u`,file:`f`,list:`l`};function A(e){return k[e.toLowerCase()]??`s`}function j(e){return D.includes(e)}function M(e,t){let n=Object.keys(e);if(n.length===0)return null;let r={};for(let i of n)r[i]={t:A(t[i]??`string`),v:e[i]};return r}function N(e){let t=Object.keys(e);if(t.length===0)return null;let n={};for(let r of t)n[r]=A(e[r]??`string`);return n}function P(e){if(!e)return{};let t={};for(let[n,r]of Object.entries(e))t[n]=r.v;return t}function F(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 I(e,t){let n=Date.now(),r=t.scriptRuntime||O;if(!j(r))return{success:!1,outputValues:{},logs:[],stdout:``,stderr:``,error:`Unsupported runtime "${r}". Supported runtimes: ${D.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:M(t.inputs,t.inputTypes),output_types:N(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=F(a.http_requests),c={success:!o,outputValues:P(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 L=()=>{let{apiName:e,stepApiName:r}=l({strict:!1}),i=c(),{data:o,isLoading:s,isError:b}=u(d),S=f(),[C,w]=(0,v.useState)(!1),[T,E]=(0,v.useState)(null),[D,O]=h(`kizen-step-inputs:${e??``}:${r??``}`,{}),[k,A]=h(`kizen-step-secrets:${e??``}:${r??``}`,{}),[j,M]=h(`kizen-code-runner-mode`,`local`),N=(0,v.useMemo)(()=>o?.find(t=>t.api_name===e),[o,e]),P=(0,v.useMemo)(()=>N?.artifacts.automation_action_configs??[],[N]),F=P.find(e=>e.action_step_api_name===r)??P[0],L=N?.base_config,{whenState:R}=g(e,L,N?.config_template);if((0,v.useEffect)(()=>{if(!r&&P.length>0&&e){let t=P[0];t&&i({to:`/$apiName/code-steps/$stepApiName`,params:{apiName:e,stepApiName:t.action_step_api_name},replace:!0})}},[r,P,e,i]),(0,v.useEffect)(()=>{E(null)},[r]),s)return(0,y.jsx)(p,{children:(0,y.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(b)return(0,y.jsx)(p,{children:(0,y.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});if(!N)return(0,y.jsx)(p,{children:(0,y.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,y.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:e}),`.`]})});if(P.length===0)return(0,y.jsx)(p,{children:(0,y.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:`This app has no automation code steps.`})});if(!F)return(0,y.jsx)(p,{children:(0,y.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`Step not found: `,(0,y.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:r}),`.`]})});let z=async()=>{w(!0),E(null);try{let t=Object.fromEntries(F.inputs.map(e=>[e.name,D[e.name]??``])),n;n=j===`remote`?await I(S,{script:F.script,scriptRuntime:F.script_runtime,inputs:t,inputTypes:Object.fromEntries(F.inputs.map(e=>[e.name,e.data_type])),outputTypes:Object.fromEntries(F.outputs.map(e=>[e.name,e.data_type])),secretNames:F.secrets.map(t=>`${e??``}__${t}`)}):await(await fetch(`/api/execute-step`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({script:F.script,scriptRuntime:F.script_runtime,inputs:t,secrets:Object.fromEntries(F.secrets.map(t=>[`${e??``}__${t}`,k[t]??``]))})})).json(),E(n)}catch(e){E({success:!1,outputValues:{},logs:[],stdout:``,stderr:``,error:e instanceof Error?e.message:String(e),exitCode:1,durationMs:0})}finally{w(!1)}};return(0,y.jsxs)(`div`,{className:`space-y-4`,children:[(0,y.jsxs)(p,{children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,y.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Code Step`}),(0,y.jsx)(`select`,{value:F.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:P.map(e=>(0,y.jsx)(`option`,{value:e.action_step_api_name,children:e.name},e.action_step_api_name))}),(0,y.jsx)(`div`,{className:`flex-1`}),(0,y.jsx)(`span`,{className:`rounded bg-blue-50 px-1.5 py-0.5 text-[10px] font-semibold text-blue-600`,children:F.script_runtime})]}),F.overall_description&&(0,y.jsx)(`p`,{className:`mt-2 text-[12px] text-neutral-500`,children:F.overall_description}),F.when&&(0,y.jsx)(`div`,{className:`mt-2`,children:(0,y.jsx)(_,{when:F.when,whenState:R})})]}),(0,y.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-3`,children:[(0,y.jsxs)(p,{children:[(0,y.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Inputs`}),F.inputs.length>0?(0,y.jsx)(`div`,{className:`space-y-3`,children:F.inputs.map(e=>(0,y.jsxs)(`div`,{children:[(0,y.jsxs)(`label`,{className:`mb-1 block text-[12px] text-neutral-700`,children:[e.label,e.required&&(0,y.jsx)(`span`,{className:`ml-0.5 text-red-500`,children:`*`})]}),(0,y.jsx)(`input`,{type:`text`,value:D[e.name]??``,onChange:t=>{O({...D,[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,y.jsx)(`div`,{className:`mt-0.5 font-mono text-[10px] text-neutral-400`,children:e.name})]},e.name))}):(0,y.jsx)(`p`,{className:`m-0 text-[12px] text-neutral-400`,children:`None defined.`})]}),(0,y.jsxs)(p,{children:[(0,y.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Outputs`}),F.outputs.length>0?(0,y.jsx)(`div`,{className:`space-y-2`,children:F.outputs.map(e=>(0,y.jsxs)(`div`,{className:`flex items-baseline gap-2 rounded border border-black/5 bg-neutral-50 px-2.5 py-1.5`,children:[(0,y.jsx)(`span`,{className:`text-[13px] text-neutral-700`,children:e.label}),(0,y.jsx)(`span`,{className:`font-mono text-[10px] text-neutral-400`,children:e.name}),(0,y.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,y.jsx)(`p`,{className:`m-0 text-[12px] text-neutral-400`,children:`None defined.`})]}),(0,y.jsxs)(p,{children:[(0,y.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Secrets`}),j===`remote`&&(0,y.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.`}),F.secrets.length>0?(0,y.jsx)(`div`,{className:`space-y-3`,children:F.secrets.map(e=>(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`label`,{className:`mb-1 block text-[12px] text-neutral-700`,children:e}),(0,y.jsx)(`input`,{type:`password`,value:k[e]??``,onChange:t=>{A({...k,[e]:t.target.value})},placeholder:e,disabled:j===`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,y.jsx)(`p`,{className:`m-0 text-[12px] text-neutral-400`,children:`None defined.`})]})]}),(0,y.jsx)(m,{code:F.script,language:`python`,onRun:()=>void z(),isRunning:C,executionMode:j,onModeChange:M}),(0,y.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:T?(0,y.jsx)(x,{result:T}):(0,y.jsx)(`div`,{className:`flex items-center gap-2 rounded-lg border border-dashed border-black/10 bg-white px-4 py-3`,children:C?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a,{icon:t,className:`animate-spin text-neutral-400`}),(0,y.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Running step…`})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a,{icon:n,className:`text-neutral-300`}),(0,y.jsx)(`span`,{className:`text-[12px] text-neutral-400`,children:`Run the step to see output, logs, and network activity here.`})]})})})]})};export{L as CodeStepsPage};
|
|
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--Ax6VWLq.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-C8d13THZ.js";import{t as _}from"./WhenBadge-B7s7fns2.js";var v=e(i(),1),y=r(),b=({title:e,defaultOpen:t=!1,children:n})=>{let[r,i]=(0,v.useState)(t);return(0,y.jsxs)(`div`,{children:[(0,y.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,y.jsx)(a,{icon:r?o:s,className:`w-2.5`}),e]}),r&&(0,y.jsx)(`div`,{className:`pb-2`,children:n})]})},x=({result:e})=>{let t=Object.entries(e.outputValues);return(0,y.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-black/10 bg-white p-4`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.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,y.jsxs)(`span`,{className:`text-[11px] text-neutral-400`,children:[String(e.durationMs),`ms`]}),e.exitCode!==0&&(0,y.jsxs)(`span`,{className:`text-[11px] text-neutral-400`,children:[`exit code `,String(e.exitCode)]}),(0,y.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,y.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,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`mb-1 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Outputs`}),(0,y.jsx)(`div`,{className:`divide-y divide-black/5`,children:t.map(([e,t])=>(0,y.jsxs)(`div`,{className:`flex items-start gap-2 py-1.5`,children:[(0,y.jsx)(`span`,{className:`shrink-0 font-mono text-[12px] text-neutral-600`,children:e}),(0,y.jsx)(`span`,{className:`text-[11px] text-neutral-300`,children:`=`}),(0,y.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,y.jsx)(b,{title:`Logs (${String(e.logs.length)})`,children:(0,y.jsx)(`div`,{className:`space-y-0.5`,children:e.logs.map((e,t)=>(0,y.jsx)(`div`,{className:`font-mono text-[12px] text-neutral-600`,children:e},t))})}),e.stdout&&(0,y.jsx)(b,{title:`Stdout`,children:(0,y.jsx)(`pre`,{className:`overflow-auto rounded bg-neutral-50 p-3 font-mono text-[12px] text-neutral-700`,children:e.stdout})}),e.stderr&&(0,y.jsx)(b,{title:`Stderr`,children:(0,y.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,y.jsx)(b,{title:`Network (${String(e.httpRequests.count)}${e.httpRequests.notLogged>0?`, ${String(e.httpRequests.notLogged)} not logged`:``})`,children:(0,y.jsx)(`div`,{className:`space-y-1.5`,children:e.httpRequests.requests.map((e,t)=>(0,y.jsx)(w,{request:e},t))})})]})},S=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`}},C=(e,t)=>t||e>=500?`text-red-700`:e>=400?`text-amber-700`:e>=200?`text-green-700`:`text-neutral-600`,w=({request:e})=>{let[t,n]=(0,v.useState)(!1),r=e.requestErrorType!==null;return(0,y.jsxs)(`div`,{className:`rounded border border-black/5 bg-neutral-50`,children:[(0,y.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,y.jsx)(a,{icon:t?o:s,className:`w-2.5 text-neutral-400`}),(0,y.jsx)(`span`,{className:`rounded px-1.5 py-0.5 font-mono text-[10px] font-semibold ${S(e.method)}`,children:e.method}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12px] text-neutral-700`,children:e.url}),(0,y.jsx)(`span`,{className:`font-mono text-[11px] font-semibold ${C(e.responseStatusCode,r)}`,children:r?e.requestErrorType:e.responseStatusCode}),(0,y.jsxs)(`span`,{className:`font-mono text-[10px] text-neutral-400`,children:[(e.duration*1e3).toFixed(0),`ms`]})]}),t&&(0,y.jsxs)(`div`,{className:`space-y-2 border-t border-black/5 p-2.5`,children:[(0,y.jsx)(T,{title:`Request Headers`,data:e.headers}),e.body&&(0,y.jsx)(E,{title:`Request Body`,body:e.body}),(0,y.jsx)(T,{title:`Response Headers`,data:e.responseHeaders}),e.responseBody&&(0,y.jsx)(E,{title:`Response Body`,body:e.responseBody})]})]})},T=({title:e,data:t})=>{let n=Object.entries(t);return n.length===0?null:(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-widest text-neutral-400`,children:e}),(0,y.jsx)(`div`,{className:`divide-y divide-black/5 rounded border border-black/5 bg-white`,children:n.map(([e,t])=>(0,y.jsxs)(`div`,{className:`flex gap-2 px-2 py-1 font-mono text-[11px]`,children:[(0,y.jsxs)(`span`,{className:`shrink-0 text-neutral-500`,children:[e,`:`]}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 break-all text-neutral-800`,children:t})]},e))})]})},E=({title:e,body:t})=>(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-widest text-neutral-400`,children:e}),(0,y.jsx)(`pre`,{className:`overflow-auto rounded border border-black/5 bg-white p-2 font-mono text-[11px] text-neutral-800`,children:t})]}),D=[`python-3-12`,`python-3-13`],O=`python-3-13`,k={text:`s`,string:`s`,number:`n`,integer:`n`,boolean:`b`,date:`d`,datetime:`dt`,phone:`p`,phonenumber:`p`,uuid:`u`,file:`f`,list:`l`};function A(e){return k[e.toLowerCase()]??`s`}function j(e){return D.includes(e)}function M(e,t){let n=Object.keys(e);if(n.length===0)return null;let r={};for(let i of n)r[i]={t:A(t[i]??`string`),v:e[i]};return r}function N(e){let t=Object.keys(e);if(t.length===0)return null;let n={};for(let r of t)n[r]=A(e[r]??`string`);return n}function P(e){if(!e)return{};let t={};for(let[n,r]of Object.entries(e))t[n]=r.v;return t}function F(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 I(e,t){let n=Date.now(),r=t.scriptRuntime||O;if(!j(r))return{success:!1,outputValues:{},logs:[],stdout:``,stderr:``,error:`Unsupported runtime "${r}". Supported runtimes: ${D.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:M(t.inputs,t.inputTypes),output_types:N(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=F(a.http_requests),c={success:!o,outputValues:P(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 L=()=>{let{apiName:e,stepApiName:r}=l({strict:!1}),i=c(),{data:o,isLoading:s,isError:b}=u(d),S=f(),[C,w]=(0,v.useState)(!1),[T,E]=(0,v.useState)(null),[D,O]=h(`kizen-step-inputs:${e??``}:${r??``}`,{}),[k,A]=h(`kizen-step-secrets:${e??``}:${r??``}`,{}),[j,M]=h(`kizen-code-runner-mode`,`local`),N=(0,v.useMemo)(()=>o?.find(t=>t.api_name===e),[o,e]),P=(0,v.useMemo)(()=>N?.artifacts.automation_action_configs??[],[N]),F=P.find(e=>e.action_step_api_name===r)??P[0],L=N?.base_config,{whenState:R}=g(e,L,N?.config_template);if((0,v.useEffect)(()=>{if(!r&&P.length>0&&e){let t=P[0];t&&i({to:`/$apiName/code-steps/$stepApiName`,params:{apiName:e,stepApiName:t.action_step_api_name},replace:!0})}},[r,P,e,i]),(0,v.useEffect)(()=>{E(null)},[r]),s)return(0,y.jsx)(p,{children:(0,y.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(b)return(0,y.jsx)(p,{children:(0,y.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});if(!N)return(0,y.jsx)(p,{children:(0,y.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,y.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:e}),`.`]})});if(P.length===0)return(0,y.jsx)(p,{children:(0,y.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:`This app has no automation code steps.`})});if(!F)return(0,y.jsx)(p,{children:(0,y.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`Step not found: `,(0,y.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:r}),`.`]})});let z=async()=>{w(!0),E(null);try{let t=Object.fromEntries(F.inputs.map(e=>[e.name,D[e.name]??``])),n;n=j===`remote`?await I(S,{script:F.script,scriptRuntime:F.script_runtime,inputs:t,inputTypes:Object.fromEntries(F.inputs.map(e=>[e.name,e.data_type])),outputTypes:Object.fromEntries(F.outputs.map(e=>[e.name,e.data_type])),secretNames:F.secrets.map(t=>`${e??``}__${t}`)}):await(await fetch(`/api/execute-step`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({script:F.script,scriptRuntime:F.script_runtime,inputs:t,secrets:Object.fromEntries(F.secrets.map(t=>[`${e??``}__${t}`,k[t]??``]))})})).json(),E(n)}catch(e){E({success:!1,outputValues:{},logs:[],stdout:``,stderr:``,error:e instanceof Error?e.message:String(e),exitCode:1,durationMs:0})}finally{w(!1)}};return(0,y.jsxs)(`div`,{className:`space-y-4`,children:[(0,y.jsxs)(p,{children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,y.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Code Step`}),(0,y.jsx)(`select`,{value:F.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:P.map(e=>(0,y.jsx)(`option`,{value:e.action_step_api_name,children:e.name},e.action_step_api_name))}),(0,y.jsx)(`div`,{className:`flex-1`}),(0,y.jsx)(`span`,{className:`rounded bg-blue-50 px-1.5 py-0.5 text-[10px] font-semibold text-blue-600`,children:F.script_runtime})]}),F.overall_description&&(0,y.jsx)(`p`,{className:`mt-2 text-[12px] text-neutral-500`,children:F.overall_description}),F.when&&(0,y.jsx)(`div`,{className:`mt-2`,children:(0,y.jsx)(_,{when:F.when,whenState:R})})]}),(0,y.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-3`,children:[(0,y.jsxs)(p,{children:[(0,y.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Inputs`}),F.inputs.length>0?(0,y.jsx)(`div`,{className:`space-y-3`,children:F.inputs.map(e=>(0,y.jsxs)(`div`,{children:[(0,y.jsxs)(`label`,{className:`mb-1 block text-[12px] text-neutral-700`,children:[e.label,e.required&&(0,y.jsx)(`span`,{className:`ml-0.5 text-red-500`,children:`*`})]}),(0,y.jsx)(`input`,{type:`text`,value:D[e.name]??``,onChange:t=>{O({...D,[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,y.jsx)(`div`,{className:`mt-0.5 font-mono text-[10px] text-neutral-400`,children:e.name})]},e.name))}):(0,y.jsx)(`p`,{className:`m-0 text-[12px] text-neutral-400`,children:`None defined.`})]}),(0,y.jsxs)(p,{children:[(0,y.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Outputs`}),F.outputs.length>0?(0,y.jsx)(`div`,{className:`space-y-2`,children:F.outputs.map(e=>(0,y.jsxs)(`div`,{className:`flex items-baseline gap-2 rounded border border-black/5 bg-neutral-50 px-2.5 py-1.5`,children:[(0,y.jsx)(`span`,{className:`text-[13px] text-neutral-700`,children:e.label}),(0,y.jsx)(`span`,{className:`font-mono text-[10px] text-neutral-400`,children:e.name}),(0,y.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,y.jsx)(`p`,{className:`m-0 text-[12px] text-neutral-400`,children:`None defined.`})]}),(0,y.jsxs)(p,{children:[(0,y.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Secrets`}),j===`remote`&&(0,y.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.`}),F.secrets.length>0?(0,y.jsx)(`div`,{className:`space-y-3`,children:F.secrets.map(e=>(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`label`,{className:`mb-1 block text-[12px] text-neutral-700`,children:e}),(0,y.jsx)(`input`,{type:`password`,value:k[e]??``,onChange:t=>{A({...k,[e]:t.target.value})},placeholder:e,disabled:j===`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,y.jsx)(`p`,{className:`m-0 text-[12px] text-neutral-400`,children:`None defined.`})]})]}),(0,y.jsx)(m,{code:F.script,language:`python`,onRun:()=>void z(),isRunning:C,executionMode:j,onModeChange:M}),(0,y.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:T?(0,y.jsx)(x,{result:T}):(0,y.jsx)(`div`,{className:`flex items-center gap-2 rounded-lg border border-dashed border-black/10 bg-white px-4 py-3`,children:C?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a,{icon:t,className:`animate-spin text-neutral-400`}),(0,y.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Running step…`})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a,{icon:n,className:`text-neutral-300`}),(0,y.jsx)(`span`,{className:`text-[12px] text-neutral-400`,children:`Run the step to see output, logs, and network activity here.`})]})})})]})};export{L 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{a as c,c as l,d as u,f as d,h as f,i as p,l as m,m as h,n as g,r as _,s as v,t as y}from"./useCompleteSetup-3RGdCYrc.js";import{t as b}from"./bundleQuery-BE1Gb8Ii.js";import{n as x}from"./CredentialsContext-Cwl_xyt_.js";import{N as S,i as C,n as w,r as T}from"./api--Ax6VWLq.js";import{n as E,t as D}from"./Dialog-C3QoiHOt.js";import{t as O}from"./Card-Sa52PGkn.js";import{n as k,t as A}from"./setupAssistant-C-3V_Vj3.js";import{t as j}from"./CodeViewer-DpJLTTab.js";import{a as M,c as N,i as P,l as F,n as I,r as L,t as R,u as z}from"./usePluginConfig-XFnehL_S.js";var B=e(r(),1),V=n(),H=e=>e?JSON.stringify(e,null,2):`{}`,U=({apiName:e,configTemplate:t})=>{let n=P(e),r=H(t),[i,a]=(0,B.useState)(n?.__kizen_clean_config?JSON.stringify(n.__kizen_clean_config,null,2):r),[o,s]=(0,B.useState)(null),[c,l]=(0,B.useState)(!1);return(0,V.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,V.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,V.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,V.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,V.jsxs)(`span`,{className:`text-[12px] text-red-500`,children:[`Parse error: `,o]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`button`,{onClick:()=>{try{F(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,V.jsx)(`button`,{onClick:()=>{I(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,V.jsx)(`span`,{className:`text-[12px] text-green-600 font-medium`,children:`Saved`})]})]})},W=({open:e,onClose:t,apiName:n,loadFn:r,label:i})=>{let a=(0,B.useMemo)(()=>e?r(n)?.__kizen_clean_config??null:null,[e,n,r]),o=(0,B.useMemo)(()=>a?JSON.stringify(a,null,2):``,[a]),[s,c]=(0,B.useState)(!1);return(0,B.useEffect)(()=>{e||c(!1)},[e]),(0,V.jsx)(D,{open:e,size:`xl`,ariaModal:!0,onBackdropClick:t,header:(0,V.jsx)(E,{title:`Stored JSON — ${i}`,onClose:t}),footer:a?(0,V.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,V.jsxs)(`div`,{className:`px-5 py-4`,children:[(0,V.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,V.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:i}),`. Save the form to refresh.`]}),a?(0,V.jsx)(j,{code:o,language:`json`}):(0,V.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.`})]})})},G=({config:e,apiName:t,loadFn:n,saveFn:r,clearFn:i})=>{let a=n(t)?.__kizen_setup_assistant_values,o=(0,B.useRef)({}),[s,c]=(0,B.useState)(!1),{getObjectByAPIName:u,getCustomObjectDetails:d}=v(),p=(0,B.useCallback)(e=>{o.current=e},[]);return(0,V.jsx)(f,{config:e,value:a,onStateChange:p,disabledKeys:[],getObjectByAPIName:u,getCustomObjectDetails:d,children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.fields?.map(e=>(0,V.jsx)(l,{field:e,pluginApiName:t},e.key)),(0,V.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,V.jsx)(`button`,{onClick:()=>{let n=o.current;r(t,n,e),c(!0),setTimeout(()=>{c(!1)},2e3)},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,V.jsx)(`button`,{onClick:()=>{i(t),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`}),s&&(0,V.jsx)(`span`,{className:`text-[12px] text-green-600 font-medium`,children:`Saved`})]})]})})},K=({children:e})=>(0,V.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:e}),q=({page:e,viewApiName:t})=>e?(0,V.jsx)(p,{page:e,className:`h-[520px] w-full overflow-hidden rounded border border-black/10`,iframeAllow:d}):(0,V.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,V.jsx)(K,{children:t}),`, which this plugin does not define. Add a `,(0,V.jsx)(K,{children:`views/${t}/`}),` component, or drop`,` `,(0,V.jsx)(K,{children:`view`}),` from the manifest to go back to the declarative assistant.`]}),J=({level:e,isViewBased:t})=>{let n=e===`user`?`this.userConfig`:`this.config`;return t?(0,V.jsxs)(V.Fragment,{children:[`Setup for this plugin is a view, so it saves its own`,` `,e===`user`?`per-user`:`business-level`,` config by calling`,` `,(0,V.jsx)(K,{children:`this.completeSetup()`}),` — there is no form or Save button here. Whatever it writes becomes `,(0,V.jsx)(K,{children:n}),`; use View JSON to inspect it.`]}):e===`user`?(0,V.jsxs)(V.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,V.jsx)(K,{children:n}),`.`]}):(0,V.jsxs)(V.Fragment,{children:[`Configure the business-level setup assistant fields. These values are shared across the whole business and exposed to plugin scripts at `,(0,V.jsx)(K,{children:n}),`.`]})},Y=({config:e,apiName:n,loadFn:r,saveFn:a,clearFn:o,level:l,views:d,userConfigs:f,onConfigWrite:p})=>{let m=s(),v=C(),b=(0,B.useMemo)(()=>S(v),[v]),{environment:E}=x(),D=w[E],[O,A]=(0,B.useState)(!1),[j,M]=(0,B.useState)(!1),{onMonitoringException:N,dialog:P}=g(),{showToast:F,clearToasts:I}=u(),L=y(l,p),R=k(e),z=c(d,R);return m?(0,V.jsx)(h,{appPath:D,user:{id:m.team.user,crm_client_id:``},business:m.business,userConfigs:f,clientObject:m.business.client_object?{id:m.business.client_object.id,objectName:m.business.client_object.object_name}:void 0,teamMember:m.team,onNavigate:()=>{},performFileUpload:()=>Promise.resolve({url:``}),monitoringExceptionHelper:N,performRequest:T(b),onCompleteSetup:L,modal:{showing:O,show:j,showPrompt:()=>{A(!0),M(!0)},onConfirm:()=>{A(!1),M(!1)},onHide:()=>{A(!1),M(!1)}},showToast:F,clearToasts:I,children:({showPluginModal:t,derivedModalState:i,pluginApiName:s})=>(0,V.jsxs)(V.Fragment,{children:[R===void 0?(0,V.jsx)(G,{config:e,apiName:n,loadFn:r,saveFn:a,clearFn:o}):(0,V.jsx)(q,{page:z,viewApiName:R}),(0,V.jsx)(_,{show:t,config:i.config,pluginApiName:s,onConfirm:i.props.onConfirm,onHide:i.props.onHide,pages:d}),P]})}):(0,V.jsx)(i,{icon:t,className:`animate-spin text-neutral-400`})},X=()=>{let{apiName:e}=a({strict:!1}),{data:t,isLoading:n,isError:r}=o(b),[i,s]=(0,B.useState)(null),c=(0,B.useMemo)(()=>t?.find(t=>t.api_name===e),[t,e]),l=c?.base_config,{configArgs:u,userConfigs:d,refreshConfig:f}=R(e,l,c?.config_template),p=(0,B.useMemo)(()=>c?c.artifacts.routable_pages.map(e=>({...e,plugin_api_name:c.api_name,args:u})):[],[c,u]);if(n)return(0,V.jsx)(O,{children:(0,V.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(r)return(0,V.jsx)(O,{children:(0,V.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});if(!c)return(0,V.jsx)(O,{children:(0,V.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,V.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:e}),`.`]})});let m=l?.setup_assistant,h=l?.user_setup_assistant,g=A(m),_=A(h);return!g&&!_?(0,V.jsx)(O,{children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`Configuration`}),(0,V.jsx)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,children:`Enter plugin configuration as JSON.`})]}),(0,V.jsx)(U,{apiName:e??``,configTemplate:c.config_template})]})}):(0,V.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start`,children:[g&&m&&(0,V.jsx)(O,{className:`lg:flex-1 lg:min-w-0`,children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`Business Configuration`}),(0,V.jsx)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,children:(0,V.jsx)(J,{level:`business`,isViewBased:k(m)!==void 0})})]}),(0,V.jsx)(`button`,{onClick:()=>{s(`business`)},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,V.jsx)(Y,{config:m,apiName:e??``,loadFn:P,saveFn:N,clearFn:I,level:`business`,views:p,userConfigs:d,onConfigWrite:f})]})}),_&&h&&(0,V.jsx)(O,{className:`lg:flex-1 lg:min-w-0`,children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`User Configuration`}),(0,V.jsx)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,children:(0,V.jsx)(J,{level:`user`,isViewBased:k(h)!==void 0})})]}),(0,V.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,V.jsx)(Y,{config:h,apiName:e??``,loadFn:M,saveFn:z,clearFn:L,level:`user`,views:p,userConfigs:d,onConfigWrite:f})]})}),(0,V.jsx)(W,{open:i===`business`,onClose:()=>{s(null)},apiName:e??``,loadFn:P,label:`this.config`}),(0,V.jsx)(W,{open:i===`user`,onClose:()=>{s(null)},apiName:e??``,loadFn:M,label:`this.userConfig`})]})},Z=()=>(0,V.jsx)(m,{children:(0,V.jsx)(X,{})});export{Z 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{a as c,c as l,d as u,f as d,h as f,i as p,l as m,m as h,n as g,r as _,s as v,t as y}from"./useCompleteSetup-DUHoBgca.js";import{t as b}from"./bundleQuery-BE1Gb8Ii.js";import{n as x}from"./CredentialsContext-Cwl_xyt_.js";import{N as S,i as C,n as w,r as T}from"./api--Ax6VWLq.js";import{n as E,t as D}from"./Dialog-C3QoiHOt.js";import{t as O}from"./Card-Sa52PGkn.js";import{n as k,t as A}from"./setupAssistant-DtI9NWXr.js";import{t as j}from"./CodeViewer-CVECJY4e.js";import{a as M,c as N,i as P,l as F,n as I,r as L,t as R,u as z}from"./usePluginConfig-C8d13THZ.js";var B=e(r(),1),V=n(),H=e=>e?JSON.stringify(e,null,2):`{}`,U=({apiName:e,configTemplate:t})=>{let n=P(e),r=H(t),[i,a]=(0,B.useState)(n?.__kizen_clean_config?JSON.stringify(n.__kizen_clean_config,null,2):r),[o,s]=(0,B.useState)(null),[c,l]=(0,B.useState)(!1);return(0,V.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,V.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,V.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,V.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,V.jsxs)(`span`,{className:`text-[12px] text-red-500`,children:[`Parse error: `,o]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`button`,{onClick:()=>{try{F(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,V.jsx)(`button`,{onClick:()=>{I(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,V.jsx)(`span`,{className:`text-[12px] text-green-600 font-medium`,children:`Saved`})]})]})},W=({open:e,onClose:t,apiName:n,loadFn:r,label:i})=>{let a=(0,B.useMemo)(()=>e?r(n)?.__kizen_clean_config??null:null,[e,n,r]),o=(0,B.useMemo)(()=>a?JSON.stringify(a,null,2):``,[a]),[s,c]=(0,B.useState)(!1);return(0,B.useEffect)(()=>{e||c(!1)},[e]),(0,V.jsx)(D,{open:e,size:`xl`,ariaModal:!0,onBackdropClick:t,header:(0,V.jsx)(E,{title:`Stored JSON — ${i}`,onClose:t}),footer:a?(0,V.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,V.jsxs)(`div`,{className:`px-5 py-4`,children:[(0,V.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,V.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:i}),`. Save the form to refresh.`]}),a?(0,V.jsx)(j,{code:o,language:`json`}):(0,V.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.`})]})})},G=({config:e,apiName:t,loadFn:n,saveFn:r,clearFn:i})=>{let a=n(t)?.__kizen_setup_assistant_values,o=(0,B.useRef)({}),[s,c]=(0,B.useState)(!1),{getObjectByAPIName:u,getCustomObjectDetails:d}=v(),p=(0,B.useCallback)(e=>{o.current=e},[]);return(0,V.jsx)(f,{config:e,value:a,onStateChange:p,disabledKeys:[],getObjectByAPIName:u,getCustomObjectDetails:d,children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.fields?.map(e=>(0,V.jsx)(l,{field:e,pluginApiName:t},e.key)),(0,V.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,V.jsx)(`button`,{onClick:()=>{let n=o.current;r(t,n,e),c(!0),setTimeout(()=>{c(!1)},2e3)},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,V.jsx)(`button`,{onClick:()=>{i(t),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`}),s&&(0,V.jsx)(`span`,{className:`text-[12px] text-green-600 font-medium`,children:`Saved`})]})]})})},K=({children:e})=>(0,V.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:e}),q=({page:e,viewApiName:t})=>e?(0,V.jsx)(p,{page:e,className:`h-[520px] w-full overflow-hidden rounded border border-black/10`,iframeAllow:d}):(0,V.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,V.jsx)(K,{children:t}),`, which this plugin does not define. Add a `,(0,V.jsx)(K,{children:`views/${t}/`}),` component, or drop`,` `,(0,V.jsx)(K,{children:`view`}),` from the manifest to go back to the declarative assistant.`]}),J=({level:e,isViewBased:t})=>{let n=e===`user`?`this.userConfig`:`this.config`;return t?(0,V.jsxs)(V.Fragment,{children:[`Setup for this plugin is a view, so it saves its own`,` `,e===`user`?`per-user`:`business-level`,` config by calling`,` `,(0,V.jsx)(K,{children:`this.completeSetup()`}),` — there is no form or Save button here. Whatever it writes becomes `,(0,V.jsx)(K,{children:n}),`; use View JSON to inspect it.`]}):e===`user`?(0,V.jsxs)(V.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,V.jsx)(K,{children:n}),`.`]}):(0,V.jsxs)(V.Fragment,{children:[`Configure the business-level setup assistant fields. These values are shared across the whole business and exposed to plugin scripts at `,(0,V.jsx)(K,{children:n}),`.`]})},Y=({config:e,apiName:n,loadFn:r,saveFn:a,clearFn:o,level:l,views:d,userConfigs:f,onConfigWrite:p})=>{let m=s(),v=C(),b=(0,B.useMemo)(()=>S(v),[v]),{environment:E}=x(),D=w[E],[O,A]=(0,B.useState)(!1),[j,M]=(0,B.useState)(!1),{onMonitoringException:N,dialog:P}=g(),{showToast:F,clearToasts:I}=u(),L=y(l,p),R=k(e),z=c(d,R);return m?(0,V.jsx)(h,{appPath:D,user:{id:m.team.user,crm_client_id:``},business:m.business,userConfigs:f,clientObject:m.business.client_object?{id:m.business.client_object.id,objectName:m.business.client_object.object_name}:void 0,teamMember:m.team,onNavigate:()=>{},performFileUpload:()=>Promise.resolve({url:``}),monitoringExceptionHelper:N,performRequest:T(b),onCompleteSetup:L,modal:{showing:O,show:j,showPrompt:()=>{A(!0),M(!0)},onConfirm:()=>{A(!1),M(!1)},onHide:()=>{A(!1),M(!1)}},showToast:F,clearToasts:I,children:({showPluginModal:t,derivedModalState:i,pluginApiName:s})=>(0,V.jsxs)(V.Fragment,{children:[R===void 0?(0,V.jsx)(G,{config:e,apiName:n,loadFn:r,saveFn:a,clearFn:o}):(0,V.jsx)(q,{page:z,viewApiName:R}),(0,V.jsx)(_,{show:t,config:i.config,pluginApiName:s,onConfirm:i.props.onConfirm,onHide:i.props.onHide,pages:d}),P]})}):(0,V.jsx)(i,{icon:t,className:`animate-spin text-neutral-400`})},X=()=>{let{apiName:e}=a({strict:!1}),{data:t,isLoading:n,isError:r}=o(b),[i,s]=(0,B.useState)(null),c=(0,B.useMemo)(()=>t?.find(t=>t.api_name===e),[t,e]),l=c?.base_config,{configArgs:u,userConfigs:d,refreshConfig:f}=R(e,l,c?.config_template),p=(0,B.useMemo)(()=>c?c.artifacts.routable_pages.map(e=>({...e,plugin_api_name:c.api_name,args:u})):[],[c,u]);if(n)return(0,V.jsx)(O,{children:(0,V.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(r)return(0,V.jsx)(O,{children:(0,V.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});if(!c)return(0,V.jsx)(O,{children:(0,V.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,V.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:e}),`.`]})});let m=l?.setup_assistant,h=l?.user_setup_assistant,g=A(m),_=A(h);return!g&&!_?(0,V.jsx)(O,{children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`Configuration`}),(0,V.jsx)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,children:`Enter plugin configuration as JSON.`})]}),(0,V.jsx)(U,{apiName:e??``,configTemplate:c.config_template})]})}):(0,V.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start`,children:[g&&m&&(0,V.jsx)(O,{className:`lg:flex-1 lg:min-w-0`,children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`Business Configuration`}),(0,V.jsx)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,children:(0,V.jsx)(J,{level:`business`,isViewBased:k(m)!==void 0})})]}),(0,V.jsx)(`button`,{onClick:()=>{s(`business`)},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,V.jsx)(Y,{config:m,apiName:e??``,loadFn:P,saveFn:N,clearFn:I,level:`business`,views:p,userConfigs:d,onConfigWrite:f})]})}),_&&h&&(0,V.jsx)(O,{className:`lg:flex-1 lg:min-w-0`,children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`User Configuration`}),(0,V.jsx)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,children:(0,V.jsx)(J,{level:`user`,isViewBased:k(h)!==void 0})})]}),(0,V.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,V.jsx)(Y,{config:h,apiName:e??``,loadFn:M,saveFn:z,clearFn:L,level:`user`,views:p,userConfigs:d,onConfigWrite:f})]})}),(0,V.jsx)(W,{open:i===`business`,onClose:()=>{s(null)},apiName:e??``,loadFn:P,label:`this.config`}),(0,V.jsx)(W,{open:i===`user`,onClose:()=>{s(null)},apiName:e??``,loadFn:M,label:`this.userConfig`})]})},Z=()=>(0,V.jsx)(m,{children:(0,V.jsx)(X,{})});export{Z as ConfigurationPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{F as t,I as n,P as r,m as i}from"./fa-core-BSqLAjHu.js";import{t as a}from"./Card-Sa52PGkn.js";import{r as o,t as s}from"./validIcons-D8mhuO5s.js";var c=e(n(),1),l=t(),u=`https://fontawesome.com/icons`,d=e=>`${u}/${e}?f=classic&s=light`,f=()=>{let[e,t]=(0,c.useState)(null),[n,f]=(0,c.useState)(``),p=(0,c.useRef)(null);(0,c.useEffect)(()=>()=>{p.current&&clearTimeout(p.current)},[]);let m=(0,c.useMemo)(()=>{let e=n.trim().toLowerCase();return e?o.filter(t=>t.includes(e)):o},[n]),h=e=>{navigator.clipboard.writeText(e),t(e),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{t(null)},1200)};return(0,l.jsx)(`div`,{className:`space-y-4 text-[13px]`,children:(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-1 flex items-baseline justify-between gap-4`,children:[(0,l.jsxs)(`div`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:[`Icon Reference (`,n.trim()?`${String(m.length)} of ${String(o.length)}`:`${String(o.length)} icons`,`)`]}),(0,l.jsx)(`div`,{className:`text-[11px] text-neutral-400`,children:`Click a name to copy it`})]}),(0,l.jsxs)(`p`,{className:`mb-3 text-[11px] leading-relaxed text-neutral-500`,children:[`These are`,` `,(0,l.jsx)(`a`,{href:u,target:`_blank`,rel:`noopener noreferrer`,className:`underline decoration-neutral-300 underline-offset-2 hover:text-neutral-700 hover:decoration-neutral-500`,children:`Font Awesome`}),` `,`icon names; icon appearance is defined by the Kizen app at runtime. This list shows valid names only.`]}),(0,l.jsx)(`input`,{type:`search`,value:n,onChange:e=>{f(e.target.value)},placeholder:`Filter icon names…`,"aria-label":`Filter icon names`,className:`mb-3 w-full max-w-xs rounded border border-black/10 px-2 py-1 font-mono text-[11px] text-neutral-700 placeholder:text-neutral-400 focus:border-black/25 focus:outline-none`}),m.length===0?(0,l.jsxs)(`div`,{className:`py-6 text-center font-mono text-[11px] text-neutral-400`,children:[`No icon name matches “`,n.trim(),`”`]}):(0,l.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:m.map(t=>{let n=e===t,a=s.has(t);return(0,l.jsxs)(`div`,{className:`flex w-44 items-center gap-1 rounded pr-1 transition-colors ${n?`bg-emerald-100`:`hover:bg-black/5`}`,children:[(0,l.jsx)(`button`,{type:`button`,onClick:()=>{h(t)},className:`min-w-0 flex-1 cursor-pointer truncate px-1.5 py-1 text-left font-mono text-[11px] text-neutral-600`,title:a?`${t} — Kizen custom icon`:`Copy “${t}”`,children:n?`Copied!`:t}),a?(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-sky-100 px-1 font-mono text-[9px] text-sky-700`,children:`kizen`}):(0,l.jsx)(`a`,{href:d(t),target:`_blank`,rel:`noopener noreferrer`,className:`shrink-0 rounded p-1 text-[9px] text-neutral-400 opacity-60 transition hover:bg-black/5 hover:text-neutral-600 hover:opacity-100 focus-visible:opacity-100`,title:`View “${t}” on fontawesome.com`,"aria-label":`View ${t} on fontawesome.com`,children:(0,l.jsx)(r,{icon:i})})]},t)})}),(0,l.jsxs)(`p`,{className:`mt-4 border-t border-black/8 pt-3 text-[11px] leading-relaxed text-neutral-400`,children:[`Names tagged `,(0,l.jsx)(`span`,{className:`font-mono text-sky-700`,children:`kizen`}),` are Kizen’s own brand icons and have no Font Awesome page. For every other name,`,` `,(0,l.jsx)(r,{icon:i,className:`text-neutral-400`}),` opens its Font Awesome page in a new tab, showing the light style Kizen renders.`]})]})})};export{f as IconReferencePage};
|