@amplitude/amp-semantic 0.2.0-codexsemantic-review-integration.0 → 0.2.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 +8 -237
- package/lib/cjs/capture.d.ts +5 -5
- package/lib/cjs/capture.d.ts.map +1 -1
- package/lib/cjs/capture.js +48 -56
- package/lib/cjs/capture.js.map +1 -1
- package/lib/cjs/index.d.ts +4 -13
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +7 -32
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/types.d.ts +33 -235
- package/lib/cjs/types.d.ts.map +1 -1
- package/lib/cjs/types.js.map +1 -1
- package/lib/esm/capture.d.ts +5 -5
- package/lib/esm/capture.d.ts.map +1 -1
- package/lib/esm/capture.js +47 -55
- package/lib/esm/capture.js.map +1 -1
- package/lib/esm/index.d.ts +4 -13
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +6 -22
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/types.d.ts +33 -235
- package/lib/esm/types.d.ts.map +1 -1
- package/lib/esm/types.js.map +1 -1
- package/package.json +8 -10
- package/lib/cjs/helpers.d.ts +0 -9
- package/lib/cjs/helpers.d.ts.map +0 -1
- package/lib/cjs/helpers.js +0 -469
- package/lib/cjs/helpers.js.map +0 -1
- package/lib/cjs/recorders/analytics.d.ts +0 -7
- package/lib/cjs/recorders/analytics.d.ts.map +0 -1
- package/lib/cjs/recorders/analytics.js +0 -95
- package/lib/cjs/recorders/analytics.js.map +0 -1
- package/lib/cjs/recorders/feedback.d.ts +0 -4
- package/lib/cjs/recorders/feedback.d.ts.map +0 -1
- package/lib/cjs/recorders/feedback.js +0 -611
- package/lib/cjs/recorders/feedback.js.map +0 -1
- package/lib/cjs/recorders/interactions.d.ts +0 -4
- package/lib/cjs/recorders/interactions.d.ts.map +0 -1
- package/lib/cjs/recorders/interactions.js +0 -320
- package/lib/cjs/recorders/interactions.js.map +0 -1
- package/lib/cjs/recorders/keys.d.ts +0 -4
- package/lib/cjs/recorders/keys.d.ts.map +0 -1
- package/lib/cjs/recorders/keys.js +0 -64
- package/lib/cjs/recorders/keys.js.map +0 -1
- package/lib/cjs/recorders/lifecycle.d.ts +0 -4
- package/lib/cjs/recorders/lifecycle.d.ts.map +0 -1
- package/lib/cjs/recorders/lifecycle.js +0 -86
- package/lib/cjs/recorders/lifecycle.js.map +0 -1
- package/lib/cjs/recorders/navigation.d.ts +0 -4
- package/lib/cjs/recorders/navigation.d.ts.map +0 -1
- package/lib/cjs/recorders/navigation.js +0 -18
- package/lib/cjs/recorders/navigation.js.map +0 -1
- package/lib/cjs/recorders/resource-error.d.ts +0 -4
- package/lib/cjs/recorders/resource-error.d.ts.map +0 -1
- package/lib/cjs/recorders/resource-error.js +0 -159
- package/lib/cjs/recorders/resource-error.js.map +0 -1
- package/lib/esm/helpers.d.ts +0 -9
- package/lib/esm/helpers.d.ts.map +0 -1
- package/lib/esm/helpers.js +0 -461
- package/lib/esm/helpers.js.map +0 -1
- package/lib/esm/recorders/analytics.d.ts +0 -7
- package/lib/esm/recorders/analytics.d.ts.map +0 -1
- package/lib/esm/recorders/analytics.js +0 -92
- package/lib/esm/recorders/analytics.js.map +0 -1
- package/lib/esm/recorders/feedback.d.ts +0 -4
- package/lib/esm/recorders/feedback.d.ts.map +0 -1
- package/lib/esm/recorders/feedback.js +0 -608
- package/lib/esm/recorders/feedback.js.map +0 -1
- package/lib/esm/recorders/interactions.d.ts +0 -4
- package/lib/esm/recorders/interactions.d.ts.map +0 -1
- package/lib/esm/recorders/interactions.js +0 -317
- package/lib/esm/recorders/interactions.js.map +0 -1
- package/lib/esm/recorders/keys.d.ts +0 -4
- package/lib/esm/recorders/keys.d.ts.map +0 -1
- package/lib/esm/recorders/keys.js +0 -61
- package/lib/esm/recorders/keys.js.map +0 -1
- package/lib/esm/recorders/lifecycle.d.ts +0 -4
- package/lib/esm/recorders/lifecycle.d.ts.map +0 -1
- package/lib/esm/recorders/lifecycle.js +0 -83
- package/lib/esm/recorders/lifecycle.js.map +0 -1
- package/lib/esm/recorders/navigation.d.ts +0 -4
- package/lib/esm/recorders/navigation.d.ts.map +0 -1
- package/lib/esm/recorders/navigation.js +0 -15
- package/lib/esm/recorders/navigation.js.map +0 -1
- package/lib/esm/recorders/resource-error.d.ts +0 -4
- package/lib/esm/recorders/resource-error.d.ts.map +0 -1
- package/lib/esm/recorders/resource-error.js +0 -156
- package/lib/esm/recorders/resource-error.js.map +0 -1
- package/schema.json +0 -1110
package/lib/cjs/index.js
CHANGED
|
@@ -1,43 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createSemanticCapture = exports.getDocumentIdentity = exports.
|
|
3
|
+
exports.createSemanticCapture = exports.getDocumentIdentity = exports.DEFAULT_SEMANTIC_CAP = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var capture_1 = require("./capture");
|
|
6
|
-
var interactions_1 = require("./recorders/interactions");
|
|
7
|
-
Object.defineProperty(exports, "interactionsRecorder", { enumerable: true, get: function () { return interactions_1.interactionsRecorder; } });
|
|
8
|
-
var feedback_1 = require("./recorders/feedback");
|
|
9
|
-
Object.defineProperty(exports, "feedbackRecorder", { enumerable: true, get: function () { return feedback_1.feedbackRecorder; } });
|
|
10
|
-
var navigation_1 = require("./recorders/navigation");
|
|
11
|
-
Object.defineProperty(exports, "navigationRecorder", { enumerable: true, get: function () { return navigation_1.navigationRecorder; } });
|
|
12
|
-
var lifecycle_1 = require("./recorders/lifecycle");
|
|
13
|
-
Object.defineProperty(exports, "lifecycleRecorder", { enumerable: true, get: function () { return lifecycle_1.lifecycleRecorder; } });
|
|
14
|
-
var keys_1 = require("./recorders/keys");
|
|
15
|
-
Object.defineProperty(exports, "keysRecorder", { enumerable: true, get: function () { return keys_1.keysRecorder; } });
|
|
16
|
-
var resource_error_1 = require("./recorders/resource-error");
|
|
17
|
-
Object.defineProperty(exports, "resourceErrorRecorder", { enumerable: true, get: function () { return resource_error_1.resourceErrorRecorder; } });
|
|
18
|
-
var analytics_1 = require("./recorders/analytics");
|
|
19
|
-
Object.defineProperty(exports, "analyticsRecorder", { enumerable: true, get: function () { return analytics_1.analyticsRecorder; } });
|
|
20
|
-
exports.defaultRecorders = [
|
|
21
|
-
interactions_1.interactionsRecorder,
|
|
22
|
-
feedback_1.feedbackRecorder,
|
|
23
|
-
lifecycle_1.lifecycleRecorder,
|
|
24
|
-
navigation_1.navigationRecorder,
|
|
25
|
-
analytics_1.analyticsRecorder,
|
|
26
|
-
keys_1.keysRecorder,
|
|
27
|
-
resource_error_1.resourceErrorRecorder,
|
|
28
|
-
];
|
|
29
6
|
tslib_1.__exportStar(require("./types"), exports);
|
|
30
7
|
var capture_2 = require("./capture");
|
|
31
|
-
Object.defineProperty(exports, "
|
|
32
|
-
var helpers_1 = require("./helpers");
|
|
33
|
-
Object.defineProperty(exports, "createHelpers", { enumerable: true, get: function () { return helpers_1.createHelpers; } });
|
|
34
|
-
Object.defineProperty(exports, "roleOf", { enumerable: true, get: function () { return helpers_1.roleOf; } });
|
|
35
|
-
Object.defineProperty(exports, "urlTemplate", { enumerable: true, get: function () { return helpers_1.urlTemplate; } });
|
|
8
|
+
Object.defineProperty(exports, "DEFAULT_SEMANTIC_CAP", { enumerable: true, get: function () { return capture_2.DEFAULT_SEMANTIC_CAP; } });
|
|
36
9
|
var identity_1 = require("./identity");
|
|
37
10
|
Object.defineProperty(exports, "getDocumentIdentity", { enumerable: true, get: function () { return identity_1.getDocumentIdentity; } });
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
11
|
+
/** Starts only the supplied recorders; no event families are installed by default. */
|
|
12
|
+
function createSemanticCapture(config, host, recorders, caps) {
|
|
13
|
+
if (recorders === void 0) { recorders = []; }
|
|
14
|
+
if (caps === void 0) { caps = {}; }
|
|
15
|
+
return (0, capture_1.createCapture)(config, host, recorders, caps);
|
|
41
16
|
}
|
|
42
17
|
exports.createSemanticCapture = createSemanticCapture;
|
|
43
18
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,qCAA0C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,qCAA0C;AAG1C,kDAAwB;AAExB,qCAAiD;AAAxC,+GAAA,oBAAoB,OAAA;AAC7B,uCAAiD;AAAxC,+GAAA,mBAAmB,OAAA;AAE5B,sFAAsF;AACtF,SAAgB,qBAAqB,CACnC,MAAgC,EAChC,IAAqB,EACrB,SAA8C,EAC9C,IAA4D;IAD5D,0BAAA,EAAA,cAA8C;IAC9C,qBAAA,EAAA,SAA4D;IAE5D,OAAO,IAAA,uBAAa,EAAC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AACtD,CAAC;AAPD,sDAOC","sourcesContent":["import { createCapture } from './capture';\nimport type { SemanticCaptureConfig, SemanticHost, SemanticPayloads, SemanticRecorder } from './types';\n\nexport * from './types';\nexport type { SemanticCapture } from './capture';\nexport { DEFAULT_SEMANTIC_CAP } from './capture';\nexport { getDocumentIdentity } from './identity';\n\n/** Starts only the supplied recorders; no event families are installed by default. */\nexport function createSemanticCapture<P extends object = SemanticPayloads>(\n config: SemanticCaptureConfig<P>,\n host: SemanticHost<P>,\n recorders: readonly SemanticRecorder<P>[] = [],\n caps: Partial<Record<Extract<keyof P, string>, number>> = {},\n) {\n return createCapture(config, host, recorders, caps);\n}\n"]}
|
package/lib/cjs/types.d.ts
CHANGED
|
@@ -1,263 +1,61 @@
|
|
|
1
|
-
import type { PrivacyConfig } from '@amplitude/session-replay-dom-privacy';
|
|
2
1
|
export declare const SEMANTIC_VERSION = 1;
|
|
3
|
-
export type NameSource = 'aria-labelledby' | 'aria-label' | 'label-for' | 'label-wrap' | 'alt' | 'value' | 'title' | 'text' | 'placeholder' | 'masked' | 'unnamed';
|
|
4
|
-
export interface TargetDescription {
|
|
5
|
-
id: number | null;
|
|
6
|
-
role: string;
|
|
7
|
-
name: string | null;
|
|
8
|
-
}
|
|
9
|
-
export interface NamedTarget extends TargetDescription {
|
|
10
|
-
name_source: NameSource;
|
|
11
|
-
}
|
|
12
|
-
export type NavigationReason = 'load' | 'push' | 'replace' | 'pop' | 'hash' | 'title';
|
|
13
|
-
export interface RecordingSignal {
|
|
14
|
-
state: 'start' | 'stop' | 'pause' | 'resume';
|
|
15
|
-
reason: 'init' | 'new_session' | 'customer_stop' | 'sampled_out' | 'opt_out' | 'targeting' | 'focus' | 'error';
|
|
16
|
-
}
|
|
17
|
-
export interface AnalyticsContext {
|
|
18
|
-
present: boolean;
|
|
19
|
-
autocapture: string[];
|
|
20
|
-
}
|
|
21
2
|
export interface SemanticIdentity {
|
|
22
3
|
readonly tab_id: string;
|
|
23
4
|
readonly document_id: string;
|
|
24
5
|
}
|
|
25
|
-
/**
|
|
26
|
-
export interface
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
language: string;
|
|
41
|
-
visibility_state: 'hidden' | 'visible';
|
|
42
|
-
focused: boolean;
|
|
43
|
-
user_agent: string;
|
|
44
|
-
analytics_sdk: AnalyticsContext;
|
|
45
|
-
caps_hit?: Partial<Record<SemanticFamily, number>>;
|
|
46
|
-
};
|
|
47
|
-
click: NamedTarget & {
|
|
48
|
-
container: TargetDescription | null;
|
|
49
|
-
states: string[];
|
|
50
|
-
visible: boolean;
|
|
51
|
-
key: string | null;
|
|
52
|
-
selector?: string | null;
|
|
53
|
-
attrs: Record<string, string>;
|
|
54
|
-
url: string;
|
|
55
|
-
heading: string | null;
|
|
56
|
-
keyboard: boolean;
|
|
57
|
-
modifiers: string[];
|
|
58
|
-
trusted: boolean;
|
|
59
|
-
};
|
|
60
|
-
keys: {
|
|
61
|
-
key: string;
|
|
62
|
-
target: NamedTarget & {
|
|
63
|
-
states: string[];
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
'resource-error': {
|
|
67
|
-
rt: 'img' | 'css' | 'font' | 'script';
|
|
68
|
-
count: number;
|
|
69
|
-
container?: TargetDescription;
|
|
70
|
-
path?: string;
|
|
71
|
-
};
|
|
72
|
-
field: NamedTarget & {
|
|
73
|
-
states: string[];
|
|
74
|
-
kind: string;
|
|
75
|
-
value_state: 'empty' | 'filled';
|
|
76
|
-
/** Unmasked native input/textarea value; omitted for sensitive and non-scalar controls. */
|
|
77
|
-
value?: string;
|
|
78
|
-
checked?: boolean;
|
|
79
|
-
valid: boolean;
|
|
80
|
-
validity: string[];
|
|
81
|
-
masked: boolean;
|
|
82
|
-
option_label: string | null;
|
|
83
|
-
};
|
|
84
|
-
submit: {
|
|
85
|
-
form: TargetDescription;
|
|
86
|
-
submitter: TargetDescription | null;
|
|
87
|
-
valid: boolean;
|
|
88
|
-
invalid_fields: {
|
|
89
|
-
id: number | null;
|
|
90
|
-
name: string | null;
|
|
91
|
-
validity: string[];
|
|
92
|
-
}[];
|
|
93
|
-
prevented: boolean;
|
|
94
|
-
};
|
|
95
|
-
notice: {
|
|
96
|
-
id: number | null;
|
|
97
|
-
role: 'alert' | 'status' | 'log' | 'live';
|
|
98
|
-
text: string | null;
|
|
99
|
-
visible: boolean;
|
|
100
|
-
region: {
|
|
101
|
-
role: string;
|
|
102
|
-
name: string | null;
|
|
103
|
-
} | null;
|
|
104
|
-
cause_click_ts: number | null;
|
|
105
|
-
};
|
|
106
|
-
dialog: NamedTarget & {
|
|
107
|
-
role: 'dialog' | 'alertdialog';
|
|
108
|
-
state: 'open' | 'closed';
|
|
109
|
-
modal: boolean;
|
|
110
|
-
visible: boolean;
|
|
111
|
-
cause_click_ts: number | null;
|
|
112
|
-
};
|
|
113
|
-
navigation: {
|
|
114
|
-
url: string;
|
|
115
|
-
};
|
|
116
|
-
recording: RecordingSignal;
|
|
117
|
-
visibility: {
|
|
118
|
-
state: 'hidden' | 'visible';
|
|
119
|
-
};
|
|
120
|
-
lifecycle: {
|
|
121
|
-
type: 'pagehide' | 'pageshow' | 'pageshow_bfcache' | 'freeze' | 'resume';
|
|
122
|
-
};
|
|
123
|
-
'amp-event': {
|
|
124
|
-
event_type: string;
|
|
125
|
-
insert_id: string | null;
|
|
126
|
-
id: number | null;
|
|
127
|
-
props: Record<string, string | number | null>;
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
export type SemanticFamily = keyof SemanticPayloads;
|
|
131
|
-
export type SemanticEvent = {
|
|
132
|
-
[K in SemanticFamily]: {
|
|
133
|
-
name: K;
|
|
134
|
-
payload: SemanticPayloads[K] & SemanticIdentity & {
|
|
135
|
-
v: 1;
|
|
136
|
-
};
|
|
137
|
-
timestamp: number;
|
|
138
|
-
};
|
|
139
|
-
}[SemanticFamily];
|
|
140
|
-
export interface SemanticCaptureConfig {
|
|
6
|
+
/** Internal event envelope, independent of any event family or replay transport. */
|
|
7
|
+
export interface SemanticEventEnvelope<Name extends string, Payload extends object> {
|
|
8
|
+
name: Name;
|
|
9
|
+
timestamp: number;
|
|
10
|
+
payload: Payload & SemanticIdentity & {
|
|
11
|
+
v: typeof SEMANTIC_VERSION;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/** Runtime consumers supply a map of event names to payload objects. */
|
|
15
|
+
export type SemanticPayloads = Record<string, object>;
|
|
16
|
+
export type SemanticFamily<P extends object = SemanticPayloads> = Extract<keyof P, string>;
|
|
17
|
+
export type SemanticEvent<P extends object = SemanticPayloads> = {
|
|
18
|
+
[K in SemanticFamily<P>]: SemanticEventEnvelope<K, P[K] & object>;
|
|
19
|
+
}[SemanticFamily<P>];
|
|
20
|
+
export interface SemanticCaptureConfig<P extends object = SemanticPayloads> {
|
|
141
21
|
enabled: boolean;
|
|
22
|
+
/** Additional sampling within recorded replay sessions. Defaults to 1. */
|
|
142
23
|
sampleRate?: number;
|
|
143
|
-
families
|
|
24
|
+
/** Registered families are enabled unless explicitly false. */
|
|
25
|
+
families?: Partial<Record<SemanticFamily<P>, boolean>>;
|
|
144
26
|
}
|
|
145
|
-
/** Forward only after analytics enrichment/filtering has accepted this event for delivery. */
|
|
146
|
-
export interface AcceptedAnalyticsEvent {
|
|
147
|
-
eventType: string;
|
|
148
|
-
insertId?: string;
|
|
149
|
-
properties: Record<string, unknown>;
|
|
150
|
-
element?: Element;
|
|
151
|
-
}
|
|
152
|
-
/** Structural replay input; no dependency on a particular recorder implementation. */
|
|
153
|
-
export interface SemanticDomNode {
|
|
154
|
-
id: number;
|
|
155
|
-
type: number;
|
|
156
|
-
tagName?: string;
|
|
157
|
-
attributes?: Record<string, unknown>;
|
|
158
|
-
childNodes?: SemanticDomNode[];
|
|
159
|
-
}
|
|
160
|
-
export type SemanticDomChange = {
|
|
161
|
-
type: 'snapshot';
|
|
162
|
-
node: SemanticDomNode;
|
|
163
|
-
} | {
|
|
164
|
-
type: 'mutation';
|
|
165
|
-
adds: {
|
|
166
|
-
parentId: number;
|
|
167
|
-
node: SemanticDomNode;
|
|
168
|
-
}[];
|
|
169
|
-
removes: {
|
|
170
|
-
parentId: number;
|
|
171
|
-
id: number;
|
|
172
|
-
}[];
|
|
173
|
-
texts: {
|
|
174
|
-
id: number;
|
|
175
|
-
}[];
|
|
176
|
-
attributes: {
|
|
177
|
-
id: number;
|
|
178
|
-
attributes: Record<string, unknown>;
|
|
179
|
-
}[];
|
|
180
|
-
};
|
|
181
27
|
export interface HostSignals {
|
|
182
|
-
|
|
183
|
-
/** Accepted URL-plugin input, already filtered by the host URL policy. */
|
|
184
|
-
url: {
|
|
185
|
-
url: string;
|
|
186
|
-
timestamp: number;
|
|
187
|
-
};
|
|
28
|
+
/** An accepted full snapshot, forwarded after the recorder is ready. */
|
|
188
29
|
snapshot: undefined;
|
|
189
|
-
navigation: NavigationReason;
|
|
190
|
-
recording: RecordingSignal;
|
|
191
|
-
click: MouseEvent;
|
|
192
|
-
analytics: AcceptedAnalyticsEvent;
|
|
193
30
|
}
|
|
194
31
|
export type Cleanup = () => void;
|
|
195
|
-
/**
|
|
196
|
-
export interface SemanticHost {
|
|
32
|
+
/** The host owns transport; the runtime has no rrweb dependency. */
|
|
33
|
+
export interface SemanticHost<P extends object = SemanticPayloads> {
|
|
197
34
|
document: Document;
|
|
198
35
|
window: Window;
|
|
199
|
-
emit: (event: SemanticEvent) => void;
|
|
200
|
-
|
|
201
|
-
/** Resolve recorded nodes for notice/dialog enrichment. Requires notify('dom', ...). */
|
|
202
|
-
getNode?: (id: number) => Node | null;
|
|
203
|
-
getPrivacy: () => PrivacyConfig;
|
|
204
|
-
getUrl: () => string;
|
|
205
|
-
sdk: string;
|
|
206
|
-
getAnalyticsContext?: () => AnalyticsContext;
|
|
207
|
-
/** Stable document identity; called lazily for accepted events. Default is document-scoped memory only. */
|
|
36
|
+
emit: (event: SemanticEvent<P>) => void;
|
|
37
|
+
/** Called lazily for accepted events. Defaults to document-scoped memory only. */
|
|
208
38
|
getIdentity?: () => SemanticIdentity;
|
|
209
|
-
getSelector?: (element: Element) => string | null;
|
|
210
|
-
/** True when the host forwards native clicks via notify('click', event). */
|
|
211
|
-
externalClicks?: boolean;
|
|
212
|
-
/** Override when the host supplies primary clicks but not auxclick. Defaults to externalClicks. */
|
|
213
|
-
externalAuxClicks?: boolean;
|
|
214
|
-
inlineStylesheet?: boolean;
|
|
215
39
|
now?: () => number;
|
|
216
40
|
random?: () => number;
|
|
217
41
|
onError?: (error: unknown) => void;
|
|
218
42
|
}
|
|
219
|
-
export interface
|
|
220
|
-
id: (element: Element) => number | null;
|
|
221
|
-
blocked: (element: Element) => boolean;
|
|
222
|
-
masked: (element: Element) => boolean;
|
|
223
|
-
text: (element: Element, value?: string | null, limit?: number) => string | null;
|
|
224
|
-
name: (element: Element) => {
|
|
225
|
-
name: string | null;
|
|
226
|
-
source: NameSource;
|
|
227
|
-
};
|
|
228
|
-
role: (element: Element) => string;
|
|
229
|
-
states: (element: Element) => string[];
|
|
230
|
-
describe: (element: Element) => NamedTarget;
|
|
231
|
-
actionable: (element: Element) => Element;
|
|
232
|
-
container: (element: Element) => TargetDescription | null;
|
|
233
|
-
visible: (element: Element) => boolean;
|
|
234
|
-
heading: () => string | null;
|
|
235
|
-
invalidateHeading?: () => void;
|
|
236
|
-
url: (value?: string) => string;
|
|
237
|
-
attributes: (element: Element) => Record<string, string>;
|
|
238
|
-
}
|
|
239
|
-
export interface RecorderContext {
|
|
43
|
+
export interface RecorderContext<P extends object = SemanticPayloads> {
|
|
240
44
|
/** Register resources immediately so failed setup can roll them back. */
|
|
241
45
|
onCleanup: (cleanup: Cleanup) => void;
|
|
242
|
-
host: SemanticHost
|
|
243
|
-
helpers: SemanticHelpers;
|
|
46
|
+
host: SemanticHost<P>;
|
|
244
47
|
now: () => number;
|
|
245
|
-
enabled: (family: SemanticFamily) => boolean;
|
|
246
|
-
/** Check session capacity without counting a dropped event. */
|
|
247
|
-
hasCapacity: (family: SemanticFamily) => boolean;
|
|
248
48
|
/** Check before expensive payload work. A rejected candidate increments the dropped count. */
|
|
249
|
-
canEmit: (family: SemanticFamily) => boolean;
|
|
250
|
-
emit: <K extends SemanticFamily
|
|
49
|
+
canEmit: (family: SemanticFamily<P>) => boolean;
|
|
50
|
+
emit: <K extends SemanticFamily<P>>(family: K, payload: P[K], timestamp?: number) => boolean;
|
|
251
51
|
on: <K extends keyof HostSignals>(signal: K, callback: (value: HostSignals[K]) => void) => Cleanup;
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
/** Preserves page readiness when families are reconfigured mid-recording. */
|
|
256
|
-
hasSnapshot?: () => boolean;
|
|
52
|
+
/** Peek at dropped counts; a recorder can acknowledge them after successful delivery. */
|
|
53
|
+
dropped: () => Partial<Record<SemanticFamily<P>, number>>;
|
|
54
|
+
clearDropped: () => void;
|
|
257
55
|
}
|
|
258
56
|
/** A factory owns its listeners/timers and returns complete teardown. */
|
|
259
|
-
export interface SemanticRecorder {
|
|
260
|
-
families: readonly SemanticFamily[];
|
|
261
|
-
setup: (context: RecorderContext) => Cleanup;
|
|
57
|
+
export interface SemanticRecorder<P extends object = SemanticPayloads> {
|
|
58
|
+
families: readonly SemanticFamily<P>[];
|
|
59
|
+
setup: (context: RecorderContext<P>) => Cleanup;
|
|
262
60
|
}
|
|
263
61
|
//# sourceMappingURL=types.d.ts.map
|
package/lib/cjs/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"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"}
|
package/lib/cjs/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAAa,QAAA,gBAAgB,GAAG,CAAC,CAAC","sourcesContent":["export const SEMANTIC_VERSION = 1;\nexport interface SemanticIdentity {\n readonly tab_id: string;\n readonly document_id: string;\n}\n/** Internal event envelope, independent of any event family or replay transport. */\nexport interface SemanticEventEnvelope<Name extends string, Payload extends object> {\n name: Name;\n timestamp: number;\n payload: Payload & SemanticIdentity & { v: typeof SEMANTIC_VERSION };\n}\n\n/** Runtime consumers supply a map of event names to payload objects. */\nexport type SemanticPayloads = Record<string, object>;\nexport type SemanticFamily<P extends object = SemanticPayloads> = Extract<keyof P, string>;\nexport type SemanticEvent<P extends object = SemanticPayloads> = {\n [K in SemanticFamily<P>]: SemanticEventEnvelope<K, P[K] & object>;\n}[SemanticFamily<P>];\nexport interface SemanticCaptureConfig<P extends object = SemanticPayloads> {\n enabled: boolean;\n /** Additional sampling within recorded replay sessions. Defaults to 1. */\n sampleRate?: number;\n /** Registered families are enabled unless explicitly false. */\n families?: Partial<Record<SemanticFamily<P>, boolean>>;\n}\nexport interface HostSignals {\n /** An accepted full snapshot, forwarded after the recorder is ready. */\n snapshot: undefined;\n}\nexport type Cleanup = () => void;\n/** The host owns transport; the runtime has no rrweb dependency. */\nexport interface SemanticHost<P extends object = SemanticPayloads> {\n document: Document;\n window: Window;\n emit: (event: SemanticEvent<P>) => void;\n /** Called lazily for accepted events. Defaults to document-scoped memory only. */\n getIdentity?: () => SemanticIdentity;\n now?: () => number;\n random?: () => number;\n onError?: (error: unknown) => void;\n}\nexport interface RecorderContext<P extends object = SemanticPayloads> {\n /** Register resources immediately so failed setup can roll them back. */\n onCleanup: (cleanup: Cleanup) => void;\n host: SemanticHost<P>;\n now: () => number;\n /** Check before expensive payload work. A rejected candidate increments the dropped count. */\n canEmit: (family: SemanticFamily<P>) => boolean;\n emit: <K extends SemanticFamily<P>>(family: K, payload: P[K], timestamp?: number) => boolean;\n on: <K extends keyof HostSignals>(signal: K, callback: (value: HostSignals[K]) => void) => Cleanup;\n /** Peek at dropped counts; a recorder can acknowledge them after successful delivery. */\n dropped: () => Partial<Record<SemanticFamily<P>, number>>;\n clearDropped: () => void;\n}\n/** A factory owns its listeners/timers and returns complete teardown. */\nexport interface SemanticRecorder<P extends object = SemanticPayloads> {\n families: readonly SemanticFamily<P>[];\n setup: (context: RecorderContext<P>) => Cleanup;\n}\n"]}
|
package/lib/esm/capture.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { HostSignals, SemanticCaptureConfig, SemanticFamily, SemanticHost, SemanticRecorder } from './types';
|
|
2
|
-
export declare const
|
|
3
|
-
export interface SemanticCapture {
|
|
1
|
+
import { HostSignals, SemanticCaptureConfig, SemanticFamily, SemanticHost, SemanticPayloads, SemanticRecorder } from './types';
|
|
2
|
+
export declare const DEFAULT_SEMANTIC_CAP = 200;
|
|
3
|
+
export interface SemanticCapture<P extends object = SemanticPayloads> {
|
|
4
4
|
isActive: () => boolean;
|
|
5
5
|
start: () => void;
|
|
6
6
|
stop: () => void;
|
|
7
|
-
updateConfig: (config: SemanticCaptureConfig) => void;
|
|
7
|
+
updateConfig: (config: SemanticCaptureConfig<P>) => void;
|
|
8
8
|
resetSession: () => void;
|
|
9
9
|
notify: <K extends keyof HostSignals>(signal: K, value: HostSignals[K]) => void;
|
|
10
10
|
}
|
|
11
11
|
/** Composable runtime. Sampling and caps belong to a session, listeners to a recording. */
|
|
12
|
-
export declare function createCapture(config: SemanticCaptureConfig
|
|
12
|
+
export declare function createCapture<P extends object = SemanticPayloads>(config: SemanticCaptureConfig<P>, host: SemanticHost<P>, recorders: readonly SemanticRecorder<P>[], caps?: Partial<Record<SemanticFamily<P>, number>>): SemanticCapture<P>;
|
|
13
13
|
//# sourceMappingURL=capture.d.ts.map
|
package/lib/esm/capture.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../../src/capture.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../../src/capture.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,WAAW,EAEX,qBAAqB,EAErB,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,MAAM,GAAG,gBAAgB;IAClE,QAAQ,EAAE,MAAM,OAAO,CAAC;IACxB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,YAAY,EAAE,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IACzD,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,MAAM,EAAE,CAAC,CAAC,SAAS,MAAM,WAAW,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;CACjF;AAED,2FAA2F;AAC3F,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,gBAAgB,EAC/D,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC,EAChC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,EACrB,SAAS,EAAE,SAAS,gBAAgB,CAAC,CAAC,CAAC,EAAE,EACzC,IAAI,GAAE,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAM,GACpD,eAAe,CAAC,CAAC,CAAC,CA4KpB"}
|