@cloudcare/browser-rum 3.3.10 → 3.3.11
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/bundle/dataflux-rum.js +1 -1
- package/cjs/boot/buildEnv.js +1 -1
- package/cjs/domain/deflate/deflateWorker.js +1 -1
- package/cjs/domain/replay/record/canvasEncodeWorker.js +1 -1
- package/cjs/domain/rumEventsCollection/actions/getActionNameFromElement.js +10 -8
- package/cjs/domain/rumEventsCollection/actions/getActionNameFromElement.js.map +1 -1
- package/cjs/domain/rumEventsCollection/actions/trackClickActions.js +4 -2
- package/cjs/domain/rumEventsCollection/actions/trackClickActions.js.map +1 -1
- package/esm/boot/buildEnv.js +1 -1
- package/esm/domain/deflate/deflateWorker.js +1 -1
- package/esm/domain/replay/record/canvasEncodeWorker.js +1 -1
- package/esm/domain/rumEventsCollection/actions/getActionNameFromElement.js +10 -8
- package/esm/domain/rumEventsCollection/actions/getActionNameFromElement.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/trackClickActions.js +5 -3
- package/esm/domain/rumEventsCollection/actions/trackClickActions.js.map +1 -1
- package/package.json +2 -2
- package/src/domain/rumEventsCollection/actions/getActionNameFromElement.js +34 -19
- package/src/domain/rumEventsCollection/actions/trackClickActions.js +10 -3
|
@@ -11,13 +11,31 @@ import {
|
|
|
11
11
|
export var DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE =
|
|
12
12
|
'data-guance-action-name'
|
|
13
13
|
|
|
14
|
-
export function getActionNameFromElement(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
export function getActionNameFromElement(
|
|
15
|
+
element,
|
|
16
|
+
userProgrammaticAttribute,
|
|
17
|
+
shouldIgnoreTextualFallback
|
|
18
|
+
) {
|
|
19
|
+
return (
|
|
20
|
+
getExplicitActionName(element, userProgrammaticAttribute) ||
|
|
21
|
+
getActionNameFromElementForStrategies(
|
|
22
|
+
element,
|
|
23
|
+
userProgrammaticAttribute,
|
|
24
|
+
shouldIgnoreTextualFallback
|
|
25
|
+
? shadowDomPriorityStrategies
|
|
26
|
+
: priorityStrategies
|
|
27
|
+
) ||
|
|
28
|
+
(!shouldIgnoreTextualFallback &&
|
|
29
|
+
getActionNameFromElementForStrategies(
|
|
30
|
+
element,
|
|
31
|
+
userProgrammaticAttribute,
|
|
32
|
+
fallbackStrategies
|
|
33
|
+
)) ||
|
|
34
|
+
''
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function getExplicitActionName(element, userProgrammaticAttribute) {
|
|
21
39
|
return (
|
|
22
40
|
getActionNameFromElementProgrammatically(
|
|
23
41
|
element,
|
|
@@ -27,18 +45,7 @@ export function getActionNameFromElement(element, userProgrammaticAttribute) {
|
|
|
27
45
|
getActionNameFromElementProgrammatically(
|
|
28
46
|
element,
|
|
29
47
|
userProgrammaticAttribute
|
|
30
|
-
))
|
|
31
|
-
getActionNameFromElementForStrategies(
|
|
32
|
-
element,
|
|
33
|
-
userProgrammaticAttribute,
|
|
34
|
-
priorityStrategies
|
|
35
|
-
) ||
|
|
36
|
-
getActionNameFromElementForStrategies(
|
|
37
|
-
element,
|
|
38
|
-
userProgrammaticAttribute,
|
|
39
|
-
fallbackStrategies
|
|
40
|
-
) ||
|
|
41
|
-
''
|
|
48
|
+
))
|
|
42
49
|
)
|
|
43
50
|
}
|
|
44
51
|
|
|
@@ -143,6 +150,14 @@ var priorityStrategies = [
|
|
|
143
150
|
}
|
|
144
151
|
]
|
|
145
152
|
|
|
153
|
+
var shadowDomPriorityStrategies = priorityStrategies.concat([
|
|
154
|
+
function (element, userProgrammaticAttribute) {
|
|
155
|
+
if (element.nodeName === 'A' && element.hasAttribute('href')) {
|
|
156
|
+
return getTextualContent(element, userProgrammaticAttribute)
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
])
|
|
160
|
+
|
|
146
161
|
var fallbackStrategies = [
|
|
147
162
|
function (element, userProgrammaticAttribute) {
|
|
148
163
|
return getTextualContent(element, userProgrammaticAttribute)
|
|
@@ -16,7 +16,8 @@ import {
|
|
|
16
16
|
isNullUndefinedDefaultValue,
|
|
17
17
|
isArray,
|
|
18
18
|
includes,
|
|
19
|
-
isNodeShadowHost
|
|
19
|
+
isNodeShadowHost,
|
|
20
|
+
isElementNode
|
|
20
21
|
} from '@cloudcare/browser-core'
|
|
21
22
|
import { trackEventCounts } from '../../trackEventCounts'
|
|
22
23
|
import {
|
|
@@ -231,7 +232,11 @@ function computeClickActionBase(event, actionNameAttribute) {
|
|
|
231
232
|
x: Math.round(event.clientX - rect.left),
|
|
232
233
|
y: Math.round(event.clientY - rect.top)
|
|
233
234
|
},
|
|
234
|
-
name: getActionNameFromElement(
|
|
235
|
+
name: getActionNameFromElement(
|
|
236
|
+
target,
|
|
237
|
+
actionNameAttribute,
|
|
238
|
+
target !== event.target
|
|
239
|
+
)
|
|
235
240
|
}
|
|
236
241
|
}
|
|
237
242
|
|
|
@@ -242,7 +247,9 @@ function getEventTarget(event) {
|
|
|
242
247
|
typeof event.composedPath === 'function'
|
|
243
248
|
) {
|
|
244
249
|
var composedPath = event.composedPath()
|
|
245
|
-
|
|
250
|
+
// Wujie renders iframe-created elements in a shadow root. Use a node type check because those
|
|
251
|
+
// elements do not pass an instanceof Element check against the parent window constructor.
|
|
252
|
+
if (composedPath.length > 0 && isElementNode(composedPath[0])) {
|
|
246
253
|
return composedPath[0]
|
|
247
254
|
}
|
|
248
255
|
}
|