@hot-updater/console 1.0.0-rc.2 → 1.0.0-rc.4

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 (126) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/InsightsPageHeader-C-Xc2MB9.js +1 -0
  3. package/.output/public/assets/api-keys-C1sgC6ko.js +1 -0
  4. package/.output/public/assets/{api-keys-api-BHcODB7q.js → api-keys-api-LchP65vQ.js} +1 -1
  5. package/.output/public/assets/badge-BuMDU0Rf.js +1 -0
  6. package/.output/public/assets/card-BEvx_QKh.js +1 -0
  7. package/.output/public/assets/{chart-no-axes-combined-Dy4WJv2U.js → chart-no-axes-combined-C0G0fQ3J.js} +1 -1
  8. package/.output/public/assets/{composite-Bp98A0Ld.js → composite-CHTH1Xhh.js} +1 -1
  9. package/.output/public/assets/createServerFn-DHc2erub.js +3 -0
  10. package/.output/public/assets/dialog-dyZ1SphZ.js +1 -0
  11. package/.output/public/assets/{dist-C_NydL0e.js → dist-Bh1gaDfB.js} +1 -1
  12. package/.output/public/assets/field-79SVH26s.js +1 -0
  13. package/.output/public/assets/index-BNkxg4jz.js +10 -0
  14. package/.output/public/assets/input-group-BbHfaBzQ.js +1 -0
  15. package/.output/public/assets/insights-D_7uSKfc.js +1 -0
  16. package/.output/public/assets/installations-BzoHWuXw.js +1 -0
  17. package/.output/public/assets/{installations-CE33wgbY.js → installations-DvjbUqd1.js} +2 -2
  18. package/.output/public/assets/{lazyRouteComponent-Ccp3bwBY.js → lazyRouteComponent-BN0MS05o.js} +1 -1
  19. package/.output/public/assets/{link-CI8idAUi.js → link-BG06whwB.js} +1 -1
  20. package/.output/public/assets/{loader-circle-BoxLrsOu.js → loader-circle-Bbp8LGVC.js} +1 -1
  21. package/.output/public/assets/{refresh-cw-Bqc72UZG.js → refresh-cw-DZgiAOMk.js} +1 -1
  22. package/.output/public/assets/routes-BFE-oRIT.js +1 -0
  23. package/.output/public/assets/{routes-DGVXdzpw.js → routes-DaPMY31P.js} +2 -2
  24. package/.output/public/assets/{shield-check-uK3MHWJZ.js → shield-check-DoIiaaXU.js} +1 -1
  25. package/.output/public/assets/signing-BTRhaF5D.js +1 -0
  26. package/.output/public/assets/styles-C7U0oVke.css +2 -0
  27. package/.output/public/assets/table-BBEzJ7Xl.js +1 -0
  28. package/.output/public/assets/useCompositeListItem-BkPDaqyj.js +42 -0
  29. package/.output/server/{__23tanstack-start-server-fn-resolver-B7ioJhtE.mjs → __23tanstack-start-server-fn-resolver-Dr2ixDgQ.mjs} +40 -32
  30. package/.output/server/_libs/@base-ui/react+[...].mjs +1 -1
  31. package/.output/server/_libs/@reduxjs/toolkit+[...].mjs +1554 -0
  32. package/.output/server/_libs/@tanstack/react-router+[...].mjs +1 -1
  33. package/.output/server/_libs/@tanstack/react-router-ssr-query+[...].mjs +1 -1
  34. package/.output/server/_libs/d3-array.mjs +231 -0
  35. package/.output/server/_libs/d3-color.mjs +330 -0
  36. package/.output/server/_libs/d3-format.mjs +252 -0
  37. package/.output/server/_libs/d3-interpolate.mjs +207 -0
  38. package/.output/server/_libs/d3-path.mjs +77 -0
  39. package/.output/server/_libs/d3-scale+[...].mjs +1907 -0
  40. package/.output/server/_libs/d3-shape.mjs +818 -0
  41. package/.output/server/_libs/decimal.js-light.mjs +884 -0
  42. package/.output/server/_libs/es-toolkit.mjs +1159 -0
  43. package/.output/server/_libs/eventemitter3.mjs +236 -0
  44. package/.output/server/_libs/immer.mjs +532 -0
  45. package/.output/server/_libs/lucide-react.mjs +9 -2
  46. package/.output/server/_libs/next-themes.mjs +1 -1
  47. package/.output/server/_libs/react-redux+[...].mjs +205 -0
  48. package/.output/server/_libs/recharts+[...].mjs +15054 -0
  49. package/.output/server/_libs/sonner.mjs +1 -1
  50. package/.output/server/_libs/tanstack__react-query.mjs +1 -1
  51. package/.output/server/_runtime.mjs +10 -1
  52. package/.output/server/_ssr/InsightsPageHeader-C5Has8Ry.mjs +60 -0
  53. package/.output/server/_ssr/{api-keys-CZeTPQys.mjs → api-keys-DJml_XoK.mjs} +10 -8
  54. package/.output/server/_ssr/{api-keys-api-BUPQVSpk.mjs → api-keys-api-CrCZyvnl.mjs} +2 -2
  55. package/.output/server/_ssr/{api-keys-rpc-Cs7tS5_j.mjs → api-keys-rpc-CFaNf-q0.mjs} +3 -3
  56. package/.output/server/_ssr/{api-rpc-tAupfGQm.mjs → api-rpc-B61KL3Eo.mjs} +25 -25
  57. package/.output/server/_ssr/{auth-rpc-DUaeOWKK.mjs → auth-rpc-D_hv52-J.mjs} +4 -4
  58. package/.output/server/_ssr/{auth.server-DW71WzsD.mjs → auth.server-DF_shCeq.mjs} +1 -1
  59. package/.output/server/_ssr/badge-BgsCP9Dp.mjs +28 -0
  60. package/.output/server/_ssr/{bundle-signing-rpc-BhnBw0-d.mjs → bundle-signing-rpc-BBipZnFs.mjs} +2 -2
  61. package/.output/server/_ssr/{bundle-signing.server-C4NW5mWx.mjs → bundle-signing.server-Co_zHdJx.mjs} +1 -1
  62. package/.output/server/_ssr/bundleActivity-D3_fIda2.mjs +27 -0
  63. package/.output/server/_ssr/{card-BRiPmi0C.mjs → card-DrbxCPtG.mjs} +3 -25
  64. package/.output/server/_ssr/chart-qxa-_30a.mjs +162 -0
  65. package/.output/server/_ssr/{config.server-afDuAwaG.mjs → config.server-CBr6PDj5.mjs} +5 -5
  66. package/.output/server/_ssr/{createSsrRpc-DjWNJ0uc.mjs → createSsrRpc-NHF2PxuK.mjs} +4 -4
  67. package/.output/server/_ssr/{deleteBundle-BTGwBgzx.mjs → deleteBundle-BAq3JuGr.mjs} +1 -1
  68. package/.output/server/_ssr/{dialog-DS-nw-pA.mjs → dialog-DUaIgpgd.mjs} +1 -1
  69. package/.output/server/_ssr/{downloadBundle-CNnYxYO2.mjs → downloadBundle-B3ert-pY.mjs} +1 -1
  70. package/.output/server/_ssr/{table-CnZmon_Z.mjs → field-CqNUlqUq.mjs} +4 -50
  71. package/.output/server/_ssr/{getBundleChildren-C0vh4ZvE.mjs → getBundleChildren-COMt16m_.mjs} +1 -1
  72. package/.output/server/_ssr/{input-group-BpsnmvZw.mjs → input-group-Bb8ueylQ.mjs} +51 -2
  73. package/.output/server/_ssr/insights-B-DUbksX.mjs +502 -0
  74. package/.output/server/_ssr/insights-recovery-DSFM-YTL.mjs +21 -0
  75. package/.output/server/_ssr/insights-recovery-rpc-P71FH66n.mjs +37 -0
  76. package/.output/server/_ssr/{insights-rpc-38DujK0G.mjs → insights-rpc-DrIQCjpD.mjs} +2 -2
  77. package/.output/server/_ssr/insightsRecovery-CqcosG7B.mjs +149 -0
  78. package/.output/server/_ssr/{installations-CtA59MQG.mjs → installations-BQrppti7.mjs} +2 -2
  79. package/.output/server/_ssr/{installations-DiVKEF5T.mjs → installations-YumqpNpa.mjs} +426 -11
  80. package/.output/server/_ssr/{router-B9wG_9f8.mjs → router-iP95Vqi2.mjs} +14 -14
  81. package/.output/server/_ssr/{routes-CKrrS2q2.mjs → routes-BDabsmc7.mjs} +2 -2
  82. package/.output/server/_ssr/{routes-D7Yh_jfj.mjs → routes-ivsV2TDu.mjs} +224 -13
  83. package/.output/server/_ssr/{runtime.server-DacU1TBV.mjs → runtime.server-jmZOKIQM.mjs} +1 -1
  84. package/.output/server/_ssr/{server-D_C2rMzf.mjs → server-p7yrVBfD.mjs} +3 -3
  85. package/.output/server/_ssr/{signing-Dz1WkZOf.mjs → signing-CxCbnFCt.mjs} +5 -4
  86. package/.output/server/_ssr/ssr.mjs +1 -1
  87. package/.output/server/_ssr/table-D1mL8fJu.mjs +53 -0
  88. package/.output/server/_tanstack-start-manifest_v-Cwpu0C9Q.mjs +100 -0
  89. package/.output/server/index.mjs +154 -154
  90. package/package.json +3 -3
  91. package/src/components/features/bundles/BundleActivityChart.tsx +95 -0
  92. package/src/components/features/bundles/BundleInsightsSummary.tsx +121 -0
  93. package/src/components/features/insights/InsightsControls.tsx +1 -15
  94. package/src/components/features/insights/InsightsOverview.tsx +368 -179
  95. package/src/components/features/releases/ReleaseEditorSheet.tsx +10 -0
  96. package/src/components/ui/empty.tsx +101 -0
  97. package/src/lib/bundle-activity.ts +21 -0
  98. package/src/lib/insights-recovery-rpc.ts +38 -0
  99. package/src/lib/insights-recovery.ts +59 -0
  100. package/src/lib/server/bundleActivity.ts +37 -0
  101. package/src/lib/server/insightsHistory.ts +52 -0
  102. package/src/lib/server/insightsRecovery.ts +186 -0
  103. package/src/routes/index.tsx +33 -3
  104. package/src/routes/insights.tsx +1 -42
  105. package/.output/public/assets/HashValueDisplay-CB0Eskit.js +0 -1
  106. package/.output/public/assets/InsightsPageHeader-Car5LNiZ.js +0 -1
  107. package/.output/public/assets/api-keys-BzKocqRy.js +0 -1
  108. package/.output/public/assets/card-Dhr_eFYj.js +0 -1
  109. package/.output/public/assets/createServerFn-CA8fs7QD.js +0 -3
  110. package/.output/public/assets/dialog-CUTrcPlB.js +0 -1
  111. package/.output/public/assets/index-DdAz-CXv.js +0 -10
  112. package/.output/public/assets/input-group-cSOG4wh_.js +0 -1
  113. package/.output/public/assets/insights-C0PBSZ-n.js +0 -1
  114. package/.output/public/assets/installations-CStZja8x.js +0 -1
  115. package/.output/public/assets/routes-DTlwOr8I.js +0 -1
  116. package/.output/public/assets/signing-CMf4aqDO.js +0 -1
  117. package/.output/public/assets/styles-BCvbtKsm.css +0 -2
  118. package/.output/public/assets/table-2vcV89QB.js +0 -1
  119. package/.output/public/assets/useCompositeListItem-CHLITE_4.js +0 -1
  120. package/.output/public/assets/x-DCd0j8c6.js +0 -1
  121. package/.output/server/_ssr/HashValueDisplay-DwpGLfrl.mjs +0 -55
  122. package/.output/server/_ssr/InsightsPageHeader-Df4Brj8u.mjs +0 -484
  123. package/.output/server/_ssr/insights-BdS364Xu.mjs +0 -460
  124. package/.output/server/_tanstack-start-manifest_v-2MjTyxil.mjs +0 -97
  125. package/src/components/features/insights/InsightsBundleReports.tsx +0 -51
  126. /package/.output/public/assets/{preload-helper-CQ36nxok.js → preload-helper-uTix4PVD.js} +0 -0
@@ -0,0 +1,502 @@
1
+ import { i as __toESM } from "../_runtime.mjs";
2
+ import { C as Toggle, J as require_react, S as ToggleGroup, q as require_jsx_runtime } from "../_libs/@base-ui/react+[...].mjs";
3
+ import { L as ArrowUpRight, n as TriangleAlert, u as RotateCw } from "../_libs/lucide-react.mjs";
4
+ import { t as cva } from "../_libs/class-variance-authority+clsx.mjs";
5
+ import { C as cn, S as buttonVariants, _ as Skeleton, n as Input, t as Button$1 } from "./createSsrRpc-NHF2PxuK.mjs";
6
+ import { m as Link } from "../_libs/@tanstack/react-router+[...].mjs";
7
+ import { n as useQuery } from "../_libs/tanstack__react-query.mjs";
8
+ import { a as Card, c as CardFooter, l as CardHeader, o as CardContent, u as CardTitle } from "./card-DrbxCPtG.mjs";
9
+ import { a as FieldLabel, i as FieldGroup, t as Field } from "./field-CqNUlqUq.mjs";
10
+ import { i as XAxis, n as LineChart, o as Line, r as YAxis, s as CartesianGrid } from "../_libs/recharts+[...].mjs";
11
+ import { a as ChartTooltipContent, i as ChartTooltip, s as getRecoveryReportRpc, t as ChartContainer } from "./chart-qxa-_30a.mjs";
12
+ import { n as InsightsPageHeader, t as InsightsErrorAlert } from "./InsightsPageHeader-C5Has8Ry.mjs";
13
+ //#region node_modules/.nitro/vite/services/ssr/assets/insights-B-DUbksX.js
14
+ var import_react = /* @__PURE__ */ __toESM(require_react());
15
+ var import_jsx_runtime = require_jsx_runtime();
16
+ var toggleVariants = cva("group/toggle inline-flex items-center justify-center gap-1 rounded-md text-xs font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
17
+ variants: {
18
+ variant: {
19
+ default: "bg-transparent",
20
+ outline: "border border-input bg-transparent hover:bg-muted"
21
+ },
22
+ size: {
23
+ default: "h-7 min-w-7 px-2 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
24
+ sm: "h-6 min-w-6 rounded-[min(var(--radius-md),8px)] px-2 text-[0.625rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
25
+ lg: "h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2"
26
+ }
27
+ },
28
+ defaultVariants: {
29
+ variant: "default",
30
+ size: "default"
31
+ }
32
+ });
33
+ var ToggleGroupContext = import_react.createContext({
34
+ size: "default",
35
+ variant: "default",
36
+ spacing: 2,
37
+ orientation: "horizontal"
38
+ });
39
+ function ToggleGroup$1({ className, variant, size, spacing = 2, orientation = "horizontal", children, ...props }) {
40
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToggleGroup, {
41
+ "data-slot": "toggle-group",
42
+ "data-variant": variant,
43
+ "data-size": size,
44
+ "data-spacing": spacing,
45
+ "data-orientation": orientation,
46
+ style: { "--gap": spacing },
47
+ className: cn("group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-md data-[size=sm]:rounded-[min(var(--radius-md),8px)] data-vertical:flex-col data-vertical:items-stretch", className),
48
+ ...props,
49
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToggleGroupContext.Provider, {
50
+ value: {
51
+ variant,
52
+ size,
53
+ spacing,
54
+ orientation
55
+ },
56
+ children
57
+ })
58
+ });
59
+ }
60
+ function ToggleGroupItem({ className, children, variant = "default", size = "default", ...props }) {
61
+ const context = import_react.useContext(ToggleGroupContext);
62
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Toggle, {
63
+ "data-slot": "toggle-group-item",
64
+ "data-variant": context.variant || variant,
65
+ "data-size": context.size || size,
66
+ "data-spacing": context.spacing,
67
+ className: cn("shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-md group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-md group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-md group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-md group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t", toggleVariants({
68
+ variant: context.variant || variant,
69
+ size: context.size || size
70
+ }), className),
71
+ ...props,
72
+ children
73
+ });
74
+ }
75
+ var windows = [
76
+ {
77
+ value: "24h",
78
+ label: "24 hours",
79
+ shortLabel: "24h"
80
+ },
81
+ {
82
+ value: "7d",
83
+ label: "7 days",
84
+ shortLabel: "7d"
85
+ },
86
+ {
87
+ value: "30d",
88
+ label: "30 days",
89
+ shortLabel: "30d"
90
+ }
91
+ ];
92
+ function InsightsControls({ onWindowChange, onScopeChange, scope, window }) {
93
+ const [platform, setPlatform] = (0, import_react.useState)(scope.platform);
94
+ const [channel, setChannel] = (0, import_react.useState)(scope.channel);
95
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
96
+ "aria-label": "Insights controls",
97
+ className: "flex flex-col gap-4",
98
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("form", {
99
+ onSubmit: (event) => {
100
+ event.preventDefault();
101
+ onScopeChange({
102
+ platform,
103
+ channel
104
+ });
105
+ },
106
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(FieldGroup, {
107
+ className: "items-end sm:flex-row",
108
+ children: [
109
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Field, {
110
+ className: "w-full sm:w-auto",
111
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldLabel, { children: "Platform" }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ToggleGroup$1, {
112
+ "aria-label": "Platform",
113
+ value: [platform],
114
+ onValueChange: (value) => {
115
+ if (value[0] === "ios" || value[0] === "android") setPlatform(value[0]);
116
+ },
117
+ spacing: 0,
118
+ variant: "outline",
119
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToggleGroupItem, {
120
+ className: "h-11 lg:h-8",
121
+ value: "ios",
122
+ children: "iOS"
123
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToggleGroupItem, {
124
+ className: "h-11 lg:h-8",
125
+ value: "android",
126
+ children: "Android"
127
+ })]
128
+ })]
129
+ }),
130
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Field, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldLabel, {
131
+ htmlFor: "insights-channel",
132
+ children: "Channel"
133
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Input, {
134
+ className: "h-11 lg:h-8",
135
+ id: "insights-channel",
136
+ value: channel,
137
+ onChange: (event) => setChannel(event.target.value),
138
+ required: true,
139
+ maxLength: 1024
140
+ })] }),
141
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$1, {
142
+ className: "h-11 w-full sm:w-auto lg:h-8",
143
+ type: "submit",
144
+ variant: "outline",
145
+ children: "Apply filters"
146
+ })
147
+ ]
148
+ })
149
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Field, {
150
+ orientation: "horizontal",
151
+ className: "w-full",
152
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldLabel, {
153
+ className: "sr-only",
154
+ children: "Reporting period"
155
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToggleGroup$1, {
156
+ "aria-label": "Reporting period",
157
+ className: "w-full sm:w-fit",
158
+ onValueChange: (value) => {
159
+ if (value[0]) onWindowChange(value[0]);
160
+ },
161
+ spacing: 0,
162
+ size: "lg",
163
+ value: [window],
164
+ variant: "outline",
165
+ children: windows.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToggleGroupItem, {
166
+ "aria-label": item.label,
167
+ className: "h-11 flex-1 px-4 sm:flex-none lg:h-8 lg:px-2.5",
168
+ value: item.value,
169
+ children: item.shortLabel
170
+ }, item.value))
171
+ })]
172
+ })]
173
+ });
174
+ }
175
+ var dates = new Intl.DateTimeFormat("en", {
176
+ month: "short",
177
+ day: "numeric",
178
+ timeZone: "UTC"
179
+ });
180
+ var times = new Intl.DateTimeFormat("en", {
181
+ month: "short",
182
+ day: "numeric",
183
+ hour: "numeric",
184
+ timeZone: "UTC"
185
+ });
186
+ var colors = [
187
+ "var(--chart-2)",
188
+ "var(--foreground)",
189
+ "var(--chart-1)",
190
+ "var(--muted-foreground)",
191
+ "var(--chart-4)"
192
+ ];
193
+ var dashes = [
194
+ void 0,
195
+ "6 3",
196
+ "2 3"
197
+ ];
198
+ function ActivityChart({ report }) {
199
+ const [metric, setMetric] = (0, import_react.useState)("active");
200
+ const [selectedId, setSelectedId] = (0, import_react.useState)(null);
201
+ const selected = report.series.find((series) => series.releaseId === selectedId);
202
+ const config = Object.fromEntries(report.series.map((series, index) => [`bundle${index}`, {
203
+ label: series.releaseId,
204
+ color: colors[index % colors.length]
205
+ }]));
206
+ const data = (report.series[0]?.points ?? []).map((point, pointIndex) => ({
207
+ startMs: point.startMs,
208
+ ...Object.fromEntries(report.series.map((series, index) => [`bundle${index}`, metric === "active" ? series.points[pointIndex].active : series.points[pointIndex].recoveredInstallations]))
209
+ }));
210
+ const formatTick = (ms) => (report.intervalMs < 864e5 ? times : dates).format(ms);
211
+ const lastSpike = selected ? [...selected.points].reverse().find((point) => point.spike) : void 0;
212
+ const total = metric === "active" ? report.series.reduce((sum, series) => sum + series.activeInstallations, 0) : report.series.filter((series) => series.recoveredInstallations > 0).length;
213
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
214
+ className: "flex flex-wrap items-start justify-between gap-4",
215
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
216
+ className: "text-sm text-muted-foreground",
217
+ children: metric === "active" ? "Active installations" : "Bundles with rollbacks"
218
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
219
+ className: "mt-1 text-4xl font-semibold tracking-tight tabular-nums",
220
+ children: total.toLocaleString()
221
+ })] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ToggleGroup$1, {
222
+ "aria-label": "Activity metric",
223
+ value: [metric],
224
+ onValueChange: (values) => {
225
+ if (values[0] === "active" || values[0] === "rollback") setMetric(values[0]);
226
+ },
227
+ spacing: 0,
228
+ variant: "outline",
229
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToggleGroupItem, {
230
+ className: "h-11 lg:h-8",
231
+ value: "active",
232
+ children: "Active"
233
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToggleGroupItem, {
234
+ className: "h-11 lg:h-8",
235
+ value: "rollback",
236
+ children: "Rollback"
237
+ })]
238
+ })]
239
+ }), report.series.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
240
+ className: "flex h-48 items-center justify-center text-center text-sm text-muted-foreground",
241
+ children: "No bundle reports in this period. Try another channel or check again after the app reports activity."
242
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
243
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
244
+ className: "mb-2 text-right text-xs text-muted-foreground",
245
+ children: [
246
+ metric === "active" ? "Installations" : "Recovered installations per interval",
247
+ " ",
248
+ "· UTC"
249
+ ]
250
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChartContainer, {
251
+ "aria-label": `${metric === "active" ? "Active" : "Rollback"} trend for all reported bundle IDs`,
252
+ className: "h-48 w-full aspect-auto sm:h-56",
253
+ config,
254
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(LineChart, {
255
+ accessibilityLayer: true,
256
+ data,
257
+ margin: {
258
+ left: -12,
259
+ right: 12,
260
+ top: 8
261
+ },
262
+ children: [
263
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CartesianGrid, { vertical: false }),
264
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(XAxis, {
265
+ axisLine: false,
266
+ dataKey: "startMs",
267
+ minTickGap: 40,
268
+ tickFormatter: formatTick,
269
+ tickLine: false
270
+ }),
271
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(YAxis, {
272
+ allowDecimals: false,
273
+ axisLine: false,
274
+ tickLine: false,
275
+ width: 48
276
+ }),
277
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChartTooltip, { content: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChartTooltipContent, {
278
+ className: "max-h-64 max-w-[calc(100vw-3rem)] overflow-auto",
279
+ labelFormatter: (_, payload) => `${times.format(payload[0]?.payload.startMs)} · UTC`
280
+ }) }),
281
+ report.series.map((series, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Line, {
282
+ dataKey: `bundle${index}`,
283
+ type: "linear",
284
+ stroke: `var(--color-bundle${index})`,
285
+ strokeWidth: selectedId === series.releaseId ? 3 : 2,
286
+ strokeOpacity: !selected || selected === series ? 1 : .4,
287
+ strokeDasharray: dashes[Math.floor(index / colors.length) % dashes.length],
288
+ dot: { r: 2 },
289
+ activeDot: { r: 4 },
290
+ isAnimationActive: false
291
+ }, series.releaseId))
292
+ ]
293
+ })
294
+ })] }),
295
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
296
+ "aria-label": "Reported bundles",
297
+ className: "grid max-h-48 grid-cols-1 gap-1 overflow-y-auto sm:grid-cols-2",
298
+ children: report.series.map((series, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
299
+ type: "button",
300
+ "aria-label": `Highlight bundle ${series.releaseId}`,
301
+ "aria-pressed": selectedId === series.releaseId,
302
+ title: series.releaseId,
303
+ onClick: () => setSelectedId(selectedId === series.releaseId ? null : series.releaseId),
304
+ className: "flex min-w-0 items-center gap-2 rounded-md px-2 py-2 text-left text-xs hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring aria-pressed:bg-muted",
305
+ children: [
306
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
307
+ "aria-hidden": "true",
308
+ width: "20",
309
+ height: "8",
310
+ className: "shrink-0",
311
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", {
312
+ x1: "0",
313
+ x2: "20",
314
+ y1: "4",
315
+ y2: "4",
316
+ stroke: colors[index % colors.length],
317
+ strokeWidth: "2",
318
+ strokeDasharray: dashes[Math.floor(index / colors.length) % dashes.length]
319
+ })
320
+ }),
321
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
322
+ className: "min-w-0 truncate font-mono",
323
+ children: series.releaseId
324
+ }),
325
+ series.points.some((point) => point.spike) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TriangleAlert, {
326
+ "aria-label": "Rollback spike",
327
+ className: "size-3 shrink-0"
328
+ }) : null,
329
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
330
+ className: "ml-auto tabular-nums",
331
+ children: (metric === "active" ? series.activeInstallations : series.recoveredInstallations).toLocaleString()
332
+ })
333
+ ]
334
+ }, series.releaseId))
335
+ }),
336
+ selected ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
337
+ className: "flex flex-wrap items-center justify-between gap-3 border-t pt-3",
338
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
339
+ className: "min-w-0 flex-1",
340
+ children: [
341
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
342
+ className: "break-all font-mono text-xs",
343
+ children: selected.releaseId
344
+ }),
345
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
346
+ className: "mt-1 text-xs text-muted-foreground",
347
+ children: [
348
+ "Active ",
349
+ selected.activeInstallations.toLocaleString(),
350
+ " · Rollback ",
351
+ selected.recoveredInstallations.toLocaleString(),
352
+ " in this period"
353
+ ]
354
+ }),
355
+ metric === "rollback" && lastSpike ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
356
+ className: "mt-2 flex items-center gap-2 text-xs",
357
+ children: [
358
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TriangleAlert, {
359
+ className: "size-3 shrink-0",
360
+ "aria-hidden": "true"
361
+ }),
362
+ "Rollback spike on ",
363
+ dates.format(lastSpike.startMs),
364
+ ". Review this bundle’s delivery settings."
365
+ ]
366
+ }) : null
367
+ ]
368
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Link, {
369
+ className: buttonVariants({
370
+ variant: "outline",
371
+ size: "sm"
372
+ }),
373
+ to: "/",
374
+ search: { releaseId: selected.releaseId },
375
+ children: ["Review bundle", /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrowUpRight, { "aria-hidden": "true" })]
376
+ })]
377
+ }) : null,
378
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", {
379
+ className: "text-xs text-muted-foreground",
380
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("summary", {
381
+ className: "cursor-pointer",
382
+ children: "View chart data"
383
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
384
+ className: "mt-2 max-h-64 overflow-auto",
385
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", {
386
+ className: "w-full text-left",
387
+ children: [
388
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("caption", {
389
+ className: "sr-only",
390
+ children: [
391
+ metric === "active" ? "Active installations" : "Recovered installations",
392
+ " ",
393
+ "by bundle ID, UTC"
394
+ ]
395
+ }),
396
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
397
+ scope: "col",
398
+ className: "pr-4",
399
+ children: "Date (UTC)"
400
+ }), report.series.map((series) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
401
+ scope: "col",
402
+ className: "px-2 font-mono",
403
+ children: series.releaseId
404
+ }, series.releaseId))] }) }),
405
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: data.map((point, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
406
+ scope: "row",
407
+ className: "whitespace-nowrap pr-4 font-normal",
408
+ children: times.format(point.startMs)
409
+ }), report.series.map((series) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
410
+ className: "px-2 tabular-nums",
411
+ children: (metric === "active" ? series.points[i].active : series.points[i].recoveredInstallations) ?? "—"
412
+ }, series.releaseId))] }, point.startMs)) })
413
+ ]
414
+ })
415
+ })]
416
+ })
417
+ ] })] });
418
+ }
419
+ function InsightsOverview({ input }) {
420
+ const query = useQuery({
421
+ queryKey: ["rollout-activity", input],
422
+ queryFn: () => getRecoveryReportRpc({ data: input }),
423
+ staleTime: 3e4
424
+ });
425
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Card, {
426
+ className: "min-w-0 overflow-hidden shadow-sm",
427
+ children: [
428
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CardHeader, {
429
+ className: "flex-row items-center justify-between gap-4 px-4 pt-4 pb-2 sm:px-6 sm:pt-6",
430
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CardTitle, {
431
+ className: "text-sm font-medium",
432
+ children: [
433
+ "Bundle activity ·",
434
+ " ",
435
+ input.window === "30d" ? "30 days" : input.window === "7d" ? "7 days" : "24 hours"
436
+ ]
437
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$1, {
438
+ "aria-label": "Refresh bundle activity",
439
+ variant: "ghost",
440
+ size: "icon-sm",
441
+ disabled: query.isFetching,
442
+ onClick: () => void query.refetch(),
443
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RotateCw, { "aria-hidden": "true" })
444
+ })]
445
+ }),
446
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CardContent, {
447
+ className: "flex flex-col gap-4 px-4 pb-4 sm:px-6 sm:pb-6",
448
+ children: query.isPending ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, {
449
+ "aria-label": "Loading bundle activity",
450
+ className: "h-64 w-full"
451
+ }) : query.error ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InsightsErrorAlert, {
452
+ error: query.error,
453
+ fallbackTitle: "Bundle activity unavailable"
454
+ }) : query.data ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActivityChart, { report: query.data }, JSON.stringify(input)) : null
455
+ }),
456
+ query.data && !query.error ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CardFooter, {
457
+ className: "flex-col items-start gap-2 border-t bg-muted/15 px-4 py-3 text-xs text-muted-foreground sm:px-6",
458
+ children: [
459
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Active follows each installation’s last reported ID in this period. Rollbacks count installations recovered from each ID per interval." }),
460
+ query.data.unattributedInstallations > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [query.data.unattributedInstallations.toLocaleString(), " reporting installations have no observed bundle ID and are excluded."] }) : null,
461
+ query.data.truncated ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [
462
+ "Partial history — only reports since",
463
+ " ",
464
+ times.format(query.data.sinceMs),
465
+ " UTC are included. Choose a shorter period to see more complete counts."
466
+ ] }) : null
467
+ ]
468
+ }) : null
469
+ ]
470
+ });
471
+ }
472
+ function InsightsPage() {
473
+ const [window, setWindow] = (0, import_react.useState)("30d");
474
+ const [scope, setScope] = (0, import_react.useState)({
475
+ platform: "ios",
476
+ channel: "production"
477
+ });
478
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
479
+ className: "flex h-svh min-h-0 flex-col",
480
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(InsightsPageHeader, { view: "overview" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
481
+ className: "min-h-0 min-w-0 flex-1 overflow-y-auto bg-muted/5 p-3 sm:p-6",
482
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
483
+ className: "mx-auto flex w-full max-w-4xl flex-col gap-4 sm:gap-6",
484
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(InsightsControls, {
485
+ scope,
486
+ onScopeChange: (next) => {
487
+ setScope(next);
488
+ },
489
+ onWindowChange: (next) => {
490
+ setWindow(next);
491
+ },
492
+ window
493
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InsightsOverview, { input: {
494
+ ...scope,
495
+ window
496
+ } })]
497
+ })
498
+ })]
499
+ });
500
+ }
501
+ //#endregion
502
+ export { InsightsPage as component };
@@ -0,0 +1,21 @@
1
+ //#region node_modules/.nitro/vite/services/ssr/assets/insights-recovery-DSFM-YTL.js
2
+ var recoveryWindows = {
3
+ "24h": {
4
+ durationMs: 864e5,
5
+ intervalMs: 36e5
6
+ },
7
+ "7d": {
8
+ durationMs: 7 * 864e5,
9
+ intervalMs: 6 * 36e5
10
+ },
11
+ "30d": {
12
+ durationMs: 30 * 864e5,
13
+ intervalMs: 864e5
14
+ }
15
+ };
16
+ function readRecoveryInput(input) {
17
+ if (!input || input.platform !== "ios" && input.platform !== "android" || typeof input.channel !== "string" || !input.channel.trim() || input.channel.length > 1024 || !Object.hasOwn(recoveryWindows, input.window) || input.releaseId !== void 0 && (typeof input.releaseId !== "string" || !input.releaseId.trim() || input.releaseId.length > 1024)) throw new Error("Choose a platform, channel, and time window.");
18
+ return input;
19
+ }
20
+ //#endregion
21
+ export { recoveryWindows as n, readRecoveryInput as t };
@@ -0,0 +1,37 @@
1
+ import { c as createServerFn } from "./createServerFn-B2hcXoPM.mjs";
2
+ import { t as createServerRpc } from "./createServerRpc-DB29C_5p.mjs";
3
+ import { t as readRecoveryInput } from "./insights-recovery-DSFM-YTL.mjs";
4
+ //#region node_modules/.nitro/vite/services/ssr/assets/insights-recovery-rpc-P71FH66n.js
5
+ function readBundleActivityInput(inputs) {
6
+ if (!Array.isArray(inputs) || inputs.length > 20) throw new Error("Choose up to 20 bundles.");
7
+ return inputs.map((input) => {
8
+ readRecoveryInput({
9
+ ...input,
10
+ window: "30d"
11
+ });
12
+ if (!input.releaseId) throw new Error("Choose a bundle ID.");
13
+ return input;
14
+ });
15
+ }
16
+ var getBundleActivityRpc_createServerFn_handler = createServerRpc({
17
+ id: "b4bf4c461903edcdc44eea52468c737b5b600a586f542138ff022dcbbe86c45c",
18
+ name: "getBundleActivityRpc",
19
+ filename: "src/lib/insights-recovery-rpc.ts"
20
+ }, (opts) => getBundleActivityRpc.__executeServer(opts));
21
+ var getBundleActivityRpc = createServerFn({ method: "GET" }).validator(readBundleActivityInput).handler(getBundleActivityRpc_createServerFn_handler, async ({ data }) => {
22
+ const [{ prepareConfig }, { getBundleActivity }] = await Promise.all([import("./config.server-CBr6PDj5.mjs"), import("./bundleActivity-D3_fIda2.mjs")]);
23
+ const { config } = await prepareConfig();
24
+ return getBundleActivity(config.database.models.insights, data);
25
+ });
26
+ var getRecoveryReportRpc_createServerFn_handler = createServerRpc({
27
+ id: "69cd8e2488b082eb2a22e7058be56ad6566f338c471c62557fa6beed5dc1352a",
28
+ name: "getRecoveryReportRpc",
29
+ filename: "src/lib/insights-recovery-rpc.ts"
30
+ }, (opts) => getRecoveryReportRpc.__executeServer(opts));
31
+ var getRecoveryReportRpc = createServerFn({ method: "GET" }).validator(readRecoveryInput).handler(getRecoveryReportRpc_createServerFn_handler, async ({ data }) => {
32
+ const [{ prepareConfig }, { getRecoveryReport }] = await Promise.all([import("./config.server-CBr6PDj5.mjs"), import("./insightsRecovery-CqcosG7B.mjs")]);
33
+ const { config } = await prepareConfig();
34
+ return getRecoveryReport(config.database.models.insights, data);
35
+ });
36
+ //#endregion
37
+ export { getBundleActivityRpc_createServerFn_handler, getRecoveryReportRpc_createServerFn_handler };
@@ -1,8 +1,8 @@
1
1
  import { c as createServerFn } from "./createServerFn-B2hcXoPM.mjs";
2
2
  import { t as createServerRpc } from "./createServerRpc-DB29C_5p.mjs";
3
- //#region node_modules/.nitro/vite/services/ssr/assets/insights-rpc-38DujK0G.js
3
+ //#region node_modules/.nitro/vite/services/ssr/assets/insights-rpc-DrIQCjpD.js
4
4
  var runtime = async () => {
5
- const { prepareConfig } = await import("./config.server-afDuAwaG.mjs");
5
+ const { prepareConfig } = await import("./config.server-CBr6PDj5.mjs");
6
6
  const { hotUpdater } = await prepareConfig();
7
7
  return hotUpdater;
8
8
  };