@atlaskit/react-ufo 2.4.4 → 2.4.5
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 +11 -0
- package/dist/cjs/create-payload/common/utils/index.js +7 -8
- package/dist/cjs/create-payload/index.js +2 -2
- package/dist/cjs/vc/vc-observer/observers/index.js +11 -0
- package/dist/es2019/create-payload/common/utils/index.js +7 -10
- package/dist/es2019/create-payload/index.js +1 -1
- package/dist/es2019/vc/vc-observer/observers/index.js +11 -0
- package/dist/esm/create-payload/common/utils/index.js +7 -8
- package/dist/esm/create-payload/index.js +2 -2
- package/dist/esm/vc/vc-observer/observers/index.js +11 -0
- package/dist/types/common/vc/types.d.ts +1 -1
- package/dist/types/create-payload/index.d.ts +64 -384
- package/dist/types-ts4.5/common/vc/types.d.ts +1 -1
- package/dist/types-ts4.5/create-payload/index.d.ts +64 -384
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/ufo-interaction-ignore
|
|
2
2
|
|
|
3
|
+
## 2.4.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#172240](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/172240)
|
|
8
|
+
[`db973dafd5ae2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/db973dafd5ae2) -
|
|
9
|
+
correctly feature flag and optimise buildSegmentTree function
|
|
10
|
+
- [#172231](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/172231)
|
|
11
|
+
[`de6f706c54af6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/de6f706c54af6) -
|
|
12
|
+
[ED-25937] Skip TTVC calculation from changes that comes from the Editor container
|
|
13
|
+
|
|
3
14
|
## 2.4.4
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -27,20 +27,19 @@ function buildSegmentTree(labelStacks) {
|
|
|
27
27
|
};
|
|
28
28
|
labelStacks.forEach(function (labelStack) {
|
|
29
29
|
var currentNode = r;
|
|
30
|
-
labelStack.forEach(function (label
|
|
31
|
-
var _currentNode$c;
|
|
30
|
+
labelStack.forEach(function (label) {
|
|
32
31
|
var name = label.name;
|
|
33
32
|
var id = isSegmentLabel(label) ? label.segmentId : undefined;
|
|
34
|
-
var key = id !== undefined ? id
|
|
35
|
-
if (
|
|
33
|
+
var key = id !== undefined ? id : name;
|
|
34
|
+
if (!currentNode.c) {
|
|
35
|
+
currentNode.c = {};
|
|
36
|
+
}
|
|
37
|
+
if (!currentNode.c[key]) {
|
|
36
38
|
currentNode.c[key] = {
|
|
37
39
|
n: name
|
|
38
40
|
};
|
|
39
41
|
}
|
|
40
|
-
currentNode =
|
|
41
|
-
if (index < labelStack.length - 1) {
|
|
42
|
-
currentNode.c = _objectSpread({}, currentNode.c || {});
|
|
43
|
-
}
|
|
42
|
+
currentNode = currentNode.c[key];
|
|
44
43
|
});
|
|
45
44
|
});
|
|
46
45
|
return {
|
|
@@ -670,9 +670,9 @@ function createInteractionMetricsPayload(interaction, interactionId) {
|
|
|
670
670
|
var pageVisibilityAtTTI = getPageVisibilityUpToTTI(interaction);
|
|
671
671
|
var pageVisibilityAtTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
672
672
|
var segments = config.killswitchNestedSegments ? [] : knownSegments;
|
|
673
|
-
var segmentTree = (0, _utils.buildSegmentTree)(segments.map(function (segment) {
|
|
673
|
+
var segmentTree = _constants.REACT_UFO_VERSION === '2.0.0' ? (0, _utils.buildSegmentTree)(segments.map(function (segment) {
|
|
674
674
|
return segment.labelStack;
|
|
675
|
-
}));
|
|
675
|
+
})) : {};
|
|
676
676
|
var isDetailedPayload = pageVisibilityAtTTAI === 'visible';
|
|
677
677
|
var isPageLoad = type === 'page_load';
|
|
678
678
|
var calculatePageVisibilityFromTheStartOfPageLoad = config.enableBetterPageVisibilityApi && isPageLoad;
|
|
@@ -23,6 +23,12 @@ var state = {
|
|
|
23
23
|
waitingForFirstRender: 2,
|
|
24
24
|
ignoring: 3
|
|
25
25
|
};
|
|
26
|
+
function isInsideEditorContainer(target) {
|
|
27
|
+
if (!target || typeof target.closest !== 'function') {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
return Boolean(target.closest('.ProseMirror'));
|
|
31
|
+
}
|
|
26
32
|
var Observers = exports.Observers = /*#__PURE__*/function () {
|
|
27
33
|
function Observers(opts) {
|
|
28
34
|
var _this = this;
|
|
@@ -297,6 +303,11 @@ var Observers = exports.Observers = /*#__PURE__*/function () {
|
|
|
297
303
|
data.ignoreReason = 'not-visible';
|
|
298
304
|
}
|
|
299
305
|
}
|
|
306
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_ed-25937_ignore_mutations_for_ttvc')) {
|
|
307
|
+
if (isInsideEditorContainer(target)) {
|
|
308
|
+
data.ignoreReason = 'editor-container-mutation';
|
|
309
|
+
}
|
|
310
|
+
}
|
|
300
311
|
_this3.callbacks.forEach(function (callback) {
|
|
301
312
|
var elementName;
|
|
302
313
|
try {
|
|
@@ -13,22 +13,19 @@ export function buildSegmentTree(labelStacks) {
|
|
|
13
13
|
};
|
|
14
14
|
labelStacks.forEach(labelStack => {
|
|
15
15
|
let currentNode = r;
|
|
16
|
-
labelStack.forEach(
|
|
17
|
-
var _currentNode$c;
|
|
16
|
+
labelStack.forEach(label => {
|
|
18
17
|
const name = label.name;
|
|
19
18
|
const id = isSegmentLabel(label) ? label.segmentId : undefined;
|
|
20
|
-
const key = id !== undefined ? id
|
|
21
|
-
if (
|
|
19
|
+
const key = id !== undefined ? id : name;
|
|
20
|
+
if (!currentNode.c) {
|
|
21
|
+
currentNode.c = {};
|
|
22
|
+
}
|
|
23
|
+
if (!currentNode.c[key]) {
|
|
22
24
|
currentNode.c[key] = {
|
|
23
25
|
n: name
|
|
24
26
|
};
|
|
25
27
|
}
|
|
26
|
-
currentNode =
|
|
27
|
-
if (index < labelStack.length - 1) {
|
|
28
|
-
currentNode.c = {
|
|
29
|
-
...(currentNode.c || {})
|
|
30
|
-
};
|
|
31
|
-
}
|
|
28
|
+
currentNode = currentNode.c[key];
|
|
32
29
|
});
|
|
33
30
|
});
|
|
34
31
|
return {
|
|
@@ -664,7 +664,7 @@ function createInteractionMetricsPayload(interaction, interactionId) {
|
|
|
664
664
|
const pageVisibilityAtTTI = getPageVisibilityUpToTTI(interaction);
|
|
665
665
|
const pageVisibilityAtTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
666
666
|
const segments = config.killswitchNestedSegments ? [] : knownSegments;
|
|
667
|
-
const segmentTree = buildSegmentTree(segments.map(segment => segment.labelStack));
|
|
667
|
+
const segmentTree = REACT_UFO_VERSION === '2.0.0' ? buildSegmentTree(segments.map(segment => segment.labelStack)) : {};
|
|
668
668
|
const isDetailedPayload = pageVisibilityAtTTAI === 'visible';
|
|
669
669
|
const isPageLoad = type === 'page_load';
|
|
670
670
|
const calculatePageVisibilityFromTheStartOfPageLoad = config.enableBetterPageVisibilityApi && isPageLoad;
|
|
@@ -8,6 +8,12 @@ const state = {
|
|
|
8
8
|
waitingForFirstRender: 2,
|
|
9
9
|
ignoring: 3
|
|
10
10
|
};
|
|
11
|
+
function isInsideEditorContainer(target) {
|
|
12
|
+
if (!target || typeof target.closest !== 'function') {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
return Boolean(target.closest('.ProseMirror'));
|
|
16
|
+
}
|
|
11
17
|
export class Observers {
|
|
12
18
|
constructor(opts) {
|
|
13
19
|
_defineProperty(this, "observedMutations", new WeakMap());
|
|
@@ -245,6 +251,11 @@ export class Observers {
|
|
|
245
251
|
data.ignoreReason = 'not-visible';
|
|
246
252
|
}
|
|
247
253
|
}
|
|
254
|
+
if (fg('platform_editor_ed-25937_ignore_mutations_for_ttvc')) {
|
|
255
|
+
if (isInsideEditorContainer(target)) {
|
|
256
|
+
data.ignoreReason = 'editor-container-mutation';
|
|
257
|
+
}
|
|
258
|
+
}
|
|
248
259
|
this.callbacks.forEach(callback => {
|
|
249
260
|
let elementName;
|
|
250
261
|
try {
|
|
@@ -16,20 +16,19 @@ export function buildSegmentTree(labelStacks) {
|
|
|
16
16
|
};
|
|
17
17
|
labelStacks.forEach(function (labelStack) {
|
|
18
18
|
var currentNode = r;
|
|
19
|
-
labelStack.forEach(function (label
|
|
20
|
-
var _currentNode$c;
|
|
19
|
+
labelStack.forEach(function (label) {
|
|
21
20
|
var name = label.name;
|
|
22
21
|
var id = isSegmentLabel(label) ? label.segmentId : undefined;
|
|
23
|
-
var key = id !== undefined ? id
|
|
24
|
-
if (
|
|
22
|
+
var key = id !== undefined ? id : name;
|
|
23
|
+
if (!currentNode.c) {
|
|
24
|
+
currentNode.c = {};
|
|
25
|
+
}
|
|
26
|
+
if (!currentNode.c[key]) {
|
|
25
27
|
currentNode.c[key] = {
|
|
26
28
|
n: name
|
|
27
29
|
};
|
|
28
30
|
}
|
|
29
|
-
currentNode =
|
|
30
|
-
if (index < labelStack.length - 1) {
|
|
31
|
-
currentNode.c = _objectSpread({}, currentNode.c || {});
|
|
32
|
-
}
|
|
31
|
+
currentNode = currentNode.c[key];
|
|
33
32
|
});
|
|
34
33
|
});
|
|
35
34
|
return {
|
|
@@ -660,9 +660,9 @@ function createInteractionMetricsPayload(interaction, interactionId) {
|
|
|
660
660
|
var pageVisibilityAtTTI = getPageVisibilityUpToTTI(interaction);
|
|
661
661
|
var pageVisibilityAtTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
662
662
|
var segments = config.killswitchNestedSegments ? [] : knownSegments;
|
|
663
|
-
var segmentTree = buildSegmentTree(segments.map(function (segment) {
|
|
663
|
+
var segmentTree = REACT_UFO_VERSION === '2.0.0' ? buildSegmentTree(segments.map(function (segment) {
|
|
664
664
|
return segment.labelStack;
|
|
665
|
-
}));
|
|
665
|
+
})) : {};
|
|
666
666
|
var isDetailedPayload = pageVisibilityAtTTAI === 'visible';
|
|
667
667
|
var isPageLoad = type === 'page_load';
|
|
668
668
|
var calculatePageVisibilityFromTheStartOfPageLoad = config.enableBetterPageVisibilityApi && isPageLoad;
|
|
@@ -16,6 +16,12 @@ var state = {
|
|
|
16
16
|
waitingForFirstRender: 2,
|
|
17
17
|
ignoring: 3
|
|
18
18
|
};
|
|
19
|
+
function isInsideEditorContainer(target) {
|
|
20
|
+
if (!target || typeof target.closest !== 'function') {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
return Boolean(target.closest('.ProseMirror'));
|
|
24
|
+
}
|
|
19
25
|
export var Observers = /*#__PURE__*/function () {
|
|
20
26
|
function Observers(opts) {
|
|
21
27
|
var _this = this;
|
|
@@ -290,6 +296,11 @@ export var Observers = /*#__PURE__*/function () {
|
|
|
290
296
|
data.ignoreReason = 'not-visible';
|
|
291
297
|
}
|
|
292
298
|
}
|
|
299
|
+
if (fg('platform_editor_ed-25937_ignore_mutations_for_ttvc')) {
|
|
300
|
+
if (isInsideEditorContainer(target)) {
|
|
301
|
+
data.ignoreReason = 'editor-container-mutation';
|
|
302
|
+
}
|
|
303
|
+
}
|
|
293
304
|
_this3.callbacks.forEach(function (callback) {
|
|
294
305
|
var elementName;
|
|
295
306
|
try {
|
|
@@ -35,7 +35,7 @@ export type VCEntryType = {
|
|
|
35
35
|
vc: number;
|
|
36
36
|
elements: string[];
|
|
37
37
|
};
|
|
38
|
-
export type VCIgnoreReason = 'image' | 'ssr-hydration' | 'editor-lazy-node-view' | 'not-visible' | '';
|
|
38
|
+
export type VCIgnoreReason = 'image' | 'ssr-hydration' | 'editor-lazy-node-view' | 'not-visible' | 'editor-container-mutation' | '';
|
|
39
39
|
export type ComponentsLogEntry = {
|
|
40
40
|
targetName: string;
|
|
41
41
|
__debug__element: WeakRef<Element> | null;
|