@burojs/ui-shadcn 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/dist/{bulk-summary-CrEij5vq.cjs → bulk-summary-2HLgz7Il.cjs} +31 -5
  2. package/dist/bulk-summary-2HLgz7Il.cjs.map +1 -0
  3. package/dist/{bulk-summary-BWSAS7k2.js → bulk-summary-D6A0ua21.js} +32 -6
  4. package/dist/bulk-summary-D6A0ua21.js.map +1 -0
  5. package/dist/{candidates-relation-picker-y5M6_oe4.cjs → candidates-relation-picker-C47mF260.cjs} +3 -3
  6. package/dist/{candidates-relation-picker-y5M6_oe4.cjs.map → candidates-relation-picker-C47mF260.cjs.map} +1 -1
  7. package/dist/{candidates-relation-picker-CS_JZ4Fd.js → candidates-relation-picker-CGXItMN0.js} +3 -3
  8. package/dist/{candidates-relation-picker-CS_JZ4Fd.js.map → candidates-relation-picker-CGXItMN0.js.map} +1 -1
  9. package/dist/{check-confirm-dialog-C-NHgMST.cjs → check-confirm-dialog-BT04Mieo.cjs} +13 -6
  10. package/dist/check-confirm-dialog-BT04Mieo.cjs.map +1 -0
  11. package/dist/{check-confirm-dialog-2j0gOd7x.js → check-confirm-dialog-CtiRzOAt.js} +14 -7
  12. package/dist/{check-confirm-dialog-2j0gOd7x.js.map → check-confirm-dialog-CtiRzOAt.js.map} +1 -1
  13. package/dist/{filter-builder-DFu0JP-1.cjs → filter-builder-ByGhxLf_.cjs} +127 -63
  14. package/dist/filter-builder-ByGhxLf_.cjs.map +1 -0
  15. package/dist/{filter-builder-DaWHUZuV.js → filter-builder-z3Axzf9Y.js} +114 -56
  16. package/dist/filter-builder-z3Axzf9Y.js.map +1 -0
  17. package/dist/{flow-runtime-BpmrIUb6.cjs → flow-runtime-BVFjMU5-.cjs} +6 -3
  18. package/dist/{flow-runtime-BpmrIUb6.cjs.map → flow-runtime-BVFjMU5-.cjs.map} +1 -1
  19. package/dist/{flow-runtime-DyqTmK3H.js → flow-runtime-DrUWyTS0.js} +6 -3
  20. package/dist/{flow-runtime-DyqTmK3H.js.map → flow-runtime-DrUWyTS0.js.map} +1 -1
  21. package/dist/{flow-screen-DCdli6Ha.js → flow-screen-3fk6J33y.js} +6 -4
  22. package/dist/flow-screen-3fk6J33y.js.map +1 -0
  23. package/dist/{flow-screen-Bcz9NF2V.cjs → flow-screen-6y5E_HT6.cjs} +5 -3
  24. package/dist/flow-screen-6y5E_HT6.cjs.map +1 -0
  25. package/dist/index.cjs +518 -107
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +187 -86
  28. package/dist/index.d.ts +187 -86
  29. package/dist/index.js +519 -108
  30. package/dist/index.js.map +1 -1
  31. package/dist/{inline-flow-host-3vw7LzzD.cjs → inline-flow-host-C4KmZIYE.cjs} +3 -3
  32. package/dist/{inline-flow-host-3vw7LzzD.cjs.map → inline-flow-host-C4KmZIYE.cjs.map} +1 -1
  33. package/dist/{inline-flow-host-C0rI9B7f.js → inline-flow-host-YnnvWjdU.js} +3 -3
  34. package/dist/{inline-flow-host-C0rI9B7f.js.map → inline-flow-host-YnnvWjdU.js.map} +1 -1
  35. package/dist/{lazy-relation-picker-dialog-Bt8lrEIu.cjs → lazy-relation-picker-dialog-BAKBRn3V.cjs} +2 -2
  36. package/dist/{lazy-relation-picker-dialog-Bt8lrEIu.cjs.map → lazy-relation-picker-dialog-BAKBRn3V.cjs.map} +1 -1
  37. package/dist/{lazy-relation-picker-dialog-CAScLPb2.js → lazy-relation-picker-dialog-DN4bvQfg.js} +2 -2
  38. package/dist/{lazy-relation-picker-dialog-CAScLPb2.js.map → lazy-relation-picker-dialog-DN4bvQfg.js.map} +1 -1
  39. package/dist/{page-flow-route-BHUEpn0I.js → page-flow-route-CtEfqAvU.js} +5 -6
  40. package/dist/page-flow-route-CtEfqAvU.js.map +1 -0
  41. package/dist/{page-flow-route-DS8IVTVH.cjs → page-flow-route-DEjAxHe3.cjs} +6 -7
  42. package/dist/page-flow-route-DEjAxHe3.cjs.map +1 -0
  43. package/dist/{place-node-CfzQvh4Y.js → place-node-BdxT-30h.js} +149 -108
  44. package/dist/place-node-BdxT-30h.js.map +1 -0
  45. package/dist/{place-node-CNb3w-c7.cjs → place-node-Bhl8B3fF.cjs} +163 -134
  46. package/dist/place-node-Bhl8B3fF.cjs.map +1 -0
  47. package/dist/{related-list-cards-CelMxl4q.cjs → related-list-cards-Bc_vfCE_.cjs} +3 -3
  48. package/dist/{related-list-cards-CelMxl4q.cjs.map → related-list-cards-Bc_vfCE_.cjs.map} +1 -1
  49. package/dist/{related-list-cards-BIqqY69Y.js → related-list-cards-BvkD5OcC.js} +3 -3
  50. package/dist/{related-list-cards-BIqqY69Y.js.map → related-list-cards-BvkD5OcC.js.map} +1 -1
  51. package/dist/related-list-timeline-DCrwN9oO.js +167 -0
  52. package/dist/related-list-timeline-DCrwN9oO.js.map +1 -0
  53. package/dist/related-list-timeline-k0DtnxTs.cjs +167 -0
  54. package/dist/related-list-timeline-k0DtnxTs.cjs.map +1 -0
  55. package/dist/{related-rows-MPnLCmPF.cjs → related-rows-BW9Jr07T.cjs} +3 -3
  56. package/dist/{related-rows-MPnLCmPF.cjs.map → related-rows-BW9Jr07T.cjs.map} +1 -1
  57. package/dist/{related-rows--uP2iKQC.js → related-rows-CPE-9FFr.js} +3 -3
  58. package/dist/{related-rows--uP2iKQC.js.map → related-rows-CPE-9FFr.js.map} +1 -1
  59. package/dist/{relation-many-picker-BJhaEqxz.js → relation-many-picker-BlrGRwMV.js} +10 -5
  60. package/dist/relation-many-picker-BlrGRwMV.js.map +1 -0
  61. package/dist/{relation-many-picker-DzuGJpEl.cjs → relation-many-picker-Br-zBHxT.cjs} +10 -5
  62. package/dist/relation-many-picker-Br-zBHxT.cjs.map +1 -0
  63. package/dist/{relation-picker-DaIMzf2H.cjs → relation-picker-ADjxI_TI.cjs} +11 -6
  64. package/dist/relation-picker-ADjxI_TI.cjs.map +1 -0
  65. package/dist/{relation-picker-dialog-DoEY8EkH.js → relation-picker-dialog-CyKliBkN.js} +2 -2
  66. package/dist/{relation-picker-dialog-DoEY8EkH.js.map → relation-picker-dialog-CyKliBkN.js.map} +1 -1
  67. package/dist/{relation-picker-dialog-9Vg5vvR1.cjs → relation-picker-dialog-DimVQF9Y.cjs} +2 -2
  68. package/dist/{relation-picker-dialog-9Vg5vvR1.cjs.map → relation-picker-dialog-DimVQF9Y.cjs.map} +1 -1
  69. package/dist/{relation-picker-D-tBBZW_.js → relation-picker-x7P5HKie.js} +11 -6
  70. package/dist/relation-picker-x7P5HKie.js.map +1 -0
  71. package/dist/{resource-page-router-Diw6S6TK.js → resource-page-router-BRpUnhay.js} +144 -17
  72. package/dist/resource-page-router-BRpUnhay.js.map +1 -0
  73. package/dist/{resource-page-router-C_kGW2o_.cjs → resource-page-router-qEd2xb55.cjs} +158 -19
  74. package/dist/resource-page-router-qEd2xb55.cjs.map +1 -0
  75. package/dist/use-record-subtitle-bfwIoUme.cjs +70 -0
  76. package/dist/use-record-subtitle-bfwIoUme.cjs.map +1 -0
  77. package/dist/use-record-subtitle-gIaCGgbI.js +53 -0
  78. package/dist/use-record-subtitle-gIaCGgbI.js.map +1 -0
  79. package/package.json +9 -9
  80. package/dist/bulk-summary-BWSAS7k2.js.map +0 -1
  81. package/dist/bulk-summary-CrEij5vq.cjs.map +0 -1
  82. package/dist/check-confirm-dialog-C-NHgMST.cjs.map +0 -1
  83. package/dist/filter-builder-DFu0JP-1.cjs.map +0 -1
  84. package/dist/filter-builder-DaWHUZuV.js.map +0 -1
  85. package/dist/flow-screen-Bcz9NF2V.cjs.map +0 -1
  86. package/dist/flow-screen-DCdli6Ha.js.map +0 -1
  87. package/dist/page-flow-route-BHUEpn0I.js.map +0 -1
  88. package/dist/page-flow-route-DS8IVTVH.cjs.map +0 -1
  89. package/dist/place-node-CNb3w-c7.cjs.map +0 -1
  90. package/dist/place-node-CfzQvh4Y.js.map +0 -1
  91. package/dist/related-list-timeline-CRh7xwLD.js +0 -141
  92. package/dist/related-list-timeline-CRh7xwLD.js.map +0 -1
  93. package/dist/related-list-timeline-DsLdi8sv.cjs +0 -141
  94. package/dist/related-list-timeline-DsLdi8sv.cjs.map +0 -1
  95. package/dist/relation-many-picker-BJhaEqxz.js.map +0 -1
  96. package/dist/relation-many-picker-DzuGJpEl.cjs.map +0 -1
  97. package/dist/relation-picker-D-tBBZW_.js.map +0 -1
  98. package/dist/relation-picker-DaIMzf2H.cjs.map +0 -1
  99. package/dist/resource-page-router-C_kGW2o_.cjs.map +0 -1
  100. package/dist/resource-page-router-Diw6S6TK.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  require("./toaster-BbByOytP.cjs");
2
- const require_check_confirm_dialog = require("./check-confirm-dialog-C-NHgMST.cjs");
2
+ const require_check_confirm_dialog = require("./check-confirm-dialog-BT04Mieo.cjs");
3
3
  const require_success_notices = require("./success-notices-Dl3M1fZP.cjs");
4
4
  let _burojs_core = require("@burojs/core");
5
5
  let _burojs_react = require("@burojs/react");
@@ -259,7 +259,10 @@ function BulkFlowRunner({ resource, actionName, ids, onFinish }) {
259
259
  confirmable: confirming ? snapshot.warnings.map((warning) => ({
260
260
  code: "check.warning",
261
261
  message: {
262
- ...(0, _burojs_core_internal.toMessageRef)(warning.message, `checks.${warning.id}`),
262
+ ...(0, _burojs_core_internal.toMessageRef)(warning.rows === void 0 ? warning.message : `${warning.message} — ${t("flow.bulkWarningRows", {
263
+ defaultValue: warning.rows === 1 ? "1 row" : `${warning.rows} rows`,
264
+ count: warning.rows
265
+ })}`, `checks.${warning.id}`),
263
266
  params: { resolved: true }
264
267
  },
265
268
  path: [],
@@ -284,4 +287,4 @@ exports.AppFlowRunner = AppFlowRunner;
284
287
  exports.BulkFlowRunner = BulkFlowRunner;
285
288
  exports.FlowRunner = FlowRunner;
286
289
 
287
- //# sourceMappingURL=flow-runtime-BpmrIUb6.cjs.map
290
+ //# sourceMappingURL=flow-runtime-BVFjMU5-.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"flow-runtime-BpmrIUb6.cjs","names":["useOptionalT","APP_ACTION_RESOURCE","useI18nCaps","useNoticeSink","useState","useRef","useCallback","reasonText","toMessageRef","CheckConfirmDialog","useMemo","useFlowRun","useFlowChrome","recordKeyOf","useApp","useProjectedTitle","useFlowHost","useTestIds","makeTestId","useFlowDialogTexts"],"sources":["../src/flows/flow-runtime.tsx"],"sourcesContent":["'use client';\n/**\n * The flow runtime's side of the UI kit (P4, the coordinator's ruling on the bundle): every\n * component that holds a run. It loads on the first sign that a user means to run a flow (a\n * hover, a focus, a menu opening, at the latest the click) through `./load-runtime.js`, and with\n * it `@burojs/react/flows` and `@burojs/core/flows` — the flow machine stays out of an\n * application's first screen.\n */\nimport { toMessageRef } from '@burojs/core/internal';\nimport {\n APP_ACTION_RESOURCE,\n type BulkProgress,\n type FlowControlState,\n type FlowResult,\n type Row,\n type ValidationIssue,\n} from '@burojs/core';\nimport {\n type CheckGateState,\n recordKeyOf,\n useApp,\n useI18nCaps,\n useOptionalT,\n useProjectedTitle,\n useTestIds,\n} from '@burojs/react';\nimport {\n type FlowHostControl,\n type UseFlowRunResult,\n useFlowHost,\n useFlowRun,\n} from '@burojs/react/flows';\nimport { type ReactElement, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { makeTestId } from '../actions/action-button.js';\nimport { CheckConfirmDialog } from '../checks/check-confirm-dialog.js';\nimport { useNoticeSink } from '../forms/success-notices.js';\nimport { reasonText } from '../lib/reason-text.js';\nimport { toast } from '../notification/toaster.js';\nimport { type FlowChrome, useFlowChrome, useFlowDialogTexts } from './chrome.js';\n\nconst NO_ISSUES: readonly ValidationIssue[] = Object.freeze([]);\n\n/**\n * Runs a flow from its control (4.15): a flow with a host presents it and the interaction ends\n * when it closes; a `{ label, submit }` flow sends, asks through the confirm dialog when\n * `confirm` or a fired warning asks, and shows `rejected`, `failed` and `unknown` in the flow's\n * screen in a dialog (`success` notifies through the flow's `then` and shows the write's notices; a lock another tab holds\n * says so; an `unavailable` send toasts the run's reason). `launch()` settles when the interaction is over.\n */\nfunction useFlowLauncher(\n flow: UseFlowRunResult,\n host: FlowHostControl,\n chrome: FlowChrome,\n resource: string,\n testid: string,\n): { readonly launch: () => Promise<void>; readonly dialog: ReactElement | null } {\n const t = useOptionalT();\n // An app flow's reason resolves app-wide: it has no resource bundle of its own.\n const own = resource === APP_ACTION_RESOURCE ? undefined : resource;\n const caps = useI18nCaps(own);\n // The write's own notices (spec 4.7): a host-less flow mounts no flow screen to show them, so\n // the launcher shows them through the same sink the flow screen uses.\n const showNotices = useNoticeSink(own);\n const [confirming, setConfirming] = useState(false);\n const decide = useRef<((proceed: boolean) => void) | null>(null);\n const latest = useRef(flow);\n latest.current = flow;\n useEffect(\n () => () => {\n decide.current?.(false);\n decide.current = null;\n },\n [],\n );\n\n const launch = useCallback(async (): Promise<void> => {\n const { run, compiled } = latest.current;\n if (run === null || compiled === null) return;\n if (compiled.hasHost) {\n await (host.open() ?? Promise.resolve());\n return;\n }\n let result: FlowResult = await run.submit();\n while (result.outcome === 'halted' && (result.step === 'accept' || result.step === 'review')) {\n setConfirming(true);\n const proceed = await new Promise<boolean>((resolve) => {\n decide.current = resolve;\n });\n decide.current = null;\n setConfirming(false);\n if (!proceed) {\n run.startOver();\n return;\n }\n result = await run.accept();\n }\n if (result.outcome === 'success') {\n const { notices } = run.getSnapshot();\n if (notices.length > 0) showNotices(notices);\n return;\n }\n // Another tab holds the attempt's lock: nothing was sent (4.10).\n if (result.outcome === 'failed' && 'reason' in result && result.reason === 'busy') {\n toast(t('flow.busyElsewhere', { defaultValue: 'This action is running in another tab.' }));\n return;\n }\n // The send found the flow unavailable (a check that runs at submit, access revoked since the\n // click): the run's reason, as a refusal before the click shows it.\n if (result.outcome === 'unavailable') {\n const reason = run.getSnapshot().reason;\n toast(\n reason === undefined\n ? t('availability.denied', { defaultValue: \"This action isn't available\" })\n : reasonText(caps, reason, own),\n );\n return;\n }\n if (\n result.outcome === 'rejected' ||\n result.outcome === 'failed' ||\n result.outcome === 'unknown' ||\n (result.outcome === 'halted' && result.step === 'outcome')\n )\n await (host.open('dialog') ?? Promise.resolve());\n }, [host, t, caps, own, showNotices]);\n\n const { snapshot, compiled } = flow;\n const gate: CheckGateState = {\n resource,\n open: confirming,\n busy: false,\n header: null,\n blockers: NO_ISSUES,\n confirmable: confirming\n ? snapshot.warnings.map(\n (warning): ValidationIssue => ({\n code: 'check.warning',\n // The machine's text (bundle and params resolved); the key is the check's.\n message: {\n ...toMessageRef(warning.message, `checks.${warning.id}`),\n // The run's text is final (bundle and params resolved): the dialog shows it as is.\n params: { resolved: true },\n },\n path: [],\n check: { id: warning.id },\n source: 'check',\n severity: 'warning',\n }),\n )\n : NO_ISSUES,\n proceed: () => decide.current?.(true),\n cancel: () => decide.current?.(false),\n };\n const dialog =\n compiled === null || compiled.hasHost ? null : (\n <CheckConfirmDialog\n state={gate}\n testid={`${testid}:confirm`}\n title={chrome.confirmTitle}\n proceedLabel={chrome.confirmProceed}\n {...(chrome.dismiss === undefined ? {} : { cancelLabel: chrome.dismiss })}\n tone={chrome.destructive ? 'destructive' : 'default'}\n />\n );\n return { launch, dialog };\n}\n\nexport interface FlowRunnerProps {\n readonly resource: string;\n readonly actionName: string;\n readonly record?: Row;\n readonly scope: string;\n /** The interaction is over (the host closed, the write answered, the confirm was declined). */\n readonly onClose: () => void;\n}\n\n/**\n * @internal A flow started from a control that holds no run — a row's button, a menu item\n * (4.15: a menu item \"presents its host through the runtime from `onSelect`, so the menu closes\n * normally\"). It renders no control: it starts the run (its `with` sources load now) and, once\n * the run has decided, presents the host or sends; `onClose` reports the end of the\n * interaction. A run that decides against the click (a check over a `with` source fired) says\n * why.\n */\nexport function FlowRunner({\n resource,\n actionName,\n record,\n scope,\n onClose,\n}: FlowRunnerProps): ReactElement | null {\n const target = useMemo(() => ({ resource, action: actionName }), [resource, actionName]);\n const flow = useFlowRun(target, {\n ...(record === undefined ? {} : { record }),\n surface: scope === 'row' ? 'row' : 'menu',\n });\n const chrome = useFlowChrome(resource, actionName);\n const recordKey = recordKeyOf(useApp().registry.get(resource), record);\n const title = useProjectedTitle(resource, recordKey, record);\n const host = useFlowHost(flow, {\n label: chrome.labelText,\n ...(record === undefined || title === '' ? {} : { title }),\n ...(record === undefined ? {} : { record }),\n });\n const tid = useTestIds();\n const t = useOptionalT();\n const caps = useI18nCaps(resource);\n const testid = makeTestId(scope, resource, actionName, String(recordKey ?? ''), tid);\n const { launch, dialog } = useFlowLauncher(flow, host, chrome, resource, testid);\n const started = useRef(false);\n const onCloseRef = useRef(onClose);\n onCloseRef.current = onClose;\n const { snapshot, compiled } = flow;\n const decided =\n compiled !== null &&\n (snapshot.control === 'disabled' ||\n snapshot.control === 'absent' ||\n (snapshot.control === 'ready' &&\n (!compiled.hasHost || snapshot.history.includes('open') || snapshot.step === 'outcome')));\n useEffect(() => {\n if (!decided || started.current) return;\n started.current = true;\n if (snapshot.control !== 'ready') {\n toast(\n snapshot.reason === undefined\n ? t('availability.denied', { defaultValue: \"This action isn't available\" })\n : reasonText(caps, snapshot.reason, resource),\n );\n onCloseRef.current();\n return;\n }\n void launch().finally(() => onCloseRef.current());\n }, [decided, snapshot.control, snapshot.reason, launch, t, caps]);\n return dialog;\n}\n\nexport interface AppFlowRunnerProps {\n /** The app action's name (`defineAppAction({ name, kind: 'flow' })`). */\n readonly name: string;\n /** Its label, as the opener resolved it (`appActions.<name>` over the declared default). */\n readonly label: string;\n /** The opener's test id: the confirm dialog's ids suffix it (`<testid>:confirm:…`). */\n readonly testid: string;\n readonly onClose: () => void;\n}\n\n/**\n * @internal An app flow started from its control (`AppFlowButton`, P4-D): the same launcher as a\n * resource flow's — the host when the flow has a form or a review, else the send with the\n * confirm dialog — over the target `{ appAction: name }`, with no record.\n */\nexport function AppFlowRunner({\n name,\n label,\n testid,\n onClose,\n}: AppFlowRunnerProps): ReactElement | null {\n const target = useMemo(() => ({ appAction: name }), [name]);\n const flow = useFlowRun(target, { surface: 'app' });\n const dialogTexts = useFlowDialogTexts('', name, label);\n const chrome: FlowChrome = {\n label,\n labelText: label,\n icon: undefined,\n destructive: false,\n ...dialogTexts,\n };\n const host = useFlowHost(flow, { label });\n const t = useOptionalT();\n const caps = useI18nCaps();\n const { launch, dialog } = useFlowLauncher(flow, host, chrome, APP_ACTION_RESOURCE, testid);\n const started = useRef(false);\n const onCloseRef = useRef(onClose);\n onCloseRef.current = onClose;\n const { snapshot, compiled } = flow;\n const decided =\n compiled !== null &&\n (snapshot.control === 'disabled' ||\n snapshot.control === 'absent' ||\n (snapshot.control === 'ready' &&\n (!compiled.hasHost || snapshot.history.includes('open') || snapshot.step === 'outcome')));\n useEffect(() => {\n if (!decided || started.current) return;\n started.current = true;\n if (snapshot.control !== 'ready') {\n toast(\n snapshot.reason === undefined\n ? t('availability.denied', { defaultValue: \"This action isn't available\" })\n : reasonText(caps, snapshot.reason),\n );\n onCloseRef.current();\n return;\n }\n void launch().finally(() => onCloseRef.current());\n }, [decided, snapshot.control, snapshot.reason, launch, t, caps]);\n return dialog;\n}\n\nexport interface BulkFlowRunnerProps {\n readonly resource: string;\n readonly actionName: string;\n readonly ids: readonly string[];\n /** The run is over: its result and its per-id report (absent when nothing was sent). */\n readonly onFinish: (result: FlowResult, progress: BulkProgress | undefined) => void;\n}\n\n/**\n * @internal A bulk flow's run over the selection (4.16), started by the bar's click: the confirm\n * (`confirm` and the fired warnings) asks through the confirm dialog, then the run re-reads the\n * rows and writes each under its own key; `onFinish` reports the result and the per-id report.\n */\nexport function BulkFlowRunner({\n resource,\n actionName,\n ids,\n onFinish,\n}: BulkFlowRunnerProps): ReactElement | null {\n const tid = useTestIds();\n const t = useOptionalT();\n const caps = useI18nCaps(resource);\n const idsKey = ids.join('\\u0000');\n // biome-ignore lint/correctness/useExhaustiveDependencies: keyed by the ids' values\n const selection = useMemo(() => ({ ids: [...ids], count: ids.length }), [idsKey]);\n const target = useMemo(() => ({ resource, action: actionName }), [resource, actionName]);\n const flow = useFlowRun(target, { selection, surface: 'bulk' });\n const chrome = useFlowChrome(resource, actionName);\n const testid = tid.bulkAction(resource, actionName);\n const [confirming, setConfirming] = useState(false);\n const decide = useRef<((proceed: boolean) => void) | null>(null);\n const started = useRef(false);\n const onFinishRef = useRef(onFinish);\n onFinishRef.current = onFinish;\n const { run, snapshot } = flow;\n useEffect(\n () => () => {\n decide.current?.(false);\n decide.current = null;\n },\n [],\n );\n const decided =\n run !== null && snapshot.control !== 'undecided' && snapshot.control !== 'pending';\n useEffect(() => {\n if (!decided || started.current || run === null) return;\n started.current = true;\n void (async () => {\n if (run.getSnapshot().control !== 'ready') {\n const refusal = run.getSnapshot().reason;\n toast(\n refusal === undefined\n ? t('availability.denied', { defaultValue: \"This action isn't available\" })\n : reasonText(caps, refusal, resource),\n );\n onFinishRef.current(\n Object.freeze({ outcome: 'unavailable', state: 'disabled' }),\n undefined,\n );\n return;\n }\n let result = await run.submit();\n while (\n result.outcome === 'halted' &&\n (result.step === 'accept' || result.step === 'review')\n ) {\n setConfirming(true);\n const proceed = await new Promise<boolean>((resolve) => {\n decide.current = resolve;\n });\n decide.current = null;\n setConfirming(false);\n if (!proceed) {\n run.startOver();\n onFinishRef.current(result, undefined);\n return;\n }\n result = await run.accept();\n }\n if (result.outcome === 'failed' && 'reason' in result && result.reason === 'busy')\n toast(t('flow.busyElsewhere', { defaultValue: 'This action is running in another tab.' }));\n onFinishRef.current(result, run.getSnapshot().bulk);\n })();\n }, [decided, run, t, caps, resource]);\n const gate: CheckGateState = {\n resource,\n open: confirming,\n busy: false,\n header: null,\n blockers: NO_ISSUES,\n confirmable: confirming\n ? snapshot.warnings.map(\n (warning): ValidationIssue => ({\n code: 'check.warning',\n // The machine's text (bundle and params resolved); the key is the check's.\n message: {\n ...toMessageRef(warning.message, `checks.${warning.id}`),\n // The run's text is final (bundle and params resolved): the dialog shows it as is.\n params: { resolved: true },\n },\n path: [],\n check: { id: warning.id },\n source: 'check',\n severity: 'warning',\n }),\n )\n : NO_ISSUES,\n proceed: () => decide.current?.(true),\n cancel: () => decide.current?.(false),\n };\n return (\n <CheckConfirmDialog\n state={gate}\n testid={`${testid}:confirm`}\n title={chrome.confirmTitle}\n proceedLabel={chrome.confirmProceed}\n {...(chrome.dismiss === undefined ? {} : { cancelLabel: chrome.dismiss })}\n tone={chrome.destructive ? 'destructive' : 'default'}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;AAwCA,MAAM,YAAwC,OAAO,OAAO,CAAC,CAAC;AAS9D,SAAS,gBACP,MACA,MACA,QACA,UACA,QACgF;CAChF,MAAM,KAAA,GAAIA,cAAAA,aAAAA,CAAa;CAEvB,MAAM,MAAM,aAAaC,aAAAA,sBAAsB,KAAA,IAAY;CAC3D,MAAM,QAAA,GAAOC,cAAAA,YAAAA,CAAY,GAAG;CAG5B,MAAM,cAAcC,wBAAAA,cAAc,GAAG;CACrC,MAAM,CAAC,YAAY,kBAAA,GAAiBC,MAAAA,SAAAA,CAAS,KAAK;CAClD,MAAM,UAAA,GAASC,MAAAA,OAAAA,CAA4C,IAAI;CAC/D,MAAM,UAAA,GAASA,MAAAA,OAAAA,CAAO,IAAI;CAC1B,OAAO,UAAU;CACjB,CAAA,GAAA,MAAA,UAAA,aACc;EACV,OAAO,UAAU,KAAK;EACtB,OAAO,UAAU;CACnB,GACA,CAAC,CACH;CAEA,MAAM,UAAA,GAASC,MAAAA,YAAAA,CAAY,YAA2B;EACpD,MAAM,EAAE,KAAK,aAAa,OAAO;EACjC,IAAI,QAAQ,QAAQ,aAAa,MAAM;EACvC,IAAI,SAAS,SAAS;GACpB,OAAO,KAAK,KAAK,KAAK,QAAQ,QAAQ;GACtC;EACF;EACA,IAAI,SAAqB,MAAM,IAAI,OAAO;EAC1C,OAAO,OAAO,YAAY,aAAa,OAAO,SAAS,YAAY,OAAO,SAAS,WAAW;GAC5F,cAAc,IAAI;GAClB,MAAM,UAAU,MAAM,IAAI,SAAkB,YAAY;IACtD,OAAO,UAAU;GACnB,CAAC;GACD,O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c,gBAAgB;CAC5C,CAAA;AAEL"}
1
+ {"version":3,"file":"flow-runtime-BVFjMU5-.cjs","names":["useOptionalT","APP_ACTION_RESOURCE","useI18nCaps","useNoticeSink","useState","useRef","useCallback","reasonText","toMessageRef","CheckConfirmDialog","useMemo","useFlowRun","useFlowChrome","recordKeyOf","useApp","useProjectedTitle","useFlowHost","useTestIds","makeTestId","useFlowDialogTexts"],"sources":["../src/flows/flow-runtime.tsx"],"sourcesContent":["'use client';\n/**\n * The flow runtime's side of the UI kit (P4, the coordinator's ruling on the bundle): every\n * component that holds a run. It loads on the first sign that a user means to run a flow (a\n * hover, a focus, a menu opening, at the latest the click) through `./load-runtime.js`, and with\n * it `@burojs/react/flows` and `@burojs/core/flows` — the flow machine stays out of an\n * application's first screen.\n */\nimport { toMessageRef } from '@burojs/core/internal';\nimport {\n APP_ACTION_RESOURCE,\n type BulkProgress,\n type FlowControlState,\n type FlowResult,\n type Row,\n type ValidationIssue,\n} from '@burojs/core';\nimport {\n type CheckGateState,\n recordKeyOf,\n useApp,\n useI18nCaps,\n useOptionalT,\n useProjectedTitle,\n useTestIds,\n} from '@burojs/react';\nimport {\n type FlowHostControl,\n type UseFlowRunResult,\n useFlowHost,\n useFlowRun,\n} from '@burojs/react/flows';\nimport { type ReactElement, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { makeTestId } from '../actions/action-button.js';\nimport { CheckConfirmDialog } from '../checks/check-confirm-dialog.js';\nimport { useNoticeSink } from '../forms/success-notices.js';\nimport { reasonText } from '../lib/reason-text.js';\nimport { toast } from '../notification/toaster.js';\nimport { type FlowChrome, useFlowChrome, useFlowDialogTexts } from './chrome.js';\n\nconst NO_ISSUES: readonly ValidationIssue[] = Object.freeze([]);\n\n/**\n * Runs a flow from its control (4.15): a flow with a host presents it and the interaction ends\n * when it closes; a `{ label, submit }` flow sends, asks through the confirm dialog when\n * `confirm` or a fired warning asks, and shows `rejected`, `failed` and `unknown` in the flow's\n * screen in a dialog (`success` notifies through the flow's `then` and shows the write's notices; a lock another tab holds\n * says so; an `unavailable` send toasts the run's reason). `launch()` settles when the interaction is over.\n */\nfunction useFlowLauncher(\n flow: UseFlowRunResult,\n host: FlowHostControl,\n chrome: FlowChrome,\n resource: string,\n testid: string,\n): { readonly launch: () => Promise<void>; readonly dialog: ReactElement | null } {\n const t = useOptionalT();\n // An app flow's reason resolves app-wide: it has no resource bundle of its own.\n const own = resource === APP_ACTION_RESOURCE ? undefined : resource;\n const caps = useI18nCaps(own);\n // The write's own notices (spec 4.7): a host-less flow mounts no flow screen to show them, so\n // the launcher shows them through the same sink the flow screen uses.\n const showNotices = useNoticeSink(own);\n const [confirming, setConfirming] = useState(false);\n const decide = useRef<((proceed: boolean) => void) | null>(null);\n const latest = useRef(flow);\n latest.current = flow;\n useEffect(\n () => () => {\n decide.current?.(false);\n decide.current = null;\n },\n [],\n );\n\n const launch = useCallback(async (): Promise<void> => {\n const { run, compiled } = latest.current;\n if (run === null || compiled === null) return;\n if (compiled.hasHost) {\n await (host.open() ?? Promise.resolve());\n return;\n }\n let result: FlowResult = await run.submit();\n while (result.outcome === 'halted' && (result.step === 'accept' || result.step === 'review')) {\n setConfirming(true);\n const proceed = await new Promise<boolean>((resolve) => {\n decide.current = resolve;\n });\n decide.current = null;\n setConfirming(false);\n if (!proceed) {\n run.startOver();\n return;\n }\n result = await run.accept();\n }\n if (result.outcome === 'success') {\n const { notices } = run.getSnapshot();\n if (notices.length > 0) showNotices(notices);\n return;\n }\n // Another tab holds the attempt's lock: nothing was sent (4.10).\n if (result.outcome === 'failed' && 'reason' in result && result.reason === 'busy') {\n toast(t('flow.busyElsewhere', { defaultValue: 'This action is running in another tab.' }));\n return;\n }\n // The send found the flow unavailable (a check that runs at submit, access revoked since the\n // click): the run's reason, as a refusal before the click shows it.\n if (result.outcome === 'unavailable') {\n const reason = run.getSnapshot().reason;\n toast(\n reason === undefined\n ? t('availability.denied', { defaultValue: \"This action isn't available\" })\n : reasonText(caps, reason, own),\n );\n return;\n }\n if (\n result.outcome === 'rejected' ||\n result.outcome === 'failed' ||\n result.outcome === 'unknown' ||\n (result.outcome === 'halted' && result.step === 'outcome')\n )\n await (host.open('dialog') ?? Promise.resolve());\n }, [host, t, caps, own, showNotices]);\n\n const { snapshot, compiled } = flow;\n const gate: CheckGateState = {\n resource,\n open: confirming,\n busy: false,\n header: null,\n blockers: NO_ISSUES,\n confirmable: confirming\n ? snapshot.warnings.map(\n (warning): ValidationIssue => ({\n code: 'check.warning',\n // The machine's text (bundle and params resolved); the key is the check's.\n message: {\n ...toMessageRef(warning.message, `checks.${warning.id}`),\n // The run's text is final (bundle and params resolved): the dialog shows it as is.\n params: { resolved: true },\n },\n path: [],\n check: { id: warning.id },\n source: 'check',\n severity: 'warning',\n }),\n )\n : NO_ISSUES,\n proceed: () => decide.current?.(true),\n cancel: () => decide.current?.(false),\n };\n const dialog =\n compiled === null || compiled.hasHost ? null : (\n <CheckConfirmDialog\n state={gate}\n testid={`${testid}:confirm`}\n title={chrome.confirmTitle}\n proceedLabel={chrome.confirmProceed}\n {...(chrome.dismiss === undefined ? {} : { cancelLabel: chrome.dismiss })}\n tone={chrome.destructive ? 'destructive' : 'default'}\n />\n );\n return { launch, dialog };\n}\n\nexport interface FlowRunnerProps {\n readonly resource: string;\n readonly actionName: string;\n readonly record?: Row;\n readonly scope: string;\n /** The interaction is over (the host closed, the write answered, the confirm was declined). */\n readonly onClose: () => void;\n}\n\n/**\n * @internal A flow started from a control that holds no run — a row's button, a menu item\n * (4.15: a menu item \"presents its host through the runtime from `onSelect`, so the menu closes\n * normally\"). It renders no control: it starts the run (its `with` sources load now) and, once\n * the run has decided, presents the host or sends; `onClose` reports the end of the\n * interaction. A run that decides against the click (a check over a `with` source fired) says\n * why.\n */\nexport function FlowRunner({\n resource,\n actionName,\n record,\n scope,\n onClose,\n}: FlowRunnerProps): ReactElement | null {\n const target = useMemo(() => ({ resource, action: actionName }), [resource, actionName]);\n const flow = useFlowRun(target, {\n ...(record === undefined ? {} : { record }),\n surface: scope === 'row' ? 'row' : 'menu',\n });\n const chrome = useFlowChrome(resource, actionName);\n const recordKey = recordKeyOf(useApp().registry.get(resource), record);\n const title = useProjectedTitle(resource, recordKey, record);\n const host = useFlowHost(flow, {\n label: chrome.labelText,\n ...(record === undefined || title === '' ? {} : { title }),\n ...(record === undefined ? {} : { record }),\n });\n const tid = useTestIds();\n const t = useOptionalT();\n const caps = useI18nCaps(resource);\n const testid = makeTestId(scope, resource, actionName, String(recordKey ?? ''), tid);\n const { launch, dialog } = useFlowLauncher(flow, host, chrome, resource, testid);\n const started = useRef(false);\n const onCloseRef = useRef(onClose);\n onCloseRef.current = onClose;\n const { snapshot, compiled } = flow;\n const decided =\n compiled !== null &&\n (snapshot.control === 'disabled' ||\n snapshot.control === 'absent' ||\n (snapshot.control === 'ready' &&\n (!compiled.hasHost || snapshot.history.includes('open') || snapshot.step === 'outcome')));\n useEffect(() => {\n if (!decided || started.current) return;\n started.current = true;\n if (snapshot.control !== 'ready') {\n toast(\n snapshot.reason === undefined\n ? t('availability.denied', { defaultValue: \"This action isn't available\" })\n : reasonText(caps, snapshot.reason, resource),\n );\n onCloseRef.current();\n return;\n }\n void launch().finally(() => onCloseRef.current());\n }, [decided, snapshot.control, snapshot.reason, launch, t, caps]);\n return dialog;\n}\n\nexport interface AppFlowRunnerProps {\n /** The app action's name (`defineAppAction({ name, kind: 'flow' })`). */\n readonly name: string;\n /** Its label, as the opener resolved it (`appActions.<name>` over the declared default). */\n readonly label: string;\n /** The opener's test id: the confirm dialog's ids suffix it (`<testid>:confirm:…`). */\n readonly testid: string;\n readonly onClose: () => void;\n}\n\n/**\n * @internal An app flow started from its control (`AppFlowButton`, P4-D): the same launcher as a\n * resource flow's — the host when the flow has a form or a review, else the send with the\n * confirm dialog — over the target `{ appAction: name }`, with no record.\n */\nexport function AppFlowRunner({\n name,\n label,\n testid,\n onClose,\n}: AppFlowRunnerProps): ReactElement | null {\n const target = useMemo(() => ({ appAction: name }), [name]);\n const flow = useFlowRun(target, { surface: 'app' });\n const dialogTexts = useFlowDialogTexts('', name, label);\n const chrome: FlowChrome = {\n label,\n labelText: label,\n icon: undefined,\n destructive: false,\n ...dialogTexts,\n };\n const host = useFlowHost(flow, { label });\n const t = useOptionalT();\n const caps = useI18nCaps();\n const { launch, dialog } = useFlowLauncher(flow, host, chrome, APP_ACTION_RESOURCE, testid);\n const started = useRef(false);\n const onCloseRef = useRef(onClose);\n onCloseRef.current = onClose;\n const { snapshot, compiled } = flow;\n const decided =\n compiled !== null &&\n (snapshot.control === 'disabled' ||\n snapshot.control === 'absent' ||\n (snapshot.control === 'ready' &&\n (!compiled.hasHost || snapshot.history.includes('open') || snapshot.step === 'outcome')));\n useEffect(() => {\n if (!decided || started.current) return;\n started.current = true;\n if (snapshot.control !== 'ready') {\n toast(\n snapshot.reason === undefined\n ? t('availability.denied', { defaultValue: \"This action isn't available\" })\n : reasonText(caps, snapshot.reason),\n );\n onCloseRef.current();\n return;\n }\n void launch().finally(() => onCloseRef.current());\n }, [decided, snapshot.control, snapshot.reason, launch, t, caps]);\n return dialog;\n}\n\nexport interface BulkFlowRunnerProps {\n readonly resource: string;\n readonly actionName: string;\n readonly ids: readonly string[];\n /** The run is over: its result and its per-id report (absent when nothing was sent). */\n readonly onFinish: (result: FlowResult, progress: BulkProgress | undefined) => void;\n}\n\n/**\n * @internal A bulk flow's run over the selection (4.16), started by the bar's click: the confirm\n * (`confirm` and the fired warnings) asks through the confirm dialog, then the run (re-reading the\n * rows first where the flow declares `submit.reread`) writes each under its own key; `onFinish` reports the result and the per-id report.\n */\nexport function BulkFlowRunner({\n resource,\n actionName,\n ids,\n onFinish,\n}: BulkFlowRunnerProps): ReactElement | null {\n const tid = useTestIds();\n const t = useOptionalT();\n const caps = useI18nCaps(resource);\n const idsKey = ids.join('\\u0000');\n // biome-ignore lint/correctness/useExhaustiveDependencies: keyed by the ids' values\n const selection = useMemo(() => ({ ids: [...ids], count: ids.length }), [idsKey]);\n const target = useMemo(() => ({ resource, action: actionName }), [resource, actionName]);\n const flow = useFlowRun(target, { selection, surface: 'bulk' });\n const chrome = useFlowChrome(resource, actionName);\n const testid = tid.bulkAction(resource, actionName);\n const [confirming, setConfirming] = useState(false);\n const decide = useRef<((proceed: boolean) => void) | null>(null);\n const started = useRef(false);\n const onFinishRef = useRef(onFinish);\n onFinishRef.current = onFinish;\n const { run, snapshot } = flow;\n useEffect(\n () => () => {\n decide.current?.(false);\n decide.current = null;\n },\n [],\n );\n const decided =\n run !== null && snapshot.control !== 'undecided' && snapshot.control !== 'pending';\n useEffect(() => {\n if (!decided || started.current || run === null) return;\n started.current = true;\n void (async () => {\n if (run.getSnapshot().control !== 'ready') {\n const refusal = run.getSnapshot().reason;\n toast(\n refusal === undefined\n ? t('availability.denied', { defaultValue: \"This action isn't available\" })\n : reasonText(caps, refusal, resource),\n );\n onFinishRef.current(\n Object.freeze({ outcome: 'unavailable', state: 'disabled' }),\n undefined,\n );\n return;\n }\n let result = await run.submit();\n while (\n result.outcome === 'halted' &&\n (result.step === 'accept' || result.step === 'review')\n ) {\n setConfirming(true);\n const proceed = await new Promise<boolean>((resolve) => {\n decide.current = resolve;\n });\n decide.current = null;\n setConfirming(false);\n if (!proceed) {\n run.startOver();\n onFinishRef.current(result, undefined);\n return;\n }\n result = await run.accept();\n }\n if (result.outcome === 'failed' && 'reason' in result && result.reason === 'busy')\n toast(t('flow.busyElsewhere', { defaultValue: 'This action is running in another tab.' }));\n onFinishRef.current(result, run.getSnapshot().bulk);\n })();\n }, [decided, run, t, caps, resource]);\n const gate: CheckGateState = {\n resource,\n open: confirming,\n busy: false,\n header: null,\n blockers: NO_ISSUES,\n confirmable: confirming\n ? snapshot.warnings.map(\n (warning): ValidationIssue => ({\n code: 'check.warning',\n // The machine's text (bundle and params resolved); the key is the check's.\n message: {\n ...toMessageRef(\n warning.rows === undefined\n ? warning.message\n : `${warning.message} — ${t('flow.bulkWarningRows', {\n defaultValue: warning.rows === 1 ? '1 row' : `${warning.rows} rows`,\n count: warning.rows,\n })}`,\n `checks.${warning.id}`,\n ),\n // The run's text is final (bundle and params resolved): the dialog shows it as is.\n params: { resolved: true },\n },\n path: [],\n check: { id: warning.id },\n source: 'check',\n severity: 'warning',\n }),\n )\n : NO_ISSUES,\n proceed: () => decide.current?.(true),\n cancel: () => decide.current?.(false),\n };\n return (\n <CheckConfirmDialog\n state={gate}\n testid={`${testid}:confirm`}\n title={chrome.confirmTitle}\n proceedLabel={chrome.confirmProceed}\n {...(chrome.dismiss === undefined ? {} : { cancelLabel: chrome.dismiss })}\n tone={chrome.destructive ? 'destructive' : 'default'}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;AAwCA,MAAM,YAAwC,OAAO,OAAO,CAAC,CAAC;AAS9D,SAAS,gBACP,MACA,MACA,QACA,UACA,QACgF;CAChF,MAAM,KAAA,GAAIA,cAAAA,aAAAA,CAAa;CAEvB,MAAM,MAAM,aAAaC,aAAAA,sBAAsB,KAAA,IAAY;CAC3D,MAAM,QAAA,GAAOC,cAAAA,YAAAA,CAAY,GAAG;CAG5B,MAAM,cAAcC,wBAAAA,cAAc,GAAG;CACrC,MAAM,CAAC,YAAY,kBAAA,GAAiBC,MAAAA,SAAAA,CAAS,KAAK;CAClD,MAAM,UAAA,GAASC,MAAAA,OAAAA,CAA4C,IAAI;CAC/D,MAAM,UAAA,GAASA,MAAAA,OAAAA,CAAO,IAAI;CAC1B,OAAO,UAAU;CACjB,CAAA,GAAA,MAAA,UAAA,aACc;EACV,OAAO,UAAU,KAAK;EACtB,OAAO,UAAU;CACnB,GACA,CAAC,CACH;CAEA,MAAM,UAAA,GAASC,MAAAA,YAAAA,CAAY,YAA2B;EACpD,MAAM,EAAE,KAAK,aAAa,OAAO;EACjC,IAAI,QAAQ,QAAQ,aAAa,MAAM;EACvC,IAAI,SAAS,SAAS;GACpB,OAAO,KAAK,KAAK,KAAK,QAAQ,QAAQ;GACtC;EACF;EACA,IAAI,SAAqB,MAAM,IAAI,OAAO;E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ACxB,QAAQ;GACR,UAAU;EACZ,EACF,IACA;EACJ,eAAe,OAAO,UAAU,IAAI;EACpC,cAAc,OAAO,UAAU,KAAK;CACtC;CACA,QACE,GAAA,kBAAA,IAAA,CAACC,6BAAAA,oBAAD;EACE,OAAO;EACP,QAAQ,GAAG,OAAO;EAClB,OAAO,OAAO;EACd,cAAc,OAAO;EACrB,GAAK,OAAO,YAAY,KAAA,IAAY,CAAC,IAAI,EAAE,aAAa,OAAO,QAAQ;EACvE,MAAM,OAAO,cAAc,gBAAgB;CAC5C,CAAA;AAEL"}
@@ -1,5 +1,5 @@
1
1
  import { n as toast } from "./toaster-Ct_YHGs6.js";
2
- import { _ as reasonText, h as useFlowDialogTexts, i as makeTestId, m as useFlowChrome, t as CheckConfirmDialog } from "./check-confirm-dialog-2j0gOd7x.js";
2
+ import { _ as reasonText, h as useFlowDialogTexts, i as makeTestId, m as useFlowChrome, t as CheckConfirmDialog } from "./check-confirm-dialog-CtiRzOAt.js";
3
3
  import { t as useNoticeSink } from "./success-notices-LDEgEkc4.js";
4
4
  import { APP_ACTION_RESOURCE } from "@burojs/core";
5
5
  import { recordKeyOf, useApp, useI18nCaps, useOptionalT, useProjectedTitle, useTestIds } from "@burojs/react";
@@ -258,7 +258,10 @@ function BulkFlowRunner({ resource, actionName, ids, onFinish }) {
258
258
  confirmable: confirming ? snapshot.warnings.map((warning) => ({
259
259
  code: "check.warning",
260
260
  message: {
261
- ...toMessageRef(warning.message, `checks.${warning.id}`),
261
+ ...toMessageRef(warning.rows === void 0 ? warning.message : `${warning.message} — ${t("flow.bulkWarningRows", {
262
+ defaultValue: warning.rows === 1 ? "1 row" : `${warning.rows} rows`,
263
+ count: warning.rows
264
+ })}`, `checks.${warning.id}`),
262
265
  params: { resolved: true }
263
266
  },
264
267
  path: [],
@@ -281,4 +284,4 @@ function BulkFlowRunner({ resource, actionName, ids, onFinish }) {
281
284
  //#endregion
282
285
  export { AppFlowRunner, BulkFlowRunner, FlowRunner };
283
286
 
284
- //# sourceMappingURL=flow-runtime-DyqTmK3H.js.map
287
+ //# sourceMappingURL=flow-runtime-DrUWyTS0.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flow-runtime-DyqTmK3H.js","names":[],"sources":["../src/flows/flow-runtime.tsx"],"sourcesContent":["'use client';\n/**\n * The flow runtime's side of the UI kit (P4, the coordinator's ruling on the bundle): every\n * component that holds a run. It loads on the first sign that a user means to run a flow (a\n * hover, a focus, a menu opening, at the latest the click) through `./load-runtime.js`, and with\n * it `@burojs/react/flows` and `@burojs/core/flows` — the flow machine stays out of an\n * application's first screen.\n */\nimport { toMessageRef } from '@burojs/core/internal';\nimport {\n APP_ACTION_RESOURCE,\n type BulkProgress,\n type FlowControlState,\n type FlowResult,\n type Row,\n type ValidationIssue,\n} from '@burojs/core';\nimport {\n type CheckGateState,\n recordKeyOf,\n useApp,\n useI18nCaps,\n useOptionalT,\n useProjectedTitle,\n useTestIds,\n} from '@burojs/react';\nimport {\n type FlowHostControl,\n type UseFlowRunResult,\n useFlowHost,\n useFlowRun,\n} from '@burojs/react/flows';\nimport { type ReactElement, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { makeTestId } from '../actions/action-button.js';\nimport { CheckConfirmDialog } from '../checks/check-confirm-dialog.js';\nimport { useNoticeSink } from '../forms/success-notices.js';\nimport { reasonText } from '../lib/reason-text.js';\nimport { toast } from '../notification/toaster.js';\nimport { type FlowChrome, useFlowChrome, useFlowDialogTexts } from './chrome.js';\n\nconst NO_ISSUES: readonly ValidationIssue[] = Object.freeze([]);\n\n/**\n * Runs a flow from its control (4.15): a flow with a host presents it and the interaction ends\n * when it closes; a `{ label, submit }` flow sends, asks through the confirm dialog when\n * `confirm` or a fired warning asks, and shows `rejected`, `failed` and `unknown` in the flow's\n * screen in a dialog (`success` notifies through the flow's `then` and shows the write's notices; a lock another tab holds\n * says so; an `unavailable` send toasts the run's reason). `launch()` settles when the interaction is over.\n */\nfunction useFlowLauncher(\n flow: UseFlowRunResult,\n host: FlowHostControl,\n chrome: FlowChrome,\n resource: string,\n testid: string,\n): { readonly launch: () => Promise<void>; readonly dialog: ReactElement | null } {\n const t = useOptionalT();\n // An app flow's reason resolves app-wide: it has no resource bundle of its own.\n const own = resource === APP_ACTION_RESOURCE ? undefined : resource;\n const caps = useI18nCaps(own);\n // The write's own notices (spec 4.7): a host-less flow mounts no flow screen to show them, so\n // the launcher shows them through the same sink the flow screen uses.\n const showNotices = useNoticeSink(own);\n const [confirming, setConfirming] = useState(false);\n const decide = useRef<((proceed: boolean) => void) | null>(null);\n const latest = useRef(flow);\n latest.current = flow;\n useEffect(\n () => () => {\n decide.current?.(false);\n decide.current = null;\n },\n [],\n );\n\n const launch = useCallback(async (): Promise<void> => {\n const { run, compiled } = latest.current;\n if (run === null || compiled === null) return;\n if (compiled.hasHost) {\n await (host.open() ?? Promise.resolve());\n return;\n }\n let result: FlowResult = await run.submit();\n while (result.outcome === 'halted' && (result.step === 'accept' || result.step === 'review')) {\n setConfirming(true);\n const proceed = await new Promise<boolean>((resolve) => {\n decide.current = resolve;\n });\n decide.current = null;\n setConfirming(false);\n if (!proceed) {\n run.startOver();\n return;\n }\n result = await run.accept();\n }\n if (result.outcome === 'success') {\n const { notices } = run.getSnapshot();\n if (notices.length > 0) showNotices(notices);\n return;\n }\n // Another tab holds the attempt's lock: nothing was sent (4.10).\n if (result.outcome === 'failed' && 'reason' in result && result.reason === 'busy') {\n toast(t('flow.busyElsewhere', { defaultValue: 'This action is running in another tab.' }));\n return;\n }\n // The send found the flow unavailable (a check that runs at submit, access revoked since the\n // click): the run's reason, as a refusal before the click shows it.\n if (result.outcome === 'unavailable') {\n const reason = run.getSnapshot().reason;\n toast(\n reason === undefined\n ? t('availability.denied', { defaultValue: \"This action isn't available\" })\n : reasonText(caps, reason, own),\n );\n return;\n }\n if (\n result.outcome === 'rejected' ||\n result.outcome === 'failed' ||\n result.outcome === 'unknown' ||\n (result.outcome === 'halted' && result.step === 'outcome')\n )\n await (host.open('dialog') ?? Promise.resolve());\n }, [host, t, caps, own, showNotices]);\n\n const { snapshot, compiled } = flow;\n const gate: CheckGateState = {\n resource,\n open: confirming,\n busy: false,\n header: null,\n blockers: NO_ISSUES,\n confirmable: confirming\n ? snapshot.warnings.map(\n (warning): ValidationIssue => ({\n code: 'check.warning',\n // The machine's text (bundle and params resolved); the key is the check's.\n message: {\n ...toMessageRef(warning.message, `checks.${warning.id}`),\n // The run's text is final (bundle and params resolved): the dialog shows it as is.\n params: { resolved: true },\n },\n path: [],\n check: { id: warning.id },\n source: 'check',\n severity: 'warning',\n }),\n )\n : NO_ISSUES,\n proceed: () => decide.current?.(true),\n cancel: () => decide.current?.(false),\n };\n const dialog =\n compiled === null || compiled.hasHost ? null : (\n <CheckConfirmDialog\n state={gate}\n testid={`${testid}:confirm`}\n title={chrome.confirmTitle}\n proceedLabel={chrome.confirmProceed}\n {...(chrome.dismiss === undefined ? {} : { cancelLabel: chrome.dismiss })}\n tone={chrome.destructive ? 'destructive' : 'default'}\n />\n );\n return { launch, dialog };\n}\n\nexport interface FlowRunnerProps {\n readonly resource: string;\n readonly actionName: string;\n readonly record?: Row;\n readonly scope: string;\n /** The interaction is over (the host closed, the write answered, the confirm was declined). */\n readonly onClose: () => void;\n}\n\n/**\n * @internal A flow started from a control that holds no run — a row's button, a menu item\n * (4.15: a menu item \"presents its host through the runtime from `onSelect`, so the menu closes\n * normally\"). It renders no control: it starts the run (its `with` sources load now) and, once\n * the run has decided, presents the host or sends; `onClose` reports the end of the\n * interaction. A run that decides against the click (a check over a `with` source fired) says\n * why.\n */\nexport function FlowRunner({\n resource,\n actionName,\n record,\n scope,\n onClose,\n}: FlowRunnerProps): ReactElement | null {\n const target = useMemo(() => ({ resource, action: actionName }), [resource, actionName]);\n const flow = useFlowRun(target, {\n ...(record === undefined ? {} : { record }),\n surface: scope === 'row' ? 'row' : 'menu',\n });\n const chrome = useFlowChrome(resource, actionName);\n const recordKey = recordKeyOf(useApp().registry.get(resource), record);\n const title = useProjectedTitle(resource, recordKey, record);\n const host = useFlowHost(flow, {\n label: chrome.labelText,\n ...(record === undefined || title === '' ? {} : { title }),\n ...(record === undefined ? {} : { record }),\n });\n const tid = useTestIds();\n const t = useOptionalT();\n const caps = useI18nCaps(resource);\n const testid = makeTestId(scope, resource, actionName, String(recordKey ?? ''), tid);\n const { launch, dialog } = useFlowLauncher(flow, host, chrome, resource, testid);\n const started = useRef(false);\n const onCloseRef = useRef(onClose);\n onCloseRef.current = onClose;\n const { snapshot, compiled } = flow;\n const decided =\n compiled !== null &&\n (snapshot.control === 'disabled' ||\n snapshot.control === 'absent' ||\n (snapshot.control === 'ready' &&\n (!compiled.hasHost || snapshot.history.includes('open') || snapshot.step === 'outcome')));\n useEffect(() => {\n if (!decided || started.current) return;\n started.current = true;\n if (snapshot.control !== 'ready') {\n toast(\n snapshot.reason === undefined\n ? t('availability.denied', { defaultValue: \"This action isn't available\" })\n : reasonText(caps, snapshot.reason, resource),\n );\n onCloseRef.current();\n return;\n }\n void launch().finally(() => onCloseRef.current());\n }, [decided, snapshot.control, snapshot.reason, launch, t, caps]);\n return dialog;\n}\n\nexport interface AppFlowRunnerProps {\n /** The app action's name (`defineAppAction({ name, kind: 'flow' })`). */\n readonly name: string;\n /** Its label, as the opener resolved it (`appActions.<name>` over the declared default). */\n readonly label: string;\n /** The opener's test id: the confirm dialog's ids suffix it (`<testid>:confirm:…`). */\n readonly testid: string;\n readonly onClose: () => void;\n}\n\n/**\n * @internal An app flow started from its control (`AppFlowButton`, P4-D): the same launcher as a\n * resource flow's — the host when the flow has a form or a review, else the send with the\n * confirm dialog — over the target `{ appAction: name }`, with no record.\n */\nexport function AppFlowRunner({\n name,\n label,\n testid,\n onClose,\n}: AppFlowRunnerProps): ReactElement | null {\n const target = useMemo(() => ({ appAction: name }), [name]);\n const flow = useFlowRun(target, { surface: 'app' });\n const dialogTexts = useFlowDialogTexts('', name, label);\n const chrome: FlowChrome = {\n label,\n labelText: label,\n icon: undefined,\n destructive: false,\n ...dialogTexts,\n };\n const host = useFlowHost(flow, { label });\n const t = useOptionalT();\n const caps = useI18nCaps();\n const { launch, dialog } = useFlowLauncher(flow, host, chrome, APP_ACTION_RESOURCE, testid);\n const started = useRef(false);\n const onCloseRef = useRef(onClose);\n onCloseRef.current = onClose;\n const { snapshot, compiled } = flow;\n const decided =\n compiled !== null &&\n (snapshot.control === 'disabled' ||\n snapshot.control === 'absent' ||\n (snapshot.control === 'ready' &&\n (!compiled.hasHost || snapshot.history.includes('open') || snapshot.step === 'outcome')));\n useEffect(() => {\n if (!decided || started.current) return;\n started.current = true;\n if (snapshot.control !== 'ready') {\n toast(\n snapshot.reason === undefined\n ? t('availability.denied', { defaultValue: \"This action isn't available\" })\n : reasonText(caps, snapshot.reason),\n );\n onCloseRef.current();\n return;\n }\n void launch().finally(() => onCloseRef.current());\n }, [decided, snapshot.control, snapshot.reason, launch, t, caps]);\n return dialog;\n}\n\nexport interface BulkFlowRunnerProps {\n readonly resource: string;\n readonly actionName: string;\n readonly ids: readonly string[];\n /** The run is over: its result and its per-id report (absent when nothing was sent). */\n readonly onFinish: (result: FlowResult, progress: BulkProgress | undefined) => void;\n}\n\n/**\n * @internal A bulk flow's run over the selection (4.16), started by the bar's click: the confirm\n * (`confirm` and the fired warnings) asks through the confirm dialog, then the run re-reads the\n * rows and writes each under its own key; `onFinish` reports the result and the per-id report.\n */\nexport function BulkFlowRunner({\n resource,\n actionName,\n ids,\n onFinish,\n}: BulkFlowRunnerProps): ReactElement | null {\n const tid = useTestIds();\n const t = useOptionalT();\n const caps = useI18nCaps(resource);\n const idsKey = ids.join('\\u0000');\n // biome-ignore lint/correctness/useExhaustiveDependencies: keyed by the ids' values\n const selection = useMemo(() => ({ ids: [...ids], count: ids.length }), [idsKey]);\n const target = useMemo(() => ({ resource, action: actionName }), [resource, actionName]);\n const flow = useFlowRun(target, { selection, surface: 'bulk' });\n const chrome = useFlowChrome(resource, actionName);\n const testid = tid.bulkAction(resource, actionName);\n const [confirming, setConfirming] = useState(false);\n const decide = useRef<((proceed: boolean) => void) | null>(null);\n const started = useRef(false);\n const onFinishRef = useRef(onFinish);\n onFinishRef.current = onFinish;\n const { run, snapshot } = flow;\n useEffect(\n () => () => {\n decide.current?.(false);\n decide.current = null;\n },\n [],\n );\n const decided =\n run !== null && snapshot.control !== 'undecided' && snapshot.control !== 'pending';\n useEffect(() => {\n if (!decided || started.current || run === null) return;\n started.current = true;\n void (async () => {\n if (run.getSnapshot().control !== 'ready') {\n const refusal = run.getSnapshot().reason;\n toast(\n refusal === undefined\n ? t('availability.denied', { defaultValue: \"This action isn't available\" })\n : reasonText(caps, refusal, resource),\n );\n onFinishRef.current(\n Object.freeze({ outcome: 'unavailable', state: 'disabled' }),\n undefined,\n );\n return;\n }\n let result = await run.submit();\n while (\n result.outcome === 'halted' &&\n (result.step === 'accept' || result.step === 'review')\n ) {\n setConfirming(true);\n const proceed = await new Promise<boolean>((resolve) => {\n decide.current = resolve;\n });\n decide.current = null;\n setConfirming(false);\n if (!proceed) {\n run.startOver();\n onFinishRef.current(result, undefined);\n return;\n }\n result = await run.accept();\n }\n if (result.outcome === 'failed' && 'reason' in result && result.reason === 'busy')\n toast(t('flow.busyElsewhere', { defaultValue: 'This action is running in another tab.' }));\n onFinishRef.current(result, run.getSnapshot().bulk);\n })();\n }, [decided, run, t, caps, resource]);\n const gate: CheckGateState = {\n resource,\n open: confirming,\n busy: false,\n header: null,\n blockers: NO_ISSUES,\n confirmable: confirming\n ? snapshot.warnings.map(\n (warning): ValidationIssue => ({\n code: 'check.warning',\n // The machine's text (bundle and params resolved); the key is the check's.\n message: {\n ...toMessageRef(warning.message, `checks.${warning.id}`),\n // The run's text is final (bundle and params resolved): the dialog shows it as is.\n params: { resolved: true },\n },\n path: [],\n check: { id: warning.id },\n source: 'check',\n severity: 'warning',\n }),\n )\n : NO_ISSUES,\n proceed: () => decide.current?.(true),\n cancel: () => decide.current?.(false),\n };\n return (\n <CheckConfirmDialog\n state={gate}\n testid={`${testid}:confirm`}\n title={chrome.confirmTitle}\n proceedLabel={chrome.confirmProceed}\n {...(chrome.dismiss === undefined ? {} : { cancelLabel: chrome.dismiss })}\n tone={chrome.destructive ? 'destructive' : 'default'}\n />\n );\n}\n"],"mappings":";;;;;;;;;;AAwCA,MAAM,YAAwC,OAAO,OAAO,CAAC,CAAC;AAS9D,SAAS,gBACP,MACA,MACA,QACA,UACA,QACgF;CAChF,MAAM,IAAI,aAAa;CAEvB,MAAM,MAAM,aAAa,sBAAsB,KAAA,IAAY;CAC3D,MAAM,OAAO,YAAY,GAAG;CAG5B,MAAM,cAAc,cAAc,GAAG;CACrC,MAAM,CAAC,YAAY,iBAAiB,SAAS,KAAK;CAClD,MAAM,SAAS,OAA4C,IAAI;CAC/D,MAAM,SAAS,OAAO,IAAI;CAC1B,OAAO,UAAU;CACjB,sBACc;EACV,OAAO,UAAU,KAAK;EACtB,OAAO,UAAU;CACnB,GACA,CAAC,CACH;CAEA,MAAM,SAAS,YAAY,YAA2B;EACpD,MAAM,EAAE,KAAK,aAAa,OAAO;EACjC,IAAI,QAAQ,QAAQ,aAAa,MAAM;EACvC,IAAI,SAAS,SAAS;GACpB,OAAO,KAAK,KAAK,KAAK,QAAQ,QAAQ;GACtC;EACF;EACA,IAAI,SAAqB,MAAM,IAAI,OAAO;EAC1C,OAAO,OAAO,YAAY,aAAa,OAAO,SAAS,YAAY,OAAO,SAAS,WAAW;GAC5F,cAAc,IAAI;GAClB,MAAM,UAAU,MAAM,IAAI,SAAkB,YAAY;IACtD,OAAO,UAAU;GACnB,CAAC;GACD,OAAO,UAAU;GACjB,cAAc,KAAK;GACnB,IAAI,CAAC,SAAS;IACZ,IAAI,UAAU;IACd;GACF;GACA,SAAS,MAAM,IAAI,OAAO;EAC5B;EACA,IAAI,OAAO,YAAY,WAAW;GAChC,MAAM,EAAE,YAAY,IAAI,YAAY;GACpC,IAAI,QAAQ,SAAS,GAAG,YAAY,OAAO;GAC3C;EACF;EAEA,IAAI,OAAO,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-DrUWyTS0.js","names":[],"sources":["../src/flows/flow-runtime.tsx"],"sourcesContent":["'use client';\n/**\n * The flow runtime's side of the UI kit (P4, the coordinator's ruling on the bundle): every\n * component that holds a run. It loads on the first sign that a user means to run a flow (a\n * hover, a focus, a menu opening, at the latest the click) through `./load-runtime.js`, and with\n * it `@burojs/react/flows` and `@burojs/core/flows` — the flow machine stays out of an\n * application's first screen.\n */\nimport { toMessageRef } from '@burojs/core/internal';\nimport {\n APP_ACTION_RESOURCE,\n type BulkProgress,\n type FlowControlState,\n type FlowResult,\n type Row,\n type ValidationIssue,\n} from '@burojs/core';\nimport {\n type CheckGateState,\n recordKeyOf,\n useApp,\n useI18nCaps,\n useOptionalT,\n useProjectedTitle,\n useTestIds,\n} from '@burojs/react';\nimport {\n type FlowHostControl,\n type UseFlowRunResult,\n useFlowHost,\n useFlowRun,\n} from '@burojs/react/flows';\nimport { type ReactElement, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { makeTestId } from '../actions/action-button.js';\nimport { CheckConfirmDialog } from '../checks/check-confirm-dialog.js';\nimport { useNoticeSink } from '../forms/success-notices.js';\nimport { reasonText } from '../lib/reason-text.js';\nimport { toast } from '../notification/toaster.js';\nimport { type FlowChrome, useFlowChrome, useFlowDialogTexts } from './chrome.js';\n\nconst NO_ISSUES: readonly ValidationIssue[] = Object.freeze([]);\n\n/**\n * Runs a flow from its control (4.15): a flow with a host presents it and the interaction ends\n * when it closes; a `{ label, submit }` flow sends, asks through the confirm dialog when\n * `confirm` or a fired warning asks, and shows `rejected`, `failed` and `unknown` in the flow's\n * screen in a dialog (`success` notifies through the flow's `then` and shows the write's notices; a lock another tab holds\n * says so; an `unavailable` send toasts the run's reason). `launch()` settles when the interaction is over.\n */\nfunction useFlowLauncher(\n flow: UseFlowRunResult,\n host: FlowHostControl,\n chrome: FlowChrome,\n resource: string,\n testid: string,\n): { readonly launch: () => Promise<void>; readonly dialog: ReactElement | null } {\n const t = useOptionalT();\n // An app flow's reason resolves app-wide: it has no resource bundle of its own.\n const own = resource === APP_ACTION_RESOURCE ? undefined : resource;\n const caps = useI18nCaps(own);\n // The write's own notices (spec 4.7): a host-less flow mounts no flow screen to show them, so\n // the launcher shows them through the same sink the flow screen uses.\n const showNotices = useNoticeSink(own);\n const [confirming, setConfirming] = useState(false);\n const decide = useRef<((proceed: boolean) => void) | null>(null);\n const latest = useRef(flow);\n latest.current = flow;\n useEffect(\n () => () => {\n decide.current?.(false);\n decide.current = null;\n },\n [],\n );\n\n const launch = useCallback(async (): Promise<void> => {\n const { run, compiled } = latest.current;\n if (run === null || compiled === null) return;\n if (compiled.hasHost) {\n await (host.open() ?? Promise.resolve());\n return;\n }\n let result: FlowResult = await run.submit();\n while (result.outcome === 'halted' && (result.step === 'accept' || result.step === 'review')) {\n setConfirming(true);\n const proceed = await new Promise<boolean>((resolve) => {\n decide.current = resolve;\n });\n decide.current = null;\n setConfirming(false);\n if (!proceed) {\n run.startOver();\n return;\n }\n result = await run.accept();\n }\n if (result.outcome === 'success') {\n const { notices } = run.getSnapshot();\n if (notices.length > 0) showNotices(notices);\n return;\n }\n // Another tab holds the attempt's lock: nothing was sent (4.10).\n if (result.outcome === 'failed' && 'reason' in result && result.reason === 'busy') {\n toast(t('flow.busyElsewhere', { defaultValue: 'This action is running in another tab.' }));\n return;\n }\n // The send found the flow unavailable (a check that runs at submit, access revoked since the\n // click): the run's reason, as a refusal before the click shows it.\n if (result.outcome === 'unavailable') {\n const reason = run.getSnapshot().reason;\n toast(\n reason === undefined\n ? t('availability.denied', { defaultValue: \"This action isn't available\" })\n : reasonText(caps, reason, own),\n );\n return;\n }\n if (\n result.outcome === 'rejected' ||\n result.outcome === 'failed' ||\n result.outcome === 'unknown' ||\n (result.outcome === 'halted' && result.step === 'outcome')\n )\n await (host.open('dialog') ?? Promise.resolve());\n }, [host, t, caps, own, showNotices]);\n\n const { snapshot, compiled } = flow;\n const gate: CheckGateState = {\n resource,\n open: confirming,\n busy: false,\n header: null,\n blockers: NO_ISSUES,\n confirmable: confirming\n ? snapshot.warnings.map(\n (warning): ValidationIssue => ({\n code: 'check.warning',\n // The machine's text (bundle and params resolved); the key is the check's.\n message: {\n ...toMessageRef(warning.message, `checks.${warning.id}`),\n // The run's text is final (bundle and params resolved): the dialog shows it as is.\n params: { resolved: true },\n },\n path: [],\n check: { id: warning.id },\n source: 'check',\n severity: 'warning',\n }),\n )\n : NO_ISSUES,\n proceed: () => decide.current?.(true),\n cancel: () => decide.current?.(false),\n };\n const dialog =\n compiled === null || compiled.hasHost ? null : (\n <CheckConfirmDialog\n state={gate}\n testid={`${testid}:confirm`}\n title={chrome.confirmTitle}\n proceedLabel={chrome.confirmProceed}\n {...(chrome.dismiss === undefined ? {} : { cancelLabel: chrome.dismiss })}\n tone={chrome.destructive ? 'destructive' : 'default'}\n />\n );\n return { launch, dialog };\n}\n\nexport interface FlowRunnerProps {\n readonly resource: string;\n readonly actionName: string;\n readonly record?: Row;\n readonly scope: string;\n /** The interaction is over (the host closed, the write answered, the confirm was declined). */\n readonly onClose: () => void;\n}\n\n/**\n * @internal A flow started from a control that holds no run — a row's button, a menu item\n * (4.15: a menu item \"presents its host through the runtime from `onSelect`, so the menu closes\n * normally\"). It renders no control: it starts the run (its `with` sources load now) and, once\n * the run has decided, presents the host or sends; `onClose` reports the end of the\n * interaction. A run that decides against the click (a check over a `with` source fired) says\n * why.\n */\nexport function FlowRunner({\n resource,\n actionName,\n record,\n scope,\n onClose,\n}: FlowRunnerProps): ReactElement | null {\n const target = useMemo(() => ({ resource, action: actionName }), [resource, actionName]);\n const flow = useFlowRun(target, {\n ...(record === undefined ? {} : { record }),\n surface: scope === 'row' ? 'row' : 'menu',\n });\n const chrome = useFlowChrome(resource, actionName);\n const recordKey = recordKeyOf(useApp().registry.get(resource), record);\n const title = useProjectedTitle(resource, recordKey, record);\n const host = useFlowHost(flow, {\n label: chrome.labelText,\n ...(record === undefined || title === '' ? {} : { title }),\n ...(record === undefined ? {} : { record }),\n });\n const tid = useTestIds();\n const t = useOptionalT();\n const caps = useI18nCaps(resource);\n const testid = makeTestId(scope, resource, actionName, String(recordKey ?? ''), tid);\n const { launch, dialog } = useFlowLauncher(flow, host, chrome, resource, testid);\n const started = useRef(false);\n const onCloseRef = useRef(onClose);\n onCloseRef.current = onClose;\n const { snapshot, compiled } = flow;\n const decided =\n compiled !== null &&\n (snapshot.control === 'disabled' ||\n snapshot.control === 'absent' ||\n (snapshot.control === 'ready' &&\n (!compiled.hasHost || snapshot.history.includes('open') || snapshot.step === 'outcome')));\n useEffect(() => {\n if (!decided || started.current) return;\n started.current = true;\n if (snapshot.control !== 'ready') {\n toast(\n snapshot.reason === undefined\n ? t('availability.denied', { defaultValue: \"This action isn't available\" })\n : reasonText(caps, snapshot.reason, resource),\n );\n onCloseRef.current();\n return;\n }\n void launch().finally(() => onCloseRef.current());\n }, [decided, snapshot.control, snapshot.reason, launch, t, caps]);\n return dialog;\n}\n\nexport interface AppFlowRunnerProps {\n /** The app action's name (`defineAppAction({ name, kind: 'flow' })`). */\n readonly name: string;\n /** Its label, as the opener resolved it (`appActions.<name>` over the declared default). */\n readonly label: string;\n /** The opener's test id: the confirm dialog's ids suffix it (`<testid>:confirm:…`). */\n readonly testid: string;\n readonly onClose: () => void;\n}\n\n/**\n * @internal An app flow started from its control (`AppFlowButton`, P4-D): the same launcher as a\n * resource flow's — the host when the flow has a form or a review, else the send with the\n * confirm dialog — over the target `{ appAction: name }`, with no record.\n */\nexport function AppFlowRunner({\n name,\n label,\n testid,\n onClose,\n}: AppFlowRunnerProps): ReactElement | null {\n const target = useMemo(() => ({ appAction: name }), [name]);\n const flow = useFlowRun(target, { surface: 'app' });\n const dialogTexts = useFlowDialogTexts('', name, label);\n const chrome: FlowChrome = {\n label,\n labelText: label,\n icon: undefined,\n destructive: false,\n ...dialogTexts,\n };\n const host = useFlowHost(flow, { label });\n const t = useOptionalT();\n const caps = useI18nCaps();\n const { launch, dialog } = useFlowLauncher(flow, host, chrome, APP_ACTION_RESOURCE, testid);\n const started = useRef(false);\n const onCloseRef = useRef(onClose);\n onCloseRef.current = onClose;\n const { snapshot, compiled } = flow;\n const decided =\n compiled !== null &&\n (snapshot.control === 'disabled' ||\n snapshot.control === 'absent' ||\n (snapshot.control === 'ready' &&\n (!compiled.hasHost || snapshot.history.includes('open') || snapshot.step === 'outcome')));\n useEffect(() => {\n if (!decided || started.current) return;\n started.current = true;\n if (snapshot.control !== 'ready') {\n toast(\n snapshot.reason === undefined\n ? t('availability.denied', { defaultValue: \"This action isn't available\" })\n : reasonText(caps, snapshot.reason),\n );\n onCloseRef.current();\n return;\n }\n void launch().finally(() => onCloseRef.current());\n }, [decided, snapshot.control, snapshot.reason, launch, t, caps]);\n return dialog;\n}\n\nexport interface BulkFlowRunnerProps {\n readonly resource: string;\n readonly actionName: string;\n readonly ids: readonly string[];\n /** The run is over: its result and its per-id report (absent when nothing was sent). */\n readonly onFinish: (result: FlowResult, progress: BulkProgress | undefined) => void;\n}\n\n/**\n * @internal A bulk flow's run over the selection (4.16), started by the bar's click: the confirm\n * (`confirm` and the fired warnings) asks through the confirm dialog, then the run (re-reading the\n * rows first where the flow declares `submit.reread`) writes each under its own key; `onFinish` reports the result and the per-id report.\n */\nexport function BulkFlowRunner({\n resource,\n actionName,\n ids,\n onFinish,\n}: BulkFlowRunnerProps): ReactElement | null {\n const tid = useTestIds();\n const t = useOptionalT();\n const caps = useI18nCaps(resource);\n const idsKey = ids.join('\\u0000');\n // biome-ignore lint/correctness/useExhaustiveDependencies: keyed by the ids' values\n const selection = useMemo(() => ({ ids: [...ids], count: ids.length }), [idsKey]);\n const target = useMemo(() => ({ resource, action: actionName }), [resource, actionName]);\n const flow = useFlowRun(target, { selection, surface: 'bulk' });\n const chrome = useFlowChrome(resource, actionName);\n const testid = tid.bulkAction(resource, actionName);\n const [confirming, setConfirming] = useState(false);\n const decide = useRef<((proceed: boolean) => void) | null>(null);\n const started = useRef(false);\n const onFinishRef = useRef(onFinish);\n onFinishRef.current = onFinish;\n const { run, snapshot } = flow;\n useEffect(\n () => () => {\n decide.current?.(false);\n decide.current = null;\n },\n [],\n );\n const decided =\n run !== null && snapshot.control !== 'undecided' && snapshot.control !== 'pending';\n useEffect(() => {\n if (!decided || started.current || run === null) return;\n started.current = true;\n void (async () => {\n if (run.getSnapshot().control !== 'ready') {\n const refusal = run.getSnapshot().reason;\n toast(\n refusal === undefined\n ? t('availability.denied', { defaultValue: \"This action isn't available\" })\n : reasonText(caps, refusal, resource),\n );\n onFinishRef.current(\n Object.freeze({ outcome: 'unavailable', state: 'disabled' }),\n undefined,\n );\n return;\n }\n let result = await run.submit();\n while (\n result.outcome === 'halted' &&\n (result.step === 'accept' || result.step === 'review')\n ) {\n setConfirming(true);\n const proceed = await new Promise<boolean>((resolve) => {\n decide.current = resolve;\n });\n decide.current = null;\n setConfirming(false);\n if (!proceed) {\n run.startOver();\n onFinishRef.current(result, undefined);\n return;\n }\n result = await run.accept();\n }\n if (result.outcome === 'failed' && 'reason' in result && result.reason === 'busy')\n toast(t('flow.busyElsewhere', { defaultValue: 'This action is running in another tab.' }));\n onFinishRef.current(result, run.getSnapshot().bulk);\n })();\n }, [decided, run, t, caps, resource]);\n const gate: CheckGateState = {\n resource,\n open: confirming,\n busy: false,\n header: null,\n blockers: NO_ISSUES,\n confirmable: confirming\n ? snapshot.warnings.map(\n (warning): ValidationIssue => ({\n code: 'check.warning',\n // The machine's text (bundle and params resolved); the key is the check's.\n message: {\n ...toMessageRef(\n warning.rows === undefined\n ? warning.message\n : `${warning.message} — ${t('flow.bulkWarningRows', {\n defaultValue: warning.rows === 1 ? '1 row' : `${warning.rows} rows`,\n count: warning.rows,\n })}`,\n `checks.${warning.id}`,\n ),\n // The run's text is final (bundle and params resolved): the dialog shows it as is.\n params: { resolved: true },\n },\n path: [],\n check: { id: warning.id },\n source: 'check',\n severity: 'warning',\n }),\n )\n : NO_ISSUES,\n proceed: () => decide.current?.(true),\n cancel: () => decide.current?.(false),\n };\n return (\n <CheckConfirmDialog\n state={gate}\n testid={`${testid}:confirm`}\n title={chrome.confirmTitle}\n proceedLabel={chrome.confirmProceed}\n {...(chrome.dismiss === undefined ? {} : { cancelLabel: chrome.dismiss })}\n tone={chrome.destructive ? 'destructive' : 'default'}\n />\n );\n}\n"],"mappings":";;;;;;;;;;AAwCA,MAAM,YAAwC,OAAO,OAAO,CAAC,CAAC;AAS9D,SAAS,gBACP,MACA,MACA,QACA,UACA,QACgF;CAChF,MAAM,IAAI,aAAa;CAEvB,MAAM,MAAM,aAAa,sBAAsB,KAAA,IAAY;CAC3D,MAAM,OAAO,YAAY,GAAG;CAG5B,MAAM,cAAc,cAAc,GAAG;CACrC,MAAM,CAAC,YAAY,iBAAiB,SAAS,KAAK;CAClD,MAAM,SAAS,OAA4C,IAAI;CAC/D,MAAM,SAAS,OAAO,IAAI;CAC1B,OAAO,UAAU;CACjB,sBACc;EACV,OAAO,UAAU,KAAK;EACtB,OAAO,UAAU;CACnB,GACA,CAAC,CACH;CAEA,MAAM,SAAS,YAAY,YAA2B;EACpD,MAAM,EAAE,KAAK,aAAa,OAAO;EACjC,IAAI,QAAQ,QAAQ,aAAa,MAAM;EACvC,IAAI,SAAS,SAAS;GACpB,OAAO,KAAK,KAAK,KAAK,QAAQ,QAAQ;GACtC;EACF;EACA,IAAI,SAAqB,MAAM,IAAI,OAAO;EAC1C,OAAO,OAAO,YAAY,aAAa,OAAO,SAAS,YAAY,OAAO,SAAS,WAAW;GAC5F,cAAc,IAAI;GAClB,MAAM,UAAU,MAAM,IAAI,SAAkB,YAAY;IACtD,OAAO,UAAU;GACnB,CAAC;GACD,OAAO,UAAU;GACjB,cAAc,KAAK;GACnB,IAAI,CAAC,SAAS;IACZ,IAAI,UAAU;IACd;GACF;GACA,SAAS,MAAM,IAAI,OAAO;EAC5B;EACA,IAAI,OAAO,YAAY,WAAW;GAChC,MAAM,EAAE,YAAY,IAAI,YAAY;GACpC,IAAI,QAAQ,SAAS,GAAG,YAAY,OAAO;GAC3C;EACF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OAAO;EACd,cAAc,OAAO;EACrB,GAAK,OAAO,YAAY,KAAA,IAAY,CAAC,IAAI,EAAE,aAAa,OAAO,QAAQ;EACvE,MAAM,OAAO,cAAc,gBAAgB;CAC5C,CAAA;AAEL"}
@@ -1,6 +1,6 @@
1
- import { A as OwnTitleHeading, N as OwnTitleContext, _ as reasonText, dt as DocInfo, j as useFocusOnMount } from "./check-confirm-dialog-2j0gOd7x.js";
1
+ import { A as OwnTitleHeading, N as OwnTitleContext, _ as reasonText, dt as DocInfo, j as useFocusOnMount } from "./check-confirm-dialog-CtiRzOAt.js";
2
2
  import { t as Button } from "./button-MWVeZaqj.js";
3
- import { H as ScreenTree, J as FormControlProvider, Pt as FieldDisplay, X as useFormControlOf, n as viewOf, t as selectImplementation } from "./place-node-CfzQvh4Y.js";
3
+ import { H as ScreenTree, J as FormControlProvider, Mt as FieldDisplay, X as useFormControlOf, n as viewOf, t as selectImplementation } from "./place-node-BdxT-30h.js";
4
4
  import { t as useNoticeSink } from "./success-notices-LDEgEkc4.js";
5
5
  import { declaredText, fieldSensitivity, flowRecordOf, humanizeKey, textsValueAt, validatePlacementProps } from "@burojs/core";
6
6
  import { BulkSelectionScope, REJECTED_KEYS, ScreenStateProvider, resolveValidationMessage, specificErrorText, useChromeT, useDismissPending, useFlowFormCatalog, useFlowOpenImplementation, useFormController, useI18nCaps, useOptionalT, useProjectedTitle, useTestIds, useUIInstance, useUIPresentationRuntime } from "@burojs/react";
@@ -9,7 +9,7 @@ import { Suspense, createContext, useContext, useEffect, useMemo, useRef, useSta
9
9
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
10
10
  import * as DialogPrimitive from "@radix-ui/react-dialog";
11
11
  import { fieldEntriesToMap } from "@burojs/core/internal";
12
- import { FlowTextsScope, useFlowForm, useFlowMetaSources, useFlowRun } from "@burojs/react/flows";
12
+ import { FlowTextsScope, useFlowFieldConditions, useFlowForm, useFlowMetaSources, useFlowRun } from "@burojs/react/flows";
13
13
  //#region src/flows/review-diff.tsx
14
14
  const REVIEW_DIFF_BLOCK = "buro:review-diff";
15
15
  function sensitive(definition) {
@@ -656,11 +656,13 @@ function ReviewTree({ compiled, tree, values, prefix, run, record, args }) {
656
656
  const body = useState(() => () => tree)[0];
657
657
  const blocks = useFlowFormCatalog();
658
658
  const metaSources = useFlowMetaSources(record, args, compiled.resource);
659
+ const fieldConditions = useFlowFieldConditions(compiled);
659
660
  const review = useFormController({
660
661
  blocks,
661
662
  flowRun: run,
662
663
  formId: compiled.formId,
663
664
  metaSources,
665
+ ...fieldConditions === void 0 ? {} : { flowFieldConditions: fieldConditions },
664
666
  review: true,
665
667
  fields: map,
666
668
  body,
@@ -742,4 +744,4 @@ function FlowOpenBlock({ open, testid }) {
742
744
  //#endregion
743
745
  export { FlowHostBindingContext, FlowScreen, HostedFlowScreen };
744
746
 
745
- //# sourceMappingURL=flow-screen-DCdli6Ha.js.map
747
+ //# sourceMappingURL=flow-screen-3fk6J33y.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow-screen-3fk6J33y.js","names":[],"sources":["../src/flows/review-diff.tsx","../src/flows/flow-screen.tsx"],"sourcesContent":["'use client';\nimport { fieldSensitivity, humanizeKey, type Row } from '@burojs/core';\nimport { type FormController, useOptionalT } from '@burojs/react';\nimport type { ReactElement } from 'react';\nimport { FieldDisplay } from '../forms/field.js';\n\n/** The built-in review block of a flow (`review: true`, P4 spec 4.4). */\nexport const REVIEW_DIFF_BLOCK = 'buro:review-diff';\n\nexport interface ReviewDiffProps {\n /** The flow's form: its active fields, their definitions and labels. */\n readonly form: FormController;\n /** The values the form opened on (`form.initial`): the baseline of the diff. */\n readonly initial: Row;\n /** The values as they will be submitted. */\n readonly values: Row;\n /** Text and doc keys of the form (`<resource>.actions.<name>`). */\n readonly i18nPrefix: string;\n /** The test id base (the flow's host). */\n readonly testid: string;\n}\n\n/** Whether a field is `sensitive` (a mark or a mask). */\nfunction sensitive(definition: unknown): boolean {\n if (fieldSensitivity(definition) !== undefined) return true;\n if (definition === null || typeof definition !== 'object') return false;\n const opts = (definition as { readonly opts?: unknown }).opts;\n const marked =\n opts !== null && typeof opts === 'object'\n ? (opts as { readonly sensitive?: unknown }).sensitive\n : undefined;\n return marked !== undefined && marked !== false && marked !== null;\n}\n\nconst same = (a: unknown, b: unknown): boolean => {\n if (Object.is(a, b)) return true;\n const empty = (value: unknown) => value === undefined || value === null || value === '';\n if (empty(a) && empty(b)) return true;\n try {\n return JSON.stringify(a) === JSON.stringify(b);\n } catch {\n return false;\n }\n};\n\n/**\n * The review of a flow (`review: true`, 4.4): one row per active form field whose value differs\n * from the one the form opened on — its label, the old display value and the new one. A\n * `sensitive` field says \"changed\" and shows no value, old or new.\n */\nexport function ReviewDiff({\n form,\n initial,\n values,\n i18nPrefix,\n testid,\n}: ReviewDiffProps): ReactElement {\n const t = useOptionalT();\n const changedText = t('review.changed', { defaultValue: 'changed' });\n const rows = form.fields.filter((binding) => !same(initial[binding.name], values[binding.name]));\n return (\n <dl data-testid={`${testid}:review`} data-buro-block={REVIEW_DIFF_BLOCK} className=\"grid gap-2\">\n {rows.map((binding) => {\n const definition = binding.field as unknown as { readonly label?: unknown };\n const label =\n typeof definition.label === 'string' ? definition.label : humanizeKey(binding.name);\n const hidden = sensitive(binding.field);\n return (\n <div\n key={binding.name}\n data-testid={`${testid}:review:${binding.name}`}\n className=\"grid grid-cols-[minmax(0,1fr)_minmax(0,2fr)] gap-2 text-sm\"\n >\n <dt className=\"font-medium\">{label}</dt>\n <dd className=\"flex flex-wrap items-center gap-2\">\n {hidden ? (\n <span className=\"text-muted-foreground\">{changedText}</span>\n ) : (\n <>\n <span data-buro-review=\"old\" className=\"text-muted-foreground line-through\">\n <FieldDisplay\n i18nPrefix={i18nPrefix}\n name={binding.name}\n field={binding.field as never}\n value={initial[binding.name]}\n fallback={<span>{display(initial[binding.name])}</span>}\n />\n </span>\n <span aria-hidden=\"true\">→</span>\n <span data-buro-review=\"new\">\n <FieldDisplay\n i18nPrefix={i18nPrefix}\n name={binding.name}\n field={binding.field as never}\n value={values[binding.name]}\n fallback={<span>{display(values[binding.name])}</span>}\n />\n </span>\n </>\n )}\n </dd>\n </div>\n );\n })}\n </dl>\n );\n}\n\nconst display = (value: unknown): string =>\n value === undefined || value === null || value === '' ? '—' : String(value);\n","'use client';\nimport {\n type CompiledFlow,\n type FlowResult,\n type FlowRun,\n declaredText,\n flowRecordOf,\n type FlowSnapshot,\n type PropValidation,\n textsValueAt,\n validatePlacementProps,\n} from '@burojs/core';\nimport {\n BulkSelectionScope,\n type ErrorTextCaps,\n REJECTED_KEYS,\n specificErrorText,\n type FlowScreenProps,\n type FlowStart,\n ScreenStateProvider,\n resolveValidationMessage,\n useFlowOpenImplementation,\n useDismissPending,\n useFlowFormCatalog,\n useFormController,\n useI18nCaps,\n useChromeT,\n useOptionalT,\n useProjectedTitle,\n useTestIds,\n useUIInstance,\n useUIPresentationRuntime,\n} from '@burojs/react';\nimport { fieldEntriesToMap } from '@burojs/core/internal';\nimport {\n FlowTextsScope,\n useFlowFieldConditions,\n useFlowForm,\n useFlowMetaSources,\n useFlowRun,\n} from '@burojs/react/flows';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { IconLoader2, IconX } from '@tabler/icons-react';\nimport {\n type ReactElement,\n type ReactNode,\n Suspense,\n createContext,\n useContext,\n useMemo,\n useEffect,\n useRef,\n useState,\n useSyncExternalStore,\n} from 'react';\nimport { DocInfo } from '../doc/doc-info.js';\nimport { useNoticeSink } from '../forms/success-notices.js';\nimport { reasonText } from '../lib/reason-text.js';\nimport { Button } from '../primitives/button.js';\nimport { FormControlProvider, useFormControlOf } from '../resource/form-context.js';\nimport { ScreenTree } from '../screen/screen-tree.js';\nimport { selectImplementation, viewOf } from '../blocks/place-node.js';\nimport { ReviewDiff } from './review-diff.js';\nimport { OwnTitleContext } from '../ui-presentations/shell.js';\nimport { OwnTitleHeading, useFocusOnMount } from './overlay-heading.js';\n\n/**\n * Thrown from the form controller's write: the controller validated (and revealed the first\n * failing field), and the run — not the controller — sends. A write that throws leaves the form\n * dirty and its draft in place (the controller re-baselines only on a write that resolves), and\n * an abort-shaped value is no reportable failure.\n */\nconst HELD = Object.freeze({ name: 'AbortError', message: 'The flow run sends the values.' });\n\n/**\n * How the flow screen leaves its host (P6): an overlay dismisses its presentation instance, a\n * page navigates to the record through the guard, an inline placement shows the next form. The\n * screen asks `close()` for Cancel, ✕ and Back, and `finish()` once a success needs nothing more\n * shown (no `then.open: { block }`).\n * @internal\n */\nexport interface FlowHostBinding {\n readonly kind: 'overlay' | 'page' | 'inline';\n close(): void;\n finish(): void;\n}\n\n/** @internal Provided by the page and inline hosts; an overlay builds its own. */\n/** @internal */\nexport function HostedFlowScreen(\n props: FlowScreenProps & { readonly binding: FlowHostBinding },\n): ReactElement | null {\n const { binding, ...rest } = props;\n return (\n <FlowHostBindingContext.Provider value={binding}>\n <FlowScreen {...rest} />\n </FlowHostBindingContext.Provider>\n );\n}\n\nexport const FlowHostBindingContext = createContext<FlowHostBinding | null>(null);\n\n/** Gives the screen below it the overlay's binding: its presentation instance. */\nfunction OverlayBinding({ children }: { readonly children: ReactNode }): ReactElement {\n const instance = useUIInstance();\n const runtime = useUIPresentationRuntime();\n const binding = useMemo<FlowHostBinding>(\n () => ({\n kind: 'overlay',\n close: () => instance.dismiss(),\n finish: () => runtime.dismiss(instance.id),\n }),\n [instance, runtime],\n );\n return (\n <FlowHostBindingContext.Provider value={binding}>{children}</FlowHostBindingContext.Provider>\n );\n}\n\n/** The screen's binding when a page or inline host provided one, else the overlay's. */\nfunction WithBinding({ children }: { readonly children: ReactNode }): ReactElement {\n const provided = useContext(FlowHostBindingContext);\n return provided !== null ? <>{children}</> : <OverlayBinding>{children}</OverlayBinding>;\n}\n\ntype Translate = ReturnType<typeof useOptionalT>;\n\n/**\n * What the outcome area says, or `null` when the screen has nothing to report. A rejection reads\n * the specific text of its code first (spec 4.15 steps 1 to 4: the flow's `<textPrefix>.validation.<code>`\n * and declared `texts.validation`, the provider's reference, the shared code texts). Only when none\n * resolves does a mapped kind read the flow's own `<textPrefix>.rejected.<kind>`, then its declared\n * `texts.rejected.<kind>` (`flow`), before the framework's neutral `flow.rejected.<kind>`;\n * `textPrefix` is the compiled flow's `textKeys.prefix`.\n */\nfunction outcomeMessage(\n snapshot: FlowSnapshot,\n busy: boolean,\n t: Translate,\n caps: ErrorTextCaps,\n textPrefix: string,\n flow: { readonly texts?: unknown } | undefined,\n reasonOf: (reason: string) => string,\n): string | null {\n if (busy)\n return t('flow.busyElsewhere', { defaultValue: 'This action is running in another tab.' });\n const outcome = snapshot.outcome;\n if (outcome === undefined || outcome.outcome === 'success') {\n // A check that could not decide blocks the flow (4.3): its reason, with Retry.\n if (snapshot.control === 'disabled' && snapshot.reason !== undefined)\n return reasonOf(snapshot.reason);\n return null;\n }\n if (outcome.outcome === 'unknown')\n return [\n outcome.applied === 'partial'\n ? t('flow.unknownPartial', {\n defaultValue: 'Part of this may have been applied. Nothing was resent.',\n })\n : t('flow.unknown', {\n defaultValue: 'It may have been applied. Nothing was resent.',\n }),\n ...(snapshot.reason === undefined ? [] : [reasonOf(snapshot.reason)]),\n ].join(' ');\n if (outcome.outcome === 'rejected') {\n if (snapshot.reason !== undefined) return reasonOf(snapshot.reason);\n const kind = 'kind' in outcome ? outcome.kind : undefined;\n const code = 'code' in outcome ? outcome.code : undefined;\n if (code !== undefined) {\n const specific = specificErrorText(\n {\n code,\n ...('message' in outcome && outcome.message !== undefined\n ? { message: outcome.message }\n : {}),\n },\n caps,\n { action: { prefix: textPrefix, texts: flow?.texts } },\n );\n if (specific !== undefined) return specific;\n }\n const key = kind === undefined ? undefined : REJECTED_KEYS[kind];\n if (key !== undefined)\n return t(`${textPrefix}.rejected.${key}`, {\n defaultValue:\n textsValueAt(flow?.texts, ['rejected', key]) ??\n t(`flow.rejected.${key}`, { defaultValue: 'Nothing was saved.' }),\n });\n return t('flow.rejected.precondition', {\n defaultValue: 'The record changed. Nothing was sent.',\n });\n }\n if (outcome.outcome === 'failed') {\n if (snapshot.reason !== undefined) return reasonOf(snapshot.reason);\n // The code's own text first (spec 4.15), as the bulk summary and the record frame read it.\n const code = 'code' in outcome ? outcome.code : undefined;\n const specific =\n code === undefined\n ? undefined\n : specificErrorText(\n {\n code,\n ...('message' in outcome && outcome.message !== undefined\n ? { message: outcome.message }\n : {}),\n },\n caps,\n { action: { prefix: textPrefix, texts: flow?.texts } },\n );\n return (\n specific ??\n t('flow.failed', { defaultValue: 'The request could not be sent. Nothing was saved.' })\n );\n }\n return null;\n}\n\n/**\n * The UI kit's flow host screen (`presentationHosts.screens.flow`, presented under `buro:flow`;\n * P4 spec 4.15, 4.19): the action's label and the record's title with its «i» and ✕; the form\n * (a `steps` body is a wizard), the final screen's warnings and `confirm`, and the outcome\n * screens; a footer of Back, Cancel and the submit button, labelled with the action's label and\n * its pending text while the write runs.\n *\n * The presentation is a dismiss scope (P3-30): Escape, an outside click, ✕ and Cancel close\n * through it, so a dirty form asks first; Back between steps stays in the host and asks nothing.\n * From the send to the outcome the screen holds the scope's pending lock — nothing closes it,\n * and the run holds every route change. `success` closes the host without asking; `rejected`\n * and `failed` return to the dirty form; `unknown` closes without asking and keeps the attempt.\n */\nexport function FlowScreen(props: FlowScreenProps): ReactElement | null {\n if (props.run !== undefined && props.compiled !== undefined)\n return <HeldFlowScreen {...props} run={props.run} compiled={props.compiled} />;\n if (props.start !== undefined) return <OwnedFlowScreen {...props} start={props.start} />;\n return null;\n}\n\ntype HeldProps = FlowScreenProps & { readonly run: FlowRun; readonly compiled: CompiledFlow };\n\n/**\n * A bulk run's record frame (read-scope spec 4, rule 1): the form's `'context'` reads take the\n * value every selected row agrees on, else the session's. A run without a selection adds nothing.\n */\nfunction SelectionScope(props: {\n readonly selection: FlowScreenProps['selection'];\n readonly resource: string | null;\n readonly children: ReactNode;\n}): ReactElement {\n if (props.selection === undefined || props.resource === null) return <>{props.children}</>;\n return (\n <BulkSelectionScope resource={props.resource} ids={props.selection.ids}>\n {props.children}\n </BulkSelectionScope>\n );\n}\n\n/** The screen over a run it is given. */\nfunction HeldFlowScreen(props: HeldProps): ReactElement {\n // \"I've checked — start over\" (4.8) opens a fresh form: the body mounts again, so the form\n // takes the run's fresh values as its baseline and offers the stored draft.\n const [generation, setGeneration] = useState(0);\n // An app flow's form reads its texts in its `common.appActions.<name>` entry.\n return (\n <FlowTextsScope compiled={props.compiled}>\n <WithBinding>\n <ScreenStateProvider key={generation}>\n <SelectionScope selection={props.selection} resource={props.compiled.resource}>\n <FlowScreenBody {...props} onFreshForm={() => setGeneration((value) => value + 1)} />\n </SelectionScope>\n </ScreenStateProvider>\n </WithBinding>\n </FlowTextsScope>\n );\n}\n\n/**\n * The host owning its run (P4-C review I1): the run lives as long as the host, not as long as\n * the control that opened it — a row that left the page, a menu item that closed — so a dirty\n * form still asks before it closes and a pending write still holds its lock. `then` waits until\n * the host has gone (its form and its blocker with it), then runs through the opener's\n * dispatcher scope; each outcome is reported to the opener.\n */\nfunction OwnedFlowScreen(props: FlowScreenProps & { readonly start: FlowStart }): ReactElement {\n const { start, effects, onSettle } = props;\n const flow = useFlowRun(start.target, {\n ...(start.record === undefined ? {} : { record: start.record }),\n ...(start.args === undefined ? {} : { args: start.args }),\n ...(start.selection === undefined ? {} : { selection: start.selection }),\n surface: 'host',\n ...(effects === undefined ? {} : { thenEffects: effects }),\n });\n // `then` is the host's to run, after it closed.\n flow.holdThen(true);\n const latest = useRef(flow);\n latest.current = flow;\n useEffect(\n () => () => {\n // After the commit that removed the host: its form's blocker is gone.\n setTimeout(() => {\n latest.current.holdThen(false);\n latest.current.runThen();\n }, 0);\n },\n [],\n );\n const { run, snapshot, compiled } = flow;\n const outcome = snapshot.outcome;\n useEffect(() => {\n if (outcome !== undefined) onSettle?.(outcome);\n }, [outcome, onSettle]);\n const instance = useUIInstance();\n const t = useOptionalT();\n const caps = useI18nCaps(compiled?.resource ?? undefined);\n const tid = useTestIds();\n const opened =\n run !== null &&\n compiled !== null &&\n (snapshot.history.includes('open') || snapshot.step === 'outcome');\n if (opened) return <HeldFlowScreen {...props} run={run} compiled={compiled} />;\n // Not opened yet: its gate, its sources and a stored attempt decide first. A run that\n // decided against opening says why.\n const refused = snapshot.control === 'disabled' || snapshot.control === 'absent';\n return (\n <div\n data-testid={compiled === null ? undefined : `${tid.flowHost(compiled.flowId)}:opening`}\n data-buro-host={props.host}\n data-buro-flow-step={refused ? 'refused' : 'opening'}\n aria-busy={refused ? undefined : 'true'}\n className=\"flex min-h-0 flex-1 flex-col gap-4\"\n >\n <OwnTitleHeading label={props.label} />\n {refused ? (\n <p role=\"alert\" className=\"text-sm\">\n {snapshot.reason === undefined\n ? t('flow.unavailable', { defaultValue: 'Not allowed.' })\n : reasonText(caps, snapshot.reason, compiled?.resource ?? undefined)}\n </p>\n ) : (\n <IconLoader2 className=\"h-5 w-5 animate-spin self-center\" aria-hidden=\"true\" />\n )}\n <div className=\"flex justify-end\">\n <Button type=\"button\" variant=\"ghost\" onClick={() => instance.dismiss()}>\n {t('flow.close', { defaultValue: 'Close' })}\n </Button>\n </div>\n </div>\n );\n}\n\nfunction FlowScreenBody({\n run,\n host,\n label,\n title: givenTitle,\n compiled,\n record: givenRecord,\n args,\n selection,\n onFreshForm,\n}: HeldProps & { readonly onFreshForm: () => void }): ReactElement {\n // A collection-level flow has no record, whoever passed one (spec 5.1): its title, its form and\n // its review read none.\n const record = flowRecordOf(compiled, givenRecord);\n const snapshot = useSyncSnapshot(run);\n const binding = useContext(FlowHostBindingContext) as FlowHostBinding;\n const tid = useTestIds();\n const t = useOptionalT();\n const chromeT = useChromeT();\n const resource = compiled.resource ?? undefined;\n const caps = useI18nCaps(resource);\n const ownTitle = useContext(OwnTitleContext);\n const flowId = compiled.flowId;\n const recordId = record?.[compiled.idField] ?? record?.id;\n const recordTitle = useProjectedTitle(resource, recordId, record);\n const title =\n givenTitle ?? (record === undefined || recordTitle === '' ? undefined : recordTitle);\n const form = useFlowForm(run, compiled, snapshot, {\n ...(record === undefined ? {} : { record }),\n ...(args === undefined ? {} : { args }),\n ...(selection === undefined ? {} : { selection: selection.ids }),\n });\n const formControl = useFormControlOf(form);\n const hasForm = compiled.flow.form !== undefined;\n const [busy, setBusy] = useState(false);\n // The values the form opened on: the review's baseline (4.4). The host opens on an opened run,\n // before anything was typed.\n const [initial] = useState(() => run.getSnapshot().values);\n // Form-level messages: a server's validation refusal on a key no field holds (M14), a\n // resource-level validator's.\n const formErrors = form.errors.filter((issue) => issue.field === '_form');\n\n // The pending lock (4.19): from the re-read to the persisted outcome nothing closes the host.\n const locked = snapshot.control === 'running';\n useDismissPending(locked);\n\n const outcome = snapshot.outcome?.outcome;\n const unknown = outcome === 'unknown';\n const succeeded = outcome === 'success';\n const finalStep = snapshot.step === 'review' || snapshot.step === 'accept';\n\n // `success` closes the host, unasked: nothing unsaved remains (4.19). The run settled the\n // mutation's effects before it answered (4.13).\n // `then.open: { block, props }` keeps the host and draws the block instead (4.13): its close is\n // the block's own button and ✕, and `result` goes with the host.\n const openBlock = succeeded ? blockOpen(snapshot.effects?.open) : null;\n // The write's own notices (spec 4.7), once per success, before the host closes.\n const showNotices = useNoticeSink(resource);\n const shownNotices = useRef<unknown>(null);\n useEffect(() => {\n if (!succeeded || snapshot.notices.length === 0 || shownNotices.current === snapshot.notices)\n return;\n shownNotices.current = snapshot.notices;\n showNotices(snapshot.notices);\n }, [succeeded, snapshot.notices, showNotices]);\n useEffect(() => {\n if (succeeded && !locked && openBlock === null) binding.finish();\n }, [succeeded, locked, openBlock, binding]);\n\n const prefix =\n compiled.resource === null\n ? `appActions.${compiled.name}`\n : `${compiled.resource}.actions.${compiled.name}`;\n\n const settle = (result: FlowResult) => {\n setBusy(result.outcome === 'failed' && 'reason' in result && result.reason === 'busy');\n };\n const submit = async () => {\n if (locked) return;\n setBusy(false);\n if (finalStep) {\n settle(await run.accept());\n return;\n }\n if (unknown && editingNew) {\n // Send as new: the form as filled now, validated, then the confirmation (P4-C review C2).\n let valid = false;\n await form.handleSubmit(() => {\n valid = true;\n throw HELD;\n })();\n if (valid) setConfirmingNew(true);\n return;\n }\n if (unknown) return;\n if (hasForm) {\n // The controller validates the active fields and reveals the first failing one (its step\n // included); the run sends.\n let validated = false;\n await form.handleSubmit(() => {\n validated = true;\n throw HELD;\n })();\n if (!validated) return;\n }\n settle(await run.submit());\n };\n\n const pendingKey =\n compiled.resource === null\n ? `appActions.${compiled.name}.pending`\n : `resources.${compiled.resource}.actions.${compiled.name}.pending`;\n const pendingLabel = caps.has(pendingKey) ? caps.t(pendingKey) : `${label}…`;\n const message = outcomeMessage(\n snapshot,\n busy,\n t,\n caps,\n compiled.textKeys.prefix,\n compiled.flow,\n (reason) => reasonText(caps, reason, resource),\n );\n // The form-level issues, resolved here so a language switch re-renders them; one that says\n // what the outcome heading already says is not shown twice.\n const formErrorTexts = formErrors\n .map((issue) =>\n resolveValidationMessage(\n {\n code: issue.code ?? '',\n message: issue.message,\n ...(issue.check === undefined ? {} : { check: issue.check }),\n },\n { has: caps.has, t: caps.t },\n ),\n )\n .filter((text) => text !== message);\n // The flow's own word for its cancel buttons (`<prefix>.dismiss`, then its declared\n // `texts.dismiss`), else the kit's.\n const dismissKey = `${compiled.textKeys.prefix}.dismiss`;\n const cancelWord =\n (caps.has(dismissKey) ? caps.t(dismissKey) : undefined) ??\n declaredText('flow', compiled.flow, 'dismiss') ??\n chromeT('actions.cancel', { defaultValue: 'Cancel' });\n // The run flags a check that could not decide; its reason is a translation, never compared.\n const couldNotCheck = snapshot.control === 'disabled' && snapshot.unverified === true;\n const steps = form.steps;\n const lastStep =\n steps === null || steps.ids.length === 0 || steps.current === steps.ids[steps.ids.length - 1];\n const showSubmit = !unknown && !succeeded && (!hasForm || finalStep || lastStep);\n // The unknown screen's exits (4.8).\n const [confirmingNew, setConfirmingNew] = useState(false);\n // Send as new sends the form as it is now (4.8): the user fills it again and it is validated\n // first — after a reload it holds only its initial values (P4-C review C2).\n const [editingNew, setEditingNew] = useState(false);\n const checkable = compiled.flow.submit.onUnknown !== undefined;\n const unhandled = unknown && !checkable && !snapshot.canResend;\n const exit = (action: () => Promise<FlowResult>) => () => {\n if (!locked) void action().then(settle);\n };\n // An overlay's Cancel keeps the draft so it survives the close (4.19); an inline Reset means\n // \"start over\", so the next form must not offer the input it just threw away (REF-51). An\n // unknown outcome's Close keeps it, like every unresolved attempt (4.11).\n const close = () => {\n if (binding.kind === 'inline' && hasForm && !unknown) form.draft.discard();\n binding.close();\n };\n\n const headingRef = useRef<HTMLHeadingElement>(null);\n useFocusOnMount(headingRef);\n const heading = (\n <h2\n ref={headingRef}\n tabIndex={-1}\n data-buro-overlay-heading=\"\"\n className=\"min-w-0 flex-1 break-words text-lg font-semibold tracking-tight focus-visible:outline-hidden\"\n >\n {label}\n {title === undefined ? null : (\n <span className=\"ml-2 font-normal text-muted-foreground\">{title}</span>\n )}\n </h2>\n );\n\n return (\n <div\n data-testid={tid.flowHost(flowId)}\n data-buro-host={host}\n data-buro-flow-step={snapshot.step}\n aria-busy={locked ? 'true' : undefined}\n className=\"flex min-h-0 flex-1 flex-col gap-4\"\n >\n {binding.kind === 'inline' ? null : (\n <div data-buro-region=\"flow-header\" className=\"flex items-center gap-2 pr-1\">\n {ownTitle ? <DialogPrimitive.Title asChild>{heading}</DialogPrimitive.Title> : heading}\n {compiled.resource === null ? null : (\n <DocInfo\n address={`${compiled.resource}/actions/${compiled.name}`}\n name={label}\n testId={`${tid.flowHost(flowId)}:info`}\n />\n )}\n {binding.kind === 'overlay' ? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className=\"h-8 w-8 shrink-0\"\n data-testid={tid.flowClose(flowId)}\n aria-label={t('flow.close', { defaultValue: 'Close' })}\n onClick={close}\n >\n <IconX className=\"h-4 w-4\" aria-hidden=\"true\" />\n </Button>\n ) : null}\n </div>\n )}\n {openBlock !== null ? (\n <FlowOpenBlock open={openBlock} prefix={prefix} testid={tid.flowHost(flowId)} />\n ) : null}\n {openBlock !== null && binding.kind !== 'overlay' ? (\n <div className=\"flex justify-end\">\n <Button\n type=\"button\"\n variant=\"outline\"\n data-testid={tid.flowClose(flowId)}\n onClick={close}\n >\n {t('flow.done', { defaultValue: 'Done' })}\n </Button>\n </div>\n ) : null}\n <form\n hidden={openBlock !== null}\n noValidate\n className={openBlock === null ? 'flex min-h-0 flex-1 flex-col gap-4' : 'hidden'}\n onSubmit={(event) => {\n event.preventDefault();\n void submit();\n }}\n >\n <div className=\"-mx-1 flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-1\">\n {message === null ? null : (\n <div\n role={unknown || outcome === 'rejected' || outcome === 'failed' ? 'alert' : 'status'}\n data-testid={tid.flowOutcome(flowId)}\n data-buro-flow-outcome={busy ? 'busy' : (outcome ?? snapshot.control)}\n className=\"flex flex-wrap items-center gap-2 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive\"\n >\n <span>{message}</span>\n {couldNotCheck ? (\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n className=\"ml-auto\"\n onClick={() => run.retryChecks()}\n >\n {chromeT('actions.retry', { defaultValue: 'Retry' })}\n </Button>\n ) : null}\n </div>\n )}\n {hasForm && form.draft.pending !== null && (!unknown || editingNew) ? (\n <div\n data-testid={tid.flowDraft(flowId)}\n role=\"status\"\n aria-live=\"polite\"\n className=\"flex flex-wrap items-center gap-2 rounded-md border border-warning/50 bg-warning/10 px-3 py-2 text-sm\"\n >\n <span className=\"font-medium\">\n {t('draft.restorePrompt', { defaultValue: 'Restore draft?' })}\n </span>\n <div className=\"ml-auto flex gap-2\">\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n data-testid={`${tid.flowDraft(flowId)}:restore`}\n onClick={form.draft.restore}\n >\n {t('draft.restore', { defaultValue: 'Restore' })}\n </Button>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n data-testid={`${tid.flowDraft(flowId)}:discard`}\n onClick={form.draft.discard}\n >\n {t('draft.discard', { defaultValue: 'Discard' })}\n </Button>\n </div>\n </div>\n ) : null}\n {formErrorTexts.length > 0 ? (\n <div\n role=\"alert\"\n data-testid={`${tid.flowHost(flowId)}:form-errors`}\n className=\"flex flex-col gap-1 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive\"\n >\n {formErrorTexts.map((text, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: one failed write's fixed list\n <p key={index}>{text}</p>\n ))}\n </div>\n ) : null}\n {finalStep && compiled.flow.review === true ? (\n <ReviewDiff\n form={form}\n initial={initial}\n values={snapshot.values}\n i18nPrefix={prefix}\n testid={tid.flowHost(flowId)}\n />\n ) : finalStep && Array.isArray(compiled.flow.review) ? (\n <ReviewTree\n compiled={compiled}\n tree={compiled.flow.review}\n values={snapshot.values}\n prefix={prefix}\n run={run}\n {...(record === undefined ? {} : { record })}\n {...(args === undefined ? {} : { args })}\n />\n ) : hasForm ? (\n <FormControlProvider value={formControl}>\n <ScreenTree\n region=\"form-body\"\n resource={prefix}\n mode=\"create\"\n compiled={form.screen}\n controller={form}\n // The record scheme: the leaves carry `form-field-input:<prefix>:create:<name>`\n // test ids, and their texts key as `resources.<prefix>.fields.<name>.…` (4.4).\n leafIds=\"record\"\n disabled={locked || (unknown && !editingNew) || finalStep || succeeded}\n />\n </FormControlProvider>\n ) : null}\n {finalStep && snapshot.warnings.length > 0 ? (\n <ul\n role=\"status\"\n data-buro-region=\"flow-warnings\"\n className=\"flex flex-col gap-1 rounded-md border border-warning/50 bg-warning/10 px-3 py-2 text-sm text-warning-emphasis\"\n >\n {snapshot.warnings.map((warning) => (\n <li key={warning.id} data-testid={`${tid.flowHost(flowId)}:warning:${warning.id}`}>\n {warning.message}\n </li>\n ))}\n </ul>\n ) : null}\n </div>\n {unhandled ? (\n <p data-testid={`${tid.flowOutcome(flowId)}:unhandled`} className=\"text-sm\">\n {t('flow.unknownUnhandled', { defaultValue: 'Check the record before trying again.' })}\n </p>\n ) : null}\n {unknown && confirmingNew ? (\n <div\n role=\"alertdialog\"\n aria-label={t('flow.sendAsNew', { defaultValue: 'Send as new' })}\n data-testid={`${tid.flowSendAsNew(flowId)}:confirm`}\n className=\"flex flex-wrap items-center gap-2 rounded-md border border-warning/50 bg-warning/10 px-3 py-2 text-sm\"\n >\n <span>\n {t('flow.sendAsNewConfirm', {\n defaultValue: 'This may apply the change twice. Send it as a new request?',\n })}\n </span>\n <div className=\"ml-auto flex gap-2\">\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n data-testid={`${tid.flowSendAsNew(flowId)}:cancel`}\n onClick={() => setConfirmingNew(false)}\n >\n {cancelWord}\n </Button>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"destructive\"\n data-testid={`${tid.flowSendAsNew(flowId)}:ok`}\n onClick={() => {\n setConfirmingNew(false);\n exit(() => run.sendAsNew({ confirmed: true }))();\n }}\n >\n {t('flow.sendAsNew', { defaultValue: 'Send as new' })}\n </Button>\n </div>\n </div>\n ) : null}\n {unknown ? (\n <div data-buro-region=\"flow-unknown-exits\" className=\"flex flex-wrap gap-2\">\n {checkable ? (\n <Button\n type=\"button\"\n variant=\"default\"\n data-testid={tid.flowCheckAgain(flowId)}\n disabled={locked}\n onClick={exit(() => run.checkAgain())}\n >\n {t('flow.checkAgain', { defaultValue: 'Check again' })}\n </Button>\n ) : null}\n {snapshot.canResend ? (\n <Button\n type=\"button\"\n variant=\"outline\"\n data-testid={tid.flowResend(flowId)}\n disabled={locked}\n onClick={exit(() => run.resend())}\n >\n {t('flow.resend', { defaultValue: 'Resend' })}\n </Button>\n ) : null}\n <Button\n type=\"button\"\n variant=\"outline\"\n data-testid={tid.flowSendAsNew(flowId)}\n disabled={locked || confirmingNew || editingNew}\n onClick={() => {\n if (hasForm) setEditingNew(true);\n else setConfirmingNew(true);\n }}\n >\n {t('flow.sendAsNew', { defaultValue: 'Send as new' })}\n </Button>\n <Button\n type=\"button\"\n variant=\"outline\"\n data-testid={tid.flowStartOver(flowId)}\n disabled={locked}\n onClick={() => {\n run.startOver();\n onFreshForm();\n }}\n >\n {t('flow.startOver', { defaultValue: \"I've checked — start over\" })}\n </Button>\n </div>\n ) : null}\n <div data-buro-region=\"flow-footer\" className=\"flex flex-wrap items-center gap-2\">\n {finalStep && hasForm && !locked ? (\n <Button\n type=\"button\"\n variant=\"outline\"\n data-testid={tid.flowBack(flowId)}\n onClick={() => run.back()}\n >\n {t('flow.back', { defaultValue: 'Back' })}\n </Button>\n ) : null}\n <div className=\"ml-auto flex gap-2\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n data-testid={tid.flowCancel(flowId)}\n disabled={locked}\n onClick={close}\n >\n {unknown\n ? t('flow.close', { defaultValue: 'Close' })\n : binding.kind === 'inline'\n ? t('flow.reset', { defaultValue: 'Reset' })\n : cancelWord}\n </Button>\n {unknown && editingNew ? (\n <Button\n type=\"submit\"\n variant=\"destructive\"\n data-testid={`${tid.flowSendAsNew(flowId)}:submit`}\n disabled={locked || confirmingNew}\n onMouseDown={(event) => event.preventDefault()}\n >\n {t('flow.sendAsNew', { defaultValue: 'Send as new' })}\n </Button>\n ) : null}\n {showSubmit ? (\n <Button\n type=\"submit\"\n variant={compiled.flow.variant === 'destructive' ? 'destructive' : 'default'}\n data-testid={tid.flowSubmit(flowId)}\n disabled={locked || couldNotCheck}\n aria-busy={locked ? 'true' : undefined}\n // Without this, focusing out of a field a blur error just inserted moves the\n // button, and the click that lands on its old position is swallowed.\n onMouseDown={(event) => event.preventDefault()}\n >\n {locked ? (\n <IconLoader2 className=\"h-4 w-4 animate-spin\" aria-hidden=\"true\" />\n ) : null}\n {locked ? pendingLabel : label}\n </Button>\n ) : null}\n </div>\n </div>\n </form>\n </div>\n );\n}\n\n/** The run's snapshot, re-rendering on each change. */\nfunction useSyncSnapshot(run: FlowRun): FlowSnapshot {\n return useSyncExternalStore(run.subscribe, run.getSnapshot, run.getSnapshot);\n}\n\nconst NO_FIELDS = Object.freeze({});\n\n/**\n * `review: (l) => [...]` (4.4): a show tree over the flow's values — displays and placements\n * only, no inputs — drawn by a show-mode form over the flow's fields.\n */\nfunction ReviewTree({\n compiled,\n tree,\n values,\n prefix,\n run,\n record,\n args,\n}: {\n readonly compiled: CompiledFlow;\n readonly tree: readonly unknown[];\n readonly values: Readonly<Record<string, unknown>>;\n readonly prefix: string;\n readonly run: FlowRun;\n readonly record?: Row;\n readonly args?: Row;\n}): ReactElement {\n const fields = compiled.flow.form?.fields;\n // A review places what it shows: a field the tree does not place leaves the show mode (its\n // `in`), so a review of blocks alone (spec 3.6) is not refused for the fields it leaves out.\n const map = useState(() => {\n if (fields === undefined) return NO_FIELDS;\n const placed = placedLeaves(tree);\n return fieldEntriesToMap(\n (fields as readonly Readonly<Record<string, unknown>>[]).map((field) =>\n placed.has(String(field.name)) ? field : { ...field, in: ['create'] },\n ) as never,\n );\n })[0];\n const body = useState(() => () => tree as never)[0];\n // The app's blocks: a review tree places them (P4-D, spec 3.6's `l.place(offeringReview)`).\n const blocks = useFlowFormCatalog();\n // The run's record and args, like the form step reads them (G35): the controller honours meta\n // sources only under the run's claim, so the review carries the run and its form id. Compiled\n // as a review, the tree's `values` stay the form's values while `record` is the run's.\n const metaSources = useFlowMetaSources(record, args, compiled.resource);\n // The form's `fieldConditions` (REF-132 §4.8): the review plans its fields as the form did, so a\n // field a callback removed from the form is not shown here either.\n const fieldConditions = useFlowFieldConditions(compiled);\n const review = useFormController({\n blocks,\n flowRun: run,\n formId: compiled.formId,\n metaSources,\n ...(fieldConditions === undefined ? {} : { flowFieldConditions: fieldConditions }),\n review: true,\n fields: map as never,\n body,\n mode: 'show',\n i18nPrefix: prefix,\n value: values as never,\n });\n return (\n <ScreenTree\n region=\"form-body\"\n resource={prefix}\n mode=\"show\"\n compiled={review.screen}\n controller={review}\n leafIds=\"record\"\n />\n );\n}\n\n/** The field names a tree places as leaves (a string child of any node). */\nfunction placedLeaves(tree: readonly unknown[]): ReadonlySet<string> {\n const out = new Set<string>();\n const walk = (node: unknown): void => {\n if (typeof node === 'string') {\n out.add(node);\n return;\n }\n if (node === null || typeof node !== 'object') return;\n const children = (node as { readonly children?: unknown }).children;\n if (Array.isArray(children)) for (const child of children) walk(child);\n };\n for (const node of tree) walk(node);\n return out;\n}\n\n/** A `then.open` block target, once resolved (`{ block, props }`); `null` for anything else. */\nfunction blockOpen(open: unknown): { readonly block: EntityRefLike; readonly props: Row } | null {\n if (open === null || typeof open !== 'object' || !Object.hasOwn(open, 'block')) return null;\n const { block, props } = open as { readonly block?: unknown; readonly props?: unknown };\n const ref =\n block !== null && typeof block === 'object' && 'ref' in block\n ? (block as { readonly ref: unknown }).ref\n : block;\n if (\n ref === null ||\n typeof ref !== 'object' ||\n typeof (ref as EntityRefLike).namespace !== 'string' ||\n typeof (ref as EntityRefLike).id !== 'string'\n )\n return null;\n return {\n block: ref as EntityRefLike,\n props: props !== null && typeof props === 'object' ? (props as Row) : {},\n };\n}\n\ninterface EntityRefLike {\n readonly namespace: string;\n readonly id: string;\n}\ntype Row = Readonly<Record<string, unknown>>;\n\n/**\n * The block `then.open` names, drawn in the host after success (4.13): its implementation from\n * the mounted catalog (an app's over the kit's), its props validated against the block's schemas\n * at mount (P1b+P1c decision 35); a failed validation, or a block nothing implements, says so.\n */\nfunction FlowOpenBlock({\n open,\n testid,\n}: {\n readonly open: { readonly block: EntityRefLike; readonly props: Row };\n readonly prefix: string;\n readonly testid: string;\n}): ReactElement {\n const t = useOptionalT();\n const id = `${open.block.namespace}:${open.block.id}`;\n const implementation = selectImplementation(id, useFlowOpenImplementation(id) as never);\n const [validation, setValidation] = useState<PropValidation | null>(() =>\n implementation === undefined\n ? null\n : validatePlacementProps(implementation.definition as never, open.props),\n );\n useEffect(() => {\n if (validation?.status !== 'pending') return;\n let live = true;\n void validation.settled.then((settled) => {\n if (live) setValidation(settled);\n });\n return () => {\n live = false;\n };\n }, [validation]);\n const failed = implementation === undefined || validation?.status === 'failed';\n const View = implementation === undefined ? null : viewOf(implementation);\n return (\n <div\n data-testid={`${testid}:open`}\n data-buro-block={id}\n className=\"min-h-0 flex-1 overflow-y-auto\"\n >\n {failed ? (\n <p role=\"alert\" className=\"text-sm text-muted-foreground\">\n {t('block.notImplemented', { defaultValue: 'This section is not available.' })}\n </p>\n ) : View === null || validation?.status !== 'ready' ? null : (\n <Suspense fallback={null}>\n <View\n props={validation.props as never}\n data={NO_FIELDS as never}\n t={(key, options) =>\n t(`blocks.${id}.${key}`, {\n ...(options?.params === undefined ? {} : { params: options.params }),\n ...(options?.count === undefined ? {} : { count: options.count }),\n })\n }\n />\n </Suspense>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAOA,MAAa,oBAAoB;AAgBjC,SAAS,UAAU,YAA8B;CAC/C,IAAI,iBAAiB,UAAU,MAAM,KAAA,GAAW,OAAO;CACvD,IAAI,eAAe,QAAQ,OAAO,eAAe,UAAU,OAAO;CAClE,MAAM,OAAQ,WAA2C;CACzD,MAAM,SACJ,SAAS,QAAQ,OAAO,SAAS,WAC5B,KAA0C,YAC3C,KAAA;CACN,OAAO,WAAW,KAAA,KAAa,WAAW,SAAS,WAAW;AAChE;AAEA,MAAM,QAAQ,GAAY,MAAwB;CAChD,IAAI,OAAO,GAAG,GAAG,CAAC,GAAG,OAAO;CAC5B,MAAM,SAAS,UAAmB,UAAU,KAAA,KAAa,UAAU,QAAQ,UAAU;CACrF,IAAI,MAAM,CAAC,KAAK,MAAM,CAAC,GAAG,OAAO;CACjC,IAAI;EACF,OAAO,KAAK,UAAU,CAAC,MAAM,KAAK,UAAU,CAAC;CAC/C,QAAQ;EACN,OAAO;CACT;AACF;AAOA,SAAgB,WAAW,EACzB,MACA,SACA,QACA,YACA,UACgC;CAEhC,MAAM,cADI,aACU,CAAC,CAAC,kBAAkB,EAAE,cAAc,UAAU,CAAC;CACnE,MAAM,OAAO,KAAK,OAAO,QAAQ,YAAY,CAAC,KAAK,QAAQ,QAAQ,OAAO,OAAO,QAAQ,KAAK,CAAC;CAC/F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AAM,SAAS,mBAAmB,KAAA,KAAa,YAAY,WAAW;CACtE,MAAM,OAAO,mBAAmB,KAAA,IAAY,OAAO,OAAO,cAAc;CACxE,OACE,IAAC,OAAD;EACE,eAAa,GAAG,OAAO;EACvB,mBAAiB;EACjB,WAAU;EAET,UAAA,SACC,IAAC,KAAD;GAAG,MAAK;GAAQ,WAAU;GACvB,UAAA,EAAE,wBAAwB,EAAE,cAAc,iCAAiC,CAAC;EAC5E,CAAA,IACD,SAAS,QAAQ,YAAY,WAAW,UAAU,OACpD,IAAC,UAAD;GAAU,UAAU;GAClB,UAAA,IAAC,MAAD;IACE,OAAO,WAAW;IAClB,MAAM;IACN,IAAI,KAAK,YACP,EAAE,UAAU,GAAG,GAAG,OAAO;KACvB,GAAI,SAAS,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ,QAAQ,OAAO;KAClE,GAAI,SAAS,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO,QAAQ,MAAM;IACjE,CAAC;GAEJ,CAAA;EACO,CAAA;CAET,CAAA;AAET"}
@@ -1,7 +1,7 @@
1
1
  const require_use_theme = require("./use-theme-DFlpXils.cjs");
2
- const require_check_confirm_dialog = require("./check-confirm-dialog-C-NHgMST.cjs");
2
+ const require_check_confirm_dialog = require("./check-confirm-dialog-BT04Mieo.cjs");
3
3
  const require_button = require("./button-BxnnE28H.cjs");
4
- const require_place_node = require("./place-node-CNb3w-c7.cjs");
4
+ const require_place_node = require("./place-node-Bhl8B3fF.cjs");
5
5
  const require_success_notices = require("./success-notices-Dl3M1fZP.cjs");
6
6
  let _burojs_core = require("@burojs/core");
7
7
  let _burojs_react = require("@burojs/react");
@@ -658,11 +658,13 @@ function ReviewTree({ compiled, tree, values, prefix, run, record, args }) {
658
658
  const body = (0, react.useState)(() => () => tree)[0];
659
659
  const blocks = (0, _burojs_react.useFlowFormCatalog)();
660
660
  const metaSources = (0, _burojs_react_flows.useFlowMetaSources)(record, args, compiled.resource);
661
+ const fieldConditions = (0, _burojs_react_flows.useFlowFieldConditions)(compiled);
661
662
  const review = (0, _burojs_react.useFormController)({
662
663
  blocks,
663
664
  flowRun: run,
664
665
  formId: compiled.formId,
665
666
  metaSources,
667
+ ...fieldConditions === void 0 ? {} : { flowFieldConditions: fieldConditions },
666
668
  review: true,
667
669
  fields: map,
668
670
  body,
@@ -746,4 +748,4 @@ exports.FlowHostBindingContext = FlowHostBindingContext;
746
748
  exports.FlowScreen = FlowScreen;
747
749
  exports.HostedFlowScreen = HostedFlowScreen;
748
750
 
749
- //# sourceMappingURL=flow-screen-Bcz9NF2V.cjs.map
751
+ //# sourceMappingURL=flow-screen-6y5E_HT6.cjs.map