@merittdev/horus-lens 0.0.1
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/dist/browser.cjs +31594 -0
- package/dist/browser.cjs.map +1 -0
- package/dist/browser.d.cts +125 -0
- package/dist/browser.d.ts +125 -0
- package/dist/browser.js +24 -0
- package/dist/browser.js.map +1 -0
- package/dist/chunk-DU7HNRF4.js +1644 -0
- package/dist/chunk-DU7HNRF4.js.map +1 -0
- package/dist/chunk-DWOH2ENF.js +17613 -0
- package/dist/chunk-DWOH2ENF.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/chunk-S6S3ZZQA.js +17225 -0
- package/dist/chunk-S6S3ZZQA.js.map +1 -0
- package/dist/dashboard.cjs +19774 -0
- package/dist/dashboard.cjs.map +1 -0
- package/dist/dashboard.css +2233 -0
- package/dist/dashboard.d.cts +707 -0
- package/dist/dashboard.d.ts +707 -0
- package/dist/dashboard.js +2237 -0
- package/dist/dashboard.js.map +1 -0
- package/dist/index.cjs +30040 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d-BA540Fae.d.ts +80 -0
- package/dist/index.d-Bzgtl7-B.d.cts +161 -0
- package/dist/index.d-Bzgtl7-B.d.ts +161 -0
- package/dist/index.d-DOCLVJGS.d.cts +80 -0
- package/dist/index.d.cts +906 -0
- package/dist/index.d.ts +906 -0
- package/dist/index.js +89 -0
- package/dist/index.js.map +1 -0
- package/dist/lens.min.js +770 -0
- package/dist/lens.min.js.map +1 -0
- package/dist/react.cjs +31683 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +100 -0
- package/dist/react.d.ts +100 -0
- package/dist/react.js +108 -0
- package/dist/react.js.map +1 -0
- package/dist/rrweb-EYUUZIYR.js +30 -0
- package/dist/rrweb-EYUUZIYR.js.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { L as LensConfig, a as LensClient } from './index.d-DOCLVJGS.cjs';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import './index.d-Bzgtl7-B.cjs';
|
|
4
|
+
|
|
5
|
+
declare const AppContextSchema: z.ZodObject<{
|
|
6
|
+
release: z.ZodOptional<z.ZodString>;
|
|
7
|
+
gitSha: z.ZodOptional<z.ZodString>;
|
|
8
|
+
environment: z.ZodOptional<z.ZodString>;
|
|
9
|
+
featureFlags: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodNumber]>>>;
|
|
10
|
+
user: z.ZodOptional<z.ZodObject<{
|
|
11
|
+
id: z.ZodOptional<z.ZodString>;
|
|
12
|
+
email: z.ZodOptional<z.ZodString>;
|
|
13
|
+
name: z.ZodOptional<z.ZodString>;
|
|
14
|
+
organization: z.ZodOptional<z.ZodString>;
|
|
15
|
+
}, z.core.$strip>>;
|
|
16
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
type AppContext = z.infer<typeof AppContextSchema>;
|
|
19
|
+
|
|
20
|
+
/** Read-only gate check (param OR persisted flag). Never mutates storage. */
|
|
21
|
+
declare function isGateActive(paramName?: string): boolean;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The documented loader snippet — a GTM-style inline stub that queues commands
|
|
25
|
+
* until the async bundle loads and replays them. Ship this in docs / install
|
|
26
|
+
* flows so a page can call `Lens('init', ...)` before the SDK is downloaded.
|
|
27
|
+
*/
|
|
28
|
+
interface SnippetOptions {
|
|
29
|
+
accessId: string;
|
|
30
|
+
/** URL of the browser bundle (defaults to the public CDN latest build). */
|
|
31
|
+
cdnUrl?: string;
|
|
32
|
+
}
|
|
33
|
+
declare const DEFAULT_CDN_URL = "https://cdn.lens.dev/browser.js";
|
|
34
|
+
declare function loaderSnippet(options: SnippetOptions): string;
|
|
35
|
+
/** Example snippet string for documentation (placeholder access id + CDN). */
|
|
36
|
+
declare const LOADER_SNIPPET: string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* GTM-style command stub. The loader snippet defines:
|
|
40
|
+
* window.Lens = function(){(window.Lens.q = window.Lens.q||[]).push(arguments)}
|
|
41
|
+
* so pages can call `Lens('init', ...)`, `Lens('identify', user)` etc. before
|
|
42
|
+
* the bundle downloads. On load we drain that queue, then replace the global
|
|
43
|
+
* with a live dispatcher that forwards subsequent calls to the running client.
|
|
44
|
+
*/
|
|
45
|
+
type LensCommand = 'init' | 'identify' | 'app' | 'open';
|
|
46
|
+
interface LensGlobal {
|
|
47
|
+
(...args: unknown[]): void;
|
|
48
|
+
q?: Array<ArrayLike<unknown>>;
|
|
49
|
+
}
|
|
50
|
+
declare global {
|
|
51
|
+
interface Window {
|
|
52
|
+
Lens?: LensGlobal;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** Structured result of replaying the pre-boot command queue. */
|
|
56
|
+
interface QueuedCommands {
|
|
57
|
+
/** `init` argument: an access id string or a partial config object. */
|
|
58
|
+
init?: string | Record<string, unknown>;
|
|
59
|
+
identify?: NonNullable<AppContext['user']>;
|
|
60
|
+
app?: Partial<AppContext>;
|
|
61
|
+
open: boolean;
|
|
62
|
+
}
|
|
63
|
+
/** Drain `window.Lens.q` into a structured shape consumed by boot(). */
|
|
64
|
+
declare function processQueue(): QueuedCommands;
|
|
65
|
+
/**
|
|
66
|
+
* Replace `window.Lens` with a live function that forwards commands to the
|
|
67
|
+
* mounted overlay. Safe to call with `null` (gate inactive) — it installs a
|
|
68
|
+
* no-op-ish dispatcher that only handles future `init`-less commands.
|
|
69
|
+
*/
|
|
70
|
+
declare function installGlobal(browser: LensBrowser | null): void;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Read-only context snapshot rendered as chips in the report panel. URL /
|
|
74
|
+
* route / browser / os / viewport are computed locally; console / network /
|
|
75
|
+
* error counts are not exposed through the public core API, so they are
|
|
76
|
+
* `null` (rendered as neutral placeholders) unless supplied externally.
|
|
77
|
+
*/
|
|
78
|
+
interface OverlayStats {
|
|
79
|
+
url: string;
|
|
80
|
+
route: string;
|
|
81
|
+
browser: string;
|
|
82
|
+
os: string;
|
|
83
|
+
viewport: {
|
|
84
|
+
width: number;
|
|
85
|
+
height: number;
|
|
86
|
+
};
|
|
87
|
+
replay: boolean;
|
|
88
|
+
console: number | null;
|
|
89
|
+
network: number | null;
|
|
90
|
+
errors: number | null;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
interface BootOptions extends Partial<Omit<LensConfig, 'accessId'>> {
|
|
94
|
+
/** Falls back to a `<script data-lens-id>` attribute or a queued `init` call. */
|
|
95
|
+
accessId?: string;
|
|
96
|
+
/** Query param that gates activation. Default `'lens'` → `?lens=true`. */
|
|
97
|
+
paramName?: string;
|
|
98
|
+
/** Bypass the query-param gate (preview envs / the React provider). */
|
|
99
|
+
force?: boolean;
|
|
100
|
+
}
|
|
101
|
+
interface LensBrowser {
|
|
102
|
+
client: LensClient;
|
|
103
|
+
/** Open the report panel. */
|
|
104
|
+
open(): void;
|
|
105
|
+
/** Close the report panel (overlay stays mounted). */
|
|
106
|
+
close(): void;
|
|
107
|
+
/** Remove the overlay, stop the client, and clear gate persistence. */
|
|
108
|
+
destroy(): void;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Boot the overlay: gate check → resolve access id → start a LensClient →
|
|
113
|
+
* mount the overlay → wire the global command dispatcher. Returns `null` on the
|
|
114
|
+
* server, when the gate is inactive, or when no access id can be resolved.
|
|
115
|
+
*/
|
|
116
|
+
declare function boot(options?: BootOptions): LensBrowser | null;
|
|
117
|
+
/**
|
|
118
|
+
* Auto-boot on bundle load when a queued `init` command or a
|
|
119
|
+
* `<script data-lens-id>` attribute supplies an access id and the gate is
|
|
120
|
+
* active. No-op during SSR. Exposed so the entry can self-initialize when
|
|
121
|
+
* loaded via the CDN snippet, while ESM consumers call `boot()` directly.
|
|
122
|
+
*/
|
|
123
|
+
declare function autoBoot(): LensBrowser | null;
|
|
124
|
+
|
|
125
|
+
export { type BootOptions, DEFAULT_CDN_URL, LOADER_SNIPPET, type LensBrowser, type LensCommand, type LensGlobal, type OverlayStats, type QueuedCommands, type SnippetOptions, autoBoot, boot, installGlobal, isGateActive, loaderSnippet, processQueue };
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { L as LensConfig, a as LensClient } from './index.d-BA540Fae.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import './index.d-Bzgtl7-B.js';
|
|
4
|
+
|
|
5
|
+
declare const AppContextSchema: z.ZodObject<{
|
|
6
|
+
release: z.ZodOptional<z.ZodString>;
|
|
7
|
+
gitSha: z.ZodOptional<z.ZodString>;
|
|
8
|
+
environment: z.ZodOptional<z.ZodString>;
|
|
9
|
+
featureFlags: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodNumber]>>>;
|
|
10
|
+
user: z.ZodOptional<z.ZodObject<{
|
|
11
|
+
id: z.ZodOptional<z.ZodString>;
|
|
12
|
+
email: z.ZodOptional<z.ZodString>;
|
|
13
|
+
name: z.ZodOptional<z.ZodString>;
|
|
14
|
+
organization: z.ZodOptional<z.ZodString>;
|
|
15
|
+
}, z.core.$strip>>;
|
|
16
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
type AppContext = z.infer<typeof AppContextSchema>;
|
|
19
|
+
|
|
20
|
+
/** Read-only gate check (param OR persisted flag). Never mutates storage. */
|
|
21
|
+
declare function isGateActive(paramName?: string): boolean;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The documented loader snippet — a GTM-style inline stub that queues commands
|
|
25
|
+
* until the async bundle loads and replays them. Ship this in docs / install
|
|
26
|
+
* flows so a page can call `Lens('init', ...)` before the SDK is downloaded.
|
|
27
|
+
*/
|
|
28
|
+
interface SnippetOptions {
|
|
29
|
+
accessId: string;
|
|
30
|
+
/** URL of the browser bundle (defaults to the public CDN latest build). */
|
|
31
|
+
cdnUrl?: string;
|
|
32
|
+
}
|
|
33
|
+
declare const DEFAULT_CDN_URL = "https://cdn.lens.dev/browser.js";
|
|
34
|
+
declare function loaderSnippet(options: SnippetOptions): string;
|
|
35
|
+
/** Example snippet string for documentation (placeholder access id + CDN). */
|
|
36
|
+
declare const LOADER_SNIPPET: string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* GTM-style command stub. The loader snippet defines:
|
|
40
|
+
* window.Lens = function(){(window.Lens.q = window.Lens.q||[]).push(arguments)}
|
|
41
|
+
* so pages can call `Lens('init', ...)`, `Lens('identify', user)` etc. before
|
|
42
|
+
* the bundle downloads. On load we drain that queue, then replace the global
|
|
43
|
+
* with a live dispatcher that forwards subsequent calls to the running client.
|
|
44
|
+
*/
|
|
45
|
+
type LensCommand = 'init' | 'identify' | 'app' | 'open';
|
|
46
|
+
interface LensGlobal {
|
|
47
|
+
(...args: unknown[]): void;
|
|
48
|
+
q?: Array<ArrayLike<unknown>>;
|
|
49
|
+
}
|
|
50
|
+
declare global {
|
|
51
|
+
interface Window {
|
|
52
|
+
Lens?: LensGlobal;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** Structured result of replaying the pre-boot command queue. */
|
|
56
|
+
interface QueuedCommands {
|
|
57
|
+
/** `init` argument: an access id string or a partial config object. */
|
|
58
|
+
init?: string | Record<string, unknown>;
|
|
59
|
+
identify?: NonNullable<AppContext['user']>;
|
|
60
|
+
app?: Partial<AppContext>;
|
|
61
|
+
open: boolean;
|
|
62
|
+
}
|
|
63
|
+
/** Drain `window.Lens.q` into a structured shape consumed by boot(). */
|
|
64
|
+
declare function processQueue(): QueuedCommands;
|
|
65
|
+
/**
|
|
66
|
+
* Replace `window.Lens` with a live function that forwards commands to the
|
|
67
|
+
* mounted overlay. Safe to call with `null` (gate inactive) — it installs a
|
|
68
|
+
* no-op-ish dispatcher that only handles future `init`-less commands.
|
|
69
|
+
*/
|
|
70
|
+
declare function installGlobal(browser: LensBrowser | null): void;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Read-only context snapshot rendered as chips in the report panel. URL /
|
|
74
|
+
* route / browser / os / viewport are computed locally; console / network /
|
|
75
|
+
* error counts are not exposed through the public core API, so they are
|
|
76
|
+
* `null` (rendered as neutral placeholders) unless supplied externally.
|
|
77
|
+
*/
|
|
78
|
+
interface OverlayStats {
|
|
79
|
+
url: string;
|
|
80
|
+
route: string;
|
|
81
|
+
browser: string;
|
|
82
|
+
os: string;
|
|
83
|
+
viewport: {
|
|
84
|
+
width: number;
|
|
85
|
+
height: number;
|
|
86
|
+
};
|
|
87
|
+
replay: boolean;
|
|
88
|
+
console: number | null;
|
|
89
|
+
network: number | null;
|
|
90
|
+
errors: number | null;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
interface BootOptions extends Partial<Omit<LensConfig, 'accessId'>> {
|
|
94
|
+
/** Falls back to a `<script data-lens-id>` attribute or a queued `init` call. */
|
|
95
|
+
accessId?: string;
|
|
96
|
+
/** Query param that gates activation. Default `'lens'` → `?lens=true`. */
|
|
97
|
+
paramName?: string;
|
|
98
|
+
/** Bypass the query-param gate (preview envs / the React provider). */
|
|
99
|
+
force?: boolean;
|
|
100
|
+
}
|
|
101
|
+
interface LensBrowser {
|
|
102
|
+
client: LensClient;
|
|
103
|
+
/** Open the report panel. */
|
|
104
|
+
open(): void;
|
|
105
|
+
/** Close the report panel (overlay stays mounted). */
|
|
106
|
+
close(): void;
|
|
107
|
+
/** Remove the overlay, stop the client, and clear gate persistence. */
|
|
108
|
+
destroy(): void;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Boot the overlay: gate check → resolve access id → start a LensClient →
|
|
113
|
+
* mount the overlay → wire the global command dispatcher. Returns `null` on the
|
|
114
|
+
* server, when the gate is inactive, or when no access id can be resolved.
|
|
115
|
+
*/
|
|
116
|
+
declare function boot(options?: BootOptions): LensBrowser | null;
|
|
117
|
+
/**
|
|
118
|
+
* Auto-boot on bundle load when a queued `init` command or a
|
|
119
|
+
* `<script data-lens-id>` attribute supplies an access id and the gate is
|
|
120
|
+
* active. No-op during SSR. Exposed so the entry can self-initialize when
|
|
121
|
+
* loaded via the CDN snippet, while ESM consumers call `boot()` directly.
|
|
122
|
+
*/
|
|
123
|
+
declare function autoBoot(): LensBrowser | null;
|
|
124
|
+
|
|
125
|
+
export { type BootOptions, DEFAULT_CDN_URL, LOADER_SNIPPET, type LensBrowser, type LensCommand, type LensGlobal, type OverlayStats, type QueuedCommands, type SnippetOptions, autoBoot, boot, installGlobal, isGateActive, loaderSnippet, processQueue };
|
package/dist/browser.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_CDN_URL,
|
|
3
|
+
LOADER_SNIPPET,
|
|
4
|
+
autoBoot,
|
|
5
|
+
boot,
|
|
6
|
+
installGlobal,
|
|
7
|
+
isGateActive,
|
|
8
|
+
loaderSnippet,
|
|
9
|
+
processQueue
|
|
10
|
+
} from "./chunk-DU7HNRF4.js";
|
|
11
|
+
import "./chunk-S6S3ZZQA.js";
|
|
12
|
+
import "./chunk-DWOH2ENF.js";
|
|
13
|
+
import "./chunk-PZ5AY32C.js";
|
|
14
|
+
export {
|
|
15
|
+
DEFAULT_CDN_URL,
|
|
16
|
+
LOADER_SNIPPET,
|
|
17
|
+
autoBoot,
|
|
18
|
+
boot,
|
|
19
|
+
installGlobal,
|
|
20
|
+
isGateActive,
|
|
21
|
+
loaderSnippet,
|
|
22
|
+
processQueue
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|