@merittdev/horus-lens 0.0.2 → 0.1.0
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 +18 -27
- package/dist/browser.cjs +1 -83
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.js +2 -4
- package/dist/{chunk-DU7HNRF4.js → chunk-A6SNBIRS.js} +2 -2
- package/dist/{chunk-S6S3ZZQA.js → chunk-MTQ3IO4U.js} +13628 -967
- package/dist/chunk-MTQ3IO4U.js.map +1 -0
- package/dist/index.cjs +1 -109
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -165
- package/dist/index.d.ts +1 -165
- package/dist/index.js +1 -29
- package/dist/lens.min.js +31 -31
- package/dist/lens.min.js.map +1 -1
- package/dist/react.cjs +6 -85
- 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 -6
- package/dist/react.js.map +1 -1
- package/package.json +5 -13
- package/dist/chunk-DWOH2ENF.js +0 -17613
- package/dist/chunk-DWOH2ENF.js.map +0 -1
- package/dist/chunk-PZ5AY32C.js +0 -10
- package/dist/chunk-PZ5AY32C.js.map +0 -1
- package/dist/chunk-S6S3ZZQA.js.map +0 -1
- package/dist/dashboard.cjs +0 -19774
- package/dist/dashboard.cjs.map +0 -1
- package/dist/dashboard.css +0 -2233
- package/dist/dashboard.d.cts +0 -707
- package/dist/dashboard.d.ts +0 -707
- package/dist/dashboard.js +0 -2237
- package/dist/dashboard.js.map +0 -1
- package/dist/rrweb-EYUUZIYR.js +0 -30
- package/dist/rrweb-EYUUZIYR.js.map +0 -1
- /package/dist/{chunk-DU7HNRF4.js.map → chunk-A6SNBIRS.js.map} +0 -0
package/dist/react.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { ReactNode, Component, ContextType } from 'react';
|
|
3
|
+
import { L as LensConfig, a as LensClient } from './index.d-DOCLVJGS.cjs';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import './index.d-Bzgtl7-B.cjs';
|
|
6
6
|
|
|
@@ -49,13 +49,25 @@ declare const AppContextSchema: z.ZodObject<{
|
|
|
49
49
|
}, z.core.$strip>;
|
|
50
50
|
type AppContext = z.infer<typeof AppContextSchema>;
|
|
51
51
|
|
|
52
|
-
interface
|
|
52
|
+
interface LensProps extends Omit<BootOptions, 'force'> {
|
|
53
53
|
accessId: string;
|
|
54
54
|
/** Activate regardless of ?lens=true — e.g. pass your preview-env flag. */
|
|
55
55
|
enabled?: boolean;
|
|
56
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Optional: <Lens /> mounts standalone anywhere in the tree. Wrap children
|
|
58
|
+
* only when descendants need the `useLens()` context.
|
|
59
|
+
*/
|
|
60
|
+
children?: ReactNode;
|
|
57
61
|
}
|
|
58
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Mounts the Lens issue-capture overlay. Renders nothing itself — drop
|
|
64
|
+
* `<Lens accessId="lai_…" />` into your root layout and the overlay appears
|
|
65
|
+
* for sessions gated in via `?lens=true` (or force it with `enabled`).
|
|
66
|
+
*/
|
|
67
|
+
declare function Lens(props: LensProps): react.JSX.Element;
|
|
68
|
+
/** Back-compat alias — `<Lens />` is the canonical name. */
|
|
69
|
+
declare const LensProvider: typeof Lens;
|
|
70
|
+
type LensProviderProps = LensProps;
|
|
59
71
|
|
|
60
72
|
interface Identity {
|
|
61
73
|
id?: string;
|
|
@@ -97,4 +109,4 @@ declare class LensErrorBoundary extends Component<Props, State> {
|
|
|
97
109
|
/** Walk the React fiber tree from `el` upward, collecting component names. */
|
|
98
110
|
declare function getComponentStack(el: Element): string[];
|
|
99
111
|
|
|
100
|
-
export { LensErrorBoundary, LensProvider, type LensProviderProps, getComponentStack, isGateActive, useLens };
|
|
112
|
+
export { Lens, LensErrorBoundary, type LensProps, LensProvider, type LensProviderProps, getComponentStack, isGateActive, useLens };
|
package/dist/react.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { ReactNode, Component, ContextType } from 'react';
|
|
3
|
+
import { L as LensConfig, a as LensClient } from './index.d-BA540Fae.js';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import './index.d-Bzgtl7-B.js';
|
|
6
6
|
|
|
@@ -49,13 +49,25 @@ declare const AppContextSchema: z.ZodObject<{
|
|
|
49
49
|
}, z.core.$strip>;
|
|
50
50
|
type AppContext = z.infer<typeof AppContextSchema>;
|
|
51
51
|
|
|
52
|
-
interface
|
|
52
|
+
interface LensProps extends Omit<BootOptions, 'force'> {
|
|
53
53
|
accessId: string;
|
|
54
54
|
/** Activate regardless of ?lens=true — e.g. pass your preview-env flag. */
|
|
55
55
|
enabled?: boolean;
|
|
56
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Optional: <Lens /> mounts standalone anywhere in the tree. Wrap children
|
|
58
|
+
* only when descendants need the `useLens()` context.
|
|
59
|
+
*/
|
|
60
|
+
children?: ReactNode;
|
|
57
61
|
}
|
|
58
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Mounts the Lens issue-capture overlay. Renders nothing itself — drop
|
|
64
|
+
* `<Lens accessId="lai_…" />` into your root layout and the overlay appears
|
|
65
|
+
* for sessions gated in via `?lens=true` (or force it with `enabled`).
|
|
66
|
+
*/
|
|
67
|
+
declare function Lens(props: LensProps): react.JSX.Element;
|
|
68
|
+
/** Back-compat alias — `<Lens />` is the canonical name. */
|
|
69
|
+
declare const LensProvider: typeof Lens;
|
|
70
|
+
type LensProviderProps = LensProps;
|
|
59
71
|
|
|
60
72
|
interface Identity {
|
|
61
73
|
id?: string;
|
|
@@ -97,4 +109,4 @@ declare class LensErrorBoundary extends Component<Props, State> {
|
|
|
97
109
|
/** Walk the React fiber tree from `el` upward, collecting component names. */
|
|
98
110
|
declare function getComponentStack(el: Element): string[];
|
|
99
111
|
|
|
100
|
-
export { LensErrorBoundary, LensProvider, type LensProviderProps, getComponentStack, isGateActive, useLens };
|
|
112
|
+
export { Lens, LensErrorBoundary, type LensProps, LensProvider, type LensProviderProps, getComponentStack, isGateActive, useLens };
|
package/dist/react.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
boot,
|
|
3
3
|
isGateActive
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-DWOH2ENF.js";
|
|
7
|
-
import "./chunk-PZ5AY32C.js";
|
|
4
|
+
} from "./chunk-A6SNBIRS.js";
|
|
5
|
+
import "./chunk-MTQ3IO4U.js";
|
|
8
6
|
|
|
9
7
|
// ../react/dist/index.js
|
|
10
8
|
import { useEffect, useState } from "react";
|
|
@@ -14,7 +12,7 @@ import { useContext } from "react";
|
|
|
14
12
|
import { Component } from "react";
|
|
15
13
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
16
14
|
var LensContext = createContext(null);
|
|
17
|
-
function
|
|
15
|
+
function Lens(props) {
|
|
18
16
|
const { children, enabled, ...bootOptions } = props;
|
|
19
17
|
const [browser, setBrowser] = useState(null);
|
|
20
18
|
useEffect(() => {
|
|
@@ -28,8 +26,9 @@ function LensProvider(props) {
|
|
|
28
26
|
setBrowser(null);
|
|
29
27
|
};
|
|
30
28
|
}, [props.accessId]);
|
|
31
|
-
return /* @__PURE__ */ jsx(LensContext.Provider, { value: browser, children });
|
|
29
|
+
return /* @__PURE__ */ jsx(LensContext.Provider, { value: browser, children: children ?? null });
|
|
32
30
|
}
|
|
31
|
+
var LensProvider = Lens;
|
|
33
32
|
function useLens() {
|
|
34
33
|
const browser = useContext(LensContext);
|
|
35
34
|
return {
|
|
@@ -99,6 +98,7 @@ function getComponentStack(el) {
|
|
|
99
98
|
return names;
|
|
100
99
|
}
|
|
101
100
|
export {
|
|
101
|
+
Lens,
|
|
102
102
|
LensErrorBoundary,
|
|
103
103
|
LensProvider,
|
|
104
104
|
getComponentStack,
|
package/dist/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../react/src/provider.tsx","../../react/src/context.ts","../../react/src/use-lens.ts","../../react/src/error-boundary.tsx","../../react/src/fiber.ts","../../react/src/index.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport type { ReactNode } from 'react';\nimport { boot } from '@horus-lens/browser';\nimport type { BootOptions, LensBrowser } from '@horus-lens/browser';\nimport { LensContext } from './context.js';\n\nexport interface
|
|
1
|
+
{"version":3,"sources":["../../react/src/provider.tsx","../../react/src/context.ts","../../react/src/use-lens.ts","../../react/src/error-boundary.tsx","../../react/src/fiber.ts","../../react/src/index.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport type { ReactNode } from 'react';\nimport { boot } from '@horus-lens/browser';\nimport type { BootOptions, LensBrowser } from '@horus-lens/browser';\nimport { LensContext } from './context.js';\n\nexport interface LensProps extends Omit<BootOptions, 'force'> {\n accessId: string;\n /** Activate regardless of ?lens=true — e.g. pass your preview-env flag. */\n enabled?: boolean;\n /**\n * Optional: <Lens /> mounts standalone anywhere in the tree. Wrap children\n * only when descendants need the `useLens()` context.\n */\n children?: ReactNode;\n}\n\n/**\n * Mounts the Lens issue-capture overlay. Renders nothing itself — drop\n * `<Lens accessId=\"lai_…\" />` into your root layout and the overlay appears\n * for sessions gated in via `?lens=true` (or force it with `enabled`).\n */\nexport function Lens(props: LensProps) {\n const { children, enabled, ...bootOptions } = props;\n const [browser, setBrowser] = useState<LensBrowser | null>(null);\n\n useEffect(() => {\n const instance = boot({ ...bootOptions, force: enabled });\n if (instance) {\n instance.client.setApp({ extra: { framework: 'react' } });\n }\n setBrowser(instance);\n return () => {\n instance?.destroy();\n setBrowser(null);\n };\n }, [props.accessId]);\n\n return <LensContext.Provider value={browser}>{children ?? null}</LensContext.Provider>;\n}\n\n/** Back-compat alias — `<Lens />` is the canonical name. */\nexport const LensProvider = Lens;\nexport type LensProviderProps = LensProps;\n","import { createContext } from 'react';\nimport type { LensBrowser } from '@horus-lens/browser';\n\nexport const LensContext = createContext<LensBrowser | null>(null);\n","import { useContext } from 'react';\nimport type { AppContext } from '@horus-lens/shared';\nimport { LensContext } from './context.js';\n\ninterface Identity {\n id?: string;\n email?: string;\n name?: string;\n organization?: string;\n}\n\nexport function useLens() {\n const browser = useContext(LensContext);\n\n return {\n active: browser !== null,\n open: () => browser?.open(),\n close: () => browser?.close(),\n identify: (user: Identity) => browser?.client.setApp({ user }),\n setApp: (app: Partial<AppContext>) => browser?.client.setApp(app),\n report: async (input?: { comment?: string }): Promise<{ reportId: string } | null> => {\n if (!browser) return null;\n return browser.client.submitReport({ comment: input?.comment });\n },\n };\n}\n","import { Component } from 'react';\nimport type { ContextType, ReactNode } from 'react';\nimport { LensContext } from './context.js';\n\ninterface Props {\n children: ReactNode;\n fallback?: ReactNode;\n}\n\ninterface State {\n hasError: boolean;\n}\n\nexport class LensErrorBoundary extends Component<Props, State> {\n static contextType = LensContext;\n declare context: ContextType<typeof LensContext>;\n\n state: State = { hasError: false };\n\n static getDerivedStateFromError(): State {\n return { hasError: true };\n }\n\n componentDidCatch(error: Error) {\n const browser = this.context;\n if (browser) {\n browser.client.setApp({ extra: { lastBoundaryError: error.message } });\n browser.open();\n }\n }\n\n render() {\n if (this.state.hasError) {\n return (\n this.props.fallback ?? (\n <div\n role=\"alert\"\n style={{\n padding: '12px 16px',\n borderRadius: 8,\n border: '1px solid rgba(0,0,0,0.1)',\n font: '14px system-ui, sans-serif',\n }}\n >\n Something went wrong.\n </div>\n )\n );\n }\n return this.props.children;\n }\n}\n","interface FiberType {\n displayName?: string;\n name?: string;\n render?: { displayName?: string; name?: string };\n}\n\ninterface FiberNode {\n type?: FiberType | string | null;\n return?: FiberNode | null;\n}\n\nfunction nameOf(type: FiberNode['type']): string | undefined {\n if (!type || typeof type === 'string') return undefined;\n return type.displayName ?? type.name ?? type.render?.displayName ?? type.render?.name;\n}\n\n/** Walk the React fiber tree from `el` upward, collecting component names. */\nexport function getComponentStack(el: Element): string[] {\n const names: string[] = [];\n try {\n const key = Object.keys(el).find((k) => k.startsWith('__reactFiber$'));\n if (!key) return names;\n\n let fiber = (el as unknown as Record<string, FiberNode | undefined>)[key] ?? null;\n const seen = new Set<FiberNode>();\n while (fiber && !seen.has(fiber)) {\n seen.add(fiber);\n const name = nameOf(fiber.type);\n if (name) names.push(name);\n fiber = fiber.return ?? null;\n }\n } catch {\n return names;\n }\n return names;\n}\n","export { Lens, LensProvider } from './provider.js';\nexport type { LensProps, LensProviderProps } from './provider.js';\nexport { useLens } from './use-lens.js';\nexport { LensErrorBoundary } from './error-boundary.js';\nexport { getComponentStack } from './fiber.js';\nexport { isGateActive } from '@horus-lens/browser';\n"],"mappings":";;;;;;;AAAA,SAAS,WAAW,gBAAgB;ACApC,SAAS,qBAAqB;ADsCrB,SAAA,WAAA;AEtCT,SAAS,kBAAkB;ACA3B,SAAS,iBAAiB;AAmChB,SAAA,OAAAA,YAAA;AFhCH,IAAM,cAAc,cAAkC,IAAI;ADmB1D,SAAS,KAAK,OAAkB;AACrC,QAAM,EAAE,UAAU,SAAS,GAAG,YAAY,IAAI;AAC9C,QAAM,CAAC,SAAS,UAAU,IAAI,SAA6B,IAAI;AAE/D,YAAU,MAAM;AACd,UAAM,WAAW,KAAK,EAAE,GAAG,aAAa,OAAO,QAAQ,CAAC;AACxD,QAAI,UAAU;AACZ,eAAS,OAAO,OAAO,EAAE,OAAO,EAAE,WAAW,QAAQ,EAAE,CAAC;IAC1D;AACA,eAAW,QAAQ;AACnB,WAAO,MAAM;AACX,gBAAU,QAAQ;AAClB,iBAAW,IAAI;IACjB;EACF,GAAG,CAAC,MAAM,QAAQ,CAAC;AAEnB,SAAO,oBAAC,YAAY,UAAZ,EAAqB,OAAO,SAAU,UAAA,YAAY,KAAA,CAAK;AACjE;AAGO,IAAM,eAAe;AE/BrB,SAAS,UAAU;AACxB,Q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AI,QAAS,GAAwD,GAAG,KAAK;AAC7E,UAAM,OAAO,oBAAI,IAAe;AAChC,WAAO,SAAS,CAAC,KAAK,IAAI,KAAK,GAAG;AAChC,WAAK,IAAI,KAAK;AACd,YAAM,OAAO,OAAO,MAAM,IAAI;AAC9B,UAAI,KAAM,OAAM,KAAK,IAAI;AACzB,cAAQ,MAAM,UAAU;IAC1B;EACF,QAAQ;AACN,WAAO;EACT;AACA,SAAO;AACT;","names":["jsx","jsx"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@merittdev/horus-lens",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "Lens — context-rich issue capture for web apps: overlay, replay, and drop-in
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Lens — context-rich issue capture SDK for web apps: overlay, session replay, and drop-in browser/React capture",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": false,
|
|
@@ -27,13 +27,6 @@
|
|
|
27
27
|
"import": "./dist/react.js",
|
|
28
28
|
"require": "./dist/react.cjs"
|
|
29
29
|
},
|
|
30
|
-
"./dashboard": {
|
|
31
|
-
"types": "./dist/dashboard.d.ts",
|
|
32
|
-
"import": "./dist/dashboard.js",
|
|
33
|
-
"require": "./dist/dashboard.cjs"
|
|
34
|
-
},
|
|
35
|
-
"./dashboard/styles.css": "./dist/dashboard.css",
|
|
36
|
-
"./dist/dashboard.css": "./dist/dashboard.css",
|
|
37
30
|
"./cdn": "./dist/lens.min.js"
|
|
38
31
|
},
|
|
39
32
|
"peerDependencies": {
|
|
@@ -52,10 +45,9 @@
|
|
|
52
45
|
"tsup": "^8.4.0",
|
|
53
46
|
"typescript": "^5.7.3",
|
|
54
47
|
"@horus-lens/browser": "0.0.1",
|
|
55
|
-
"@horus-lens/
|
|
48
|
+
"@horus-lens/core": "0.0.1",
|
|
56
49
|
"@horus-lens/react": "0.0.1",
|
|
57
|
-
"@horus-lens/shared": "0.0.1"
|
|
58
|
-
"@horus-lens/core": "0.0.1"
|
|
50
|
+
"@horus-lens/shared": "0.0.1"
|
|
59
51
|
},
|
|
60
52
|
"publishConfig": {
|
|
61
53
|
"access": "public"
|
|
@@ -82,7 +74,7 @@
|
|
|
82
74
|
"url": "https://github.com/Meritt-dev/horus-lens/issues"
|
|
83
75
|
},
|
|
84
76
|
"scripts": {
|
|
85
|
-
"build": "tsup
|
|
77
|
+
"build": "tsup",
|
|
86
78
|
"typecheck": "tsc --noEmit",
|
|
87
79
|
"clean": "rm -rf dist .turbo"
|
|
88
80
|
}
|