@eifi1/ui-kit 0.26.0 → 0.27.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 (158) hide show
  1. package/README.md +15 -4
  2. package/dist/chart.d.ts +13 -9
  3. package/dist/components/account-chips.d.ts +1 -1
  4. package/dist/components/amount-input.d.ts +13 -9
  5. package/dist/components/button-group.d.ts +13 -9
  6. package/dist/components/calculator.d.ts +13 -9
  7. package/dist/components/confirm-dialog.d.ts +13 -9
  8. package/dist/components/copy-button.d.ts +10 -6
  9. package/dist/components/danger-confirm.d.ts +13 -9
  10. package/dist/components/data-table-cells.d.ts +1 -1
  11. package/dist/components/data-table-filter-popover.d.ts +1 -1
  12. package/dist/components/data-table-filters.d.ts +1 -1
  13. package/dist/components/data-table-labels.d.ts +1 -1
  14. package/dist/components/data-table-pagination.d.ts +1 -1
  15. package/dist/components/data-table.d.ts +1 -1
  16. package/dist/components/data-table.js.map +1 -1
  17. package/dist/components/facing-pair.d.ts +13 -9
  18. package/dist/components/file-button.d.ts +13 -9
  19. package/dist/components/file-dropzone.d.ts +13 -9
  20. package/dist/components/form-actions.d.ts +13 -9
  21. package/dist/components/iban-input.d.ts +13 -9
  22. package/dist/components/language-select.d.ts +13 -9
  23. package/dist/components/money-field.d.ts +13 -9
  24. package/dist/components/number-field.d.ts +13 -9
  25. package/dist/components/number-input.d.ts +13 -9
  26. package/dist/components/numpad-sheet.d.ts +13 -9
  27. package/dist/components/phone-input.d.ts +13 -9
  28. package/dist/components/series-chart.d.ts +13 -9
  29. package/dist/components/settings-fields.d.ts +13 -9
  30. package/dist/components/share-card.d.ts +13 -9
  31. package/dist/components/text-link.d.ts +13 -9
  32. package/dist/components/time-input.d.ts +13 -9
  33. package/dist/components/ui.d.ts +10 -6
  34. package/dist/components/use-table-state.d.ts +1 -1
  35. package/dist/{data-table-labels-Cdn1QS2k.d.ts → data-table-labels-DUELeXpa.d.ts} +5 -0
  36. package/dist/data-table.d.ts +1 -1
  37. package/dist/feedback/feedback-attachment.d.ts +13 -9
  38. package/dist/feedback/feedback-attachment.js +3 -3
  39. package/dist/feedback/feedback-attachment.js.map +1 -1
  40. package/dist/feedback/feedback-capture.d.ts +71 -0
  41. package/dist/feedback/feedback-capture.js +194 -0
  42. package/dist/feedback/feedback-capture.js.map +1 -0
  43. package/dist/feedback/feedback-context.d.ts +71 -0
  44. package/dist/feedback/feedback-context.js +96 -0
  45. package/dist/feedback/feedback-context.js.map +1 -0
  46. package/dist/feedback/feedback-crash.d.ts +276 -0
  47. package/dist/feedback/feedback-crash.js +225 -0
  48. package/dist/feedback/feedback-crash.js.map +1 -0
  49. package/dist/feedback/feedback-dialog.d.ts +13 -9
  50. package/dist/feedback/feedback-dialog.js +5 -3
  51. package/dist/feedback/feedback-dialog.js.map +1 -1
  52. package/dist/feedback/feedback-inbox.d.ts +13 -9
  53. package/dist/feedback/feedback-inbox.js +89 -49
  54. package/dist/feedback/feedback-inbox.js.map +1 -1
  55. package/dist/feedback/feedback-labels.d.ts +71 -0
  56. package/dist/feedback/feedback-labels.js +48 -0
  57. package/dist/feedback/feedback-labels.js.map +1 -0
  58. package/dist/feedback/feedback-menu.d.ts +71 -0
  59. package/dist/feedback/feedback-menu.js +61 -0
  60. package/dist/feedback/feedback-menu.js.map +1 -0
  61. package/dist/feedback/feedback-record.d.ts +71 -0
  62. package/dist/feedback/feedback-record.js +104 -0
  63. package/dist/feedback/feedback-record.js.map +1 -0
  64. package/dist/feedback/feedback-row-detail.d.ts +71 -0
  65. package/dist/feedback/feedback-row-detail.js +437 -0
  66. package/dist/feedback/feedback-row-detail.js.map +1 -0
  67. package/dist/feedback/feedback-status-undo.d.ts +71 -0
  68. package/dist/feedback/feedback-status-undo.js +40 -0
  69. package/dist/feedback/feedback-status-undo.js.map +1 -0
  70. package/dist/feedback/feedback-submit.d.ts +182 -0
  71. package/dist/feedback/feedback-submit.js +101 -0
  72. package/dist/feedback/feedback-submit.js.map +1 -0
  73. package/dist/feedback/feedback-swipe.d.ts +152 -0
  74. package/dist/feedback/feedback-swipe.js +73 -0
  75. package/dist/feedback/feedback-swipe.js.map +1 -0
  76. package/dist/feedback/feedback-table.d.ts +71 -0
  77. package/dist/feedback/feedback-table.js +357 -0
  78. package/dist/feedback/feedback-table.js.map +1 -0
  79. package/dist/feedback/feedback-thread.d.ts +13 -9
  80. package/dist/feedback.d.ts +17 -9
  81. package/dist/feedback.js +11 -0
  82. package/dist/feedback.js.map +1 -1
  83. package/dist/hooks/use-file-drop.d.ts +13 -9
  84. package/dist/i18n/defaults.d.ts +13 -9
  85. package/dist/i18n/defaults.js +16 -0
  86. package/dist/i18n/defaults.js.map +1 -1
  87. package/dist/i18n/german.d.ts +13 -9
  88. package/dist/i18n/german.js +91 -5
  89. package/dist/i18n/german.js.map +1 -1
  90. package/dist/i18n/kit-labels.d.ts +7 -3
  91. package/dist/i18n/kit-labels.js.map +1 -1
  92. package/dist/i18n/languages.d.ts +13 -9
  93. package/dist/i18n/locales/de-CH.d.ts +13 -9
  94. package/dist/i18n/locales/en.d.ts +13 -9
  95. package/dist/i18n/locales/en.js +10 -1
  96. package/dist/i18n/locales/en.js.map +1 -1
  97. package/dist/i18n/locales/es.d.ts +13 -9
  98. package/dist/i18n/locales/es.js +89 -5
  99. package/dist/i18n/locales/es.js.map +1 -1
  100. package/dist/i18n/locales/fr.d.ts +13 -9
  101. package/dist/i18n/locales/fr.js +89 -5
  102. package/dist/i18n/locales/fr.js.map +1 -1
  103. package/dist/i18n/locales/hu.d.ts +13 -9
  104. package/dist/i18n/locales/hu.js +90 -5
  105. package/dist/i18n/locales/hu.js.map +1 -1
  106. package/dist/i18n/locales/it.d.ts +13 -9
  107. package/dist/i18n/locales/it.js +89 -5
  108. package/dist/i18n/locales/it.js.map +1 -1
  109. package/dist/i18n/locales/zh.d.ts +13 -9
  110. package/dist/i18n/locales/zh.js +89 -5
  111. package/dist/i18n/locales/zh.js.map +1 -1
  112. package/dist/i18n/review.d.ts +16 -11
  113. package/dist/i18n/review.js +11 -0
  114. package/dist/i18n/review.js.map +1 -1
  115. package/dist/i18n/swiss.js +3 -1
  116. package/dist/i18n/swiss.js.map +1 -1
  117. package/dist/index.d.ts +6 -2
  118. package/dist/index.js +11 -0
  119. package/dist/index.js.map +1 -1
  120. package/dist/{feedback-BXKH-ToU.d.ts → kit-labels-DQg82eHB.d.ts} +1275 -25
  121. package/dist/rhf/fields.d.ts +13 -9
  122. package/dist/rhf/form.d.ts +13 -9
  123. package/dist/rhf.d.ts +13 -9
  124. package/dist/shell/app-shell.d.ts +13 -9
  125. package/dist/shell/top-bar-brand.d.ts +13 -9
  126. package/dist/shell.d.ts +11 -11
  127. package/dist/wizard/stepper-nav.d.ts +13 -9
  128. package/dist/wizard.d.ts +13 -9
  129. package/package.json +6 -1
  130. package/src/components/data-table.tsx +5 -0
  131. package/src/feedback/feedback-attachment.tsx +19 -3
  132. package/src/feedback/feedback-capture.ts +285 -0
  133. package/src/feedback/feedback-context.tsx +217 -0
  134. package/src/feedback/feedback-crash.ts +547 -0
  135. package/src/feedback/feedback-dialog.tsx +29 -6
  136. package/src/feedback/feedback-inbox.tsx +131 -27
  137. package/src/feedback/feedback-labels.ts +127 -0
  138. package/src/feedback/feedback-menu.tsx +132 -0
  139. package/src/feedback/feedback-record.ts +345 -0
  140. package/src/feedback/feedback-row-detail.tsx +825 -0
  141. package/src/feedback/feedback-status-undo.ts +111 -0
  142. package/src/feedback/feedback-submit.tsx +224 -0
  143. package/src/feedback/feedback-swipe.tsx +170 -0
  144. package/src/feedback/feedback-table.tsx +757 -0
  145. package/src/feedback.ts +13 -0
  146. package/src/i18n/defaults.ts +16 -0
  147. package/src/i18n/german.ts +98 -5
  148. package/src/i18n/kit-labels.tsx +20 -0
  149. package/src/i18n/locales/en.ts +15 -1
  150. package/src/i18n/locales/es.ts +96 -5
  151. package/src/i18n/locales/fr.ts +95 -5
  152. package/src/i18n/locales/hu.ts +94 -5
  153. package/src/i18n/locales/it.ts +97 -5
  154. package/src/i18n/locales/zh.ts +90 -5
  155. package/src/i18n/review.ts +14 -2
  156. package/src/i18n/swiss.ts +5 -1
  157. package/src/index.ts +13 -0
  158. package/tokens.css +4 -0
@@ -0,0 +1,437 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useRef, useState } from "react";
4
+ import { Download, ExternalLink, FileText, RotateCcw } from "lucide-react";
5
+ import { AuthedImage } from "../components/authed-image.js";
6
+ import { CopyButton } from "../components/copy-button.js";
7
+ import { TextLink } from "../components/text-link.js";
8
+ import { toast } from "../components/toast.js";
9
+ import { Button } from "../components/ui.js";
10
+ import { useKitLabels, useKitLocale } from "../i18n/kit-labels.js";
11
+ import { formatDate } from "../lib/format.js";
12
+ import { DEFAULT_MAX_ATTACHMENT_BYTES } from "./feedback-attachment.js";
13
+ import { DEFAULT_FEEDBACK_DIALOG_LABELS } from "./feedback-dialog.js";
14
+ import {
15
+ FeedbackDetail,
16
+ FeedbackDetailSection,
17
+ FeedbackNoteEditor,
18
+ FeedbackProse,
19
+ FeedbackStatusTransitions,
20
+ selectableFeedbackStatuses,
21
+ visibleFeedbackStatuses
22
+ } from "./feedback-inbox.js";
23
+ import { useFeedbackToastLabels } from "./feedback-labels.js";
24
+ import {
25
+ FEEDBACK_ATTACHMENT_ACCEPT,
26
+ FEEDBACK_AUTHOR_EDITABLE_STATUSES,
27
+ FEEDBACK_REWORKABLE_STATUSES,
28
+ appendRework,
29
+ attachmentName,
30
+ isImageAttachment,
31
+ replaceDescription,
32
+ splitBodyAttachments,
33
+ splitDescription
34
+ } from "./feedback-record.js";
35
+ import { useFeedbackStatusUndo } from "./feedback-status-undo.js";
36
+ const DEFAULT_FEEDBACK_DETAIL_LABELS = {
37
+ body: "Description",
38
+ edit: "Edit",
39
+ editDescription: "Edit description",
40
+ save: "Save",
41
+ cancel: "Cancel",
42
+ url: "URL",
43
+ copyUrl: "Copy URL",
44
+ attachment: "Attachment",
45
+ download: (name) => `Download ${name}`,
46
+ downloadFailed: "The attachment could not be downloaded.",
47
+ outcome: "Outcome",
48
+ resolvedAt: (date) => `Resolved: ${date}`,
49
+ outcomeAdd: "Add outcome",
50
+ outcomeUpdate: "Update",
51
+ outcomePlaceholder: "What was done, decided, or why this won't be addressed.",
52
+ rework: "Rework",
53
+ openPage: "Open page",
54
+ reworkTitle: "Send for rework",
55
+ reworkSend: "Send rework",
56
+ reworkPlaceholder: "What still needs refinement? Any new constraints or change of direction.",
57
+ reworkUploadFailed: "The file could not be uploaded. The rework was not sent.",
58
+ status: "Status"
59
+ };
60
+ function useFeedbackDetailLabels(labels) {
61
+ return useKitLabels("feedbackDetail", DEFAULT_FEEDBACK_DETAIL_LABELS, labels);
62
+ }
63
+ function parsePage(context) {
64
+ const raw = (context?.url || context?.route || "").trim();
65
+ if (!raw) return null;
66
+ try {
67
+ const url = new URL(raw, "http://localhost");
68
+ return url.protocol === "http:" || url.protocol === "https:" ? url : null;
69
+ } catch {
70
+ return null;
71
+ }
72
+ }
73
+ const localPath = (pathname) => pathname.replace(/^\/{2,}/, "/");
74
+ function feedbackPageHref(context) {
75
+ const url = parsePage(context);
76
+ return url ? `${localPath(url.pathname)}${url.search}${url.hash}` : null;
77
+ }
78
+ function feedbackPagePath(context) {
79
+ const url = parsePage(context);
80
+ return url ? localPath(url.pathname) : null;
81
+ }
82
+ function feedbackPageUrl(context) {
83
+ if (!parsePage(context)) return null;
84
+ return (context?.url || context?.route || "").trim();
85
+ }
86
+ function feedbackAttachmentUrls(row) {
87
+ const urls = [
88
+ ...row.screenshot_url ? [row.screenshot_url] : [],
89
+ // `?? []`: NULL on rows filed before the column, and no key at all from a server
90
+ // that predates it (keksdose dev #578).
91
+ ...row.attachment_urls ?? [],
92
+ ...splitBodyAttachments(row.body).urls
93
+ ];
94
+ return [...new Set(urls)];
95
+ }
96
+ async function toBlob(answer) {
97
+ if (typeof Response !== "undefined" && answer instanceof Response) {
98
+ if (!answer.ok) throw new Error(`HTTP ${answer.status}`);
99
+ return answer.blob();
100
+ }
101
+ return answer;
102
+ }
103
+ const plainFetch = (url, { signal }) => fetch(url, { signal, credentials: "same-origin" });
104
+ function AttachmentDownload({
105
+ url,
106
+ fetcher,
107
+ labels
108
+ }) {
109
+ const [busy, setBusy] = useState(false);
110
+ const name = attachmentName(url);
111
+ const download = async (event) => {
112
+ event.stopPropagation();
113
+ setBusy(true);
114
+ try {
115
+ const blob = await toBlob(await fetcher(url, { signal: new AbortController().signal }));
116
+ const href = URL.createObjectURL(blob);
117
+ const anchor = document.createElement("a");
118
+ anchor.href = href;
119
+ anchor.download = name;
120
+ anchor.click();
121
+ setTimeout(() => URL.revokeObjectURL(href), 0);
122
+ } catch {
123
+ toast.error(labels.downloadFailed);
124
+ } finally {
125
+ setBusy(false);
126
+ }
127
+ };
128
+ return /* @__PURE__ */ jsxs(
129
+ Button,
130
+ {
131
+ type: "button",
132
+ variant: "secondary",
133
+ size: "sm",
134
+ pending: busy,
135
+ onClick: (event) => void download(event),
136
+ "aria-label": labels.download(name),
137
+ className: "max-w-full",
138
+ children: [
139
+ /* @__PURE__ */ jsx(FileText, { className: "size-3.5 shrink-0", "aria-hidden": true }),
140
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 max-w-[14rem] truncate", children: name }),
141
+ /* @__PURE__ */ jsx(Download, { className: "size-3.5 shrink-0", "aria-hidden": true })
142
+ ]
143
+ }
144
+ );
145
+ }
146
+ function feedbackRowAccess(row, { canEdit, viewerId }) {
147
+ const isAuthor = row.user_id !== null && viewerId !== void 0 && viewerId !== null && viewerId === row.user_id;
148
+ return {
149
+ isAuthor,
150
+ canEditDescription: isAuthor && FEEDBACK_AUTHOR_EDITABLE_STATUSES.includes(row.status),
151
+ canEditOutcome: canEdit,
152
+ canRework: (canEdit || isAuthor) && FEEDBACK_REWORKABLE_STATUSES.includes(row.status),
153
+ canChangeStatus: canEdit
154
+ };
155
+ }
156
+ function FeedbackReworkSection({
157
+ row,
158
+ onUpdate,
159
+ pending = false,
160
+ onUpload,
161
+ onCaptureScreenshot,
162
+ onSent,
163
+ onCancel,
164
+ attachment,
165
+ commit,
166
+ labels: labelsProp
167
+ }) {
168
+ const labels = useFeedbackDetailLabels(labelsProp);
169
+ const toasts = useFeedbackToastLabels();
170
+ const [uploading, setUploading] = useState(false);
171
+ const latestBody = useRef(row.body);
172
+ useEffect(() => {
173
+ latestBody.current = row.body;
174
+ }, [row.body]);
175
+ const capture = onCaptureScreenshot ? async () => {
176
+ try {
177
+ return await onCaptureScreenshot();
178
+ } catch {
179
+ toast.error(toasts.captureFailed);
180
+ return null;
181
+ }
182
+ } : void 0;
183
+ const send = async (value, file) => {
184
+ const note = value.trim();
185
+ if (!note) return;
186
+ let url = null;
187
+ if (file && onUpload) {
188
+ setUploading(true);
189
+ try {
190
+ url = await onUpload(file);
191
+ } catch {
192
+ toast.error(labels.reworkUploadFailed);
193
+ return;
194
+ } finally {
195
+ setUploading(false);
196
+ }
197
+ }
198
+ let body;
199
+ try {
200
+ body = appendRework(latestBody.current, note, url);
201
+ } catch {
202
+ toast.error(labels.reworkUploadFailed);
203
+ return;
204
+ }
205
+ if (body === null) return;
206
+ onUpdate({ id: row.id, body }, { onSuccess: () => onSent?.() });
207
+ };
208
+ return /* @__PURE__ */ jsx(FeedbackDetailSection, { title: labels.reworkTitle, children: /* @__PURE__ */ jsx(
209
+ FeedbackNoteEditor,
210
+ {
211
+ initial: "",
212
+ required: true,
213
+ commit,
214
+ pending: pending || uploading,
215
+ onSave: (value, file) => void send(value, file),
216
+ onCancel,
217
+ saveLabel: labels.reworkSend,
218
+ cancelLabel: labels.cancel,
219
+ placeholder: labels.reworkPlaceholder,
220
+ attachment: onUpload ? {
221
+ accept: FEEDBACK_ATTACHMENT_ACCEPT,
222
+ maxBytes: DEFAULT_MAX_ATTACHMENT_BYTES,
223
+ onError: (kind) => {
224
+ toast.error(kind === "type" ? toasts.attachmentUnsupported : toasts.attachmentTooLarge);
225
+ },
226
+ onCaptureScreenshot: capture,
227
+ ...attachment
228
+ } : void 0
229
+ },
230
+ row.id
231
+ ) });
232
+ }
233
+ function FeedbackRowDetail({
234
+ row,
235
+ canEdit,
236
+ viewerId,
237
+ onUpdate,
238
+ pending = false,
239
+ onUpload,
240
+ fetcher,
241
+ statusChange,
242
+ onCaptureScreenshot,
243
+ reworkAttachment,
244
+ renderDate,
245
+ commit,
246
+ labels: labelsProp,
247
+ className
248
+ }) {
249
+ const labels = useFeedbackDetailLabels(labelsProp);
250
+ const dialogText = useKitLabels("feedbackDialog", DEFAULT_FEEDBACK_DIALOG_LABELS);
251
+ const locale = useKitLocale();
252
+ const ownStatusChange = useFeedbackStatusUndo(onUpdate);
253
+ const changeStatus = statusChange ?? ownStatusChange;
254
+ const [editingBody, setEditingBody] = useState(false);
255
+ const [editingOutcome, setEditingOutcome] = useState(false);
256
+ const [reworking, setReworking] = useState(false);
257
+ const access = feedbackRowAccess(row, { canEdit, viewerId });
258
+ const bodyText = splitBodyAttachments(row.body).text;
259
+ const { description } = splitDescription(row.body);
260
+ const pageHref = feedbackPageHref(row.context);
261
+ const pageUrl = feedbackPageUrl(row.context);
262
+ const files = feedbackAttachmentUrls(row);
263
+ const fetchFile = fetcher ?? plainFetch;
264
+ const dateText = (iso) => renderDate ? renderDate(iso) : formatDate(iso, "medium", { locale });
265
+ const saveDescription = (value) => {
266
+ if (value.trim() === description.trim()) {
267
+ setEditingBody(false);
268
+ return;
269
+ }
270
+ onUpdate({ id: row.id, body: replaceDescription(row.body, value) }, { onSuccess: () => setEditingBody(false) });
271
+ };
272
+ const saveOutcome = (value) => {
273
+ const next = value.trim() ? value.trim() : null;
274
+ if (next === row.outcome) {
275
+ setEditingOutcome(false);
276
+ return;
277
+ }
278
+ onUpdate({ id: row.id, outcome: next }, { onSuccess: () => setEditingOutcome(false) });
279
+ };
280
+ const showOutcomeEditor = access.canEditOutcome && editingOutcome;
281
+ const showRework = access.canRework && reworking;
282
+ return /* @__PURE__ */ jsxs(FeedbackDetail, { className, children: [
283
+ /* @__PURE__ */ jsx(
284
+ FeedbackDetailSection,
285
+ {
286
+ title: labels.body,
287
+ action: access.canEditDescription && !editingBody ? /* @__PURE__ */ jsx(
288
+ Button,
289
+ {
290
+ type: "button",
291
+ variant: "ghost",
292
+ size: "sm",
293
+ onClick: (event) => {
294
+ event.stopPropagation();
295
+ setEditingBody(true);
296
+ },
297
+ "aria-label": labels.editDescription,
298
+ children: labels.edit
299
+ }
300
+ ) : void 0,
301
+ children: access.canEditDescription && editingBody ? /* @__PURE__ */ jsx(
302
+ FeedbackNoteEditor,
303
+ {
304
+ initial: description,
305
+ pending,
306
+ commit,
307
+ onSave: saveDescription,
308
+ onCancel: () => setEditingBody(false),
309
+ saveLabel: labels.save,
310
+ cancelLabel: labels.cancel,
311
+ placeholder: dialogText.bodyOptional ?? dialogText.body
312
+ },
313
+ row.id
314
+ ) : /* @__PURE__ */ jsx(FeedbackProse, { children: bodyText.trim() ? bodyText : void 0 })
315
+ }
316
+ ),
317
+ pageHref && pageUrl && // The page it was filed on, with the full URL a click away (keksdose #278).
318
+ /* @__PURE__ */ jsx(FeedbackDetailSection, { title: labels.url, children: /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [
319
+ /* @__PURE__ */ jsx(TextLink, { href: pageHref, tone: "secondary", underline: "hover", stopPropagation: true, className: "min-w-0", children: /* @__PURE__ */ jsx("code", { className: "break-all text-xs", children: pageHref }) }),
320
+ /* @__PURE__ */ jsx(CopyButton, { size: "xs", className: "shrink-0", text: pageUrl, label: labels.copyUrl, stopPropagation: true })
321
+ ] }) }),
322
+ files.length > 0 && /* @__PURE__ */ jsx(FeedbackDetailSection, { title: labels.attachment, children: /* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-wrap items-start gap-2", children: files.map(
323
+ (url) => isImageAttachment(url) ? /* @__PURE__ */ jsx(
324
+ AuthedImage,
325
+ {
326
+ src: url,
327
+ alt: labels.attachment,
328
+ fetcher: fetchFile,
329
+ link: true,
330
+ stopPropagation: true,
331
+ errorFallback: null,
332
+ wrapperClassName: "inline-block max-w-full",
333
+ className: "max-h-64 max-w-full rounded border border-[var(--border)]"
334
+ },
335
+ url
336
+ ) : /* @__PURE__ */ jsx(AttachmentDownload, { url, fetcher: fetchFile, labels }, url)
337
+ ) }) }),
338
+ /* @__PURE__ */ jsx(
339
+ FeedbackDetailSection,
340
+ {
341
+ title: labels.outcome,
342
+ action: row.resolved_at ? /* @__PURE__ */ jsx("span", { className: "text-xs text-[var(--text-muted)]", children: labels.resolvedAt(dateText(row.resolved_at)) }) : void 0,
343
+ children: showOutcomeEditor ? /* @__PURE__ */ jsx(
344
+ FeedbackNoteEditor,
345
+ {
346
+ initial: row.outcome ?? "",
347
+ pending,
348
+ commit,
349
+ onSave: saveOutcome,
350
+ onCancel: () => setEditingOutcome(false),
351
+ saveLabel: labels.save,
352
+ cancelLabel: labels.cancel,
353
+ placeholder: labels.outcomePlaceholder
354
+ },
355
+ row.id
356
+ ) : /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
357
+ /* @__PURE__ */ jsx(FeedbackProse, { children: row.outcome || void 0 }),
358
+ (access.canEditOutcome || access.canRework && !reworking || pageHref) && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
359
+ access.canEditOutcome && /* @__PURE__ */ jsx(
360
+ Button,
361
+ {
362
+ type: "button",
363
+ variant: "secondary",
364
+ onClick: (event) => {
365
+ event.stopPropagation();
366
+ setEditingOutcome(true);
367
+ },
368
+ children: row.outcome ? labels.outcomeUpdate : labels.outcomeAdd
369
+ }
370
+ ),
371
+ access.canRework && !reworking && /* @__PURE__ */ jsxs(
372
+ Button,
373
+ {
374
+ type: "button",
375
+ variant: "secondary",
376
+ onClick: (event) => {
377
+ event.stopPropagation();
378
+ setReworking(true);
379
+ },
380
+ children: [
381
+ /* @__PURE__ */ jsx(RotateCcw, { className: "size-3.5", "aria-hidden": true }),
382
+ " ",
383
+ labels.rework
384
+ ]
385
+ }
386
+ ),
387
+ pageHref && // A real href (keksdose dev #451): middle-click and ⌘/Ctrl-click are
388
+ // the browser's, and only a link has them.
389
+ /* @__PURE__ */ jsxs(Button, { href: pageHref, variant: "secondary", onClick: (event) => event.stopPropagation(), children: [
390
+ /* @__PURE__ */ jsx(ExternalLink, { className: "size-3.5", "aria-hidden": true }),
391
+ " ",
392
+ labels.openPage
393
+ ] })
394
+ ] })
395
+ ] })
396
+ }
397
+ ),
398
+ showRework && /* @__PURE__ */ jsx(
399
+ FeedbackReworkSection,
400
+ {
401
+ row,
402
+ onUpdate,
403
+ pending,
404
+ onUpload,
405
+ onCaptureScreenshot,
406
+ onSent: () => setReworking(false),
407
+ onCancel: () => setReworking(false),
408
+ attachment: reworkAttachment,
409
+ commit,
410
+ labels: labelsProp
411
+ }
412
+ ),
413
+ /* @__PURE__ */ jsx(FeedbackDetailSection, { title: labels.status, children: /* @__PURE__ */ jsx(
414
+ FeedbackStatusTransitions,
415
+ {
416
+ status: row.status,
417
+ statuses: access.canChangeStatus ? selectableFeedbackStatuses(row.status) : visibleFeedbackStatuses(row.status),
418
+ canEdit: access.canChangeStatus,
419
+ commit,
420
+ onPick: (status) => changeStatus(row, status),
421
+ variant: "pill"
422
+ }
423
+ ) })
424
+ ] });
425
+ }
426
+ export {
427
+ DEFAULT_FEEDBACK_DETAIL_LABELS,
428
+ FeedbackReworkSection,
429
+ FeedbackRowDetail,
430
+ feedbackAttachmentUrls,
431
+ feedbackPageHref,
432
+ feedbackPagePath,
433
+ feedbackPageUrl,
434
+ feedbackRowAccess,
435
+ useFeedbackDetailLabels
436
+ };
437
+ //# sourceMappingURL=feedback-row-detail.js.map
@@ -0,0 +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/ui\";\nimport type { AuthedFetcher } from \"../hooks/use-authed-src\";\nimport { useKitLabels, useKitLocale } from \"../i18n/kit-labels\";\nimport { formatDate } from \"../lib/format\";\nimport { DEFAULT_MAX_ATTACHMENT_BYTES } from \"./feedback-attachment\";\nimport { DEFAULT_FEEDBACK_DIALOG_LABELS } from \"./feedback-dialog\";\nimport {\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\";\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: **Description** (the body; the author's\n * Edit while OPEN / 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 /** Section 1'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}\n\nexport const DEFAULT_FEEDBACK_DETAIL_LABELS: FeedbackDetailLabels = {\n body: \"Description\",\n edit: \"Edit\",\n editDescription: \"Edit description\",\n save: \"Save\",\n cancel: \"Cancel\",\n url: \"URL\",\n copyUrl: \"Copy URL\",\n attachment: \"Attachment\",\n download: (name) => `Download ${name}`,\n downloadFailed: \"The attachment could not be downloaded.\",\n outcome: \"Outcome\",\n resolvedAt: (date) => `Resolved: ${date}`,\n outcomeAdd: \"Add outcome\",\n outcomeUpdate: \"Update\",\n outcomePlaceholder: \"What was done, decided, or why this won't be addressed.\",\n rework: \"Rework\",\n openPage: \"Open page\",\n reworkTitle: \"Send for rework\",\n reworkSend: \"Send rework\",\n reworkPlaceholder: \"What still needs refinement? Any new constraints or change of direction.\",\n reworkUploadFailed: \"The file could not be uploaded. The rework was not sent.\",\n status: \"Status\",\n};\n\n/** `feedbackDetail` resolved: English, then `<UiKitProvider labels>`, then `labels`. */\nexport function useFeedbackDetailLabels(labels?: Partial<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 handed to a synthetic anchor; a failure says so in a toast.\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 blob = await toBlob(await fetcher(url, { signal: new AbortController().signal }));\n const href = URL.createObjectURL(blob);\n const anchor = document.createElement(\"a\");\n anchor.href = href;\n anchor.download = name;\n anchor.click();\n // After the click has handed the URL to the download, not before.\n setTimeout(() => URL.revokeObjectURL(href), 0);\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\">{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 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?: boolean;\n labels?: Partial<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?: boolean;\n labels?: Partial<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 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 <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-[var(--border)]\"\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-[var(--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 </FeedbackDetail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,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":[]}
@@ -0,0 +1,71 @@
1
+ export { z as FEEDBACK_UNDO_DURATION, aB as FeedbackStatusChange, aD as FeedbackStatusMutate, aE as FeedbackStatusPatch, aF as FeedbackStatusRow, aH as FeedbackStatusUndoOptions, bq as useFeedbackStatusUndo } from '../kit-labels-DQg82eHB.js';
2
+ import 'react';
3
+ import '../data-table-labels-DUELeXpa.js';
4
+ import '../components/data-table-sort.js';
5
+ import '../components/swipeable-row.js';
6
+ import '../components/mini-calendar.js';
7
+ import '../components/calendar-heatmap.js';
8
+ import '../components/popover.js';
9
+ import '../components/chip.js';
10
+ import 'lucide-react';
11
+ import '../components/field-sync.js';
12
+ import '../components/tooltip.js';
13
+ import '../hooks/use-anchored-rect.js';
14
+ import '../lib/clipping.js';
15
+ import '../wizard/types.js';
16
+ import '../tour/tour.js';
17
+ import '../search/command-palette.js';
18
+ import '../search/global-search.js';
19
+ import '../search/search-index.js';
20
+ import '../components/month-picker.js';
21
+ import '../components/page-contents.js';
22
+ import '../components/series-chart-labels.js';
23
+ import '../components/pie-chart-labels.js';
24
+ import '../components/sparkline.js';
25
+ import '../components/stat-tile.js';
26
+ import '../components/signature-pad.js';
27
+ import '../components/password-strength.js';
28
+ import '../components/swatch-picker.js';
29
+ import '../components/tile-radio.js';
30
+ import '../components/icon-picker.js';
31
+ import '../components/dialog-frame.js';
32
+ import '../components/modal.js';
33
+ import '../hooks/use-search-param-state.js';
34
+ import '../components/measured-grid.js';
35
+ import '../components/user-avatar.js';
36
+ import '../components/status-dot.js';
37
+ import '../components/progress-bar.js';
38
+ import '../components/signed-amount.js';
39
+ import '../shell/topbar-action-menu.js';
40
+ import '../components/menu-item.js';
41
+ import '../components/floating-panel.js';
42
+ import '../hooks/use-authed-src.js';
43
+ import '../components/account-settings-labels.js';
44
+ import '../components/bulk-action-bar.js';
45
+ import '../components/list.js';
46
+ import '../components/breadcrumbs.js';
47
+ import '../components/toast.js';
48
+ import '../components/description-list.js';
49
+ import '../components/line-items.js';
50
+ import '../components/error-boundary.js';
51
+ import '../components/authed-image.js';
52
+ import '../components/image-grid.js';
53
+ import '../components/lightbox.js';
54
+ import '../components/write-lock.js';
55
+ import '../components/legal.js';
56
+ import '../components/account-chips.js';
57
+ import '../lib/format.js';
58
+ import '../components/reauth-dialog.js';
59
+ import '../components/server-wake.js';
60
+ import '../lib/server-wake.js';
61
+ import '../components/translation-review-labels.js';
62
+ import '../lib/translation-review.js';
63
+ import '../components/country-select.js';
64
+ import '../components/inline-edit-field.js';
65
+ import '../lib/iban.js';
66
+ import '../lib/phone.js';
67
+ import '../components/sign-chip.js';
68
+ import '../components/column-mapper.js';
69
+ import '../lib/column-mapping.js';
70
+ import '../lib/table-text.js';
71
+ import '../components/field-parts.js';
@@ -0,0 +1,40 @@
1
+ "use client";
2
+ import { useCallback } from "react";
3
+ import { toast } from "../components/toast.js";
4
+ import {
5
+ useFeedbackStatusLabels,
6
+ useFeedbackToastLabels
7
+ } from "./feedback-labels.js";
8
+ const FEEDBACK_UNDO_DURATION = 8e3;
9
+ function useFeedbackStatusUndo(mutate, { labels, statusLabels } = {}) {
10
+ const words = useFeedbackToastLabels(labels);
11
+ const names = useFeedbackStatusLabels(statusLabels);
12
+ return useCallback(
13
+ (row, status) => {
14
+ const { id, title, status: previous } = row;
15
+ if (status === previous) return;
16
+ const nameOf = (value) => names[value] ?? value;
17
+ mutate(
18
+ { id, status },
19
+ {
20
+ onSuccess: () => {
21
+ toast.undo(words.statusChanged(nameOf(status), title), {
22
+ label: words.statusUndo,
23
+ duration: FEEDBACK_UNDO_DURATION,
24
+ onUndo: () => mutate(
25
+ { id, status: previous },
26
+ { onSuccess: () => void toast.success(words.statusRestored(nameOf(previous), title)) }
27
+ )
28
+ });
29
+ }
30
+ }
31
+ );
32
+ },
33
+ [mutate, words, names]
34
+ );
35
+ }
36
+ export {
37
+ FEEDBACK_UNDO_DURATION,
38
+ useFeedbackStatusUndo
39
+ };
40
+ //# sourceMappingURL=feedback-status-undo.js.map