@atlaskit/react-ufo 3.4.5 → 3.4.6

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,5 +1,13 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 3.4.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#131564](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/131564)
8
+ [`e4cc2be4d7e50`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e4cc2be4d7e50) -
9
+ Fix get element name to use data vc by default unless specifically disabled
10
+
3
11
  ## 3.4.5
4
12
 
5
13
  ### Patch Changes
@@ -63,14 +63,14 @@ function getUfoNameOverride(interaction) {
63
63
  function getEarliestLegacyStopTime(interaction, labelStack) {
64
64
  var earliestLegacyStopTime = null;
65
65
  interaction.apdex.forEach(function (a) {
66
- var _a$labelStack, _earliestLegacyStopTi;
66
+ var _a$labelStack;
67
67
  if (!(a !== null && a !== void 0 && a.stopTime)) {
68
68
  return;
69
69
  }
70
70
  if (!(0, _utils.labelStackStartWith)((_a$labelStack = a.labelStack) !== null && _a$labelStack !== void 0 ? _a$labelStack : [], labelStack)) {
71
71
  return;
72
72
  }
73
- if (a.stopTime > interaction.start && ((_earliestLegacyStopTi = earliestLegacyStopTime) !== null && _earliestLegacyStopTi !== void 0 ? _earliestLegacyStopTi : a.stopTime) >= a.stopTime) {
73
+ if (a.stopTime > interaction.start && (earliestLegacyStopTime !== null && earliestLegacyStopTime !== void 0 ? earliestLegacyStopTime : a.stopTime) >= a.stopTime) {
74
74
  earliestLegacyStopTime = a.stopTime;
75
75
  }
76
76
  });
@@ -16,6 +16,9 @@ function getElementName(selectorConfig, element) {
16
16
  // Get the tag name of the element.
17
17
  var tagName = element.localName;
18
18
  var encodeValue = function encodeValue(s) {
19
+ if (typeof encodeURIComponent !== 'function') {
20
+ return '';
21
+ }
19
22
  try {
20
23
  return encodeURIComponent(s);
21
24
  } catch (e) {
@@ -26,6 +29,9 @@ function getElementName(selectorConfig, element) {
26
29
  // Helper function to construct attribute selectors.
27
30
  var getAttributeSelector = function getAttributeSelector(attributeName) {
28
31
  var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
32
+ if (element && typeof element.getAttribute !== 'function') {
33
+ return '';
34
+ }
29
35
  var attrValue = element.getAttribute(attributeName);
30
36
  if (!attrValue) {
31
37
  return '';
@@ -35,7 +41,7 @@ function getElementName(selectorConfig, element) {
35
41
  };
36
42
 
37
43
  // Construct the data-vc attribute selector if specified in the config.
38
- var dataVC = selectorConfig.dataVC ? getAttributeSelector('data-vc') : '';
44
+ var dataVC = selectorConfig.dataVC !== false ? getAttributeSelector('data-vc') : '';
39
45
 
40
46
  // Construct the ID selector if specified in the config and the element has an ID.
41
47
  var id = selectorConfig.id && element.id ? "#".concat(encodeValue(element.id)) : '';
@@ -17,7 +17,6 @@ function createIntersectionObserver(args) {
17
17
  var validEntries = [];
18
18
  var startTime = performance.now();
19
19
  entries.forEach(function (entry) {
20
- var _mutationTag;
21
20
  if (!(entry.target instanceof HTMLElement) || !isValidEntry(entry)) {
22
21
  return;
23
22
  }
@@ -44,7 +43,7 @@ function createIntersectionObserver(args) {
44
43
  target: entry.target,
45
44
  rect: entry.intersectionRect,
46
45
  time: entry.time,
47
- type: (_mutationTag = mutationTag) !== null && _mutationTag !== void 0 ? _mutationTag : 'unknown',
46
+ type: mutationTag !== null && mutationTag !== void 0 ? mutationTag : 'unknown',
48
47
  mutationData: mutationData
49
48
  });
50
49
  validEntries.push(new WeakRef(entry.target));
@@ -10,6 +10,9 @@ export default function getElementName(selectorConfig, element) {
10
10
  // Get the tag name of the element.
11
11
  const tagName = element.localName;
12
12
  const encodeValue = s => {
13
+ if (typeof encodeURIComponent !== 'function') {
14
+ return '';
15
+ }
13
16
  try {
14
17
  return encodeURIComponent(s);
15
18
  } catch (e) {
@@ -19,6 +22,9 @@ export default function getElementName(selectorConfig, element) {
19
22
 
20
23
  // Helper function to construct attribute selectors.
21
24
  const getAttributeSelector = (attributeName, prefix = '') => {
25
+ if (element && typeof element.getAttribute !== 'function') {
26
+ return '';
27
+ }
22
28
  const attrValue = element.getAttribute(attributeName);
23
29
  if (!attrValue) {
24
30
  return '';
@@ -28,7 +34,7 @@ export default function getElementName(selectorConfig, element) {
28
34
  };
29
35
 
30
36
  // Construct the data-vc attribute selector if specified in the config.
31
- const dataVC = selectorConfig.dataVC ? getAttributeSelector('data-vc') : '';
37
+ const dataVC = selectorConfig.dataVC !== false ? getAttributeSelector('data-vc') : '';
32
38
 
33
39
  // Construct the ID selector if specified in the config and the element has an ID.
34
40
  const id = selectorConfig.id && element.id ? `#${encodeValue(element.id)}` : '';
@@ -52,14 +52,14 @@ function getUfoNameOverride(interaction) {
52
52
  function getEarliestLegacyStopTime(interaction, labelStack) {
53
53
  var earliestLegacyStopTime = null;
54
54
  interaction.apdex.forEach(function (a) {
55
- var _a$labelStack, _earliestLegacyStopTi;
55
+ var _a$labelStack;
56
56
  if (!(a !== null && a !== void 0 && a.stopTime)) {
57
57
  return;
58
58
  }
59
59
  if (!labelStackStartWith((_a$labelStack = a.labelStack) !== null && _a$labelStack !== void 0 ? _a$labelStack : [], labelStack)) {
60
60
  return;
61
61
  }
62
- if (a.stopTime > interaction.start && ((_earliestLegacyStopTi = earliestLegacyStopTime) !== null && _earliestLegacyStopTi !== void 0 ? _earliestLegacyStopTi : a.stopTime) >= a.stopTime) {
62
+ if (a.stopTime > interaction.start && (earliestLegacyStopTime !== null && earliestLegacyStopTime !== void 0 ? earliestLegacyStopTime : a.stopTime) >= a.stopTime) {
63
63
  earliestLegacyStopTime = a.stopTime;
64
64
  }
65
65
  });
@@ -10,6 +10,9 @@ export default function getElementName(selectorConfig, element) {
10
10
  // Get the tag name of the element.
11
11
  var tagName = element.localName;
12
12
  var encodeValue = function encodeValue(s) {
13
+ if (typeof encodeURIComponent !== 'function') {
14
+ return '';
15
+ }
13
16
  try {
14
17
  return encodeURIComponent(s);
15
18
  } catch (e) {
@@ -20,6 +23,9 @@ export default function getElementName(selectorConfig, element) {
20
23
  // Helper function to construct attribute selectors.
21
24
  var getAttributeSelector = function getAttributeSelector(attributeName) {
22
25
  var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
26
+ if (element && typeof element.getAttribute !== 'function') {
27
+ return '';
28
+ }
23
29
  var attrValue = element.getAttribute(attributeName);
24
30
  if (!attrValue) {
25
31
  return '';
@@ -29,7 +35,7 @@ export default function getElementName(selectorConfig, element) {
29
35
  };
30
36
 
31
37
  // Construct the data-vc attribute selector if specified in the config.
32
- var dataVC = selectorConfig.dataVC ? getAttributeSelector('data-vc') : '';
38
+ var dataVC = selectorConfig.dataVC !== false ? getAttributeSelector('data-vc') : '';
33
39
 
34
40
  // Construct the ID selector if specified in the config and the element has an ID.
35
41
  var id = selectorConfig.id && element.id ? "#".concat(encodeValue(element.id)) : '';
@@ -11,7 +11,6 @@ export function createIntersectionObserver(args) {
11
11
  var validEntries = [];
12
12
  var startTime = performance.now();
13
13
  entries.forEach(function (entry) {
14
- var _mutationTag;
15
14
  if (!(entry.target instanceof HTMLElement) || !isValidEntry(entry)) {
16
15
  return;
17
16
  }
@@ -38,7 +37,7 @@ export function createIntersectionObserver(args) {
38
37
  target: entry.target,
39
38
  rect: entry.intersectionRect,
40
39
  time: entry.time,
41
- type: (_mutationTag = mutationTag) !== null && _mutationTag !== void 0 ? _mutationTag : 'unknown',
40
+ type: mutationTag !== null && mutationTag !== void 0 ? mutationTag : 'unknown',
42
41
  mutationData: mutationData
43
42
  });
44
43
  validEntries.push(new WeakRef(entry.target));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "3.4.5",
3
+ "version": "3.4.6",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",