tdem-web-sdk 1.0.11 → 1.0.13
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 +56 -0
- package/lib/packages/core/src/http/request-finalizer.d.ts +25 -0
- package/lib/packages/core/src/index.d.ts +9 -1
- package/lib/packages/core/src/interface/config.d.ts +1 -0
- package/lib/packages/core/src/interface/env.d.ts +1 -0
- package/lib/packages/core/src/interface/event.d.ts +29 -2
- package/lib/packages/core/src/interface/index.d.ts +1 -1
- package/lib/packages/core/src/pipes/event-pipes.d.ts +6 -5
- package/lib/packages/core/src/pipes/tdem-sample-gate.d.ts +4 -23
- package/lib/packages/core/src/sample/evaluate.d.ts +6 -0
- package/lib/packages/core/src/sample/eventTypes.d.ts +23 -0
- package/lib/packages/core/src/sample/resolve.d.ts +2 -0
- package/lib/packages/core/src/sample/types.d.ts +52 -0
- package/lib/packages/core/src/util/event-session.d.ts +5 -0
- package/lib/packages/core/src/util/index.d.ts +5 -0
- package/lib/packages/web-sdk/src/index.core.d.ts +6 -0
- package/lib/packages/web-sdk/src/index.d.ts +2 -0
- package/lib/packages/web-sdk/src/interface/core.d.ts +9 -0
- package/lib/packages/web-sdk/src/interface/index.d.ts +4 -1
- package/lib/packages/web-sdk/src/plugins/cgi-speed/dial-observation.d.ts +44 -0
- package/lib/packages/web-sdk/src/plugins/cgi-speed/sse-observer.d.ts +2 -0
- package/lib/packages/web-sdk/src/plugins/{session-replay → click-detection}/click-detector.d.ts +10 -7
- package/lib/packages/web-sdk/src/plugins/session-replay/constants.d.ts +13 -0
- package/lib/packages/web-sdk/src/plugins/session-replay/event-buffer.d.ts +10 -2
- package/lib/packages/web-sdk/src/plugins/session-replay/index.d.ts +1 -1
- package/lib/packages/web-sdk/src/plugins/session-replay/logger.d.ts +4 -33
- package/lib/packages/web-sdk/src/plugins/session-replay/replay-handoff.d.ts +20 -0
- package/lib/packages/web-sdk/src/plugins/session-replay/replay-policy.d.ts +2 -2
- package/lib/packages/web-sdk/src/plugins/session-replay/types.d.ts +1 -1
- package/lib/packages/web-sdk/src/plugins/session-replay/uploader.d.ts +13 -5
- package/lib/packages/web-sdk/src/plugins/struggle-monitor.d.ts +4 -0
- package/lib/packages/web-sdk/src/plugins/tdem-config.d.ts +1 -8
- package/lib/packages/web-sdk/src/tdem.d.ts +17 -1
- package/lib/packages/web-sdk/src/transport/browser-transport.d.ts +1 -1
- package/lib/packages/web-sdk/src/util/click-target.d.ts +5 -0
- package/lib/packages/web-sdk/src/util/entry-registry.d.ts +28 -0
- package/lib/packages/web-sdk/src/util/logger.d.ts +35 -0
- package/lib/tdem.f.min.js +3 -3
- package/lib/tdem.global.min.js +3 -3
- package/lib/tdem.ie.min.js +3 -3
- package/lib/tdem.min.js +3 -3
- package/package.json +17 -1
package/README.md
CHANGED
|
@@ -29,6 +29,27 @@ const tdem = new TDEM({
|
|
|
29
29
|
|
|
30
30
|
省略 `version` 时,上报里的应用版本是字符串 `1.0.0`。
|
|
31
31
|
|
|
32
|
+
## 入口
|
|
33
|
+
|
|
34
|
+
同一个包提供两个入口,默认入口保持完整能力:
|
|
35
|
+
|
|
36
|
+
```javascript
|
|
37
|
+
// 完整入口(默认):含会话回放
|
|
38
|
+
import TDEM from 'tdem-web-sdk';
|
|
39
|
+
|
|
40
|
+
// core 入口:不含会话回放,体积更小
|
|
41
|
+
import TDEMCore from 'tdem-web-sdk/core';
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
| 入口 | 体积(gzip9) | 能力 |
|
|
45
|
+
|---|---:|---|
|
|
46
|
+
| `tdem-web-sdk` | 148,055 B | 基础监控 + 会话回放 + 错误回溯 + 远程回放策略 |
|
|
47
|
+
| `tdem-web-sdk/core` | 56,184 B(UMD) | 基础监控(错误/性能/资源/API/点击/控制台/SPA/设备/白屏/卡顿/内存/bridge/挣扎事件) |
|
|
48
|
+
|
|
49
|
+
core 入口没有 `sessionReplay`:传入该配置只会 `console.warn` 并忽略,不影响其它监控。IE 与指纹变体只在完整入口提供。
|
|
50
|
+
|
|
51
|
+
升级整包即可;core 与完整入口可互换引用,回滚请回退整个包版本;同页同时加载两个入口会按项目 id 去重。
|
|
52
|
+
|
|
32
53
|
## 什么时候会有数据
|
|
33
54
|
|
|
34
55
|
创建实例后,SDK 会先请求 `POST {url}/api/v1/config`。控制台未打开采集、采样未命中,或这次请求失败且本地没有可用缓存时,后续插件不会启动,事件也不会发出。控制台会出现:
|
|
@@ -183,6 +204,41 @@ tdem.destroy();
|
|
|
183
204
|
|
|
184
205
|
`trackStruggle` 的 `severity` 为 `low`、`medium` 或 `high`,默认 `medium`。`captureMessage` 的 `level` 为 `info`、`warn` 或 `error`。`endMeasure` 找不到对应的 `startMeasure` 时会忽略。
|
|
185
206
|
|
|
207
|
+
## 协议说明
|
|
208
|
+
|
|
209
|
+
- 远程配置(Web 规则化采样权威):`POST {url}/api/v1/sample-config`(snake_case `event` / `replay.experience_sample_rate`)
|
|
210
|
+
- 旧配置(非 Web / 兼容):`POST {url}/api/v1/config`
|
|
211
|
+
- 事件上报:`POST {url}/api/v1/collect/events`
|
|
212
|
+
|
|
213
|
+
所有事件统一走 TDEM Event 协议,请求体结构:
|
|
214
|
+
|
|
215
|
+
```json
|
|
216
|
+
{
|
|
217
|
+
"protocol_version": 2,
|
|
218
|
+
"project_key": "your-project-id",
|
|
219
|
+
"sdk": { "name": "tdem-web-sdk", "version": "x.x.x" },
|
|
220
|
+
"app": { "version": "1.0.0" },
|
|
221
|
+
"context": {
|
|
222
|
+
"session_id": "...",
|
|
223
|
+
"user_id": "...",
|
|
224
|
+
"platform": "web",
|
|
225
|
+
"user_agent": "...",
|
|
226
|
+
"screen_resolution": "1920x1080",
|
|
227
|
+
"language": "zh-CN"
|
|
228
|
+
},
|
|
229
|
+
"events": [
|
|
230
|
+
{
|
|
231
|
+
"event_id": "evt_xxx",
|
|
232
|
+
"event_type": "js_error",
|
|
233
|
+
"event_category": "error",
|
|
234
|
+
"timestamp": 1713800000000,
|
|
235
|
+
"page_url": "https://example.com/page",
|
|
236
|
+
"data": { ... }
|
|
237
|
+
}
|
|
238
|
+
]
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
186
242
|
## 环境枚举
|
|
187
243
|
|
|
188
244
|
```javascript
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Fields a request finalizer may add; transport/status and other event fields stay with the collector. */
|
|
2
|
+
export interface RequestFinalizationFields {
|
|
3
|
+
req_dial_links?: string;
|
|
4
|
+
req_dial_links_truncated?: string;
|
|
5
|
+
dns_dial_links?: string;
|
|
6
|
+
dns_dial_links_truncated?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare type RequestFinalizerResult = void | RequestFinalizationFields | PromiseLike<void | RequestFinalizationFields>;
|
|
9
|
+
export interface RequestFinalizerOptions {
|
|
10
|
+
/** Replacing a handler is explicit and invalidates all its pending results. */
|
|
11
|
+
replace?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface RequestFinalizerLease<T, R> {
|
|
14
|
+
readonly handler: (observation: Readonly<T>) => R;
|
|
15
|
+
}
|
|
16
|
+
export declare const requestFinalizationFields: (value: unknown) => RequestFinalizationFields;
|
|
17
|
+
/** One owner per module. Disposers and pending results are bound to the registration, not the function identity. */
|
|
18
|
+
export declare const createRequestFinalizerSlot: <T, R extends RequestFinalizerResult = void | RequestFinalizationFields>(onChange?: (() => void) | undefined) => {
|
|
19
|
+
register: (handler: (observation: Readonly<T>) => R, options?: RequestFinalizerOptions) => (() => void);
|
|
20
|
+
capture: () => RequestFinalizerLease<T, R> | null;
|
|
21
|
+
isCurrent: (lease: RequestFinalizerLease<T, R> | null) => boolean;
|
|
22
|
+
onInvalidated: (lease: RequestFinalizerLease<T, R>, cancel: () => void) => (() => void);
|
|
23
|
+
invokeSync: (lease: RequestFinalizerLease<T, R> | null, observation: Readonly<T>) => RequestFinalizationFields;
|
|
24
|
+
invoke: (lease: RequestFinalizerLease<T, R> | null, observation: Readonly<T>, timeoutMs: number) => RequestFinalizationFields | Promise<RequestFinalizationFields>;
|
|
25
|
+
};
|
|
@@ -3,7 +3,15 @@ import Core from './core';
|
|
|
3
3
|
import Plugin from './plugin';
|
|
4
4
|
export { Plugin };
|
|
5
5
|
export default Core;
|
|
6
|
-
export { SpeedLog, BridgeLog, StaticAssetsLog, PagePerformanceLog, PagePerformanceLogForHippy3, HippyPagePerformanceLog, Config, InternalConfig, CoreApiConfig, SendOption, SendSuccess, SendFail, SendType, Transport, TransportRequest, TransportResult, TransportCallbacks, TransportMethod, TransportBody, RetryDelayResolver, RetrySchedule, DEFAULT_TRANSPORT_RETRY_SCHEDULE, InternalSdkOptions, PlatTypeNum, NetworkTypeNum, PagePerformanceStruct, EventType, EventCategory, BaseEvent, ExceptionStack, ExceptionFrame, FormSubmitStatus, NavigationType, StruggleStatus, StruggleOwnerType, StruggleEventName, JSErrorEvent, PromiseErrorEvent, ResourceErrorEvent, APIErrorEvent, PageLoadEvent, ResourceLoadEvent, APICallEvent, SSECallOutcome, SSECallEvent, WebVitalsEvent, LagEventMeasurements, LagEventProperties, LagEventData, LagDetectedEvent, NoResponseEvent, BlankScreenTriggerReason, BlankScreenTriggerType, BlankScreenDetectionMethod, BlankScreenMeasurements, BlankScreenEventProperties, BlankScreenEvent, MemoryEventMeasurements, WebMemoryEventMeasurements, AppMemoryEventMeasurements, WebMemoryEventData, AppMemoryEventData, MemoryEventData, MemoryUsageEvent, ProcessSignalEventName, ProcessSignalEventProperties, ProcessSignalEventData, ProcessSignalEvent, AppMetricsEvent, FileIoOperation, FileIoEventMeasurements, FileIoEventProperties, FileIoEventData, FileIoEvent, MemoryOOMEvent, EventContextData, BehaviorContextData, FormEventData, ClickEvent, ScrollEvent, LongPressEvent, PageViewEvent, FormFocusEvent, FormBlurEvent, FormChangeEvent, FormSubmitEvent, FormSubmitResultEvent, StruggleEvent, CustomEvent, CustomTimeEvent, LogEvent, TDEMEvent, ReportStruggleParams, StruggleSeverity, EventPropertyValue, EventProperties, ReportFormSubmitResultParams, EventOptions, TrackOptions, TrackStruggleOptions, MeasureOptions, CaptureOptions, SetPageOptions, ReportPageViewOptions, generateEventId, parseErrorStack, } from './interface';
|
|
6
|
+
export { SpeedLog, BridgeLog, StaticAssetsLog, PagePerformanceLog, PagePerformanceLogForHippy3, HippyPagePerformanceLog, Config, InternalConfig, CoreApiConfig, SendOption, SendSuccess, SendFail, SendType, Transport, TransportRequest, TransportResult, TransportCallbacks, TransportMethod, TransportBody, RetryDelayResolver, RetrySchedule, DEFAULT_TRANSPORT_RETRY_SCHEDULE, InternalSdkOptions, PlatTypeNum, NetworkTypeNum, PagePerformanceStruct, EventType, EventCategory, BaseEvent, ExceptionStack, ExceptionFrame, FormSubmitStatus, NavigationType, StruggleStatus, StruggleOwnerType, StruggleEventName, JSErrorEvent, PromiseErrorEvent, ResourceErrorEvent, APIErrorEvent, PageLoadEvent, ResourceLoadEvent, APICallEvent, SSECallOutcome, SSECallEvent, WebVitalsEvent, LagEventMeasurements, LagEventProperties, LagEventData, LagDetectedEvent, NoResponseEvent, BlankScreenTriggerReason, BlankScreenTriggerType, BlankScreenDetectionMethod, BlankScreenMeasurements, BlankScreenEventProperties, BlankScreenEvent, MemoryEventMeasurements, WebMemoryEventMeasurements, AppMemoryEventMeasurements, WebMemoryEventData, AppMemoryEventData, MemoryEventData, MemoryUsageEvent, ProcessSignalEventName, ProcessSignalEventProperties, ProcessSignalEventData, ProcessSignalEvent, AppMetricsEvent, FileIoOperation, FileIoEventMeasurements, FileIoEventProperties, FileIoEventData, FileIoEvent, MemoryOOMEvent, EventContextData, BehaviorContextData, FormEventData, ClickEvent, ScrollEvent, LongPressEvent, PageViewEvent, FormFocusEvent, FormBlurEvent, FormChangeEvent, FormSubmitEvent, FormSubmitResultEvent, StruggleEvent, CustomEvent, CustomTimeEvent, LogEvent, TDEMEvent, ReportStruggleParams, StruggleSeverity, EventPropertyValue, EventProperties, ReportFormSubmitResultParams, EventOptions, TrackOptions, TrackStruggleOptions, MeasureOptions, CaptureOptions, SetPageOptions, ReportPageViewOptions, generateEventId, parseErrorStack, resolveEnvironment, } from './interface';
|
|
7
7
|
export { getDefaultConfig, setConfigUrl, globalAny, REPORT_TIMEOUT, MAX_FROM_LENGTH, ERROR_MSG_IGNORE, URL_SPEED_IGNORE, RESOURCE_TYPE_FETCH, RESOURCE_TYPE_STATIC, UNKNOWN, RESOURCE_TYPE, MAX_PROMISE_ERROR_MSG_LENGTH, } from './constant';
|
|
8
8
|
export * from './pipes';
|
|
9
9
|
export * from './util';
|
|
10
|
+
export { eventSession, readEventSession } from './util/event-session';
|
|
11
|
+
export * from './sample/types';
|
|
12
|
+
export { evaluateEventSample } from './sample/evaluate';
|
|
13
|
+
export type { EvaluateEventSampleOptions } from './sample/evaluate';
|
|
14
|
+
export { resolveSampleConfig } from './sample/resolve';
|
|
15
|
+
export { WEB_SAMPLE_EVENT_TYPES, WEB_SAMPLE_EVENT_TYPE_SET, MP_SAMPLE_EVENT_TYPES, MP_SAMPLE_EVENT_TYPE_SET, ANDROID_SAMPLE_EVENT_TYPES, ANDROID_SAMPLE_EVENT_TYPE_SET, IOS_SAMPLE_EVENT_TYPES, IOS_SAMPLE_EVENT_TYPE_SET, ELECTRON_SAMPLE_EVENT_TYPES, ELECTRON_SAMPLE_EVENT_TYPE_SET, isWebSampleEventType, sampleEventTypesFor, sampleEventTypeSet, isSampleEventType, } from './sample/eventTypes';
|
|
16
|
+
export { createRequestFinalizerSlot, requestFinalizationFields } from './http/request-finalizer';
|
|
17
|
+
export type { RequestFinalizationFields, RequestFinalizerResult, RequestFinalizerOptions, RequestFinalizerLease } from './http/request-finalizer';
|
|
@@ -39,7 +39,9 @@ export declare enum EventType {
|
|
|
39
39
|
FORM_SUBMIT_RESULT = "form_submit_result",
|
|
40
40
|
STRUGGLE = "struggle",
|
|
41
41
|
CUSTOM = "custom",
|
|
42
|
-
LOG = "log"
|
|
42
|
+
LOG = "log",
|
|
43
|
+
DIAL_PROBE = "dial_probe",
|
|
44
|
+
DIAL_MTR = "dial_mtr"
|
|
43
45
|
}
|
|
44
46
|
/**
|
|
45
47
|
* 事件分类枚举
|
|
@@ -71,6 +73,7 @@ export interface BaseEvent {
|
|
|
71
73
|
event_category: EventCategory;
|
|
72
74
|
timestamp: number;
|
|
73
75
|
page_url: string;
|
|
76
|
+
view_id?: string;
|
|
74
77
|
data: Record<string, any>;
|
|
75
78
|
}
|
|
76
79
|
/**
|
|
@@ -81,6 +84,7 @@ export interface EventContext {
|
|
|
81
84
|
session_id: string;
|
|
82
85
|
user_id?: string;
|
|
83
86
|
platform: string;
|
|
87
|
+
view_id?: string;
|
|
84
88
|
runtime?: string;
|
|
85
89
|
process_type?: string;
|
|
86
90
|
window_id?: string;
|
|
@@ -190,6 +194,8 @@ export interface APIErrorEvent extends BaseEvent {
|
|
|
190
194
|
response_body?: string;
|
|
191
195
|
measurements?: {
|
|
192
196
|
duration?: number;
|
|
197
|
+
/** 本次请求的 DNS 阶段耗时。未发生解析时为 0;测不到时不写。 */
|
|
198
|
+
dns_time?: number;
|
|
193
199
|
};
|
|
194
200
|
exception_stacks?: ExceptionStack[];
|
|
195
201
|
replay_id?: string;
|
|
@@ -269,6 +275,8 @@ export interface APICallEvent extends BaseEvent {
|
|
|
269
275
|
url: string;
|
|
270
276
|
measurements: {
|
|
271
277
|
duration: number;
|
|
278
|
+
/** 本次请求的 DNS 阶段耗时。未发生解析时为 0;测不到时不写。 */
|
|
279
|
+
dns_time?: number;
|
|
272
280
|
request_size?: number;
|
|
273
281
|
response_size?: number;
|
|
274
282
|
};
|
|
@@ -332,6 +340,10 @@ export interface SSECallEvent extends BaseEvent {
|
|
|
332
340
|
request_headers?: string;
|
|
333
341
|
response_headers?: string;
|
|
334
342
|
replay_offset_ms?: string;
|
|
343
|
+
/** 连接发起时的 llmVersion 快照。空白或未配置为 unknown。 */
|
|
344
|
+
model_version: string;
|
|
345
|
+
/** 已拿到的 IPv4/IPv6 字面量。浏览器省略。 */
|
|
346
|
+
server_ip?: string;
|
|
335
347
|
};
|
|
336
348
|
};
|
|
337
349
|
}
|
|
@@ -727,7 +739,15 @@ export interface LogEvent extends BaseEvent {
|
|
|
727
739
|
/**
|
|
728
740
|
* 所有事件的联合类型
|
|
729
741
|
*/
|
|
730
|
-
export declare type TDEMEvent = JSErrorEvent | PromiseErrorEvent | ResourceErrorEvent | APIErrorEvent | PageLoadEvent | ResourceLoadEvent | APICallEvent | SSECallEvent | WebVitalsEvent | LagDetectedEvent | NoResponseEvent | BlankScreenEvent | MemoryUsageEvent | AppMetricsEvent | ProcessSignalEvent | MemoryOOMEvent | FileIoEvent | ClickEvent | ScrollEvent | LongPressEvent | PageViewEvent | LifecycleEvent | FormFocusEvent | FormBlurEvent | FormChangeEvent | FormSubmitEvent | FormSubmitResultEvent | StruggleEvent | CustomEvent | CustomTimeEvent | LogEvent;
|
|
742
|
+
export declare type TDEMEvent = JSErrorEvent | PromiseErrorEvent | ResourceErrorEvent | APIErrorEvent | PageLoadEvent | ResourceLoadEvent | APICallEvent | SSECallEvent | WebVitalsEvent | LagDetectedEvent | NoResponseEvent | BlankScreenEvent | MemoryUsageEvent | AppMetricsEvent | ProcessSignalEvent | MemoryOOMEvent | FileIoEvent | ClickEvent | ScrollEvent | LongPressEvent | PageViewEvent | LifecycleEvent | FormFocusEvent | FormBlurEvent | FormChangeEvent | FormSubmitEvent | FormSubmitResultEvent | StruggleEvent | CustomEvent | CustomTimeEvent | LogEvent | DialEvent;
|
|
743
|
+
export interface DialEvent extends BaseEvent {
|
|
744
|
+
event_type: EventType.DIAL_PROBE | EventType.DIAL_MTR;
|
|
745
|
+
event_category: EventCategory.NETWORK;
|
|
746
|
+
platform?: string;
|
|
747
|
+
os?: string;
|
|
748
|
+
session_id?: string;
|
|
749
|
+
user_id?: string;
|
|
750
|
+
}
|
|
731
751
|
/** @internal Protocol-level input used by automatic struggle detectors. */
|
|
732
752
|
export interface ReportStruggleParams {
|
|
733
753
|
type: StruggleEventName;
|
|
@@ -749,6 +769,13 @@ export interface ReportStruggleParams {
|
|
|
749
769
|
tags?: Record<string, string>;
|
|
750
770
|
/** Business properties written flat into data.event_properties. */
|
|
751
771
|
properties?: EventProperties;
|
|
772
|
+
/** @internal Frozen source context for delayed automatic detections. */
|
|
773
|
+
sourceContext?: {
|
|
774
|
+
timestamp: number;
|
|
775
|
+
sessionId: string;
|
|
776
|
+
viewId: string;
|
|
777
|
+
replayId: string;
|
|
778
|
+
};
|
|
752
779
|
}
|
|
753
780
|
export interface ReportFormSubmitResultParams {
|
|
754
781
|
status: FormSubmitStatus;
|
|
@@ -2,5 +2,5 @@ export { Config, InternalConfig, CoreApiConfig, PagePerformanceStruct } from './
|
|
|
2
2
|
export { SpeedLog, BridgeLog, StaticAssetsLog, PagePerformanceLog, PagePerformanceLogForHippy3, HippyPagePerformanceLog, PlatTypeNum, NetworkTypeNum, } from './log';
|
|
3
3
|
export { SendOption, SendSuccess, SendFail, SendType, } from './send';
|
|
4
4
|
export { Transport, TransportRequest, TransportResult, TransportCallbacks, TransportMethod, TransportBody, RetryDelayResolver, RetrySchedule, DEFAULT_TRANSPORT_RETRY_SCHEDULE, InternalSdkOptions, } from './transport';
|
|
5
|
-
export { Environment, } from './env';
|
|
5
|
+
export { Environment, resolveEnvironment, } from './env';
|
|
6
6
|
export { EventType, EventCategory, BaseEvent, EventContext, SDKInfo, AppInfo, CollectEventsRequest, ExceptionStack, ExceptionFrame, FormSubmitStatus, NavigationType, StruggleStatus, StruggleOwnerType, StruggleEventName, JSErrorEvent, PromiseErrorEvent, ResourceErrorEvent, APIErrorEvent, PageLoadEvent, ResourceLoadEvent, APICallEvent, SSECallOutcome, SSECallEvent, WebVitalsEvent, LagEventMeasurements, LagEventProperties, LagEventData, LagDetectedEvent, NoResponseEvent, BlankScreenTriggerReason, BlankScreenTriggerType, BlankScreenDetectionMethod, BlankScreenMeasurements, BlankScreenEventProperties, BlankScreenEvent, MemoryEventMeasurements, WebMemoryEventMeasurements, AppMemoryEventMeasurements, WebMemoryEventData, AppMemoryEventData, MemoryEventData, MemoryUsageEvent, ProcessSignalEventName, ProcessSignalEventProperties, ProcessSignalEventData, ProcessSignalEvent, AppMetricsEvent, FileIoOperation, FileIoEventMeasurements, FileIoEventProperties, FileIoEventData, FileIoEvent, MemoryOOMEvent, EventContextData, BehaviorContextData, FormEventData, ClickEvent, ScrollEvent, LongPressEvent, PageViewEvent, FormFocusEvent, FormBlurEvent, FormChangeEvent, FormSubmitEvent, FormSubmitResultEvent, StruggleEvent, CustomEvent, CustomTimeEvent, LogEvent, TDEMEvent, ReportStruggleParams, StruggleSeverity, EventPropertyValue, EventProperties, ReportFormSubmitResultParams, EventOptions, TrackOptions, TrackStruggleOptions, MeasureOptions, CaptureOptions, SetPageOptions, ReportPageViewOptions, generateEventId, parseErrorStack, } from './event';
|
|
@@ -4,17 +4,18 @@
|
|
|
4
4
|
import { TDEMEvent } from '../interface/event';
|
|
5
5
|
import { Pipe } from './index';
|
|
6
6
|
import Core from '../core';
|
|
7
|
-
/**
|
|
8
|
-
* 事件节流管道
|
|
9
|
-
* @param tdem - Core 实例
|
|
10
|
-
* @param maxCount - 最大批量数量
|
|
11
|
-
*/
|
|
12
7
|
export declare function createEventThrottlePipe(tdem: Core, maxCount: number): Pipe<TDEMEvent | TDEMEvent[], TDEMEvent[]>;
|
|
13
8
|
/**
|
|
14
9
|
* 事件过滤管道 - 调用用户的 beforeReport 钩子
|
|
15
10
|
* @param tdem - Core 实例
|
|
16
11
|
*/
|
|
17
12
|
export declare function createEventFilterPipe(tdem: Core): Pipe<TDEMEvent[], TDEMEvent[]>;
|
|
13
|
+
/**
|
|
14
|
+
* 构建公共上下文信息
|
|
15
|
+
* @param tdem - Core 实例
|
|
16
|
+
*/
|
|
17
|
+
export declare function normalizePlatform(rawPlatform: string): string;
|
|
18
|
+
export declare function readInstanceViewId(tdem: Core): string;
|
|
18
19
|
/**
|
|
19
20
|
* 上报管道 - 构建新版协议请求体并上报
|
|
20
21
|
* @param tdem - Core 实例
|
|
@@ -1,28 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TDEM
|
|
2
|
+
* TDEM 采样闸门管道
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* - 支持 Session 续期时重新决策(reDecide)
|
|
4
|
+
* 若实例上挂了 `_tdemSampleConfig`(规则化文档),按事件独立抽签。
|
|
5
|
+
* 可通过 `_tdemSampleEvaluateOptions` 注入闭集与 page_path 派生策略。
|
|
6
|
+
* 未挂文档时保持 Session 全有/全无闸门。
|
|
8
7
|
*/
|
|
9
8
|
import { Pipe } from './index';
|
|
10
9
|
import { TDEMEvent } from '../interface/event';
|
|
11
10
|
import Core from '../core';
|
|
12
|
-
/** 采样闸门控制接口 */
|
|
13
11
|
export interface TDEMSampleGate {
|
|
14
|
-
/** 标记采样决策结果,释放闸门 */
|
|
15
12
|
decide(isSampled: boolean): void;
|
|
16
|
-
/**
|
|
17
|
-
* Session 续期时重新决策
|
|
18
|
-
* 使用缓存的采样率重新摇骰子,决定新 Session 是否继续上报
|
|
19
|
-
* @param sampleRate 采样率 (0~100)
|
|
20
|
-
* @returns 新的采样结果
|
|
21
|
-
*/
|
|
22
13
|
reDecide(sampleRate: number): boolean;
|
|
23
|
-
/** 是否已完成采样决策 */
|
|
24
14
|
readonly isDecided: boolean;
|
|
25
|
-
/** 是否被采样命中 */
|
|
26
15
|
readonly isSampled: boolean;
|
|
27
16
|
}
|
|
28
17
|
/**
|
|
@@ -30,12 +19,4 @@ export interface TDEMSampleGate {
|
|
|
30
19
|
* 决策前、远程关闭或未命中时都为 false,此时不得改写业务请求的追踪头。
|
|
31
20
|
*/
|
|
32
21
|
export declare function isTDEMCollectionActive(tdem: unknown): boolean;
|
|
33
|
-
/**
|
|
34
|
-
* 创建 TDEM 采样闸门管道
|
|
35
|
-
*
|
|
36
|
-
* 该管道放在 tdemEventPipeline 的入口:
|
|
37
|
-
* - 采样决策未完成 → 暂存事件到队列
|
|
38
|
-
* - 采样命中 → 释放所有暂存事件,后续事件正常放行
|
|
39
|
-
* - 采样未命中 → 丢弃所有暂存事件,后续事件静默丢弃
|
|
40
|
-
*/
|
|
41
22
|
export declare function createTDEMSampleGatePipe(tdem: Core): Pipe<TDEMEvent | TDEMEvent[], TDEMEvent | TDEMEvent[]>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SampleConfigDocument, SampleEventView } from './types';
|
|
2
|
+
export declare type EvaluateEventSampleOptions = {
|
|
3
|
+
closedSet?: ReadonlySet<string>;
|
|
4
|
+
derivePagePath?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare function evaluateEventSample(event: SampleEventView, config?: SampleConfigDocument, random?: () => number, options?: EvaluateEventSampleOptions): boolean;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web 规则化采样左树闭集,对齐 event-types-inventory.md §3.1。
|
|
3
|
+
* 不含 rage_click / lcp 等假类型,也不含 behavior / log(永远 100%;log 与自定义事件重叠,前端不提供采样)。
|
|
4
|
+
*
|
|
5
|
+
* 104 四端闭集与 Web 并存;不要用 WEB_SAMPLE_EVENT_TYPES 去过滤 Electron / 原生。
|
|
6
|
+
*/
|
|
7
|
+
export declare const WEB_SAMPLE_EVENT_CATEGORIES: readonly ["error", "performance", "network", "custom"];
|
|
8
|
+
export declare type WebSampleEventCategory = (typeof WEB_SAMPLE_EVENT_CATEGORIES)[number];
|
|
9
|
+
export declare const WEB_SAMPLE_EVENT_TYPES: Record<WebSampleEventCategory, readonly string[]>;
|
|
10
|
+
export declare const WEB_SAMPLE_EVENT_TYPE_SET: ReadonlySet<string>;
|
|
11
|
+
export declare function isWebSampleEventType(type: string): boolean;
|
|
12
|
+
export declare const MP_SAMPLE_EVENT_TYPES: Record<string, readonly string[]>;
|
|
13
|
+
export declare const ANDROID_SAMPLE_EVENT_TYPES: Record<string, readonly string[]>;
|
|
14
|
+
export declare const IOS_SAMPLE_EVENT_TYPES: Record<string, readonly string[]>;
|
|
15
|
+
export declare const ELECTRON_SAMPLE_EVENT_TYPES: Record<string, readonly string[]>;
|
|
16
|
+
export declare const MP_SAMPLE_EVENT_TYPE_SET: ReadonlySet<string>;
|
|
17
|
+
export declare const ANDROID_SAMPLE_EVENT_TYPE_SET: ReadonlySet<string>;
|
|
18
|
+
export declare const IOS_SAMPLE_EVENT_TYPE_SET: ReadonlySet<string>;
|
|
19
|
+
export declare const ELECTRON_SAMPLE_EVENT_TYPE_SET: ReadonlySet<string>;
|
|
20
|
+
export declare type RuleSamplingAppType = 'web' | 'wx-miniprogram' | 'android' | 'ios' | 'electron';
|
|
21
|
+
export declare function sampleEventTypesFor(appType: string): Record<string, readonly string[]> | undefined;
|
|
22
|
+
export declare function sampleEventTypeSet(appType: string): ReadonlySet<string> | undefined;
|
|
23
|
+
export declare function isSampleEventType(appType: string, type: string): boolean;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { SampleConfigDocument, SampleConfigPreference } from './types';
|
|
2
|
+
export declare function resolveSampleConfig(preference: SampleConfigPreference | undefined, remote: SampleConfigDocument | null | undefined, local: SampleConfigDocument | null | undefined): SampleConfigDocument;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export declare type SampleOperator = 'equals' | 'not_equals' | 'contains' | 'not_contains' | 'in' | 'not_in' | 'starts_with' | 'ends_with';
|
|
2
|
+
export interface SampleCondition {
|
|
3
|
+
field: string;
|
|
4
|
+
operator: SampleOperator;
|
|
5
|
+
value: string | string[];
|
|
6
|
+
}
|
|
7
|
+
export interface SampleRule {
|
|
8
|
+
name: string;
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
sample_rate: number;
|
|
11
|
+
conditions: SampleCondition[];
|
|
12
|
+
}
|
|
13
|
+
export interface SampleTypeConfig {
|
|
14
|
+
sample_rate: number;
|
|
15
|
+
rules: SampleRule[];
|
|
16
|
+
}
|
|
17
|
+
export interface SampleEventConfig {
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
types: Record<string, SampleTypeConfig>;
|
|
20
|
+
}
|
|
21
|
+
export interface SampleReplayConfig {
|
|
22
|
+
enabled: boolean;
|
|
23
|
+
experience_sample_rate: number;
|
|
24
|
+
error_traceback: boolean;
|
|
25
|
+
error_sample_rate: number;
|
|
26
|
+
}
|
|
27
|
+
export interface SampleConfigDocument {
|
|
28
|
+
event: SampleEventConfig;
|
|
29
|
+
replay: SampleReplayConfig;
|
|
30
|
+
}
|
|
31
|
+
export declare const BUILTIN_SAMPLE_CONFIG: SampleConfigDocument;
|
|
32
|
+
export declare type SampleConfigPreference = 'remote-first' | 'local-first';
|
|
33
|
+
/** 抽样时从事件 + 会话上下文抽出的扁平字段。 */
|
|
34
|
+
export interface SampleEventView {
|
|
35
|
+
event_type: string;
|
|
36
|
+
event_category?: string;
|
|
37
|
+
event_name?: string;
|
|
38
|
+
page_url?: string;
|
|
39
|
+
user_id?: string;
|
|
40
|
+
device_id?: string;
|
|
41
|
+
env?: string;
|
|
42
|
+
version?: string;
|
|
43
|
+
device?: string;
|
|
44
|
+
os?: string;
|
|
45
|
+
os_version?: string;
|
|
46
|
+
browser?: string;
|
|
47
|
+
browser_version?: string;
|
|
48
|
+
network?: string;
|
|
49
|
+
process_type?: string;
|
|
50
|
+
tags?: Record<string, unknown>;
|
|
51
|
+
event_properties?: Record<string, unknown>;
|
|
52
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import Core from '../core';
|
|
2
|
+
import { TDEMEvent } from '../interface/event';
|
|
3
|
+
export declare function readEventSession(tdem: Core): string;
|
|
4
|
+
export declare function stampEventSession(event: TDEMEvent, sessionId: string): void;
|
|
5
|
+
export declare function eventSession(event: TDEMEvent): string | undefined;
|
|
@@ -13,6 +13,11 @@ export declare const buildLog2Json: (logs: any | any[]) => string;
|
|
|
13
13
|
interface P {
|
|
14
14
|
[k: string]: any;
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* 抹掉上报里的敏感词 eval(微信会拦截含该词的请求)。
|
|
18
|
+
* evaluate_script 含有子串 eval,必须原样保留,否则键会变成 evaIuate_script。
|
|
19
|
+
*/
|
|
20
|
+
export declare function maskEvalKeyword(input: string): string;
|
|
16
21
|
/**
|
|
17
22
|
* 拼接上报请求 query 参数
|
|
18
23
|
* @param url
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import './polyfill';
|
|
2
2
|
import TDEM from './tdem';
|
|
3
3
|
export default TDEM;
|
|
4
|
+
export { registerCgiRequestFinalizer } from './plugins/cgi-speed/dial-observation';
|
|
4
5
|
export { WebConfig, LagMonitorConfig, BlankScreenConfig, MemoryMonitorConfig, ElementMatcher, } from './interface';
|
|
6
|
+
export type { CgiDialObservation, CgiRequestFinalizer } from './plugins/cgi-speed/dial-observation';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Config, InternalConfig, CoreApiConfig, TraceType, TraceRequestHeader, PagePerformanceStruct } from "../../../core/src";
|
|
1
|
+
import { Config, InternalConfig, CoreApiConfig, TraceType, TraceRequestHeader, PagePerformanceStruct, SampleConfigDocument } from "../../../core/src";
|
|
2
2
|
import { SessionReplayConfig } from '../plugins/session-replay/types';
|
|
3
3
|
import { StruggleMonitorConfig } from '../plugins/struggle-monitor';
|
|
4
4
|
export declare type ApiMonitorConfig = CoreApiConfig & {
|
|
@@ -106,6 +106,9 @@ export interface WebConfig extends Config {
|
|
|
106
106
|
websocket?: boolean | WebSocketMonitorConfig;
|
|
107
107
|
webVitals?: boolean | WebVitalsConfig;
|
|
108
108
|
sessionReplay?: boolean | SessionReplayConfig;
|
|
109
|
+
/** 远程优先 | 本地优先;默认 remote-first */
|
|
110
|
+
sampleConfigPreference?: 'remote-first' | 'local-first';
|
|
111
|
+
sampleConfig?: SampleConfigDocument;
|
|
109
112
|
struggleMonitor?: boolean | StruggleMonitorConfig;
|
|
110
113
|
lagMonitor?: boolean | LagMonitorConfig;
|
|
111
114
|
blankScreen?: boolean | BlankScreenConfig;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { RequestFinalizationFields, RequestFinalizerResult, RequestFinalizerLease } from "../../../../core/src";
|
|
2
|
+
export interface CgiDialObservation {
|
|
3
|
+
requestId: string;
|
|
4
|
+
source: 'renderer_fetch_xhr';
|
|
5
|
+
host: string;
|
|
6
|
+
url: string;
|
|
7
|
+
statusCode: number;
|
|
8
|
+
errorCode: string;
|
|
9
|
+
durationMs: number;
|
|
10
|
+
/** Browser DNS interval; absent when no usable timing entry is available. */
|
|
11
|
+
dnsTimeMs?: number;
|
|
12
|
+
willReport: boolean;
|
|
13
|
+
process: 'renderer';
|
|
14
|
+
startedAtMs: number;
|
|
15
|
+
}
|
|
16
|
+
export declare type CgiRequestFinalizer = (observation: Readonly<CgiDialObservation>) => RequestFinalizerResult;
|
|
17
|
+
export declare const registerCgiRequestFinalizer: (handler: (observation: Readonly<CgiDialObservation>) => RequestFinalizerResult, options?: import("../../../../core/src").RequestFinalizerOptions) => () => void;
|
|
18
|
+
export declare const beginCgiRequest: (url: string, initiatorType?: "fetch" | "xmlhttprequest" | undefined) => string;
|
|
19
|
+
export declare const endCgiRequest: (url: string, id?: string | undefined) => void;
|
|
20
|
+
/** Transport has ended, but keep its owner until the deferred HTTP report is finalized. */
|
|
21
|
+
export declare const releaseCgiRequest: (id: string) => void;
|
|
22
|
+
export declare const rendererDnsTime: (url: string, startedAtMs: number, requestId?: string | undefined) => number | undefined;
|
|
23
|
+
export declare const waitForRendererResourceTiming: (url: string, startedAtMs: number, requestId?: string | undefined) => Promise<'settled' | 'timeout'> | 'settled';
|
|
24
|
+
export declare const notifyCgiFinalObservation: (input: {
|
|
25
|
+
requestId: string;
|
|
26
|
+
url: string;
|
|
27
|
+
statusCode: number;
|
|
28
|
+
durationMs: number;
|
|
29
|
+
willReport: boolean;
|
|
30
|
+
startedAtMs: number;
|
|
31
|
+
transportFailure?: boolean | undefined;
|
|
32
|
+
timingUnavailable?: boolean | undefined;
|
|
33
|
+
}, owner?: RequestFinalizerLease<CgiDialObservation, RequestFinalizerResult> | null, measured?: {
|
|
34
|
+
ms?: number | undefined;
|
|
35
|
+
} | undefined) => RequestFinalizationFields | Promise<RequestFinalizationFields>;
|
|
36
|
+
export declare const publishAfterDialObservation: (input: {
|
|
37
|
+
requestId: string;
|
|
38
|
+
url: string;
|
|
39
|
+
statusCode: number;
|
|
40
|
+
durationMs: number;
|
|
41
|
+
willReport: boolean;
|
|
42
|
+
startedAtMs: number;
|
|
43
|
+
transportFailure?: boolean;
|
|
44
|
+
}, publish: (fields: RequestFinalizationFields, dnsTime?: number | undefined) => void) => void;
|
|
@@ -33,6 +33,7 @@ export declare function resolveSseNetworkMeta(input: {
|
|
|
33
33
|
httpMethod: string;
|
|
34
34
|
redirectCount: number;
|
|
35
35
|
};
|
|
36
|
+
export declare function normalizeModelVersion(value: unknown): string;
|
|
36
37
|
export declare function createSseObserver(options: {
|
|
37
38
|
url: string;
|
|
38
39
|
httpMethod: string;
|
|
@@ -43,6 +44,7 @@ export declare function createSseObserver(options: {
|
|
|
43
44
|
redirectCount?: number;
|
|
44
45
|
replayId?: string | undefined;
|
|
45
46
|
now?: () => number;
|
|
47
|
+
llmVersion?: string;
|
|
46
48
|
}): SseObserver;
|
|
47
49
|
export declare function readSseResponseBody(body: {
|
|
48
50
|
getReader: () => {
|
package/lib/packages/web-sdk/src/plugins/{session-replay → click-detection}/click-detector.d.ts
RENAMED
|
@@ -14,7 +14,7 @@ export interface ClickDetectorOptions {
|
|
|
14
14
|
slowClickThreshold?: number;
|
|
15
15
|
/** 愤怒点击次数阈值,默认 5 */
|
|
16
16
|
rageClickCount?: number;
|
|
17
|
-
/** 愤怒点击时间窗口(毫秒),默认
|
|
17
|
+
/** 愤怒点击时间窗口(毫秒),默认 3000 */
|
|
18
18
|
rageClickWindow?: number;
|
|
19
19
|
/** 慢点击回调 */
|
|
20
20
|
onSlowClick?: (data: SlowClickData) => void;
|
|
@@ -26,6 +26,7 @@ export interface ClickDetectorOptions {
|
|
|
26
26
|
onEffectiveAction?: (data: EffectiveActionData) => void;
|
|
27
27
|
/** 死点击回调 */
|
|
28
28
|
onDeadClick?: (data: DeadClickData) => void;
|
|
29
|
+
getClickContext?: () => string;
|
|
29
30
|
}
|
|
30
31
|
/** 慢点击数据 */
|
|
31
32
|
export interface SlowClickData {
|
|
@@ -48,6 +49,8 @@ export interface RageClickData {
|
|
|
48
49
|
timeWindowMs: number;
|
|
49
50
|
/** 开始时间戳 */
|
|
50
51
|
timestamp: number;
|
|
52
|
+
clicks: ClickStartData[];
|
|
53
|
+
lastTimestamp: number;
|
|
51
54
|
}
|
|
52
55
|
/** 死点击数据 */
|
|
53
56
|
export interface DeadClickData {
|
|
@@ -74,7 +77,7 @@ export interface ClickStartData {
|
|
|
74
77
|
node: ClickNodeInfo;
|
|
75
78
|
timestamp: number;
|
|
76
79
|
target: HTMLElement;
|
|
77
|
-
event:
|
|
80
|
+
event: MouseEvent;
|
|
78
81
|
effectiveActionReason?: EffectiveActionReason;
|
|
79
82
|
}
|
|
80
83
|
/** 有效动作数据 */
|
|
@@ -93,9 +96,10 @@ export declare class ClickDetector {
|
|
|
93
96
|
private clickNode;
|
|
94
97
|
private slowClickTimeoutId;
|
|
95
98
|
private mutationObserver;
|
|
96
|
-
private
|
|
97
|
-
private
|
|
98
|
-
private
|
|
99
|
+
private rage;
|
|
100
|
+
private rageTimer;
|
|
101
|
+
private closeRage;
|
|
102
|
+
private onVisibility;
|
|
99
103
|
constructor(options?: ClickDetectorOptions);
|
|
100
104
|
/**
|
|
101
105
|
* 启动检测
|
|
@@ -113,6 +117,7 @@ export declare class ClickDetector {
|
|
|
113
117
|
* 处理 click 事件(用于愤怒点击检测)
|
|
114
118
|
*/
|
|
115
119
|
private handleClick;
|
|
120
|
+
finishRage(): void;
|
|
116
121
|
/**
|
|
117
122
|
* 启动 MutationObserver
|
|
118
123
|
*/
|
|
@@ -129,7 +134,6 @@ export declare class ClickDetector {
|
|
|
129
134
|
* 清理慢点击检测状态
|
|
130
135
|
*/
|
|
131
136
|
private cleanupSlowClick;
|
|
132
|
-
private isSameTarget;
|
|
133
137
|
/**
|
|
134
138
|
* 标记当前点击已产生有效动作
|
|
135
139
|
*/
|
|
@@ -138,7 +142,6 @@ export declare class ClickDetector {
|
|
|
138
142
|
/**
|
|
139
143
|
* 获取可点击元素
|
|
140
144
|
*/
|
|
141
|
-
private getClickableElement;
|
|
142
145
|
private getExternalNavigationReason;
|
|
143
146
|
/**
|
|
144
147
|
* 获取节点信息
|
|
@@ -13,6 +13,11 @@ export declare const MAX_REPLAY_DURATION: number;
|
|
|
13
13
|
export declare const MIN_REPLAY_DURATION: number;
|
|
14
14
|
/** 事件缓冲区最大大小 (5MB) */
|
|
15
15
|
export declare const MAX_BUFFER_SIZE: number;
|
|
16
|
+
/** 与 collector 解压后的 events 限制对齐,包含 JSON 数组开销。 */
|
|
17
|
+
export declare const MAX_REPLAY_EVENTS_BYTES: number;
|
|
18
|
+
/** 活动数据及冻结队列的序列化数据总预算,不等同于 JS 堆大小。 */
|
|
19
|
+
export declare const MAX_REPLAY_RETAINED_BYTES: number;
|
|
20
|
+
export declare const MAX_PENDING_REPLAY_SEGMENTS = 64;
|
|
16
21
|
/** 单个 Segment 上报最大大小 (3MB),需小于后端 maxEventsSizeBytes(5MB),仅用于 fetch 上报路径 */
|
|
17
22
|
export declare const MAX_SEGMENT_SIZE: number;
|
|
18
23
|
/**
|
|
@@ -25,6 +30,14 @@ export declare const MAX_SEGMENT_SIZE: number;
|
|
|
25
30
|
* 仅用于 unload 时的 sendBeacon 上报路径,不影响常规 fetch 上报路径的 MAX_SEGMENT_SIZE。
|
|
26
31
|
*/
|
|
27
32
|
export declare const BEACON_MAX_CHUNK_SIZE: number;
|
|
33
|
+
/**
|
|
34
|
+
* 单次 Beacon 请求体上限(UTF-8 字节,压缩和封装之后)。
|
|
35
|
+
* 浏览器对同一页面未完成的 keepalive / sendBeacon 共享约 64KB 队列,
|
|
36
|
+
* 这里留出余量,并且仍然必须处理 sendBeacon 返回 false。
|
|
37
|
+
*/
|
|
38
|
+
export declare const BEACON_BODY_LIMIT: number;
|
|
39
|
+
/** 同组 keepalive / sendBeacon 的队列上限(字节) */
|
|
40
|
+
export declare const KEEPALIVE_QUEUE_LIMIT: number;
|
|
28
41
|
/** 默认 flush 间隔 (20秒) */
|
|
29
42
|
export declare const DEFAULT_FLUSH_INTERVAL: number;
|
|
30
43
|
/** 最小 flush 事件数量 (至少10个事件才上报) */
|
|
@@ -43,11 +43,19 @@ export declare class EventBuffer {
|
|
|
43
43
|
* 检查缓冲区是否为空
|
|
44
44
|
*/
|
|
45
45
|
isEmpty(): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* 同步拿走当前活动缓冲。之后新进来的事件留在缓冲里,不会被这次冻结带走。
|
|
48
|
+
*/
|
|
49
|
+
detachEvents(): eventWithTime[];
|
|
50
|
+
/**
|
|
51
|
+
* 首组 Meta + FullSnapshot 是否已经都在活动缓冲里。
|
|
52
|
+
*/
|
|
53
|
+
hasBaselinePair(): boolean;
|
|
46
54
|
/**
|
|
47
55
|
* 完成缓冲并返回结果
|
|
48
56
|
*
|
|
49
|
-
* Worker
|
|
50
|
-
*
|
|
57
|
+
* 始终返回主线程副本,不等待或清空 Worker。
|
|
58
|
+
* eventsJson 保留在返回类型中以兼容旧调用方。
|
|
51
59
|
*/
|
|
52
60
|
finishAsync(): Promise<BufferFinishResult & {
|
|
53
61
|
eventsJson?: string;
|
|
@@ -14,7 +14,7 @@ export { EventBuffer } from './event-buffer';
|
|
|
14
14
|
export { RecorderManager } from './recorder-manager';
|
|
15
15
|
export { SamplerManager } from './sampler-manager';
|
|
16
16
|
export { Uploader } from './uploader';
|
|
17
|
-
export { ClickDetector } from '
|
|
17
|
+
export { ClickDetector } from '../click-detection/click-detector';
|
|
18
18
|
export * from './types';
|
|
19
19
|
export * from './constants';
|
|
20
20
|
export * from './privacy';
|