@stapel/alerts-react 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/CHANGELOG.md +109 -0
  2. package/LICENSE +21 -0
  3. package/MODULE.md +140 -0
  4. package/README.md +147 -0
  5. package/dist/analytics/events.d.ts +29 -0
  6. package/dist/analytics/events.d.ts.map +1 -0
  7. package/dist/analytics/events.js +28 -0
  8. package/dist/analytics/events.js.map +1 -0
  9. package/dist/api/alertsApi.d.ts +84 -0
  10. package/dist/api/alertsApi.d.ts.map +1 -0
  11. package/dist/api/alertsApi.js +127 -0
  12. package/dist/api/alertsApi.js.map +1 -0
  13. package/dist/api/generated/schema.d.ts +453 -0
  14. package/dist/api/generated/schema.d.ts.map +1 -0
  15. package/dist/api/generated/schema.js +2 -0
  16. package/dist/api/generated/schema.js.map +1 -0
  17. package/dist/api/types.d.ts +78 -0
  18. package/dist/api/types.d.ts.map +1 -0
  19. package/dist/api/types.js +44 -0
  20. package/dist/api/types.js.map +1 -0
  21. package/dist/default/FixIssueDialog.d.ts +15 -0
  22. package/dist/default/FixIssueDialog.d.ts.map +1 -0
  23. package/dist/default/FixIssueDialog.js +67 -0
  24. package/dist/default/FixIssueDialog.js.map +1 -0
  25. package/dist/default/IssueDetail.d.ts +10 -0
  26. package/dist/default/IssueDetail.d.ts.map +1 -0
  27. package/dist/default/IssueDetail.js +83 -0
  28. package/dist/default/IssueDetail.js.map +1 -0
  29. package/dist/default/IssueFilterBar.d.ts +21 -0
  30. package/dist/default/IssueFilterBar.d.ts.map +1 -0
  31. package/dist/default/IssueFilterBar.js +86 -0
  32. package/dist/default/IssueFilterBar.js.map +1 -0
  33. package/dist/default/IssuesFeed.d.ts +10 -0
  34. package/dist/default/IssuesFeed.d.ts.map +1 -0
  35. package/dist/default/IssuesFeed.js +137 -0
  36. package/dist/default/IssuesFeed.js.map +1 -0
  37. package/dist/default/MuteIssueDialog.d.ts +19 -0
  38. package/dist/default/MuteIssueDialog.d.ts.map +1 -0
  39. package/dist/default/MuteIssueDialog.js +72 -0
  40. package/dist/default/MuteIssueDialog.js.map +1 -0
  41. package/dist/default/index.d.ts +32 -0
  42. package/dist/default/index.d.ts.map +1 -0
  43. package/dist/default/index.js +26 -0
  44. package/dist/default/index.js.map +1 -0
  45. package/dist/default/labels.d.ts +40 -0
  46. package/dist/default/labels.d.ts.map +1 -0
  47. package/dist/default/labels.js +94 -0
  48. package/dist/default/labels.js.map +1 -0
  49. package/dist/default/layout.d.ts +32 -0
  50. package/dist/default/layout.d.ts.map +1 -0
  51. package/dist/default/layout.js +44 -0
  52. package/dist/default/layout.js.map +1 -0
  53. package/dist/default/types.d.ts +27 -0
  54. package/dist/default/types.d.ts.map +1 -0
  55. package/dist/default/types.js +2 -0
  56. package/dist/default/types.js.map +1 -0
  57. package/dist/flows/errors.d.ts +12 -0
  58. package/dist/flows/errors.d.ts.map +1 -0
  59. package/dist/flows/errors.js +13 -0
  60. package/dist/flows/errors.js.map +1 -0
  61. package/dist/flows/registry.d.ts +22 -0
  62. package/dist/flows/registry.d.ts.map +1 -0
  63. package/dist/flows/registry.js +20 -0
  64. package/dist/flows/registry.js.map +1 -0
  65. package/dist/headless/AlertsProvider.d.ts +19 -0
  66. package/dist/headless/AlertsProvider.d.ts.map +1 -0
  67. package/dist/headless/AlertsProvider.js +15 -0
  68. package/dist/headless/AlertsProvider.js.map +1 -0
  69. package/dist/i18n/errorsMap.d.ts +10 -0
  70. package/dist/i18n/errorsMap.d.ts.map +1 -0
  71. package/dist/i18n/errorsMap.js +20 -0
  72. package/dist/i18n/errorsMap.js.map +1 -0
  73. package/dist/i18n/es.d.ts +20 -0
  74. package/dist/i18n/es.d.ts.map +1 -0
  75. package/dist/i18n/es.js +152 -0
  76. package/dist/i18n/es.js.map +1 -0
  77. package/dist/i18n/generated/errors.es.gen.d.ts +9 -0
  78. package/dist/i18n/generated/errors.es.gen.d.ts.map +1 -0
  79. package/dist/i18n/generated/errors.es.gen.js +57 -0
  80. package/dist/i18n/generated/errors.es.gen.js.map +1 -0
  81. package/dist/i18n/generated/errors.gen.d.ts +323 -0
  82. package/dist/i18n/generated/errors.gen.d.ts.map +1 -0
  83. package/dist/i18n/generated/errors.gen.js +165 -0
  84. package/dist/i18n/generated/errors.gen.js.map +1 -0
  85. package/dist/i18n/generated/errors.ru.gen.d.ts +9 -0
  86. package/dist/i18n/generated/errors.ru.gen.d.ts.map +1 -0
  87. package/dist/i18n/generated/errors.ru.gen.js +57 -0
  88. package/dist/i18n/generated/errors.ru.gen.js.map +1 -0
  89. package/dist/i18n/keys.d.ts +164 -0
  90. package/dist/i18n/keys.d.ts.map +1 -0
  91. package/dist/i18n/keys.js +300 -0
  92. package/dist/i18n/keys.js.map +1 -0
  93. package/dist/i18n/ru.d.ts +27 -0
  94. package/dist/i18n/ru.d.ts.map +1 -0
  95. package/dist/i18n/ru.js +159 -0
  96. package/dist/i18n/ru.js.map +1 -0
  97. package/dist/index.d.ts +42 -0
  98. package/dist/index.d.ts.map +1 -0
  99. package/dist/index.js +45 -0
  100. package/dist/index.js.map +1 -0
  101. package/dist/model/context.d.ts +11 -0
  102. package/dist/model/context.d.ts.map +1 -0
  103. package/dist/model/context.js +16 -0
  104. package/dist/model/context.js.map +1 -0
  105. package/dist/model/issues.d.ts +103 -0
  106. package/dist/model/issues.d.ts.map +1 -0
  107. package/dist/model/issues.js +230 -0
  108. package/dist/model/issues.js.map +1 -0
  109. package/dist/model/queryKeys.d.ts +11 -0
  110. package/dist/model/queryKeys.d.ts.map +1 -0
  111. package/dist/model/queryKeys.js +32 -0
  112. package/dist/model/queryKeys.js.map +1 -0
  113. package/dist/model/refusals.d.ts +25 -0
  114. package/dist/model/refusals.d.ts.map +1 -0
  115. package/dist/model/refusals.js +73 -0
  116. package/dist/model/refusals.js.map +1 -0
  117. package/dist/model/runtime.d.ts +51 -0
  118. package/dist/model/runtime.d.ts.map +1 -0
  119. package/dist/model/runtime.js +29 -0
  120. package/dist/model/runtime.js.map +1 -0
  121. package/dist/model/status.d.ts +60 -0
  122. package/dist/model/status.d.ts.map +1 -0
  123. package/dist/model/status.js +116 -0
  124. package/dist/model/status.js.map +1 -0
  125. package/dist/nav/manifest.d.ts +43 -0
  126. package/dist/nav/manifest.d.ts.map +1 -0
  127. package/dist/nav/manifest.js +36 -0
  128. package/dist/nav/manifest.js.map +1 -0
  129. package/llms.txt +84 -0
  130. package/manifest.json +694 -0
  131. package/nav-manifest.json +46 -0
  132. package/package.json +119 -0
  133. package/src/analytics/events.ts +29 -0
  134. package/src/analytics/generated/events.json +7 -0
  135. package/src/api/alertsApi.ts +259 -0
  136. package/src/api/generated/schema.ts +455 -0
  137. package/src/api/types.ts +113 -0
  138. package/src/default/FixIssueDialog.tsx +158 -0
  139. package/src/default/IssueDetail.tsx +431 -0
  140. package/src/default/IssueFilterBar.tsx +197 -0
  141. package/src/default/IssuesFeed.tsx +343 -0
  142. package/src/default/MuteIssueDialog.tsx +186 -0
  143. package/src/default/index.ts +37 -0
  144. package/src/default/labels.ts +113 -0
  145. package/src/default/layout.ts +52 -0
  146. package/src/default/types.ts +27 -0
  147. package/src/flows/errors.ts +16 -0
  148. package/src/flows/registry.ts +32 -0
  149. package/src/headless/AlertsProvider.tsx +20 -0
  150. package/src/i18n/errorsMap.ts +31 -0
  151. package/src/i18n/es.ts +181 -0
  152. package/src/i18n/generated/errors.es.gen.ts +63 -0
  153. package/src/i18n/generated/errors.gen.ts +196 -0
  154. package/src/i18n/generated/errors.json +370 -0
  155. package/src/i18n/generated/errors.ru.gen.ts +63 -0
  156. package/src/i18n/keys.ts +341 -0
  157. package/src/i18n/ru.ts +188 -0
  158. package/src/index.ts +152 -0
  159. package/src/model/context.tsx +28 -0
  160. package/src/model/issues.ts +311 -0
  161. package/src/model/queryKeys.ts +41 -0
  162. package/src/model/refusals.ts +82 -0
  163. package/src/model/runtime.ts +80 -0
  164. package/src/model/status.ts +179 -0
  165. package/src/nav/manifest.ts +76 -0
  166. package/tsconfig.json +26 -0
@@ -0,0 +1,80 @@
1
+ import { createModuleRuntime } from "@stapel/core";
2
+ import type { CreateModuleRuntimeOptions, ModuleRuntime } from "@stapel/core";
3
+ import { createAlertsApi } from "../api/alertsApi.js";
4
+ import type { AlertsApi } from "../api/alertsApi.js";
5
+
6
+ /**
7
+ * The wired alerts runtime — core's `ModuleRuntime` bound to this pair's API
8
+ * (slim wave §21/S2) — plus the two facts about this deployment that the
9
+ * module genuinely knows and its HTTP surface genuinely does not serve.
10
+ *
11
+ * The runtime's `fetch`/`credentials`/`defaultHeaders` are forwarded to the
12
+ * pair's RAW read surface as well, because the conditional (`ETag`) reads
13
+ * cannot ride the JSON client — see `api/alertsApi.ts`.
14
+ *
15
+ * ── `pollIntervalMs`: there is no stream ──────────────────────────────────
16
+ *
17
+ * stapel-alerts pushes nothing. An issue opens when a process somewhere fails,
18
+ * which is precisely when nobody is looking at the tracker; a feed that never
19
+ * re-read would show a green screen through an outage. The re-read is
20
+ * conditional, so the cost of asking is a 304 and a header — which is the
21
+ * whole reason the backend put an `ETag` on these two routes.
22
+ *
23
+ * ── `commitRefUrl`: where a sha goes when you click it ────────────────────
24
+ *
25
+ * A fixed issue carries `fixed_in_sha`, and the only useful thing to do with a
26
+ * sha is open the commit. WHERE that is is the host's repository, which this
27
+ * package cannot know and will not guess: unset, the sha renders as text and
28
+ * not as a dead link.
29
+ */
30
+ export type AlertsRuntime = ModuleRuntime<AlertsApi> & {
31
+ /** How often an open feed re-asks, conditionally. `0` disables the poll. */
32
+ readonly pollIntervalMs: number;
33
+ /** `(sha) => href` for the host's repository browser. Omit for plain text. */
34
+ readonly commitRefUrl: ((sha: string) => string) | undefined;
35
+ };
36
+
37
+ /** The module's canonical mount (`urls.py` + `urls_v1.py`). */
38
+ export const DEFAULT_ALERTS_BASE_URL = "/alerts/api/v1/";
39
+
40
+ /**
41
+ * 60 seconds — the interval the module's own API doc names ("a poller that
42
+ * asks every minute should get a 304, not a page of JSON it already has").
43
+ * Fast enough that an operator watching a deploy sees a regression while it is
44
+ * still their deploy; slow enough that the answer is almost always 304.
45
+ */
46
+ export const DEFAULT_ALERTS_POLL_INTERVAL_MS = 60_000;
47
+
48
+ export interface CreateAlertsRuntimeOptions
49
+ extends Omit<CreateModuleRuntimeOptions, "baseUrl"> {
50
+ /** Default {@link DEFAULT_ALERTS_BASE_URL}. */
51
+ readonly baseUrl?: string;
52
+ /** Default {@link DEFAULT_ALERTS_POLL_INTERVAL_MS}; `0` disables the poll. */
53
+ readonly pollIntervalMs?: number;
54
+ /** Turn a `fixed_in_sha` into a link into the host's repository browser. */
55
+ readonly commitRefUrl?: (sha: string) => string;
56
+ }
57
+
58
+ export function createAlertsRuntime(
59
+ options: CreateAlertsRuntimeOptions = {}
60
+ ): AlertsRuntime {
61
+ const { baseUrl, pollIntervalMs, commitRefUrl, ...moduleOptions } = options;
62
+ const base = createModuleRuntime(
63
+ (client) =>
64
+ createAlertsApi(client, {
65
+ ...(options.fetch !== undefined ? { fetch: options.fetch } : {}),
66
+ ...(options.credentials !== undefined
67
+ ? { credentials: options.credentials }
68
+ : {}),
69
+ ...(options.defaultHeaders !== undefined
70
+ ? { defaultHeaders: options.defaultHeaders }
71
+ : {}),
72
+ }),
73
+ { ...moduleOptions, baseUrl: baseUrl ?? DEFAULT_ALERTS_BASE_URL }
74
+ );
75
+ return {
76
+ ...base,
77
+ pollIntervalMs: pollIntervalMs ?? DEFAULT_ALERTS_POLL_INTERVAL_MS,
78
+ commitRefUrl,
79
+ };
80
+ }
@@ -0,0 +1,179 @@
1
+ /**
2
+ * The three writes an operator owns, and the one they do not.
3
+ *
4
+ * ── Fixing is its own endpoint, not a status patch ────────────────────────
5
+ *
6
+ * `POST /issues/{id}/fix` and `PATCH {status: "fixed"}` both leave the row
7
+ * `fixed`, and only the first one records WHICH release claims it and zeroes
8
+ * `count_since_fix`. That counter is the entire answer to "did it come back?",
9
+ * so {@link useIssueStatus}'s `fix` is the POST — a patch to `fixed` would
10
+ * close an issue whose regression nobody could later prove.
11
+ *
12
+ * ── A mute is the deadline ────────────────────────────────────────────────
13
+ *
14
+ * `PATCH {muted_until}` on its own is a mute: the field has no meaning in any
15
+ * other status, so the store infers `status: "muted"` from it, and any status
16
+ * other than `muted` clears it on the way out. What `mute` must never do is
17
+ * OMIT the key — a patch without `muted_until` is a note, not a mute — so
18
+ * "mute forever" sends an explicit `null`.
19
+ *
20
+ * ── `regressed` is not offered ────────────────────────────────────────────
21
+ *
22
+ * There is no `regress()` here. The store sets that status from evidence
23
+ * (`services.record`: a fixed issue received a new event), and a caller able
24
+ * to assert it would be a caller able to withhold it. `reopen` puts an issue
25
+ * back to `new`, which is the operator's own judgement and is a different
26
+ * statement entirely.
27
+ *
28
+ * ── One invalidation, because the keys nest ───────────────────────────────
29
+ *
30
+ * `alertsQueryKeys.issues` is a prefix of both the list keys and the detail
31
+ * key, so invalidating it re-asks everything this module caches. Each re-ask
32
+ * is conditional and the body genuinely changed, so exactly the entries that
33
+ * moved come back with a new body; the rest 304.
34
+ */
35
+ import { useMutation, useQueryClient } from "@tanstack/react-query";
36
+ import type { UseMutationResult } from "@tanstack/react-query";
37
+ import type { StapelApiError } from "@stapel/core";
38
+ import type { Issue, IssueLevel } from "../api/types.js";
39
+ import { ALERTS_EVENTS } from "../analytics/events.js";
40
+ import { useAlertsAnalytics, useAlertsApi } from "./context.js";
41
+ import { alertsQueryKeys } from "./queryKeys.js";
42
+
43
+ /** The value, or `undefined` when it is blank once trimmed. */
44
+ function trimmed(value: string | undefined): string | undefined {
45
+ const text = value?.trim() ?? "";
46
+ return text.length > 0 ? text : undefined;
47
+ }
48
+
49
+ /** What `fix` is called with. */
50
+ export interface FixIssueInput {
51
+ readonly issueId: string;
52
+ /** The release that claims the fix. Optional — a hotfix may have no tag. */
53
+ readonly version?: string;
54
+ /** The commit that claims it. Optional — a human closing by hand has none. */
55
+ readonly sha?: string;
56
+ /**
57
+ * The row's level, for the analytics prop ONLY. The store reads the level
58
+ * off the row it already has; this never reaches the wire.
59
+ */
60
+ readonly level?: IssueLevel;
61
+ }
62
+
63
+ /** What `mute` is called with. */
64
+ export interface MuteIssueInput {
65
+ readonly issueId: string;
66
+ /**
67
+ * When the mute lapses, as an ISO-8601 instant. `null` mutes with no
68
+ * deadline — sent explicitly, because the key IS the mute (see the module
69
+ * header).
70
+ */
71
+ readonly mutedUntil: string | null;
72
+ /** Why it is muted. Worth a sentence: a silent row with no reason is a trap. */
73
+ readonly note?: string;
74
+ readonly level?: IssueLevel;
75
+ }
76
+
77
+ /** What `reopen` is called with. */
78
+ export interface ReopenIssueInput {
79
+ readonly issueId: string;
80
+ readonly note?: string;
81
+ readonly level?: IssueLevel;
82
+ }
83
+
84
+ /** What `annotate` is called with — a note, with no change of status. */
85
+ export interface AnnotateIssueInput {
86
+ readonly issueId: string;
87
+ readonly note: string;
88
+ }
89
+
90
+ /** What {@link useIssueStatus} reports. */
91
+ export interface IssueStatusBag {
92
+ /** `POST /issues/{id}/fix` — close it with the release that claims it. */
93
+ readonly fix: UseMutationResult<Issue, StapelApiError, FixIssueInput>;
94
+ /** `PATCH {muted_until}` — known, accepted, quiet; the status is implied. */
95
+ readonly mute: UseMutationResult<Issue, StapelApiError, MuteIssueInput>;
96
+ /** `PATCH {status: "new"}` — back on the board, by a person's judgement. */
97
+ readonly reopen: UseMutationResult<Issue, StapelApiError, ReopenIssueInput>;
98
+ /** `PATCH {note}` — a sentence, with no claim about the status. */
99
+ readonly annotate: UseMutationResult<Issue, StapelApiError, AnnotateIssueInput>;
100
+ }
101
+
102
+ /**
103
+ * The write half of the tracker.
104
+ *
105
+ * Every mutation resolves to the issue the server saved, so a caller can show
106
+ * the row it now is rather than the row it asked for — the two differ whenever
107
+ * something else moved the issue between the read and the click.
108
+ */
109
+ export function useIssueStatus(): IssueStatusBag {
110
+ const api = useAlertsApi();
111
+ const analytics = useAlertsAnalytics();
112
+ const queryClient = useQueryClient();
113
+
114
+ const invalidate = (): void => {
115
+ void queryClient.invalidateQueries({ queryKey: alertsQueryKeys.issues });
116
+ };
117
+
118
+ const fix = useMutation<Issue, StapelApiError, FixIssueInput>({
119
+ mutationFn: (input) => {
120
+ // Both fields are optional upstream and both are RECORDED, so a blank
121
+ // one is not the same as an absent one: `version: ""` is a recorded
122
+ // claim of nothing. Trimmed HERE rather than in the dialog, because the
123
+ // wire contract belongs to the model layer and a host calling this hook
124
+ // directly gets the same discipline a skin does.
125
+ const version = trimmed(input.version);
126
+ const sha = trimmed(input.sha);
127
+ return api.fixIssue(input.issueId, {
128
+ ...(version !== undefined ? { version } : {}),
129
+ ...(sha !== undefined ? { sha } : {}),
130
+ });
131
+ },
132
+ onSuccess: (_issue, input) => {
133
+ analytics?.track(ALERTS_EVENTS.issueFixed, {
134
+ ...(input.level !== undefined ? { level: input.level } : {}),
135
+ });
136
+ invalidate();
137
+ },
138
+ });
139
+
140
+ const mute = useMutation<Issue, StapelApiError, MuteIssueInput>({
141
+ mutationFn: (input) => {
142
+ const note = trimmed(input.note);
143
+ return api.patchIssue(input.issueId, {
144
+ muted_until: input.mutedUntil,
145
+ ...(note !== undefined ? { note } : {}),
146
+ });
147
+ },
148
+ onSuccess: (_issue, input) => {
149
+ analytics?.track(ALERTS_EVENTS.issueMuted, {
150
+ ...(input.level !== undefined ? { level: input.level } : {}),
151
+ hasDeadline: input.mutedUntil !== null,
152
+ });
153
+ invalidate();
154
+ },
155
+ });
156
+
157
+ const reopen = useMutation<Issue, StapelApiError, ReopenIssueInput>({
158
+ mutationFn: (input) => {
159
+ const note = trimmed(input.note);
160
+ return api.patchIssue(input.issueId, {
161
+ status: "new",
162
+ ...(note !== undefined ? { note } : {}),
163
+ });
164
+ },
165
+ onSuccess: (_issue, input) => {
166
+ analytics?.track(ALERTS_EVENTS.issueReopened, {
167
+ ...(input.level !== undefined ? { level: input.level } : {}),
168
+ });
169
+ invalidate();
170
+ },
171
+ });
172
+
173
+ const annotate = useMutation<Issue, StapelApiError, AnnotateIssueInput>({
174
+ mutationFn: (input) => api.patchIssue(input.issueId, { note: input.note }),
175
+ onSuccess: invalidate,
176
+ });
177
+
178
+ return { fix, mute, reopen, annotate };
179
+ }
@@ -0,0 +1,76 @@
1
+ /**
2
+ * `@stapel/alerts-react`'s contribution to the scripted-fullstack navigation
3
+ * contract (`@stapel/core`'s `NavEntry` / `PackageNavManifest`).
4
+ *
5
+ * `scripts/gen-nav-manifest.mjs` reads `navEntries` below, stamps
6
+ * `package`/`version` from this package's own `package.json`, and writes
7
+ * `packages/alerts-react/nav-manifest.json` plus this package's slice of the
8
+ * monorepo's root aggregate. `resolveNav` (`@stapel/shell-react`) turns that
9
+ * aggregate plus a host's override file into the tree a shell renders and a
10
+ * container mounts routes from.
11
+ *
12
+ * ── Two entries, both under the admin area ────────────────────────────────
13
+ *
14
+ * `admin.root` is a CONTAINER-owned parent this pair does not declare (the
15
+ * `@stapel/gdpr-react` / `@stapel/moderation-react` precedent): stapel-tools
16
+ * synthesises it whenever an installed pair hangs a staff screen off it.
17
+ * `resolveNav` DROPS an orphaned submenu entry instead of throwing, so a host
18
+ * that installs this pair without an admin area gets a smaller menu rather
19
+ * than a broken build.
20
+ *
21
+ * ── The axis cannot say "staff", so the SCREEN says it ────────────────────
22
+ *
23
+ * `surface` has two values (`public` | `member`), and every route behind these
24
+ * entries is `IsStaffUser`. `member` is the truest available answer, and the
25
+ * door stays visible by default: `<IssuesFeed>` names the 403 by code
26
+ * (`isAlertsStaffOnly`) instead of drawing an empty triage table. A hidden
27
+ * door teaches nobody anything; an empty table teaches the wrong thing —
28
+ * "nothing is broken" is the one sentence an error tracker must never say by
29
+ * accident.
30
+ *
31
+ * ── The detail is a route, not a menu item ────────────────────────────────
32
+ *
33
+ * `admin.alerts-issue` mounts `<IssueDetail>` at `:issueId` under the feed.
34
+ * Nobody navigates to one issue from a menu — they arrive from a row, or from
35
+ * an `alerts:<issue-id>` reference in a commit message, which is the whole
36
+ * reason the id is stable. So it is `menuVisibleDefault: false`: the scaffold
37
+ * builds the route and nothing appears in the navigation.
38
+ */
39
+ import type { NavEntry } from "@stapel/core";
40
+
41
+ /** The container-owned admin area these screens hang from. */
42
+ export const ADMIN_ROOT_ID = "admin.root";
43
+
44
+ export const navEntries: readonly NavEntry[] = [
45
+ {
46
+ id: "admin.alerts",
47
+ labelKey: "alerts.nav.feed",
48
+ // The bell is the fleet's alarm glyph and is not taken inside the admin
49
+ // section (`BellOutlined` is notifications' — a MEMBER surface). An
50
+ // operator scanning an admin menu for "what is broken" looks for it.
51
+ icon: "BellOutlined",
52
+ route: { path: "alerts" },
53
+ component: { export: "IssuesFeed", subpath: "default" },
54
+ placement: { level: "submenu", parentId: ADMIN_ROOT_ID },
55
+ menuVisibleDefault: true,
56
+ requiresAuth: true,
57
+ surface: "member",
58
+ // Above moderation (20) and privacy (40): when something is on fire it is
59
+ // the first door an operator wants, and a menu is read top down.
60
+ order: 10,
61
+ },
62
+ {
63
+ id: "admin.alerts-issue",
64
+ labelKey: "alerts.nav.issue",
65
+ icon: "AuditOutlined",
66
+ // Relative to the parent's `alerts` segment — the container composes
67
+ // `alerts/:issueId`.
68
+ route: { path: ":issueId" },
69
+ component: { export: "IssueDetail", subpath: "default" },
70
+ placement: { level: "submenu", parentId: "admin.alerts" },
71
+ menuVisibleDefault: false,
72
+ requiresAuth: true,
73
+ surface: "member",
74
+ order: 11,
75
+ },
76
+ ];
package/tsconfig.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "_comment": "Self-contained on purpose: standalone-buildable per frontend-standard §7. Mirrors the root tsconfig.base.json settings.",
4
+ "compilerOptions": {
5
+ "target": "ES2022",
6
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
7
+ "module": "ESNext",
8
+ "moduleResolution": "bundler",
9
+ "jsx": "react-jsx",
10
+ "strict": true,
11
+ "noUncheckedIndexedAccess": true,
12
+ "noImplicitOverride": true,
13
+ "exactOptionalPropertyTypes": true,
14
+ "isolatedModules": true,
15
+ "isolatedDeclarations": true,
16
+ "verbatimModuleSyntax": true,
17
+ "declaration": true,
18
+ "declarationMap": true,
19
+ "sourceMap": true,
20
+ "skipLibCheck": true,
21
+ "forceConsistentCasingInFileNames": true,
22
+ "outDir": "dist",
23
+ "rootDir": "src"
24
+ },
25
+ "include": ["src"]
26
+ }