@rytass/bpm-core-react 0.13.2 → 0.13.4

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 (148) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +1 -0
  3. package/dist/chunks/{FormBuilderView-D4xIuPYB.js → FormBuilderView-BYLN6W-P.js} +2 -2
  4. package/dist/chunks/{FormBuilderView-D4xIuPYB.js.map → FormBuilderView-BYLN6W-P.js.map} +1 -1
  5. package/dist/chunks/{FormBuilderView-CLFlfDGe.cjs → FormBuilderView-VmdPVbg7.cjs} +2 -2
  6. package/dist/chunks/{FormBuilderView-CLFlfDGe.cjs.map → FormBuilderView-VmdPVbg7.cjs.map} +1 -1
  7. package/dist/chunks/FormRendererView-Bs8lTb4k.cjs +2 -0
  8. package/dist/chunks/{FormRendererView-BxGT16z0.cjs.map → FormRendererView-Bs8lTb4k.cjs.map} +1 -1
  9. package/dist/chunks/{FormRendererView-DUceSOXe.js → FormRendererView-UPowZZgw.js} +3 -3
  10. package/dist/chunks/{FormRendererView-DUceSOXe.js.map → FormRendererView-UPowZZgw.js.map} +1 -1
  11. package/dist/chunks/{approval-instance-list-page-BjX2kaoF.js → approval-instance-list-page-CPXMP3PL.js} +2 -2
  12. package/dist/chunks/{approval-instance-list-page-BjX2kaoF.js.map → approval-instance-list-page-CPXMP3PL.js.map} +1 -1
  13. package/dist/chunks/{approval-instance-list-page-CWiQvnfE.cjs → approval-instance-list-page-ax0pm8bt.cjs} +2 -2
  14. package/dist/chunks/{approval-instance-list-page-CWiQvnfE.cjs.map → approval-instance-list-page-ax0pm8bt.cjs.map} +1 -1
  15. package/dist/chunks/{compose-Bb-REfoB.js → compose-6P64PO1i.js} +5 -5
  16. package/dist/chunks/{compose-Bb-REfoB.js.map → compose-6P64PO1i.js.map} +1 -1
  17. package/dist/chunks/{compose-DzRYZcqe.cjs → compose-BnSRL4ml.cjs} +2 -2
  18. package/dist/chunks/{compose-DzRYZcqe.cjs.map → compose-BnSRL4ml.cjs.map} +1 -1
  19. package/dist/chunks/{dashboard-page-DJ9vOPga.js → dashboard-page-CeCLV1tp.js} +2 -2
  20. package/dist/chunks/{dashboard-page-DJ9vOPga.js.map → dashboard-page-CeCLV1tp.js.map} +1 -1
  21. package/dist/chunks/{dashboard-page-CH87L5nx.cjs → dashboard-page-DooFJsxM.cjs} +2 -2
  22. package/dist/chunks/{dashboard-page-CH87L5nx.cjs.map → dashboard-page-DooFJsxM.cjs.map} +1 -1
  23. package/dist/chunks/{delegations-vpLtus9g.cjs → delegations-8LsxcQM4.cjs} +2 -2
  24. package/dist/chunks/{delegations-vpLtus9g.cjs.map → delegations-8LsxcQM4.cjs.map} +1 -1
  25. package/dist/chunks/{delegations-0MbJ7CWj.js → delegations-B8gLSt0i.js} +4 -5
  26. package/dist/chunks/{delegations-0MbJ7CWj.js.map → delegations-B8gLSt0i.js.map} +1 -1
  27. package/dist/chunks/{delegations-DyMGIDpp.js → delegations-DRupxJ4_.js} +4 -5
  28. package/dist/chunks/{delegations-DyMGIDpp.js.map → delegations-DRupxJ4_.js.map} +1 -1
  29. package/dist/chunks/{delegations-Bc9psOZ3.cjs → delegations-DlYwMiAW.cjs} +2 -2
  30. package/dist/chunks/{delegations-Bc9psOZ3.cjs.map → delegations-DlYwMiAW.cjs.map} +1 -1
  31. package/dist/chunks/{designer-C6oIO9Kq.js → designer-C3s2kSna.js} +1342 -841
  32. package/dist/chunks/designer-C3s2kSna.js.map +1 -0
  33. package/dist/chunks/designer-_g58R6rQ.cjs +65 -0
  34. package/dist/chunks/designer-_g58R6rQ.cjs.map +1 -0
  35. package/dist/chunks/detail-Db-UOELp.cjs +2 -0
  36. package/dist/chunks/detail-Db-UOELp.cjs.map +1 -0
  37. package/dist/chunks/detail-pYEIk-jW.js +2325 -0
  38. package/dist/chunks/detail-pYEIk-jW.js.map +1 -0
  39. package/dist/chunks/{login-9bCXyjbX.cjs → login-AtVxZBsC.cjs} +2 -2
  40. package/dist/chunks/{login-9bCXyjbX.cjs.map → login-AtVxZBsC.cjs.map} +1 -1
  41. package/dist/chunks/{login-BKxpLibd.js → login-C6qlTC6F.js} +2 -2
  42. package/dist/chunks/{login-BKxpLibd.js.map → login-C6qlTC6F.js.map} +1 -1
  43. package/dist/chunks/{orgs-Cr_7zsAD.js → orgs-BpqVu5ka.js} +2 -2
  44. package/dist/chunks/{orgs-Cr_7zsAD.js.map → orgs-BpqVu5ka.js.map} +1 -1
  45. package/dist/chunks/orgs-D0-5BaHT.cjs +2 -0
  46. package/dist/chunks/{orgs-Bz8hBMoQ.cjs.map → orgs-D0-5BaHT.cjs.map} +1 -1
  47. package/dist/chunks/providers-DHtDZFNA.cjs +2 -0
  48. package/dist/chunks/{providers-BsEn3ikK.cjs.map → providers-DHtDZFNA.cjs.map} +1 -1
  49. package/dist/chunks/{providers-DjLh4oLY.js → providers-J5eyByQj.js} +7 -7
  50. package/dist/chunks/{providers-DjLh4oLY.js.map → providers-J5eyByQj.js.map} +1 -1
  51. package/dist/chunks/{routes-config-fDVHmvXi.cjs → routes-config-C1j_vFKo.cjs} +2 -2
  52. package/dist/chunks/routes-config-C1j_vFKo.cjs.map +1 -0
  53. package/dist/chunks/{routes-config-RBYQtUd0.js → routes-config-yZbESPlw.js} +3 -2
  54. package/dist/chunks/routes-config-yZbESPlw.js.map +1 -0
  55. package/dist/chunks/use-bpm-member-D57LKe_u.js +20 -0
  56. package/dist/chunks/use-bpm-member-D57LKe_u.js.map +1 -0
  57. package/dist/chunks/use-bpm-member-DpNAQtNC.cjs +2 -0
  58. package/dist/chunks/use-bpm-member-DpNAQtNC.cjs.map +1 -0
  59. package/dist/index.cjs +1 -1
  60. package/dist/index.cjs.map +1 -1
  61. package/dist/index.js +19 -24
  62. package/dist/index.js.map +1 -1
  63. package/dist/lib/routes-config.d.ts +2 -0
  64. package/dist/lib/use-bpm-member.d.ts +6 -0
  65. package/dist/next/index.cjs +1 -1
  66. package/dist/next/index.js +2 -2
  67. package/dist/pages/admin/delegations/index.cjs +1 -1
  68. package/dist/pages/admin/delegations/index.js +1 -1
  69. package/dist/pages/admin/orgs/index.cjs +1 -1
  70. package/dist/pages/admin/orgs/index.js +1 -1
  71. package/dist/pages/admin/webhook-endpoints/index.cjs +2 -0
  72. package/dist/pages/admin/webhook-endpoints/index.cjs.map +1 -0
  73. package/dist/pages/admin/webhook-endpoints/index.d.ts +4 -0
  74. package/dist/pages/admin/webhook-endpoints/index.js +14 -0
  75. package/dist/pages/admin/webhook-endpoints/index.js.map +1 -0
  76. package/dist/pages/delegations/index.cjs +1 -1
  77. package/dist/pages/delegations/index.js +1 -1
  78. package/dist/pages/instances/detail/index.cjs +1 -1
  79. package/dist/pages/instances/detail/index.js +1 -1
  80. package/dist/pages/login/index.cjs +1 -1
  81. package/dist/pages/login/index.js +1 -1
  82. package/dist/pages/templates/compose/index.cjs +1 -1
  83. package/dist/pages/templates/compose/index.js +1 -1
  84. package/dist/pages/templates/designer/index.cjs +1 -1
  85. package/dist/pages/templates/designer/index.js +1 -1
  86. package/dist/style.css +1 -1
  87. package/dist/views/admin/delegations/index.cjs +1 -1
  88. package/dist/views/admin/delegations/index.js +1 -1
  89. package/dist/views/admin/index.cjs +1 -1
  90. package/dist/views/admin/index.d.ts +1 -0
  91. package/dist/views/admin/index.js +4 -3
  92. package/dist/views/admin/orgs/index.cjs +1 -1
  93. package/dist/views/admin/orgs/index.js +1 -1
  94. package/dist/views/admin/webhook-endpoints/AdminWebhookEndpointsView.d.ts +8 -0
  95. package/dist/views/admin/webhook-endpoints/index.cjs +2 -0
  96. package/dist/views/admin/webhook-endpoints/index.cjs.map +1 -0
  97. package/dist/views/admin/webhook-endpoints/index.d.ts +1 -0
  98. package/dist/views/admin/webhook-endpoints/index.js +729 -0
  99. package/dist/views/admin/webhook-endpoints/index.js.map +1 -0
  100. package/dist/views/cc/index.cjs +1 -1
  101. package/dist/views/cc/index.js +1 -1
  102. package/dist/views/dashboard/index.cjs +1 -1
  103. package/dist/views/dashboard/index.js +1 -1
  104. package/dist/views/delegations/index.cjs +1 -1
  105. package/dist/views/delegations/index.js +1 -1
  106. package/dist/views/forms/builder/index.cjs +1 -1
  107. package/dist/views/forms/builder/index.js +1 -1
  108. package/dist/views/forms/renderer/index.cjs +1 -1
  109. package/dist/views/forms/renderer/index.js +1 -1
  110. package/dist/views/inbox/index.cjs +1 -1
  111. package/dist/views/inbox/index.js +1 -1
  112. package/dist/views/instances/detail/InstanceDetailView.d.ts +6 -1
  113. package/dist/views/instances/detail/index.cjs +1 -1
  114. package/dist/views/instances/detail/index.d.ts +1 -0
  115. package/dist/views/instances/detail/index.js +2 -2
  116. package/dist/views/instances/detail/sections/InstanceWebhookDeliveriesSection.d.ts +20 -0
  117. package/dist/views/instances/detail/sections/shared.d.ts +37 -4
  118. package/dist/views/instances/new/index.cjs +1 -1
  119. package/dist/views/instances/new/index.js +2 -2
  120. package/dist/views/login/index.cjs +1 -1
  121. package/dist/views/login/index.js +1 -1
  122. package/dist/views/search/index.cjs +1 -1
  123. package/dist/views/search/index.js +1 -1
  124. package/dist/views/sent/index.cjs +1 -1
  125. package/dist/views/sent/index.js +1 -1
  126. package/dist/views/templates/compose/index.cjs +1 -1
  127. package/dist/views/templates/compose/index.js +1 -1
  128. package/dist/views/templates/designer/NotifyWebhookTargetsEditor.d.ts +20 -0
  129. package/dist/views/templates/designer/index.cjs +1 -1
  130. package/dist/views/templates/designer/index.js +1 -1
  131. package/dist/views/templates/designer/notify-webhook-designer.d.ts +74 -0
  132. package/dist/views/templates/index.cjs +1 -1
  133. package/dist/views/templates/index.js +1 -1
  134. package/dist/views/templates/versions/index.cjs +1 -1
  135. package/dist/views/templates/versions/index.js +1 -1
  136. package/package.json +13 -3
  137. package/dist/chunks/FormRendererView-BxGT16z0.cjs +0 -2
  138. package/dist/chunks/designer-C6oIO9Kq.js.map +0 -1
  139. package/dist/chunks/designer-gFUdImeZ.cjs +0 -65
  140. package/dist/chunks/designer-gFUdImeZ.cjs.map +0 -1
  141. package/dist/chunks/detail-BgKgMvYx.js +0 -2044
  142. package/dist/chunks/detail-BgKgMvYx.js.map +0 -1
  143. package/dist/chunks/detail-Dnz5aaI-.cjs +0 -2
  144. package/dist/chunks/detail-Dnz5aaI-.cjs.map +0 -1
  145. package/dist/chunks/orgs-Bz8hBMoQ.cjs +0 -2
  146. package/dist/chunks/providers-BsEn3ikK.cjs +0 -2
  147. package/dist/chunks/routes-config-RBYQtUd0.js.map +0 -1
  148. package/dist/chunks/routes-config-fDVHmvXi.cjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../src/views/admin/webhook-endpoints/AdminWebhookEndpointsView.tsx"],"sourcesContent":["'use client';\n\nimport {\n ChangeEvent,\n CSSProperties,\n ReactElement,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport {\n Badge,\n Button,\n Input,\n Modal,\n PageHeader,\n Section,\n SectionGroup,\n Select,\n Table,\n Textarea,\n Toggle,\n Typography,\n} from '@mezzanine-ui/react';\nimport ContentHeader from '@mezzanine-ui/react/ContentHeader';\nimport { PlusIcon, TrashIcon } from '@mezzanine-ui/icons';\nimport type { TableActions, TableColumn } from '@mezzanine-ui/core/table';\nimport { NotifyWebhookParameterType } from '@rytass/bpm-core-shared/workflow';\nimport {\n WorkflowWebhookEndpointAuditRecord,\n WorkflowWebhookEndpointManagementRecord,\n WorkflowWebhookEndpointTestResultRecord,\n WorkflowWebhookManagedEndpointRecord,\n createWorkflowWebhookEndpoint,\n listWorkflowWebhookEndpointAudits,\n listWorkflowWebhookManagedEndpoints,\n readWorkflowWebhookEndpointManagement,\n rotateWorkflowWebhookEndpointSecret,\n setWorkflowWebhookEndpointActive,\n testWorkflowWebhookEndpoint,\n updateWorkflowWebhookEndpoint,\n} from '@rytass/bpm-core-client/template';\nimport { BPMFormField } from '../../../components/bpm-form-field';\nimport { formatDateTime } from '../../../lib/format-date-time';\n\ntype SelectOption = Readonly<{ id: string; name: string }>;\n\ntype EndpointRow = Readonly<\n Record<string, unknown> & {\n endpoint: WorkflowWebhookManagedEndpointRecord;\n key: string;\n }\n>;\n\ntype AuditRow = Readonly<\n Record<string, unknown> & {\n audit: WorkflowWebhookEndpointAuditRecord;\n key: string;\n }\n>;\n\ntype ParameterDraft = Readonly<{\n description: string;\n key: string;\n label: string;\n required: boolean;\n type: NotifyWebhookParameterType;\n}>;\n\ntype HeaderDraft = Readonly<{ name: string; value: string }>;\n\n/**\n * `mode` decides what can change: a new endpoint (or a new version of one)\n * sets everything; editing keeps the parameter contract and only replaces\n * headers when asked to.\n */\ntype EndpointDraft = Readonly<{\n deprecated: boolean;\n description: string;\n endpointId: string | null;\n headers: readonly HeaderDraft[];\n key: string;\n label: string;\n method: string;\n mode: 'create' | 'edit' | 'version';\n /** The stored URL when editing, to spot a move to another host. */\n originalUrl: string;\n parameters: readonly ParameterDraft[];\n replaceHeaders: boolean;\n signingSecret: string;\n timeoutMs: string;\n url: string;\n version: string;\n}>;\n\nconst STACK_STYLE: CSSProperties = {\n display: 'grid',\n gap: 'var(--mzn-spacing-gap-base)',\n};\n\nconst ROW_STYLE: CSSProperties = {\n alignItems: 'center',\n display: 'grid',\n gap: 'var(--mzn-spacing-gap-base)',\n gridTemplateColumns: 'minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) auto auto',\n};\n\nconst HEADER_ROW_STYLE: CSSProperties = {\n alignItems: 'center',\n display: 'grid',\n gap: 'var(--mzn-spacing-gap-base)',\n gridTemplateColumns: 'minmax(0, 1fr) minmax(0, 2fr) auto',\n};\n\nconst METHOD_OPTIONS: readonly SelectOption[] = [\n { id: 'POST', name: 'POST' },\n { id: 'PUT', name: 'PUT' },\n { id: 'PATCH', name: 'PATCH' },\n];\n\nconst PARAMETER_TYPE_OPTIONS: readonly SelectOption[] = [\n { id: 'string', name: '文字' },\n { id: 'number', name: '數字' },\n { id: 'boolean', name: '是/否' },\n { id: 'stringArray', name: '文字清單' },\n { id: 'json', name: 'JSON' },\n];\n\nconst AUDIT_ACTION_LABELS: Readonly<\n Record<WorkflowWebhookEndpointAuditRecord['action'], string>\n> = {\n CREATED: '建立',\n DISABLED: '停用',\n ENABLED: '啟用',\n SECRET_ROTATED: '輪替金鑰',\n TEST_SENT: '測試送出',\n UPDATED: '更新',\n};\n\nconst EMPTY_DRAFT: EndpointDraft = {\n deprecated: false,\n description: '',\n endpointId: null,\n headers: [],\n key: '',\n label: '',\n method: 'POST',\n mode: 'create',\n originalUrl: '',\n parameters: [],\n replaceHeaders: true,\n signingSecret: '',\n timeoutMs: '',\n url: '',\n version: '1',\n};\n\n/**\n * Back-office management of database webhook endpoints (ADR 18 §3.13):\n * create, edit, disable, rotate the signing secret, test-send and read the\n * change history. Header values and secrets are entered here and never shown\n * again. Administrator-only on the server.\n */\nexport function AdminWebhookEndpointsView(): ReactElement {\n const [management, setManagement] =\n useState<WorkflowWebhookEndpointManagementRecord | null>(null);\n const [endpoints, setEndpoints] = useState<\n readonly WorkflowWebhookManagedEndpointRecord[]\n >([]);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<string | null>(null);\n const [notice, setNotice] = useState<string | null>(null);\n const [draft, setDraft] = useState<EndpointDraft | null>(null);\n const [saving, setSaving] = useState(false);\n const [rotating, setRotating] =\n useState<WorkflowWebhookManagedEndpointRecord | null>(null);\n const [nextSecret, setNextSecret] = useState('');\n const [removeSecret, setRemoveSecret] = useState(false);\n const [audits, setAudits] = useState<{\n readonly endpoint: WorkflowWebhookManagedEndpointRecord;\n readonly records: readonly WorkflowWebhookEndpointAuditRecord[];\n } | null>(null);\n\n const refresh = useCallback(async (): Promise<void> => {\n setLoading(true);\n\n try {\n const nextManagement = await readWorkflowWebhookEndpointManagement();\n\n setManagement(nextManagement);\n setEndpoints(\n nextManagement.enabled\n ? await listWorkflowWebhookManagedEndpoints()\n : [],\n );\n setError(null);\n } catch (requestError: unknown) {\n setError(readErrorMessage(requestError));\n } finally {\n setLoading(false);\n }\n }, []);\n\n useEffect((): void => {\n void refresh();\n }, [refresh]);\n\n const run = useCallback(\n async (work: () => Promise<string | null>): Promise<boolean> => {\n setError(null);\n setNotice(null);\n\n try {\n setNotice(await work());\n await refresh();\n\n return true;\n } catch (requestError: unknown) {\n setError(readErrorMessage(requestError));\n\n return false;\n }\n },\n [refresh],\n );\n\n const rows = useMemo(\n (): EndpointRow[] =>\n endpoints.map((endpoint) => ({ endpoint, key: endpoint.id })),\n [endpoints],\n );\n\n const columns = useMemo(\n (): TableColumn<EndpointRow>[] => [\n {\n key: 'label',\n render: ({ endpoint }: EndpointRow): ReactElement => (\n <div style={STACK_STYLE}>\n <Typography component=\"span\" variant=\"body\">\n {endpoint.label}\n </Typography>\n <Typography color=\"text-neutral\" component=\"span\" variant=\"caption\">\n {endpoint.key}@{endpoint.version} · 參數{' '}\n {endpoint.parameters.length} 個\n </Typography>\n </div>\n ),\n title: '端點',\n width: 240,\n },\n {\n key: 'url',\n render: ({ endpoint }: EndpointRow): ReactElement => (\n <Typography component=\"span\" variant=\"body\">\n {endpoint.method} {endpoint.url}\n </Typography>\n ),\n title: 'URL',\n width: 320,\n },\n {\n key: 'status',\n render: ({ endpoint }: EndpointRow): ReactElement =>\n !endpoint.active ? (\n <Badge size=\"sub\" text=\"已停用\" variant=\"dot-inactive\" />\n ) : endpoint.deprecated ? (\n <Badge size=\"sub\" text=\"不建議使用\" variant=\"dot-warning\" />\n ) : (\n <Badge size=\"sub\" text=\"啟用中\" variant=\"dot-success\" />\n ),\n title: '狀態',\n width: 120,\n },\n {\n key: 'credentials',\n render: ({ endpoint }: EndpointRow): ReactElement => (\n <div style={STACK_STYLE}>\n <Typography component=\"span\" variant=\"body\">\n {endpoint.hasSigningSecret ? '已設定簽章金鑰' : '未簽章'}\n </Typography>\n <Typography color=\"text-neutral\" component=\"span\" variant=\"caption\">\n {endpoint.headerNames.length\n ? `Header:${endpoint.headerNames.join('、')}`\n : '沒有自訂 header'}\n </Typography>\n </div>\n ),\n title: '憑證',\n width: 200,\n },\n {\n key: 'updatedAt',\n render: ({ endpoint }: EndpointRow): ReactElement => (\n <Typography component=\"span\" variant=\"body\">\n {formatDateTime(endpoint.updatedAt)}\n </Typography>\n ),\n title: '更新時間',\n width: 180,\n },\n ],\n [],\n );\n\n const actions = useMemo(\n (): TableActions<EndpointRow> => ({\n render: ({\n endpoint,\n }): ReturnType<TableActions<EndpointRow>['render']> => [\n {\n name: '編輯',\n onClick: (): void => setDraft(readEditDraft(endpoint, 'edit')),\n },\n {\n name: '建立新版本',\n onClick: (): void => setDraft(readEditDraft(endpoint, 'version')),\n },\n {\n name: '測試送出',\n onClick: (): void => {\n void run(async () =>\n readTestNotice(\n endpoint,\n await testWorkflowWebhookEndpoint(endpoint.id),\n ),\n );\n },\n },\n {\n name: '輪替金鑰',\n onClick: (): void => {\n setNextSecret('');\n setRemoveSecret(false);\n setRotating(endpoint);\n },\n },\n {\n name: endpoint.active ? '停用' : '啟用',\n onClick: (): void => {\n void run(async () => {\n await setWorkflowWebhookEndpointActive(\n endpoint.id,\n !endpoint.active,\n );\n\n return `已${endpoint.active ? '停用' : '啟用'}「${endpoint.label}」。`;\n });\n },\n },\n {\n name: '異動紀錄',\n onClick: (): void => {\n void listWorkflowWebhookEndpointAudits(endpoint.id)\n .then((records): void => setAudits({ endpoint, records }))\n .catch((requestError: unknown): void =>\n setError(readErrorMessage(requestError)),\n );\n },\n },\n ],\n variant: 'base-secondary',\n width: 180,\n }),\n [run],\n );\n\n async function handleSaveDraft(): Promise<void> {\n if (!draft) {\n return;\n }\n\n setSaving(true);\n\n const saved = await run(async () => {\n const parameters = draft.parameters.map((parameter) => ({\n description: parameter.description.trim() || null,\n key: parameter.key.trim(),\n label: parameter.label.trim(),\n required: parameter.required,\n type: parameter.type,\n }));\n const headers = draft.headers\n .filter((header) => header.name.trim())\n .map((header) => ({ name: header.name.trim(), value: header.value }));\n const timeoutMs = draft.timeoutMs.trim() ? Number(draft.timeoutMs) : null;\n\n if (draft.mode === 'edit' && draft.endpointId) {\n await updateWorkflowWebhookEndpoint({\n deprecated: draft.deprecated,\n description: draft.description,\n headers:\n draft.replaceHeaders || isOriginChanged(draft) ? headers : null,\n id: draft.endpointId,\n label: draft.label,\n method: draft.method,\n parameters,\n timeoutMs,\n url: draft.url,\n });\n\n return `已更新「${draft.label}」。`;\n }\n\n await createWorkflowWebhookEndpoint({\n deprecated: draft.deprecated,\n description: draft.description,\n headers,\n key: draft.key,\n label: draft.label,\n method: draft.method,\n parameters,\n signingSecret: draft.signingSecret || null,\n timeoutMs,\n url: draft.url,\n version: Number(draft.version),\n });\n\n return `已建立「${draft.label}」v${draft.version},設計器現在可以選用。`;\n });\n\n setSaving(false);\n\n if (saved) {\n setDraft(null);\n }\n }\n\n async function handleRotate(): Promise<void> {\n if (!rotating) {\n return;\n }\n\n const endpoint = rotating;\n const done = await run(async () => {\n await rotateWorkflowWebhookEndpointSecret(\n endpoint.id,\n removeSecret ? null : nextSecret,\n );\n\n return removeSecret\n ? `已移除「${endpoint.label}」的簽章金鑰,之後的請求不再簽章。`\n : `已輪替「${endpoint.label}」的簽章金鑰,接收端需改用新金鑰驗簽。`;\n });\n\n if (done) {\n setRotating(null);\n setNextSecret('');\n }\n }\n\n const enabled = Boolean(management?.enabled);\n\n return (\n <>\n <PageHeader>\n <ContentHeader\n description=\"維護知會節點可呼叫的外部系統端點。Header 值與簽章金鑰加密保存,儲存後不會再顯示。\"\n title=\"Webhook 端點\"\n >\n <Button\n disabled={!enabled}\n icon={PlusIcon}\n iconType=\"leading\"\n onClick={(): void => setDraft(EMPTY_DRAFT)}\n variant=\"base-primary\"\n >\n 新增端點\n </Button>\n </ContentHeader>\n </PageHeader>\n\n <SectionGroup>\n <Section>\n <div style={STACK_STYLE}>\n {error ? (\n <Typography color=\"text-error\" variant=\"body\">\n {error}\n </Typography>\n ) : null}\n {notice ? (\n <Typography color=\"text-success\" variant=\"body\">\n {notice}\n </Typography>\n ) : null}\n {management && !enabled ? (\n <Typography color=\"text-warning\" variant=\"body\">\n 此伺服器未啟用後台維護的 Webhook 端點:需要設定\n workflowWebhookTargetSources 含 DATABASE、URL\n 白名單與加密金鑰。程式註冊的端點不受影響。\n </Typography>\n ) : null}\n {enabled ? (\n <Typography color=\"text-neutral\" variant=\"caption\">\n 允許的 URL:{management?.allowedUrlPatterns.join('、')}\n </Typography>\n ) : null}\n <Table\n actions={actions}\n columns={columns}\n dataSource={rows}\n fullWidth\n loading={loading}\n />\n </div>\n </Section>\n </SectionGroup>\n\n {draft ? (\n <EndpointDraftModal\n draft={draft}\n onCancel={(): void => setDraft(null)}\n onChange={setDraft}\n onConfirm={(): void => void handleSaveDraft()}\n saving={saving}\n />\n ) : null}\n\n <Modal\n cancelText=\"取消\"\n confirmButtonProps={{ disabled: !removeSecret && !nextSecret }}\n confirmText={removeSecret ? '移除金鑰' : '輪替金鑰'}\n modalType=\"standard\"\n onCancel={(): void => setRotating(null)}\n onClose={(): void => setRotating(null)}\n onConfirm={(): void => void handleRotate()}\n open={Boolean(rotating)}\n showModalFooter\n showModalHeader\n supportingText=\"新金鑰會加密保存,不會再顯示;請同時更新接收端的驗簽金鑰。\"\n title={`輪替簽章金鑰:${rotating?.label ?? ''}`}\n >\n <div style={STACK_STYLE}>\n <BPMFormField label=\"移除金鑰\" name=\"removeSigningSecret\">\n <Toggle\n checked={removeSecret}\n onChange={(event: ChangeEvent<HTMLInputElement>): void =>\n setRemoveSecret(event.target.checked)\n }\n />\n </BPMFormField>\n {removeSecret ? null : (\n <BPMFormField label=\"新金鑰\" name=\"nextSigningSecret\" required>\n <Input\n onChange={(event: ChangeEvent<HTMLInputElement>): void =>\n setNextSecret(event.target.value)\n }\n value={nextSecret}\n inputProps={{ autoComplete: 'new-password' }}\n variant=\"password\"\n />\n </BPMFormField>\n )}\n </div>\n </Modal>\n\n <Modal\n confirmText=\"關閉\"\n modalType=\"standard\"\n onClose={(): void => setAudits(null)}\n onConfirm={(): void => setAudits(null)}\n open={Boolean(audits)}\n showModalFooter\n showModalHeader\n size=\"wide\"\n supportingText=\"只記錄誰在何時變更了哪些欄位,不記錄任何值。\"\n title={`異動紀錄:${audits?.endpoint.label ?? ''}`}\n >\n <Table\n columns={AUDIT_COLUMNS}\n dataSource={(audits?.records ?? []).map((audit): AuditRow => ({\n audit,\n key: audit.id,\n }))}\n fullWidth\n />\n </Modal>\n </>\n );\n}\n\nconst AUDIT_COLUMNS: TableColumn<AuditRow>[] = [\n {\n key: 'createdAt',\n render: ({ audit }: AuditRow): ReactElement => (\n <Typography component=\"span\" variant=\"body\">\n {formatDateTime(audit.createdAt)}\n </Typography>\n ),\n title: '時間',\n width: 180,\n },\n {\n key: 'action',\n render: ({ audit }: AuditRow): ReactElement => (\n <Typography component=\"span\" variant=\"body\">\n {AUDIT_ACTION_LABELS[audit.action]}\n </Typography>\n ),\n title: '動作',\n width: 120,\n },\n {\n key: 'changedFields',\n render: ({ audit }: AuditRow): ReactElement => (\n <Typography component=\"span\" variant=\"body\">\n {audit.changedFields.join('、') || '—'}\n </Typography>\n ),\n title: '欄位',\n width: 280,\n },\n {\n key: 'actor',\n render: ({ audit }: AuditRow): ReactElement => (\n <Typography component=\"span\" variant=\"body\">\n {audit.actorMemberId ?? '系統'}\n </Typography>\n ),\n title: '操作者',\n width: 160,\n },\n];\n\nfunction EndpointDraftModal({\n draft,\n onCancel,\n onChange,\n onConfirm,\n saving,\n}: {\n readonly draft: EndpointDraft;\n readonly onCancel: () => void;\n readonly onChange: (draft: EndpointDraft) => void;\n readonly onConfirm: () => void;\n readonly saving: boolean;\n}): ReactElement {\n const editing = draft.mode === 'edit';\n // Stored header values must not follow the URL to another host, so a new\n // host always means entering the headers again.\n const originChanged = isOriginChanged(draft);\n const replaceHeaders = draft.replaceHeaders || originChanged;\n const update = (patch: Partial<EndpointDraft>): void =>\n onChange({ ...draft, ...patch });\n const updateParameter = (\n index: number,\n patch: Partial<ParameterDraft>,\n ): void =>\n update({\n parameters: draft.parameters.map((parameter, current) =>\n current === index ? { ...parameter, ...patch } : parameter,\n ),\n });\n const updateHeader = (index: number, patch: Partial<HeaderDraft>): void =>\n update({\n headers: draft.headers.map((header, current) =>\n current === index ? { ...header, ...patch } : header,\n ),\n });\n const text =\n (field: keyof EndpointDraft) =>\n (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>): void =>\n update({ [field]: event.target.value });\n\n return (\n <Modal\n cancelText=\"取消\"\n confirmText={editing ? '儲存' : '建立'}\n loading={saving}\n modalType=\"standard\"\n onCancel={onCancel}\n onClose={onCancel}\n onConfirm={onConfirm}\n open\n showModalFooter\n showModalHeader\n size=\"wide\"\n supportingText={\n editing\n ? '參數的鍵、型別與必填是這個版本的契約,無法修改;需要變更請建立新版本。'\n : draft.mode === 'version'\n ? '新版本可調整參數;既有模板仍使用舊版本,直到設計者改選。'\n : 'URL 需符合伺服器設定的白名單。'\n }\n title={\n editing\n ? `編輯端點:${draft.label}`\n : draft.mode === 'version'\n ? `建立新版本:${draft.key}`\n : '新增 Webhook 端點'\n }\n >\n <div style={STACK_STYLE}>\n <BPMFormField label=\"Key\" name=\"endpointKey\" required>\n <Input\n {...(draft.mode === 'create' ? {} : { readonly: true as const })}\n onChange={text('key')}\n placeholder=\"例如 crm.lead-created\"\n value={draft.key}\n inputProps={{ autoComplete: 'off' }}\n variant=\"base\"\n />\n </BPMFormField>\n <BPMFormField label=\"版本\" name=\"endpointVersion\" required>\n <Input\n {...(editing ? { readonly: true as const } : {})}\n inputProps={{ autoComplete: 'off', inputMode: 'numeric' }}\n onChange={text('version')}\n value={draft.version}\n variant=\"base\"\n />\n </BPMFormField>\n <BPMFormField label=\"名稱\" name=\"endpointLabel\" required>\n <Input\n onChange={text('label')}\n placeholder=\"例如 CRM 建立名單\"\n value={draft.label}\n inputProps={{ autoComplete: 'off' }}\n variant=\"base\"\n />\n </BPMFormField>\n <BPMFormField label=\"說明\" name=\"endpointDescription\">\n <Textarea\n onChange={text('description')}\n rows={2}\n value={draft.description}\n />\n </BPMFormField>\n <BPMFormField label=\"URL\" name=\"endpointUrl\" required>\n <Input\n onChange={text('url')}\n placeholder=\"https://\"\n value={draft.url}\n inputProps={{ autoComplete: 'off' }}\n variant=\"base\"\n />\n </BPMFormField>\n <BPMFormField label=\"Method\" name=\"endpointMethod\" required>\n <Select\n clearable={false}\n onChange={(option): void =>\n update({ method: option?.id ?? 'POST' })\n }\n options={[...METHOD_OPTIONS]}\n value={\n METHOD_OPTIONS.find((option) => option.id === draft.method) ??\n null\n }\n />\n </BPMFormField>\n <BPMFormField\n hintText=\"留空使用預設 10 秒,上限 30000 毫秒。\"\n label=\"逾時(毫秒)\"\n name=\"endpointTimeout\"\n >\n <Input\n inputProps={{ autoComplete: 'off', inputMode: 'numeric' }}\n onChange={text('timeoutMs')}\n value={draft.timeoutMs}\n variant=\"base\"\n />\n </BPMFormField>\n <BPMFormField label=\"不建議使用\" name=\"endpointDeprecated\">\n <Toggle\n checked={draft.deprecated}\n onChange={(event: ChangeEvent<HTMLInputElement>): void =>\n update({ deprecated: event.target.checked })\n }\n />\n </BPMFormField>\n {editing ? null : (\n <BPMFormField\n hintText=\"選填;設定後 BPM 以 HMAC-SHA256 簽章,儲存後不會再顯示。\"\n label=\"簽章金鑰\"\n name=\"endpointSigningSecret\"\n >\n <Input\n onChange={text('signingSecret')}\n placeholder=\"選填,儲存後不再顯示\"\n value={draft.signingSecret}\n inputProps={{ autoComplete: 'new-password' }}\n variant=\"password\"\n />\n </BPMFormField>\n )}\n\n <Typography variant=\"label-primary-highlight\">Headers</Typography>\n {editing ? (\n <BPMFormField\n hintText={\n originChanged\n ? 'URL 已改到其他主機,必須重新輸入 header(留空代表不帶任何 header)。'\n : '現有 header 的值不會顯示;開啟後以下列內容取代全部 header。'\n }\n label=\"取代 headers\"\n name=\"endpointReplaceHeaders\"\n >\n <Toggle\n checked={replaceHeaders}\n disabled={originChanged}\n onChange={(event: ChangeEvent<HTMLInputElement>): void =>\n update({ replaceHeaders: event.target.checked })\n }\n />\n </BPMFormField>\n ) : null}\n {replaceHeaders\n ? draft.headers.map((header, index): ReactElement => (\n <div key={index} style={HEADER_ROW_STYLE}>\n <Input\n onChange={(event: ChangeEvent<HTMLInputElement>): void =>\n updateHeader(index, { name: event.target.value })\n }\n placeholder=\"名稱,例如 Authorization\"\n inputProps={{ autoComplete: 'off' }}\n value={header.name}\n variant=\"base\"\n />\n <Input\n onChange={(event: ChangeEvent<HTMLInputElement>): void =>\n updateHeader(index, { value: event.target.value })\n }\n placeholder=\"值\"\n value={header.value}\n inputProps={{ autoComplete: 'new-password' }}\n variant=\"password\"\n />\n <Button\n icon={TrashIcon}\n iconType=\"icon-only\"\n onClick={(): void =>\n update({\n headers: draft.headers.filter(\n (_header, current) => current !== index,\n ),\n })\n }\n variant=\"destructive-text-link\"\n >\n 移除 header\n </Button>\n </div>\n ))\n : null}\n {replaceHeaders ? (\n <div>\n <Button\n icon={PlusIcon}\n iconType=\"leading\"\n onClick={(): void =>\n update({ headers: [...draft.headers, { name: '', value: '' }] })\n }\n variant=\"base-dashed\"\n >\n 新增 header\n </Button>\n </div>\n ) : null}\n\n <Typography variant=\"label-primary-highlight\">參數</Typography>\n {draft.parameters.map((parameter, index): ReactElement => (\n <div key={index} style={ROW_STYLE}>\n <Input\n {...(editing ? { readonly: true as const } : {})}\n onChange={(event: ChangeEvent<HTMLInputElement>): void =>\n updateParameter(index, { key: event.target.value })\n }\n placeholder=\"參數鍵\"\n inputProps={{ autoComplete: 'off' }}\n value={parameter.key}\n variant=\"base\"\n />\n <Input\n onChange={(event: ChangeEvent<HTMLInputElement>): void =>\n updateParameter(index, { label: event.target.value })\n }\n placeholder=\"顯示名稱\"\n inputProps={{ autoComplete: 'off' }}\n value={parameter.label}\n variant=\"base\"\n />\n <Select\n clearable={false}\n disabled={editing}\n onChange={(option): void =>\n updateParameter(index, {\n type: readParameterType(option?.id ?? null),\n })\n }\n options={[...PARAMETER_TYPE_OPTIONS]}\n value={\n PARAMETER_TYPE_OPTIONS.find(\n (option) => option.id === parameter.type,\n ) ?? null\n }\n />\n <Toggle\n checked={parameter.required}\n disabled={editing}\n label=\"必填\"\n onChange={(event: ChangeEvent<HTMLInputElement>): void =>\n updateParameter(index, { required: event.target.checked })\n }\n />\n <Button\n disabled={editing}\n icon={TrashIcon}\n iconType=\"icon-only\"\n onClick={(): void =>\n update({\n parameters: draft.parameters.filter(\n (_parameter, current) => current !== index,\n ),\n })\n }\n variant=\"destructive-text-link\"\n >\n 移除參數\n </Button>\n </div>\n ))}\n {editing ? null : (\n <div>\n <Button\n icon={PlusIcon}\n iconType=\"leading\"\n onClick={(): void =>\n update({\n parameters: [\n ...draft.parameters,\n {\n description: '',\n key: '',\n label: '',\n required: false,\n type: 'string',\n },\n ],\n })\n }\n variant=\"base-dashed\"\n >\n 新增參數\n </Button>\n </div>\n )}\n </div>\n </Modal>\n );\n}\n\nfunction readEditDraft(\n endpoint: WorkflowWebhookManagedEndpointRecord,\n mode: 'edit' | 'version',\n): EndpointDraft {\n return {\n deprecated: endpoint.deprecated,\n description: endpoint.description ?? '',\n endpointId: mode === 'edit' ? endpoint.id : null,\n headers: [],\n key: endpoint.key,\n label: endpoint.label,\n method: endpoint.method,\n mode,\n originalUrl: endpoint.url,\n parameters: endpoint.parameters.map((parameter) => ({\n description: parameter.description ?? '',\n key: parameter.key,\n label: parameter.label,\n required: parameter.required,\n type: parameter.type,\n })),\n // A new version starts without credentials: they are not readable.\n replaceHeaders: mode === 'version',\n signingSecret: '',\n timeoutMs: endpoint.timeoutMs ? String(endpoint.timeoutMs) : '',\n url: endpoint.url,\n version: String(\n mode === 'version' ? endpoint.version + 1 : endpoint.version,\n ),\n };\n}\n\nfunction readTestNotice(\n endpoint: WorkflowWebhookManagedEndpointRecord,\n result: WorkflowWebhookEndpointTestResultRecord,\n): string {\n if (result.ok) {\n return `測試送出成功:「${endpoint.label}」回應 HTTP ${result.status ?? ''}。`;\n }\n\n throw new Error(\n `測試送出失敗:「${endpoint.label}」${result.status ? `回應 HTTP ${result.status}` : ''}(${result.errorCode ?? '未知錯誤'})${result.errorDetail ? `:${result.errorDetail}` : ''}`,\n );\n}\n\nfunction isOriginChanged(draft: EndpointDraft): boolean {\n if (draft.mode !== 'edit') {\n return false;\n }\n\n const origin = (url: string): string => {\n try {\n return new URL(url.trim()).origin;\n } catch {\n return url.trim();\n }\n };\n\n return origin(draft.url) !== origin(draft.originalUrl);\n}\n\nfunction readParameterType(id: string | null): NotifyWebhookParameterType {\n return PARAMETER_TYPE_OPTIONS.some((option) => option.id === id)\n ? (id as NotifyWebhookParameterType)\n : 'string';\n}\n\nfunction readErrorMessage(error: unknown): string {\n if (!(error instanceof Error)) {\n return '發生未知錯誤';\n }\n\n const message = error.message;\n\n if (message.includes('WORKFLOW_WEBHOOK_URL_NOT_ALLOWED')) {\n return 'URL 不在伺服器允許的白名單內。';\n }\n\n if (message.includes('WORKFLOW_WEBHOOK_ENDPOINT_KEY_CONFLICT')) {\n return '這個 Key 已由程式註冊的端點使用,請換一個。';\n }\n\n if (message.includes('WORKFLOW_WEBHOOK_ENDPOINT_CONTRACT_CHANGED')) {\n return '參數契約不能修改,請改用「建立新版本」。';\n }\n\n if (message.includes('WORKFLOW_WEBHOOK_TEST_RATE_LIMITED')) {\n return '測試送出太頻繁,請稍後再試(每 10 秒一次、10 分鐘最多 5 次)。';\n }\n\n return message;\n}\n"],"mappings":";;;;;;;;;;AAgGA,IAAM,IAA6B;CACjC,SAAS;CACT,KAAK;AACP,GAEM,IAA2B;CAC/B,YAAY;CACZ,SAAS;CACT,KAAK;CACL,qBAAqB;AACvB,GAEM,IAAkC;CACtC,YAAY;CACZ,SAAS;CACT,KAAK;CACL,qBAAqB;AACvB,GAEM,IAA0C;CAC9C;EAAE,IAAI;EAAQ,MAAM;CAAO;CAC3B;EAAE,IAAI;EAAO,MAAM;CAAM;CACzB;EAAE,IAAI;EAAS,MAAM;CAAQ;AAC/B,GAEM,IAAkD;CACtD;EAAE,IAAI;EAAU,MAAM;CAAK;CAC3B;EAAE,IAAI;EAAU,MAA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AA+B;CACtD,IAAI,EAAM,SAAS,QACjB,OAAO;CAGT,IAAM,KAAU,MAAwB;EACtC,IAAI;GACF,OAAO,IAAI,IAAI,EAAI,KAAK,CAAC,CAAC,CAAC;EAC7B,QAAQ;GACN,OAAO,EAAI,KAAK;EAClB;CACF;CAEA,OAAO,EAAO,EAAM,GAAG,MAAM,EAAO,EAAM,WAAW;AACvD;AAEA,SAAS,EAAkB,GAA+C;CACxE,OAAO,EAAuB,MAAM,MAAW,EAAO,OAAO,CAAE,IAC1D,IACD;AACN;AAEA,SAAS,EAAiB,GAAwB;CAChD,IAAI,EAAE,aAAiB,QACrB,OAAO;CAGT,IAAM,IAAU,EAAM;CAkBtB,OAhBI,EAAQ,SAAS,kCAAkC,IAC9C,sBAGL,EAAQ,SAAS,wCAAwC,IACpD,6BAGL,EAAQ,SAAS,4CAA4C,IACxD,yBAGL,EAAQ,SAAS,oCAAoC,IAChD,yCAGF;AACT"}
@@ -1,2 +1,2 @@
1
- "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/approval-instance-list-page-CWiQvnfE.cjs");let t=require("react/jsx-runtime");function n(){return(0,t.jsx)(e.t,{defaultState:null,description:`查看抄送給你的簽核案件。`,emptyMessage:`目前沒有抄送給你的簽核案件。`,searchPlaceholder:`關鍵字:搜尋案件、發起人、模板或狀態`,title:`抄送給我`,view:`CC`})}exports.CcView=n;
1
+ "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/approval-instance-list-page-ax0pm8bt.cjs");let t=require("react/jsx-runtime");function n(){return(0,t.jsx)(e.t,{defaultState:null,description:`查看抄送給你的簽核案件。`,emptyMessage:`目前沒有抄送給你的簽核案件。`,searchPlaceholder:`關鍵字:搜尋案件、發起人、模板或狀態`,title:`抄送給我`,view:`CC`})}exports.CcView=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-BjX2kaoF.js";
2
+ import { t as e } from "../../chunks/approval-instance-list-page-CPXMP3PL.js";
3
3
  import { jsx as t } from "react/jsx-runtime";
4
4
  //#region src/views/cc/CcView.tsx
5
5
  function n() {
@@ -1,2 +1,2 @@
1
- "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/dashboard-page-CH87L5nx.cjs");let t=require("react/jsx-runtime");function n(){return(0,t.jsx)(e.t,{})}exports.DashboardView=n;
1
+ "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/dashboard-page-DooFJsxM.cjs");let t=require("react/jsx-runtime");function n(){return(0,t.jsx)(e.t,{})}exports.DashboardView=n;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { t as e } from "../../chunks/dashboard-page-DJ9vOPga.js";
2
+ import { t as e } from "../../chunks/dashboard-page-CeCLV1tp.js";
3
3
  import { jsx as t } from "react/jsx-runtime";
4
4
  //#region src/views/dashboard/DashboardView.tsx
5
5
  function n() {
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/delegations-vpLtus9g.cjs");exports.DelegationsView=e.t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/delegations-8LsxcQM4.cjs");exports.DelegationsView=e.t;
@@ -1,2 +1,2 @@
1
- import { t as e } from "../../chunks/delegations-DyMGIDpp.js";
1
+ import { t as e } from "../../chunks/delegations-DRupxJ4_.js";
2
2
  export { e as DelegationsView };
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/FormBuilderView-CLFlfDGe.cjs");exports.FormBuilderView=e.t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/FormBuilderView-VmdPVbg7.cjs");exports.FormBuilderView=e.t;
@@ -1,2 +1,2 @@
1
- import { t as e } from "../../../chunks/FormBuilderView-D4xIuPYB.js";
1
+ import { t as e } from "../../../chunks/FormBuilderView-BYLN6W-P.js";
2
2
  export { e as FormBuilderView };
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/FormRendererView-BxGT16z0.cjs");exports.FormRenderer=e.t,exports.FormRendererView=e.t,exports.isFormDataSourceFieldSubmissionBlocked=e.n,exports.readFormDataSourceFieldStatusMessage=e.r,exports.readFormDataSourceSubmissionBlockMessage=e.i,exports.useFormDataSourceField=e.a;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/FormRendererView-Bs8lTb4k.cjs");exports.FormRenderer=e.t,exports.FormRendererView=e.t,exports.isFormDataSourceFieldSubmissionBlocked=e.n,exports.readFormDataSourceFieldStatusMessage=e.r,exports.readFormDataSourceSubmissionBlockMessage=e.i,exports.useFormDataSourceField=e.a;
@@ -1,2 +1,2 @@
1
- import { a as e, i as t, n, r, t as i } from "../../../chunks/FormRendererView-DUceSOXe.js";
1
+ import { a as e, i as t, n, r, t as i } from "../../../chunks/FormRendererView-UPowZZgw.js";
2
2
  export { i as FormRenderer, i as FormRendererView, n as isFormDataSourceFieldSubmissionBlocked, r as readFormDataSourceFieldStatusMessage, t as readFormDataSourceSubmissionBlockMessage, e as useFormDataSourceField };
@@ -1,2 +1,2 @@
1
- "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/rolldown-runtime-BocRIvOZ.cjs"),t=require("../../chunks/router-adapter--gYs13E8.cjs"),n=require("../../chunks/auth-provider-4BeCw7cI.cjs"),r=require("../../chunks/format-date-time-D-cx5M8z.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;
1
+ "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/rolldown-runtime-BocRIvOZ.cjs"),t=require("../../chunks/router-adapter--gYs13E8.cjs"),n=require("../../chunks/auth-provider-4BeCw7cI.cjs"),r=require("../../chunks/format-date-time-D-cx5M8z.cjs"),i=require("../../chunks/routes-config-C1j_vFKo.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-RBYQtUd0.js";
5
+ import { r } from "../../chunks/routes-config-yZbESPlw.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";
@@ -12,6 +12,11 @@ export interface InstanceDetailViewProps {
12
12
  readonly showSignatures?: boolean;
13
13
  /** Show the history section (default: true). */
14
14
  readonly showHistory?: boolean;
15
+ /**
16
+ * Show the notify-node webhook deliveries section (default: true). Only
17
+ * administrators ever see it, and only when the instance queued any.
18
+ */
19
+ readonly showWebhookDeliveries?: boolean;
15
20
  }
16
21
  /**
17
22
  * Framework-agnostic view for the BPM approval instance detail page.
@@ -19,4 +24,4 @@ export interface InstanceDetailViewProps {
19
24
  * `instanceId` is provided by the host page wrapper (typically resolved
20
25
  * from `params.id` in the Next.js Server Component shim).
21
26
  */
22
- export declare function InstanceDetailView({ instanceId, showAttachments, showForm, showHistory, showSignatures, showTasks, }: InstanceDetailViewProps): ReactElement;
27
+ export declare function InstanceDetailView({ instanceId, showAttachments, showForm, showHistory, showSignatures, showTasks, showWebhookDeliveries, }: InstanceDetailViewProps): ReactElement;
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/detail-Dnz5aaI-.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
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/detail-Db-UOELp.cjs");exports.InstanceAttachmentsSection=e.o,exports.InstanceDetailView=e.t,exports.InstanceFormSection=e.s,exports.InstanceHistorySection=e.r,exports.InstanceSignaturesSection=e.i,exports.InstanceTasksSection=e.a,exports.InstanceWebhookDeliveriesSection=e.n;
@@ -4,3 +4,4 @@ export * from './sections/InstanceAttachmentsSection';
4
4
  export * from './sections/InstanceTasksSection';
5
5
  export * from './sections/InstanceSignaturesSection';
6
6
  export * from './sections/InstanceHistorySection';
7
+ export * from './sections/InstanceWebhookDeliveriesSection';
@@ -1,2 +1,2 @@
1
- import { a as e, i as t, n, o as r, r as i, t as a } from "../../../chunks/detail-BgKgMvYx.js";
2
- export { e as InstanceAttachmentsSection, a as InstanceDetailView, r as InstanceFormSection, n as InstanceHistorySection, i as InstanceSignaturesSection, t as InstanceTasksSection };
1
+ import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "../../../chunks/detail-pYEIk-jW.js";
2
+ export { r as InstanceAttachmentsSection, o as InstanceDetailView, a as InstanceFormSection, i as InstanceHistorySection, t as InstanceSignaturesSection, e as InstanceTasksSection, n as InstanceWebhookDeliveriesSection };
@@ -0,0 +1,20 @@
1
+ import { ReactElement } from 'react';
2
+ import { WorkflowWebhookDeliveryRecord } from '@rytass/bpm-core-client/workflow';
3
+ export interface InstanceWebhookDeliveriesSectionProps {
4
+ /** The instance's notify-node webhook deliveries, oldest first. */
5
+ readonly deliveries: readonly WorkflowWebhookDeliveryRecord[];
6
+ /** Resolves a node id to the label shown to the reader. */
7
+ readonly readNodeLabel: (nodeId: string) => string;
8
+ /**
9
+ * Re-queues a `FAILED` delivery. A rejection is shown in the section, so
10
+ * the caller only needs to refresh what it displays on success.
11
+ */
12
+ readonly onRetry: (delivery: WorkflowWebhookDeliveryRecord) => Promise<void>;
13
+ }
14
+ /**
15
+ * Administrator-only view of the webhooks this instance's notify nodes sent
16
+ * (ADR 18 §3.10): where each delivery stands, how many attempts it took, the
17
+ * last error, and a retry for the ones that gave up. Carries no URL or
18
+ * payload — the server never sends them to the browser.
19
+ */
20
+ export declare function InstanceWebhookDeliveriesSection({ deliveries, onRetry, readNodeLabel, }: InstanceWebhookDeliveriesSectionProps): ReactElement;
@@ -31,15 +31,23 @@ export type MemberOption = Readonly<{
31
31
  export type ActivityStepDescriptionPart = Readonly<{
32
32
  text: string;
33
33
  type: 'text';
34
- }> | Readonly<{
35
- text: string;
36
- type: 'dangerText';
37
34
  }> | Readonly<{
38
35
  email: string | null;
39
36
  label: string;
40
37
  memberId: string | null;
41
38
  prefix: string;
42
39
  type: 'member';
40
+ }>
41
+ /**
42
+ * What an approver actually wrote. Kept apart from the `text` parts so the
43
+ * timeline can give it its own line instead of burying it mid-sentence
44
+ * between the node, the actor, the timestamp and the signature hash.
45
+ */
46
+ | Readonly<{
47
+ label: string;
48
+ text: string;
49
+ tone: 'danger' | 'neutral';
50
+ type: 'comment';
43
51
  }>;
44
52
  export interface ActivityStepRecord {
45
53
  readonly descriptionParts: readonly ActivityStepDescriptionPart[];
@@ -77,10 +85,35 @@ export declare function readReturnTargetOptions(workflow: WorkflowDefinition, no
77
85
  readonly name: string;
78
86
  }[];
79
87
  export declare function readMemberOption(profile: MemberProfileRecord): MemberOption;
88
+ /**
89
+ * The target an ad-hoc directive is sent to, or the reason it cannot be built
90
+ * yet. Kept out of the component so the "which shape do we send" decision is
91
+ * testable on its own — it is the part that changed when the member picker
92
+ * went from one selection to many.
93
+ */
94
+ export type AdhocTargetDraft = Readonly<{
95
+ target: Readonly<{
96
+ kind: 'MEMBER';
97
+ memberIds: readonly string[];
98
+ }> | Readonly<{
99
+ kind: 'WEBHOOK';
100
+ webhookUrl: string;
101
+ }>;
102
+ valid: true;
103
+ }> | Readonly<{
104
+ error: string;
105
+ valid: false;
106
+ }>;
107
+ export declare function readAdhocTargetDraft({ memberIds, useWebhookTarget, webhookUrl, }: {
108
+ readonly memberIds: readonly string[];
109
+ readonly useWebhookTarget: boolean;
110
+ readonly webhookUrl: string;
111
+ }): AdhocTargetDraft;
112
+ export declare function isPresentMemberOption(option: MemberOption | null): option is MemberOption;
80
113
  export declare function readMemberOptionFromValue(value: unknown): MemberOption | null;
81
114
  export declare function readUniqueMemberOption(searchText: string, options: readonly MemberOption[]): MemberOption | null;
82
115
  export declare function readTextDescriptionPart(text: string | null): ActivityStepDescriptionPart | null;
83
- export declare function readDangerTextDescriptionPart(text: string | null): ActivityStepDescriptionPart | null;
116
+ export declare function readCommentDescriptionPart(label: string, text: string | null, tone?: 'danger' | 'neutral'): ActivityStepDescriptionPart | null;
84
117
  export declare function readMemberDescriptionPart(prefix: string, memberId: string | null, memberProfilesById: ReadonlyMap<string, MemberProfileRecord>, fallbackLabel: string): ActivityStepDescriptionPart;
85
118
  export declare function isActivityDescriptionPart(part: ActivityStepDescriptionPart | null): part is ActivityStepDescriptionPart;
86
119
  export declare function readCurrentActivityStep(activitySteps: readonly ActivityStepRecord[]): number;
@@ -1,2 +1,2 @@
1
- "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/rolldown-runtime-BocRIvOZ.cjs"),t=require("../../../chunks/router-adapter--gYs13E8.cjs"),n=require("../../../chunks/auth-provider-4BeCw7cI.cjs"),r=require("../../../chunks/format-date-time-D-cx5M8z.cjs"),i=require("../../../chunks/routes-config-fDVHmvXi.cjs"),a=require("../../../chunks/FormRendererView-BxGT16z0.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),[P,F]=(0,o.useState)({}),I=(0,o.useCallback)((e,t)=>{F(n=>{let r=n[e];return r?.hasValue===t.hasValue&&r.status===t.status?n:{...n,[e]:{hasValue:t.hasValue,status:t.status}}})},[]);(0,o.useEffect)(()=>{if(!y){B();return}V(y)},[y]);let L=(0,o.useMemo)(()=>w.map(e=>({...e,key:e.id,updatedAt:r.t(e.updatedAt),versionLabel:`v${e.version}`})),[w]),R=(0,o.useMemo)(()=>[{dataIndex:`name`,key:`name`,title:`模板名稱`,width:240},{dataIndex:`versionLabel`,key:`versionLabel`,title:`發布版本`,width:120},{dataIndex:`updatedAt`,key:`updatedAt`,title:`更新時間`,width:220}],[]),z=(0,o.useMemo)(()=>({render:e=>[{name:`發起`,onClick:()=>m.push(h.caseNew(e.id)),variant:`base-primary`}],variant:`base-secondary`,width:88}),[m]);async function B(){j(!0),D(null),x(null),F({});try{T(await(0,l.listLaunchableTemplates)())}catch(e){D(_(e))}finally{j(!1)}}async function V(e){j(!0),D(null),T([]),F({});try{x(await(0,l.readLaunchContext)(e))}catch(e){D(_(e))}finally{j(!1)}}async function H(){if(!b||!v)return;N(!0),D(null),k({});let e=a.i(Object.values(P));if(e){D(e),N(!1);return}let t=(0,f.buildFormRendererValues)(b.formVersion.schema.fields,S),n=(0,f.validateFormRendererValues)({schema:b.formVersion.schema,uiSchema:b.formVersion.uiSchema,values:t});if(!n.valid){k(n.errors),D(`請先補齊必填欄位。`),n.firstInvalidFieldKey&&(0,f.focusFormRendererField)(n.firstInvalidFieldKey),N(!1);return}try{let e=await(0,l.submitApprovalInstance)({formData:t,initiatorMemberId:v,templateId:b.template.id,title:(0,l.readFormDataCaseTitle)({fallbackTitle:b.template.name,formData:t,schema:b.formVersion.schema,uiSchema:b.formVersion.uiSchema})});m.push(h.caseDetail(e))}catch(e){D(_(e))}finally{N(!1)}}async function U(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:H,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,{dataSourceContext:{kind:`runtime`,templateId:b.template.id},errors:O,maxWidth:480,onChange:e=>{C(e),k({})},onDataSourceStateChange:I,onUploadAttachment:U,schema:b.formVersion.schema,singleColumn:!0,uiSchema:b.formVersion.uiSchema,value:S}):null,!y&&!A?L.length>0?(0,c.jsx)(s.Table,{actions:z,columns:R,dataSource:L,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(0,f.readFormDataSourceErrorMessage)(e)||(e instanceof Error?e.message:`發生未知錯誤`)}exports.InstanceNewView=m;
1
+ "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/rolldown-runtime-BocRIvOZ.cjs"),t=require("../../../chunks/router-adapter--gYs13E8.cjs"),n=require("../../../chunks/auth-provider-4BeCw7cI.cjs"),r=require("../../../chunks/format-date-time-D-cx5M8z.cjs"),i=require("../../../chunks/routes-config-C1j_vFKo.cjs"),a=require("../../../chunks/FormRendererView-Bs8lTb4k.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),[P,F]=(0,o.useState)({}),I=(0,o.useCallback)((e,t)=>{F(n=>{let r=n[e];return r?.hasValue===t.hasValue&&r.status===t.status?n:{...n,[e]:{hasValue:t.hasValue,status:t.status}}})},[]);(0,o.useEffect)(()=>{if(!y){B();return}V(y)},[y]);let L=(0,o.useMemo)(()=>w.map(e=>({...e,key:e.id,updatedAt:r.t(e.updatedAt),versionLabel:`v${e.version}`})),[w]),R=(0,o.useMemo)(()=>[{dataIndex:`name`,key:`name`,title:`模板名稱`,width:240},{dataIndex:`versionLabel`,key:`versionLabel`,title:`發布版本`,width:120},{dataIndex:`updatedAt`,key:`updatedAt`,title:`更新時間`,width:220}],[]),z=(0,o.useMemo)(()=>({render:e=>[{name:`發起`,onClick:()=>m.push(h.caseNew(e.id)),variant:`base-primary`}],variant:`base-secondary`,width:88}),[m]);async function B(){j(!0),D(null),x(null),F({});try{T(await(0,l.listLaunchableTemplates)())}catch(e){D(_(e))}finally{j(!1)}}async function V(e){j(!0),D(null),T([]),F({});try{x(await(0,l.readLaunchContext)(e))}catch(e){D(_(e))}finally{j(!1)}}async function H(){if(!b||!v)return;N(!0),D(null),k({});let e=a.i(Object.values(P));if(e){D(e),N(!1);return}let t=(0,f.buildFormRendererValues)(b.formVersion.schema.fields,S),n=(0,f.validateFormRendererValues)({schema:b.formVersion.schema,uiSchema:b.formVersion.uiSchema,values:t});if(!n.valid){k(n.errors),D(`請先補齊必填欄位。`),n.firstInvalidFieldKey&&(0,f.focusFormRendererField)(n.firstInvalidFieldKey),N(!1);return}try{let e=await(0,l.submitApprovalInstance)({formData:t,initiatorMemberId:v,templateId:b.template.id,title:(0,l.readFormDataCaseTitle)({fallbackTitle:b.template.name,formData:t,schema:b.formVersion.schema,uiSchema:b.formVersion.uiSchema})});m.push(h.caseDetail(e))}catch(e){D(_(e))}finally{N(!1)}}async function U(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:H,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,{dataSourceContext:{kind:`runtime`,templateId:b.template.id},errors:O,maxWidth:480,onChange:e=>{C(e),k({})},onDataSourceStateChange:I,onUploadAttachment:U,schema:b.formVersion.schema,singleColumn:!0,uiSchema:b.formVersion.uiSchema,value:S}):null,!y&&!A?L.length>0?(0,c.jsx)(s.Table,{actions:z,columns:R,dataSource:L,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(0,f.readFormDataSourceErrorMessage)(e)||(e instanceof Error?e.message:`發生未知錯誤`)}exports.InstanceNewView=m;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -2,8 +2,8 @@
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-RBYQtUd0.js";
6
- import { i, t as a } from "../../../chunks/FormRendererView-DUceSOXe.js";
5
+ import { r } from "../../../chunks/routes-config-yZbESPlw.js";
6
+ import { i, t as a } from "../../../chunks/FormRendererView-UPowZZgw.js";
7
7
  import { Suspense as o, useCallback as ee, useEffect as s, useMemo as c, useState as l } from "react";
8
8
  import { Button as u, PageHeader as d, Section as f, SectionGroup as p, Table as m, Typography as h } from "@mezzanine-ui/react";
9
9
  import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/login-9bCXyjbX.cjs");exports.LoginView=e.t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/login-AtVxZBsC.cjs");exports.LoginView=e.t;
@@ -1,2 +1,2 @@
1
- import { t as e } from "../../chunks/login-BKxpLibd.js";
1
+ import { t as e } from "../../chunks/login-C6qlTC6F.js";
2
2
  export { e as LoginView };
@@ -1,2 +1,2 @@
1
- "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/approval-instance-list-page-CWiQvnfE.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-ax0pm8bt.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-BjX2kaoF.js";
2
+ import { t as e } from "../../chunks/approval-instance-list-page-CPXMP3PL.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-CWiQvnfE.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-ax0pm8bt.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-BjX2kaoF.js";
2
+ import { t as e } from "../../chunks/approval-instance-list-page-CPXMP3PL.js";
3
3
  import { jsx as t } from "react/jsx-runtime";
4
4
  //#region src/views/sent/SentView.tsx
5
5
  function n() {
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/compose-DzRYZcqe.cjs");exports.EMPTY_COMPOSE_FORM_SCHEMA=e.n,exports.EMPTY_COMPOSE_FORM_UI_SCHEMA=e.r,exports.TemplateComposeWizardView=e.t,exports.useTemplateComposeWizard=e.i;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/compose-BnSRL4ml.cjs");exports.EMPTY_COMPOSE_FORM_SCHEMA=e.n,exports.EMPTY_COMPOSE_FORM_UI_SCHEMA=e.r,exports.TemplateComposeWizardView=e.t,exports.useTemplateComposeWizard=e.i;
@@ -1,2 +1,2 @@
1
- import { i as e, n as t, r as n, t as r } from "../../../chunks/compose-Bb-REfoB.js";
1
+ import { i as e, n as t, r as n, t as r } from "../../../chunks/compose-6P64PO1i.js";
2
2
  export { t as EMPTY_COMPOSE_FORM_SCHEMA, n as EMPTY_COMPOSE_FORM_UI_SCHEMA, r as TemplateComposeWizardView, e as useTemplateComposeWizard };
@@ -0,0 +1,20 @@
1
+ import { ReactElement } from 'react';
2
+ import { FormFieldDefinition } from '@rytass/bpm-core-shared/form';
3
+ import { NotifyWebhookTarget } from '@rytass/bpm-core-shared/workflow';
4
+ import { NotifyWebhookDesignerEndpoint } from './notify-webhook-designer';
5
+ export type NotifyWebhookCatalogState = 'loading' | 'ready' | 'unavailable';
6
+ export interface NotifyWebhookTargetsEditorProps {
7
+ /** Every endpoint the catalog lists, deprecated ones included. */
8
+ readonly catalog: readonly NotifyWebhookDesignerEndpoint[];
9
+ readonly catalogState: NotifyWebhookCatalogState;
10
+ /** `null` when no form is bound yet, so fields cannot be picked. */
11
+ readonly formFields: readonly FormFieldDefinition[] | null;
12
+ readonly onChange: (targets: readonly NotifyWebhookTarget[]) => void;
13
+ readonly targets: readonly NotifyWebhookTarget[];
14
+ }
15
+ /**
16
+ * Edits a NOTIFY node's webhook targets (ADR 18 §3.3). Parameters come from
17
+ * the endpoint catalog, so the author only picks an endpoint and binds each
18
+ * parameter; a URL, header or secret is never shown or entered here.
19
+ */
20
+ export declare function NotifyWebhookTargetsEditor({ catalog, catalogState, formFields, onChange, targets, }: NotifyWebhookTargetsEditorProps): ReactElement | null;
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/designer-gFUdImeZ.cjs");exports.TemplateDesignerView=e.t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/designer-_g58R6rQ.cjs");exports.TemplateDesignerView=e.t;
@@ -1,2 +1,2 @@
1
- import { t as e } from "../../../chunks/designer-C6oIO9Kq.js";
1
+ import { t as e } from "../../../chunks/designer-C3s2kSna.js";
2
2
  export { e as TemplateDesignerView };
@@ -0,0 +1,74 @@
1
+ import { FormFieldDefinition } from '@rytass/bpm-core-shared/form';
2
+ import { NotifyWebhookBindingSource, NotifyWebhookContextPath, NotifyWebhookParameterType, NotifyWebhookTarget, WorkflowDefinition } from '@rytass/bpm-core-shared/workflow';
3
+ import { NotifyWebhookEndpointContract } from '@rytass/bpm-core-shared/workflow-graph';
4
+ export type NotifyWebhookBindingKind = NotifyWebhookBindingSource['kind'];
5
+ /** The catalog fields the designer reads; a subset of the client record. */
6
+ export interface NotifyWebhookDesignerEndpoint extends NotifyWebhookEndpointContract {
7
+ readonly deprecated: boolean;
8
+ readonly description: string | null;
9
+ /** Switched off by an administrator (database endpoints). */
10
+ readonly disabled?: boolean;
11
+ readonly key: string;
12
+ readonly label: string;
13
+ readonly parameters: readonly {
14
+ readonly description: string | null;
15
+ readonly key: string;
16
+ readonly label: string;
17
+ readonly required: boolean;
18
+ readonly type: NotifyWebhookParameterType;
19
+ }[];
20
+ /** `DATABASE` endpoints are maintained in the back office. */
21
+ readonly source?: 'DATABASE' | 'REGISTRY';
22
+ readonly version: number;
23
+ }
24
+ type DesignerParameter = NotifyWebhookDesignerEndpoint['parameters'][number];
25
+ export declare const NOTIFY_WEBHOOK_CONTEXT_PATH_LABELS: Readonly<Record<NotifyWebhookContextPath, string>>;
26
+ export declare const NOTIFY_WEBHOOK_PARAMETER_TYPE_LABELS: Readonly<Record<NotifyWebhookParameterType, string>>;
27
+ export declare function readNotifyWebhookEndpointOptionId(endpoint: {
28
+ readonly key: string;
29
+ readonly version: number;
30
+ }): string;
31
+ export declare function findNotifyWebhookEndpoint(endpoints: readonly NotifyWebhookDesignerEndpoint[], reference: {
32
+ readonly key: string;
33
+ readonly version: number;
34
+ }): NotifyWebhookDesignerEndpoint | null;
35
+ /**
36
+ * The sources a parameter can take. A `CONTEXT` path is always a string, and
37
+ * a `CONSTANT` cannot hold a list, so those are only offered where they fit.
38
+ */
39
+ export declare function readNotifyWebhookBindingKinds(type: NotifyWebhookParameterType): readonly NotifyWebhookBindingKind[];
40
+ export declare function readCompatibleFormFields(formFields: readonly FormFieldDefinition[], type: NotifyWebhookParameterType): readonly FormFieldDefinition[];
41
+ /** The value a binding starts with when its source kind is picked. */
42
+ export declare function createNotifyWebhookBindingSource(kind: NotifyWebhookBindingKind, parameter: DesignerParameter, formFields: readonly FormFieldDefinition[]): NotifyWebhookBindingSource;
43
+ /**
44
+ * Reads a typed constant from a text input. A number parameter takes plain
45
+ * decimals only (no `0x1f`, no exponent); anything else, including a number
46
+ * still being typed such as `1.`, stays text so the publish check can point
47
+ * at it instead of the input silently changing what was typed.
48
+ */
49
+ export declare function readNotifyWebhookConstantValue(type: NotifyWebhookParameterType, raw: string): boolean | number | string | null;
50
+ /**
51
+ * Whether the editor can render a node's `webhooks` at all. Parsed JSON is
52
+ * saved as a draft without the structural lint, so a hand-edited list may
53
+ * hold values the editor would throw on.
54
+ */
55
+ export declare function isNotifyWebhookListEditable(webhooks: unknown): boolean;
56
+ /** Sets, or with `null` removes, the binding for one parameter. */
57
+ export declare function setNotifyWebhookBinding(target: NotifyWebhookTarget, parameter: string, from: NotifyWebhookBindingSource | null): NotifyWebhookTarget;
58
+ /**
59
+ * Points a target at another endpoint, keeping the id (deliveries are keyed
60
+ * by it) and every binding whose parameter the new endpoint still declares
61
+ * with a type the bound value fits.
62
+ */
63
+ export declare function switchNotifyWebhookEndpoint(target: NotifyWebhookTarget, endpoint: NotifyWebhookDesignerEndpoint, formFields: readonly FormFieldDefinition[]): NotifyWebhookTarget;
64
+ /**
65
+ * The publish check the backend runs against the catalog, worded for the
66
+ * designer. Only structurally valid targets are checked; shape problems are
67
+ * already reported by the shared structural lint.
68
+ */
69
+ export declare function readNotifyWebhookDesignerIssues({ definition, endpoints, formFields, }: {
70
+ readonly definition: WorkflowDefinition;
71
+ readonly endpoints: readonly NotifyWebhookDesignerEndpoint[];
72
+ readonly formFields: readonly FormFieldDefinition[];
73
+ }): readonly string[];
74
+ export {};
@@ -1,2 +1,2 @@
1
- "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/rolldown-runtime-BocRIvOZ.cjs"),t=require("../../chunks/router-adapter--gYs13E8.cjs"),n=require("../../chunks/format-date-time-D-cx5M8z.cjs"),r=require("../../chunks/routes-config-fDVHmvXi.cjs"),i=require("../../chunks/categories-Yid05WAX.cjs"),a=require("./versions/index.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/core/form"),d=require("@mezzanine-ui/react/ContentHeader");d=e.t(d,1);let f=require("@mezzanine-ui/icons"),p=require("@rytass/bpm-core-client/template");var m=[10,20,50],h=[{key:`ALL`,label:`全部`},{key:`PUBLISHED`,label:`已發布`},{key:`DRAFT`,label:`草稿`}],g=100;function _(){let e=t.r(),a=r.r(),[_,O]=(0,o.useState)([]),[k,A]=(0,o.useState)(C),[j,M]=(0,o.useState)([]),[N,P]=(0,o.useState)(new Set),[F,I]=(0,o.useState)(null),[L,R]=(0,o.useState)(!0),[z,B]=(0,o.useState)(1),[V,H]=(0,o.useState)(10),[U,W]=(0,o.useState)(``),[G,K]=(0,o.useState)(`ALL`),[q,J]=(0,o.useState)(0),[Y,X]=(0,o.useState)(null),Z=(0,o.useRef)(0),Q=(0,o.useCallback)(async()=>{let e=Z.current+1;Z.current=e,R(!0),I(null),P(new Set),(0,l.listLaunchableTemplates)().then(t=>{e===Z.current&&P(new Set(t.map(e=>e.id)))}).catch(()=>{e===Z.current&&P(new Set)});try{let[t,n]=await Promise.all([(0,p.listApprovalTemplatesPage)({categoryId:k.categoryId,page:z,pageSize:V,searchText:U,status:G===`ALL`?null:G}),(0,p.listApprovalTemplateCategoriesPage)({page:1,pageSize:g,searchText:``,status:`ACTIVE`})]);if(e!==Z.current)return;M([...n.categories.map(w)]),O(t.templates),J(t.totalCount)}catch(t){e===Z.current&&I(v(t))}finally{e===Z.current&&R(!1)}},[k,z,V,U,G]);(0,o.useEffect)(()=>{Q()},[Q]);let $=(0,o.useCallback)(async e=>{X(e.id),I(null);try{await(e.isActive?(0,p.deactivateApprovalTemplate)(e.id):(0,p.activateApprovalTemplate)(e.id)),await Q()}catch(e){I(v(e))}finally{X(null)}},[Q]),ee=(0,o.useMemo)(()=>_.map(e=>({...e,categoryLabel:D(e),key:e.id,status:e.currentVersionId?`PUBLISHED`:`DRAFT`,updatedAt:n.t(e.updatedAt)})),[_]),te=(0,o.useMemo)(()=>[{dataIndex:`name`,key:`name`,title:`模板名稱`,width:220},{key:`status`,render:e=>(0,c.jsx)(b,{status:e.status}),title:`狀態`,width:120},{key:`isActive`,render:e=>(0,c.jsx)(x,{isActive:e.isActive}),title:`服務狀態`,width:120},{key:`category`,render:e=>(0,c.jsx)(S,{record:e}),title:`分類`,width:160},{dataIndex:`updatedAt`,key:`updatedAt`,title:`更新時間`,width:220}],[]),ne=(0,o.useMemo)(()=>({render:t=>[{disabled:e=>!N.has(e.id),name:`發起`,onClick:()=>e.push(a.caseNew(t.id)),variant:`base-primary`},{name:`設計`,onClick:()=>e.push(a.templateDesigner(t.id))},{name:`版本`,onClick:()=>e.push(a.templateVersions(t.id))},{disabled:e=>Y===e.id,name:t.isActive?`停用`:`啟用`,onClick:e=>{$(e)},variant:t.isActive?`destructive-secondary`:`base-secondary`}],variant:`base-secondary`,width:264}),[Y,N,e,$]);return(0,c.jsx)(c.Fragment,{children:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.PageHeader,{children:(0,c.jsx)(d.default,{description:`建立流程模板、維護草稿與發布版本。`,title:`簽核模板`,children:(0,c.jsx)(s.Button,{icon:f.PlusIcon,iconType:`leading`,onClick:()=>e.push(a.templateCompose()),variant:`base-primary`,children:`建立模板`})})}),(0,c.jsx)(s.SectionGroup,{children:(0,c.jsxs)(s.Section,{filterArea:(0,c.jsx)(s.FilterArea,{className:i.n.templateFilterArea,size:`sub`,children:(0,c.jsxs)(s.FilterLine,{children:[(0,c.jsx)(s.Filter,{span:3,children:(0,c.jsx)(s.FormField,{fullWidth:!0,layout:u.FormFieldLayout.VERTICAL,name:`templateSearchText`,children:(0,c.jsx)(s.Input,{fullWidth:!0,onChange:e=>{W(e.target.value),B(1)},placeholder:`關鍵字:搜尋模板名稱、分類或描述`,size:`sub`,value:U,variant:`base`})})}),(0,c.jsx)(s.Filter,{span:2,children:(0,c.jsx)(s.FormField,{fullWidth:!0,layout:u.FormFieldLayout.VERTICAL,name:`templateCategoryFilter`,children:(0,c.jsx)(s.Select,{clearable:!1,fullWidth:!0,onChange:e=>{A(T(e,j)),B(1)},options:[C,...j],placeholder:`分類`,renderValue:e=>`分類:${E(e)}`,size:`sub`,value:k})})})]})}),tab:(0,c.jsx)(s.Tab,{activeKey:G,onChange:e=>{K(y(e)),B(1)},children:h.map(e=>(0,c.jsx)(s.TabItem,{children:e.label},e.key))}),children:[F?(0,c.jsx)(s.Typography,{color:`text-error`,variant:`body`,children:F}):null,(0,c.jsx)(s.Table,{actions:ne,columns:te,dataSource:ee,fullWidth:!0,loading:L,pagination:{current:z,onChange:e=>{B(e)},onChangePageSize:e=>{B(1),H(e)},pageSize:V,pageSizeLabel:`每頁筆數`,pageSizeOptions:m,renderResultSummary:(e,t,n)=>`顯示 ${e}-${t} 筆,共 ${n} 筆`,showPageSizeOptions:!0,total:q}})]})})]})})}function v(e){return e instanceof Error?e.message:`發生未知錯誤`}function y(e){return e===`PUBLISHED`||e===`DRAFT`?e:`ALL`}function b({status:e}){return e===`PUBLISHED`?(0,c.jsx)(s.Badge,{size:`sub`,text:`已發布`,variant:`dot-success`}):(0,c.jsx)(s.Badge,{size:`sub`,text:`草稿`,variant:`dot-inactive`})}function x({isActive:e}){return e?(0,c.jsx)(s.Badge,{size:`sub`,text:`啟用中`,variant:`dot-success`}):(0,c.jsx)(s.Badge,{size:`sub`,text:`已停用`,variant:`dot-inactive`})}function S({record:e}){return e.categoryDetail?.isActive===!1?(0,c.jsx)(s.Badge,{size:`sub`,text:`${e.categoryLabel}(停用)`,variant:`dot-inactive`}):(0,c.jsx)(s.Typography,{component:`span`,variant:`body`,children:e.categoryLabel})}var C={categoryId:null,id:`ALL_CATEGORIES`,name:`全部分類`};function w(e){return{categoryId:e.id,id:e.id,name:e.name}}function T(e,t){if(!O(e))return C;let n=typeof e.id==`string`?e.id:null;return n===C.id?C:t.find(e=>e.id===n)??C}function E(e){return Array.isArray(e)||!O(e)?C.name:typeof e.name==`string`?e.name:C.name}function D(e){return e.categoryDetail?.name??e.category??`未分類`}function O(e){return typeof e==`object`&&!!e}exports.TemplateCategoriesView=i.t,exports.TemplateVersionsView=a.TemplateVersionsView,exports.TemplatesView=_;
1
+ "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/rolldown-runtime-BocRIvOZ.cjs"),t=require("../../chunks/router-adapter--gYs13E8.cjs"),n=require("../../chunks/format-date-time-D-cx5M8z.cjs"),r=require("../../chunks/routes-config-C1j_vFKo.cjs"),i=require("../../chunks/categories-Yid05WAX.cjs"),a=require("./versions/index.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/core/form"),d=require("@mezzanine-ui/react/ContentHeader");d=e.t(d,1);let f=require("@mezzanine-ui/icons"),p=require("@rytass/bpm-core-client/template");var m=[10,20,50],h=[{key:`ALL`,label:`全部`},{key:`PUBLISHED`,label:`已發布`},{key:`DRAFT`,label:`草稿`}],g=100;function _(){let e=t.r(),a=r.r(),[_,O]=(0,o.useState)([]),[k,A]=(0,o.useState)(C),[j,M]=(0,o.useState)([]),[N,P]=(0,o.useState)(new Set),[F,I]=(0,o.useState)(null),[L,R]=(0,o.useState)(!0),[z,B]=(0,o.useState)(1),[V,H]=(0,o.useState)(10),[U,W]=(0,o.useState)(``),[G,K]=(0,o.useState)(`ALL`),[q,J]=(0,o.useState)(0),[Y,X]=(0,o.useState)(null),Z=(0,o.useRef)(0),Q=(0,o.useCallback)(async()=>{let e=Z.current+1;Z.current=e,R(!0),I(null),P(new Set),(0,l.listLaunchableTemplates)().then(t=>{e===Z.current&&P(new Set(t.map(e=>e.id)))}).catch(()=>{e===Z.current&&P(new Set)});try{let[t,n]=await Promise.all([(0,p.listApprovalTemplatesPage)({categoryId:k.categoryId,page:z,pageSize:V,searchText:U,status:G===`ALL`?null:G}),(0,p.listApprovalTemplateCategoriesPage)({page:1,pageSize:g,searchText:``,status:`ACTIVE`})]);if(e!==Z.current)return;M([...n.categories.map(w)]),O(t.templates),J(t.totalCount)}catch(t){e===Z.current&&I(v(t))}finally{e===Z.current&&R(!1)}},[k,z,V,U,G]);(0,o.useEffect)(()=>{Q()},[Q]);let $=(0,o.useCallback)(async e=>{X(e.id),I(null);try{await(e.isActive?(0,p.deactivateApprovalTemplate)(e.id):(0,p.activateApprovalTemplate)(e.id)),await Q()}catch(e){I(v(e))}finally{X(null)}},[Q]),ee=(0,o.useMemo)(()=>_.map(e=>({...e,categoryLabel:D(e),key:e.id,status:e.currentVersionId?`PUBLISHED`:`DRAFT`,updatedAt:n.t(e.updatedAt)})),[_]),te=(0,o.useMemo)(()=>[{dataIndex:`name`,key:`name`,title:`模板名稱`,width:220},{key:`status`,render:e=>(0,c.jsx)(b,{status:e.status}),title:`狀態`,width:120},{key:`isActive`,render:e=>(0,c.jsx)(x,{isActive:e.isActive}),title:`服務狀態`,width:120},{key:`category`,render:e=>(0,c.jsx)(S,{record:e}),title:`分類`,width:160},{dataIndex:`updatedAt`,key:`updatedAt`,title:`更新時間`,width:220}],[]),ne=(0,o.useMemo)(()=>({render:t=>[{disabled:e=>!N.has(e.id),name:`發起`,onClick:()=>e.push(a.caseNew(t.id)),variant:`base-primary`},{name:`設計`,onClick:()=>e.push(a.templateDesigner(t.id))},{name:`版本`,onClick:()=>e.push(a.templateVersions(t.id))},{disabled:e=>Y===e.id,name:t.isActive?`停用`:`啟用`,onClick:e=>{$(e)},variant:t.isActive?`destructive-secondary`:`base-secondary`}],variant:`base-secondary`,width:264}),[Y,N,e,$]);return(0,c.jsx)(c.Fragment,{children:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.PageHeader,{children:(0,c.jsx)(d.default,{description:`建立流程模板、維護草稿與發布版本。`,title:`簽核模板`,children:(0,c.jsx)(s.Button,{icon:f.PlusIcon,iconType:`leading`,onClick:()=>e.push(a.templateCompose()),variant:`base-primary`,children:`建立模板`})})}),(0,c.jsx)(s.SectionGroup,{children:(0,c.jsxs)(s.Section,{filterArea:(0,c.jsx)(s.FilterArea,{className:i.n.templateFilterArea,size:`sub`,children:(0,c.jsxs)(s.FilterLine,{children:[(0,c.jsx)(s.Filter,{span:3,children:(0,c.jsx)(s.FormField,{fullWidth:!0,layout:u.FormFieldLayout.VERTICAL,name:`templateSearchText`,children:(0,c.jsx)(s.Input,{fullWidth:!0,onChange:e=>{W(e.target.value),B(1)},placeholder:`關鍵字:搜尋模板名稱、分類或描述`,size:`sub`,value:U,variant:`base`})})}),(0,c.jsx)(s.Filter,{span:2,children:(0,c.jsx)(s.FormField,{fullWidth:!0,layout:u.FormFieldLayout.VERTICAL,name:`templateCategoryFilter`,children:(0,c.jsx)(s.Select,{clearable:!1,fullWidth:!0,onChange:e=>{A(T(e,j)),B(1)},options:[C,...j],placeholder:`分類`,renderValue:e=>`分類:${E(e)}`,size:`sub`,value:k})})})]})}),tab:(0,c.jsx)(s.Tab,{activeKey:G,onChange:e=>{K(y(e)),B(1)},children:h.map(e=>(0,c.jsx)(s.TabItem,{children:e.label},e.key))}),children:[F?(0,c.jsx)(s.Typography,{color:`text-error`,variant:`body`,children:F}):null,(0,c.jsx)(s.Table,{actions:ne,columns:te,dataSource:ee,fullWidth:!0,loading:L,pagination:{current:z,onChange:e=>{B(e)},onChangePageSize:e=>{B(1),H(e)},pageSize:V,pageSizeLabel:`每頁筆數`,pageSizeOptions:m,renderResultSummary:(e,t,n)=>`顯示 ${e}-${t} 筆,共 ${n} 筆`,showPageSizeOptions:!0,total:q}})]})})]})})}function v(e){return e instanceof Error?e.message:`發生未知錯誤`}function y(e){return e===`PUBLISHED`||e===`DRAFT`?e:`ALL`}function b({status:e}){return e===`PUBLISHED`?(0,c.jsx)(s.Badge,{size:`sub`,text:`已發布`,variant:`dot-success`}):(0,c.jsx)(s.Badge,{size:`sub`,text:`草稿`,variant:`dot-inactive`})}function x({isActive:e}){return e?(0,c.jsx)(s.Badge,{size:`sub`,text:`啟用中`,variant:`dot-success`}):(0,c.jsx)(s.Badge,{size:`sub`,text:`已停用`,variant:`dot-inactive`})}function S({record:e}){return e.categoryDetail?.isActive===!1?(0,c.jsx)(s.Badge,{size:`sub`,text:`${e.categoryLabel}(停用)`,variant:`dot-inactive`}):(0,c.jsx)(s.Typography,{component:`span`,variant:`body`,children:e.categoryLabel})}var C={categoryId:null,id:`ALL_CATEGORIES`,name:`全部分類`};function w(e){return{categoryId:e.id,id:e.id,name:e.name}}function T(e,t){if(!O(e))return C;let n=typeof e.id==`string`?e.id:null;return n===C.id?C:t.find(e=>e.id===n)??C}function E(e){return Array.isArray(e)||!O(e)?C.name:typeof e.name==`string`?e.name:C.name}function D(e){return e.categoryDetail?.name??e.category??`未分類`}function O(e){return typeof e==`object`&&!!e}exports.TemplateCategoriesView=i.t,exports.TemplateVersionsView=a.TemplateVersionsView,exports.TemplatesView=_;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { r as e } from "../../chunks/router-adapter-DftlFTOd.js";
3
3
  import { t } from "../../chunks/format-date-time-CB-LxzqT.js";
4
- import { r as n } from "../../chunks/routes-config-RBYQtUd0.js";
4
+ import { r as n } from "../../chunks/routes-config-yZbESPlw.js";
5
5
  import { n as ee, t as r } from "../../chunks/categories-DGlxuC6X.js";
6
6
  import { TemplateVersionsView as i } from "./versions/index.js";
7
7
  import { useCallback as a, useEffect as o, useMemo as s, useRef as c, useState as l } from "react";