donobu 2.31.1 → 2.32.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/apis/GptConfigsApi.d.ts.map +1 -1
- package/dist/apis/GptConfigsApi.js +2 -0
- package/dist/apis/GptConfigsApi.js.map +1 -1
- package/dist/assets/generated/version +1 -1
- package/dist/assets/interactive-elements-tracker.js +81 -60
- package/dist/assets/page-interactions-tracker.js +15 -42
- package/dist/assets/smart-selector-generator.js +839 -259
- package/dist/bindings/PageInteractionTracker.d.ts +27 -1
- package/dist/bindings/PageInteractionTracker.d.ts.map +1 -1
- package/dist/bindings/PageInteractionTracker.js +172 -61
- package/dist/bindings/PageInteractionTracker.js.map +1 -1
- package/dist/esm/apis/GptConfigsApi.d.ts.map +1 -1
- package/dist/esm/apis/GptConfigsApi.js +2 -0
- package/dist/esm/apis/GptConfigsApi.js.map +1 -1
- package/dist/esm/assets/generated/version +1 -1
- package/dist/esm/assets/interactive-elements-tracker.js +81 -60
- package/dist/esm/assets/page-interactions-tracker.js +15 -42
- package/dist/esm/assets/smart-selector-generator.js +839 -259
- package/dist/esm/bindings/PageInteractionTracker.d.ts +27 -1
- package/dist/esm/bindings/PageInteractionTracker.d.ts.map +1 -1
- package/dist/esm/bindings/PageInteractionTracker.js +172 -61
- package/dist/esm/bindings/PageInteractionTracker.js.map +1 -1
- package/dist/esm/managers/AgentsManager.d.ts +9 -0
- package/dist/esm/managers/AgentsManager.d.ts.map +1 -1
- package/dist/esm/managers/AgentsManager.js +52 -0
- package/dist/esm/managers/AgentsManager.js.map +1 -1
- package/dist/esm/managers/CodeGenerator.d.ts.map +1 -1
- package/dist/esm/managers/CodeGenerator.js +1 -0
- package/dist/esm/managers/CodeGenerator.js.map +1 -1
- package/dist/esm/managers/DonobuFlow.d.ts +1 -0
- package/dist/esm/managers/DonobuFlow.d.ts.map +1 -1
- package/dist/esm/managers/DonobuFlow.js +8 -0
- package/dist/esm/managers/DonobuFlow.js.map +1 -1
- package/dist/esm/managers/PageInspector.d.ts.map +1 -1
- package/dist/esm/managers/PageInspector.js +77 -7
- package/dist/esm/managers/PageInspector.js.map +1 -1
- package/dist/esm/models/BrowserConfig.d.ts +56 -56
- package/dist/esm/models/CreateDonobuFlow.d.ts +48 -48
- package/dist/esm/models/FlowMetadata.d.ts +54 -54
- package/dist/esm/models/InteractableElement.d.ts +4 -3
- package/dist/esm/models/InteractableElement.d.ts.map +1 -1
- package/dist/esm/models/InteractableElement.js +9 -4
- package/dist/esm/models/InteractableElement.js.map +1 -1
- package/dist/esm/persistence/DonobuSqliteDb.d.ts.map +1 -1
- package/dist/esm/persistence/DonobuSqliteDb.js +44 -0
- package/dist/esm/persistence/DonobuSqliteDb.js.map +1 -1
- package/dist/esm/tools/InputRandomizedEmailAddressTool.d.ts +6 -6
- package/dist/esm/tools/InputTextTool.d.ts +9 -0
- package/dist/esm/tools/InputTextTool.d.ts.map +1 -1
- package/dist/esm/tools/InputTextTool.js +8 -2
- package/dist/esm/tools/InputTextTool.js.map +1 -1
- package/dist/esm/tools/PressKeyTool.d.ts.map +1 -1
- package/dist/esm/tools/PressKeyTool.js +8 -3
- package/dist/esm/tools/PressKeyTool.js.map +1 -1
- package/dist/esm/tools/ReplayableInteraction.d.ts.map +1 -1
- package/dist/esm/tools/ReplayableInteraction.js +14 -7
- package/dist/esm/tools/ReplayableInteraction.js.map +1 -1
- package/dist/esm/tools/RunAccessibilityTestTool.d.ts +0 -8
- package/dist/esm/tools/RunAccessibilityTestTool.d.ts.map +1 -1
- package/dist/esm/tools/RunAccessibilityTestTool.js +20 -38
- package/dist/esm/tools/RunAccessibilityTestTool.js.map +1 -1
- package/dist/esm/tools/ScrollPageTool.d.ts +52 -11
- package/dist/esm/tools/ScrollPageTool.d.ts.map +1 -1
- package/dist/esm/tools/ScrollPageTool.js +63 -57
- package/dist/esm/tools/ScrollPageTool.js.map +1 -1
- package/dist/esm/tools/TriggerDonobuFlowTool.d.ts +116 -116
- package/dist/esm/utils/BrowserUtils.js +1 -1
- package/dist/esm/utils/BrowserUtils.js.map +1 -1
- package/dist/esm/utils/PlaywrightUtils.d.ts.map +1 -1
- package/dist/esm/utils/PlaywrightUtils.js +0 -2
- package/dist/esm/utils/PlaywrightUtils.js.map +1 -1
- package/dist/managers/AgentsManager.d.ts +9 -0
- package/dist/managers/AgentsManager.d.ts.map +1 -1
- package/dist/managers/AgentsManager.js +52 -0
- package/dist/managers/AgentsManager.js.map +1 -1
- package/dist/managers/CodeGenerator.d.ts.map +1 -1
- package/dist/managers/CodeGenerator.js +1 -0
- package/dist/managers/CodeGenerator.js.map +1 -1
- package/dist/managers/DonobuFlow.d.ts +1 -0
- package/dist/managers/DonobuFlow.d.ts.map +1 -1
- package/dist/managers/DonobuFlow.js +8 -0
- package/dist/managers/DonobuFlow.js.map +1 -1
- package/dist/managers/PageInspector.d.ts.map +1 -1
- package/dist/managers/PageInspector.js +77 -7
- package/dist/managers/PageInspector.js.map +1 -1
- package/dist/models/BrowserConfig.d.ts +56 -56
- package/dist/models/CreateDonobuFlow.d.ts +48 -48
- package/dist/models/FlowMetadata.d.ts +54 -54
- package/dist/models/InteractableElement.d.ts +4 -3
- package/dist/models/InteractableElement.d.ts.map +1 -1
- package/dist/models/InteractableElement.js +9 -4
- package/dist/models/InteractableElement.js.map +1 -1
- package/dist/persistence/DonobuSqliteDb.d.ts.map +1 -1
- package/dist/persistence/DonobuSqliteDb.js +44 -0
- package/dist/persistence/DonobuSqliteDb.js.map +1 -1
- package/dist/tools/InputRandomizedEmailAddressTool.d.ts +6 -6
- package/dist/tools/InputTextTool.d.ts +9 -0
- package/dist/tools/InputTextTool.d.ts.map +1 -1
- package/dist/tools/InputTextTool.js +8 -2
- package/dist/tools/InputTextTool.js.map +1 -1
- package/dist/tools/PressKeyTool.d.ts.map +1 -1
- package/dist/tools/PressKeyTool.js +8 -3
- package/dist/tools/PressKeyTool.js.map +1 -1
- package/dist/tools/ReplayableInteraction.d.ts.map +1 -1
- package/dist/tools/ReplayableInteraction.js +14 -7
- package/dist/tools/ReplayableInteraction.js.map +1 -1
- package/dist/tools/RunAccessibilityTestTool.d.ts +0 -8
- package/dist/tools/RunAccessibilityTestTool.d.ts.map +1 -1
- package/dist/tools/RunAccessibilityTestTool.js +20 -38
- package/dist/tools/RunAccessibilityTestTool.js.map +1 -1
- package/dist/tools/ScrollPageTool.d.ts +52 -11
- package/dist/tools/ScrollPageTool.d.ts.map +1 -1
- package/dist/tools/ScrollPageTool.js +63 -57
- package/dist/tools/ScrollPageTool.js.map +1 -1
- package/dist/tools/TriggerDonobuFlowTool.d.ts +116 -116
- package/dist/utils/BrowserUtils.js +1 -1
- package/dist/utils/BrowserUtils.js.map +1 -1
- package/dist/utils/PlaywrightUtils.d.ts.map +1 -1
- package/dist/utils/PlaywrightUtils.js +0 -2
- package/dist/utils/PlaywrightUtils.js.map +1 -1
- package/package.json +2 -1
- package/dist/assets/axe.js +0 -47397
- package/dist/esm/assets/axe.js +0 -47397
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GptConfigsApi.d.ts","sourceRoot":"","sources":["../../src/apis/GptConfigsApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,SAAS,EAAmB,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG1D;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,aAAa;IAatB,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAbhC;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAK1C;gBAGiB,iBAAiB,EAAE,iBAAiB,EACpC,aAAa,EAAE,aAAa;IAG/C;;;;;;;;;;;;;;;;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ptConfigsApi {
|
|
|
52
52
|
throw new GptConfigNotFoundException_1.GptConfigNotFoundException(name);
|
|
53
53
|
}
|
|
54
54
|
await this.gptConfigsManager.set(name, parsedBody);
|
|
55
|
+
// Trigger auto-assignment of flow-runner if no configuration is currently assigned
|
|
56
|
+
await this.agentsManager.triggerAutoAssignment();
|
|
55
57
|
res.json(GptConfigsApi.redactSensativeData(parsedBody));
|
|
56
58
|
}
|
|
57
59
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GptConfigsApi.js","sourceRoot":"","sources":["../../src/apis/GptConfigsApi.ts"],"names":[],"mappings":";;;AAEA,yFAAsF;AACtF,mDAAiE;AAEjE,4CAA4C;AAE5C;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAa,aAAa;IAYxB,YACmB,iBAAoC,EACpC,aAA4B;QAD5B,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,kBAAa,GAAb,aAAa,CAAe;IAC5C,CAAC;IAEJ;;;;;;;;;;;;;;;;;OAiBG;IACI,KAAK,CAAC,GAAG,CAAC,GAAY,EAAE,GAAa;QAC1C,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;QAC7B,MAAM,UAAU,GAAG,2BAAe,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAEnD,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,uDAA0B,CAAC,IAAI,CAAC,CAAC;QAC7C,CAAC;QAED,MAAM,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"GptConfigsApi.js","sourceRoot":"","sources":["../../src/apis/GptConfigsApi.ts"],"names":[],"mappings":";;;AAEA,yFAAsF;AACtF,mDAAiE;AAEjE,4CAA4C;AAE5C;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAa,aAAa;IAYxB,YACmB,iBAAoC,EACpC,aAA4B;Q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aAAa,CAAC,oBAAoB,EAAE,CAAC;YACnE,IAAI,iBAAiB,IAAI,UAAU,EAAE,CAAC;gBACpC,wDAAwD;gBACvD,UAAkB,CAAC,iBAAiB,CAAC,GAAG,kBAAkB,CAAC;YAC9D,CAAC;QACH,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;;AA5IH,sCA6IC;AA5IC;;;GAGG;AACqB,kCAAoB,GAAG;IAC7C,QAAQ;IACR,aAAa;IACb,KAAK;IACL,iBAAiB;CAClB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
1319
|
|
@@ -3,6 +3,38 @@
|
|
|
3
3
|
// Store all elements deemed to be interactive
|
|
4
4
|
const interactiveElements = new Set();
|
|
5
5
|
|
|
6
|
+
// ---- listener-count bookkeeping --------------------------------------
|
|
7
|
+
const listenerCounts = new WeakMap(); // el -> { type: n, … }
|
|
8
|
+
const bumpCount = (el, type, delta) => {
|
|
9
|
+
let map = listenerCounts.get(el);
|
|
10
|
+
|
|
11
|
+
if (!map) {
|
|
12
|
+
if (delta < 0) {
|
|
13
|
+
// nothing to decrement
|
|
14
|
+
return;
|
|
15
|
+
} else {
|
|
16
|
+
map = Object.create(null);
|
|
17
|
+
listenerCounts.set(el, map);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
map[type] = (map[type] || 0) + delta;
|
|
22
|
+
|
|
23
|
+
if (map[type] <= 0) {
|
|
24
|
+
delete map[type];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (Object.keys(map).length === 0) {
|
|
28
|
+
listenerCounts.delete(el);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const totalListenerCount = (el) =>
|
|
33
|
+
(listenerCounts.get(el) &&
|
|
34
|
+
Object.values(listenerCounts.get(el)).reduce((s, n) => s + n, 0)) ||
|
|
35
|
+
0;
|
|
36
|
+
// ----------------------------------------------------------------------
|
|
37
|
+
|
|
6
38
|
// Original method references for monkey patching
|
|
7
39
|
const originalAddEventListener = EventTarget.prototype.addEventListener;
|
|
8
40
|
const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
|
|
@@ -43,7 +75,7 @@
|
|
|
43
75
|
element.getAttribute('role') === 'button' ||
|
|
44
76
|
element.getAttribute('role') === 'link' ||
|
|
45
77
|
element.getAttribute('aria-haspopup') === 'true' ||
|
|
46
|
-
element.getAttribute('tabindex')
|
|
78
|
+
element.getAttribute('tabindex') >= '0' ||
|
|
47
79
|
element.getAttribute('contenteditable') === 'true'
|
|
48
80
|
);
|
|
49
81
|
} catch (error) {
|
|
@@ -112,6 +144,7 @@
|
|
|
112
144
|
EventTarget.prototype.addEventListener = function (type, listener, options) {
|
|
113
145
|
if (pointerEvents.includes(type) && this !== window && this !== document) {
|
|
114
146
|
interactiveElements.add(this);
|
|
147
|
+
bumpCount(this, type, 1);
|
|
115
148
|
|
|
116
149
|
// If this element is in shadow DOM, ensure it's accessible
|
|
117
150
|
if (isInShadowDOM(this)) {
|
|
@@ -128,15 +161,24 @@
|
|
|
128
161
|
return originalAddEventListener.call(this, type, listener, options);
|
|
129
162
|
};
|
|
130
163
|
|
|
131
|
-
//
|
|
164
|
+
// monkey-patch removeEventListener (count only, no deletion here)
|
|
132
165
|
EventTarget.prototype.removeEventListener = function (
|
|
133
166
|
type,
|
|
134
167
|
listener,
|
|
135
168
|
options,
|
|
136
169
|
) {
|
|
137
170
|
if (pointerEvents.includes(type) && this !== window && this !== document) {
|
|
138
|
-
|
|
171
|
+
bumpCount(this, type, -1);
|
|
172
|
+
|
|
173
|
+
if (
|
|
174
|
+
totalListenerCount(this) <= 0 &&
|
|
175
|
+
!hasInteractiveStyling(this) &&
|
|
176
|
+
!hasReactInteractiveProps(this)
|
|
177
|
+
) {
|
|
178
|
+
removeFromInteractiveSet(this);
|
|
179
|
+
}
|
|
139
180
|
}
|
|
181
|
+
|
|
140
182
|
return originalRemoveEventListener.call(this, type, listener, options);
|
|
141
183
|
};
|
|
142
184
|
|
|
@@ -205,6 +247,21 @@
|
|
|
205
247
|
}
|
|
206
248
|
};
|
|
207
249
|
|
|
250
|
+
const removeFromInteractiveSet = (node) => {
|
|
251
|
+
if (interactiveElements.delete(node) && node.shadowRoot) {
|
|
252
|
+
// also drop any interactive nodes inside a shadow tree
|
|
253
|
+
Array.from(node.shadowRoot.querySelectorAll('*')).forEach((el) =>
|
|
254
|
+
interactiveElements.delete(el),
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (node instanceof Element || node instanceof DocumentFragment) {
|
|
259
|
+
node
|
|
260
|
+
.querySelectorAll('*')
|
|
261
|
+
.forEach((child) => interactiveElements.delete(child));
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
|
|
208
265
|
// Initialize MutationObserver safely
|
|
209
266
|
let observer = null;
|
|
210
267
|
|
|
@@ -216,9 +273,18 @@
|
|
|
216
273
|
let shouldRescan = false;
|
|
217
274
|
|
|
218
275
|
for (const mutation of mutations) {
|
|
219
|
-
if (mutation.type === 'childList'
|
|
220
|
-
|
|
221
|
-
|
|
276
|
+
if (mutation.type === 'childList') {
|
|
277
|
+
// detached nodes
|
|
278
|
+
mutation.removedNodes.forEach(removeFromInteractiveSet);
|
|
279
|
+
if (mutation.addedNodes.length > 0) shouldRescan = true;
|
|
280
|
+
} else if (mutation.type === 'attributes') {
|
|
281
|
+
const el = mutation.target;
|
|
282
|
+
|
|
283
|
+
if (hasInteractiveStyling(el) || hasReactInteractiveProps(el)) {
|
|
284
|
+
interactiveElements.add(el);
|
|
285
|
+
} else if (totalListenerCount(el) <= 0) {
|
|
286
|
+
removeFromInteractiveSet(el);
|
|
287
|
+
}
|
|
222
288
|
}
|
|
223
289
|
}
|
|
224
290
|
|
|
@@ -227,10 +293,18 @@
|
|
|
227
293
|
}
|
|
228
294
|
});
|
|
229
295
|
|
|
230
|
-
// Start observing the document body
|
|
231
296
|
observer.observe(document.body, {
|
|
232
297
|
childList: true,
|
|
233
298
|
subtree: true,
|
|
299
|
+
attributes: true,
|
|
300
|
+
attributeFilter: [
|
|
301
|
+
'class',
|
|
302
|
+
'role',
|
|
303
|
+
'tabindex',
|
|
304
|
+
'style',
|
|
305
|
+
'aria-haspopup',
|
|
306
|
+
'data-donobu-interactable',
|
|
307
|
+
],
|
|
234
308
|
});
|
|
235
309
|
} catch (error) {
|
|
236
310
|
console.error('Error initializing MutationObserver:', error);
|
|
@@ -282,49 +356,6 @@
|
|
|
282
356
|
});
|
|
283
357
|
}
|
|
284
358
|
|
|
285
|
-
if (!window.__donobu.debugInteractiveElement) {
|
|
286
|
-
Object.defineProperty(window.__donobu, 'debugInteractiveElement', {
|
|
287
|
-
value: (element) => {
|
|
288
|
-
if (!(element instanceof Element)) {
|
|
289
|
-
return { isInteractive: false, reason: 'Not a DOM element' };
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
const reasons = [];
|
|
293
|
-
|
|
294
|
-
if (hasInteractiveStyling(element)) {
|
|
295
|
-
reasons.push('Has interactive CSS styling');
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
if (hasReactInteractiveProps(element)) {
|
|
299
|
-
reasons.push('Has React interactive props or classes');
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
// Check common interactive elements
|
|
303
|
-
if (
|
|
304
|
-
element.tagName === 'A' ||
|
|
305
|
-
element.tagName === 'BUTTON' ||
|
|
306
|
-
element.tagName === 'INPUT' ||
|
|
307
|
-
element.tagName === 'SELECT'
|
|
308
|
-
) {
|
|
309
|
-
reasons.push(`Is a ${element.tagName} element`);
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
// Check if element has an explicit event listener
|
|
313
|
-
if (interactiveElements.has(element)) {
|
|
314
|
-
reasons.push('Has registered event listener');
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
return {
|
|
318
|
-
isInteractive: reasons.length > 0,
|
|
319
|
-
reasons: reasons,
|
|
320
|
-
};
|
|
321
|
-
},
|
|
322
|
-
enumerable: false,
|
|
323
|
-
writable: false,
|
|
324
|
-
configurable: false,
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
|
|
328
359
|
// Initialize things safely after DOM content is loaded
|
|
329
360
|
const initialize = () => {
|
|
330
361
|
scanForInteractiveElements();
|
|
@@ -338,14 +369,4 @@
|
|
|
338
369
|
// DOM already ready, initialize now
|
|
339
370
|
initialize();
|
|
340
371
|
}
|
|
341
|
-
|
|
342
|
-
// Periodically scan for interactive elements (React/SPA behavior)
|
|
343
|
-
const rescanInterval = 2000; // milliseconds
|
|
344
|
-
setInterval(() => {
|
|
345
|
-
try {
|
|
346
|
-
scanForInteractiveElements();
|
|
347
|
-
} catch (error) {
|
|
348
|
-
console.error('Error during periodic scan:', error);
|
|
349
|
-
}
|
|
350
|
-
}, rescanInterval);
|
|
351
372
|
})();
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
if (!window.__donobu.
|
|
37
|
-
Object.defineProperty(window.__donobu, '
|
|
38
|
-
value:
|
|
36
|
+
if (!window.__donobu.processedEvents) {
|
|
37
|
+
Object.defineProperty(window.__donobu, 'processedEvents', {
|
|
38
|
+
value: new WeakSet(),
|
|
39
39
|
enumerable: false,
|
|
40
40
|
writable: true,
|
|
41
41
|
configurable: false,
|
|
@@ -48,24 +48,11 @@
|
|
|
48
48
|
document.addEventListener(
|
|
49
49
|
eventType,
|
|
50
50
|
function (e) {
|
|
51
|
-
|
|
52
|
-
const currentTime = new Date().getTime();
|
|
53
|
-
const debounceTimeMs = 50;
|
|
54
|
-
// Deduplicate rapid-fire identical events.
|
|
55
|
-
if (
|
|
56
|
-
window.__donobu.lastInteractionEvent &&
|
|
57
|
-
window.__donobu.lastInteractionEvent.key === eventKey &&
|
|
58
|
-
currentTime - window.__donobu.lastInteractionEvent.time <
|
|
59
|
-
debounceTimeMs
|
|
60
|
-
) {
|
|
51
|
+
if (window.__donobu.processedEvents.has(e)) {
|
|
61
52
|
return;
|
|
62
53
|
}
|
|
63
54
|
|
|
64
|
-
window.__donobu.
|
|
65
|
-
key: eventKey,
|
|
66
|
-
time: currentTime,
|
|
67
|
-
};
|
|
68
|
-
|
|
55
|
+
window.__donobu.processedEvents.add(e);
|
|
69
56
|
const eventData = {
|
|
70
57
|
type: eventType,
|
|
71
58
|
x: e.clientX,
|
|
@@ -95,6 +82,11 @@
|
|
|
95
82
|
document.addEventListener(
|
|
96
83
|
eventType,
|
|
97
84
|
function (e) {
|
|
85
|
+
if (window.__donobu.processedEvents.has(e)) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
window.__donobu.processedEvents.add(e);
|
|
98
90
|
__donobuTrackInteraction({
|
|
99
91
|
type: eventType,
|
|
100
92
|
key: e.key,
|
|
@@ -116,6 +108,11 @@
|
|
|
116
108
|
document.addEventListener(
|
|
117
109
|
eventType,
|
|
118
110
|
function (e) {
|
|
111
|
+
if (window.__donobu.processedEvents.has(e)) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
window.__donobu.processedEvents.add(e);
|
|
119
116
|
const eventData = {
|
|
120
117
|
type: eventType,
|
|
121
118
|
selectors: window.__donobu.generateSmartSelectors(e.target),
|
|
@@ -140,28 +137,4 @@
|
|
|
140
137
|
true,
|
|
141
138
|
);
|
|
142
139
|
});
|
|
143
|
-
|
|
144
|
-
// Touch events for mobile
|
|
145
|
-
['touchstart', 'touchend', 'touchmove', 'touchcancel'].forEach(
|
|
146
|
-
(eventType) => {
|
|
147
|
-
document.addEventListener(
|
|
148
|
-
eventType,
|
|
149
|
-
function (e) {
|
|
150
|
-
const touches = Array.from(e.touches).map((touch) => ({
|
|
151
|
-
x: touch.clientX,
|
|
152
|
-
y: touch.clientY,
|
|
153
|
-
identifier: touch.identifier,
|
|
154
|
-
}));
|
|
155
|
-
|
|
156
|
-
__donobuTrackInteraction({
|
|
157
|
-
type: eventType,
|
|
158
|
-
touches: touches,
|
|
159
|
-
selectors: window.__donobu.generateSmartSelectors(e.target),
|
|
160
|
-
timestamp: new Date().getTime(),
|
|
161
|
-
});
|
|
162
|
-
},
|
|
163
|
-
true,
|
|
164
|
-
);
|
|
165
|
-
},
|
|
166
|
-
);
|
|
167
140
|
})();
|