@openreplay/tracker 5.0.0 → 5.0.1-beta.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 5.0.1
2
+
3
+ - Default text input mode is now Obscured
4
+ - Use `@medv/finder` instead of our own implementation of `getSelector` for better clickmaps experience
5
+
1
6
  ## 5.0.0
2
7
 
3
8
  - Added "tel" to supported input types
package/cjs/app/index.js CHANGED
@@ -33,7 +33,7 @@ class App {
33
33
  this.stopCallbacks = [];
34
34
  this.commitCallbacks = [];
35
35
  this.activityState = ActivityState.NotActive;
36
- this.version = '5.0.0'; // TODO: version compatability check inside each plugin.
36
+ this.version = '5.0.1-beta.1'; // TODO: version compatability check inside each plugin.
37
37
  this._usingOldFetchPlugin = false;
38
38
  this.delay = 0;
39
39
  this.projectKey = projectKey;
package/cjs/index.js CHANGED
@@ -140,7 +140,7 @@ class API {
140
140
  // no-cors issue only with text/plain or not-set Content-Type
141
141
  // req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
142
142
  req.send(JSON.stringify({
143
- trackerVersion: '5.0.0',
143
+ trackerVersion: '5.0.1-beta.1',
144
144
  projectKey: options.projectKey,
145
145
  doNotTrack,
146
146
  // TODO: add precise reason (an exact API missing)
@@ -68,7 +68,7 @@ function default_1(app, opts) {
68
68
  const options = Object.assign({
69
69
  obscureInputNumbers: true,
70
70
  obscureInputEmails: true,
71
- defaultInputMode: 0 /* InputMode.Plain */,
71
+ defaultInputMode: 1 /* InputMode.Obscured */,
72
72
  obscureInputDates: false,
73
73
  }, opts);
74
74
  function sendInputTarget(id, node) {
@@ -4,25 +4,15 @@ const guards_js_1 = require("../app/guards.js");
4
4
  const utils_js_1 = require("../utils.js");
5
5
  const messages_gen_js_1 = require("../app/messages.gen.js");
6
6
  const input_js_1 = require("./input.js");
7
+ const finder_1 = require("@medv/finder");
7
8
  function _getSelector(target, document) {
8
- let el = target;
9
- let selector = null;
10
- do {
11
- if (el.id) {
12
- return `#${el.id}` + (selector ? ` > ${selector}` : '');
13
- }
14
- selector =
15
- el.className
16
- .split(' ')
17
- .map((cn) => cn.trim())
18
- .filter((cn) => cn !== '')
19
- .reduce((sel, cn) => `${sel}.${cn}`, el.tagName.toLowerCase()) +
20
- (selector ? ` > ${selector}` : '');
21
- if (el === document.body) {
22
- return selector;
23
- }
24
- el = el.parentElement;
25
- } while (el !== document.body && el !== null);
9
+ const selector = (0, finder_1.finder)(target, {
10
+ root: document.body,
11
+ seedMinLength: 3,
12
+ optimizedMinLength: 2,
13
+ threshold: 1000,
14
+ maxNumberOfTries: 10000,
15
+ });
26
16
  return selector;
27
17
  }
28
18
  function isClickable(element) {
package/lib/app/index.js CHANGED
@@ -30,7 +30,7 @@ export default class App {
30
30
  this.stopCallbacks = [];
31
31
  this.commitCallbacks = [];
32
32
  this.activityState = ActivityState.NotActive;
33
- this.version = '5.0.0'; // TODO: version compatability check inside each plugin.
33
+ this.version = '5.0.1-beta.1'; // TODO: version compatability check inside each plugin.
34
34
  this._usingOldFetchPlugin = false;
35
35
  this.delay = 0;
36
36
  this.projectKey = projectKey;
package/lib/index.js CHANGED
@@ -135,7 +135,7 @@ export default class API {
135
135
  // no-cors issue only with text/plain or not-set Content-Type
136
136
  // req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
137
137
  req.send(JSON.stringify({
138
- trackerVersion: '5.0.0',
138
+ trackerVersion: '5.0.1-beta.1',
139
139
  projectKey: options.projectKey,
140
140
  doNotTrack,
141
141
  // TODO: add precise reason (an exact API missing)
@@ -64,7 +64,7 @@ export default function (app, opts) {
64
64
  const options = Object.assign({
65
65
  obscureInputNumbers: true,
66
66
  obscureInputEmails: true,
67
- defaultInputMode: 0 /* InputMode.Plain */,
67
+ defaultInputMode: 1 /* InputMode.Obscured */,
68
68
  obscureInputDates: false,
69
69
  }, opts);
70
70
  function sendInputTarget(id, node) {
@@ -2,25 +2,15 @@ import { hasTag, isSVGElement, isDocument } from '../app/guards.js';
2
2
  import { normSpaces, hasOpenreplayAttribute, getLabelAttribute } from '../utils.js';
3
3
  import { MouseMove, MouseClick } from '../app/messages.gen.js';
4
4
  import { getInputLabel } from './input.js';
5
+ import { finder } from '@medv/finder';
5
6
  function _getSelector(target, document) {
6
- let el = target;
7
- let selector = null;
8
- do {
9
- if (el.id) {
10
- return `#${el.id}` + (selector ? ` > ${selector}` : '');
11
- }
12
- selector =
13
- el.className
14
- .split(' ')
15
- .map((cn) => cn.trim())
16
- .filter((cn) => cn !== '')
17
- .reduce((sel, cn) => `${sel}.${cn}`, el.tagName.toLowerCase()) +
18
- (selector ? ` > ${selector}` : '');
19
- if (el === document.body) {
20
- return selector;
21
- }
22
- el = el.parentElement;
23
- } while (el !== document.body && el !== null);
7
+ const selector = finder(target, {
8
+ root: document.body,
9
+ seedMinLength: 3,
10
+ optimizedMinLength: 2,
11
+ threshold: 1000,
12
+ maxNumberOfTries: 10000,
13
+ });
24
14
  return selector;
25
15
  }
26
16
  function isClickable(element) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@openreplay/tracker",
3
3
  "description": "The OpenReplay tracker main package",
4
- "version": "5.0.0",
4
+ "version": "5.0.1-beta.1",
5
5
  "keywords": [
6
6
  "logging",
7
7
  "replay"
@@ -47,6 +47,7 @@
47
47
  "typescript": "^4.9.4"
48
48
  },
49
49
  "dependencies": {
50
+ "@medv/finder": "^3.0.0",
50
51
  "error-stack-parser": "^2.0.6"
51
52
  },
52
53
  "engines": {