@eifi1/ui-kit 0.37.0 → 0.38.1

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 (130) hide show
  1. package/README.md +11 -4
  2. package/dist/eslint/index.js +1 -1
  3. package/dist/feedback/feedback-comment-thread.d.ts +87 -0
  4. package/dist/feedback/feedback-comment-thread.js +170 -0
  5. package/dist/feedback/feedback-comment-thread.js.map +1 -0
  6. package/dist/feedback/feedback-dialog-labels.js +2 -1
  7. package/dist/feedback/feedback-dialog-labels.js.map +1 -1
  8. package/dist/feedback/feedback-dialog.d.ts +13 -0
  9. package/dist/feedback/feedback-dialog.js +12 -4
  10. package/dist/feedback/feedback-dialog.js.map +1 -1
  11. package/dist/feedback/feedback-labels.d.ts +11 -0
  12. package/dist/feedback/feedback-labels.js +4 -1
  13. package/dist/feedback/feedback-labels.js.map +1 -1
  14. package/dist/feedback/feedback-menu-labels.js +2 -1
  15. package/dist/feedback/feedback-menu-labels.js.map +1 -1
  16. package/dist/feedback/feedback-menu.d.ts +17 -3
  17. package/dist/feedback/feedback-menu.js +11 -1
  18. package/dist/feedback/feedback-menu.js.map +1 -1
  19. package/dist/feedback/feedback-public-labels.d.ts +53 -0
  20. package/dist/feedback/feedback-public-labels.js +27 -0
  21. package/dist/feedback/feedback-public-labels.js.map +1 -0
  22. package/dist/feedback/feedback-public-list.d.ts +139 -0
  23. package/dist/feedback/feedback-public-list.js +299 -0
  24. package/dist/feedback/feedback-public-list.js.map +1 -0
  25. package/dist/feedback/feedback-public-switch.d.ts +51 -0
  26. package/dist/feedback/feedback-public-switch.js +50 -0
  27. package/dist/feedback/feedback-public-switch.js.map +1 -0
  28. package/dist/feedback/feedback-public-types.d.ts +75 -0
  29. package/dist/feedback/feedback-public-types.js +2 -0
  30. package/dist/feedback/feedback-public-types.js.map +1 -0
  31. package/dist/feedback/feedback-record.d.ts +32 -1
  32. package/dist/feedback/feedback-record.js +10 -0
  33. package/dist/feedback/feedback-record.js.map +1 -1
  34. package/dist/feedback/feedback-replies-context.d.ts +7 -0
  35. package/dist/feedback/feedback-replies-context.js +7 -0
  36. package/dist/feedback/feedback-replies-context.js.map +1 -0
  37. package/dist/feedback/feedback-replies.d.ts +97 -0
  38. package/dist/feedback/feedback-replies.js +114 -0
  39. package/dist/feedback/feedback-replies.js.map +1 -0
  40. package/dist/feedback/feedback-row-detail-labels.js +1 -0
  41. package/dist/feedback/feedback-row-detail-labels.js.map +1 -1
  42. package/dist/feedback/feedback-row-detail.d.ts +47 -10
  43. package/dist/feedback/feedback-row-detail.js +51 -50
  44. package/dist/feedback/feedback-row-detail.js.map +1 -1
  45. package/dist/feedback/feedback-submit-dialog.d.ts +3 -1
  46. package/dist/feedback/feedback-submit-dialog.js +6 -1
  47. package/dist/feedback/feedback-submit-dialog.js.map +1 -1
  48. package/dist/feedback/feedback-submit.d.ts +8 -0
  49. package/dist/feedback/feedback-submit.js +3 -2
  50. package/dist/feedback/feedback-submit.js.map +1 -1
  51. package/dist/feedback/feedback-table.d.ts +15 -5
  52. package/dist/feedback/feedback-table.js +46 -5
  53. package/dist/feedback/feedback-table.js.map +1 -1
  54. package/dist/feedback/feedback-thread-parts-labels.d.ts +6 -0
  55. package/dist/feedback/feedback-thread-parts-labels.js +36 -0
  56. package/dist/feedback/feedback-thread-parts-labels.js.map +1 -0
  57. package/dist/feedback/feedback-thread.d.ts +8 -0
  58. package/dist/feedback/feedback-thread.js +7 -2
  59. package/dist/feedback/feedback-thread.js.map +1 -1
  60. package/dist/feedback/feedback-vote-button.d.ts +49 -0
  61. package/dist/feedback/feedback-vote-button.js +72 -0
  62. package/dist/feedback/feedback-vote-button.js.map +1 -0
  63. package/dist/feedback.d.ts +6 -0
  64. package/dist/feedback.js +6 -0
  65. package/dist/feedback.js.map +1 -1
  66. package/dist/i18n/defaults.js +12 -0
  67. package/dist/i18n/defaults.js.map +1 -1
  68. package/dist/i18n/german.js +69 -3
  69. package/dist/i18n/german.js.map +1 -1
  70. package/dist/i18n/kit-labels.d.ts +16 -0
  71. package/dist/i18n/kit-labels.js.map +1 -1
  72. package/dist/i18n/locales/en.js +85 -3
  73. package/dist/i18n/locales/en.js.map +3 -3
  74. package/dist/i18n/locales/es.js +69 -3
  75. package/dist/i18n/locales/es.js.map +1 -1
  76. package/dist/i18n/locales/fr.js +69 -3
  77. package/dist/i18n/locales/fr.js.map +1 -1
  78. package/dist/i18n/locales/hu.js +69 -3
  79. package/dist/i18n/locales/hu.js.map +1 -1
  80. package/dist/i18n/locales/it.js +69 -3
  81. package/dist/i18n/locales/it.js.map +1 -1
  82. package/dist/i18n/locales/zh.js +69 -3
  83. package/dist/i18n/locales/zh.js.map +1 -1
  84. package/dist/i18n/review.js +5 -0
  85. package/dist/i18n/review.js.map +1 -1
  86. package/dist/index.d.ts +2 -0
  87. package/dist/index.js +6 -0
  88. package/dist/index.js.map +1 -1
  89. package/dist/notifications/feedback-notification-types-labels.d.ts +15 -0
  90. package/dist/notifications/feedback-notification-types-labels.js +11 -0
  91. package/dist/notifications/feedback-notification-types-labels.js.map +1 -0
  92. package/dist/notifications/feedback-notification-types.d.ts +28 -0
  93. package/dist/notifications/feedback-notification-types.js +21 -0
  94. package/dist/notifications/feedback-notification-types.js.map +1 -0
  95. package/package.json +1 -1
  96. package/src/feedback/feedback-comment-thread.tsx +277 -0
  97. package/src/feedback/feedback-dialog-labels.ts +1 -0
  98. package/src/feedback/feedback-dialog.tsx +30 -2
  99. package/src/feedback/feedback-labels.ts +14 -0
  100. package/src/feedback/feedback-menu-labels.ts +1 -0
  101. package/src/feedback/feedback-menu.tsx +29 -3
  102. package/src/feedback/feedback-public-labels.ts +80 -0
  103. package/src/feedback/feedback-public-list.tsx +478 -0
  104. package/src/feedback/feedback-public-switch.tsx +102 -0
  105. package/src/feedback/feedback-public-types.ts +82 -0
  106. package/src/feedback/feedback-record.ts +39 -1
  107. package/src/feedback/feedback-replies-context.ts +9 -0
  108. package/src/feedback/feedback-replies.tsx +235 -0
  109. package/src/feedback/feedback-row-detail-labels.ts +1 -0
  110. package/src/feedback/feedback-row-detail.tsx +115 -74
  111. package/src/feedback/feedback-submit-dialog.tsx +9 -0
  112. package/src/feedback/feedback-submit.tsx +10 -1
  113. package/src/feedback/feedback-table.tsx +73 -6
  114. package/src/feedback/feedback-thread-parts-labels.ts +41 -0
  115. package/src/feedback/feedback-thread.tsx +18 -1
  116. package/src/feedback/feedback-vote-button.tsx +123 -0
  117. package/src/feedback.ts +10 -0
  118. package/src/i18n/defaults.ts +12 -0
  119. package/src/i18n/german.ts +66 -0
  120. package/src/i18n/kit-labels.tsx +16 -0
  121. package/src/i18n/locales/en.ts +8 -0
  122. package/src/i18n/locales/es.ts +66 -0
  123. package/src/i18n/locales/fr.ts +66 -0
  124. package/src/i18n/locales/hu.ts +66 -0
  125. package/src/i18n/locales/it.ts +66 -0
  126. package/src/i18n/locales/zh.ts +66 -0
  127. package/src/i18n/review.ts +5 -0
  128. package/src/index.ts +9 -0
  129. package/src/notifications/feedback-notification-types-labels.ts +24 -0
  130. package/src/notifications/feedback-notification-types.ts +46 -0
@@ -36,6 +36,10 @@ import {
36
36
  } from "./feedback-record.js";
37
37
  import { useFeedbackStatusUndo } from "./feedback-status-undo.js";
38
38
  import { DEFAULT_FEEDBACK_DETAIL_LABELS } from "./feedback-row-detail-labels.js";
39
+ import { FeedbackReplyComposer, FeedbackReplyTimeline, feedbackReplyNudge } from "./feedback-replies.js";
40
+ import { FeedbackPublicSwitch } from "./feedback-public-switch.js";
41
+ import { FeedbackRepliesDrawnAboveContext } from "./feedback-replies-context.js";
42
+ import { DEFAULT_FEEDBACK_COMMENTS_LABELS } from "./feedback-thread-parts-labels.js";
39
43
  function useFeedbackDetailLabels(labels) {
40
44
  return useKitLabels("feedbackDetail", DEFAULT_FEEDBACK_DETAIL_LABELS, labels);
41
45
  }
@@ -220,6 +224,10 @@ function FeedbackRowDetail({
220
224
  renderDate,
221
225
  commit,
222
226
  showSubject = true,
227
+ onReply,
228
+ replying = false,
229
+ comments,
230
+ onPublicChange,
223
231
  labels: labelsProp,
224
232
  className
225
233
  }) {
@@ -229,7 +237,6 @@ function FeedbackRowDetail({
229
237
  const ownStatusChange = useFeedbackStatusUndo(onUpdate);
230
238
  const changeStatus = statusChange ?? ownStatusChange;
231
239
  const [editingBody, setEditingBody] = useState(false);
232
- const [editingOutcome, setEditingOutcome] = useState(false);
233
240
  const [reworking, setReworking] = useState(false);
234
241
  const access = feedbackRowAccess(row, { canEdit, viewerId });
235
242
  const bodyText = splitBodyAttachments(row.body).text;
@@ -246,15 +253,8 @@ function FeedbackRowDetail({
246
253
  }
247
254
  onUpdate({ id: row.id, body: replaceDescription(row.body, value) }, { onSuccess: () => setEditingBody(false) });
248
255
  };
249
- const saveOutcome = (value) => {
250
- const next = value.trim() ? value.trim() : null;
251
- if (next === row.outcome) {
252
- setEditingOutcome(false);
253
- return;
254
- }
255
- onUpdate({ id: row.id, outcome: next }, { onSuccess: () => setEditingOutcome(false) });
256
- };
257
- const showOutcomeEditor = access.canEditOutcome && editingOutcome;
256
+ const replies = row.replies;
257
+ const commentLabels = useKitLabels("feedbackComments", DEFAULT_FEEDBACK_COMMENTS_LABELS);
258
258
  const showRework = access.canRework && reworking;
259
259
  return /* @__PURE__ */ jsxs(FeedbackDetail, { className, children: [
260
260
  showSubject && /* @__PURE__ */ jsx(FeedbackDetailSection, { title: labels.subject, children: /* @__PURE__ */ jsxs("p", { className: "flex flex-wrap items-center gap-x-2 gap-y-1 text-sm", "data-feedback-subject": "", children: [
@@ -319,36 +319,22 @@ function FeedbackRowDetail({
319
319
  /* @__PURE__ */ jsx(
320
320
  FeedbackDetailSection,
321
321
  {
322
- title: labels.outcome,
322
+ title: replies ? labels.replies : labels.outcome,
323
323
  action: row.resolved_at ? /* @__PURE__ */ jsx("span", { className: "text-xs text-muted", children: labels.resolvedAt(dateText(row.resolved_at)) }) : void 0,
324
- children: showOutcomeEditor ? /* @__PURE__ */ jsx(
325
- FeedbackNoteEditor,
326
- {
327
- initial: row.outcome ?? "",
328
- pending,
329
- commit,
330
- onSave: saveOutcome,
331
- onCancel: () => setEditingOutcome(false),
332
- saveLabel: labels.save,
333
- cancelLabel: labels.cancel,
334
- placeholder: labels.outcomePlaceholder
335
- },
336
- row.id
337
- ) : /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
338
- /* @__PURE__ */ jsx(FeedbackProse, { children: row.outcome || void 0 }),
339
- (access.canEditOutcome || access.canRework && !reworking || pageHref) && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
340
- access.canEditOutcome && /* @__PURE__ */ jsx(
341
- Button,
342
- {
343
- type: "button",
344
- variant: "secondary",
345
- onClick: (event) => {
346
- event.stopPropagation();
347
- setEditingOutcome(true);
348
- },
349
- children: row.outcome ? labels.outcomeUpdate : labels.outcomeAdd
350
- }
351
- ),
324
+ children: /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
325
+ replies ? /* @__PURE__ */ jsx(FeedbackReplyTimeline, { replies }) : /* @__PURE__ */ jsx(FeedbackProse, { children: row.outcome || void 0 }),
326
+ replies && access.canEditOutcome && onReply && /* @__PURE__ */ jsx(
327
+ FeedbackReplyComposer,
328
+ {
329
+ status: row.status,
330
+ onReply,
331
+ pending: replying,
332
+ suggestedStatus: feedbackReplyNudge(row),
333
+ commit
334
+ },
335
+ row.id
336
+ ),
337
+ (access.canRework && !reworking || pageHref) && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
352
338
  access.canRework && !reworking && /* @__PURE__ */ jsxs(
353
339
  Button,
354
340
  {
@@ -376,6 +362,7 @@ function FeedbackRowDetail({
376
362
  ] })
377
363
  }
378
364
  ),
365
+ comments != null && /* @__PURE__ */ jsx(FeedbackDetailSection, { title: commentLabels.comments, children: /* @__PURE__ */ jsx(FeedbackRepliesDrawnAboveContext.Provider, { value: true, children: comments }) }),
379
366
  showRework && /* @__PURE__ */ jsx(
380
367
  FeedbackReworkSection,
381
368
  {
@@ -391,17 +378,31 @@ function FeedbackRowDetail({
391
378
  labels: labelsProp
392
379
  }
393
380
  ),
394
- /* @__PURE__ */ jsx(FeedbackDetailSection, { title: labels.status, children: /* @__PURE__ */ jsx(
395
- FeedbackStatusTransitions,
396
- {
397
- status: row.status,
398
- statuses: access.canChangeStatus ? selectableFeedbackStatuses(row.status) : visibleFeedbackStatuses(row.status),
399
- canEdit: access.canChangeStatus,
400
- commit,
401
- onPick: (status) => changeStatus(row, status),
402
- variant: "pill"
403
- }
404
- ) })
381
+ /* @__PURE__ */ jsxs(FeedbackDetailSection, { title: labels.status, children: [
382
+ /* @__PURE__ */ jsx(
383
+ FeedbackStatusTransitions,
384
+ {
385
+ status: row.status,
386
+ statuses: access.canChangeStatus ? selectableFeedbackStatuses(row.status) : visibleFeedbackStatuses(row.status),
387
+ canEdit: access.canChangeStatus,
388
+ commit,
389
+ onPick: (status) => changeStatus(row, status),
390
+ variant: "pill"
391
+ }
392
+ ),
393
+ onPublicChange && /* @__PURE__ */ jsx(
394
+ FeedbackPublicSwitch,
395
+ {
396
+ row,
397
+ isAdmin: canEdit,
398
+ viewerId,
399
+ onChange: onPublicChange,
400
+ pending,
401
+ commit,
402
+ className: "mt-3"
403
+ }
404
+ )
405
+ ] })
405
406
  ] });
406
407
  }
407
408
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/feedback/feedback-row-detail.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport type { MouseEvent } from \"react\";\nimport { Download, ExternalLink, FileText, RotateCcw } from \"lucide-react\";\nimport { AuthedImage } from \"../components/authed-image\";\nimport { CopyButton } from \"../components/copy-button\";\nimport { TextLink } from \"../components/text-link\";\nimport { toast } from \"../components/toast\";\nimport { Button } from \"../components/button\";\nimport type { AuthedFetcher } from \"../hooks/use-authed-src\";\nimport { useKitLabels, useKitLocale, type LabelOverride } from \"../i18n/kit-labels\";\nimport { filenameFromDisposition, saveBlob } from \"../lib/download\";\nimport { formatDate } from \"../lib/format\";\nimport { DEFAULT_MAX_ATTACHMENT_BYTES } from \"./feedback-attachment\";\nimport { DEFAULT_FEEDBACK_DIALOG_LABELS } from \"./feedback-dialog\";\nimport {\n FeedbackCategoryBadge,\n FeedbackDetail,\n FeedbackDetailSection,\n FeedbackNoteEditor,\n FeedbackProse,\n FeedbackStatusTransitions,\n selectableFeedbackStatuses,\n visibleFeedbackStatuses,\n} from \"./feedback-inbox\";\nimport type { FeedbackNoteAttachment, FeedbackStatus } from \"./feedback-inbox\";\nimport { useFeedbackToastLabels } from \"./feedback-labels\";\nimport {\n FEEDBACK_ATTACHMENT_ACCEPT,\n FEEDBACK_AUTHOR_EDITABLE_STATUSES,\n FEEDBACK_REWORKABLE_STATUSES,\n appendRework,\n attachmentName,\n isImageAttachment,\n replaceDescription,\n splitBodyAttachments,\n splitDescription,\n} from \"./feedback-record\";\nimport type { FeedbackContext, FeedbackRecord } from \"./feedback-record\";\nimport { useFeedbackStatusUndo } from \"./feedback-status-undo\";\nimport type { FeedbackStatusChange } from \"./feedback-status-undo\";\nimport type { CommitScope } from \"../components/write-lock\";\nimport { DEFAULT_FEEDBACK_DETAIL_LABELS } from \"./feedback-row-detail-labels\";\n\n/**\n * One report, opened — the panel a feedback table unfolds under its row (§4.4 of\n * docs/feedback-harmonization.md), lifted from keksdose's `FeedbackRow`\n * (`frontend/src/features/feedback/feedback-page.tsx:329-612`) with the contract's\n * changes applied.\n *\n * Until 0.27 each app wrote this panel itself out of the kit's shell\n * (`FeedbackDetail` / `FeedbackDetailSection` / `FeedbackNoteEditor`), and the three\n * copies had drifted in exactly the places a user notices:\n *\n * - **the description editor held the raw body** — keksdose `initial={fb.body}`\n * (`:420`), kastlan the same (`pages/feedback-page.tsx:226`) — so an author fixing a\n * typo could delete the `--- REWORK … ---` rounds and the `[screenshot]` file lines\n * with it, and the history was gone. Here the editor holds the ORIGINAL description\n * only ({@link splitDescription}) and saves through {@link replaceDescription}, which\n * puts every appended block and file line back unchanged;\n * - **kastlan's rework sent `status: \"OPEN\"`** from the client (`:189-195`) and offered it\n * on three statuses; keksdose sends the body alone and lets the server reopen the row\n * on five (live #331). The contract is keksdose's (§3.4) — {@link appendRework}, one\n * file, the server reopens;\n * - **kastlan showed only `screenshot_url`** (`:265-276`) and no downloads; keksdose the\n * screenshot, the other files and the rework pictures, a PDF as a download (dev #578);\n * - **the URL fell away on Kurvenschmiede's rows**, whose backfilled `context.url` is a\n * path (`/accounts?p=2`): keksdose's `new URL(…)` throws on one and the section\n * vanished. kastlan already fell back to `context.route` (`feedbackRaw`, `:97`).\n *\n * The sections, in the contract's order: **Subject** (the category and the title, §8.1;\n * `showSubject={false}` leaves it out), **Description** (the body; the author's\n * Edit while OPEN / READY / IN_PROGRESS), **URL**, **Attachment**, **Outcome** (the admin's\n * outcome editor, Rework, Open page), **Send for rework** (only while reworking) and\n * **Status**. No comment thread (§2.2: kastlan's comments fold into the body, §7.7).\n *\n * The app keeps its data and its API: the row it renders, the PATCH (`onUpdate`), the\n * upload (`onUpload`), the authenticated GET (`fetcher`) and who is looking (`canEdit`,\n * `viewerId`). Every word is the kit's `feedbackDetail` namespace.\n */\n\n/* ── Labels ───────────────────────────────────────────────────────────────── */\n\n/**\n * `feedbackDetail` — the row detail's words (§4.4). English: keksdose's `en.json`\n * (`feedback.*`, `common.*`, `more.copy_url`) with the contract's changes; the de-CH\n * canon (keksdose `de-CH.json`, ss never ß, \"Nacharbeit\" throughout — §7.14) on each key.\n */\nexport interface FeedbackDetailLabels {\n /** The first section's heading: what the report is called (feedback contract §8.1,\n * keksdose live #395 — with the row expanded and the table scrolled, nothing said\n * which entry was being answered). de-CH: \"Betreff\" */\n subject: string;\n /** The description section's heading — keksdose's `feedback.body` (§7.3). The dialog's field asks\n * \"What happened? (optional)\"; the description, once filed, is headed as what it is\n * — and as the author's \"Edit description\" calls it. de-CH: \"Beschreibung\" */\n body: string;\n /** The author's button on that heading. de-CH: \"Bearbeiten\" */\n edit: string;\n /** Its accessible name — says WHAT is edited; contains the visible word.\n * de-CH: \"Beschreibung bearbeiten\" */\n editDescription: string;\n /** The editors' save button (description, outcome). de-CH: \"Speichern\" */\n save: string;\n /** Every editor's cancel button. de-CH: \"Abbrechen\" */\n cancel: string;\n /** Section 2's heading. de-CH: \"URL\" */\n url: string;\n /** The copy button beside the link — copies the FULL `context.url`.\n * de-CH: \"URL kopieren\" */\n copyUrl: string;\n /** Section 3's heading, and each picture's alt text. de-CH: \"Anhang\" */\n attachment: string;\n /** A PDF's / text file's download button, given the file's name.\n * de-CH: \"{{name}} herunterladen\" */\n download: (name: string) => string;\n /** The toast when that download failed. de-CH: \"Der Anhang konnte nicht\n * heruntergeladen werden.\" */\n downloadFailed: string;\n /** Section 4's heading. de-CH: \"Ergebnis\" */\n outcome: string;\n /** On section 4's heading line once the row is settled, given the formatted\n * `resolved_at` date. de-CH: \"Erledigt am: {{date}}\" */\n resolvedAt: (date: string) => string;\n /** The admin's button while there is no outcome. de-CH: \"Ergebnis hinzufügen\" */\n outcomeAdd: string;\n /** The same button once there is one. de-CH: \"Aktualisieren\" */\n outcomeUpdate: string;\n /** The line above the outcome editor. de-CH: \"Was wurde umgesetzt, entschieden oder\n * warum nicht.\" */\n outcomePlaceholder: string;\n /** The button that opens section 5 on an answered row. de-CH: \"Nacharbeit\" */\n rework: string;\n /** The link to the page the report was filed on. de-CH: \"Seite öffnen\" */\n openPage: string;\n /** Section 5's heading. de-CH: \"Zur Nacharbeit senden\" */\n reworkTitle: string;\n /** Section 5's send button. de-CH: \"Nacharbeit senden\" */\n reworkSend: string;\n /** The line above the rework note. de-CH: \"Was muss noch angepasst werden? Neue\n * Anforderungen oder Richtungswechsel.\" */\n reworkPlaceholder: string;\n /** The toast when the rework's file did not upload — and so nothing was sent. Names\n * no screenshot: it fires for a PDF or a log too (§7.14; keksdose's said\n * \"screenshot\"). de-CH: \"Die Datei konnte nicht hochgeladen werden. Die Nacharbeit\n * wurde nicht gesendet.\" */\n reworkUploadFailed: string;\n /** Section 6's heading. de-CH: \"Status\" */\n status: string;\n /** A `FeedbackNoteEditor`'s box, named when no `placeholder` line names it and the\n * caller gives no `label` — without it the box was read out as just \"edit text\"\n * (round 0.34, the showcase's axe check). de-CH: \"Notiz\" */\n note: string;\n}\n\n// Defined in ./feedback-row-detail-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_FEEDBACK_DETAIL_LABELS };\n\n/** `feedbackDetail` resolved: English, then `<UiKitProvider labels>`, then `labels`. */\nexport function useFeedbackDetailLabels(labels?: LabelOverride<FeedbackDetailLabels>): FeedbackDetailLabels {\n return useKitLabels(\"feedbackDetail\", DEFAULT_FEEDBACK_DETAIL_LABELS, labels);\n}\n\n/* ── The page a report was filed on (§3.2, §4.4.2) ────────────────────────── */\n\n/** `context.url`, else `context.route` — a parsed URL, or null when neither is set or\n * the value is no http(s) address or path (a `javascript:` value is not a page). */\nfunction parsePage(context: FeedbackContext | null | undefined): URL | null {\n const raw = (context?.url || context?.route || \"\").trim();\n if (!raw) return null;\n try {\n // A base, so a PATH-ONLY value parses too: Kurvenschmiede backfills its old rows\n // with `url = page_path + search` (§3.2), and keksdose's `new URL(raw)` threw on\n // those and dropped the section.\n const url = new URL(raw, \"http://localhost\");\n return url.protocol === \"http:\" || url.protocol === \"https:\" ? url : null;\n } catch {\n return null;\n }\n}\n\n/** Collapses a leading `//` run: `/\\/\\/evil.example/` as a path would be a\n * protocol-relative link off the app. */\nconst localPath = (pathname: string) => pathname.replace(/^\\/{2,}/, \"/\");\n\n/**\n * The in-app link to the page a report was filed on — path + query + hash (keksdose\n * `localHref`: the query and hash carry the state worth restoring, `?tab=import`, a\n * drill-down). Read from `context.url`, else `context.route`; a path-only `url` works.\n * Always a path on THIS app, never another origin's address, so it is safe as an\n * `href` whatever the row says. `null` when there is nothing to link.\n */\nexport function feedbackPageHref(context: FeedbackContext | null | undefined): string | null {\n const url = parsePage(context);\n return url ? `${localPath(url.pathname)}${url.search}${url.hash}` : null;\n}\n\n/** The page's path alone — the compact text a URL column shows (§4.3). */\nexport function feedbackPagePath(context: FeedbackContext | null | undefined): string | null {\n const url = parsePage(context);\n return url ? localPath(url.pathname) : null;\n}\n\n/**\n * What \"Copy URL\" copies: the FULL `context.url` as the reporter's browser had it —\n * origin included, which is the one part that says which copy of the app it was\n * (feedback #278) — else `context.route`. `null` when there is no page.\n */\nexport function feedbackPageUrl(context: FeedbackContext | null | undefined): string | null {\n if (!parsePage(context)) return null;\n return (context?.url || context?.route || \"\").trim();\n}\n\n/* ── Attachments (§3.5, §4.4.3) ───────────────────────────────────────────── */\n\n/**\n * Every file a report carries, in the order the detail shows them (§4.4.3): the\n * screenshot it was filed with, then its other files, then whatever the rework rounds\n * brought, in body order (keksdose dev #578, live #291). One list rather than three —\n * a reader looking for \"the picture\" should not have to know at which point in the\n * conversation it was taken.\n *\n * Each URL once: keksdose and Kurvenschmiede content-address their keys, so the same\n * screenshot pasted twice is one URL — shown twice it is the same picture twice (and,\n * keyed by URL, a React key clash keksdose had).\n */\nexport function feedbackAttachmentUrls(\n row: Pick<FeedbackRecord, \"screenshot_url\" | \"attachment_urls\" | \"body\">,\n): string[] {\n const urls = [\n ...(row.screenshot_url ? [row.screenshot_url] : []),\n // `?? []`: NULL on rows filed before the column, and no key at all from a server\n // that predates it (keksdose dev #578).\n ...(row.attachment_urls ?? []),\n ...splitBodyAttachments(row.body).urls,\n ];\n return [...new Set(urls)];\n}\n\n/** The bytes behind a fetcher's answer — a `Blob` as it is, a `Response` checked. */\nasync function toBlob(answer: Blob | Response): Promise<Blob> {\n if (typeof Response !== \"undefined\" && answer instanceof Response) {\n if (!answer.ok) throw new Error(`HTTP ${answer.status}`);\n return answer.blob();\n }\n return answer as Blob;\n}\n\n/** No fetcher: the browser's own `fetch`, with the cookies a same-origin app uses. */\nconst plainFetch: AuthedFetcher = (url, { signal }) => fetch(url, { signal, credentials: \"same-origin\" });\n\n/**\n * A PDF or a text log (keksdose `FeedbackFileDownload`, dev #578): the bytes sit behind\n * an authenticated route that serves them as `attachment`, never inline (§3.5), so a\n * plain link would be a 401 the moment it was opened. Fetched through the app's\n * fetcher and saved with {@link saveBlob}; a failure says so in a toast.\n *\n * Saved under the name the server gives it when the fetcher answers with a `Response`\n * (server-kit's `content_disposition` puts the uploader's own name in `filename*`), and\n * under the URL's last segment — the name on the button — when it answers with a bare\n * `Blob`, which has no headers to ask.\n */\nfunction AttachmentDownload({\n url,\n fetcher,\n labels,\n}: {\n url: string;\n fetcher: AuthedFetcher;\n labels: FeedbackDetailLabels;\n}) {\n const [busy, setBusy] = useState(false);\n const name = attachmentName(url);\n const download = async (event: MouseEvent) => {\n // The row around the detail may toggle on a click.\n event.stopPropagation();\n setBusy(true);\n try {\n const answer = await fetcher(url, { signal: new AbortController().signal });\n const blob = await toBlob(answer);\n const saveAs =\n typeof Response !== \"undefined\" && answer instanceof Response\n ? filenameFromDisposition(answer.headers.get(\"Content-Disposition\"), name)\n : name;\n saveBlob(blob, saveAs);\n } catch {\n toast.error(labels.downloadFailed);\n } finally {\n setBusy(false);\n }\n };\n return (\n <Button\n type=\"button\"\n variant=\"secondary\"\n size=\"sm\"\n pending={busy}\n onClick={(event) => void download(event)}\n aria-label={labels.download(name)}\n className=\"max-w-full\"\n >\n <FileText className=\"size-3.5 shrink-0\" aria-hidden />\n <span className=\"min-w-0 max-w-[14rem] truncate-until-large\">{name}</span>\n <Download className=\"size-3.5 shrink-0\" aria-hidden />\n </Button>\n );\n}\n\n/* ── Who may do what (§3.4, §4.3, §4.4) ───────────────────────────────────── */\n\n/** What the person looking at a row may do with it — {@link feedbackRowAccess}. */\nexport interface FeedbackRowAccess {\n /** The viewer filed it (`viewerId === row.user_id`; never for an erased author). */\n isAuthor: boolean;\n /** \"Edit description\": the author, while the row is OPEN, READY or IN_PROGRESS — on either\n * page (keksdose `canAuthorEdit`, `feedback-page.tsx:398`, is not gated on `mine`). */\n canEditDescription: boolean;\n /** The outcome editor: the admin on the inbox (`canEdit`). */\n canEditOutcome: boolean;\n /** \"Rework\": the admin or the author, on an answered row\n * ({@link FEEDBACK_REWORKABLE_STATUSES}) — §3.4, anyone else gets the server's 403. */\n canRework: boolean;\n /** The status pills: the admin on the inbox; everyone else sees them read-only. */\n canChangeStatus: boolean;\n}\n\n/**\n * The detail's permission rules in one place — the same answers the server gives\n * (§3.4), so the panel never offers what the PATCH would refuse.\n *\n * `canEdit` is the app's \"admin on `/feedback`\": an admin on `/my-feedback` edits no\n * status and no outcome there (§4.3), but as the author still edits the description\n * and sends for rework. `viewerId` is the signed-in user's id.\n */\nexport function feedbackRowAccess(\n row: Pick<FeedbackRecord, \"user_id\" | \"status\">,\n { canEdit, viewerId }: { canEdit: boolean; viewerId?: number | null },\n): FeedbackRowAccess {\n // `user_id: null` is an erased author (keksdose live #275): nobody is that author,\n // least of all a viewer whose id happens to be missing too.\n const isAuthor = row.user_id !== null && viewerId !== undefined && viewerId !== null && viewerId === row.user_id;\n return {\n isAuthor,\n canEditDescription: isAuthor && FEEDBACK_AUTHOR_EDITABLE_STATUSES.includes(row.status),\n canEditOutcome: canEdit,\n canRework: (canEdit || isAuthor) && FEEDBACK_REWORKABLE_STATUSES.includes(row.status),\n canChangeStatus: canEdit,\n };\n}\n\n/* ── The PATCH ─────────────────────────────────────────────────────────────── */\n\n/** What the detail sends as `PATCH /feedback/{id}` (§3.4): the body (a description\n * edit, a rework append) or the outcome — and, through {@link useFeedbackStatusUndo}\n * when no `statusChange` is given, the status. Never two at once: a rework PATCH must\n * carry the body ALONE for the server to read it as an append (keksdose live #331). */\nexport interface FeedbackDetailPatch {\n id: number;\n body?: string;\n /** `null` clears it — a real edit. */\n outcome?: string | null;\n status?: FeedbackStatus;\n}\n\n/**\n * The page's update mutation. **TanStack Query's `mutate` fits as it stands** — pass\n * `update.mutate` (and `pending={update.isPending}`), the same function\n * `useFeedbackStatusUndo` takes. A hand-written one sends the PATCH and calls\n * `onSuccess` once it has landed, and only then: that is when an editor closes. A\n * failure is the mutation's own to toast — the server's `detail`, else\n * `feedbackToast.updateFailed` (§4.4) — and leaves the editor open with its draft.\n */\nexport type FeedbackDetailUpdate = (patch: FeedbackDetailPatch, callbacks: { onSuccess: () => void }) => void;\n\n/** `POST /feedback/attachments` (§3.3): one file up, its URL\n * (`/api/v1/feedback/attachments/<key>`) back. Reject on failure. */\nexport type FeedbackUpload = (file: File) => Promise<string>;\n\n/* ── Send for rework (§4.4.5) ─────────────────────────────────────────────── */\n\nexport interface FeedbackReworkSectionProps {\n /** The row being sent back: its id, and the body the round is appended to. */\n row: Pick<FeedbackRecord, \"id\" | \"body\">;\n /** The PATCH — see {@link FeedbackDetailUpdate}. Called with `{ id, body }` only. */\n onUpdate: FeedbackDetailUpdate;\n /** The PATCH is in flight (`update.isPending`). The upload adds its own. */\n pending?: boolean;\n /** The upload. Left out, the note goes without a file field. */\n onUpload?: FeedbackUpload;\n /** Snapshot the app view as a File — the kit's `captureAppScreenshot`, or the app's\n * own. A \"Capture screenshot\" button appears only with it; a rejection (no\n * `modern-screenshot`, a canvas that would not draw) toasts\n * `feedbackToast.captureFailed` and adds nothing. */\n onCaptureScreenshot?: () => Promise<File | null>;\n /** The round landed — the server has the note and, on an answered row, reopened it. */\n onSent?: () => void;\n onCancel: () => void;\n /** Over the field's defaults: the contract's types and 10 MB (§3.5), the\n * `feedbackToast` refusals, the `feedbackAttachment` words. */\n attachment?: Partial<FeedbackNoteAttachment>;\n /** The send COMMITS — see `FeedbackNoteEditor`'s `commit`. */\n commit?: CommitScope;\n labels?: LabelOverride<FeedbackDetailLabels>;\n}\n\n/**\n * The rework editor (§4.4.5): the submitter — or the admin — sends an answered report\n * back with a note and at most one file, and the server reopens it (§3.4, keksdose\n * `submitRework`, `feedback-page.tsx:350`).\n *\n * - **The note is required** and trimmed: Send stays disabled on a blank box (a file\n * alone cannot be sent; keksdose `:577` dropped that click silently).\n * - **One file**, added, captured or pasted — the dialog's types and 10 MB. It is\n * uploaded FIRST and awaited: a body naming a file that never arrived would be a\n * rework whose evidence is missing, and the upload is the half that fails on its\n * own. If it fails nothing is sent and the toast says so; the note stays in the box.\n * - **The body alone goes in the PATCH** — {@link appendRework}'s strict extension of\n * the current body, which is how the server recognises the append and reopens the\n * row. Never a `status` (kastlan's client sent `OPEN`; an author may not write one,\n * so the server refused the whole PATCH, note and all — keksdose live #331).\n *\n * Exported on its own for an app that offers rework somewhere other than the row\n * detail. Kurvenschmiede's author verdict (\"That is it, done\") is NOT here: an answered\n * item stays answered unless its author sends it back (§7.2).\n */\nexport function FeedbackReworkSection({\n row,\n onUpdate,\n pending = false,\n onUpload,\n onCaptureScreenshot,\n onSent,\n onCancel,\n attachment,\n commit,\n labels: labelsProp,\n}: FeedbackReworkSectionProps) {\n const labels = useFeedbackDetailLabels(labelsProp);\n const toasts = useFeedbackToastLabels();\n const [uploading, setUploading] = useState(false);\n // The body as it is NOW, not as it was when Send was pressed: the list can refresh\n // while the file uploads, and an append to a stale body is no longer a strict\n // extension of the stored one — the server would read it as an edit, and refuse it.\n const latestBody = useRef(row.body);\n useEffect(() => {\n latestBody.current = row.body;\n }, [row.body]);\n\n const capture = onCaptureScreenshot\n ? async () => {\n try {\n return await onCaptureScreenshot();\n } catch {\n toast.error(toasts.captureFailed);\n return null;\n }\n }\n : undefined;\n\n const send = async (value: string, file?: File | null) => {\n const note = value.trim();\n if (!note) return;\n let url: string | null = null;\n if (file && onUpload) {\n setUploading(true);\n try {\n url = await onUpload(file);\n } catch {\n toast.error(labels.reworkUploadFailed);\n return;\n } finally {\n setUploading(false);\n }\n }\n let body: string | null;\n try {\n body = appendRework(latestBody.current, note, url);\n } catch {\n // The upload answered with something that is not an attachment URL of this\n // contract — written anyway it would sit in the body as prose no reader knows to\n // be a file. As far as the person is concerned, the file did not arrive.\n toast.error(labels.reworkUploadFailed);\n return;\n }\n if (body === null) return;\n onUpdate({ id: row.id, body }, { onSuccess: () => onSent?.() });\n };\n\n return (\n <FeedbackDetailSection title={labels.reworkTitle}>\n <FeedbackNoteEditor\n key={row.id}\n initial=\"\"\n required\n commit={commit}\n pending={pending || uploading}\n onSave={(value, file) => void send(value, file)}\n onCancel={onCancel}\n saveLabel={labels.reworkSend}\n cancelLabel={labels.cancel}\n placeholder={labels.reworkPlaceholder}\n attachment={\n onUpload\n ? {\n accept: FEEDBACK_ATTACHMENT_ACCEPT,\n maxBytes: DEFAULT_MAX_ATTACHMENT_BYTES,\n onError: (kind) => {\n toast.error(kind === \"type\" ? toasts.attachmentUnsupported : toasts.attachmentTooLarge);\n },\n onCaptureScreenshot: capture,\n ...attachment,\n }\n : undefined\n }\n />\n </FeedbackDetailSection>\n );\n}\n\n/* ── The detail (§4.4) ─────────────────────────────────────────────────────── */\n\nexport interface FeedbackRowDetailProps {\n /** The report — the list's own row, as `GET /feedback` / `GET /feedback/my` sent it. */\n row: FeedbackRecord;\n /** The admin on the inbox (`/feedback`): status pills and the outcome editor. `false`\n * on `/my-feedback`, for an admin too (§4.3). */\n canEdit: boolean;\n /** The signed-in user's id — who the AUTHOR is: the description editor and rework. */\n viewerId?: number | null;\n /** The page's PATCH — `update.mutate` (see {@link FeedbackDetailUpdate}). */\n onUpdate: FeedbackDetailUpdate;\n /** `update.isPending`: the editors' save buttons wait for it. */\n pending?: boolean;\n /** `POST /feedback/attachments` for the rework's one file. Left out, a rework is a\n * note alone. */\n onUpload?: FeedbackUpload;\n /** The app's authenticated GET (`AuthedImage`'s) — the pictures and the downloads go\n * through it, since the attachment route wants the bearer token (§3.5). Left out,\n * the browser's own fetch with same-origin cookies. */\n fetcher?: AuthedFetcher | null;\n /**\n * The undoable status change — what `useFeedbackStatusUndo(update.mutate)` returns,\n * the SAME one the table's status cell and the swipes use (§4.5). Left out, the\n * detail builds one from `onUpdate`, which is equivalent as long as `onUpdate` is the\n * page's mutation (its observer outlives the row a status filter removes).\n */\n statusChange?: FeedbackStatusChange;\n /** For the rework's \"Capture screenshot\" — see {@link FeedbackReworkSectionProps}. */\n onCaptureScreenshot?: () => Promise<File | null>;\n /** The rework's file field, over the contract's defaults. */\n reworkAttachment?: Partial<FeedbackNoteAttachment>;\n /** How the `resolved_at` date reads — the app's date cell, as a string. Default: the\n * kit's `formatDate` in the provider's locale, `medium` style. */\n renderDate?: (iso: string) => string;\n /**\n * The detail's saves COMMIT (description, outcome, rework, status): under a locked\n * `WriteLockProvider` each is `aria-disabled` with the lock's reason, and nothing\n * reaches `onUpdate`. Off by default — keksdose's shell lock is a read-only demo\n * BUDGET, and a person viewing one still owns their own reports.\n */\n commit?: CommitScope;\n /**\n * Open with the subject: the category badge and the title (feedback contract §8.1,\n * keksdose live #395). On by default; `false` for a page that already shows the title\n * beside the detail.\n */\n showSubject?: boolean;\n labels?: LabelOverride<FeedbackDetailLabels>;\n className?: string;\n}\n\n/**\n * The expanded row of a feedback table (§4.4): what was reported, where, with which\n * files, what the answer was, and where it stands — with the edits each viewer may\n * make. Hand it to `DataTable`'s `expandedRow`:\n *\n * ```tsx\n * const update = useMutation({ mutationFn: ({ id, ...patch }) => api.updateFeedback(id, patch),\n * onSuccess: invalidate, onError: (e) => toast.error(detailOf(e) ?? toastLabels.updateFailed) });\n * const changeStatus = useFeedbackStatusUndo(update.mutate);\n * <DataTable\n * isExpanded={(row) => expandedId === row.id}\n * expandedRow={(row) => (\n * <FeedbackRowDetail row={row} canEdit={isAdmin && !mine} viewerId={user?.id}\n * onUpdate={update.mutate} pending={update.isPending} statusChange={changeStatus}\n * onUpload={api.uploadFeedbackAttachment} fetcher={authedImageFetcher}\n * onCaptureScreenshot={captureAppScreenshot} />\n * )} … />\n * ```\n *\n * Mounted only while its row is expanded, so which editor is open lives here, and\n * collapsing the row closes it. Each editor is keyed by the row's id, so a draft is\n * never thrown away by a list refresh under it.\n */\nexport function FeedbackRowDetail({\n row,\n canEdit,\n viewerId,\n onUpdate,\n pending = false,\n onUpload,\n fetcher,\n statusChange,\n onCaptureScreenshot,\n reworkAttachment,\n renderDate,\n commit,\n showSubject = true,\n labels: labelsProp,\n className,\n}: FeedbackRowDetailProps) {\n const labels = useFeedbackDetailLabels(labelsProp);\n // \"placeholder = the dialog's body label\" (§4.4.1): read from the dialog's own\n // namespace, so the two can never say different things.\n const dialogText = useKitLabels(\"feedbackDialog\", DEFAULT_FEEDBACK_DIALOG_LABELS);\n const locale = useKitLocale();\n const ownStatusChange = useFeedbackStatusUndo(onUpdate);\n const changeStatus = statusChange ?? ownStatusChange;\n const [editingBody, setEditingBody] = useState(false);\n const [editingOutcome, setEditingOutcome] = useState(false);\n const [reworking, setReworking] = useState(false);\n\n const access = feedbackRowAccess(row, { canEdit, viewerId });\n // The body as written, without its file lines (they are shown as files below) — the\n // rework rounds stay in the prose: they are what was said after the answer.\n const bodyText = splitBodyAttachments(row.body).text;\n const { description } = splitDescription(row.body);\n const pageHref = feedbackPageHref(row.context);\n const pageUrl = feedbackPageUrl(row.context);\n const files = feedbackAttachmentUrls(row);\n const fetchFile = fetcher ?? plainFetch;\n const dateText = (iso: string) => (renderDate ? renderDate(iso) : formatDate(iso, \"medium\", { locale }));\n\n const saveDescription = (value: string) => {\n // Only a real change makes a round trip; clearing it is one (\"\" — the description\n // is optional, §7.4), and the rounds and file lines go back unchanged.\n if (value.trim() === description.trim()) {\n setEditingBody(false);\n return;\n }\n onUpdate({ id: row.id, body: replaceDescription(row.body, value) }, { onSuccess: () => setEditingBody(false) });\n };\n\n const saveOutcome = (value: string) => {\n // Blank saves `null`: no outcome, rather than an empty one.\n const next = value.trim() ? value.trim() : null;\n if (next === row.outcome) {\n setEditingOutcome(false);\n return;\n }\n onUpdate({ id: row.id, outcome: next }, { onSuccess: () => setEditingOutcome(false) });\n };\n\n const showOutcomeEditor = access.canEditOutcome && editingOutcome;\n const showRework = access.canRework && reworking;\n\n return (\n <FeedbackDetail className={className}>\n {showSubject && (\n <FeedbackDetailSection title={labels.subject}>\n <p className=\"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm\" data-feedback-subject=\"\">\n <FeedbackCategoryBadge category={row.category} />\n <span className=\"min-w-0 font-medium text-primary [overflow-wrap:anywhere]\">\n {row.title}\n </span>\n </p>\n </FeedbackDetailSection>\n )}\n <FeedbackDetailSection\n title={labels.body}\n action={\n access.canEditDescription && !editingBody ? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={(event) => {\n event.stopPropagation();\n setEditingBody(true);\n }}\n aria-label={labels.editDescription}\n >\n {labels.edit}\n </Button>\n ) : undefined\n }\n >\n {access.canEditDescription && editingBody ? (\n <FeedbackNoteEditor\n key={row.id}\n // The ORIGINAL description only — see the module note.\n initial={description}\n pending={pending}\n commit={commit}\n onSave={saveDescription}\n onCancel={() => setEditingBody(false)}\n saveLabel={labels.save}\n cancelLabel={labels.cancel}\n placeholder={dialogText.bodyOptional ?? dialogText.body}\n />\n ) : (\n <FeedbackProse>{bodyText.trim() ? bodyText : undefined}</FeedbackProse>\n )}\n </FeedbackDetailSection>\n\n {pageHref && pageUrl && (\n // The page it was filed on, with the full URL a click away (keksdose #278).\n <FeedbackDetailSection title={labels.url}>\n <div className=\"flex min-w-0 items-center gap-1.5\">\n <TextLink href={pageHref} tone=\"secondary\" underline=\"hover\" stopPropagation className=\"min-w-0\">\n <code className=\"break-all text-xs\">{pageHref}</code>\n </TextLink>\n <CopyButton size=\"xs\" className=\"shrink-0\" text={pageUrl} label={labels.copyUrl} stopPropagation />\n </div>\n </FeedbackDetailSection>\n )}\n\n {files.length > 0 && (\n <FeedbackDetailSection title={labels.attachment}>\n <div className=\"flex min-w-0 flex-wrap items-start gap-2\">\n {files.map((url) =>\n isImageAttachment(url) ? (\n <AuthedImage\n key={url}\n src={url}\n alt={labels.attachment}\n fetcher={fetchFile}\n link\n stopPropagation\n // A broken attachment is simply not in the row (keksdose's\n // AuthedImage default) rather than a grey tile per failure.\n errorFallback={null}\n wrapperClassName=\"inline-block max-w-full\"\n className=\"max-h-64 max-w-full rounded border border-subtle\"\n />\n ) : (\n <AttachmentDownload key={url} url={url} fetcher={fetchFile} labels={labels} />\n ),\n )}\n </div>\n </FeedbackDetailSection>\n )}\n\n <FeedbackDetailSection\n title={labels.outcome}\n // When the row entered DONE / WONT_DO (keksdose feedback #96).\n action={\n row.resolved_at ? (\n <span className=\"text-xs text-muted\">{labels.resolvedAt(dateText(row.resolved_at))}</span>\n ) : undefined\n }\n >\n {showOutcomeEditor ? (\n <FeedbackNoteEditor\n key={row.id}\n initial={row.outcome ?? \"\"}\n pending={pending}\n commit={commit}\n onSave={saveOutcome}\n onCancel={() => setEditingOutcome(false)}\n saveLabel={labels.save}\n cancelLabel={labels.cancel}\n placeholder={labels.outcomePlaceholder}\n />\n ) : (\n <div className=\"space-y-2\">\n <FeedbackProse>{row.outcome || undefined}</FeedbackProse>\n {(access.canEditOutcome || (access.canRework && !reworking) || pageHref) && (\n <div className=\"flex flex-wrap gap-2\">\n {access.canEditOutcome && (\n <Button\n type=\"button\"\n variant=\"secondary\"\n onClick={(event) => {\n event.stopPropagation();\n setEditingOutcome(true);\n }}\n >\n {row.outcome ? labels.outcomeUpdate : labels.outcomeAdd}\n </Button>\n )}\n {access.canRework && !reworking && (\n <Button\n type=\"button\"\n variant=\"secondary\"\n onClick={(event) => {\n event.stopPropagation();\n setReworking(true);\n }}\n >\n <RotateCcw className=\"size-3.5\" aria-hidden /> {labels.rework}\n </Button>\n )}\n {pageHref && (\n // A real href (keksdose dev #451): middle-click and ⌘/Ctrl-click are\n // the browser's, and only a link has them.\n <Button href={pageHref} variant=\"secondary\" onClick={(event) => event.stopPropagation()}>\n <ExternalLink className=\"size-3.5\" aria-hidden /> {labels.openPage}\n </Button>\n )}\n </div>\n )}\n </div>\n )}\n </FeedbackDetailSection>\n\n {showRework && (\n <FeedbackReworkSection\n row={row}\n onUpdate={onUpdate}\n pending={pending}\n onUpload={onUpload}\n onCaptureScreenshot={onCaptureScreenshot}\n onSent={() => setReworking(false)}\n onCancel={() => setReworking(false)}\n attachment={reworkAttachment}\n commit={commit}\n labels={labelsProp}\n />\n )}\n\n <FeedbackDetailSection title={labels.status}>\n {/* Expanded: the whole enum in one click for the admin (keksdose feedback #421);\n everyone else the narrow set, read-only — a picture of the workflow. */}\n <FeedbackStatusTransitions\n status={row.status}\n statuses={\n access.canChangeStatus ? selectableFeedbackStatuses(row.status) : visibleFeedbackStatuses(row.status)\n }\n canEdit={access.canChangeStatus}\n commit={commit}\n onPick={(status) => changeStatus(row, status)}\n variant=\"pill\"\n />\n </FeedbackDetailSection>\n </FeedbackDetail>\n );\n}\n"],"mappings":";AAmSI,SASE,KATF;AAnSJ,SAAS,WAAW,QAAQ,gBAAgB;AAE5C,SAAS,UAAU,cAAc,UAAU,iBAAiB;AAC5D,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AACzB,SAAS,aAAa;AACtB,SAAS,cAAc;AAEvB,SAAS,cAAc,oBAAwC;AAC/D,SAAS,yBAAyB,gBAAgB;AAClD,SAAS,kBAAkB;AAC3B,SAAS,oCAAoC;AAC7C,SAAS,sCAAsC;AAC/C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,8BAA8B;AACvC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,6BAA6B;AAGtC,SAAS,sCAAsC;AAqHxC,SAAS,wBAAwB,QAAoE;AAC1G,SAAO,aAAa,kBAAkB,gCAAgC,MAAM;AAC9E;AAMA,SAAS,UAAU,SAAyD;AAC1E,QAAM,OAAO,SAAS,OAAO,SAAS,SAAS,IAAI,KAAK;AACxD,MAAI,CAAC,IAAK,QAAO;AACjB,MAAI;AAIF,UAAM,MAAM,IAAI,IAAI,KAAK,kBAAkB;AAC3C,WAAO,IAAI,aAAa,WAAW,IAAI,aAAa,WAAW,MAAM;AAAA,EACvE,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAIA,MAAM,YAAY,CAAC,aAAqB,SAA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AAAA,QACZ,UACE,OAAO,kBAAkB,2BAA2B,IAAI,MAAM,IAAI,wBAAwB,IAAI,MAAM;AAAA,QAEtG,SAAS,OAAO;AAAA,QAChB;AAAA,QACA,QAAQ,CAAC,WAAW,aAAa,KAAK,MAAM;AAAA,QAC5C,SAAQ;AAAA;AAAA,IACV,GACF;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/feedback/feedback-row-detail.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport type { MouseEvent, ReactNode } from \"react\";\nimport { Download, ExternalLink, FileText, RotateCcw } from \"lucide-react\";\nimport { AuthedImage } from \"../components/authed-image\";\nimport { CopyButton } from \"../components/copy-button\";\nimport { TextLink } from \"../components/text-link\";\nimport { toast } from \"../components/toast\";\nimport { Button } from \"../components/button\";\nimport type { AuthedFetcher } from \"../hooks/use-authed-src\";\nimport { useKitLabels, useKitLocale, type LabelOverride } from \"../i18n/kit-labels\";\nimport { filenameFromDisposition, saveBlob } from \"../lib/download\";\nimport { formatDate } from \"../lib/format\";\nimport { DEFAULT_MAX_ATTACHMENT_BYTES } from \"./feedback-attachment\";\nimport { DEFAULT_FEEDBACK_DIALOG_LABELS } from \"./feedback-dialog\";\nimport {\n FeedbackCategoryBadge,\n FeedbackDetail,\n FeedbackDetailSection,\n FeedbackNoteEditor,\n FeedbackProse,\n FeedbackStatusTransitions,\n selectableFeedbackStatuses,\n visibleFeedbackStatuses,\n} from \"./feedback-inbox\";\nimport type { FeedbackNoteAttachment, FeedbackStatus } from \"./feedback-inbox\";\nimport { useFeedbackToastLabels } from \"./feedback-labels\";\nimport {\n FEEDBACK_ATTACHMENT_ACCEPT,\n FEEDBACK_AUTHOR_EDITABLE_STATUSES,\n FEEDBACK_REWORKABLE_STATUSES,\n appendRework,\n attachmentName,\n isImageAttachment,\n replaceDescription,\n splitBodyAttachments,\n splitDescription,\n} from \"./feedback-record\";\nimport type { FeedbackContext, FeedbackRecord } from \"./feedback-record\";\nimport { useFeedbackStatusUndo } from \"./feedback-status-undo\";\nimport type { FeedbackStatusChange } from \"./feedback-status-undo\";\nimport type { CommitScope } from \"../components/write-lock\";\nimport { DEFAULT_FEEDBACK_DETAIL_LABELS } from \"./feedback-row-detail-labels\";\nimport { FeedbackReplyComposer, FeedbackReplyTimeline, feedbackReplyNudge } from \"./feedback-replies\";\nimport { FeedbackPublicSwitch } from \"./feedback-public-switch\";\nimport { FeedbackRepliesDrawnAboveContext } from \"./feedback-replies-context\";\nimport { DEFAULT_FEEDBACK_COMMENTS_LABELS } from \"./feedback-thread-parts-labels\";\n\n/**\n * One report, opened — the panel a feedback table unfolds under its row (§4.4 of\n * docs/feedback-harmonization.md), lifted from keksdose's `FeedbackRow`\n * (`frontend/src/features/feedback/feedback-page.tsx:329-612`) with the contract's\n * changes applied.\n *\n * Until 0.27 each app wrote this panel itself out of the kit's shell\n * (`FeedbackDetail` / `FeedbackDetailSection` / `FeedbackNoteEditor`), and the three\n * copies had drifted in exactly the places a user notices:\n *\n * - **the description editor held the raw body** — keksdose `initial={fb.body}`\n * (`:420`), kastlan the same (`pages/feedback-page.tsx:226`) — so an author fixing a\n * typo could delete the `--- REWORK … ---` rounds and the `[screenshot]` file lines\n * with it, and the history was gone. Here the editor holds the ORIGINAL description\n * only ({@link splitDescription}) and saves through {@link replaceDescription}, which\n * puts every appended block and file line back unchanged;\n * - **kastlan's rework sent `status: \"OPEN\"`** from the client (`:189-195`) and offered it\n * on three statuses; keksdose sends the body alone and lets the server reopen the row\n * on five (live #331). The contract is keksdose's (§3.4) — {@link appendRework}, one\n * file, the server reopens;\n * - **kastlan showed only `screenshot_url`** (`:265-276`) and no downloads; keksdose the\n * screenshot, the other files and the rework pictures, a PDF as a download (dev #578);\n * - **the URL fell away on Kurvenschmiede's rows**, whose backfilled `context.url` is a\n * path (`/accounts?p=2`): keksdose's `new URL(…)` throws on one and the section\n * vanished. kastlan already fell back to `context.route` (`feedbackRaw`, `:97`).\n *\n * The sections, in the contract's order: **Subject** (the category and the title, §8.1;\n * `showSubject={false}` leaves it out), **Description** (the body; the author's\n * Edit while OPEN / READY / IN_PROGRESS), **URL**, **Attachment**, **Replies** (0.38,\n * §9.7: the timeline, the admin's reply composer with its status picker and the nudge,\n * Rework, Open page — on a row without `replies`, a server before 0.38, the frozen\n * **Outcome** read-only in its place), **Comments** (0.38: the app's\n * `FeedbackCommentThread`, when passed), **Send for rework** (only while reworking) and\n * **Status** (with the **Visible to others** switch when `onPublicChange` is passed).\n *\n * The app keeps its data and its API: the row it renders, the PATCH (`onUpdate`), the\n * upload (`onUpload`), the authenticated GET (`fetcher`) and who is looking (`canEdit`,\n * `viewerId`). Every word is the kit's `feedbackDetail` namespace.\n */\n\n/* ── Labels ───────────────────────────────────────────────────────────────── */\n\n/**\n * `feedbackDetail` — the row detail's words (§4.4). English: keksdose's `en.json`\n * (`feedback.*`, `common.*`, `more.copy_url`) with the contract's changes; the de-CH\n * canon (keksdose `de-CH.json`, ss never ß, \"Nacharbeit\" throughout — §7.14) on each key.\n */\nexport interface FeedbackDetailLabels {\n /** The first section's heading: what the report is called (feedback contract §8.1,\n * keksdose live #395 — with the row expanded and the table scrolled, nothing said\n * which entry was being answered). de-CH: \"Betreff\" */\n subject: string;\n /** The description section's heading — keksdose's `feedback.body` (§7.3). The dialog's field asks\n * \"What happened? (optional)\"; the description, once filed, is headed as what it is\n * — and as the author's \"Edit description\" calls it. de-CH: \"Beschreibung\" */\n body: string;\n /** The author's button on that heading. de-CH: \"Bearbeiten\" */\n edit: string;\n /** Its accessible name — says WHAT is edited; contains the visible word.\n * de-CH: \"Beschreibung bearbeiten\" */\n editDescription: string;\n /** The editors' save button (description, outcome). de-CH: \"Speichern\" */\n save: string;\n /** Every editor's cancel button. de-CH: \"Abbrechen\" */\n cancel: string;\n /** Section 2's heading. de-CH: \"URL\" */\n url: string;\n /** The copy button beside the link — copies the FULL `context.url`.\n * de-CH: \"URL kopieren\" */\n copyUrl: string;\n /** Section 3's heading, and each picture's alt text. de-CH: \"Anhang\" */\n attachment: string;\n /** A PDF's / text file's download button, given the file's name.\n * de-CH: \"{{name}} herunterladen\" */\n download: (name: string) => string;\n /** The toast when that download failed. de-CH: \"Der Anhang konnte nicht\n * heruntergeladen werden.\" */\n downloadFailed: string;\n /** Section 4's heading on a row without `replies` (a server before 0.38), where the\n * frozen outcome is shown read-only. de-CH: \"Ergebnis\" */\n outcome: string;\n /** Section 4's heading since 0.38: the replies' timeline (§9.7). de-CH: \"Antworten\" */\n replies: string;\n /** On section 4's heading line once the row is settled, given the formatted\n * `resolved_at` date. de-CH: \"Erledigt am: {{date}}\" */\n resolvedAt: (date: string) => string;\n /** The admin's button while there is no outcome. **Unused since 0.38** (the outcome is\n * frozen, §9.7; a reply is written instead); kept for one release.\n * de-CH: \"Ergebnis hinzufügen\" */\n outcomeAdd: string;\n /** The same button once there is one. Unused since 0.38, as `outcomeAdd`.\n * de-CH: \"Aktualisieren\" */\n outcomeUpdate: string;\n /** The line above the outcome editor. Unused since 0.38, as `outcomeAdd`. de-CH: \"Was wurde umgesetzt, entschieden oder\n * warum nicht.\" */\n outcomePlaceholder: string;\n /** The button that opens section 5 on an answered row. de-CH: \"Nacharbeit\" */\n rework: string;\n /** The link to the page the report was filed on. de-CH: \"Seite öffnen\" */\n openPage: string;\n /** Section 5's heading. de-CH: \"Zur Nacharbeit senden\" */\n reworkTitle: string;\n /** Section 5's send button. de-CH: \"Nacharbeit senden\" */\n reworkSend: string;\n /** The line above the rework note. de-CH: \"Was muss noch angepasst werden? Neue\n * Anforderungen oder Richtungswechsel.\" */\n reworkPlaceholder: string;\n /** The toast when the rework's file did not upload — and so nothing was sent. Names\n * no screenshot: it fires for a PDF or a log too (§7.14; keksdose's said\n * \"screenshot\"). de-CH: \"Die Datei konnte nicht hochgeladen werden. Die Nacharbeit\n * wurde nicht gesendet.\" */\n reworkUploadFailed: string;\n /** Section 6's heading. de-CH: \"Status\" */\n status: string;\n /** A `FeedbackNoteEditor`'s box, named when no `placeholder` line names it and the\n * caller gives no `label` — without it the box was read out as just \"edit text\"\n * (round 0.34, the showcase's axe check). de-CH: \"Notiz\" */\n note: string;\n}\n\n// Defined in ./feedback-row-detail-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_FEEDBACK_DETAIL_LABELS };\n\n/** `feedbackDetail` resolved: English, then `<UiKitProvider labels>`, then `labels`. */\nexport function useFeedbackDetailLabels(labels?: LabelOverride<FeedbackDetailLabels>): FeedbackDetailLabels {\n return useKitLabels(\"feedbackDetail\", DEFAULT_FEEDBACK_DETAIL_LABELS, labels);\n}\n\n/* ── The page a report was filed on (§3.2, §4.4.2) ────────────────────────── */\n\n/** `context.url`, else `context.route` — a parsed URL, or null when neither is set or\n * the value is no http(s) address or path (a `javascript:` value is not a page). */\nfunction parsePage(context: FeedbackContext | null | undefined): URL | null {\n const raw = (context?.url || context?.route || \"\").trim();\n if (!raw) return null;\n try {\n // A base, so a PATH-ONLY value parses too: Kurvenschmiede backfills its old rows\n // with `url = page_path + search` (§3.2), and keksdose's `new URL(raw)` threw on\n // those and dropped the section.\n const url = new URL(raw, \"http://localhost\");\n return url.protocol === \"http:\" || url.protocol === \"https:\" ? url : null;\n } catch {\n return null;\n }\n}\n\n/** Collapses a leading `//` run: `/\\/\\/evil.example/` as a path would be a\n * protocol-relative link off the app. */\nconst localPath = (pathname: string) => pathname.replace(/^\\/{2,}/, \"/\");\n\n/**\n * The in-app link to the page a report was filed on — path + query + hash (keksdose\n * `localHref`: the query and hash carry the state worth restoring, `?tab=import`, a\n * drill-down). Read from `context.url`, else `context.route`; a path-only `url` works.\n * Always a path on THIS app, never another origin's address, so it is safe as an\n * `href` whatever the row says. `null` when there is nothing to link.\n */\nexport function feedbackPageHref(context: FeedbackContext | null | undefined): string | null {\n const url = parsePage(context);\n return url ? `${localPath(url.pathname)}${url.search}${url.hash}` : null;\n}\n\n/** The page's path alone — the compact text a URL column shows (§4.3). */\nexport function feedbackPagePath(context: FeedbackContext | null | undefined): string | null {\n const url = parsePage(context);\n return url ? localPath(url.pathname) : null;\n}\n\n/**\n * What \"Copy URL\" copies: the FULL `context.url` as the reporter's browser had it —\n * origin included, which is the one part that says which copy of the app it was\n * (feedback #278) — else `context.route`. `null` when there is no page.\n */\nexport function feedbackPageUrl(context: FeedbackContext | null | undefined): string | null {\n if (!parsePage(context)) return null;\n return (context?.url || context?.route || \"\").trim();\n}\n\n/* ── Attachments (§3.5, §4.4.3) ───────────────────────────────────────────── */\n\n/**\n * Every file a report carries, in the order the detail shows them (§4.4.3): the\n * screenshot it was filed with, then its other files, then whatever the rework rounds\n * brought, in body order (keksdose dev #578, live #291). One list rather than three —\n * a reader looking for \"the picture\" should not have to know at which point in the\n * conversation it was taken.\n *\n * Each URL once: keksdose and Kurvenschmiede content-address their keys, so the same\n * screenshot pasted twice is one URL — shown twice it is the same picture twice (and,\n * keyed by URL, a React key clash keksdose had).\n */\nexport function feedbackAttachmentUrls(\n row: Pick<FeedbackRecord, \"screenshot_url\" | \"attachment_urls\" | \"body\">,\n): string[] {\n const urls = [\n ...(row.screenshot_url ? [row.screenshot_url] : []),\n // `?? []`: NULL on rows filed before the column, and no key at all from a server\n // that predates it (keksdose dev #578).\n ...(row.attachment_urls ?? []),\n ...splitBodyAttachments(row.body).urls,\n ];\n return [...new Set(urls)];\n}\n\n/** The bytes behind a fetcher's answer — a `Blob` as it is, a `Response` checked. */\nasync function toBlob(answer: Blob | Response): Promise<Blob> {\n if (typeof Response !== \"undefined\" && answer instanceof Response) {\n if (!answer.ok) throw new Error(`HTTP ${answer.status}`);\n return answer.blob();\n }\n return answer as Blob;\n}\n\n/** No fetcher: the browser's own `fetch`, with the cookies a same-origin app uses. */\nconst plainFetch: AuthedFetcher = (url, { signal }) => fetch(url, { signal, credentials: \"same-origin\" });\n\n/**\n * A PDF or a text log (keksdose `FeedbackFileDownload`, dev #578): the bytes sit behind\n * an authenticated route that serves them as `attachment`, never inline (§3.5), so a\n * plain link would be a 401 the moment it was opened. Fetched through the app's\n * fetcher and saved with {@link saveBlob}; a failure says so in a toast.\n *\n * Saved under the name the server gives it when the fetcher answers with a `Response`\n * (server-kit's `content_disposition` puts the uploader's own name in `filename*`), and\n * under the URL's last segment — the name on the button — when it answers with a bare\n * `Blob`, which has no headers to ask.\n */\nfunction AttachmentDownload({\n url,\n fetcher,\n labels,\n}: {\n url: string;\n fetcher: AuthedFetcher;\n labels: FeedbackDetailLabels;\n}) {\n const [busy, setBusy] = useState(false);\n const name = attachmentName(url);\n const download = async (event: MouseEvent) => {\n // The row around the detail may toggle on a click.\n event.stopPropagation();\n setBusy(true);\n try {\n const answer = await fetcher(url, { signal: new AbortController().signal });\n const blob = await toBlob(answer);\n const saveAs =\n typeof Response !== \"undefined\" && answer instanceof Response\n ? filenameFromDisposition(answer.headers.get(\"Content-Disposition\"), name)\n : name;\n saveBlob(blob, saveAs);\n } catch {\n toast.error(labels.downloadFailed);\n } finally {\n setBusy(false);\n }\n };\n return (\n <Button\n type=\"button\"\n variant=\"secondary\"\n size=\"sm\"\n pending={busy}\n onClick={(event) => void download(event)}\n aria-label={labels.download(name)}\n className=\"max-w-full\"\n >\n <FileText className=\"size-3.5 shrink-0\" aria-hidden />\n <span className=\"min-w-0 max-w-[14rem] truncate-until-large\">{name}</span>\n <Download className=\"size-3.5 shrink-0\" aria-hidden />\n </Button>\n );\n}\n\n/* ── Who may do what (§3.4, §4.3, §4.4) ───────────────────────────────────── */\n\n/** What the person looking at a row may do with it — {@link feedbackRowAccess}. */\nexport interface FeedbackRowAccess {\n /** The viewer filed it (`viewerId === row.user_id`; never for an erased author). */\n isAuthor: boolean;\n /** \"Edit description\": the author, while the row is OPEN, READY or IN_PROGRESS — on either\n * page (keksdose `canAuthorEdit`, `feedback-page.tsx:398`, is not gated on `mine`). */\n canEditDescription: boolean;\n /** The admin on the inbox (`canEdit`): since 0.38 the reply composer (the outcome\n * itself is frozen, §9.7). */\n canEditOutcome: boolean;\n /** \"Rework\": the admin or the author, on an answered row\n * ({@link FEEDBACK_REWORKABLE_STATUSES}) — §3.4, anyone else gets the server's 403. */\n canRework: boolean;\n /** The status pills: the admin on the inbox; everyone else sees them read-only. */\n canChangeStatus: boolean;\n}\n\n/**\n * The detail's permission rules in one place — the same answers the server gives\n * (§3.4), so the panel never offers what the PATCH would refuse.\n *\n * `canEdit` is the app's \"admin on `/feedback`\": an admin on `/my-feedback` edits no\n * status and no outcome there (§4.3), but as the author still edits the description\n * and sends for rework. `viewerId` is the signed-in user's id.\n */\nexport function feedbackRowAccess(\n row: Pick<FeedbackRecord, \"user_id\" | \"status\">,\n { canEdit, viewerId }: { canEdit: boolean; viewerId?: number | null },\n): FeedbackRowAccess {\n // `user_id: null` is an erased author (keksdose live #275): nobody is that author,\n // least of all a viewer whose id happens to be missing too.\n const isAuthor = row.user_id !== null && viewerId !== undefined && viewerId !== null && viewerId === row.user_id;\n return {\n isAuthor,\n canEditDescription: isAuthor && FEEDBACK_AUTHOR_EDITABLE_STATUSES.includes(row.status),\n canEditOutcome: canEdit,\n canRework: (canEdit || isAuthor) && FEEDBACK_REWORKABLE_STATUSES.includes(row.status),\n canChangeStatus: canEdit,\n };\n}\n\n/* ── The PATCH ─────────────────────────────────────────────────────────────── */\n\n/** What the detail sends as `PATCH /feedback/{id}` (§3.4): the body (a description\n * edit, a rework append) or the outcome — and, through {@link useFeedbackStatusUndo}\n * when no `statusChange` is given, the status. Never two at once: a rework PATCH must\n * carry the body ALONE for the server to read it as an append (keksdose live #331). */\nexport interface FeedbackDetailPatch {\n id: number;\n body?: string;\n /** `null` clears it — a real edit. **Frozen since 0.38** (§9.7): server-kit 0.11\n * answers 422; the detail no longer sends it (a reply is written instead). */\n outcome?: string | null;\n status?: FeedbackStatus;\n /** 0.38.1: the **Visible to others** flip (§9.3) — what `onPublicChange`'s\n * `PATCH /feedback/{id} {\"public\": next}` carries, alone, so an app can send it\n * through the same `onUpdate` mutation. */\n public?: boolean;\n}\n\n/**\n * The page's update mutation. **TanStack Query's `mutate` fits as it stands** — pass\n * `update.mutate` (and `pending={update.isPending}`), the same function\n * `useFeedbackStatusUndo` takes. A hand-written one sends the PATCH and calls\n * `onSuccess` once it has landed, and only then: that is when an editor closes. A\n * failure is the mutation's own to toast — the server's `detail`, else\n * `feedbackToast.updateFailed` (§4.4) — and leaves the editor open with its draft.\n */\nexport type FeedbackDetailUpdate = (patch: FeedbackDetailPatch, callbacks: { onSuccess: () => void }) => void;\n\n/** `POST /feedback/attachments` (§3.3): one file up, its URL\n * (`/api/v1/feedback/attachments/<key>`) back. Reject on failure. */\nexport type FeedbackUpload = (file: File) => Promise<string>;\n\n/* ── Send for rework (§4.4.5) ─────────────────────────────────────────────── */\n\nexport interface FeedbackReworkSectionProps {\n /** The row being sent back: its id, and the body the round is appended to. */\n row: Pick<FeedbackRecord, \"id\" | \"body\">;\n /** The PATCH — see {@link FeedbackDetailUpdate}. Called with `{ id, body }` only. */\n onUpdate: FeedbackDetailUpdate;\n /** The PATCH is in flight (`update.isPending`). The upload adds its own. */\n pending?: boolean;\n /** The upload. Left out, the note goes without a file field. */\n onUpload?: FeedbackUpload;\n /** Snapshot the app view as a File — the kit's `captureAppScreenshot`, or the app's\n * own. A \"Capture screenshot\" button appears only with it; a rejection (no\n * `modern-screenshot`, a canvas that would not draw) toasts\n * `feedbackToast.captureFailed` and adds nothing. */\n onCaptureScreenshot?: () => Promise<File | null>;\n /** The round landed — the server has the note and, on an answered row, reopened it. */\n onSent?: () => void;\n onCancel: () => void;\n /** Over the field's defaults: the contract's types and 10 MB (§3.5), the\n * `feedbackToast` refusals, the `feedbackAttachment` words. */\n attachment?: Partial<FeedbackNoteAttachment>;\n /** The send COMMITS — see `FeedbackNoteEditor`'s `commit`. */\n commit?: CommitScope;\n labels?: LabelOverride<FeedbackDetailLabels>;\n}\n\n/**\n * The rework editor (§4.4.5): the submitter — or the admin — sends an answered report\n * back with a note and at most one file, and the server reopens it (§3.4, keksdose\n * `submitRework`, `feedback-page.tsx:350`).\n *\n * - **The note is required** and trimmed: Send stays disabled on a blank box (a file\n * alone cannot be sent; keksdose `:577` dropped that click silently).\n * - **One file**, added, captured or pasted — the dialog's types and 10 MB. It is\n * uploaded FIRST and awaited: a body naming a file that never arrived would be a\n * rework whose evidence is missing, and the upload is the half that fails on its\n * own. If it fails nothing is sent and the toast says so; the note stays in the box.\n * - **The body alone goes in the PATCH** — {@link appendRework}'s strict extension of\n * the current body, which is how the server recognises the append and reopens the\n * row. Never a `status` (kastlan's client sent `OPEN`; an author may not write one,\n * so the server refused the whole PATCH, note and all — keksdose live #331).\n *\n * Exported on its own for an app that offers rework somewhere other than the row\n * detail. Kurvenschmiede's author verdict (\"That is it, done\") is NOT here: an answered\n * item stays answered unless its author sends it back (§7.2).\n */\nexport function FeedbackReworkSection({\n row,\n onUpdate,\n pending = false,\n onUpload,\n onCaptureScreenshot,\n onSent,\n onCancel,\n attachment,\n commit,\n labels: labelsProp,\n}: FeedbackReworkSectionProps) {\n const labels = useFeedbackDetailLabels(labelsProp);\n const toasts = useFeedbackToastLabels();\n const [uploading, setUploading] = useState(false);\n // The body as it is NOW, not as it was when Send was pressed: the list can refresh\n // while the file uploads, and an append to a stale body is no longer a strict\n // extension of the stored one — the server would read it as an edit, and refuse it.\n const latestBody = useRef(row.body);\n useEffect(() => {\n latestBody.current = row.body;\n }, [row.body]);\n\n const capture = onCaptureScreenshot\n ? async () => {\n try {\n return await onCaptureScreenshot();\n } catch {\n toast.error(toasts.captureFailed);\n return null;\n }\n }\n : undefined;\n\n const send = async (value: string, file?: File | null) => {\n const note = value.trim();\n if (!note) return;\n let url: string | null = null;\n if (file && onUpload) {\n setUploading(true);\n try {\n url = await onUpload(file);\n } catch {\n toast.error(labels.reworkUploadFailed);\n return;\n } finally {\n setUploading(false);\n }\n }\n let body: string | null;\n try {\n body = appendRework(latestBody.current, note, url);\n } catch {\n // The upload answered with something that is not an attachment URL of this\n // contract — written anyway it would sit in the body as prose no reader knows to\n // be a file. As far as the person is concerned, the file did not arrive.\n toast.error(labels.reworkUploadFailed);\n return;\n }\n if (body === null) return;\n onUpdate({ id: row.id, body }, { onSuccess: () => onSent?.() });\n };\n\n return (\n <FeedbackDetailSection title={labels.reworkTitle}>\n <FeedbackNoteEditor\n key={row.id}\n initial=\"\"\n required\n commit={commit}\n pending={pending || uploading}\n onSave={(value, file) => void send(value, file)}\n onCancel={onCancel}\n saveLabel={labels.reworkSend}\n cancelLabel={labels.cancel}\n placeholder={labels.reworkPlaceholder}\n attachment={\n onUpload\n ? {\n accept: FEEDBACK_ATTACHMENT_ACCEPT,\n maxBytes: DEFAULT_MAX_ATTACHMENT_BYTES,\n onError: (kind) => {\n toast.error(kind === \"type\" ? toasts.attachmentUnsupported : toasts.attachmentTooLarge);\n },\n onCaptureScreenshot: capture,\n ...attachment,\n }\n : undefined\n }\n />\n </FeedbackDetailSection>\n );\n}\n\n/* ── The detail (§4.4) ─────────────────────────────────────────────────────── */\n\nexport interface FeedbackRowDetailProps {\n /** The report — the list's own row, as `GET /feedback` / `GET /feedback/my` sent it. */\n row: FeedbackRecord;\n /** The admin on the inbox (`/feedback`): status pills and the outcome editor. `false`\n * on `/my-feedback`, for an admin too (§4.3). */\n canEdit: boolean;\n /** The signed-in user's id — who the AUTHOR is: the description editor and rework. */\n viewerId?: number | null;\n /** The page's PATCH — `update.mutate` (see {@link FeedbackDetailUpdate}). */\n onUpdate: FeedbackDetailUpdate;\n /** `update.isPending`: the editors' save buttons wait for it. */\n pending?: boolean;\n /** `POST /feedback/attachments` for the rework's one file. Left out, a rework is a\n * note alone. */\n onUpload?: FeedbackUpload;\n /** The app's authenticated GET (`AuthedImage`'s) — the pictures and the downloads go\n * through it, since the attachment route wants the bearer token (§3.5). Left out,\n * the browser's own fetch with same-origin cookies. */\n fetcher?: AuthedFetcher | null;\n /**\n * The undoable status change — what `useFeedbackStatusUndo(update.mutate)` returns,\n * the SAME one the table's status cell and the swipes use (§4.5). Left out, the\n * detail builds one from `onUpdate`, which is equivalent as long as `onUpdate` is the\n * page's mutation (its observer outlives the row a status filter removes).\n */\n statusChange?: FeedbackStatusChange;\n /** For the rework's \"Capture screenshot\" — see {@link FeedbackReworkSectionProps}. */\n onCaptureScreenshot?: () => Promise<File | null>;\n /** The rework's file field, over the contract's defaults. */\n reworkAttachment?: Partial<FeedbackNoteAttachment>;\n /** How the `resolved_at` date reads — the app's date cell, as a string. Default: the\n * kit's `formatDate` in the provider's locale, `medium` style. */\n renderDate?: (iso: string) => string;\n /**\n * The detail's saves COMMIT (description, outcome, rework, status): under a locked\n * `WriteLockProvider` each is `aria-disabled` with the lock's reason, and nothing\n * reaches `onUpdate`. Off by default — keksdose's shell lock is a read-only demo\n * BUDGET, and a person viewing one still owns their own reports.\n */\n commit?: CommitScope;\n /**\n * Open with the subject: the category badge and the title (feedback contract §8.1,\n * keksdose live #395). On by default; `false` for a page that already shows the title\n * beside the detail.\n */\n showSubject?: boolean;\n /**\n * 0.38: `POST /feedback/{id}/replies` (§9.7) — the body and the status picked\n * (`undefined`: \"No change\"). With `canEdit` and a row that carries `replies`, the\n * reply composer stands under the timeline. Return the promise: the box clears when it\n * resolves. A failure is the app's to toast — the server's `detail`, else\n * `feedbackToast.replyFailed` (0.38.1).\n */\n onReply?: (body: string, status?: FeedbackStatus) => void | Promise<unknown>;\n /** 0.38: the reply is in flight. */\n replying?: boolean;\n /** 0.38: the report's comments — the app's `FeedbackCommentThread` — in a section of\n * their own under the replies. A thread here draws the comments alone (0.38.1): the\n * Replies section above has the replies, so whatever `replies` the thread is handed\n * are dropped, and nothing is drawn twice. */\n comments?: ReactNode;\n /** 0.38: `PATCH /feedback/{id} {\"public\": next}` — draws the **Visible to others**\n * switch (`FeedbackPublicSwitch`) in the Status section, for the admin (`canEdit`)\n * and, within §9.3's window, the author. The page's own mutation fits:\n * `onPublicChange={(next) => update.mutate({ id: row.id, public: next })}` —\n * {@link FeedbackDetailPatch}'s `public` (0.38.1). */\n onPublicChange?: (next: boolean) => void;\n labels?: LabelOverride<FeedbackDetailLabels>;\n className?: string;\n}\n\n/**\n * The expanded row of a feedback table (§4.4): what was reported, where, with which\n * files, what the answer was, and where it stands — with the edits each viewer may\n * make. Hand it to `DataTable`'s `expandedRow`:\n *\n * ```tsx\n * const update = useMutation({ mutationFn: ({ id, ...patch }) => api.updateFeedback(id, patch),\n * onSuccess: invalidate, onError: (e) => toast.error(detailOf(e) ?? toastLabels.updateFailed) });\n * const changeStatus = useFeedbackStatusUndo(update.mutate);\n * <DataTable\n * isExpanded={(row) => expandedId === row.id}\n * expandedRow={(row) => (\n * <FeedbackRowDetail row={row} canEdit={isAdmin && !mine} viewerId={user?.id}\n * onUpdate={update.mutate} pending={update.isPending} statusChange={changeStatus}\n * onUpload={api.uploadFeedbackAttachment} fetcher={authedImageFetcher}\n * onCaptureScreenshot={captureAppScreenshot} />\n * )} … />\n * ```\n *\n * Mounted only while its row is expanded, so which editor is open lives here, and\n * collapsing the row closes it. Each editor is keyed by the row's id, so a draft is\n * never thrown away by a list refresh under it.\n */\nexport function FeedbackRowDetail({\n row,\n canEdit,\n viewerId,\n onUpdate,\n pending = false,\n onUpload,\n fetcher,\n statusChange,\n onCaptureScreenshot,\n reworkAttachment,\n renderDate,\n commit,\n showSubject = true,\n onReply,\n replying = false,\n comments,\n onPublicChange,\n labels: labelsProp,\n className,\n}: FeedbackRowDetailProps) {\n const labels = useFeedbackDetailLabels(labelsProp);\n // \"placeholder = the dialog's body label\" (§4.4.1): read from the dialog's own\n // namespace, so the two can never say different things.\n const dialogText = useKitLabels(\"feedbackDialog\", DEFAULT_FEEDBACK_DIALOG_LABELS);\n const locale = useKitLocale();\n const ownStatusChange = useFeedbackStatusUndo(onUpdate);\n const changeStatus = statusChange ?? ownStatusChange;\n const [editingBody, setEditingBody] = useState(false);\n const [reworking, setReworking] = useState(false);\n\n const access = feedbackRowAccess(row, { canEdit, viewerId });\n // The body as written, without its file lines (they are shown as files below) — the\n // rework rounds stay in the prose: they are what was said after the answer.\n const bodyText = splitBodyAttachments(row.body).text;\n const { description } = splitDescription(row.body);\n const pageHref = feedbackPageHref(row.context);\n const pageUrl = feedbackPageUrl(row.context);\n const files = feedbackAttachmentUrls(row);\n const fetchFile = fetcher ?? plainFetch;\n const dateText = (iso: string) => (renderDate ? renderDate(iso) : formatDate(iso, \"medium\", { locale }));\n\n const saveDescription = (value: string) => {\n // Only a real change makes a round trip; clearing it is one (\"\" — the description\n // is optional, §7.4), and the rounds and file lines go back unchanged.\n if (value.trim() === description.trim()) {\n setEditingBody(false);\n return;\n }\n onUpdate({ id: row.id, body: replaceDescription(row.body, value) }, { onSuccess: () => setEditingBody(false) });\n };\n\n // 0.38 (§9.7): the replies replace the outcome; a row without them is a server before\n // 0.38, whose frozen outcome is shown as it is, read-only.\n const replies = row.replies;\n const commentLabels = useKitLabels(\"feedbackComments\", DEFAULT_FEEDBACK_COMMENTS_LABELS);\n const showRework = access.canRework && reworking;\n\n return (\n <FeedbackDetail className={className}>\n {showSubject && (\n <FeedbackDetailSection title={labels.subject}>\n <p className=\"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm\" data-feedback-subject=\"\">\n <FeedbackCategoryBadge category={row.category} />\n <span className=\"min-w-0 font-medium text-primary [overflow-wrap:anywhere]\">\n {row.title}\n </span>\n </p>\n </FeedbackDetailSection>\n )}\n <FeedbackDetailSection\n title={labels.body}\n action={\n access.canEditDescription && !editingBody ? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={(event) => {\n event.stopPropagation();\n setEditingBody(true);\n }}\n aria-label={labels.editDescription}\n >\n {labels.edit}\n </Button>\n ) : undefined\n }\n >\n {access.canEditDescription && editingBody ? (\n <FeedbackNoteEditor\n key={row.id}\n // The ORIGINAL description only — see the module note.\n initial={description}\n pending={pending}\n commit={commit}\n onSave={saveDescription}\n onCancel={() => setEditingBody(false)}\n saveLabel={labels.save}\n cancelLabel={labels.cancel}\n placeholder={dialogText.bodyOptional ?? dialogText.body}\n />\n ) : (\n <FeedbackProse>{bodyText.trim() ? bodyText : undefined}</FeedbackProse>\n )}\n </FeedbackDetailSection>\n\n {pageHref && pageUrl && (\n // The page it was filed on, with the full URL a click away (keksdose #278).\n <FeedbackDetailSection title={labels.url}>\n <div className=\"flex min-w-0 items-center gap-1.5\">\n <TextLink href={pageHref} tone=\"secondary\" underline=\"hover\" stopPropagation className=\"min-w-0\">\n <code className=\"break-all text-xs\">{pageHref}</code>\n </TextLink>\n <CopyButton size=\"xs\" className=\"shrink-0\" text={pageUrl} label={labels.copyUrl} stopPropagation />\n </div>\n </FeedbackDetailSection>\n )}\n\n {files.length > 0 && (\n <FeedbackDetailSection title={labels.attachment}>\n <div className=\"flex min-w-0 flex-wrap items-start gap-2\">\n {files.map((url) =>\n isImageAttachment(url) ? (\n <AuthedImage\n key={url}\n src={url}\n alt={labels.attachment}\n fetcher={fetchFile}\n link\n stopPropagation\n // A broken attachment is simply not in the row (keksdose's\n // AuthedImage default) rather than a grey tile per failure.\n errorFallback={null}\n wrapperClassName=\"inline-block max-w-full\"\n className=\"max-h-64 max-w-full rounded border border-subtle\"\n />\n ) : (\n <AttachmentDownload key={url} url={url} fetcher={fetchFile} labels={labels} />\n ),\n )}\n </div>\n </FeedbackDetailSection>\n )}\n\n <FeedbackDetailSection\n title={replies ? labels.replies : labels.outcome}\n // When the row entered DONE / WONT_DO (keksdose feedback #96).\n action={\n row.resolved_at ? (\n <span className=\"text-xs text-muted\">{labels.resolvedAt(dateText(row.resolved_at))}</span>\n ) : undefined\n }\n >\n <div className=\"space-y-3\">\n {replies ? (\n <FeedbackReplyTimeline replies={replies} />\n ) : (\n <FeedbackProse>{row.outcome || undefined}</FeedbackProse>\n )}\n {replies && access.canEditOutcome && onReply && (\n <FeedbackReplyComposer\n key={row.id}\n status={row.status}\n onReply={onReply}\n pending={replying}\n suggestedStatus={feedbackReplyNudge(row)}\n commit={commit}\n />\n )}\n {((access.canRework && !reworking) || pageHref) && (\n <div className=\"flex flex-wrap gap-2\">\n {access.canRework && !reworking && (\n <Button\n type=\"button\"\n variant=\"secondary\"\n onClick={(event) => {\n event.stopPropagation();\n setReworking(true);\n }}\n >\n <RotateCcw className=\"size-3.5\" aria-hidden /> {labels.rework}\n </Button>\n )}\n {pageHref && (\n // A real href (keksdose dev #451): middle-click and ⌘/Ctrl-click are\n // the browser's, and only a link has them.\n <Button href={pageHref} variant=\"secondary\" onClick={(event) => event.stopPropagation()}>\n <ExternalLink className=\"size-3.5\" aria-hidden /> {labels.openPage}\n </Button>\n )}\n </div>\n )}\n </div>\n </FeedbackDetailSection>\n\n {comments != null && (\n <FeedbackDetailSection title={commentLabels.comments}>\n <FeedbackRepliesDrawnAboveContext.Provider value>{comments}</FeedbackRepliesDrawnAboveContext.Provider>\n </FeedbackDetailSection>\n )}\n\n {showRework && (\n <FeedbackReworkSection\n row={row}\n onUpdate={onUpdate}\n pending={pending}\n onUpload={onUpload}\n onCaptureScreenshot={onCaptureScreenshot}\n onSent={() => setReworking(false)}\n onCancel={() => setReworking(false)}\n attachment={reworkAttachment}\n commit={commit}\n labels={labelsProp}\n />\n )}\n\n <FeedbackDetailSection title={labels.status}>\n {/* Expanded: the whole enum in one click for the admin (keksdose feedback #421);\n everyone else the narrow set, read-only — a picture of the workflow. */}\n <FeedbackStatusTransitions\n status={row.status}\n statuses={\n access.canChangeStatus ? selectableFeedbackStatuses(row.status) : visibleFeedbackStatuses(row.status)\n }\n canEdit={access.canChangeStatus}\n commit={commit}\n onPick={(status) => changeStatus(row, status)}\n variant=\"pill\"\n />\n {onPublicChange && (\n <FeedbackPublicSwitch\n row={row}\n isAdmin={canEdit}\n viewerId={viewerId}\n onChange={onPublicChange}\n pending={pending}\n commit={commit}\n className=\"mt-3\"\n />\n )}\n </FeedbackDetailSection>\n </FeedbackDetail>\n );\n}\n"],"mappings":";AAgTI,SASE,KATF;AAhTJ,SAAS,WAAW,QAAQ,gBAAgB;AAE5C,SAAS,UAAU,cAAc,UAAU,iBAAiB;AAC5D,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS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,GACpF;AAAA,kCAAC,gBAAa,WAAU,YAAW,eAAW,MAAC;AAAA,cAAE;AAAA,cAAE,OAAO;AAAA,eAC5D;AAAA,aAEJ;AAAA,WAEJ;AAAA;AAAA,IACF;AAAA,IAEC,YAAY,QACX,oBAAC,yBAAsB,OAAO,cAAc,UAC1C,8BAAC,iCAAiC,UAAjC,EAA0C,OAAK,MAAE,oBAAS,GAC7D;AAAA,IAGD,cACC;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,QAAQ,MAAM,aAAa,KAAK;AAAA,QAChC,UAAU,MAAM,aAAa,KAAK;AAAA,QAClC,YAAY;AAAA,QACZ;AAAA,QACA,QAAQ;AAAA;AAAA,IACV;AAAA,IAGF,qBAAC,yBAAsB,OAAO,OAAO,QAGnC;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,QAAQ,IAAI;AAAA,UACZ,UACE,OAAO,kBAAkB,2BAA2B,IAAI,MAAM,IAAI,wBAAwB,IAAI,MAAM;AAAA,UAEtG,SAAS,OAAO;AAAA,UAChB;AAAA,UACA,QAAQ,CAAC,WAAW,aAAa,KAAK,MAAM;AAAA,UAC5C,SAAQ;AAAA;AAAA,MACV;AAAA,MACC,kBACC;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA,SAAS;AAAA,UACT;AAAA,UACA,UAAU;AAAA,UACV;AAAA,UACA;AAAA,UACA,WAAU;AAAA;AAAA,MACZ;AAAA,OAEJ;AAAA,KACF;AAEJ;","names":[]}
@@ -34,6 +34,8 @@ export interface FeedbackSubmitDialogProps {
34
34
  version?: string;
35
35
  /** `UseFeedbackSubmitOptions.capture`, as the app passed it. */
36
36
  capture?: false | (() => Promise<File | null>);
37
+ /** `UseFeedbackSubmitOptions.publicNotice` (0.38): the line under the body. */
38
+ publicNotice?: boolean;
37
39
  }
38
40
  /** `FeedbackDialog` as `useFeedbackSubmit` settles it — see the hook for what it settles. */
39
- export declare function FeedbackSubmitDialog({ onClose, category, onCategoryChange, submitting, onSubmit, user, url, attachUrl, onAttachUrlChange, environment, version, capture, }: FeedbackSubmitDialogProps): import("react").JSX.Element;
41
+ export declare function FeedbackSubmitDialog({ onClose, category, onCategoryChange, submitting, onSubmit, user, url, attachUrl, onAttachUrlChange, environment, version, capture, publicNotice, }: FeedbackSubmitDialogProps): import("react").JSX.Element;
@@ -4,6 +4,8 @@ import { toast } from "../components/toast.js";
4
4
  import { captureAppScreenshot } from "./feedback-capture.js";
5
5
  import { FeedbackContextBox, feedbackContext } from "./feedback-context.js";
6
6
  import { FeedbackDialog } from "./feedback-dialog.js";
7
+ import { DEFAULT_FEEDBACK_DIALOG_LABELS } from "./feedback-dialog-labels.js";
8
+ import { useKitLabels } from "../i18n/kit-labels.js";
7
9
  import { useFeedbackCategoryLabels, useFeedbackToastLabels } from "./feedback-labels.js";
8
10
  import {
9
11
  DEFAULT_MAX_ATTACHMENTS,
@@ -22,9 +24,11 @@ function FeedbackSubmitDialog({
22
24
  onAttachUrlChange,
23
25
  environment,
24
26
  version,
25
- capture
27
+ capture,
28
+ publicNotice = false
26
29
  }) {
27
30
  const toastText = useFeedbackToastLabels();
31
+ const dialogText = useKitLabels("feedbackDialog", DEFAULT_FEEDBACK_DIALOG_LABELS);
28
32
  const categoryLabels = useFeedbackCategoryLabels();
29
33
  const onCaptureScreenshot = capture === false ? void 0 : async () => {
30
34
  try {
@@ -55,6 +59,7 @@ function FeedbackSubmitDialog({
55
59
  )
56
60
  ),
57
61
  onCaptureScreenshot,
62
+ publicNotice: publicNotice ? dialogText.publicNotice ?? DEFAULT_FEEDBACK_DIALOG_LABELS.publicNotice : void 0,
58
63
  onSubmit: (data) => onSubmit(data, feedbackContext({ user, attachUrl, url, environment, version })),
59
64
  contextSlot: /* @__PURE__ */ jsx(FeedbackContextBox, { user, url, attachUrl, onAttachUrlChange })
60
65
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/feedback/feedback-submit-dialog.tsx"],"sourcesContent":["import { toast } from \"../components/toast\";\nimport { captureAppScreenshot } from \"./feedback-capture\";\nimport { FeedbackContextBox, feedbackContext, type FeedbackSubmitter } from \"./feedback-context\";\nimport { FeedbackDialog, type FeedbackMultipleSubmission } from \"./feedback-dialog\";\nimport { useFeedbackCategoryLabels, useFeedbackToastLabels } from \"./feedback-labels\";\nimport {\n DEFAULT_MAX_ATTACHMENTS,\n FEEDBACK_ATTACHMENT_ACCEPT,\n FEEDBACK_PICKABLE_CATEGORIES,\n type FeedbackContext,\n type FeedbackEnvironment,\n} from \"./feedback-record\";\nimport type { FeedbackCategory } from \"./feedback-vocabulary\";\n\n/**\n * The open half of `useFeedbackSubmit`: the dialog it draws, with the context box and\n * everything that only exists while somebody is filing a report.\n *\n * A module of its own so it can load LATE (0.34, MOD-1 of the refactor audit 2026-10).\n * Every app mounts the hook in its top bar; this — the attachment field, the modal, the\n * context box, the capture — was ~11 kB gzip of each app's entry chunk, for a dialog most\n * sessions never open. feedback-submit.tsx reaches it only through a literal relative\n * `import()`, so the library build keeps it a module of its own (`bundle: false`) and an\n * app's bundler makes it a chunk of its own.\n *\n * Internal, and not in the barrel: nothing but that `import()` should reach it. The hook\n * keeps the state — open, category, the URL and whether it goes along, the send in\n * flight — and this draws it.\n */\n\n/** What `useFeedbackSubmit` hands its lazily loaded dialog. */\nexport interface FeedbackSubmitDialogProps {\n onClose: () => void;\n category: FeedbackCategory;\n onCategoryChange: (category: FeedbackCategory) => void;\n submitting: boolean;\n /** The form, and the `context` built from the same values the box showed. */\n onSubmit: (data: FeedbackMultipleSubmission, context: FeedbackContext) => void | Promise<void>;\n user?: FeedbackSubmitter | null;\n /** `location.href` when the dialog opened. */\n url: string;\n attachUrl: boolean;\n onAttachUrlChange: (attachUrl: boolean) => void;\n environment?: FeedbackEnvironment | (string & {});\n version?: string;\n /** `UseFeedbackSubmitOptions.capture`, as the app passed it. */\n capture?: false | (() => Promise<File | null>);\n}\n\n/** `FeedbackDialog` as `useFeedbackSubmit` settles it — see the hook for what it settles. */\nexport function FeedbackSubmitDialog({\n onClose,\n category,\n onCategoryChange,\n submitting,\n onSubmit,\n user,\n url,\n attachUrl,\n onAttachUrlChange,\n environment,\n version,\n capture,\n}: FeedbackSubmitDialogProps) {\n const toastText = useFeedbackToastLabels();\n const categoryLabels = useFeedbackCategoryLabels();\n\n const onCaptureScreenshot =\n capture === false\n ? undefined\n : async () => {\n try {\n return await (capture ?? (() => captureAppScreenshot()))();\n } catch {\n toast.error(toastText.captureFailed);\n return null;\n }\n };\n\n return (\n <FeedbackDialog\n open\n onClose={onClose}\n categories={FEEDBACK_PICKABLE_CATEGORIES.map((value) => ({ value, label: categoryLabels[value] }))}\n category={category}\n onCategoryChange={(value) => onCategoryChange(value as FeedbackCategory)}\n submitting={submitting}\n attachments=\"multiple\"\n maxAttachments={DEFAULT_MAX_ATTACHMENTS}\n requireBody={false}\n attachmentAccept={FEEDBACK_ATTACHMENT_ACCEPT}\n onAttachmentError={(kind, info) =>\n toast.error(\n kind === \"type\"\n ? toastText.attachmentUnsupported\n : kind === \"size\"\n ? toastText.attachmentTooLarge\n : // More files at once than there was room for: the surplus was dropped, the\n // rest kept. The count is how many fit, as keksdose says it.\n toastText.attachmentTooMany(info.max ?? DEFAULT_MAX_ATTACHMENTS),\n )\n }\n onCaptureScreenshot={onCaptureScreenshot}\n // The context is read off the very values the box below shows (§3.2).\n onSubmit={(data) => onSubmit(data, feedbackContext({ user, attachUrl, url, environment, version }))}\n contextSlot={<FeedbackContextBox user={user} url={url} attachUrl={attachUrl} onAttachUrlChange={onAttachUrlChange} />}\n />\n );\n}\n"],"mappings":";AAyGmB;AAzGnB,SAAS,aAAa;AACtB,SAAS,4BAA4B;AACrC,SAAS,oBAAoB,uBAA+C;AAC5E,SAAS,sBAAuD;AAChE,SAAS,2BAA2B,8BAA8B;AAClE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AAuCA,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA8B;AAC5B,QAAM,YAAY,uBAAuB;AACzC,QAAM,iBAAiB,0BAA0B;AAEjD,QAAM,sBACJ,YAAY,QACR,SACA,YAAY;AACV,QAAI;AACF,aAAO,OAAO,YAAY,MAAM,qBAAqB,IAAI;AAAA,IAC3D,QAAQ;AACN,YAAM,MAAM,UAAU,aAAa;AACnC,aAAO;AAAA,IACT;AAAA,EACF;AAEN,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAI;AAAA,MACJ;AAAA,MACA,YAAY,6BAA6B,IAAI,CAAC,WAAW,EAAE,OAAO,OAAO,eAAe,KAAK,EAAE,EAAE;AAAA,MACjG;AAAA,MACA,kBAAkB,CAAC,UAAU,iBAAiB,KAAyB;AAAA,MACvE;AAAA,MACA,aAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,kBAAkB;AAAA,MAClB,mBAAmB,CAAC,MAAM,SACxB,MAAM;AAAA,QACJ,SAAS,SACL,UAAU,wBACV,SAAS,SACP,UAAU;AAAA;AAAA;AAAA,UAGV,UAAU,kBAAkB,KAAK,OAAO,uBAAuB;AAAA;AAAA,MACvE;AAAA,MAEF;AAAA,MAEA,UAAU,CAAC,SAAS,SAAS,MAAM,gBAAgB,EAAE,MAAM,WAAW,KAAK,aAAa,QAAQ,CAAC,CAAC;AAAA,MAClG,aAAa,oBAAC,sBAAmB,MAAY,KAAU,WAAsB,mBAAsC;AAAA;AAAA,EACrH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/feedback/feedback-submit-dialog.tsx"],"sourcesContent":["import { toast } from \"../components/toast\";\nimport { captureAppScreenshot } from \"./feedback-capture\";\nimport { FeedbackContextBox, feedbackContext, type FeedbackSubmitter } from \"./feedback-context\";\nimport { FeedbackDialog, type FeedbackMultipleSubmission } from \"./feedback-dialog\";\nimport { DEFAULT_FEEDBACK_DIALOG_LABELS } from \"./feedback-dialog-labels\";\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport { useFeedbackCategoryLabels, useFeedbackToastLabels } from \"./feedback-labels\";\nimport {\n DEFAULT_MAX_ATTACHMENTS,\n FEEDBACK_ATTACHMENT_ACCEPT,\n FEEDBACK_PICKABLE_CATEGORIES,\n type FeedbackContext,\n type FeedbackEnvironment,\n} from \"./feedback-record\";\nimport type { FeedbackCategory } from \"./feedback-vocabulary\";\n\n/**\n * The open half of `useFeedbackSubmit`: the dialog it draws, with the context box and\n * everything that only exists while somebody is filing a report.\n *\n * A module of its own so it can load LATE (0.34, MOD-1 of the refactor audit 2026-10).\n * Every app mounts the hook in its top bar; this — the attachment field, the modal, the\n * context box, the capture — was ~11 kB gzip of each app's entry chunk, for a dialog most\n * sessions never open. feedback-submit.tsx reaches it only through a literal relative\n * `import()`, so the library build keeps it a module of its own (`bundle: false`) and an\n * app's bundler makes it a chunk of its own.\n *\n * Internal, and not in the barrel: nothing but that `import()` should reach it. The hook\n * keeps the state — open, category, the URL and whether it goes along, the send in\n * flight — and this draws it.\n */\n\n/** What `useFeedbackSubmit` hands its lazily loaded dialog. */\nexport interface FeedbackSubmitDialogProps {\n onClose: () => void;\n category: FeedbackCategory;\n onCategoryChange: (category: FeedbackCategory) => void;\n submitting: boolean;\n /** The form, and the `context` built from the same values the box showed. */\n onSubmit: (data: FeedbackMultipleSubmission, context: FeedbackContext) => void | Promise<void>;\n user?: FeedbackSubmitter | null;\n /** `location.href` when the dialog opened. */\n url: string;\n attachUrl: boolean;\n onAttachUrlChange: (attachUrl: boolean) => void;\n environment?: FeedbackEnvironment | (string & {});\n version?: string;\n /** `UseFeedbackSubmitOptions.capture`, as the app passed it. */\n capture?: false | (() => Promise<File | null>);\n /** `UseFeedbackSubmitOptions.publicNotice` (0.38): the line under the body. */\n publicNotice?: boolean;\n}\n\n/** `FeedbackDialog` as `useFeedbackSubmit` settles it — see the hook for what it settles. */\nexport function FeedbackSubmitDialog({\n onClose,\n category,\n onCategoryChange,\n submitting,\n onSubmit,\n user,\n url,\n attachUrl,\n onAttachUrlChange,\n environment,\n version,\n capture,\n publicNotice = false,\n}: FeedbackSubmitDialogProps) {\n const toastText = useFeedbackToastLabels();\n const dialogText = useKitLabels(\"feedbackDialog\", DEFAULT_FEEDBACK_DIALOG_LABELS);\n const categoryLabels = useFeedbackCategoryLabels();\n\n const onCaptureScreenshot =\n capture === false\n ? undefined\n : async () => {\n try {\n return await (capture ?? (() => captureAppScreenshot()))();\n } catch {\n toast.error(toastText.captureFailed);\n return null;\n }\n };\n\n return (\n <FeedbackDialog\n open\n onClose={onClose}\n categories={FEEDBACK_PICKABLE_CATEGORIES.map((value) => ({ value, label: categoryLabels[value] }))}\n category={category}\n onCategoryChange={(value) => onCategoryChange(value as FeedbackCategory)}\n submitting={submitting}\n attachments=\"multiple\"\n maxAttachments={DEFAULT_MAX_ATTACHMENTS}\n requireBody={false}\n attachmentAccept={FEEDBACK_ATTACHMENT_ACCEPT}\n onAttachmentError={(kind, info) =>\n toast.error(\n kind === \"type\"\n ? toastText.attachmentUnsupported\n : kind === \"size\"\n ? toastText.attachmentTooLarge\n : // More files at once than there was room for: the surplus was dropped, the\n // rest kept. The count is how many fit, as keksdose says it.\n toastText.attachmentTooMany(info.max ?? DEFAULT_MAX_ATTACHMENTS),\n )\n }\n onCaptureScreenshot={onCaptureScreenshot}\n publicNotice={\n publicNotice ? (dialogText.publicNotice ?? DEFAULT_FEEDBACK_DIALOG_LABELS.publicNotice) : undefined\n }\n // The context is read off the very values the box below shows (§3.2).\n onSubmit={(data) => onSubmit(data, feedbackContext({ user, attachUrl, url, environment, version }))}\n contextSlot={<FeedbackContextBox user={user} url={url} attachUrl={attachUrl} onAttachUrlChange={onAttachUrlChange} />}\n />\n );\n}\n"],"mappings":";AAkHmB;AAlHnB,SAAS,aAAa;AACtB,SAAS,4BAA4B;AACrC,SAAS,oBAAoB,uBA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AAC;AAAA,MAClG,aAAa,oBAAC,sBAAmB,MAAY,KAAU,WAAsB,mBAAsC;AAAA;AAAA,EACrH;AAEJ;","names":[]}
@@ -56,6 +56,14 @@ export interface UseFeedbackSubmitOptions<R = unknown> {
56
56
  * `modern-screenshot`. A rejection becomes the `captureFailed` toast.
57
57
  */
58
58
  capture?: false | (() => Promise<File | null>);
59
+ /**
60
+ * The app's reports are public (0.38, docs/feedback-harmonization.md §9.2 decision 6):
61
+ * `true` shows **"Other users will see the title and text (never your screenshots or
62
+ * files)"** (`feedbackDialog.publicNotice`) under the body. keksdose and Kurvenschmiede
63
+ * pass it — for a viewer who passes the app's `public_viewer` — and kastlan, whose
64
+ * public parts are off, does not. Default `false`.
65
+ */
66
+ publicNotice?: boolean;
59
67
  }
60
68
  export interface FeedbackSubmit {
61
69
  /**
@@ -8,7 +8,7 @@ const LazySubmitDialog = lazy(
8
8
  () => import("./feedback-submit-dialog.js").then((module) => ({ default: module.FeedbackSubmitDialog }))
9
9
  );
10
10
  function useFeedbackSubmit(options) {
11
- const { upload, create, user, environment, version, onSubmitted, errorMessage, capture } = options;
11
+ const { upload, create, user, environment, version, onSubmitted, errorMessage, capture, publicNotice } = options;
12
12
  const toastText = useFeedbackToastLabels();
13
13
  const [isOpen, setIsOpen] = useState(false);
14
14
  const [category, setCategory] = useState("OTHER");
@@ -69,7 +69,8 @@ function useFeedbackSubmit(options) {
69
69
  onAttachUrlChange: setAttachUrl,
70
70
  environment,
71
71
  version,
72
- capture
72
+ capture,
73
+ publicNotice
73
74
  }
74
75
  ) }) : null;
75
76
  return { open, close, dialog };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/feedback/feedback-submit.tsx"],"sourcesContent":["import { lazy, Suspense, useRef, useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { toast } from \"../components/toast\";\n// Types only, gone from the built module: the dialog's modules load with the dialog.\nimport type { FeedbackSubmitter } from \"./feedback-context\";\nimport type { FeedbackMultipleSubmission } from \"./feedback-dialog\";\nimport { useFeedbackToastLabels } from \"./feedback-labels\";\nimport { FEEDBACK_PICKABLE_CATEGORIES, type FeedbackContext, type FeedbackEnvironment } from \"./feedback-record\";\nimport type { FeedbackCategory } from \"./feedback-vocabulary\";\n\n/**\n * The dialog, loaded when it is first opened rather than with the top bar that mounts the\n * hook (0.34, MOD-1 of the refactor audit 2026-10; see feedback-submit-dialog.tsx). A\n * LITERAL relative `import()`, as the catalogue loaders are (i18n/languages.ts): the\n * library build keeps the module its own (`bundle: false`), and a path an app's bundler\n * can read is a chunk it can split off.\n */\nconst LazySubmitDialog = lazy(() =>\n import(\"./feedback-submit-dialog\").then((module) => ({ default: module.FeedbackSubmitDialog })),\n);\n\n/**\n * `FeedbackCreate` — the body of `POST /feedback` (keksdose `schemas/feedback.py:25`, §3.4\n * of docs/feedback-harmonization.md), as {@link useFeedbackSubmit} hands it to the app's\n * `create`.\n */\nexport interface FeedbackCreatePayload {\n /** Trimmed; never blank (the dialog will not send a subject of spaces). */\n title: string;\n /** `\"\"` when the reporter wrote nothing or only whitespace — the server stores `\"\"`. */\n body: string;\n /** Never `CRASH` — the server answers that with a 422 (§3.4). */\n category: FeedbackCategory;\n /** §3.2, built by `feedbackContext` from what the context box showed. */\n context: FeedbackContext;\n /** The captured screenshot's upload URL, or `null`. */\n screenshot_url: string | null;\n /** The picked and pasted files' upload URLs, in the order they were added — `[]` when\n * none, as keksdose sends it. At most 5. */\n attachment_urls: string[];\n}\n\nexport interface UseFeedbackSubmitOptions<R = unknown> {\n /**\n * `POST /feedback/attachments` for ONE file → its URL (§3.3) — the app's authed client.\n * Every file goes up BEFORE the report is created, so a row never names a file that did\n * not arrive (keksdose `use-feedback-dialog.tsx:89`); if any upload rejects, nothing is\n * created and the failure toast says so.\n */\n upload: (file: File) => Promise<string>;\n /** `POST /feedback` with the payload. Whatever it resolves with reaches `onSubmitted`. */\n create: (payload: FeedbackCreatePayload) => Promise<R>;\n /** Who is filing — shown in the context box and sent in `context.user_*`. */\n user?: FeedbackSubmitter | null;\n /** `context.environment` — the app's own reading of which copy it is (keksdose\n * `deployEnvironment()`). */\n environment?: FeedbackEnvironment | (string & {});\n /** `context.version` — the app build (`__APP_VERSION__`). */\n version?: string;\n /** The report was filed: after the \"Thanks for the feedback!\" toast and the close. The\n * place to invalidate the app's feedback queries. */\n onSubmitted?: (result: R) => void;\n /**\n * The failure toast's text from what `upload` or `create` rejected with — the app's own\n * `extractApiErrorMessage(err, fallback)` (keksdose) / `apiErrorMessage` (Kurvenschmiede),\n * so the server's `detail` wins (§3.7: a 413, a 415, keksdose's demo-session 403). Without\n * it every failure says `feedbackToast.submitFailed`.\n */\n errorMessage?: (error: unknown, fallback: string) => string;\n /**\n * The \"Capture screenshot\" button's capture. Default {@link captureAppScreenshot} of\n * `#root`; another root is `() => captureAppScreenshot({ rootId: \"app\" })`. `false`\n * hides the button — for an app that does not install the optional peer\n * `modern-screenshot`. A rejection becomes the `captureFailed` toast.\n */\n capture?: false | (() => Promise<File | null>);\n}\n\nexport interface FeedbackSubmit {\n /**\n * Open the dialog on `category` — a `FeedbackMenu` row's (§4.2: \"default category when\n * opened from a row: that row's\"). Without one, or with `CRASH` (never pickable), it\n * opens on `OTHER`, the server's own default (§3.4). Each open starts a fresh form,\n * reads `location.href` for the context box and ticks \"Attach current page URL\" again.\n */\n open: (category?: FeedbackCategory) => void;\n /** Close it, as Cancel does. */\n close: () => void;\n /**\n * The dialog — render it once, anywhere (it portals). `null` while closed. Since 0.34\n * its module loads when it is first opened (MOD-1), so it appears a moment after\n * `open`: a test finds it with `await screen.findBy…`, not `getBy…`.\n */\n dialog: ReactNode;\n}\n\n/**\n * The feedback submit dialog, wired (0.27.0, docs/feedback-harmonization.md §4.2): the\n * one call that replaces keksdose's `use-feedback-dialog.tsx`, kastlan's `FeedbackButton`\n * and Kurvenschmiede's `use-feedback-dialog.tsx`.\n *\n * ```tsx\n * const feedback = useFeedbackSubmit({\n * upload: (file) => feedbackApi.uploadAttachment(file),\n * create: (payload) => feedbackApi.create(payload),\n * user, environment: deployEnvironment(), version: __APP_VERSION__,\n * errorMessage: extractApiErrorMessage,\n * onSubmitted: () => qc.invalidateQueries({ queryKey: queryKeys.feedback.all }),\n * });\n * <FeedbackMenu onFile={feedback.open} isAdmin={user?.role === \"ADMIN\"} />\n * {feedback.dialog}\n * ```\n *\n * What it settles, so no app restates it:\n *\n * - `FeedbackDialog` in `attachments=\"multiple\"` with `requireBody={false}` (§7.4): a\n * subject alone is a report. One captured screenshot in its own slot plus up to 5\n * picked or pasted files, `FEEDBACK_ATTACHMENT_ACCEPT` (images, PDF, text), 10 MB each.\n * - The pickable categories — Bug, Idea, Question, Other, in the kit's words. `CRASH` is\n * filed by the error boundary and is never offered (keksdose feedback #160).\n * - The context box, built from the same values as the `context` it sends\n * ({@link FeedbackContextBox} / `feedbackContext`), the URL read when the dialog OPENS.\n * - Upload every file, then create (keksdose `use-feedback-dialog.tsx:89`): the\n * screenshot to `screenshot_url`, the rest to `attachment_urls`, all in parallel.\n * - The toasts, from `feedbackToast`: filed, failed (the server's `detail` through\n * `errorMessage`), a refused file's type, size or count, a failed capture.\n *\n * What stays the app's: the API client, the user, the environment and version, and what\n * to refresh afterwards. No TanStack in here — `create` is a plain promise, so the hook\n * runs in any app; the app's mutation, if it wants one, lives inside `create`.\n *\n * A failure keeps the dialog open with the draft, as keksdose's did. A dialog closed and\n * opened again while a send is still running is NOT closed by that send's success — the\n * new draft is somebody's next report.\n */\nexport function useFeedbackSubmit<R = unknown>(options: UseFeedbackSubmitOptions<R>): FeedbackSubmit {\n const { upload, create, user, environment, version, onSubmitted, errorMessage, capture } = options;\n const toastText = useFeedbackToastLabels();\n const [isOpen, setIsOpen] = useState(false);\n const [category, setCategory] = useState<FeedbackCategory>(\"OTHER\");\n const [url, setUrl] = useState(\"\");\n const [attachUrl, setAttachUrl] = useState(true);\n const [submitting, setSubmitting] = useState(false);\n // Which opening a send belongs to — see \"closed and opened again\" above.\n const opening = useRef(0);\n const inFlight = useRef(false);\n\n const open = (next?: FeedbackCategory) => {\n opening.current += 1;\n setCategory(next && FEEDBACK_PICKABLE_CATEGORIES.includes(next) ? next : \"OTHER\");\n setUrl(typeof window === \"undefined\" ? \"\" : window.location.href);\n // Fresh every time (Kurvenschmiede use-feedback-dialog.tsx:80): a reporter who left the\n // page out of one idea is not saying the bug report after it is unrelated too.\n setAttachUrl(true);\n setIsOpen(true);\n };\n const close = () => setIsOpen(false);\n\n // `context` comes from the dialog, built off the values its context box shows.\n const submit = async (data: FeedbackMultipleSubmission, context: FeedbackContext) => {\n if (inFlight.current) return;\n inFlight.current = true;\n setSubmitting(true);\n const from = opening.current;\n let result: R;\n try {\n const [screenshot_url, attachment_urls] = await Promise.all([\n data.screenshot ? upload(data.screenshot) : Promise.resolve(null),\n Promise.all(data.attachments.map((file) => upload(file))),\n ]);\n result = await create({\n title: data.title.trim(),\n body: data.body.trim() ? data.body : \"\",\n category: data.category as FeedbackCategory,\n context,\n screenshot_url,\n attachment_urls,\n });\n } catch (error) {\n toast.error(errorMessage ? errorMessage(error, toastText.submitFailed) : toastText.submitFailed);\n return;\n } finally {\n inFlight.current = false;\n setSubmitting(false);\n }\n toast.success(toastText.submitted);\n if (opening.current === from) setIsOpen(false);\n onSubmitted?.(result);\n };\n\n // Nothing is drawn while the dialog's module is on its way — a few milliseconds, once per\n // page load; a spinner would only flash. A load that fails (a deploy replaced the chunk)\n // throws a chunk-load error to the app's error boundary, as a lazy route's does.\n const dialog = isOpen ? (\n <Suspense fallback={null}>\n <LazySubmitDialog\n onClose={close}\n category={category}\n onCategoryChange={setCategory}\n submitting={submitting}\n onSubmit={submit}\n user={user}\n url={url}\n attachUrl={attachUrl}\n onAttachUrlChange={setAttachUrl}\n environment={environment}\n version={version}\n capture={capture}\n />\n </Suspense>\n ) : null;\n\n return { open, close, dialog };\n}\n"],"mappings":";AAmMM;AAnMN,SAAS,MAAM,UAAU,QAAQ,gBAAgB;AAEjD,SAAS,aAAa;AAItB,SAAS,8BAA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AA,QACpB,OAAO,KAAK,MAAM,KAAK;AAAA,QACvB,MAAM,KAAK,KAAK,KAAK,IAAI,KAAK,OAAO;AAAA,QACrC,UAAU,KAAK;AAAA,QACf;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH,SAAS,OAAO;AACd,YAAM,MAAM,eAAe,aAAa,OAAO,UAAU,YAAY,IAAI,UAAU,YAAY;AAC/F;AAAA,IACF,UAAE;AACA,eAAS,UAAU;AACnB,oBAAc,KAAK;AAAA,IACrB;AACA,UAAM,QAAQ,UAAU,SAAS;AACjC,QAAI,QAAQ,YAAY,KAAM,WAAU,KAAK;AAC7C,kBAAc,MAAM;AAAA,EACtB;AAKA,QAAM,SAAS,SACb,oBAAC,YAAS,UAAU,MAClB;AAAA,IAAC;AAAA;AAAA,MACC,SAAS;AAAA,MACT;AAAA,MACA,kBAAkB;AAAA,MAClB;AAAA,MACA,UAAU;AAAA,MACV;AAAA,MACA;AAAA,MACA;AAAA,MACA,mBAAmB;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF,GACF,IACE;AAEJ,SAAO,EAAE,MAAM,OAAO,OAAO;AAC/B;","names":[]}
1
+ {"version":3,"sources":["../../src/feedback/feedback-submit.tsx"],"sourcesContent":["import { lazy, Suspense, useRef, useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { toast } from \"../components/toast\";\n// Types only, gone from the built module: the dialog's modules load with the dialog.\nimport type { FeedbackSubmitter } from \"./feedback-context\";\nimport type { FeedbackMultipleSubmission } from \"./feedback-dialog\";\nimport { useFeedbackToastLabels } from \"./feedback-labels\";\nimport { FEEDBACK_PICKABLE_CATEGORIES, type FeedbackContext, type FeedbackEnvironment } from \"./feedback-record\";\nimport type { FeedbackCategory } from \"./feedback-vocabulary\";\n\n/**\n * The dialog, loaded when it is first opened rather than with the top bar that mounts the\n * hook (0.34, MOD-1 of the refactor audit 2026-10; see feedback-submit-dialog.tsx). A\n * LITERAL relative `import()`, as the catalogue loaders are (i18n/languages.ts): the\n * library build keeps the module its own (`bundle: false`), and a path an app's bundler\n * can read is a chunk it can split off.\n */\nconst LazySubmitDialog = lazy(() =>\n import(\"./feedback-submit-dialog\").then((module) => ({ default: module.FeedbackSubmitDialog })),\n);\n\n/**\n * `FeedbackCreate` — the body of `POST /feedback` (keksdose `schemas/feedback.py:25`, §3.4\n * of docs/feedback-harmonization.md), as {@link useFeedbackSubmit} hands it to the app's\n * `create`.\n */\nexport interface FeedbackCreatePayload {\n /** Trimmed; never blank (the dialog will not send a subject of spaces). */\n title: string;\n /** `\"\"` when the reporter wrote nothing or only whitespace — the server stores `\"\"`. */\n body: string;\n /** Never `CRASH` — the server answers that with a 422 (§3.4). */\n category: FeedbackCategory;\n /** §3.2, built by `feedbackContext` from what the context box showed. */\n context: FeedbackContext;\n /** The captured screenshot's upload URL, or `null`. */\n screenshot_url: string | null;\n /** The picked and pasted files' upload URLs, in the order they were added — `[]` when\n * none, as keksdose sends it. At most 5. */\n attachment_urls: string[];\n}\n\nexport interface UseFeedbackSubmitOptions<R = unknown> {\n /**\n * `POST /feedback/attachments` for ONE file → its URL (§3.3) — the app's authed client.\n * Every file goes up BEFORE the report is created, so a row never names a file that did\n * not arrive (keksdose `use-feedback-dialog.tsx:89`); if any upload rejects, nothing is\n * created and the failure toast says so.\n */\n upload: (file: File) => Promise<string>;\n /** `POST /feedback` with the payload. Whatever it resolves with reaches `onSubmitted`. */\n create: (payload: FeedbackCreatePayload) => Promise<R>;\n /** Who is filing — shown in the context box and sent in `context.user_*`. */\n user?: FeedbackSubmitter | null;\n /** `context.environment` — the app's own reading of which copy it is (keksdose\n * `deployEnvironment()`). */\n environment?: FeedbackEnvironment | (string & {});\n /** `context.version` — the app build (`__APP_VERSION__`). */\n version?: string;\n /** The report was filed: after the \"Thanks for the feedback!\" toast and the close. The\n * place to invalidate the app's feedback queries. */\n onSubmitted?: (result: R) => void;\n /**\n * The failure toast's text from what `upload` or `create` rejected with — the app's own\n * `extractApiErrorMessage(err, fallback)` (keksdose) / `apiErrorMessage` (Kurvenschmiede),\n * so the server's `detail` wins (§3.7: a 413, a 415, keksdose's demo-session 403). Without\n * it every failure says `feedbackToast.submitFailed`.\n */\n errorMessage?: (error: unknown, fallback: string) => string;\n /**\n * The \"Capture screenshot\" button's capture. Default {@link captureAppScreenshot} of\n * `#root`; another root is `() => captureAppScreenshot({ rootId: \"app\" })`. `false`\n * hides the button — for an app that does not install the optional peer\n * `modern-screenshot`. A rejection becomes the `captureFailed` toast.\n */\n capture?: false | (() => Promise<File | null>);\n /**\n * The app's reports are public (0.38, docs/feedback-harmonization.md §9.2 decision 6):\n * `true` shows **\"Other users will see the title and text (never your screenshots or\n * files)\"** (`feedbackDialog.publicNotice`) under the body. keksdose and Kurvenschmiede\n * pass it — for a viewer who passes the app's `public_viewer` — and kastlan, whose\n * public parts are off, does not. Default `false`.\n */\n publicNotice?: boolean;\n}\n\nexport interface FeedbackSubmit {\n /**\n * Open the dialog on `category` — a `FeedbackMenu` row's (§4.2: \"default category when\n * opened from a row: that row's\"). Without one, or with `CRASH` (never pickable), it\n * opens on `OTHER`, the server's own default (§3.4). Each open starts a fresh form,\n * reads `location.href` for the context box and ticks \"Attach current page URL\" again.\n */\n open: (category?: FeedbackCategory) => void;\n /** Close it, as Cancel does. */\n close: () => void;\n /**\n * The dialog — render it once, anywhere (it portals). `null` while closed. Since 0.34\n * its module loads when it is first opened (MOD-1), so it appears a moment after\n * `open`: a test finds it with `await screen.findBy…`, not `getBy…`.\n */\n dialog: ReactNode;\n}\n\n/**\n * The feedback submit dialog, wired (0.27.0, docs/feedback-harmonization.md §4.2): the\n * one call that replaces keksdose's `use-feedback-dialog.tsx`, kastlan's `FeedbackButton`\n * and Kurvenschmiede's `use-feedback-dialog.tsx`.\n *\n * ```tsx\n * const feedback = useFeedbackSubmit({\n * upload: (file) => feedbackApi.uploadAttachment(file),\n * create: (payload) => feedbackApi.create(payload),\n * user, environment: deployEnvironment(), version: __APP_VERSION__,\n * errorMessage: extractApiErrorMessage,\n * onSubmitted: () => qc.invalidateQueries({ queryKey: queryKeys.feedback.all }),\n * });\n * <FeedbackMenu onFile={feedback.open} isAdmin={user?.role === \"ADMIN\"} />\n * {feedback.dialog}\n * ```\n *\n * What it settles, so no app restates it:\n *\n * - `FeedbackDialog` in `attachments=\"multiple\"` with `requireBody={false}` (§7.4): a\n * subject alone is a report. One captured screenshot in its own slot plus up to 5\n * picked or pasted files, `FEEDBACK_ATTACHMENT_ACCEPT` (images, PDF, text), 10 MB each.\n * - The pickable categories — Bug, Idea, Question, Other, in the kit's words. `CRASH` is\n * filed by the error boundary and is never offered (keksdose feedback #160).\n * - The context box, built from the same values as the `context` it sends\n * ({@link FeedbackContextBox} / `feedbackContext`), the URL read when the dialog OPENS.\n * - Upload every file, then create (keksdose `use-feedback-dialog.tsx:89`): the\n * screenshot to `screenshot_url`, the rest to `attachment_urls`, all in parallel.\n * - The toasts, from `feedbackToast`: filed, failed (the server's `detail` through\n * `errorMessage`), a refused file's type, size or count, a failed capture.\n *\n * What stays the app's: the API client, the user, the environment and version, and what\n * to refresh afterwards. No TanStack in here — `create` is a plain promise, so the hook\n * runs in any app; the app's mutation, if it wants one, lives inside `create`.\n *\n * A failure keeps the dialog open with the draft, as keksdose's did. A dialog closed and\n * opened again while a send is still running is NOT closed by that send's success — the\n * new draft is somebody's next report.\n */\nexport function useFeedbackSubmit<R = unknown>(options: UseFeedbackSubmitOptions<R>): FeedbackSubmit {\n const { upload, create, user, environment, version, onSubmitted, errorMessage, capture, publicNotice } = options;\n const toastText = useFeedbackToastLabels();\n const [isOpen, setIsOpen] = useState(false);\n const [category, setCategory] = useState<FeedbackCategory>(\"OTHER\");\n const [url, setUrl] = useState(\"\");\n const [attachUrl, setAttachUrl] = useState(true);\n const [submitting, setSubmitting] = useState(false);\n // Which opening a send belongs to — see \"closed and opened again\" above.\n const opening = useRef(0);\n const inFlight = useRef(false);\n\n const open = (next?: FeedbackCategory) => {\n opening.current += 1;\n setCategory(next && FEEDBACK_PICKABLE_CATEGORIES.includes(next) ? next : \"OTHER\");\n setUrl(typeof window === \"undefined\" ? \"\" : window.location.href);\n // Fresh every time (Kurvenschmiede use-feedback-dialog.tsx:80): a reporter who left the\n // page out of one idea is not saying the bug report after it is unrelated too.\n setAttachUrl(true);\n setIsOpen(true);\n };\n const close = () => setIsOpen(false);\n\n // `context` comes from the dialog, built off the values its context box shows.\n const submit = async (data: FeedbackMultipleSubmission, context: FeedbackContext) => {\n if (inFlight.current) return;\n inFlight.current = true;\n setSubmitting(true);\n const from = opening.current;\n let result: R;\n try {\n const [screenshot_url, attachment_urls] = await Promise.all([\n data.screenshot ? upload(data.screenshot) : Promise.resolve(null),\n Promise.all(data.attachments.map((file) => upload(file))),\n ]);\n result = await create({\n title: data.title.trim(),\n body: data.body.trim() ? data.body : \"\",\n category: data.category as FeedbackCategory,\n context,\n screenshot_url,\n attachment_urls,\n });\n } catch (error) {\n toast.error(errorMessage ? errorMessage(error, toastText.submitFailed) : toastText.submitFailed);\n return;\n } finally {\n inFlight.current = false;\n setSubmitting(false);\n }\n toast.success(toastText.submitted);\n if (opening.current === from) setIsOpen(false);\n onSubmitted?.(result);\n };\n\n // Nothing is drawn while the dialog's module is on its way — a few milliseconds, once per\n // page load; a spinner would only flash. A load that fails (a deploy replaced the chunk)\n // throws a chunk-load error to the app's error boundary, as a lazy route's does.\n const dialog = isOpen ? (\n <Suspense fallback={null}>\n <LazySubmitDialog\n onClose={close}\n category={category}\n onCategoryChange={setCategory}\n submitting={submitting}\n onSubmit={submit}\n user={user}\n url={url}\n attachUrl={attachUrl}\n onAttachUrlChange={setAttachUrl}\n environment={environment}\n version={version}\n capture={capture}\n publicNotice={publicNotice}\n />\n </Suspense>\n ) : null;\n\n return { open, close, dialog };\n}\n"],"mappings":";AA2MM;AA3MN,SAAS,MAAM,UAAU,QAAQ,gBAAgB;AAEjD,SAAS,aAAa;AAItB,SAAS,8BAA8B;AACvC,SAAS,oCAAoF;AAU7F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