@openreplay/tracker 4.0.0 → 4.1.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.
Files changed (64) hide show
  1. package/cjs/app/guards.d.ts +1 -0
  2. package/cjs/app/guards.js +6 -1
  3. package/cjs/app/index.d.ts +1 -1
  4. package/cjs/app/index.js +15 -9
  5. package/cjs/app/messages.gen.d.ts +1 -0
  6. package/cjs/app/messages.gen.js +10 -1
  7. package/cjs/app/nodes.d.ts +1 -1
  8. package/cjs/app/nodes.js +3 -5
  9. package/cjs/app/observer/iframe_observer.js +1 -0
  10. package/cjs/app/observer/iframe_offsets.d.ts +8 -0
  11. package/cjs/app/observer/iframe_offsets.js +59 -0
  12. package/cjs/app/observer/observer.js +4 -4
  13. package/cjs/app/observer/top_observer.d.ts +2 -4
  14. package/cjs/app/observer/top_observer.js +11 -21
  15. package/cjs/app/sanitizer.d.ts +10 -4
  16. package/cjs/app/sanitizer.js +33 -15
  17. package/cjs/app/session.js +1 -1
  18. package/cjs/common/messages.gen.d.ts +8 -2
  19. package/cjs/common/messages.gen.js +1 -0
  20. package/cjs/index.d.ts +1 -0
  21. package/cjs/index.js +7 -7
  22. package/cjs/modules/constructedStyleSheets.d.ts +4 -0
  23. package/cjs/modules/{adoptedStyleSheets.js → constructedStyleSheets.js} +21 -20
  24. package/cjs/modules/cssrules.js +65 -18
  25. package/cjs/modules/img.js +27 -19
  26. package/cjs/modules/input.js +2 -2
  27. package/cjs/modules/mouse.js +11 -7
  28. package/cjs/modules/scroll.js +32 -12
  29. package/cjs/utils.d.ts +5 -3
  30. package/cjs/utils.js +18 -13
  31. package/lib/app/guards.d.ts +1 -0
  32. package/lib/app/guards.js +4 -0
  33. package/lib/app/index.d.ts +1 -1
  34. package/lib/app/index.js +15 -9
  35. package/lib/app/messages.gen.d.ts +1 -0
  36. package/lib/app/messages.gen.js +8 -0
  37. package/lib/app/nodes.d.ts +1 -1
  38. package/lib/app/nodes.js +3 -5
  39. package/lib/app/observer/iframe_observer.js +1 -0
  40. package/lib/app/observer/iframe_offsets.d.ts +8 -0
  41. package/lib/app/observer/iframe_offsets.js +56 -0
  42. package/lib/app/observer/observer.js +4 -4
  43. package/lib/app/observer/top_observer.d.ts +2 -4
  44. package/lib/app/observer/top_observer.js +11 -21
  45. package/lib/app/sanitizer.d.ts +10 -4
  46. package/lib/app/sanitizer.js +32 -15
  47. package/lib/app/session.js +1 -1
  48. package/lib/common/messages.gen.d.ts +8 -2
  49. package/lib/common/messages.gen.js +1 -0
  50. package/lib/common/tsconfig.tsbuildinfo +1 -1
  51. package/lib/index.d.ts +1 -0
  52. package/lib/index.js +5 -6
  53. package/lib/modules/constructedStyleSheets.d.ts +4 -0
  54. package/lib/modules/{adoptedStyleSheets.js → constructedStyleSheets.js} +20 -21
  55. package/lib/modules/cssrules.js +67 -19
  56. package/lib/modules/img.js +28 -20
  57. package/lib/modules/input.js +3 -3
  58. package/lib/modules/mouse.js +11 -7
  59. package/lib/modules/scroll.js +33 -13
  60. package/lib/utils.d.ts +5 -3
  61. package/lib/utils.js +17 -11
  62. package/package.json +1 -1
  63. package/cjs/modules/adoptedStyleSheets.d.ts +0 -2
  64. package/lib/modules/adoptedStyleSheets.d.ts +0 -2
package/lib/utils.js CHANGED
@@ -1,6 +1,12 @@
1
- export function timestamp() {
2
- return Math.round(performance.now()) + performance.timing.navigationStart;
3
- }
1
+ const DEPRECATED_ATTRS = { htmlmasked: 'hidden', masked: 'obscured' };
2
+ export const IN_BROWSER = !(typeof window === 'undefined');
3
+ export const IS_FIREFOX = IN_BROWSER && navigator.userAgent.match(/firefox|fxios/i);
4
+ export const MAX_STR_LEN = 1e5;
5
+ const navigationStart = (IN_BROWSER && performance.timing.navigationStart) || performance.timeOrigin;
6
+ // performance.now() is buggy in some browsers
7
+ export const timestamp = IN_BROWSER && performance.now() && navigationStart
8
+ ? () => Math.round(performance.now() + navigationStart)
9
+ : () => Date.now();
4
10
  export const stars = 'repeat' in String.prototype
5
11
  ? (str) => '*'.repeat(str.length)
6
12
  : (str) => str.replace(/./g, '*');
@@ -11,7 +17,6 @@ export function normSpaces(str) {
11
17
  export function isURL(s) {
12
18
  return s.startsWith('https://') || s.startsWith('http://');
13
19
  }
14
- export const IN_BROWSER = !(typeof window === 'undefined');
15
20
  // TODO: JOIN IT WITH LOGGER somehow (use logging decorators?); Don't forget about index.js loggin when there is no logger instance.
16
21
  export const DOCS_HOST = 'https://docs.openreplay.com';
17
22
  const warnedFeatures = {};
@@ -33,14 +38,15 @@ export function getLabelAttribute(e) {
33
38
  }
34
39
  return value;
35
40
  }
36
- export function hasOpenreplayAttribute(e, name) {
37
- const newName = `data-openreplay-${name}`;
41
+ export function hasOpenreplayAttribute(e, attr) {
42
+ const newName = `data-openreplay-${attr}`;
38
43
  if (e.hasAttribute(newName)) {
39
- return true;
40
- }
41
- const oldName = `data-asayer-${name}`;
42
- if (e.hasAttribute(oldName)) {
43
- deprecationWarn(`"${oldName}" attribute`, `"${newName}" attribute`, '/installation/sanitize-data');
44
+ // @ts-ignore
45
+ if (DEPRECATED_ATTRS[attr]) {
46
+ deprecationWarn(`"${newName}" attribute`,
47
+ // @ts-ignore
48
+ `"${DEPRECATED_ATTRS[attr]}" attribute`, '/installation/sanitize-data');
49
+ }
44
50
  return true;
45
51
  }
46
52
  return false;
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": "4.0.0",
4
+ "version": "4.1.0",
5
5
  "keywords": [
6
6
  "logging",
7
7
  "replay"
@@ -1,2 +0,0 @@
1
- import type App from '../app/index.js';
2
- export default function (app: App | null): void;
@@ -1,2 +0,0 @@
1
- import type App from '../app/index.js';
2
- export default function (app: App | null): void;