mirror of
https://github.com/hanzoai/ui.git
synced 2026-11-20 22:36:27 +00:00
Interaction analytics was app work. Every surface wired its own client and instrumented its own call sites, so a click on the same Button was named three ways or not at all. `<Hanzo analytics>` is now the whole wiring: one prop on the root an app already mounts, and every click, change, submit and route change inside the tree reaches the ONE front door named by the component it happened on — `card/button[Save]` — with input values withheld. A prop, not a default. Mounting a component library must never start a network conversation the app did not ask for; off, no provider renders and no listener is installed. On, it renders @hanzogui/telemetry's provider, which is where consent already lives (GPC, DNT, the stored choice a banner writes). No second client, no second stream, no second consent policy. Component names are real in production. Every primitive already carries a `data-slot` through one helper, so `componentName()` reads it — ranked ABOVE the React fiber owner deliberately, because the fiber name is development-only and a dashboard grouped on it empties silently at deploy. A named node keeps its qualifier now (`button[Save]`, not `button`): a component name says what KIND of thing it is, and a library renders hundreds of each. It cannot double-count. The engine installs DELEGATED listeners on a root, so two engines on one root report everything twice — which is exactly what an app got by following two true sets of instructions at once, since a library provider starts an engine and observe's own README told apps to mount another. The first engine to start now claims its root and any later one stays inert. The claim lives on the page under a `Symbol.for` registry rather than in module scope: two copies of the package in one bundle have two module scopes and would not see each other's claim, which is precisely when a duplicate is most likely. Driving it in Chromium found what jsdom could not: the input debounce was ONE slot shared across elements, so moving to the next field cleared the previous field's pending timer and a filled form reported only the last field touched. Keyed by field now. hz.js could not authenticate at all. Through 0.3.11 it sent no `Authorization` and no `?ingest_key=`, so every keyed static surface wrote unattributed, the door refused it (401 ingest_key_required), and nothing in the page said so — the tag measured fine in the browser and the surface was simply missing from the warehouse. `data-ingest-key="pk-…"` now rides the header on fetch and the query on a headerless unload beacon, the same pair the npm client uses. It also honors Global Privacy Control and the stored `hz_consent` choice, not DNT alone, and its stamped `libraryVersion` is pinned to the package version by a test — it had drifted three patches, dating every static-site row to the wrong release. The hz.js suite ran none of its tests: Node >= 21 ships a `navigator` whose descriptor has no setter, so the harness's assignment threw. The one shipped file with no bundler and no import-time typing had no executed coverage. It runs again, and now asserts what reaches the wire — transport, URL, headers — not only the batch. @hanzo/event 0.3.12, @hanzo/observe 0.1.7, @hanzo/ui 8.0.58. Co-authored-by: Hanzo Dev <[email protected]>
87 lines
2.1 KiB
JSON
87 lines
2.1 KiB
JSON
{
|
|
"name": "@hanzo/observe",
|
|
"version": "0.1.7",
|
|
"description": "Hanzo Observe — default-on interaction capture for React. Watches every click/input/nav/visibility across the tree, annotates each with a semantic hierarchy (component path / role / data-testid / aria) auto-derived from the DOM, and emits it through @hanzo/event to the ONE front door (POST /v1/event). Privacy-gated (input redaction) and fail-soft by default; ships a real-time event stream hook for session playback.",
|
|
"publishConfig": {
|
|
"registry": "https://registry.npmjs.org/",
|
|
"access": "public",
|
|
"scope": "@hanzo"
|
|
},
|
|
"author": "Hanzo AI <[email protected]>",
|
|
"license": "MIT",
|
|
"type": "module",
|
|
"main": "./dist/index.cjs",
|
|
"module": "./dist/index.mjs",
|
|
"types": "./dist/index.d.ts",
|
|
"sideEffects": false,
|
|
"files": [
|
|
"dist",
|
|
"src",
|
|
"README.md"
|
|
],
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/hanzoai/ui.git",
|
|
"directory": "pkgs/observe"
|
|
},
|
|
"keywords": [
|
|
"analytics",
|
|
"autocapture",
|
|
"session-replay",
|
|
"telemetry",
|
|
"semantic",
|
|
"react",
|
|
"observability",
|
|
"hanzo"
|
|
],
|
|
"scripts": {
|
|
"build": "tsup",
|
|
"dev": "tsup --watch",
|
|
"test": "vitest run",
|
|
"typecheck": "tsc --noEmit",
|
|
"clean": "rm -rf dist"
|
|
},
|
|
"exports": {
|
|
".": {
|
|
"import": {
|
|
"types": "./dist/index.d.ts",
|
|
"default": "./dist/index.mjs"
|
|
},
|
|
"require": {
|
|
"types": "./dist/index.d.cts",
|
|
"default": "./dist/index.cjs"
|
|
}
|
|
},
|
|
"./react": {
|
|
"import": {
|
|
"types": "./dist/react.d.ts",
|
|
"default": "./dist/react.mjs"
|
|
},
|
|
"require": {
|
|
"types": "./dist/react.d.cts",
|
|
"default": "./dist/react.cjs"
|
|
}
|
|
}
|
|
},
|
|
"dependencies": {
|
|
"@hanzo/event": "^0.3.3"
|
|
},
|
|
"peerDependencies": {
|
|
"react": "^18.0.0 || ^19.0.0"
|
|
},
|
|
"peerDependenciesMeta": {
|
|
"react": {
|
|
"optional": true
|
|
}
|
|
},
|
|
"devDependencies": {
|
|
"@types/node": "^25.5.0",
|
|
"@types/react": "19.2.14",
|
|
"happy-dom": "^20.0.0",
|
|
"react": "19.2.4",
|
|
"tsup": "^8.5.1",
|
|
"typescript": "^5.9.3",
|
|
"vitest": "^4.1.0"
|
|
}
|
|
}
|