@eifi1/ui-kit 0.37.0 → 0.38.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/README.md +11 -4
  2. package/dist/eslint/index.js +1 -1
  3. package/dist/feedback/feedback-comment-thread.d.ts +87 -0
  4. package/dist/feedback/feedback-comment-thread.js +170 -0
  5. package/dist/feedback/feedback-comment-thread.js.map +1 -0
  6. package/dist/feedback/feedback-dialog-labels.js +2 -1
  7. package/dist/feedback/feedback-dialog-labels.js.map +1 -1
  8. package/dist/feedback/feedback-dialog.d.ts +13 -0
  9. package/dist/feedback/feedback-dialog.js +12 -4
  10. package/dist/feedback/feedback-dialog.js.map +1 -1
  11. package/dist/feedback/feedback-labels.d.ts +11 -0
  12. package/dist/feedback/feedback-labels.js +4 -1
  13. package/dist/feedback/feedback-labels.js.map +1 -1
  14. package/dist/feedback/feedback-menu-labels.js +2 -1
  15. package/dist/feedback/feedback-menu-labels.js.map +1 -1
  16. package/dist/feedback/feedback-menu.d.ts +17 -3
  17. package/dist/feedback/feedback-menu.js +11 -1
  18. package/dist/feedback/feedback-menu.js.map +1 -1
  19. package/dist/feedback/feedback-public-labels.d.ts +53 -0
  20. package/dist/feedback/feedback-public-labels.js +27 -0
  21. package/dist/feedback/feedback-public-labels.js.map +1 -0
  22. package/dist/feedback/feedback-public-list.d.ts +139 -0
  23. package/dist/feedback/feedback-public-list.js +299 -0
  24. package/dist/feedback/feedback-public-list.js.map +1 -0
  25. package/dist/feedback/feedback-public-switch.d.ts +51 -0
  26. package/dist/feedback/feedback-public-switch.js +50 -0
  27. package/dist/feedback/feedback-public-switch.js.map +1 -0
  28. package/dist/feedback/feedback-public-types.d.ts +75 -0
  29. package/dist/feedback/feedback-public-types.js +2 -0
  30. package/dist/feedback/feedback-public-types.js.map +1 -0
  31. package/dist/feedback/feedback-record.d.ts +32 -1
  32. package/dist/feedback/feedback-record.js +10 -0
  33. package/dist/feedback/feedback-record.js.map +1 -1
  34. package/dist/feedback/feedback-replies-context.d.ts +7 -0
  35. package/dist/feedback/feedback-replies-context.js +7 -0
  36. package/dist/feedback/feedback-replies-context.js.map +1 -0
  37. package/dist/feedback/feedback-replies.d.ts +97 -0
  38. package/dist/feedback/feedback-replies.js +114 -0
  39. package/dist/feedback/feedback-replies.js.map +1 -0
  40. package/dist/feedback/feedback-row-detail-labels.js +1 -0
  41. package/dist/feedback/feedback-row-detail-labels.js.map +1 -1
  42. package/dist/feedback/feedback-row-detail.d.ts +47 -10
  43. package/dist/feedback/feedback-row-detail.js +51 -50
  44. package/dist/feedback/feedback-row-detail.js.map +1 -1
  45. package/dist/feedback/feedback-submit-dialog.d.ts +3 -1
  46. package/dist/feedback/feedback-submit-dialog.js +6 -1
  47. package/dist/feedback/feedback-submit-dialog.js.map +1 -1
  48. package/dist/feedback/feedback-submit.d.ts +8 -0
  49. package/dist/feedback/feedback-submit.js +3 -2
  50. package/dist/feedback/feedback-submit.js.map +1 -1
  51. package/dist/feedback/feedback-table.d.ts +15 -5
  52. package/dist/feedback/feedback-table.js +46 -5
  53. package/dist/feedback/feedback-table.js.map +1 -1
  54. package/dist/feedback/feedback-thread-parts-labels.d.ts +6 -0
  55. package/dist/feedback/feedback-thread-parts-labels.js +36 -0
  56. package/dist/feedback/feedback-thread-parts-labels.js.map +1 -0
  57. package/dist/feedback/feedback-thread.d.ts +8 -0
  58. package/dist/feedback/feedback-thread.js +7 -2
  59. package/dist/feedback/feedback-thread.js.map +1 -1
  60. package/dist/feedback/feedback-vote-button.d.ts +49 -0
  61. package/dist/feedback/feedback-vote-button.js +72 -0
  62. package/dist/feedback/feedback-vote-button.js.map +1 -0
  63. package/dist/feedback.d.ts +6 -0
  64. package/dist/feedback.js +6 -0
  65. package/dist/feedback.js.map +1 -1
  66. package/dist/i18n/defaults.js +12 -0
  67. package/dist/i18n/defaults.js.map +1 -1
  68. package/dist/i18n/german.js +69 -3
  69. package/dist/i18n/german.js.map +1 -1
  70. package/dist/i18n/kit-labels.d.ts +16 -0
  71. package/dist/i18n/kit-labels.js.map +1 -1
  72. package/dist/i18n/locales/en.js +85 -3
  73. package/dist/i18n/locales/en.js.map +3 -3
  74. package/dist/i18n/locales/es.js +69 -3
  75. package/dist/i18n/locales/es.js.map +1 -1
  76. package/dist/i18n/locales/fr.js +69 -3
  77. package/dist/i18n/locales/fr.js.map +1 -1
  78. package/dist/i18n/locales/hu.js +69 -3
  79. package/dist/i18n/locales/hu.js.map +1 -1
  80. package/dist/i18n/locales/it.js +69 -3
  81. package/dist/i18n/locales/it.js.map +1 -1
  82. package/dist/i18n/locales/zh.js +69 -3
  83. package/dist/i18n/locales/zh.js.map +1 -1
  84. package/dist/i18n/review.js +5 -0
  85. package/dist/i18n/review.js.map +1 -1
  86. package/dist/index.d.ts +2 -0
  87. package/dist/index.js +6 -0
  88. package/dist/index.js.map +1 -1
  89. package/dist/notifications/feedback-notification-types-labels.d.ts +15 -0
  90. package/dist/notifications/feedback-notification-types-labels.js +11 -0
  91. package/dist/notifications/feedback-notification-types-labels.js.map +1 -0
  92. package/dist/notifications/feedback-notification-types.d.ts +28 -0
  93. package/dist/notifications/feedback-notification-types.js +21 -0
  94. package/dist/notifications/feedback-notification-types.js.map +1 -0
  95. package/package.json +1 -1
  96. package/src/feedback/feedback-comment-thread.tsx +277 -0
  97. package/src/feedback/feedback-dialog-labels.ts +1 -0
  98. package/src/feedback/feedback-dialog.tsx +30 -2
  99. package/src/feedback/feedback-labels.ts +14 -0
  100. package/src/feedback/feedback-menu-labels.ts +1 -0
  101. package/src/feedback/feedback-menu.tsx +29 -3
  102. package/src/feedback/feedback-public-labels.ts +80 -0
  103. package/src/feedback/feedback-public-list.tsx +478 -0
  104. package/src/feedback/feedback-public-switch.tsx +102 -0
  105. package/src/feedback/feedback-public-types.ts +82 -0
  106. package/src/feedback/feedback-record.ts +39 -1
  107. package/src/feedback/feedback-replies-context.ts +9 -0
  108. package/src/feedback/feedback-replies.tsx +235 -0
  109. package/src/feedback/feedback-row-detail-labels.ts +1 -0
  110. package/src/feedback/feedback-row-detail.tsx +115 -74
  111. package/src/feedback/feedback-submit-dialog.tsx +9 -0
  112. package/src/feedback/feedback-submit.tsx +10 -1
  113. package/src/feedback/feedback-table.tsx +73 -6
  114. package/src/feedback/feedback-thread-parts-labels.ts +41 -0
  115. package/src/feedback/feedback-thread.tsx +18 -1
  116. package/src/feedback/feedback-vote-button.tsx +123 -0
  117. package/src/feedback.ts +10 -0
  118. package/src/i18n/defaults.ts +12 -0
  119. package/src/i18n/german.ts +66 -0
  120. package/src/i18n/kit-labels.tsx +16 -0
  121. package/src/i18n/locales/en.ts +8 -0
  122. package/src/i18n/locales/es.ts +66 -0
  123. package/src/i18n/locales/fr.ts +66 -0
  124. package/src/i18n/locales/hu.ts +66 -0
  125. package/src/i18n/locales/it.ts +66 -0
  126. package/src/i18n/locales/zh.ts +66 -0
  127. package/src/i18n/review.ts +5 -0
  128. package/src/index.ts +9 -0
  129. package/src/notifications/feedback-notification-types-labels.ts +24 -0
  130. package/src/notifications/feedback-notification-types.ts +46 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/feedback/feedback-record.ts"],"sourcesContent":["import { FEEDBACK_CATEGORY_ORDER } from \"./feedback-vocabulary\";\nimport type { FeedbackCategory, FeedbackStatus } from \"./feedback-vocabulary\";\n\n/**\n * One feedback report as the three apps send it, and the facts the kit reads off it.\n *\n * Until 0.27 the inbox parts took no report at all (\"no `Feedback` type in this file\",\n * feedback-inbox.tsx): keksdose kept its reporter context in a JSON column, kastlan a\n * thinner copy of it, Kurvenschmiede a `page_path` and the bytes in the row. Marcel's\n * feedback round (2026-10-04, docs/feedback-harmonization.md) settled one API contract\n * for all three — keksdose's, read off its code — so the apps now share one shape and the\n * kit can take a row instead of a dozen loose values. This file is that shape (§3.1,\n * §3.2), the contract's constants (§3.4, §3.5, §4.3) and the readers and writers of the\n * one field whose format is itself contract: the body, which carries the rework rounds\n * (§3.4) — lifted from keksdose `frontend/src/features/feedback/body-attachments.ts`.\n *\n * Plain functions and data, no components: everything here is as usable from a loop\n * script's helper or a test as from a page.\n */\n\n/* ── The resource (§3.1, §3.2) ────────────────────────────────────────────── */\n\n/** Which copy of an app a report came from — keksdose `app/deploy-environment.ts`.\n * Any other string is read as \"not prod\" (the admin list shows it upper-cased as a\n * chip, §4.3), so an app with a `staging` loses nothing. */\nexport type FeedbackEnvironment = \"prod\" | \"dev\" | \"local\";\n\n/**\n * The reporter's context, written by the submit dialog (keksdose\n * `use-feedback-dialog.tsx:105`) — §3.2 of the contract.\n *\n * **Every key is optional on read**, and a reader treats a missing one as \"unknown\":\n * kastlan's client sends six of them (no email, no version), Kurvenschmiede's old rows are\n * backfilled from two columns with a path-only `url`, crash rows add their own (and\n * `origin` / `environment` from the crash payload, §3.6 — older crash rows have neither),\n * and an erased account's row keeps only an allow-list (§3.2: `environment` stays,\n * `origin` goes). Extra keys are allowed — a server may add its own — hence the index\n * signature.\n */\nexport interface FeedbackContext {\n /** The full `location.href` at open time; `\"\"` when \"Attach current page URL\" was off.\n * Readers also accept a path-only value (Kurvenschmiede's backfilled rows). */\n url?: string;\n /** Its pathname; `\"\"` when the URL was withheld. */\n route?: string;\n /** `location.origin` — which copy of the app, not personal; never withheld. */\n origin?: string;\n /** {@link FeedbackEnvironment}, or whatever the app calls its other copies. */\n environment?: FeedbackEnvironment | (string & {});\n /** The submitter, as a snapshot. The server should overwrite the three `user_*` keys\n * from the session (Kurvenschmiede does), so nobody files in someone else's name. */\n user_id?: number | null;\n user_email?: string | null;\n user_display_name?: string | null;\n /** `\"406x816\"`. */\n viewport?: string;\n /** `navigator.userAgent`. */\n ua?: string;\n /** The app build (`__APP_VERSION__`). */\n version?: string;\n // Crash rows (server-written, keksdose `feedback_service.py:346`).\n fingerprint?: string;\n /** Which error boundary caught it. */\n boundary?: \"app\" | \"page\" | (string & {});\n online?: boolean;\n occurrences?: number;\n first_seen_at?: string;\n last_seen_at?: string;\n auto_reported?: boolean;\n [key: string]: unknown;\n}\n\n/**\n * One report — `FeedbackResponse`, keksdose `schemas/feedback.py:117`, §3.1 of the\n * contract. What `GET /feedback`, `GET /feedback/my`, `POST /feedback` and\n * `PATCH /feedback/{id}` answer in all three apps.\n *\n * Extra fields are allowed and ignored (kastlan's `company_id`, `user_name`): an app's\n * own row type with more fields is assignable to this one as it stands.\n *\n * There is **no rework counter field** — {@link reworkCount} reads it off the body, so\n * nothing can forget to set it.\n */\nexport interface FeedbackRecord {\n id: number;\n /** `null`: the author's account was erased (keksdose live #275). */\n user_id: number | null;\n /** The admin list only (joined); `null` — or absent — on `/my`, create and update. */\n user_email?: string | null;\n /** 1–255 characters, never blank. */\n title: string;\n /** `\"\"` when none. Rework rounds are appended here (§3.4) — read it with\n * {@link splitDescription} / {@link splitBodyAttachments}, write it with\n * {@link appendRework} / {@link replaceDescription}. */\n body: string;\n category: FeedbackCategory;\n status: FeedbackStatus;\n /** §3.2; `null` on rows that have none. */\n context: FeedbackContext | null;\n /** The ONE captured screenshot's attachment URL, or `null`. */\n screenshot_url: string | null;\n /** Up to 5 other files; `null` = none. Optional because a server older than the\n * column sends no key at all (keksdose dev #578 met exactly that). */\n attachment_urls?: string[] | null;\n /** The team's answer; `null` = none written. */\n outcome: string | null;\n /** Set on ENTERING `DONE` / `WONT_DO`, cleared on leaving them. ISO 8601. */\n resolved_at: string | null;\n /** ISO 8601. */\n created_at: string;\n /** ISO 8601. */\n updated_at: string;\n}\n\n/* ── Constants (§3.4, §3.5, §4.3) ─────────────────────────────────────────── */\n\n// The attachment field's three defaults live here, not in feedback-attachment.tsx\n// (which re-exports them), since 0.34 (MOD-1, refactor audit 2026-10). This module is in\n// every app's top bar (the menu's categories), and FEEDBACK_ATTACHMENT_ACCEPT below is\n// built on DEFAULT_ATTACHMENT_ACCEPT: imported from the field's module, it tied the top\n// bar to the field, the lazily loaded dialog's heaviest part, for three values.\n\n/** The image types `FeedbackAttachmentField` takes when `accept` is not given. */\nexport const DEFAULT_ATTACHMENT_ACCEPT = [\"image/png\", \"image/jpeg\", \"image/webp\", \"image/gif\"];\n/** 10 MB, the contract's size limit for one file (§3.5). */\nexport const DEFAULT_MAX_ATTACHMENT_BYTES = 10 * 1024 * 1024;\n/** How many files `<FeedbackAttachmentField multiple>` takes when `max` is not given\n * (0.15.5). Five photos of one problem is already a lot to look through; a report\n * that needs more is a conversation, which the thread is for. */\nexport const DEFAULT_MAX_ATTACHMENTS = 5;\n\n/**\n * What a report may carry (§3.5, keksdose `upload_guards.py:197` and its\n * `attachment-options.ts`): the kit's four image types plus a PDF and a plain-text log\n * (keksdose feedback #87). SVG and HTML stay out — both are script-carrying documents in\n * an image's clothing. For `FeedbackAttachmentField` / `FeedbackDialog`'s `accept`, with\n * `DEFAULT_MAX_ATTACHMENTS` (5) and `DEFAULT_MAX_ATTACHMENT_BYTES` (10 MB) above, which\n * already are the contract's limits.\n *\n * A plain array (not frozen) because `accept` takes `string[]`, as\n * `DEFAULT_ATTACHMENT_ACCEPT` does — copy it before changing it.\n */\nexport const FEEDBACK_ATTACHMENT_ACCEPT: string[] = [\n ...DEFAULT_ATTACHMENT_ACCEPT,\n \"application/pdf\",\n \"text/plain\",\n];\n\n/**\n * The categories a person can pick — every one but `CRASH`, in triage order (Bug, Idea,\n * Question, Other: the feedback menu's rows, §4.1). `CRASH` is filed by an error boundary\n * and the server refuses it by hand with a 422 (keksdose `_reject_manual_crash`), so no\n * picker may offer it.\n */\nexport const FEEDBACK_PICKABLE_CATEGORIES: readonly FeedbackCategory[] = Object.freeze(\n FEEDBACK_CATEGORY_ORDER.filter((category) => category !== \"CRASH\"),\n);\n\n/**\n * The statuses a report can be sent back for **rework** from (§3.4): everything the team\n * has answered — `IN_EVALUATION`, `NEEDS_LIVE_TEST`, `POSTPONED`, `DONE`, `WONT_DO`. On\n * these the server reopens the row when the body grows by a rework block; on `OPEN`,\n * `READY` and `IN_PROGRESS` there is nothing to send back yet.\n */\nexport const FEEDBACK_REWORKABLE_STATUSES: readonly FeedbackStatus[] = Object.freeze([\n \"IN_EVALUATION\",\n \"NEEDS_LIVE_TEST\",\n \"POSTPONED\",\n \"DONE\",\n \"WONT_DO\",\n] as const);\n\n/**\n * The statuses in which the AUTHOR may still edit title, body and category (§3.4,\n * keksdose `canAuthorEdit`, `feedback-page.tsx:398`): `OPEN`, `READY` and `IN_PROGRESS`.\n * Once the team has answered, the description is what they answered and stays as it\n * was; a correction goes in as a rework.\n */\nexport const FEEDBACK_AUTHOR_EDITABLE_STATUSES: readonly FeedbackStatus[] = Object.freeze([\n \"OPEN\",\n \"READY\",\n \"IN_PROGRESS\",\n] as const);\n\n/**\n * The statuses that wait on the person triaging: filed and not yet triaged (`OPEN`,\n * since READY took over \"released for implementation\" in 0.31, feedback contract §8.2),\n * answered and handed back for a verdict, or answered and only checkable on a deployed\n * build (keksdose `AWAITING_VERDICT`, live #330). The phone's \"Only what is waiting for\n * you\" toggle narrows the inbox to exactly these (§4.3).\n */\nexport const FEEDBACK_AWAITING_STATUSES: readonly FeedbackStatus[] = Object.freeze([\n \"OPEN\",\n \"IN_EVALUATION\",\n \"NEEDS_LIVE_TEST\",\n] as const);\n\n/* ── The body (§3.4) ──────────────────────────────────────────────────────── */\n\n/**\n * The path every app serves attachments under (§3.3), and a key after it. Keys are\n * OPAQUE (§3.5): keksdose and Kurvenschmiede content-address (`<sha12>.<ext>`), kastlan's\n * storage keys are `<uuid32>_<sha12>.<ext>` — so `[\\w.-]+`, never a fixed hex shape.\n */\nconst ATTACHMENT_URL = /^\\/api\\/v1\\/feedback\\/attachments\\/[\\w.-]+$/;\n\n/**\n * One file line in a body. The marker is deliberately narrow — this path and nothing\n * else, alone on its line — so no sentence a user writes can be mistaken for one\n * (keksdose live #291). It says `[screenshot]` for a PDF or a text log too: the name is\n * history, the format is contract.\n */\nconst ATTACHMENT_LINE = /^\\[screenshot\\]\\s+(\\/api\\/v1\\/feedback\\/attachments\\/[\\w.-]+)\\s*$/;\n\n/**\n * The `--- REWORK <stamp> ---` rule a rework opens with. Anchored and whole-line for the\n * same reason as the file marker: \"I did a REWORK --- honestly\" is a sentence, not a\n * round. kastlan's folded `--- COMMENT <stamp> · <name> ---` blocks (§7.7) never match.\n */\nconst REWORK_RULE = /^---\\s*REWORK\\b.*---$/;\n\n/** Any appended block's opening rule: a rework round, or a kastlan comment folded into\n * the body by its one-time migration (§7.7). */\nconst BLOCK_RULE = /^---\\s*(?:REWORK|COMMENT)\\b.*---$/;\n\n/** The body line for one uploaded attachment — what {@link appendRework} writes under\n * the note. */\nexport function feedbackAttachmentLine(url: string): string {\n return `[screenshot] ${url}`;\n}\n\n/**\n * A rework round appended to a body — the exact text `PATCH /feedback/{id}` takes as the\n * new `body` (§3.4; keksdose `submitRework`, `feedback-page.tsx:350`):\n *\n * ```text\n * <old body>\\n\\n--- REWORK 2026-10-04 09:12 ---\\n<note>\\n[screenshot] /api/v1/feedback/attachments/<key>\n * ```\n *\n * - The stamp is UTC, `YYYY-MM-DD HH:MM` (`toISOString().slice(0, 16)`), from `now`.\n * - The old body is kept byte for byte, so the result STRICTLY EXTENDS it — which is\n * how the server recognises an append and reopens an answered row (keksdose\n * `_is_rework_append`, live #331). `\\n\\n` is left out when the old body is `\"\"`.\n * - ONE file per round (`url`), uploaded first by the caller: a body appended without\n * it would be a rework whose evidence never arrived.\n *\n * **Returns `null` when the trimmed note is empty** — a file alone cannot be sent\n * (keksdose `:577`). Null rather than a throw because an empty note is something a\n * person does, not a bug, and the type then makes every caller decide what an empty\n * box means before anything can reach the PATCH.\n *\n * **Throws a `TypeError` when `url` is not an attachment URL** of the contract's shape\n * (`/api/v1/feedback/attachments/<key>`): that one IS a bug — the upload handed back\n * something foreign — and written anyway it would sit in the body as prose that no\n * reader recognises as a file.\n */\nexport function appendRework(\n body: string,\n note: string,\n url?: string | null,\n now: Date = new Date(),\n): string | null {\n const text = note.trim();\n if (!text) return null;\n if (url && !ATTACHMENT_URL.test(url)) {\n throw new TypeError(`appendRework: not a feedback attachment URL: ${url}`);\n }\n const stamp = now.toISOString().slice(0, 16).replace(\"T\", \" \");\n const block = `--- REWORK ${stamp} ---\\n${url ? `${text}\\n${feedbackAttachmentLine(url)}` : text}`;\n return body ? `${body}\\n\\n${block}` : block;\n}\n\n/**\n * How many times a report has been sent back — the count of `--- REWORK … ---` rule\n * lines in its body (keksdose live #331: the \"category for items in rework\", derived\n * rather than stored, so nothing can forget to set it or leave it set). Folded kastlan\n * comments do not count.\n */\nexport function reworkCount(body: string): number {\n let n = 0;\n for (const line of body.split(\"\\n\")) if (REWORK_RULE.test(line.trim())) n += 1;\n return n;\n}\n\n/**\n * A body split into the prose to render and the files to show beside it, in body order.\n *\n * The file lines are stripped from the text: they are a location, not something anybody\n * wrote, and left in they would put a raw URL in the middle of a sentence. Trailing blank\n * lines go (what a stripped marker leaves at the end of a note); every blank line between\n * paragraphs stays.\n */\nexport function splitBodyAttachments(body: string): { text: string; urls: string[] } {\n const urls: string[] = [];\n const kept: string[] = [];\n for (const line of body.split(\"\\n\")) {\n const match = ATTACHMENT_LINE.exec(line.trim());\n if (match) urls.push(match[1]);\n else kept.push(line);\n }\n return { text: kept.join(\"\\n\").replace(/\\n+$/, \"\"), urls };\n}\n\n/** A body cut where its first appended block begins. */\nfunction cutAtFirstBlock(body: string): { head: string; appended: string } {\n const lines = body.split(\"\\n\");\n const at = lines.findIndex((line) => BLOCK_RULE.test(line.trim()));\n if (at === -1) return { head: body, appended: \"\" };\n return { head: lines.slice(0, at).join(\"\\n\"), appended: lines.slice(at).join(\"\\n\") };\n}\n\n/**\n * The ORIGINAL description, apart from everything appended to it since (§4.4.1).\n *\n * - `description` — what the author wrote when filing, without its file lines and\n * trailing blank lines: the text the \"Edit description\" editor holds.\n * - `appended` — every `--- REWORK … ---` round and folded `--- COMMENT … ---` block,\n * from the first one's rule line to the end, verbatim (`\"\"` when there are none).\n *\n * keksdose's editor edits the raw body (`initial={fb.body}`, `feedback-page.tsx:420`), so\n * an author tidying a typo could delete the rework history and the file lines with it.\n * The kit's editor holds `description` only and saves through\n * {@link replaceDescription}, which puts the rest back unchanged.\n */\nexport function splitDescription(body: string): { description: string; appended: string } {\n const { head, appended } = cutAtFirstBlock(body);\n return { description: splitBodyAttachments(head).text, appended };\n}\n\n/**\n * The body with its original description replaced and everything else kept — the file\n * lines of the original part (after the new text, in their order) and the appended\n * blocks (verbatim, after a blank line). The new text is trimmed; clearing it saves the\n * rest alone (`\"\"` when there is no rest).\n *\n * `replaceDescription(body, splitDescription(body).description)` gives back a canonical\n * body unchanged — a trimmed description, then each block after one blank line, as the\n * dialog and {@link appendRework} write them.\n */\nexport function replaceDescription(body: string, description: string): string {\n const { head, appended } = cutAtFirstBlock(body);\n const files = splitBodyAttachments(head).urls.map(feedbackAttachmentLine);\n const text = description.trim();\n const top = [...(text ? [text] : []), ...files].join(\"\\n\");\n if (!appended) return top;\n return top ? `${top}\\n\\n${appended}` : appended;\n}\n\n/**\n * Whether an attachment URL is a picture (keksdose dev #578). The upload route takes\n * PDFs and text logs too and serves them as downloads, never inline, so an `<img>` on\n * one shows a broken icon. The key's extension is the server's own statement of the\n * type (minted from the sniffed content), so it is the thing to read.\n */\nexport function isImageAttachment(url: string): boolean {\n return /\\.(png|jpe?g|webp|gif)$/i.test(url);\n}\n\n/** The file name an attachment downloads as — its key, the last segment of the URL. */\nexport function attachmentName(url: string): string {\n return url.slice(url.lastIndexOf(\"/\") + 1);\n}\n"],"mappings":";AAAA,SAAS,+BAA+B;AA2HjC,MAAM,4BAA4B,CAAC,aAAa,cAAc,cAAc,WAAW;AAEvF,MAAM,+BAA+B,KAAK,OAAO;AAIjD,MAAM,0BAA0B;AAahC,MAAM,6BAAuC;AAAA,EAClD,GAAG;AAAA,EACH;AAAA,EACA;AACF;AAQO,MAAM,+BAA4D,OAAO;AAAA,EAC9E,wBAAwB,OAAO,CAAC,aAAa,aAAa,OAAO;AACnE;AAQO,MAAM,+BAA0D,OAAO,OAAO;AAAA,EACnF;AAAA,EACA;AAAA,EACA;AAAA,EACA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KAAK,KAAK,IAAI,EAAE,QAAQ,QAAQ,EAAE,GAAG,KAAK;AAC3D;AAGA,SAAS,gBAAgB,MAAkD;AACzE,QAAM,QAAQ,KAAK,MAAM,IAAI;AAC7B,QAAM,KAAK,MAAM,UAAU,CAAC,SAAS,WAAW,KAAK,KAAK,KAAK,CAAC,CAAC;AACjE,MAAI,OAAO,GAAI,QAAO,EAAE,MAAM,MAAM,UAAU,GAAG;AACjD,SAAO,EAAE,MAAM,MAAM,MAAM,GAAG,EAAE,EAAE,KAAK,IAAI,GAAG,UAAU,MAAM,MAAM,EAAE,EAAE,KAAK,IAAI,EAAE;AACrF;AAeO,SAAS,iBAAiB,MAAyD;AACxF,QAAM,EAAE,MAAM,SAAS,IAAI,gBAAgB,IAAI;AAC/C,SAAO,EAAE,aAAa,qBAAqB,IAAI,EAAE,MAAM,SAAS;AAClE;AAYO,SAAS,mBAAmB,MAAc,aAA6B;AAC5E,QAAM,EAAE,MAAM,SAAS,IAAI,gBAAgB,IAAI;AAC/C,QAAM,QAAQ,qBAAqB,IAAI,EAAE,KAAK,IAAI,sBAAsB;AACxE,QAAM,OAAO,YAAY,KAAK;AAC9B,QAAM,MAAM,CAAC,GAAI,OAAO,CAAC,IAAI,IAAI,CAAC,GAAI,GAAG,KAAK,EAAE,KAAK,IAAI;AACzD,MAAI,CAAC,SAAU,QAAO;AACtB,SAAO,MAAM,GAAG,GAAG;AAAA;AAAA,EAAO,QAAQ,KAAK;AACzC;AAQO,SAAS,kBAAkB,KAAsB;AACtD,SAAO,2BAA2B,KAAK,GAAG;AAC5C;AAGO,SAAS,eAAe,KAAqB;AAClD,SAAO,IAAI,MAAM,IAAI,YAAY,GAAG,IAAI,CAAC;AAC3C;","names":[]}
1
+ {"version":3,"sources":["../../src/feedback/feedback-record.ts"],"sourcesContent":["import { FEEDBACK_CATEGORY_ORDER } from \"./feedback-vocabulary\";\nimport type { FeedbackCategory, FeedbackStatus } from \"./feedback-vocabulary\";\nimport type { FeedbackReply } from \"./feedback-public-types\";\n\n/**\n * One feedback report as the three apps send it, and the facts the kit reads off it.\n *\n * Until 0.27 the inbox parts took no report at all (\"no `Feedback` type in this file\",\n * feedback-inbox.tsx): keksdose kept its reporter context in a JSON column, kastlan a\n * thinner copy of it, Kurvenschmiede a `page_path` and the bytes in the row. Marcel's\n * feedback round (2026-10-04, docs/feedback-harmonization.md) settled one API contract\n * for all three — keksdose's, read off its code — so the apps now share one shape and the\n * kit can take a row instead of a dozen loose values. This file is that shape (§3.1,\n * §3.2), the contract's constants (§3.4, §3.5, §4.3) and the readers and writers of the\n * one field whose format is itself contract: the body, which carries the rework rounds\n * (§3.4) — lifted from keksdose `frontend/src/features/feedback/body-attachments.ts`.\n *\n * Plain functions and data, no components: everything here is as usable from a loop\n * script's helper or a test as from a page.\n */\n\n/* ── The resource (§3.1, §3.2) ────────────────────────────────────────────── */\n\n/** Which copy of an app a report came from — keksdose `app/deploy-environment.ts`.\n * Any other string is read as \"not prod\" (the admin list shows it upper-cased as a\n * chip, §4.3), so an app with a `staging` loses nothing. */\nexport type FeedbackEnvironment = \"prod\" | \"dev\" | \"local\";\n\n/**\n * The reporter's context, written by the submit dialog (keksdose\n * `use-feedback-dialog.tsx:105`) — §3.2 of the contract.\n *\n * **Every key is optional on read**, and a reader treats a missing one as \"unknown\":\n * kastlan's client sends six of them (no email, no version), Kurvenschmiede's old rows are\n * backfilled from two columns with a path-only `url`, crash rows add their own (and\n * `origin` / `environment` from the crash payload, §3.6 — older crash rows have neither),\n * and an erased account's row keeps only an allow-list (§3.2: `environment` stays,\n * `origin` goes). Extra keys are allowed — a server may add its own — hence the index\n * signature.\n */\nexport interface FeedbackContext {\n /** The full `location.href` at open time; `\"\"` when \"Attach current page URL\" was off.\n * Readers also accept a path-only value (Kurvenschmiede's backfilled rows). */\n url?: string;\n /** Its pathname; `\"\"` when the URL was withheld. */\n route?: string;\n /** `location.origin` — which copy of the app, not personal; never withheld. */\n origin?: string;\n /** {@link FeedbackEnvironment}, or whatever the app calls its other copies. */\n environment?: FeedbackEnvironment | (string & {});\n /** The submitter, as a snapshot. The server should overwrite the three `user_*` keys\n * from the session (Kurvenschmiede does), so nobody files in someone else's name. */\n user_id?: number | null;\n user_email?: string | null;\n user_display_name?: string | null;\n /** `\"406x816\"`. */\n viewport?: string;\n /** `navigator.userAgent`. */\n ua?: string;\n /** The app build (`__APP_VERSION__`). */\n version?: string;\n // Crash rows (server-written, keksdose `feedback_service.py:346`).\n fingerprint?: string;\n /** Which error boundary caught it. */\n boundary?: \"app\" | \"page\" | (string & {});\n online?: boolean;\n occurrences?: number;\n first_seen_at?: string;\n last_seen_at?: string;\n auto_reported?: boolean;\n [key: string]: unknown;\n}\n\n/**\n * One report — `FeedbackResponse`, keksdose `schemas/feedback.py:117`, §3.1 of the\n * contract. What `GET /feedback`, `GET /feedback/my`, `POST /feedback` and\n * `PATCH /feedback/{id}` answer in all three apps.\n *\n * Extra fields are allowed and ignored (kastlan's `company_id`, `user_name`): an app's\n * own row type with more fields is assignable to this one as it stands.\n *\n * There is **no rework counter field** — {@link reworkCount} reads it off the body, so\n * nothing can forget to set it.\n */\nexport interface FeedbackRecord {\n id: number;\n /** `null`: the author's account was erased (keksdose live #275). */\n user_id: number | null;\n /** The admin list only (joined); `null` — or absent — on `/my`, create and update. */\n user_email?: string | null;\n /** 1–255 characters, never blank. */\n title: string;\n /** `\"\"` when none. Rework rounds are appended here (§3.4) — read it with\n * {@link splitDescription} / {@link splitBodyAttachments}, write it with\n * {@link appendRework} / {@link replaceDescription}. */\n body: string;\n category: FeedbackCategory;\n status: FeedbackStatus;\n /** §3.2; `null` on rows that have none. */\n context: FeedbackContext | null;\n /** The ONE captured screenshot's attachment URL, or `null`. */\n screenshot_url: string | null;\n /** Up to 5 other files; `null` = none. Optional because a server older than the\n * column sends no key at all (keksdose dev #578 met exactly that). */\n attachment_urls?: string[] | null;\n /** The team's answer; `null` = none written. **Frozen since 0.38** (§9.7): answered\n * as stored for one release, written by nothing, then dropped — the answer is\n * {@link FeedbackRecord.replies} now. */\n outcome: string | null;\n /** Set on ENTERING `DONE` / `WONT_DO`, cleared on leaving them. ISO 8601. */\n resolved_at: string | null;\n /** ISO 8601. */\n created_at: string;\n /** ISO 8601. */\n updated_at: string;\n // ── Round 0.38 (§9.3): all optional, so an app without public parts sends none. ──\n /** The admin: the full name; the author: their own; `null`: none to show. */\n author_name?: string | null;\n /** The viewer filed it. */\n mine?: boolean | null;\n /** Visible to the app's other users (§9.3); never on a CRASH. */\n public?: boolean | null;\n /** Made public by the 0.38 migration: the author may switch it off at any status. */\n filed_private?: boolean | null;\n /** People who want this (the author's own vote included, §9.6). */\n votes?: number | null;\n /** The viewer's vote. */\n voted?: boolean | null;\n /** Comments (an admin's count includes hidden ones). */\n comment_count?: number | null;\n /** The admin's answers, oldest first (§9.7). Absent: a server before 0.38 — read\n * `outcome` instead. */\n replies?: FeedbackReply[] | null;\n}\n\n/* ── Constants (§3.4, §3.5, §4.3) ─────────────────────────────────────────── */\n\n// The attachment field's three defaults live here, not in feedback-attachment.tsx\n// (which re-exports them), since 0.34 (MOD-1, refactor audit 2026-10). This module is in\n// every app's top bar (the menu's categories), and FEEDBACK_ATTACHMENT_ACCEPT below is\n// built on DEFAULT_ATTACHMENT_ACCEPT: imported from the field's module, it tied the top\n// bar to the field, the lazily loaded dialog's heaviest part, for three values.\n\n/** The image types `FeedbackAttachmentField` takes when `accept` is not given. */\nexport const DEFAULT_ATTACHMENT_ACCEPT = [\"image/png\", \"image/jpeg\", \"image/webp\", \"image/gif\"];\n/** 10 MB, the contract's size limit for one file (§3.5). */\nexport const DEFAULT_MAX_ATTACHMENT_BYTES = 10 * 1024 * 1024;\n/** How many files `<FeedbackAttachmentField multiple>` takes when `max` is not given\n * (0.15.5). Five photos of one problem is already a lot to look through; a report\n * that needs more is a conversation, which the thread is for. */\nexport const DEFAULT_MAX_ATTACHMENTS = 5;\n\n/**\n * What a report may carry (§3.5, keksdose `upload_guards.py:197` and its\n * `attachment-options.ts`): the kit's four image types plus a PDF and a plain-text log\n * (keksdose feedback #87). SVG and HTML stay out — both are script-carrying documents in\n * an image's clothing. For `FeedbackAttachmentField` / `FeedbackDialog`'s `accept`, with\n * `DEFAULT_MAX_ATTACHMENTS` (5) and `DEFAULT_MAX_ATTACHMENT_BYTES` (10 MB) above, which\n * already are the contract's limits.\n *\n * A plain array (not frozen) because `accept` takes `string[]`, as\n * `DEFAULT_ATTACHMENT_ACCEPT` does — copy it before changing it.\n */\nexport const FEEDBACK_ATTACHMENT_ACCEPT: string[] = [\n ...DEFAULT_ATTACHMENT_ACCEPT,\n \"application/pdf\",\n \"text/plain\",\n];\n\n/**\n * The categories a person can pick — every one but `CRASH`, in triage order (Bug, Idea,\n * Question, Other: the feedback menu's rows, §4.1). `CRASH` is filed by an error boundary\n * and the server refuses it by hand with a 422 (keksdose `_reject_manual_crash`), so no\n * picker may offer it.\n */\nexport const FEEDBACK_PICKABLE_CATEGORIES: readonly FeedbackCategory[] = Object.freeze(\n FEEDBACK_CATEGORY_ORDER.filter((category) => category !== \"CRASH\"),\n);\n\n/**\n * The statuses a report can be sent back for **rework** from (§3.4): everything the team\n * has answered — `IN_EVALUATION`, `NEEDS_LIVE_TEST`, `POSTPONED`, `DONE`, `WONT_DO`. On\n * these the server reopens the row when the body grows by a rework block; on `OPEN`,\n * `READY` and `IN_PROGRESS` there is nothing to send back yet.\n */\nexport const FEEDBACK_REWORKABLE_STATUSES: readonly FeedbackStatus[] = Object.freeze([\n \"IN_EVALUATION\",\n \"NEEDS_LIVE_TEST\",\n \"POSTPONED\",\n \"DONE\",\n \"WONT_DO\",\n] as const);\n\n/**\n * The statuses in which the AUTHOR may still edit title, body and category (§3.4,\n * keksdose `canAuthorEdit`, `feedback-page.tsx:398`): `OPEN`, `READY` and `IN_PROGRESS`.\n * Once the team has answered, the description is what they answered and stays as it\n * was; a correction goes in as a rework.\n */\nexport const FEEDBACK_AUTHOR_EDITABLE_STATUSES: readonly FeedbackStatus[] = Object.freeze([\n \"OPEN\",\n \"READY\",\n \"IN_PROGRESS\",\n] as const);\n\n/**\n * The statuses that wait on the person triaging: filed and not yet triaged (`OPEN`,\n * since READY took over \"released for implementation\" in 0.31, feedback contract §8.2),\n * answered and handed back for a verdict, or answered and only checkable on a deployed\n * build (keksdose `AWAITING_VERDICT`, live #330). The phone's \"Only what is waiting for\n * you\" toggle narrows the inbox to exactly these (§4.3).\n */\nexport const FEEDBACK_AWAITING_STATUSES: readonly FeedbackStatus[] = Object.freeze([\n \"OPEN\",\n \"IN_EVALUATION\",\n \"NEEDS_LIVE_TEST\",\n] as const);\n\n/**\n * The **decided** statuses (§9.7, decision 13): `DONE`, `WONT_DO`, `POSTPONED`. A\n * status-only move into one tells the author nothing (a status alone sends no\n * notification), so the row detail nudges the admin toward a reply until one with that\n * `status_to` exists.\n */\nexport const FEEDBACK_DECIDED_STATUSES: readonly FeedbackStatus[] = Object.freeze([\n \"DONE\",\n \"WONT_DO\",\n \"POSTPONED\",\n] as const);\n\n/** A comment's longest body after trimming (§9.8). */\nexport const FEEDBACK_COMMENT_MAX = 4000;\n/** A reply's longest body after trimming (§9.7). */\nexport const FEEDBACK_REPLY_MAX = 8000;\n\n/* ── The body (§3.4) ──────────────────────────────────────────────────────── */\n\n/**\n * The path every app serves attachments under (§3.3), and a key after it. Keys are\n * OPAQUE (§3.5): keksdose and Kurvenschmiede content-address (`<sha12>.<ext>`), kastlan's\n * storage keys are `<uuid32>_<sha12>.<ext>` — so `[\\w.-]+`, never a fixed hex shape.\n */\nconst ATTACHMENT_URL = /^\\/api\\/v1\\/feedback\\/attachments\\/[\\w.-]+$/;\n\n/**\n * One file line in a body. The marker is deliberately narrow — this path and nothing\n * else, alone on its line — so no sentence a user writes can be mistaken for one\n * (keksdose live #291). It says `[screenshot]` for a PDF or a text log too: the name is\n * history, the format is contract.\n */\nconst ATTACHMENT_LINE = /^\\[screenshot\\]\\s+(\\/api\\/v1\\/feedback\\/attachments\\/[\\w.-]+)\\s*$/;\n\n/**\n * The `--- REWORK <stamp> ---` rule a rework opens with. Anchored and whole-line for the\n * same reason as the file marker: \"I did a REWORK --- honestly\" is a sentence, not a\n * round. kastlan's folded `--- COMMENT <stamp> · <name> ---` blocks (§7.7) never match.\n */\nconst REWORK_RULE = /^---\\s*REWORK\\b.*---$/;\n\n/** Any appended block's opening rule: a rework round, or a kastlan comment folded into\n * the body by its one-time migration (§7.7). */\nconst BLOCK_RULE = /^---\\s*(?:REWORK|COMMENT)\\b.*---$/;\n\n/** The body line for one uploaded attachment — what {@link appendRework} writes under\n * the note. */\nexport function feedbackAttachmentLine(url: string): string {\n return `[screenshot] ${url}`;\n}\n\n/**\n * A rework round appended to a body — the exact text `PATCH /feedback/{id}` takes as the\n * new `body` (§3.4; keksdose `submitRework`, `feedback-page.tsx:350`):\n *\n * ```text\n * <old body>\\n\\n--- REWORK 2026-10-04 09:12 ---\\n<note>\\n[screenshot] /api/v1/feedback/attachments/<key>\n * ```\n *\n * - The stamp is UTC, `YYYY-MM-DD HH:MM` (`toISOString().slice(0, 16)`), from `now`.\n * - The old body is kept byte for byte, so the result STRICTLY EXTENDS it — which is\n * how the server recognises an append and reopens an answered row (keksdose\n * `_is_rework_append`, live #331). `\\n\\n` is left out when the old body is `\"\"`.\n * - ONE file per round (`url`), uploaded first by the caller: a body appended without\n * it would be a rework whose evidence never arrived.\n *\n * **Returns `null` when the trimmed note is empty** — a file alone cannot be sent\n * (keksdose `:577`). Null rather than a throw because an empty note is something a\n * person does, not a bug, and the type then makes every caller decide what an empty\n * box means before anything can reach the PATCH.\n *\n * **Throws a `TypeError` when `url` is not an attachment URL** of the contract's shape\n * (`/api/v1/feedback/attachments/<key>`): that one IS a bug — the upload handed back\n * something foreign — and written anyway it would sit in the body as prose that no\n * reader recognises as a file.\n */\nexport function appendRework(\n body: string,\n note: string,\n url?: string | null,\n now: Date = new Date(),\n): string | null {\n const text = note.trim();\n if (!text) return null;\n if (url && !ATTACHMENT_URL.test(url)) {\n throw new TypeError(`appendRework: not a feedback attachment URL: ${url}`);\n }\n const stamp = now.toISOString().slice(0, 16).replace(\"T\", \" \");\n const block = `--- REWORK ${stamp} ---\\n${url ? `${text}\\n${feedbackAttachmentLine(url)}` : text}`;\n return body ? `${body}\\n\\n${block}` : block;\n}\n\n/**\n * How many times a report has been sent back — the count of `--- REWORK … ---` rule\n * lines in its body (keksdose live #331: the \"category for items in rework\", derived\n * rather than stored, so nothing can forget to set it or leave it set). Folded kastlan\n * comments do not count.\n */\nexport function reworkCount(body: string): number {\n let n = 0;\n for (const line of body.split(\"\\n\")) if (REWORK_RULE.test(line.trim())) n += 1;\n return n;\n}\n\n/**\n * A body split into the prose to render and the files to show beside it, in body order.\n *\n * The file lines are stripped from the text: they are a location, not something anybody\n * wrote, and left in they would put a raw URL in the middle of a sentence. Trailing blank\n * lines go (what a stripped marker leaves at the end of a note); every blank line between\n * paragraphs stays.\n */\nexport function splitBodyAttachments(body: string): { text: string; urls: string[] } {\n const urls: string[] = [];\n const kept: string[] = [];\n for (const line of body.split(\"\\n\")) {\n const match = ATTACHMENT_LINE.exec(line.trim());\n if (match) urls.push(match[1]);\n else kept.push(line);\n }\n return { text: kept.join(\"\\n\").replace(/\\n+$/, \"\"), urls };\n}\n\n/** A body cut where its first appended block begins. */\nfunction cutAtFirstBlock(body: string): { head: string; appended: string } {\n const lines = body.split(\"\\n\");\n const at = lines.findIndex((line) => BLOCK_RULE.test(line.trim()));\n if (at === -1) return { head: body, appended: \"\" };\n return { head: lines.slice(0, at).join(\"\\n\"), appended: lines.slice(at).join(\"\\n\") };\n}\n\n/**\n * The ORIGINAL description, apart from everything appended to it since (§4.4.1).\n *\n * - `description` — what the author wrote when filing, without its file lines and\n * trailing blank lines: the text the \"Edit description\" editor holds.\n * - `appended` — every `--- REWORK … ---` round and folded `--- COMMENT … ---` block,\n * from the first one's rule line to the end, verbatim (`\"\"` when there are none).\n *\n * keksdose's editor edits the raw body (`initial={fb.body}`, `feedback-page.tsx:420`), so\n * an author tidying a typo could delete the rework history and the file lines with it.\n * The kit's editor holds `description` only and saves through\n * {@link replaceDescription}, which puts the rest back unchanged.\n */\nexport function splitDescription(body: string): { description: string; appended: string } {\n const { head, appended } = cutAtFirstBlock(body);\n return { description: splitBodyAttachments(head).text, appended };\n}\n\n/**\n * The body with its original description replaced and everything else kept — the file\n * lines of the original part (after the new text, in their order) and the appended\n * blocks (verbatim, after a blank line). The new text is trimmed; clearing it saves the\n * rest alone (`\"\"` when there is no rest).\n *\n * `replaceDescription(body, splitDescription(body).description)` gives back a canonical\n * body unchanged — a trimmed description, then each block after one blank line, as the\n * dialog and {@link appendRework} write them.\n */\nexport function replaceDescription(body: string, description: string): string {\n const { head, appended } = cutAtFirstBlock(body);\n const files = splitBodyAttachments(head).urls.map(feedbackAttachmentLine);\n const text = description.trim();\n const top = [...(text ? [text] : []), ...files].join(\"\\n\");\n if (!appended) return top;\n return top ? `${top}\\n\\n${appended}` : appended;\n}\n\n/**\n * Whether an attachment URL is a picture (keksdose dev #578). The upload route takes\n * PDFs and text logs too and serves them as downloads, never inline, so an `<img>` on\n * one shows a broken icon. The key's extension is the server's own statement of the\n * type (minted from the sniffed content), so it is the thing to read.\n */\nexport function isImageAttachment(url: string): boolean {\n return /\\.(png|jpe?g|webp|gif)$/i.test(url);\n}\n\n/** The file name an attachment downloads as — its key, the last segment of the URL. */\nexport function attachmentName(url: string): string {\n return url.slice(url.lastIndexOf(\"/\") + 1);\n}\n"],"mappings":";AAAA,SAAS,+BAA+B;AAgJjC,MAAM,4BAA4B,CAAC,aAAa,cAAc,cAAc,WAAW;AAEvF,MAAM,+BAA+B,KAAK,OAAO;AAIjD,MAAM,0BAA0B;AAahC,MAAM,6BAAuC;AAAA,EAClD,GAAG;AAAA,EACH;AAAA,EACA;AACF;AAQO,MAAM,+BAA4D,OAAO;AAAA,EAC9E,wBAAwB,OAAO,CAAC,aAAa,aAAa,OAAO;AACnE;AAQO,MAAM,+BAA0D,OAAO,OAAO;AAAA,EACnF;AAAA,E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@
1
+ /**
2
+ * `true` inside `FeedbackRowDetail`'s Comments section (0.38.1, Kurvenschmiede): the
3
+ * detail's own Replies section draws the report's replies already, so a
4
+ * `FeedbackCommentThread` there draws the comments alone — whatever `replies` it was
5
+ * handed. Internal: not re-exported.
6
+ */
7
+ export declare const FeedbackRepliesDrawnAboveContext: import("react").Context<boolean>;
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ import { createContext } from "react";
3
+ const FeedbackRepliesDrawnAboveContext = createContext(false);
4
+ export {
5
+ FeedbackRepliesDrawnAboveContext
6
+ };
7
+ //# sourceMappingURL=feedback-replies-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/feedback/feedback-replies-context.ts"],"sourcesContent":["import { createContext } from \"react\";\n\n/**\n * `true` inside `FeedbackRowDetail`'s Comments section (0.38.1, Kurvenschmiede): the\n * detail's own Replies section draws the report's replies already, so a\n * `FeedbackCommentThread` there draws the comments alone — whatever `replies` it was\n * handed. Internal: not re-exported.\n */\nexport const FeedbackRepliesDrawnAboveContext = createContext(false);\n"],"mappings":";AAAA,SAAS,qBAAqB;AAQvB,MAAM,mCAAmC,cAAc,KAAK;","names":[]}
@@ -0,0 +1,97 @@
1
+ import type { CommitScope } from "../components/write-lock.js";
2
+ import { type LabelOverride } from "../i18n/kit-labels.js";
3
+ import { type FeedbackStatus } from "./feedback-inbox.js";
4
+ import type { FeedbackReply } from "./feedback-public-types.js";
5
+ import { DEFAULT_FEEDBACK_REPLIES_LABELS } from "./feedback-thread-parts-labels.js";
6
+ /**
7
+ * The admin's answers as a list (docs/feedback-harmonization.md §9.7, decision 5): each
8
+ * reply its own row — who, when, what, and the status it moved the report to — where
9
+ * 0.37 had one `outcome` field that every answer overwrote. {@link FeedbackReplyTimeline}
10
+ * draws them; {@link FeedbackReplyComposer} writes the next one, with the status picker
11
+ * beside it (decision 13: a reply notifies the author, a status alone does not, so the
12
+ * status belongs with the words).
13
+ */
14
+ /** The `feedbackReplies` namespace of `<UiKitProvider labels>`. */
15
+ export interface FeedbackRepliesLabels {
16
+ /** The timeline's accessible name. de-CH: "Antworten" */
17
+ replies: string;
18
+ /** No reply yet. de-CH: "Noch keine Antwort" */
19
+ empty: string;
20
+ /** A reply without an author — a loop's, a migrated outcome, an erased admin (§9.7).
21
+ * The app's word for its admin; never "the team". de-CH: "Admin" */
22
+ admin: string;
23
+ /** Read before a reply's status chip ("→ Done"). de-CH: "Status geändert auf" */
24
+ statusChanged: string;
25
+ /** The reply box's accessible name. de-CH: "Antwort schreiben" */
26
+ field: string;
27
+ /** de-CH: "Antwort schreiben…" */
28
+ placeholder: string;
29
+ /** The send button. de-CH: "Antworten" */
30
+ reply: string;
31
+ /** The status picker's accessible name. de-CH: "Status mit der Antwort" */
32
+ status: string;
33
+ /** The picker's first option: the reply changes no status. de-CH: "Keine Änderung" */
34
+ noChange: string;
35
+ /** Above the composer when a decided status was set without a reply (§9.7, B2).
36
+ * de-CH: "Die meldende Person wurde nicht benachrichtigt. Schreiben Sie eine Antwort." */
37
+ nudge: string;
38
+ }
39
+ export { DEFAULT_FEEDBACK_REPLIES_LABELS };
40
+ /** `feedbackReplies` resolved: English, then `<UiKitProvider labels>`, then `labels`. */
41
+ export declare function useFeedbackRepliesLabels(labels?: LabelOverride<FeedbackRepliesLabels>): FeedbackRepliesLabels;
42
+ /**
43
+ * The status a row detail should nudge toward (§9.7, B2), or `undefined`: the row's
44
+ * status when it is decided ({@link FEEDBACK_DECIDED_STATUSES}) and no reply carries it
45
+ * as its `status_to` — a status-only move from the table, a swipe or the pills told the
46
+ * author nothing. `undefined` too without `replies` (a server before 0.38).
47
+ */
48
+ export declare function feedbackReplyNudge(row: {
49
+ status: FeedbackStatus;
50
+ replies?: readonly Pick<FeedbackReply, "status_to">[] | null;
51
+ }): FeedbackStatus | undefined;
52
+ export interface FeedbackReplyTimelineProps {
53
+ /** Oldest first, as the server sends them. */
54
+ replies: readonly FeedbackReply[];
55
+ /** How a reply's time reads. Default: the date and time in the provider's locale. */
56
+ renderDate?: (iso: string) => string;
57
+ /** Tag bodies and names `data-private` (a host's screen-share blur). Default true. */
58
+ redact?: boolean;
59
+ labels?: LabelOverride<FeedbackRepliesLabels>;
60
+ className?: string;
61
+ }
62
+ /**
63
+ * The replies, oldest first, down a rule: each with its author (`null` → "Admin"), its
64
+ * time, the status it set ("→ Done"; the admin view adds where from) and its text. No
65
+ * edit and no delete (§9.7): a correction is a new reply.
66
+ */
67
+ export declare function FeedbackReplyTimeline({ replies, renderDate, redact, labels: labelsProp, className, }: FeedbackReplyTimelineProps): import("react").JSX.Element;
68
+ export interface FeedbackReplyComposerProps {
69
+ /** The report's status now — what "No change" keeps. */
70
+ status: FeedbackStatus;
71
+ /**
72
+ * `POST /feedback/{id}/replies` — the body (1–{@link FEEDBACK_REPLY_MAX} after
73
+ * trimming) and the status picked, `undefined` for "No change". Return the promise:
74
+ * the box clears when it resolves, and keeps everything on a rejection.
75
+ */
76
+ onReply: (body: string, status?: FeedbackStatus) => void | Promise<unknown>;
77
+ /** The reply is in flight. */
78
+ pending?: boolean;
79
+ /** Preselect this status and say the author has not been told (§9.7, the nudge) —
80
+ * {@link feedbackReplyNudge}. */
81
+ suggestedStatus?: FeedbackStatus;
82
+ /** Reply COMMITS — see ChatComposer's `commit`. */
83
+ commit?: CommitScope;
84
+ labels?: LabelOverride<FeedbackRepliesLabels>;
85
+ className?: string;
86
+ }
87
+ /**
88
+ * The admin's reply box (§9.7): the text, the **status** to set with it ("No change"
89
+ * first, then every status — {@link selectableFeedbackStatuses}), and **Reply**. A
90
+ * {@link ChatComposer} underneath: Ctrl/⌘+Enter sends, the count runs to 8 000, a draft
91
+ * typed while a reply is in flight stays.
92
+ *
93
+ * With `suggestedStatus` the line "The author has not been told. Add a reply." stands
94
+ * above it and that status is picked, so the reply that answers it records the status
95
+ * and the nudge goes away.
96
+ */
97
+ export declare function FeedbackReplyComposer({ status, onReply, pending, suggestedStatus, commit, labels: labelsProp, className, }: FeedbackReplyComposerProps): import("react").JSX.Element;
@@ -0,0 +1,114 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { BellOff } from "lucide-react";
5
+ import { Select } from "../components/select.js";
6
+ import { useKitLabels, useKitLocale } from "../i18n/kit-labels.js";
7
+ import { cn } from "../lib/cn.js";
8
+ import { formatDate } from "../lib/format.js";
9
+ import { FeedbackStatusBadge, selectableFeedbackStatuses } from "./feedback-inbox.js";
10
+ import { useFeedbackStatusLabels } from "./feedback-labels.js";
11
+ import { FEEDBACK_DECIDED_STATUSES, FEEDBACK_REPLY_MAX } from "./feedback-record.js";
12
+ import { ChatComposer } from "./feedback-thread.js";
13
+ import { DEFAULT_FEEDBACK_REPLIES_LABELS } from "./feedback-thread-parts-labels.js";
14
+ function useFeedbackRepliesLabels(labels) {
15
+ return useKitLabels("feedbackReplies", DEFAULT_FEEDBACK_REPLIES_LABELS, labels);
16
+ }
17
+ function feedbackReplyNudge(row) {
18
+ if (!row.replies || !FEEDBACK_DECIDED_STATUSES.includes(row.status)) return void 0;
19
+ return row.replies.some((reply) => reply.status_to === row.status) ? void 0 : row.status;
20
+ }
21
+ function FeedbackReplyTimeline({
22
+ replies,
23
+ renderDate,
24
+ redact = true,
25
+ labels: labelsProp,
26
+ className
27
+ }) {
28
+ const labels = useFeedbackRepliesLabels(labelsProp);
29
+ const locale = useKitLocale();
30
+ const priv = redact ? "" : void 0;
31
+ if (replies.length === 0) {
32
+ return /* @__PURE__ */ jsx("p", { className: cn("text-sm text-placeholder", className), children: labels.empty });
33
+ }
34
+ const dateText = (iso) => renderDate ? renderDate(iso) : formatDate(iso, { dateStyle: "medium", timeStyle: "short" }, { locale });
35
+ return /* @__PURE__ */ jsx("ol", { "aria-label": labels.replies, className: cn("space-y-3 border-s-2 border-subtle ps-3", className), children: replies.map((reply) => /* @__PURE__ */ jsxs("li", { "data-feedback-reply": reply.id, className: "min-w-0 text-sm", children: [
36
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1 text-caption text-muted", children: [
37
+ /* @__PURE__ */ jsx("span", { "data-private": priv, className: "font-medium text-secondary", children: reply.author_name ?? labels.admin }),
38
+ /* @__PURE__ */ jsx("time", { dateTime: reply.created_at, className: "tabular-nums", children: dateText(reply.created_at) }),
39
+ 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: [
40
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: labels.statusChanged }),
41
+ reply.status_from && reply.status_from !== reply.status_to && /* @__PURE__ */ jsxs(Fragment, { children: [
42
+ /* @__PURE__ */ jsx(FeedbackStatusBadge, { status: reply.status_from }),
43
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "\u2192" })
44
+ ] }),
45
+ !reply.status_from && /* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "\u2192" }),
46
+ /* @__PURE__ */ jsx(FeedbackStatusBadge, { status: reply.status_to })
47
+ ] })
48
+ ] }),
49
+ /* @__PURE__ */ jsx("p", { "data-private": priv, dir: "auto", className: "mt-0.5 whitespace-pre-wrap break-words text-start text-primary", children: reply.body })
50
+ ] }, reply.id)) });
51
+ }
52
+ function FeedbackReplyComposer({
53
+ status,
54
+ onReply,
55
+ pending = false,
56
+ suggestedStatus,
57
+ commit,
58
+ labels: labelsProp,
59
+ className
60
+ }) {
61
+ const labels = useFeedbackRepliesLabels(labelsProp);
62
+ const statusNames = useFeedbackStatusLabels();
63
+ const [pick, setPick] = useState({
64
+ under: suggestedStatus,
65
+ value: suggestedStatus ?? ""
66
+ });
67
+ const picked = pick.under === suggestedStatus ? pick.value : suggestedStatus ?? "";
68
+ const send = (body) => {
69
+ const sent = picked;
70
+ return Promise.resolve(onReply(body, sent || void 0)).then(() => {
71
+ setPick((current) => current.value === sent ? { under: suggestedStatus, value: "" } : current);
72
+ });
73
+ };
74
+ return /* @__PURE__ */ jsxs("div", { className: cn("space-y-2", className), "data-feedback-reply-composer": "", children: [
75
+ suggestedStatus && /* @__PURE__ */ jsxs("p", { className: "flex items-start gap-1.5 text-xs text-secondary", "data-feedback-nudge": suggestedStatus, children: [
76
+ /* @__PURE__ */ jsx(BellOff, { className: "mt-0.5 size-3.5 shrink-0 text-warning", "aria-hidden": true }),
77
+ /* @__PURE__ */ jsx("span", { children: labels.nudge })
78
+ ] }),
79
+ /* @__PURE__ */ jsx(
80
+ ChatComposer,
81
+ {
82
+ onSend: send,
83
+ pending,
84
+ commit,
85
+ maxLength: FEEDBACK_REPLY_MAX,
86
+ showCount: true,
87
+ labels: { field: labels.field, placeholder: labels.placeholder, send: labels.reply },
88
+ attachmentSlot: /* @__PURE__ */ jsxs(
89
+ Select,
90
+ {
91
+ size: "sm",
92
+ "aria-label": labels.status,
93
+ value: picked,
94
+ disabled: pending,
95
+ onChange: (event) => setPick({ under: suggestedStatus, value: event.target.value }),
96
+ "data-feedback-reply-status-pick": "",
97
+ children: [
98
+ /* @__PURE__ */ jsx("option", { value: "", children: labels.noChange }),
99
+ selectableFeedbackStatuses(status).map((value) => /* @__PURE__ */ jsx("option", { value, children: statusNames[value] }, value))
100
+ ]
101
+ }
102
+ )
103
+ }
104
+ )
105
+ ] });
106
+ }
107
+ export {
108
+ DEFAULT_FEEDBACK_REPLIES_LABELS,
109
+ FeedbackReplyComposer,
110
+ FeedbackReplyTimeline,
111
+ feedbackReplyNudge,
112
+ useFeedbackRepliesLabels
113
+ };
114
+ //# sourceMappingURL=feedback-replies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/feedback/feedback-replies.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { BellOff } from \"lucide-react\";\nimport { Select } from \"../components/select\";\nimport type { CommitScope } from \"../components/write-lock\";\nimport { useKitLabels, useKitLocale, type LabelOverride } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { formatDate } from \"../lib/format\";\nimport { FeedbackStatusBadge, selectableFeedbackStatuses, type FeedbackStatus } from \"./feedback-inbox\";\nimport { useFeedbackStatusLabels } from \"./feedback-labels\";\nimport type { FeedbackReply } from \"./feedback-public-types\";\nimport { FEEDBACK_DECIDED_STATUSES, FEEDBACK_REPLY_MAX } from \"./feedback-record\";\nimport { ChatComposer } from \"./feedback-thread\";\nimport { DEFAULT_FEEDBACK_REPLIES_LABELS } from \"./feedback-thread-parts-labels\";\n\n/**\n * The admin's answers as a list (docs/feedback-harmonization.md §9.7, decision 5): each\n * reply its own row — who, when, what, and the status it moved the report to — where\n * 0.37 had one `outcome` field that every answer overwrote. {@link FeedbackReplyTimeline}\n * draws them; {@link FeedbackReplyComposer} writes the next one, with the status picker\n * beside it (decision 13: a reply notifies the author, a status alone does not, so the\n * status belongs with the words).\n */\n\n/* ── Labels ───────────────────────────────────────────────────────────────── */\n\n/** The `feedbackReplies` namespace of `<UiKitProvider labels>`. */\nexport interface FeedbackRepliesLabels {\n /** The timeline's accessible name. de-CH: \"Antworten\" */\n replies: string;\n /** No reply yet. de-CH: \"Noch keine Antwort\" */\n empty: string;\n /** A reply without an author — a loop's, a migrated outcome, an erased admin (§9.7).\n * The app's word for its admin; never \"the team\". de-CH: \"Admin\" */\n admin: string;\n /** Read before a reply's status chip (\"→ Done\"). de-CH: \"Status geändert auf\" */\n statusChanged: string;\n /** The reply box's accessible name. de-CH: \"Antwort schreiben\" */\n field: string;\n /** de-CH: \"Antwort schreiben…\" */\n placeholder: string;\n /** The send button. de-CH: \"Antworten\" */\n reply: string;\n /** The status picker's accessible name. de-CH: \"Status mit der Antwort\" */\n status: string;\n /** The picker's first option: the reply changes no status. de-CH: \"Keine Änderung\" */\n noChange: string;\n /** Above the composer when a decided status was set without a reply (§9.7, B2).\n * de-CH: \"Die meldende Person wurde nicht benachrichtigt. Schreiben Sie eine Antwort.\" */\n nudge: string;\n}\n\nexport { DEFAULT_FEEDBACK_REPLIES_LABELS };\n\n/** `feedbackReplies` resolved: English, then `<UiKitProvider labels>`, then `labels`. */\nexport function useFeedbackRepliesLabels(labels?: LabelOverride<FeedbackRepliesLabels>): FeedbackRepliesLabels {\n return useKitLabels(\"feedbackReplies\", DEFAULT_FEEDBACK_REPLIES_LABELS, labels);\n}\n\n/**\n * The status a row detail should nudge toward (§9.7, B2), or `undefined`: the row's\n * status when it is decided ({@link FEEDBACK_DECIDED_STATUSES}) and no reply carries it\n * as its `status_to` — a status-only move from the table, a swipe or the pills told the\n * author nothing. `undefined` too without `replies` (a server before 0.38).\n */\nexport function feedbackReplyNudge(row: {\n status: FeedbackStatus;\n replies?: readonly Pick<FeedbackReply, \"status_to\">[] | null;\n}): FeedbackStatus | undefined {\n if (!row.replies || !FEEDBACK_DECIDED_STATUSES.includes(row.status)) return undefined;\n return row.replies.some((reply) => reply.status_to === row.status) ? undefined : row.status;\n}\n\n/* ── The timeline ─────────────────────────────────────────────────────────── */\n\nexport interface FeedbackReplyTimelineProps {\n /** Oldest first, as the server sends them. */\n replies: readonly FeedbackReply[];\n /** How a reply's time reads. Default: the date and time in the provider's locale. */\n renderDate?: (iso: string) => string;\n /** Tag bodies and names `data-private` (a host's screen-share blur). Default true. */\n redact?: boolean;\n labels?: LabelOverride<FeedbackRepliesLabels>;\n className?: string;\n}\n\n/**\n * The replies, oldest first, down a rule: each with its author (`null` → \"Admin\"), its\n * time, the status it set (\"→ Done\"; the admin view adds where from) and its text. No\n * edit and no delete (§9.7): a correction is a new reply.\n */\nexport function FeedbackReplyTimeline({\n replies,\n renderDate,\n redact = true,\n labels: labelsProp,\n className,\n}: FeedbackReplyTimelineProps) {\n const labels = useFeedbackRepliesLabels(labelsProp);\n const locale = useKitLocale();\n const priv = redact ? \"\" : undefined;\n if (replies.length === 0) {\n return <p className={cn(\"text-sm text-placeholder\", className)}>{labels.empty}</p>;\n }\n const dateText = (iso: string) =>\n renderDate ? renderDate(iso) : formatDate(iso, { dateStyle: \"medium\", timeStyle: \"short\" }, { locale });\n return (\n <ol aria-label={labels.replies} className={cn(\"space-y-3 border-s-2 border-subtle ps-3\", className)}>\n {replies.map((reply) => (\n <li key={reply.id} data-feedback-reply={reply.id} className=\"min-w-0 text-sm\">\n <div className=\"flex flex-wrap items-center gap-x-2 gap-y-1 text-caption text-muted\">\n <span data-private={priv} className=\"font-medium text-secondary\">\n {reply.author_name ?? labels.admin}\n </span>\n <time dateTime={reply.created_at} className=\"tabular-nums\">\n {dateText(reply.created_at)}\n </time>\n {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\">{labels.statusChanged}</span>\n {reply.status_from && reply.status_from !== reply.status_to && (\n <>\n <FeedbackStatusBadge status={reply.status_from} />\n <span aria-hidden>→</span>\n </>\n )}\n {!reply.status_from && <span aria-hidden>→</span>}\n <FeedbackStatusBadge status={reply.status_to} />\n </span>\n )}\n </div>\n <p data-private={priv} dir=\"auto\" className=\"mt-0.5 whitespace-pre-wrap break-words text-start text-primary\">\n {reply.body}\n </p>\n </li>\n ))}\n </ol>\n );\n}\n\n/* ── The composer ─────────────────────────────────────────────────────────── */\n\nexport interface FeedbackReplyComposerProps {\n /** The report's status now — what \"No change\" keeps. */\n status: FeedbackStatus;\n /**\n * `POST /feedback/{id}/replies` — the body (1–{@link FEEDBACK_REPLY_MAX} after\n * trimming) and the status picked, `undefined` for \"No change\". Return the promise:\n * the box clears when it resolves, and keeps everything on a rejection.\n */\n onReply: (body: string, status?: FeedbackStatus) => void | Promise<unknown>;\n /** The reply is in flight. */\n pending?: boolean;\n /** Preselect this status and say the author has not been told (§9.7, the nudge) —\n * {@link feedbackReplyNudge}. */\n suggestedStatus?: FeedbackStatus;\n /** Reply COMMITS — see ChatComposer's `commit`. */\n commit?: CommitScope;\n labels?: LabelOverride<FeedbackRepliesLabels>;\n className?: string;\n}\n\n/**\n * The admin's reply box (§9.7): the text, the **status** to set with it (\"No change\"\n * first, then every status — {@link selectableFeedbackStatuses}), and **Reply**. A\n * {@link ChatComposer} underneath: Ctrl/⌘+Enter sends, the count runs to 8 000, a draft\n * typed while a reply is in flight stays.\n *\n * With `suggestedStatus` the line \"The author has not been told. Add a reply.\" stands\n * above it and that status is picked, so the reply that answers it records the status\n * and the nudge goes away.\n */\nexport function FeedbackReplyComposer({\n status,\n onReply,\n pending = false,\n suggestedStatus,\n commit,\n labels: labelsProp,\n className,\n}: FeedbackReplyComposerProps) {\n const labels = useFeedbackRepliesLabels(labelsProp);\n const statusNames = useFeedbackStatusLabels();\n // The pick, valid for the suggestion it was made under: a new suggestion (another\n // status set from the table) picks itself again.\n const [pick, setPick] = useState<{ under: FeedbackStatus | undefined; value: FeedbackStatus | \"\" }>({\n under: suggestedStatus,\n value: suggestedStatus ?? \"\",\n });\n const picked = pick.under === suggestedStatus ? pick.value : (suggestedStatus ?? \"\");\n\n const send = (body: string) => {\n const sent = picked;\n return Promise.resolve(onReply(body, sent || undefined)).then(() => {\n setPick((current) => (current.value === sent ? { under: suggestedStatus, value: \"\" } : current));\n });\n };\n\n return (\n <div className={cn(\"space-y-2\", className)} data-feedback-reply-composer=\"\">\n {suggestedStatus && (\n <p className=\"flex items-start gap-1.5 text-xs text-secondary\" data-feedback-nudge={suggestedStatus}>\n <BellOff className=\"mt-0.5 size-3.5 shrink-0 text-warning\" aria-hidden />\n <span>{labels.nudge}</span>\n </p>\n )}\n <ChatComposer\n onSend={send}\n pending={pending}\n commit={commit}\n maxLength={FEEDBACK_REPLY_MAX}\n showCount\n labels={{ field: labels.field, placeholder: labels.placeholder, send: labels.reply }}\n attachmentSlot={\n <Select\n size=\"sm\"\n aria-label={labels.status}\n value={picked}\n disabled={pending}\n onChange={(event) =>\n setPick({ under: suggestedStatus, value: event.target.value as FeedbackStatus | \"\" })\n }\n data-feedback-reply-status-pick=\"\"\n >\n <option value=\"\">{labels.noChange}</option>\n {selectableFeedbackStatuses(status).map((value) => (\n <option key={value} value={value}>\n {statusNames[value]}\n </option>\n ))}\n </Select>\n }\n />\n </div>\n );\n}\n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AC,SAAI,WAAW,GAAG,aAAa,SAAS,GAAG,gCAA6B,IACtE;AAAA,uBACC,qBAAC,OAAE,WAAU,mDAAkD,uBAAqB,iBAClF;AAAA,0BAAC,WAAQ,WAAU,yCAAwC,eAAW,MAAC;AAAA,MACvE,oBAAC,UAAM,iBAAO,OAAM;AAAA,OACtB;AAAA,IAEF;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ;AAAA,QACR;AAAA,QACA;AAAA,QACA,WAAW;AAAA,QACX,WAAS;AAAA,QACT,QAAQ,EAAE,OAAO,OAAO,OAAO,aAAa,OAAO,aAAa,MAAM,OAAO,MAAM;AAAA,QACnF,gBACE;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,cAAY,OAAO;AAAA,YACnB,OAAO;AAAA,YACP,UAAU;AAAA,YACV,UAAU,CAAC,UACT,QAAQ,EAAE,OAAO,iBAAiB,OAAO,MAAM,OAAO,MAA6B,CAAC;AAAA,YAEtF,mCAAgC;AAAA,YAEhC;AAAA,kCAAC,YAAO,OAAM,IAAI,iBAAO,UAAS;AAAA,cACjC,2BAA2B,MAAM,EAAE,IAAI,CAAC,UACvC,oBAAC,YAAmB,OACjB,sBAAY,KAAK,KADP,KAEb,CACD;AAAA;AAAA;AAAA,QACH;AAAA;AAAA,IAEJ;AAAA,KACF;AAEJ;","names":[]}
@@ -12,6 +12,7 @@ const DEFAULT_FEEDBACK_DETAIL_LABELS = {
12
12
  download: (name) => `Download ${name}`,
13
13
  downloadFailed: "The attachment could not be downloaded.",
14
14
  outcome: "Outcome",
15
+ replies: "Replies",
15
16
  resolvedAt: (date) => `Resolved: ${date}`,
16
17
  outcomeAdd: "Add outcome",
17
18
  outcomeUpdate: "Update",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/feedback/feedback-row-detail-labels.ts"],"sourcesContent":["// The English words of ./feedback-row-detail, in a module with no component code: the\n// English catalogue (src/i18n/defaults.ts) imports them without the component, so `en`\n// loads as one chunk like the other languages (0.34, KS U8). ./feedback-row-detail\n// re-exports them.\n\nimport type { FeedbackDetailLabels } from \"./feedback-row-detail\";\n\nexport const DEFAULT_FEEDBACK_DETAIL_LABELS: FeedbackDetailLabels = {\n subject: \"Subject\",\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 note: \"Note\",\n};\n"],"mappings":";AAOO,MAAM,iCAAuD;AAAA,EAClE,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM;AAAA,EACN,iBAAiB;AAAA,EACjB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,UAAU,CAAC,SAAS,YAAY,IAAI;AAAA,EACpC,gBAAgB;AAAA,EAChB,SAAS;AAAA,EACT,YAAY,CAAC,SAAS,aAAa,IAAI;AAAA,EACvC,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,oBAAoB;AAAA,EACpB,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,QAAQ;AAAA,EACR,MAAM;AACR;","names":[]}
1
+ {"version":3,"sources":["../../src/feedback/feedback-row-detail-labels.ts"],"sourcesContent":["// The English words of ./feedback-row-detail, in a module with no component code: the\n// English catalogue (src/i18n/defaults.ts) imports them without the component, so `en`\n// loads as one chunk like the other languages (0.34, KS U8). ./feedback-row-detail\n// re-exports them.\n\nimport type { FeedbackDetailLabels } from \"./feedback-row-detail\";\n\nexport const DEFAULT_FEEDBACK_DETAIL_LABELS: FeedbackDetailLabels = {\n subject: \"Subject\",\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 replies: \"Replies\",\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 note: \"Note\",\n};\n"],"mappings":";AAOO,MAAM,iCAAuD;AAAA,EAClE,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM;AAAA,EACN,iBAAiB;AAAA,EACjB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,UAAU,CAAC,SAAS,YAAY,IAAI;AAAA,EACpC,gBAAgB;AAAA,EAChB,SAAS;AAAA,EACT,SAAS;AAAA,EACT,YAAY,CAAC,SAAS,aAAa,IAAI;AAAA,EACvC,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,oBAAoB;AAAA,EACpB,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,QAAQ;AAAA,EACR,MAAM;AACR;","names":[]}
@@ -1,3 +1,4 @@
1
+ import type { ReactNode } from "react";
1
2
  import type { AuthedFetcher } from "../hooks/use-authed-src.js";
2
3
  import { type LabelOverride } from "../i18n/kit-labels.js";
3
4
  import type { FeedbackNoteAttachment, FeedbackStatus } from "./feedback-inbox.js";
@@ -33,9 +34,12 @@ import { DEFAULT_FEEDBACK_DETAIL_LABELS } from "./feedback-row-detail-labels.js"
33
34
  *
34
35
  * The sections, in the contract's order: **Subject** (the category and the title, §8.1;
35
36
  * `showSubject={false}` leaves it out), **Description** (the body; the author's
36
- * Edit while OPEN / READY / IN_PROGRESS), **URL**, **Attachment**, **Outcome** (the admin's
37
- * outcome editor, Rework, Open page), **Send for rework** (only while reworking) and
38
- * **Status**. No comment thread (§2.2: kastlan's comments fold into the body, §7.7).
37
+ * Edit while OPEN / READY / IN_PROGRESS), **URL**, **Attachment**, **Replies** (0.38,
38
+ * §9.7: the timeline, the admin's reply composer with its status picker and the nudge,
39
+ * Rework, Open page — on a row without `replies`, a server before 0.38, the frozen
40
+ * **Outcome** read-only in its place), **Comments** (0.38: the app's
41
+ * `FeedbackCommentThread`, when passed), **Send for rework** (only while reworking) and
42
+ * **Status** (with the **Visible to others** switch when `onPublicChange` is passed).
39
43
  *
40
44
  * The app keeps its data and its API: the row it renders, the PATCH (`onUpdate`), the
41
45
  * upload (`onUpload`), the authenticated GET (`fetcher`) and who is looking (`canEdit`,
@@ -77,16 +81,22 @@ export interface FeedbackDetailLabels {
77
81
  /** The toast when that download failed. de-CH: "Der Anhang konnte nicht
78
82
  * heruntergeladen werden." */
79
83
  downloadFailed: string;
80
- /** Section 4's heading. de-CH: "Ergebnis" */
84
+ /** Section 4's heading on a row without `replies` (a server before 0.38), where the
85
+ * frozen outcome is shown read-only. de-CH: "Ergebnis" */
81
86
  outcome: string;
87
+ /** Section 4's heading since 0.38: the replies' timeline (§9.7). de-CH: "Antworten" */
88
+ replies: string;
82
89
  /** On section 4's heading line once the row is settled, given the formatted
83
90
  * `resolved_at` date. de-CH: "Erledigt am: {{date}}" */
84
91
  resolvedAt: (date: string) => string;
85
- /** The admin's button while there is no outcome. de-CH: "Ergebnis hinzufügen" */
92
+ /** The admin's button while there is no outcome. **Unused since 0.38** (the outcome is
93
+ * frozen, §9.7; a reply is written instead); kept for one release.
94
+ * de-CH: "Ergebnis hinzufügen" */
86
95
  outcomeAdd: string;
87
- /** The same button once there is one. de-CH: "Aktualisieren" */
96
+ /** The same button once there is one. Unused since 0.38, as `outcomeAdd`.
97
+ * de-CH: "Aktualisieren" */
88
98
  outcomeUpdate: string;
89
- /** The line above the outcome editor. de-CH: "Was wurde umgesetzt, entschieden oder
99
+ /** The line above the outcome editor. Unused since 0.38, as `outcomeAdd`. de-CH: "Was wurde umgesetzt, entschieden oder
90
100
  * warum nicht." */
91
101
  outcomePlaceholder: string;
92
102
  /** The button that opens section 5 on an answered row. de-CH: "Nacharbeit" */
@@ -150,7 +160,8 @@ export interface FeedbackRowAccess {
150
160
  /** "Edit description": the author, while the row is OPEN, READY or IN_PROGRESS — on either
151
161
  * page (keksdose `canAuthorEdit`, `feedback-page.tsx:398`, is not gated on `mine`). */
152
162
  canEditDescription: boolean;
153
- /** The outcome editor: the admin on the inbox (`canEdit`). */
163
+ /** The admin on the inbox (`canEdit`): since 0.38 the reply composer (the outcome
164
+ * itself is frozen, §9.7). */
154
165
  canEditOutcome: boolean;
155
166
  /** "Rework": the admin or the author, on an answered row
156
167
  * ({@link FEEDBACK_REWORKABLE_STATUSES}) — §3.4, anyone else gets the server's 403. */
@@ -177,9 +188,14 @@ export declare function feedbackRowAccess(row: Pick<FeedbackRecord, "user_id" |
177
188
  export interface FeedbackDetailPatch {
178
189
  id: number;
179
190
  body?: string;
180
- /** `null` clears it — a real edit. */
191
+ /** `null` clears it — a real edit. **Frozen since 0.38** (§9.7): server-kit 0.11
192
+ * answers 422; the detail no longer sends it (a reply is written instead). */
181
193
  outcome?: string | null;
182
194
  status?: FeedbackStatus;
195
+ /** 0.38.1: the **Visible to others** flip (§9.3) — what `onPublicChange`'s
196
+ * `PATCH /feedback/{id} {"public": next}` carries, alone, so an app can send it
197
+ * through the same `onUpdate` mutation. */
198
+ public?: boolean;
183
199
  }
184
200
  /**
185
201
  * The page's update mutation. **TanStack Query's `mutate` fits as it stands** — pass
@@ -286,6 +302,27 @@ export interface FeedbackRowDetailProps {
286
302
  * beside the detail.
287
303
  */
288
304
  showSubject?: boolean;
305
+ /**
306
+ * 0.38: `POST /feedback/{id}/replies` (§9.7) — the body and the status picked
307
+ * (`undefined`: "No change"). With `canEdit` and a row that carries `replies`, the
308
+ * reply composer stands under the timeline. Return the promise: the box clears when it
309
+ * resolves. A failure is the app's to toast — the server's `detail`, else
310
+ * `feedbackToast.replyFailed` (0.38.1).
311
+ */
312
+ onReply?: (body: string, status?: FeedbackStatus) => void | Promise<unknown>;
313
+ /** 0.38: the reply is in flight. */
314
+ replying?: boolean;
315
+ /** 0.38: the report's comments — the app's `FeedbackCommentThread` — in a section of
316
+ * their own under the replies. A thread here draws the comments alone (0.38.1): the
317
+ * Replies section above has the replies, so whatever `replies` the thread is handed
318
+ * are dropped, and nothing is drawn twice. */
319
+ comments?: ReactNode;
320
+ /** 0.38: `PATCH /feedback/{id} {"public": next}` — draws the **Visible to others**
321
+ * switch (`FeedbackPublicSwitch`) in the Status section, for the admin (`canEdit`)
322
+ * and, within §9.3's window, the author. The page's own mutation fits:
323
+ * `onPublicChange={(next) => update.mutate({ id: row.id, public: next })}` —
324
+ * {@link FeedbackDetailPatch}'s `public` (0.38.1). */
325
+ onPublicChange?: (next: boolean) => void;
289
326
  labels?: LabelOverride<FeedbackDetailLabels>;
290
327
  className?: string;
291
328
  }
@@ -312,4 +349,4 @@ export interface FeedbackRowDetailProps {
312
349
  * collapsing the row closes it. Each editor is keyed by the row's id, so a draft is
313
350
  * never thrown away by a list refresh under it.
314
351
  */
315
- export declare function FeedbackRowDetail({ row, canEdit, viewerId, onUpdate, pending, onUpload, fetcher, statusChange, onCaptureScreenshot, reworkAttachment, renderDate, commit, showSubject, labels: labelsProp, className, }: FeedbackRowDetailProps): import("react").JSX.Element;
352
+ export declare function FeedbackRowDetail({ row, canEdit, viewerId, onUpdate, pending, onUpload, fetcher, statusChange, onCaptureScreenshot, reworkAttachment, renderDate, commit, showSubject, onReply, replying, comments, onPublicChange, labels: labelsProp, className, }: FeedbackRowDetailProps): import("react").JSX.Element;