@eifi1/ui-kit 0.46.1 → 0.48.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 (216) hide show
  1. package/README.md +8 -6
  2. package/dist/admin/admin-sections.d.ts +8 -0
  3. package/dist/admin/admin-sections.js +2 -1
  4. package/dist/admin/admin-sections.js.map +1 -1
  5. package/dist/auth/verify-email.d.ts +9 -1
  6. package/dist/auth/verify-email.js +22 -13
  7. package/dist/auth/verify-email.js.map +1 -1
  8. package/dist/components/alert-banner.d.ts +29 -1
  9. package/dist/components/alert-banner.js +84 -7
  10. package/dist/components/alert-banner.js.map +1 -1
  11. package/dist/components/button-look.d.ts +4 -0
  12. package/dist/components/button-look.js +2 -0
  13. package/dist/components/button-look.js.map +1 -1
  14. package/dist/components/combobox-core.js +5 -1
  15. package/dist/components/combobox-core.js.map +1 -1
  16. package/dist/components/data-table-column-settings.d.ts +6 -1
  17. package/dist/components/data-table-column-settings.js +12 -2
  18. package/dist/components/data-table-column-settings.js.map +1 -1
  19. package/dist/components/data-table-fit.d.ts +44 -0
  20. package/dist/components/data-table-fit.js +103 -0
  21. package/dist/components/data-table-fit.js.map +1 -0
  22. package/dist/components/data-table-groups.d.ts +95 -0
  23. package/dist/components/data-table-groups.js +165 -0
  24. package/dist/components/data-table-groups.js.map +1 -0
  25. package/dist/components/data-table-head.js +3 -1
  26. package/dist/components/data-table-head.js.map +1 -1
  27. package/dist/components/data-table-labels.d.ts +7 -0
  28. package/dist/components/data-table-labels.js +3 -0
  29. package/dist/components/data-table-labels.js.map +1 -1
  30. package/dist/components/data-table-leading-row.d.ts +17 -0
  31. package/dist/components/data-table-leading-row.js +41 -0
  32. package/dist/components/data-table-leading-row.js.map +1 -0
  33. package/dist/components/data-table-resize.js +1 -1
  34. package/dist/components/data-table-resize.js.map +1 -1
  35. package/dist/components/data-table.d.ts +78 -2
  36. package/dist/components/data-table.js +355 -247
  37. package/dist/components/data-table.js.map +1 -1
  38. package/dist/components/disclosure.d.ts +3 -1
  39. package/dist/components/disclosure.js +10 -4
  40. package/dist/components/disclosure.js.map +1 -1
  41. package/dist/components/dropdown.js +8 -1
  42. package/dist/components/dropdown.js.map +1 -1
  43. package/dist/components/floating-panel.d.ts +14 -1
  44. package/dist/components/floating-panel.js +7 -2
  45. package/dist/components/floating-panel.js.map +1 -1
  46. package/dist/components/hover-menu.js +5 -1
  47. package/dist/components/hover-menu.js.map +1 -1
  48. package/dist/components/icon-button.js +2 -1
  49. package/dist/components/icon-button.js.map +1 -1
  50. package/dist/components/popover.js +5 -1
  51. package/dist/components/popover.js.map +1 -1
  52. package/dist/components/row-actions.d.ts +25 -0
  53. package/dist/components/row-actions.js +13 -3
  54. package/dist/components/row-actions.js.map +1 -1
  55. package/dist/components/table-skeleton.d.ts +35 -0
  56. package/dist/components/table-skeleton.js +75 -0
  57. package/dist/components/table-skeleton.js.map +1 -0
  58. package/dist/components/tabs.d.ts +22 -16
  59. package/dist/components/tabs.js +47 -31
  60. package/dist/components/tabs.js.map +1 -1
  61. package/dist/components/ui-labels.js +1 -1
  62. package/dist/components/ui-labels.js.map +1 -1
  63. package/dist/components/use-table-state.d.ts +8 -7
  64. package/dist/components/use-table-state.js +37 -3
  65. package/dist/components/use-table-state.js.map +1 -1
  66. package/dist/data-table.d.ts +1 -0
  67. package/dist/data-table.js.map +1 -1
  68. package/dist/eslint/index.js +1 -1
  69. package/dist/feedback/feedback-attachment-download.d.ts +19 -0
  70. package/dist/feedback/feedback-attachment-download.js +59 -0
  71. package/dist/feedback/feedback-attachment-download.js.map +1 -0
  72. package/dist/feedback/feedback-comment-thread.d.ts +17 -6
  73. package/dist/feedback/feedback-comment-thread.js +21 -2
  74. package/dist/feedback/feedback-comment-thread.js.map +1 -1
  75. package/dist/feedback/feedback-entry-file.d.ts +61 -0
  76. package/dist/feedback/feedback-entry-file.js +76 -0
  77. package/dist/feedback/feedback-entry-file.js.map +1 -0
  78. package/dist/feedback/feedback-public-list.d.ts +18 -5
  79. package/dist/feedback/feedback-public-list.js +8 -0
  80. package/dist/feedback/feedback-public-list.js.map +1 -1
  81. package/dist/feedback/feedback-public-types.d.ts +7 -2
  82. package/dist/feedback/feedback-replies.d.ts +26 -9
  83. package/dist/feedback/feedback-replies.js +20 -10
  84. package/dist/feedback/feedback-replies.js.map +1 -1
  85. package/dist/feedback/feedback-row-detail-labels.js +0 -1
  86. package/dist/feedback/feedback-row-detail-labels.js.map +1 -1
  87. package/dist/feedback/feedback-row-detail.d.ts +23 -10
  88. package/dist/feedback/feedback-row-detail.js +10 -54
  89. package/dist/feedback/feedback-row-detail.js.map +1 -1
  90. package/dist/feedback/feedback-table.d.ts +5 -0
  91. package/dist/feedback/feedback-table.js +30 -7
  92. package/dist/feedback/feedback-table.js.map +1 -1
  93. package/dist/feedback.d.ts +1 -0
  94. package/dist/feedback.js +1 -0
  95. package/dist/feedback.js.map +1 -1
  96. package/dist/hooks/use-dismiss.d.ts +30 -1
  97. package/dist/hooks/use-dismiss.js +30 -2
  98. package/dist/hooks/use-dismiss.js.map +1 -1
  99. package/dist/i18n/german.js +7 -7
  100. package/dist/i18n/german.js.map +1 -1
  101. package/dist/i18n/kit-labels.d.ts +4 -0
  102. package/dist/i18n/kit-labels.js.map +1 -1
  103. package/dist/i18n/locales/en.js +7 -7
  104. package/dist/i18n/locales/en.js.map +2 -2
  105. package/dist/i18n/locales/es.js +7 -7
  106. package/dist/i18n/locales/es.js.map +1 -1
  107. package/dist/i18n/locales/fr.js +7 -7
  108. package/dist/i18n/locales/fr.js.map +1 -1
  109. package/dist/i18n/locales/hu.js +7 -7
  110. package/dist/i18n/locales/hu.js.map +1 -1
  111. package/dist/i18n/locales/it.js +7 -7
  112. package/dist/i18n/locales/it.js.map +1 -1
  113. package/dist/i18n/locales/zh.js +7 -7
  114. package/dist/i18n/locales/zh.js.map +1 -1
  115. package/dist/i18n/review.js +0 -1
  116. package/dist/i18n/review.js.map +1 -1
  117. package/dist/i18n/shared-labels.js +3 -1
  118. package/dist/i18n/shared-labels.js.map +1 -1
  119. package/dist/index.d.ts +4 -4
  120. package/dist/index.js +13 -4
  121. package/dist/index.js.map +1 -1
  122. package/dist/lib/float-clearance.d.ts +8 -0
  123. package/dist/lib/float-clearance.js +29 -0
  124. package/dist/lib/float-clearance.js.map +1 -0
  125. package/dist/notifications/device-zone-report.d.ts +1 -1
  126. package/dist/notifications/device-zone-report.js.map +1 -1
  127. package/dist/notifications/notification-types.d.ts +0 -3
  128. package/dist/notifications/notifications-labels.d.ts +2 -15
  129. package/dist/notifications/notifications-labels.js +0 -4
  130. package/dist/notifications/notifications-labels.js.map +1 -1
  131. package/dist/notifications/quiet-hours-setting.d.ts +3 -8
  132. package/dist/notifications/quiet-hours-setting.js +8 -3
  133. package/dist/notifications/quiet-hours-setting.js.map +1 -1
  134. package/dist/settings/settings-catalogue.d.ts +10 -0
  135. package/dist/settings/settings-catalogue.js.map +1 -1
  136. package/dist/settings/settings-layout.js +10 -3
  137. package/dist/settings/settings-layout.js.map +1 -1
  138. package/dist/shell/app-shell.d.ts +5 -0
  139. package/dist/shell/app-shell.js +5 -3
  140. package/dist/shell/app-shell.js.map +1 -1
  141. package/dist/shell/option-switcher-menu.d.ts +2 -0
  142. package/dist/shell/option-switcher-menu.js +6 -2
  143. package/dist/shell/option-switcher-menu.js.map +1 -1
  144. package/dist/shell/topbar-action-menu.js +2 -1
  145. package/dist/shell/topbar-action-menu.js.map +1 -1
  146. package/dist/shell/topbar-controls.js +5 -3
  147. package/dist/shell/topbar-controls.js.map +1 -1
  148. package/dist/theme/theme-store.d.ts +4 -4
  149. package/dist/theme/theme-store.js +1 -0
  150. package/dist/theme/theme-store.js.map +1 -1
  151. package/dist/tour/tour.js +1 -0
  152. package/dist/tour/tour.js.map +1 -1
  153. package/package.json +2 -2
  154. package/src/admin/admin-sections.tsx +8 -0
  155. package/src/auth/verify-email.tsx +34 -9
  156. package/src/components/alert-banner.tsx +131 -7
  157. package/src/components/button-look.ts +6 -0
  158. package/src/components/combobox-core.tsx +7 -1
  159. package/src/components/data-table-column-settings.tsx +23 -2
  160. package/src/components/data-table-fit.ts +187 -0
  161. package/src/components/data-table-groups.tsx +275 -0
  162. package/src/components/data-table-head.tsx +4 -1
  163. package/src/components/data-table-labels.ts +13 -0
  164. package/src/components/data-table-leading-row.tsx +55 -0
  165. package/src/components/data-table-resize.ts +2 -1
  166. package/src/components/data-table.tsx +274 -45
  167. package/src/components/disclosure.tsx +22 -5
  168. package/src/components/dropdown.tsx +11 -1
  169. package/src/components/floating-panel.tsx +24 -1
  170. package/src/components/hover-menu.tsx +6 -1
  171. package/src/components/icon-button.tsx +3 -3
  172. package/src/components/popover.tsx +7 -1
  173. package/src/components/row-actions.tsx +42 -3
  174. package/src/components/table-skeleton.tsx +133 -0
  175. package/src/components/tabs.tsx +102 -50
  176. package/src/components/ui-labels.ts +1 -1
  177. package/src/components/use-table-state.ts +54 -3
  178. package/src/data-table.ts +2 -0
  179. package/src/feedback/feedback-attachment-download.tsx +77 -0
  180. package/src/feedback/feedback-comment-thread.tsx +42 -7
  181. package/src/feedback/feedback-entry-file.tsx +150 -0
  182. package/src/feedback/feedback-public-list.tsx +25 -4
  183. package/src/feedback/feedback-public-types.ts +7 -2
  184. package/src/feedback/feedback-replies.tsx +46 -19
  185. package/src/feedback/feedback-row-detail-labels.ts +0 -1
  186. package/src/feedback/feedback-row-detail.tsx +35 -86
  187. package/src/feedback/feedback-table.tsx +33 -1
  188. package/src/feedback.ts +1 -0
  189. package/src/hooks/use-dismiss.ts +65 -3
  190. package/src/i18n/german.ts +6 -6
  191. package/src/i18n/kit-labels.tsx +4 -0
  192. package/src/i18n/locales/es.ts +6 -6
  193. package/src/i18n/locales/fr.ts +6 -6
  194. package/src/i18n/locales/hu.ts +6 -6
  195. package/src/i18n/locales/it.ts +6 -6
  196. package/src/i18n/locales/zh.ts +6 -6
  197. package/src/i18n/review.ts +0 -1
  198. package/src/i18n/shared-labels.ts +2 -0
  199. package/src/index.ts +13 -3
  200. package/src/lib/float-clearance.ts +54 -0
  201. package/src/notifications/device-zone-report.ts +1 -1
  202. package/src/notifications/notification-types.ts +0 -3
  203. package/src/notifications/notifications-labels.ts +2 -19
  204. package/src/notifications/quiet-hours-setting.tsx +16 -11
  205. package/src/settings/settings-catalogue.ts +10 -0
  206. package/src/settings/settings-layout.tsx +18 -4
  207. package/src/shell/app-shell.tsx +17 -3
  208. package/src/shell/option-switcher-menu.tsx +16 -4
  209. package/src/shell/topbar-action-menu.tsx +22 -10
  210. package/src/shell/topbar-controls.tsx +18 -12
  211. package/src/theme/theme-store.ts +13 -5
  212. package/src/tour/tour.tsx +5 -0
  213. package/dist/notifications/time-zone-select.d.ts +0 -54
  214. package/dist/notifications/time-zone-select.js +0 -71
  215. package/dist/notifications/time-zone-select.js.map +0 -1
  216. package/src/notifications/time-zone-select.tsx +0 -125
@@ -0,0 +1,59 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { Download, FileText } from "lucide-react";
5
+ import { Button } from "../components/button.js";
6
+ import { toast } from "../components/toast.js";
7
+ import { useKitLabels } from "../i18n/kit-labels.js";
8
+ import { filenameFromDisposition, saveBlob } from "../lib/download.js";
9
+ import { attachmentName } from "./feedback-record.js";
10
+ import { DEFAULT_FEEDBACK_DETAIL_LABELS } from "./feedback-row-detail-labels.js";
11
+ async function toBlob(answer) {
12
+ if (typeof Response !== "undefined" && answer instanceof Response) {
13
+ if (!answer.ok) throw new Error(`HTTP ${answer.status}`);
14
+ return answer.blob();
15
+ }
16
+ return answer;
17
+ }
18
+ const plainFeedbackFetch = (url, { signal }) => fetch(url, { signal, credentials: "same-origin" });
19
+ function FeedbackAttachmentDownload({ url, fetcher }) {
20
+ const labels = useKitLabels("feedbackDetail", DEFAULT_FEEDBACK_DETAIL_LABELS);
21
+ const [busy, setBusy] = useState(false);
22
+ const name = attachmentName(url);
23
+ const download = async (event) => {
24
+ event.stopPropagation();
25
+ setBusy(true);
26
+ try {
27
+ const answer = await fetcher(url, { signal: new AbortController().signal });
28
+ const blob = await toBlob(answer);
29
+ const saveAs = typeof Response !== "undefined" && answer instanceof Response ? filenameFromDisposition(answer.headers.get("Content-Disposition"), name) : name;
30
+ saveBlob(blob, saveAs);
31
+ } catch {
32
+ toast.error(labels.downloadFailed);
33
+ } finally {
34
+ setBusy(false);
35
+ }
36
+ };
37
+ return /* @__PURE__ */ jsxs(
38
+ Button,
39
+ {
40
+ type: "button",
41
+ variant: "secondary",
42
+ size: "sm",
43
+ pending: busy,
44
+ onClick: (event) => void download(event),
45
+ "aria-label": labels.download(name),
46
+ className: "max-w-full",
47
+ children: [
48
+ /* @__PURE__ */ jsx(FileText, { className: "size-3.5 shrink-0", "aria-hidden": true }),
49
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 max-w-[14rem] truncate-until-large", children: name }),
50
+ /* @__PURE__ */ jsx(Download, { className: "size-3.5 shrink-0", "aria-hidden": true })
51
+ ]
52
+ }
53
+ );
54
+ }
55
+ export {
56
+ FeedbackAttachmentDownload,
57
+ plainFeedbackFetch
58
+ };
59
+ //# sourceMappingURL=feedback-attachment-download.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/feedback/feedback-attachment-download.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport type { MouseEvent } from \"react\";\nimport { Download, FileText } from \"lucide-react\";\nimport { Button } from \"../components/button\";\nimport { toast } from \"../components/toast\";\nimport type { AuthedFetcher } from \"../hooks/use-authed-src\";\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport { filenameFromDisposition, saveBlob } from \"../lib/download\";\nimport { attachmentName } from \"./feedback-record\";\nimport { DEFAULT_FEEDBACK_DETAIL_LABELS } from \"./feedback-row-detail-labels\";\n\n// Internal (not in the `./feedback` entry): the row detail's download button and its\n// plain fetch, shared since 0.47 with ./feedback-entry-file's inline entry files.\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. */\nexport const plainFeedbackFetch: AuthedFetcher = (url, { signal }) =>\n 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. Words: `feedbackDetail.download` /\n * `downloadFailed`.\n */\nexport function FeedbackAttachmentDownload({ url, fetcher }: { url: string; fetcher: AuthedFetcher }) {\n const labels = useKitLabels(\"feedbackDetail\", DEFAULT_FEEDBACK_DETAIL_LABELS);\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-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AAA,MACT,SAAS,CAAC,UAAU,KAAK,SAAS,KAAK;AAAA,MACvC,cAAY,OAAO,SAAS,IAAI;AAAA,MAChC,WAAU;AAAA,MAEV;AAAA,4BAAC,YAAS,WAAU,qBAAoB,eAAW,MAAC;AAAA,QACpD,oBAAC,UAAK,WAAU,8CAA8C,gBAAK;AAAA,QACnE,oBAAC,YAAS,WAAU,qBAAoB,eAAW,MAAC;AAAA;AAAA;AAAA,EACtD;AAEJ;","names":[]}
@@ -1,6 +1,8 @@
1
1
  import type { CommitScope } from "../components/write-lock.js";
2
+ import type { AuthedFetcher } from "../hooks/use-authed-src.js";
2
3
  import { type LabelOverride } from "../i18n/kit-labels.js";
3
4
  import type { FeedbackComment, FeedbackReply } from "./feedback-public-types.js";
5
+ import { type FeedbackEntryUploadOptions } from "./feedback-entry-file.js";
4
6
  import { DEFAULT_FEEDBACK_COMMENTS_LABELS } from "./feedback-thread-parts-labels.js";
5
7
  /**
6
8
  * A report's conversation as everyone who may read it sees it
@@ -20,8 +22,13 @@ import { DEFAULT_FEEDBACK_COMMENTS_LABELS } from "./feedback-thread-parts-labels
20
22
  * sees their text with that line; the admin sees it struck through, with **Unhide**.
21
23
  * An admin has **Hide** on every visible comment; the writer **Delete** on their own,
22
24
  * after a confirm (it is a hard delete). Nobody edits a comment.
23
- * - **The composer** (1–4 000 characters, no files) only with `onComment`: left out for
24
- * a reader who may not write (a demo, a CRASH report — the app knows).
25
+ * - **The composer** (1–4 000 characters) only with `onComment`: left out for a reader
26
+ * who may not write (a demo, a CRASH report — the app knows). Since 0.47 (§12) with
27
+ * `onUpload` it takes one file as the rework note does — pasted into the box,
28
+ * captured or picked — uploaded first, its URL `onComment`'s second argument.
29
+ * - **Files** (0.47, §12): a comment's or an entry's file under its text, a picture
30
+ * INLINE — a thumbnail through `fetcher` that opens full size — any other file a
31
+ * download ({@link FeedbackEntryFile}). A veiled comment shows none.
25
32
  *
26
33
  * Delete asks through `useConfirm`, so a thread with `onDelete` and a comment of the
27
34
  * viewer's needs the app's `ConfirmProvider` (each app mounts one already).
@@ -54,7 +61,7 @@ export interface FeedbackCommentsLabels {
54
61
  send: string;
55
62
  }
56
63
  export { DEFAULT_FEEDBACK_COMMENTS_LABELS };
57
- export interface FeedbackCommentThreadProps {
64
+ export interface FeedbackCommentThreadProps extends FeedbackEntryUploadOptions {
58
65
  /** The report's replies (§9.7), oldest first. Left out or `[]`: none.
59
66
  *
60
67
  * Inside `FeedbackRowDetail`'s `comments` they are dropped (0.38.1): the detail's
@@ -71,8 +78,12 @@ export interface FeedbackCommentThreadProps {
71
78
  /** `POST /feedback/{id}/comments`. Return the promise: the box clears when it
72
79
  * resolves, and keeps the draft when it rejects. A failure is the app's to toast —
73
80
  * the server's `detail`, else `feedbackToast.commentFailed` (0.38.1). Left out, no
74
- * composer. */
75
- onComment?: (body: string) => void | Promise<unknown>;
81
+ * composer. 0.47 (§12): `attachmentUrl` is the one file uploaded with it (with
82
+ * `onUpload`), `undefined` for none — `attachment_url` in the body (server-kit 0.18). */
83
+ onComment?: (body: string, attachmentUrl?: string) => void | Promise<unknown>;
84
+ /** 0.47: the app's authenticated GET (`AuthedImage`'s) for the files in the thread.
85
+ * Left out, the browser's own fetch with same-origin cookies. */
86
+ fetcher?: AuthedFetcher | null;
76
87
  /** `PATCH /feedback/{id}/comments/{comment_id} {hidden}` — the admin's. A rejection
77
88
  * is caught (0.38.1) and is the app's to toast (`feedbackToast.updateFailed`). Left
78
89
  * out, no Hide / Unhide. */
@@ -91,4 +102,4 @@ export interface FeedbackCommentThreadProps {
91
102
  labels?: LabelOverride<FeedbackCommentsLabels>;
92
103
  className?: string;
93
104
  }
94
- export declare function FeedbackCommentThread({ replies: repliesProp, comments, isAdmin, isAuthor, onComment, onHide, onDelete, pending, loading, commit, now, labels: labelsProp, className, }: FeedbackCommentThreadProps): import("react").JSX.Element;
105
+ export declare function FeedbackCommentThread({ replies: repliesProp, comments, isAdmin, isAuthor, onComment, onHide, onDelete, pending, loading, commit, now, fetcher, onUpload, onCaptureScreenshot, attachment, labels: labelsProp, className, }: FeedbackCommentThreadProps): import("react").JSX.Element;
@@ -8,6 +8,7 @@ import { useKitLabels } from "../i18n/kit-labels.js";
8
8
  import { FeedbackStatusBadge } from "./feedback-inbox.js";
9
9
  import { DEFAULT_FEEDBACK_PUBLIC_LABELS } from "./feedback-public-labels.js";
10
10
  import { FEEDBACK_COMMENT_MAX, attachmentName } from "./feedback-record.js";
11
+ import { FeedbackEntryFile, useFeedbackEntryUpload } from "./feedback-entry-file.js";
11
12
  import { useFeedbackRepliesLabels } from "./feedback-replies.js";
12
13
  import { FeedbackRepliesDrawnAboveContext } from "./feedback-replies-context.js";
13
14
  import { FeedbackReworkEntryChip } from "./feedback-rework-entry-chip.js";
@@ -32,9 +33,18 @@ function FeedbackCommentThread({
32
33
  loading = false,
33
34
  commit,
34
35
  now,
36
+ fetcher,
37
+ onUpload,
38
+ onCaptureScreenshot,
39
+ attachment,
35
40
  labels: labelsProp,
36
41
  className
37
42
  }) {
43
+ const { composerAttachment, upload, uploading } = useFeedbackEntryUpload({
44
+ onUpload,
45
+ onCaptureScreenshot,
46
+ attachment
47
+ });
38
48
  const labels = useKitLabels("feedbackComments", DEFAULT_FEEDBACK_COMMENTS_LABELS, labelsProp);
39
49
  const anonymous = useKitLabels("feedbackPublic", DEFAULT_FEEDBACK_PUBLIC_LABELS).anonymous;
40
50
  const replyLabels = useFeedbackRepliesLabels();
@@ -73,6 +83,8 @@ function FeedbackCommentThread({
73
83
  author: reply.author_name ?? replyLabels.admin,
74
84
  createdAt: reply.created_at,
75
85
  body: reply.body,
86
+ // 0.47 (§12): an admin reply's file, where the view carries it.
87
+ attachments: reply.attachment_url ? [{ name: attachmentName(reply.attachment_url), url: reply.attachment_url }] : void 0,
76
88
  staff: true,
77
89
  badge: reply.status_to ? /* @__PURE__ */ jsxs("span", { className: "inline-flex min-w-0 max-w-full flex-wrap items-center gap-1", "data-feedback-reply-status": reply.status_to, children: [
78
90
  /* @__PURE__ */ jsx("span", { className: "sr-only", children: replyLabels.statusChanged }),
@@ -126,6 +138,8 @@ function FeedbackCommentThread({
126
138
  author: veiled ? void 0 : comment.mine ? void 0 : comment.author_name ?? anonymous,
127
139
  createdAt: comment.created_at,
128
140
  body: veiled ? "" : comment.body ?? "",
141
+ // 0.47 (§12): its one file; none when veiled (the server sends none either).
142
+ attachments: !veiled && comment.attachment_url ? [{ name: attachmentName(comment.attachment_url), url: comment.attachment_url }] : void 0,
129
143
  staff: !veiled && comment.staff,
130
144
  struck: comment.hidden && isAdmin && !veiled,
131
145
  footer: actions.length > 0 ? actions : void 0
@@ -140,6 +154,7 @@ function FeedbackCommentThread({
140
154
  messages: entries.map((entry) => entry.message),
141
155
  loading,
142
156
  now,
157
+ renderAttachment: (file) => file.url ? /* @__PURE__ */ jsx(FeedbackEntryFile, { url: file.url, fetcher }) : file.name,
143
158
  labels: { thread: labels.comments, empty: labels.empty }
144
159
  }
145
160
  ),
@@ -147,8 +162,12 @@ function FeedbackCommentThread({
147
162
  ChatComposer,
148
163
  {
149
164
  className: "mt-3",
150
- onSend: (body) => onComment(body),
151
- pending,
165
+ onSend: async (body, file) => {
166
+ const url = await upload(file);
167
+ return url === void 0 ? onComment(body) : onComment(body, url);
168
+ },
169
+ pending: pending || uploading,
170
+ attachment: composerAttachment,
152
171
  commit,
153
172
  maxLength: FEEDBACK_COMMENT_MAX,
154
173
  showCount: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/feedback/feedback-comment-thread.tsx"],"sourcesContent":["import { useContext } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { EyeOff } from \"lucide-react\";\nimport { Button } from \"../components/button\";\nimport { useConfirm } from \"../components/confirm-dialog\";\nimport type { CommitScope } from \"../components/write-lock\";\nimport { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { FeedbackStatusBadge } from \"./feedback-inbox\";\nimport type { FeedbackComment, FeedbackReply } from \"./feedback-public-types\";\nimport { DEFAULT_FEEDBACK_PUBLIC_LABELS } from \"./feedback-public-labels\";\nimport { FEEDBACK_COMMENT_MAX, attachmentName } from \"./feedback-record\";\nimport { useFeedbackRepliesLabels } from \"./feedback-replies\";\nimport { FeedbackRepliesDrawnAboveContext } from \"./feedback-replies-context\";\nimport { FeedbackReworkEntryChip } from \"./feedback-rework-entry-chip\";\nimport { ChatComposer, FeedbackThread } from \"./feedback-thread\";\nimport type { FeedbackThreadMessage } from \"./feedback-thread\";\nimport { DEFAULT_FEEDBACK_COMMENTS_LABELS } from \"./feedback-thread-parts-labels\";\n\n/**\n * A report's conversation as everyone who may read it sees it\n * (docs/feedback-harmonization.md §9.8): the admin's replies and other people's\n * comments, each its own row, oldest first — merged by time, on the\n * {@link FeedbackThread} look — and the box to add one.\n *\n * - **Replies** are drawn as staff posts with the status they set (\"→ Done\"); a reply\n * without an author is \"Admin\" (§9.7).\n * - **Reworks** (0.40, §10.3, `kind: \"rework\"`) are the report's author's: the\n * **Rework** chip, \"→ status\" when the entry moved one (a migrated one did not), the\n * file when the view carries it; at the reading end for the author ({@link\n * FeedbackCommentThreadProps.isAuthor}), and a `null` name is \"A user\", never \"Admin\".\n * - **Comments**: the viewer's own at the reading end (\"You\"); someone else's under the\n * first name the server sent, `null` as \"A user\" (§9.5, `feedbackPublic.anonymous`).\n * - **Hidden** (§9.8): others see \"Hidden by an admin\" and no name, no text; the writer\n * sees their text with that line; the admin sees it struck through, with **Unhide**.\n * An admin has **Hide** on every visible comment; the writer **Delete** on their own,\n * after a confirm (it is a hard delete). Nobody edits a comment.\n * - **The composer** (1–4 000 characters, no files) only with `onComment`: left out for\n * a reader who may not write (a demo, a CRASH report — the app knows).\n *\n * Delete asks through `useConfirm`, so a thread with `onDelete` and a comment of the\n * viewer's needs the app's `ConfirmProvider` (each app mounts one already).\n */\n\n/* ── Labels ───────────────────────────────────────────────────────────────── */\n\n/** The `feedbackComments` namespace of `<UiKitProvider labels>`. A `null` name is\n * `feedbackPublic.anonymous`, the public pages' word, so the two say the same. */\nexport interface FeedbackCommentsLabels {\n /** The thread's accessible name. de-CH: \"Kommentare\" */\n comments: string;\n /** Nothing yet. de-CH: \"Noch keine Kommentare\" */\n empty: string;\n /** In place of a hidden comment. de-CH: \"Von einem Admin ausgeblendet\" */\n hidden: string;\n /** The admin's button. de-CH: \"Ausblenden\" */\n hide: string;\n /** The admin's button on a hidden comment. de-CH: \"Einblenden\" */\n unhide: string;\n /** The writer's button. de-CH: \"Löschen\" */\n delete: string;\n /** The confirm's question. de-CH: \"Diesen Kommentar löschen?\" */\n deleteTitle: string;\n /** The confirm's line. de-CH: \"Er wird für alle entfernt. Das kann nicht rückgängig\n * gemacht werden.\" */\n deleteBody: string;\n /** The box's accessible name. de-CH: \"Kommentar schreiben\" */\n field: string;\n /** de-CH: \"Kommentar schreiben…\" */\n placeholder: string;\n /** The send button. de-CH: \"Kommentieren\" */\n send: string;\n}\n\nexport { DEFAULT_FEEDBACK_COMMENTS_LABELS };\n\n/* ── The thread ───────────────────────────────────────────────────────────── */\n\nexport interface FeedbackCommentThreadProps {\n /** The report's replies (§9.7), oldest first. Left out or `[]`: none.\n *\n * Inside `FeedbackRowDetail`'s `comments` they are dropped (0.38.1): the detail's\n * Replies section draws them already, and the thread there is the comments alone —\n * so passing them there cannot draw them twice. */\n replies?: readonly FeedbackReply[];\n /** `GET /feedback/{id}/comments`, oldest first. */\n comments: readonly FeedbackComment[];\n /** The viewer is the app's admin: Hide / Unhide, the hidden text struck through. */\n isAdmin: boolean;\n /** 0.40: the viewer filed the report (the record's `mine`) — its rework entries are\n * theirs, drawn at the reading end as \"You\". Default `false`. */\n isAuthor?: boolean;\n /** `POST /feedback/{id}/comments`. Return the promise: the box clears when it\n * resolves, and keeps the draft when it rejects. A failure is the app's to toast —\n * the server's `detail`, else `feedbackToast.commentFailed` (0.38.1). Left out, no\n * composer. */\n onComment?: (body: string) => void | Promise<unknown>;\n /** `PATCH /feedback/{id}/comments/{comment_id} {hidden}` — the admin's. A rejection\n * is caught (0.38.1) and is the app's to toast (`feedbackToast.updateFailed`). Left\n * out, no Hide / Unhide. */\n onHide?: (comment: FeedbackComment, hidden: boolean) => void | Promise<unknown>;\n /** `DELETE /feedback/{id}/comments/{comment_id}` — the writer's own, after the\n * confirm. Left out, no Delete. */\n onDelete?: (comment: FeedbackComment) => void | Promise<unknown>;\n /** A comment is being sent. */\n pending?: boolean;\n /** The comments are loading. */\n loading?: boolean;\n /** Comment, Hide and Delete COMMIT — see Button's `commit`. */\n commit?: CommitScope;\n /** \"Now\" for the relative times — pin it in tests and stories. */\n now?: Date | number;\n labels?: LabelOverride<FeedbackCommentsLabels>;\n className?: string;\n}\n\ntype Entry = { at: number; order: number; message: FeedbackThreadMessage };\n\n/** The admin's Hide / Unhide as a promise — a sync throw or a `void` return included —\n * so the click can catch it as Delete's does. */\nconst hideComment = async (\n onHide: NonNullable<FeedbackCommentThreadProps[\"onHide\"]>,\n comment: FeedbackComment,\n) => {\n await onHide(comment, !comment.hidden);\n};\n\nconst instant = (iso: string) => {\n const ms = Date.parse(iso);\n return Number.isNaN(ms) ? 0 : ms;\n};\n\nexport function FeedbackCommentThread({\n replies: repliesProp = [],\n comments,\n isAdmin,\n isAuthor = false,\n onComment,\n onHide,\n onDelete,\n pending = false,\n loading = false,\n commit,\n now,\n labels: labelsProp,\n className,\n}: FeedbackCommentThreadProps) {\n const labels = useKitLabels(\"feedbackComments\", DEFAULT_FEEDBACK_COMMENTS_LABELS, labelsProp);\n const anonymous = useKitLabels(\"feedbackPublic\", DEFAULT_FEEDBACK_PUBLIC_LABELS).anonymous;\n const replyLabels = useFeedbackRepliesLabels();\n const repliesDrawnAbove = useContext(FeedbackRepliesDrawnAboveContext);\n const replies = repliesDrawnAbove ? [] : repliesProp;\n\n const entries: Entry[] = [];\n replies.forEach((reply, order) => {\n if (reply.kind === \"rework\") {\n entries.push({\n at: instant(reply.created_at),\n order,\n message: {\n id: `reply-${reply.id}`,\n own: isAuthor,\n author: isAuthor ? undefined : (reply.author_name ?? anonymous),\n createdAt: reply.created_at,\n body: reply.body,\n attachments: reply.attachment_url\n ? [{ name: attachmentName(reply.attachment_url), url: reply.attachment_url }]\n : undefined,\n badge: (\n <span className=\"inline-flex min-w-0 max-w-full flex-wrap items-center gap-1\" data-feedback-entry-kind=\"rework\">\n <FeedbackReworkEntryChip />\n {reply.status_to && (\n <span className=\"inline-flex items-center gap-1\" data-feedback-reply-status={reply.status_to}>\n <span className=\"sr-only\">{replyLabels.statusChanged}</span>\n <span aria-hidden>→</span>\n <FeedbackStatusBadge status={reply.status_to} />\n </span>\n )}\n </span>\n ),\n },\n });\n return;\n }\n entries.push({\n at: instant(reply.created_at),\n order,\n message: {\n id: `reply-${reply.id}`,\n author: reply.author_name ?? replyLabels.admin,\n createdAt: reply.created_at,\n body: reply.body,\n staff: true,\n badge: reply.status_to ? (\n <span className=\"inline-flex min-w-0 max-w-full flex-wrap items-center gap-1\" data-feedback-reply-status={reply.status_to}>\n <span className=\"sr-only\">{replyLabels.statusChanged}</span>\n <span aria-hidden>→</span>\n <FeedbackStatusBadge status={reply.status_to} />\n </span>\n ) : undefined,\n },\n });\n });\n comments.forEach((comment, index) => {\n // Shown as hidden — no name, no text — to anyone but its writer and an admin.\n const veiled = comment.hidden && !comment.mine && !isAdmin;\n const actions: ReactNode[] = [];\n if (comment.hidden) {\n actions.push(\n <span key=\"hidden\" className=\"inline-flex items-center gap-1\" data-feedback-comment-hidden=\"\">\n <EyeOff className=\"size-3\" aria-hidden />\n {labels.hidden}\n </span>,\n );\n }\n if (isAdmin && onHide) {\n actions.push(\n <Button\n key=\"hide\"\n type=\"button\"\n variant=\"link\"\n tone=\"muted\"\n size=\"sm\"\n commit={commit}\n // Caught as Delete's is (0.38.1): a rejection is the app's to toast — its\n // mutation's `onError` — and must not surface as an unhandled one.\n onClick={() => void hideComment(onHide, comment).catch(() => {})}\n >\n {comment.hidden ? labels.unhide : labels.hide}\n </Button>,\n );\n }\n if (comment.mine && onDelete) {\n actions.push(\n <DeleteCommentButton key=\"delete\" comment={comment} onDelete={onDelete} commit={commit} labels={labels} />,\n );\n }\n entries.push({\n at: instant(comment.created_at),\n // Replies first on a tie, then the comments in their order.\n order: replies.length + index,\n message: {\n id: `comment-${comment.id}`,\n own: comment.mine,\n author: veiled ? undefined : comment.mine ? undefined : (comment.author_name ?? anonymous),\n createdAt: comment.created_at,\n body: veiled ? \"\" : (comment.body ?? \"\"),\n staff: !veiled && comment.staff,\n struck: comment.hidden && isAdmin && !veiled,\n footer: actions.length > 0 ? actions : undefined,\n },\n });\n });\n entries.sort((a, b) => a.at - b.at || a.order - b.order);\n\n return (\n <div className={className} data-feedback-comment-thread=\"\">\n <FeedbackThread\n messages={entries.map((entry) => entry.message)}\n loading={loading}\n now={now}\n labels={{ thread: labels.comments, empty: labels.empty }}\n />\n {onComment && (\n <ChatComposer\n className=\"mt-3\"\n onSend={(body) => onComment(body)}\n pending={pending}\n commit={commit}\n maxLength={FEEDBACK_COMMENT_MAX}\n showCount\n labels={{ field: labels.field, placeholder: labels.placeholder, send: labels.send }}\n />\n )}\n </div>\n );\n}\n\n/** The writer's Delete: a confirm (danger tone, focus on Cancel), then `onDelete`. Its\n * own component, so `useConfirm` — which needs a `ConfirmProvider` — is only called\n * where there is something to delete. */\nfunction DeleteCommentButton({\n comment,\n onDelete,\n commit,\n labels,\n}: {\n comment: FeedbackComment;\n onDelete: (comment: FeedbackComment) => void | Promise<unknown>;\n commit?: CommitScope;\n labels: FeedbackCommentsLabels;\n}) {\n const confirm = useConfirm();\n const remove = async () => {\n const ok = await confirm({\n title: labels.deleteTitle,\n body: labels.deleteBody,\n confirmLabel: labels.delete,\n tone: \"danger\",\n commit,\n });\n if (ok) await onDelete(comment);\n };\n return (\n <Button\n type=\"button\"\n variant=\"link\"\n tone=\"danger\"\n size=\"sm\"\n commit={commit}\n onClick={() => void remove().catch(() => {})}\n >\n {labels.delete}\n </Button>\n );\n}\n"],"mappings":";AAyKc,cAEE,YAFF;AAzKd,SAAS,kBAAk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UAAU,OAAO,OAAO,MAAM;AAAA;AAAA,IACzD;AAAA,IACC,aACC;AAAA,MAAC;AAAA;AAAA,QACC,WAAU;AAAA,QACV,QAAQ,CAAC,SAAS,UAAU,IAAI;AAAA,QAChC;AAAA,QACA;AAAA,QACA,WAAW;AAAA,QACX,WAAS;AAAA,QACT,QAAQ,EAAE,OAAO,OAAO,OAAO,aAAa,OAAO,aAAa,MAAM,OAAO,KAAK;AAAA;AAAA,IACpF;AAAA,KAEJ;AAEJ;AAKA,SAAS,oBAAoB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAKG;AACD,QAAM,UAAU,WAAW;AAC3B,QAAM,SAAS,YAAY;AACzB,UAAM,KAAK,MAAM,QAAQ;AAAA,MACvB,OAAO,OAAO;AAAA,MACd,MAAM,OAAO;AAAA,MACb,cAAc,OAAO;AAAA,MACrB,MAAM;AAAA,MACN;AAAA,IACF,CAAC;AACD,QAAI,GAAI,OAAM,SAAS,OAAO;AAAA,EAChC;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,MAAK;AAAA,MACL;AAAA,MACA,SAAS,MAAM,KAAK,OAAO,EAAE,MAAM,MAAM;AAAA,MAAC,CAAC;AAAA,MAE1C,iBAAO;AAAA;AAAA,EACV;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/feedback/feedback-comment-thread.tsx"],"sourcesContent":["import { useContext } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { EyeOff } from \"lucide-react\";\nimport { Button } from \"../components/button\";\nimport { useConfirm } from \"../components/confirm-dialog\";\nimport type { CommitScope } from \"../components/write-lock\";\nimport type { AuthedFetcher } from \"../hooks/use-authed-src\";\nimport { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { FeedbackStatusBadge } from \"./feedback-inbox\";\nimport type { FeedbackComment, FeedbackReply } from \"./feedback-public-types\";\nimport { DEFAULT_FEEDBACK_PUBLIC_LABELS } from \"./feedback-public-labels\";\nimport { FEEDBACK_COMMENT_MAX, attachmentName } from \"./feedback-record\";\nimport { FeedbackEntryFile, useFeedbackEntryUpload, type FeedbackEntryUploadOptions } from \"./feedback-entry-file\";\nimport { useFeedbackRepliesLabels } from \"./feedback-replies\";\nimport { FeedbackRepliesDrawnAboveContext } from \"./feedback-replies-context\";\nimport { FeedbackReworkEntryChip } from \"./feedback-rework-entry-chip\";\nimport { ChatComposer, FeedbackThread } from \"./feedback-thread\";\nimport type { FeedbackThreadMessage } from \"./feedback-thread\";\nimport { DEFAULT_FEEDBACK_COMMENTS_LABELS } from \"./feedback-thread-parts-labels\";\n\n/**\n * A report's conversation as everyone who may read it sees it\n * (docs/feedback-harmonization.md §9.8): the admin's replies and other people's\n * comments, each its own row, oldest first — merged by time, on the\n * {@link FeedbackThread} look — and the box to add one.\n *\n * - **Replies** are drawn as staff posts with the status they set (\"→ Done\"); a reply\n * without an author is \"Admin\" (§9.7).\n * - **Reworks** (0.40, §10.3, `kind: \"rework\"`) are the report's author's: the\n * **Rework** chip, \"→ status\" when the entry moved one (a migrated one did not), the\n * file when the view carries it; at the reading end for the author ({@link\n * FeedbackCommentThreadProps.isAuthor}), and a `null` name is \"A user\", never \"Admin\".\n * - **Comments**: the viewer's own at the reading end (\"You\"); someone else's under the\n * first name the server sent, `null` as \"A user\" (§9.5, `feedbackPublic.anonymous`).\n * - **Hidden** (§9.8): others see \"Hidden by an admin\" and no name, no text; the writer\n * sees their text with that line; the admin sees it struck through, with **Unhide**.\n * An admin has **Hide** on every visible comment; the writer **Delete** on their own,\n * after a confirm (it is a hard delete). Nobody edits a comment.\n * - **The composer** (1–4 000 characters) only with `onComment`: left out for a reader\n * who may not write (a demo, a CRASH report — the app knows). Since 0.47 (§12) with\n * `onUpload` it takes one file as the rework note does — pasted into the box,\n * captured or picked — uploaded first, its URL `onComment`'s second argument.\n * - **Files** (0.47, §12): a comment's or an entry's file under its text, a picture\n * INLINE — a thumbnail through `fetcher` that opens full size — any other file a\n * download ({@link FeedbackEntryFile}). A veiled comment shows none.\n *\n * Delete asks through `useConfirm`, so a thread with `onDelete` and a comment of the\n * viewer's needs the app's `ConfirmProvider` (each app mounts one already).\n */\n\n/* ── Labels ───────────────────────────────────────────────────────────────── */\n\n/** The `feedbackComments` namespace of `<UiKitProvider labels>`. A `null` name is\n * `feedbackPublic.anonymous`, the public pages' word, so the two say the same. */\nexport interface FeedbackCommentsLabels {\n /** The thread's accessible name. de-CH: \"Kommentare\" */\n comments: string;\n /** Nothing yet. de-CH: \"Noch keine Kommentare\" */\n empty: string;\n /** In place of a hidden comment. de-CH: \"Von einem Admin ausgeblendet\" */\n hidden: string;\n /** The admin's button. de-CH: \"Ausblenden\" */\n hide: string;\n /** The admin's button on a hidden comment. de-CH: \"Einblenden\" */\n unhide: string;\n /** The writer's button. de-CH: \"Löschen\" */\n delete: string;\n /** The confirm's question. de-CH: \"Diesen Kommentar löschen?\" */\n deleteTitle: string;\n /** The confirm's line. de-CH: \"Er wird für alle entfernt. Das kann nicht rückgängig\n * gemacht werden.\" */\n deleteBody: string;\n /** The box's accessible name. de-CH: \"Kommentar schreiben\" */\n field: string;\n /** de-CH: \"Kommentar schreiben…\" */\n placeholder: string;\n /** The send button. de-CH: \"Kommentieren\" */\n send: string;\n}\n\nexport { DEFAULT_FEEDBACK_COMMENTS_LABELS };\n\n/* ── The thread ───────────────────────────────────────────────────────────── */\n\nexport interface FeedbackCommentThreadProps extends FeedbackEntryUploadOptions {\n /** The report's replies (§9.7), oldest first. Left out or `[]`: none.\n *\n * Inside `FeedbackRowDetail`'s `comments` they are dropped (0.38.1): the detail's\n * Replies section draws them already, and the thread there is the comments alone —\n * so passing them there cannot draw them twice. */\n replies?: readonly FeedbackReply[];\n /** `GET /feedback/{id}/comments`, oldest first. */\n comments: readonly FeedbackComment[];\n /** The viewer is the app's admin: Hide / Unhide, the hidden text struck through. */\n isAdmin: boolean;\n /** 0.40: the viewer filed the report (the record's `mine`) — its rework entries are\n * theirs, drawn at the reading end as \"You\". Default `false`. */\n isAuthor?: boolean;\n /** `POST /feedback/{id}/comments`. Return the promise: the box clears when it\n * resolves, and keeps the draft when it rejects. A failure is the app's to toast —\n * the server's `detail`, else `feedbackToast.commentFailed` (0.38.1). Left out, no\n * composer. 0.47 (§12): `attachmentUrl` is the one file uploaded with it (with\n * `onUpload`), `undefined` for none — `attachment_url` in the body (server-kit 0.18). */\n onComment?: (body: string, attachmentUrl?: string) => void | Promise<unknown>;\n /** 0.47: the app's authenticated GET (`AuthedImage`'s) for the files in the thread.\n * Left out, the browser's own fetch with same-origin cookies. */\n fetcher?: AuthedFetcher | null;\n /** `PATCH /feedback/{id}/comments/{comment_id} {hidden}` — the admin's. A rejection\n * is caught (0.38.1) and is the app's to toast (`feedbackToast.updateFailed`). Left\n * out, no Hide / Unhide. */\n onHide?: (comment: FeedbackComment, hidden: boolean) => void | Promise<unknown>;\n /** `DELETE /feedback/{id}/comments/{comment_id}` — the writer's own, after the\n * confirm. Left out, no Delete. */\n onDelete?: (comment: FeedbackComment) => void | Promise<unknown>;\n /** A comment is being sent. */\n pending?: boolean;\n /** The comments are loading. */\n loading?: boolean;\n /** Comment, Hide and Delete COMMIT — see Button's `commit`. */\n commit?: CommitScope;\n /** \"Now\" for the relative times — pin it in tests and stories. */\n now?: Date | number;\n labels?: LabelOverride<FeedbackCommentsLabels>;\n className?: string;\n}\n\ntype Entry = { at: number; order: number; message: FeedbackThreadMessage };\n\n/** The admin's Hide / Unhide as a promise — a sync throw or a `void` return included —\n * so the click can catch it as Delete's does. */\nconst hideComment = async (\n onHide: NonNullable<FeedbackCommentThreadProps[\"onHide\"]>,\n comment: FeedbackComment,\n) => {\n await onHide(comment, !comment.hidden);\n};\n\nconst instant = (iso: string) => {\n const ms = Date.parse(iso);\n return Number.isNaN(ms) ? 0 : ms;\n};\n\nexport function FeedbackCommentThread({\n replies: repliesProp = [],\n comments,\n isAdmin,\n isAuthor = false,\n onComment,\n onHide,\n onDelete,\n pending = false,\n loading = false,\n commit,\n now,\n fetcher,\n onUpload,\n onCaptureScreenshot,\n attachment,\n labels: labelsProp,\n className,\n}: FeedbackCommentThreadProps) {\n const { composerAttachment, upload, uploading } = useFeedbackEntryUpload({\n onUpload,\n onCaptureScreenshot,\n attachment,\n });\n const labels = useKitLabels(\"feedbackComments\", DEFAULT_FEEDBACK_COMMENTS_LABELS, labelsProp);\n const anonymous = useKitLabels(\"feedbackPublic\", DEFAULT_FEEDBACK_PUBLIC_LABELS).anonymous;\n const replyLabels = useFeedbackRepliesLabels();\n const repliesDrawnAbove = useContext(FeedbackRepliesDrawnAboveContext);\n const replies = repliesDrawnAbove ? [] : repliesProp;\n\n const entries: Entry[] = [];\n replies.forEach((reply, order) => {\n if (reply.kind === \"rework\") {\n entries.push({\n at: instant(reply.created_at),\n order,\n message: {\n id: `reply-${reply.id}`,\n own: isAuthor,\n author: isAuthor ? undefined : (reply.author_name ?? anonymous),\n createdAt: reply.created_at,\n body: reply.body,\n attachments: reply.attachment_url\n ? [{ name: attachmentName(reply.attachment_url), url: reply.attachment_url }]\n : undefined,\n badge: (\n <span className=\"inline-flex min-w-0 max-w-full flex-wrap items-center gap-1\" data-feedback-entry-kind=\"rework\">\n <FeedbackReworkEntryChip />\n {reply.status_to && (\n <span className=\"inline-flex items-center gap-1\" data-feedback-reply-status={reply.status_to}>\n <span className=\"sr-only\">{replyLabels.statusChanged}</span>\n <span aria-hidden>→</span>\n <FeedbackStatusBadge status={reply.status_to} />\n </span>\n )}\n </span>\n ),\n },\n });\n return;\n }\n entries.push({\n at: instant(reply.created_at),\n order,\n message: {\n id: `reply-${reply.id}`,\n author: reply.author_name ?? replyLabels.admin,\n createdAt: reply.created_at,\n body: reply.body,\n // 0.47 (§12): an admin reply's file, where the view carries it.\n attachments: reply.attachment_url\n ? [{ name: attachmentName(reply.attachment_url), url: reply.attachment_url }]\n : undefined,\n staff: true,\n badge: reply.status_to ? (\n <span className=\"inline-flex min-w-0 max-w-full flex-wrap items-center gap-1\" data-feedback-reply-status={reply.status_to}>\n <span className=\"sr-only\">{replyLabels.statusChanged}</span>\n <span aria-hidden>→</span>\n <FeedbackStatusBadge status={reply.status_to} />\n </span>\n ) : undefined,\n },\n });\n });\n comments.forEach((comment, index) => {\n // Shown as hidden — no name, no text — to anyone but its writer and an admin.\n const veiled = comment.hidden && !comment.mine && !isAdmin;\n const actions: ReactNode[] = [];\n if (comment.hidden) {\n actions.push(\n <span key=\"hidden\" className=\"inline-flex items-center gap-1\" data-feedback-comment-hidden=\"\">\n <EyeOff className=\"size-3\" aria-hidden />\n {labels.hidden}\n </span>,\n );\n }\n if (isAdmin && onHide) {\n actions.push(\n <Button\n key=\"hide\"\n type=\"button\"\n variant=\"link\"\n tone=\"muted\"\n size=\"sm\"\n commit={commit}\n // Caught as Delete's is (0.38.1): a rejection is the app's to toast — its\n // mutation's `onError` — and must not surface as an unhandled one.\n onClick={() => void hideComment(onHide, comment).catch(() => {})}\n >\n {comment.hidden ? labels.unhide : labels.hide}\n </Button>,\n );\n }\n if (comment.mine && onDelete) {\n actions.push(\n <DeleteCommentButton key=\"delete\" comment={comment} onDelete={onDelete} commit={commit} labels={labels} />,\n );\n }\n entries.push({\n at: instant(comment.created_at),\n // Replies first on a tie, then the comments in their order.\n order: replies.length + index,\n message: {\n id: `comment-${comment.id}`,\n own: comment.mine,\n author: veiled ? undefined : comment.mine ? undefined : (comment.author_name ?? anonymous),\n createdAt: comment.created_at,\n body: veiled ? \"\" : (comment.body ?? \"\"),\n // 0.47 (§12): its one file; none when veiled (the server sends none either).\n attachments:\n !veiled && comment.attachment_url\n ? [{ name: attachmentName(comment.attachment_url), url: comment.attachment_url }]\n : undefined,\n staff: !veiled && comment.staff,\n struck: comment.hidden && isAdmin && !veiled,\n footer: actions.length > 0 ? actions : undefined,\n },\n });\n });\n entries.sort((a, b) => a.at - b.at || a.order - b.order);\n\n return (\n <div className={className} data-feedback-comment-thread=\"\">\n <FeedbackThread\n messages={entries.map((entry) => entry.message)}\n loading={loading}\n now={now}\n renderAttachment={(file) => (file.url ? <FeedbackEntryFile url={file.url} fetcher={fetcher} /> : file.name)}\n labels={{ thread: labels.comments, empty: labels.empty }}\n />\n {onComment && (\n <ChatComposer\n className=\"mt-3\"\n onSend={async (body, file) => {\n const url = await upload(file);\n // The second argument only with a file, so a text comment calls as before 0.47.\n return url === undefined ? onComment(body) : onComment(body, url);\n }}\n pending={pending || uploading}\n attachment={composerAttachment}\n commit={commit}\n maxLength={FEEDBACK_COMMENT_MAX}\n showCount\n labels={{ field: labels.field, placeholder: labels.placeholder, send: labels.send }}\n />\n )}\n </div>\n );\n}\n\n/** The writer's Delete: a confirm (danger tone, focus on Cancel), then `onDelete`. Its\n * own component, so `useConfirm` — which needs a `ConfirmProvider` — is only called\n * where there is something to delete. */\nfunction DeleteCommentButton({\n comment,\n onDelete,\n commit,\n labels,\n}: {\n comment: FeedbackComment;\n onDelete: (comment: FeedbackComment) => void | Promise<unknown>;\n commit?: CommitScope;\n labels: FeedbackCommentsLabels;\n}) {\n const confirm = useConfirm();\n const remove = async () => {\n const ok = await confirm({\n title: labels.deleteTitle,\n body: labels.deleteBody,\n confirmLabel: labels.delete,\n tone: \"danger\",\n commit,\n });\n if (ok) await onDelete(comment);\n };\n return (\n <Button\n type=\"button\"\n variant=\"link\"\n tone=\"danger\"\n size=\"sm\"\n commit={commit}\n onClick={() => void remove().catch(() => {})}\n >\n {labels.delete}\n </Button>\n );\n}\n"],"mappings":";AA6Lc,cAEE,YAFF;AA7Ld,SAAS,kBAAkB;AAE3B,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAG3B,SAAS,oBAAwC;AACjD,SAAS,2BAA2B;AAEpC,SAAS,sCAAsC;AAC/C,SAAS,sBAAsB,sBAAsB;AACrD,SAAS,mBAAmB,8BAA+D;AAC3F,SAAS,gCAAgC;AACzC,SAAS,wCAAwC;AACjD,SAAS,+BAA+B;AACxC,SAAS,cAAc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;","names":[]}
@@ -0,0 +1,61 @@
1
+ import type { AuthedFetcher } from "../hooks/use-authed-src.js";
2
+ import type { FeedbackNoteAttachment } from "./feedback-inbox.js";
3
+ import type { FeedbackComposerAttachment } from "./feedback-thread.js";
4
+ /**
5
+ * One file of a conversation entry, and the upload behind an entry's composer
6
+ * (docs/feedback-harmonization.md §12, round 0.47; keksdose run 82 R1, live #447).
7
+ *
8
+ * - {@link FeedbackEntryFile}: a picture drawn INLINE — a thumbnail fetched through the
9
+ * app's authenticated GET, a tap opens it full size in a tab — and any other file a
10
+ * download button, as the row detail's Attachment section draws them. The reply
11
+ * timeline, the rework entries and the comment thread all draw their file with it.
12
+ * - {@link useFeedbackEntryUpload}: the rework note's one-file field (paste from the
13
+ * clipboard, capture, pick; the contract's types and 10 MB, §3.5) for a
14
+ * {@link ChatComposer}, and the upload that runs FIRST on send, so an entry never names
15
+ * a file that did not arrive.
16
+ */
17
+ export interface FeedbackEntryFileProps {
18
+ /** The entry's `attachment_url` — `/api/v1/feedback/attachments/<key>`. */
19
+ url: string;
20
+ /** The app's authenticated GET (`AuthedImage`'s): the attachment route wants the
21
+ * bearer token (§3.5). Left out, the browser's own fetch with same-origin cookies. */
22
+ fetcher?: AuthedFetcher | null;
23
+ className?: string;
24
+ }
25
+ /**
26
+ * An entry's one file (§12): a picture (`png`, `jpg`, `webp`, `gif` — by the key's
27
+ * extension, which the server minted from the sniffed bytes) as an inline thumbnail that
28
+ * opens full size in a new tab (`AuthedImage`'s `link`: the `blob:` URL, never the API
29
+ * path); anything else a download button. A picture that will not load falls back to the
30
+ * download button, so a broken file still says it is there. `alt`:
31
+ * `feedbackDetail.attachment`.
32
+ */
33
+ export declare function FeedbackEntryFile({ url, fetcher, className }: FeedbackEntryFileProps): import("react").JSX.Element;
34
+ /** `POST /feedback/attachments` — the file, answered with its URL. */
35
+ export type FeedbackEntryUpload = (file: File) => Promise<string>;
36
+ export interface FeedbackEntryUploadOptions {
37
+ /** The upload. Left out, the composer is text only. */
38
+ onUpload?: FeedbackEntryUpload;
39
+ /** The "Capture screenshot" button — the kit's `captureAppScreenshot` or the app's
40
+ * own. A rejection toasts `feedbackToast.captureFailed` and adds nothing. */
41
+ onCaptureScreenshot?: () => Promise<File | null>;
42
+ /** Over the field's defaults: the contract's types and 10 MB (§3.5), the
43
+ * `feedbackToast` refusals. The same object the rework section takes. */
44
+ attachment?: Partial<FeedbackNoteAttachment>;
45
+ }
46
+ export interface FeedbackEntryUploadState {
47
+ /** For {@link ChatComposer}'s `attachment`; `undefined` without `onUpload`. */
48
+ composerAttachment: FeedbackComposerAttachment | undefined;
49
+ /** Upload the picked file, if any: its URL, `undefined` for none. Rejects after a
50
+ * toast (`feedbackAttachment.attachmentUploadFailed`) when the upload fails — the
51
+ * send then stops and the composer keeps the draft and the file. */
52
+ upload: (file: File | null) => Promise<string | undefined>;
53
+ /** An upload is running — add it to the composer's `pending`. */
54
+ uploading: boolean;
55
+ }
56
+ /**
57
+ * The rework note's file field for a reply or a comment composer (§12): one file, added,
58
+ * captured or pasted from the clipboard into the box, the contract's types and 10 MB; and
59
+ * the upload, awaited before the entry is sent.
60
+ */
61
+ export declare function useFeedbackEntryUpload({ onUpload, onCaptureScreenshot, attachment, }: FeedbackEntryUploadOptions): FeedbackEntryUploadState;
@@ -0,0 +1,76 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { AuthedImage } from "../components/authed-image.js";
5
+ import { toast } from "../components/toast.js";
6
+ import { useKitLabels } from "../i18n/kit-labels.js";
7
+ import { cn } from "../lib/cn.js";
8
+ import { DEFAULT_FEEDBACK_ATTACHMENT_LABELS, DEFAULT_MAX_ATTACHMENT_BYTES } from "./feedback-attachment.js";
9
+ import { useFeedbackToastLabels } from "./feedback-labels.js";
10
+ import { FeedbackAttachmentDownload, plainFeedbackFetch } from "./feedback-attachment-download.js";
11
+ import { FEEDBACK_ATTACHMENT_ACCEPT, isImageAttachment } from "./feedback-record.js";
12
+ import { DEFAULT_FEEDBACK_DETAIL_LABELS } from "./feedback-row-detail-labels.js";
13
+ function FeedbackEntryFile({ url, fetcher, className }) {
14
+ const labels = useKitLabels("feedbackDetail", DEFAULT_FEEDBACK_DETAIL_LABELS);
15
+ const fetchFile = fetcher ?? plainFeedbackFetch;
16
+ return /* @__PURE__ */ jsx("span", { className: cn("inline-block min-w-0 max-w-full", className), "data-feedback-entry-file": url, children: isImageAttachment(url) ? /* @__PURE__ */ jsx(
17
+ AuthedImage,
18
+ {
19
+ src: url,
20
+ alt: labels.attachment,
21
+ fetcher: fetchFile,
22
+ link: true,
23
+ stopPropagation: true,
24
+ errorFallback: /* @__PURE__ */ jsx(FeedbackAttachmentDownload, { url, fetcher: fetchFile }),
25
+ wrapperClassName: "inline-block max-w-full",
26
+ className: "max-h-40 max-w-full rounded border border-subtle"
27
+ }
28
+ ) : /* @__PURE__ */ jsx(FeedbackAttachmentDownload, { url, fetcher: fetchFile }) });
29
+ }
30
+ function useFeedbackEntryUpload({
31
+ onUpload,
32
+ onCaptureScreenshot,
33
+ attachment
34
+ }) {
35
+ const toasts = useFeedbackToastLabels();
36
+ const fieldLabels = useKitLabels("feedbackAttachment", DEFAULT_FEEDBACK_ATTACHMENT_LABELS);
37
+ const [uploading, setUploading] = useState(false);
38
+ const capture = onCaptureScreenshot ? async () => {
39
+ try {
40
+ return await onCaptureScreenshot();
41
+ } catch {
42
+ toast.error(toasts.captureFailed);
43
+ return null;
44
+ }
45
+ } : void 0;
46
+ const composerAttachment = onUpload ? {
47
+ accept: FEEDBACK_ATTACHMENT_ACCEPT,
48
+ maxBytes: DEFAULT_MAX_ATTACHMENT_BYTES,
49
+ onError: (kind) => {
50
+ toast.error(kind === "type" ? toasts.attachmentUnsupported : toasts.attachmentTooLarge);
51
+ },
52
+ onCaptureScreenshot: capture,
53
+ buttonVariant: "ghost",
54
+ buttonSize: "sm",
55
+ ...attachment
56
+ } : void 0;
57
+ const upload = async (file) => {
58
+ if (!file || !onUpload) return void 0;
59
+ setUploading(true);
60
+ try {
61
+ return await onUpload(file);
62
+ } catch (error) {
63
+ const failed = fieldLabels.attachmentUploadFailed ?? DEFAULT_FEEDBACK_ATTACHMENT_LABELS.attachmentUploadFailed;
64
+ toast.error(failed(file.name));
65
+ throw error;
66
+ } finally {
67
+ setUploading(false);
68
+ }
69
+ };
70
+ return { composerAttachment, upload, uploading };
71
+ }
72
+ export {
73
+ FeedbackEntryFile,
74
+ useFeedbackEntryUpload
75
+ };
76
+ //# sourceMappingURL=feedback-entry-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/feedback/feedback-entry-file.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { AuthedImage } from \"../components/authed-image\";\nimport { toast } from \"../components/toast\";\nimport type { AuthedFetcher } from \"../hooks/use-authed-src\";\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { DEFAULT_FEEDBACK_ATTACHMENT_LABELS, DEFAULT_MAX_ATTACHMENT_BYTES } from \"./feedback-attachment\";\nimport type { FeedbackNoteAttachment } from \"./feedback-inbox\";\nimport { useFeedbackToastLabels } from \"./feedback-labels\";\nimport { FeedbackAttachmentDownload, plainFeedbackFetch } from \"./feedback-attachment-download\";\nimport { FEEDBACK_ATTACHMENT_ACCEPT, isImageAttachment } from \"./feedback-record\";\nimport { DEFAULT_FEEDBACK_DETAIL_LABELS } from \"./feedback-row-detail-labels\";\nimport type { FeedbackComposerAttachment } from \"./feedback-thread\";\n\n/**\n * One file of a conversation entry, and the upload behind an entry's composer\n * (docs/feedback-harmonization.md §12, round 0.47; keksdose run 82 R1, live #447).\n *\n * - {@link FeedbackEntryFile}: a picture drawn INLINE — a thumbnail fetched through the\n * app's authenticated GET, a tap opens it full size in a tab — and any other file a\n * download button, as the row detail's Attachment section draws them. The reply\n * timeline, the rework entries and the comment thread all draw their file with it.\n * - {@link useFeedbackEntryUpload}: the rework note's one-file field (paste from the\n * clipboard, capture, pick; the contract's types and 10 MB, §3.5) for a\n * {@link ChatComposer}, and the upload that runs FIRST on send, so an entry never names\n * a file that did not arrive.\n */\n\nexport interface FeedbackEntryFileProps {\n /** The entry's `attachment_url` — `/api/v1/feedback/attachments/<key>`. */\n url: string;\n /** The app's authenticated GET (`AuthedImage`'s): the attachment route wants the\n * bearer token (§3.5). Left out, the browser's own fetch with same-origin cookies. */\n fetcher?: AuthedFetcher | null;\n className?: string;\n}\n\n/**\n * An entry's one file (§12): a picture (`png`, `jpg`, `webp`, `gif` — by the key's\n * extension, which the server minted from the sniffed bytes) as an inline thumbnail that\n * opens full size in a new tab (`AuthedImage`'s `link`: the `blob:` URL, never the API\n * path); anything else a download button. A picture that will not load falls back to the\n * download button, so a broken file still says it is there. `alt`:\n * `feedbackDetail.attachment`.\n */\nexport function FeedbackEntryFile({ url, fetcher, className }: FeedbackEntryFileProps) {\n const labels = useKitLabels(\"feedbackDetail\", DEFAULT_FEEDBACK_DETAIL_LABELS);\n const fetchFile = fetcher ?? plainFeedbackFetch;\n return (\n <span className={cn(\"inline-block min-w-0 max-w-full\", className)} data-feedback-entry-file={url}>\n {isImageAttachment(url) ? (\n <AuthedImage\n src={url}\n alt={labels.attachment}\n fetcher={fetchFile}\n link\n stopPropagation\n errorFallback={<FeedbackAttachmentDownload url={url} fetcher={fetchFile} />}\n wrapperClassName=\"inline-block max-w-full\"\n className=\"max-h-40 max-w-full rounded border border-subtle\"\n />\n ) : (\n <FeedbackAttachmentDownload url={url} fetcher={fetchFile} />\n )}\n </span>\n );\n}\n\n/* ── The composer's one file ──────────────────────────────────────────────── */\n\n/** `POST /feedback/attachments` — the file, answered with its URL. */\nexport type FeedbackEntryUpload = (file: File) => Promise<string>;\n\nexport interface FeedbackEntryUploadOptions {\n /** The upload. Left out, the composer is text only. */\n onUpload?: FeedbackEntryUpload;\n /** The \"Capture screenshot\" button — the kit's `captureAppScreenshot` or the app's\n * own. A rejection toasts `feedbackToast.captureFailed` and adds nothing. */\n onCaptureScreenshot?: () => Promise<File | null>;\n /** Over the field's defaults: the contract's types and 10 MB (§3.5), the\n * `feedbackToast` refusals. The same object the rework section takes. */\n attachment?: Partial<FeedbackNoteAttachment>;\n}\n\nexport interface FeedbackEntryUploadState {\n /** For {@link ChatComposer}'s `attachment`; `undefined` without `onUpload`. */\n composerAttachment: FeedbackComposerAttachment | undefined;\n /** Upload the picked file, if any: its URL, `undefined` for none. Rejects after a\n * toast (`feedbackAttachment.attachmentUploadFailed`) when the upload fails — the\n * send then stops and the composer keeps the draft and the file. */\n upload: (file: File | null) => Promise<string | undefined>;\n /** An upload is running — add it to the composer's `pending`. */\n uploading: boolean;\n}\n\n/**\n * The rework note's file field for a reply or a comment composer (§12): one file, added,\n * captured or pasted from the clipboard into the box, the contract's types and 10 MB; and\n * the upload, awaited before the entry is sent.\n */\nexport function useFeedbackEntryUpload({\n onUpload,\n onCaptureScreenshot,\n attachment,\n}: FeedbackEntryUploadOptions): FeedbackEntryUploadState {\n const toasts = useFeedbackToastLabels();\n const fieldLabels = useKitLabels(\"feedbackAttachment\", DEFAULT_FEEDBACK_ATTACHMENT_LABELS);\n const [uploading, setUploading] = useState(false);\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 composerAttachment: FeedbackComposerAttachment | undefined = 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 buttonVariant: \"ghost\",\n buttonSize: \"sm\",\n ...attachment,\n }\n : undefined;\n\n const upload = async (file: File | null) => {\n if (!file || !onUpload) return undefined;\n setUploading(true);\n try {\n return await onUpload(file);\n } catch (error) {\n const failed = fieldLabels.attachmentUploadFailed ?? DEFAULT_FEEDBACK_ATTACHMENT_LABELS.attachmentUploadFailed!;\n toast.error(failed(file.name));\n throw error;\n } finally {\n setUploading(false);\n }\n };\n\n return { composerAttachment, upload, uploading };\n}\n"],"mappings":";AAyDyB;AAzDzB,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAC5B,SAAS,aAAa;AAEtB,SAAS,oBAAoB;AAC7B,SAAS,UAAU;AACnB,SAAS,oCAAoC,oCAAoC;AAEjF,SAAS,8BAA8B;AACvC,SAAS,4BAA4B,0BAA0B;AAC/D,SAAS,4BAA4B,yBAAyB;AAC9D,SAAS,sCAAsC;AAkCxC,SAAS,kBAAkB,EAAE,KAAK,SAAS,UAAU,GAA2B;AACrF,QAAM,SAAS,aAAa,kBAAkB,8BAA8B;AAC5E,QAAM,YAAY,WAAW;AAC7B,SACE,oBAAC,UAAK,WAAW,GAAG,mCAAmC,SAAS,GAAG,4BAA0B,KAC1F,4BAAkB,GAAG,IACpB;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL,KAAK,OAAO;AAAA,MACZ,SAAS;AAAA,MACT,MAAI;AAAA,MACJ,iBAAe;AAAA,MACf,eAAe,oBAAC,8BAA2B,KAAU,SAAS,WAAW;AAAA,MACzE,kBAAiB;AAAA,MACjB,WAAU;AAAA;AAAA,EACZ,IAEA,oBAAC,8BAA2B,KAAU,SAAS,WAAW,GAE9D;AAEJ;AAkCO,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AACF,GAAyD;AACvD,QAAM,SAAS,uBAAuB;AACtC,QAAM,cAAc,aAAa,sBAAsB,kCAAkC;AACzF,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAEhD,QAAM,UAAU,sBACZ,YAAY;AACV,QAAI;AACF,aAAO,MAAM,oBAAoB;AAAA,IACnC,QAAQ;AACN,YAAM,MAAM,OAAO,aAAa;AAChC,aAAO;AAAA,IACT;AAAA,EACF,IACA;AAEJ,QAAM,qBAA6D,WAC/D;AAAA,IACE,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,SAAS,CAAC,SAAS;AACjB,YAAM,MAAM,SAAS,SAAS,OAAO,wBAAwB,OAAO,kBAAkB;AAAA,IACxF;AAAA,IACA,qBAAqB;AAAA,IACrB,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,GAAG;AAAA,EACL,IACA;AAEJ,QAAM,SAAS,OAAO,SAAsB;AAC1C,QAAI,CAAC,QAAQ,CAAC,SAAU,QAAO;AAC/B,iBAAa,IAAI;AACjB,QAAI;AACF,aAAO,MAAM,SAAS,IAAI;AAAA,IAC5B,SAAS,OAAO;AACd,YAAM,SAAS,YAAY,0BAA0B,mCAAmC;AACxF,YAAM,MAAM,OAAO,KAAK,IAAI,CAAC;AAC7B,YAAM;AAAA,IACR,UAAE;AACA,mBAAa,KAAK;AAAA,IACpB;AAAA,EACF;AAEA,SAAO,EAAE,oBAAoB,QAAQ,UAAU;AACjD;","names":[]}
@@ -1,7 +1,9 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { CommitScope } from "../components/write-lock.js";
3
+ import type { AuthedFetcher } from "../hooks/use-authed-src.js";
3
4
  import { type LabelOverride } from "../i18n/kit-labels.js";
4
5
  import { type FeedbackCommentsLabels } from "./feedback-comment-thread.js";
6
+ import type { FeedbackEntryUploadOptions } from "./feedback-entry-file.js";
5
7
  import { DEFAULT_FEEDBACK_PUBLIC_LABELS, type FeedbackPublicLabels } from "./feedback-public-labels.js";
6
8
  import type { FeedbackComment, FeedbackPublicListItem, FeedbackPublicRecord, FeedbackPublicSort, FeedbackVoteState } from "./feedback-public-types.js";
7
9
  import { type FeedbackPageLabels, type FeedbackRenderDate } from "./feedback-table.js";
@@ -106,8 +108,18 @@ export interface FeedbackPublicDetailProps {
106
108
  /** The viewer is the app's admin: Hide / Unhide on the comments. */
107
109
  isAdmin?: boolean;
108
110
  /** `POST /feedback/{id}/comments`. Left out — a demo, a reader who may not write — no
109
- * composer. */
110
- onComment?: (body: string) => void | Promise<unknown>;
111
+ * composer. 0.47 (§12): `attachmentUrl` is the one file uploaded with it (with
112
+ * `onUpload`). */
113
+ onComment?: (body: string, attachmentUrl?: string) => void | Promise<unknown>;
114
+ /** 0.47 (§12): `POST /feedback/attachments` — the comment box then takes one file,
115
+ * pasted, captured or picked, as the rework note does. Left out, text only. */
116
+ onUpload?: FeedbackEntryUploadOptions["onUpload"];
117
+ /** 0.47: the comment box's "Capture screenshot". */
118
+ onCaptureScreenshot?: FeedbackEntryUploadOptions["onCaptureScreenshot"];
119
+ /** 0.47: the comment box's file field, over the contract's defaults. */
120
+ attachment?: FeedbackEntryUploadOptions["attachment"];
121
+ /** 0.47: the app's authenticated GET for the comments' pictures, drawn inline. */
122
+ fetcher?: AuthedFetcher | null;
111
123
  /** The admin's hide (`PATCH …/comments/{id} {hidden}`). */
112
124
  onHide?: (comment: FeedbackComment, hidden: boolean) => void | Promise<unknown>;
113
125
  /** The writer's delete (`DELETE …/comments/{id}`), after a confirm. */
@@ -136,7 +148,8 @@ export interface FeedbackPublicDetailProps {
136
148
  * add one.
137
149
  *
138
150
  * What it never draws, because the public record never carries it (§9.10): an address,
139
- * a last name, a screenshot, a file, the page the report was filed on. The body is the
140
- * server's `public_body` — the client strips nothing and adds nothing.
151
+ * a last name, the report's screenshot or files, the page the report was filed on. The
152
+ * body is the server's `public_body` — the client strips nothing and adds nothing. The
153
+ * one file it shows (0.47, §12) is a comment's own, posted with it to be seen.
141
154
  */
142
- export declare function FeedbackPublicDetail({ row, comments, onVote, isAdmin, onComment, onHide, onDelete, pending, commit, voteDisabled, renderDate: renderDateProp, now, labels: labelsProp, commentLabels, className, }: FeedbackPublicDetailProps): import("react").JSX.Element;
155
+ export declare function FeedbackPublicDetail({ row, comments, onVote, isAdmin, onComment, onHide, onDelete, onUpload, onCaptureScreenshot, attachment, fetcher, pending, commit, voteDisabled, renderDate: renderDateProp, now, labels: labelsProp, commentLabels, className, }: FeedbackPublicDetailProps): import("react").JSX.Element;
@@ -254,6 +254,10 @@ function FeedbackPublicDetail({
254
254
  onComment,
255
255
  onHide,
256
256
  onDelete,
257
+ onUpload,
258
+ onCaptureScreenshot,
259
+ attachment,
260
+ fetcher,
257
261
  pending,
258
262
  commit,
259
263
  voteDisabled,
@@ -294,6 +298,10 @@ function FeedbackPublicDetail({
294
298
  onComment,
295
299
  onHide,
296
300
  onDelete,
301
+ onUpload,
302
+ onCaptureScreenshot,
303
+ attachment,
304
+ fetcher,
297
305
  pending,
298
306
  commit,
299
307
  now,