@merittdev/horus-lens 0.0.2 → 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 CHANGED
@@ -30,20 +30,19 @@ Or with a script tag (any website — no build step):
30
30
  ### React
31
31
 
32
32
  ```tsx
33
- import { LensProvider } from '@merittdev/horus-lens/react';
33
+ import { Lens } from '@merittdev/horus-lens/react';
34
34
 
35
- <LensProvider
35
+ // anywhere in your root layout — renders nothing, mounts the overlay
36
+ <Lens
36
37
  accessId="lai_your_access_id"
37
- endpoint="https://api-lens.meritt.app"
38
38
  app={{ release: APP_VERSION, gitSha: COMMIT_SHA, user: { id: user.id } }}
39
- >
40
- <App />
41
- </LensProvider>
39
+ />
42
40
  ```
43
41
 
44
42
  The React entry additionally captures the React component tree of whatever element
45
43
  the reporter picks. Use `enabled={isPreviewEnv}` to force the overlay on (e.g. every
46
- preview deployment), and `useLens()` for programmatic control.
44
+ preview deployment). Wrap children with `<Lens>` only when a descendant needs the
45
+ `useLens()` hook for programmatic control.
47
46
 
48
47
  ### Script tag
49
48
 
@@ -55,26 +54,51 @@ Lens('app', { release: 'v2.14.3', featureFlags: { newCheckout: true } });
55
54
  Lens('open'); // open the report panel programmatically
56
55
  ```
57
56
 
58
- ### Dashboard components (your own admin, no hosted dashboard)
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:
59
61
 
60
62
  ```tsx
61
- import {
62
- createLensApi, LensDashboardProvider,
63
- ReportsTable, ReportDetail, IntegrationSettings, OnboardingWizard,
64
- } from '@merittdev/horus-lens/dashboard';
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';
65
73
  import '@merittdev/horus-lens/dist/dashboard.css';
66
74
 
67
- const api = createLensApi({
68
- baseUrl: '/api/lens', // your server-side proxy
69
- getToken: () => '', // credentials attach server-side — never in the browser
70
- });
75
+ export default function LensPageClient({ config }: { config: LensAdminConfig }) {
76
+ return (
77
+ <LensProvider config={config}>
78
+ <LensAdmin />
79
+ </LensProvider>
80
+ );
81
+ }
71
82
  ```
72
83
 
73
- Ships a reports table (search + pagination), tabbed report detail with a replay
74
- player, integration management (OAuth to Linear/GitHub/Jira, single active
75
- destination), and a self-serve onboarding wizard. Light-first monochrome design that
76
- drops into any admin; dark mode via `.dark`, `[data-theme="dark"]`, or
77
- `<LensDashboardProvider theme="dark">`.
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.
78
102
 
79
103
  ## When does the overlay appear?
80
104
 
@@ -87,7 +111,12 @@ import on the same check.
87
111
 
88
112
  - `lai_…` **access id** — public by design (like a GA measurement id). Enforced by a
89
113
  per-project origin allowlist and rate limits on the API.
90
- - `las_…` **secret key** — server-side only: management API, dashboard proxy, CI.
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.
91
120
 
92
121
  ## Self-hosting
93
122
 
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 = "http://localhost:5625";
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;