@atlaskit/react-ufo 3.4.9 → 3.4.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/CHANGELOG.md +16 -0
- package/dist/cjs/create-payload/utils/get-vc-metrics.js +24 -6
- package/dist/cjs/vc/vc-observer/getVCRevisionsData.js +81 -0
- package/dist/cjs/vc/vc-observer/index.js +119 -117
- package/dist/cjs/vc/vc-observer/observers/index.js +19 -7
- package/dist/cjs/vc/vc-observer/revisions/fy25_02.js +9 -18
- package/dist/cjs/vc/vc-observer/revisions/revisions.js +13 -12
- package/dist/cjs/vc/vc-observer-new/viewport-observer/mutation-observer/index.js +27 -5
- package/dist/es2019/create-payload/utils/get-vc-metrics.js +23 -10
- package/dist/es2019/vc/vc-observer/getVCRevisionsData.js +76 -0
- package/dist/es2019/vc/vc-observer/index.js +96 -93
- package/dist/es2019/vc/vc-observer/observers/index.js +19 -7
- package/dist/es2019/vc/vc-observer/revisions/fy25_02.js +7 -16
- package/dist/es2019/vc/vc-observer/revisions/revisions.js +13 -14
- package/dist/es2019/vc/vc-observer-new/viewport-observer/mutation-observer/index.js +27 -5
- package/dist/esm/create-payload/utils/get-vc-metrics.js +24 -6
- package/dist/esm/vc/vc-observer/getVCRevisionsData.js +74 -0
- package/dist/esm/vc/vc-observer/index.js +119 -117
- package/dist/esm/vc/vc-observer/observers/index.js +19 -7
- package/dist/esm/vc/vc-observer/revisions/fy25_02.js +9 -18
- package/dist/esm/vc/vc-observer/revisions/revisions.js +13 -12
- package/dist/esm/vc/vc-observer-new/viewport-observer/mutation-observer/index.js +27 -5
- package/dist/types/config/index.d.ts +1 -0
- package/dist/types/vc/vc-observer/getVCRevisionsData.d.ts +35 -0
- package/dist/types-ts4.5/config/index.d.ts +1 -0
- package/dist/types-ts4.5/vc/vc-observer/getVCRevisionsData.d.ts +35 -0
- package/package.json +10 -10
|
@@ -4,20 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getRevisions = void 0;
|
|
7
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
7
8
|
var _fy25_ = require("./fy25_01");
|
|
8
9
|
var _fy25_2 = require("./fy25_02");
|
|
9
|
-
var Revisions = [{
|
|
10
|
-
name: 'fy25.01',
|
|
11
|
-
classifier: _fy25_.revFY25_01Classifier
|
|
12
|
-
}, {
|
|
13
|
-
name: 'fy25.02',
|
|
14
|
-
classifier: _fy25_2.revFY25_02Classifier
|
|
15
|
-
}];
|
|
16
|
-
var revisionResultCache = null;
|
|
17
10
|
var getRevisions = exports.getRevisions = function getRevisions() {
|
|
18
|
-
if (
|
|
19
|
-
return
|
|
11
|
+
if ((0, _platformFeatureFlags.fg)('platform_ufo_disable_ttvc_v1')) {
|
|
12
|
+
return [{
|
|
13
|
+
name: 'fy25.02',
|
|
14
|
+
classifier: _fy25_2.revFY25_02Classifier
|
|
15
|
+
}];
|
|
20
16
|
}
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
return [{
|
|
18
|
+
name: 'fy25.01',
|
|
19
|
+
classifier: _fy25_.revFY25_01Classifier
|
|
20
|
+
}, {
|
|
21
|
+
name: 'fy25.02',
|
|
22
|
+
classifier: _fy25_2.revFY25_02Classifier
|
|
23
|
+
}];
|
|
23
24
|
};
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = createMutationObserver;
|
|
7
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
7
8
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
8
9
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
9
10
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
@@ -27,11 +28,32 @@ function createMutationObserver(_ref) {
|
|
|
27
28
|
continue;
|
|
28
29
|
}
|
|
29
30
|
if (mut.type === 'attributes') {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
if ((0, _platformFeatureFlags.fg)('platform_ufo_vc_ignore_same_value_mutation')) {
|
|
32
|
+
var _mut$oldValue;
|
|
33
|
+
/*
|
|
34
|
+
"MutationObserver was explicitly designed to work that way, but I can't now recall the reasoning.
|
|
35
|
+
I think it might have been something along the lines that for consistency every setAttribute call should create a record.
|
|
36
|
+
Conceptually there is after all a mutation: there is an old value replaced with a new one,
|
|
37
|
+
and whether or not they are the same doesn't really matter.
|
|
38
|
+
And Custom elements should work the same way as MutationObserver."
|
|
39
|
+
https://github.com/whatwg/dom/issues/520#issuecomment-336574796
|
|
40
|
+
*/
|
|
41
|
+
var oldValue = (_mut$oldValue = mut.oldValue) !== null && _mut$oldValue !== void 0 ? _mut$oldValue : undefined;
|
|
42
|
+
var newValue = mut.attributeName ? mut.target.getAttribute(mut.attributeName) : undefined;
|
|
43
|
+
if (oldValue !== newValue) {
|
|
44
|
+
var _mut$attributeName;
|
|
45
|
+
onAttributeMutation({
|
|
46
|
+
target: mut.target,
|
|
47
|
+
attributeName: (_mut$attributeName = mut.attributeName) !== null && _mut$attributeName !== void 0 ? _mut$attributeName : 'unknown'
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
} else {
|
|
51
|
+
var _mut$attributeName2;
|
|
52
|
+
onAttributeMutation({
|
|
53
|
+
target: mut.target,
|
|
54
|
+
attributeName: (_mut$attributeName2 = mut.attributeName) !== null && _mut$attributeName2 !== void 0 ? _mut$attributeName2 : 'unknown'
|
|
55
|
+
});
|
|
56
|
+
}
|
|
35
57
|
continue;
|
|
36
58
|
} else if (mut.type === 'childList') {
|
|
37
59
|
var _mut$addedNodes, _mut$removedNodes;
|
|
@@ -39,15 +39,28 @@ export default async function getVCMetrics(interaction) {
|
|
|
39
39
|
getVCObserver().stop();
|
|
40
40
|
}
|
|
41
41
|
postInteractionLog.setLastInteractionFinishVCResult(result);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
if (fg('platform_ufo_disable_ttvc_v1')) {
|
|
43
|
+
const ttvcV2Revision = (result === null || result === void 0 ? void 0 : result['ufo:vc:rev']).find(({
|
|
44
|
+
revision
|
|
45
|
+
}) => revision === 'fy25.02');
|
|
46
|
+
if (!(ttvcV2Revision !== null && ttvcV2Revision !== void 0 && ttvcV2Revision.clean)) {
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
...result,
|
|
51
|
+
'metric:vc90': ttvcV2Revision['metric:vc90']
|
|
52
|
+
};
|
|
53
|
+
} else {
|
|
54
|
+
const VC = result === null || result === void 0 ? void 0 : result['metrics:vc'];
|
|
55
|
+
if (!VC || !(result !== null && result !== void 0 && result[`${prefix}:vc:clean`])) {
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
if (interactionStatus.originalInteractionStatus !== 'SUCCEEDED' || pageVisibilityUpToTTAI !== 'visible') {
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
...result,
|
|
63
|
+
'metric:vc90': VC['90']
|
|
64
|
+
};
|
|
45
65
|
}
|
|
46
|
-
if (interactionStatus.originalInteractionStatus !== 'SUCCEEDED' || pageVisibilityUpToTTAI !== 'visible') {
|
|
47
|
-
return result;
|
|
48
|
-
}
|
|
49
|
-
return {
|
|
50
|
-
...result,
|
|
51
|
-
'metric:vc90': VC['90']
|
|
52
|
-
};
|
|
53
66
|
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
+
import { getPageVisibilityState } from '../../hidden-timing';
|
|
3
|
+
import { getRevisions } from './revisions/revisions';
|
|
4
|
+
const VCParts = ['25', '50', '75', '80', '85', '90', '95', '98', '99'];
|
|
5
|
+
export function getVCRevisionsData({
|
|
6
|
+
fullPrefix,
|
|
7
|
+
interaction,
|
|
8
|
+
isVCClean,
|
|
9
|
+
isEventAborted,
|
|
10
|
+
multiHeatmap,
|
|
11
|
+
ssr,
|
|
12
|
+
calculatedVC,
|
|
13
|
+
calculatedVCNext
|
|
14
|
+
}) {
|
|
15
|
+
const isMultiHeatmapEnabled = !fg('platform_ufo_multiheatmap_killswitch');
|
|
16
|
+
if (!isMultiHeatmapEnabled) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
if (!fg('platform_ufo_vc_observer_new')) {
|
|
20
|
+
if (!multiHeatmap) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
[`${fullPrefix}vc:rev`]: multiHeatmap === null || multiHeatmap === void 0 ? void 0 : multiHeatmap.getPayloadShapedData({
|
|
25
|
+
VCParts: VCParts.map(v => parseInt(v)),
|
|
26
|
+
VCCalculationMethods: getRevisions().map(({
|
|
27
|
+
classifier
|
|
28
|
+
}) => classifier.VCCalculationMethod),
|
|
29
|
+
filterComponentsLog: getRevisions().map(({
|
|
30
|
+
classifier
|
|
31
|
+
}) => classifier.filterComponentsLog),
|
|
32
|
+
isEventAborted,
|
|
33
|
+
interactionStart: interaction.start,
|
|
34
|
+
ttai: interaction.end,
|
|
35
|
+
ssr,
|
|
36
|
+
clean: isVCClean
|
|
37
|
+
})
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const pageVisibilityUpToTTAI = getPageVisibilityState(interaction.start, interaction.end);
|
|
41
|
+
const isVisiblePageVisibleUpToTTAI = pageVisibilityUpToTTAI === 'visible';
|
|
42
|
+
const shouldHaveVCmetric = isVCClean && !isEventAborted && isVisiblePageVisibleUpToTTAI;
|
|
43
|
+
const ttvcV1Revision = {
|
|
44
|
+
revision: 'fy25.01',
|
|
45
|
+
clean: isVCClean,
|
|
46
|
+
'metric:vc90': shouldHaveVCmetric ? calculatedVC.VC['90'] : null,
|
|
47
|
+
vcDetails: shouldHaveVCmetric ? Object.fromEntries(VCParts.map(key => {
|
|
48
|
+
var _calculatedVC$VCBox$k;
|
|
49
|
+
return [key, {
|
|
50
|
+
t: calculatedVC.VC[key],
|
|
51
|
+
e: (_calculatedVC$VCBox$k = calculatedVC.VCBox[key]) !== null && _calculatedVC$VCBox$k !== void 0 ? _calculatedVC$VCBox$k : []
|
|
52
|
+
}];
|
|
53
|
+
})) : {}
|
|
54
|
+
};
|
|
55
|
+
const ttvcV2ReportedMetric = fg('platform_ufo_fix_v2_reported_vc90') ? calculatedVCNext.VC['90'] : calculatedVC.VC['90'];
|
|
56
|
+
const ttvcV2Revision = {
|
|
57
|
+
revision: 'fy25.02',
|
|
58
|
+
clean: isVCClean,
|
|
59
|
+
'metric:vc90': shouldHaveVCmetric ? ttvcV2ReportedMetric : null,
|
|
60
|
+
vcDetails: shouldHaveVCmetric ? Object.fromEntries(VCParts.map(key => {
|
|
61
|
+
var _calculatedVCNext$VCB;
|
|
62
|
+
return [key, {
|
|
63
|
+
t: calculatedVCNext.VC[key],
|
|
64
|
+
e: (_calculatedVCNext$VCB = calculatedVCNext.VCBox[key]) !== null && _calculatedVCNext$VCB !== void 0 ? _calculatedVCNext$VCB : []
|
|
65
|
+
}];
|
|
66
|
+
})) : {}
|
|
67
|
+
};
|
|
68
|
+
if (fg('platform_ufo_disable_ttvc_v1')) {
|
|
69
|
+
return {
|
|
70
|
+
[`${fullPrefix}vc:rev`]: [ttvcV2Revision]
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
[`${fullPrefix}vc:rev`]: [ttvcV1Revision, ttvcV2Revision]
|
|
75
|
+
};
|
|
76
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
-
import { getPageVisibilityState } from '../../hidden-timing';
|
|
4
3
|
import { attachAbortListeners } from './attachAbortListeners';
|
|
4
|
+
import { getVCRevisionsData } from './getVCRevisionsData';
|
|
5
5
|
import { getViewportHeight, getViewportWidth } from './getViewport';
|
|
6
6
|
import { MultiRevisionHeatmap } from './heatmap/heatmap';
|
|
7
7
|
import { Observers } from './observers';
|
|
@@ -128,12 +128,17 @@ export class VCObserver {
|
|
|
128
128
|
[`${fullPrefix}vc:abort:timestamp`]: abortReason.timestamp
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
131
|
+
const isTTVCv1Disabled = fg('platform_ufo_disable_ttvc_v1');
|
|
132
|
+
const ttvcV1Result = isTTVCv1Disabled ? {
|
|
133
|
+
VC: {},
|
|
134
|
+
VCBox: {},
|
|
135
|
+
VCEntries: {
|
|
136
|
+
abs: [],
|
|
137
|
+
rel: [],
|
|
138
|
+
speedIndex: -1
|
|
139
|
+
},
|
|
140
|
+
totalPainted: -1
|
|
141
|
+
} : VCObserver.calculateVC({
|
|
137
142
|
heatmap,
|
|
138
143
|
ssr,
|
|
139
144
|
componentsLog: {
|
|
@@ -141,35 +146,19 @@ export class VCObserver {
|
|
|
141
146
|
},
|
|
142
147
|
viewport
|
|
143
148
|
});
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
149
|
+
const {
|
|
150
|
+
VC,
|
|
151
|
+
VCBox,
|
|
152
|
+
VCEntries,
|
|
153
|
+
totalPainted
|
|
154
|
+
} = ttvcV1Result;
|
|
155
|
+
const _componentsLog = {};
|
|
156
|
+
Object.entries(this.componentsLog).forEach(([_timestamp, value]) => {
|
|
157
|
+
const timestamp = Number(_timestamp);
|
|
158
|
+
if (stop > timestamp) {
|
|
159
|
+
_componentsLog[timestamp] = value;
|
|
155
160
|
}
|
|
156
|
-
}
|
|
157
|
-
/* empty */
|
|
158
|
-
}
|
|
159
|
-
let _componentsLog = {};
|
|
160
|
-
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
161
|
-
if (fg('ufo-remove-vc-component-observations-after-ttai')) {
|
|
162
|
-
Object.entries(this.componentsLog).forEach(([_timestamp, value]) => {
|
|
163
|
-
const timestamp = Number(_timestamp);
|
|
164
|
-
if (stop > timestamp) {
|
|
165
|
-
_componentsLog[timestamp] = value;
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
} else {
|
|
169
|
-
_componentsLog = {
|
|
170
|
-
...componentsLog
|
|
171
|
-
};
|
|
172
|
-
}
|
|
161
|
+
});
|
|
173
162
|
const vcNext = VCObserver.calculateVC({
|
|
174
163
|
heatmap: heatmapNext,
|
|
175
164
|
ssr,
|
|
@@ -179,12 +168,33 @@ export class VCObserver {
|
|
|
179
168
|
try {
|
|
180
169
|
if (!this.isPostInteraction) {
|
|
181
170
|
VCObserver.VCParts.forEach(key => {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
171
|
+
if (isTTVCv1Disabled) {
|
|
172
|
+
const duration = vcNext.VC[key];
|
|
173
|
+
if (duration !== null && duration !== undefined) {
|
|
174
|
+
performance.measure(`VC${key}`, {
|
|
175
|
+
start,
|
|
176
|
+
duration
|
|
177
|
+
});
|
|
178
|
+
performance.measure(`VC_Next${key}`, {
|
|
179
|
+
start,
|
|
180
|
+
duration
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
} else {
|
|
184
|
+
const ttvcV1duration = VC[key];
|
|
185
|
+
if (ttvcV1duration !== null && ttvcV1duration !== undefined) {
|
|
186
|
+
performance.measure(`VC${key}`, {
|
|
187
|
+
start,
|
|
188
|
+
duration: ttvcV1duration
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
const ttvcV2duration = vcNext.VC[key];
|
|
192
|
+
if (ttvcV2duration !== null && ttvcV2duration !== undefined) {
|
|
193
|
+
performance.measure(`VC_Next${key}`, {
|
|
194
|
+
start,
|
|
195
|
+
duration: ttvcV2duration
|
|
196
|
+
});
|
|
197
|
+
}
|
|
188
198
|
}
|
|
189
199
|
});
|
|
190
200
|
}
|
|
@@ -201,7 +211,7 @@ export class VCObserver {
|
|
|
201
211
|
// exposing data to devtools
|
|
202
212
|
try {
|
|
203
213
|
if (!this.isPostInteraction && devToolsEnabled) {
|
|
204
|
-
|
|
214
|
+
const ttvcV1DevToolInfo = isTTVCv1Disabled ? undefined : {
|
|
205
215
|
entries: VCEntries.rel,
|
|
206
216
|
log: componentsLog,
|
|
207
217
|
metrics: {
|
|
@@ -220,7 +230,7 @@ export class VCObserver {
|
|
|
220
230
|
heatmap,
|
|
221
231
|
ratios
|
|
222
232
|
};
|
|
223
|
-
|
|
233
|
+
const ttvcV2DevToolInfo = {
|
|
224
234
|
entries: vcNext.VCEntries.rel,
|
|
225
235
|
log: componentsLog,
|
|
226
236
|
metrics: {
|
|
@@ -239,12 +249,19 @@ export class VCObserver {
|
|
|
239
249
|
heatmap: heatmapNext,
|
|
240
250
|
ratios
|
|
241
251
|
};
|
|
252
|
+
if (isTTVCv1Disabled) {
|
|
253
|
+
window.__vc = ttvcV2DevToolInfo;
|
|
254
|
+
window.__vcNext = ttvcV2DevToolInfo;
|
|
255
|
+
} else {
|
|
256
|
+
window.__vc = ttvcV1DevToolInfo;
|
|
257
|
+
window.__vcNext = ttvcV2DevToolInfo;
|
|
258
|
+
}
|
|
242
259
|
|
|
243
260
|
// Emitting a custom event to make it available in the Chrome extension
|
|
244
261
|
window.dispatchEvent(new CustomEvent('vcReady', {
|
|
245
262
|
detail: {
|
|
246
263
|
log: filterComponentsLog(componentsLog),
|
|
247
|
-
entries: VCEntries.rel
|
|
264
|
+
entries: isTTVCv1Disabled ? vcNext.VCEntries.rel : VCEntries.rel
|
|
248
265
|
}
|
|
249
266
|
}));
|
|
250
267
|
}
|
|
@@ -252,56 +269,42 @@ export class VCObserver {
|
|
|
252
269
|
/* do nothing */
|
|
253
270
|
}
|
|
254
271
|
const isVCClean = !abortReasonInfo;
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
},
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
'metric:vc90': shouldHaveVCmetric ? VC['90'] : null,
|
|
275
|
-
vcDetails: shouldHaveVCmetric ? Object.fromEntries(VCObserver.VCParts.map(key => {
|
|
276
|
-
var _vcNext$VCBox$key;
|
|
277
|
-
return [key, {
|
|
278
|
-
t: vcNext.VC[key],
|
|
279
|
-
e: (_vcNext$VCBox$key = vcNext.VCBox[key]) !== null && _vcNext$VCBox$key !== void 0 ? _vcNext$VCBox$key : []
|
|
280
|
-
}];
|
|
281
|
-
})) : []
|
|
282
|
-
}]
|
|
283
|
-
} : multiHeatmap !== null ? {
|
|
284
|
-
[`${fullPrefix}vc:rev`]: multiHeatmap === null || multiHeatmap === void 0 ? void 0 : multiHeatmap.getPayloadShapedData({
|
|
285
|
-
VCParts: VCObserver.VCParts.map(v => parseInt(v)),
|
|
286
|
-
VCCalculationMethods: getRevisions().map(({
|
|
287
|
-
classifier
|
|
288
|
-
}) => classifier.VCCalculationMethod),
|
|
289
|
-
filterComponentsLog: getRevisions().map(({
|
|
290
|
-
classifier
|
|
291
|
-
}) => classifier.filterComponentsLog),
|
|
292
|
-
isEventAborted,
|
|
293
|
-
interactionStart: start,
|
|
294
|
-
ttai: stop,
|
|
295
|
-
ssr,
|
|
296
|
-
clean: isVCClean
|
|
297
|
-
})
|
|
298
|
-
} : null : null;
|
|
272
|
+
const revisionsData = getVCRevisionsData({
|
|
273
|
+
fullPrefix,
|
|
274
|
+
interaction: {
|
|
275
|
+
start,
|
|
276
|
+
end: stop
|
|
277
|
+
},
|
|
278
|
+
isVCClean,
|
|
279
|
+
multiHeatmap,
|
|
280
|
+
ssr,
|
|
281
|
+
calculatedVC: {
|
|
282
|
+
VC,
|
|
283
|
+
VCBox
|
|
284
|
+
},
|
|
285
|
+
calculatedVCNext: {
|
|
286
|
+
VC: vcNext.VC,
|
|
287
|
+
VCBox: vcNext.VCBox
|
|
288
|
+
},
|
|
289
|
+
isEventAborted
|
|
290
|
+
});
|
|
299
291
|
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
300
292
|
const isCalcSpeedIndexEnabled = fg('ufo-calc-speed-index');
|
|
301
293
|
const speedIndex = {
|
|
302
|
-
[`ufo:speedIndex`]: VCEntries.speedIndex,
|
|
294
|
+
[`ufo:speedIndex`]: isTTVCv1Disabled ? vcNext.VCEntries.speedIndex : VCEntries.speedIndex,
|
|
303
295
|
[`ufo:next:speedIndex`]: vcNext.VCEntries.speedIndex
|
|
304
296
|
};
|
|
297
|
+
if (isTTVCv1Disabled) {
|
|
298
|
+
return {
|
|
299
|
+
[`${fullPrefix}vc:size`]: viewport,
|
|
300
|
+
[`${fullPrefix}vc:time`]: Math.round(totalTime + (stopTime - startTime)),
|
|
301
|
+
[`${fullPrefix}vc:ratios`]: ratios,
|
|
302
|
+
...outOfBoundary,
|
|
303
|
+
[`${fullPrefix}vc:ignored`]: this.getIgnoredElements(componentsLog),
|
|
304
|
+
...revisionsData,
|
|
305
|
+
...(isCalcSpeedIndexEnabled ? speedIndex : {})
|
|
306
|
+
};
|
|
307
|
+
}
|
|
305
308
|
return {
|
|
306
309
|
'metrics:vc': VC,
|
|
307
310
|
[`${fullPrefix}vc:state`]: true,
|
|
@@ -317,7 +320,6 @@ export class VCObserver {
|
|
|
317
320
|
[`${fullPrefix}vc:next`]: vcNext.VC,
|
|
318
321
|
[`${fullPrefix}vc:next:updates`]: vcNext.VCEntries.rel.slice(0, 50),
|
|
319
322
|
[`${fullPrefix}vc:next:dom`]: vcNext.VCBox,
|
|
320
|
-
//...oldDomUpdates,
|
|
321
323
|
[`${fullPrefix}vc:ignored`]: this.getIgnoredElements(componentsLog),
|
|
322
324
|
...revisionsData,
|
|
323
325
|
...(isCalcSpeedIndexEnabled ? speedIndex : {})
|
|
@@ -346,7 +348,8 @@ export class VCObserver {
|
|
|
346
348
|
if (!ignoreReason) {
|
|
347
349
|
this.applyChangesToHeatMap(mappedValues, time, this.heatmapNext);
|
|
348
350
|
}
|
|
349
|
-
|
|
351
|
+
const isTTVCv1Disabled = fg('platform_ufo_disable_ttvc_v1');
|
|
352
|
+
if (!isTTVCv1Disabled && (!ignoreReason || ignoreReason === 'not-visible') && type !== 'attr') {
|
|
350
353
|
this.applyChangesToHeatMap(mappedValues, time, this.heatmap);
|
|
351
354
|
}
|
|
352
355
|
if (!this.componentsLog[time]) {
|
|
@@ -474,7 +477,7 @@ export class VCObserver {
|
|
|
474
477
|
dataVC: true
|
|
475
478
|
}
|
|
476
479
|
});
|
|
477
|
-
this.heatmap = this.getCleanHeatmap();
|
|
480
|
+
this.heatmap = fg('platform_ufo_disable_ttvc_v1') ? [] : this.getCleanHeatmap();
|
|
478
481
|
this.heatmapNext = this.getCleanHeatmap();
|
|
479
482
|
this.multiHeatmap = new MultiRevisionHeatmap({
|
|
480
483
|
viewport: this.viewport,
|
|
@@ -637,7 +640,7 @@ export class VCObserver {
|
|
|
637
640
|
blocking: false
|
|
638
641
|
};
|
|
639
642
|
this.detachAbortListeners();
|
|
640
|
-
this.heatmap = this.getCleanHeatmap();
|
|
643
|
+
this.heatmap = fg('platform_ufo_disable_ttvc_v1') ? [] : this.getCleanHeatmap();
|
|
641
644
|
this.heatmapNext = this.getCleanHeatmap();
|
|
642
645
|
this.multiHeatmap = new MultiRevisionHeatmap({
|
|
643
646
|
viewport: this.viewport,
|
|
@@ -80,7 +80,7 @@ export class Observers {
|
|
|
80
80
|
renderStop: -1
|
|
81
81
|
};
|
|
82
82
|
(_this$mutationObserve = this.mutationObserver) === null || _this$mutationObserve === void 0 ? void 0 : _this$mutationObserve.observe(document.body, {
|
|
83
|
-
attributeFilter:
|
|
83
|
+
attributeFilter: ['hidden', 'style', 'src', 'class'],
|
|
84
84
|
attributeOldValue: true,
|
|
85
85
|
attributes: true,
|
|
86
86
|
childList: true,
|
|
@@ -183,13 +183,27 @@ export class Observers {
|
|
|
183
183
|
});
|
|
184
184
|
} else if (mutation.type === 'attributes') {
|
|
185
185
|
if (mutation.target instanceof HTMLElement) {
|
|
186
|
-
if (fg('
|
|
186
|
+
if (fg('platform_ufo_vc_ignore_same_value_mutation')) {
|
|
187
|
+
var _mutation$oldValue;
|
|
188
|
+
/*
|
|
189
|
+
"MutationObserver was explicitly designed to work that way, but I can't now recall the reasoning.
|
|
190
|
+
I think it might have been something along the lines that for consistency every setAttribute call should create a record.
|
|
191
|
+
Conceptually there is after all a mutation: there is an old value replaced with a new one,
|
|
192
|
+
and whether or not they are the same doesn't really matter.
|
|
193
|
+
And Custom elements should work the same way as MutationObserver."
|
|
194
|
+
https://github.com/whatwg/dom/issues/520#issuecomment-336574796
|
|
195
|
+
*/
|
|
196
|
+
const oldValue = (_mutation$oldValue = mutation.oldValue) !== null && _mutation$oldValue !== void 0 ? _mutation$oldValue : undefined;
|
|
197
|
+
const newValue = mutation.attributeName ? mutation.target.getAttribute(mutation.attributeName) : undefined;
|
|
198
|
+
if (oldValue !== newValue) {
|
|
199
|
+
this.observeElement(mutation.target, mutation, 'attr', ignoreReason);
|
|
200
|
+
}
|
|
201
|
+
} else {
|
|
187
202
|
this.observeElement(mutation.target, mutation, 'attr', ignoreReason);
|
|
188
203
|
}
|
|
189
204
|
}
|
|
190
205
|
}
|
|
191
206
|
});
|
|
192
|
-
this.measureStop();
|
|
193
207
|
}) : null;
|
|
194
208
|
}
|
|
195
209
|
getElementName(element) {
|
|
@@ -235,10 +249,8 @@ export class Observers {
|
|
|
235
249
|
// ignore intersection report without recent mutation
|
|
236
250
|
return;
|
|
237
251
|
}
|
|
238
|
-
if (
|
|
239
|
-
|
|
240
|
-
data.ignoreReason = 'not-visible';
|
|
241
|
-
}
|
|
252
|
+
if (!isElementVisible(target)) {
|
|
253
|
+
data.ignoreReason = 'not-visible';
|
|
242
254
|
}
|
|
243
255
|
if (fg('platform_editor_ed-25937_ignore_mutations_for_ttvc')) {
|
|
244
256
|
if (isInsideEditorContainer(target)) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
2
|
import { FY25_01Classifier } from './fy25_01';
|
|
4
3
|
export class FY25_02Classifier extends FY25_01Classifier {
|
|
5
4
|
// @todo remove it once fixed as described: https://product-fabric.atlassian.net/browse/AFO-3443
|
|
@@ -7,21 +6,13 @@ export class FY25_02Classifier extends FY25_01Classifier {
|
|
|
7
6
|
componentsLog,
|
|
8
7
|
ttai
|
|
9
8
|
}) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
_componentsLog[timestamp] = value;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
} else {
|
|
21
|
-
_componentsLog = {
|
|
22
|
-
...componentsLog
|
|
23
|
-
};
|
|
24
|
-
}
|
|
9
|
+
const _componentsLog = {};
|
|
10
|
+
Object.entries(componentsLog).forEach(([_timestamp, value]) => {
|
|
11
|
+
const timestamp = Number(_timestamp);
|
|
12
|
+
if (Math.ceil(ttai) >= timestamp) {
|
|
13
|
+
_componentsLog[timestamp] = value;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
25
16
|
return _componentsLog;
|
|
26
17
|
}
|
|
27
18
|
constructor() {
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
1
2
|
import { revFY25_01Classifier } from './fy25_01';
|
|
2
3
|
import { revFY25_02Classifier } from './fy25_02';
|
|
3
|
-
const Revisions = [{
|
|
4
|
-
name: 'fy25.01',
|
|
5
|
-
classifier: revFY25_01Classifier
|
|
6
|
-
}, {
|
|
7
|
-
name: 'fy25.02',
|
|
8
|
-
classifier: revFY25_02Classifier
|
|
9
|
-
}];
|
|
10
|
-
let revisionResultCache = null;
|
|
11
4
|
export const getRevisions = () => {
|
|
12
|
-
if (
|
|
13
|
-
return
|
|
5
|
+
if (fg('platform_ufo_disable_ttvc_v1')) {
|
|
6
|
+
return [{
|
|
7
|
+
name: 'fy25.02',
|
|
8
|
+
classifier: revFY25_02Classifier
|
|
9
|
+
}];
|
|
14
10
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
return [{
|
|
12
|
+
name: 'fy25.01',
|
|
13
|
+
classifier: revFY25_01Classifier
|
|
14
|
+
}, {
|
|
15
|
+
name: 'fy25.02',
|
|
16
|
+
classifier: revFY25_02Classifier
|
|
17
|
+
}];
|
|
19
18
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
1
2
|
export default function createMutationObserver({
|
|
2
3
|
onAttributeMutation,
|
|
3
4
|
onChildListMutation,
|
|
@@ -15,11 +16,32 @@ export default function createMutationObserver({
|
|
|
15
16
|
continue;
|
|
16
17
|
}
|
|
17
18
|
if (mut.type === 'attributes') {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
if (fg('platform_ufo_vc_ignore_same_value_mutation')) {
|
|
20
|
+
var _mut$oldValue;
|
|
21
|
+
/*
|
|
22
|
+
"MutationObserver was explicitly designed to work that way, but I can't now recall the reasoning.
|
|
23
|
+
I think it might have been something along the lines that for consistency every setAttribute call should create a record.
|
|
24
|
+
Conceptually there is after all a mutation: there is an old value replaced with a new one,
|
|
25
|
+
and whether or not they are the same doesn't really matter.
|
|
26
|
+
And Custom elements should work the same way as MutationObserver."
|
|
27
|
+
https://github.com/whatwg/dom/issues/520#issuecomment-336574796
|
|
28
|
+
*/
|
|
29
|
+
const oldValue = (_mut$oldValue = mut.oldValue) !== null && _mut$oldValue !== void 0 ? _mut$oldValue : undefined;
|
|
30
|
+
const newValue = mut.attributeName ? mut.target.getAttribute(mut.attributeName) : undefined;
|
|
31
|
+
if (oldValue !== newValue) {
|
|
32
|
+
var _mut$attributeName;
|
|
33
|
+
onAttributeMutation({
|
|
34
|
+
target: mut.target,
|
|
35
|
+
attributeName: (_mut$attributeName = mut.attributeName) !== null && _mut$attributeName !== void 0 ? _mut$attributeName : 'unknown'
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
var _mut$attributeName2;
|
|
40
|
+
onAttributeMutation({
|
|
41
|
+
target: mut.target,
|
|
42
|
+
attributeName: (_mut$attributeName2 = mut.attributeName) !== null && _mut$attributeName2 !== void 0 ? _mut$attributeName2 : 'unknown'
|
|
43
|
+
});
|
|
44
|
+
}
|
|
23
45
|
continue;
|
|
24
46
|
} else if (mut.type === 'childList') {
|
|
25
47
|
var _mut$addedNodes, _mut$removedNodes;
|