@ohbug/browser 2.1.2 → 2.2.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/dist/index.d.ts CHANGED
@@ -15,7 +15,6 @@ interface UncaughtErrorDetail extends OhbugBaseDetail {
15
15
  }
16
16
 
17
17
  interface ResourceErrorDetail extends OhbugBaseDetail {
18
- outerHTML: string;
19
18
  src: string;
20
19
  tagName: string;
21
20
  id: string;
@@ -36,12 +35,6 @@ interface AjaxErrorDetail extends OhbugBaseDetail {
36
35
  req: {
37
36
  url: string;
38
37
  method: string;
39
- data: string | {};
40
- };
41
- res: {
42
- response: string;
43
- status: number;
44
- statusText: string;
45
38
  };
46
39
  }
47
40
 
@@ -49,11 +42,6 @@ interface FetchErrorDetail extends OhbugBaseDetail {
49
42
  req: {
50
43
  url: string;
51
44
  method: string;
52
- data: string;
53
- };
54
- res: {
55
- status: number;
56
- statusText: string;
57
45
  };
58
46
  }
59
47
 
@@ -61,10 +49,6 @@ interface WebsocketErrorDetail extends OhbugBaseDetail {
61
49
  url: string;
62
50
  timeStamp: number;
63
51
  readyState: number;
64
- protocol: string;
65
- extensions: string;
66
- binaryType: string;
67
- bufferedAmount: number;
68
52
  }
69
53
 
70
54
  export { AjaxErrorDetail, FetchErrorDetail, ResourceErrorDetail, UncaughtErrorDetail, UnhandledrejectionErrorDetail, UnknownErrorDetail, WebsocketErrorDetail, BrowserClient as default };
package/dist/index.js CHANGED
@@ -49,7 +49,11 @@ var import_utils19 = require("@ohbug/utils");
49
49
  var device = () => {
50
50
  const ohbugDevice = {};
51
51
  if (navigator) {
52
- const { language, userAgent, connection } = navigator;
52
+ const {
53
+ language,
54
+ userAgent,
55
+ connection
56
+ } = navigator;
53
57
  ohbugDevice.language = language;
54
58
  ohbugDevice.userAgent = userAgent;
55
59
  if (connection) {
@@ -73,7 +77,7 @@ var device = () => {
73
77
  };
74
78
 
75
79
  // src/version.ts
76
- var version = "2.1.2";
80
+ var version = "2.2.0";
77
81
 
78
82
  // src/extension.ts
79
83
  var import_core12 = require("@ohbug/core");
@@ -173,22 +177,23 @@ var global2 = (0, import_utils2.getGlobal)();
173
177
  function listener(e) {
174
178
  if (e.target) {
175
179
  const { client } = (0, import_utils2.getOhbugObject)();
176
- const { tagName, id, className, name, src, outerHTML, nodeType } = e.target;
177
- const selector = (0, import_utils2.getSelector)(e);
178
- client.addAction(
179
- "click node",
180
- {
181
- tagName,
182
- id,
183
- className,
184
- name,
185
- src,
186
- outerHTML,
187
- nodeType,
188
- selector
189
- },
190
- "click"
191
- );
180
+ const { tagName, id, className, name, src, nodeType } = e.target;
181
+ if (tagName.toUpperCase() !== "HTML" && tagName.toUpperCase() !== "BODY") {
182
+ const selector = (0, import_utils2.getSelector)(e);
183
+ client.addAction(
184
+ "click node",
185
+ {
186
+ tagName,
187
+ id: id || void 0,
188
+ className: className || void 0,
189
+ name: name || void 0,
190
+ src: src || void 0,
191
+ nodeType: nodeType || void 0,
192
+ selector: selector || void 0
193
+ },
194
+ "click"
195
+ );
196
+ }
192
197
  }
193
198
  }
194
199
  function captureClick() {
@@ -275,10 +280,8 @@ var import_utils5 = require("@ohbug/utils");
275
280
  var import_core2 = require("@ohbug/core");
276
281
  function resourceErrorHandler(error) {
277
282
  const target = error.target || error.srcElement;
278
- const { outerHTML } = target;
279
283
  const selector = (0, import_utils5.getSelector)(error);
280
284
  const detail = {
281
- outerHTML,
282
285
  src: target && target.src,
283
286
  tagName: target && target.tagName,
284
287
  id: target && target.id,
@@ -447,13 +450,7 @@ function captureAjaxError() {
447
450
  const detail = {
448
451
  req: {
449
452
  url: desc.url,
450
- method: desc.method,
451
- data: args[0] || {}
452
- },
453
- res: {
454
- status: this.status,
455
- statusText: this.statusText,
456
- response: this.response
453
+ method: desc.method
457
454
  }
458
455
  };
459
456
  client.addAction("ajax", detail, "ajax");
@@ -495,12 +492,7 @@ function captureFetchError() {
495
492
  const detail = {
496
493
  req: {
497
494
  url,
498
- method: conf && conf.method,
499
- data: conf && conf.body || {}
500
- },
501
- res: {
502
- status: res.status,
503
- statusText: res.statusText
495
+ method: conf && conf.method
504
496
  }
505
497
  };
506
498
  client.addAction("fetch", detail, "fetch");
@@ -514,12 +506,7 @@ function captureFetchError() {
514
506
  const detail = {
515
507
  req: {
516
508
  url,
517
- method: conf && conf.method,
518
- data: conf && conf.body || {}
519
- },
520
- res: {
521
- status: 400,
522
- statusText: "unknownError"
509
+ method: conf && conf.method
523
510
  }
524
511
  };
525
512
  networkDispatcher(import_core10.EventTypes.FETCH_ERROR, detail);
@@ -553,22 +540,14 @@ function captureWebSocketError() {
553
540
  const {
554
541
  target: {
555
542
  url,
556
- readyState,
557
- protocol,
558
- extensions,
559
- binaryType,
560
- bufferedAmount
543
+ readyState
561
544
  },
562
545
  timeStamp
563
546
  } = e;
564
547
  const detail = {
565
548
  url,
566
549
  timeStamp,
567
- readyState,
568
- protocol,
569
- extensions,
570
- binaryType,
571
- bufferedAmount
550
+ readyState
572
551
  };
573
552
  networkDispatcher(import_core11.EventTypes.WEBSOCKET_ERROR, detail);
574
553
  arg.apply(this, args);
package/dist/index.mjs CHANGED
@@ -26,7 +26,11 @@ import { getGlobal as getGlobal10 } from "@ohbug/utils";
26
26
  var device = () => {
27
27
  const ohbugDevice = {};
28
28
  if (navigator) {
29
- const { language, userAgent, connection } = navigator;
29
+ const {
30
+ language,
31
+ userAgent,
32
+ connection
33
+ } = navigator;
30
34
  ohbugDevice.language = language;
31
35
  ohbugDevice.userAgent = userAgent;
32
36
  if (connection) {
@@ -50,7 +54,7 @@ var device = () => {
50
54
  };
51
55
 
52
56
  // src/version.ts
53
- var version = "2.1.2";
57
+ var version = "2.2.0";
54
58
 
55
59
  // src/extension.ts
56
60
  import { defineExtension } from "@ohbug/core";
@@ -150,22 +154,23 @@ var global2 = getGlobal2();
150
154
  function listener(e) {
151
155
  if (e.target) {
152
156
  const { client } = getOhbugObject2();
153
- const { tagName, id, className, name, src, outerHTML, nodeType } = e.target;
154
- const selector = getSelector(e);
155
- client.addAction(
156
- "click node",
157
- {
158
- tagName,
159
- id,
160
- className,
161
- name,
162
- src,
163
- outerHTML,
164
- nodeType,
165
- selector
166
- },
167
- "click"
168
- );
157
+ const { tagName, id, className, name, src, nodeType } = e.target;
158
+ if (tagName.toUpperCase() !== "HTML" && tagName.toUpperCase() !== "BODY") {
159
+ const selector = getSelector(e);
160
+ client.addAction(
161
+ "click node",
162
+ {
163
+ tagName,
164
+ id: id || void 0,
165
+ className: className || void 0,
166
+ name: name || void 0,
167
+ src: src || void 0,
168
+ nodeType: nodeType || void 0,
169
+ selector: selector || void 0
170
+ },
171
+ "click"
172
+ );
173
+ }
169
174
  }
170
175
  }
171
176
  function captureClick() {
@@ -252,10 +257,8 @@ import { getOhbugObject as getOhbugObject5, getSelector as getSelector2 } from "
252
257
  import { EventTypes as EventTypes2 } from "@ohbug/core";
253
258
  function resourceErrorHandler(error) {
254
259
  const target = error.target || error.srcElement;
255
- const { outerHTML } = target;
256
260
  const selector = getSelector2(error);
257
261
  const detail = {
258
- outerHTML,
259
262
  src: target && target.src,
260
263
  tagName: target && target.tagName,
261
264
  id: target && target.id,
@@ -424,13 +427,7 @@ function captureAjaxError() {
424
427
  const detail = {
425
428
  req: {
426
429
  url: desc.url,
427
- method: desc.method,
428
- data: args[0] || {}
429
- },
430
- res: {
431
- status: this.status,
432
- statusText: this.statusText,
433
- response: this.response
430
+ method: desc.method
434
431
  }
435
432
  };
436
433
  client.addAction("ajax", detail, "ajax");
@@ -472,12 +469,7 @@ function captureFetchError() {
472
469
  const detail = {
473
470
  req: {
474
471
  url,
475
- method: conf && conf.method,
476
- data: conf && conf.body || {}
477
- },
478
- res: {
479
- status: res.status,
480
- statusText: res.statusText
472
+ method: conf && conf.method
481
473
  }
482
474
  };
483
475
  client.addAction("fetch", detail, "fetch");
@@ -491,12 +483,7 @@ function captureFetchError() {
491
483
  const detail = {
492
484
  req: {
493
485
  url,
494
- method: conf && conf.method,
495
- data: conf && conf.body || {}
496
- },
497
- res: {
498
- status: 400,
499
- statusText: "unknownError"
486
+ method: conf && conf.method
500
487
  }
501
488
  };
502
489
  networkDispatcher(EventTypes10.FETCH_ERROR, detail);
@@ -530,22 +517,14 @@ function captureWebSocketError() {
530
517
  const {
531
518
  target: {
532
519
  url,
533
- readyState,
534
- protocol,
535
- extensions,
536
- binaryType,
537
- bufferedAmount
520
+ readyState
538
521
  },
539
522
  timeStamp
540
523
  } = e;
541
524
  const detail = {
542
525
  url,
543
526
  timeStamp,
544
- readyState,
545
- protocol,
546
- extensions,
547
- binaryType,
548
- bufferedAmount
527
+ readyState
549
528
  };
550
529
  networkDispatcher(EventTypes11.WEBSOCKET_ERROR, detail);
551
530
  arg.apply(this, args);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ohbug/browser",
3
- "version": "2.1.2",
3
+ "version": "2.2.0",
4
4
  "description": "Ohbug SDK for browsers",
5
5
  "license": "Apache-2.0",
6
6
  "author": "chenyueban <jasonchan0527@gmail.com>",