hazo_umetrics 0.1.1 → 0.1.2
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/CHANGE_LOG.md +12 -0
- package/README.md +7 -2
- package/SETUP_CHECKLIST.md +5 -1
- package/dist/ui/metrics_panel.js +2 -2
- package/package.json +6 -5
package/CHANGE_LOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# hazo_umetrics — Change Log
|
|
2
2
|
|
|
3
|
+
## 0.1.2 — 2026-06-14
|
|
4
|
+
|
|
5
|
+
**Changed:**
|
|
6
|
+
- `MetricsPanel`/`StatTrend`: `LineChart` now imported from `hazo_dataviz/client` instead of `hazo_ui`, following the hazo_ui 4.0.0 chart migration (LineChart/MultiLineChart moved to hazo_dataviz).
|
|
7
|
+
- Added `hazo_dataviz ^0.3.0` as a (required) peer dependency.
|
|
8
|
+
- `hazo_ui` peer range bumped to `^4.0.0`.
|
|
9
|
+
- README: install/peer-dep list, entry-point table, and Tailwind `@source` block updated for the `hazo_dataviz` chart dependency.
|
|
10
|
+
|
|
11
|
+
**Test-app:**
|
|
12
|
+
- Autotest `hazo_umetrics_stats` scenario: the `GET /stats/series` case now self-authenticates (logs in as the seeded `viewer@hazo.local` before fetching) instead of silently depending on a pre-existing manual login — it was failing with `UNAUTHORIZED` on a fresh run. Added a shared `loginAs()` helper.
|
|
13
|
+
- Added two stats cases unlocked by `loginAs()`: `GET /stats` authenticated viewer (happy path, `ok:true` + `data.stat`) and `GET /stats` as `none@hazo.local` (the `permission_ok=false → 403 FORBIDDEN` branch, previously uncovered).
|
|
14
|
+
|
|
3
15
|
## 0.1.1 — 2026-06-12
|
|
4
16
|
|
|
5
17
|
**Fixed:**
|
package/README.md
CHANGED
|
@@ -23,9 +23,13 @@ npm install hazo_umetrics
|
|
|
23
23
|
**Peer dependencies (install the ones you use):**
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
|
-
npm install hazo_core hazo_connect hazo_auth hazo_secure hazo_audit hazo_api hazo_ui
|
|
26
|
+
npm install hazo_core hazo_connect hazo_auth hazo_secure hazo_audit hazo_api hazo_ui hazo_dataviz
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
+
> The `hazo_umetrics/ui` panel renders its trend chart with `hazo_dataviz` (the chart
|
|
30
|
+
> primitives moved out of `hazo_ui` in the hazo_ui 4.0.0 migration), so install
|
|
31
|
+
> `hazo_dataviz` when you use `MetricsPanel`/`StatTrend`.
|
|
32
|
+
|
|
29
33
|
Required env vars for cookie signing (A/B assignment):
|
|
30
34
|
```
|
|
31
35
|
HAZO_UMETRICS_COOKIE_KEY_CURRENT=v1
|
|
@@ -39,7 +43,7 @@ HAZO_UMETRICS_COOKIE_KEY_v1=<base64-encoded 32-byte AES-256 key>
|
|
|
39
43
|
| `hazo_umetrics` | Server: recordStat, getLatestStat, getStatSeries, resolveVariant, weightedBucket, GA4/experiment stubs |
|
|
40
44
|
| `hazo_umetrics/api` | Route factories: createStatHandlers, createExperimentHandlers, createGa4ConnectHandlers, createQueryHandlers |
|
|
41
45
|
| `hazo_umetrics/client` | Client: HazoMetricsProvider, useMetrics, getVariant, isEnabled, identify, recordStat |
|
|
42
|
-
| `hazo_umetrics/ui` | UI: MetricsPanel, StatCards, StatTrend (uses
|
|
46
|
+
| `hazo_umetrics/ui` | UI: MetricsPanel, StatCards, StatTrend (uses hazo_dataviz LineChart — requires hazo_dataviz peer dep) |
|
|
43
47
|
|
|
44
48
|
## Stat store
|
|
45
49
|
|
|
@@ -115,6 +119,7 @@ Copy `config/hazo_umetrics_config.ini.sample` to `hazo_umetrics_config.ini` and
|
|
|
115
119
|
|
|
116
120
|
@source "../node_modules/hazo_umetrics/dist";
|
|
117
121
|
@source "../node_modules/hazo_ui/dist";
|
|
122
|
+
@source "../node_modules/hazo_dataviz/dist"; /* StatTrend's LineChart lives here */
|
|
118
123
|
|
|
119
124
|
/* Tailwind v4 — map tokens to utilities */
|
|
120
125
|
@theme inline {
|
package/SETUP_CHECKLIST.md
CHANGED
|
@@ -11,9 +11,12 @@ npm install hazo_umetrics
|
|
|
11
11
|
Install peer dependencies you need:
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
npm install hazo_core hazo_connect hazo_auth hazo_secure hazo_audit hazo_api hazo_ui
|
|
14
|
+
npm install hazo_core hazo_connect hazo_auth hazo_secure hazo_audit hazo_api hazo_ui hazo_dataviz
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
> `hazo_dataviz` is required when you render `MetricsPanel`/`StatTrend` — its `LineChart`
|
|
18
|
+
> draws the trend chart (moved out of `hazo_ui` in the 4.0.0 chart migration).
|
|
19
|
+
|
|
17
20
|
## 2. Run DB migrations
|
|
18
21
|
|
|
19
22
|
**SQLite:**
|
|
@@ -81,6 +84,7 @@ export default function RootLayout({ children }) {
|
|
|
81
84
|
|
|
82
85
|
@source "../node_modules/hazo_umetrics/dist";
|
|
83
86
|
@source "../node_modules/hazo_ui/dist";
|
|
87
|
+
@source "../node_modules/hazo_dataviz/dist";
|
|
84
88
|
|
|
85
89
|
/* Tailwind v4 — map HSL tokens to color utilities */
|
|
86
90
|
@theme inline {
|
package/dist/ui/metrics_panel.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useState } from 'react';
|
|
4
|
-
import { LineChart } from '
|
|
4
|
+
import { LineChart } from 'hazo_dataviz/client';
|
|
5
5
|
// ---------------------------------------------------------------------------
|
|
6
6
|
// Metric metadata (display labels + format hints)
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
@@ -52,7 +52,7 @@ export function StatTrend({ data, label }) {
|
|
|
52
52
|
if (data.length < 2) {
|
|
53
53
|
return (_jsx("div", { className: "rounded-lg border p-4 text-sm text-muted-foreground", children: "No trend data yet" }));
|
|
54
54
|
}
|
|
55
|
-
//
|
|
55
|
+
// hazo_dataviz LineChart gives us labelled X/Y axes + a hover cursor & value bubble.
|
|
56
56
|
const values = data.map((d) => d.value);
|
|
57
57
|
const dates = data.map((d) => formatTrendLabel(d.ts));
|
|
58
58
|
return (_jsxs("div", { className: "rounded-lg border p-4", children: [label != null && _jsx("p", { className: "mb-2 text-sm font-medium", children: label }), _jsx(LineChart, { data: values, dates: dates, color: "#6366f1", showTooltip: true })] }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hazo_umetrics",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Product analytics for hazo apps — GA4 hybrid + first-party stat store + feature flags",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -40,15 +40,16 @@
|
|
|
40
40
|
"build:test-app": "npm run build && cd test-app && npm run build"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"hazo_core": "^1.
|
|
43
|
+
"hazo_core": "^1.2.0",
|
|
44
|
+
"hazo_dataviz": "^0.3.0",
|
|
44
45
|
"hazo_logs": "^2.0.3",
|
|
45
46
|
"hazo_config": "^2.1.10",
|
|
46
|
-
"hazo_connect": "^3.
|
|
47
|
+
"hazo_connect": "^3.7.0",
|
|
47
48
|
"hazo_api": "^2.3.1",
|
|
48
|
-
"hazo_auth": "^10.
|
|
49
|
+
"hazo_auth": "^10.2.0",
|
|
49
50
|
"hazo_secure": "^1.3.0",
|
|
50
51
|
"hazo_audit": "^2.1.1",
|
|
51
|
-
"hazo_ui": "^
|
|
52
|
+
"hazo_ui": "^4.0.0",
|
|
52
53
|
"react": "^18.0.0 || ^19.0.0",
|
|
53
54
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
54
55
|
},
|