anys-web 7.0.1 → 8.0.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/package.json CHANGED
@@ -1,38 +1,39 @@
1
1
  {
2
2
  "name": "anys-web",
3
- "version": "7.0.1",
3
+ "version": "8.0.0",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
7
+ "keywords": [],
8
+ "author": "tangshuang",
9
+ "license": "Apache-2.0",
10
+ "homepage": "https://github.com/tangshuang/anys",
7
11
  "scripts": {
8
12
  "build": "rimraf dist && webpack --config ../../webpack.config.js",
9
13
  "republish": "(can-npm-publish && npm publish) || exit 0"
10
14
  },
11
- "keywords": [],
12
- "author": "tangshuang",
13
- "license": "Apache-2.0",
14
15
  "dependencies": {
15
- "anys": "^7.0.0",
16
- "anys-plugin-store-memory": "^7.0.0",
17
- "anys-shared": "^7.0.0",
18
- "anys-web-plugin-identify": "^7.0.0",
19
- "anys-web-plugin-monitor-ajax": "^7.0.0",
20
- "anys-web-plugin-monitor-dom-mutation": "^7.0.0",
21
- "anys-web-plugin-monitor-error": "^7.0.0",
22
- "anys-web-plugin-monitor-input-event": "^7.0.0",
23
- "anys-web-plugin-monitor-mouse-event": "^7.0.0",
24
- "anys-web-plugin-monitor-performance": "^7.0.0",
25
- "anys-web-plugin-monitor-scroll-event": "^7.0.0",
26
- "anys-web-plugin-monitor-touch-event": "^7.0.0",
27
- "anys-web-plugin-monitor-url": "^7.0.0",
28
- "anys-web-plugin-monitor-window-activity": "^7.0.0",
29
- "anys-web-plugin-monitor-window-size": "^7.0.0",
30
- "anys-web-plugin-send-by-ajax": "^7.0.1",
31
- "anys-web-plugin-send-by-beacon": "^7.0.1",
32
- "anys-web-plugin-store-offline": "^7.0.0"
16
+ "anys": "^8.0.0",
17
+ "anys-plugin-store-memory": "^8.0.0",
18
+ "anys-shared": "^8.0.0",
19
+ "anys-web-plugin-identify": "^8.0.0",
20
+ "anys-web-plugin-monitor-ajax": "^8.0.0",
21
+ "anys-web-plugin-monitor-dom-mutation": "^8.0.0",
22
+ "anys-web-plugin-monitor-error": "^8.0.0",
23
+ "anys-web-plugin-monitor-input-event": "^8.0.0",
24
+ "anys-web-plugin-monitor-mouse-event": "^8.0.0",
25
+ "anys-web-plugin-monitor-performance": "^8.0.0",
26
+ "anys-web-plugin-monitor-scroll-event": "^8.0.0",
27
+ "anys-web-plugin-monitor-touch-event": "^8.0.0",
28
+ "anys-web-plugin-monitor-url": "^8.0.0",
29
+ "anys-web-plugin-monitor-window-activity": "^8.0.0",
30
+ "anys-web-plugin-monitor-window-size": "^8.0.0",
31
+ "anys-web-plugin-send-by-ajax": "^8.0.0",
32
+ "anys-web-plugin-send-by-beacon": "^8.0.0",
33
+ "anys-web-plugin-store-offline": "^8.0.0"
33
34
  },
34
35
  "publishConfig": {
35
36
  "registry": "https://registry.npmjs.org/"
36
37
  },
37
- "gitHead": "fece86b7db710354ad998a3406105d88b13cd533"
38
+ "gitHead": "8fbe953a3f773cfaab7f69055b2b34e7e19cc788"
38
39
  }
package/src/index.js CHANGED
@@ -1,17 +1,7 @@
1
1
  import { Anys } from 'anys';
2
2
  import { AnysOfflineTracerPlugin } from './offline-tracer-plugin.js';
3
3
 
4
- class Tracer extends Anys {
5
- /**
6
- * patch auth info into reportParams
7
- * @param {object} info
8
- */
9
- auth(info) {
10
- this.options.reportParams = Object.assign(this.options.reportParams || {}, info);
11
- }
12
- }
13
-
14
- export const createTracer = (options = {}) => new Tracer({
4
+ export const createTracer = (options = {}) => new Anys({
15
5
  namespace: 'AnysTracer',
16
6
  ...options,
17
7
  plugins: {
@@ -145,7 +145,8 @@ export class AnysOfflineTracerPlugin extends AnysPlugin {
145
145
  }
146
146
 
147
147
  const { reportUrl, reportParams } = this.anys.options;
148
- const url = reportParams ? replaceUrlSearch(reportUrl, reportParams) : reportUrl;
148
+ const params = typeof reportParams === 'function' ? reportParams() : reportParams;
149
+ const url = params ? replaceUrlSearch(reportUrl, params) : reportUrl;
149
150
  return ajaxPost(url, { data: items }).then(() => {
150
151
  ids.forEach((id) => {
151
152
  delete this.cache[id];