@eifi1/ui-kit 0.26.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/README.md +15 -4
  2. package/dist/chart.d.ts +13 -9
  3. package/dist/components/account-chips.d.ts +1 -1
  4. package/dist/components/amount-input.d.ts +13 -9
  5. package/dist/components/button-group.d.ts +13 -9
  6. package/dist/components/calculator.d.ts +13 -9
  7. package/dist/components/confirm-dialog.d.ts +13 -9
  8. package/dist/components/copy-button.d.ts +10 -6
  9. package/dist/components/danger-confirm.d.ts +13 -9
  10. package/dist/components/data-table-cells.d.ts +1 -1
  11. package/dist/components/data-table-filter-popover.d.ts +1 -1
  12. package/dist/components/data-table-filters.d.ts +1 -1
  13. package/dist/components/data-table-labels.d.ts +1 -1
  14. package/dist/components/data-table-pagination.d.ts +1 -1
  15. package/dist/components/data-table.d.ts +1 -1
  16. package/dist/components/data-table.js.map +1 -1
  17. package/dist/components/facing-pair.d.ts +13 -9
  18. package/dist/components/file-button.d.ts +13 -9
  19. package/dist/components/file-dropzone.d.ts +13 -9
  20. package/dist/components/form-actions.d.ts +13 -9
  21. package/dist/components/iban-input.d.ts +13 -9
  22. package/dist/components/language-select.d.ts +13 -9
  23. package/dist/components/money-field.d.ts +13 -9
  24. package/dist/components/number-field.d.ts +13 -9
  25. package/dist/components/number-input.d.ts +13 -9
  26. package/dist/components/numpad-sheet.d.ts +13 -9
  27. package/dist/components/phone-input.d.ts +13 -9
  28. package/dist/components/series-chart.d.ts +13 -9
  29. package/dist/components/settings-fields.d.ts +13 -9
  30. package/dist/components/share-card.d.ts +13 -9
  31. package/dist/components/text-link.d.ts +13 -9
  32. package/dist/components/time-input.d.ts +13 -9
  33. package/dist/components/ui.d.ts +10 -6
  34. package/dist/components/use-table-state.d.ts +1 -1
  35. package/dist/{data-table-labels-Cdn1QS2k.d.ts → data-table-labels-DUELeXpa.d.ts} +5 -0
  36. package/dist/data-table.d.ts +1 -1
  37. package/dist/feedback/feedback-attachment.d.ts +13 -9
  38. package/dist/feedback/feedback-attachment.js +3 -3
  39. package/dist/feedback/feedback-attachment.js.map +1 -1
  40. package/dist/feedback/feedback-capture.d.ts +71 -0
  41. package/dist/feedback/feedback-capture.js +194 -0
  42. package/dist/feedback/feedback-capture.js.map +1 -0
  43. package/dist/feedback/feedback-context.d.ts +71 -0
  44. package/dist/feedback/feedback-context.js +96 -0
  45. package/dist/feedback/feedback-context.js.map +1 -0
  46. package/dist/feedback/feedback-crash.d.ts +276 -0
  47. package/dist/feedback/feedback-crash.js +225 -0
  48. package/dist/feedback/feedback-crash.js.map +1 -0
  49. package/dist/feedback/feedback-dialog.d.ts +13 -9
  50. package/dist/feedback/feedback-dialog.js +5 -3
  51. package/dist/feedback/feedback-dialog.js.map +1 -1
  52. package/dist/feedback/feedback-inbox.d.ts +13 -9
  53. package/dist/feedback/feedback-inbox.js +89 -49
  54. package/dist/feedback/feedback-inbox.js.map +1 -1
  55. package/dist/feedback/feedback-labels.d.ts +71 -0
  56. package/dist/feedback/feedback-labels.js +48 -0
  57. package/dist/feedback/feedback-labels.js.map +1 -0
  58. package/dist/feedback/feedback-menu.d.ts +71 -0
  59. package/dist/feedback/feedback-menu.js +61 -0
  60. package/dist/feedback/feedback-menu.js.map +1 -0
  61. package/dist/feedback/feedback-record.d.ts +71 -0
  62. package/dist/feedback/feedback-record.js +104 -0
  63. package/dist/feedback/feedback-record.js.map +1 -0
  64. package/dist/feedback/feedback-row-detail.d.ts +71 -0
  65. package/dist/feedback/feedback-row-detail.js +437 -0
  66. package/dist/feedback/feedback-row-detail.js.map +1 -0
  67. package/dist/feedback/feedback-status-undo.d.ts +71 -0
  68. package/dist/feedback/feedback-status-undo.js +40 -0
  69. package/dist/feedback/feedback-status-undo.js.map +1 -0
  70. package/dist/feedback/feedback-submit.d.ts +182 -0
  71. package/dist/feedback/feedback-submit.js +101 -0
  72. package/dist/feedback/feedback-submit.js.map +1 -0
  73. package/dist/feedback/feedback-swipe.d.ts +152 -0
  74. package/dist/feedback/feedback-swipe.js +73 -0
  75. package/dist/feedback/feedback-swipe.js.map +1 -0
  76. package/dist/feedback/feedback-table.d.ts +71 -0
  77. package/dist/feedback/feedback-table.js +357 -0
  78. package/dist/feedback/feedback-table.js.map +1 -0
  79. package/dist/feedback/feedback-thread.d.ts +13 -9
  80. package/dist/feedback.d.ts +17 -9
  81. package/dist/feedback.js +11 -0
  82. package/dist/feedback.js.map +1 -1
  83. package/dist/hooks/use-file-drop.d.ts +13 -9
  84. package/dist/i18n/defaults.d.ts +13 -9
  85. package/dist/i18n/defaults.js +16 -0
  86. package/dist/i18n/defaults.js.map +1 -1
  87. package/dist/i18n/german.d.ts +13 -9
  88. package/dist/i18n/german.js +91 -5
  89. package/dist/i18n/german.js.map +1 -1
  90. package/dist/i18n/kit-labels.d.ts +7 -3
  91. package/dist/i18n/kit-labels.js.map +1 -1
  92. package/dist/i18n/languages.d.ts +13 -9
  93. package/dist/i18n/locales/de-CH.d.ts +13 -9
  94. package/dist/i18n/locales/en.d.ts +13 -9
  95. package/dist/i18n/locales/en.js +10 -1
  96. package/dist/i18n/locales/en.js.map +1 -1
  97. package/dist/i18n/locales/es.d.ts +13 -9
  98. package/dist/i18n/locales/es.js +89 -5
  99. package/dist/i18n/locales/es.js.map +1 -1
  100. package/dist/i18n/locales/fr.d.ts +13 -9
  101. package/dist/i18n/locales/fr.js +89 -5
  102. package/dist/i18n/locales/fr.js.map +1 -1
  103. package/dist/i18n/locales/hu.d.ts +13 -9
  104. package/dist/i18n/locales/hu.js +90 -5
  105. package/dist/i18n/locales/hu.js.map +1 -1
  106. package/dist/i18n/locales/it.d.ts +13 -9
  107. package/dist/i18n/locales/it.js +89 -5
  108. package/dist/i18n/locales/it.js.map +1 -1
  109. package/dist/i18n/locales/zh.d.ts +13 -9
  110. package/dist/i18n/locales/zh.js +89 -5
  111. package/dist/i18n/locales/zh.js.map +1 -1
  112. package/dist/i18n/review.d.ts +16 -11
  113. package/dist/i18n/review.js +11 -0
  114. package/dist/i18n/review.js.map +1 -1
  115. package/dist/i18n/swiss.js +3 -1
  116. package/dist/i18n/swiss.js.map +1 -1
  117. package/dist/index.d.ts +6 -2
  118. package/dist/index.js +11 -0
  119. package/dist/index.js.map +1 -1
  120. package/dist/{feedback-BXKH-ToU.d.ts → kit-labels-DQg82eHB.d.ts} +1275 -25
  121. package/dist/rhf/fields.d.ts +13 -9
  122. package/dist/rhf/form.d.ts +13 -9
  123. package/dist/rhf.d.ts +13 -9
  124. package/dist/shell/app-shell.d.ts +13 -9
  125. package/dist/shell/top-bar-brand.d.ts +13 -9
  126. package/dist/shell.d.ts +11 -11
  127. package/dist/wizard/stepper-nav.d.ts +13 -9
  128. package/dist/wizard.d.ts +13 -9
  129. package/package.json +6 -1
  130. package/src/components/data-table.tsx +5 -0
  131. package/src/feedback/feedback-attachment.tsx +19 -3
  132. package/src/feedback/feedback-capture.ts +285 -0
  133. package/src/feedback/feedback-context.tsx +217 -0
  134. package/src/feedback/feedback-crash.ts +547 -0
  135. package/src/feedback/feedback-dialog.tsx +29 -6
  136. package/src/feedback/feedback-inbox.tsx +131 -27
  137. package/src/feedback/feedback-labels.ts +127 -0
  138. package/src/feedback/feedback-menu.tsx +132 -0
  139. package/src/feedback/feedback-record.ts +345 -0
  140. package/src/feedback/feedback-row-detail.tsx +825 -0
  141. package/src/feedback/feedback-status-undo.ts +111 -0
  142. package/src/feedback/feedback-submit.tsx +224 -0
  143. package/src/feedback/feedback-swipe.tsx +170 -0
  144. package/src/feedback/feedback-table.tsx +757 -0
  145. package/src/feedback.ts +13 -0
  146. package/src/i18n/defaults.ts +16 -0
  147. package/src/i18n/german.ts +98 -5
  148. package/src/i18n/kit-labels.tsx +20 -0
  149. package/src/i18n/locales/en.ts +15 -1
  150. package/src/i18n/locales/es.ts +96 -5
  151. package/src/i18n/locales/fr.ts +95 -5
  152. package/src/i18n/locales/hu.ts +94 -5
  153. package/src/i18n/locales/it.ts +97 -5
  154. package/src/i18n/locales/zh.ts +90 -5
  155. package/src/i18n/review.ts +14 -2
  156. package/src/i18n/swiss.ts +5 -1
  157. package/src/index.ts +13 -0
  158. package/tokens.css +4 -0
@@ -0,0 +1,225 @@
1
+ "use client";
2
+ import { crashFingerprint } from "../components/error-boundary.js";
3
+ const MAX_PENDING = 3;
4
+ const HOT_UPDATE_GRACE_MS = 1e4;
5
+ const NOT_FILED = Object.freeze({ filed: false });
6
+ function clamp(value, max) {
7
+ if (typeof value !== "string") return null;
8
+ const trimmed = value.trim();
9
+ if (!trimmed) return null;
10
+ return trimmed.length > max ? trimmed.slice(0, max) : trimmed;
11
+ }
12
+ function reducePage(page, allow) {
13
+ const raw = typeof page === "string" ? page : "";
14
+ try {
15
+ const url = new URL(raw, "http://localhost");
16
+ const kept = new URLSearchParams();
17
+ for (const [key, value] of url.searchParams) {
18
+ if (allow.has(key)) kept.append(key, value);
19
+ }
20
+ const query = kept.toString();
21
+ return `${url.pathname}${query ? `?${query}` : ""}`;
22
+ } catch {
23
+ return raw.split(/[?#]/)[0];
24
+ }
25
+ }
26
+ function normalise(text) {
27
+ return text.replace(/\b[0-9a-fA-F]{6,}\b/g, "#").replace(/\d+/g, "#").replace(/\s+/g, " ").trim();
28
+ }
29
+ function bufferKey(p) {
30
+ const frames = (p.stack ?? "").split("\n").slice(0, 3).map(normalise).join("\n");
31
+ const crash = crashFingerprint({ name: p.name ?? "", message: normalise(p.message), stack: frames });
32
+ return `${p.version ?? ""}::${p.route ?? ""}::${crash}`;
33
+ }
34
+ function compact(list) {
35
+ const first = /* @__PURE__ */ new Map();
36
+ const last = /* @__PURE__ */ new Map();
37
+ list.forEach((p, i) => {
38
+ const key = bufferKey(p);
39
+ if (!first.has(key)) first.set(key, p);
40
+ last.set(key, i);
41
+ });
42
+ return [...last.entries()].sort((a, b) => a[1] - b[1]).map(([key]) => first.get(key)).slice(-MAX_PENDING);
43
+ }
44
+ function isPayload(value) {
45
+ if (!value || typeof value !== "object") return false;
46
+ const p = value;
47
+ return typeof p.message === "string" && p.message !== "" && typeof p.occurred_at === "string";
48
+ }
49
+ function storage() {
50
+ try {
51
+ return globalThis.localStorage ?? null;
52
+ } catch {
53
+ return null;
54
+ }
55
+ }
56
+ function isOffline() {
57
+ try {
58
+ return typeof navigator !== "undefined" && navigator.onLine === false;
59
+ } catch {
60
+ return false;
61
+ }
62
+ }
63
+ function viewport() {
64
+ try {
65
+ return `${window.innerWidth}x${window.innerHeight}`;
66
+ } catch {
67
+ return null;
68
+ }
69
+ }
70
+ function currentOrigin() {
71
+ try {
72
+ const origin = globalThis.location?.origin;
73
+ return typeof origin === "string" && origin !== "null" ? origin : "";
74
+ } catch {
75
+ return "";
76
+ }
77
+ }
78
+ function createCrashReporter(options) {
79
+ const { endpoint, getToken, storageKey, suppress, environment } = options;
80
+ const allow = new Set(options.allowParams);
81
+ let lastHotUpdateAt = 0;
82
+ let flushing = null;
83
+ function token() {
84
+ try {
85
+ const t = getToken();
86
+ return typeof t === "string" && t !== "" ? t : null;
87
+ } catch {
88
+ return null;
89
+ }
90
+ }
91
+ function suppressed() {
92
+ try {
93
+ return suppress?.() === true;
94
+ } catch {
95
+ return false;
96
+ }
97
+ }
98
+ function readPending() {
99
+ try {
100
+ const raw = storage()?.getItem(storageKey);
101
+ if (!raw) return [];
102
+ const parsed = JSON.parse(raw);
103
+ return Array.isArray(parsed) ? parsed.filter(isPayload) : [];
104
+ } catch {
105
+ return [];
106
+ }
107
+ }
108
+ function writePending(list) {
109
+ try {
110
+ const store = storage();
111
+ if (!store) return;
112
+ const kept = compact(list);
113
+ if (kept.length === 0) store.removeItem(storageKey);
114
+ else store.setItem(storageKey, JSON.stringify(kept));
115
+ } catch {
116
+ }
117
+ }
118
+ function buffer(payload) {
119
+ writePending([...readPending(), payload]);
120
+ }
121
+ async function post(payload, bearer) {
122
+ try {
123
+ const send = options.fetchImpl ?? globalThis.fetch;
124
+ if (typeof send !== "function") return { filed: false, retry: true };
125
+ const res = await send(endpoint, {
126
+ method: "POST",
127
+ headers: { "Content-Type": "application/json", Authorization: `Bearer ${bearer}` },
128
+ body: JSON.stringify(payload),
129
+ keepalive: true
130
+ });
131
+ if (!res.ok) {
132
+ return { filed: false, retry: res.status === 401 || res.status >= 500 };
133
+ }
134
+ const body = await res.json().catch(() => null);
135
+ const answer = body ?? {};
136
+ if (answer.stored !== true) return { filed: false, retry: false };
137
+ const reference = typeof answer.reference === "string" && answer.reference ? answer.reference : void 0;
138
+ return reference ? { filed: true, reference } : { filed: true };
139
+ } catch {
140
+ return { filed: false, retry: true };
141
+ }
142
+ }
143
+ function payloadOf(report) {
144
+ const page = reducePage(report.page, allow);
145
+ const origin = options.origin ?? currentOrigin();
146
+ return {
147
+ name: clamp(report.name, 200),
148
+ message: clamp(report.message, 2e3) ?? "(no message)",
149
+ stack: clamp(report.stack, 8e3),
150
+ component_stack: clamp(report.componentStack, 8e3),
151
+ boundary: report.placement === "app" ? "app" : "page",
152
+ url: clamp(`${origin}${page}`, 2e3),
153
+ route: clamp(page.split("?")[0], 500),
154
+ version: clamp(options.version ?? report.appVersion, 50),
155
+ viewport: clamp(viewport(), 50),
156
+ ua: clamp(report.userAgent, 500),
157
+ online: typeof report.online === "boolean" ? report.online : null,
158
+ occurred_at: typeof report.time === "string" && report.time ? report.time : (/* @__PURE__ */ new Date()).toISOString(),
159
+ origin: clamp(origin, 200),
160
+ environment: clamp(environment, 20)
161
+ };
162
+ }
163
+ async function onReport(report) {
164
+ try {
165
+ if (report.chunkLoad) return NOT_FILED;
166
+ if (suppressed()) return NOT_FILED;
167
+ if (lastHotUpdateAt > 0 && Date.now() - lastHotUpdateAt < HOT_UPDATE_GRACE_MS) {
168
+ console.info("[ui-kit] crash not filed: a hot update landed moments ago", report.message);
169
+ return NOT_FILED;
170
+ }
171
+ const payload = payloadOf(report);
172
+ const bearer = token();
173
+ if (isOffline() || !bearer) {
174
+ buffer(payload);
175
+ return NOT_FILED;
176
+ }
177
+ const result = await post(payload, bearer);
178
+ if (result.filed) return result.reference ? { reference: result.reference } : {};
179
+ if (result.retry) buffer(payload);
180
+ return NOT_FILED;
181
+ } catch {
182
+ return NOT_FILED;
183
+ }
184
+ }
185
+ async function drain() {
186
+ try {
187
+ const pending = readPending();
188
+ if (pending.length === 0) return;
189
+ const bearer = token();
190
+ if (!bearer || suppressed() || isOffline()) return;
191
+ writePending([]);
192
+ const keep = [];
193
+ for (const [i, payload] of pending.entries()) {
194
+ const result = await post(payload, bearer);
195
+ if (!result.filed && result.retry) {
196
+ keep.push(...pending.slice(i));
197
+ break;
198
+ }
199
+ }
200
+ if (keep.length > 0) writePending([...keep, ...readPending()]);
201
+ } catch {
202
+ }
203
+ }
204
+ function flushPending() {
205
+ flushing ??= drain().finally(() => {
206
+ flushing = null;
207
+ });
208
+ return flushing;
209
+ }
210
+ function redact(report) {
211
+ try {
212
+ return { ...report, page: reducePage(report.page, allow) };
213
+ } catch {
214
+ return { name: "Error", message: "", page: "", time: "", userAgent: "", chunkLoad: false, extras: {} };
215
+ }
216
+ }
217
+ function noteHotUpdate(at = Date.now()) {
218
+ lastHotUpdateAt = at;
219
+ }
220
+ return { onReport, redact, flushPending, noteHotUpdate };
221
+ }
222
+ export {
223
+ createCrashReporter
224
+ };
225
+ //# sourceMappingURL=feedback-crash.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/feedback/feedback-crash.ts"],"sourcesContent":["import { crashFingerprint } from \"../components/error-boundary\";\nimport type { CrashReport } from \"../components/error-boundary\";\nimport type { FeedbackEnvironment } from \"./feedback-record\";\n\n/**\n * Crash auto-filing, the client half — §4.6 of the feedback contract\n * (docs/feedback-harmonization.md), lifted from keksdose's\n * `frontend/src/shared/lib/crash-report.ts` (feedback #160).\n *\n * Until #160 keksdose had no telemetry at all: a render crash was one `console.error`\n * that died with the tab, and live 0.4.26 crashed deterministically on /accounts for a\n * real user without anybody finding out. kastlan and Kurvenschmiede still file nothing\n * (contract §1). The kit's `ErrorBoundary` already owns the screen, the hostile-throw\n * normalisation, the per-page-load dedupe and cap, and the chunk-load test; this module\n * is the other half every app was going to write again — the POST, the buffer and the\n * page redaction — so the three apps keep only what only they know: the endpoint, the\n * token, the demo check and which query params may leave the device.\n *\n * Two rules outrank everything else, both keksdose's:\n *\n * 1. **It never throws.** It runs inside a boundary that has already caught a crash; a\n * reporter that throws takes the fallback down with it and the user gets the white\n * screen the boundary exists to prevent. Every function below ends in a `catch`.\n * 2. **Structure, never content.** Nothing the user typed may go into a report — see\n * {@link CrashReporter.redact}, which rebuilds the query string from an allow-list.\n *\n * One fix over keksdose: a report counts as filed **only when the server answered\n * `stored: true`**. keksdose keys on `res.ok` + `reference` (kk `crash-report.ts:253-255`,\n * `:325`), so its server's `202 { stored: false }` — the 20-an-hour limiter, a demo user\n * — resolved `{}`, and the kit fallback said \"This error has been reported\n * automatically.\" for a report that was dropped (contract §4.6).\n */\n\n/** How many undeliverable reports wait in storage — the newest ones. A device stuck in a\n * crash loop while offline would otherwise fill `localStorage` with copies of one stack\n * (kk `crash-report.ts:37-39`, `MAX_PENDING = 3`). */\nconst MAX_PENDING = 3;\n\n/** How long after a Vite hot update a crash is taken for its fallout (kk\n * `crash-report.ts:76-79`): long enough for the re-render the update triggers, short\n * enough that a crash the developer causes by clicking a minute later is still filed. */\nconst HOT_UPDATE_GRACE_MS = 10_000;\n\n/**\n * `POST /feedback/crash`'s body — `CrashReportCreate`, §3.6 (kk `schemas/feedback.py`),\n * including the optional `origin` and `environment` the server copies into the row's\n * `context`, so a dev crash no longer reads as prod and the admin list shows its env\n * chip (§3.2).\n *\n * Every string is clamped to the server's column width before it is sent: one character\n * over a `max_length` used to come back 422 and the report was lost (kk\n * `crash-report.ts:104-106`) — the diagnostics are worth more truncated than not\n * delivered. Empty strings are sent as `null`.\n */\nexport interface CrashReportCreate {\n /** The thrown value's `name`, ≤ 200. */\n name: string | null;\n /** 1–2000; `\"(no message)\"` when the error had none. */\n message: string;\n /** ≤ 8000 each. */\n stack: string | null;\n component_stack: string | null;\n /** The boundary's `placement`: `\"app\"` stays `\"app\"`, anything else is `\"page\"`. */\n boundary: \"app\" | \"page\";\n /** `origin` + the redacted page, ≤ 2000. */\n url: string | null;\n /** The redacted page's pathname, ≤ 500. */\n route: string | null;\n /** ≤ 50 each. */\n version: string | null;\n viewport: string | null;\n /** ≤ 500. */\n ua: string | null;\n online: boolean | null;\n /** ISO 8601, UTC — when it crashed, not when a buffered copy was finally sent. */\n occurred_at: string;\n /** `location.origin` — which copy of the app (§3.2). ≤ 200. */\n origin: string | null;\n /** `\"prod\"` / `\"dev\"` / `\"local\"` (§3.2) — the app's `environment` option. ≤ 20. */\n environment: string | null;\n}\n\n/** `POST /feedback/crash`'s answer — always a 202 (§3.6). Only `stored` decides. */\nexport interface CrashReportResponse {\n /** `false` when the server dropped it on purpose: the limiter, a demo user. */\n stored: boolean;\n /** `true` when it was counted onto an open row with the same fingerprint. */\n duplicate?: boolean;\n feedback_id?: number | null;\n /** The fingerprint's first 8 characters, for the user to quote. */\n reference?: string | null;\n}\n\n/**\n * What {@link CrashReporter.onReport} resolves with — the kit `ErrorBoundary`'s\n * `CrashReportResult`, narrowed to the three answers the fallback tells apart:\n *\n * - **filed with a reference** — `{ reference: \"3fae6774\" }`: the server stored it\n * (`stored === true`) and named it; the screen says \"Reported as 3fae6774\" and drops\n * the copy button;\n * - **filed** — `{}`: stored, but the server gave no reference; the screen says \"This\n * error has been reported automatically.\";\n * - **not filed** — `{ filed: false }`: suppressed by the app (`suppress`, a hot\n * update, a chunk-load error), refused by the server (`stored: false`, a 4xx), or\n * buffered for later (offline, signed out, 401, 5xx, no network). The screen claims\n * nothing and keeps the copy button.\n *\n * Code that reads it outside a boundary: filed is `result.filed !== false`.\n */\nexport type CrashFiling = { reference?: string } | { filed: false };\n\nexport interface CrashReporterOptions {\n /** The app's crash route, e.g. `${API_BASE}/feedback/crash` (§3.3). */\n endpoint: string;\n /**\n * The bearer token, read at the moment of filing — **never assumed to exist**. Nothing\n * (`null`, `undefined`, `\"\"`) means signed out, or not yet signed in again (kastlan\n * keeps its access token in memory, so it is `null` at start-up until the refresh\n * lands): the report is buffered and {@link CrashReporter.flushPending} sends it once\n * a token appears.\n *\n * Must not touch React — no hooks, no context: it runs from a component that is\n * mid-crash. Read storage or a store's `getState()` (kk `crash-report.ts:175-181`).\n * A throw reads as \"no token\".\n */\n getToken: () => string | null | undefined;\n /**\n * The query params a report may keep — the app's ALLOW-list (§4.6). Everything else\n * is dropped, so a param added later stays out until somebody decides otherwise.\n * keksdose's: `p ps sort tab g granularity month preset from to tstate future\n * archived uncleared` (kk `crash-report.ts:136-151`) — what locates a render crash\n * (paging, sort, range, grouping), never `q` (free text), `f.*` (filters holding\n * payee names) or ids (`row`, `action`). Copied when the reporter is made.\n */\n allowParams: Iterable<string>;\n /** The `localStorage` key undeliverable reports wait under — one per app, e.g.\n * keksdose's `\"keksdose.pendingCrashReports\"` (kk `crash-report.ts:35`). */\n storageKey: string;\n /**\n * The app's own opt-out: `true` files nothing and buffers nothing — keksdose's demo\n * sessions (kk `crash-report.ts:183-193`; its server answers `stored: false` for them\n * anyway). Asked at filing time and again before a flush, which keeps the buffer\n * while it says `true`. Must not touch React; a throw reads as `false`. Optional:\n * kastlan has no demo users.\n */\n suppress?: () => boolean;\n /** The deploy environment, copied into every report (§3.2; kk\n * `app/deploy-environment.ts`). */\n environment: FeedbackEnvironment | (string & {});\n /** Which copy of the app — default `location.origin` at filing time. */\n origin?: string;\n /** The app build — default the boundary's `appVersion` prop, as the report carries it. */\n version?: string;\n /** The `fetch` to post with — default the global one, looked up at each call. For\n * tests (no network) and for an app whose `fetch` is wrapped. */\n fetchImpl?: typeof fetch;\n}\n\n/** What {@link createCrashReporter} returns. Every member is a free function (no\n * `this`), safe to pass as a prop or a listener as it stands. */\nexport interface CrashReporter {\n /**\n * The boundary's `onReport`: file one crash and say how it went ({@link CrashFiling}).\n * Never throws, never rejects.\n *\n * The report arrives already `redact`ed when this reporter's `redact` is the\n * boundary's too; the page is reduced again here anyway, because the allow-list is\n * the one thing this channel must never get wrong (kk `crash-report.ts:273-276`).\n */\n onReport: (report: CrashReport) => Promise<CrashFiling>;\n /**\n * The boundary's `redact`: the report with its page reduced to the pathname and the\n * allowed query params (no hash). The screen's details and the copy button — whose\n * text ends up pasted into a feedback message — then show the same reduced page as the\n * POST (kk `crash-report.ts:114-135`). `extras` are the app's own and pass unchanged.\n */\n redact: (report: CrashReport) => CrashReport;\n /**\n * Send the buffered reports. Call it at start-up and whenever a token appears (kk\n * `main.tsx:59-61`). One flush at a time — a second call while one runs joins it.\n * Keeps the buffer while there is no token, the app suppresses, or the browser is\n * offline; stops at the first 401/5xx/network failure and keeps the rest. Never\n * rejects.\n */\n flushPending: () => Promise<void>;\n /**\n * Note that Vite has just applied a hot update: a crash within 10 s of one is HMR\n * fallout (a module re-executed under a live React tree), not the app's bug, and is\n * not filed (kk `crash-report.ts:56-102`; eight rows across five keksdose feedback\n * runs were exactly this). Dev only by construction — a production build has no\n * `import.meta.hot` to call it from. The kit cannot listen itself (a pre-bundled\n * dependency sees no `import.meta.hot`), so the app wires both events:\n *\n * ```ts\n * if (import.meta.hot) {\n * import.meta.hot.on(\"vite:beforeUpdate\", () => crashReporter.noteHotUpdate());\n * import.meta.hot.on(\"vite:afterUpdate\", () => crashReporter.noteHotUpdate());\n * }\n * ```\n */\n noteHotUpdate: (at?: number) => void;\n}\n\nconst NOT_FILED: CrashFiling = Object.freeze({ filed: false as const });\n\n/** Trimmed and cut to `max`; `null` for a non-string or an empty one. */\nfunction clamp(value: unknown, max: number): string | null {\n if (typeof value !== \"string\") return null;\n const trimmed = value.trim();\n if (!trimmed) return null;\n return trimmed.length > max ? trimmed.slice(0, max) : trimmed;\n}\n\n/** The page as `pathname?allowed=params` — never anything else. */\nfunction reducePage(page: unknown, allow: ReadonlySet<string>): string {\n const raw = typeof page === \"string\" ? page : \"\";\n try {\n // The base only lets a path parse; it never leaves this function.\n const url = new URL(raw, \"http://localhost\");\n const kept = new URLSearchParams();\n for (const [key, value] of url.searchParams) {\n if (allow.has(key)) kept.append(key, value);\n }\n const query = kept.toString();\n return `${url.pathname}${query ? `?${query}` : \"\"}`;\n } catch {\n // A page that will not parse still has a pathname worth having (kk `:163-167`).\n return raw.split(/[?#]/)[0];\n }\n}\n\n/** The server's message normalisation (kk `feedback_service.py` `_normalise`): hex runs\n * of 6 or more first, then digit runs, to `#`; whitespace collapsed. */\nfunction normalise(text: string): string {\n return text\n .replace(/\\b[0-9a-fA-F]{6,}\\b/g, \"#\")\n .replace(/\\d+/g, \"#\")\n .replace(/\\s+/g, \" \")\n .trim();\n}\n\n/**\n * \"The same crash again\" in the buffer: the kit boundary's {@link crashFingerprint}\n * (name, message, top frames) over the server's normalised message and first three\n * normalised stack lines, plus the version and route — the server's own identity\n * (§3.6) without the user, who is whoever signs in to flush. Placement is left out, as\n * the server leaves it out: two copies that differ only in it end up as one row anyway.\n * Never coarser than the server's key, so the buffer never merges two crashes the server\n * would have filed apart.\n */\nfunction bufferKey(p: CrashReportCreate): string {\n const frames = (p.stack ?? \"\").split(\"\\n\").slice(0, 3).map(normalise).join(\"\\n\");\n const crash = crashFingerprint({ name: p.name ?? \"\", message: normalise(p.message), stack: frames });\n return `${p.version ?? \"\"}::${p.route ?? \"\"}::${crash}`;\n}\n\n/**\n * The buffer, deduplicated and bounded: one entry per {@link bufferKey}, the FIRST\n * occurrence kept (its `occurred_at` is when the bug first hit) but moved to the position\n * of the latest, so a crash that keeps recurring is the last to be evicted; then the\n * newest {@link MAX_PENDING}.\n */\nfunction compact(list: CrashReportCreate[]): CrashReportCreate[] {\n const first = new Map<string, CrashReportCreate>();\n const last = new Map<string, number>();\n list.forEach((p, i) => {\n const key = bufferKey(p);\n if (!first.has(key)) first.set(key, p);\n last.set(key, i);\n });\n return [...last.entries()]\n .sort((a, b) => a[1] - b[1])\n .map(([key]) => first.get(key) as CrashReportCreate)\n .slice(-MAX_PENDING);\n}\n\nfunction isPayload(value: unknown): value is CrashReportCreate {\n if (!value || typeof value !== \"object\") return false;\n const p = value as Partial<CrashReportCreate>;\n return typeof p.message === \"string\" && p.message !== \"\" && typeof p.occurred_at === \"string\";\n}\n\nfunction storage(): Storage | null {\n try {\n return globalThis.localStorage ?? null;\n } catch {\n return null; // private mode / storage disabled\n }\n}\n\nfunction isOffline(): boolean {\n try {\n return typeof navigator !== \"undefined\" && navigator.onLine === false;\n } catch {\n return false;\n }\n}\n\nfunction viewport(): string | null {\n try {\n return `${window.innerWidth}x${window.innerHeight}`;\n } catch {\n return null;\n }\n}\n\nfunction currentOrigin(): string {\n try {\n const origin = globalThis.location?.origin;\n return typeof origin === \"string\" && origin !== \"null\" ? origin : \"\";\n } catch {\n return \"\";\n }\n}\n\ntype PostResult = { filed: true; reference?: string } | { filed: false; retry: boolean };\n\n/**\n * Make the crash filer for one app — §4.6, the kit's half of keksdose's\n * `shared/lib/crash-report.ts`. Hand the result to both boundaries (`placement=\"app\"`\n * at the root, `\"page\"` in the layout):\n *\n * ```tsx\n * export const crashReporter = createCrashReporter({\n * endpoint: `${API_BASE}/feedback/crash`,\n * getToken: () => localStorage.getItem(\"auth_token\"),\n * allowParams: [\"p\", \"ps\", \"sort\", \"tab\"],\n * storageKey: \"myapp.pendingCrashReports\",\n * suppress: () => useAuth.getState().user?.is_demo === true,\n * environment: deployEnvironment(),\n * });\n *\n * <ErrorBoundary placement=\"page\" appVersion={APP_VERSION}\n * redact={crashReporter.redact} onReport={crashReporter.onReport}>\n *\n * // start-up, and whenever a token appears (kk main.tsx:59-61)\n * void crashReporter.flushPending();\n * useAuth.subscribe((s, prev) => { if (s.token && !prev.token) void crashReporter.flushPending(); });\n * ```\n *\n * What it sends: §3.6's `CrashReportCreate` ({@link CrashReportCreate}) with `origin`\n * and `environment`, clamped to the server's caps. How: a bare `fetch` with `keepalive`\n * and the bearer token — **not the app's axios client**, whose 401 handler would log the\n * user out of a page that has just crashed (kk `crash-report.ts:222-235`), and\n * `keepalive` so the request survives the Reload the user is about to press.\n *\n * When it files nothing (resolving `{ filed: false }`):\n * - a chunk-load error (the boundary already withholds those) — a deploy or a dropped\n * connection, not a defect;\n * - `suppress()` says so (demo sessions), or a hot update landed under 10 s ago;\n * - the server answered `stored: false` (limiter, demo) or a 4xx other than 401 —\n * dropped, never retried: the server will never take that payload.\n *\n * When it buffers (also `{ filed: false }` — not filed *yet*): offline, no token,\n * 401, 5xx, or no network. Up to 3 reports wait under `storageKey`, the newest kept,\n * identical crashes kept once (see `bufferKey`); {@link CrashReporter.flushPending}\n * sends them. A signed-out visitor's crash waits for a sign-in — there is no\n * unauthenticated crash endpoint (Kurvenschmiede's public pages; accepted, §4.6).\n */\nexport function createCrashReporter(options: CrashReporterOptions): CrashReporter {\n const { endpoint, getToken, storageKey, suppress, environment } = options;\n const allow: ReadonlySet<string> = new Set(options.allowParams);\n let lastHotUpdateAt = 0;\n let flushing: Promise<void> | null = null;\n\n function token(): string | null {\n try {\n const t = getToken();\n return typeof t === \"string\" && t !== \"\" ? t : null;\n } catch {\n return null;\n }\n }\n\n function suppressed(): boolean {\n try {\n return suppress?.() === true;\n } catch {\n // keksdose's rule (`isDemoSession`): an opt-out that cannot answer does not opt\n // out — the server suppresses demo users itself.\n return false;\n }\n }\n\n function readPending(): CrashReportCreate[] {\n try {\n const raw = storage()?.getItem(storageKey);\n if (!raw) return [];\n const parsed: unknown = JSON.parse(raw);\n return Array.isArray(parsed) ? parsed.filter(isPayload) : [];\n } catch {\n return [];\n }\n }\n\n function writePending(list: CrashReportCreate[]): void {\n try {\n const store = storage();\n if (!store) return;\n const kept = compact(list);\n if (kept.length === 0) store.removeItem(storageKey);\n else store.setItem(storageKey, JSON.stringify(kept));\n } catch {\n /* best effort: a report that cannot be buffered is lost */\n }\n }\n\n function buffer(payload: CrashReportCreate): void {\n writePending([...readPending(), payload]);\n }\n\n async function post(payload: CrashReportCreate, bearer: string): Promise<PostResult> {\n try {\n // A local, so it is called without `this` — `options.fetchImpl(…)` would bind the\n // options object and a browser's own `fetch` throws \"Illegal invocation\".\n const send = options.fetchImpl ?? globalThis.fetch;\n if (typeof send !== \"function\") return { filed: false, retry: true };\n const res = await send(endpoint, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", Authorization: `Bearer ${bearer}` },\n body: JSON.stringify(payload),\n keepalive: true,\n });\n if (!res.ok) {\n // 401: the token expired — worth another go after the next sign-in. 5xx: the\n // server's trouble. Any other 4xx refuses this payload for good, and retrying it\n // would wedge the buffer behind it (kk `crash-report.ts:246-252`).\n return { filed: false, retry: res.status === 401 || res.status >= 500 };\n }\n const body: unknown = await res.json().catch(() => null);\n const answer = (body ?? {}) as Partial<Record<keyof CrashReportResponse, unknown>>;\n // THE fix (§4.6): a 202 is not a filing. `stored: false` is the limiter or a\n // demo user, and a body without `stored` is no proof either.\n if (answer.stored !== true) return { filed: false, retry: false };\n const reference = typeof answer.reference === \"string\" && answer.reference ? answer.reference : undefined;\n return reference ? { filed: true, reference } : { filed: true };\n } catch {\n return { filed: false, retry: true }; // network down, blocked, a hostile fetch\n }\n }\n\n function payloadOf(report: CrashReport): CrashReportCreate {\n const page = reducePage(report.page, allow);\n const origin = options.origin ?? currentOrigin();\n return {\n name: clamp(report.name, 200),\n message: clamp(report.message, 2000) ?? \"(no message)\",\n stack: clamp(report.stack, 8000),\n component_stack: clamp(report.componentStack, 8000),\n boundary: report.placement === \"app\" ? \"app\" : \"page\",\n url: clamp(`${origin}${page}`, 2000),\n route: clamp(page.split(\"?\")[0], 500),\n version: clamp(options.version ?? report.appVersion, 50),\n viewport: clamp(viewport(), 50),\n ua: clamp(report.userAgent, 500),\n online: typeof report.online === \"boolean\" ? report.online : null,\n occurred_at: typeof report.time === \"string\" && report.time ? report.time : new Date().toISOString(),\n origin: clamp(origin, 200),\n environment: clamp(environment, 20),\n };\n }\n\n async function onReport(report: CrashReport): Promise<CrashFiling> {\n try {\n // The boundary never hands one over; said here too, so a direct caller cannot\n // buffer a connectivity symptom as if it were a defect.\n if (report.chunkLoad) return NOT_FILED;\n if (suppressed()) return NOT_FILED;\n if (lastHotUpdateAt > 0 && Date.now() - lastHotUpdateAt < HOT_UPDATE_GRACE_MS) {\n // Said out loud: the developer is looking at this screen, and \"nothing was\n // filed\" only reassures when you know why (kk `crash-report.ts:284-288`).\n console.info(\"[ui-kit] crash not filed: a hot update landed moments ago\", report.message);\n return NOT_FILED;\n }\n // Built before any wait, so it carries the state at crash time (`online: false`\n // included) whenever it is finally sent.\n const payload = payloadOf(report);\n const bearer = token();\n // Offline: the crashes hardest to reproduce are the ones with no network (kk\n // `crash-report.ts:308-315`). Signed out: nobody to file it under yet.\n if (isOffline() || !bearer) {\n buffer(payload);\n return NOT_FILED;\n }\n const result = await post(payload, bearer);\n if (result.filed) return result.reference ? { reference: result.reference } : {};\n if (result.retry) buffer(payload);\n return NOT_FILED;\n } catch {\n // Last line of defence: whatever went wrong in here, the fallback still renders.\n return NOT_FILED;\n }\n }\n\n async function drain(): Promise<void> {\n try {\n const pending = readPending();\n if (pending.length === 0) return;\n // Still unattributable, opted out or offline: keep them rather than burn them.\n const bearer = token();\n if (!bearer || suppressed() || isOffline()) return;\n // Clear first and re-buffer only what failed for a reason worth retrying: should\n // the tab die mid-flush, losing a report beats re-posting the same rows on every\n // load forever (kk `crash-report.ts:353-356`).\n writePending([]);\n const keep: CrashReportCreate[] = [];\n for (const [i, payload] of pending.entries()) {\n const result = await post(payload, bearer);\n if (!result.filed && result.retry) {\n // The token or the server is the trouble, not this report — the rest would\n // fail the same way. Keep it and everything after it for the next flush.\n keep.push(...pending.slice(i));\n break;\n }\n }\n // Merged with what arrived meanwhile, never overwritten: a crash that buffered\n // while the POSTs above were in flight (the start-up flush runs exactly when a\n // boot-time crash fires) comes after them and is the newest (kk `:362-367`).\n if (keep.length > 0) writePending([...keep, ...readPending()]);\n } catch {\n /* never throws: a failed flush must not break start-up */\n }\n }\n\n function flushPending(): Promise<void> {\n flushing ??= drain().finally(() => {\n flushing = null;\n });\n return flushing;\n }\n\n function redact(report: CrashReport): CrashReport {\n try {\n return { ...report, page: reducePage(report.page, allow) };\n } catch {\n // Only a hostile object gets here (a getter that throws on the spread), so\n // nothing of it is read again: fail closed with an empty report.\n return { name: \"Error\", message: \"\", page: \"\", time: \"\", userAgent: \"\", chunkLoad: false, extras: {} };\n }\n }\n\n function noteHotUpdate(at: number = Date.now()): void {\n lastHotUpdateAt = at;\n }\n\n return { onReport, redact, flushPending, noteHotUpdate };\n}\n"],"mappings":";AAAA,SAAS,wBAAwB;AAoCjC,MAAM,cAAc;AAKpB,MAAM,sBAAsB;AAkK5B,MAAM,YAAyB,OAAO,OAAO,EAAE,OAAO,MAAe,CAAC;AAGtE,SAAS,MAAM,OAAgB,KAA4B;AACzD,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,QAAM,UAAU,MAAM,KAAK;AAC3B,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO,QAAQ,SAAS,MAAM,QAAQ,MAAM,GAAG,GAAG,IAAI;AACxD;AAGA,SAAS,WAAW,MAAe,OAAoC;AACrE,QAAM,MAAM,OAAO,SAAS,WAAW,OAAO;AAC9C,MAAI;AAEF,UAAM,MAAM,IAAI,IAAI,KAAK,kBAAkB;AAC3C,UAAM,OAAO,IAAI,gBAAgB;AACjC,eAAW,CAAC,KAAK,KAAK,KAAK,IAAI,cAAc;AAC3C,UAAI,MAAM,IAAI,GAAG,EAAG,MAAK,OAAO,KAAK,KAAK;AAAA,IAC5C;AACA,UAAM,QAAQ,KAAK,SAAS;AAC5B,WAAO,GAAG,IAAI,QAAQ,GAAG,QAAQ,IAAI,KAAK,KAAK,EAAE;AAAA,EACnD,QAAQ;AAEN,WAAO,IAAI,MAAM,MAAM,EAAE,CAAC;AAAA,EAC5B;AACF;AAIA,SAAS,UAAU,MAAsB;AACvC,SAAO,KACJ,QAAQ,wBAAwB,GAAG,EACnC,QAAQ,QAAQ,GAAG,EACnB,QAAQ,QAAQ,GAAG,EACnB,KAAK;AACV;AAWA,SAAS,UAAU,GAA8B;A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,EAAG;AAI5C,mBAAa,CAAC,CAAC;AACf,YAAM,OAA4B,CAAC;AACnC,iBAAW,CAAC,GAAG,OAAO,KAAK,QAAQ,QAAQ,GAAG;AAC5C,cAAM,SAAS,MAAM,KAAK,SAAS,MAAM;AACzC,YAAI,CAAC,OAAO,SAAS,OAAO,OAAO;AAGjC,eAAK,KAAK,GAAG,QAAQ,MAAM,CAAC,CAAC;AAC7B;AAAA,QACF;AAAA,MACF;AAIA,UAAI,KAAK,SAAS,EAAG,cAAa,CAAC,GAAG,MAAM,GAAG,YAAY,CAAC,CAAC;AAAA,IAC/D,QAAQ;AAAA,IAER;AAAA,EACF;AAEA,WAAS,eAA8B;AACrC,iBAAa,MAAM,EAAE,QAAQ,MAAM;AACjC,iBAAW;AAAA,IACb,CAAC;AACD,WAAO;AAAA,EACT;AAEA,WAAS,OAAO,QAAkC;AAChD,QAAI;AACF,aAAO,EAAE,GAAG,QAAQ,MAAM,WAAW,OAAO,MAAM,KAAK,EAAE;AAAA,IAC3D,QAAQ;AAGN,aAAO,EAAE,MAAM,SAAS,SAAS,IAAI,MAAM,IAAI,MAAM,IAAI,WAAW,IAAI,WAAW,OAAO,QAAQ,CAAC,EAAE;AAAA,IACvG;AAAA,EACF;AAEA,WAAS,cAAc,KAAa,KAAK,IAAI,GAAS;AACpD,sBAAkB;AAAA,EACpB;AAEA,SAAO,EAAE,UAAU,QAAQ,cAAc,cAAc;AACzD;","names":[]}
@@ -1,9 +1,6 @@
1
1
  import 'react';
2
- export { a7 as DEFAULT_FEEDBACK_DIALOG_LABELS, aP as FeedbackAttachmentLabels, aU as FeedbackCategoryOption, b1 as FeedbackDialog, b2 as FeedbackDialogLabels, b3 as FeedbackDialogMultipleProps, b4 as FeedbackDialogProps, b5 as FeedbackDialogSingleProps, b6 as FeedbackDialogTextLabels, b7 as FeedbackMultipleSubmission, be as FeedbackSubmission } from '../feedback-BXKH-ToU.js';
3
- import '../components/tooltip.js';
4
- import '../hooks/use-anchored-rect.js';
5
- import '../lib/clipping.js';
6
- import '../data-table-labels-Cdn1QS2k.js';
2
+ export { j as DEFAULT_FEEDBACK_DIALOG_LABELS, L as FeedbackAttachmentLabels, T as FeedbackCategoryOption, a9 as FeedbackDialog, aa as FeedbackDialogLabels, ab as FeedbackDialogMultipleProps, ac as FeedbackDialogProps, ad as FeedbackDialogSingleProps, ae as FeedbackDialogTextLabels, an as FeedbackMultipleSubmission, aK as FeedbackSubmission, aL as FeedbackSubmitHint } from '../kit-labels-DQg82eHB.js';
3
+ import '../data-table-labels-DUELeXpa.js';
7
4
  import '../components/data-table-sort.js';
8
5
  import '../components/swipeable-row.js';
9
6
  import '../components/mini-calendar.js';
@@ -12,6 +9,9 @@ import '../components/popover.js';
12
9
  import '../components/chip.js';
13
10
  import 'lucide-react';
14
11
  import '../components/field-sync.js';
12
+ import '../components/tooltip.js';
13
+ import '../hooks/use-anchored-rect.js';
14
+ import '../lib/clipping.js';
15
15
  import '../wizard/types.js';
16
16
  import '../tour/tour.js';
17
17
  import '../search/command-palette.js';
@@ -32,19 +32,23 @@ import '../components/dialog-frame.js';
32
32
  import '../components/modal.js';
33
33
  import '../hooks/use-search-param-state.js';
34
34
  import '../components/measured-grid.js';
35
- import '../components/account-settings-labels.js';
35
+ import '../components/user-avatar.js';
36
+ import '../components/status-dot.js';
37
+ import '../components/progress-bar.js';
38
+ import '../components/signed-amount.js';
39
+ import '../shell/topbar-action-menu.js';
40
+ import '../components/menu-item.js';
36
41
  import '../components/floating-panel.js';
42
+ import '../hooks/use-authed-src.js';
43
+ import '../components/account-settings-labels.js';
37
44
  import '../components/bulk-action-bar.js';
38
45
  import '../components/list.js';
39
- import '../components/signed-amount.js';
40
46
  import '../components/breadcrumbs.js';
41
47
  import '../components/toast.js';
42
48
  import '../components/description-list.js';
43
49
  import '../components/line-items.js';
44
- import '../components/progress-bar.js';
45
50
  import '../components/error-boundary.js';
46
51
  import '../components/authed-image.js';
47
- import '../hooks/use-authed-src.js';
48
52
  import '../components/image-grid.js';
49
53
  import '../components/lightbox.js';
50
54
  import '../components/write-lock.js';
@@ -3,6 +3,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useState } from "react";
4
4
  import { Button, Input, PHONE_QUERY, Select, Textarea } from "../components/ui.js";
5
5
  import { Modal } from "../components/modal.js";
6
+ import { isApplePlatform } from "../hooks/use-hotkey.js";
6
7
  import { useMediaQuery } from "../hooks/use-media-query.js";
7
8
  import { useKitLabels } from "../i18n/kit-labels.js";
8
9
  import {
@@ -17,10 +18,11 @@ const DEFAULT_FEEDBACK_DIALOG_LABELS = {
17
18
  subject: "Subject",
18
19
  body: "What happened?",
19
20
  bodyOptional: "What happened? (optional)",
20
- attachment: "Screenshot",
21
+ attachment: "Attachment",
21
22
  // No `attachments`: the multiple-mode heading is `feedbackAttachment.attachmentList`,
22
23
  // and a default here would shadow a provider that translated only that one.
23
- submitHint: "Ctrl/\u2318 + Enter to send",
24
+ // The modifier as `form.submitShortcut` writes it: "⌘ Enter" on Apple, "Ctrl+Enter" elsewhere.
25
+ submitHint: (apple) => apple ? "\u2318 Enter to send" : "Ctrl+Enter to send",
24
26
  cancel: "Cancel",
25
27
  save: "Send"
26
28
  };
@@ -155,7 +157,7 @@ function FeedbackDialog(props) {
155
157
  contextSlot
156
158
  ] }),
157
159
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
158
- /* @__PURE__ */ jsx("div", { className: "text-xs text-[var(--text-placeholder)]", children: labels.submitHint }),
160
+ /* @__PURE__ */ jsx("div", { className: "text-xs text-[var(--text-placeholder)]", children: typeof labels.submitHint === "function" ? labels.submitHint(isApplePlatform()) : labels.submitHint }),
159
161
  /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
160
162
  /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: onClose, children: labels.cancel }),
161
163
  /* @__PURE__ */ jsx(Button, { onClick: trySubmit, disabled: !canSubmit, children: labels.save })
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/feedback/feedback-dialog.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { Button, Input, PHONE_QUERY, Select, Textarea } from \"../components/ui\";\nimport type { ButtonSize, ButtonVariant } from \"../components/ui\";\nimport { Modal } from \"../components/modal\";\nimport { useMediaQuery } from \"../hooks/use-media-query\";\nimport { useKitLabels } from \"../i18n/kit-labels\";\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\";\n\nexport interface FeedbackCategoryOption {\n value: string;\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 submitHint: string;\n cancel: string;\n save: string;\n /** @deprecated since 0.16.0 — use `attachmentList`, the one key for the heading and\n * the chip list it names. Still honoured: set, it wins over the provider's\n * `attachmentList` (but not over an `attachmentList` passed beside it). */\n attachments?: string;\n}\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 /** The line beside the buttons naming the shortcut. */\n submitHint: string;\n cancel: string;\n save: string;\n /** @deprecated since 0.16.0 — use `feedbackAttachment.attachmentList`. It and this\n * key were two names for one heading (\"Attachments\" over the chips that list names\n * \"Attachments\"), and a catalogue that translated one left the other English. Still\n * honoured when set: it wins over `feedbackAttachment.attachmentList`. */\n attachments?: string;\n}\n\nexport const DEFAULT_FEEDBACK_DIALOG_LABELS: FeedbackDialogTextLabels = {\n title: \"Send feedback\",\n category: \"Category\",\n subject: \"Subject\",\n body: \"What happened?\",\n bodyOptional: \"What happened? (optional)\",\n attachment: \"Screenshot\",\n // No `attachments`: the multiple-mode heading is `feedbackAttachment.attachmentList`,\n // and a default here would shadow a provider that translated only that one.\n submitHint: \"Ctrl/⌘ + Enter to send\",\n cancel: \"Cancel\",\n save: \"Send\",\n};\n\nexport interface FeedbackSubmission {\n title: string;\n body: string;\n category: string;\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 {\n title: string;\n body: string;\n category: string;\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\ninterface FeedbackDialogBaseProps {\n open: boolean;\n onClose: () => void;\n categories: FeedbackCategoryOption[];\n category: string;\n onCategoryChange: (value: string) => void;\n /** Prop > `<UiKitProvider labels={{ feedbackDialog, feedbackAttachment }}>` >\n * English. Optional since 0.12.0; a whole `FeedbackDialogLabels` still fits. */\n labels?: Partial<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\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 extends FeedbackDialogBaseProps {\n attachments?: \"single\";\n onSubmit: (data: FeedbackSubmission) => 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 extends FeedbackDialogBaseProps {\n attachments: \"multiple\";\n /** Default `DEFAULT_MAX_ATTACHMENTS` (5). The screenshot does not count. */\n maxAttachments?: number;\n onSubmit: (data: FeedbackMultipleSubmission) => 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 = FeedbackDialogSingleProps | FeedbackDialogMultipleProps;\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(props: FeedbackDialogProps) {\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 } = 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 = useMediaQuery(PHONE_QUERY, false);\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. The\n // deprecated `feedbackDialog.attachments` (prop or provider) still wins over the\n // provider's `attachmentList`, as it did before 0.16.0; an `attachmentList` prop wins\n // over both.\n const listHeading =\n labelsProp?.attachmentList ??\n labels.attachments ??\n attachmentText.attachmentList ??\n 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 <Select label={labels.category} value={category} onChange={(e) => onCategoryChange(e.target.value)}>\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 bodyField = (\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 />\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-[var(--border)] 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-[var(--text-placeholder)]\">{labels.submitHint}</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":";AAsSQ,SAkFE,UAlFF,KAqFI,YArFJ;AAtSR,SAAS,gBAAgB;AAEzB,SAAS,QAAQ,OAAO,aAAa,QAAQ,gBAAgB;AAE7D,SAAS,aAAa;AACtB,SAAS,qBAAqB;AAC9B,SA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B;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,UAAQ;AAAA,MACR,OAAO;AAAA,MACP,UAAU;AAAA,MACV,KAAK,MAAM;AAAA,MAIX;AAAA,MACA,oBAAoB;AAAA,MACpB,SAAS,MAAM;AAAA;AAAA,EACjB,IAEA;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,OAAO;AAAA,MACP,UAAU;AAAA,MACV,SAAS,MAAM;AAAA;AAAA,EACjB;AAGJ,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,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,kDACZ;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,0CAA0C,iBAAO,YAAW;AAAA,YAC3E,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 { useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { Button, Input, PHONE_QUERY, Select, Textarea } from \"../components/ui\";\nimport type { ButtonSize, ButtonVariant } from \"../components/ui\";\nimport { Modal } from \"../components/modal\";\nimport { isApplePlatform } from \"../hooks/use-hotkey\";\nimport { useMediaQuery } from \"../hooks/use-media-query\";\nimport { useKitLabels } from \"../i18n/kit-labels\";\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\";\n\nexport interface FeedbackCategoryOption {\n value: string;\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 /** @deprecated since 0.16.0 — use `attachmentList`, the one key for the heading and\n * the chip list it names. Still honoured: set, it wins over the provider's\n * `attachmentList` (but not over an `attachmentList` passed beside it). */\n attachments?: 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 /** @deprecated since 0.16.0 — use `feedbackAttachment.attachmentList`. It and this\n * key were two names for one heading (\"Attachments\" over the chips that list names\n * \"Attachments\"), and a catalogue that translated one left the other English. Still\n * honoured when set: it wins over `feedbackAttachment.attachmentList`. */\n attachments?: string;\n}\n\n/**\n * English. The feedback contract's wording (docs/feedback-harmonization.md §4.2, 0.27.0):\n * \"Send\", not keksdose's \"Save\", and the body asks \"What happened?\" (Marcel's two calls);\n * the rest is keksdose's. Since 0.27.0 `attachment`, the single-mode heading, is keksdose's\n * `feedback.attachment` **\"Attachment\"** (it said \"Screenshot\" over a button that says \"Add\n * attachment\" and a picker that may offer a PDF), and `submitHint` is keksdose's\n * **\"Ctrl+Enter to send\"** — \"⌘ Enter to send\" on Apple platforms, where the old\n * \"Ctrl/⌘ + Enter\" made every reader parse both. The `attachments=\"multiple\"` heading is\n * `feedbackAttachment.attachmentList` (\"Attachments\") and did not change.\n */\nexport const DEFAULT_FEEDBACK_DIALOG_LABELS: FeedbackDialogTextLabels = {\n title: \"Send feedback\",\n category: \"Category\",\n subject: \"Subject\",\n body: \"What happened?\",\n bodyOptional: \"What happened? (optional)\",\n attachment: \"Attachment\",\n // No `attachments`: the multiple-mode heading is `feedbackAttachment.attachmentList`,\n // and a default here would shadow a provider that translated only that one.\n // The modifier as `form.submitShortcut` writes it: \"⌘ Enter\" on Apple, \"Ctrl+Enter\" elsewhere.\n submitHint: (apple) => (apple ? \"⌘ Enter to send\" : \"Ctrl+Enter to send\"),\n cancel: \"Cancel\",\n save: \"Send\",\n};\n\nexport interface FeedbackSubmission {\n title: string;\n body: string;\n category: string;\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 {\n title: string;\n body: string;\n category: string;\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\ninterface FeedbackDialogBaseProps {\n open: boolean;\n onClose: () => void;\n categories: FeedbackCategoryOption[];\n category: string;\n onCategoryChange: (value: string) => void;\n /** Prop > `<UiKitProvider labels={{ feedbackDialog, feedbackAttachment }}>` >\n * English. Optional since 0.12.0; a whole `FeedbackDialogLabels` still fits. */\n labels?: Partial<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\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 extends FeedbackDialogBaseProps {\n attachments?: \"single\";\n onSubmit: (data: FeedbackSubmission) => 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 extends FeedbackDialogBaseProps {\n attachments: \"multiple\";\n /** Default `DEFAULT_MAX_ATTACHMENTS` (5). The screenshot does not count. */\n maxAttachments?: number;\n onSubmit: (data: FeedbackMultipleSubmission) => 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 = FeedbackDialogSingleProps | FeedbackDialogMultipleProps;\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(props: FeedbackDialogProps) {\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 } = 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 = useMediaQuery(PHONE_QUERY, false);\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. The\n // deprecated `feedbackDialog.attachments` (prop or provider) still wins over the\n // provider's `attachmentList`, as it did before 0.16.0; an `attachmentList` prop wins\n // over both.\n const listHeading =\n labelsProp?.attachmentList ??\n labels.attachments ??\n attachmentText.attachmentList ??\n 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 <Select label={labels.category} value={category} onChange={(e) => onCategoryChange(e.target.value)}>\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 bodyField = (\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 />\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-[var(--border)] 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-[var(--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":";AA2TQ,SAkFE,UAlFF,KAqFI,YArFJ;AA3TR,SAAS,gBAAgB;AAEzB,SAAS,QAAQ,OAAO,aAAa,QAAQ,gBAAgB;AAE7D,SAAS,aAAa;AACtB,SAAS,uBAAuB;AAChC,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAC7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AAiGA,MAAM,iCAA2D;AAAA,EACtE,OAAO;AAAA,EACP,UAAU;AAAA,EACV,SAAS;AAAA,EACT,MAAM;AAAA,EACN,cAAc;AAAA,EACd,YAAY;AAAA;AAAA;AAAA;AAAA,EAIZ,YAAY,CAAC,UAAW,QAAQ,yBAAoB;AAAA,EACpD,QAAQ;AAAA,EACR,MAAM;AACR;AAoHO,SAAS,eAAe,OAA4B;AACzD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA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A,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,kDACZ;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,0CACZ,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,10 +1,7 @@
1
1
  import 'react';
2
2
  import 'lucide-react';
3
- export { av as FEEDBACK_CATEGORY_META, aw as FEEDBACK_CATEGORY_ORDER, ax as FEEDBACK_STATUS_META, ay as FEEDBACK_STATUS_ORDER, aS as FeedbackCategory, aT as FeedbackCategoryBadge, a$ as FeedbackDetail, b0 as FeedbackDetailSection, b8 as FeedbackNoteAttachment, b9 as FeedbackNoteEditor, ba as FeedbackProse, bb as FeedbackStatus, bc as FeedbackStatusBadge, bd as FeedbackStatusTransitions, cH as feedbackCategoryRank, cL as nextFeedbackStatus, cO as selectableFeedbackStatuses, c_ as visibleFeedbackStatuses } from '../feedback-BXKH-ToU.js';
4
- import '../components/tooltip.js';
5
- import '../hooks/use-anchored-rect.js';
6
- import '../lib/clipping.js';
7
- import '../data-table-labels-Cdn1QS2k.js';
3
+ export { t as FEEDBACK_CATEGORY_META, u as FEEDBACK_CATEGORY_ORDER, x as FEEDBACK_STATUS_META, y as FEEDBACK_STATUS_ORDER, Q as FeedbackCategory, R as FeedbackCategoryBadge, a4 as FeedbackDetail, a7 as FeedbackDetailSection, ao as FeedbackNoteAttachment, ap as FeedbackNoteEditor, ar as FeedbackProse, az as FeedbackStatus, aA as FeedbackStatusBadge, aG as FeedbackStatusTransitions, b0 as feedbackCategoryRank, bd as nextFeedbackStatus, bh as selectableFeedbackStatuses, bs as visibleFeedbackStatuses } from '../kit-labels-DQg82eHB.js';
4
+ import '../data-table-labels-DUELeXpa.js';
8
5
  import '../components/data-table-sort.js';
9
6
  import '../components/swipeable-row.js';
10
7
  import '../components/mini-calendar.js';
@@ -12,6 +9,9 @@ import '../components/calendar-heatmap.js';
12
9
  import '../components/popover.js';
13
10
  import '../components/chip.js';
14
11
  import '../components/field-sync.js';
12
+ import '../components/tooltip.js';
13
+ import '../hooks/use-anchored-rect.js';
14
+ import '../lib/clipping.js';
15
15
  import '../wizard/types.js';
16
16
  import '../tour/tour.js';
17
17
  import '../search/command-palette.js';
@@ -32,19 +32,23 @@ import '../components/dialog-frame.js';
32
32
  import '../components/modal.js';
33
33
  import '../hooks/use-search-param-state.js';
34
34
  import '../components/measured-grid.js';
35
- import '../components/account-settings-labels.js';
35
+ import '../components/user-avatar.js';
36
+ import '../components/status-dot.js';
37
+ import '../components/progress-bar.js';
38
+ import '../components/signed-amount.js';
39
+ import '../shell/topbar-action-menu.js';
40
+ import '../components/menu-item.js';
36
41
  import '../components/floating-panel.js';
42
+ import '../hooks/use-authed-src.js';
43
+ import '../components/account-settings-labels.js';
37
44
  import '../components/bulk-action-bar.js';
38
45
  import '../components/list.js';
39
- import '../components/signed-amount.js';
40
46
  import '../components/breadcrumbs.js';
41
47
  import '../components/toast.js';
42
48
  import '../components/description-list.js';
43
49
  import '../components/line-items.js';
44
- import '../components/progress-bar.js';
45
50
  import '../components/error-boundary.js';
46
51
  import '../components/authed-image.js';
47
- import '../hooks/use-authed-src.js';
48
52
  import '../components/image-grid.js';
49
53
  import '../components/lightbox.js';
50
54
  import '../components/write-lock.js';