@eifi1/ui-kit 0.52.0 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -59
- package/dist/account/delete-account-setting.d.ts +3 -2
- package/dist/account/delete-account-setting.js.map +1 -1
- package/dist/auth/auth-errors.d.ts +36 -0
- package/dist/auth/auth-errors.js +20 -0
- package/dist/auth/auth-errors.js.map +1 -1
- package/dist/billing/cancel-subscription.d.ts +5 -14
- package/dist/billing/cancel-subscription.js +1 -3
- package/dist/billing/cancel-subscription.js.map +1 -1
- package/dist/billing/plan-card.d.ts +5 -13
- package/dist/billing/plan-card.js +3 -11
- package/dist/billing/plan-card.js.map +1 -1
- package/dist/billing/plan-switch.d.ts +5 -14
- package/dist/billing/plan-switch.js +1 -3
- package/dist/billing/plan-switch.js.map +1 -1
- package/dist/chart.d.ts +3 -14
- package/dist/chart.js +64 -11
- package/dist/chart.js.map +1 -1
- package/dist/components/amount-input.d.ts +2 -1
- package/dist/components/amount-input.js.map +1 -1
- package/dist/components/calendar-heatmap.js +4 -2
- package/dist/components/calendar-heatmap.js.map +1 -1
- package/dist/components/currency-option-list.d.ts +2 -1
- package/dist/components/currency-option-list.js +10 -3
- package/dist/components/currency-option-list.js.map +1 -1
- package/dist/components/currency-select.d.ts +3 -1
- package/dist/components/currency-select.js.map +1 -1
- package/dist/components/danger-confirm.d.ts +22 -1
- package/dist/components/danger-confirm.js +50 -28
- package/dist/components/danger-confirm.js.map +1 -1
- package/dist/components/data-table-filter-popover.d.ts +2 -1
- package/dist/components/data-table-filter-popover.js +3 -2
- package/dist/components/data-table-filter-popover.js.map +1 -1
- package/dist/components/data-table-filters.d.ts +33 -3
- package/dist/components/data-table-filters.js +6 -4
- package/dist/components/data-table-filters.js.map +1 -1
- package/dist/components/date-field.d.ts +1 -1
- package/dist/components/date-field.js.map +1 -1
- package/dist/components/date-picker.d.ts +1 -1
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/date-range-picker.d.ts +4 -17
- package/dist/components/date-range-picker.js +2 -2
- package/dist/components/date-range-picker.js.map +1 -1
- package/dist/components/dialog-frame.d.ts +3 -1
- package/dist/components/dialog-frame.js +6 -2
- package/dist/components/dialog-frame.js.map +1 -1
- package/dist/components/mini-calendar.js +3 -2
- package/dist/components/mini-calendar.js.map +1 -1
- package/dist/components/modal.d.ts +27 -0
- package/dist/components/modal.js +5 -3
- package/dist/components/modal.js.map +1 -1
- package/dist/components/nav-pills.d.ts +1 -1
- package/dist/components/nav-pills.js.map +1 -1
- package/dist/components/number-input.js.map +1 -1
- package/dist/components/series-chart-axes.d.ts +1 -1
- package/dist/components/series-chart-axes.js.map +1 -1
- package/dist/components/series-chart.d.ts +64 -19
- package/dist/components/series-chart.js +2 -1
- package/dist/components/series-chart.js.map +1 -1
- package/dist/components/stat-tile.d.ts +21 -2
- package/dist/components/stat-tile.js +4 -2
- package/dist/components/stat-tile.js.map +1 -1
- package/dist/components/treemap-labels.d.ts +6 -1
- package/dist/components/treemap-labels.js +2 -2
- package/dist/components/treemap-labels.js.map +1 -1
- package/dist/components/treemap.d.ts +29 -4
- package/dist/components/treemap.js +22 -9
- package/dist/components/treemap.js.map +1 -1
- package/dist/currencies.d.ts +16 -2
- package/dist/currencies.js +2 -1
- package/dist/currencies.js.map +1 -1
- package/dist/data-table.d.ts +1 -6
- package/dist/data-table.js +1 -9
- package/dist/data-table.js.map +1 -1
- package/dist/demo/demo-countdown.d.ts +0 -5
- package/dist/demo/demo-countdown.js +0 -4
- package/dist/demo/demo-countdown.js.map +1 -1
- package/dist/eslint/index.js +1 -1
- package/dist/feedback/feedback-context-labels.js +2 -1
- package/dist/feedback/feedback-context-labels.js.map +1 -1
- package/dist/feedback/feedback-context.d.ts +19 -3
- package/dist/feedback/feedback-context.js +12 -1
- package/dist/feedback/feedback-context.js.map +1 -1
- package/dist/feedback/feedback-diagnostics.d.ts +17 -0
- package/dist/feedback/feedback-diagnostics.js +27 -0
- package/dist/feedback/feedback-diagnostics.js.map +1 -0
- package/dist/feedback/feedback-dialog.d.ts +10 -0
- package/dist/feedback/feedback-dialog.js +6 -4
- package/dist/feedback/feedback-dialog.js.map +1 -1
- package/dist/feedback/feedback-mutation.d.ts +11 -23
- package/dist/feedback/feedback-mutation.js +1 -9
- package/dist/feedback/feedback-mutation.js.map +1 -1
- package/dist/feedback/feedback-public-list.d.ts +1 -6
- package/dist/feedback/feedback-public-list.js +1 -2
- package/dist/feedback/feedback-public-list.js.map +1 -1
- package/dist/feedback/feedback-record.d.ts +5 -0
- package/dist/feedback/feedback-record.js.map +1 -1
- package/dist/feedback/feedback-row-detail-labels.js +1 -8
- package/dist/feedback/feedback-row-detail-labels.js.map +1 -1
- package/dist/feedback/feedback-row-detail.d.ts +6 -50
- package/dist/feedback/feedback-row-detail.js +3 -8
- package/dist/feedback/feedback-row-detail.js.map +1 -1
- package/dist/feedback/feedback-status-undo.d.ts +3 -19
- package/dist/feedback/feedback-status-undo.js.map +1 -1
- package/dist/feedback/feedback-submit-dialog.d.ts +5 -1
- package/dist/feedback/feedback-submit-dialog.js +15 -3
- package/dist/feedback/feedback-submit-dialog.js.map +1 -1
- package/dist/feedback/feedback-submit.d.ts +30 -2
- package/dist/feedback/feedback-submit.js +5 -2
- package/dist/feedback/feedback-submit.js.map +1 -1
- package/dist/feedback/feedback-thread.d.ts +0 -9
- package/dist/feedback/feedback-thread.js.map +1 -1
- package/dist/feedback.d.ts +6 -40
- package/dist/feedback.js +88 -46
- package/dist/feedback.js.map +1 -1
- package/dist/hooks/use-hotkey.js +11 -1
- package/dist/hooks/use-hotkey.js.map +1 -1
- package/dist/i18n/defaults.js +0 -4
- package/dist/i18n/defaults.js.map +1 -1
- package/dist/i18n/german.js +5 -20
- package/dist/i18n/german.js.map +1 -1
- package/dist/i18n/kit-labels.d.ts +5 -14
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/i18n/locales/en.js +5 -31
- package/dist/i18n/locales/en.js.map +3 -3
- package/dist/i18n/locales/es.js +5 -20
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.js +5 -20
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.js +5 -20
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.js +5 -21
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.js +5 -20
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/review.js +9 -4
- package/dist/i18n/review.js.map +1 -1
- package/dist/i18n/shared-labels.js +0 -1
- package/dist/i18n/shared-labels.js.map +1 -1
- package/dist/index.d.ts +18 -67
- package/dist/index.js +28 -103
- package/dist/index.js.map +1 -1
- package/dist/lib/dates.d.ts +7 -1
- package/dist/lib/dates.js +8 -1
- package/dist/lib/dates.js.map +1 -1
- package/dist/lib/format.d.ts +37 -2
- package/dist/lib/format.js +25 -1
- package/dist/lib/format.js.map +1 -1
- package/dist/lib/intl-cache.d.ts +4 -2
- package/dist/lib/intl-cache.js.map +1 -1
- package/dist/lib/translation-review.d.ts +26 -0
- package/dist/lib/translation-review.js +14 -0
- package/dist/lib/translation-review.js.map +1 -1
- package/dist/rhf/fields.d.ts +2 -2
- package/dist/rhf/fields.js.map +1 -1
- package/dist/search/search-index.d.ts +0 -6
- package/dist/search/search-index.js +0 -4
- package/dist/search/search-index.js.map +1 -1
- package/dist/search.d.ts +1 -8
- package/dist/search.js +2 -7
- package/dist/search.js.map +1 -1
- package/dist/shell/account-menu-language.d.ts +7 -21
- package/dist/shell/account-menu-language.js +1 -3
- package/dist/shell/account-menu-language.js.map +1 -1
- package/dist/shell/account-menu-text-size.d.ts +9 -23
- package/dist/shell/account-menu-text-size.js +2 -3
- package/dist/shell/account-menu-text-size.js.map +1 -1
- package/dist/shell/app-shell.d.ts +0 -10
- package/dist/shell/app-shell.js +1 -7
- package/dist/shell/app-shell.js.map +1 -1
- package/dist/shell/company-switcher.d.ts +1 -1
- package/dist/shell/company-switcher.js.map +1 -1
- package/dist/shell/dev-menu.d.ts +1 -1
- package/dist/shell/dev-menu.js.map +1 -1
- package/dist/shell/top-bar-parts-labels.d.ts +1 -1
- package/dist/shell/top-bar-parts-labels.js.map +1 -1
- package/dist/shell.d.ts +7 -29
- package/dist/shell.js +12 -42
- package/dist/shell.js.map +1 -1
- package/dist/sync.d.ts +2 -6
- package/dist/sync.js +2 -15
- package/dist/sync.js.map +1 -1
- package/dist/theme/chart-palette.d.ts +0 -5
- package/dist/theme/chart-palette.js +0 -2
- package/dist/theme/chart-palette.js.map +1 -1
- package/package.json +1 -1
- package/src/account/delete-account-setting.tsx +3 -2
- package/src/auth/auth-errors.ts +69 -0
- package/src/billing/cancel-subscription.tsx +5 -16
- package/src/billing/plan-card.tsx +7 -24
- package/src/billing/plan-switch.tsx +5 -16
- package/src/chart.ts +62 -13
- package/src/components/amount-input.tsx +2 -1
- package/src/components/calendar-heatmap.tsx +8 -2
- package/src/components/currency-option-list.tsx +12 -4
- package/src/components/currency-select.tsx +3 -1
- package/src/components/danger-confirm.tsx +80 -27
- package/src/components/data-table-filter-popover.tsx +19 -11
- package/src/components/data-table-filters.ts +36 -8
- package/src/components/date-field.tsx +1 -1
- package/src/components/date-picker.tsx +0 -1
- package/src/components/date-range-picker.tsx +6 -22
- package/src/components/dialog-frame.tsx +12 -4
- package/src/components/mini-calendar.tsx +5 -2
- package/src/components/modal.tsx +36 -7
- package/src/components/nav-pills.tsx +1 -1
- package/src/components/number-input.tsx +4 -3
- package/src/components/series-chart-axes.ts +6 -1
- package/src/components/series-chart.tsx +78 -21
- package/src/components/stat-tile.tsx +32 -3
- package/src/components/treemap-labels.ts +11 -3
- package/src/components/treemap.tsx +65 -12
- package/src/currencies.ts +23 -3
- package/src/data-table.ts +1 -11
- package/src/demo/demo-countdown.ts +3 -8
- package/src/feedback/feedback-context-labels.ts +1 -0
- package/src/feedback/feedback-context.tsx +34 -2
- package/src/feedback/feedback-diagnostics.tsx +41 -0
- package/src/feedback/feedback-dialog.tsx +16 -4
- package/src/feedback/feedback-mutation.ts +12 -33
- package/src/feedback/feedback-public-list.tsx +1 -7
- package/src/feedback/feedback-record.ts +5 -0
- package/src/feedback/feedback-row-detail-labels.ts +1 -8
- package/src/feedback/feedback-row-detail.tsx +21 -58
- package/src/feedback/feedback-status-undo.ts +4 -18
- package/src/feedback/feedback-submit-dialog.tsx +15 -2
- package/src/feedback/feedback-submit.tsx +36 -3
- package/src/feedback/feedback-thread.tsx +0 -10
- package/src/feedback.ts +89 -48
- package/src/hooks/use-hotkey.ts +24 -1
- package/src/i18n/defaults.ts +0 -4
- package/src/i18n/german.ts +4 -19
- package/src/i18n/kit-labels.tsx +5 -14
- package/src/i18n/locales/es.ts +4 -19
- package/src/i18n/locales/fr.ts +4 -19
- package/src/i18n/locales/hu.ts +4 -19
- package/src/i18n/locales/it.ts +4 -20
- package/src/i18n/locales/zh.ts +4 -19
- package/src/i18n/review.ts +9 -4
- package/src/i18n/shared-labels.ts +0 -1
- package/src/index.ts +44 -114
- package/src/lib/dates.ts +24 -2
- package/src/lib/format.ts +66 -3
- package/src/lib/intl-cache.ts +4 -2
- package/src/lib/translation-review.ts +52 -0
- package/src/rhf/fields.tsx +2 -2
- package/src/search/search-index.ts +0 -15
- package/src/search.ts +8 -8
- package/src/shell/account-menu-language.tsx +7 -27
- package/src/shell/account-menu-text-size.tsx +13 -32
- package/src/shell/app-shell.tsx +0 -13
- package/src/shell/company-switcher.tsx +1 -1
- package/src/shell/dev-menu.tsx +1 -1
- package/src/shell/top-bar-parts-labels.ts +1 -1
- package/src/shell.ts +17 -44
- package/src/sync.ts +2 -15
- package/src/theme/chart-palette.ts +0 -2
- package/tokens.css +4 -4
- package/dist/billing/dialog-close.d.ts +0 -29
- package/dist/billing/dialog-close.js +0 -8
- package/dist/billing/dialog-close.js.map +0 -1
- package/dist/components/field-sync-labels.d.ts +0 -3
- package/dist/components/field-sync-labels.js +0 -12
- package/dist/components/field-sync-labels.js.map +0 -1
- package/dist/components/field-sync.d.ts +0 -186
- package/dist/components/field-sync.js +0 -269
- package/dist/components/field-sync.js.map +0 -1
- package/dist/components/section-nav.d.ts +0 -44
- package/dist/components/section-nav.js +0 -33
- package/dist/components/section-nav.js.map +0 -1
- package/dist/components/sign-chip-labels.d.ts +0 -3
- package/dist/components/sign-chip-labels.js +0 -11
- package/dist/components/sign-chip-labels.js.map +0 -1
- package/dist/components/sign-chip.d.ts +0 -77
- package/dist/components/sign-chip.js +0 -47
- package/dist/components/sign-chip.js.map +0 -1
- package/dist/lib/isin.d.ts +0 -38
- package/dist/lib/isin.js +0 -36
- package/dist/lib/isin.js.map +0 -1
- package/dist/shell/role-switcher.d.ts +0 -28
- package/dist/shell/role-switcher.js +0 -31
- package/dist/shell/role-switcher.js.map +0 -1
- package/src/billing/dialog-close.ts +0 -34
- package/src/components/field-sync-labels.ts +0 -14
- package/src/components/field-sync.tsx +0 -504
- package/src/components/section-nav.tsx +0 -72
- package/src/components/sign-chip-labels.ts +0 -13
- package/src/components/sign-chip.tsx +0 -133
- package/src/lib/isin.ts +0 -72
- package/src/shell/role-switcher.tsx +0 -53
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/feedback/feedback-public-list.tsx"],"sourcesContent":["import { useMemo, useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { ChevronLeft, ChevronRight, MessageSquare, ThumbsUp } from \"lucide-react\";\nimport { DataTable, type DataTableColumn } from \"../components/data-table\";\nimport { DEFAULT_DATA_TABLE_LABELS } from \"../components/data-table-labels\";\nimport { IconButton } from \"../components/icon-button\";\nimport { SearchField } from \"../components/search-field\";\nimport { ToggleGroup } from \"../components/toggle-group\";\nimport type { CommitScope } from \"../components/write-lock\";\nimport type { AuthedFetcher } from \"../hooks/use-authed-src\";\nimport { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { FILL_HEIGHT_CLASS } from \"../shell/fill-height\";\nimport { EMPTY_FORMATTED_VALUE } from \"../lib/format\";\nimport {\n FeedbackCategoryBadge,\n FeedbackDetail,\n FeedbackDetailSection,\n FeedbackProse,\n FeedbackStatusBadge,\n} from \"./feedback-inbox\";\nimport { useFeedbackCategoryLabels } from \"./feedback-labels\";\nimport { FeedbackCommentThread, type FeedbackCommentsLabels } from \"./feedback-comment-thread\";\nimport type { FeedbackEntryUploadOptions } from \"./feedback-entry-file\";\nimport { DEFAULT_FEEDBACK_PUBLIC_LABELS, type FeedbackPublicLabels } from \"./feedback-public-labels\";\nimport type {\n FeedbackComment,\n FeedbackPublicListItem,\n FeedbackPublicRecord,\n FeedbackPublicSort,\n FeedbackVoteState,\n} from \"./feedback-public-types\";\nimport {\n useFeedbackPageLabels,\n useFeedbackRenderDate,\n type FeedbackPageLabels,\n type FeedbackRenderDate,\n} from \"./feedback-table\";\nimport { FeedbackVoteButton } from \"./feedback-vote-button\";\n\nexport { DEFAULT_FEEDBACK_PUBLIC_LABELS };\nexport type { FeedbackPublicLabels };\n\n/** `feedbackPublic` resolved: English, then `<UiKitProvider labels>`, then `labels`. */\nexport function useFeedbackPublicLabels(labels?: LabelOverride<FeedbackPublicLabels>): FeedbackPublicLabels {\n return useKitLabels(\"feedbackPublic\", DEFAULT_FEEDBACK_PUBLIC_LABELS, labels);\n}\n\n/** The sort toggle's order: the server's default first (§9.6). */\nconst SORTS: readonly FeedbackPublicSort[] = [\"newest\", \"votes\", \"updated\"];\n\n/** A date in a cell, as the inbox writes it: `<time>`, nowrap, tabular figures. */\nfunction PublicDate({ value, renderDate }: { value: string | null | undefined; renderDate: FeedbackRenderDate }) {\n if (!value) return <span className=\"text-placeholder\">{EMPTY_FORMATTED_VALUE}</span>;\n return (\n <time dateTime={value} className=\"whitespace-nowrap tabular-nums text-muted\">\n {renderDate(value)}\n </time>\n );\n}\n\n/** The visible comments as a small chip beside the title — the count in figures, the\n * words for a screen reader. Nothing at 0. */\nfunction CommentCount({ count, labels }: { count: number; labels: FeedbackPublicLabels }) {\n if (!count) return null;\n return (\n <span className=\"inline-flex shrink-0 items-center gap-1 text-xs text-muted\" data-feedback-comment-count={count}>\n <MessageSquare className=\"size-3.5\" aria-hidden />\n <span aria-hidden className=\"tabular-nums\">\n {count}\n </span>\n <span className=\"sr-only\">{labels.comments(count)}</span>\n </span>\n );\n}\n\n/** The votes on a phone card: the thumb and the count, in the brand colour when the\n * viewer's own. */\nfunction VoteCount({ count, voted, labels }: { count: number; voted: boolean; labels: FeedbackPublicLabels }) {\n return (\n <span\n className={cn(\"ms-auto inline-flex shrink-0 items-center gap-1 text-xs\", voted ? \"text-brand\" : \"text-muted\")}\n data-feedback-vote-count={count}\n >\n <ThumbsUp className=\"size-3.5\" aria-hidden />\n <span aria-hidden className=\"tabular-nums\">\n {count}\n </span>\n <span className=\"sr-only\">{labels.votes(count)}</span>\n </span>\n );\n}\n\n/** 0.38.1: previous / next over the server's pages when it answers no total\n * (`GET /feedback/public` — Kurvenschmiede): \"Page 3\" between two arrows. The arrows'\n * names are `dataTable`'s, the strip's; the page's is `feedbackPublic.page`. */\nfunction PublicPager({\n page,\n hasMore,\n onPageChange,\n labels,\n}: {\n page: number;\n hasMore: boolean;\n onPageChange: (page: number) => void;\n labels: FeedbackPublicLabels;\n}) {\n const tableLabels = useKitLabels(\"dataTable\", DEFAULT_DATA_TABLE_LABELS);\n const name = labels.page(page + 1);\n return (\n <div\n role=\"group\"\n aria-label={name}\n className=\"flex items-center justify-end gap-2 text-sm text-secondary\"\n data-feedback-public-pager={page}\n >\n <IconButton\n size=\"sm\"\n variant=\"secondary\"\n label={tableLabels.prevPage}\n disabled={page <= 0}\n onClick={() => onPageChange(page - 1)}\n >\n {/* \"Previous\" points back along the line — left in LTR, right in RTL. */}\n <ChevronLeft className=\"rtl:-scale-x-100\" />\n </IconButton>\n <span className=\"tabular-nums\" aria-hidden>\n {name}\n </span>\n <IconButton\n size=\"sm\"\n variant=\"secondary\"\n label={tableLabels.nextPage}\n disabled={!hasMore}\n onClick={() => onPageChange(page + 1)}\n >\n <ChevronRight className=\"rtl:-scale-x-100\" />\n </IconButton>\n </div>\n );\n}\n\n/* ── The list ─────────────────────────────────────────────────────────────── */\n\nexport interface FeedbackPublicListProps<T extends FeedbackPublicListItem = FeedbackPublicListItem> {\n /** `GET /feedback/public?sort=&q=` — the server's page, in the server's order.\n * `readonly` since 0.52 (refactor audit 2026-10-30, API-7): the list never changes it. */\n rows: readonly T[];\n /** How many the query has in all — the line beside the sort. Left out, no line. */\n total?: number;\n /** The server sorts (§9.6): the toggle only says which way. */\n sort: FeedbackPublicSort;\n onSortChange: (sort: FeedbackPublicSort) => void;\n /** The search box's text (`q`, titles only). */\n search?: string;\n /**\n * The search box is drawn ONLY with this handler: where the app's titles are sealed\n * (Kurvenschmiede, `FeedbackDeps.public_search=False`, §9.9) there is nothing to search\n * on and the server answers `q` with a 422 — so it passes none.\n */\n onSearchChange?: (search: string) => void;\n /** The opened row: the app's {@link FeedbackPublicDetail} with the row's\n * `GET /feedback/public/{id}` and its comments. */\n renderDetail: (row: T) => ReactNode;\n /** `PUT` / `DELETE /feedback/{id}/vote` for a row's button (`next`: the new state);\n * resolve with the answer, reject to roll back. */\n onVote: (row: T, next: boolean) => Promise<FeedbackVoteState>;\n /** The page is loading: the table says so where its rows would be. */\n loading?: boolean;\n /** The opened row's id, when the app keeps it (a `?row=` param). Left out, the list\n * keeps it itself. */\n openId?: number | null;\n /** 0.52: a row was opened (its id) or closed (`null`) — `openId`'s pair. Named for\n * what it carries: every other `onOpenChange` in the kit is a boolean (refactor audit\n * 2026-10-30, API-5). */\n onOpenIdChange?: (id: number | null) => void;\n /**\n * @deprecated 0.52 — `onOpenIdChange`, the same call: an `onOpenChange` is a boolean\n * everywhere else in the kit; removed in 0.53\n */\n onOpenChange?: (id: number | null) => void;\n /**\n * 0.38.1: the opened report when it is NOT on this page — a `?row=` link to an older\n * one (Kurvenschmiede). The app fetches it (`GET /feedback/public/{id}`, a list item's\n * fields and more) and passes it with `openId`; while `openId` is its id it is drawn\n * first, above the page's rows, and opened with `renderDetail` (on the phone, in the\n * full-screen dialog). Closed, it is gone. A row the page has already is never drawn\n * twice: the page's own is opened instead.\n */\n openRow?: T | null;\n /**\n * 0.38.1: the server's page, from 0 — for a pager where `/feedback/public` answers no\n * total (Kurvenschmiede). With {@link onPageChange} a **Previous / Page n / Next**\n * strip stands under the table; Next is off without {@link hasMore}. Left out, no\n * pager: the server's `limit` is all there is.\n */\n page?: number;\n /** 0.38.1: there is a page after this one (e.g. the page came back full). */\n hasMore?: boolean;\n /** 0.38.1: go to another page (`page ± 1`); the app fetches it. Draws the pager. */\n onPageChange?: (page: number) => void;\n /** A vote COMMITS — see Button's `commit`. */\n commit?: CommitScope;\n /** See {@link FeedbackRenderDate}. Default: the kit's, with the weekday. */\n renderDate?: FeedbackRenderDate;\n /** Over the `feedbackPublic` namespace. The shared column names (#, Date, Category,\n * Subject, Status) are `feedbackPage`'s: pass `pageLabels` for those. */\n labels?: LabelOverride<FeedbackPublicLabels>;\n pageLabels?: LabelOverride<FeedbackPageLabels>;\n /** 0.40.1: the list fills the window as DataTable's `fillHeight` (page layout §1) — the\n * public feedback page passes §1.2's rule. Below md the page scrolls, as everywhere. */\n fillHeight?: boolean;\n className?: string;\n}\n\n/**\n * **All feedback** — the reports every user the app lets in may read (round 0.38,\n * docs/feedback-harmonization.md §9.3, §9.9; keksdose's `/all-feedback`).\n *\n * - **Titles only** (decision 23): #, Date, Category, Subject (with the visible\n * comments), Votes, Status. No body, no submitter, no file — the list item carries\n * none of them (§9.10).\n * - **The server sorts**: the toggle **Newest / Most wanted / Recently updated** sets\n * `sort`, and the columns themselves do not sort (a page of 50 sorted in the browser\n * would not be the 50 the sort asks for).\n * - **The search box only with `onSearchChange`**: an app whose titles are sealed\n * passes none (§9.9).\n * - **Votes** are `FeedbackVoteButton`s, optimistic, the viewer's own report pressed\n * and locked (\"Your report\", §9.6).\n * - A row opens in place with `renderDetail` — on the phone, in a full-screen dialog.\n * The phone cards carry the title, the status, the category, the date and the two\n * counts; the vote itself is in the opened report (a button inside the card, which is\n * the row's own button, would be two controls in one).\n *\n * No client paging: the server's `limit` is the page, and `total` says how many there\n * are. For more than one page, `page` / `hasMore` / `onPageChange` draw a previous /\n * next strip that needs no total (0.38.1); `openRow` shows a `?row=` report from\n * another page. Needs a router, as every `DataTable` does.\n */\nexport function FeedbackPublicList<T extends FeedbackPublicListItem = FeedbackPublicListItem>({\n rows,\n total,\n sort,\n onSortChange,\n search = \"\",\n onSearchChange,\n renderDetail,\n onVote,\n loading = false,\n openId: openIdProp,\n onOpenIdChange,\n onOpenChange,\n openRow,\n page: pageIndex = 0,\n hasMore = false,\n onPageChange,\n commit,\n renderDate: renderDateProp,\n labels: labelsProp,\n pageLabels: pageLabelsProp,\n fillHeight,\n className,\n}: FeedbackPublicListProps<T>) {\n const labels = useFeedbackPublicLabels(labelsProp);\n const page = useFeedbackPageLabels(pageLabelsProp);\n const categoryLabels = useFeedbackCategoryLabels();\n const renderDate = useFeedbackRenderDate(renderDateProp);\n const [ownOpenId, setOwnOpenId] = useState<number | null>(null);\n const openId = openIdProp !== undefined ? openIdProp : ownOpenId;\n const setOpen = (id: number | null) => {\n if (openIdProp === undefined) setOwnOpenId(id);\n (onOpenIdChange ?? onOpenChange)?.(id);\n };\n // A `?row=` report from another page: first, while it is the open one, and only when\n // the page does not have it itself.\n // `as T[]`: DataTable's `rows` is still mutable in its type (API-7), and never mutated.\n const shownRows = (\n openRow && openId === openRow.id && !rows.some((row) => row.id === openRow.id) ? [openRow, ...rows] : rows\n ) as T[];\n\n const columns = useMemo<DataTableColumn<T>[]>(\n () => [\n {\n key: \"id\",\n header: page.columnId,\n cell: (row) => <span className=\"font-mono text-xs text-muted\">{row.id}</span>,\n mobileHidden: true,\n },\n {\n key: \"date\",\n header: page.columnDate,\n cell: (row) => <PublicDate value={row.created_at} renderDate={renderDate} />,\n },\n {\n key: \"category\",\n header: page.columnCategory,\n cell: (row) => <FeedbackCategoryBadge category={row.category} label={categoryLabels[row.category]} />,\n },\n {\n key: \"title\",\n header: page.columnSubject,\n cell: (row) => (\n <span className=\"inline-flex min-w-0 max-w-full items-center gap-2 large:items-start\">\n <span className=\"min-w-0 truncate-until-large font-medium\">{row.title}</span>\n <CommentCount count={row.comment_count} labels={labels} />\n </span>\n ),\n mobilePrimary: true,\n },\n {\n key: \"votes\",\n header: labels.columnVotes,\n className: \"whitespace-nowrap\",\n // The cell is a button: the row's own link must never wrap it.\n noRowLink: true,\n cell: (row) => (\n <FeedbackVoteButton\n votes={row.votes}\n voted={row.voted}\n own={row.mine}\n onVote={(next) => onVote(row, next)}\n commit={commit}\n size=\"sm\"\n />\n ),\n },\n {\n key: \"status\",\n header: page.columnStatus,\n className: \"whitespace-nowrap\",\n cell: (row) => <FeedbackStatusBadge status={row.status} />,\n },\n ],\n [page, labels, categoryLabels, renderDate, onVote, commit],\n );\n\n return (\n <div\n className={cn(\"flex flex-col gap-3\", fillHeight && FILL_HEIGHT_CLASS, className)}\n data-feedback-public-list=\"\"\n aria-busy={loading || undefined}\n >\n <div className=\"flex flex-wrap items-center gap-2\">\n <ToggleGroup\n aria-label={labels.sort}\n value={sort}\n onChange={(value) => onSortChange(value)}\n options={SORTS.map((value) => ({\n value,\n label: value === \"newest\" ? labels.sortNewest : value === \"votes\" ? labels.sortVotes : labels.sortUpdated,\n }))}\n />\n {onSearchChange && (\n <SearchField\n aria-label={labels.search}\n placeholder={labels.search}\n value={search}\n onChange={onSearchChange}\n className=\"min-w-[12rem] flex-1 md:max-w-xs\"\n />\n )}\n {total !== undefined && (\n <span className=\"ms-auto text-sm text-muted\" data-feedback-public-total={total}>\n {labels.total(total)}\n </span>\n )}\n </div>\n <DataTable\n rows={shownRows}\n columns={columns}\n rowKey={(row) => row.id}\n rowName={(row) => row.title}\n onRowClick={(row) => setOpen(openId === row.id ? null : row.id)}\n isExpanded={(row) => row.id === openId}\n expandedRow={(row) => renderDetail(row)}\n mobileExpandAsDialog\n paginated={false}\n fillHeight={fillHeight}\n empty={loading ? labels.loading : labels.empty}\n mobileCard={(row) => (\n <div className=\"min-w-0 space-y-1\">\n <div className=\"flex items-start justify-between gap-2\">\n <span className=\"min-w-0 flex-1 font-medium [overflow-wrap:anywhere]\">{row.title}</span>\n <FeedbackStatusBadge status={row.status} className=\"shrink-0\" />\n </div>\n <div className=\"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted\">\n <FeedbackCategoryBadge category={row.category} compact label={categoryLabels[row.category]} />\n <PublicDate value={row.created_at} renderDate={renderDate} />\n <CommentCount count={row.comment_count} labels={labels} />\n {/* A count, not the button: the whole card is the row's button, and a button\n inside it is two controls in one. The vote is in the opened report. */}\n <VoteCount count={row.votes} voted={row.voted || row.mine} labels={labels} />\n </div>\n </div>\n )}\n />\n {onPageChange && (pageIndex > 0 || hasMore) && (\n <PublicPager page={pageIndex} hasMore={hasMore} onPageChange={onPageChange} labels={labels} />\n )}\n </div>\n );\n}\n\n/* ── The detail ───────────────────────────────────────────────────────────── */\n\nexport interface FeedbackPublicDetailProps {\n /** `GET /feedback/public/{id}`: the public body (attachment URLs already stripped by\n * the server, §9.4) and the replies. */\n row: FeedbackPublicRecord;\n /** `GET /feedback/{id}/comments`, oldest first; `undefined` while it loads. */\n comments: readonly FeedbackComment[] | undefined;\n /** `PUT` / `DELETE /feedback/{id}/vote`; resolve with the answer, reject to roll back. */\n onVote: (next: boolean) => Promise<FeedbackVoteState>;\n /** The viewer is the app's admin: Hide / Unhide on the comments. */\n isAdmin?: boolean;\n /** `POST /feedback/{id}/comments`. Left out — a demo, a reader who may not write — no\n * composer. 0.47 (§12): `attachmentUrl` is the one file uploaded with it (with\n * `onUpload`). */\n onComment?: (body: string, attachmentUrl?: string) => void | Promise<unknown>;\n /** 0.47 (§12): `POST /feedback/attachments` — the comment box then takes one file,\n * pasted, captured or picked, as the rework note does. Left out, text only. */\n onUpload?: FeedbackEntryUploadOptions[\"onUpload\"];\n /** 0.47: the comment box's \"Capture screenshot\". */\n onCaptureScreenshot?: FeedbackEntryUploadOptions[\"onCaptureScreenshot\"];\n /** 0.47: the comment box's file field, over the contract's defaults. */\n attachment?: FeedbackEntryUploadOptions[\"attachment\"];\n /** 0.47: the app's authenticated GET for the comments' pictures, drawn inline. */\n fetcher?: AuthedFetcher | null;\n /** The admin's hide (`PATCH …/comments/{id} {hidden}`). */\n onHide?: (comment: FeedbackComment, hidden: boolean) => void | Promise<unknown>;\n /** The writer's delete (`DELETE …/comments/{id}`), after a confirm. */\n onDelete?: (comment: FeedbackComment) => void | Promise<unknown>;\n /** A comment is being sent. */\n pending?: boolean;\n /** The vote and the thread's buttons COMMIT — see Button's `commit`. */\n commit?: CommitScope;\n /** Voting is off for this viewer (a demo): `true`, or the reason. */\n voteDisabled?: boolean | string;\n /** See {@link FeedbackRenderDate}. */\n renderDate?: FeedbackRenderDate;\n /** \"Now\" for the thread's relative times — pin it in tests and stories. */\n now?: Date | number;\n /** Over the `feedbackPublic` namespace. */\n labels?: LabelOverride<FeedbackPublicLabels>;\n /** Over the `feedbackComments` namespace, for the thread. */\n commentLabels?: LabelOverride<FeedbackCommentsLabels>;\n className?: string;\n}\n\n/**\n * One public report opened (round 0.38, docs/feedback-harmonization.md §9.3, §9.10): who\n * filed it — the first name the server sent, else **\"A user\"** (§9.5) — and when; the\n * **vote**; the **public body**; and the **conversation**, the admin's replies and other\n * people's comments merged oldest first (§9.8, `FeedbackCommentThread`), with the box to\n * add one.\n *\n * What it never draws, because the public record never carries it (§9.10): an address,\n * a last name, the report's screenshot or files, the page the report was filed on. The\n * body is the server's `public_body` — the client strips nothing and adds nothing. The\n * one file it shows (0.47, §12) is a comment's own, posted with it to be seen.\n */\nexport function FeedbackPublicDetail({\n row,\n comments,\n onVote,\n isAdmin = false,\n onComment,\n onHide,\n onDelete,\n onUpload,\n onCaptureScreenshot,\n attachment,\n fetcher,\n pending,\n commit,\n voteDisabled,\n renderDate: renderDateProp,\n now,\n labels: labelsProp,\n commentLabels,\n className,\n}: FeedbackPublicDetailProps) {\n const labels = useFeedbackPublicLabels(labelsProp);\n const renderDate = useFeedbackRenderDate(renderDateProp);\n return (\n <FeedbackDetail className={className}>\n <div className=\"flex flex-wrap items-center gap-x-3 gap-y-2\" data-feedback-public-detail={row.id}>\n <span className=\"text-sm text-secondary\" data-feedback-author=\"\">\n {labels.filedBy(row.author_name ?? labels.anonymous)}\n </span>\n <PublicDate value={row.created_at} renderDate={renderDate} />\n <FeedbackVoteButton\n votes={row.votes}\n voted={row.voted}\n own={row.mine}\n onVote={onVote}\n disabled={voteDisabled}\n commit={commit}\n className=\"ms-auto\"\n />\n </div>\n <FeedbackDetailSection title={labels.body}>\n {/* Rework rounds stay in it — the author's own words (§9.4) — on a server before\n server-kit 0.13; since then each is an entry in the conversation (§10.3). */}\n <FeedbackProse>{row.body}</FeedbackProse>\n </FeedbackDetailSection>\n <FeedbackDetailSection title={labels.conversation}>\n <FeedbackCommentThread\n replies={row.replies}\n comments={comments ?? []}\n loading={comments === undefined}\n isAdmin={isAdmin}\n // 0.40 (§10.3): the author's rework entries are theirs — at the reading end.\n isAuthor={row.mine}\n onComment={onComment}\n onHide={onHide}\n onDelete={onDelete}\n onUpload={onUpload}\n onCaptureScreenshot={onCaptureScreenshot}\n attachment={attachment}\n fetcher={fetcher}\n pending={pending}\n commit={commit}\n now={now}\n labels={commentLabels}\n />\n </FeedbackDetailSection>\n </FeedbackDetail>\n );\n}\n"],"mappings":";AAqDqB,cAajB,YAbiB;AArDrB,SAAS,SAAS,gBAAgB;AAElC,SAAS,aAAa,cAAc,eAAe,gBAAgB;AACnE,SAAS,iBAAuC;AAChD,SAAS,iCAAiC;AAC1C,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAG5B,SAAS,oBAAwC;AACjD,SAAS,UAAU;AACnB,SAAS,yBAAyB;AAClC,SAAS,6BAA6B;AACtC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAC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IAC3D,iBAAO,QAAQ,IAAI,eAAe,OAAO,SAAS,GACrD;AAAA,MACA,oBAAC,cAAW,OAAO,IAAI,YAAY,YAAwB;AAAA,MAC3D;AAAA,QAAC;AAAA;AAAA,UACC,OAAO,IAAI;AAAA,UACX,OAAO,IAAI;AAAA,UACX,KAAK,IAAI;AAAA,UACT;AAAA,UACA,UAAU;AAAA,UACV;AAAA,UACA,WAAU;AAAA;AAAA,MACZ;AAAA,OACF;AAAA,IACA,oBAAC,yBAAsB,OAAO,OAAO,MAGnC,8BAAC,iBAAe,cAAI,MAAK,GAC3B;AAAA,IACA,oBAAC,yBAAsB,OAAO,OAAO,cACnC;AAAA,MAAC;AAAA;AAAA,QACC,SAAS,IAAI;AAAA,QACb,UAAU,YAAY,CAAC;AAAA,QACvB,SAAS,aAAa;AAAA,QACtB;AAAA,QAEA,UAAU,IAAI;AAAA,QACd;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,QAAQ;AAAA;AAAA,IACV,GACF;AAAA,KACF;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/feedback/feedback-public-list.tsx"],"sourcesContent":["import { useMemo, useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { ChevronLeft, ChevronRight, MessageSquare, ThumbsUp } from \"lucide-react\";\nimport { DataTable, type DataTableColumn } from \"../components/data-table\";\nimport { DEFAULT_DATA_TABLE_LABELS } from \"../components/data-table-labels\";\nimport { IconButton } from \"../components/icon-button\";\nimport { SearchField } from \"../components/search-field\";\nimport { ToggleGroup } from \"../components/toggle-group\";\nimport type { CommitScope } from \"../components/write-lock\";\nimport type { AuthedFetcher } from \"../hooks/use-authed-src\";\nimport { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { FILL_HEIGHT_CLASS } from \"../shell/fill-height\";\nimport { EMPTY_FORMATTED_VALUE } from \"../lib/format\";\nimport {\n FeedbackCategoryBadge,\n FeedbackDetail,\n FeedbackDetailSection,\n FeedbackProse,\n FeedbackStatusBadge,\n} from \"./feedback-inbox\";\nimport { useFeedbackCategoryLabels } from \"./feedback-labels\";\nimport { FeedbackCommentThread, type FeedbackCommentsLabels } from \"./feedback-comment-thread\";\nimport type { FeedbackEntryUploadOptions } from \"./feedback-entry-file\";\nimport { DEFAULT_FEEDBACK_PUBLIC_LABELS, type FeedbackPublicLabels } from \"./feedback-public-labels\";\nimport type {\n FeedbackComment,\n FeedbackPublicListItem,\n FeedbackPublicRecord,\n FeedbackPublicSort,\n FeedbackVoteState,\n} from \"./feedback-public-types\";\nimport {\n useFeedbackPageLabels,\n useFeedbackRenderDate,\n type FeedbackPageLabels,\n type FeedbackRenderDate,\n} from \"./feedback-table\";\nimport { FeedbackVoteButton } from \"./feedback-vote-button\";\n\nexport { DEFAULT_FEEDBACK_PUBLIC_LABELS };\nexport type { FeedbackPublicLabels };\n\n/** `feedbackPublic` resolved: English, then `<UiKitProvider labels>`, then `labels`. */\nexport function useFeedbackPublicLabels(labels?: LabelOverride<FeedbackPublicLabels>): FeedbackPublicLabels {\n return useKitLabels(\"feedbackPublic\", DEFAULT_FEEDBACK_PUBLIC_LABELS, labels);\n}\n\n/** The sort toggle's order: the server's default first (§9.6). */\nconst SORTS: readonly FeedbackPublicSort[] = [\"newest\", \"votes\", \"updated\"];\n\n/** A date in a cell, as the inbox writes it: `<time>`, nowrap, tabular figures. */\nfunction PublicDate({ value, renderDate }: { value: string | null | undefined; renderDate: FeedbackRenderDate }) {\n if (!value) return <span className=\"text-placeholder\">{EMPTY_FORMATTED_VALUE}</span>;\n return (\n <time dateTime={value} className=\"whitespace-nowrap tabular-nums text-muted\">\n {renderDate(value)}\n </time>\n );\n}\n\n/** The visible comments as a small chip beside the title — the count in figures, the\n * words for a screen reader. Nothing at 0. */\nfunction CommentCount({ count, labels }: { count: number; labels: FeedbackPublicLabels }) {\n if (!count) return null;\n return (\n <span className=\"inline-flex shrink-0 items-center gap-1 text-xs text-muted\" data-feedback-comment-count={count}>\n <MessageSquare className=\"size-3.5\" aria-hidden />\n <span aria-hidden className=\"tabular-nums\">\n {count}\n </span>\n <span className=\"sr-only\">{labels.comments(count)}</span>\n </span>\n );\n}\n\n/** The votes on a phone card: the thumb and the count, in the brand colour when the\n * viewer's own. */\nfunction VoteCount({ count, voted, labels }: { count: number; voted: boolean; labels: FeedbackPublicLabels }) {\n return (\n <span\n className={cn(\"ms-auto inline-flex shrink-0 items-center gap-1 text-xs\", voted ? \"text-brand\" : \"text-muted\")}\n data-feedback-vote-count={count}\n >\n <ThumbsUp className=\"size-3.5\" aria-hidden />\n <span aria-hidden className=\"tabular-nums\">\n {count}\n </span>\n <span className=\"sr-only\">{labels.votes(count)}</span>\n </span>\n );\n}\n\n/** 0.38.1: previous / next over the server's pages when it answers no total\n * (`GET /feedback/public` — Kurvenschmiede): \"Page 3\" between two arrows. The arrows'\n * names are `dataTable`'s, the strip's; the page's is `feedbackPublic.page`. */\nfunction PublicPager({\n page,\n hasMore,\n onPageChange,\n labels,\n}: {\n page: number;\n hasMore: boolean;\n onPageChange: (page: number) => void;\n labels: FeedbackPublicLabels;\n}) {\n const tableLabels = useKitLabels(\"dataTable\", DEFAULT_DATA_TABLE_LABELS);\n const name = labels.page(page + 1);\n return (\n <div\n role=\"group\"\n aria-label={name}\n className=\"flex items-center justify-end gap-2 text-sm text-secondary\"\n data-feedback-public-pager={page}\n >\n <IconButton\n size=\"sm\"\n variant=\"secondary\"\n label={tableLabels.prevPage}\n disabled={page <= 0}\n onClick={() => onPageChange(page - 1)}\n >\n {/* \"Previous\" points back along the line — left in LTR, right in RTL. */}\n <ChevronLeft className=\"rtl:-scale-x-100\" />\n </IconButton>\n <span className=\"tabular-nums\" aria-hidden>\n {name}\n </span>\n <IconButton\n size=\"sm\"\n variant=\"secondary\"\n label={tableLabels.nextPage}\n disabled={!hasMore}\n onClick={() => onPageChange(page + 1)}\n >\n <ChevronRight className=\"rtl:-scale-x-100\" />\n </IconButton>\n </div>\n );\n}\n\n/* ── The list ─────────────────────────────────────────────────────────────── */\n\nexport interface FeedbackPublicListProps<T extends FeedbackPublicListItem = FeedbackPublicListItem> {\n /** `GET /feedback/public?sort=&q=` — the server's page, in the server's order.\n * `readonly` since 0.52 (refactor audit 2026-10-30, API-7): the list never changes it. */\n rows: readonly T[];\n /** How many the query has in all — the line beside the sort. Left out, no line. */\n total?: number;\n /** The server sorts (§9.6): the toggle only says which way. */\n sort: FeedbackPublicSort;\n onSortChange: (sort: FeedbackPublicSort) => void;\n /** The search box's text (`q`, titles only). */\n search?: string;\n /**\n * The search box is drawn ONLY with this handler: where the app's titles are sealed\n * (Kurvenschmiede, `FeedbackDeps.public_search=False`, §9.9) there is nothing to search\n * on and the server answers `q` with a 422 — so it passes none.\n */\n onSearchChange?: (search: string) => void;\n /** The opened row: the app's {@link FeedbackPublicDetail} with the row's\n * `GET /feedback/public/{id}` and its comments. */\n renderDetail: (row: T) => ReactNode;\n /** `PUT` / `DELETE /feedback/{id}/vote` for a row's button (`next`: the new state);\n * resolve with the answer, reject to roll back. */\n onVote: (row: T, next: boolean) => Promise<FeedbackVoteState>;\n /** The page is loading: the table says so where its rows would be. */\n loading?: boolean;\n /** The opened row's id, when the app keeps it (a `?row=` param). Left out, the list\n * keeps it itself. */\n openId?: number | null;\n /** 0.52: a row was opened (its id) or closed (`null`) — `openId`'s pair. Named for\n * what it carries: every other `onOpenChange` in the kit is a boolean (refactor audit\n * 2026-10-30, API-5). */\n onOpenIdChange?: (id: number | null) => void;\n /**\n * 0.38.1: the opened report when it is NOT on this page — a `?row=` link to an older\n * one (Kurvenschmiede). The app fetches it (`GET /feedback/public/{id}`, a list item's\n * fields and more) and passes it with `openId`; while `openId` is its id it is drawn\n * first, above the page's rows, and opened with `renderDetail` (on the phone, in the\n * full-screen dialog). Closed, it is gone. A row the page has already is never drawn\n * twice: the page's own is opened instead.\n */\n openRow?: T | null;\n /**\n * 0.38.1: the server's page, from 0 — for a pager where `/feedback/public` answers no\n * total (Kurvenschmiede). With {@link onPageChange} a **Previous / Page n / Next**\n * strip stands under the table; Next is off without {@link hasMore}. Left out, no\n * pager: the server's `limit` is all there is.\n */\n page?: number;\n /** 0.38.1: there is a page after this one (e.g. the page came back full). */\n hasMore?: boolean;\n /** 0.38.1: go to another page (`page ± 1`); the app fetches it. Draws the pager. */\n onPageChange?: (page: number) => void;\n /** A vote COMMITS — see Button's `commit`. */\n commit?: CommitScope;\n /** See {@link FeedbackRenderDate}. Default: the kit's, with the weekday. */\n renderDate?: FeedbackRenderDate;\n /** Over the `feedbackPublic` namespace. The shared column names (#, Date, Category,\n * Subject, Status) are `feedbackPage`'s: pass `pageLabels` for those. */\n labels?: LabelOverride<FeedbackPublicLabels>;\n pageLabels?: LabelOverride<FeedbackPageLabels>;\n /** 0.40.1: the list fills the window as DataTable's `fillHeight` (page layout §1) — the\n * public feedback page passes §1.2's rule. Below md the page scrolls, as everywhere. */\n fillHeight?: boolean;\n className?: string;\n}\n\n/**\n * **All feedback** — the reports every user the app lets in may read (round 0.38,\n * docs/feedback-harmonization.md §9.3, §9.9; keksdose's `/all-feedback`).\n *\n * - **Titles only** (decision 23): #, Date, Category, Subject (with the visible\n * comments), Votes, Status. No body, no submitter, no file — the list item carries\n * none of them (§9.10).\n * - **The server sorts**: the toggle **Newest / Most wanted / Recently updated** sets\n * `sort`, and the columns themselves do not sort (a page of 50 sorted in the browser\n * would not be the 50 the sort asks for).\n * - **The search box only with `onSearchChange`**: an app whose titles are sealed\n * passes none (§9.9).\n * - **Votes** are `FeedbackVoteButton`s, optimistic, the viewer's own report pressed\n * and locked (\"Your report\", §9.6).\n * - A row opens in place with `renderDetail` — on the phone, in a full-screen dialog.\n * The phone cards carry the title, the status, the category, the date and the two\n * counts; the vote itself is in the opened report (a button inside the card, which is\n * the row's own button, would be two controls in one).\n *\n * No client paging: the server's `limit` is the page, and `total` says how many there\n * are. For more than one page, `page` / `hasMore` / `onPageChange` draw a previous /\n * next strip that needs no total (0.38.1); `openRow` shows a `?row=` report from\n * another page. Needs a router, as every `DataTable` does.\n */\nexport function FeedbackPublicList<T extends FeedbackPublicListItem = FeedbackPublicListItem>({\n rows,\n total,\n sort,\n onSortChange,\n search = \"\",\n onSearchChange,\n renderDetail,\n onVote,\n loading = false,\n openId: openIdProp,\n onOpenIdChange,\n openRow,\n page: pageIndex = 0,\n hasMore = false,\n onPageChange,\n commit,\n renderDate: renderDateProp,\n labels: labelsProp,\n pageLabels: pageLabelsProp,\n fillHeight,\n className,\n}: FeedbackPublicListProps<T>) {\n const labels = useFeedbackPublicLabels(labelsProp);\n const page = useFeedbackPageLabels(pageLabelsProp);\n const categoryLabels = useFeedbackCategoryLabels();\n const renderDate = useFeedbackRenderDate(renderDateProp);\n const [ownOpenId, setOwnOpenId] = useState<number | null>(null);\n const openId = openIdProp !== undefined ? openIdProp : ownOpenId;\n const setOpen = (id: number | null) => {\n if (openIdProp === undefined) setOwnOpenId(id);\n onOpenIdChange?.(id);\n };\n // A `?row=` report from another page: first, while it is the open one, and only when\n // the page does not have it itself.\n // `as T[]`: DataTable's `rows` is still mutable in its type (API-7), and never mutated.\n const shownRows = (\n openRow && openId === openRow.id && !rows.some((row) => row.id === openRow.id) ? [openRow, ...rows] : rows\n ) as T[];\n\n const columns = useMemo<DataTableColumn<T>[]>(\n () => [\n {\n key: \"id\",\n header: page.columnId,\n cell: (row) => <span className=\"font-mono text-xs text-muted\">{row.id}</span>,\n mobileHidden: true,\n },\n {\n key: \"date\",\n header: page.columnDate,\n cell: (row) => <PublicDate value={row.created_at} renderDate={renderDate} />,\n },\n {\n key: \"category\",\n header: page.columnCategory,\n cell: (row) => <FeedbackCategoryBadge category={row.category} label={categoryLabels[row.category]} />,\n },\n {\n key: \"title\",\n header: page.columnSubject,\n cell: (row) => (\n <span className=\"inline-flex min-w-0 max-w-full items-center gap-2 large:items-start\">\n <span className=\"min-w-0 truncate-until-large font-medium\">{row.title}</span>\n <CommentCount count={row.comment_count} labels={labels} />\n </span>\n ),\n mobilePrimary: true,\n },\n {\n key: \"votes\",\n header: labels.columnVotes,\n className: \"whitespace-nowrap\",\n // The cell is a button: the row's own link must never wrap it.\n noRowLink: true,\n cell: (row) => (\n <FeedbackVoteButton\n votes={row.votes}\n voted={row.voted}\n own={row.mine}\n onVote={(next) => onVote(row, next)}\n commit={commit}\n size=\"sm\"\n />\n ),\n },\n {\n key: \"status\",\n header: page.columnStatus,\n className: \"whitespace-nowrap\",\n cell: (row) => <FeedbackStatusBadge status={row.status} />,\n },\n ],\n [page, labels, categoryLabels, renderDate, onVote, commit],\n );\n\n return (\n <div\n className={cn(\"flex flex-col gap-3\", fillHeight && FILL_HEIGHT_CLASS, className)}\n data-feedback-public-list=\"\"\n aria-busy={loading || undefined}\n >\n <div className=\"flex flex-wrap items-center gap-2\">\n <ToggleGroup\n aria-label={labels.sort}\n value={sort}\n onChange={(value) => onSortChange(value)}\n options={SORTS.map((value) => ({\n value,\n label: value === \"newest\" ? labels.sortNewest : value === \"votes\" ? labels.sortVotes : labels.sortUpdated,\n }))}\n />\n {onSearchChange && (\n <SearchField\n aria-label={labels.search}\n placeholder={labels.search}\n value={search}\n onChange={onSearchChange}\n className=\"min-w-[12rem] flex-1 md:max-w-xs\"\n />\n )}\n {total !== undefined && (\n <span className=\"ms-auto text-sm text-muted\" data-feedback-public-total={total}>\n {labels.total(total)}\n </span>\n )}\n </div>\n <DataTable\n rows={shownRows}\n columns={columns}\n rowKey={(row) => row.id}\n rowName={(row) => row.title}\n onRowClick={(row) => setOpen(openId === row.id ? null : row.id)}\n isExpanded={(row) => row.id === openId}\n expandedRow={(row) => renderDetail(row)}\n mobileExpandAsDialog\n paginated={false}\n fillHeight={fillHeight}\n empty={loading ? labels.loading : labels.empty}\n mobileCard={(row) => (\n <div className=\"min-w-0 space-y-1\">\n <div className=\"flex items-start justify-between gap-2\">\n <span className=\"min-w-0 flex-1 font-medium [overflow-wrap:anywhere]\">{row.title}</span>\n <FeedbackStatusBadge status={row.status} className=\"shrink-0\" />\n </div>\n <div className=\"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted\">\n <FeedbackCategoryBadge category={row.category} compact label={categoryLabels[row.category]} />\n <PublicDate value={row.created_at} renderDate={renderDate} />\n <CommentCount count={row.comment_count} labels={labels} />\n {/* A count, not the button: the whole card is the row's button, and a button\n inside it is two controls in one. The vote is in the opened report. */}\n <VoteCount count={row.votes} voted={row.voted || row.mine} labels={labels} />\n </div>\n </div>\n )}\n />\n {onPageChange && (pageIndex > 0 || hasMore) && (\n <PublicPager page={pageIndex} hasMore={hasMore} onPageChange={onPageChange} labels={labels} />\n )}\n </div>\n );\n}\n\n/* ── The detail ───────────────────────────────────────────────────────────── */\n\nexport interface FeedbackPublicDetailProps {\n /** `GET /feedback/public/{id}`: the public body (attachment URLs already stripped by\n * the server, §9.4) and the replies. */\n row: FeedbackPublicRecord;\n /** `GET /feedback/{id}/comments`, oldest first; `undefined` while it loads. */\n comments: readonly FeedbackComment[] | undefined;\n /** `PUT` / `DELETE /feedback/{id}/vote`; resolve with the answer, reject to roll back. */\n onVote: (next: boolean) => Promise<FeedbackVoteState>;\n /** The viewer is the app's admin: Hide / Unhide on the comments. */\n isAdmin?: boolean;\n /** `POST /feedback/{id}/comments`. Left out — a demo, a reader who may not write — no\n * composer. 0.47 (§12): `attachmentUrl` is the one file uploaded with it (with\n * `onUpload`). */\n onComment?: (body: string, attachmentUrl?: string) => void | Promise<unknown>;\n /** 0.47 (§12): `POST /feedback/attachments` — the comment box then takes one file,\n * pasted, captured or picked, as the rework note does. Left out, text only. */\n onUpload?: FeedbackEntryUploadOptions[\"onUpload\"];\n /** 0.47: the comment box's \"Capture screenshot\". */\n onCaptureScreenshot?: FeedbackEntryUploadOptions[\"onCaptureScreenshot\"];\n /** 0.47: the comment box's file field, over the contract's defaults. */\n attachment?: FeedbackEntryUploadOptions[\"attachment\"];\n /** 0.47: the app's authenticated GET for the comments' pictures, drawn inline. */\n fetcher?: AuthedFetcher | null;\n /** The admin's hide (`PATCH …/comments/{id} {hidden}`). */\n onHide?: (comment: FeedbackComment, hidden: boolean) => void | Promise<unknown>;\n /** The writer's delete (`DELETE …/comments/{id}`), after a confirm. */\n onDelete?: (comment: FeedbackComment) => void | Promise<unknown>;\n /** A comment is being sent. */\n pending?: boolean;\n /** The vote and the thread's buttons COMMIT — see Button's `commit`. */\n commit?: CommitScope;\n /** Voting is off for this viewer (a demo): `true`, or the reason. */\n voteDisabled?: boolean | string;\n /** See {@link FeedbackRenderDate}. */\n renderDate?: FeedbackRenderDate;\n /** \"Now\" for the thread's relative times — pin it in tests and stories. */\n now?: Date | number;\n /** Over the `feedbackPublic` namespace. */\n labels?: LabelOverride<FeedbackPublicLabels>;\n /** Over the `feedbackComments` namespace, for the thread. */\n commentLabels?: LabelOverride<FeedbackCommentsLabels>;\n className?: string;\n}\n\n/**\n * One public report opened (round 0.38, docs/feedback-harmonization.md §9.3, §9.10): who\n * filed it — the first name the server sent, else **\"A user\"** (§9.5) — and when; the\n * **vote**; the **public body**; and the **conversation**, the admin's replies and other\n * people's comments merged oldest first (§9.8, `FeedbackCommentThread`), with the box to\n * add one.\n *\n * What it never draws, because the public record never carries it (§9.10): an address,\n * a last name, the report's screenshot or files, the page the report was filed on. The\n * body is the server's `public_body` — the client strips nothing and adds nothing. The\n * one file it shows (0.47, §12) is a comment's own, posted with it to be seen.\n */\nexport function FeedbackPublicDetail({\n row,\n comments,\n onVote,\n isAdmin = false,\n onComment,\n onHide,\n onDelete,\n onUpload,\n onCaptureScreenshot,\n attachment,\n fetcher,\n pending,\n commit,\n voteDisabled,\n renderDate: renderDateProp,\n now,\n labels: labelsProp,\n commentLabels,\n className,\n}: FeedbackPublicDetailProps) {\n const labels = useFeedbackPublicLabels(labelsProp);\n const renderDate = useFeedbackRenderDate(renderDateProp);\n return (\n <FeedbackDetail className={className}>\n <div className=\"flex flex-wrap items-center gap-x-3 gap-y-2\" data-feedback-public-detail={row.id}>\n <span className=\"text-sm text-secondary\" data-feedback-author=\"\">\n {labels.filedBy(row.author_name ?? labels.anonymous)}\n </span>\n <PublicDate value={row.created_at} renderDate={renderDate} />\n <FeedbackVoteButton\n votes={row.votes}\n voted={row.voted}\n own={row.mine}\n onVote={onVote}\n disabled={voteDisabled}\n commit={commit}\n className=\"ms-auto\"\n />\n </div>\n <FeedbackDetailSection title={labels.body}>\n {/* Rework rounds stay in it — the author's own words (§9.4) — on a server before\n server-kit 0.13; since then each is an entry in the conversation (§10.3). */}\n <FeedbackProse>{row.body}</FeedbackProse>\n </FeedbackDetailSection>\n <FeedbackDetailSection title={labels.conversation}>\n <FeedbackCommentThread\n replies={row.replies}\n comments={comments ?? []}\n loading={comments === undefined}\n isAdmin={isAdmin}\n // 0.40 (§10.3): the author's rework entries are theirs — at the reading end.\n isAuthor={row.mine}\n onComment={onComment}\n onHide={onHide}\n onDelete={onDelete}\n onUpload={onUpload}\n onCaptureScreenshot={onCaptureScreenshot}\n attachment={attachment}\n fetcher={fetcher}\n pending={pending}\n commit={commit}\n now={now}\n labels={commentLabels}\n />\n </FeedbackDetailSection>\n </FeedbackDetail>\n );\n}\n"],"mappings":";AAqDqB,cAajB,YAbiB;AArDrB,SAAS,SAAS,gBAAgB;AAElC,SAAS,aAAa,cAAc,eAAe,gBAAgB;AACnE,SAAS,iBAAuC;AAChD,SAAS,iCAAiC;AAC1C,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAG5B,SAAS,oBAAwC;AACjD,SAAS,UAAU;AACnB,SAAS,yBAAyB;AAClC,SAAS,6BAA6B;AACtC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iCAAiC;AAC1C,SAAS,6BAA0D;AAEnE,SAAS,sCAAiE;AAQ1E;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP,SAAS,0BAA0B;AAM5B,S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,UACX,OAAO,IAAI;AAAA,UACX,KAAK,IAAI;AAAA,UACT;AAAA,UACA,UAAU;AAAA,UACV;AAAA,UACA,WAAU;AAAA;AAAA,MACZ;AAAA,OACF;AAAA,IACA,oBAAC,yBAAsB,OAAO,OAAO,MAGnC,8BAAC,iBAAe,cAAI,MAAK,GAC3B;AAAA,IACA,oBAAC,yBAAsB,OAAO,OAAO,cACnC;AAAA,MAAC;AAAA;AAAA,QACC,SAAS,IAAI;AAAA,QACb,UAAU,YAAY,CAAC;AAAA,QACvB,SAAS,aAAa;AAAA,QACtB;AAAA,QAEA,UAAU,IAAI;AAAA,QACd;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,QAAQ;AAAA;AAAA,IACV,GACF;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -53,6 +53,11 @@ export interface FeedbackContext {
|
|
|
53
53
|
ua?: string;
|
|
54
54
|
/** The app build (`__APP_VERSION__`). */
|
|
55
55
|
version?: string;
|
|
56
|
+
/** What the app attached about the thing reported (keksdose's stuck receipt scan, live
|
|
57
|
+
* #481): a flat record of short values, in the order the app wrote them. The row
|
|
58
|
+
* detail shows it to the admin and the author, never to anyone else; erasure drops it
|
|
59
|
+
* (it is not on server-kit's `FEEDBACK_CONTEXT_KEEP`). */
|
|
60
|
+
diagnostics?: Readonly<Record<string, unknown>>;
|
|
56
61
|
fingerprint?: string;
|
|
57
62
|
/** Which error boundary caught it. */
|
|
58
63
|
boundary?: "app" | "page" | (string & {});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/feedback/feedback-record.ts"],"sourcesContent":["import { FEEDBACK_CATEGORY_ORDER } from \"./feedback-vocabulary\";\nimport type { FeedbackCategory, FeedbackStatus } from \"./feedback-vocabulary\";\nimport type { FeedbackReply } from \"./feedback-public-types\";\n\n/**\n * One feedback report as the three apps send it, and the facts the kit reads off it.\n *\n * Until 0.27 the inbox parts took no report at all (\"no `Feedback` type in this file\",\n * feedback-inbox.tsx): keksdose kept its reporter context in a JSON column, kastlan a\n * thinner copy of it, Kurvenschmiede a `page_path` and the bytes in the row. Marcel's\n * feedback round (2026-10-04, docs/feedback-harmonization.md) settled one API contract\n * for all three — keksdose's, read off its code — so the apps now share one shape and the\n * kit can take a row instead of a dozen loose values. This file is that shape (§3.1,\n * §3.2), the contract's constants (§3.4, §3.5, §4.3) and the readers and writers of the\n * one field whose format is itself contract: the body, which carries the rework rounds\n * (§3.4) — lifted from keksdose `frontend/src/features/feedback/body-attachments.ts`.\n *\n * Plain functions and data, no components: everything here is as usable from a loop\n * script's helper or a test as from a page.\n */\n\n/* ── The resource (§3.1, §3.2) ────────────────────────────────────────────── */\n\n/** Which copy of an app a report came from — keksdose `app/deploy-environment.ts`.\n * Any other string is read as \"not prod\" (the admin list shows it upper-cased as a\n * chip, §4.3), so an app with a `staging` loses nothing. */\nexport type FeedbackEnvironment = \"prod\" | \"dev\" | \"local\";\n\n/**\n * The reporter's context, written by the submit dialog (keksdose\n * `use-feedback-dialog.tsx:105`) — §3.2 of the contract.\n *\n * **Every key is optional on read**, and a reader treats a missing one as \"unknown\":\n * kastlan's client sends six of them (no email, no version), Kurvenschmiede's old rows are\n * backfilled from two columns with a path-only `url`, crash rows add their own (and\n * `origin` / `environment` from the crash payload, §3.6 — older crash rows have neither),\n * and an erased account's row keeps only an allow-list (§3.2: `environment` stays,\n * `origin` goes). Extra keys are allowed — a server may add its own — hence the index\n * signature.\n */\nexport interface FeedbackContext {\n /** The full `location.href` at open time; `\"\"` when \"Attach current page URL\" was off.\n * Readers also accept a path-only value (Kurvenschmiede's backfilled rows). */\n url?: string;\n /** Its pathname; `\"\"` when the URL was withheld. */\n route?: string;\n /** `location.origin` — which copy of the app, not personal; never withheld. */\n origin?: string;\n /** {@link FeedbackEnvironment}, or whatever the app calls its other copies. */\n environment?: FeedbackEnvironment | (string & {});\n /** The submitter, as a snapshot. The server should overwrite the three `user_*` keys\n * from the session (Kurvenschmiede does), so nobody files in someone else's name. */\n user_id?: number | null;\n user_email?: string | null;\n user_display_name?: string | null;\n /** `\"406x816\"`. */\n viewport?: string;\n /** `navigator.userAgent`. */\n ua?: string;\n /** The app build (`__APP_VERSION__`). */\n version?: string;\n // Crash rows (server-written, keksdose `feedback_service.py:346`).\n fingerprint?: string;\n /** Which error boundary caught it. */\n boundary?: \"app\" | \"page\" | (string & {});\n online?: boolean;\n occurrences?: number;\n first_seen_at?: string;\n last_seen_at?: string;\n auto_reported?: boolean;\n [key: string]: unknown;\n}\n\n/**\n * One report — `FeedbackResponse`, keksdose `schemas/feedback.py:117`, §3.1 of the\n * contract. What `GET /feedback`, `GET /feedback/my`, `POST /feedback` and\n * `PATCH /feedback/{id}` answer in all three apps.\n *\n * Extra fields are allowed and ignored (kastlan's `company_id`, `user_name`): an app's\n * own row type with more fields is assignable to this one as it stands.\n *\n * There is **no rework counter field** — {@link reworkCount} reads it off the body, so\n * nothing can forget to set it.\n */\nexport interface FeedbackRecord {\n id: number;\n /** `null`: the author's account was erased (keksdose live #275). */\n user_id: number | null;\n /** The admin list only (joined); `null` — or absent — on `/my`, create and update. */\n user_email?: string | null;\n /** 1–255 characters, never blank. */\n title: string;\n /** `\"\"` when none. Rework rounds are appended here (§3.4) — read it with\n * {@link splitDescription} / {@link splitBodyAttachments}, write it with\n * {@link appendRework} / {@link replaceDescription}. */\n body: string;\n category: FeedbackCategory;\n status: FeedbackStatus;\n /** §3.2; `null` on rows that have none. */\n context: FeedbackContext | null;\n /** The ONE captured screenshot's attachment URL, or `null`. */\n screenshot_url: string | null;\n /** Up to 5 other files; `null` = none. Optional because a server older than the\n * column sends no key at all (keksdose dev #578 met exactly that). */\n attachment_urls?: string[] | null;\n /** The team's answer; `null` = none written. **Frozen since 0.38** (§9.7): answered\n * as stored for one release, written by nothing, then dropped — the answer is\n * {@link FeedbackRecord.replies} now. */\n outcome: string | null;\n /** Set on ENTERING `DONE` / `WONT_DO`, cleared on leaving them. ISO 8601. */\n resolved_at: string | null;\n /** ISO 8601. */\n created_at: string;\n /** ISO 8601. */\n updated_at: string;\n // ── Round 0.38 (§9.3): all optional, so an app without public parts sends none. ──\n /** The admin: the full name; the author: their own; `null`: none to show. */\n author_name?: string | null;\n /** The viewer filed it. */\n mine?: boolean | null;\n /** Visible to the app's other users (§9.3); never on a CRASH. */\n public?: boolean | null;\n /** Made public by the 0.38 migration: the author may switch it off at any status. */\n filed_private?: boolean | null;\n /** People who want this (the author's own vote included, §9.6). */\n votes?: number | null;\n /** The viewer's vote. */\n voted?: boolean | null;\n /** Comments (an admin's count includes hidden ones). */\n comment_count?: number | null;\n /** The admin's answers, oldest first (§9.7). Absent: a server before 0.38 — read\n * `outcome` instead. */\n replies?: FeedbackReply[] | null;\n}\n\n/* ── Constants (§3.4, §3.5, §4.3) ─────────────────────────────────────────── */\n\n// The attachment field's three defaults live here, not in feedback-attachment.tsx\n// (which re-exports them), since 0.34 (MOD-1, refactor audit 2026-10). This module is in\n// every app's top bar (the menu's categories), and FEEDBACK_ATTACHMENT_ACCEPT below is\n// built on DEFAULT_ATTACHMENT_ACCEPT: imported from the field's module, it tied the top\n// bar to the field, the lazily loaded dialog's heaviest part, for three values.\n\n/** The image types `FeedbackAttachmentField` takes when `accept` is not given. */\nexport const DEFAULT_ATTACHMENT_ACCEPT = [\"image/png\", \"image/jpeg\", \"image/webp\", \"image/gif\"];\n/** 10 MB, the contract's size limit for one file (§3.5). */\nexport const DEFAULT_MAX_ATTACHMENT_BYTES = 10 * 1024 * 1024;\n/** How many files `<FeedbackAttachmentField multiple>` takes when `max` is not given\n * (0.15.5). Five photos of one problem is already a lot to look through; a report\n * that needs more is a conversation, which the thread is for. */\nexport const DEFAULT_MAX_ATTACHMENTS = 5;\n\n/**\n * What a report may carry (§3.5, keksdose `upload_guards.py:197` and its\n * `attachment-options.ts`): the kit's four image types plus a PDF and a plain-text log\n * (keksdose feedback #87). SVG and HTML stay out — both are script-carrying documents in\n * an image's clothing. For `FeedbackAttachmentField` / `FeedbackDialog`'s `accept`, with\n * `DEFAULT_MAX_ATTACHMENTS` (5) and `DEFAULT_MAX_ATTACHMENT_BYTES` (10 MB) above, which\n * already are the contract's limits.\n *\n * A plain array (not frozen) because `accept` takes `string[]`, as\n * `DEFAULT_ATTACHMENT_ACCEPT` does — copy it before changing it.\n */\nexport const FEEDBACK_ATTACHMENT_ACCEPT: string[] = [...DEFAULT_ATTACHMENT_ACCEPT, \"application/pdf\", \"text/plain\"];\n\n/**\n * The categories a person can pick — every one but `CRASH`, in triage order (Bug, Idea,\n * Question, Other: the feedback menu's rows, §4.1). `CRASH` is filed by an error boundary\n * and the server refuses it by hand with a 422 (keksdose `_reject_manual_crash`), so no\n * picker may offer it.\n */\nexport const FEEDBACK_PICKABLE_CATEGORIES: readonly FeedbackCategory[] = Object.freeze(\n FEEDBACK_CATEGORY_ORDER.filter((category) => category !== \"CRASH\"),\n);\n\n/**\n * The statuses a report can be sent back for **rework** from (§3.4): everything the team\n * has answered — `IN_EVALUATION`, `NEEDS_LIVE_TEST`, `POSTPONED`, `DONE`, `WONT_DO` — and,\n * since 0.40, `REWORK` itself (§10.2 decision 4: a second rework adds another entry). On\n * `OPEN`, `READY` and `IN_PROGRESS` there is nothing to send back yet.\n */\nexport const FEEDBACK_REWORKABLE_STATUSES: readonly FeedbackStatus[] = Object.freeze([\n \"REWORK\",\n \"IN_EVALUATION\",\n \"NEEDS_LIVE_TEST\",\n \"POSTPONED\",\n \"DONE\",\n \"WONT_DO\",\n] as const);\n\n/**\n * The loops' queue (0.40, §10.2 decision 4; server-kit `QUEUE_STATUSES`): released for\n * work (`READY`), sent back and released again (`REWORK`), and being worked\n * (`IN_PROGRESS`). Kurvenschmiede's loop adds `OPEN` (decision 9) — its own difference,\n * not this list's.\n */\nexport const FEEDBACK_QUEUE_STATUSES: readonly FeedbackStatus[] = Object.freeze([\n \"READY\",\n \"REWORK\",\n \"IN_PROGRESS\",\n] as const);\n\n/**\n * The statuses in which the AUTHOR may still edit title, body and category (§3.4,\n * keksdose `canAuthorEdit`, `feedback-page.tsx:398`): `OPEN`, `READY` and `IN_PROGRESS`.\n * Once the team has answered, the description is what they answered and stays as it\n * was; a correction goes in as a rework.\n */\nexport const FEEDBACK_AUTHOR_EDITABLE_STATUSES: readonly FeedbackStatus[] = Object.freeze([\n \"OPEN\",\n \"READY\",\n \"IN_PROGRESS\",\n] as const);\n\n/**\n * The statuses that wait on the person triaging: filed and not yet triaged (`OPEN`,\n * since READY took over \"released for implementation\" in 0.31, feedback contract §8.2),\n * answered and handed back for a verdict, or answered and only checkable on a deployed\n * build (keksdose `AWAITING_VERDICT`, live #330). The phone's \"Only what is waiting for\n * you\" toggle narrows the inbox to exactly these (§4.3).\n */\nexport const FEEDBACK_AWAITING_STATUSES: readonly FeedbackStatus[] = Object.freeze([\n \"OPEN\",\n \"IN_EVALUATION\",\n \"NEEDS_LIVE_TEST\",\n] as const);\n\n/**\n * The **decided** statuses (§9.7, decision 13): `DONE`, `WONT_DO`, `POSTPONED`. A\n * status-only move into one tells the author nothing (a status alone sends no\n * notification), so the row detail nudges the admin toward a reply until one with that\n * `status_to` exists.\n */\nexport const FEEDBACK_DECIDED_STATUSES: readonly FeedbackStatus[] = Object.freeze([\n \"DONE\",\n \"WONT_DO\",\n \"POSTPONED\",\n] as const);\n\n/** A comment's longest body after trimming (§9.8). */\nexport const FEEDBACK_COMMENT_MAX = 4000;\n/** A reply's longest body after trimming (§9.7). */\nexport const FEEDBACK_REPLY_MAX = 8000;\n\n/* ── The body (§3.4) ──────────────────────────────────────────────────────── */\n\n/**\n * The path every app serves attachments under (§3.3), and a key after it. Keys are\n * OPAQUE (§3.5): keksdose and Kurvenschmiede content-address (`<sha12>.<ext>`), kastlan's\n * storage keys are `<uuid32>_<sha12>.<ext>` — so `[\\w.-]+`, never a fixed hex shape.\n */\nconst ATTACHMENT_URL = /^\\/api\\/v1\\/feedback\\/attachments\\/[\\w.-]+$/;\n\n/**\n * One file line in a body. The marker is deliberately narrow — this path and nothing\n * else, alone on its line — so no sentence a user writes can be mistaken for one\n * (keksdose live #291). It says `[screenshot]` for a PDF or a text log too: the name is\n * history, the format is contract.\n */\nconst ATTACHMENT_LINE = /^\\[screenshot\\]\\s+(\\/api\\/v1\\/feedback\\/attachments\\/[\\w.-]+)\\s*$/;\n\n/**\n * The `--- REWORK <stamp> ---` rule a rework opens with. Anchored and whole-line for the\n * same reason as the file marker: \"I did a REWORK --- honestly\" is a sentence, not a\n * round. kastlan's folded `--- COMMENT <stamp> · <name> ---` blocks (§7.7) never match.\n */\nconst REWORK_RULE = /^---\\s*REWORK\\b.*---$/;\n\n/** Any appended block's opening rule: a rework round, or a kastlan comment folded into\n * the body by its one-time migration (§7.7). */\nconst BLOCK_RULE = /^---\\s*(?:REWORK|COMMENT)\\b.*---$/;\n\n/** The body line for one uploaded attachment — what {@link appendRework} writes under\n * the note. */\nexport function feedbackAttachmentLine(url: string): string {\n return `[screenshot] ${url}`;\n}\n\n/**\n * A rework round appended to a body — the exact text `PATCH /feedback/{id}` takes as the\n * new `body` (§3.4; keksdose `submitRework`, `feedback-page.tsx:350`):\n *\n * ```text\n * <old body>\\n\\n--- REWORK 2026-10-04 09:12 ---\\n<note>\\n[screenshot] /api/v1/feedback/attachments/<key>\n * ```\n *\n * - The stamp is UTC, `YYYY-MM-DD HH:MM` (`toISOString().slice(0, 16)`), from `now`.\n * - The old body is kept byte for byte, so the result STRICTLY EXTENDS it — which is\n * how the server recognises an append and reopens an answered row (keksdose\n * `_is_rework_append`, live #331). `\\n\\n` is left out when the old body is `\"\"`.\n * - ONE file per round (`url`), uploaded first by the caller: a body appended without\n * it would be a rework whose evidence never arrived.\n *\n * **Returns `null` when the trimmed note is empty** — a file alone cannot be sent\n * (keksdose `:577`). Null rather than a throw because an empty note is something a\n * person does, not a bug, and the type then makes every caller decide what an empty\n * box means before anything can reach the PATCH.\n *\n * **Throws a `TypeError` when `url` is not an attachment URL** of the contract's shape\n * (`/api/v1/feedback/attachments/<key>`): that one IS a bug — the upload handed back\n * something foreign — and written anyway it would sit in the body as prose that no\n * reader recognises as a file.\n */\nexport function appendRework(body: string, note: string, url?: string | null, now: Date = new Date()): string | null {\n const text = note.trim();\n if (!text) return null;\n if (url && !ATTACHMENT_URL.test(url)) {\n throw new TypeError(`appendRework: not a feedback attachment URL: ${url}`);\n }\n const stamp = now.toISOString().slice(0, 16).replace(\"T\", \" \");\n const block = `--- REWORK ${stamp} ---\\n${url ? `${text}\\n${feedbackAttachmentLine(url)}` : text}`;\n return body ? `${body}\\n\\n${block}` : block;\n}\n\n/**\n * How many times a report has been sent back — the count of `--- REWORK … ---` rule\n * lines in its body (keksdose live #331: the \"category for items in rework\", derived\n * rather than stored, so nothing can forget to set it or leave it set). Folded kastlan\n * comments do not count.\n */\nexport function reworkCount(body: string): number {\n let n = 0;\n for (const line of body.split(\"\\n\")) if (REWORK_RULE.test(line.trim())) n += 1;\n return n;\n}\n\n/**\n * How many times a report has been sent back, since 0.40 (§10.3): its `kind: \"rework\"`\n * entries when the row carries `replies`, else {@link reworkCount} off the body (a server\n * before server-kit 0.13, whose reworks are still `--- REWORK … ---` blocks). What the\n * Rework chip counts.\n */\nexport function feedbackReworkCount(row: {\n body?: string | null;\n replies?: readonly Pick<FeedbackReply, \"kind\">[] | null;\n}): number {\n if (row.replies) {\n const entries = row.replies.filter((reply) => reply.kind === \"rework\").length;\n // A row migrated by an app that answers `replies` but not yet `kind` keeps its body's\n // count: no entry is a rework there, and the blocks are still in the body.\n if (entries > 0) return entries;\n }\n return reworkCount(row.body ?? \"\");\n}\n\n/**\n * A body split into the prose to render and the files to show beside it, in body order.\n *\n * The file lines are stripped from the text: they are a location, not something anybody\n * wrote, and left in they would put a raw URL in the middle of a sentence. Trailing blank\n * lines go (what a stripped marker leaves at the end of a note); every blank line between\n * paragraphs stays.\n */\nexport function splitBodyAttachments(body: string): { text: string; urls: string[] } {\n const urls: string[] = [];\n const kept: string[] = [];\n for (const line of body.split(\"\\n\")) {\n const match = ATTACHMENT_LINE.exec(line.trim());\n if (match) urls.push(match[1]);\n else kept.push(line);\n }\n return { text: kept.join(\"\\n\").replace(/\\n+$/, \"\"), urls };\n}\n\n/** A body cut where its first appended block begins. */\nfunction cutAtFirstBlock(body: string): { head: string; appended: string } {\n const lines = body.split(\"\\n\");\n const at = lines.findIndex((line) => BLOCK_RULE.test(line.trim()));\n if (at === -1) return { head: body, appended: \"\" };\n return { head: lines.slice(0, at).join(\"\\n\"), appended: lines.slice(at).join(\"\\n\") };\n}\n\n/**\n * The ORIGINAL description, apart from everything appended to it since (§4.4.1).\n *\n * - `description` — what the author wrote when filing, without its file lines and\n * trailing blank lines: the text the \"Edit description\" editor holds.\n * - `appended` — every `--- REWORK … ---` round and folded `--- COMMENT … ---` block,\n * from the first one's rule line to the end, verbatim (`\"\"` when there are none).\n *\n * keksdose's editor edits the raw body (`initial={fb.body}`, `feedback-page.tsx:420`), so\n * an author tidying a typo could delete the rework history and the file lines with it.\n * The kit's editor holds `description` only and saves through\n * {@link replaceDescription}, which puts the rest back unchanged.\n */\nexport function splitDescription(body: string): { description: string; appended: string } {\n const { head, appended } = cutAtFirstBlock(body);\n return { description: splitBodyAttachments(head).text, appended };\n}\n\n/**\n * The body with its original description replaced and everything else kept — the file\n * lines of the original part (after the new text, in their order) and the appended\n * blocks (verbatim, after a blank line). The new text is trimmed; clearing it saves the\n * rest alone (`\"\"` when there is no rest).\n *\n * `replaceDescription(body, splitDescription(body).description)` gives back a canonical\n * body unchanged — a trimmed description, then each block after one blank line, as the\n * dialog and {@link appendRework} write them.\n */\nexport function replaceDescription(body: string, description: string): string {\n const { head, appended } = cutAtFirstBlock(body);\n const files = splitBodyAttachments(head).urls.map(feedbackAttachmentLine);\n const text = description.trim();\n const top = [...(text ? [text] : []), ...files].join(\"\\n\");\n if (!appended) return top;\n return top ? `${top}\\n\\n${appended}` : appended;\n}\n\n/**\n * Whether an attachment URL is a picture (keksdose dev #578). The upload route takes\n * PDFs and text logs too and serves them as downloads, never inline, so an `<img>` on\n * one shows a broken icon. The key's extension is the server's own statement of the\n * type (minted from the sniffed content), so it is the thing to read.\n */\nexport function isImageAttachment(url: string): boolean {\n return /\\.(png|jpe?g|webp|gif)$/i.test(url);\n}\n\n/** The file name an attachment downloads as — its key, the last segment of the URL. */\nexport function attachmentName(url: string): string {\n return url.slice(url.lastIndexOf(\"/\") + 1);\n}\n"],"mappings":";AAAA,SAAS,+BAA+B;AAgJjC,MAAM,4BAA4B,CAAC,aAAa,cAAc,cAAc,WAAW;AAEvF,MAAM,+BAA+B,KAAK,OAAO;AAIjD,MAAM,0BAA0B;AAahC,MAAM,6BAAuC,CAAC,GAAG,2BAA2B,mBAAmB,YAAY;AAQ3G,MAAM,+BAA4D,OAAO;AAAA,EAC9E,wBAAwB,OAAO,CAAC,aAAa,aAAa,OAAO;AACnE;AAQO,MAAM,+BAA0D,OAAO,OAAO;AAAA,EACnF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAU;AAQH,MAAM,0BAAqD,OAAO,OAAO;AAAA,EAC9E;AAAA,EACA;AAAA,EACA;AACF,CAAU;AAQH,MAAM,oCAA+D,OAAO,OAAO;AAAA,EACxF;AAAA,EACA;AAAA,EACA;AACF,CAAU;AASH,MAAM,6BAAwD,OAAO,OAAO;AAAA,EACjF;AAAA,EACA;AAAA,EACA;AACF,CAAU;AAQH,MAAM,4BAAuD,OAAO,OAAO;AAAA,EAChF;AAAA,EACA;AAAA,EACA;AACF,CAAU;AAGH,MAAM,uBAAuB;AAE7B,MAAM,qBAAqB;AASlC,MAAM,iBAAiB;AAQvB,MAAM,kBAAkB;AAOxB,MAAM,cAAc;AAIpB,MAAM,aAAa;AAIZ,SAAS,uBAAuB,KAAqB;AAC1D,SAAO,gBAAgB,GAAG;AAC5B;AA2BO,SAAS,aAAa,MAAc,MAAc,KAAqB,MAAY,oBAAI,KAAK,GAAkB;AACn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AAS,WAAW,KAAK,KAAK,KAAK,CAAC,CAAC;AACjE,MAAI,OAAO,GAAI,QAAO,EAAE,MAAM,MAAM,UAAU,GAAG;AACjD,SAAO,EAAE,MAAM,MAAM,MAAM,GAAG,EAAE,EAAE,KAAK,IAAI,GAAG,UAAU,MAAM,MAAM,EAAE,EAAE,KAAK,IAAI,EAAE;AACrF;AAeO,SAAS,iBAAiB,MAAyD;AACxF,QAAM,EAAE,MAAM,SAAS,IAAI,gBAAgB,IAAI;AAC/C,SAAO,EAAE,aAAa,qBAAqB,IAAI,EAAE,MAAM,SAAS;AAClE;AAYO,SAAS,mBAAmB,MAAc,aAA6B;AAC5E,QAAM,EAAE,MAAM,SAAS,IAAI,gBAAgB,IAAI;AAC/C,QAAM,QAAQ,qBAAqB,IAAI,EAAE,KAAK,IAAI,sBAAsB;AACxE,QAAM,OAAO,YAAY,KAAK;AAC9B,QAAM,MAAM,CAAC,GAAI,OAAO,CAAC,IAAI,IAAI,CAAC,GAAI,GAAG,KAAK,EAAE,KAAK,IAAI;AACzD,MAAI,CAAC,SAAU,QAAO;AACtB,SAAO,MAAM,GAAG,GAAG;AAAA;AAAA,EAAO,QAAQ,KAAK;AACzC;AAQO,SAAS,kBAAkB,KAAsB;AACtD,SAAO,2BAA2B,KAAK,GAAG;AAC5C;AAGO,SAAS,eAAe,KAAqB;AAClD,SAAO,IAAI,MAAM,IAAI,YAAY,GAAG,IAAI,CAAC;AAC3C;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/feedback/feedback-record.ts"],"sourcesContent":["import { FEEDBACK_CATEGORY_ORDER } from \"./feedback-vocabulary\";\nimport type { FeedbackCategory, FeedbackStatus } from \"./feedback-vocabulary\";\nimport type { FeedbackReply } from \"./feedback-public-types\";\n\n/**\n * One feedback report as the three apps send it, and the facts the kit reads off it.\n *\n * Until 0.27 the inbox parts took no report at all (\"no `Feedback` type in this file\",\n * feedback-inbox.tsx): keksdose kept its reporter context in a JSON column, kastlan a\n * thinner copy of it, Kurvenschmiede a `page_path` and the bytes in the row. Marcel's\n * feedback round (2026-10-04, docs/feedback-harmonization.md) settled one API contract\n * for all three — keksdose's, read off its code — so the apps now share one shape and the\n * kit can take a row instead of a dozen loose values. This file is that shape (§3.1,\n * §3.2), the contract's constants (§3.4, §3.5, §4.3) and the readers and writers of the\n * one field whose format is itself contract: the body, which carries the rework rounds\n * (§3.4) — lifted from keksdose `frontend/src/features/feedback/body-attachments.ts`.\n *\n * Plain functions and data, no components: everything here is as usable from a loop\n * script's helper or a test as from a page.\n */\n\n/* ── The resource (§3.1, §3.2) ────────────────────────────────────────────── */\n\n/** Which copy of an app a report came from — keksdose `app/deploy-environment.ts`.\n * Any other string is read as \"not prod\" (the admin list shows it upper-cased as a\n * chip, §4.3), so an app with a `staging` loses nothing. */\nexport type FeedbackEnvironment = \"prod\" | \"dev\" | \"local\";\n\n/**\n * The reporter's context, written by the submit dialog (keksdose\n * `use-feedback-dialog.tsx:105`) — §3.2 of the contract.\n *\n * **Every key is optional on read**, and a reader treats a missing one as \"unknown\":\n * kastlan's client sends six of them (no email, no version), Kurvenschmiede's old rows are\n * backfilled from two columns with a path-only `url`, crash rows add their own (and\n * `origin` / `environment` from the crash payload, §3.6 — older crash rows have neither),\n * and an erased account's row keeps only an allow-list (§3.2: `environment` stays,\n * `origin` goes). Extra keys are allowed — a server may add its own — hence the index\n * signature.\n */\nexport interface FeedbackContext {\n /** The full `location.href` at open time; `\"\"` when \"Attach current page URL\" was off.\n * Readers also accept a path-only value (Kurvenschmiede's backfilled rows). */\n url?: string;\n /** Its pathname; `\"\"` when the URL was withheld. */\n route?: string;\n /** `location.origin` — which copy of the app, not personal; never withheld. */\n origin?: string;\n /** {@link FeedbackEnvironment}, or whatever the app calls its other copies. */\n environment?: FeedbackEnvironment | (string & {});\n /** The submitter, as a snapshot. The server should overwrite the three `user_*` keys\n * from the session (Kurvenschmiede does), so nobody files in someone else's name. */\n user_id?: number | null;\n user_email?: string | null;\n user_display_name?: string | null;\n /** `\"406x816\"`. */\n viewport?: string;\n /** `navigator.userAgent`. */\n ua?: string;\n /** The app build (`__APP_VERSION__`). */\n version?: string;\n /** What the app attached about the thing reported (keksdose's stuck receipt scan, live\n * #481): a flat record of short values, in the order the app wrote them. The row\n * detail shows it to the admin and the author, never to anyone else; erasure drops it\n * (it is not on server-kit's `FEEDBACK_CONTEXT_KEEP`). */\n diagnostics?: Readonly<Record<string, unknown>>;\n // Crash rows (server-written, keksdose `feedback_service.py:346`).\n fingerprint?: string;\n /** Which error boundary caught it. */\n boundary?: \"app\" | \"page\" | (string & {});\n online?: boolean;\n occurrences?: number;\n first_seen_at?: string;\n last_seen_at?: string;\n auto_reported?: boolean;\n [key: string]: unknown;\n}\n\n/**\n * One report — `FeedbackResponse`, keksdose `schemas/feedback.py:117`, §3.1 of the\n * contract. What `GET /feedback`, `GET /feedback/my`, `POST /feedback` and\n * `PATCH /feedback/{id}` answer in all three apps.\n *\n * Extra fields are allowed and ignored (kastlan's `company_id`, `user_name`): an app's\n * own row type with more fields is assignable to this one as it stands.\n *\n * There is **no rework counter field** — {@link reworkCount} reads it off the body, so\n * nothing can forget to set it.\n */\nexport interface FeedbackRecord {\n id: number;\n /** `null`: the author's account was erased (keksdose live #275). */\n user_id: number | null;\n /** The admin list only (joined); `null` — or absent — on `/my`, create and update. */\n user_email?: string | null;\n /** 1–255 characters, never blank. */\n title: string;\n /** `\"\"` when none. Rework rounds are appended here (§3.4) — read it with\n * {@link splitDescription} / {@link splitBodyAttachments}, write it with\n * {@link appendRework} / {@link replaceDescription}. */\n body: string;\n category: FeedbackCategory;\n status: FeedbackStatus;\n /** §3.2; `null` on rows that have none. */\n context: FeedbackContext | null;\n /** The ONE captured screenshot's attachment URL, or `null`. */\n screenshot_url: string | null;\n /** Up to 5 other files; `null` = none. Optional because a server older than the\n * column sends no key at all (keksdose dev #578 met exactly that). */\n attachment_urls?: string[] | null;\n /** The team's answer; `null` = none written. **Frozen since 0.38** (§9.7): answered\n * as stored for one release, written by nothing, then dropped — the answer is\n * {@link FeedbackRecord.replies} now. */\n outcome: string | null;\n /** Set on ENTERING `DONE` / `WONT_DO`, cleared on leaving them. ISO 8601. */\n resolved_at: string | null;\n /** ISO 8601. */\n created_at: string;\n /** ISO 8601. */\n updated_at: string;\n // ── Round 0.38 (§9.3): all optional, so an app without public parts sends none. ──\n /** The admin: the full name; the author: their own; `null`: none to show. */\n author_name?: string | null;\n /** The viewer filed it. */\n mine?: boolean | null;\n /** Visible to the app's other users (§9.3); never on a CRASH. */\n public?: boolean | null;\n /** Made public by the 0.38 migration: the author may switch it off at any status. */\n filed_private?: boolean | null;\n /** People who want this (the author's own vote included, §9.6). */\n votes?: number | null;\n /** The viewer's vote. */\n voted?: boolean | null;\n /** Comments (an admin's count includes hidden ones). */\n comment_count?: number | null;\n /** The admin's answers, oldest first (§9.7). Absent: a server before 0.38 — read\n * `outcome` instead. */\n replies?: FeedbackReply[] | null;\n}\n\n/* ── Constants (§3.4, §3.5, §4.3) ─────────────────────────────────────────── */\n\n// The attachment field's three defaults live here, not in feedback-attachment.tsx\n// (which re-exports them), since 0.34 (MOD-1, refactor audit 2026-10). This module is in\n// every app's top bar (the menu's categories), and FEEDBACK_ATTACHMENT_ACCEPT below is\n// built on DEFAULT_ATTACHMENT_ACCEPT: imported from the field's module, it tied the top\n// bar to the field, the lazily loaded dialog's heaviest part, for three values.\n\n/** The image types `FeedbackAttachmentField` takes when `accept` is not given. */\nexport const DEFAULT_ATTACHMENT_ACCEPT = [\"image/png\", \"image/jpeg\", \"image/webp\", \"image/gif\"];\n/** 10 MB, the contract's size limit for one file (§3.5). */\nexport const DEFAULT_MAX_ATTACHMENT_BYTES = 10 * 1024 * 1024;\n/** How many files `<FeedbackAttachmentField multiple>` takes when `max` is not given\n * (0.15.5). Five photos of one problem is already a lot to look through; a report\n * that needs more is a conversation, which the thread is for. */\nexport const DEFAULT_MAX_ATTACHMENTS = 5;\n\n/**\n * What a report may carry (§3.5, keksdose `upload_guards.py:197` and its\n * `attachment-options.ts`): the kit's four image types plus a PDF and a plain-text log\n * (keksdose feedback #87). SVG and HTML stay out — both are script-carrying documents in\n * an image's clothing. For `FeedbackAttachmentField` / `FeedbackDialog`'s `accept`, with\n * `DEFAULT_MAX_ATTACHMENTS` (5) and `DEFAULT_MAX_ATTACHMENT_BYTES` (10 MB) above, which\n * already are the contract's limits.\n *\n * A plain array (not frozen) because `accept` takes `string[]`, as\n * `DEFAULT_ATTACHMENT_ACCEPT` does — copy it before changing it.\n */\nexport const FEEDBACK_ATTACHMENT_ACCEPT: string[] = [...DEFAULT_ATTACHMENT_ACCEPT, \"application/pdf\", \"text/plain\"];\n\n/**\n * The categories a person can pick — every one but `CRASH`, in triage order (Bug, Idea,\n * Question, Other: the feedback menu's rows, §4.1). `CRASH` is filed by an error boundary\n * and the server refuses it by hand with a 422 (keksdose `_reject_manual_crash`), so no\n * picker may offer it.\n */\nexport const FEEDBACK_PICKABLE_CATEGORIES: readonly FeedbackCategory[] = Object.freeze(\n FEEDBACK_CATEGORY_ORDER.filter((category) => category !== \"CRASH\"),\n);\n\n/**\n * The statuses a report can be sent back for **rework** from (§3.4): everything the team\n * has answered — `IN_EVALUATION`, `NEEDS_LIVE_TEST`, `POSTPONED`, `DONE`, `WONT_DO` — and,\n * since 0.40, `REWORK` itself (§10.2 decision 4: a second rework adds another entry). On\n * `OPEN`, `READY` and `IN_PROGRESS` there is nothing to send back yet.\n */\nexport const FEEDBACK_REWORKABLE_STATUSES: readonly FeedbackStatus[] = Object.freeze([\n \"REWORK\",\n \"IN_EVALUATION\",\n \"NEEDS_LIVE_TEST\",\n \"POSTPONED\",\n \"DONE\",\n \"WONT_DO\",\n] as const);\n\n/**\n * The loops' queue (0.40, §10.2 decision 4; server-kit `QUEUE_STATUSES`): released for\n * work (`READY`), sent back and released again (`REWORK`), and being worked\n * (`IN_PROGRESS`). Kurvenschmiede's loop adds `OPEN` (decision 9) — its own difference,\n * not this list's.\n */\nexport const FEEDBACK_QUEUE_STATUSES: readonly FeedbackStatus[] = Object.freeze([\n \"READY\",\n \"REWORK\",\n \"IN_PROGRESS\",\n] as const);\n\n/**\n * The statuses in which the AUTHOR may still edit title, body and category (§3.4,\n * keksdose `canAuthorEdit`, `feedback-page.tsx:398`): `OPEN`, `READY` and `IN_PROGRESS`.\n * Once the team has answered, the description is what they answered and stays as it\n * was; a correction goes in as a rework.\n */\nexport const FEEDBACK_AUTHOR_EDITABLE_STATUSES: readonly FeedbackStatus[] = Object.freeze([\n \"OPEN\",\n \"READY\",\n \"IN_PROGRESS\",\n] as const);\n\n/**\n * The statuses that wait on the person triaging: filed and not yet triaged (`OPEN`,\n * since READY took over \"released for implementation\" in 0.31, feedback contract §8.2),\n * answered and handed back for a verdict, or answered and only checkable on a deployed\n * build (keksdose `AWAITING_VERDICT`, live #330). The phone's \"Only what is waiting for\n * you\" toggle narrows the inbox to exactly these (§4.3).\n */\nexport const FEEDBACK_AWAITING_STATUSES: readonly FeedbackStatus[] = Object.freeze([\n \"OPEN\",\n \"IN_EVALUATION\",\n \"NEEDS_LIVE_TEST\",\n] as const);\n\n/**\n * The **decided** statuses (§9.7, decision 13): `DONE`, `WONT_DO`, `POSTPONED`. A\n * status-only move into one tells the author nothing (a status alone sends no\n * notification), so the row detail nudges the admin toward a reply until one with that\n * `status_to` exists.\n */\nexport const FEEDBACK_DECIDED_STATUSES: readonly FeedbackStatus[] = Object.freeze([\n \"DONE\",\n \"WONT_DO\",\n \"POSTPONED\",\n] as const);\n\n/** A comment's longest body after trimming (§9.8). */\nexport const FEEDBACK_COMMENT_MAX = 4000;\n/** A reply's longest body after trimming (§9.7). */\nexport const FEEDBACK_REPLY_MAX = 8000;\n\n/* ── The body (§3.4) ──────────────────────────────────────────────────────── */\n\n/**\n * The path every app serves attachments under (§3.3), and a key after it. Keys are\n * OPAQUE (§3.5): keksdose and Kurvenschmiede content-address (`<sha12>.<ext>`), kastlan's\n * storage keys are `<uuid32>_<sha12>.<ext>` — so `[\\w.-]+`, never a fixed hex shape.\n */\nconst ATTACHMENT_URL = /^\\/api\\/v1\\/feedback\\/attachments\\/[\\w.-]+$/;\n\n/**\n * One file line in a body. The marker is deliberately narrow — this path and nothing\n * else, alone on its line — so no sentence a user writes can be mistaken for one\n * (keksdose live #291). It says `[screenshot]` for a PDF or a text log too: the name is\n * history, the format is contract.\n */\nconst ATTACHMENT_LINE = /^\\[screenshot\\]\\s+(\\/api\\/v1\\/feedback\\/attachments\\/[\\w.-]+)\\s*$/;\n\n/**\n * The `--- REWORK <stamp> ---` rule a rework opens with. Anchored and whole-line for the\n * same reason as the file marker: \"I did a REWORK --- honestly\" is a sentence, not a\n * round. kastlan's folded `--- COMMENT <stamp> · <name> ---` blocks (§7.7) never match.\n */\nconst REWORK_RULE = /^---\\s*REWORK\\b.*---$/;\n\n/** Any appended block's opening rule: a rework round, or a kastlan comment folded into\n * the body by its one-time migration (§7.7). */\nconst BLOCK_RULE = /^---\\s*(?:REWORK|COMMENT)\\b.*---$/;\n\n/** The body line for one uploaded attachment — what {@link appendRework} writes under\n * the note. */\nexport function feedbackAttachmentLine(url: string): string {\n return `[screenshot] ${url}`;\n}\n\n/**\n * A rework round appended to a body — the exact text `PATCH /feedback/{id}` takes as the\n * new `body` (§3.4; keksdose `submitRework`, `feedback-page.tsx:350`):\n *\n * ```text\n * <old body>\\n\\n--- REWORK 2026-10-04 09:12 ---\\n<note>\\n[screenshot] /api/v1/feedback/attachments/<key>\n * ```\n *\n * - The stamp is UTC, `YYYY-MM-DD HH:MM` (`toISOString().slice(0, 16)`), from `now`.\n * - The old body is kept byte for byte, so the result STRICTLY EXTENDS it — which is\n * how the server recognises an append and reopens an answered row (keksdose\n * `_is_rework_append`, live #331). `\\n\\n` is left out when the old body is `\"\"`.\n * - ONE file per round (`url`), uploaded first by the caller: a body appended without\n * it would be a rework whose evidence never arrived.\n *\n * **Returns `null` when the trimmed note is empty** — a file alone cannot be sent\n * (keksdose `:577`). Null rather than a throw because an empty note is something a\n * person does, not a bug, and the type then makes every caller decide what an empty\n * box means before anything can reach the PATCH.\n *\n * **Throws a `TypeError` when `url` is not an attachment URL** of the contract's shape\n * (`/api/v1/feedback/attachments/<key>`): that one IS a bug — the upload handed back\n * something foreign — and written anyway it would sit in the body as prose that no\n * reader recognises as a file.\n */\nexport function appendRework(body: string, note: string, url?: string | null, now: Date = new Date()): string | null {\n const text = note.trim();\n if (!text) return null;\n if (url && !ATTACHMENT_URL.test(url)) {\n throw new TypeError(`appendRework: not a feedback attachment URL: ${url}`);\n }\n const stamp = now.toISOString().slice(0, 16).replace(\"T\", \" \");\n const block = `--- REWORK ${stamp} ---\\n${url ? `${text}\\n${feedbackAttachmentLine(url)}` : text}`;\n return body ? `${body}\\n\\n${block}` : block;\n}\n\n/**\n * How many times a report has been sent back — the count of `--- REWORK … ---` rule\n * lines in its body (keksdose live #331: the \"category for items in rework\", derived\n * rather than stored, so nothing can forget to set it or leave it set). Folded kastlan\n * comments do not count.\n */\nexport function reworkCount(body: string): number {\n let n = 0;\n for (const line of body.split(\"\\n\")) if (REWORK_RULE.test(line.trim())) n += 1;\n return n;\n}\n\n/**\n * How many times a report has been sent back, since 0.40 (§10.3): its `kind: \"rework\"`\n * entries when the row carries `replies`, else {@link reworkCount} off the body (a server\n * before server-kit 0.13, whose reworks are still `--- REWORK … ---` blocks). What the\n * Rework chip counts.\n */\nexport function feedbackReworkCount(row: {\n body?: string | null;\n replies?: readonly Pick<FeedbackReply, \"kind\">[] | null;\n}): number {\n if (row.replies) {\n const entries = row.replies.filter((reply) => reply.kind === \"rework\").length;\n // A row migrated by an app that answers `replies` but not yet `kind` keeps its body's\n // count: no entry is a rework there, and the blocks are still in the body.\n if (entries > 0) return entries;\n }\n return reworkCount(row.body ?? \"\");\n}\n\n/**\n * A body split into the prose to render and the files to show beside it, in body order.\n *\n * The file lines are stripped from the text: they are a location, not something anybody\n * wrote, and left in they would put a raw URL in the middle of a sentence. Trailing blank\n * lines go (what a stripped marker leaves at the end of a note); every blank line between\n * paragraphs stays.\n */\nexport function splitBodyAttachments(body: string): { text: string; urls: string[] } {\n const urls: string[] = [];\n const kept: string[] = [];\n for (const line of body.split(\"\\n\")) {\n const match = ATTACHMENT_LINE.exec(line.trim());\n if (match) urls.push(match[1]);\n else kept.push(line);\n }\n return { text: kept.join(\"\\n\").replace(/\\n+$/, \"\"), urls };\n}\n\n/** A body cut where its first appended block begins. */\nfunction cutAtFirstBlock(body: string): { head: string; appended: string } {\n const lines = body.split(\"\\n\");\n const at = lines.findIndex((line) => BLOCK_RULE.test(line.trim()));\n if (at === -1) return { head: body, appended: \"\" };\n return { head: lines.slice(0, at).join(\"\\n\"), appended: lines.slice(at).join(\"\\n\") };\n}\n\n/**\n * The ORIGINAL description, apart from everything appended to it since (§4.4.1).\n *\n * - `description` — what the author wrote when filing, without its file lines and\n * trailing blank lines: the text the \"Edit description\" editor holds.\n * - `appended` — every `--- REWORK … ---` round and folded `--- COMMENT … ---` block,\n * from the first one's rule line to the end, verbatim (`\"\"` when there are none).\n *\n * keksdose's editor edits the raw body (`initial={fb.body}`, `feedback-page.tsx:420`), so\n * an author tidying a typo could delete the rework history and the file lines with it.\n * The kit's editor holds `description` only and saves through\n * {@link replaceDescription}, which puts the rest back unchanged.\n */\nexport function splitDescription(body: string): { description: string; appended: string } {\n const { head, appended } = cutAtFirstBlock(body);\n return { description: splitBodyAttachments(head).text, appended };\n}\n\n/**\n * The body with its original description replaced and everything else kept — the file\n * lines of the original part (after the new text, in their order) and the appended\n * blocks (verbatim, after a blank line). The new text is trimmed; clearing it saves the\n * rest alone (`\"\"` when there is no rest).\n *\n * `replaceDescription(body, splitDescription(body).description)` gives back a canonical\n * body unchanged — a trimmed description, then each block after one blank line, as the\n * dialog and {@link appendRework} write them.\n */\nexport function replaceDescription(body: string, description: string): string {\n const { head, appended } = cutAtFirstBlock(body);\n const files = splitBodyAttachments(head).urls.map(feedbackAttachmentLine);\n const text = description.trim();\n const top = [...(text ? [text] : []), ...files].join(\"\\n\");\n if (!appended) return top;\n return top ? `${top}\\n\\n${appended}` : appended;\n}\n\n/**\n * Whether an attachment URL is a picture (keksdose dev #578). The upload route takes\n * PDFs and text logs too and serves them as downloads, never inline, so an `<img>` on\n * one shows a broken icon. The key's extension is the server's own statement of the\n * type (minted from the sniffed content), so it is the thing to read.\n */\nexport function isImageAttachment(url: string): boolean {\n return /\\.(png|jpe?g|webp|gif)$/i.test(url);\n}\n\n/** The file name an attachment downloads as — its key, the last segment of the URL. */\nexport function attachmentName(url: string): string {\n return url.slice(url.lastIndexOf(\"/\") + 1);\n}\n"],"mappings":";AAAA,SAAS,+BAA+B;AAqJjC,MAAM,4BAA4B,CAAC,aAAa,cAAc,cAAc,WAAW;AAEvF,MAAM,+BAA+B,KAAK,OAAO;AAIjD,MAAM,0BAA0B;AAahC,MAAM,6BAAuC,CAAC,GAAG,2BAA2B,mBAAmB,YAAY;AAQ3G,MAAM,+BAA4D,OAAO;AAAA,EAC9E,wBAAwB,OAAO,CAAC,aAAa,aAAa,OAAO;AACnE;AAQO,MAAM,+BAA0D,OAAO,OAAO;AAAA,EACnF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAU;AAQH,MAAM,0BAAqD,OAAO,OAAO;AAAA,EAC9E;AAAA,EACA;AAAA,EACA;AACF,CAAU;AAQH,MAAM,oCAA+D,OAAO,OAAO;AAAA,EACxF;AAAA,EACA;AAAA,EACA;AACF,CAAU;AASH,MAAM,6BAAwD,OAAO,OAAO;AAAA,EACjF;AAAA,EACA;AAAA,EACA;AACF,CAAU;AAQH,MAAM,4BAAuD,OAAO,OAAO;AAAA,EAChF;AAAA,EACA;AAAA,EACA;AACF,CAAU;AAGH,MAAM,uBAAuB;AAE7B,MAAM,qBAAqB;AASlC,MAAM,iBAAiB;AAQvB,MAAM,kBAAkB;AAOxB,MAAM,cAAc;AAIpB,MAAM,aAAa;AAIZ,SAAS,uBAAuB,KAAqB;AAC1D,SAAO,gBAAgB,GAAG;AAC5B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QAAM,QAAQ,KAAK,MAAM,IAAI;AAC7B,QAAM,KAAK,MAAM,UAAU,CAAC,SAAS,WAAW,KAAK,KAAK,KAAK,CAAC,CAAC;AACjE,MAAI,OAAO,GAAI,QAAO,EAAE,MAAM,MAAM,UAAU,GAAG;AACjD,SAAO,EAAE,MAAM,MAAM,MAAM,GAAG,EAAE,EAAE,KAAK,IAAI,GAAG,UAAU,MAAM,MAAM,EAAE,EAAE,KAAK,IAAI,EAAE;AACrF;AAeO,SAAS,iBAAiB,MAAyD;AACxF,QAAM,EAAE,MAAM,SAAS,IAAI,gBAAgB,IAAI;AAC/C,SAAO,EAAE,aAAa,qBAAqB,IAAI,EAAE,MAAM,SAAS;AAClE;AAYO,SAAS,mBAAmB,MAAc,aAA6B;AAC5E,QAAM,EAAE,MAAM,SAAS,IAAI,gBAAgB,IAAI;AAC/C,QAAM,QAAQ,qBAAqB,IAAI,EAAE,KAAK,IAAI,sBAAsB;AACxE,QAAM,OAAO,YAAY,KAAK;AAC9B,QAAM,MAAM,CAAC,GAAI,OAAO,CAAC,IAAI,IAAI,CAAC,GAAI,GAAG,KAAK,EAAE,KAAK,IAAI;AACzD,MAAI,CAAC,SAAU,QAAO;AACtB,SAAO,MAAM,GAAG,GAAG;AAAA;AAAA,EAAO,QAAQ,KAAK;AACzC;AAQO,SAAS,kBAAkB,KAAsB;AACtD,SAAO,2BAA2B,KAAK,GAAG;AAC5C;AAGO,SAAS,eAAe,KAAqB;AAClD,SAAO,IAAI,MAAM,IAAI,YAAY,GAAG,IAAI,CAAC;AAC3C;","names":[]}
|
|
@@ -8,20 +8,13 @@ const DEFAULT_FEEDBACK_DETAIL_LABELS = {
|
|
|
8
8
|
cancel: "Cancel",
|
|
9
9
|
url: "URL",
|
|
10
10
|
copyUrl: "Copy URL",
|
|
11
|
+
diagnostics: "Diagnostics",
|
|
11
12
|
attachment: "Attachment",
|
|
12
13
|
download: (name) => `Download ${name}`,
|
|
13
14
|
downloadFailed: "The attachment could not be downloaded.",
|
|
14
15
|
outcome: "Outcome",
|
|
15
16
|
replies: "Replies",
|
|
16
17
|
resolvedAt: (date) => `Resolved: ${date}`,
|
|
17
|
-
// The outcome editor's three words, read by nothing since 0.38 and "kept for one
|
|
18
|
-
// release" for 13 minors: no tag, so the deprecations test never listed them (refactor
|
|
19
|
-
// audit 2026-10-30, DOC-9). Deprecated on `FeedbackDetailLabels`, the type an app reads
|
|
20
|
-
// them through — a tag on these keys reached no reader (0.52 code review). The keys
|
|
21
|
-
// leave the type and all seven catalogues in 0.53.
|
|
22
|
-
outcomeAdd: "Add outcome",
|
|
23
|
-
outcomeUpdate: "Update",
|
|
24
|
-
outcomePlaceholder: "What was done, decided, or why this won't be addressed.",
|
|
25
18
|
rework: "Rework",
|
|
26
19
|
reworkTitle: "Send for rework",
|
|
27
20
|
reworkSend: "Send rework",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/feedback/feedback-row-detail-labels.ts"],"sourcesContent":["// The English words of ./feedback-row-detail, in a module with no component code: the\n// English catalogue (src/i18n/defaults.ts) imports them without the component, so `en`\n// loads as one chunk like the other languages (0.34, KS U8). ./feedback-row-detail\n// re-exports them.\n\nimport type { FeedbackDetailLabels } from \"./feedback-row-detail\";\n\nexport const DEFAULT_FEEDBACK_DETAIL_LABELS: FeedbackDetailLabels = {\n subject: \"Subject\",\n body: \"Description\",\n edit: \"Edit\",\n editDescription: \"Edit description\",\n save: \"Save\",\n cancel: \"Cancel\",\n url: \"URL\",\n copyUrl: \"Copy URL\",\n attachment: \"Attachment\",\n download: (name) => `Download ${name}`,\n downloadFailed: \"The attachment could not be downloaded.\",\n outcome: \"Outcome\",\n replies: \"Replies\",\n resolvedAt: (date) => `Resolved: ${date}`,\n
|
|
1
|
+
{"version":3,"sources":["../../src/feedback/feedback-row-detail-labels.ts"],"sourcesContent":["// The English words of ./feedback-row-detail, in a module with no component code: the\n// English catalogue (src/i18n/defaults.ts) imports them without the component, so `en`\n// loads as one chunk like the other languages (0.34, KS U8). ./feedback-row-detail\n// re-exports them.\n\nimport type { FeedbackDetailLabels } from \"./feedback-row-detail\";\n\nexport const DEFAULT_FEEDBACK_DETAIL_LABELS: FeedbackDetailLabels = {\n subject: \"Subject\",\n body: \"Description\",\n edit: \"Edit\",\n editDescription: \"Edit description\",\n save: \"Save\",\n cancel: \"Cancel\",\n url: \"URL\",\n copyUrl: \"Copy URL\",\n diagnostics: \"Diagnostics\",\n attachment: \"Attachment\",\n download: (name) => `Download ${name}`,\n downloadFailed: \"The attachment could not be downloaded.\",\n outcome: \"Outcome\",\n replies: \"Replies\",\n resolvedAt: (date) => `Resolved: ${date}`,\n rework: \"Rework\",\n reworkTitle: \"Send for rework\",\n reworkSend: \"Send rework\",\n reworkPlaceholder: \"What still needs refinement? Any new constraints or change of direction.\",\n reworkUploadFailed: \"The file could not be uploaded. The rework was not sent.\",\n status: \"Status\",\n note: \"Note\",\n};\n"],"mappings":";AAOO,MAAM,iCAAuD;AAAA,EAClE,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM;AAAA,EACN,iBAAiB;AAAA,EACjB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,SAAS;AAAA,EACT,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,UAAU,CAAC,SAAS,YAAY,IAAI;AAAA,EACpC,gBAAgB;AAAA,EAChB,SAAS;AAAA,EACT,SAAS;AAAA,EACT,YAAY,CAAC,SAAS,aAAa,IAAI;AAAA,EACvC,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,QAAQ;AAAA,EACR,MAAM;AACR;","names":[]}
|
|
@@ -4,7 +4,6 @@ import type { PathPattern } from "../landing/routing.js";
|
|
|
4
4
|
import { type LabelOverride } from "../i18n/kit-labels.js";
|
|
5
5
|
import type { FeedbackNoteAttachment, FeedbackStatus } from "./feedback-inbox.js";
|
|
6
6
|
import type { FeedbackContext, FeedbackRecord } from "./feedback-record.js";
|
|
7
|
-
import { type FeedbackMutationCall } from "./feedback-mutation.js";
|
|
8
7
|
import type { FeedbackStatusChange } from "./feedback-status-undo.js";
|
|
9
8
|
import type { CommitScope } from "../components/write-lock.js";
|
|
10
9
|
import { DEFAULT_FEEDBACK_DETAIL_LABELS } from "./feedback-row-detail-labels.js";
|
|
@@ -75,6 +74,9 @@ export interface FeedbackDetailLabels {
|
|
|
75
74
|
/** The copy button beside the link — copies the FULL `context.url`.
|
|
76
75
|
* de-CH: "URL kopieren" */
|
|
77
76
|
copyUrl: string;
|
|
77
|
+
/** The heading over `context.diagnostics`, between the URL and the attachment (keksdose
|
|
78
|
+
* live #481). de-CH: "Diagnose" */
|
|
79
|
+
diagnostics: string;
|
|
78
80
|
/** Section 3's heading, and each picture's alt text. de-CH: "Anhang" */
|
|
79
81
|
attachment: string;
|
|
80
82
|
/** A PDF's / text file's download button, given the file's name.
|
|
@@ -91,18 +93,6 @@ export interface FeedbackDetailLabels {
|
|
|
91
93
|
/** On section 4's heading line once the row is settled, given the formatted
|
|
92
94
|
* `resolved_at` date. de-CH: "Erledigt am: {{date}}" */
|
|
93
95
|
resolvedAt: (date: string) => string;
|
|
94
|
-
/** The admin's button while there is no outcome — read by nothing since 0.38 (the
|
|
95
|
-
* outcome is frozen, §9.7; a reply is written instead). de-CH: "Ergebnis hinzufügen"
|
|
96
|
-
* @deprecated 0.52 — a reply: the outcome is frozen since 0.38 (§9.7); removed in 0.53. */
|
|
97
|
-
outcomeAdd: string;
|
|
98
|
-
/** The same button once there is one. Unused since 0.38, as `outcomeAdd`.
|
|
99
|
-
* de-CH: "Aktualisieren"
|
|
100
|
-
* @deprecated 0.52 — a reply: the outcome is frozen since 0.38 (§9.7); removed in 0.53. */
|
|
101
|
-
outcomeUpdate: string;
|
|
102
|
-
/** The line above the outcome editor. Unused since 0.38, as `outcomeAdd`.
|
|
103
|
-
* de-CH: "Was wurde umgesetzt, entschieden oder warum nicht."
|
|
104
|
-
* @deprecated 0.52 — a reply: the outcome is frozen since 0.38 (§9.7); removed in 0.53. */
|
|
105
|
-
outcomePlaceholder: string;
|
|
106
96
|
/** The button that opens section 5 on an answered row. de-CH: "Nacharbeit" */
|
|
107
97
|
rework: string;
|
|
108
98
|
/** Section 5's heading. de-CH: "Zur Nacharbeit senden" */
|
|
@@ -127,30 +117,9 @@ export interface FeedbackDetailLabels {
|
|
|
127
117
|
export { DEFAULT_FEEDBACK_DETAIL_LABELS };
|
|
128
118
|
/** `feedbackDetail` resolved: English, then `<UiKitProvider labels>`, then `labels`. */
|
|
129
119
|
export declare function useFeedbackDetailLabels(labels?: LabelOverride<FeedbackDetailLabels>): FeedbackDetailLabels;
|
|
130
|
-
/**
|
|
131
|
-
* The page a report was filed on as the reporter had it — path + query + hash (keksdose
|
|
132
|
-
* `localHref`: the query and hash carry the state, `?tab=import`, a drill-down). Read from
|
|
133
|
-
* `context.url`, else `context.route`; a path-only `url` works. `null` when there is no
|
|
134
|
-
* page.
|
|
135
|
-
*
|
|
136
|
-
* Always a path on THIS app, never another origin's address — but the path and query
|
|
137
|
-
* are the reporter's to write, so it is TEXT, not a link target: `/join?token=…` acts on
|
|
138
|
-
* load, and `/login?next=…` forwards a signed-in admin to whatever its query names
|
|
139
|
-
* (refactor audit 2026-10-30, FLW-7; 0.52 code review). The kit's URL cell and section
|
|
140
|
-
* link {@link feedbackPagePath} alone, and not even that for a one-shot route
|
|
141
|
-
* (`pageLinkExclude`) — `FeedbackRowDetail` and `useFeedbackColumns` draw the page that
|
|
142
|
-
* way; an app's own cell should not link this.
|
|
143
|
-
*/
|
|
144
|
-
export declare function feedbackPageHref(context: FeedbackContext | null | undefined): string | null;
|
|
145
120
|
/** The page's path alone — the compact text a URL column shows (§4.3), and the only part
|
|
146
121
|
* of the page the kit links. */
|
|
147
122
|
export declare function feedbackPagePath(context: FeedbackContext | null | undefined): string | null;
|
|
148
|
-
/**
|
|
149
|
-
* What "Copy URL" copies: the FULL `context.url` as the reporter's browser had it —
|
|
150
|
-
* origin included, which is the one part that says which copy of the app it was
|
|
151
|
-
* (feedback #278) — else `context.route`. `null` when there is no page.
|
|
152
|
-
*/
|
|
153
|
-
export declare function feedbackPageUrl(context: FeedbackContext | null | undefined): string | null;
|
|
154
123
|
/**
|
|
155
124
|
* Every file a report carries, in the order the detail shows them (§4.4.3): the
|
|
156
125
|
* screenshot it was filed with, then its other files, then whatever the rework rounds
|
|
@@ -218,18 +187,6 @@ export interface FeedbackDetailPatch {
|
|
|
218
187
|
* `feedbackToast.updateFailed` (§4.4) — and leaves the editor open with its draft.
|
|
219
188
|
*/
|
|
220
189
|
export type FeedbackDetailUpdateAsync = (patch: FeedbackDetailPatch) => Promise<unknown>;
|
|
221
|
-
/**
|
|
222
|
-
* The callback form: TanStack Query's `mutate`, or a function that calls `onSuccess` once
|
|
223
|
-
* the PATCH has landed. TanStack calls a per-call `onSuccess` for the LATEST `mutate()`
|
|
224
|
-
* only, so an editor whose save was followed by another PATCH before it answered stayed
|
|
225
|
-
* open, and the earlier status change lost its Undo.
|
|
226
|
-
*
|
|
227
|
-
* @deprecated 0.52 — pass `update.mutateAsync` ({@link FeedbackDetailUpdateAsync}); removed
|
|
228
|
-
* in 0.53
|
|
229
|
-
*/
|
|
230
|
-
export type FeedbackDetailUpdate = (patch: FeedbackDetailPatch, callbacks: {
|
|
231
|
-
onSuccess: () => void;
|
|
232
|
-
}) => void;
|
|
233
190
|
/** `POST /feedback/attachments` (§3.3): one file up, its URL
|
|
234
191
|
* (`/api/v1/feedback/attachments/<key>`) back. Reject on failure. */
|
|
235
192
|
export type FeedbackUpload = (file: File) => Promise<string>;
|
|
@@ -247,7 +204,7 @@ export interface FeedbackReworkSectionProps {
|
|
|
247
204
|
/** The PATCH — see {@link FeedbackDetailUpdateAsync}. Called with `{ id, body }` only,
|
|
248
205
|
* and only without `onRework`: the legacy append (§3.4), which server-kit 0.13 still
|
|
249
206
|
* turns into an entry for one release. Optional since 0.40; pass one of the two. */
|
|
250
|
-
onUpdate?:
|
|
207
|
+
onUpdate?: FeedbackDetailUpdateAsync;
|
|
251
208
|
/** The PATCH is in flight (`update.isPending`). The upload adds its own. */
|
|
252
209
|
pending?: boolean;
|
|
253
210
|
/** The upload. Left out, the note goes without a file field. */
|
|
@@ -300,9 +257,8 @@ export interface FeedbackRowDetailProps {
|
|
|
300
257
|
/** The signed-in user's id — who the AUTHOR is: the description editor and rework. */
|
|
301
258
|
viewerId?: number | null;
|
|
302
259
|
/** The page's PATCH — `update.mutateAsync` (see {@link FeedbackDetailUpdateAsync}). The
|
|
303
|
-
* callback form
|
|
304
|
-
|
|
305
|
-
onUpdate: FeedbackMutationCall<FeedbackDetailPatch>;
|
|
260
|
+
* callback form, `update.mutate`, went in 0.53 (deprecated in 0.52). */
|
|
261
|
+
onUpdate: FeedbackDetailUpdateAsync;
|
|
306
262
|
/** `update.isPending`: the editors' save buttons wait for it. */
|
|
307
263
|
pending?: boolean;
|
|
308
264
|
/** `POST /feedback/attachments` for the rework's one file and, since 0.47 (§12) with
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
splitBodyAttachments,
|
|
33
33
|
splitDescription
|
|
34
34
|
} from "./feedback-record.js";
|
|
35
|
+
import { diagnosticsEntries, FeedbackDiagnosticsList } from "./feedback-diagnostics.js";
|
|
35
36
|
import { runMutation } from "./feedback-mutation.js";
|
|
36
37
|
import { feedbackPage, feedbackPageLinkTarget } from "./feedback-page-link.js";
|
|
37
38
|
import { useFeedbackStatusUndo } from "./feedback-status-undo.js";
|
|
@@ -44,15 +45,9 @@ import { DEFAULT_FEEDBACK_COMMENTS_LABELS } from "./feedback-thread-parts-labels
|
|
|
44
45
|
function useFeedbackDetailLabels(labels) {
|
|
45
46
|
return useKitLabels("feedbackDetail", DEFAULT_FEEDBACK_DETAIL_LABELS, labels);
|
|
46
47
|
}
|
|
47
|
-
function feedbackPageHref(context) {
|
|
48
|
-
return feedbackPage(context)?.href ?? null;
|
|
49
|
-
}
|
|
50
48
|
function feedbackPagePath(context) {
|
|
51
49
|
return feedbackPage(context)?.path ?? null;
|
|
52
50
|
}
|
|
53
|
-
function feedbackPageUrl(context) {
|
|
54
|
-
return feedbackPage(context)?.url ?? null;
|
|
55
|
-
}
|
|
56
51
|
function feedbackAttachmentUrls(row) {
|
|
57
52
|
const urls = [
|
|
58
53
|
...row.screenshot_url ? [row.screenshot_url] : [],
|
|
@@ -205,6 +200,7 @@ function FeedbackRowDetail({
|
|
|
205
200
|
const { description } = splitDescription(row.body);
|
|
206
201
|
const page = feedbackPage(row.context);
|
|
207
202
|
const pageLink = page && feedbackPageLinkTarget(page, pageLinkExclude);
|
|
203
|
+
const diagnostics = canEdit || access.isAuthor ? diagnosticsEntries(row.context?.diagnostics) : [];
|
|
208
204
|
const files = feedbackAttachmentUrls(row.replies ? { ...row, replies: void 0 } : row);
|
|
209
205
|
const fetchFile = fetcher ?? plainFeedbackFetch;
|
|
210
206
|
const day = useDayFormatter(renderDate);
|
|
@@ -278,6 +274,7 @@ function FeedbackRowDetail({
|
|
|
278
274
|
),
|
|
279
275
|
/* @__PURE__ */ jsx(CopyButton, { size: "xs", className: "shrink-0", text: page.url, label: labels.copyUrl, stopPropagation: true })
|
|
280
276
|
] }) }),
|
|
277
|
+
diagnostics.length > 0 && /* @__PURE__ */ jsx(FeedbackDetailSection, { title: labels.diagnostics, children: /* @__PURE__ */ jsx(FeedbackDiagnosticsList, { entries: diagnostics }) }),
|
|
281
278
|
files.length > 0 && /* @__PURE__ */ jsx(FeedbackDetailSection, { title: labels.attachment, children: /* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-wrap items-start gap-2", children: files.map(
|
|
282
279
|
(url) => isImageAttachment(url) ? /* @__PURE__ */ jsx(
|
|
283
280
|
AuthedImage,
|
|
@@ -383,9 +380,7 @@ export {
|
|
|
383
380
|
FeedbackReworkSection,
|
|
384
381
|
FeedbackRowDetail,
|
|
385
382
|
feedbackAttachmentUrls,
|
|
386
|
-
feedbackPageHref,
|
|
387
383
|
feedbackPagePath,
|
|
388
|
-
feedbackPageUrl,
|
|
389
384
|
feedbackRowAccess,
|
|
390
385
|
useFeedbackDetailLabels
|
|
391
386
|
};
|