@eifi1/ui-kit 0.26.0 → 0.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) 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/legal.d.ts +5 -2
  24. package/dist/components/legal.js +4 -10
  25. package/dist/components/legal.js.map +1 -1
  26. package/dist/components/money-field.d.ts +13 -9
  27. package/dist/components/number-field.d.ts +13 -9
  28. package/dist/components/number-input.d.ts +13 -9
  29. package/dist/components/numpad-sheet.d.ts +13 -9
  30. package/dist/components/phone-input.d.ts +13 -9
  31. package/dist/components/series-chart.d.ts +13 -9
  32. package/dist/components/settings-fields.d.ts +13 -9
  33. package/dist/components/share-card.d.ts +13 -9
  34. package/dist/components/text-link.d.ts +13 -9
  35. package/dist/components/time-input.d.ts +13 -9
  36. package/dist/components/ui.d.ts +10 -6
  37. package/dist/components/use-table-state.d.ts +1 -1
  38. package/dist/{data-table-labels-Cdn1QS2k.d.ts → data-table-labels-DUELeXpa.d.ts} +5 -0
  39. package/dist/data-table.d.ts +1 -1
  40. package/dist/feedback/feedback-attachment.d.ts +13 -9
  41. package/dist/feedback/feedback-attachment.js +3 -3
  42. package/dist/feedback/feedback-attachment.js.map +1 -1
  43. package/dist/feedback/feedback-capture.d.ts +71 -0
  44. package/dist/feedback/feedback-capture.js +194 -0
  45. package/dist/feedback/feedback-capture.js.map +1 -0
  46. package/dist/feedback/feedback-context.d.ts +71 -0
  47. package/dist/feedback/feedback-context.js +96 -0
  48. package/dist/feedback/feedback-context.js.map +1 -0
  49. package/dist/feedback/feedback-crash.d.ts +276 -0
  50. package/dist/feedback/feedback-crash.js +225 -0
  51. package/dist/feedback/feedback-crash.js.map +1 -0
  52. package/dist/feedback/feedback-dialog.d.ts +13 -9
  53. package/dist/feedback/feedback-dialog.js +5 -3
  54. package/dist/feedback/feedback-dialog.js.map +1 -1
  55. package/dist/feedback/feedback-inbox.d.ts +13 -9
  56. package/dist/feedback/feedback-inbox.js +89 -49
  57. package/dist/feedback/feedback-inbox.js.map +1 -1
  58. package/dist/feedback/feedback-labels.d.ts +71 -0
  59. package/dist/feedback/feedback-labels.js +48 -0
  60. package/dist/feedback/feedback-labels.js.map +1 -0
  61. package/dist/feedback/feedback-menu.d.ts +71 -0
  62. package/dist/feedback/feedback-menu.js +61 -0
  63. package/dist/feedback/feedback-menu.js.map +1 -0
  64. package/dist/feedback/feedback-record.d.ts +71 -0
  65. package/dist/feedback/feedback-record.js +104 -0
  66. package/dist/feedback/feedback-record.js.map +1 -0
  67. package/dist/feedback/feedback-row-detail.d.ts +71 -0
  68. package/dist/feedback/feedback-row-detail.js +437 -0
  69. package/dist/feedback/feedback-row-detail.js.map +1 -0
  70. package/dist/feedback/feedback-status-undo.d.ts +71 -0
  71. package/dist/feedback/feedback-status-undo.js +40 -0
  72. package/dist/feedback/feedback-status-undo.js.map +1 -0
  73. package/dist/feedback/feedback-submit.d.ts +182 -0
  74. package/dist/feedback/feedback-submit.js +101 -0
  75. package/dist/feedback/feedback-submit.js.map +1 -0
  76. package/dist/feedback/feedback-swipe.d.ts +152 -0
  77. package/dist/feedback/feedback-swipe.js +73 -0
  78. package/dist/feedback/feedback-swipe.js.map +1 -0
  79. package/dist/feedback/feedback-table.d.ts +71 -0
  80. package/dist/feedback/feedback-table.js +357 -0
  81. package/dist/feedback/feedback-table.js.map +1 -0
  82. package/dist/feedback/feedback-thread.d.ts +13 -9
  83. package/dist/feedback.d.ts +17 -9
  84. package/dist/feedback.js +11 -0
  85. package/dist/feedback.js.map +1 -1
  86. package/dist/hooks/use-file-drop.d.ts +13 -9
  87. package/dist/i18n/defaults.d.ts +13 -9
  88. package/dist/i18n/defaults.js +16 -0
  89. package/dist/i18n/defaults.js.map +1 -1
  90. package/dist/i18n/german.d.ts +13 -9
  91. package/dist/i18n/german.js +91 -5
  92. package/dist/i18n/german.js.map +1 -1
  93. package/dist/i18n/kit-labels.d.ts +7 -3
  94. package/dist/i18n/kit-labels.js.map +1 -1
  95. package/dist/i18n/languages.d.ts +13 -9
  96. package/dist/i18n/locales/de-CH.d.ts +13 -9
  97. package/dist/i18n/locales/en.d.ts +13 -9
  98. package/dist/i18n/locales/en.js +10 -1
  99. package/dist/i18n/locales/en.js.map +1 -1
  100. package/dist/i18n/locales/es.d.ts +13 -9
  101. package/dist/i18n/locales/es.js +89 -5
  102. package/dist/i18n/locales/es.js.map +1 -1
  103. package/dist/i18n/locales/fr.d.ts +13 -9
  104. package/dist/i18n/locales/fr.js +89 -5
  105. package/dist/i18n/locales/fr.js.map +1 -1
  106. package/dist/i18n/locales/hu.d.ts +13 -9
  107. package/dist/i18n/locales/hu.js +90 -5
  108. package/dist/i18n/locales/hu.js.map +1 -1
  109. package/dist/i18n/locales/it.d.ts +13 -9
  110. package/dist/i18n/locales/it.js +89 -5
  111. package/dist/i18n/locales/it.js.map +1 -1
  112. package/dist/i18n/locales/zh.d.ts +13 -9
  113. package/dist/i18n/locales/zh.js +89 -5
  114. package/dist/i18n/locales/zh.js.map +1 -1
  115. package/dist/i18n/review.d.ts +16 -11
  116. package/dist/i18n/review.js +11 -0
  117. package/dist/i18n/review.js.map +1 -1
  118. package/dist/i18n/swiss.js +3 -1
  119. package/dist/i18n/swiss.js.map +1 -1
  120. package/dist/index.d.ts +6 -2
  121. package/dist/index.js +11 -0
  122. package/dist/index.js.map +1 -1
  123. package/dist/{feedback-BXKH-ToU.d.ts → kit-labels-DQg82eHB.d.ts} +1275 -25
  124. package/dist/rhf/fields.d.ts +13 -9
  125. package/dist/rhf/form.d.ts +13 -9
  126. package/dist/rhf.d.ts +13 -9
  127. package/dist/shell/app-shell.d.ts +13 -9
  128. package/dist/shell/top-bar-brand.d.ts +13 -9
  129. package/dist/shell.d.ts +11 -11
  130. package/dist/wizard/stepper-nav.d.ts +13 -9
  131. package/dist/wizard.d.ts +13 -9
  132. package/package.json +6 -1
  133. package/src/components/data-table.tsx +5 -0
  134. package/src/components/legal.tsx +8 -7
  135. package/src/feedback/feedback-attachment.tsx +19 -3
  136. package/src/feedback/feedback-capture.ts +285 -0
  137. package/src/feedback/feedback-context.tsx +217 -0
  138. package/src/feedback/feedback-crash.ts +547 -0
  139. package/src/feedback/feedback-dialog.tsx +29 -6
  140. package/src/feedback/feedback-inbox.tsx +131 -27
  141. package/src/feedback/feedback-labels.ts +127 -0
  142. package/src/feedback/feedback-menu.tsx +132 -0
  143. package/src/feedback/feedback-record.ts +345 -0
  144. package/src/feedback/feedback-row-detail.tsx +825 -0
  145. package/src/feedback/feedback-status-undo.ts +111 -0
  146. package/src/feedback/feedback-submit.tsx +224 -0
  147. package/src/feedback/feedback-swipe.tsx +170 -0
  148. package/src/feedback/feedback-table.tsx +757 -0
  149. package/src/feedback.ts +13 -0
  150. package/src/i18n/defaults.ts +16 -0
  151. package/src/i18n/german.ts +98 -5
  152. package/src/i18n/kit-labels.tsx +20 -0
  153. package/src/i18n/locales/en.ts +15 -1
  154. package/src/i18n/locales/es.ts +96 -5
  155. package/src/i18n/locales/fr.ts +95 -5
  156. package/src/i18n/locales/hu.ts +94 -5
  157. package/src/i18n/locales/it.ts +97 -5
  158. package/src/i18n/locales/zh.ts +90 -5
  159. package/src/i18n/review.ts +14 -2
  160. package/src/i18n/swiss.ts +5 -1
  161. package/src/index.ts +13 -0
  162. package/tokens.css +4 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/feedback/feedback-capture.ts"],"sourcesContent":["/**\n * `captureAppScreenshot` — the picture of the app a feedback report attaches (0.27.0,\n * docs/feedback-harmonization.md §5).\n *\n * Lifted from keksdose `frontend/src/features/feedback/capture-screenshot.ts` (live #271),\n * which is the canon: Kurvenschmiede carried a second copy (`capture-page.ts`) with none of\n * its speed-ups, and kastlan had no capture at all. Each app wrote the same three awkward\n * decisions — which element, which library, what to do when it throws — and they drifted\n * the moment there were two copies (Kurvenschmiede feedback #128 says exactly that).\n *\n * WHY IT IS FAST (keksdose live #271: *\"Capture screenshot — That takes ages in my mobile\n * phone\"*). `modern-screenshot` deep-clones the subtree and inlines every node's computed\n * style onto the clone, because the final image is an SVG `foreignObject` that carries no\n * stylesheets. By default it walks the WHOLE computed style (~340 longhands in Chrome) per\n * element; keksdose's /transactions has ~4,800 elements under `#root` at phone width, so\n * that was ~1.6 million `getPropertyValue` calls before a pixel was drawn — 21–52 s on a\n * desktop CPU, 153–160 s with the CPU throttled 4×. Two levers fixed it, both kept here:\n *\n * 1. {@link CAPTURE_STYLE_PROPERTIES} — copy the ~140 longhands a Tailwind v4 app built\n * on this kit actually uses. Alone: 21 s → 1.8 s.\n * 2. {@link inViewport} drops `display: none` subtrees — on a phone most of the\n * document, since `DataTable` renders both layouts and hides one — and anything\n * wholly outside the viewport. Together: 27–52 s → 0.4–1.1 s, the picture\n * 0.05% of pixels different (antialiasing).\n *\n * Plus WebP at 0.9 (222 KB → 46 KB, an upload a phone makes on a mobile connection) with\n * the file named from what the canvas ACTUALLY produced — a browser without WebP encodes\n * PNG, and a \"screenshot.webp\" that is a PNG is refused by the server on its type — and\n * `font: false`, since the app's faces are same-origin and already in the page.\n *\n * WHY THE PEER IS LOADED DYNAMICALLY. `modern-screenshot` is an OPTIONAL peer\n * (`peerDependenciesMeta.optional`, like `sonner`), and this module is re-exported by the\n * barrel: a static import would make every app that imports a Button install it. It is\n * imported inside the function, so an app pays nothing until somebody presses \"Capture\n * screenshot\", and an app without it gets a REJECTED promise — which the submit dialog\n * turns into the \"Could not capture a screenshot\" toast (`feedbackToast.captureFailed`).\n *\n * WHAT IS NOT HERE: Kurvenschmiede's `features: { restoreScrollPosition: true }` (its\n * feedback #153: a capture of a scrolled `<main>` came out as the TOP of the page). The\n * viewport filter already answers that case — what is scrolled out of view is dropped, so\n * what remains is what was on screen, give or take the part of the first row that was\n * scrolled past (checked in Chromium, 0.27.0: an inner `<main>` scrolled to row 20 captures\n * rows 20–26). Both together are worse than either: the clone is translated by the scroll\n * offset AFTER the rows above were dropped, and the picture came out blank below the\n * header (same check).\n */\n\n/**\n * The computed properties copied onto the clone (keksdose `capture-screenshot.ts:94`).\n *\n * LONGHANDS only: `getPropertyValue()` resolves a shorthand to `\"\"` whenever its longhands\n * disagree, so `\"border\"` would silently drop every one-sided border. Chosen by what\n * Tailwind v4 emits rather than by what looks complete: `font-variant-numeric` because\n * money is `tabular-nums`, the SVG paint properties because every icon is a lucide `<svg>`\n * inheriting `stroke: currentColor`.\n */\nconst CAPTURE_STYLE_PROPERTIES: readonly string[] = [\n // box\n \"display\",\n \"position\",\n \"top\",\n \"right\",\n \"bottom\",\n \"left\",\n \"width\",\n \"height\",\n \"min-width\",\n \"min-height\",\n \"max-width\",\n \"max-height\",\n \"box-sizing\",\n \"margin-top\",\n \"margin-right\",\n \"margin-bottom\",\n \"margin-left\",\n \"padding-top\",\n \"padding-right\",\n \"padding-bottom\",\n \"padding-left\",\n \"overflow-x\",\n \"overflow-y\",\n \"z-index\",\n \"float\",\n \"clear\",\n \"aspect-ratio\",\n \"inset-inline-start\",\n \"inset-inline-end\",\n // flex + grid\n \"flex-direction\",\n \"flex-wrap\",\n \"flex-grow\",\n \"flex-shrink\",\n \"flex-basis\",\n \"align-items\",\n \"align-self\",\n \"align-content\",\n \"justify-content\",\n \"justify-items\",\n \"justify-self\",\n \"row-gap\",\n \"column-gap\",\n \"order\",\n \"grid-template-columns\",\n \"grid-template-rows\",\n \"grid-column-start\",\n \"grid-column-end\",\n \"grid-row-start\",\n \"grid-row-end\",\n \"grid-auto-flow\",\n \"grid-auto-rows\",\n \"grid-auto-columns\",\n // type\n \"color\",\n \"font-family\",\n \"font-size\",\n \"font-weight\",\n \"font-style\",\n \"font-variant-numeric\",\n \"font-feature-settings\",\n \"line-height\",\n \"letter-spacing\",\n \"word-spacing\",\n \"text-align\",\n \"text-indent\",\n \"text-transform\",\n \"text-overflow\",\n \"text-decoration-line\",\n \"text-decoration-color\",\n \"text-decoration-style\",\n \"text-decoration-thickness\",\n \"text-underline-offset\",\n \"white-space\",\n \"word-break\",\n \"overflow-wrap\",\n \"vertical-align\",\n \"direction\",\n \"list-style-type\",\n \"list-style-position\",\n \"-webkit-line-clamp\",\n \"-webkit-box-orient\",\n \"-webkit-text-fill-color\",\n // paint\n \"background-color\",\n \"background-image\",\n \"background-position\",\n \"background-repeat\",\n \"background-size\",\n \"background-clip\",\n \"background-origin\",\n \"opacity\",\n \"visibility\",\n \"box-shadow\",\n \"filter\",\n \"backdrop-filter\",\n \"mix-blend-mode\",\n \"clip-path\",\n // borders + outline\n \"border-top-width\",\n \"border-right-width\",\n \"border-bottom-width\",\n \"border-left-width\",\n \"border-top-style\",\n \"border-right-style\",\n \"border-bottom-style\",\n \"border-left-style\",\n \"border-top-color\",\n \"border-right-color\",\n \"border-bottom-color\",\n \"border-left-color\",\n \"border-top-left-radius\",\n \"border-top-right-radius\",\n \"border-bottom-right-radius\",\n \"border-bottom-left-radius\",\n \"outline-width\",\n \"outline-style\",\n \"outline-color\",\n \"outline-offset\",\n // transform\n \"transform\",\n \"transform-origin\",\n \"rotate\",\n \"scale\",\n \"translate\",\n // tables\n \"border-collapse\",\n \"border-spacing\",\n \"table-layout\",\n \"caption-side\",\n // replaced content + svg\n \"object-fit\",\n \"object-position\",\n \"fill\",\n \"fill-opacity\",\n \"fill-rule\",\n \"stroke\",\n \"stroke-opacity\",\n \"stroke-width\",\n \"stroke-linecap\",\n \"stroke-linejoin\",\n \"stroke-dasharray\",\n \"stroke-dashoffset\",\n \"shape-rendering\",\n \"paint-order\",\n];\n\n/** The extension that belongs to what the canvas actually produced (keksdose\n * `capture-screenshot.ts:247`). */\nconst EXTENSIONS: Record<string, string> = {\n \"image/webp\": \"webp\",\n \"image/jpeg\": \"jpg\",\n \"image/png\": \"png\",\n};\n\n/**\n * Keep a node only if it can paint inside the viewport (keksdose `capture-screenshot.ts:267`).\n *\n * - `display: none` goes, with its subtree — it paints nothing and no descendant can.\n * `<style>` and `<link>` are computed `display: none` too but are NOT decoration: a\n * stylesheet inside the captured subtree still applies inside the `foreignObject`.\n * `visibility: hidden` is deliberately not checked: a descendant may set it back.\n * - A box wholly outside the viewport goes: the root is viewport-sized (the app scrolls an\n * inner `<main>`), so it would have been clipped away unseen.\n * - A ZERO box is kept: `display: contents` reports 0×0 while its children paint, and the\n * library's filter drops a rejected node's children too.\n */\nfunction inViewport(node: Node): boolean {\n if (node.nodeType !== Node.ELEMENT_NODE) return true;\n const el = node as Element;\n const tag = el.tagName;\n if (tag !== \"STYLE\" && tag !== \"LINK\") {\n const display = el.ownerDocument?.defaultView?.getComputedStyle(el).display;\n if (display === \"none\") return false;\n }\n const rect = el.getBoundingClientRect?.();\n if (!rect) return true;\n if (rect.width === 0 && rect.height === 0) return true;\n return !(rect.bottom <= 0 || rect.right <= 0 || rect.top >= window.innerHeight || rect.left >= window.innerWidth);\n}\n\n/** What `captureAppScreenshot` takes. */\nexport interface CaptureAppScreenshotOptions {\n /**\n * The id of the element to capture. Default `\"root\"` — the app's mount point, which is\n * right on purpose: the kit's `Modal` portals to `document.body` as a SIBLING of `#root`,\n * so capturing `#root` leaves the feedback dialog and its backdrop out of the picture\n * without a single filter rule.\n */\n rootId?: string;\n}\n\n/**\n * Snapshot the app view behind the feedback dialog, as a `File` ready for the upload —\n * `screenshot.webp`, or `screenshot.png` where the browser cannot encode WebP.\n *\n * - Resolves `null` when there is no element with `rootId` — nothing to capture.\n * - **Rejects** when the optional peer `modern-screenshot` is not installed (the error\n * says so), or when the capture itself fails. It never swallows: what to say about a\n * failure is the caller's — `useFeedbackSubmit` toasts `feedbackToast.captureFailed`.\n *\n * Call it from the \"Capture screenshot\" button's own click and nowhere else (keksdose\n * checked: running it at dialog OPEN was suspected and was never the cause of the wait).\n */\nexport async function captureAppScreenshot({ rootId = \"root\" }: CaptureAppScreenshotOptions = {}): Promise<File | null> {\n let domToBlob: (typeof import(\"modern-screenshot\"))[\"domToBlob\"];\n try {\n ({ domToBlob } = await import(\"modern-screenshot\"));\n } catch (cause) {\n throw new Error(\n \"@eifi1/ui-kit: captureAppScreenshot needs the optional peer `modern-screenshot` — install it (npm i modern-screenshot).\",\n { cause },\n );\n }\n const el = document.getElementById(rootId);\n if (!el) return null;\n const blob = await domToBlob(el, {\n // Falls back to PNG where WebP cannot be encoded; the File is named from the blob.\n type: \"image/webp\",\n quality: 0.9,\n font: false,\n includeStyleProperties: [...CAPTURE_STYLE_PROPERTIES],\n filter: inViewport,\n });\n const type = blob.type || \"image/png\";\n return new File([blob], `screenshot.${EXTENSIONS[type] ?? \"png\"}`, { type });\n}\n"],"mappings":";AAwDA,MAAM,2BAA8C;AAAA;AAAA,EAElD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AA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 @@
1
+ import 'react';
2
+ export { h as DEFAULT_FEEDBACK_CONTEXT_LABELS, a0 as FeedbackContextBox, a1 as FeedbackContextBoxProps, a2 as FeedbackContextInput, a3 as FeedbackContextLabels, aM as FeedbackSubmitter, b2 as feedbackContext } from '../kit-labels-DQg82eHB.js';
3
+ import '../data-table-labels-DUELeXpa.js';
4
+ import '../components/data-table-sort.js';
5
+ import '../components/swipeable-row.js';
6
+ import '../components/mini-calendar.js';
7
+ import '../components/calendar-heatmap.js';
8
+ import '../components/popover.js';
9
+ import '../components/chip.js';
10
+ import 'lucide-react';
11
+ import '../components/field-sync.js';
12
+ import '../components/tooltip.js';
13
+ import '../hooks/use-anchored-rect.js';
14
+ import '../lib/clipping.js';
15
+ import '../wizard/types.js';
16
+ import '../tour/tour.js';
17
+ import '../search/command-palette.js';
18
+ import '../search/global-search.js';
19
+ import '../search/search-index.js';
20
+ import '../components/month-picker.js';
21
+ import '../components/page-contents.js';
22
+ import '../components/series-chart-labels.js';
23
+ import '../components/pie-chart-labels.js';
24
+ import '../components/sparkline.js';
25
+ import '../components/stat-tile.js';
26
+ import '../components/signature-pad.js';
27
+ import '../components/password-strength.js';
28
+ import '../components/swatch-picker.js';
29
+ import '../components/tile-radio.js';
30
+ import '../components/icon-picker.js';
31
+ import '../components/dialog-frame.js';
32
+ import '../components/modal.js';
33
+ import '../hooks/use-search-param-state.js';
34
+ import '../components/measured-grid.js';
35
+ import '../components/user-avatar.js';
36
+ import '../components/status-dot.js';
37
+ import '../components/progress-bar.js';
38
+ import '../components/signed-amount.js';
39
+ import '../shell/topbar-action-menu.js';
40
+ import '../components/menu-item.js';
41
+ import '../components/floating-panel.js';
42
+ import '../hooks/use-authed-src.js';
43
+ import '../components/account-settings-labels.js';
44
+ import '../components/bulk-action-bar.js';
45
+ import '../components/list.js';
46
+ import '../components/breadcrumbs.js';
47
+ import '../components/toast.js';
48
+ import '../components/description-list.js';
49
+ import '../components/line-items.js';
50
+ import '../components/error-boundary.js';
51
+ import '../components/authed-image.js';
52
+ import '../components/image-grid.js';
53
+ import '../components/lightbox.js';
54
+ import '../components/write-lock.js';
55
+ import '../components/legal.js';
56
+ import '../components/account-chips.js';
57
+ import '../lib/format.js';
58
+ import '../components/reauth-dialog.js';
59
+ import '../components/server-wake.js';
60
+ import '../lib/server-wake.js';
61
+ import '../components/translation-review-labels.js';
62
+ import '../lib/translation-review.js';
63
+ import '../components/country-select.js';
64
+ import '../components/inline-edit-field.js';
65
+ import '../lib/iban.js';
66
+ import '../lib/phone.js';
67
+ import '../components/sign-chip.js';
68
+ import '../components/column-mapper.js';
69
+ import '../lib/column-mapping.js';
70
+ import '../lib/table-text.js';
71
+ import '../components/field-parts.js';
@@ -0,0 +1,96 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { Checkbox } from "../components/checkbox.js";
4
+ import { DEFAULT_COMMON_LABELS, useKitLabels } from "../i18n/kit-labels.js";
5
+ import { cn } from "../lib/cn.js";
6
+ function submitterLine(user) {
7
+ const name = user?.display_name?.trim();
8
+ const email = user?.email?.trim();
9
+ if (name && email) return `${name} (${email})`;
10
+ return name || email || "\u2014";
11
+ }
12
+ function pathOf(url, base) {
13
+ if (!url) return "";
14
+ try {
15
+ return new URL(url, base || "http://localhost").pathname;
16
+ } catch {
17
+ return "";
18
+ }
19
+ }
20
+ function feedbackContext(input) {
21
+ const { user, attachUrl, url } = input;
22
+ const win = typeof window === "undefined" ? void 0 : window;
23
+ const origin = input.origin ?? win?.location.origin ?? "";
24
+ const context = {
25
+ url: attachUrl ? url : "",
26
+ route: attachUrl ? input.route ?? pathOf(url, origin || win?.location.href) : "",
27
+ origin
28
+ };
29
+ if (input.environment !== void 0) context.environment = input.environment;
30
+ context.user_id = user?.id ?? null;
31
+ context.user_email = user?.email ?? null;
32
+ context.user_display_name = user?.display_name ?? null;
33
+ context.viewport = input.viewport ?? (win ? `${win.innerWidth}x${win.innerHeight}` : "");
34
+ context.ua = input.ua ?? (typeof navigator === "undefined" ? "" : navigator.userAgent);
35
+ if (input.version !== void 0) context.version = input.version;
36
+ return context;
37
+ }
38
+ const DEFAULT_FEEDBACK_CONTEXT_LABELS = {
39
+ user: "User",
40
+ attachUrl: "Attach current page URL"
41
+ };
42
+ function FeedbackContextBox({
43
+ user,
44
+ url,
45
+ attachUrl,
46
+ onAttachUrlChange,
47
+ labels: labelsProp,
48
+ className
49
+ }) {
50
+ const labels = useKitLabels("feedbackContext", DEFAULT_FEEDBACK_CONTEXT_LABELS, labelsProp);
51
+ const common = useKitLabels("common", DEFAULT_COMMON_LABELS);
52
+ const submitter = submitterLine(user);
53
+ const line = common.fieldValue(labels.user, submitter);
54
+ const lead = line.endsWith(submitter) ? line.slice(0, line.length - submitter.length) : null;
55
+ return /* @__PURE__ */ jsxs(
56
+ "div",
57
+ {
58
+ className: cn(
59
+ "space-y-1 rounded-md border border-[var(--border)] bg-[var(--bg-surface-2)] px-3 py-2 text-xs text-[var(--text-muted)]",
60
+ className
61
+ ),
62
+ children: [
63
+ /* @__PURE__ */ jsx("div", { className: "[overflow-wrap:anywhere]", children: lead === null ? line : /* @__PURE__ */ jsxs(Fragment, { children: [
64
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-[var(--text-secondary)]", children: lead }),
65
+ submitter
66
+ ] }) }),
67
+ /* @__PURE__ */ jsx(
68
+ Checkbox,
69
+ {
70
+ checked: attachUrl,
71
+ onCheckedChange: onAttachUrlChange,
72
+ label: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-[var(--text-secondary)]", children: labels.attachUrl }),
73
+ description: url ? (
74
+ // `break-all`: a URL is one unbreakable word, and at 390px a long query string
75
+ // would otherwise push the dialog sideways.
76
+ /* @__PURE__ */ jsx(
77
+ "span",
78
+ {
79
+ "data-withheld": attachUrl ? void 0 : "",
80
+ className: cn("break-all text-xs", !attachUrl && "line-through opacity-60"),
81
+ children: url
82
+ }
83
+ )
84
+ ) : void 0
85
+ }
86
+ )
87
+ ]
88
+ }
89
+ );
90
+ }
91
+ export {
92
+ DEFAULT_FEEDBACK_CONTEXT_LABELS,
93
+ FeedbackContextBox,
94
+ feedbackContext
95
+ };
96
+ //# sourceMappingURL=feedback-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/feedback/feedback-context.tsx"],"sourcesContent":["import { Checkbox } from \"../components/checkbox\";\nimport { DEFAULT_COMMON_LABELS, useKitLabels } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport type { FeedbackContext, FeedbackEnvironment } from \"./feedback-record\";\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\nexport const DEFAULT_FEEDBACK_CONTEXT_LABELS: FeedbackContextLabels = {\n user: \"User\",\n attachUrl: \"Attach current page URL\",\n};\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?: Partial<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(\n \"space-y-1 rounded-md border border-[var(--border)] bg-[var(--bg-surface-2)] px-3 py-2 text-xs text-[var(--text-muted)]\",\n className,\n )}\n >\n <div className=\"[overflow-wrap:anywhere]\">\n {lead === null ? (\n line\n ) : (\n <>\n <span className=\"font-medium text-[var(--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-[var(--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"],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;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;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MAEA;AAAA,4BAAC,SAAI,WAAU,4BACZ,mBAAS,OACR,OAEA,iCACE;AAAA,8BAAC,UAAK,WAAU,4CAA4C,gBAAK;AAAA,UAChE;AAAA,WACH,GAEJ;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,SAAS;AAAA,YACT,iBAAiB;AAAA,YACjB,OAAO,oBAAC,UAAK,WAAU,oDAAoD,iBAAO,WAAU;AAAA,YAC5F,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":[]}
@@ -0,0 +1,276 @@
1
+ import { CrashReport } from '../components/error-boundary.js';
2
+ import { ah as FeedbackEnvironment } from '../kit-labels-DQg82eHB.js';
3
+ import 'react';
4
+ import '../data-table-labels-DUELeXpa.js';
5
+ import '../components/data-table-sort.js';
6
+ import '../components/swipeable-row.js';
7
+ import '../components/mini-calendar.js';
8
+ import '../components/calendar-heatmap.js';
9
+ import '../components/popover.js';
10
+ import '../components/chip.js';
11
+ import 'lucide-react';
12
+ import '../components/field-sync.js';
13
+ import '../components/tooltip.js';
14
+ import '../hooks/use-anchored-rect.js';
15
+ import '../lib/clipping.js';
16
+ import '../wizard/types.js';
17
+ import '../tour/tour.js';
18
+ import '../search/command-palette.js';
19
+ import '../search/global-search.js';
20
+ import '../search/search-index.js';
21
+ import '../components/month-picker.js';
22
+ import '../components/page-contents.js';
23
+ import '../components/series-chart-labels.js';
24
+ import '../components/pie-chart-labels.js';
25
+ import '../components/sparkline.js';
26
+ import '../components/stat-tile.js';
27
+ import '../components/signature-pad.js';
28
+ import '../components/password-strength.js';
29
+ import '../components/swatch-picker.js';
30
+ import '../components/tile-radio.js';
31
+ import '../components/icon-picker.js';
32
+ import '../components/dialog-frame.js';
33
+ import '../components/modal.js';
34
+ import '../hooks/use-search-param-state.js';
35
+ import '../components/measured-grid.js';
36
+ import '../components/user-avatar.js';
37
+ import '../components/status-dot.js';
38
+ import '../components/progress-bar.js';
39
+ import '../components/signed-amount.js';
40
+ import '../shell/topbar-action-menu.js';
41
+ import '../components/menu-item.js';
42
+ import '../components/floating-panel.js';
43
+ import '../hooks/use-authed-src.js';
44
+ import '../components/account-settings-labels.js';
45
+ import '../components/bulk-action-bar.js';
46
+ import '../components/list.js';
47
+ import '../components/breadcrumbs.js';
48
+ import '../components/toast.js';
49
+ import '../components/description-list.js';
50
+ import '../components/line-items.js';
51
+ import '../components/authed-image.js';
52
+ import '../components/image-grid.js';
53
+ import '../components/lightbox.js';
54
+ import '../components/write-lock.js';
55
+ import '../components/legal.js';
56
+ import '../components/account-chips.js';
57
+ import '../lib/format.js';
58
+ import '../components/reauth-dialog.js';
59
+ import '../components/server-wake.js';
60
+ import '../lib/server-wake.js';
61
+ import '../components/translation-review-labels.js';
62
+ import '../lib/translation-review.js';
63
+ import '../components/country-select.js';
64
+ import '../components/inline-edit-field.js';
65
+ import '../lib/iban.js';
66
+ import '../lib/phone.js';
67
+ import '../components/sign-chip.js';
68
+ import '../components/column-mapper.js';
69
+ import '../lib/column-mapping.js';
70
+ import '../lib/table-text.js';
71
+ import '../components/field-parts.js';
72
+
73
+ /**
74
+ * `POST /feedback/crash`'s body — `CrashReportCreate`, §3.6 (kk `schemas/feedback.py`),
75
+ * including the optional `origin` and `environment` the server copies into the row's
76
+ * `context`, so a dev crash no longer reads as prod and the admin list shows its env
77
+ * chip (§3.2).
78
+ *
79
+ * Every string is clamped to the server's column width before it is sent: one character
80
+ * over a `max_length` used to come back 422 and the report was lost (kk
81
+ * `crash-report.ts:104-106`) — the diagnostics are worth more truncated than not
82
+ * delivered. Empty strings are sent as `null`.
83
+ */
84
+ interface CrashReportCreate {
85
+ /** The thrown value's `name`, ≤ 200. */
86
+ name: string | null;
87
+ /** 1–2000; `"(no message)"` when the error had none. */
88
+ message: string;
89
+ /** ≤ 8000 each. */
90
+ stack: string | null;
91
+ component_stack: string | null;
92
+ /** The boundary's `placement`: `"app"` stays `"app"`, anything else is `"page"`. */
93
+ boundary: "app" | "page";
94
+ /** `origin` + the redacted page, ≤ 2000. */
95
+ url: string | null;
96
+ /** The redacted page's pathname, ≤ 500. */
97
+ route: string | null;
98
+ /** ≤ 50 each. */
99
+ version: string | null;
100
+ viewport: string | null;
101
+ /** ≤ 500. */
102
+ ua: string | null;
103
+ online: boolean | null;
104
+ /** ISO 8601, UTC — when it crashed, not when a buffered copy was finally sent. */
105
+ occurred_at: string;
106
+ /** `location.origin` — which copy of the app (§3.2). ≤ 200. */
107
+ origin: string | null;
108
+ /** `"prod"` / `"dev"` / `"local"` (§3.2) — the app's `environment` option. ≤ 20. */
109
+ environment: string | null;
110
+ }
111
+ /** `POST /feedback/crash`'s answer — always a 202 (§3.6). Only `stored` decides. */
112
+ interface CrashReportResponse {
113
+ /** `false` when the server dropped it on purpose: the limiter, a demo user. */
114
+ stored: boolean;
115
+ /** `true` when it was counted onto an open row with the same fingerprint. */
116
+ duplicate?: boolean;
117
+ feedback_id?: number | null;
118
+ /** The fingerprint's first 8 characters, for the user to quote. */
119
+ reference?: string | null;
120
+ }
121
+ /**
122
+ * What {@link CrashReporter.onReport} resolves with — the kit `ErrorBoundary`'s
123
+ * `CrashReportResult`, narrowed to the three answers the fallback tells apart:
124
+ *
125
+ * - **filed with a reference** — `{ reference: "3fae6774" }`: the server stored it
126
+ * (`stored === true`) and named it; the screen says "Reported as 3fae6774" and drops
127
+ * the copy button;
128
+ * - **filed** — `{}`: stored, but the server gave no reference; the screen says "This
129
+ * error has been reported automatically.";
130
+ * - **not filed** — `{ filed: false }`: suppressed by the app (`suppress`, a hot
131
+ * update, a chunk-load error), refused by the server (`stored: false`, a 4xx), or
132
+ * buffered for later (offline, signed out, 401, 5xx, no network). The screen claims
133
+ * nothing and keeps the copy button.
134
+ *
135
+ * Code that reads it outside a boundary: filed is `result.filed !== false`.
136
+ */
137
+ type CrashFiling = {
138
+ reference?: string;
139
+ } | {
140
+ filed: false;
141
+ };
142
+ interface CrashReporterOptions {
143
+ /** The app's crash route, e.g. `${API_BASE}/feedback/crash` (§3.3). */
144
+ endpoint: string;
145
+ /**
146
+ * The bearer token, read at the moment of filing — **never assumed to exist**. Nothing
147
+ * (`null`, `undefined`, `""`) means signed out, or not yet signed in again (kastlan
148
+ * keeps its access token in memory, so it is `null` at start-up until the refresh
149
+ * lands): the report is buffered and {@link CrashReporter.flushPending} sends it once
150
+ * a token appears.
151
+ *
152
+ * Must not touch React — no hooks, no context: it runs from a component that is
153
+ * mid-crash. Read storage or a store's `getState()` (kk `crash-report.ts:175-181`).
154
+ * A throw reads as "no token".
155
+ */
156
+ getToken: () => string | null | undefined;
157
+ /**
158
+ * The query params a report may keep — the app's ALLOW-list (§4.6). Everything else
159
+ * is dropped, so a param added later stays out until somebody decides otherwise.
160
+ * keksdose's: `p ps sort tab g granularity month preset from to tstate future
161
+ * archived uncleared` (kk `crash-report.ts:136-151`) — what locates a render crash
162
+ * (paging, sort, range, grouping), never `q` (free text), `f.*` (filters holding
163
+ * payee names) or ids (`row`, `action`). Copied when the reporter is made.
164
+ */
165
+ allowParams: Iterable<string>;
166
+ /** The `localStorage` key undeliverable reports wait under — one per app, e.g.
167
+ * keksdose's `"keksdose.pendingCrashReports"` (kk `crash-report.ts:35`). */
168
+ storageKey: string;
169
+ /**
170
+ * The app's own opt-out: `true` files nothing and buffers nothing — keksdose's demo
171
+ * sessions (kk `crash-report.ts:183-193`; its server answers `stored: false` for them
172
+ * anyway). Asked at filing time and again before a flush, which keeps the buffer
173
+ * while it says `true`. Must not touch React; a throw reads as `false`. Optional:
174
+ * kastlan has no demo users.
175
+ */
176
+ suppress?: () => boolean;
177
+ /** The deploy environment, copied into every report (§3.2; kk
178
+ * `app/deploy-environment.ts`). */
179
+ environment: FeedbackEnvironment | (string & {});
180
+ /** Which copy of the app — default `location.origin` at filing time. */
181
+ origin?: string;
182
+ /** The app build — default the boundary's `appVersion` prop, as the report carries it. */
183
+ version?: string;
184
+ /** The `fetch` to post with — default the global one, looked up at each call. For
185
+ * tests (no network) and for an app whose `fetch` is wrapped. */
186
+ fetchImpl?: typeof fetch;
187
+ }
188
+ /** What {@link createCrashReporter} returns. Every member is a free function (no
189
+ * `this`), safe to pass as a prop or a listener as it stands. */
190
+ interface CrashReporter {
191
+ /**
192
+ * The boundary's `onReport`: file one crash and say how it went ({@link CrashFiling}).
193
+ * Never throws, never rejects.
194
+ *
195
+ * The report arrives already `redact`ed when this reporter's `redact` is the
196
+ * boundary's too; the page is reduced again here anyway, because the allow-list is
197
+ * the one thing this channel must never get wrong (kk `crash-report.ts:273-276`).
198
+ */
199
+ onReport: (report: CrashReport) => Promise<CrashFiling>;
200
+ /**
201
+ * The boundary's `redact`: the report with its page reduced to the pathname and the
202
+ * allowed query params (no hash). The screen's details and the copy button — whose
203
+ * text ends up pasted into a feedback message — then show the same reduced page as the
204
+ * POST (kk `crash-report.ts:114-135`). `extras` are the app's own and pass unchanged.
205
+ */
206
+ redact: (report: CrashReport) => CrashReport;
207
+ /**
208
+ * Send the buffered reports. Call it at start-up and whenever a token appears (kk
209
+ * `main.tsx:59-61`). One flush at a time — a second call while one runs joins it.
210
+ * Keeps the buffer while there is no token, the app suppresses, or the browser is
211
+ * offline; stops at the first 401/5xx/network failure and keeps the rest. Never
212
+ * rejects.
213
+ */
214
+ flushPending: () => Promise<void>;
215
+ /**
216
+ * Note that Vite has just applied a hot update: a crash within 10 s of one is HMR
217
+ * fallout (a module re-executed under a live React tree), not the app's bug, and is
218
+ * not filed (kk `crash-report.ts:56-102`; eight rows across five keksdose feedback
219
+ * runs were exactly this). Dev only by construction — a production build has no
220
+ * `import.meta.hot` to call it from. The kit cannot listen itself (a pre-bundled
221
+ * dependency sees no `import.meta.hot`), so the app wires both events:
222
+ *
223
+ * ```ts
224
+ * if (import.meta.hot) {
225
+ * import.meta.hot.on("vite:beforeUpdate", () => crashReporter.noteHotUpdate());
226
+ * import.meta.hot.on("vite:afterUpdate", () => crashReporter.noteHotUpdate());
227
+ * }
228
+ * ```
229
+ */
230
+ noteHotUpdate: (at?: number) => void;
231
+ }
232
+ /**
233
+ * Make the crash filer for one app — §4.6, the kit's half of keksdose's
234
+ * `shared/lib/crash-report.ts`. Hand the result to both boundaries (`placement="app"`
235
+ * at the root, `"page"` in the layout):
236
+ *
237
+ * ```tsx
238
+ * export const crashReporter = createCrashReporter({
239
+ * endpoint: `${API_BASE}/feedback/crash`,
240
+ * getToken: () => localStorage.getItem("auth_token"),
241
+ * allowParams: ["p", "ps", "sort", "tab"],
242
+ * storageKey: "myapp.pendingCrashReports",
243
+ * suppress: () => useAuth.getState().user?.is_demo === true,
244
+ * environment: deployEnvironment(),
245
+ * });
246
+ *
247
+ * <ErrorBoundary placement="page" appVersion={APP_VERSION}
248
+ * redact={crashReporter.redact} onReport={crashReporter.onReport}>
249
+ *
250
+ * // start-up, and whenever a token appears (kk main.tsx:59-61)
251
+ * void crashReporter.flushPending();
252
+ * useAuth.subscribe((s, prev) => { if (s.token && !prev.token) void crashReporter.flushPending(); });
253
+ * ```
254
+ *
255
+ * What it sends: §3.6's `CrashReportCreate` ({@link CrashReportCreate}) with `origin`
256
+ * and `environment`, clamped to the server's caps. How: a bare `fetch` with `keepalive`
257
+ * and the bearer token — **not the app's axios client**, whose 401 handler would log the
258
+ * user out of a page that has just crashed (kk `crash-report.ts:222-235`), and
259
+ * `keepalive` so the request survives the Reload the user is about to press.
260
+ *
261
+ * When it files nothing (resolving `{ filed: false }`):
262
+ * - a chunk-load error (the boundary already withholds those) — a deploy or a dropped
263
+ * connection, not a defect;
264
+ * - `suppress()` says so (demo sessions), or a hot update landed under 10 s ago;
265
+ * - the server answered `stored: false` (limiter, demo) or a 4xx other than 401 —
266
+ * dropped, never retried: the server will never take that payload.
267
+ *
268
+ * When it buffers (also `{ filed: false }` — not filed *yet*): offline, no token,
269
+ * 401, 5xx, or no network. Up to 3 reports wait under `storageKey`, the newest kept,
270
+ * identical crashes kept once (see `bufferKey`); {@link CrashReporter.flushPending}
271
+ * sends them. A signed-out visitor's crash waits for a sign-in — there is no
272
+ * unauthenticated crash endpoint (Kurvenschmiede's public pages; accepted, §4.6).
273
+ */
274
+ declare function createCrashReporter(options: CrashReporterOptions): CrashReporter;
275
+
276
+ export { type CrashFiling, type CrashReportCreate, type CrashReportResponse, type CrashReporter, type CrashReporterOptions, createCrashReporter };