aegis-mp-rum-wrapper 0.1.6 → 0.1.8

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/index.d.ts CHANGED
@@ -22,15 +22,6 @@ export interface AegisUserInfo {
22
22
  ext2?: string;
23
23
  ext3?: string;
24
24
  }
25
- export interface AegisMpWrapperConfig {
26
- id?: string;
27
- uin?: string;
28
- reportApiSpeed?: boolean;
29
- reportAssetSpeed?: boolean;
30
- pagePerformance?: boolean;
31
- webVitals?: boolean;
32
- delay?: number;
33
- }
34
25
  export interface ReportParams {
35
26
  name: string;
36
27
  ext1?: string;
@@ -38,7 +29,6 @@ export interface ReportParams {
38
29
  ext3?: string;
39
30
  [key: string]: any;
40
31
  }
41
- export declare function configureWrapper(config: AegisMpWrapperConfig): void;
42
32
  export declare function setUser(user: Partial<AegisUserInfo>): void;
43
33
  export declare function setRumID(rumID: string): void;
44
34
  export declare function reportEvent(params: string | ReportParams): void;
package/dist/index.js CHANGED
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.AegisW = exports.GPPRumID = void 0;
7
- exports.configureWrapper = configureWrapper;
8
7
  exports.setUser = setUser;
9
8
  exports.setRumID = setRumID;
10
9
  exports.reportEvent = reportEvent;
@@ -144,21 +143,16 @@ function initAegis(isDefault) {
144
143
  ext3: internalState.user.ext3,
145
144
  }, true);
146
145
  }
147
- console.log("AegisCtor235", aegis_mp_sdk_1.default);
146
+ console.log("Aegis235", aegis_mp_sdk_1.default);
148
147
  // 小程序环境直接使用构造函数
149
148
  if (typeof aegis_mp_sdk_1.default === "function") {
150
- console.log("return new AegisCtor");
149
+ console.log("return new Aegis");
151
150
  return new aegis_mp_sdk_1.default({
152
- id,
151
+ id: '8lDwXIovanY8d1awa6',
153
152
  uin: internalState.uin,
154
- reportApiSpeed: apiSpeed,
155
- reportAssetSpeed: assetSpeed,
156
- pagePerformance,
157
- webVitals,
158
- delay,
159
153
  spa: true,
160
154
  ext1,
161
- // hostUrl: "https://aegis.qq.com",
155
+ hostUrl: "https://aegis.qq.com",
162
156
  beforeRequest(data) {
163
157
  if (data.logType === "speed" || data.logType === "log") {
164
158
  return false;
@@ -170,23 +164,6 @@ function initAegis(isDefault) {
170
164
  console.error("[Aegis Wrapper] 找不到 aegis-mp-sdk 构造函数,请确认依赖是否正确安装和引用265");
171
165
  return undefined;
172
166
  }
173
- // 对外暴露的配置 API
174
- function configureWrapper(config) {
175
- if (config.id)
176
- internalState.id = config.id;
177
- if (typeof config.uin === "string")
178
- internalState.uin = config.uin;
179
- if (typeof config.reportApiSpeed === "boolean")
180
- internalState.reportApiSpeed = config.reportApiSpeed;
181
- if (typeof config.reportAssetSpeed === "boolean")
182
- internalState.reportAssetSpeed = config.reportAssetSpeed;
183
- if (typeof config.pagePerformance === "boolean")
184
- internalState.pagePerformance = config.pagePerformance;
185
- if (typeof config.webVitals === "boolean")
186
- internalState.webVitals = config.webVitals;
187
- if (typeof config.delay === "number")
188
- internalState.delay = config.delay;
189
- }
190
167
  function setUser(user) {
191
168
  const incoming = user;
192
169
  const nextUser = Object.assign(Object.assign({}, internalState.user), user);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aegis-mp-rum-wrapper",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "基于 aegis-mp-sdk 的小程序上报封装 SDK,支持双实例与自定义 RUM 日志构造。",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import AegisCtor from "aegis-mp-sdk";
1
+ import Aegis from "aegis-mp-sdk";
2
2
 
3
3
  // RUM 上报 ID(默认使用国服服务)
4
4
  export const GPPRumID = "8lDwXIovanY8d1awa6";
@@ -28,16 +28,6 @@ export interface AegisUserInfo {
28
28
  ext3?: string;
29
29
  }
30
30
 
31
- export interface AegisMpWrapperConfig {
32
- id?: string; // 默认使用 GPPRumID
33
- uin?: string;
34
- reportApiSpeed?: boolean;
35
- reportAssetSpeed?: boolean;
36
- pagePerformance?: boolean;
37
- webVitals?: boolean;
38
- delay?: number;
39
- }
40
-
41
31
  // 日志字段模板
42
32
  interface LogItem {
43
33
  report_type: number;
@@ -235,22 +225,18 @@ function initAegis(isDefault: boolean): any | undefined {
235
225
  true
236
226
  );
237
227
  }
238
- console.log("AegisCtor235", AegisCtor);
228
+ console.log("Aegis235", Aegis);
239
229
 
240
230
  // 小程序环境直接使用构造函数
241
- if (typeof AegisCtor === "function") {
242
- console.log("return new AegisCtor");
243
- return new (AegisCtor as any)({
244
- id,
231
+ if (typeof Aegis === "function") {
232
+ console.log("return new Aegis");
233
+ return new (Aegis as any)({
234
+ id:'8lDwXIovanY8d1awa6',
245
235
  uin: internalState.uin,
246
- reportApiSpeed: apiSpeed,
247
- reportAssetSpeed: assetSpeed,
248
- pagePerformance,
249
- webVitals,
250
- delay,
236
+
251
237
  spa: true,
252
238
  ext1,
253
- // hostUrl: "https://aegis.qq.com",
239
+ hostUrl: "https://aegis.qq.com",
254
240
  beforeRequest(data: any) {
255
241
  if (data.logType === "speed" || data.logType === "log") {
256
242
  return false;
@@ -266,21 +252,6 @@ function initAegis(isDefault: boolean): any | undefined {
266
252
  return undefined;
267
253
  }
268
254
 
269
- // 对外暴露的配置 API
270
- export function configureWrapper(config: AegisMpWrapperConfig): void {
271
- if (config.id) internalState.id = config.id;
272
- if (typeof config.uin === "string") internalState.uin = config.uin;
273
- if (typeof config.reportApiSpeed === "boolean")
274
- internalState.reportApiSpeed = config.reportApiSpeed;
275
- if (typeof config.reportAssetSpeed === "boolean")
276
- internalState.reportAssetSpeed = config.reportAssetSpeed;
277
- if (typeof config.pagePerformance === "boolean")
278
- internalState.pagePerformance = config.pagePerformance;
279
- if (typeof config.webVitals === "boolean")
280
- internalState.webVitals = config.webVitals;
281
- if (typeof config.delay === "number") internalState.delay = config.delay;
282
- }
283
-
284
255
  export function setUser(user: Partial<AegisUserInfo>): void {
285
256
  const incoming: any = user as any;
286
257
  const nextUser: AegisUserInfo = {