@eifi1/ui-kit 0.53.0 → 0.54.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.
- package/README.md +9 -9
- package/dist/account/delete-account-setting.d.ts +3 -2
- package/dist/account/delete-account-setting.js.map +1 -1
- package/dist/auth/auth-errors.d.ts +36 -0
- package/dist/auth/auth-errors.js +20 -0
- package/dist/auth/auth-errors.js.map +1 -1
- package/dist/components/amount-input.d.ts +2 -1
- package/dist/components/amount-input.js.map +1 -1
- package/dist/components/calendar-heatmap.js +4 -2
- package/dist/components/calendar-heatmap.js.map +1 -1
- package/dist/components/currency-option-list.d.ts +2 -1
- package/dist/components/currency-option-list.js +10 -3
- package/dist/components/currency-option-list.js.map +1 -1
- package/dist/components/currency-select.d.ts +3 -1
- package/dist/components/currency-select.js.map +1 -1
- package/dist/components/danger-confirm.d.ts +22 -1
- package/dist/components/danger-confirm.js +50 -28
- package/dist/components/danger-confirm.js.map +1 -1
- package/dist/components/data-table-filter-popover.d.ts +2 -1
- package/dist/components/data-table-filter-popover.js +3 -2
- package/dist/components/data-table-filter-popover.js.map +1 -1
- package/dist/components/data-table-filters.d.ts +33 -3
- package/dist/components/data-table-filters.js +6 -4
- package/dist/components/data-table-filters.js.map +1 -1
- package/dist/components/dialog-frame.d.ts +3 -1
- package/dist/components/dialog-frame.js +6 -2
- package/dist/components/dialog-frame.js.map +1 -1
- package/dist/components/mini-calendar.js +3 -2
- package/dist/components/mini-calendar.js.map +1 -1
- package/dist/components/modal.d.ts +27 -0
- package/dist/components/modal.js +5 -3
- package/dist/components/modal.js.map +1 -1
- package/dist/components/number-input.js.map +1 -1
- package/dist/components/stat-tile.d.ts +21 -2
- package/dist/components/stat-tile.js +4 -2
- package/dist/components/stat-tile.js.map +1 -1
- package/dist/currencies.d.ts +16 -2
- package/dist/currencies.js +2 -1
- package/dist/currencies.js.map +1 -1
- package/dist/eslint/index.js +1 -1
- package/dist/feedback/feedback-context-labels.js +2 -1
- package/dist/feedback/feedback-context-labels.js.map +1 -1
- package/dist/feedback/feedback-context.d.ts +19 -3
- package/dist/feedback/feedback-context.js +12 -1
- package/dist/feedback/feedback-context.js.map +1 -1
- package/dist/feedback/feedback-diagnostics.d.ts +17 -0
- package/dist/feedback/feedback-diagnostics.js +27 -0
- package/dist/feedback/feedback-diagnostics.js.map +1 -0
- package/dist/feedback/feedback-dialog.d.ts +10 -0
- package/dist/feedback/feedback-dialog.js +6 -4
- package/dist/feedback/feedback-dialog.js.map +1 -1
- package/dist/feedback/feedback-record.d.ts +5 -0
- package/dist/feedback/feedback-record.js.map +1 -1
- package/dist/feedback/feedback-row-detail-labels.js +1 -0
- package/dist/feedback/feedback-row-detail-labels.js.map +1 -1
- package/dist/feedback/feedback-row-detail.d.ts +3 -0
- package/dist/feedback/feedback-row-detail.js +3 -0
- package/dist/feedback/feedback-row-detail.js.map +1 -1
- package/dist/feedback/feedback-submit-dialog.d.ts +5 -1
- package/dist/feedback/feedback-submit-dialog.js +15 -3
- package/dist/feedback/feedback-submit-dialog.js.map +1 -1
- package/dist/feedback/feedback-submit.d.ts +30 -2
- package/dist/feedback/feedback-submit.js +5 -2
- package/dist/feedback/feedback-submit.js.map +1 -1
- package/dist/hooks/use-hotkey.js +11 -1
- package/dist/hooks/use-hotkey.js.map +1 -1
- package/dist/i18n/german.js +3 -1
- package/dist/i18n/german.js.map +1 -1
- package/dist/i18n/locales/en.js +3 -1
- package/dist/i18n/locales/en.js.map +2 -2
- package/dist/i18n/locales/es.js +3 -1
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.js +3 -1
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.js +3 -1
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.js +3 -1
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.js +3 -1
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/dates.d.ts +7 -1
- package/dist/lib/dates.js +8 -1
- package/dist/lib/dates.js.map +1 -1
- package/dist/lib/format.d.ts +37 -2
- package/dist/lib/format.js +25 -1
- package/dist/lib/format.js.map +1 -1
- package/dist/lib/intl-cache.d.ts +4 -2
- package/dist/lib/intl-cache.js.map +1 -1
- package/dist/lib/translation-review.d.ts +26 -0
- package/dist/lib/translation-review.js +14 -0
- package/dist/lib/translation-review.js.map +1 -1
- package/package.json +1 -1
- package/src/account/delete-account-setting.tsx +3 -2
- package/src/auth/auth-errors.ts +69 -0
- package/src/components/amount-input.tsx +2 -1
- package/src/components/calendar-heatmap.tsx +8 -2
- package/src/components/currency-option-list.tsx +12 -4
- package/src/components/currency-select.tsx +3 -1
- package/src/components/danger-confirm.tsx +80 -27
- package/src/components/data-table-filter-popover.tsx +19 -11
- package/src/components/data-table-filters.ts +36 -8
- package/src/components/dialog-frame.tsx +12 -4
- package/src/components/mini-calendar.tsx +5 -2
- package/src/components/modal.tsx +36 -7
- package/src/components/number-input.tsx +4 -3
- package/src/components/stat-tile.tsx +32 -3
- package/src/currencies.ts +23 -3
- package/src/feedback/feedback-context-labels.ts +1 -0
- package/src/feedback/feedback-context.tsx +34 -2
- package/src/feedback/feedback-diagnostics.tsx +41 -0
- package/src/feedback/feedback-dialog.tsx +16 -4
- package/src/feedback/feedback-record.ts +5 -0
- package/src/feedback/feedback-row-detail-labels.ts +1 -0
- package/src/feedback/feedback-row-detail.tsx +13 -0
- package/src/feedback/feedback-submit-dialog.tsx +15 -2
- package/src/feedback/feedback-submit.tsx +36 -3
- package/src/hooks/use-hotkey.ts +24 -1
- package/src/i18n/german.ts +2 -0
- package/src/i18n/locales/es.ts +2 -0
- package/src/i18n/locales/fr.ts +2 -0
- package/src/i18n/locales/hu.ts +2 -0
- package/src/i18n/locales/it.ts +2 -0
- package/src/i18n/locales/zh.ts +2 -0
- package/src/index.ts +14 -2
- package/src/lib/dates.ts +24 -2
- package/src/lib/format.ts +66 -3
- package/src/lib/intl-cache.ts +4 -2
- package/src/lib/translation-review.ts +52 -0
|
@@ -52,16 +52,21 @@ export interface FeedbackContextInput {
|
|
|
52
52
|
viewport?: string;
|
|
53
53
|
/** Default `navigator.userAgent`. */
|
|
54
54
|
ua?: string;
|
|
55
|
+
/** What the app attached about the thing reported — `useFeedbackSubmit().open(category,
|
|
56
|
+
* { diagnostics })` (keksdose live #481). Sent whatever `attachUrl` says, as the box
|
|
57
|
+
* shows it; left out of the object when it has no key to show. */
|
|
58
|
+
diagnostics?: Readonly<Record<string, unknown>> | null;
|
|
55
59
|
}
|
|
56
60
|
/**
|
|
57
61
|
* The `context` object of `POST /feedback` (§3.2), keys in keksdose's order: `url`, `route`,
|
|
58
62
|
* `origin`, `environment`, `user_id`, `user_email`, `user_display_name`, `viewport`, `ua`,
|
|
59
|
-
* `version`.
|
|
63
|
+
* `version`, then the app's `diagnostics`.
|
|
60
64
|
*
|
|
61
65
|
* With `attachUrl: false`, `url` and `route` are `""` — present and empty, as keksdose
|
|
62
66
|
* sends them, so a reader can tell "withheld" from "an old row without the key".
|
|
63
67
|
* `environment` and `version` are omitted when the app passes none (kastlan had no
|
|
64
|
-
* version), rather than sent as `undefined
|
|
68
|
+
* version), rather than sent as `undefined`; `diagnostics` when the box would show no
|
|
69
|
+
* line of it (none, `{}`, not a record).
|
|
65
70
|
*
|
|
66
71
|
* Reads `window` / `navigator` only for the defaults it was not given, so it is a pure
|
|
67
72
|
* function in a test that passes everything.
|
|
@@ -78,6 +83,9 @@ export interface FeedbackContextLabels {
|
|
|
78
83
|
user: string;
|
|
79
84
|
/** The checkbox. The URL it is about is the line beneath it. */
|
|
80
85
|
attachUrl: string;
|
|
86
|
+
/** The heading over what the app attached — `open(category, { diagnostics })`, shown
|
|
87
|
+
* read-only under the URL (keksdose live #481). de-CH: "Mitgesendete Diagnose" */
|
|
88
|
+
diagnostics: string;
|
|
81
89
|
}
|
|
82
90
|
export { DEFAULT_FEEDBACK_CONTEXT_LABELS };
|
|
83
91
|
export interface FeedbackContextBoxProps {
|
|
@@ -88,6 +96,10 @@ export interface FeedbackContextBoxProps {
|
|
|
88
96
|
/** The checkbox, on by default in the dialog (§4.2) — the same `attachUrl`. */
|
|
89
97
|
attachUrl: boolean;
|
|
90
98
|
onAttachUrlChange: (next: boolean) => void;
|
|
99
|
+
/** What the app attached — the same `diagnostics` handed to {@link feedbackContext}.
|
|
100
|
+
* Shown read-only, each key and its value as the row detail draws them; no block when
|
|
101
|
+
* there is no line to show. */
|
|
102
|
+
diagnostics?: Readonly<Record<string, unknown>> | null;
|
|
91
103
|
/** Prop > `<UiKitProvider labels={{ feedbackContext }}>` > English. */
|
|
92
104
|
labels?: LabelOverride<FeedbackContextLabels>;
|
|
93
105
|
className?: string;
|
|
@@ -104,7 +116,11 @@ export interface FeedbackContextBoxProps {
|
|
|
104
116
|
* against whatever screen happened to be open, the queue reads as if it were about that
|
|
105
117
|
* screen.
|
|
106
118
|
*
|
|
119
|
+
* Below the URL, what the app attached (`diagnostics`, keksdose live #481: a stuck receipt
|
|
120
|
+
* scan's bookkeeping), read-only and in the row detail's own lines: the reporter sees what
|
|
121
|
+
* goes with the report, and that the URL checkbox does not withhold it.
|
|
122
|
+
*
|
|
107
123
|
* Nothing in here is the app's: hand it the values handed to {@link feedbackContext}, and
|
|
108
124
|
* what the box shows is what is sent.
|
|
109
125
|
*/
|
|
110
|
-
export declare function FeedbackContextBox({ user, url, attachUrl, onAttachUrlChange, labels: labelsProp, className, }: FeedbackContextBoxProps): import("react").JSX.Element;
|
|
126
|
+
export declare function FeedbackContextBox({ user, url, attachUrl, onAttachUrlChange, diagnostics, labels: labelsProp, className, }: FeedbackContextBoxProps): import("react").JSX.Element;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId } from "react";
|
|
3
4
|
import { Checkbox } from "../components/checkbox.js";
|
|
4
5
|
import { DEFAULT_COMMON_LABELS, useKitLabels } from "../i18n/kit-labels.js";
|
|
5
6
|
import { cn } from "../lib/cn.js";
|
|
6
7
|
import { DEFAULT_FEEDBACK_CONTEXT_LABELS } from "./feedback-context-labels.js";
|
|
8
|
+
import { diagnosticsEntries, FeedbackDiagnosticsList } from "./feedback-diagnostics.js";
|
|
7
9
|
function submitterLine(user) {
|
|
8
10
|
const name = user?.display_name?.trim();
|
|
9
11
|
const email = user?.email?.trim();
|
|
@@ -34,6 +36,7 @@ function feedbackContext(input) {
|
|
|
34
36
|
context.viewport = input.viewport ?? (win ? `${win.innerWidth}x${win.innerHeight}` : "");
|
|
35
37
|
context.ua = input.ua ?? (typeof navigator === "undefined" ? "" : navigator.userAgent);
|
|
36
38
|
if (input.version !== void 0) context.version = input.version;
|
|
39
|
+
if (input.diagnostics && diagnosticsEntries(input.diagnostics).length) context.diagnostics = input.diagnostics;
|
|
37
40
|
return context;
|
|
38
41
|
}
|
|
39
42
|
function FeedbackContextBox({
|
|
@@ -41,11 +44,14 @@ function FeedbackContextBox({
|
|
|
41
44
|
url,
|
|
42
45
|
attachUrl,
|
|
43
46
|
onAttachUrlChange,
|
|
47
|
+
diagnostics,
|
|
44
48
|
labels: labelsProp,
|
|
45
49
|
className
|
|
46
50
|
}) {
|
|
47
51
|
const labels = useKitLabels("feedbackContext", DEFAULT_FEEDBACK_CONTEXT_LABELS, labelsProp);
|
|
48
52
|
const common = useKitLabels("common", DEFAULT_COMMON_LABELS);
|
|
53
|
+
const diagnosticsId = useId();
|
|
54
|
+
const attached = diagnosticsEntries(diagnostics);
|
|
49
55
|
const submitter = submitterLine(user);
|
|
50
56
|
const line = common.fieldValue(labels.user, submitter);
|
|
51
57
|
const lead = line.endsWith(submitter) ? line.slice(0, line.length - submitter.length) : null;
|
|
@@ -77,7 +83,12 @@ function FeedbackContextBox({
|
|
|
77
83
|
)
|
|
78
84
|
) : void 0
|
|
79
85
|
}
|
|
80
|
-
)
|
|
86
|
+
),
|
|
87
|
+
attached.length > 0 && // A named group, so a screen reader hears what the pairs are before it reads them.
|
|
88
|
+
/* @__PURE__ */ jsxs("div", { role: "group", "aria-labelledby": diagnosticsId, className: "space-y-0.5 pt-1", children: [
|
|
89
|
+
/* @__PURE__ */ jsx("div", { id: diagnosticsId, className: "font-medium text-secondary", children: labels.diagnostics }),
|
|
90
|
+
/* @__PURE__ */ jsx(FeedbackDiagnosticsList, { entries: attached })
|
|
91
|
+
] })
|
|
81
92
|
]
|
|
82
93
|
}
|
|
83
94
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/feedback/feedback-context.tsx"],"sourcesContent":["import { Checkbox } from \"../components/checkbox\";\nimport { DEFAULT_COMMON_LABELS, useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport type { FeedbackContext, FeedbackEnvironment } from \"./feedback-record\";\nimport { DEFAULT_FEEDBACK_CONTEXT_LABELS } from \"./feedback-context-labels\";\n\n/**\n * The reporter context of a feedback report: the box the submit dialog shows, and the\n * `context` object `POST /feedback` sends (0.27.0, docs/feedback-harmonization.md §3.2,\n * §4.2). One file for both, so what the box SAYS will be sent and what IS sent cannot\n * drift apart.\n *\n * Each app had written both halves itself (keksdose `use-feedback-dialog.tsx:105` and\n * `:222`, kastlan `feedback-button.tsx:80`, Kurvenschmiede `use-feedback-dialog.tsx:124`),\n * and they had drifted: kastlan sent six keys with `user_email: null` and no version,\n * Kurvenschmiede a `page_path` column and a sentence where keksdose had a labelled box,\n * and only keksdose showed the full URL it was about to send.\n */\n\n/* ── Who is filing ───────────────────────────────────────────────────────── */\n\n/**\n * The person filing, as the app knows them. Snake case on purpose: keksdose's and\n * Kurvenschmiede's user objects already have this shape (`id`, `email`, `display_name`),\n * so they pass their `user` as it is; kastlan maps its token's `sub` and name parts.\n *\n * A SNAPSHOT for the report and the box. The server should overwrite the three `user_*`\n * keys from the session (§3.2; Kurvenschmiede does), so nobody can file in someone else's\n * name — this is what the reporter is SHOWN, not proof of who they are.\n */\nexport interface FeedbackSubmitter {\n id?: number | null;\n email?: string | null;\n display_name?: string | null;\n}\n\n/** \"Ada Example (ada@example.com)\", the name alone, the email alone, or \"—\" when the app\n * knows neither (keksdose `use-feedback-dialog.tsx:228`). */\nfunction submitterLine(user: FeedbackSubmitter | null | undefined): string {\n const name = user?.display_name?.trim();\n const email = user?.email?.trim();\n if (name && email) return `${name} (${email})`;\n return name || email || \"—\";\n}\n\n/* ── The object (§3.2) ───────────────────────────────────────────────────── */\n\n/** What {@link feedbackContext} is built from. */\nexport interface FeedbackContextInput {\n /** The submitter, or `null` when signed out / unknown — the three `user_*` keys are then\n * `null`, as keksdose sends them. */\n user?: FeedbackSubmitter | null;\n /** The box's \"Attach current page URL\" checkbox. `false` withholds `url` and `route`\n * (both `\"\"`); nothing else is withheld — `origin` says which copy of the app, which is\n * not personal, and triage needs it first (keksdose `use-feedback-dialog.tsx:110`). */\n attachUrl: boolean;\n /** `location.href` when the dialog OPENED — the page the report is about, not the one\n * the reporter may have navigated to while typing. */\n url: string;\n /** Its pathname. Default: read off `url` (a path-only `url` works too). */\n route?: string;\n /** Default `location.origin`. */\n origin?: string;\n /** `\"prod\"` / `\"dev\"` / `\"local\"` — the app's own reading (keksdose\n * `app/deploy-environment.ts`). Left out of the object when not given. */\n environment?: FeedbackEnvironment | (string & {});\n /** The app build (`__APP_VERSION__`). Left out of the object when not given. */\n version?: string;\n /** Default `${innerWidth}x${innerHeight}` at the time of the call — \"406x816\". */\n viewport?: string;\n /** Default `navigator.userAgent`. */\n ua?: string;\n}\n\n/** The pathname of a full or path-only URL; `\"\"` for something that is neither. */\nfunction pathOf(url: string, base: string | undefined): string {\n if (!url) return \"\";\n try {\n return new URL(url, base || \"http://localhost\").pathname;\n } catch {\n return \"\";\n }\n}\n\n/**\n * The `context` object of `POST /feedback` (§3.2), keys in keksdose's order: `url`, `route`,\n * `origin`, `environment`, `user_id`, `user_email`, `user_display_name`, `viewport`, `ua`,\n * `version`.\n *\n * With `attachUrl: false`, `url` and `route` are `\"\"` — present and empty, as keksdose\n * sends them, so a reader can tell \"withheld\" from \"an old row without the key\".\n * `environment` and `version` are omitted when the app passes none (kastlan had no\n * version), rather than sent as `undefined`.\n *\n * Reads `window` / `navigator` only for the defaults it was not given, so it is a pure\n * function in a test that passes everything.\n */\nexport function feedbackContext(input: FeedbackContextInput): FeedbackContext {\n const { user, attachUrl, url } = input;\n const win = typeof window === \"undefined\" ? undefined : window;\n const origin = input.origin ?? win?.location.origin ?? \"\";\n const context: FeedbackContext = {\n url: attachUrl ? url : \"\",\n route: attachUrl ? (input.route ?? pathOf(url, origin || win?.location.href)) : \"\",\n origin,\n };\n if (input.environment !== undefined) context.environment = input.environment;\n context.user_id = user?.id ?? null;\n context.user_email = user?.email ?? null;\n context.user_display_name = user?.display_name ?? null;\n context.viewport = input.viewport ?? (win ? `${win.innerWidth}x${win.innerHeight}` : \"\");\n context.ua = input.ua ?? (typeof navigator === \"undefined\" ? \"\" : navigator.userAgent);\n if (input.version !== undefined) context.version = input.version;\n return context;\n}\n\n/* ── The box (§4.2) ──────────────────────────────────────────────────────── */\n\n/**\n * `feedbackContext` — the context box's words. de-CH canon (keksdose `de-CH.json`):\n * `user` \"Nutzer\", `attachUrl` \"Aktuelle Seiten-URL anhängen\".\n */\nexport interface FeedbackContextLabels {\n /** The submitter line's label — the box draws \"**User:** Ada Example (ada@example.com)\".\n * The label alone: the colon between it and the person is the language's\n * `common.fieldValue` (fr \"Utilisateur : …\", zh \"用户:…\"). */\n user: string;\n /** The checkbox. The URL it is about is the line beneath it. */\n attachUrl: string;\n}\n\n// Defined in ./feedback-context-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_FEEDBACK_CONTEXT_LABELS };\n\nexport interface FeedbackContextBoxProps {\n /** Who is filing — the same value handed to {@link feedbackContext}. */\n user?: FeedbackSubmitter | null;\n /** The URL that goes with the report — the same `url` handed to {@link feedbackContext}. */\n url: string;\n /** The checkbox, on by default in the dialog (§4.2) — the same `attachUrl`. */\n attachUrl: boolean;\n onAttachUrlChange: (next: boolean) => void;\n /** Prop > `<UiKitProvider labels={{ feedbackContext }}>` > English. */\n labels?: LabelOverride<FeedbackContextLabels>;\n className?: string;\n}\n\n/**\n * The submit dialog's context box — the dialog's `contextSlot` (keksdose\n * `use-feedback-dialog.tsx:222`, §4.2): who is filing, and the page URL with a checkbox to\n * leave it out, ON by default.\n *\n * The URL stays visible when the box is off, struck through: the reporter sees what they\n * withheld rather than a line that vanished, and ticking it back on is the same glance.\n * Kurvenschmiede's argument for the checkbox is why it exists at all (its feedback #101):\n * the route is right for a bug and wrong for an idea about a screen one is not on — filed\n * against whatever screen happened to be open, the queue reads as if it were about that\n * screen.\n *\n * Nothing in here is the app's: hand it the values handed to {@link feedbackContext}, and\n * what the box shows is what is sent.\n */\nexport function FeedbackContextBox({\n user,\n url,\n attachUrl,\n onAttachUrlChange,\n labels: labelsProp,\n className,\n}: FeedbackContextBoxProps) {\n const labels = useKitLabels(\"feedbackContext\", DEFAULT_FEEDBACK_CONTEXT_LABELS, labelsProp);\n const common = useKitLabels(\"common\", DEFAULT_COMMON_LABELS);\n const submitter = submitterLine(user);\n // \"User: Ada …\" through `common.fieldValue`, so French gets its space before the colon\n // and Chinese its full-width one; the label and its punctuation are drawn bold, as\n // keksdose's box does. A `fieldValue` that does not end in the value (an app's own\n // order) is shown whole, unbolded, rather than cut in the wrong place.\n const line = common.fieldValue(labels.user, submitter);\n const lead = line.endsWith(submitter) ? line.slice(0, line.length - submitter.length) : null;\n return (\n <div\n className={cn(\"space-y-1 rounded-md border border-subtle bg-surface-2 px-3 py-2 text-xs text-muted\", className)}\n >\n <div className=\"[overflow-wrap:anywhere]\">\n {lead === null ? (\n line\n ) : (\n <>\n <span className=\"font-medium text-secondary\">{lead}</span>\n {submitter}\n </>\n )}\n </div>\n <Checkbox\n checked={attachUrl}\n onCheckedChange={onAttachUrlChange}\n label={<span className=\"text-xs font-medium text-secondary\">{labels.attachUrl}</span>}\n description={\n url ? (\n // `break-all`: a URL is one unbreakable word, and at 390px a long query string\n // would otherwise push the dialog sideways.\n <span\n data-withheld={attachUrl ? undefined : \"\"}\n className={cn(\"break-all text-xs\", !attachUrl && \"line-through opacity-60\")}\n >\n {url}\n </span>\n ) : undefined\n }\n />\n </div>\n );\n}\n"],"mappings":";AA2LU,mBACE,KADF;AA3LV,SAAS,gBAAgB;AACzB,SAAS,uBAAuB,oBAAwC;AACxE,SAAS,UAAU;AAEnB,SAAS,uCAAuC;AAkChD,SAAS,cAAc,MAAoD;AACzE,QAAM,OAAO,MAAM,cAAc,KAAK;AACtC,QAAM,QAAQ,MAAM,OAAO,KAAK;AAChC,MAAI,QAAQ,MAAO,QAAO,GAAG,IAAI,KAAK,KAAK;AAC3C,SAAO,QAAQ,SAAS;AAC1B;AAgCA,SAAS,OAAO,KAAa,MAAkC;AAC7D,MAAI,CAAC,IAAK,QAAO;AACjB,MAAI;AACF,WAAO,IAAI,IAAI,KAAK,QAAQ,kBAAkB,EAAE;AAAA,EAClD,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAeO,SAAS,gBAAgB,OAA8C;AAC5E,QAAM,EAAE,MAAM,WAAW,IAAI,IAAI;AACjC,QAAM,MAAM,OAAO,WAAW,cAAc,SAAY;AACxD,QAAM,SAAS,MAAM,UAAU,KAAK,SAAS,UAAU;AACvD,QAAM,UAA2B;AAAA,IAC/B,KAAK,YAAY,MAAM;AAAA,IACvB,OAAO,YAAa,MAAM,SAAS,OAAO,KAAK,UAAU,KAAK,SAAS,IAAI,IAAK;AAAA,IAChF;AAAA,EACF;AACA,MAAI,MAAM,gBAAgB,OAAW,SAAQ,cAAc,MAAM;AACjE,UAAQ,UAAU,MAAM,MAAM;AAC9B,UAAQ,aAAa,MAAM,SAAS;AACpC,UAAQ,oBAAoB,MAAM,gBAAgB;AAClD,UAAQ,WAAW,MAAM,aAAa,MAAM,GAAG,IAAI,UAAU,IAAI,IAAI,WAAW,KAAK;AACrF,UAAQ,KAAK,MAAM,OAAO,OAAO,cAAc,cAAc,KAAK,UAAU;AAC5E,MAAI,MAAM,YAAY,OAAW,SAAQ,UAAU,MAAM;AACzD,SAAO;AACT;AAgDO,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AACF,GAA4B;AAC1B,QAAM,SAAS,aAAa,mBAAmB,iCAAiC,UAAU;AAC1F,QAAM,SAAS,aAAa,UAAU,qBAAqB;AAC3D,QAAM,YAAY,cAAc,IAAI;AAKpC,QAAM,OAAO,OAAO,WAAW,OAAO,MAAM,SAAS;AACrD,QAAM,OAAO,KAAK,SAAS,SAAS,IAAI,KAAK,MAAM,GAAG,KAAK,SAAS,UAAU,MAAM,IAAI;AACxF,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,GAAG,uFAAuF,SAAS;AAAA,MAE9G;AAAA,4BAAC,SAAI,WAAU,4BACZ,mBAAS,OACR,OAEA,iCACE;AAAA,8BAAC,UAAK,WAAU,8BAA8B,gBAAK;AAAA,UAClD;AAAA,WACH,GAEJ;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,SAAS;AAAA,YACT,iBAAiB;AAAA,YACjB,OAAO,oBAAC,UAAK,WAAU,sCAAsC,iBAAO,WAAU;AAAA,YAC9E,aACE;AAAA;AAAA;AAAA,cAGE;AAAA,gBAAC;AAAA;AAAA,kBACC,iBAAe,YAAY,SAAY;AAAA,kBACvC,WAAW,GAAG,qBAAqB,CAAC,aAAa,yBAAyB;AAAA,kBAEzE;AAAA;AAAA,cACH;AAAA,gBACE;AAAA;AAAA,QAER;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/feedback/feedback-context.tsx"],"sourcesContent":["import { useId } from \"react\";\nimport { Checkbox } from \"../components/checkbox\";\nimport { DEFAULT_COMMON_LABELS, useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport type { FeedbackContext, FeedbackEnvironment } from \"./feedback-record\";\nimport { DEFAULT_FEEDBACK_CONTEXT_LABELS } from \"./feedback-context-labels\";\nimport { diagnosticsEntries, FeedbackDiagnosticsList } from \"./feedback-diagnostics\";\n\n/**\n * The reporter context of a feedback report: the box the submit dialog shows, and the\n * `context` object `POST /feedback` sends (0.27.0, docs/feedback-harmonization.md §3.2,\n * §4.2). One file for both, so what the box SAYS will be sent and what IS sent cannot\n * drift apart.\n *\n * Each app had written both halves itself (keksdose `use-feedback-dialog.tsx:105` and\n * `:222`, kastlan `feedback-button.tsx:80`, Kurvenschmiede `use-feedback-dialog.tsx:124`),\n * and they had drifted: kastlan sent six keys with `user_email: null` and no version,\n * Kurvenschmiede a `page_path` column and a sentence where keksdose had a labelled box,\n * and only keksdose showed the full URL it was about to send.\n */\n\n/* ── Who is filing ───────────────────────────────────────────────────────── */\n\n/**\n * The person filing, as the app knows them. Snake case on purpose: keksdose's and\n * Kurvenschmiede's user objects already have this shape (`id`, `email`, `display_name`),\n * so they pass their `user` as it is; kastlan maps its token's `sub` and name parts.\n *\n * A SNAPSHOT for the report and the box. The server should overwrite the three `user_*`\n * keys from the session (§3.2; Kurvenschmiede does), so nobody can file in someone else's\n * name — this is what the reporter is SHOWN, not proof of who they are.\n */\nexport interface FeedbackSubmitter {\n id?: number | null;\n email?: string | null;\n display_name?: string | null;\n}\n\n/** \"Ada Example (ada@example.com)\", the name alone, the email alone, or \"—\" when the app\n * knows neither (keksdose `use-feedback-dialog.tsx:228`). */\nfunction submitterLine(user: FeedbackSubmitter | null | undefined): string {\n const name = user?.display_name?.trim();\n const email = user?.email?.trim();\n if (name && email) return `${name} (${email})`;\n return name || email || \"—\";\n}\n\n/* ── The object (§3.2) ───────────────────────────────────────────────────── */\n\n/** What {@link feedbackContext} is built from. */\nexport interface FeedbackContextInput {\n /** The submitter, or `null` when signed out / unknown — the three `user_*` keys are then\n * `null`, as keksdose sends them. */\n user?: FeedbackSubmitter | null;\n /** The box's \"Attach current page URL\" checkbox. `false` withholds `url` and `route`\n * (both `\"\"`); nothing else is withheld — `origin` says which copy of the app, which is\n * not personal, and triage needs it first (keksdose `use-feedback-dialog.tsx:110`). */\n attachUrl: boolean;\n /** `location.href` when the dialog OPENED — the page the report is about, not the one\n * the reporter may have navigated to while typing. */\n url: string;\n /** Its pathname. Default: read off `url` (a path-only `url` works too). */\n route?: string;\n /** Default `location.origin`. */\n origin?: string;\n /** `\"prod\"` / `\"dev\"` / `\"local\"` — the app's own reading (keksdose\n * `app/deploy-environment.ts`). Left out of the object when not given. */\n environment?: FeedbackEnvironment | (string & {});\n /** The app build (`__APP_VERSION__`). Left out of the object when not given. */\n version?: string;\n /** Default `${innerWidth}x${innerHeight}` at the time of the call — \"406x816\". */\n viewport?: string;\n /** Default `navigator.userAgent`. */\n ua?: string;\n /** What the app attached about the thing reported — `useFeedbackSubmit().open(category,\n * { diagnostics })` (keksdose live #481). Sent whatever `attachUrl` says, as the box\n * shows it; left out of the object when it has no key to show. */\n diagnostics?: Readonly<Record<string, unknown>> | null;\n}\n\n/** The pathname of a full or path-only URL; `\"\"` for something that is neither. */\nfunction pathOf(url: string, base: string | undefined): string {\n if (!url) return \"\";\n try {\n return new URL(url, base || \"http://localhost\").pathname;\n } catch {\n return \"\";\n }\n}\n\n/**\n * The `context` object of `POST /feedback` (§3.2), keys in keksdose's order: `url`, `route`,\n * `origin`, `environment`, `user_id`, `user_email`, `user_display_name`, `viewport`, `ua`,\n * `version`, then the app's `diagnostics`.\n *\n * With `attachUrl: false`, `url` and `route` are `\"\"` — present and empty, as keksdose\n * sends them, so a reader can tell \"withheld\" from \"an old row without the key\".\n * `environment` and `version` are omitted when the app passes none (kastlan had no\n * version), rather than sent as `undefined`; `diagnostics` when the box would show no\n * line of it (none, `{}`, not a record).\n *\n * Reads `window` / `navigator` only for the defaults it was not given, so it is a pure\n * function in a test that passes everything.\n */\nexport function feedbackContext(input: FeedbackContextInput): FeedbackContext {\n const { user, attachUrl, url } = input;\n const win = typeof window === \"undefined\" ? undefined : window;\n const origin = input.origin ?? win?.location.origin ?? \"\";\n const context: FeedbackContext = {\n url: attachUrl ? url : \"\",\n route: attachUrl ? (input.route ?? pathOf(url, origin || win?.location.href)) : \"\",\n origin,\n };\n if (input.environment !== undefined) context.environment = input.environment;\n context.user_id = user?.id ?? null;\n context.user_email = user?.email ?? null;\n context.user_display_name = user?.display_name ?? null;\n context.viewport = input.viewport ?? (win ? `${win.innerWidth}x${win.innerHeight}` : \"\");\n context.ua = input.ua ?? (typeof navigator === \"undefined\" ? \"\" : navigator.userAgent);\n if (input.version !== undefined) context.version = input.version;\n // The box's own test: what it draws no line of is not sent either.\n if (input.diagnostics && diagnosticsEntries(input.diagnostics).length) context.diagnostics = input.diagnostics;\n return context;\n}\n\n/* ── The box (§4.2) ──────────────────────────────────────────────────────── */\n\n/**\n * `feedbackContext` — the context box's words. de-CH canon (keksdose `de-CH.json`):\n * `user` \"Nutzer\", `attachUrl` \"Aktuelle Seiten-URL anhängen\".\n */\nexport interface FeedbackContextLabels {\n /** The submitter line's label — the box draws \"**User:** Ada Example (ada@example.com)\".\n * The label alone: the colon between it and the person is the language's\n * `common.fieldValue` (fr \"Utilisateur : …\", zh \"用户:…\"). */\n user: string;\n /** The checkbox. The URL it is about is the line beneath it. */\n attachUrl: string;\n /** The heading over what the app attached — `open(category, { diagnostics })`, shown\n * read-only under the URL (keksdose live #481). de-CH: \"Mitgesendete Diagnose\" */\n diagnostics: string;\n}\n\n// Defined in ./feedback-context-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_FEEDBACK_CONTEXT_LABELS };\n\nexport interface FeedbackContextBoxProps {\n /** Who is filing — the same value handed to {@link feedbackContext}. */\n user?: FeedbackSubmitter | null;\n /** The URL that goes with the report — the same `url` handed to {@link feedbackContext}. */\n url: string;\n /** The checkbox, on by default in the dialog (§4.2) — the same `attachUrl`. */\n attachUrl: boolean;\n onAttachUrlChange: (next: boolean) => void;\n /** What the app attached — the same `diagnostics` handed to {@link feedbackContext}.\n * Shown read-only, each key and its value as the row detail draws them; no block when\n * there is no line to show. */\n diagnostics?: Readonly<Record<string, unknown>> | null;\n /** Prop > `<UiKitProvider labels={{ feedbackContext }}>` > English. */\n labels?: LabelOverride<FeedbackContextLabels>;\n className?: string;\n}\n\n/**\n * The submit dialog's context box — the dialog's `contextSlot` (keksdose\n * `use-feedback-dialog.tsx:222`, §4.2): who is filing, and the page URL with a checkbox to\n * leave it out, ON by default.\n *\n * The URL stays visible when the box is off, struck through: the reporter sees what they\n * withheld rather than a line that vanished, and ticking it back on is the same glance.\n * Kurvenschmiede's argument for the checkbox is why it exists at all (its feedback #101):\n * the route is right for a bug and wrong for an idea about a screen one is not on — filed\n * against whatever screen happened to be open, the queue reads as if it were about that\n * screen.\n *\n * Below the URL, what the app attached (`diagnostics`, keksdose live #481: a stuck receipt\n * scan's bookkeeping), read-only and in the row detail's own lines: the reporter sees what\n * goes with the report, and that the URL checkbox does not withhold it.\n *\n * Nothing in here is the app's: hand it the values handed to {@link feedbackContext}, and\n * what the box shows is what is sent.\n */\nexport function FeedbackContextBox({\n user,\n url,\n attachUrl,\n onAttachUrlChange,\n diagnostics,\n labels: labelsProp,\n className,\n}: FeedbackContextBoxProps) {\n const labels = useKitLabels(\"feedbackContext\", DEFAULT_FEEDBACK_CONTEXT_LABELS, labelsProp);\n const common = useKitLabels(\"common\", DEFAULT_COMMON_LABELS);\n const diagnosticsId = useId();\n const attached = diagnosticsEntries(diagnostics);\n const submitter = submitterLine(user);\n // \"User: Ada …\" through `common.fieldValue`, so French gets its space before the colon\n // and Chinese its full-width one; the label and its punctuation are drawn bold, as\n // keksdose's box does. A `fieldValue` that does not end in the value (an app's own\n // order) is shown whole, unbolded, rather than cut in the wrong place.\n const line = common.fieldValue(labels.user, submitter);\n const lead = line.endsWith(submitter) ? line.slice(0, line.length - submitter.length) : null;\n return (\n <div\n className={cn(\"space-y-1 rounded-md border border-subtle bg-surface-2 px-3 py-2 text-xs text-muted\", className)}\n >\n <div className=\"[overflow-wrap:anywhere]\">\n {lead === null ? (\n line\n ) : (\n <>\n <span className=\"font-medium text-secondary\">{lead}</span>\n {submitter}\n </>\n )}\n </div>\n <Checkbox\n checked={attachUrl}\n onCheckedChange={onAttachUrlChange}\n label={<span className=\"text-xs font-medium text-secondary\">{labels.attachUrl}</span>}\n description={\n url ? (\n // `break-all`: a URL is one unbreakable word, and at 390px a long query string\n // would otherwise push the dialog sideways.\n <span\n data-withheld={attachUrl ? undefined : \"\"}\n className={cn(\"break-all text-xs\", !attachUrl && \"line-through opacity-60\")}\n >\n {url}\n </span>\n ) : undefined\n }\n />\n {attached.length > 0 && (\n // A named group, so a screen reader hears what the pairs are before it reads them.\n <div role=\"group\" aria-labelledby={diagnosticsId} className=\"space-y-0.5 pt-1\">\n <div id={diagnosticsId} className=\"font-medium text-secondary\">\n {labels.diagnostics}\n </div>\n <FeedbackDiagnosticsList entries={attached} />\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";AAkNU,mBACE,KADF;AAlNV,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,uBAAuB,oBAAwC;AACxE,SAAS,UAAU;AAEnB,SAAS,uCAAuC;AAChD,SAAS,oBAAoB,+BAA+B;AAkC5D,SAAS,cAAc,MAAoD;AACzE,QAAM,OAAO,MAAM,cAAc,KAAK;AACtC,QAAM,QAAQ,MAAM,OAAO,KAAK;AAChC,MAAI,QAAQ,MAAO,QAAO,GAAG,IAAI,KAAK,KAAK;AAC3C,SAAO,QAAQ,SAAS;AAC1B;AAoCA,SAAS,OAAO,KAAa,MAAkC;AAC7D,MAAI,CAAC,IAAK,QAAO;AACjB,MAAI;AACF,WAAO,IAAI,IAAI,KAAK,QAAQ,kBAAkB,EAAE;AAAA,EAClD,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAgBO,SAAS,gBAAgB,OAA8C;AAC5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G;AAAA,4BAAC,SAAI,WAAU,4BACZ,mBAAS,OACR,OAEA,iCACE;AAAA,8BAAC,UAAK,WAAU,8BAA8B,gBAAK;AAAA,UAClD;AAAA,WACH,GAEJ;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,SAAS;AAAA,YACT,iBAAiB;AAAA,YACjB,OAAO,oBAAC,UAAK,WAAU,sCAAsC,iBAAO,WAAU;AAAA,YAC9E,aACE;AAAA;AAAA;AAAA,cAGE;AAAA,gBAAC;AAAA;AAAA,kBACC,iBAAe,YAAY,SAAY;AAAA,kBACvC,WAAW,GAAG,qBAAqB,CAAC,aAAa,yBAAyB;AAAA,kBAEzE;AAAA;AAAA,cACH;AAAA,gBACE;AAAA;AAAA,QAER;AAAA,QACC,SAAS,SAAS;AAAA,QAEjB,qBAAC,SAAI,MAAK,SAAQ,mBAAiB,eAAe,WAAU,oBAC1D;AAAA,8BAAC,SAAI,IAAI,eAAe,WAAU,8BAC/B,iBAAO,aACV;AAAA,UACA,oBAAC,2BAAwB,SAAS,UAAU;AAAA,WAC9C;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `context.diagnostics` (§3.2), drawn one way wherever it shows: in the submit dialog's
|
|
3
|
+
* context box, to the reporter before it goes (§4.2), and in the row detail, to the admin
|
|
4
|
+
* and the author afterwards (§4.4.2). One module for both, so the reporter is shown the
|
|
5
|
+
* very lines the admin will read (keksdose live #481).
|
|
6
|
+
*
|
|
7
|
+
* Internal: neither `@eifi1/ui-kit/feedback` nor the barrel names it.
|
|
8
|
+
*/
|
|
9
|
+
/** `diagnostics` as [key, text] pairs, in the app's order: a string, number or boolean as
|
|
10
|
+
* written, an object or a list as JSON, nothing as "—". Empty for no diagnostics, and for
|
|
11
|
+
* a value that is not a plain object — the server stores whatever the client sent. */
|
|
12
|
+
export declare function diagnosticsEntries(diagnostics: unknown): Array<[string, string]>;
|
|
13
|
+
/** The pairs as a definition list: each key beside its value, in monospace. Read-only in
|
|
14
|
+
* both places; the heading over it is the caller's. */
|
|
15
|
+
export declare function FeedbackDiagnosticsList({ entries }: {
|
|
16
|
+
entries: ReadonlyArray<readonly [string, string]>;
|
|
17
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
function diagnosticsEntries(diagnostics) {
|
|
4
|
+
if (!diagnostics || typeof diagnostics !== "object" || Array.isArray(diagnostics)) return [];
|
|
5
|
+
return Object.entries(diagnostics).map(([key, v]) => [
|
|
6
|
+
key,
|
|
7
|
+
v === null || v === void 0 || v === "" ? "\u2014" : typeof v === "object" ? JSON.stringify(v) : String(v)
|
|
8
|
+
]);
|
|
9
|
+
}
|
|
10
|
+
function FeedbackDiagnosticsList({ entries }) {
|
|
11
|
+
return /* @__PURE__ */ jsx(
|
|
12
|
+
"dl",
|
|
13
|
+
{
|
|
14
|
+
className: "grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-0.5 font-mono text-xs",
|
|
15
|
+
"data-feedback-diagnostics": "",
|
|
16
|
+
children: entries.map(([key, text]) => /* @__PURE__ */ jsxs("div", { className: "contents", children: [
|
|
17
|
+
/* @__PURE__ */ jsx("dt", { className: "text-muted", children: key }),
|
|
18
|
+
/* @__PURE__ */ jsx("dd", { className: "min-w-0 break-words text-secondary", children: text })
|
|
19
|
+
] }, key))
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
FeedbackDiagnosticsList,
|
|
25
|
+
diagnosticsEntries
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=feedback-diagnostics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/feedback/feedback-diagnostics.tsx"],"sourcesContent":["/**\n * `context.diagnostics` (§3.2), drawn one way wherever it shows: in the submit dialog's\n * context box, to the reporter before it goes (§4.2), and in the row detail, to the admin\n * and the author afterwards (§4.4.2). One module for both, so the reporter is shown the\n * very lines the admin will read (keksdose live #481).\n *\n * Internal: neither `@eifi1/ui-kit/feedback` nor the barrel names it.\n */\n\n/** `diagnostics` as [key, text] pairs, in the app's order: a string, number or boolean as\n * written, an object or a list as JSON, nothing as \"—\". Empty for no diagnostics, and for\n * a value that is not a plain object — the server stores whatever the client sent. */\nexport function diagnosticsEntries(diagnostics: unknown): Array<[string, string]> {\n if (!diagnostics || typeof diagnostics !== \"object\" || Array.isArray(diagnostics)) return [];\n return Object.entries(diagnostics).map(([key, v]) => [\n key,\n v === null || v === undefined || v === \"\"\n ? \"—\"\n : typeof v === \"object\"\n ? JSON.stringify(v)\n : String(v as string | number | boolean | bigint),\n ]);\n}\n\n/** The pairs as a definition list: each key beside its value, in monospace. Read-only in\n * both places; the heading over it is the caller's. */\nexport function FeedbackDiagnosticsList({ entries }: { entries: ReadonlyArray<readonly [string, string]> }) {\n return (\n <dl\n className=\"grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-0.5 font-mono text-xs\"\n data-feedback-diagnostics=\"\"\n >\n {entries.map(([key, text]) => (\n <div key={key} className=\"contents\">\n <dt className=\"text-muted\">{key}</dt>\n <dd className=\"min-w-0 break-words text-secondary\">{text}</dd>\n </div>\n ))}\n </dl>\n );\n}\n"],"mappings":";AAiCQ,SACE,KADF;AArBD,SAAS,mBAAmB,aAA+C;AAChF,MAAI,CAAC,eAAe,OAAO,gBAAgB,YAAY,MAAM,QAAQ,WAAW,EAAG,QAAO,CAAC;AAC3F,SAAO,OAAO,QAAQ,WAAW,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM;AAAA,IACnD;AAAA,IACA,MAAM,QAAQ,MAAM,UAAa,MAAM,KACnC,WACA,OAAO,MAAM,WACX,KAAK,UAAU,CAAC,IAChB,OAAO,CAAuC;AAAA,EACtD,CAAC;AACH;AAIO,SAAS,wBAAwB,EAAE,QAAQ,GAA0D;AAC1G,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV,6BAA0B;AAAA,MAEzB,kBAAQ,IAAI,CAAC,CAAC,KAAK,IAAI,MACtB,qBAAC,SAAc,WAAU,YACvB;AAAA,4BAAC,QAAG,WAAU,cAAc,eAAI;AAAA,QAChC,oBAAC,QAAG,WAAU,sCAAsC,gBAAK;AAAA,WAFjD,GAGV,CACD;AAAA;AAAA,EACH;AAEJ;","names":[]}
|
|
@@ -120,6 +120,16 @@ interface FeedbackDialogBaseProps<C extends string = string> {
|
|
|
120
120
|
* English. Optional since 0.12.0; a whole `FeedbackDialogLabels` still fits. */
|
|
121
121
|
labels?: LabelOverride<FeedbackDialogLabels>;
|
|
122
122
|
submitting?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* The subject and the body each opening starts with, in place of empty fields — the
|
|
125
|
+
* reporter edits them like anything typed. `useFeedbackSubmit().open(category, { title,
|
|
126
|
+
* body })` passes them (keksdose live #481: "Report this problem" opens on words the
|
|
127
|
+
* screen already knows). Read when the dialog opens; a change while it is open leaves
|
|
128
|
+
* the draft alone.
|
|
129
|
+
*/
|
|
130
|
+
defaultTitle?: string;
|
|
131
|
+
/** The body's, as `defaultTitle` is the subject's. */
|
|
132
|
+
defaultBody?: string;
|
|
123
133
|
contextSlot?: ReactNode;
|
|
124
134
|
attachmentAccept?: string[];
|
|
125
135
|
maxAttachmentBytes?: number;
|
|
@@ -26,6 +26,8 @@ function FeedbackDialog(props) {
|
|
|
26
26
|
onCategoryChange,
|
|
27
27
|
labels: labelsProp,
|
|
28
28
|
submitting = false,
|
|
29
|
+
defaultTitle = "",
|
|
30
|
+
defaultBody = "",
|
|
29
31
|
contextSlot,
|
|
30
32
|
attachmentAccept = DEFAULT_ATTACHMENT_ACCEPT,
|
|
31
33
|
maxAttachmentBytes = DEFAULT_MAX_ATTACHMENT_BYTES,
|
|
@@ -35,8 +37,8 @@ function FeedbackDialog(props) {
|
|
|
35
37
|
attachmentButtonSize,
|
|
36
38
|
publicNotice
|
|
37
39
|
} = props;
|
|
38
|
-
const [title, setTitle] = useState(
|
|
39
|
-
const [body, setBody] = useState(
|
|
40
|
+
const [title, setTitle] = useState(defaultTitle);
|
|
41
|
+
const [body, setBody] = useState(defaultBody);
|
|
40
42
|
const [attachment, setAttachment] = useState(null);
|
|
41
43
|
const [screenshot, setScreenshot] = useState(null);
|
|
42
44
|
const [files, setFiles] = useState([]);
|
|
@@ -51,8 +53,8 @@ function FeedbackDialog(props) {
|
|
|
51
53
|
if (open !== wasOpen) {
|
|
52
54
|
setWasOpen(open);
|
|
53
55
|
if (open) {
|
|
54
|
-
setTitle(
|
|
55
|
-
setBody(
|
|
56
|
+
setTitle(defaultTitle);
|
|
57
|
+
setBody(defaultBody);
|
|
56
58
|
setAttachment(null);
|
|
57
59
|
setScreenshot(null);
|
|
58
60
|
setFiles([]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/feedback/feedback-dialog.tsx"],"sourcesContent":["import { useId, useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { Button } from \"../components/button\";\nimport { Input } from \"../components/input\";\nimport { Select } from \"../components/select\";\nimport { Textarea } from \"../components/textarea\";\nimport type { ButtonSize, ButtonVariant } from \"../components/button-look\";\nimport { Modal } from \"../components/modal\";\nimport { isApplePlatform } from \"../hooks/use-hotkey\";\nimport { usePhoneLayout } from \"../hooks/use-breakpoint\";\nimport { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { hasContent } from \"../lib/presence\";\nimport {\n DEFAULT_ATTACHMENT_ACCEPT,\n DEFAULT_FEEDBACK_ATTACHMENT_LABELS,\n DEFAULT_MAX_ATTACHMENT_BYTES,\n FeedbackAttachmentField,\n type FeedbackAttachmentError,\n type FeedbackAttachmentErrorInfo,\n} from \"./feedback-attachment\";\nimport { DEFAULT_FEEDBACK_DIALOG_LABELS } from \"./feedback-dialog-labels\";\n\n/** One category the dialog offers. `C` (0.52): the app's category type — the kit's\n * `FeedbackCategory`, or `string` (the default) for a vocabulary of the app's own. */\nexport interface FeedbackCategoryOption<C extends string = string> {\n value: C;\n label: string;\n}\n\nexport interface FeedbackAttachmentLabels {\n /** The heading over the field. Optional: a note editor puts the buttons\n * straight under its textarea, where a second heading is noise. */\n attachment?: string;\n attachmentAdd: string;\n /** Label for the \"capture screenshot\" button. Optional — falls back to the provider's\n * `feedbackAttachment.attachmentCapture`, then English. */\n attachmentCapture?: string;\n /** The line under the attachment buttons saying a screenshot can be pasted\n * straight in. Optional — falls back to the provider's `feedbackAttachment`, then English. */\n attachmentPaste?: string;\n attachmentRemove: string;\n /** `multiple` mode (0.15.5): the chip list's accessible name — and, in\n * `<FeedbackDialog attachments=\"multiple\">`, the heading over it (0.16.0). Optional,\n * as are the keys below — they fall back to the provider's `feedbackAttachment`,\n * then English. */\n attachmentList?: string;\n /** `multiple` mode (0.16.0): the screenshot slot's chip title, in place of its file name. */\n attachmentScreenshot?: string;\n /** `multiple` mode: one chip's remove button, given the file's name. */\n attachmentRemoveFile?: (name: string) => string;\n /** `multiple` mode: the line shown once `max` files are attached. */\n attachmentLimit?: (max: number) => string;\n /** `refs` mode (0.22.0): the second line of a chip whose upload is still running. */\n attachmentUploading?: string;\n}\n\nexport interface FeedbackDialogLabels extends FeedbackAttachmentLabels {\n title: string;\n category: string;\n subject: string;\n body: string;\n attachment: string;\n /** See {@link FeedbackDialogTextLabels.submitHint}. */\n submitHint: FeedbackSubmitHint;\n cancel: string;\n save: string;\n}\n\n/** The submit hint: a string, or the line for the platform (`apple`: Mac, iPhone, iPad). */\nexport type FeedbackSubmitHint = string | ((apple: boolean) => string);\n\n/**\n * The dialog's own strings — the `feedbackDialog` namespace of `<UiKitProvider\n * labels>` (0.12.0). The attachment keys are not repeated here: they are the\n * `feedbackAttachment` namespace's, which the field inside already reads.\n *\n * Before, every key was required at the call site, so each app restated ten strings\n * wherever it mounted the dialog (kastlan feedback-button.tsx built the object inline).\n */\nexport interface FeedbackDialogTextLabels {\n title: string;\n category: string;\n subject: string;\n body: string;\n /** The body's label when `requireBody={false}`: \"What happened? (optional)\".\n * Optional, so a complete `UiKitLabels` typed before 0.14.2 still compiles. */\n bodyOptional?: string;\n /** The heading over the attachment buttons. */\n attachment: string;\n /**\n * The line beside the buttons naming the shortcut. Since 0.27.0 a function of the\n * platform, like `form.submitShortcut`: `apple` is true on a Mac, iPhone or iPad, where\n * the key is Cmd — \"⌘ Enter to send\" there, keksdose's \"Ctrl+Enter to send\" elsewhere\n * (§7.12). A plain string is still taken and shown everywhere, as before 0.27.0.\n */\n submitHint: FeedbackSubmitHint;\n cancel: string;\n save: string;\n /** 0.38 (docs/feedback-harmonization.md §9.2 decision 6): the line under the body when\n * reports are public — `useFeedbackSubmit({ publicNotice: true })` shows it. Optional,\n * so a complete `UiKitLabels` typed before 0.38 still compiles. de-CH \"Andere Personen\n * sehen Titel und Text (nie Ihre Screenshots oder Dateien).\" */\n publicNotice?: string;\n}\n\n// Defined in ./feedback-dialog-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_FEEDBACK_DIALOG_LABELS };\n\nexport interface FeedbackSubmission<C extends string = string> {\n title: string;\n body: string;\n category: C;\n attachment: File | null;\n}\n\n/**\n * What `onSubmit` gets under `attachments=\"multiple\"` (0.15.5): the screenshot and\n * the picked/pasted files apart, because an app files them differently — keksdose\n * attaches the screenshot to the report and the photos as its evidence list. No\n * `attachment`: there is no one file it could name.\n */\nexport interface FeedbackMultipleSubmission<C extends string = string> {\n title: string;\n body: string;\n category: C;\n /** What `onCaptureScreenshot` returned, or `null` — at most one. */\n screenshot: File | null;\n /** Picked and pasted files, in the order they were added; at most `maxAttachments`. */\n attachments: File[];\n}\n\n/**\n * `C` (0.52, refactor audit 2026-10-30, API-7): the category type, inferred from\n * `categories` and `category` — `FeedbackCategory` hands `onCategoryChange` and\n * `onSubmit` a `FeedbackCategory` back, where a plain `string` had to be cast (the kit's\n * own `useFeedbackSubmit` did). `string` by default, so an app's own vocabulary fits.\n */\ninterface FeedbackDialogBaseProps<C extends string = string> {\n open: boolean;\n onClose: () => void;\n /** `readonly` since 0.52: the dialog never changes it. */\n categories: readonly FeedbackCategoryOption<C>[];\n category: C;\n onCategoryChange: (value: C) => void;\n /** Prop > `<UiKitProvider labels={{ feedbackDialog, feedbackAttachment }}>` >\n * English. Optional since 0.12.0; a whole `FeedbackDialogLabels` still fits. */\n labels?: LabelOverride<FeedbackDialogLabels>;\n submitting?: boolean;\n contextSlot?: ReactNode;\n attachmentAccept?: string[];\n maxAttachmentBytes?: number;\n /**\n * Optional: capture a screenshot of the underlying app view and return it as a\n * File. When provided, a \"Capture screenshot\" button is shown next to \"Add\n * attachment\"; the returned file is fed through the same validation + preview.\n */\n onCaptureScreenshot?: () => Promise<File | null>;\n /**\n * `false`: a report with only a subject can be sent, and the body's label says it is\n * optional (`bodyOptional`, unless `labels.body` is passed). Default `true`, the\n * dialog's behaviour until 0.14.2 (keksdose K1: its backend takes title-only reports).\n */\n requireBody?: boolean;\n /**\n * The attachment field's add and capture buttons: its `buttonVariant` (0.25.0),\n * Button's own `variant`. Default `\"secondary\"`, the look they always had.\n *\n * The field took `buttonVariant` / `buttonSize` in 0.24.0 (keksdose's support chat),\n * but the dialog builds its field itself and passed neither, so a host that wanted\n * quieter buttons here — a dialog that already ends in a row of Cancel / Send — had\n * no way to say so short of rebuilding the dialog. Named after the dialog's other\n * attachment options (`attachmentAccept`, `onAttachmentError`) and handed through\n * unchanged, in both `attachments` modes.\n */\n attachmentButtonVariant?: ButtonVariant;\n /** The attachment field's `buttonSize` (0.25.0) — with {@link attachmentButtonVariant}.\n * Default `\"md\"`; `\"sm\"` draws the paperclip and camera at 14px. */\n attachmentButtonSize?: ButtonSize;\n /**\n * A muted line under the body saying who will read it (0.38, docs/feedback-harmonization.md\n * §9.2 decision 6) — the kit's sentence is `feedbackDialog.publicNotice`, \"Other users\n * will see the title and text (never your screenshots or files)\", which\n * `useFeedbackSubmit({ publicNotice: true })` passes. Attached to the body field with\n * `aria-describedby`, so it is heard where the text is written. Left out: no line.\n */\n publicNotice?: ReactNode;\n}\n\n/** One attachment — a screenshot, a picked or a pasted image; a second replaces\n * nothing, it has to wait for the first to be removed. The default. */\nexport interface FeedbackDialogSingleProps<C extends string = string> extends FeedbackDialogBaseProps<C> {\n attachments?: \"single\";\n onSubmit: (data: FeedbackSubmission<C>) => void | Promise<void>;\n /** `info` (0.23.0) names the refused file and the limit — see\n * {@link FeedbackAttachmentErrorInfo}. */\n onAttachmentError?: (kind: \"type\" | \"size\", info: FeedbackAttachmentErrorInfo) => void;\n /** Multiple mode only — refused here rather than silently ignored. */\n maxAttachments?: never;\n}\n\n/**\n * One screenshot plus up to `maxAttachments` picked or pasted files (0.15.5, keksdose\n * dev#578: \"pasted two photos, the second overwrote the first\"). The capture button is\n * offered while there is no screenshot yet; the add button while there is room.\n */\nexport interface FeedbackDialogMultipleProps<C extends string = string> extends FeedbackDialogBaseProps<C> {\n attachments: \"multiple\";\n /** Default `DEFAULT_MAX_ATTACHMENTS` (5). The screenshot does not count. */\n maxAttachments?: number;\n onSubmit: (data: FeedbackMultipleSubmission<C>) => void | Promise<void>;\n /** `\"count\"`: more files arrived at once than there was room for; the surplus was\n * dropped. `info` (0.23.0) names the refused file(s) and the limit. */\n onAttachmentError?: (kind: FeedbackAttachmentError, info: FeedbackAttachmentErrorInfo) => void;\n}\n\nexport type FeedbackDialogProps<C extends string = string> =\n FeedbackDialogSingleProps<C> | FeedbackDialogMultipleProps<C>;\n\n/**\n * The generic feedback form dialog: category + subject + body + an optional image\n * attachment, with Ctrl/Cmd+Enter to submit. Domain-free — the app supplies the\n * category options, labels and an `onSubmit` that talks to its own backend, plus\n * an optional `contextSlot` for app-specific context (user, current URL, …).\n *\n * **A screenshot can be pasted straight in.** Ctrl/Cmd+V anywhere in the dialog\n * takes an image off the clipboard and makes it the attachment, through the same\n * validation and the same preview as the file picker. It is the gesture the two\n * ways in did not cover: `onCaptureScreenshot` snapshots the *whole* app view,\n * and the file picker needs a file — so somebody who wanted to show one panel,\n * or one region of one, had to save a crop to disk first and then find it again\n * (Steering Design feedback #39). The clipboard is where a region snip already\n * is on every platform.\n *\n * **`attachments=\"multiple\"`** (0.15.5) takes several: every paste and pick adds a\n * chip, and `onSubmit` gets `{ screenshot, attachments }` ({@link\n * FeedbackMultipleSubmission}) instead of `attachment`. Opt-in, so a caller typed\n * against the one-file submission keeps compiling and behaving as before.\n */\nexport function FeedbackDialog<C extends string = string>(props: FeedbackDialogProps<C>) {\n const {\n open,\n onClose,\n categories,\n category,\n onCategoryChange,\n labels: labelsProp,\n submitting = false,\n contextSlot,\n attachmentAccept = DEFAULT_ATTACHMENT_ACCEPT,\n maxAttachmentBytes = DEFAULT_MAX_ATTACHMENT_BYTES,\n onCaptureScreenshot,\n requireBody = true,\n attachmentButtonVariant,\n attachmentButtonSize,\n publicNotice,\n } = props;\n const [title, setTitle] = useState(\"\");\n const [body, setBody] = useState(\"\");\n const [attachment, setAttachment] = useState<File | null>(null);\n // `attachments=\"multiple\"` only: the capture, apart from the picked/pasted files.\n const [screenshot, setScreenshot] = useState<File | null>(null);\n const [files, setFiles] = useState<File[]>([]);\n const isMobile = usePhoneLayout();\n const noticeId = useId();\n const hasNotice = hasContent(publicNotice);\n const labels = useKitLabels(\"feedbackDialog\", DEFAULT_FEEDBACK_DIALOG_LABELS, labelsProp);\n const attachmentText = useKitLabels(\"feedbackAttachment\", DEFAULT_FEEDBACK_ATTACHMENT_LABELS, labelsProp);\n // Under `multiple` the heading is `attachmentList` — a screenshot AND photos — which\n // also names the chip list beneath it: one string, so the two cannot disagree. Its old\n // second name, `feedbackDialog.attachments`, went in 0.34.\n const listHeading =\n labelsProp?.attachmentList ?? attachmentText.attachmentList ?? DEFAULT_FEEDBACK_ATTACHMENT_LABELS.attachmentList!;\n // The attachment field resolves its own keys from `feedbackAttachment`; it gets the\n // prop's (so a caller's `attachmentAdd` still wins) plus the resolved heading.\n const attachmentLabels =\n props.attachments === \"multiple\"\n ? { ...labelsProp, attachment: listHeading, attachmentList: listHeading }\n : { ...labelsProp, attachment: labels.attachment };\n\n // Reset the form whenever the dialog is (re)opened — during render, on the\n // closed-to-open transition, so the old draft never paints for a frame.\n const [wasOpen, setWasOpen] = useState(open);\n if (open !== wasOpen) {\n setWasOpen(open);\n if (open) {\n setTitle(\"\");\n setBody(\"\");\n setAttachment(null);\n setScreenshot(null);\n setFiles([]);\n }\n }\n\n // Trimmed: a subject or body of spaces is empty (keksdose's API answers a blank title\n // with a 422, and a blank report is no report).\n const canSubmit = !!title.trim() && (!requireBody || !!body.trim()) && !submitting;\n const trySubmit = () => {\n if (!canSubmit) return;\n if (props.attachments === \"multiple\") {\n void props.onSubmit({ title, body, category, screenshot, attachments: files });\n } else {\n void props.onSubmit({ title, body, category, attachment });\n }\n };\n\n if (!open) return null;\n\n const categoryField = (\n // The select offers exactly `categories`' values, so what it answers is one of them.\n <Select label={labels.category} value={category} onChange={(e) => onCategoryChange(e.target.value as C)}>\n {categories.map((c) => (\n <option key={c.value} value={c.value}>\n {c.label}\n </option>\n ))}\n </Select>\n );\n // On a phone the subject leads as a heading rather than as the second of two\n // identical boxes under a select (Keksdose feedback #179). `variant=\"display\"`\n // is a no-op above the phone breakpoint, so the desktop dialog is unchanged.\n const subjectField = (\n <Input label={labels.subject} value={title} onChange={(e) => setTitle(e.target.value)} variant=\"display\" />\n );\n const bodyTextarea = (\n <Textarea\n rows={5}\n label={requireBody ? labels.body : (labelsProp?.body ?? labels.bodyOptional ?? labels.body)}\n value={body}\n onChange={(e) => setBody(e.target.value)}\n aria-describedby={hasNotice ? noticeId : undefined}\n />\n );\n // 0.38: who will read it, right under what they are writing (§9.2 decision 6).\n const bodyField = hasNotice ? (\n <div className=\"space-y-1\">\n {bodyTextarea}\n <p id={noticeId} className=\"text-xs text-muted\" data-feedback-public-notice=\"\">\n {publicNotice}\n </p>\n </div>\n ) : (\n bodyTextarea\n );\n const fieldProps = {\n labels: attachmentLabels,\n accept: attachmentAccept,\n maxBytes: maxAttachmentBytes,\n onCaptureScreenshot,\n // Left undefined they are the field's own defaults (secondary / md).\n buttonVariant: attachmentButtonVariant,\n buttonSize: attachmentButtonSize,\n // On `document`, not on the panel: the Modal focuses its own panel on open\n // and traps Tab inside it, so while this dialog is up every paste in the\n // page is meant for it — including the one made with nothing in\n // particular focused, which never reaches a React `onPaste` on a child.\n documentPaste: open,\n };\n const attachmentField =\n props.attachments === \"multiple\" ? (\n <FeedbackAttachmentField\n {...fieldProps}\n multiple\n value={files}\n onChange={setFiles}\n max={props.maxAttachments}\n // The capture goes to its own slot, so it is offered once and never crowds\n // out a photo; a paste is a photo (a region snip is chosen evidence, not \"the\n // screenshot\").\n screenshot={screenshot}\n onScreenshotChange={setScreenshot}\n onError={props.onAttachmentError}\n />\n ) : (\n <FeedbackAttachmentField\n {...fieldProps}\n value={attachment}\n onChange={setAttachment}\n onError={props.onAttachmentError}\n />\n );\n\n return (\n <Modal\n onClose={onClose}\n // The one dialog whose subject is the page behind it (Keksdose dev#460: \"Make\n // the feedback dialog draggable so I can see behind it if it blocks\n // something\") — you are describing what is under it while you type.\n draggable\n onKeyDown={(e) => {\n if ((e.ctrlKey || e.metaKey) && e.key === \"Enter\") {\n e.preventDefault();\n trySubmit();\n }\n }}\n >\n {/* Also the drag handle: pressing anywhere on the panel's own chrome moves it,\n and the heading is the strip a user reaches for. */}\n <h2 className=\"mb-3 text-lg font-semibold\">{labels.title}</h2>\n <div className=\"space-y-3\">\n {isMobile ? (\n // Phone shape, the same reasoning as the transaction editor's (#177):\n // the desktop order is the DATA MODEL's order — category, then subject,\n // then body — but nobody opens this dialog to pick a category. What they\n // came to do is say the thing, so that leads; the classification and the\n // evidence follow, a tier down.\n <>\n {subjectField}\n {bodyField}\n <div className=\"space-y-3 border-t border-subtle pt-3\">\n {categoryField}\n {attachmentField}\n {contextSlot}\n </div>\n </>\n ) : (\n <>\n {categoryField}\n {subjectField}\n {bodyField}\n {attachmentField}\n {contextSlot}\n </>\n )}\n <div className=\"flex items-center justify-between gap-2\">\n <div className=\"text-xs text-placeholder\">\n {typeof labels.submitHint === \"function\" ? labels.submitHint(isApplePlatform()) : labels.submitHint}\n </div>\n <div className=\"flex gap-2\">\n <Button variant=\"ghost\" onClick={onClose}>\n {labels.cancel}\n </Button>\n <Button onClick={trySubmit} disabled={!canSubmit}>\n {labels.save}\n </Button>\n </div>\n </div>\n </div>\n </Modal>\n );\n}\n"],"mappings":";AAuTQ,SA8FE,UA9FF,KAuBJ,YAvBI;AAvTR,SAAS,OAAO,gBAAgB;AAEhC,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,cAAc;AACvB,SAAS,gBAAgB;AAEzB,SAAS,aAAa;AACtB,SAAS,uBAAuB;AAChC,SAAS,sBAAsB;AAC/B,SAAS,oBAAwC;AACjD,SAAS,kBAAkB;AAC3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP,SAAS,sCAAsC;AA0NxC,SAAS,eAA0C,OAA+B;AACvF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR,aAAa;AAAA,IACb;AAAA,IACA,mBAAmB;AAAA,IACnB,qBAAqB;AAAA,IACrB;AAAA,IACA,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,EAAE;AACrC,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,EAAE;AACnC,QAAM,CAAC,YAAY,aAAa,IAAI,SAAsB,IAAI;AAE9D,QAAM,CAAC,YAAY,aAAa,IAAI,SAAsB,IAAI;AAC9D,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAiB,CAAC,CAAC;AAC7C,QAAM,WAAW,eAAe;AAChC,QAAM,WAAW,MAAM;AACvB,QAAM,YAAY,WAAW,YAAY;AACzC,QAAM,S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A,YAMC,iCACG;AAAA;AAAA,cACA;AAAA,cACD,qBAAC,SAAI,WAAU,yCACZ;AAAA;AAAA,gBACA;AAAA,gBACA;AAAA,iBACH;AAAA,eACF;AAAA,cAEA,iCACG;AAAA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,aACH;AAAA,UAEF,qBAAC,SAAI,WAAU,2CACb;AAAA,gCAAC,SAAI,WAAU,4BACZ,iBAAO,OAAO,eAAe,aAAa,OAAO,WAAW,gBAAgB,CAAC,IAAI,OAAO,YAC3F;AAAA,YACA,qBAAC,SAAI,WAAU,cACb;AAAA,kCAAC,UAAO,SAAQ,SAAQ,SAAS,SAC9B,iBAAO,QACV;AAAA,cACA,oBAAC,UAAO,SAAS,WAAW,UAAU,CAAC,WACpC,iBAAO,MACV;AAAA,eACF;AAAA,aACF;AAAA,WACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/feedback/feedback-dialog.tsx"],"sourcesContent":["import { useId, useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { Button } from \"../components/button\";\nimport { Input } from \"../components/input\";\nimport { Select } from \"../components/select\";\nimport { Textarea } from \"../components/textarea\";\nimport type { ButtonSize, ButtonVariant } from \"../components/button-look\";\nimport { Modal } from \"../components/modal\";\nimport { isApplePlatform } from \"../hooks/use-hotkey\";\nimport { usePhoneLayout } from \"../hooks/use-breakpoint\";\nimport { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { hasContent } from \"../lib/presence\";\nimport {\n DEFAULT_ATTACHMENT_ACCEPT,\n DEFAULT_FEEDBACK_ATTACHMENT_LABELS,\n DEFAULT_MAX_ATTACHMENT_BYTES,\n FeedbackAttachmentField,\n type FeedbackAttachmentError,\n type FeedbackAttachmentErrorInfo,\n} from \"./feedback-attachment\";\nimport { DEFAULT_FEEDBACK_DIALOG_LABELS } from \"./feedback-dialog-labels\";\n\n/** One category the dialog offers. `C` (0.52): the app's category type — the kit's\n * `FeedbackCategory`, or `string` (the default) for a vocabulary of the app's own. */\nexport interface FeedbackCategoryOption<C extends string = string> {\n value: C;\n label: string;\n}\n\nexport interface FeedbackAttachmentLabels {\n /** The heading over the field. Optional: a note editor puts the buttons\n * straight under its textarea, where a second heading is noise. */\n attachment?: string;\n attachmentAdd: string;\n /** Label for the \"capture screenshot\" button. Optional — falls back to the provider's\n * `feedbackAttachment.attachmentCapture`, then English. */\n attachmentCapture?: string;\n /** The line under the attachment buttons saying a screenshot can be pasted\n * straight in. Optional — falls back to the provider's `feedbackAttachment`, then English. */\n attachmentPaste?: string;\n attachmentRemove: string;\n /** `multiple` mode (0.15.5): the chip list's accessible name — and, in\n * `<FeedbackDialog attachments=\"multiple\">`, the heading over it (0.16.0). Optional,\n * as are the keys below — they fall back to the provider's `feedbackAttachment`,\n * then English. */\n attachmentList?: string;\n /** `multiple` mode (0.16.0): the screenshot slot's chip title, in place of its file name. */\n attachmentScreenshot?: string;\n /** `multiple` mode: one chip's remove button, given the file's name. */\n attachmentRemoveFile?: (name: string) => string;\n /** `multiple` mode: the line shown once `max` files are attached. */\n attachmentLimit?: (max: number) => string;\n /** `refs` mode (0.22.0): the second line of a chip whose upload is still running. */\n attachmentUploading?: string;\n}\n\nexport interface FeedbackDialogLabels extends FeedbackAttachmentLabels {\n title: string;\n category: string;\n subject: string;\n body: string;\n attachment: string;\n /** See {@link FeedbackDialogTextLabels.submitHint}. */\n submitHint: FeedbackSubmitHint;\n cancel: string;\n save: string;\n}\n\n/** The submit hint: a string, or the line for the platform (`apple`: Mac, iPhone, iPad). */\nexport type FeedbackSubmitHint = string | ((apple: boolean) => string);\n\n/**\n * The dialog's own strings — the `feedbackDialog` namespace of `<UiKitProvider\n * labels>` (0.12.0). The attachment keys are not repeated here: they are the\n * `feedbackAttachment` namespace's, which the field inside already reads.\n *\n * Before, every key was required at the call site, so each app restated ten strings\n * wherever it mounted the dialog (kastlan feedback-button.tsx built the object inline).\n */\nexport interface FeedbackDialogTextLabels {\n title: string;\n category: string;\n subject: string;\n body: string;\n /** The body's label when `requireBody={false}`: \"What happened? (optional)\".\n * Optional, so a complete `UiKitLabels` typed before 0.14.2 still compiles. */\n bodyOptional?: string;\n /** The heading over the attachment buttons. */\n attachment: string;\n /**\n * The line beside the buttons naming the shortcut. Since 0.27.0 a function of the\n * platform, like `form.submitShortcut`: `apple` is true on a Mac, iPhone or iPad, where\n * the key is Cmd — \"⌘ Enter to send\" there, keksdose's \"Ctrl+Enter to send\" elsewhere\n * (§7.12). A plain string is still taken and shown everywhere, as before 0.27.0.\n */\n submitHint: FeedbackSubmitHint;\n cancel: string;\n save: string;\n /** 0.38 (docs/feedback-harmonization.md §9.2 decision 6): the line under the body when\n * reports are public — `useFeedbackSubmit({ publicNotice: true })` shows it. Optional,\n * so a complete `UiKitLabels` typed before 0.38 still compiles. de-CH \"Andere Personen\n * sehen Titel und Text (nie Ihre Screenshots oder Dateien).\" */\n publicNotice?: string;\n}\n\n// Defined in ./feedback-dialog-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_FEEDBACK_DIALOG_LABELS };\n\nexport interface FeedbackSubmission<C extends string = string> {\n title: string;\n body: string;\n category: C;\n attachment: File | null;\n}\n\n/**\n * What `onSubmit` gets under `attachments=\"multiple\"` (0.15.5): the screenshot and\n * the picked/pasted files apart, because an app files them differently — keksdose\n * attaches the screenshot to the report and the photos as its evidence list. No\n * `attachment`: there is no one file it could name.\n */\nexport interface FeedbackMultipleSubmission<C extends string = string> {\n title: string;\n body: string;\n category: C;\n /** What `onCaptureScreenshot` returned, or `null` — at most one. */\n screenshot: File | null;\n /** Picked and pasted files, in the order they were added; at most `maxAttachments`. */\n attachments: File[];\n}\n\n/**\n * `C` (0.52, refactor audit 2026-10-30, API-7): the category type, inferred from\n * `categories` and `category` — `FeedbackCategory` hands `onCategoryChange` and\n * `onSubmit` a `FeedbackCategory` back, where a plain `string` had to be cast (the kit's\n * own `useFeedbackSubmit` did). `string` by default, so an app's own vocabulary fits.\n */\ninterface FeedbackDialogBaseProps<C extends string = string> {\n open: boolean;\n onClose: () => void;\n /** `readonly` since 0.52: the dialog never changes it. */\n categories: readonly FeedbackCategoryOption<C>[];\n category: C;\n onCategoryChange: (value: C) => void;\n /** Prop > `<UiKitProvider labels={{ feedbackDialog, feedbackAttachment }}>` >\n * English. Optional since 0.12.0; a whole `FeedbackDialogLabels` still fits. */\n labels?: LabelOverride<FeedbackDialogLabels>;\n submitting?: boolean;\n /**\n * The subject and the body each opening starts with, in place of empty fields — the\n * reporter edits them like anything typed. `useFeedbackSubmit().open(category, { title,\n * body })` passes them (keksdose live #481: \"Report this problem\" opens on words the\n * screen already knows). Read when the dialog opens; a change while it is open leaves\n * the draft alone.\n */\n defaultTitle?: string;\n /** The body's, as `defaultTitle` is the subject's. */\n defaultBody?: string;\n contextSlot?: ReactNode;\n attachmentAccept?: string[];\n maxAttachmentBytes?: number;\n /**\n * Optional: capture a screenshot of the underlying app view and return it as a\n * File. When provided, a \"Capture screenshot\" button is shown next to \"Add\n * attachment\"; the returned file is fed through the same validation + preview.\n */\n onCaptureScreenshot?: () => Promise<File | null>;\n /**\n * `false`: a report with only a subject can be sent, and the body's label says it is\n * optional (`bodyOptional`, unless `labels.body` is passed). Default `true`, the\n * dialog's behaviour until 0.14.2 (keksdose K1: its backend takes title-only reports).\n */\n requireBody?: boolean;\n /**\n * The attachment field's add and capture buttons: its `buttonVariant` (0.25.0),\n * Button's own `variant`. Default `\"secondary\"`, the look they always had.\n *\n * The field took `buttonVariant` / `buttonSize` in 0.24.0 (keksdose's support chat),\n * but the dialog builds its field itself and passed neither, so a host that wanted\n * quieter buttons here — a dialog that already ends in a row of Cancel / Send — had\n * no way to say so short of rebuilding the dialog. Named after the dialog's other\n * attachment options (`attachmentAccept`, `onAttachmentError`) and handed through\n * unchanged, in both `attachments` modes.\n */\n attachmentButtonVariant?: ButtonVariant;\n /** The attachment field's `buttonSize` (0.25.0) — with {@link attachmentButtonVariant}.\n * Default `\"md\"`; `\"sm\"` draws the paperclip and camera at 14px. */\n attachmentButtonSize?: ButtonSize;\n /**\n * A muted line under the body saying who will read it (0.38, docs/feedback-harmonization.md\n * §9.2 decision 6) — the kit's sentence is `feedbackDialog.publicNotice`, \"Other users\n * will see the title and text (never your screenshots or files)\", which\n * `useFeedbackSubmit({ publicNotice: true })` passes. Attached to the body field with\n * `aria-describedby`, so it is heard where the text is written. Left out: no line.\n */\n publicNotice?: ReactNode;\n}\n\n/** One attachment — a screenshot, a picked or a pasted image; a second replaces\n * nothing, it has to wait for the first to be removed. The default. */\nexport interface FeedbackDialogSingleProps<C extends string = string> extends FeedbackDialogBaseProps<C> {\n attachments?: \"single\";\n onSubmit: (data: FeedbackSubmission<C>) => void | Promise<void>;\n /** `info` (0.23.0) names the refused file and the limit — see\n * {@link FeedbackAttachmentErrorInfo}. */\n onAttachmentError?: (kind: \"type\" | \"size\", info: FeedbackAttachmentErrorInfo) => void;\n /** Multiple mode only — refused here rather than silently ignored. */\n maxAttachments?: never;\n}\n\n/**\n * One screenshot plus up to `maxAttachments` picked or pasted files (0.15.5, keksdose\n * dev#578: \"pasted two photos, the second overwrote the first\"). The capture button is\n * offered while there is no screenshot yet; the add button while there is room.\n */\nexport interface FeedbackDialogMultipleProps<C extends string = string> extends FeedbackDialogBaseProps<C> {\n attachments: \"multiple\";\n /** Default `DEFAULT_MAX_ATTACHMENTS` (5). The screenshot does not count. */\n maxAttachments?: number;\n onSubmit: (data: FeedbackMultipleSubmission<C>) => void | Promise<void>;\n /** `\"count\"`: more files arrived at once than there was room for; the surplus was\n * dropped. `info` (0.23.0) names the refused file(s) and the limit. */\n onAttachmentError?: (kind: FeedbackAttachmentError, info: FeedbackAttachmentErrorInfo) => void;\n}\n\nexport type FeedbackDialogProps<C extends string = string> =\n FeedbackDialogSingleProps<C> | FeedbackDialogMultipleProps<C>;\n\n/**\n * The generic feedback form dialog: category + subject + body + an optional image\n * attachment, with Ctrl/Cmd+Enter to submit. Domain-free — the app supplies the\n * category options, labels and an `onSubmit` that talks to its own backend, plus\n * an optional `contextSlot` for app-specific context (user, current URL, …).\n *\n * **A screenshot can be pasted straight in.** Ctrl/Cmd+V anywhere in the dialog\n * takes an image off the clipboard and makes it the attachment, through the same\n * validation and the same preview as the file picker. It is the gesture the two\n * ways in did not cover: `onCaptureScreenshot` snapshots the *whole* app view,\n * and the file picker needs a file — so somebody who wanted to show one panel,\n * or one region of one, had to save a crop to disk first and then find it again\n * (Steering Design feedback #39). The clipboard is where a region snip already\n * is on every platform.\n *\n * **`attachments=\"multiple\"`** (0.15.5) takes several: every paste and pick adds a\n * chip, and `onSubmit` gets `{ screenshot, attachments }` ({@link\n * FeedbackMultipleSubmission}) instead of `attachment`. Opt-in, so a caller typed\n * against the one-file submission keeps compiling and behaving as before.\n */\nexport function FeedbackDialog<C extends string = string>(props: FeedbackDialogProps<C>) {\n const {\n open,\n onClose,\n categories,\n category,\n onCategoryChange,\n labels: labelsProp,\n submitting = false,\n defaultTitle = \"\",\n defaultBody = \"\",\n contextSlot,\n attachmentAccept = DEFAULT_ATTACHMENT_ACCEPT,\n maxAttachmentBytes = DEFAULT_MAX_ATTACHMENT_BYTES,\n onCaptureScreenshot,\n requireBody = true,\n attachmentButtonVariant,\n attachmentButtonSize,\n publicNotice,\n } = props;\n const [title, setTitle] = useState(defaultTitle);\n const [body, setBody] = useState(defaultBody);\n const [attachment, setAttachment] = useState<File | null>(null);\n // `attachments=\"multiple\"` only: the capture, apart from the picked/pasted files.\n const [screenshot, setScreenshot] = useState<File | null>(null);\n const [files, setFiles] = useState<File[]>([]);\n const isMobile = usePhoneLayout();\n const noticeId = useId();\n const hasNotice = hasContent(publicNotice);\n const labels = useKitLabels(\"feedbackDialog\", DEFAULT_FEEDBACK_DIALOG_LABELS, labelsProp);\n const attachmentText = useKitLabels(\"feedbackAttachment\", DEFAULT_FEEDBACK_ATTACHMENT_LABELS, labelsProp);\n // Under `multiple` the heading is `attachmentList` — a screenshot AND photos — which\n // also names the chip list beneath it: one string, so the two cannot disagree. Its old\n // second name, `feedbackDialog.attachments`, went in 0.34.\n const listHeading =\n labelsProp?.attachmentList ?? attachmentText.attachmentList ?? DEFAULT_FEEDBACK_ATTACHMENT_LABELS.attachmentList!;\n // The attachment field resolves its own keys from `feedbackAttachment`; it gets the\n // prop's (so a caller's `attachmentAdd` still wins) plus the resolved heading.\n const attachmentLabels =\n props.attachments === \"multiple\"\n ? { ...labelsProp, attachment: listHeading, attachmentList: listHeading }\n : { ...labelsProp, attachment: labels.attachment };\n\n // Reset the form whenever the dialog is (re)opened — during render, on the\n // closed-to-open transition, so the old draft never paints for a frame.\n const [wasOpen, setWasOpen] = useState(open);\n if (open !== wasOpen) {\n setWasOpen(open);\n if (open) {\n setTitle(defaultTitle);\n setBody(defaultBody);\n setAttachment(null);\n setScreenshot(null);\n setFiles([]);\n }\n }\n\n // Trimmed: a subject or body of spaces is empty (keksdose's API answers a blank title\n // with a 422, and a blank report is no report).\n const canSubmit = !!title.trim() && (!requireBody || !!body.trim()) && !submitting;\n const trySubmit = () => {\n if (!canSubmit) return;\n if (props.attachments === \"multiple\") {\n void props.onSubmit({ title, body, category, screenshot, attachments: files });\n } else {\n void props.onSubmit({ title, body, category, attachment });\n }\n };\n\n if (!open) return null;\n\n const categoryField = (\n // The select offers exactly `categories`' values, so what it answers is one of them.\n <Select label={labels.category} value={category} onChange={(e) => onCategoryChange(e.target.value as C)}>\n {categories.map((c) => (\n <option key={c.value} value={c.value}>\n {c.label}\n </option>\n ))}\n </Select>\n );\n // On a phone the subject leads as a heading rather than as the second of two\n // identical boxes under a select (Keksdose feedback #179). `variant=\"display\"`\n // is a no-op above the phone breakpoint, so the desktop dialog is unchanged.\n const subjectField = (\n <Input label={labels.subject} value={title} onChange={(e) => setTitle(e.target.value)} variant=\"display\" />\n );\n const bodyTextarea = (\n <Textarea\n rows={5}\n label={requireBody ? labels.body : (labelsProp?.body ?? labels.bodyOptional ?? labels.body)}\n value={body}\n onChange={(e) => setBody(e.target.value)}\n aria-describedby={hasNotice ? noticeId : undefined}\n />\n );\n // 0.38: who will read it, right under what they are writing (§9.2 decision 6).\n const bodyField = hasNotice ? (\n <div className=\"space-y-1\">\n {bodyTextarea}\n <p id={noticeId} className=\"text-xs text-muted\" data-feedback-public-notice=\"\">\n {publicNotice}\n </p>\n </div>\n ) : (\n bodyTextarea\n );\n const fieldProps = {\n labels: attachmentLabels,\n accept: attachmentAccept,\n maxBytes: maxAttachmentBytes,\n onCaptureScreenshot,\n // Left undefined they are the field's own defaults (secondary / md).\n buttonVariant: attachmentButtonVariant,\n buttonSize: attachmentButtonSize,\n // On `document`, not on the panel: the Modal focuses its own panel on open\n // and traps Tab inside it, so while this dialog is up every paste in the\n // page is meant for it — including the one made with nothing in\n // particular focused, which never reaches a React `onPaste` on a child.\n documentPaste: open,\n };\n const attachmentField =\n props.attachments === \"multiple\" ? (\n <FeedbackAttachmentField\n {...fieldProps}\n multiple\n value={files}\n onChange={setFiles}\n max={props.maxAttachments}\n // The capture goes to its own slot, so it is offered once and never crowds\n // out a photo; a paste is a photo (a region snip is chosen evidence, not \"the\n // screenshot\").\n screenshot={screenshot}\n onScreenshotChange={setScreenshot}\n onError={props.onAttachmentError}\n />\n ) : (\n <FeedbackAttachmentField\n {...fieldProps}\n value={attachment}\n onChange={setAttachment}\n onError={props.onAttachmentError}\n />\n );\n\n return (\n <Modal\n onClose={onClose}\n // The one dialog whose subject is the page behind it (Keksdose dev#460: \"Make\n // the feedback dialog draggable so I can see behind it if it blocks\n // something\") — you are describing what is under it while you type.\n draggable\n onKeyDown={(e) => {\n if ((e.ctrlKey || e.metaKey) && e.key === \"Enter\") {\n e.preventDefault();\n trySubmit();\n }\n }}\n >\n {/* Also the drag handle: pressing anywhere on the panel's own chrome moves it,\n and the heading is the strip a user reaches for. */}\n <h2 className=\"mb-3 text-lg font-semibold\">{labels.title}</h2>\n <div className=\"space-y-3\">\n {isMobile ? (\n // Phone shape, the same reasoning as the transaction editor's (#177):\n // the desktop order is the DATA MODEL's order — category, then subject,\n // then body — but nobody opens this dialog to pick a category. What they\n // came to do is say the thing, so that leads; the classification and the\n // evidence follow, a tier down.\n <>\n {subjectField}\n {bodyField}\n <div className=\"space-y-3 border-t border-subtle pt-3\">\n {categoryField}\n {attachmentField}\n {contextSlot}\n </div>\n </>\n ) : (\n <>\n {categoryField}\n {subjectField}\n {bodyField}\n {attachmentField}\n {contextSlot}\n </>\n )}\n <div className=\"flex items-center justify-between gap-2\">\n <div className=\"text-xs text-placeholder\">\n {typeof labels.submitHint === \"function\" ? labels.submitHint(isApplePlatform()) : labels.submitHint}\n </div>\n <div className=\"flex gap-2\">\n <Button variant=\"ghost\" onClick={onClose}>\n {labels.cancel}\n </Button>\n <Button onClick={trySubmit} disabled={!canSubmit}>\n {labels.save}\n </Button>\n </div>\n </div>\n </div>\n </Modal>\n );\n}\n"],"mappings":";AAmUQ,SA8FE,UA9FF,KAuBJ,YAvBI;AAnUR,SAAS,OAAO,gBAAgB;AAEhC,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,cAAc;AACvB,SAAS,gBAAgB;AAEzB,SAAS,aAAa;AACtB,SAAS,uBAAuB;AAChC,SAAS,sBAAsB;AAC/B,SAAS,oBAAwC;AACjD,SAAS,kBAAkB;AAC3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP,SAAS,sCAAsC;AAoOxC,SAAS,eAA0C,OAA+B;AACvF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,eAAe;AAAA,IACf,cAAc;AAAA,IACd;AAAA,IACA,mBAAmB;AAAA,IACnB,qBAAqB;AAAA,IACrB;AAAA,IACA,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,YAAY;AAC/C,QAAM,CAA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MAIA,WAAS;AAAA,MACT,WAAW,CAAC,MAAM;AAChB,aAAK,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,SAAS;AACjD,YAAE,eAAe;AACjB,oBAAU;AAAA,QACZ;AAAA,MACF;AAAA,MAIA;AAAA,4BAAC,QAAG,WAAU,8BAA8B,iBAAO,OAAM;AAAA,QACzD,qBAAC,SAAI,WAAU,aACZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAMC,iCACG;AAAA;AAAA,cACA;AAAA,cACD,qBAAC,SAAI,WAAU,yCACZ;AAAA;AAAA,gBACA;AAAA,gBACA;AAAA,iBACH;AAAA,eACF;AAAA,cAEA,iCACG;AAAA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,aACH;AAAA,UAEF,qBAAC,SAAI,WAAU,2CACb;AAAA,gCAAC,SAAI,WAAU,4BACZ,iBAAO,OAAO,eAAe,aAAa,OAAO,WAAW,gBAAgB,CAAC,IAAI,OAAO,YAC3F;AAAA,YACA,qBAAC,SAAI,WAAU,cACb;AAAA,kCAAC,UAAO,SAAQ,SAAQ,SAAS,SAC9B,iBAAO,QACV;AAAA,cACA,oBAAC,UAAO,SAAS,WAAW,UAAU,CAAC,WACpC,iBAAO,MACV;AAAA,eACF;AAAA,aACF;AAAA,WACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -53,6 +53,11 @@ export interface FeedbackContext {
|
|
|
53
53
|
ua?: string;
|
|
54
54
|
/** The app build (`__APP_VERSION__`). */
|
|
55
55
|
version?: string;
|
|
56
|
+
/** What the app attached about the thing reported (keksdose's stuck receipt scan, live
|
|
57
|
+
* #481): a flat record of short values, in the order the app wrote them. The row
|
|
58
|
+
* detail shows it to the admin and the author, never to anyone else; erasure drops it
|
|
59
|
+
* (it is not on server-kit's `FEEDBACK_CONTEXT_KEEP`). */
|
|
60
|
+
diagnostics?: Readonly<Record<string, unknown>>;
|
|
56
61
|
fingerprint?: string;
|
|
57
62
|
/** Which error boundary caught it. */
|
|
58
63
|
boundary?: "app" | "page" | (string & {});
|
|
@@ -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\";\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[] = [...DEFAULT_ATTACHMENT_ACCEPT, \"application/pdf\", \"text/plain\"];\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` — and,\n * since 0.40, `REWORK` itself (§10.2 decision 4: a second rework adds another entry). On\n * `OPEN`, `READY` and `IN_PROGRESS` there is nothing to send back yet.\n */\nexport const FEEDBACK_REWORKABLE_STATUSES: readonly FeedbackStatus[] = Object.freeze([\n \"REWORK\",\n \"IN_EVALUATION\",\n \"NEEDS_LIVE_TEST\",\n \"POSTPONED\",\n \"DONE\",\n \"WONT_DO\",\n] as const);\n\n/**\n * The loops' queue (0.40, §10.2 decision 4; server-kit `QUEUE_STATUSES`): released for\n * work (`READY`), sent back and released again (`REWORK`), and being worked\n * (`IN_PROGRESS`). Kurvenschmiede's loop adds `OPEN` (decision 9) — its own difference,\n * not this list's.\n */\nexport const FEEDBACK_QUEUE_STATUSES: readonly FeedbackStatus[] = Object.freeze([\n \"READY\",\n \"REWORK\",\n \"IN_PROGRESS\",\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(body: string, note: string, url?: string | null, now: Date = new Date()): 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 * How many times a report has been sent back, since 0.40 (§10.3): its `kind: \"rework\"`\n * entries when the row carries `replies`, else {@link reworkCount} off the body (a server\n * before server-kit 0.13, whose reworks are still `--- REWORK … ---` blocks). What the\n * Rework chip counts.\n */\nexport function feedbackReworkCount(row: {\n body?: string | null;\n replies?: readonly Pick<FeedbackReply, \"kind\">[] | null;\n}): number {\n if (row.replies) {\n const entries = row.replies.filter((reply) => reply.kind === \"rework\").length;\n // A row migrated by an app that answers `replies` but not yet `kind` keeps its body's\n // count: no entry is a rework there, and the blocks are still in the body.\n if (entries > 0) return entries;\n }\n return reworkCount(row.body ?? \"\");\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,CAAC,GAAG,2BAA2B,mBAAmB,YAAY;AAQ3G,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;AAAA,EACA;AAAA,EACA;AACF,CAAU;AAQH,MAAM,0BAAqD,OAAO,OAAO;AAAA,EAC9E;AAAA,EACA;AAAA,EACA;AACF,CAAU;AAQH,MAAM,oCAA+D,OAAO,OAAO;AAAA,EACxF;AAAA,EACA;AAAA,EACA;AACF,CAAU;AASH,MAAM,6BAAwD,OAAO,OAAO;AAAA,EACjF;AAAA,EACA;AAAA,EACA;AACF,CAAU;AAQH,MAAM,4BAAuD,OAAO,O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["../../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 /** What the app attached about the thing reported (keksdose's stuck receipt scan, live\n * #481): a flat record of short values, in the order the app wrote them. The row\n * detail shows it to the admin and the author, never to anyone else; erasure drops it\n * (it is not on server-kit's `FEEDBACK_CONTEXT_KEEP`). */\n diagnostics?: Readonly<Record<string, unknown>>;\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[] = [...DEFAULT_ATTACHMENT_ACCEPT, \"application/pdf\", \"text/plain\"];\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` — and,\n * since 0.40, `REWORK` itself (§10.2 decision 4: a second rework adds another entry). On\n * `OPEN`, `READY` and `IN_PROGRESS` there is nothing to send back yet.\n */\nexport const FEEDBACK_REWORKABLE_STATUSES: readonly FeedbackStatus[] = Object.freeze([\n \"REWORK\",\n \"IN_EVALUATION\",\n \"NEEDS_LIVE_TEST\",\n \"POSTPONED\",\n \"DONE\",\n \"WONT_DO\",\n] as const);\n\n/**\n * The loops' queue (0.40, §10.2 decision 4; server-kit `QUEUE_STATUSES`): released for\n * work (`READY`), sent back and released again (`REWORK`), and being worked\n * (`IN_PROGRESS`). Kurvenschmiede's loop adds `OPEN` (decision 9) — its own difference,\n * not this list's.\n */\nexport const FEEDBACK_QUEUE_STATUSES: readonly FeedbackStatus[] = Object.freeze([\n \"READY\",\n \"REWORK\",\n \"IN_PROGRESS\",\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(body: string, note: string, url?: string | null, now: Date = new Date()): 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 * How many times a report has been sent back, since 0.40 (§10.3): its `kind: \"rework\"`\n * entries when the row carries `replies`, else {@link reworkCount} off the body (a server\n * before server-kit 0.13, whose reworks are still `--- REWORK … ---` blocks). What the\n * Rework chip counts.\n */\nexport function feedbackReworkCount(row: {\n body?: string | null;\n replies?: readonly Pick<FeedbackReply, \"kind\">[] | null;\n}): number {\n if (row.replies) {\n const entries = row.replies.filter((reply) => reply.kind === \"rework\").length;\n // A row migrated by an app that answers `replies` but not yet `kind` keeps its body's\n // count: no entry is a rework there, and the blocks are still in the body.\n if (entries > 0) return entries;\n }\n return reworkCount(row.body ?? \"\");\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;AAqJjC,MAAM,4BAA4B,CAAC,aAAa,cAAc,cAAc,WAAW;AAEvF,MAAM,+BAA+B,KAAK,OAAO;AAIjD,MAAM,0BAA0B;AAahC,MAAM,6BAAuC,CAAC,GAAG,2BAA2B,mBAAmB,YAAY;AAQ3G,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;AAAA,EACA;AAAA,EACA;AACF,CAAU;AAQH,MAAM,0BAAqD,OAAO,OAAO;AAAA,EAC9E;AAAA,EACA;AAAA,EACA;AACF,CAAU;AAQH,MAAM,oCAA+D,OAAO,OAAO;AAAA,EACxF;AAAA,EACA;AAAA,EACA;AACF,CAAU;AASH,MAAM,6BAAwD,OAAO,OAAO;AA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IAAI,YAAY,GAAG,IAAI,CAAC;AAC3C;","names":[]}
|
|
@@ -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 replies: \"Replies\",\n resolvedAt: (date) => `Resolved: ${date}`,\n rework: \"Rework\",\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,QAAQ;AAAA,EACR,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 diagnostics: \"Diagnostics\",\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 rework: \"Rework\",\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,aAAa;AAAA,EACb,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,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,QAAQ;AAAA,EACR,MAAM;AACR;","names":[]}
|
|
@@ -74,6 +74,9 @@ export interface FeedbackDetailLabels {
|
|
|
74
74
|
/** The copy button beside the link — copies the FULL `context.url`.
|
|
75
75
|
* de-CH: "URL kopieren" */
|
|
76
76
|
copyUrl: string;
|
|
77
|
+
/** The heading over `context.diagnostics`, between the URL and the attachment (keksdose
|
|
78
|
+
* live #481). de-CH: "Diagnose" */
|
|
79
|
+
diagnostics: string;
|
|
77
80
|
/** Section 3's heading, and each picture's alt text. de-CH: "Anhang" */
|
|
78
81
|
attachment: string;
|
|
79
82
|
/** A PDF's / text file's download button, given the file's name.
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
splitBodyAttachments,
|
|
33
33
|
splitDescription
|
|
34
34
|
} from "./feedback-record.js";
|
|
35
|
+
import { diagnosticsEntries, FeedbackDiagnosticsList } from "./feedback-diagnostics.js";
|
|
35
36
|
import { runMutation } from "./feedback-mutation.js";
|
|
36
37
|
import { feedbackPage, feedbackPageLinkTarget } from "./feedback-page-link.js";
|
|
37
38
|
import { useFeedbackStatusUndo } from "./feedback-status-undo.js";
|
|
@@ -199,6 +200,7 @@ function FeedbackRowDetail({
|
|
|
199
200
|
const { description } = splitDescription(row.body);
|
|
200
201
|
const page = feedbackPage(row.context);
|
|
201
202
|
const pageLink = page && feedbackPageLinkTarget(page, pageLinkExclude);
|
|
203
|
+
const diagnostics = canEdit || access.isAuthor ? diagnosticsEntries(row.context?.diagnostics) : [];
|
|
202
204
|
const files = feedbackAttachmentUrls(row.replies ? { ...row, replies: void 0 } : row);
|
|
203
205
|
const fetchFile = fetcher ?? plainFeedbackFetch;
|
|
204
206
|
const day = useDayFormatter(renderDate);
|
|
@@ -272,6 +274,7 @@ function FeedbackRowDetail({
|
|
|
272
274
|
),
|
|
273
275
|
/* @__PURE__ */ jsx(CopyButton, { size: "xs", className: "shrink-0", text: page.url, label: labels.copyUrl, stopPropagation: true })
|
|
274
276
|
] }) }),
|
|
277
|
+
diagnostics.length > 0 && /* @__PURE__ */ jsx(FeedbackDetailSection, { title: labels.diagnostics, children: /* @__PURE__ */ jsx(FeedbackDiagnosticsList, { entries: diagnostics }) }),
|
|
275
278
|
files.length > 0 && /* @__PURE__ */ jsx(FeedbackDetailSection, { title: labels.attachment, children: /* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-wrap items-start gap-2", children: files.map(
|
|
276
279
|
(url) => isImageAttachment(url) ? /* @__PURE__ */ jsx(
|
|
277
280
|
AuthedImage,
|