@debugkit/dashboard 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/client/assets/_authed-C29P68T-.js +1 -0
  2. package/dist/client/assets/_authed-D-dYbHoP.js +7 -0
  3. package/dist/client/assets/{charts-XyOWJI9T.js → charts--S1o8iId.js} +6 -6
  4. package/dist/client/assets/copy-button-BJkvWYRY.js +1 -0
  5. package/dist/client/assets/customers-Cwx5qEO1.js +1 -0
  6. package/dist/client/assets/endpoints-zz1TotR2.js +1 -0
  7. package/dist/client/assets/events._eventId-Bx6TfUjv.js +3 -0
  8. package/dist/client/assets/index-COHr_cc3.js +10 -0
  9. package/dist/client/assets/invite._token-DiDJMnQu.js +1 -0
  10. package/dist/client/assets/issues._fingerprint-Cv522h2j.js +1 -0
  11. package/dist/client/assets/login-CKkpc0t5.js +1 -0
  12. package/dist/client/assets/sessions._sessionId-B0NxM46y.js +1 -0
  13. package/dist/client/assets/settings-CIlF10MI.js +1 -0
  14. package/dist/client/assets/src-BKSiJUs3.js +3 -0
  15. package/dist/client/assets/styles-GAsMUS4-.css +2 -0
  16. package/dist/client/assets/team-BRuVQ2bU.js +1 -0
  17. package/dist/client/assets/timeline-BIGo9MCA.js +1 -0
  18. package/dist/client/assets/ui-CaEZB1j2.js +1 -0
  19. package/dist/client/assets/version-banner-VFvyqbPh.js +1 -0
  20. package/dist/server/assets/_authed-BJWDiF9i.js +92 -0
  21. package/dist/server/assets/{_authed-C-sIPXSO.js → _authed-X9u_5JUy.js} +318 -126
  22. package/dist/server/assets/_tanstack-start-manifest_v-C6vaeBdY.js +90 -0
  23. package/dist/server/assets/copy-button-D3RddzTw.js +52 -0
  24. package/dist/server/assets/customers-827fC5I3.js +163 -0
  25. package/dist/server/assets/{demo-BsMMDk_F.js → demo-DDNiXCgj.js} +29 -7
  26. package/dist/server/assets/{dynamodb-Zkk1-mgz.js → dynamodb-Cd4blXkh.js} +98 -17
  27. package/dist/server/assets/endpoints-_T0NSOyA.js +371 -0
  28. package/dist/server/assets/{queries-BJxX3Kjp.js → errors-Po4Tt5zd.js} +893 -66
  29. package/dist/server/assets/events._eventId-Dcsu4oVO.js +765 -0
  30. package/dist/server/assets/{firestore-C52q_vwM.js → firestore-c8Sz2Q4O.js} +26 -6
  31. package/dist/server/assets/{fns-DwGaMi8S.js → fns-BiUOnY1_.js} +27 -3
  32. package/dist/server/assets/fns-CVbk8Gf9.js +1310 -0
  33. package/dist/server/assets/{invite._token-xnpnkdRv.js → invite._token-7DjEeeaD.js} +3 -3
  34. package/dist/server/assets/{issues._fingerprint-e7ubdJf0.js → issues._fingerprint-vc9r3jgg.js} +89 -11
  35. package/dist/server/assets/{login-EopnOJXA.js → login-CwKAx9Bj.js} +3 -3
  36. package/dist/server/assets/{memory-BssaqdZm.js → memory-Bv4C8uyK.js} +431 -28
  37. package/dist/server/assets/router-Dk3XHn7B.js +512 -0
  38. package/dist/server/assets/sessions._sessionId-BvXxK9qF.js +264 -0
  39. package/dist/server/assets/{settings-CaJN69N6.js → settings-B9NLQjl1.js} +221 -5
  40. package/dist/server/assets/{src-D83GYTrp.js → src-oWPSAvXv.js} +1 -1
  41. package/dist/server/assets/{team-B1UcM1jA.js → team-Bsm2wFG0.js} +3 -3
  42. package/dist/server/assets/timeline-MDRNDhiA.js +132 -0
  43. package/dist/server/assets/{ui-BJokJdYa.js → ui-SAkSlP7f.js} +53 -13
  44. package/dist/server/assets/version-banner-nf-yZurq.js +106 -0
  45. package/dist/server/assets/versions-BOlL8jam.js +58 -0
  46. package/dist/server/server.js +41 -21
  47. package/package.json +4 -4
  48. package/dist/client/assets/_authed-BN39b-7H.js +0 -1
  49. package/dist/client/assets/_authed-CspAf0jN.js +0 -7
  50. package/dist/client/assets/index-Bfb2UOzB.js +0 -10
  51. package/dist/client/assets/invite._token-B4HN51-h.js +0 -1
  52. package/dist/client/assets/issues._fingerprint-BV1QrETY.js +0 -1
  53. package/dist/client/assets/login-COlvJ5Je.js +0 -1
  54. package/dist/client/assets/preload-helper-Dscj_TcA.js +0 -3
  55. package/dist/client/assets/settings-Dl4EWeWC.js +0 -1
  56. package/dist/client/assets/styles-DztngwT9.css +0 -2
  57. package/dist/client/assets/team-7Zekz_Er.js +0 -1
  58. package/dist/client/assets/ui-C0HGOza2.js +0 -1
  59. package/dist/server/assets/_authed-CrjuC0O3.js +0 -73
  60. package/dist/server/assets/_tanstack-start-manifest_v-CqaE4wze.js +0 -61
  61. package/dist/server/assets/fns-mbUIXXep.js +0 -529
  62. package/dist/server/assets/router-G99085_Q.js +0 -315
@@ -0,0 +1,264 @@
1
+ import { t as CopyButton } from "./copy-button-D3RddzTw.js";
2
+ import { a as joined, i as clock, n as ICON, r as OutcomeBadge, s as roundedSpan, t as CrumbBody } from "./timeline-MDRNDhiA.js";
3
+ import { t as Card } from "./ui-SAkSlP7f.js";
4
+ import { n as Route } from "./router-Dk3XHn7B.js";
5
+ import { Link } from "@tanstack/react-router";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ // src/routes/_authed/sessions.$sessionId.tsx?tsr-split=component
8
+ function SessionPage() {
9
+ const { session: s, missingIndex } = Route.useLoaderData();
10
+ if (!s) return /* @__PURE__ */ jsxs("main", {
11
+ className: "mx-auto max-w-3xl px-4 py-10 sm:px-6",
12
+ children: [/* @__PURE__ */ jsx("h1", {
13
+ className: "text-xl font-semibold",
14
+ children: "This session can't be read yet"
15
+ }), /* @__PURE__ */ jsx("p", {
16
+ className: "mt-2 text-sm text-muted",
17
+ children: missingIndex && "Firestore needs deBug's new index on events (sessionId, ts). Deploy it with: firebase deploy --only firestore:indexes, using deBug's firestore.indexes.json. It takes a few minutes to build."
18
+ })]
19
+ });
20
+ const customer = s.user.id;
21
+ return /* @__PURE__ */ jsxs("main", {
22
+ className: "mx-auto max-w-5xl space-y-5 px-4 py-6 sm:px-6",
23
+ children: [
24
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("p", {
25
+ className: "text-xs uppercase tracking-wide text-muted",
26
+ title: "From the earliest step recorded to the last stored event. The session may have started earlier and gone on after.",
27
+ children: [
28
+ "Session · recorded ",
29
+ clock(s.start),
30
+ " to ",
31
+ clock(s.end),
32
+ " · ",
33
+ duration(s.start, s.end)
34
+ ]
35
+ }), /* @__PURE__ */ jsxs("div", {
36
+ className: "mt-1 flex flex-wrap items-center gap-3",
37
+ children: [
38
+ /* @__PURE__ */ jsx("h1", {
39
+ className: "text-xl font-semibold tracking-tight",
40
+ children: customer ? /* @__PURE__ */ jsx("span", {
41
+ className: "break-all font-mono",
42
+ children: customer
43
+ }) : "Not signed in"
44
+ }),
45
+ /* @__PURE__ */ jsx(OutcomeBadge, { outcome: s.outcome }),
46
+ (customer || s.user.anonymousId) && /* @__PURE__ */ jsx(Link, {
47
+ to: "/customers",
48
+ search: {
49
+ app: s.app,
50
+ q: customer ?? s.user.anonymousId
51
+ },
52
+ className: "text-sm text-accent hover:underline",
53
+ children: "All their sessions →"
54
+ })
55
+ ]
56
+ })] }),
57
+ /* @__PURE__ */ jsxs("section", {
58
+ "aria-label": "Device and app",
59
+ className: "flex flex-wrap items-center gap-x-6 gap-y-2 rounded-xl border border-line bg-panel px-4 py-3 text-sm",
60
+ children: [
61
+ /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("span", {
62
+ className: "text-muted",
63
+ children: "Device "
64
+ }), joined([s.context.device.brand, s.context.device.model]) ?? "—"] }),
65
+ /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("span", {
66
+ className: "text-muted",
67
+ children: "OS "
68
+ }), joined([s.context.os.name, s.context.os.version]) ?? "—"] }),
69
+ /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("span", {
70
+ className: "text-muted",
71
+ children: "App "
72
+ }), joined([s.context.app.version, s.context.app.build && `(${s.context.app.build})`]) ?? "—"] }),
73
+ /* @__PURE__ */ jsxs("span", { children: [
74
+ /* @__PURE__ */ jsx("span", {
75
+ className: "text-muted",
76
+ children: "Errors "
77
+ }),
78
+ s.counts.errors,
79
+ s.counts.handled > 0 && /* @__PURE__ */ jsxs("span", {
80
+ className: "text-muted",
81
+ children: [
82
+ " (",
83
+ s.counts.handled,
84
+ " caught by the app)"
85
+ ]
86
+ })
87
+ ] }),
88
+ /* @__PURE__ */ jsxs("span", { children: [
89
+ /* @__PURE__ */ jsx("span", {
90
+ className: "text-muted",
91
+ children: "Session "
92
+ }),
93
+ /* @__PURE__ */ jsx("span", {
94
+ className: "break-all font-mono text-xs",
95
+ children: s.sessionId
96
+ }),
97
+ /* @__PURE__ */ jsx("span", {
98
+ className: "ml-2",
99
+ children: /* @__PURE__ */ jsx(CopyButton, {
100
+ text: s.sessionId,
101
+ label: "Copy",
102
+ ariaLabel: "Copy session id"
103
+ })
104
+ })
105
+ ] }),
106
+ s.user.anonymousId && /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("span", {
107
+ className: "text-muted",
108
+ children: "Install "
109
+ }), /* @__PURE__ */ jsx("span", {
110
+ className: "break-all font-mono text-xs",
111
+ children: s.user.anonymousId
112
+ })] }),
113
+ customer && /* @__PURE__ */ jsx("span", {
114
+ className: "ml-auto",
115
+ children: /* @__PURE__ */ jsx(CopyButton, {
116
+ text: customer,
117
+ label: "Copy customer",
118
+ ariaLabel: "Copy customer id"
119
+ })
120
+ })
121
+ ]
122
+ }),
123
+ /* @__PURE__ */ jsxs(Card, {
124
+ title: "Timeline",
125
+ subtitle: "Screens, taps, API calls, flow steps and errors in this session, in order. Times are from the device, from the session's start.",
126
+ children: [
127
+ /* @__PURE__ */ jsx("ol", {
128
+ className: "space-y-1.5",
129
+ children: s.rows.map((r, i) => /* @__PURE__ */ jsx(Row, {
130
+ row: r,
131
+ app: s.app,
132
+ start: s.start
133
+ }, r.kind === "crumb" ? `c${i}` : r.eventId))
134
+ }),
135
+ s.truncated && /* @__PURE__ */ jsxs("p", {
136
+ className: "mt-3 text-xs text-muted",
137
+ children: [
138
+ "Showing the newest ",
139
+ s.read,
140
+ " events of this session; older ones are left out."
141
+ ]
142
+ }),
143
+ /* @__PURE__ */ jsx("p", {
144
+ className: "mt-3 text-xs text-muted",
145
+ children: "Screens, taps and API calls come from the trail each error carries, so what happened after the last error isn't shown, and the trail before an error goes back as far as the SDK's breadcrumb limit."
146
+ })
147
+ ]
148
+ })
149
+ ]
150
+ });
151
+ }
152
+ function Row({ row, app, start }) {
153
+ const at = /* @__PURE__ */ jsx("span", {
154
+ className: "tabular pt-0.5 text-right text-xs text-muted",
155
+ title: row.ts,
156
+ children: since(row.ts, start)
157
+ });
158
+ const cls = "grid grid-cols-[4.5rem_1.25rem_1fr] gap-2 rounded-md px-2 py-1.5 text-sm";
159
+ if (row.kind === "crumb") {
160
+ const t = row.item;
161
+ return /* @__PURE__ */ jsxs("li", {
162
+ className: `${cls} ${t.failed ? "bg-sev-critical/10" : t.level === "warning" ? "bg-sev-medium/10" : ""}`,
163
+ children: [
164
+ at,
165
+ /* @__PURE__ */ jsx("span", {
166
+ "aria-hidden": true,
167
+ className: `pt-0.5 text-center ${t.failed ? "text-sev-critical" : "text-muted"}`,
168
+ children: ICON[t.category]
169
+ }),
170
+ /* @__PURE__ */ jsxs("div", {
171
+ className: "min-w-0",
172
+ children: [/* @__PURE__ */ jsx(CrumbBody, { item: t }), /* @__PURE__ */ jsx(SourceLink, {
173
+ source: row.source,
174
+ app
175
+ })]
176
+ })
177
+ ]
178
+ });
179
+ }
180
+ if (row.kind === "event") return /* @__PURE__ */ jsxs("li", {
181
+ className: `${cls} ${row.failed ? "bg-sev-medium/10" : ""}`,
182
+ children: [
183
+ at,
184
+ /* @__PURE__ */ jsx("span", {
185
+ "aria-hidden": true,
186
+ className: `pt-0.5 text-center ${row.failed ? "text-sev-high" : "text-muted"}`,
187
+ children: "◆"
188
+ }),
189
+ /* @__PURE__ */ jsxs("div", {
190
+ className: "min-w-0",
191
+ children: [
192
+ /* @__PURE__ */ jsx("span", {
193
+ className: "mr-2 rounded bg-panel-2 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-muted",
194
+ children: "flow"
195
+ }),
196
+ /* @__PURE__ */ jsx("span", {
197
+ className: `break-words ${row.failed ? "font-medium" : ""}`,
198
+ children: row.detail
199
+ }),
200
+ /* @__PURE__ */ jsx(SourceLink, {
201
+ source: row.source,
202
+ app
203
+ })
204
+ ]
205
+ })
206
+ ]
207
+ });
208
+ return /* @__PURE__ */ jsxs("li", {
209
+ className: `${cls} ${row.handled ? "bg-sev-critical/10" : "bg-sev-critical/20"} font-medium text-sev-critical`,
210
+ children: [
211
+ at,
212
+ /* @__PURE__ */ jsx("span", {
213
+ "aria-hidden": true,
214
+ className: "pt-0.5 text-center",
215
+ children: "✕"
216
+ }),
217
+ /* @__PURE__ */ jsxs("div", {
218
+ className: "min-w-0",
219
+ children: [/* @__PURE__ */ jsx("span", {
220
+ className: "mr-2 rounded bg-sev-critical px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-white",
221
+ children: row.crash ? "crash" : row.handled ? "error" : "uncaught"
222
+ }), row.fingerprint ? /* @__PURE__ */ jsx(Link, {
223
+ to: "/events/$eventId",
224
+ params: { eventId: row.eventId },
225
+ search: {
226
+ app,
227
+ issue: row.fingerprint
228
+ },
229
+ className: "break-words hover:underline",
230
+ children: row.title
231
+ }) : /* @__PURE__ */ jsx("span", {
232
+ className: "break-words",
233
+ children: row.title
234
+ })]
235
+ })
236
+ ]
237
+ });
238
+ }
239
+ /** Opens the error whose trail holds this row, where the steps around it are shown. */
240
+ function SourceLink({ source, app }) {
241
+ if (!source) return null;
242
+ return /* @__PURE__ */ jsx(Link, {
243
+ to: "/events/$eventId",
244
+ params: { eventId: source.eventId },
245
+ search: {
246
+ app,
247
+ issue: source.fingerprint
248
+ },
249
+ className: "ml-2 whitespace-nowrap text-xs text-muted hover:text-ink hover:underline",
250
+ title: "Open the error this step led to",
251
+ children: "in error →"
252
+ });
253
+ }
254
+ /** "+1:05" from the session's start; the first row is "+0:00". */
255
+ function since(ts, start) {
256
+ const s = Math.max(0, Math.round((Date.parse(ts) - Date.parse(start)) / 1e3));
257
+ return s >= 3600 ? `+${Math.floor(s / 3600)}:${pad(Math.floor(s / 60) % 60)}:${pad(s % 60)}` : `+${Math.floor(s / 60)}:${pad(s % 60)}`;
258
+ }
259
+ function duration(start, end) {
260
+ const s = Math.max(0, (Date.parse(end) - Date.parse(start)) / 1e3);
261
+ return s < .05 ? "0 s" : roundedSpan(s);
262
+ }
263
+ var pad = (n) => String(n).padStart(2, "0");
264
+ export { SessionPage as component };
@@ -1,6 +1,8 @@
1
- import { t as Card } from "./ui-BJokJdYa.js";
2
- import { _ as sendTestAlert, g as saveRetention, h as saveAppSettings, m as restampExisting } from "./fns-DwGaMi8S.js";
3
- import { a as Route } from "./router-G99085_Q.js";
1
+ import { E as OWNER_INFO, T as OWNERS, b as normaliseHostMatch } from "./memory-Bv4C8uyK.js";
2
+ import { l as timeAgo, t as Card } from "./ui-SAkSlP7f.js";
3
+ import { i as partText, r as useVersionStatus, t as UpgradeCommand } from "./version-banner-nf-yZurq.js";
4
+ import { S as sendTestAlert, b as saveAppSettings, x as saveRetention, y as restampExisting } from "./fns-BiUOnY1_.js";
5
+ import { s as Route } from "./router-Dk3XHn7B.js";
4
6
  import { useState } from "react";
5
7
  import { useNavigate, useRouter } from "@tanstack/react-router";
6
8
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -13,7 +15,8 @@ var CHOICES = [
13
15
  365
14
16
  ];
15
17
  function SettingsPage() {
16
- const { apps, settings } = Route.useLoaderData();
18
+ const { apps, settings, seenHosts } = Route.useLoaderData();
19
+ const versions = useVersionStatus();
17
20
  const navigate = useNavigate({ from: Route.fullPath });
18
21
  const router = useRouter();
19
22
  const [days, setDays] = useState(String(settings?.retentionDays ?? 60));
@@ -96,6 +99,7 @@ function SettingsPage() {
96
99
  children: apps.map((a) => /* @__PURE__ */ jsx("option", { children: a }, a))
97
100
  })]
98
101
  }),
102
+ versions && /* @__PURE__ */ jsx(VersionsCard, { status: versions }),
99
103
  /* @__PURE__ */ jsxs(Card, {
100
104
  title: "Data retention",
101
105
  subtitle: "Your data lives in your own database, so you decide how long to keep it.",
@@ -211,7 +215,13 @@ function SettingsPage() {
211
215
  canEdit && /* @__PURE__ */ jsx(FlowsAndAlerts, {
212
216
  settings,
213
217
  onStatus: setStatus
214
- }, settings.app + (settings.updatedAt ?? "")),
218
+ }, settings.app + JSON.stringify([settings.criticalFlows, settings.alerts])),
219
+ canEdit && /* @__PURE__ */ jsx(HostNames, {
220
+ app: settings.app,
221
+ hosts: settings.hosts,
222
+ seen: seenHosts,
223
+ onStatus: setStatus
224
+ }, settings.app + JSON.stringify(settings.hosts)),
215
225
  status && /* @__PURE__ */ jsx("p", {
216
226
  role: "status",
217
227
  className: `rounded-lg border px-3 py-2 text-sm ${status.tone === "error" ? "border-sev-critical text-sev-critical" : status.tone === "ok" ? "border-line bg-panel-2" : "border-line text-muted"}`,
@@ -368,4 +378,210 @@ function FlowsAndAlerts({ settings, onStatus }) {
368
378
  })
369
379
  ] });
370
380
  }
381
+ /** Owners a host can be given; leaving it unset lets the classifier decide. */
382
+ var HOST_OWNERS = OWNERS.filter((o) => o !== "unknown");
383
+ function HostNames({ app, hosts, seen, onStatus }) {
384
+ const router = useRouter();
385
+ const [nextId, setNextId] = useState(hosts.length + 1);
386
+ const [rows, setRows] = useState(() => hosts.length ? hosts.map((h, i) => ({
387
+ id: i,
388
+ match: h.match,
389
+ name: h.name,
390
+ owner: h.owner ?? ""
391
+ })) : [{
392
+ id: 0,
393
+ match: "",
394
+ name: "",
395
+ owner: ""
396
+ }]);
397
+ const [busy, setBusy] = useState(false);
398
+ const named = new Set(rows.map((r) => normaliseHostMatch(r.match)));
399
+ const unnamed = seen.filter((h) => !named.has(h));
400
+ const update = (id, patch) => setRows((rs) => rs.map((r) => r.id === id ? {
401
+ ...r,
402
+ ...patch
403
+ } : r));
404
+ const add = (match = "") => {
405
+ setRows((rs) => [...rs.filter((r) => r.match || r.name), {
406
+ id: nextId,
407
+ match,
408
+ name: "",
409
+ owner: ""
410
+ }]);
411
+ setNextId((n) => n + 1);
412
+ };
413
+ const save = async () => {
414
+ setBusy(true);
415
+ onStatus(null);
416
+ const out = await saveAppSettings({ data: {
417
+ app,
418
+ hosts: rows.map((r) => ({
419
+ match: r.match,
420
+ name: r.name,
421
+ ...r.owner ? { owner: r.owner } : {}
422
+ }))
423
+ } }).catch((e) => ({
424
+ ok: false,
425
+ error: e.message
426
+ }));
427
+ setBusy(false);
428
+ if (!out.ok) return onStatus({
429
+ tone: "error",
430
+ text: out.error
431
+ });
432
+ onStatus({
433
+ tone: "ok",
434
+ text: "Saved. Names show straight away; owners apply to new errors within about a minute, and to existing issues now."
435
+ });
436
+ await router.invalidate();
437
+ };
438
+ const box = "rounded-md border border-line bg-panel px-2 py-1.5 text-sm";
439
+ return /* @__PURE__ */ jsx(Card, {
440
+ title: "Host names",
441
+ subtitle: "Give the servers your app calls a name people recognise, and say who looks after each one.",
442
+ children: /* @__PURE__ */ jsxs("div", {
443
+ className: "space-y-3",
444
+ children: [
445
+ rows.map((r, i) => /* @__PURE__ */ jsxs("div", {
446
+ role: "group",
447
+ "aria-label": `Host ${i + 1}`,
448
+ className: "grid gap-2 rounded-lg border border-line p-3 sm:grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)_auto_auto] sm:items-end sm:border-0 sm:p-0",
449
+ children: [
450
+ /* @__PURE__ */ jsxs("label", {
451
+ className: "min-w-0 text-xs text-muted",
452
+ children: ["Host, or host and path", /* @__PURE__ */ jsx("input", {
453
+ value: r.match,
454
+ onChange: (e) => update(r.id, { match: e.target.value }),
455
+ list: "seen-hosts",
456
+ placeholder: "api.example.com/payments",
457
+ className: `mt-1 w-full font-mono text-xs text-ink ${box}`
458
+ })]
459
+ }),
460
+ /* @__PURE__ */ jsxs("label", {
461
+ className: "min-w-0 text-xs text-muted",
462
+ children: ["Name", /* @__PURE__ */ jsx("input", {
463
+ value: r.name,
464
+ onChange: (e) => update(r.id, { name: e.target.value }),
465
+ placeholder: "Balance service",
466
+ maxLength: 60,
467
+ className: `mt-1 w-full text-ink ${box}`
468
+ })]
469
+ }),
470
+ /* @__PURE__ */ jsxs("label", {
471
+ className: "text-xs text-muted",
472
+ children: ["Looked after by", /* @__PURE__ */ jsxs("select", {
473
+ value: r.owner,
474
+ onChange: (e) => update(r.id, { owner: e.target.value }),
475
+ className: `mt-1 w-full text-ink ${box}`,
476
+ children: [/* @__PURE__ */ jsx("option", {
477
+ value: "",
478
+ children: "Work it out"
479
+ }), HOST_OWNERS.map((o) => /* @__PURE__ */ jsx("option", {
480
+ value: o,
481
+ children: OWNER_INFO[o].name
482
+ }, o))]
483
+ })]
484
+ }),
485
+ /* @__PURE__ */ jsx("button", {
486
+ type: "button",
487
+ onClick: () => setRows((rs) => rs.filter((x) => x.id !== r.id)),
488
+ "aria-label": `Remove ${r.match || "this host"}`,
489
+ className: "justify-self-start rounded-md border border-line px-2.5 py-1.5 text-sm hover:bg-panel-2",
490
+ children: "Remove"
491
+ })
492
+ ]
493
+ }, r.id)),
494
+ /* @__PURE__ */ jsx("datalist", {
495
+ id: "seen-hosts",
496
+ children: unnamed.map((h) => /* @__PURE__ */ jsx("option", { value: h }, h))
497
+ }),
498
+ unnamed.length > 0 && /* @__PURE__ */ jsxs("div", {
499
+ className: "text-xs text-muted",
500
+ children: [/* @__PURE__ */ jsx("p", { children: "Called in the last 30 days and not named yet:" }), /* @__PURE__ */ jsx("div", {
501
+ className: "mt-1 flex flex-wrap gap-1.5",
502
+ children: unnamed.slice(0, 8).map((h) => /* @__PURE__ */ jsxs("button", {
503
+ type: "button",
504
+ onClick: () => add(h),
505
+ className: "max-w-full truncate rounded-md border border-line px-2 py-0.5 font-mono hover:bg-panel-2",
506
+ title: `Name ${h}`,
507
+ children: ["+ ", h]
508
+ }, h))
509
+ })]
510
+ }),
511
+ /* @__PURE__ */ jsx("p", {
512
+ className: "text-xs text-muted",
513
+ children: "A path names part of a host: api.example.com/payments covers /payments/… only; the longest match wins. The owner decides who server errors from that host are passed to."
514
+ }),
515
+ /* @__PURE__ */ jsxs("div", {
516
+ className: "flex flex-wrap gap-2",
517
+ children: [/* @__PURE__ */ jsx("button", {
518
+ type: "button",
519
+ onClick: () => add(),
520
+ className: "rounded-md border border-line px-3 py-1.5 text-sm hover:bg-panel-2",
521
+ children: "Add a host"
522
+ }), /* @__PURE__ */ jsx("button", {
523
+ type: "button",
524
+ onClick: () => void save(),
525
+ disabled: busy,
526
+ className: "rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-white disabled:opacity-40",
527
+ children: "Save host names"
528
+ })]
529
+ })
530
+ ]
531
+ })
532
+ });
533
+ }
534
+ /** Only ingest or the dashboard a patch behind: nothing is missing yet. */
535
+ var patchOnly = (s) => s.level === "note" && s.behind.some((p) => p.part !== "sdk");
536
+ var upperFirst = (s) => s.charAt(0).toUpperCase() + s.slice(1);
537
+ var PART_LABEL = {
538
+ sdk: "App SDK (newest seen)",
539
+ ingest: "Ingest",
540
+ dashboard: "This dashboard"
541
+ };
542
+ /** The project's deBug versions, and what to run when one is behind. */
543
+ function VersionsCard({ status }) {
544
+ const behind = new Set(status.behind.map((p) => p.part));
545
+ return /* @__PURE__ */ jsxs(Card, {
546
+ title: "deBug versions",
547
+ subtitle: "Your app's SDK, your ingest and this dashboard are released together and work best on the same version.",
548
+ children: [/* @__PURE__ */ jsx("dl", {
549
+ className: "grid grid-cols-[minmax(8rem,auto)_1fr] gap-x-4 gap-y-1.5 text-sm",
550
+ children: status.parts.map((p) => /* @__PURE__ */ jsxs("div", {
551
+ className: "contents",
552
+ children: [/* @__PURE__ */ jsx("dt", {
553
+ className: "text-muted",
554
+ children: PART_LABEL[p.part]
555
+ }), /* @__PURE__ */ jsxs("dd", {
556
+ className: behind.has(p.part) ? "font-medium text-sev-high" : "",
557
+ children: [p.version ?? (p.part === "sdk" ? "not seen yet" : "predates version tracking"), p.at && /* @__PURE__ */ jsxs("span", {
558
+ className: "ml-2 text-xs text-muted",
559
+ title: p.at,
560
+ children: [
561
+ p.part === "sdk" ? "seen" : "recorded",
562
+ " ",
563
+ timeAgo(p.at)
564
+ ]
565
+ })]
566
+ })]
567
+ }, p.part))
568
+ }), status.level === "none" ? /* @__PURE__ */ jsx("p", {
569
+ className: "mt-3 text-xs text-muted",
570
+ children: "All in step."
571
+ }) : /* @__PURE__ */ jsxs("div", {
572
+ className: "mt-3 space-y-2 text-sm",
573
+ children: [/* @__PURE__ */ jsxs("p", {
574
+ className: status.level === "banner" ? "" : "text-muted",
575
+ children: [upperFirst(status.behind.map(partText).join(" and ")), patchOnly(status) ? `: a patch behind ${status.newest}, so nothing's missing, but worth catching up.` : `, behind ${status.newest}.`]
576
+ }), status.behind.some((p) => p.part !== "sdk") ? /* @__PURE__ */ jsx(UpgradeCommand, { status }) : /* @__PURE__ */ jsxs("p", {
577
+ className: "text-xs text-muted",
578
+ children: [
579
+ "Update @debugkit/sdk in your app to ",
580
+ status.newest,
581
+ "."
582
+ ]
583
+ })]
584
+ })]
585
+ });
586
+ }
371
587
  export { SettingsPage as component };
@@ -1,4 +1,4 @@
1
- import "./memory-BssaqdZm.js";
1
+ import "./memory-Bv4C8uyK.js";
2
2
  // ../../packages/adapters/src/index.ts
3
3
  var MAX_RETENTION_DAYS = 3650;
4
4
  var TEAM_ROLES = [
@@ -1,6 +1,6 @@
1
- import { c as timeAgo, t as Card } from "./ui-BJokJdYa.js";
2
- import { l as inviteToTeam, p as removeFromTeam, t as cancelInvite, v as setMemberRole } from "./fns-DwGaMi8S.js";
3
- import { i as Route } from "./router-G99085_Q.js";
1
+ import { l as timeAgo, t as Card } from "./ui-SAkSlP7f.js";
2
+ import { C as setMemberRole, m as inviteToTeam, t as cancelInvite, v as removeFromTeam } from "./fns-BiUOnY1_.js";
3
+ import { o as Route } from "./router-Dk3XHn7B.js";
4
4
  import { useState } from "react";
5
5
  import { useRouter } from "@tanstack/react-router";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -0,0 +1,132 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ // src/components/timeline.tsx
3
+ var OUTCOME = {
4
+ crashed: {
5
+ label: "Crashed",
6
+ title: "A fatal error ended the app.",
7
+ className: "bg-sev-critical text-white"
8
+ },
9
+ errored: {
10
+ label: "Errored",
11
+ title: "An error the app didn't catch, but no crash.",
12
+ className: "bg-sev-high text-white"
13
+ },
14
+ clean: {
15
+ label: "Clean",
16
+ title: "No crash and no uncaught errors. Errors the app caught are counted apart.",
17
+ className: "border border-line text-muted"
18
+ }
19
+ };
20
+ /** A session's outcome: crashed, errored or clean. */
21
+ function OutcomeBadge({ outcome }) {
22
+ const o = OUTCOME[outcome];
23
+ return /* @__PURE__ */ jsx("span", {
24
+ title: o.title,
25
+ className: `whitespace-nowrap rounded px-1.5 py-0.5 text-[11px] font-semibold uppercase tracking-wide ${o.className}`,
26
+ children: o.label
27
+ });
28
+ }
29
+ /** One glyph per breadcrumb category, next to its label. */
30
+ var ICON = {
31
+ navigation: "→",
32
+ network: "⇅",
33
+ ui: "◉",
34
+ log: "≡",
35
+ event: "◆",
36
+ custom: "✱"
37
+ };
38
+ /** A breadcrumb's text: the API call it describes, or its message, plus a repeat count and extra data. */
39
+ function CrumbBody({ item }) {
40
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
41
+ /* @__PURE__ */ jsx("span", {
42
+ className: "mr-2 rounded bg-panel-2 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-muted",
43
+ children: item.category
44
+ }),
45
+ item.api ? /* @__PURE__ */ jsx(ApiLine, { call: item.api }) : /* @__PURE__ */ jsx("span", {
46
+ className: "break-words",
47
+ children: item.message
48
+ }),
49
+ item.repeated && /* @__PURE__ */ jsxs("span", {
50
+ className: "ml-2 text-xs text-muted",
51
+ children: ["×", item.repeated]
52
+ }),
53
+ item.data && /* @__PURE__ */ jsx("div", {
54
+ className: "mt-0.5 break-words font-mono text-[11px] text-muted",
55
+ children: Object.entries(item.data).map(([k, v]) => `${k}=${String(v)}`).join(" · ")
56
+ })
57
+ ] });
58
+ }
59
+ function ApiLine({ call }) {
60
+ return /* @__PURE__ */ jsxs("span", {
61
+ className: "break-words",
62
+ children: [
63
+ call.service && /* @__PURE__ */ jsxs("span", {
64
+ className: "font-medium",
65
+ children: [call.service, " "]
66
+ }),
67
+ /* @__PURE__ */ jsx("span", {
68
+ className: "font-mono text-xs",
69
+ children: joined([call.method, call.path])
70
+ }),
71
+ " → ",
72
+ /* @__PURE__ */ jsx("span", {
73
+ className: call.failed ? "font-semibold text-sev-critical" : "",
74
+ children: call.status ?? call.outcome ?? "failed"
75
+ }),
76
+ call.status !== void 0 && call.outcome && call.outcome !== "answered" && /* @__PURE__ */ jsxs("span", {
77
+ className: "text-muted",
78
+ children: [
79
+ " (",
80
+ call.outcome,
81
+ ")"
82
+ ]
83
+ }),
84
+ call.durationMs !== void 0 && /* @__PURE__ */ jsxs("span", {
85
+ className: "text-muted",
86
+ children: [
87
+ " · ",
88
+ call.durationMs,
89
+ " ms"
90
+ ]
91
+ }),
92
+ call.errorKind && /* @__PURE__ */ jsxs("span", {
93
+ className: "text-muted",
94
+ children: [" · ", call.errorKind]
95
+ }),
96
+ call.backendCode && /* @__PURE__ */ jsxs("span", {
97
+ className: "text-muted",
98
+ children: [" · ", call.backendCode]
99
+ })
100
+ ]
101
+ });
102
+ }
103
+ /** The parts that are set, joined; undefined when none are. */
104
+ function joined(parts, sep = " ") {
105
+ return parts.filter(Boolean).join(sep) || void 0;
106
+ }
107
+ /** "14 Nov, 12:59:55" in the viewer's time zone. */
108
+ function clock(iso) {
109
+ return new Date(iso).toLocaleString(void 0, {
110
+ day: "numeric",
111
+ month: "short",
112
+ hour: "2-digit",
113
+ minute: "2-digit",
114
+ second: "2-digit"
115
+ });
116
+ }
117
+ /** How long before the error: "−5.9 s", "−2 min". */
118
+ function offset(ts, errorTs) {
119
+ const s = (Date.parse(ts) - Date.parse(errorTs)) / 1e3;
120
+ if (!Number.isFinite(s)) return "";
121
+ const a = Math.abs(s);
122
+ if (a < .05) return "0 s";
123
+ return `${s < 0 ? "−" : "+"}${roundedSpan(a)}`;
124
+ }
125
+ /** A span of seconds in one unit: "5.9 s", "42 s", "2 min", "3 h". */
126
+ function roundedSpan(a) {
127
+ if (a < 9.95) return `${a.toFixed(1)} s`;
128
+ if (Math.round(a) < 60) return `${Math.round(a)} s`;
129
+ if (Math.round(a / 60) < 60) return `${Math.round(a / 60)} min`;
130
+ return `${Math.round(a / 3600)} h`;
131
+ }
132
+ export { joined as a, clock as i, ICON as n, offset as o, OutcomeBadge as r, roundedSpan as s, CrumbBody as t };