@openreplay/tracker 14.0.10-beta.2 → 14.0.10

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 (273) hide show
  1. package/{cjs → dist/cjs}/index.js +27 -49
  2. package/dist/cjs/index.js.map +1 -0
  3. package/{cjs → dist/cjs/main}/app/index.d.ts +17 -5
  4. package/{lib → dist/cjs/main}/app/messages.gen.d.ts +2 -2
  5. package/{lib/app/nodes.d.ts → dist/cjs/main/app/nodes/index.d.ts} +14 -7
  6. package/dist/cjs/main/app/nodes/maintainer.d.ts +28 -0
  7. package/{lib → dist/cjs/main}/app/observer/iframe_offsets.d.ts +1 -1
  8. package/{lib → dist/cjs/main}/app/observer/observer.d.ts +3 -1
  9. package/{lib → dist/cjs/main}/app/observer/top_observer.d.ts +5 -1
  10. package/{cjs → dist/cjs/main}/app/sanitizer.d.ts +5 -2
  11. package/{cjs → dist/cjs/main}/app/session.d.ts +6 -3
  12. package/{cjs → dist/cjs/main}/index.d.ts +2 -2
  13. package/{cjs → dist/cjs/main}/modules/attributeSender.d.ts +5 -2
  14. package/{cjs → dist/cjs/main}/modules/conditionsManager.d.ts +1 -1
  15. package/{cjs → dist/cjs/main}/modules/tagWatcher.d.ts +8 -4
  16. package/{lib → dist/cjs/main}/modules/userTesting/SignalManager.d.ts +2 -2
  17. package/{lib → dist/cjs/main}/utils.d.ts +4 -3
  18. package/dist/lib/index.js +9323 -0
  19. package/dist/lib/index.js.map +1 -0
  20. package/{lib → dist/lib/main}/app/index.d.ts +17 -5
  21. package/{cjs → dist/lib/main}/app/messages.gen.d.ts +2 -2
  22. package/{cjs/app/nodes.d.ts → dist/lib/main/app/nodes/index.d.ts} +14 -7
  23. package/dist/lib/main/app/nodes/maintainer.d.ts +28 -0
  24. package/{cjs → dist/lib/main}/app/observer/iframe_offsets.d.ts +1 -1
  25. package/{cjs → dist/lib/main}/app/observer/observer.d.ts +3 -1
  26. package/{cjs → dist/lib/main}/app/observer/top_observer.d.ts +5 -1
  27. package/{lib → dist/lib/main}/app/sanitizer.d.ts +5 -2
  28. package/{lib → dist/lib/main}/app/session.d.ts +6 -3
  29. package/{lib → dist/lib/main}/index.d.ts +2 -2
  30. package/{lib → dist/lib/main}/modules/attributeSender.d.ts +5 -2
  31. package/{lib → dist/lib/main}/modules/conditionsManager.d.ts +1 -1
  32. package/{lib → dist/lib/main}/modules/tagWatcher.d.ts +8 -4
  33. package/{cjs → dist/lib/main}/modules/userTesting/SignalManager.d.ts +2 -2
  34. package/{cjs → dist/lib/main}/utils.d.ts +4 -3
  35. package/package.json +29 -10
  36. package/.eslintignore +0 -11
  37. package/.nvmrc +0 -1
  38. package/.prettierignore +0 -1
  39. package/CHANGELOG.md +0 -297
  40. package/bun.lockb +0 -0
  41. package/cjs/app/canvas.js +0 -204
  42. package/cjs/app/guards.js +0 -37
  43. package/cjs/app/index.js +0 -1397
  44. package/cjs/app/logger.js +0 -37
  45. package/cjs/app/messages.gen.js +0 -702
  46. package/cjs/app/nodes.js +0 -111
  47. package/cjs/app/observer/iframe_observer.js +0 -35
  48. package/cjs/app/observer/iframe_offsets.js +0 -56
  49. package/cjs/app/observer/observer.js +0 -383
  50. package/cjs/app/observer/shadow_root_observer.js +0 -24
  51. package/cjs/app/observer/top_observer.js +0 -134
  52. package/cjs/app/sanitizer.js +0 -82
  53. package/cjs/app/session.js +0 -140
  54. package/cjs/app/ticker.js +0 -48
  55. package/cjs/common/interaction.js +0 -2
  56. package/cjs/common/messages.gen.js +0 -4
  57. package/cjs/modules/attributeSender.js +0 -51
  58. package/cjs/modules/axiosSpy.js +0 -122
  59. package/cjs/modules/conditionsManager.js +0 -343
  60. package/cjs/modules/connection.js +0 -15
  61. package/cjs/modules/console.js +0 -127
  62. package/cjs/modules/constructedStyleSheets.js +0 -138
  63. package/cjs/modules/cssrules.js +0 -99
  64. package/cjs/modules/exception.js +0 -85
  65. package/cjs/modules/featureFlags.js +0 -89
  66. package/cjs/modules/focus.js +0 -45
  67. package/cjs/modules/fonts.js +0 -57
  68. package/cjs/modules/img.js +0 -110
  69. package/cjs/modules/input.js +0 -203
  70. package/cjs/modules/mouse.js +0 -195
  71. package/cjs/modules/network.js +0 -244
  72. package/cjs/modules/performance.js +0 -53
  73. package/cjs/modules/scroll.js +0 -84
  74. package/cjs/modules/selection.js +0 -37
  75. package/cjs/modules/tabs.js +0 -13
  76. package/cjs/modules/tagWatcher.js +0 -76
  77. package/cjs/modules/timing.js +0 -173
  78. package/cjs/modules/userTesting/SignalManager.js +0 -83
  79. package/cjs/modules/userTesting/dnd.js +0 -40
  80. package/cjs/modules/userTesting/index.js +0 -464
  81. package/cjs/modules/userTesting/recorder.js +0 -101
  82. package/cjs/modules/userTesting/styles.js +0 -266
  83. package/cjs/modules/userTesting/utils.js +0 -87
  84. package/cjs/modules/viewport.js +0 -43
  85. package/cjs/package.json +0 -1
  86. package/cjs/utils.js +0 -249
  87. package/coverage/clover.xml +0 -4304
  88. package/coverage/coverage-final.json +0 -55
  89. package/coverage/lcov-report/base.css +0 -224
  90. package/coverage/lcov-report/block-navigation.js +0 -87
  91. package/coverage/lcov-report/favicon.png +0 -0
  92. package/coverage/lcov-report/index.html +0 -206
  93. package/coverage/lcov-report/main/app/canvas.ts.html +0 -712
  94. package/coverage/lcov-report/main/app/guards.ts.html +0 -232
  95. package/coverage/lcov-report/main/app/index.html +0 -236
  96. package/coverage/lcov-report/main/app/index.ts.html +0 -3955
  97. package/coverage/lcov-report/main/app/logger.ts.html +0 -211
  98. package/coverage/lcov-report/main/app/messages.gen.ts.html +0 -3034
  99. package/coverage/lcov-report/main/app/nodes.ts.html +0 -406
  100. package/coverage/lcov-report/main/app/observer/iframe_observer.ts.html +0 -148
  101. package/coverage/lcov-report/main/app/observer/iframe_offsets.ts.html +0 -289
  102. package/coverage/lcov-report/main/app/observer/index.html +0 -161
  103. package/coverage/lcov-report/main/app/observer/shadow_root_observer.ts.html +0 -142
  104. package/coverage/lcov-report/main/app/observer/top_observer.ts.html +0 -541
  105. package/coverage/lcov-report/main/app/sanitizer.ts.html +0 -403
  106. package/coverage/lcov-report/main/app/session.ts.html +0 -622
  107. package/coverage/lcov-report/main/app/ticker.ts.html +0 -250
  108. package/coverage/lcov-report/main/index.html +0 -131
  109. package/coverage/lcov-report/main/index.ts.html +0 -1597
  110. package/coverage/lcov-report/main/modules/Network/beaconProxy.ts.html +0 -400
  111. package/coverage/lcov-report/main/modules/Network/fetchProxy.ts.html +0 -1075
  112. package/coverage/lcov-report/main/modules/Network/index.html +0 -191
  113. package/coverage/lcov-report/main/modules/Network/index.ts.html +0 -244
  114. package/coverage/lcov-report/main/modules/Network/networkMessage.ts.html +0 -400
  115. package/coverage/lcov-report/main/modules/Network/utils.ts.html +0 -709
  116. package/coverage/lcov-report/main/modules/Network/xhrProxy.ts.html +0 -877
  117. package/coverage/lcov-report/main/modules/attributeSender.ts.html +0 -241
  118. package/coverage/lcov-report/main/modules/axiosSpy.ts.html +0 -709
  119. package/coverage/lcov-report/main/modules/conditionsManager.ts.html +0 -1381
  120. package/coverage/lcov-report/main/modules/connection.ts.html +0 -160
  121. package/coverage/lcov-report/main/modules/console.ts.html +0 -541
  122. package/coverage/lcov-report/main/modules/constructedStyleSheets.ts.html +0 -571
  123. package/coverage/lcov-report/main/modules/cssrules.ts.html +0 -418
  124. package/coverage/lcov-report/main/modules/exception.ts.html +0 -385
  125. package/coverage/lcov-report/main/modules/featureFlags.ts.html +0 -415
  126. package/coverage/lcov-report/main/modules/focus.ts.html +0 -220
  127. package/coverage/lcov-report/main/modules/fonts.ts.html +0 -289
  128. package/coverage/lcov-report/main/modules/img.ts.html +0 -436
  129. package/coverage/lcov-report/main/modules/index.html +0 -431
  130. package/coverage/lcov-report/main/modules/input.ts.html +0 -826
  131. package/coverage/lcov-report/main/modules/mouse.ts.html +0 -826
  132. package/coverage/lcov-report/main/modules/network.ts.html +0 -1123
  133. package/coverage/lcov-report/main/modules/performance.ts.html +0 -367
  134. package/coverage/lcov-report/main/modules/scroll.ts.html +0 -364
  135. package/coverage/lcov-report/main/modules/selection.ts.html +0 -202
  136. package/coverage/lcov-report/main/modules/tabs.ts.html +0 -124
  137. package/coverage/lcov-report/main/modules/tagWatcher.ts.html +0 -337
  138. package/coverage/lcov-report/main/modules/timing.ts.html +0 -877
  139. package/coverage/lcov-report/main/modules/userTesting/SignalManager.ts.html +0 -370
  140. package/coverage/lcov-report/main/modules/userTesting/dnd.ts.html +0 -220
  141. package/coverage/lcov-report/main/modules/userTesting/index.html +0 -191
  142. package/coverage/lcov-report/main/modules/userTesting/index.ts.html +0 -1909
  143. package/coverage/lcov-report/main/modules/userTesting/recorder.ts.html +0 -430
  144. package/coverage/lcov-report/main/modules/userTesting/styles.ts.html +0 -937
  145. package/coverage/lcov-report/main/modules/userTesting/utils.ts.html +0 -364
  146. package/coverage/lcov-report/main/modules/viewport.ts.html +0 -250
  147. package/coverage/lcov-report/main/utils.ts.html +0 -814
  148. package/coverage/lcov-report/prettify.css +0 -1
  149. package/coverage/lcov-report/prettify.js +0 -2
  150. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  151. package/coverage/lcov-report/sorter.js +0 -196
  152. package/coverage/lcov-report/webworker/BatchWriter.ts.html +0 -499
  153. package/coverage/lcov-report/webworker/MessageEncoder.gen.ts.html +0 -1021
  154. package/coverage/lcov-report/webworker/PrimitiveEncoder.ts.html +0 -436
  155. package/coverage/lcov-report/webworker/QueueSender.ts.html +0 -547
  156. package/coverage/lcov-report/webworker/index.html +0 -176
  157. package/coverage/lcov-report/webworker/index.ts.html +0 -667
  158. package/coverage/lcov.info +0 -8425
  159. package/jest.config.js +0 -13
  160. package/lib/app/canvas.js +0 -202
  161. package/lib/app/guards.js +0 -26
  162. package/lib/app/index.js +0 -1367
  163. package/lib/app/logger.js +0 -33
  164. package/lib/app/messages.gen.js +0 -622
  165. package/lib/app/nodes.js +0 -108
  166. package/lib/app/observer/iframe_observer.js +0 -29
  167. package/lib/app/observer/iframe_offsets.js +0 -53
  168. package/lib/app/observer/observer.js +0 -380
  169. package/lib/app/observer/shadow_root_observer.js +0 -18
  170. package/lib/app/observer/top_observer.js +0 -128
  171. package/lib/app/sanitizer.js +0 -77
  172. package/lib/app/session.js +0 -137
  173. package/lib/app/ticker.js +0 -45
  174. package/lib/common/interaction.js +0 -1
  175. package/lib/common/messages.gen.js +0 -3
  176. package/lib/common/tsconfig.tsbuildinfo +0 -1
  177. package/lib/index.js +0 -423
  178. package/lib/modules/attributeSender.js +0 -46
  179. package/lib/modules/axiosSpy.js +0 -119
  180. package/lib/modules/conditionsManager.js +0 -340
  181. package/lib/modules/connection.js +0 -12
  182. package/lib/modules/console.js +0 -124
  183. package/lib/modules/constructedStyleSheets.js +0 -133
  184. package/lib/modules/cssrules.js +0 -97
  185. package/lib/modules/exception.js +0 -76
  186. package/lib/modules/featureFlags.js +0 -86
  187. package/lib/modules/focus.js +0 -42
  188. package/lib/modules/fonts.js +0 -54
  189. package/lib/modules/img.js +0 -107
  190. package/lib/modules/input.js +0 -198
  191. package/lib/modules/mouse.js +0 -192
  192. package/lib/modules/network.js +0 -238
  193. package/lib/modules/performance.js +0 -49
  194. package/lib/modules/scroll.js +0 -81
  195. package/lib/modules/selection.js +0 -35
  196. package/lib/modules/tabs.js +0 -10
  197. package/lib/modules/tagWatcher.js +0 -73
  198. package/lib/modules/timing.js +0 -170
  199. package/lib/modules/userTesting/SignalManager.js +0 -80
  200. package/lib/modules/userTesting/dnd.js +0 -37
  201. package/lib/modules/userTesting/index.js +0 -435
  202. package/lib/modules/userTesting/recorder.js +0 -97
  203. package/lib/modules/userTesting/styles.js +0 -263
  204. package/lib/modules/userTesting/utils.js +0 -79
  205. package/lib/modules/viewport.js +0 -40
  206. package/lib/utils.js +0 -230
  207. package/rollup.config.js +0 -12
  208. package/scripts/checkver.cjs +0 -7
  209. package/tsconfig-base.json +0 -16
  210. /package/{cjs → dist/cjs}/common/interaction.d.ts +0 -0
  211. /package/{cjs → dist/cjs}/common/messages.gen.d.ts +0 -0
  212. /package/{cjs → dist/cjs/main}/app/canvas.d.ts +0 -0
  213. /package/{cjs → dist/cjs/main}/app/guards.d.ts +0 -0
  214. /package/{cjs → dist/cjs/main}/app/logger.d.ts +0 -0
  215. /package/{cjs → dist/cjs/main}/app/observer/iframe_observer.d.ts +0 -0
  216. /package/{cjs → dist/cjs/main}/app/observer/shadow_root_observer.d.ts +0 -0
  217. /package/{cjs → dist/cjs/main}/app/ticker.d.ts +0 -0
  218. /package/{cjs → dist/cjs/main}/modules/axiosSpy.d.ts +0 -0
  219. /package/{cjs → dist/cjs/main}/modules/connection.d.ts +0 -0
  220. /package/{cjs → dist/cjs/main}/modules/console.d.ts +0 -0
  221. /package/{cjs → dist/cjs/main}/modules/constructedStyleSheets.d.ts +0 -0
  222. /package/{cjs → dist/cjs/main}/modules/cssrules.d.ts +0 -0
  223. /package/{cjs → dist/cjs/main}/modules/exception.d.ts +0 -0
  224. /package/{cjs → dist/cjs/main}/modules/featureFlags.d.ts +0 -0
  225. /package/{cjs → dist/cjs/main}/modules/focus.d.ts +0 -0
  226. /package/{cjs → dist/cjs/main}/modules/fonts.d.ts +0 -0
  227. /package/{cjs → dist/cjs/main}/modules/img.d.ts +0 -0
  228. /package/{cjs → dist/cjs/main}/modules/input.d.ts +0 -0
  229. /package/{cjs → dist/cjs/main}/modules/mouse.d.ts +0 -0
  230. /package/{cjs → dist/cjs/main}/modules/network.d.ts +0 -0
  231. /package/{cjs → dist/cjs/main}/modules/performance.d.ts +0 -0
  232. /package/{cjs → dist/cjs/main}/modules/scroll.d.ts +0 -0
  233. /package/{cjs → dist/cjs/main}/modules/selection.d.ts +0 -0
  234. /package/{cjs → dist/cjs/main}/modules/tabs.d.ts +0 -0
  235. /package/{cjs → dist/cjs/main}/modules/timing.d.ts +0 -0
  236. /package/{cjs → dist/cjs/main}/modules/userTesting/dnd.d.ts +0 -0
  237. /package/{cjs → dist/cjs/main}/modules/userTesting/index.d.ts +0 -0
  238. /package/{cjs → dist/cjs/main}/modules/userTesting/recorder.d.ts +0 -0
  239. /package/{cjs → dist/cjs/main}/modules/userTesting/styles.d.ts +0 -0
  240. /package/{cjs → dist/cjs/main}/modules/userTesting/utils.d.ts +0 -0
  241. /package/{cjs → dist/cjs/main}/modules/viewport.d.ts +0 -0
  242. /package/{lib → dist/lib}/common/interaction.d.ts +0 -0
  243. /package/{lib → dist/lib}/common/messages.gen.d.ts +0 -0
  244. /package/{lib → dist/lib/main}/app/canvas.d.ts +0 -0
  245. /package/{lib → dist/lib/main}/app/guards.d.ts +0 -0
  246. /package/{lib → dist/lib/main}/app/logger.d.ts +0 -0
  247. /package/{lib → dist/lib/main}/app/observer/iframe_observer.d.ts +0 -0
  248. /package/{lib → dist/lib/main}/app/observer/shadow_root_observer.d.ts +0 -0
  249. /package/{lib → dist/lib/main}/app/ticker.d.ts +0 -0
  250. /package/{lib → dist/lib/main}/modules/axiosSpy.d.ts +0 -0
  251. /package/{lib → dist/lib/main}/modules/connection.d.ts +0 -0
  252. /package/{lib → dist/lib/main}/modules/console.d.ts +0 -0
  253. /package/{lib → dist/lib/main}/modules/constructedStyleSheets.d.ts +0 -0
  254. /package/{lib → dist/lib/main}/modules/cssrules.d.ts +0 -0
  255. /package/{lib → dist/lib/main}/modules/exception.d.ts +0 -0
  256. /package/{lib → dist/lib/main}/modules/featureFlags.d.ts +0 -0
  257. /package/{lib → dist/lib/main}/modules/focus.d.ts +0 -0
  258. /package/{lib → dist/lib/main}/modules/fonts.d.ts +0 -0
  259. /package/{lib → dist/lib/main}/modules/img.d.ts +0 -0
  260. /package/{lib → dist/lib/main}/modules/input.d.ts +0 -0
  261. /package/{lib → dist/lib/main}/modules/mouse.d.ts +0 -0
  262. /package/{lib → dist/lib/main}/modules/network.d.ts +0 -0
  263. /package/{lib → dist/lib/main}/modules/performance.d.ts +0 -0
  264. /package/{lib → dist/lib/main}/modules/scroll.d.ts +0 -0
  265. /package/{lib → dist/lib/main}/modules/selection.d.ts +0 -0
  266. /package/{lib → dist/lib/main}/modules/tabs.d.ts +0 -0
  267. /package/{lib → dist/lib/main}/modules/timing.d.ts +0 -0
  268. /package/{lib → dist/lib/main}/modules/userTesting/dnd.d.ts +0 -0
  269. /package/{lib → dist/lib/main}/modules/userTesting/index.d.ts +0 -0
  270. /package/{lib → dist/lib/main}/modules/userTesting/recorder.d.ts +0 -0
  271. /package/{lib → dist/lib/main}/modules/userTesting/styles.d.ts +0 -0
  272. /package/{lib → dist/lib/main}/modules/userTesting/utils.d.ts +0 -0
  273. /package/{lib → dist/lib/main}/modules/viewport.d.ts +0 -0
@@ -1,99 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const messages_gen_js_1 = require("../app/messages.gen.js");
4
- const guards_js_1 = require("../app/guards.js");
5
- const constructedStyleSheets_js_1 = require("./constructedStyleSheets.js");
6
- function default_1(app) {
7
- if (app === null) {
8
- return;
9
- }
10
- if (!window.CSSStyleSheet) {
11
- app.send((0, messages_gen_js_1.TechnicalInfo)('no_stylesheet_prototype_in_window', ''));
12
- return;
13
- }
14
- const sendInsertDeleteRule = app.safe((sheet, index, rule) => {
15
- const sheetID = constructedStyleSheets_js_1.styleSheetIDMap.get(sheet);
16
- if (!sheetID) {
17
- // OK-case. Sheet haven't been registered yet. Rules will be sent on registration.
18
- return;
19
- }
20
- if (typeof rule === 'string') {
21
- app.send((0, messages_gen_js_1.AdoptedSSInsertRuleURLBased)(sheetID, rule, index, app.getBaseHref()));
22
- }
23
- else {
24
- app.send((0, messages_gen_js_1.AdoptedSSDeleteRule)(sheetID, index));
25
- }
26
- });
27
- // TODO: proper rule insertion/removal (how?)
28
- const sendReplaceGroupingRule = app.safe((rule) => {
29
- let topmostRule = rule;
30
- while (topmostRule.parentRule) {
31
- topmostRule = topmostRule.parentRule;
32
- }
33
- const sheet = topmostRule.parentStyleSheet;
34
- if (!sheet) {
35
- app.debug.warn('No parent StyleSheet found for', topmostRule, rule);
36
- return;
37
- }
38
- const sheetID = constructedStyleSheets_js_1.styleSheetIDMap.get(sheet);
39
- if (!sheetID) {
40
- app.debug.warn('No sheedID found for', sheet, constructedStyleSheets_js_1.styleSheetIDMap);
41
- return;
42
- }
43
- const cssText = topmostRule.cssText;
44
- const ruleList = sheet.cssRules;
45
- const idx = Array.from(ruleList).indexOf(topmostRule);
46
- if (idx >= 0) {
47
- app.send((0, messages_gen_js_1.AdoptedSSInsertRuleURLBased)(sheetID, cssText, idx, app.getBaseHref()));
48
- app.send((0, messages_gen_js_1.AdoptedSSDeleteRule)(sheetID, idx + 1)); // Remove previous clone
49
- }
50
- else {
51
- app.debug.warn('Rule index not found in', sheet, topmostRule);
52
- }
53
- });
54
- const patchContext = app.safe((context) => {
55
- const { insertRule, deleteRule } = context.CSSStyleSheet.prototype;
56
- const { insertRule: groupInsertRule, deleteRule: groupDeleteRule } = context.CSSGroupingRule.prototype;
57
- context.CSSStyleSheet.prototype.insertRule = function (rule, index = 0) {
58
- sendInsertDeleteRule(this, index, rule);
59
- return insertRule.call(this, rule, index);
60
- };
61
- context.CSSStyleSheet.prototype.deleteRule = function (index) {
62
- sendInsertDeleteRule(this, index);
63
- return deleteRule.call(this, index);
64
- };
65
- context.CSSGroupingRule.prototype.insertRule = function (rule, index = 0) {
66
- const result = groupInsertRule.call(this, rule, index);
67
- sendReplaceGroupingRule(this);
68
- return result;
69
- };
70
- context.CSSGroupingRule.prototype.deleteRule = function (index = 0) {
71
- const result = groupDeleteRule.call(this, index);
72
- sendReplaceGroupingRule(this);
73
- return result;
74
- };
75
- });
76
- patchContext(window);
77
- app.observer.attachContextCallback(patchContext);
78
- app.nodes.attachNodeCallback((node) => {
79
- if (!(0, guards_js_1.hasTag)(node, 'style') || !node.sheet) {
80
- return;
81
- }
82
- if (node.textContent !== null && node.textContent.trim().length > 0) {
83
- return; // Non-virtual styles captured by the observer as a text
84
- }
85
- const nodeID = app.nodes.getID(node);
86
- if (!nodeID) {
87
- return;
88
- }
89
- const sheet = node.sheet;
90
- const sheetID = (0, constructedStyleSheets_js_1.nextID)();
91
- constructedStyleSheets_js_1.styleSheetIDMap.set(sheet, sheetID);
92
- app.send((0, messages_gen_js_1.AdoptedSSAddOwner)(sheetID, nodeID));
93
- const rules = sheet.cssRules;
94
- for (let i = 0; i < rules.length; i++) {
95
- sendInsertDeleteRule(sheet, i, rules[i].cssText);
96
- }
97
- });
98
- }
99
- exports.default = default_1;
@@ -1,85 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getExceptionMessageFromEvent = exports.getExceptionMessage = void 0;
7
- const messages_gen_js_1 = require("../app/messages.gen.js");
8
- const error_stack_parser_1 = __importDefault(require("error-stack-parser"));
9
- function getDefaultStack(e) {
10
- return [
11
- {
12
- columnNumber: e.colno,
13
- lineNumber: e.lineno,
14
- fileName: e.filename,
15
- functionName: '',
16
- source: '',
17
- },
18
- ];
19
- }
20
- function getExceptionMessage(error, fallbackStack, metadata = {}) {
21
- let stack = fallbackStack;
22
- try {
23
- stack = error_stack_parser_1.default.parse(error);
24
- }
25
- catch (e) { }
26
- return (0, messages_gen_js_1.JSException)(error.name, error.message, JSON.stringify(stack), JSON.stringify(metadata));
27
- }
28
- exports.getExceptionMessage = getExceptionMessage;
29
- function getExceptionMessageFromEvent(e, context = window, metadata = {}) {
30
- if (e instanceof ErrorEvent) {
31
- if (e.error instanceof Error) {
32
- return getExceptionMessage(e.error, getDefaultStack(e), metadata);
33
- }
34
- else {
35
- let [name, message] = e.message.split(':');
36
- if (!message) {
37
- name = 'Error';
38
- message = e.message;
39
- }
40
- return (0, messages_gen_js_1.JSException)(name, message, JSON.stringify(getDefaultStack(e)), JSON.stringify(metadata));
41
- }
42
- }
43
- else if ('PromiseRejectionEvent' in context && e instanceof context.PromiseRejectionEvent) {
44
- if (e.reason instanceof Error) {
45
- return getExceptionMessage(e.reason, [], metadata);
46
- }
47
- else {
48
- let message;
49
- try {
50
- message = JSON.stringify(e.reason);
51
- }
52
- catch (_) {
53
- message = String(e.reason);
54
- }
55
- return (0, messages_gen_js_1.JSException)('Unhandled Promise Rejection', message, '[]', JSON.stringify(metadata));
56
- }
57
- }
58
- return null;
59
- }
60
- exports.getExceptionMessageFromEvent = getExceptionMessageFromEvent;
61
- function default_1(app, opts) {
62
- const options = Object.assign({
63
- captureExceptions: true,
64
- }, opts);
65
- function patchContext(context) {
66
- function handler(e) {
67
- const msg = getExceptionMessageFromEvent(e, context);
68
- if (msg != null) {
69
- app.send(msg);
70
- }
71
- }
72
- try {
73
- app.attachEventListener(context, 'unhandledrejection', handler);
74
- app.attachEventListener(context, 'error', handler);
75
- }
76
- catch (e) {
77
- console.error('Error while attaching to error proto contexts', e);
78
- }
79
- }
80
- if (options.captureExceptions) {
81
- app.observer.attachContextCallback(patchContext); // TODO: attach once-per-iframe (?)
82
- patchContext(window);
83
- }
84
- }
85
- exports.default = default_1;
@@ -1,89 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class FeatureFlags {
4
- constructor(app) {
5
- this.app = app;
6
- this.flags = [];
7
- this.storageKey = '__openreplay_flags';
8
- const persistFlags = this.app.sessionStorage.getItem(this.storageKey);
9
- if (persistFlags) {
10
- const persistFlagsStrArr = persistFlags.split(';').filter(Boolean);
11
- this.flags = persistFlagsStrArr.map((flag) => JSON.parse(flag));
12
- }
13
- }
14
- getFeatureFlag(flagName) {
15
- return this.flags.find((flag) => flag.key === flagName);
16
- }
17
- isFlagEnabled(flagName) {
18
- return this.flags.findIndex((flag) => flag.key === flagName) !== -1;
19
- }
20
- onFlagsLoad(cb) {
21
- this.onFlagsCb = cb;
22
- }
23
- async reloadFlags(token) {
24
- const persistFlagsStr = this.app.sessionStorage.getItem(this.storageKey);
25
- const persistFlags = {};
26
- if (persistFlagsStr) {
27
- const persistArray = persistFlagsStr.split(';').filter(Boolean);
28
- persistArray.forEach((flag) => {
29
- const flagObj = JSON.parse(flag);
30
- persistFlags[flagObj.key] = { key: flagObj.key, value: flagObj.value };
31
- });
32
- }
33
- const sessionInfo = this.app.session.getInfo();
34
- const userInfo = this.app.session.userInfo;
35
- const requestObject = {
36
- projectID: sessionInfo.projectID,
37
- userID: sessionInfo.userID,
38
- metadata: sessionInfo.metadata,
39
- referrer: document.referrer,
40
- os: userInfo.userOS,
41
- device: userInfo.userDevice,
42
- country: userInfo.userCountry,
43
- state: userInfo.userState,
44
- city: userInfo.userCity,
45
- browser: userInfo.userBrowser,
46
- persistFlags: persistFlags,
47
- };
48
- const authToken = token ?? this.app.session.getSessionToken();
49
- const resp = await fetch(this.app.options.ingestPoint + '/v1/web/feature-flags', {
50
- method: 'POST',
51
- headers: {
52
- 'Content-Type': 'application/json',
53
- Authorization: `Bearer ${authToken}`,
54
- },
55
- body: JSON.stringify(requestObject),
56
- });
57
- if (resp.status === 200) {
58
- const data = await resp.json();
59
- return this.handleFlags(data.flags);
60
- }
61
- }
62
- handleFlags(flags) {
63
- const persistFlags = [];
64
- flags.forEach((flag) => {
65
- if (flag.is_persist)
66
- persistFlags.push(flag);
67
- });
68
- let str = '';
69
- const uniquePersistFlags = this.diffPersist(persistFlags);
70
- uniquePersistFlags.forEach((flag) => {
71
- str += `${JSON.stringify(flag)};`;
72
- });
73
- this.app.sessionStorage.setItem(this.storageKey, str);
74
- this.flags = flags;
75
- return this.onFlagsCb?.(flags);
76
- }
77
- clearPersistFlags() {
78
- this.app.sessionStorage.removeItem(this.storageKey);
79
- }
80
- diffPersist(flags) {
81
- const persistFlags = this.app.sessionStorage.getItem(this.storageKey);
82
- if (!persistFlags)
83
- return flags;
84
- const persistFlagsStrArr = persistFlags.split(';').filter(Boolean);
85
- const persistFlagsArr = persistFlagsStrArr.map((flag) => JSON.parse(flag));
86
- return flags.filter((flag) => persistFlagsArr.findIndex((pf) => pf.key === flag.key) === -1);
87
- }
88
- }
89
- exports.default = FeatureFlags;
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const guards_js_1 = require("../app/guards.js");
4
- const messages_gen_js_1 = require("../app/messages.gen.js");
5
- function default_1(app) {
6
- function sendSetNodeFocus(n) {
7
- const id = app.nodes.getID(n);
8
- if (id !== undefined) {
9
- app.send((0, messages_gen_js_1.SetNodeFocus)(id));
10
- }
11
- }
12
- let blurred = false;
13
- app.nodes.attachNodeCallback((node) => {
14
- if (!(0, guards_js_1.hasTag)(node, 'body')) {
15
- return;
16
- }
17
- app.nodes.attachNodeListener(node, 'focus', (e) => {
18
- if (!(0, guards_js_1.isNode)(e.target)) {
19
- return;
20
- }
21
- sendSetNodeFocus(e.target);
22
- blurred = false;
23
- });
24
- app.nodes.attachNodeListener(node, 'blur', (e) => {
25
- if (e.relatedTarget === null) {
26
- blurred = true;
27
- setTimeout(() => {
28
- if (blurred) {
29
- app.send((0, messages_gen_js_1.SetNodeFocus)(-1));
30
- }
31
- }, 0);
32
- }
33
- });
34
- });
35
- app.attachStartCallback(() => {
36
- let elem = document.activeElement;
37
- while (elem && (0, guards_js_1.hasTag)(elem, 'iframe') && elem.contentDocument) {
38
- elem = elem.contentDocument.activeElement;
39
- }
40
- if (elem && elem !== elem.ownerDocument.body) {
41
- sendSetNodeFocus(elem);
42
- }
43
- }, true);
44
- }
45
- exports.default = default_1;
@@ -1,57 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const guards_js_1 = require("../app/guards.js");
4
- const messages_gen_js_1 = require("../app/messages.gen.js");
5
- function default_1(app) {
6
- if (!window.FontFace) {
7
- return;
8
- }
9
- const docFonts = new Map();
10
- const patchWindow = (wnd) => {
11
- class FontFaceInterceptor extends wnd.FontFace {
12
- constructor(...args) {
13
- //maybe do this on load(). In this case check if the document.fonts.load(...) function calls the font's load()
14
- if (typeof args[1] === 'string') {
15
- let desc = '';
16
- if (args[2]) {
17
- app.safe(() => {
18
- desc = JSON.stringify(args[2]);
19
- });
20
- }
21
- const ffData = [args[0], args[1], desc];
22
- const ffDataArr = docFonts.get(wnd.document) || [];
23
- ffDataArr.push(ffData);
24
- docFonts.set(wnd.document, ffDataArr);
25
- const parentID = wnd === window ? 0 : app.nodes.getID(wnd.document);
26
- if (parentID === undefined) {
27
- return;
28
- }
29
- if (app.active()) {
30
- app.send((0, messages_gen_js_1.LoadFontFace)(parentID, ...ffData));
31
- }
32
- }
33
- super(...args);
34
- }
35
- }
36
- wnd.FontFace = FontFaceInterceptor;
37
- };
38
- app.observer.attachContextCallback(patchWindow);
39
- patchWindow(window);
40
- app.nodes.attachNodeCallback(app.safe((node) => {
41
- if (!(0, guards_js_1.isDocument)(node)) {
42
- return;
43
- }
44
- const ffDataArr = docFonts.get(node);
45
- if (!ffDataArr) {
46
- return;
47
- }
48
- const parentID = node.defaultView === window ? 0 : app.nodes.getID(node);
49
- if (parentID === undefined) {
50
- return;
51
- }
52
- ffDataArr.forEach((ffData) => {
53
- app.send((0, messages_gen_js_1.LoadFontFace)(parentID, ...ffData));
54
- });
55
- }));
56
- }
57
- exports.default = default_1;
@@ -1,110 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const utils_js_1 = require("../utils.js");
4
- const messages_gen_js_1 = require("../app/messages.gen.js");
5
- const guards_js_1 = require("../app/guards.js");
6
- function resolveURL(url, location = document.location) {
7
- url = url.trim();
8
- if (url.startsWith('//') ||
9
- url.startsWith('http://') ||
10
- url.startsWith('https://') ||
11
- url.startsWith('data:') // any other possible value here? https://bugzilla.mozilla.org/show_bug.cgi?id=1758035
12
- ) {
13
- return url;
14
- }
15
- else if (url.startsWith('/')) {
16
- return location.origin + url;
17
- }
18
- else {
19
- return location.origin + location.pathname + url;
20
- }
21
- }
22
- // https://bugzilla.mozilla.org/show_bug.cgi?id=1607081
23
- function isSVGInFireFox(url) {
24
- return utils_js_1.IS_FIREFOX && (url.startsWith('data:image/svg+xml') || url.match(/.svg$|/i));
25
- }
26
- const PLACEHOLDER_SRC = 'https://static.openreplay.com/tracker/placeholder.jpeg';
27
- function default_1(app) {
28
- function sendPlaceholder(id, node) {
29
- app.attributeSender.sendSetAttribute(id, 'src', PLACEHOLDER_SRC);
30
- const { width, height } = node.getBoundingClientRect();
31
- if (!node.hasAttribute('width')) {
32
- app.attributeSender.sendSetAttribute(id, 'width', String(width));
33
- }
34
- if (!node.hasAttribute('height')) {
35
- app.attributeSender.sendSetAttribute(id, 'height', String(height));
36
- }
37
- }
38
- const sendSrcset = function (id, img) {
39
- const { srcset } = img;
40
- if (!srcset) {
41
- return;
42
- }
43
- const resolvedSrcset = srcset
44
- .split(srcset.match(/,\s+/) ? /,\s+/ : ',')
45
- .map((str) => resolveURL(str))
46
- .join(', ');
47
- app.attributeSender.sendSetAttribute(id, 'srcset', resolvedSrcset);
48
- };
49
- const sendSrc = function (id, img) {
50
- if (img.src.length > utils_js_1.MAX_STR_LEN) {
51
- sendPlaceholder(id, img);
52
- }
53
- app.send((0, messages_gen_js_1.SetNodeAttributeURLBased)(id, 'src', img.src, app.getBaseHref()));
54
- };
55
- const sendImgError = app.safe(function (img) {
56
- const resolvedSrc = resolveURL(img.src || ''); // Src type is null sometimes. - is it true?
57
- if ((0, utils_js_1.isURL)(resolvedSrc)) {
58
- app.send((0, messages_gen_js_1.ResourceTiming)(app.timestamp(), 0, 0, 0, 0, 0, resolvedSrc, 'img', 0, false));
59
- }
60
- });
61
- const sendImgAttrs = app.safe(function (img) {
62
- const id = app.nodes.getID(img);
63
- if (id === undefined) {
64
- return;
65
- }
66
- if (!img.complete) {
67
- return;
68
- }
69
- if (img.naturalHeight === 0 && img.naturalWidth === 0 && !isSVGInFireFox(img.src)) {
70
- sendImgError(img);
71
- }
72
- else if (app.sanitizer.isHidden(id) || app.sanitizer.isObscured(id)) {
73
- sendPlaceholder(id, img);
74
- }
75
- else {
76
- sendSrc(id, img);
77
- sendSrcset(id, img);
78
- }
79
- });
80
- const observer = (0, utils_js_1.createMutationObserver)(app.safe((mutations) => {
81
- for (const mutation of mutations) {
82
- if (mutation.type === 'attributes') {
83
- const target = mutation.target;
84
- const id = app.nodes.getID(target);
85
- if (id === undefined) {
86
- return;
87
- }
88
- if (mutation.attributeName === 'src') {
89
- sendSrc(id, target);
90
- }
91
- if (mutation.attributeName === 'srcset') {
92
- sendSrcset(id, target);
93
- }
94
- }
95
- }
96
- }), app.options.angularMode);
97
- app.attachStopCallback(() => {
98
- observer.disconnect();
99
- });
100
- app.nodes.attachNodeCallback((node) => {
101
- if (!(0, guards_js_1.hasTag)(node, 'img')) {
102
- return;
103
- }
104
- app.nodes.attachNodeListener(node, 'error', () => sendImgError(node));
105
- app.nodes.attachNodeListener(node, 'load', () => sendImgAttrs(node));
106
- sendImgAttrs(node);
107
- observer.observe(node, { attributes: true, attributeFilter: ['src', 'srcset'] });
108
- });
109
- }
110
- exports.default = default_1;
@@ -1,203 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InputMode = exports.getInputLabel = void 0;
4
- const utils_js_1 = require("../utils.js");
5
- const guards_js_1 = require("../app/guards.js");
6
- const messages_gen_js_1 = require("../app/messages.gen.js");
7
- const INPUT_TYPES = [
8
- 'text',
9
- 'password',
10
- 'email',
11
- 'search',
12
- 'number',
13
- 'range',
14
- 'date',
15
- 'tel',
16
- 'time',
17
- ];
18
- function isTextFieldElement(node) {
19
- if ((0, guards_js_1.hasTag)(node, 'textarea')) {
20
- return true;
21
- }
22
- if (!(0, guards_js_1.hasTag)(node, 'input')) {
23
- return false;
24
- }
25
- return INPUT_TYPES.includes(node.type);
26
- }
27
- function isCheckbox(node) {
28
- if (!(0, guards_js_1.hasTag)(node, 'input')) {
29
- return false;
30
- }
31
- const type = node.type;
32
- return type === 'checkbox' || type === 'radio';
33
- }
34
- const labelElementFor = utils_js_1.IN_BROWSER && 'labels' in HTMLInputElement.prototype
35
- ? (node) => {
36
- let p = node;
37
- while ((p = p.parentNode) !== null) {
38
- if ((0, guards_js_1.hasTag)(p, 'label')) {
39
- return p;
40
- }
41
- }
42
- const labels = node.labels;
43
- if (labels !== null && labels.length === 1) {
44
- return labels[0];
45
- }
46
- }
47
- : (node) => {
48
- let p = node;
49
- while ((p = p.parentNode) !== null) {
50
- if ((0, guards_js_1.hasTag)(p, 'label')) {
51
- return p;
52
- }
53
- }
54
- const id = node.id;
55
- if (id) {
56
- const labels = node.ownerDocument.querySelectorAll('label[for="' + id + '"]');
57
- if (labels !== null && labels.length === 1) {
58
- return labels[0];
59
- }
60
- }
61
- };
62
- function getInputLabel(node) {
63
- let label = (0, utils_js_1.getLabelAttribute)(node);
64
- if (label === null) {
65
- const labelElement = labelElementFor(node);
66
- label =
67
- (labelElement && labelElement.innerText) ||
68
- node.placeholder ||
69
- node.name ||
70
- node.id ||
71
- node.className ||
72
- node.type;
73
- }
74
- return (0, utils_js_1.normSpaces)(label).slice(0, 100);
75
- }
76
- exports.getInputLabel = getInputLabel;
77
- exports.InputMode = {
78
- Plain: 0,
79
- Obscured: 1,
80
- Hidden: 2,
81
- };
82
- function default_1(app, opts) {
83
- const options = Object.assign({
84
- obscureInputNumbers: true,
85
- obscureInputEmails: true,
86
- defaultInputMode: exports.InputMode.Obscured,
87
- obscureInputDates: false,
88
- }, opts);
89
- function getInputValue(id, node) {
90
- let value = node.value;
91
- let inputMode = options.defaultInputMode;
92
- if (node.type === 'password' || app.sanitizer.isHidden(id)) {
93
- inputMode = exports.InputMode.Hidden;
94
- }
95
- else if (app.sanitizer.isObscured(id) ||
96
- (inputMode === exports.InputMode.Plain &&
97
- ((options.obscureInputNumbers && node.type !== 'date' && /\d\d\d\d/.test(value)) ||
98
- (options.obscureInputDates && node.type === 'date') ||
99
- (options.obscureInputEmails && (node.type === 'email' || !!~value.indexOf('@')))))) {
100
- inputMode = exports.InputMode.Obscured;
101
- }
102
- let mask = 0;
103
- switch (inputMode) {
104
- case exports.InputMode.Hidden:
105
- mask = -1;
106
- value = '';
107
- break;
108
- case exports.InputMode.Obscured:
109
- mask = value.length;
110
- value = '';
111
- break;
112
- }
113
- return { value, mask };
114
- }
115
- function sendInputValue(id, node) {
116
- const { value, mask } = getInputValue(id, node);
117
- app.send((0, messages_gen_js_1.SetInputValue)(id, value, mask));
118
- }
119
- const inputValues = new Map();
120
- const checkboxValues = new Map();
121
- app.attachStopCallback(() => {
122
- inputValues.clear();
123
- checkboxValues.clear();
124
- });
125
- function trackInputValue(id, node) {
126
- if (inputValues.get(id) === node.value) {
127
- return;
128
- }
129
- inputValues.set(id, node.value);
130
- sendInputValue(id, node);
131
- }
132
- function trackCheckboxValue(id, value) {
133
- if (checkboxValues.get(id) === value) {
134
- return;
135
- }
136
- checkboxValues.set(id, value);
137
- app.send((0, messages_gen_js_1.SetInputChecked)(id, value));
138
- }
139
- // The only way (to our knowledge) to track all kinds of input changes, including those made by JS
140
- app.ticker.attach(() => {
141
- inputValues.forEach((value, id) => {
142
- const node = app.nodes.getNode(id);
143
- if (!node)
144
- return inputValues.delete(id);
145
- trackInputValue(id, node);
146
- });
147
- checkboxValues.forEach((checked, id) => {
148
- const node = app.nodes.getNode(id);
149
- if (!node)
150
- return checkboxValues.delete(id);
151
- trackCheckboxValue(id, node.checked);
152
- });
153
- }, 3);
154
- function sendInputChange(id, node, hesitationTime, inputTime) {
155
- const { value, mask } = getInputValue(id, node);
156
- const label = getInputLabel(node);
157
- app.send((0, messages_gen_js_1.InputChange)(id, value, mask !== 0, label, hesitationTime, inputTime));
158
- }
159
- app.nodes.attachNodeCallback(app.safe((node) => {
160
- const id = app.nodes.getID(node);
161
- if (id === undefined) {
162
- return;
163
- }
164
- // TODO: support multiple select (?): use selectedOptions;
165
- if ((0, guards_js_1.hasTag)(node, 'select')) {
166
- sendInputValue(id, node);
167
- app.nodes.attachNodeListener(node, 'change', () => sendInputValue(id, node));
168
- }
169
- if (isTextFieldElement(node)) {
170
- trackInputValue(id, node);
171
- let nodeFocusTime = 0;
172
- let nodeHesitationTime = 0;
173
- let inputTime = 0;
174
- const onFocus = () => {
175
- nodeFocusTime = (0, utils_js_1.now)();
176
- };
177
- const onInput = () => {
178
- if (nodeHesitationTime === 0 && nodeFocusTime !== 0) {
179
- nodeHesitationTime = (0, utils_js_1.now)() - nodeFocusTime;
180
- }
181
- };
182
- const onChange = () => {
183
- if (nodeFocusTime !== 0) {
184
- inputTime = (0, utils_js_1.now)() - nodeFocusTime;
185
- }
186
- sendInputChange(id, node, nodeHesitationTime, inputTime);
187
- nodeHesitationTime = 0;
188
- inputTime = 0;
189
- nodeFocusTime = 0;
190
- };
191
- app.nodes.attachNodeListener(node, 'focus', onFocus);
192
- app.nodes.attachNodeListener(node, 'input', onInput);
193
- app.nodes.attachNodeListener(node, 'change', onChange);
194
- return;
195
- }
196
- if (isCheckbox(node)) {
197
- trackCheckboxValue(id, node.checked);
198
- app.nodes.attachNodeListener(node, 'change', () => trackCheckboxValue(id, node.checked));
199
- return;
200
- }
201
- }));
202
- }
203
- exports.default = default_1;