@eifi1/ui-kit 0.37.0 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) 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 +80 -0
  4. package/dist/feedback/feedback-comment-thread.js +162 -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-menu-labels.js +2 -1
  12. package/dist/feedback/feedback-menu-labels.js.map +1 -1
  13. package/dist/feedback/feedback-menu.d.ts +17 -3
  14. package/dist/feedback/feedback-menu.js +11 -1
  15. package/dist/feedback/feedback-menu.js.map +1 -1
  16. package/dist/feedback/feedback-public-labels.d.ts +50 -0
  17. package/dist/feedback/feedback-public-labels.js +26 -0
  18. package/dist/feedback/feedback-public-labels.js.map +1 -0
  19. package/dist/feedback/feedback-public-list.d.ts +118 -0
  20. package/dist/feedback/feedback-public-list.js +248 -0
  21. package/dist/feedback/feedback-public-list.js.map +1 -0
  22. package/dist/feedback/feedback-public-switch.d.ts +51 -0
  23. package/dist/feedback/feedback-public-switch.js +50 -0
  24. package/dist/feedback/feedback-public-switch.js.map +1 -0
  25. package/dist/feedback/feedback-public-types.d.ts +75 -0
  26. package/dist/feedback/feedback-public-types.js +2 -0
  27. package/dist/feedback/feedback-public-types.js.map +1 -0
  28. package/dist/feedback/feedback-record.d.ts +32 -1
  29. package/dist/feedback/feedback-record.js +10 -0
  30. package/dist/feedback/feedback-record.js.map +1 -1
  31. package/dist/feedback/feedback-replies.d.ts +97 -0
  32. package/dist/feedback/feedback-replies.js +114 -0
  33. package/dist/feedback/feedback-replies.js.map +1 -0
  34. package/dist/feedback/feedback-row-detail-labels.js +1 -0
  35. package/dist/feedback/feedback-row-detail-labels.js.map +1 -1
  36. package/dist/feedback/feedback-row-detail.d.ts +38 -10
  37. package/dist/feedback/feedback-row-detail.js +50 -50
  38. package/dist/feedback/feedback-row-detail.js.map +1 -1
  39. package/dist/feedback/feedback-submit-dialog.d.ts +3 -1
  40. package/dist/feedback/feedback-submit-dialog.js +6 -1
  41. package/dist/feedback/feedback-submit-dialog.js.map +1 -1
  42. package/dist/feedback/feedback-submit.d.ts +8 -0
  43. package/dist/feedback/feedback-submit.js +3 -2
  44. package/dist/feedback/feedback-submit.js.map +1 -1
  45. package/dist/feedback/feedback-table.d.ts +15 -5
  46. package/dist/feedback/feedback-table.js +46 -5
  47. package/dist/feedback/feedback-table.js.map +1 -1
  48. package/dist/feedback/feedback-thread-parts-labels.d.ts +6 -0
  49. package/dist/feedback/feedback-thread-parts-labels.js +36 -0
  50. package/dist/feedback/feedback-thread-parts-labels.js.map +1 -0
  51. package/dist/feedback/feedback-thread.d.ts +8 -0
  52. package/dist/feedback/feedback-thread.js +7 -2
  53. package/dist/feedback/feedback-thread.js.map +1 -1
  54. package/dist/feedback/feedback-vote-button.d.ts +48 -0
  55. package/dist/feedback/feedback-vote-button.js +72 -0
  56. package/dist/feedback/feedback-vote-button.js.map +1 -0
  57. package/dist/feedback.d.ts +6 -0
  58. package/dist/feedback.js +6 -0
  59. package/dist/feedback.js.map +1 -1
  60. package/dist/i18n/defaults.js +12 -0
  61. package/dist/i18n/defaults.js.map +1 -1
  62. package/dist/i18n/german.js +64 -2
  63. package/dist/i18n/german.js.map +1 -1
  64. package/dist/i18n/kit-labels.d.ts +16 -0
  65. package/dist/i18n/kit-labels.js.map +1 -1
  66. package/dist/i18n/locales/en.js +79 -2
  67. package/dist/i18n/locales/en.js.map +3 -3
  68. package/dist/i18n/locales/es.js +64 -2
  69. package/dist/i18n/locales/es.js.map +1 -1
  70. package/dist/i18n/locales/fr.js +64 -2
  71. package/dist/i18n/locales/fr.js.map +1 -1
  72. package/dist/i18n/locales/hu.js +64 -2
  73. package/dist/i18n/locales/hu.js.map +1 -1
  74. package/dist/i18n/locales/it.js +64 -2
  75. package/dist/i18n/locales/it.js.map +1 -1
  76. package/dist/i18n/locales/zh.js +64 -2
  77. package/dist/i18n/locales/zh.js.map +1 -1
  78. package/dist/i18n/review.js +4 -0
  79. package/dist/i18n/review.js.map +1 -1
  80. package/dist/index.d.ts +2 -0
  81. package/dist/index.js +6 -0
  82. package/dist/index.js.map +1 -1
  83. package/dist/notifications/feedback-notification-types-labels.d.ts +15 -0
  84. package/dist/notifications/feedback-notification-types-labels.js +11 -0
  85. package/dist/notifications/feedback-notification-types-labels.js.map +1 -0
  86. package/dist/notifications/feedback-notification-types.d.ts +28 -0
  87. package/dist/notifications/feedback-notification-types.js +21 -0
  88. package/dist/notifications/feedback-notification-types.js.map +1 -0
  89. package/package.json +1 -1
  90. package/src/feedback/feedback-comment-thread.tsx +255 -0
  91. package/src/feedback/feedback-dialog-labels.ts +1 -0
  92. package/src/feedback/feedback-dialog.tsx +30 -2
  93. package/src/feedback/feedback-menu-labels.ts +1 -0
  94. package/src/feedback/feedback-menu.tsx +29 -3
  95. package/src/feedback/feedback-public-labels.ts +76 -0
  96. package/src/feedback/feedback-public-list.tsx +395 -0
  97. package/src/feedback/feedback-public-switch.tsx +102 -0
  98. package/src/feedback/feedback-public-types.ts +82 -0
  99. package/src/feedback/feedback-record.ts +39 -1
  100. package/src/feedback/feedback-replies.tsx +235 -0
  101. package/src/feedback/feedback-row-detail-labels.ts +1 -0
  102. package/src/feedback/feedback-row-detail.tsx +103 -74
  103. package/src/feedback/feedback-submit-dialog.tsx +9 -0
  104. package/src/feedback/feedback-submit.tsx +10 -1
  105. package/src/feedback/feedback-table.tsx +73 -6
  106. package/src/feedback/feedback-thread-parts-labels.ts +41 -0
  107. package/src/feedback/feedback-thread.tsx +18 -1
  108. package/src/feedback/feedback-vote-button.tsx +122 -0
  109. package/src/feedback.ts +10 -0
  110. package/src/i18n/defaults.ts +12 -0
  111. package/src/i18n/german.ts +62 -0
  112. package/src/i18n/kit-labels.tsx +16 -0
  113. package/src/i18n/locales/en.ts +7 -0
  114. package/src/i18n/locales/es.ts +62 -0
  115. package/src/i18n/locales/fr.ts +62 -0
  116. package/src/i18n/locales/hu.ts +62 -0
  117. package/src/i18n/locales/it.ts +62 -0
  118. package/src/i18n/locales/zh.ts +62 -0
  119. package/src/i18n/review.ts +4 -0
  120. package/src/index.ts +9 -0
  121. package/src/notifications/feedback-notification-types-labels.ts +24 -0
  122. package/src/notifications/feedback-notification-types.ts +46 -0
@@ -1,3 +1,4 @@
1
+ import type { ReactNode } from "react";
1
2
  import type { AuthedFetcher } from "../hooks/use-authed-src.js";
2
3
  import { type LabelOverride } from "../i18n/kit-labels.js";
3
4
  import type { FeedbackNoteAttachment, FeedbackStatus } from "./feedback-inbox.js";
@@ -33,9 +34,12 @@ import { DEFAULT_FEEDBACK_DETAIL_LABELS } from "./feedback-row-detail-labels.js"
33
34
  *
34
35
  * The sections, in the contract's order: **Subject** (the category and the title, §8.1;
35
36
  * `showSubject={false}` leaves it out), **Description** (the body; the author's
36
- * Edit while OPEN / READY / IN_PROGRESS), **URL**, **Attachment**, **Outcome** (the admin's
37
- * outcome editor, Rework, Open page), **Send for rework** (only while reworking) and
38
- * **Status**. No comment thread (§2.2: kastlan's comments fold into the body, §7.7).
37
+ * Edit while OPEN / READY / IN_PROGRESS), **URL**, **Attachment**, **Replies** (0.38,
38
+ * §9.7: the timeline, the admin's reply composer with its status picker and the nudge,
39
+ * Rework, Open page — on a row without `replies`, a server before 0.38, the frozen
40
+ * **Outcome** read-only in its place), **Comments** (0.38: the app's
41
+ * `FeedbackCommentThread`, when passed), **Send for rework** (only while reworking) and
42
+ * **Status** (with the **Visible to others** switch when `onPublicChange` is passed).
39
43
  *
40
44
  * The app keeps its data and its API: the row it renders, the PATCH (`onUpdate`), the
41
45
  * upload (`onUpload`), the authenticated GET (`fetcher`) and who is looking (`canEdit`,
@@ -77,16 +81,22 @@ export interface FeedbackDetailLabels {
77
81
  /** The toast when that download failed. de-CH: "Der Anhang konnte nicht
78
82
  * heruntergeladen werden." */
79
83
  downloadFailed: string;
80
- /** Section 4's heading. de-CH: "Ergebnis" */
84
+ /** Section 4's heading on a row without `replies` (a server before 0.38), where the
85
+ * frozen outcome is shown read-only. de-CH: "Ergebnis" */
81
86
  outcome: string;
87
+ /** Section 4's heading since 0.38: the replies' timeline (§9.7). de-CH: "Antworten" */
88
+ replies: string;
82
89
  /** On section 4's heading line once the row is settled, given the formatted
83
90
  * `resolved_at` date. de-CH: "Erledigt am: {{date}}" */
84
91
  resolvedAt: (date: string) => string;
85
- /** The admin's button while there is no outcome. de-CH: "Ergebnis hinzufügen" */
92
+ /** The admin's button while there is no outcome. **Unused since 0.38** (the outcome is
93
+ * frozen, §9.7; a reply is written instead); kept for one release.
94
+ * de-CH: "Ergebnis hinzufügen" */
86
95
  outcomeAdd: string;
87
- /** The same button once there is one. de-CH: "Aktualisieren" */
96
+ /** The same button once there is one. Unused since 0.38, as `outcomeAdd`.
97
+ * de-CH: "Aktualisieren" */
88
98
  outcomeUpdate: string;
89
- /** The line above the outcome editor. de-CH: "Was wurde umgesetzt, entschieden oder
99
+ /** The line above the outcome editor. Unused since 0.38, as `outcomeAdd`. de-CH: "Was wurde umgesetzt, entschieden oder
90
100
  * warum nicht." */
91
101
  outcomePlaceholder: string;
92
102
  /** The button that opens section 5 on an answered row. de-CH: "Nacharbeit" */
@@ -150,7 +160,8 @@ export interface FeedbackRowAccess {
150
160
  /** "Edit description": the author, while the row is OPEN, READY or IN_PROGRESS — on either
151
161
  * page (keksdose `canAuthorEdit`, `feedback-page.tsx:398`, is not gated on `mine`). */
152
162
  canEditDescription: boolean;
153
- /** The outcome editor: the admin on the inbox (`canEdit`). */
163
+ /** The admin on the inbox (`canEdit`): since 0.38 the reply composer (the outcome
164
+ * itself is frozen, §9.7). */
154
165
  canEditOutcome: boolean;
155
166
  /** "Rework": the admin or the author, on an answered row
156
167
  * ({@link FEEDBACK_REWORKABLE_STATUSES}) — §3.4, anyone else gets the server's 403. */
@@ -177,7 +188,8 @@ export declare function feedbackRowAccess(row: Pick<FeedbackRecord, "user_id" |
177
188
  export interface FeedbackDetailPatch {
178
189
  id: number;
179
190
  body?: string;
180
- /** `null` clears it — a real edit. */
191
+ /** `null` clears it — a real edit. **Frozen since 0.38** (§9.7): server-kit 0.11
192
+ * answers 422; the detail no longer sends it (a reply is written instead). */
181
193
  outcome?: string | null;
182
194
  status?: FeedbackStatus;
183
195
  }
@@ -286,6 +298,22 @@ export interface FeedbackRowDetailProps {
286
298
  * beside the detail.
287
299
  */
288
300
  showSubject?: boolean;
301
+ /**
302
+ * 0.38: `POST /feedback/{id}/replies` (§9.7) — the body and the status picked
303
+ * (`undefined`: "No change"). With `canEdit` and a row that carries `replies`, the
304
+ * reply composer stands under the timeline. Return the promise: the box clears when it
305
+ * resolves.
306
+ */
307
+ onReply?: (body: string, status?: FeedbackStatus) => void | Promise<unknown>;
308
+ /** 0.38: the reply is in flight. */
309
+ replying?: boolean;
310
+ /** 0.38: the report's comments — the app's `FeedbackCommentThread` — in a section of
311
+ * their own under the replies. */
312
+ comments?: ReactNode;
313
+ /** 0.38: `PATCH /feedback/{id} {"public": next}` — draws the **Visible to others**
314
+ * switch (`FeedbackPublicSwitch`) in the Status section, for the admin (`canEdit`)
315
+ * and, within §9.3's window, the author. */
316
+ onPublicChange?: (next: boolean) => void;
289
317
  labels?: LabelOverride<FeedbackDetailLabels>;
290
318
  className?: string;
291
319
  }
@@ -312,4 +340,4 @@ export interface FeedbackRowDetailProps {
312
340
  * collapsing the row closes it. Each editor is keyed by the row's id, so a draft is
313
341
  * never thrown away by a list refresh under it.
314
342
  */
315
- export declare function FeedbackRowDetail({ row, canEdit, viewerId, onUpdate, pending, onUpload, fetcher, statusChange, onCaptureScreenshot, reworkAttachment, renderDate, commit, showSubject, labels: labelsProp, className, }: FeedbackRowDetailProps): import("react").JSX.Element;
343
+ export declare function FeedbackRowDetail({ row, canEdit, viewerId, onUpdate, pending, onUpload, fetcher, statusChange, onCaptureScreenshot, reworkAttachment, renderDate, commit, showSubject, onReply, replying, comments, onPublicChange, labels: labelsProp, className, }: FeedbackRowDetailProps): import("react").JSX.Element;
@@ -36,6 +36,9 @@ 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 { DEFAULT_FEEDBACK_COMMENTS_LABELS } from "./feedback-thread-parts-labels.js";
39
42
  function useFeedbackDetailLabels(labels) {
40
43
  return useKitLabels("feedbackDetail", DEFAULT_FEEDBACK_DETAIL_LABELS, labels);
41
44
  }
@@ -220,6 +223,10 @@ function FeedbackRowDetail({
220
223
  renderDate,
221
224
  commit,
222
225
  showSubject = true,
226
+ onReply,
227
+ replying = false,
228
+ comments,
229
+ onPublicChange,
223
230
  labels: labelsProp,
224
231
  className
225
232
  }) {
@@ -229,7 +236,6 @@ function FeedbackRowDetail({
229
236
  const ownStatusChange = useFeedbackStatusUndo(onUpdate);
230
237
  const changeStatus = statusChange ?? ownStatusChange;
231
238
  const [editingBody, setEditingBody] = useState(false);
232
- const [editingOutcome, setEditingOutcome] = useState(false);
233
239
  const [reworking, setReworking] = useState(false);
234
240
  const access = feedbackRowAccess(row, { canEdit, viewerId });
235
241
  const bodyText = splitBodyAttachments(row.body).text;
@@ -246,15 +252,8 @@ function FeedbackRowDetail({
246
252
  }
247
253
  onUpdate({ id: row.id, body: replaceDescription(row.body, value) }, { onSuccess: () => setEditingBody(false) });
248
254
  };
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;
255
+ const replies = row.replies;
256
+ const commentLabels = useKitLabels("feedbackComments", DEFAULT_FEEDBACK_COMMENTS_LABELS);
258
257
  const showRework = access.canRework && reworking;
259
258
  return /* @__PURE__ */ jsxs(FeedbackDetail, { className, children: [
260
259
  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 +318,22 @@ function FeedbackRowDetail({
319
318
  /* @__PURE__ */ jsx(
320
319
  FeedbackDetailSection,
321
320
  {
322
- title: labels.outcome,
321
+ title: replies ? labels.replies : labels.outcome,
323
322
  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
- ),
323
+ children: /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
324
+ replies ? /* @__PURE__ */ jsx(FeedbackReplyTimeline, { replies }) : /* @__PURE__ */ jsx(FeedbackProse, { children: row.outcome || void 0 }),
325
+ replies && access.canEditOutcome && onReply && /* @__PURE__ */ jsx(
326
+ FeedbackReplyComposer,
327
+ {
328
+ status: row.status,
329
+ onReply,
330
+ pending: replying,
331
+ suggestedStatus: feedbackReplyNudge(row),
332
+ commit
333
+ },
334
+ row.id
335
+ ),
336
+ (access.canRework && !reworking || pageHref) && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
352
337
  access.canRework && !reworking && /* @__PURE__ */ jsxs(
353
338
  Button,
354
339
  {
@@ -376,6 +361,7 @@ function FeedbackRowDetail({
376
361
  ] })
377
362
  }
378
363
  ),
364
+ comments != null && /* @__PURE__ */ jsx(FeedbackDetailSection, { title: commentLabels.comments, children: comments }),
379
365
  showRework && /* @__PURE__ */ jsx(
380
366
  FeedbackReworkSection,
381
367
  {
@@ -391,17 +377,31 @@ function FeedbackRowDetail({
391
377
  labels: labelsProp
392
378
  }
393
379
  ),
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
- ) })
380
+ /* @__PURE__ */ jsxs(FeedbackDetailSection, { title: labels.status, children: [
381
+ /* @__PURE__ */ jsx(
382
+ FeedbackStatusTransitions,
383
+ {
384
+ status: row.status,
385
+ statuses: access.canChangeStatus ? selectableFeedbackStatuses(row.status) : visibleFeedbackStatuses(row.status),
386
+ canEdit: access.canChangeStatus,
387
+ commit,
388
+ onPick: (status) => changeStatus(row, status),
389
+ variant: "pill"
390
+ }
391
+ ),
392
+ onPublicChange && /* @__PURE__ */ jsx(
393
+ FeedbackPublicSwitch,
394
+ {
395
+ row,
396
+ isAdmin: canEdit,
397
+ viewerId,
398
+ onChange: onPublicChange,
399
+ pending,
400
+ commit,
401
+ className: "mt-3"
402
+ }
403
+ )
404
+ ] })
405
405
  ] });
406
406
  }
407
407
  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;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A,gBAEA;AAAA,sCAAC,aAAU,WAAU,YAAW,eAAW,MAAC;AAAA,kBAAE;AAAA,kBAAE,OAAO;AAAA;AAAA;AAAA,YACzD;AAAA,YAED;AAAA;AAAA,YAGC,qBAAC,UAAO,MAAM,UAAU,SAAQ,aAAY,SAAS,CAAC,UAAU,MAAM,gBAAgB,GACpF;AAAA,kCAAC,gBAAa,WAAU,YAAW,eAAW,MAAC;AAAA,cAAE;AAAA,cAAE,OAAO;AAAA,eAC5D;AAAA,aAEJ;AAAA,WAEJ;AAAA;AAAA,IAEJ;AAAA,IAEC,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,oBAAC,yBAAsB,OAAO,OAAO,QAGnC;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ,IAAI;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 { 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}\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.\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. */\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. */\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}>{comments}</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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AC,aAAU,WAAU,YAAW,eAAW,MAAC;AAAA,kBAAE;AAAA,kBAAE,OAAO;AAAA;AAAA;AAAA,YACzD;AAAA,YAED;AAAA;AAAA,YAGC,qBAAC,UAAO,MAAM,UAAU,SAAQ,aAAY,SAAS,CAAC,UAAU,MAAM,gBAAgB,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,UAAW,oBAAS;AAAA,IAGjE,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={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,cACE,eAAgB,WAAW,gBAAgB,+BAA+B,eAAgB;AAAA,MAG5F,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":[]}
@@ -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 };