@kizenapps/cli 1.8.0-5359c23 → 1.8.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.
Files changed (22) hide show
  1. package/README.md +25 -0
  2. package/dist/viewer/assets/CodeStepsPage-C5l1pu51.js +1 -0
  3. package/dist/viewer/assets/{ConfigurationPage-P12z6vGj.js → ConfigurationPage-DMUqeW2V.js} +1 -1
  4. package/dist/viewer/assets/SandboxPage-qLFGQ_Lg.js +1 -0
  5. package/dist/viewer/assets/{SecretsPage-CeSIhKDx.js → SecretsPage-GbNJAR3u.js} +1 -1
  6. package/dist/viewer/assets/{WhenBadge-xRYajcDX.js → WhenBadge-BD_2mB-N.js} +1 -1
  7. package/dist/viewer/assets/api-ViOFtzH7.js +11 -0
  8. package/dist/viewer/assets/{bootstrapQuery-CbwKDhqe.js → bootstrapQuery-DQckmnki.js} +1 -1
  9. package/dist/viewer/assets/{calendarSource.worker-ChbwoBdD.js → calendarSource.worker-mLICe-Oi.js} +1 -1
  10. package/dist/viewer/assets/{configStorage-DoMfqInd.js → configStorage-CfwJ8JQJ.js} +1 -1
  11. package/dist/viewer/assets/{floatingFrame.worker-ObFUZfkb.js → floatingFrame.worker-C8edGbiJ.js} +1 -1
  12. package/dist/viewer/assets/{generic.worker-TTxPXEzW.js → generic.worker-DSYVvVm0.js} +1 -1
  13. package/dist/viewer/assets/{index-IPap1aum.js → index-B7mInhXv.js} +3 -3
  14. package/dist/viewer/assets/index-ZrNbBIqA.css +2 -0
  15. package/dist/viewer/assets/{recordDetail.worker-ClqoFFJe.js → recordDetail.worker-Bsa6yMRD.js} +1 -1
  16. package/dist/viewer/assets/{useCriticalExceptionDialog-Dxoa5oCH.js → useCriticalExceptionDialog-CncFngL7.js} +4 -4
  17. package/dist/viewer/index.html +4 -4
  18. package/package.json +2 -2
  19. package/dist/viewer/assets/CodeStepsPage-DGeG_PIE.js +0 -1
  20. package/dist/viewer/assets/SandboxPage-BUdgHfUU.js +0 -1
  21. package/dist/viewer/assets/api-DwPVK6u4.js +0 -11
  22. package/dist/viewer/assets/index-CnQPaS6I.css +0 -2
package/README.md CHANGED
@@ -37,6 +37,31 @@ On first run you'll be prompted to set up credentials — either stored globally
37
37
 
38
38
  Supported environments: `go`, `fmo`, `staging`, `integration`, `test1`.
39
39
 
40
+ ## Navigation context
41
+
42
+ Plugin scripts can attach a JSON context payload to an in-app navigation:
43
+
44
+ ```js
45
+ this.openWindow('/some/path', '_self', { recordId: 'abc', mode: 'edit' });
46
+ ```
47
+
48
+ The engine transmits that payload out of band through `sessionStorage` and appends a `session_data_key` to the URL; the destination page reads it back with `readNavigationContext` / `consumeNavigationContext` (or the `useAppNavigationContext` React hook). The sandbox surfaces this end to end:
49
+
50
+ - **Navigation Context panel** — a slide-out panel on the Routable Pages browser (toggled by the `context` button in its chrome, which shows a live event count) with a reverse-chronological log of every navigation that carried a context payload, plus any external `window.open` (which the engine drops context from). Each entry shows the target, whether a context payload rode along, its key and byte size, an expandable pretty-printed payload, and a status badge.
51
+ - **Simulated destination page** — navigating to an in-app path that isn't a routable page in your plugin renders a stand-in for the real Kizen page. When the URL carries a valid context key it shows the payload and lets you **Consume**, **Clear**, or **Re-read** it, so you can confirm the destination sees exactly what the script sent (and that a re-read after consuming sees nothing).
52
+
53
+ How the two navigation targets behave:
54
+
55
+ - **`_self`** (same-tab, relative) — the context stays in this tab's `sessionStorage` across the navigation, so the destination reads it normally. The sandbox reads (does not consume) it when logging.
56
+ - **`_blank`** (new-tab, relative, same origin) — the engine stores the context, opens the tab, then immediately deletes its own copy, relying on a real browser having already copied `sessionStorage` into the new tab.
57
+ - **External / cross-origin** URLs — context is never attached and is dropped by design; these appear in the log as `ignored (external)`.
58
+
59
+ **Fidelity limit:** a real `_blank` open gives the new tab its own `sessionStorage` copy. The sandbox has no real second tab, so the "opener" and the simulated destination share one `sessionStorage`; to keep the engine's reader helpers working, the harness snapshots the payload and re-inserts it under the same key immediately after the engine deletes it. Behavior matches a real browser for reading/consuming, but the two "tabs" are not truly isolated.
60
+
61
+ **Scope boundary:** navigating to a path that matches one of your plugin's own routable pages activates that page's tab without carrying the URL through, so the page cannot observe its own `session_data_key` via the simulated location. Use the simulated destination page (any non-routable in-app path) to inspect what a destination receives.
62
+
63
+ **Error surfacing:** if `sessionStorage` writes fail (e.g. quota exceeded, storage disabled), the engine navigates without context and reports a message through the same `onError` path every script artifact already uses — it shows in that artifact's result UI and the DevTools console, not as a separate log entry, because on failure the URL carries no key for the harness to detect. Note also that context is serialized with `JSON.stringify` inside the worker script: circular references and `BigInt` values throw there before any navigation happens, while functions, `undefined` values, and symbols are silently dropped.
64
+
40
65
  ## License
41
66
 
42
67
  GPL-3.0. See [LICENSE.md](./LICENSE.md).
@@ -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,p}from"./api-ViOFtzH7.js";import{t as m}from"./Card-Sa52PGkn.js";import{t as h}from"./CodeViewer-CVECJY4e.js";import{t as g}from"./useLocalStorage-wp83IS34.js";import{i as _,r as v}from"./configStorage-CfwJ8JQJ.js";import{t as y}from"./WhenBadge-BD_2mB-N.js";var b=e(i(),1),x=r(),S=({title:e,defaultOpen:t=!1,children:n})=>{let[r,i]=(0,b.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,b.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={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 M(e){return j[e.toLowerCase()]??`s`}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]??`string`),v: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]??`string`);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:S}=u(d),w=f(),[T,E]=(0,b.useState)(!1),[D,O]=(0,b.useState)(null),[k,A]=g(`kizen-step-inputs:${e??``}:${r??``}`,{}),[j,M]=g(`kizen-step-secrets:${e??``}:${r??``}`,{}),[N,P]=g(`kizen-code-runner-mode`,`local`),F=o?.find(t=>t.api_name===e),I=(0,b.useMemo)(()=>F?.artifacts.automation_action_configs??[],[F]),L=I.find(e=>e.action_step_api_name===r)??I[0],z=(0,b.useMemo)(()=>{if(!e||!F)return{};let t=F.base_config,n=v(e),r=_(e),i=p(n?.__kizen_clean_config??{},[],n?.__kizen_setup_assistant_values??{},t?.setup_assistant?.fields),a=p(r?.__kizen_clean_config??{},[],r?.__kizen_setup_assistant_values??{},t?.user_setup_assistant?.fields),o={};for(let[e,t]of Object.entries(i))o[`config__${e}`]=t;for(let[e,t]of Object.entries(a))o[`userConfig__${e}`]=t;return o},[e,F]);if((0,b.useEffect)(()=>{if(!r&&I.length>0&&e){let t=I[0];t&&i({to:`/$apiName/code-steps/$stepApiName`,params:{apiName:e,stepApiName:t.action_step_api_name},replace:!0})}},[r,I,e,i]),(0,b.useEffect)(()=>{O(null)},[r]),s)return(0,x.jsx)(m,{children:(0,x.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(S)return(0,x.jsx)(m,{children:(0,x.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});if(!F)return(0,x.jsx)(m,{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(I.length===0)return(0,x.jsx)(m,{children:(0,x.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:`This app has no automation code steps.`})});if(!L)return(0,x.jsx)(m,{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()=>{E(!0),O(null);try{let t=Object.fromEntries(L.inputs.map(e=>[e.name,k[e.name]??``])),n;n=N===`remote`?await R(w,{script:L.script,scriptRuntime:L.script_runtime,inputs:t,inputTypes:Object.fromEntries(L.inputs.map(e=>[e.name,e.data_type])),outputTypes:Object.fromEntries(L.outputs.map(e=>[e.name,e.data_type])),secretNames:L.secrets.map(t=>`${e??``}__${t}`)}):await(await fetch(`/api/execute-step`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({script:L.script,scriptRuntime:L.script_runtime,inputs:t,secrets:Object.fromEntries(L.secrets.map(t=>[`${e??``}__${t}`,j[t]??``]))})})).json(),O(n)}catch(e){O({success:!1,outputValues:{},logs:[],stdout:``,stderr:``,error:e instanceof Error?e.message:String(e),exitCode:1,durationMs:0})}finally{E(!1)}};return(0,x.jsxs)(`div`,{className:`space-y-4`,children:[(0,x.jsxs)(m,{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:L.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:I.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:L.script_runtime})]}),L.overall_description&&(0,x.jsx)(`p`,{className:`mt-2 text-[12px] text-neutral-500`,children:L.overall_description}),L.when&&(0,x.jsx)(`div`,{className:`mt-2`,children:(0,x.jsx)(y,{when:L.when,whenState:z})})]}),(0,x.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-3`,children:[(0,x.jsxs)(m,{children:[(0,x.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Inputs`}),L.inputs.length>0?(0,x.jsx)(`div`,{className:`space-y-3`,children:L.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:k[e.name]??``,onChange:t=>{A({...k,[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)(m,{children:[(0,x.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Outputs`}),L.outputs.length>0?(0,x.jsx)(`div`,{className:`space-y-2`,children:L.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)(m,{children:[(0,x.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Secrets`}),N===`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.`}),L.secrets.length>0?(0,x.jsx)(`div`,{className:`space-y-3`,children:L.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:j[e]??``,onChange:t=>{M({...j,[e]:t.target.value})},placeholder:e,disabled:N===`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)(h,{code:L.script,language:`python`,onRun:()=>void B(),isRunning:T,executionMode:N,onModeChange:P}),(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:D?(0,x.jsx)(C,{result:D}):(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:T?(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{c,n as l,r as u,s as d,t as f}from"./useCriticalExceptionDialog-Dxoa5oCH.js";import{t as p}from"./bundleQuery-BE1Gb8Ii.js";import{n as m}from"./CredentialsContext-Cwl_xyt_.js";import{A as h,i as g,n as _,r as v}from"./api-DwPVK6u4.js";import{n as y,t as b}from"./Dialog-C3QoiHOt.js";import{t as x}from"./Card-Sa52PGkn.js";import{t as S}from"./CodeViewer-CVECJY4e.js";import{c as C,i as w,n as T,o as E,r as D,s as O,t as k}from"./configStorage-DoMfqInd.js";var A=e(r(),1),j=n(),M=e=>e?JSON.stringify(e,null,2):`{}`,N=({apiName:e,configTemplate:t})=>{let n=D(e),r=M(t),[i,a]=(0,A.useState)(n?.__kizen_clean_config?JSON.stringify(n.__kizen_clean_config,null,2):r),[o,s]=(0,A.useState)(null),[c,l]=(0,A.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{O(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:()=>{k(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`})]})]})},P=({open:e,onClose:t,apiName:n,loadFn:r,label:i})=>{let a=(0,A.useMemo)(()=>e?r(n)?.__kizen_clean_config??null:null,[e,n,r]),o=(0,A.useMemo)(()=>a?JSON.stringify(a,null,2):``,[a]),[s,c]=(0,A.useState)(!1);return(0,A.useEffect)(()=>{e||c(!1)},[e]),(0,j.jsx)(b,{open:e,size:`xl`,ariaModal:!0,onBackdropClick:t,header:(0,j.jsx)(y,{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)(S,{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.`})]})})},F=({config:e,apiName:t,loadFn:n,saveFn:r,clearFn:i})=>{let a=n(t)?.__kizen_setup_assistant_values,o=(0,A.useRef)({}),[s,d]=(0,A.useState)(!1),{getObjectByAPIName:f,getCustomObjectDetails:p}=l(),m=(0,A.useCallback)(e=>{o.current=e},[]);return(0,j.jsx)(c,{config:e,value:a,onStateChange:m,disabledKeys:[],getObjectByAPIName:f,getCustomObjectDetails:p,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.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,j.jsx)(`button`,{onClick:()=>{let n=o.current;r(t,n,e),d(!0),setTimeout(()=>{d(!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,j.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,j.jsx)(`span`,{className:`text-[12px] text-green-600 font-medium`,children:`Saved`})]})]})})},I=({config:e,apiName:n,loadFn:r,saveFn:a,clearFn:o})=>{let c=s(),l=g(),u=(0,A.useMemo)(()=>h(l),[l]),{environment:p}=m(),y=_[p],[b,x]=(0,A.useState)(!1),[S,C]=(0,A.useState)(!1),{onMonitoringException:w,dialog:T}=f();return c?(0,j.jsx)(d,{appPath:y,user:{id:c.team.user,crm_client_id:``},business:c.business,clientObject:c.business.client_object?{id:c.business.client_object.id,objectName:c.business.client_object.object_name}:void 0,teamMember:c.team,onNavigate:()=>{},performFileUpload:()=>Promise.resolve({url:``}),monitoringExceptionHelper:w,performRequest:v(u),modal:{showing:b,show:S,showPrompt:()=>{x(!0),C(!0)},onConfirm:()=>{x(!1),C(!1)},onHide:()=>{x(!1),C(!1)}},showToast:()=>{},clearToasts:()=>{},children:()=>(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(F,{config:e,apiName:n,loadFn:r,saveFn:a,clearFn:o}),T]})}):(0,j.jsx)(i,{icon:t,className:`animate-spin text-neutral-400`})},L=()=>{let{apiName:e}=a({strict:!1}),{data:t,isLoading:n,isError:r}=o(p),[i,s]=(0,A.useState)(null);if(n)return(0,j.jsx)(x,{children:(0,j.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(r)return(0,j.jsx)(x,{children:(0,j.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});let c=t?.find(t=>t.api_name===e);if(!c)return(0,j.jsx)(x,{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 l=c.base_config,u=l?.setup_assistant,d=l?.user_setup_assistant,f=(u?.fields?.length??0)>0,m=(d?.fields?.length??0)>0;return!f&&!m?(0,j.jsx)(x,{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)(N,{apiName:e??``,configTemplate:c.config_template})]})}):(0,j.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start`,children:[f&&u&&(0,j.jsx)(x,{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.jsxs)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,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)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:`this.config`}),`.`]})]}),(0,j.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,j.jsx)(I,{config:u,apiName:e??``,loadFn:D,saveFn:E,clearFn:k})]})}),m&&d&&(0,j.jsx)(x,{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.jsxs)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,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)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:`this.userConfig`}),`.`]})]}),(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)(I,{config:d,apiName:e??``,loadFn:w,saveFn:C,clearFn:T})]})}),(0,j.jsx)(P,{open:i===`business`,onClose:()=>{s(null)},apiName:e??``,loadFn:D,label:`this.config`}),(0,j.jsx)(P,{open:i===`user`,onClose:()=>{s(null)},apiName:e??``,loadFn:w,label:`this.userConfig`})]})};export{L 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{c,n as l,r as u,s as d,t as f}from"./useCriticalExceptionDialog-CncFngL7.js";import{t as p}from"./bundleQuery-BE1Gb8Ii.js";import{n as m}from"./CredentialsContext-Cwl_xyt_.js";import{N as h,i as g,n as _,r as v}from"./api-ViOFtzH7.js";import{n as y,t as b}from"./Dialog-C3QoiHOt.js";import{t as x}from"./Card-Sa52PGkn.js";import{t as S}from"./CodeViewer-CVECJY4e.js";import{c as C,i as w,n as T,o as E,r as D,s as O,t as k}from"./configStorage-CfwJ8JQJ.js";var A=e(r(),1),j=n(),M=e=>e?JSON.stringify(e,null,2):`{}`,N=({apiName:e,configTemplate:t})=>{let n=D(e),r=M(t),[i,a]=(0,A.useState)(n?.__kizen_clean_config?JSON.stringify(n.__kizen_clean_config,null,2):r),[o,s]=(0,A.useState)(null),[c,l]=(0,A.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{O(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:()=>{k(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`})]})]})},P=({open:e,onClose:t,apiName:n,loadFn:r,label:i})=>{let a=(0,A.useMemo)(()=>e?r(n)?.__kizen_clean_config??null:null,[e,n,r]),o=(0,A.useMemo)(()=>a?JSON.stringify(a,null,2):``,[a]),[s,c]=(0,A.useState)(!1);return(0,A.useEffect)(()=>{e||c(!1)},[e]),(0,j.jsx)(b,{open:e,size:`xl`,ariaModal:!0,onBackdropClick:t,header:(0,j.jsx)(y,{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)(S,{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.`})]})})},F=({config:e,apiName:t,loadFn:n,saveFn:r,clearFn:i})=>{let a=n(t)?.__kizen_setup_assistant_values,o=(0,A.useRef)({}),[s,d]=(0,A.useState)(!1),{getObjectByAPIName:f,getCustomObjectDetails:p}=l(),m=(0,A.useCallback)(e=>{o.current=e},[]);return(0,j.jsx)(c,{config:e,value:a,onStateChange:m,disabledKeys:[],getObjectByAPIName:f,getCustomObjectDetails:p,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.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,j.jsx)(`button`,{onClick:()=>{let n=o.current;r(t,n,e),d(!0),setTimeout(()=>{d(!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,j.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,j.jsx)(`span`,{className:`text-[12px] text-green-600 font-medium`,children:`Saved`})]})]})})},I=({config:e,apiName:n,loadFn:r,saveFn:a,clearFn:o})=>{let c=s(),l=g(),u=(0,A.useMemo)(()=>h(l),[l]),{environment:p}=m(),y=_[p],[b,x]=(0,A.useState)(!1),[S,C]=(0,A.useState)(!1),{onMonitoringException:w,dialog:T}=f();return c?(0,j.jsx)(d,{appPath:y,user:{id:c.team.user,crm_client_id:``},business:c.business,clientObject:c.business.client_object?{id:c.business.client_object.id,objectName:c.business.client_object.object_name}:void 0,teamMember:c.team,onNavigate:()=>{},performFileUpload:()=>Promise.resolve({url:``}),monitoringExceptionHelper:w,performRequest:v(u),modal:{showing:b,show:S,showPrompt:()=>{x(!0),C(!0)},onConfirm:()=>{x(!1),C(!1)},onHide:()=>{x(!1),C(!1)}},showToast:()=>{},clearToasts:()=>{},children:()=>(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(F,{config:e,apiName:n,loadFn:r,saveFn:a,clearFn:o}),T]})}):(0,j.jsx)(i,{icon:t,className:`animate-spin text-neutral-400`})},L=()=>{let{apiName:e}=a({strict:!1}),{data:t,isLoading:n,isError:r}=o(p),[i,s]=(0,A.useState)(null);if(n)return(0,j.jsx)(x,{children:(0,j.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(r)return(0,j.jsx)(x,{children:(0,j.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});let c=t?.find(t=>t.api_name===e);if(!c)return(0,j.jsx)(x,{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 l=c.base_config,u=l?.setup_assistant,d=l?.user_setup_assistant,f=(u?.fields?.length??0)>0,m=(d?.fields?.length??0)>0;return!f&&!m?(0,j.jsx)(x,{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)(N,{apiName:e??``,configTemplate:c.config_template})]})}):(0,j.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start`,children:[f&&u&&(0,j.jsx)(x,{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.jsxs)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,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)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:`this.config`}),`.`]})]}),(0,j.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,j.jsx)(I,{config:u,apiName:e??``,loadFn:D,saveFn:E,clearFn:k})]})}),m&&d&&(0,j.jsx)(x,{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.jsxs)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,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)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:`this.userConfig`}),`.`]})]}),(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)(I,{config:d,apiName:e??``,loadFn:w,saveFn:C,clearFn:T})]})}),(0,j.jsx)(P,{open:i===`business`,onClose:()=>{s(null)},apiName:e??``,loadFn:D,label:`this.config`}),(0,j.jsx)(P,{open:i===`user`,onClose:()=>{s(null)},apiName:e??``,loadFn:w,label:`this.userConfig`})]})};export{L as ConfigurationPage};