@tmsfe/tms-core 0.0.8 → 0.0.12

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.js CHANGED
@@ -52,10 +52,11 @@ class FastReport {
52
52
  const data = new Array(41);
53
53
  const env = getEnvInfo();
54
54
  Object.keys(param).forEach(key => {
55
- data[key] = param[key] === null ? '' : JSON.stringify(param[key]);
55
+ const valType = typeof param[key];
56
+ if (valType === 'string') data[key] = param[key];else if (valType === 'object') data[key] = JSON.stringify(param[key]);else data[key] = String(param[key]);
56
57
  });
57
58
  data[9] = '2';
58
- data[33] = getSystemInfo$1();
59
+ data[33] = encodeURIComponent(JSON.stringify(getSystemInfo$1()));
59
60
  appVer && !data[10] && (data[10] = env.appVersion);
60
61
  if (!data[26]) data[26] = (_data$ = data[27]) === null || _data$ === void 0 ? void 0 : _data$[0];
61
62
  data[28] = env.client;
@@ -69,9 +70,7 @@ class FastReport {
69
70
  data[simulatedUserIdIndex] = FastReport.getSimulatedUserId();
70
71
  }
71
72
 
72
- return new Request({
73
- withAuth: false
74
- }).post('basic/event/upload', {
73
+ return new Request().post('basic/event/upload', {
75
74
  batch: [data]
76
75
  }).catch(() => null);
77
76
  }
@@ -1477,41 +1476,6 @@ const startListenApp = () => {
1477
1476
  // onHide时立即上报,并清除定时器
1478
1477
  report(true, true);
1479
1478
  });
1480
- /**
1481
- * 监听小程序路由切换事件
1482
- */
1483
-
1484
- if (!wx.onAppRoute) {
1485
- cache({
1486
- 26: 'H',
1487
- 27: 'H100',
1488
- 40: 'notReport'
1489
- }, true);
1490
- wx.reportAnalytics('onapproute_not_support', {
1491
- mp_version: getMiniProgramVersion()
1492
- });
1493
- return;
1494
- }
1495
-
1496
- wx.onAppRoute(res => {
1497
- const {
1498
- path,
1499
- query,
1500
- openType
1501
- } = res || {};
1502
- cache({
1503
- 26: 'H',
1504
- 27: 'H100',
1505
- 38: path,
1506
- 39: JSON.stringify(query),
1507
- 40: openType
1508
- });
1509
- wx.reportAnalytics('page_show', {
1510
- path,
1511
- query: JSON.stringify(query),
1512
- opentype: openType
1513
- });
1514
- });
1515
1479
  };
1516
1480
 
1517
1481
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmsfe/tms-core",
3
- "version": "0.0.8",
3
+ "version": "0.0.12",
4
4
  "description": "tms运行时框架",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,7 +34,9 @@
34
34
  "rollup": "^2.6.1",
35
35
  "rollup-plugin-node-resolve": "^5.2.0",
36
36
  "rollup-plugin-terser": "^6.1.0",
37
- "rollup-plugin-typescript2": "0.27.0"
37
+ "rollup-plugin-typescript2": "0.27.0",
38
+ "rollup-plugin-replace": "^2.2.0",
39
+ "typescript": "^4.5.2"
38
40
  },
39
41
  "author": "tms·web",
40
42
  "gitHead": "72bf52451594b49a1c9f78edbad5956d414a66ca"
package/rollup.config.js CHANGED
@@ -98,7 +98,7 @@ function createConfig(format, output, plugins = []) {
98
98
  // exclude: ['node_modules/**'],
99
99
  }),
100
100
  // terser(),
101
- createReplacePlugin(),
101
+ // createReplacePlugin(),
102
102
  ...extralPlugin,
103
103
  ...plugins,
104
104
  ],
package/src/fastreport.js CHANGED
@@ -36,10 +36,13 @@ export default class FastReport {
36
36
  const data = new Array(41);
37
37
  const env = getEnvInfo();
38
38
  Object.keys(param).forEach((key) => {
39
- data[key] = param[key] === null ? '' : JSON.stringify(param[key]);
39
+ const valType = typeof param[key];
40
+ if (valType === 'string') data[key] = param[key];
41
+ else if (valType === 'object') data[key] = JSON.stringify(param[key]);
42
+ else data[key] = String(param[key]);
40
43
  });
41
44
  data[9] = '2';
42
- data[33] = getSystemInfo();
45
+ data[33] = encodeURIComponent(JSON.stringify(getSystemInfo()));
43
46
  appVer && !data[10] && (data[10] = env.appVersion);
44
47
  if (!data[26]) data[26] = data[27]?.[0];
45
48
  data[28] = env.client;
@@ -51,7 +54,7 @@ export default class FastReport {
51
54
  data[simulatedUserIdIndex] = FastReport.getSimulatedUserId();
52
55
  }
53
56
 
54
- return new Request({ withAuth: false }).post('basic/event/upload', { batch: [data] })
57
+ return new Request().post('basic/event/upload', { batch: [data] })
55
58
  .catch(() => null);
56
59
  }
57
60
 
package/src/report.js CHANGED
@@ -409,26 +409,6 @@ const startListenApp = () => {
409
409
  // onHide时立即上报,并清除定时器
410
410
  report(true, true);
411
411
  });
412
-
413
- /**
414
- * 监听小程序路由切换事件
415
- */
416
- if (!wx.onAppRoute) {
417
- cache({ 26: 'H', 27: 'H100', 40: 'notReport' }, true);
418
- wx.reportAnalytics('onapproute_not_support', {
419
- mp_version: getMiniProgramVersion(),
420
- });
421
- return;
422
- }
423
- wx.onAppRoute((res) => {
424
- const { path, query, openType } = res || {};
425
- cache({ 26: 'H', 27: 'H100', 38: path, 39: JSON.stringify(query), 40: openType });
426
- wx.reportAnalytics('page_show', {
427
- path,
428
- query: JSON.stringify(query),
429
- opentype: openType,
430
- });
431
- });
432
412
  };
433
413
 
434
414
  export {