@merittdev/horus-lens 0.0.1 → 0.0.3
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/README.md +129 -0
- package/dist/browser.cjs +1 -1
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.js +2 -2
- package/dist/{chunk-DU7HNRF4.js → chunk-CTBY5XIN.js} +2 -2
- package/dist/{chunk-S6S3ZZQA.js → chunk-XRONR4GR.js} +2 -2
- package/dist/{chunk-S6S3ZZQA.js.map → chunk-XRONR4GR.js.map} +1 -1
- package/dist/dashboard.cjs +784 -434
- package/dist/dashboard.cjs.map +1 -1
- package/dist/dashboard.css +224 -1
- package/dist/dashboard.d.cts +85 -1
- package/dist/dashboard.d.ts +85 -1
- package/dist/dashboard.js +648 -301
- package/dist/dashboard.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/lens.min.js +1 -1
- package/dist/lens.min.js.map +1 -1
- package/dist/react.cjs +6 -3
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +18 -6
- package/dist/react.d.ts +18 -6
- package/dist/react.js +6 -4
- package/dist/react.js.map +1 -1
- package/dist/server.cjs +109 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.d.cts +59 -0
- package/dist/server.d.ts +59 -0
- package/dist/server.js +82 -0
- package/dist/server.js.map +1 -0
- package/package.json +30 -4
- /package/dist/{chunk-DU7HNRF4.js.map → chunk-CTBY5XIN.js.map} +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Lens — `@merittdev/horus-lens`
|
|
2
|
+
|
|
3
|
+
Context-rich issue capture for web apps, part of the [Horus](https://horus.sh) ecosystem.
|
|
4
|
+
|
|
5
|
+
A teammate visits your app with `?lens=true`, an overlay appears, they describe the
|
|
6
|
+
issue (pick an element, mark an area, or record their steps), press Submit — and Lens
|
|
7
|
+
ships a report with a session replay, screenshot, console + network buffers, DOM
|
|
8
|
+
snapshot, environment, release/git SHA, and user context. Reports become issues in
|
|
9
|
+
**Linear, GitHub, or Jira** automatically, with the screenshot embedded and a
|
|
10
|
+
shareable replay link.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @merittdev/horus-lens
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Or with a script tag (any website — no build step):
|
|
19
|
+
|
|
20
|
+
```html
|
|
21
|
+
<script>
|
|
22
|
+
window.Lens=window.Lens||function(){(Lens.q=Lens.q||[]).push(arguments)};
|
|
23
|
+
Lens('init', 'lai_your_access_id');
|
|
24
|
+
</script>
|
|
25
|
+
<script async src="https://cdn.jsdelivr.net/npm/@merittdev/horus-lens/dist/lens.min.js"></script>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Quickstart
|
|
29
|
+
|
|
30
|
+
### React
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { Lens } from '@merittdev/horus-lens/react';
|
|
34
|
+
|
|
35
|
+
// anywhere in your root layout — renders nothing, mounts the overlay
|
|
36
|
+
<Lens
|
|
37
|
+
accessId="lai_your_access_id"
|
|
38
|
+
app={{ release: APP_VERSION, gitSha: COMMIT_SHA, user: { id: user.id } }}
|
|
39
|
+
/>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The React entry additionally captures the React component tree of whatever element
|
|
43
|
+
the reporter picks. Use `enabled={isPreviewEnv}` to force the overlay on (e.g. every
|
|
44
|
+
preview deployment). Wrap children with `<Lens>` only when a descendant needs the
|
|
45
|
+
`useLens()` hook for programmatic control.
|
|
46
|
+
|
|
47
|
+
### Script tag
|
|
48
|
+
|
|
49
|
+
Context can be pushed before the bundle even loads:
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
Lens('identify', { id: 'u_42', email: 'sarah@acme.com' });
|
|
53
|
+
Lens('app', { release: 'v2.14.3', featureFlags: { newCheckout: true } });
|
|
54
|
+
Lens('open'); // open the report panel programmatically
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Dashboard (your own admin, no hosted dashboard)
|
|
58
|
+
|
|
59
|
+
One component, one config. On an access-controlled page (your admin auth is the
|
|
60
|
+
gate), read the credentials server-side and hand them to the component:
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
// page.tsx — server component, env stays on the server
|
|
64
|
+
import LensPageClient from './LensPageClient';
|
|
65
|
+
|
|
66
|
+
export default function Page() {
|
|
67
|
+
return <LensPageClient config={{ projects: JSON.parse(process.env.LENS_PROJECTS ?? '[]') }} />;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// LensPageClient.tsx — client component
|
|
71
|
+
'use client'
|
|
72
|
+
import { LensProvider, LensAdmin, type LensAdminConfig } from '@merittdev/horus-lens/dashboard';
|
|
73
|
+
import '@merittdev/horus-lens/dist/dashboard.css';
|
|
74
|
+
|
|
75
|
+
export default function LensPageClient({ config }: { config: LensAdminConfig }) {
|
|
76
|
+
return (
|
|
77
|
+
<LensProvider config={config}>
|
|
78
|
+
<LensAdmin />
|
|
79
|
+
</LensProvider>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
LENS_PROJECTS=[{"name":"front","accessId":"lai_…","secretKey":"las_…"}]
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
No projects yet? Pass `config={{ projects: [], adminToken: process.env.LENS_ADMIN_TOKEN }}`
|
|
89
|
+
and the built-in wizard mints the first project and hands you that env line.
|
|
90
|
+
|
|
91
|
+
You get the full surface: reports (search + pagination + shareable
|
|
92
|
+
`?report=` deep links), replay player, integrations (OAuth to
|
|
93
|
+
Linear/GitHub/Jira with provider-fed dropdowns), project switcher, onboarding.
|
|
94
|
+
Light-first monochrome; dark mode via `theme="dark"`, `.dark`, or
|
|
95
|
+
`[data-theme="dark"]`.
|
|
96
|
+
|
|
97
|
+
Prefer keys to never reach the browser at all (shared machines, stricter
|
|
98
|
+
compliance)? Use proxy mode instead: mount the package's server handlers and
|
|
99
|
+
drop the `config` prop — see `@merittdev/horus-lens/server`
|
|
100
|
+
(`createLensProxy` + `createLensProjectsRoute`). Piecemeal components
|
|
101
|
+
(`ReportsTable`, `ReportDetail`, …) remain exported for custom layouts.
|
|
102
|
+
|
|
103
|
+
## When does the overlay appear?
|
|
104
|
+
|
|
105
|
+
Never, for normal visitors. The SDK stays dormant until a page is opened with
|
|
106
|
+
**`?lens=true`** — then the pill appears and persists for the session
|
|
107
|
+
(`?lens=false` turns it off). Zero bundle cost for real users when you gate the
|
|
108
|
+
import on the same check.
|
|
109
|
+
|
|
110
|
+
## Keys
|
|
111
|
+
|
|
112
|
+
- `lai_…` **access id** — public by design (like a GA measurement id). Enforced by a
|
|
113
|
+
per-project origin allowlist and rate limits on the API.
|
|
114
|
+
- `las_…` **secret key** — full project access. Read it server-side and hand it only
|
|
115
|
+
to access-controlled surfaces (your admin page via `<LensProvider config>`), CI, or
|
|
116
|
+
the management API — never a public page.
|
|
117
|
+
|
|
118
|
+
The SDK talks to the hosted Lens API out of the box — no endpoint configuration.
|
|
119
|
+
Self-hosting? Pass `endpoint` (React/script `init` config) to point anywhere else.
|
|
120
|
+
|
|
121
|
+
## Self-hosting
|
|
122
|
+
|
|
123
|
+
The Lens API is a single Docker image (Fastify + Postgres + your own S3 bucket —
|
|
124
|
+
assets upload browser→S3 via presigned URLs and never transit the API). See the
|
|
125
|
+
[repository](https://github.com/Meritt-dev/horus-lens) for deployment docs.
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
MIT © Meritt Dev
|
package/dist/browser.cjs
CHANGED
|
@@ -29086,7 +29086,7 @@ var ConnectIntegrationResponseSchema = external_exports.object({
|
|
|
29086
29086
|
// ../core/dist/index.js
|
|
29087
29087
|
var SDK_NAME = "@merittdev/horus-lens";
|
|
29088
29088
|
var SDK_VERSION = "0.0.1";
|
|
29089
|
-
var DEFAULT_ENDPOINT = "
|
|
29089
|
+
var DEFAULT_ENDPOINT = "https://api-lens.meritt.app";
|
|
29090
29090
|
var DEFAULT_REPLAY_WINDOW_MS = 15e3;
|
|
29091
29091
|
var DEFAULT_MAX_CONSOLE_ENTRIES = 200;
|
|
29092
29092
|
var DEFAULT_MAX_NETWORK_ENTRIES = 100;
|