@rytass/bpm-core-react 0.4.1 → 0.5.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 (147) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/dist/chunks/FormBuilderView-B_KGPjlp.cjs +3 -0
  3. package/dist/chunks/FormBuilderView-B_KGPjlp.cjs.map +1 -0
  4. package/dist/chunks/FormBuilderView-D8DrQOXD.js +1090 -0
  5. package/dist/chunks/FormBuilderView-D8DrQOXD.js.map +1 -0
  6. package/dist/chunks/{approval-instance-list-page-C5ZKPHdA.cjs → approval-instance-list-page-BMUKxzcz.cjs} +2 -2
  7. package/dist/chunks/{approval-instance-list-page-C5ZKPHdA.cjs.map → approval-instance-list-page-BMUKxzcz.cjs.map} +1 -1
  8. package/dist/chunks/{approval-instance-list-page-BF2r5D2-.js → approval-instance-list-page-YZcGGDD8.js} +2 -2
  9. package/dist/chunks/{approval-instance-list-page-BF2r5D2-.js.map → approval-instance-list-page-YZcGGDD8.js.map} +1 -1
  10. package/dist/chunks/compose-PMrmi-LE.js +451 -0
  11. package/dist/chunks/compose-PMrmi-LE.js.map +1 -0
  12. package/dist/chunks/compose-ziVbRYdo.cjs +2 -0
  13. package/dist/chunks/compose-ziVbRYdo.cjs.map +1 -0
  14. package/dist/chunks/{dashboard-page-Ib8srCMy.js → dashboard-page-DJ9vOPga.js} +2 -2
  15. package/dist/chunks/{dashboard-page-Ib8srCMy.js.map → dashboard-page-DJ9vOPga.js.map} +1 -1
  16. package/dist/chunks/{dashboard-page-CddG1MnK.cjs → dashboard-page-DwHQY6Ki.cjs} +2 -2
  17. package/dist/chunks/{dashboard-page-CddG1MnK.cjs.map → dashboard-page-DwHQY6Ki.cjs.map} +1 -1
  18. package/dist/chunks/designer-DCn6_v4b.cjs +65 -0
  19. package/dist/chunks/designer-DCn6_v4b.cjs.map +1 -0
  20. package/dist/chunks/designer-mOMxJ0Py.js +2576 -0
  21. package/dist/chunks/designer-mOMxJ0Py.js.map +1 -0
  22. package/dist/chunks/detail-Bml-vXHX.js +1622 -0
  23. package/dist/chunks/detail-Bml-vXHX.js.map +1 -0
  24. package/dist/chunks/detail-CWeCrmtC.cjs +2 -0
  25. package/dist/chunks/detail-CWeCrmtC.cjs.map +1 -0
  26. package/dist/chunks/{routes-config-dxahImVe.js → routes-config-RBYQtUd0.js} +2 -3
  27. package/dist/chunks/routes-config-RBYQtUd0.js.map +1 -0
  28. package/dist/chunks/routes-config-fDVHmvXi.cjs +2 -0
  29. package/dist/chunks/routes-config-fDVHmvXi.cjs.map +1 -0
  30. package/dist/index.cjs +1 -1
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.js +268 -128
  33. package/dist/index.js.map +1 -1
  34. package/dist/lib/routes-config.d.ts +6 -4
  35. package/dist/next/index.cjs +1 -1
  36. package/dist/next/index.js +1 -1
  37. package/dist/next/workflow-chat-route.cjs +19 -0
  38. package/dist/next/workflow-chat-route.cjs.map +1 -0
  39. package/dist/next/workflow-chat-route.d.ts +17 -0
  40. package/dist/next/workflow-chat-route.js +31 -0
  41. package/dist/next/workflow-chat-route.js.map +1 -0
  42. package/dist/pages/instances/detail/index.cjs +1 -1
  43. package/dist/pages/instances/detail/index.js +1 -1
  44. package/dist/pages/templates/compose/index.cjs +2 -0
  45. package/dist/pages/templates/compose/index.cjs.map +1 -0
  46. package/dist/pages/templates/compose/index.d.ts +13 -0
  47. package/dist/pages/templates/compose/index.js +14 -0
  48. package/dist/pages/templates/compose/index.js.map +1 -0
  49. package/dist/pages/templates/designer/index.cjs +1 -1
  50. package/dist/pages/templates/designer/index.cjs.map +1 -1
  51. package/dist/pages/templates/designer/index.js +7 -2
  52. package/dist/pages/templates/designer/index.js.map +1 -1
  53. package/dist/pages/templates/index.cjs +1 -1
  54. package/dist/pages/templates/index.cjs.map +1 -1
  55. package/dist/pages/templates/index.js +3 -3
  56. package/dist/pages/templates/index.js.map +1 -1
  57. package/dist/views/cc/index.cjs +1 -1
  58. package/dist/views/cc/index.js +1 -1
  59. package/dist/views/dashboard/index.cjs +1 -1
  60. package/dist/views/dashboard/index.js +1 -1
  61. package/dist/views/forms/builder/FormBuilderView.d.ts +13 -4
  62. package/dist/views/forms/builder/index.cjs +1 -1
  63. package/dist/views/forms/builder/index.js +1 -1
  64. package/dist/views/forms/builder/json-code-editor.d.ts +1 -1
  65. package/dist/views/inbox/index.cjs +1 -1
  66. package/dist/views/inbox/index.js +1 -1
  67. package/dist/views/instances/detail/InstanceDetailView.d.ts +11 -1
  68. package/dist/views/instances/detail/index.cjs +1 -1
  69. package/dist/views/instances/detail/index.d.ts +5 -0
  70. package/dist/views/instances/detail/index.js +2 -2
  71. package/dist/views/instances/detail/sections/InstanceAttachmentsSection.d.ts +15 -0
  72. package/dist/views/instances/detail/sections/InstanceFormSection.d.ts +33 -0
  73. package/dist/views/instances/detail/sections/InstanceHistorySection.d.ts +29 -0
  74. package/dist/views/instances/detail/sections/InstanceSignaturesSection.d.ts +14 -0
  75. package/dist/views/instances/detail/sections/InstanceTasksSection.d.ts +44 -0
  76. package/dist/views/instances/detail/sections/container-helpers.d.ts +8 -0
  77. package/dist/views/instances/detail/sections/shared.d.ts +103 -0
  78. package/dist/views/instances/new/index.cjs +1 -1
  79. package/dist/views/instances/new/index.js +1 -1
  80. package/dist/views/search/index.cjs +1 -1
  81. package/dist/views/search/index.js +1 -1
  82. package/dist/views/sent/index.cjs +1 -1
  83. package/dist/views/sent/index.js +1 -1
  84. package/dist/views/templates/TemplatesView.d.ts +5 -0
  85. package/dist/views/templates/compose/TemplateComposeWizardView.d.ts +8 -0
  86. package/dist/views/templates/compose/index.cjs +1 -0
  87. package/dist/views/templates/compose/index.d.ts +2 -0
  88. package/dist/views/templates/compose/index.js +2 -0
  89. package/dist/views/templates/compose/steps/ComposeFormStep.d.ts +15 -0
  90. package/dist/views/templates/compose/steps/ComposeReviewStep.d.ts +12 -0
  91. package/dist/views/templates/compose/steps/ComposeWorkflowStep.d.ts +11 -0
  92. package/dist/views/templates/compose/use-template-compose-wizard.d.ts +46 -0
  93. package/dist/views/templates/designer/TemplateDesignerView.d.ts +60 -2
  94. package/dist/views/templates/designer/chrome-workflow-chat.d.ts +12 -0
  95. package/dist/views/templates/designer/index.cjs +1 -51
  96. package/dist/views/templates/designer/index.js +2 -2272
  97. package/dist/views/templates/designer/use-workflow-chat.d.ts +21 -0
  98. package/dist/views/templates/designer/use-workflow-designer-controller.d.ts +41 -0
  99. package/dist/views/templates/designer/workflow-chat-drawer.d.ts +16 -0
  100. package/dist/views/templates/index.cjs +2 -1
  101. package/dist/views/templates/index.cjs.map +1 -0
  102. package/dist/views/templates/index.js +265 -4
  103. package/dist/views/templates/index.js.map +1 -0
  104. package/dist/views/templates/versions/index.cjs +1 -1
  105. package/dist/views/templates/versions/index.cjs.map +1 -1
  106. package/dist/views/templates/versions/index.js +38 -42
  107. package/dist/views/templates/versions/index.js.map +1 -1
  108. package/package.json +22 -19
  109. package/dist/chunks/builder-BLVnnpnP.js +0 -1300
  110. package/dist/chunks/builder-BLVnnpnP.js.map +0 -1
  111. package/dist/chunks/builder-DVE9zIKH.cjs +0 -3
  112. package/dist/chunks/builder-DVE9zIKH.cjs.map +0 -1
  113. package/dist/chunks/detail-Dcr5mM8g.cjs +0 -2
  114. package/dist/chunks/detail-Dcr5mM8g.cjs.map +0 -1
  115. package/dist/chunks/detail-u9DdLhDW.js +0 -1518
  116. package/dist/chunks/detail-u9DdLhDW.js.map +0 -1
  117. package/dist/chunks/form-name-modal-C3OEvkCV.js +0 -64
  118. package/dist/chunks/form-name-modal-C3OEvkCV.js.map +0 -1
  119. package/dist/chunks/form-name-modal-uZCHbtRH.cjs +0 -2
  120. package/dist/chunks/form-name-modal-uZCHbtRH.cjs.map +0 -1
  121. package/dist/chunks/routes-config-2aKbWq2H.cjs +0 -2
  122. package/dist/chunks/routes-config-2aKbWq2H.cjs.map +0 -1
  123. package/dist/chunks/routes-config-dxahImVe.js.map +0 -1
  124. package/dist/chunks/templates-D44FSB46.js +0 -380
  125. package/dist/chunks/templates-D44FSB46.js.map +0 -1
  126. package/dist/chunks/templates-w96t83N-.cjs +0 -2
  127. package/dist/chunks/templates-w96t83N-.cjs.map +0 -1
  128. package/dist/pages/forms/builder/index.cjs +0 -2
  129. package/dist/pages/forms/builder/index.cjs.map +0 -1
  130. package/dist/pages/forms/builder/index.d.ts +0 -21
  131. package/dist/pages/forms/builder/index.js +0 -15
  132. package/dist/pages/forms/builder/index.js.map +0 -1
  133. package/dist/pages/forms/index.cjs +0 -2
  134. package/dist/pages/forms/index.cjs.map +0 -1
  135. package/dist/pages/forms/index.d.ts +0 -17
  136. package/dist/pages/forms/index.js +0 -14
  137. package/dist/pages/forms/index.js.map +0 -1
  138. package/dist/views/forms/FormsView.d.ts +0 -2
  139. package/dist/views/forms/form-name-modal.d.ts +0 -12
  140. package/dist/views/forms/index.cjs +0 -2
  141. package/dist/views/forms/index.cjs.map +0 -1
  142. package/dist/views/forms/index.d.ts +0 -2
  143. package/dist/views/forms/index.js +0 -186
  144. package/dist/views/forms/index.js.map +0 -1
  145. package/dist/views/templates/designer/index.cjs.map +0 -1
  146. package/dist/views/templates/designer/index.js.map +0 -1
  147. package/dist/views/templates/template-name-modal.d.ts +0 -22
@@ -1,2 +1,2 @@
1
- "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/chunk-CMqjfN_6.cjs"),t=require("../../chunks/router-adapter--gYs13E8.cjs"),n=require("../../chunks/auth-provider-4BeCw7cI.cjs"),r=require("../../chunks/format-date-time-XxBzF0F5.cjs"),i=require("../../chunks/routes-config-2aKbWq2H.cjs");let a=require("react"),o=require("@mezzanine-ui/react"),s=require("react/jsx-runtime"),c=require("@rytass/bpm-core-client/workflow"),l=require("@mezzanine-ui/react/ContentHeader");l=e.t(l,1);let u=require("@mezzanine-ui/icons");function d(){let e=t.r(),d=i.r(),{member:m}=n.n(),h=m?.memberId??null,[g,_]=(0,a.useState)(`pending`),[v,b]=(0,a.useState)(null),[S,w]=(0,a.useState)([]),[T,E]=(0,a.useState)(!0),[D,k]=(0,a.useState)([]);(0,a.useEffect)(()=>{h&&I()},[h]);let A=(0,a.useMemo)(()=>[{dataIndex:`caseTitle`,key:`caseTitle`,title:`案件`,width:280},{dataIndex:`nodeId`,key:`nodeId`,title:`節點`,width:180},{dataIndex:`statusLabel`,key:`statusLabel`,title:`狀態`,width:120},{key:`slaDueAt`,render:e=>(0,s.jsx)(o.Typography,{color:e.slaStatusColor,component:`span`,variant:`body`,children:e.slaStatusText}),title:`SLA`,width:180},{key:`createdAt`,render:e=>(0,s.jsx)(o.Typography,{component:`span`,variant:`body`,children:r.t(e.createdAt)}),title:`建立時間`,width:220}],[]),j=(0,a.useMemo)(()=>({render:t=>[{name:`處理`,onClick:()=>e.push(d.caseDetail(t.instanceId))}],variant:`base-secondary`,width:88}),[e,d]),M=(0,a.useMemo)(()=>[{dataIndex:`caseTitle`,key:`caseTitle`,title:`案件`,width:280},{dataIndex:`nodeId`,key:`nodeId`,title:`節點`,width:180},{key:`decisionLabel`,render:e=>(0,s.jsx)(o.Typography,{color:y(e.decisionAction),component:`span`,variant:`body`,children:e.decisionLabel}),title:`決議`,width:120},{key:`decisionComment`,render:e=>(0,s.jsx)(o.Typography,{component:`span`,variant:`body`,children:e.decisionCommentText}),title:`意見`,width:240},{key:`instanceStateLabel`,render:e=>(0,s.jsx)(o.Typography,{color:x(e.instanceState),component:`span`,variant:`body`,children:e.instanceStateLabel}),title:`流程狀態`,width:140},{key:`decidedAt`,render:e=>(0,s.jsx)(o.Typography,{component:`span`,variant:`body`,children:C(e.decidedAt)}),title:`簽核時間`,width:220}],[]),N=(0,a.useMemo)(()=>({render:t=>[{name:`查看`,onClick:()=>e.push(d.caseDetail(t.instanceId))}],variant:`base-secondary`,width:88}),[e,d]),P=(0,a.useMemo)(()=>S.filter(e=>e.instanceState===`RUNNING`),[S]);function F(e){if(e===`history`||e===`pending`||e===`tracking`){_(e);return}_(`pending`)}async function I(){E(!0),b(null);try{if(!h){k([]),w([]);return}let[e,t]=await Promise.all([(0,c.listInboxTasks)(h),(0,c.listApprovalHistoryTasks)(h)]),[n,r]=await Promise.all([f(e),p(t)]);k(n),w(r)}catch(e){b(O(e))}finally{E(!1)}}return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o.PageHeader,{children:(0,s.jsx)(l.default,{description:`目前以 ${m?.name??h??`目前登入會員`} 查詢待處理與歷史簽核任務。`,title:`我的待簽`,children:(0,s.jsx)(o.Button,{icon:u.PlusIcon,iconType:`leading`,onClick:()=>e.push(d.caseNew()),variant:`base-primary`,children:`發起簽核`})})}),(0,s.jsx)(o.SectionGroup,{children:(0,s.jsxs)(o.Section,{children:[v?(0,s.jsx)(o.Typography,{color:`text-error`,variant:`body`,children:v}):null,(0,s.jsxs)(o.Tab,{activeKey:g,onChange:F,size:`sub`,children:[(0,s.jsx)(o.TabItem,{badgeCount:T?void 0:D.length,children:`待簽核`},`pending`),(0,s.jsx)(o.TabItem,{badgeCount:T?void 0:P.length,children:`已處理未結束`},`tracking`),(0,s.jsx)(o.TabItem,{children:`歷史簽核記錄`},`history`)]}),g===`pending`?(0,s.jsx)(o.Table,{actions:j,columns:A,dataSource:D,fullWidth:!0,loading:T}):null,g===`tracking`?(0,s.jsx)(o.Table,{actions:N,columns:M,dataSource:P,fullWidth:!0,loading:T}):null,g===`history`?(0,s.jsx)(o.Table,{actions:N,columns:M,dataSource:S,fullWidth:!0,loading:T}):null]})})]})}async function f(e){let t=await m(e);return e.map((e,n)=>({...e,caseTitle:h(e,t[n]??null),key:e.id,slaStatusColor:T(e.slaDueAt),slaStatusText:w(e.slaDueAt),statusLabel:D(e.status)}))}async function p(e){let[t,n]=await Promise.all([Promise.all(e.map(e=>(0,c.listTaskDecisions)(e.id))),m(e)]);return e.map((e,r)=>{let i=g(t[r]??[]),a=n[r]??null;return{...e,caseTitle:h(e,a),decisionAction:i?.action??null,decisionComment:i?.comment??null,decisionCommentText:S(i?.comment??null),decisionLabel:v(i?.action??null),decidedAt:i?.decidedAt??e.completedAt,instanceState:a?.state??null,instanceStateLabel:b(a?.state??null),key:e.id}})}async function m(e){return Promise.all(e.map(async e=>{try{return(await(0,c.readApprovalInstance)(e.instanceId)).instance}catch{return null}}))}function h(e,t){return t?(0,c.readApprovalInstanceCaseTitle)(t):e.instanceId}function g(e){return[...e].sort(_)[0]??null}function _(e,t){return new Date(t.decidedAt).getTime()-new Date(e.decidedAt).getTime()}function v(e){return e===`APPROVED`?`同意`:e===`REJECTED`?`拒絕`:e===`RETURNED`?`退回`:e===`TRANSFERRED`?`轉派`:`未記錄`}function y(e){return e===`APPROVED`?`text-success`:e===`REJECTED`||e===`RETURNED`?`text-error`:`text-neutral`}function b(e){return e===`RUNNING`?`進行中`:e===`APPROVED`?`已通過`:e===`REJECTED`?`已拒絕`:e===`RETURNED`?`已退回`:e===`CANCELLED`?`已取消`:e===`EXPIRED`?`已逾期`:e===`DRAFT`?`草稿`:`-`}function x(e){return e===`APPROVED`?`text-success`:e===`REJECTED`||e===`CANCELLED`||e===`EXPIRED`?`text-error`:`text-neutral`}function S(e){return(e?.trim()??``)||`-`}function C(e){return r.t(e)}function w(e){if(!e)return`-`;let t=new Date(e).getTime(),n=Date.now(),r=E(Math.abs(t-n));return t<n?`已逾期 ${r}`:`剩餘 ${r}`}function T(e){return e?new Date(e).getTime()<Date.now()?`text-error`:`text-success`:`text-neutral`}function E(e){let t=Math.max(1,Math.ceil(e/6e4)),n=Math.floor(t/1440),r=Math.floor(t%1440/60),i=t%60;return n>0?`${n}天 ${r}小時`:r>0?`${r}小時 ${i}分鐘`:`${i}分鐘`}function D(e){return e===`PENDING`?`待處理`:e===`IN_PROGRESS`?`處理中`:e===`COMPLETED`?`已完成`:e===`TRANSFERRED`?`已轉派`:e===`CANCELLED`?`已取消`:e}function O(e){return e instanceof Error?e.message:`發生未知錯誤`}exports.InboxView=d;
1
+ "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/chunk-CMqjfN_6.cjs"),t=require("../../chunks/router-adapter--gYs13E8.cjs"),n=require("../../chunks/auth-provider-4BeCw7cI.cjs"),r=require("../../chunks/format-date-time-XxBzF0F5.cjs"),i=require("../../chunks/routes-config-fDVHmvXi.cjs");let a=require("react"),o=require("@mezzanine-ui/react"),s=require("react/jsx-runtime"),c=require("@rytass/bpm-core-client/workflow"),l=require("@mezzanine-ui/react/ContentHeader");l=e.t(l,1);let u=require("@mezzanine-ui/icons");function d(){let e=t.r(),d=i.r(),{member:m}=n.n(),h=m?.memberId??null,[g,_]=(0,a.useState)(`pending`),[v,b]=(0,a.useState)(null),[S,w]=(0,a.useState)([]),[T,E]=(0,a.useState)(!0),[D,k]=(0,a.useState)([]);(0,a.useEffect)(()=>{h&&I()},[h]);let A=(0,a.useMemo)(()=>[{dataIndex:`caseTitle`,key:`caseTitle`,title:`案件`,width:280},{dataIndex:`nodeId`,key:`nodeId`,title:`節點`,width:180},{dataIndex:`statusLabel`,key:`statusLabel`,title:`狀態`,width:120},{key:`slaDueAt`,render:e=>(0,s.jsx)(o.Typography,{color:e.slaStatusColor,component:`span`,variant:`body`,children:e.slaStatusText}),title:`SLA`,width:180},{key:`createdAt`,render:e=>(0,s.jsx)(o.Typography,{component:`span`,variant:`body`,children:r.t(e.createdAt)}),title:`建立時間`,width:220}],[]),j=(0,a.useMemo)(()=>({render:t=>[{name:`處理`,onClick:()=>e.push(d.caseDetail(t.instanceId))}],variant:`base-secondary`,width:88}),[e,d]),M=(0,a.useMemo)(()=>[{dataIndex:`caseTitle`,key:`caseTitle`,title:`案件`,width:280},{dataIndex:`nodeId`,key:`nodeId`,title:`節點`,width:180},{key:`decisionLabel`,render:e=>(0,s.jsx)(o.Typography,{color:y(e.decisionAction),component:`span`,variant:`body`,children:e.decisionLabel}),title:`決議`,width:120},{key:`decisionComment`,render:e=>(0,s.jsx)(o.Typography,{component:`span`,variant:`body`,children:e.decisionCommentText}),title:`意見`,width:240},{key:`instanceStateLabel`,render:e=>(0,s.jsx)(o.Typography,{color:x(e.instanceState),component:`span`,variant:`body`,children:e.instanceStateLabel}),title:`流程狀態`,width:140},{key:`decidedAt`,render:e=>(0,s.jsx)(o.Typography,{component:`span`,variant:`body`,children:C(e.decidedAt)}),title:`簽核時間`,width:220}],[]),N=(0,a.useMemo)(()=>({render:t=>[{name:`查看`,onClick:()=>e.push(d.caseDetail(t.instanceId))}],variant:`base-secondary`,width:88}),[e,d]),P=(0,a.useMemo)(()=>S.filter(e=>e.instanceState===`RUNNING`),[S]);function F(e){if(e===`history`||e===`pending`||e===`tracking`){_(e);return}_(`pending`)}async function I(){E(!0),b(null);try{if(!h){k([]),w([]);return}let[e,t]=await Promise.all([(0,c.listInboxTasks)(h),(0,c.listApprovalHistoryTasks)(h)]),[n,r]=await Promise.all([f(e),p(t)]);k(n),w(r)}catch(e){b(O(e))}finally{E(!1)}}return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o.PageHeader,{children:(0,s.jsx)(l.default,{description:`目前以 ${m?.name??h??`目前登入會員`} 查詢待處理與歷史簽核任務。`,title:`我的待簽`,children:(0,s.jsx)(o.Button,{icon:u.PlusIcon,iconType:`leading`,onClick:()=>e.push(d.caseNew()),variant:`base-primary`,children:`發起簽核`})})}),(0,s.jsx)(o.SectionGroup,{children:(0,s.jsxs)(o.Section,{children:[v?(0,s.jsx)(o.Typography,{color:`text-error`,variant:`body`,children:v}):null,(0,s.jsxs)(o.Tab,{activeKey:g,onChange:F,size:`sub`,children:[(0,s.jsx)(o.TabItem,{badgeCount:T?void 0:D.length,children:`待簽核`},`pending`),(0,s.jsx)(o.TabItem,{badgeCount:T?void 0:P.length,children:`已處理未結束`},`tracking`),(0,s.jsx)(o.TabItem,{children:`歷史簽核記錄`},`history`)]}),g===`pending`?(0,s.jsx)(o.Table,{actions:j,columns:A,dataSource:D,fullWidth:!0,loading:T}):null,g===`tracking`?(0,s.jsx)(o.Table,{actions:N,columns:M,dataSource:P,fullWidth:!0,loading:T}):null,g===`history`?(0,s.jsx)(o.Table,{actions:N,columns:M,dataSource:S,fullWidth:!0,loading:T}):null]})})]})}async function f(e){let t=await m(e);return e.map((e,n)=>({...e,caseTitle:h(e,t[n]??null),key:e.id,slaStatusColor:T(e.slaDueAt),slaStatusText:w(e.slaDueAt),statusLabel:D(e.status)}))}async function p(e){let[t,n]=await Promise.all([Promise.all(e.map(e=>(0,c.listTaskDecisions)(e.id))),m(e)]);return e.map((e,r)=>{let i=g(t[r]??[]),a=n[r]??null;return{...e,caseTitle:h(e,a),decisionAction:i?.action??null,decisionComment:i?.comment??null,decisionCommentText:S(i?.comment??null),decisionLabel:v(i?.action??null),decidedAt:i?.decidedAt??e.completedAt,instanceState:a?.state??null,instanceStateLabel:b(a?.state??null),key:e.id}})}async function m(e){return Promise.all(e.map(async e=>{try{return(await(0,c.readApprovalInstance)(e.instanceId)).instance}catch{return null}}))}function h(e,t){return t?(0,c.readApprovalInstanceCaseTitle)(t):e.instanceId}function g(e){return[...e].sort(_)[0]??null}function _(e,t){return new Date(t.decidedAt).getTime()-new Date(e.decidedAt).getTime()}function v(e){return e===`APPROVED`?`同意`:e===`REJECTED`?`拒絕`:e===`RETURNED`?`退回`:e===`TRANSFERRED`?`轉派`:`未記錄`}function y(e){return e===`APPROVED`?`text-success`:e===`REJECTED`||e===`RETURNED`?`text-error`:`text-neutral`}function b(e){return e===`RUNNING`?`進行中`:e===`APPROVED`?`已通過`:e===`REJECTED`?`已拒絕`:e===`RETURNED`?`已退回`:e===`CANCELLED`?`已取消`:e===`EXPIRED`?`已逾期`:e===`DRAFT`?`草稿`:`-`}function x(e){return e===`APPROVED`?`text-success`:e===`REJECTED`||e===`CANCELLED`||e===`EXPIRED`?`text-error`:`text-neutral`}function S(e){return(e?.trim()??``)||`-`}function C(e){return r.t(e)}function w(e){if(!e)return`-`;let t=new Date(e).getTime(),n=Date.now(),r=E(Math.abs(t-n));return t<n?`已逾期 ${r}`:`剩餘 ${r}`}function T(e){return e?new Date(e).getTime()<Date.now()?`text-error`:`text-success`:`text-neutral`}function E(e){let t=Math.max(1,Math.ceil(e/6e4)),n=Math.floor(t/1440),r=Math.floor(t%1440/60),i=t%60;return n>0?`${n}天 ${r}小時`:r>0?`${r}小時 ${i}分鐘`:`${i}分鐘`}function D(e){return e===`PENDING`?`待處理`:e===`IN_PROGRESS`?`處理中`:e===`COMPLETED`?`已完成`:e===`TRANSFERRED`?`已轉派`:e===`CANCELLED`?`已取消`:e}function O(e){return e instanceof Error?e.message:`發生未知錯誤`}exports.InboxView=d;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -2,7 +2,7 @@
2
2
  import { r as e } from "../../chunks/router-adapter-DftlFTOd.js";
3
3
  import { n as t } from "../../chunks/auth-provider-B5oPmvk2.js";
4
4
  import { t as n } from "../../chunks/format-date-time-CB-LxzqT.js";
5
- import { r } from "../../chunks/routes-config-dxahImVe.js";
5
+ import { r } from "../../chunks/routes-config-RBYQtUd0.js";
6
6
  import { useEffect as i, useMemo as a, useState as o } from "react";
7
7
  import { Button as s, PageHeader as c, Section as l, SectionGroup as u, Tab as d, TabItem as f, Table as p, Typography as m } from "@mezzanine-ui/react";
8
8
  import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
@@ -2,6 +2,16 @@ import { ReactElement } from 'react';
2
2
  export interface InstanceDetailViewProps {
3
3
  /** Approval instance id (Next.js `params.id` resolved by the page shim). */
4
4
  readonly instanceId: string;
5
+ /** Show the form snapshot section (default: true). */
6
+ readonly showForm?: boolean;
7
+ /** Show the attachments section (default: true). */
8
+ readonly showAttachments?: boolean;
9
+ /** Show the tasks section (default: true). */
10
+ readonly showTasks?: boolean;
11
+ /** Show the signatures section (default: true). */
12
+ readonly showSignatures?: boolean;
13
+ /** Show the history section (default: true). */
14
+ readonly showHistory?: boolean;
5
15
  }
6
16
  /**
7
17
  * Framework-agnostic view for the BPM approval instance detail page.
@@ -9,4 +19,4 @@ export interface InstanceDetailViewProps {
9
19
  * `instanceId` is provided by the host page wrapper (typically resolved
10
20
  * from `params.id` in the Next.js Server Component shim).
11
21
  */
12
- export declare function InstanceDetailView({ instanceId, }: InstanceDetailViewProps): ReactElement;
22
+ export declare function InstanceDetailView({ instanceId, showAttachments, showForm, showHistory, showSignatures, showTasks, }: InstanceDetailViewProps): ReactElement;
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/detail-Dcr5mM8g.cjs");exports.InstanceDetailView=e.t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/detail-CWeCrmtC.cjs");exports.InstanceAttachmentsSection=e.a,exports.InstanceDetailView=e.t,exports.InstanceFormSection=e.o,exports.InstanceHistorySection=e.n,exports.InstanceSignaturesSection=e.r,exports.InstanceTasksSection=e.i;
@@ -1 +1,6 @@
1
1
  export * from './InstanceDetailView';
2
+ export * from './sections/InstanceFormSection';
3
+ export * from './sections/InstanceAttachmentsSection';
4
+ export * from './sections/InstanceTasksSection';
5
+ export * from './sections/InstanceSignaturesSection';
6
+ export * from './sections/InstanceHistorySection';
@@ -1,2 +1,2 @@
1
- import { t as e } from "../../../chunks/detail-u9DdLhDW.js";
2
- export { e as InstanceDetailView };
1
+ import { a as e, i as t, n, o as r, r as i, t as a } from "../../../chunks/detail-Bml-vXHX.js";
2
+ export { e as InstanceAttachmentsSection, a as InstanceDetailView, r as InstanceFormSection, n as InstanceHistorySection, i as InstanceSignaturesSection, t as InstanceTasksSection };
@@ -0,0 +1,15 @@
1
+ import { ReactElement } from 'react';
2
+ import { AttachmentRecord } from '@rytass/bpm-core-client/workflow';
3
+ export interface InstanceAttachmentsSectionProps {
4
+ /** The list of attachments for this instance. */
5
+ readonly attachments: readonly AttachmentRecord[];
6
+ /** Called when the user clicks the download action for an attachment. */
7
+ readonly onDownload: (attachment: AttachmentRecord) => void;
8
+ /** Called when the user clicks the preview action for a PDF attachment. */
9
+ readonly onPreview: (attachment: AttachmentRecord) => void;
10
+ }
11
+ /**
12
+ * Renders the attachments section of the approval instance detail page.
13
+ * Shows a table of attachments with download and (for PDFs) preview actions.
14
+ */
15
+ export declare function InstanceAttachmentsSection({ attachments, onDownload, onPreview, }: InstanceAttachmentsSectionProps): ReactElement;
@@ -0,0 +1,33 @@
1
+ import { ReactElement } from 'react';
2
+ import { FormFieldDefinition } from '@rytass/bpm-core-shared/form';
3
+ import { ApprovalInstanceRecord, WorkflowFormData } from '@rytass/bpm-core-client/workflow';
4
+ export interface InstanceFormSectionProps {
5
+ /** The loaded approval instance, or null while loading. */
6
+ readonly instance: ApprovalInstanceRecord | null;
7
+ /** Whether the instance is in a loading state. */
8
+ readonly loading: boolean;
9
+ /** Error message to display, if any. */
10
+ readonly error: string | null;
11
+ /** Whether the current user can resubmit (edit + resubmit the returned form). */
12
+ readonly canResubmitInstance: boolean;
13
+ /** Current form data for the resubmit flow. */
14
+ readonly resubmitFormData: WorkflowFormData;
15
+ /** Validation error map for the resubmit form. */
16
+ readonly resubmitFormErrors: Readonly<Record<string, string>>;
17
+ /** Whether a decision/submit action is in progress. */
18
+ readonly deciding: boolean;
19
+ /** Called when the form data changes in the resubmit flow. */
20
+ readonly onResubmitFormChange: (values: WorkflowFormData) => void;
21
+ /** Called when the user clicks "重新送出". */
22
+ readonly onResubmitInstance: () => void;
23
+ /** Called when an attachment upload is requested via the form field. */
24
+ readonly onUploadAttachment: (field: FormFieldDefinition, file: File) => Promise<{
25
+ readonly id: string;
26
+ }>;
27
+ }
28
+ /**
29
+ * Renders the form snapshot section of the approval instance detail page.
30
+ * Displays the form in read-only mode normally, or editable mode when the
31
+ * instance has been returned and the current member can resubmit it.
32
+ */
33
+ export declare function InstanceFormSection({ canResubmitInstance, deciding, error, instance, loading, onResubmitFormChange, onResubmitInstance, onUploadAttachment, resubmitFormData, resubmitFormErrors, }: InstanceFormSectionProps): ReactElement;
@@ -0,0 +1,29 @@
1
+ import { ReactElement } from 'react';
2
+ import { ActivityLogRecord, ApprovalInstanceRecord, MemberProfileRecord, SignatureRecord, SignatureVerificationRecord, TaskDecisionRecord, TaskRecord, WorkflowTokenRecord } from '@rytass/bpm-core-client/workflow';
3
+ import { WorkflowDefinition } from '@rytass/bpm-core-shared/workflow';
4
+ export interface InstanceHistorySectionProps {
5
+ /** Activity log records for this instance. */
6
+ readonly activityLogs: readonly ActivityLogRecord[];
7
+ /** All tasks for this instance (used to compute pending/future steps). */
8
+ readonly tasks: readonly TaskRecord[];
9
+ /** All workflow tokens for this instance. */
10
+ readonly workflowTokens: readonly WorkflowTokenRecord[];
11
+ /** The workflow definition snapshot, or null if not yet loaded. */
12
+ readonly workflowSnapshot: WorkflowDefinition | null;
13
+ /** The current state of the instance. */
14
+ readonly instanceState: ApprovalInstanceRecord['state'];
15
+ /** Member profiles indexed by memberId. */
16
+ readonly memberProfilesById: ReadonlyMap<string, MemberProfileRecord>;
17
+ /** Task decisions indexed by taskId (latest per task). */
18
+ readonly taskDecisionsByTaskId: ReadonlyMap<string, TaskDecisionRecord>;
19
+ /** Signatures indexed by id. */
20
+ readonly signaturesById: ReadonlyMap<string, SignatureRecord>;
21
+ /** Signature chain verification result, or null. */
22
+ readonly signatureVerification: SignatureVerificationRecord | null;
23
+ }
24
+ /**
25
+ * Renders the activity history section of the approval instance detail page.
26
+ * Computes the step records from the provided data and renders them as a
27
+ * vertical dot stepper.
28
+ */
29
+ export declare function InstanceHistorySection({ activityLogs, instanceState, memberProfilesById, signatureVerification, signaturesById, taskDecisionsByTaskId, tasks, workflowSnapshot, workflowTokens, }: InstanceHistorySectionProps): ReactElement;
@@ -0,0 +1,14 @@
1
+ import { ReactElement } from 'react';
2
+ import { SignatureRecord, SignatureVerificationRecord } from '@rytass/bpm-core-client/workflow';
3
+ export interface InstanceSignaturesSectionProps {
4
+ /** The list of signatures for this instance. */
5
+ readonly signatures: readonly SignatureRecord[];
6
+ /** The signature chain verification result, or null if not yet loaded. */
7
+ readonly signatureVerification: SignatureVerificationRecord | null;
8
+ }
9
+ /**
10
+ * Renders the signatures section of the approval instance detail page.
11
+ * Shows the signature chain verification status and a table of individual
12
+ * signature records.
13
+ */
14
+ export declare function InstanceSignaturesSection({ signatureVerification, signatures, }: InstanceSignaturesSectionProps): ReactElement;
@@ -0,0 +1,44 @@
1
+ import { ApprovalInstanceRecord, MemberProfileRecord, TaskRecord } from '@rytass/bpm-core-client/workflow';
2
+ /**
3
+ * Imperative handle exposed by InstanceTasksSection via ref.
4
+ * The container uses these to wire PageHeader action buttons to the
5
+ * section's internal modal state without lifting state up.
6
+ */
7
+ export interface InstanceTasksSectionHandle {
8
+ /** Whether a task action (decision) is currently in flight. */
9
+ readonly deciding: boolean;
10
+ /** Whether the current user has an actionable pending task. */
11
+ readonly hasCurrentTask: boolean;
12
+ /** Whether the current task's node allows a return action. */
13
+ readonly canReturnCurrentTask: boolean;
14
+ /** Opens the reject-reason modal. */
15
+ openRejectModal(): void;
16
+ /** Opens the return modal. */
17
+ openReturnModal(): void;
18
+ /** Opens the transfer modal. */
19
+ openTransferModal(): void;
20
+ /** Submits an APPROVED decision immediately (no modal needed). */
21
+ handleApprove(): void;
22
+ }
23
+ export interface InstanceTasksSectionProps {
24
+ /** All tasks for this instance. */
25
+ readonly tasks: readonly TaskRecord[];
26
+ /** The loaded approval instance (used to read workflowSnapshot node labels). */
27
+ readonly instance: ApprovalInstanceRecord | null;
28
+ /** Member profiles indexed by memberId, for displaying assignee labels. */
29
+ readonly memberProfilesById: ReadonlyMap<string, MemberProfileRecord>;
30
+ /** The currently authenticated member's id. */
31
+ readonly currentMemberId: string | null;
32
+ /**
33
+ * Called after any task decision action (approve / reject / return /
34
+ * transfer) completes successfully. The container should refresh data.
35
+ */
36
+ readonly onChanged: () => void | Promise<void>;
37
+ }
38
+ /**
39
+ * Renders the tasks section of the approval instance detail page.
40
+ * Contains the task table plus all decision action modals
41
+ * (reject, return, transfer). Approve is also handled here via the
42
+ * imperative handle exposed through the forwarded ref.
43
+ */
44
+ export declare const InstanceTasksSection: import('react').ForwardRefExoticComponent<InstanceTasksSectionProps & import('react').RefAttributes<InstanceTasksSectionHandle>>;
@@ -0,0 +1,8 @@
1
+ import { ActivityLogRecord, MemberProfileRecord, TaskDecisionRecord, TaskRecord } from '@rytass/bpm-core-client/workflow';
2
+ export { canMemberActOnTask, readErrorMessage, readInstanceStateLabel, readNodeRuntimeState, } from './shared';
3
+ export declare function readMemberProfilesForTimeline({ activityLogs, tasks, }: {
4
+ readonly activityLogs: readonly ActivityLogRecord[];
5
+ readonly tasks: readonly TaskRecord[];
6
+ }): Promise<readonly MemberProfileRecord[]>;
7
+ export declare function readTaskDecisionsForTasks(tasks: readonly TaskRecord[]): Promise<readonly TaskDecisionRecord[]>;
8
+ export declare function readLatestTaskDecisionsByTaskId(taskDecisions: readonly TaskDecisionRecord[]): ReadonlyMap<string, TaskDecisionRecord>;
@@ -0,0 +1,103 @@
1
+ import { ActivityLogRecord, ApprovalInstanceRecord, AttachmentRecord, MemberProfileRecord, SignatureRecord, SignatureVerificationRecord, TaskDecisionRecord, TaskRecord, WorkflowTokenRecord } from '@rytass/bpm-core-client/workflow';
2
+ import { WorkflowDefinition, WorkflowNode } from '@rytass/bpm-core-shared/workflow';
3
+ export type TaskRow = Readonly<Record<string, unknown> & TaskRecord & {
4
+ assigneeLabel: string;
5
+ key: string;
6
+ nodeLabel: string;
7
+ statusLabel: string;
8
+ }>;
9
+ export type AttachmentRow = Readonly<Record<string, unknown> & {
10
+ attachment: AttachmentRecord;
11
+ createdAt: string;
12
+ filename: string;
13
+ id: string;
14
+ key: string;
15
+ mimeType: string;
16
+ sizeLabel: string;
17
+ }>;
18
+ export type SignatureRow = Readonly<Record<string, unknown> & {
19
+ algorithm: string;
20
+ hashLabel: string;
21
+ key: string;
22
+ keyVersion: number;
23
+ signedAtLabel: string;
24
+ signerMemberId: string;
25
+ }>;
26
+ export type MemberOption = Readonly<{
27
+ email: string | null;
28
+ id: string;
29
+ name: string;
30
+ }>;
31
+ export type ActivityStepDescriptionPart = Readonly<{
32
+ text: string;
33
+ type: 'text';
34
+ }> | Readonly<{
35
+ text: string;
36
+ type: 'dangerText';
37
+ }> | Readonly<{
38
+ email: string | null;
39
+ label: string;
40
+ memberId: string | null;
41
+ prefix: string;
42
+ type: 'member';
43
+ }>;
44
+ export interface ActivityStepRecord {
45
+ readonly descriptionParts: readonly ActivityStepDescriptionPart[];
46
+ readonly error: boolean;
47
+ readonly forcePending?: boolean;
48
+ readonly id: string;
49
+ readonly title: string;
50
+ }
51
+ interface DelegationChainStep {
52
+ readonly from: string;
53
+ readonly reason: string;
54
+ readonly ruleId: string | null;
55
+ readonly to: string;
56
+ }
57
+ export declare function readDelegationChain(value: string): readonly DelegationChainStep[];
58
+ export declare function readStringField(record: Readonly<Record<string, unknown>>, key: string): string | null;
59
+ export declare function readStringArrayField(record: Readonly<Record<string, unknown>>, key: string): readonly string[];
60
+ export declare function readNumberField(record: Readonly<Record<string, unknown>>, key: string): number | null;
61
+ export declare function isPresentText(value: string | null): value is string;
62
+ export declare function isRecord(value: unknown): value is Readonly<Record<string, unknown>>;
63
+ export declare function isPendingTask(task: TaskRecord): boolean;
64
+ export declare function readErrorMessage(error: unknown): string;
65
+ export declare function formatFileSize(sizeBytes: number): string;
66
+ export declare function readShortHash(hash: string): string;
67
+ export declare function readInstanceStateLabel(state: string): string;
68
+ export declare function readTaskStatusLabel(status: TaskRecord['status']): string;
69
+ export declare function readTaskDecisionActionLabel(action: string): string;
70
+ export declare function readNodeKindLabel(type: WorkflowNode['type']): string;
71
+ export declare function readNodeDisplayLabel(nodeId: string, workflow: WorkflowDefinition | null): string;
72
+ export declare function readMemberDisplayText(memberId: string | null, memberProfilesById: ReadonlyMap<string, MemberProfileRecord>): string;
73
+ export declare function readTaskAssigneeLabel(task: TaskRecord, memberProfilesById?: ReadonlyMap<string, MemberProfileRecord>): string;
74
+ export declare function canMemberActOnTask(task: TaskRecord, memberId: string | null): boolean;
75
+ export declare function readReturnTargetOptions(workflow: WorkflowDefinition, node: WorkflowNode): readonly {
76
+ readonly id: string;
77
+ readonly name: string;
78
+ }[];
79
+ export declare function readMemberOption(profile: MemberProfileRecord): MemberOption;
80
+ export declare function readMemberOptionFromValue(value: unknown): MemberOption | null;
81
+ export declare function readUniqueMemberOption(searchText: string, options: readonly MemberOption[]): MemberOption | null;
82
+ export declare function readTextDescriptionPart(text: string | null): ActivityStepDescriptionPart | null;
83
+ export declare function readDangerTextDescriptionPart(text: string | null): ActivityStepDescriptionPart | null;
84
+ export declare function readMemberDescriptionPart(prefix: string, memberId: string | null, memberProfilesById: ReadonlyMap<string, MemberProfileRecord>, fallbackLabel: string): ActivityStepDescriptionPart;
85
+ export declare function isActivityDescriptionPart(part: ActivityStepDescriptionPart | null): part is ActivityStepDescriptionPart;
86
+ export declare function readCurrentActivityStep(activitySteps: readonly ActivityStepRecord[]): number;
87
+ export declare function isUserMeaningfulActivity(activityLog: ActivityLogRecord): boolean;
88
+ export declare function readActivityEventLabel(eventType: string, payload: Readonly<Record<string, unknown>>): string;
89
+ export declare function readActivityPayload(activityLog: ActivityLogRecord): Readonly<Record<string, unknown>>;
90
+ export declare function isActivityError(activityLog: ActivityLogRecord, payload: Readonly<Record<string, unknown>>): boolean;
91
+ export declare function formatActivityDateTime(value: string): string;
92
+ export declare function readActivityDetailParts(activityLog: ActivityLogRecord, payload: Readonly<Record<string, unknown>>, workflow: WorkflowDefinition | null, taskDecisionsByTaskId: ReadonlyMap<string, TaskDecisionRecord>, signaturesById: ReadonlyMap<string, SignatureRecord>, signatureVerification: SignatureVerificationRecord | null, memberProfilesById: ReadonlyMap<string, MemberProfileRecord>): readonly ActivityStepDescriptionPart[];
93
+ export declare function isFutureTimelineNode(node: WorkflowNode, tasks: readonly TaskRecord[], tokens: readonly WorkflowTokenRecord[], instanceState: ApprovalInstanceRecord['state'], representedNodeIds: ReadonlySet<string>): boolean;
94
+ export declare function readFutureTimelineNodes(workflow: WorkflowDefinition, tasks: readonly TaskRecord[], tokens: readonly WorkflowTokenRecord[], instanceState: ApprovalInstanceRecord['state'], representedNodeIds: ReadonlySet<string>): readonly WorkflowNode[];
95
+ export declare function readFutureNodeStepTitle(node: WorkflowNode): string;
96
+ export declare function readActivityStepRecords(activityLogs: readonly ActivityLogRecord[], tasks: readonly TaskRecord[], tokens: readonly WorkflowTokenRecord[], workflow: WorkflowDefinition | null, instanceState: ApprovalInstanceRecord['state'], memberProfilesById: ReadonlyMap<string, MemberProfileRecord>, taskDecisionsByTaskId: ReadonlyMap<string, TaskDecisionRecord>, signaturesById: ReadonlyMap<string, SignatureRecord>, signatureVerification: SignatureVerificationRecord | null): ActivityStepRecord[];
97
+ type RuntimeTone = 'cancelled' | 'completed' | 'current' | 'neutral' | 'waiting';
98
+ export declare function readNodeRuntimeState(node: WorkflowNode, tasks: readonly TaskRecord[], tokens: readonly WorkflowTokenRecord[], instanceState: string): Readonly<{
99
+ secondaryLabel: string;
100
+ statusLabel: string;
101
+ tone: RuntimeTone;
102
+ }>;
103
+ export {};
@@ -1,2 +1,2 @@
1
- "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/chunk-CMqjfN_6.cjs"),t=require("../../../chunks/router-adapter--gYs13E8.cjs"),n=require("../../../chunks/auth-provider-4BeCw7cI.cjs"),r=require("../../../chunks/format-date-time-XxBzF0F5.cjs"),i=require("../../../chunks/routes-config-2aKbWq2H.cjs"),a=require("../../../chunks/FormRendererView-BwVsH2eX.cjs");let o=require("react"),s=require("@mezzanine-ui/react"),c=require("react/jsx-runtime"),l=require("@rytass/bpm-core-client/workflow"),u=require("@mezzanine-ui/react/ContentHeader");u=e.t(u,1);let d=require("@mezzanine-ui/icons"),f=require("@rytass/bpm-core-client/form");var p={display:`grid`,gap:16};function m(e={}){return(0,c.jsx)(o.Suspense,{fallback:(0,c.jsx)(g,{}),children:(0,c.jsx)(h,{templateId:e.templateId??void 0})})}function h({templateId:e}){let m=t.r(),h=i.r(),{member:g}=n.n(),v=g?.memberId??null,y=e??null,[b,x]=(0,o.useState)(null),[S,C]=(0,o.useState)({}),[w,T]=(0,o.useState)([]),[E,D]=(0,o.useState)(null),[O,k]=(0,o.useState)({}),[A,j]=(0,o.useState)(!0),[M,N]=(0,o.useState)(!1);(0,o.useEffect)(()=>{if(!y){L();return}R(y)},[y]);let P=(0,o.useMemo)(()=>w.map(e=>({...e,key:e.id,updatedAt:r.t(e.updatedAt),versionLabel:`v${e.version}`})),[w]),F=(0,o.useMemo)(()=>[{dataIndex:`name`,key:`name`,title:`模板名稱`,width:240},{dataIndex:`versionLabel`,key:`versionLabel`,title:`發布版本`,width:120},{dataIndex:`updatedAt`,key:`updatedAt`,title:`更新時間`,width:220}],[]),I=(0,o.useMemo)(()=>({render:e=>[{name:`發起`,onClick:()=>m.push(h.caseNew(e.id)),variant:`base-primary`}],variant:`base-secondary`,width:88}),[m]);async function L(){j(!0),D(null),x(null);try{T(await(0,l.listLaunchableTemplates)())}catch(e){D(_(e))}finally{j(!1)}}async function R(e){j(!0),D(null),T([]);try{x(await(0,l.readLaunchContext)(e))}catch(e){D(_(e))}finally{j(!1)}}async function z(){if(!b||!v)return;N(!0),D(null),k({});let e=(0,f.validateFormRendererValues)({schema:b.formVersion.schema,uiSchema:b.formVersion.uiSchema,values:S});if(!e.valid){k(e.errors),D(`請先補齊必填欄位。`),e.firstInvalidFieldKey&&(0,f.focusFormRendererField)(e.firstInvalidFieldKey),N(!1);return}try{let e=await(0,l.submitApprovalInstance)({formData:S,initiatorMemberId:v,templateId:b.template.id,title:(0,l.readFormDataCaseTitle)({fallbackTitle:b.template.name,formData:S,schema:b.formVersion.schema,uiSchema:b.formVersion.uiSchema})});m.push(h.caseDetail(e))}catch(e){D(_(e))}finally{N(!1)}}async function B(e,t){if(!v)throw Error(`尚未登入,無法上傳附件`);return{id:(await(0,l.uploadAttachment)({file:t,formFieldPath:`form.${e.fieldKey}`})).id}}return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.PageHeader,{children:(0,c.jsx)(u.default,{description:b?`${b.template.name} · 表單 v${b.formVersion.version}`:`選擇可發起的已發布模板後填寫表單內容。`,title:`發起簽核`,children:b?(0,c.jsx)(s.Button,{disabled:A||M,icon:d.CheckedIcon,iconType:`leading`,onClick:z,variant:`base-primary`,children:`送出`}):null})}),(0,c.jsx)(s.SectionGroup,{children:(0,c.jsx)(s.Section,{children:(0,c.jsxs)(`div`,{style:p,children:[E?(0,c.jsx)(s.Typography,{color:`text-error`,variant:`body`,children:E}):null,A?(0,c.jsx)(s.Typography,{color:`text-neutral`,variant:`body`,children:`載入中...`}):null,b?(0,c.jsx)(a.t,{errors:O,maxWidth:480,onChange:e=>{C(e),k({})},onUploadAttachment:B,schema:b.formVersion.schema,singleColumn:!0,uiSchema:b.formVersion.uiSchema,value:S}):null,!y&&!A?P.length>0?(0,c.jsx)(s.Table,{actions:I,columns:F,dataSource:P,fullWidth:!0}):(0,c.jsx)(s.Typography,{color:`text-neutral`,variant:`body`,children:`目前沒有可發起的已發布模板。`}):null]})})})]})}function g(){return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.PageHeader,{children:(0,c.jsx)(u.default,{description:`選擇可發起的已發布模板後填寫表單內容。`,title:`發起簽核`})}),(0,c.jsx)(s.SectionGroup,{children:(0,c.jsx)(s.Section,{children:(0,c.jsx)(s.Typography,{color:`text-neutral`,variant:`body`,children:`載入中...`})})})]})}function _(e){return e instanceof Error?e.message:`發生未知錯誤`}exports.InstanceNewView=m;
1
+ "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/chunk-CMqjfN_6.cjs"),t=require("../../../chunks/router-adapter--gYs13E8.cjs"),n=require("../../../chunks/auth-provider-4BeCw7cI.cjs"),r=require("../../../chunks/format-date-time-XxBzF0F5.cjs"),i=require("../../../chunks/routes-config-fDVHmvXi.cjs"),a=require("../../../chunks/FormRendererView-BwVsH2eX.cjs");let o=require("react"),s=require("@mezzanine-ui/react"),c=require("react/jsx-runtime"),l=require("@rytass/bpm-core-client/workflow"),u=require("@mezzanine-ui/react/ContentHeader");u=e.t(u,1);let d=require("@mezzanine-ui/icons"),f=require("@rytass/bpm-core-client/form");var p={display:`grid`,gap:16};function m(e={}){return(0,c.jsx)(o.Suspense,{fallback:(0,c.jsx)(g,{}),children:(0,c.jsx)(h,{templateId:e.templateId??void 0})})}function h({templateId:e}){let m=t.r(),h=i.r(),{member:g}=n.n(),v=g?.memberId??null,y=e??null,[b,x]=(0,o.useState)(null),[S,C]=(0,o.useState)({}),[w,T]=(0,o.useState)([]),[E,D]=(0,o.useState)(null),[O,k]=(0,o.useState)({}),[A,j]=(0,o.useState)(!0),[M,N]=(0,o.useState)(!1);(0,o.useEffect)(()=>{if(!y){L();return}R(y)},[y]);let P=(0,o.useMemo)(()=>w.map(e=>({...e,key:e.id,updatedAt:r.t(e.updatedAt),versionLabel:`v${e.version}`})),[w]),F=(0,o.useMemo)(()=>[{dataIndex:`name`,key:`name`,title:`模板名稱`,width:240},{dataIndex:`versionLabel`,key:`versionLabel`,title:`發布版本`,width:120},{dataIndex:`updatedAt`,key:`updatedAt`,title:`更新時間`,width:220}],[]),I=(0,o.useMemo)(()=>({render:e=>[{name:`發起`,onClick:()=>m.push(h.caseNew(e.id)),variant:`base-primary`}],variant:`base-secondary`,width:88}),[m]);async function L(){j(!0),D(null),x(null);try{T(await(0,l.listLaunchableTemplates)())}catch(e){D(_(e))}finally{j(!1)}}async function R(e){j(!0),D(null),T([]);try{x(await(0,l.readLaunchContext)(e))}catch(e){D(_(e))}finally{j(!1)}}async function z(){if(!b||!v)return;N(!0),D(null),k({});let e=(0,f.validateFormRendererValues)({schema:b.formVersion.schema,uiSchema:b.formVersion.uiSchema,values:S});if(!e.valid){k(e.errors),D(`請先補齊必填欄位。`),e.firstInvalidFieldKey&&(0,f.focusFormRendererField)(e.firstInvalidFieldKey),N(!1);return}try{let e=await(0,l.submitApprovalInstance)({formData:S,initiatorMemberId:v,templateId:b.template.id,title:(0,l.readFormDataCaseTitle)({fallbackTitle:b.template.name,formData:S,schema:b.formVersion.schema,uiSchema:b.formVersion.uiSchema})});m.push(h.caseDetail(e))}catch(e){D(_(e))}finally{N(!1)}}async function B(e,t){if(!v)throw Error(`尚未登入,無法上傳附件`);return{id:(await(0,l.uploadAttachment)({file:t,formFieldPath:`form.${e.fieldKey}`})).id}}return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.PageHeader,{children:(0,c.jsx)(u.default,{description:b?`${b.template.name} · 表單 v${b.formVersion.version}`:`選擇可發起的已發布模板後填寫表單內容。`,title:`發起簽核`,children:b?(0,c.jsx)(s.Button,{disabled:A||M,icon:d.CheckedIcon,iconType:`leading`,onClick:z,variant:`base-primary`,children:`送出`}):null})}),(0,c.jsx)(s.SectionGroup,{children:(0,c.jsx)(s.Section,{children:(0,c.jsxs)(`div`,{style:p,children:[E?(0,c.jsx)(s.Typography,{color:`text-error`,variant:`body`,children:E}):null,A?(0,c.jsx)(s.Typography,{color:`text-neutral`,variant:`body`,children:`載入中...`}):null,b?(0,c.jsx)(a.t,{errors:O,maxWidth:480,onChange:e=>{C(e),k({})},onUploadAttachment:B,schema:b.formVersion.schema,singleColumn:!0,uiSchema:b.formVersion.uiSchema,value:S}):null,!y&&!A?P.length>0?(0,c.jsx)(s.Table,{actions:I,columns:F,dataSource:P,fullWidth:!0}):(0,c.jsx)(s.Typography,{color:`text-neutral`,variant:`body`,children:`目前沒有可發起的已發布模板。`}):null]})})})]})}function g(){return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.PageHeader,{children:(0,c.jsx)(u.default,{description:`選擇可發起的已發布模板後填寫表單內容。`,title:`發起簽核`})}),(0,c.jsx)(s.SectionGroup,{children:(0,c.jsx)(s.Section,{children:(0,c.jsx)(s.Typography,{color:`text-neutral`,variant:`body`,children:`載入中...`})})})]})}function _(e){return e instanceof Error?e.message:`發生未知錯誤`}exports.InstanceNewView=m;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -2,7 +2,7 @@
2
2
  import { r as e } from "../../../chunks/router-adapter-DftlFTOd.js";
3
3
  import { n as t } from "../../../chunks/auth-provider-B5oPmvk2.js";
4
4
  import { t as n } from "../../../chunks/format-date-time-CB-LxzqT.js";
5
- import { r } from "../../../chunks/routes-config-dxahImVe.js";
5
+ import { r } from "../../../chunks/routes-config-RBYQtUd0.js";
6
6
  import { t as i } from "../../../chunks/FormRendererView-DrHsuSVo.js";
7
7
  import { Suspense as a, useEffect as o, useMemo as s, useState as c } from "react";
8
8
  import { Button as l, PageHeader as u, Section as d, SectionGroup as f, Table as p, Typography as m } from "@mezzanine-ui/react";
@@ -1,2 +1,2 @@
1
- "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/approval-instance-list-page-C5ZKPHdA.cjs");let t=require("react/jsx-runtime");function n(){return(0,t.jsx)(e.t,{defaultState:null,description:`以關鍵字與狀態查詢你有權限查看的簽核案件。`,emptyMessage:`沒有符合條件的簽核案件。`,searchPlaceholder:`關鍵字:搜尋案件、發起人、模板或狀態`,title:`案件搜尋`,view:`ALL`})}exports.SearchView=n;
1
+ "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/approval-instance-list-page-BMUKxzcz.cjs");let t=require("react/jsx-runtime");function n(){return(0,t.jsx)(e.t,{defaultState:null,description:`以關鍵字與狀態查詢你有權限查看的簽核案件。`,emptyMessage:`沒有符合條件的簽核案件。`,searchPlaceholder:`關鍵字:搜尋案件、發起人、模板或狀態`,title:`案件搜尋`,view:`ALL`})}exports.SearchView=n;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { t as e } from "../../chunks/approval-instance-list-page-BF2r5D2-.js";
2
+ import { t as e } from "../../chunks/approval-instance-list-page-YZcGGDD8.js";
3
3
  import { jsx as t } from "react/jsx-runtime";
4
4
  //#region src/views/search/SearchView.tsx
5
5
  function n() {
@@ -1,2 +1,2 @@
1
- "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/approval-instance-list-page-C5ZKPHdA.cjs");let t=require("react/jsx-runtime");function n(){return(0,t.jsx)(e.t,{defaultState:null,description:`查看由你發起的簽核案件與目前流程狀態。`,emptyMessage:`目前沒有由你發起的簽核案件。`,searchPlaceholder:`關鍵字:搜尋案件、發起人、模板或狀態`,title:`我發起的`,view:`SENT`})}exports.SentView=n;
1
+ "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/approval-instance-list-page-BMUKxzcz.cjs");let t=require("react/jsx-runtime");function n(){return(0,t.jsx)(e.t,{defaultState:null,description:`查看由你發起的簽核案件與目前流程狀態。`,emptyMessage:`目前沒有由你發起的簽核案件。`,searchPlaceholder:`關鍵字:搜尋案件、發起人、模板或狀態`,title:`我發起的`,view:`SENT`})}exports.SentView=n;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { t as e } from "../../chunks/approval-instance-list-page-BF2r5D2-.js";
2
+ import { t as e } from "../../chunks/approval-instance-list-page-YZcGGDD8.js";
3
3
  import { jsx as t } from "react/jsx-runtime";
4
4
  //#region src/views/sent/SentView.tsx
5
5
  function n() {
@@ -1,2 +1,7 @@
1
1
  import { ReactElement } from 'react';
2
+ export interface TemplateCategoryOption {
3
+ readonly categoryId: string | null;
4
+ readonly id: string;
5
+ readonly name: string;
6
+ }
2
7
  export declare function TemplatesView(): ReactElement;
@@ -0,0 +1,8 @@
1
+ import { ReactElement } from 'react';
2
+ /**
3
+ * Unified "form + flow" template creation wizard. Walks the user through
4
+ * Step 0 表單設計 → Step 1 流程設計 → Step 2 檢視並發佈, then commits both
5
+ * sides atomically through `composeApprovalTemplateWithForm`. Coexists with
6
+ * the separate `/forms` and `/templates` entry points.
7
+ */
8
+ export declare function TemplateComposeWizardView(): ReactElement;
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/compose-ziVbRYdo.cjs");exports.EMPTY_COMPOSE_FORM_SCHEMA=e.n,exports.EMPTY_COMPOSE_FORM_UI_SCHEMA=e.r,exports.TemplateComposeWizardView=e.t,exports.useTemplateComposeWizard=e.i;
@@ -0,0 +1,2 @@
1
+ export * from './TemplateComposeWizardView';
2
+ export * from './use-template-compose-wizard';
@@ -0,0 +1,2 @@
1
+ import { i as e, n as t, r as n, t as r } from "../../../chunks/compose-PMrmi-LE.js";
2
+ export { t as EMPTY_COMPOSE_FORM_SCHEMA, n as EMPTY_COMPOSE_FORM_UI_SCHEMA, r as TemplateComposeWizardView, e as useTemplateComposeWizard };
@@ -0,0 +1,15 @@
1
+ import { ReactElement } from 'react';
2
+ import { FormDefinitionSchema, FormUiSchema } from '@rytass/bpm-core-shared/form';
3
+ export interface ComposeFormStepProps {
4
+ readonly name: string;
5
+ readonly categoryId: string | null;
6
+ readonly formSchema: FormDefinitionSchema;
7
+ readonly formUiSchema: FormUiSchema;
8
+ readonly onNameChange: (value: string) => void;
9
+ readonly onCategoryIdChange: (value: string | null) => void;
10
+ readonly onFormChange: (next: {
11
+ readonly schema: FormDefinitionSchema;
12
+ readonly uiSchema: FormUiSchema;
13
+ }) => void;
14
+ }
15
+ export declare function ComposeFormStep({ categoryId, formSchema, formUiSchema, name, onCategoryIdChange, onFormChange, onNameChange, }: ComposeFormStepProps): ReactElement;
@@ -0,0 +1,12 @@
1
+ import { ReactElement } from 'react';
2
+ import { FormDefinitionSchema, FormUiSchema } from '@rytass/bpm-core-shared/form';
3
+ import { WorkflowDefinition } from '@rytass/bpm-core-shared/workflow';
4
+ export interface ComposeReviewStepProps {
5
+ readonly name: string;
6
+ readonly formSchema: FormDefinitionSchema;
7
+ readonly formUiSchema: FormUiSchema;
8
+ readonly workflowDefinition: WorkflowDefinition | null;
9
+ readonly initiatorPolicyCel: string | null;
10
+ readonly publishError: string | null;
11
+ }
12
+ export declare function ComposeReviewStep({ formSchema, formUiSchema, initiatorPolicyCel, name, publishError, workflowDefinition, }: ComposeReviewStepProps): ReactElement;
@@ -0,0 +1,11 @@
1
+ import { ReactElement } from 'react';
2
+ import { FormDefinitionSchema } from '@rytass/bpm-core-shared/form';
3
+ import { WorkflowDefinition } from '@rytass/bpm-core-shared/workflow';
4
+ export interface ComposeWorkflowStepProps {
5
+ readonly formSchema: FormDefinitionSchema;
6
+ readonly workflowDefinition: WorkflowDefinition | null;
7
+ readonly initiatorPolicyCel: string | null;
8
+ readonly onWorkflowChange: (definition: WorkflowDefinition) => void;
9
+ readonly onInitiatorPolicyChange: (cel: string | null) => void;
10
+ }
11
+ export declare function ComposeWorkflowStep({ formSchema, initiatorPolicyCel, onInitiatorPolicyChange, onWorkflowChange, workflowDefinition, }: ComposeWorkflowStepProps): ReactElement;
@@ -0,0 +1,46 @@
1
+ import { FormDefinitionSchema, FormUiSchema } from '@rytass/bpm-core-shared/form';
2
+ import { WorkflowDefinition } from '@rytass/bpm-core-shared/workflow';
3
+ import { ComposeApprovalTemplateWithFormResult } from '@rytass/bpm-core-client/template';
4
+ export type ComposeWizardStep = 0 | 1 | 2;
5
+ export type ComposePublishPhase = 'error' | 'idle' | 'submitting' | 'success';
6
+ export declare const EMPTY_COMPOSE_FORM_SCHEMA: FormDefinitionSchema;
7
+ export declare const EMPTY_COMPOSE_FORM_UI_SCHEMA: FormUiSchema;
8
+ export interface TemplateComposeWizard {
9
+ readonly currentStep: ComposeWizardStep;
10
+ /**
11
+ * Single user-facing name. Persisted to both the template and the form
12
+ * (`templateName` / `formName`) at the `composeApprovalTemplateWithForm`
13
+ * boundary — the DB keeps two columns, the UI keeps one field.
14
+ */
15
+ readonly name: string;
16
+ readonly categoryId: string | null;
17
+ readonly formSchema: FormDefinitionSchema;
18
+ readonly formUiSchema: FormUiSchema;
19
+ readonly workflowDefinition: WorkflowDefinition | null;
20
+ readonly initiatorPolicyCel: string | null;
21
+ readonly publishPhase: ComposePublishPhase;
22
+ readonly publishError: string | null;
23
+ readonly canLeaveBasics: boolean;
24
+ readonly goToStep: (step: ComposeWizardStep) => void;
25
+ readonly goNext: () => void;
26
+ readonly goBack: () => void;
27
+ readonly setName: (value: string) => void;
28
+ readonly setCategoryId: (value: string | null) => void;
29
+ readonly setFormValue: (next: {
30
+ readonly schema: FormDefinitionSchema;
31
+ readonly uiSchema: FormUiSchema;
32
+ }) => void;
33
+ readonly setWorkflowDefinition: (definition: WorkflowDefinition) => void;
34
+ readonly setInitiatorPolicyCel: (cel: string | null) => void;
35
+ readonly publish: () => Promise<ComposeApprovalTemplateWithFormResult | null>;
36
+ }
37
+ /**
38
+ * Owns the cross-step state for the unified "form + flow" template wizard.
39
+ *
40
+ * Step 0 (表單) edits `formSchema`/`formUiSchema`; that same in-memory schema
41
+ * feeds Step 1 (流程) as the field source for condition branches, so the
42
+ * embedded designer never needs a published form version. Step 2 (檢視發佈)
43
+ * submits everything through the atomic `composeApprovalTemplateWithForm`
44
+ * mutation.
45
+ */
46
+ export declare function useTemplateComposeWizard(): TemplateComposeWizard;
@@ -1,5 +1,63 @@
1
1
  import { ReactElement } from 'react';
2
+ import { FormDefinitionSchema } from '@rytass/bpm-core-shared/form';
3
+ import { WorkflowDefinition } from '@rytass/bpm-core-shared/workflow';
2
4
  export interface TemplateDesignerViewProps {
3
- readonly templateId: string;
5
+ /**
6
+ * Template id to load. Required in non-embedded mode; unused in embedded mode.
7
+ */
8
+ readonly templateId?: string;
9
+ /**
10
+ * When `true`, the component operates in embedded / wizard mode:
11
+ * - No `readTemplateDesigner` call (no templateId needed).
12
+ * - Only org data is loaded for approver pickers.
13
+ * - PageHeader / ContentHeader, form-version binding, dry-run, and the AI
14
+ * drawer are hidden.
15
+ * - Mutations flow out via `onWorkflowChange` / `onInitiatorPolicyChange`
16
+ * rather than save-draft / publish actions.
17
+ * Default `false`.
18
+ */
19
+ readonly embedded?: boolean;
20
+ /**
21
+ * In embedded mode: the formSchema used for condition-edge compilation,
22
+ * injected from outside (e.g. the wizard already knows the form). Replaces
23
+ * the "bind form version" picker. Pass `null` to clear.
24
+ */
25
+ readonly formSchemaOverride?: FormDefinitionSchema | null;
26
+ /**
27
+ * In embedded mode: the initial workflow definition to seed the canvas.
28
+ * Falls back to an empty start→end workflow when omitted.
29
+ */
30
+ readonly initialWorkflowDefinition?: WorkflowDefinition;
31
+ /**
32
+ * In embedded mode: the initial initiator-policy CEL expression.
33
+ * Falls back to `null` (no policy) when omitted.
34
+ */
35
+ readonly initialInitiatorPolicyCel?: string | null;
36
+ /**
37
+ * In embedded mode: called whenever the workflow definition changes so the
38
+ * host can persist the current canvas state.
39
+ */
40
+ readonly onWorkflowChange?: (definition: WorkflowDefinition) => void;
41
+ /**
42
+ * In embedded mode: called whenever the initiator-policy CEL changes.
43
+ */
44
+ readonly onInitiatorPolicyChange?: (cel: string | null) => void;
45
+ /**
46
+ * Render the "試跑流程" (dry-run) button at all. Default `true`. Hosts can
47
+ * pass `false` to hide it (e.g. deployments that don't expose dry-run).
48
+ * Has no effect in embedded mode, where the PageHeader is hidden entirely.
49
+ */
50
+ readonly showDryRun?: boolean;
51
+ /**
52
+ * Render the AI assistant toggle at all. Default `false` — the feature is
53
+ * hidden unless the host opts in (e.g. a deployment that has it configured).
54
+ */
55
+ readonly showAiAssistant?: boolean;
56
+ /**
57
+ * Whether the LLM backend is configured (e.g. the host has an API key set).
58
+ * Default `true`. When `false`, the toggle is shown but disabled and labelled
59
+ * as not configured — a placeholder rather than a broken feature.
60
+ */
61
+ readonly aiAssistantAvailable?: boolean;
4
62
  }
5
- export declare function TemplateDesignerView({ templateId, }: TemplateDesignerViewProps): ReactElement;
63
+ export declare function TemplateDesignerView({ aiAssistantAvailable, embedded, formSchemaOverride, initialInitiatorPolicyCel, initialWorkflowDefinition, onInitiatorPolicyChange, onWorkflowChange, showAiAssistant, showDryRun, templateId, }: TemplateDesignerViewProps): ReactElement;
@@ -0,0 +1,12 @@
1
+ import { UIMessage } from 'ai';
2
+ import { WorkflowDesignerController } from './use-workflow-designer-controller';
3
+ export interface UseChromeWorkflowChatResult {
4
+ /** True only when the on-device model is usable in this browser. */
5
+ readonly available: boolean;
6
+ readonly messages: readonly UIMessage[];
7
+ readonly status: 'ready' | 'submitted' | 'streaming' | 'error';
8
+ readonly send: (text: string) => void;
9
+ }
10
+ export declare function useChromeWorkflowChat({ controller, }: {
11
+ readonly controller: WorkflowDesignerController;
12
+ }): UseChromeWorkflowChatResult;