@cloudcare/browser-core 3.1.12 → 3.1.14

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/types/index.d.ts +79 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudcare/browser-core",
3
- "version": "3.1.12",
3
+ "version": "3.1.14",
4
4
  "main": "cjs/index.js",
5
5
  "module": "esm/index.js",
6
6
  "types": "types/index.d.ts",
@@ -22,5 +22,5 @@
22
22
  "author": "dataflux",
23
23
  "license": "MIT",
24
24
  "description": "DataFlux RUM Web 端数据指标监控",
25
- "gitHead": "01fca1d8b95bbd1e8e7936bda860af98bf76fa02"
25
+ "gitHead": "b1e48a057524da9bd63262a8b9d56500e5c6ae46"
26
26
  }
package/types/index.d.ts CHANGED
@@ -22,26 +22,67 @@ export declare const RawReportType: {
22
22
  readonly cspViolation: 'csp_violation'
23
23
  }
24
24
  export type RawReportType = (typeof RawReportType)[keyof typeof RawReportType]
25
+
26
+ export interface SiteInitConfiguration {
27
+ /**
28
+ * 以openway 方式上报数据令牌,从观测云控制台获取,必填
29
+ */
30
+ clientToken: string | undefined
31
+
32
+ /**
33
+ * 以 公共openway 方式上报数据地址,从观测云控制台获取,必填
34
+ */
35
+ site: string | undefined
36
+ }
37
+ export interface DatakitInitConfiguration {
38
+ /** DataKit 数据上报 Origin 注释:
39
+ * 协议(包括://),域名(或IP地址)[和端口号]
40
+ * 例如:
41
+ * https://www.datakit.com;
42
+ * http://100.20.34.3:8088。
43
+ */
44
+ datakitOrigin: string
45
+ }
25
46
  export interface InitConfiguration {
26
- clientToken?: string | undefined
47
+ /**
48
+ * 数据发送前的的拦截器
49
+ * @param event 事件内容
50
+ * @param context 事件额外属性
51
+ * @returns
52
+ */
27
53
  beforeSend?: (event: any, context?: any) => unknown | undefined
54
+ /**
55
+ * 数据上报采样率,100 表示全收集;0 表示不收集。默认 100
56
+ */
28
57
  sessionSampleRate?: number | undefined
29
58
  telemetrySampleRate?: number | undefined
30
59
  silentMultipleInit?: boolean | undefined
31
- site?: string | undefined
32
- datakitOrigin: string
60
+
33
61
  service?: string | undefined
62
+ /** Web 应用当前环境,如 prod:线上环境;gray:灰度环境;pre:预发布环境;common:日常环境;local:本地环境。 */
34
63
  env?: string | undefined
64
+ /** Web 应用的版本号。 */
35
65
  version?: string | undefined
36
- tracingSampleRate: number | undefined
66
+ /** 链路数据采样百分比:100 表示全收集;0 表示不收集。 */
67
+ tracingSampleRate?: number | undefined
37
68
  /**
38
69
  * @deprecated use usePartitionedCrossSiteSessionCookie instead
39
70
  */
40
71
  useCrossSiteSessionCookie?: boolean | undefined
72
+ /**
73
+ * 是否使用跨域 cookie,开启第三方 cookie 跨分区实现。默认不允许跨域,例如嵌套跨域 iframe 的情况。
74
+ */
75
+ usePartitionedCrossSiteSessionCookie?: boolean | undefined
41
76
  useSecureSessionCookie?: boolean | undefined
42
77
  trackSessionAcrossSubdomains?: boolean | undefined
43
- storeContextsToLocal: boolean | undefined
44
- sendContentTypeByJson: boolean | undefined
78
+ /**
79
+ * 是否把公共数据存储到localstorage,默认不存储
80
+ */
81
+ storeContextsToLocal?: boolean | undefined
82
+ /**
83
+ * 数据以 application/json 的发送方式,默认text
84
+ */
85
+ sendContentTypeByJson?: boolean | undefined
45
86
  }
46
87
  export enum TraceType {
47
88
  DDTRACE = 'ddtrace',
@@ -78,15 +119,44 @@ export declare function matchList(
78
119
  useStartsWith?: boolean
79
120
  ): boolean
80
121
 
81
- export interface RumInitConfiguration extends InitConfiguration {
122
+ export interface RumBaseInitConfiguration extends InitConfiguration {
123
+ /**从观测云创建的应用 ID */
82
124
  applicationId: string
125
+ /**
126
+ * 排除一些影响 loadingtime 的指标准确性的url,具体可参考下面文档
127
+ * https://docs.guance.com/security/page-performance/#_3
128
+ */
83
129
  excludedActivityUrls?: MatchOption[] | undefined
130
+ /**
131
+ * 允许注入 trace 采集器所需 header 头部的所有请求列表。可以是请求的 origin,也可以是正则,origin: 协议(包括://),域名(或IP地址)[和端口号]。例如:
132
+ ["https://api.example.com", /https:\\/\\/.*\\.my-api-domain\\.com/]。
133
+ */
84
134
  allowedTracingUrls?: Array<MatchOption | TracingOption> | undefined
85
135
  defaultPrivacyLevel?: DefaultPrivacyLevel | undefined
136
+ /**
137
+ * Session Replay 数据采集百分比:
138
+ 100 表示全收集;0 表示不收集。
139
+ */
86
140
  sessionReplaySampleRate?: number | undefined
141
+ /**
142
+ * 是否开启用户行为采集。
143
+ */
87
144
  trackUserInteractions?: boolean | undefined
145
+ /**
146
+ * 指定 action 数据 name 获取方式,默认自动获取,可以指定元素特定属性名称
147
+ */
88
148
  actionNameAttribute?: string | undefined
89
149
  trackViewsManually?: boolean | undefined
90
- traceType: TraceType
91
- traceId128Bit: boolean | undefined
150
+ /**
151
+ * 配置链路追踪工具类型,如果不配置默认为 ddtrace。目前支持 ddtrace、zipkin、skywalking_v3、jaeger、zipkin_single_header、w3c_traceparent 6 种数据类型。
152
+ */
153
+ traceType?: TraceType
154
+ /**
155
+ * 是否以 128 字节的方式生成 traceID,与 traceType 对应,目前支持类型 zipkin、jaeger。
156
+ */
157
+ traceId128Bit?: boolean | undefined
92
158
  }
159
+ export type RumInitConfiguration = RumBaseInitConfiguration &
160
+ DatakitInitConfiguration
161
+ export type RumSiteInitConfiguration = RumBaseInitConfiguration &
162
+ SiteInitConfiguration