@kizenapps/cli 0.15.0 → 0.16.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/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/viewer/assets/{ConfigurationPage-n8Uo_HL7.js → ConfigurationPage-Bz7OWrKi.js} +1 -1
- package/dist/viewer/assets/{SandboxPage-CB4FgqI3.js → SandboxPage-DR-JuVpv.js} +1 -1
- package/dist/viewer/assets/{index-BMMO15ja.js → index-CdWhtYEM.js} +2 -2
- package/dist/viewer/assets/{index-dW-Omils.css → index-DtzraybB.css} +1 -1
- package/dist/viewer/assets/{useCriticalExceptionDialog-C3m9pLEk.js → useCriticalExceptionDialog-CutIcd8b.js} +1 -1
- package/dist/viewer/index.html +2 -2
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{A as t,T as n,j as r,k as i}from"./fa-core-BoBqCOD3.js";import{n as a,t as o}from"./bundleQuery-CjbA01rb.js";import{t as s}from"./useQuery-5OkVbV1s.js";import{a as c,i as l,n as u}from"./BootstrapContext-D5ZnMrOp.js";import{i as d,n as f,o as p,r as m,s as h,t as g}from"./useCriticalExceptionDialog-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{A as t,T as n,j as r,k as i}from"./fa-core-BoBqCOD3.js";import{n as a,t as o}from"./bundleQuery-CjbA01rb.js";import{t as s}from"./useQuery-5OkVbV1s.js";import{a as c,i as l,n as u}from"./BootstrapContext-D5ZnMrOp.js";import{i as d,n as f,o as p,r as m,s as h,t as g}from"./useCriticalExceptionDialog-CutIcd8b.js";import{d as _}from"./storageKeys-C6c8YF5Y.js";import{n as v,r as y}from"./api-CT-MKz2h.js";import{t as b}from"./Card-BpDJPrPZ.js";import{t as x}from"./CodeViewer-C9aVhzG7.js";import{c as S,i as C,n as w,o as T,r as E,s as D,t as O}from"./configStorage-CNoQ0cy5.js";var k=e(r(),1),A=t(),j=e=>e?JSON.stringify(e,null,2):`{}`,M=({apiName:e,configTemplate:t})=>{let n=E(e),r=j(t),[i,a]=(0,k.useState)(n?.__kizen_clean_config?JSON.stringify(n.__kizen_clean_config,null,2):r),[o,s]=(0,k.useState)(null),[c,l]=(0,k.useState)(!1);return(0,A.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,A.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,A.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,A.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,A.jsxs)(`span`,{className:`text-[12px] text-red-500`,children:[`Parse error: `,o]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(`button`,{onClick:()=>{try{D(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,A.jsx)(`button`,{onClick:()=>{O(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,A.jsx)(`span`,{className:`text-[12px] text-green-600 font-medium`,children:`Saved`})]})]})},N=({open:e,onClose:t,apiName:n,loadFn:r,label:i})=>{let a=(0,k.useMemo)(()=>e?r(n)?.__kizen_clean_config??null:null,[e,n,r]),o=(0,k.useMemo)(()=>a?JSON.stringify(a,null,2):``,[a]),[s,u]=(0,k.useState)(!1);return(0,k.useEffect)(()=>{e||u(!1)},[e]),(0,A.jsx)(l,{open:e,size:`xl`,ariaModal:!0,onBackdropClick:t,header:(0,A.jsx)(c,{title:`Stored JSON — ${i}`,onClose:t}),footer:a?(0,A.jsx)(`button`,{onClick:()=>{navigator.clipboard.writeText(o).then(()=>{u(!0),setTimeout(()=>{u(!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,A.jsxs)(`div`,{className:`px-5 py-4`,children:[(0,A.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,A.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:i}),`. Save the form to refresh.`]}),a?(0,A.jsx)(x,{code:o,language:`json`}):(0,A.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.`})]})})},P=({config:e,apiName:t,loadFn:n,saveFn:r,clearFn:i})=>{let a=n(t)?.__kizen_setup_assistant_values,o=(0,k.useRef)({}),[s,c]=(0,k.useState)(!1),{getObjectByAPIName:l,getCustomObjectDetails:u}=f(),p=(0,k.useCallback)(e=>{o.current=e},[]);return(0,A.jsx)(h,{config:e,value:a,onStateChange:p,disabledKeys:[],getObjectByAPIName:l,getCustomObjectDetails:u,children:(0,A.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.fields?.map(e=>(0,A.jsx)(d,{field:e,pluginApiName:t},e.key)),(0,A.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,A.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,A.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,A.jsx)(`span`,{className:`text-[12px] text-green-600 font-medium`,children:`Saved`})]})]})})},F=({config:e,apiName:t,loadFn:r,saveFn:a,clearFn:o})=>{let s=u(),c=y(),l=(0,k.useMemo)(()=>m(c),[c]),{environment:d}=_(),f=v[d],[h,b]=(0,k.useState)(!1),[x,S]=(0,k.useState)(!1),{onMonitoringException:C,dialog:w}=g();return s?(0,A.jsx)(p,{appPath:f,user:{id:s.team.user,crm_client_id:``},business:s.business,clientObject:s.business.client_object?{id:s.business.client_object.id,objectName:s.business.client_object.object_name}:void 0,teamMember:s.team,onNavigate:()=>{},performFileUpload:()=>Promise.resolve({url:``}),monitoringExceptionHelper:C,performRequest:async(e,t,n,r)=>({data:await l.request(e,t,n,r)}),modal:{showing:h,show:x,showPrompt:()=>{b(!0),S(!0)},onConfirm:()=>{b(!1),S(!1)},onHide:()=>{b(!1),S(!1)}},showToast:()=>{},clearToasts:()=>{},children:()=>(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(P,{config:e,apiName:t,loadFn:r,saveFn:a,clearFn:o}),w]})}):(0,A.jsx)(i,{icon:n,className:`animate-spin text-neutral-400`})},I=()=>{let{apiName:e}=a({strict:!1}),{data:t,isLoading:n,isError:r}=s(o),[i,c]=(0,k.useState)(null);if(n)return(0,A.jsx)(b,{children:(0,A.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(r)return(0,A.jsx)(b,{children:(0,A.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});let l=t?.find(t=>t.api_name===e);if(!l)return(0,A.jsx)(b,{children:(0,A.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,A.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:e}),`.`]})});let u=l.base_config,d=u?.setup_assistant,f=u?.user_setup_assistant,p=(d?.fields?.length??0)>0,m=(f?.fields?.length??0)>0;return!p&&!m?(0,A.jsx)(b,{children:(0,A.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`Configuration`}),(0,A.jsx)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,children:`Enter plugin configuration as JSON.`})]}),(0,A.jsx)(M,{apiName:e??``,configTemplate:l.config_template})]})}):(0,A.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start`,children:[p&&d&&(0,A.jsx)(b,{className:`lg:flex-1 lg:min-w-0`,children:(0,A.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`Business Configuration`}),(0,A.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,A.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:`this.config`}),`.`]})]}),(0,A.jsx)(`button`,{onClick:()=>{c(`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,A.jsx)(F,{config:d,apiName:e??``,loadFn:E,saveFn:T,clearFn:O})]})}),m&&f&&(0,A.jsx)(b,{className:`lg:flex-1 lg:min-w-0`,children:(0,A.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`User Configuration`}),(0,A.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,A.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:`this.userConfig`}),`.`]})]}),(0,A.jsx)(`button`,{onClick:()=>{c(`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,A.jsx)(F,{config:f,apiName:e??``,loadFn:C,saveFn:S,clearFn:w})]})}),(0,A.jsx)(N,{open:i===`business`,onClose:()=>{c(null)},apiName:e??``,loadFn:E,label:`this.config`}),(0,A.jsx)(N,{open:i===`user`,onClose:()=>{c(null)},apiName:e??``,loadFn:C,label:`this.userConfig`})]})};export{I as ConfigurationPage};
|