@atlaskit/react-ufo 3.13.13 → 3.13.15
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 +22 -0
- package/dist/cjs/config/index.js +4 -4
- package/dist/cjs/create-payload/index.js +1 -2
- package/dist/cjs/create-payload/utils/get-ssr-done-time-value.js +1 -2
- package/dist/cjs/interaction-ignore/ufo-interaction-ignore.js +1 -2
- package/dist/cjs/interaction-metrics/index.js +10 -10
- package/dist/cjs/interaction-metrics-init/index.js +1 -2
- package/dist/cjs/label/UFOLabel.js +1 -2
- package/dist/cjs/load-hold/UFOLoadHold.js +1 -2
- package/dist/cjs/placeholder/Placeholder.js +1 -2
- package/dist/cjs/placeholder/loosely-lazy/lazy-suspense.js +1 -2
- package/dist/cjs/segment/segment-highlight.js +1 -2
- package/dist/cjs/segment/segment.js +1 -2
- package/dist/cjs/trace-transition/index.js +1 -2
- package/dist/cjs/vc/vc-observer/getVCRevisionsData.js +15 -5
- package/dist/cjs/vc/vc-observer/index.js +25 -25
- package/dist/cjs/vc/vc-observer/media-wrapper/index.js +1 -2
- package/dist/cjs/vc/vc-observer-new/index.js +1 -3
- package/dist/cjs/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +93 -90
- package/dist/cjs/vc/vc-observer-new/metric-calculator/fy25_03/index.js +1 -1
- package/dist/cjs/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/index.js +2 -2
- package/dist/cjs/vc/vc-observer-new/metric-calculator/percentile-calc/index.js +1 -2
- package/dist/es2019/interaction-metrics/index.js +10 -10
- package/dist/es2019/vc/vc-observer/getVCRevisionsData.js +15 -5
- package/dist/es2019/vc/vc-observer/index.js +3 -3
- package/dist/es2019/vc/vc-observer-new/index.js +1 -3
- package/dist/es2019/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +32 -19
- package/dist/es2019/vc/vc-observer-new/metric-calculator/fy25_03/index.js +1 -1
- package/dist/esm/config/index.js +4 -4
- package/dist/esm/interaction-metrics/index.js +10 -10
- package/dist/esm/vc/vc-observer/getVCRevisionsData.js +15 -5
- package/dist/esm/vc/vc-observer/index.js +25 -25
- package/dist/esm/vc/vc-observer-new/index.js +1 -3
- package/dist/esm/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +95 -92
- package/dist/esm/vc/vc-observer-new/metric-calculator/fy25_03/index.js +1 -1
- package/dist/esm/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/index.js +2 -2
- package/dist/types/common/vc/types.d.ts +1 -0
- package/dist/types/vc/vc-observer/getVCRevisionsData.d.ts +3 -2
- package/dist/types/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +4 -1
- package/dist/types-ts4.5/common/vc/types.d.ts +1 -0
- package/dist/types-ts4.5/vc/vc-observer/getVCRevisionsData.d.ts +3 -2
- package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +4 -1
- package/package.json +3 -9
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
13
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
@@ -28,52 +29,64 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
|
|
|
28
29
|
return 'rect' in entry.data;
|
|
29
30
|
});
|
|
30
31
|
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Calculate ratios for each element based on their viewport coverage.
|
|
35
|
+
*/
|
|
31
36
|
}, {
|
|
32
|
-
key: "
|
|
33
|
-
value: function () {
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
percentiles: percentiles
|
|
51
|
-
});
|
|
52
|
-
case 4:
|
|
53
|
-
vcLogs = _context.sent;
|
|
54
|
-
return _context.abrupt("return", vcLogs);
|
|
55
|
-
case 6:
|
|
56
|
-
case "end":
|
|
57
|
-
return _context.stop();
|
|
37
|
+
key: "calculateRatios",
|
|
38
|
+
value: function calculateRatios(filteredEntries) {
|
|
39
|
+
var ratios = {};
|
|
40
|
+
var viewportWidth = (0, _getViewportWidth.default)();
|
|
41
|
+
var viewportHeight = (0, _getViewportHeight.default)();
|
|
42
|
+
var totalViewportArea = viewportWidth * viewportHeight;
|
|
43
|
+
if (totalViewportArea === 0) {
|
|
44
|
+
return ratios;
|
|
45
|
+
}
|
|
46
|
+
var elementRects = new Map();
|
|
47
|
+
var _iterator = _createForOfIteratorHelper(filteredEntries),
|
|
48
|
+
_step;
|
|
49
|
+
try {
|
|
50
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
51
|
+
var _entry = _step.value;
|
|
52
|
+
if ('rect' in _entry.data) {
|
|
53
|
+
var viewportEntry = _entry.data;
|
|
54
|
+
elementRects.set(viewportEntry.elementName, viewportEntry.rect);
|
|
58
55
|
}
|
|
59
|
-
}
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
}
|
|
57
|
+
} catch (err) {
|
|
58
|
+
_iterator.e(err);
|
|
59
|
+
} finally {
|
|
60
|
+
_iterator.f();
|
|
63
61
|
}
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
var _iterator2 = _createForOfIteratorHelper(elementRects),
|
|
63
|
+
_step2;
|
|
64
|
+
try {
|
|
65
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
66
|
+
var _step2$value = (0, _slicedToArray2.default)(_step2.value, 2),
|
|
67
|
+
elementName = _step2$value[0],
|
|
68
|
+
rect = _step2$value[1];
|
|
69
|
+
var elementArea = rect.width * rect.height;
|
|
70
|
+
ratios[elementName] = elementArea / totalViewportArea;
|
|
71
|
+
}
|
|
72
|
+
} catch (err) {
|
|
73
|
+
_iterator2.e(err);
|
|
74
|
+
} finally {
|
|
75
|
+
_iterator2.f();
|
|
76
|
+
}
|
|
77
|
+
return ratios;
|
|
78
|
+
}
|
|
66
79
|
}, {
|
|
67
80
|
key: "calculateWithDebugInfo",
|
|
68
81
|
value: function () {
|
|
69
|
-
var _calculateWithDebugInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
70
|
-
var percentiles, viewportEntries, vcLogs, vcDetails, percentileIndex, entryDataBuffer,
|
|
71
|
-
return _regenerator.default.wrap(function
|
|
72
|
-
while (1) switch (
|
|
82
|
+
var _calculateWithDebugInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason) {
|
|
83
|
+
var percentiles, viewportEntries, vcLogs, vcDetails, percentileIndex, entryDataBuffer, _iterator3, _step3, _entry2, time, viewportPercentage, entries, elementNames, previousResult, i, percentile, _ufo_devtool_onVCRev, _ref;
|
|
84
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
85
|
+
while (1) switch (_context.prev = _context.next) {
|
|
73
86
|
case 0:
|
|
74
87
|
percentiles = [25, 50, 75, 80, 85, 90, 95, 98, 99];
|
|
75
88
|
viewportEntries = this.filterViewportEntries(filteredEntries);
|
|
76
|
-
|
|
89
|
+
_context.next = 4;
|
|
77
90
|
return (0, _percentileCalc.calculateTTVCPercentilesWithDebugInfo)({
|
|
78
91
|
viewport: {
|
|
79
92
|
width: (0, _getViewportWidth.default)(),
|
|
@@ -84,29 +97,29 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
|
|
|
84
97
|
orderedEntries: viewportEntries
|
|
85
98
|
});
|
|
86
99
|
case 4:
|
|
87
|
-
vcLogs =
|
|
100
|
+
vcLogs = _context.sent;
|
|
88
101
|
vcDetails = {};
|
|
89
102
|
percentileIndex = 0;
|
|
90
103
|
entryDataBuffer = new Set();
|
|
91
104
|
if (!vcLogs) {
|
|
92
|
-
|
|
105
|
+
_context.next = 28;
|
|
93
106
|
break;
|
|
94
107
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
108
|
+
_iterator3 = _createForOfIteratorHelper(vcLogs);
|
|
109
|
+
_context.prev = 10;
|
|
110
|
+
_iterator3.s();
|
|
98
111
|
case 12:
|
|
99
|
-
if ((
|
|
100
|
-
|
|
112
|
+
if ((_step3 = _iterator3.n()).done) {
|
|
113
|
+
_context.next = 20;
|
|
101
114
|
break;
|
|
102
115
|
}
|
|
103
|
-
|
|
104
|
-
time =
|
|
116
|
+
_entry2 = _step3.value;
|
|
117
|
+
time = _entry2.time, viewportPercentage = _entry2.viewportPercentage, entries = _entry2.entries; // Only process entries if we haven't reached all percentiles
|
|
105
118
|
if (!(percentileIndex >= percentiles.length)) {
|
|
106
|
-
|
|
119
|
+
_context.next = 17;
|
|
107
120
|
break;
|
|
108
121
|
}
|
|
109
|
-
return
|
|
122
|
+
return _context.abrupt("break", 20);
|
|
110
123
|
case 17:
|
|
111
124
|
// Check if this entry matches any checkpoint percentiles
|
|
112
125
|
if (viewportPercentage >= percentiles[percentileIndex]) {
|
|
@@ -130,19 +143,19 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
|
|
|
130
143
|
});
|
|
131
144
|
}
|
|
132
145
|
case 18:
|
|
133
|
-
|
|
146
|
+
_context.next = 12;
|
|
134
147
|
break;
|
|
135
148
|
case 20:
|
|
136
|
-
|
|
149
|
+
_context.next = 25;
|
|
137
150
|
break;
|
|
138
151
|
case 22:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
152
|
+
_context.prev = 22;
|
|
153
|
+
_context.t0 = _context["catch"](10);
|
|
154
|
+
_iterator3.e(_context.t0);
|
|
142
155
|
case 25:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
return
|
|
156
|
+
_context.prev = 25;
|
|
157
|
+
_iterator3.f();
|
|
158
|
+
return _context.finish(25);
|
|
146
159
|
case 28:
|
|
147
160
|
// Fill in any missing percentiles with the last known values
|
|
148
161
|
previousResult = {
|
|
@@ -159,7 +172,7 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
|
|
|
159
172
|
}
|
|
160
173
|
|
|
161
174
|
// Handle devtool callback
|
|
162
|
-
if (!isPostInteraction && typeof window !== 'undefined' && typeof window.__ufo_devtool_onVCRevisionReady__ === 'function'
|
|
175
|
+
if (!isPostInteraction && typeof window !== 'undefined' && typeof window.__ufo_devtool_onVCRevisionReady__ === 'function') {
|
|
163
176
|
try {
|
|
164
177
|
(_ufo_devtool_onVCRev = (_ref = window).__ufo_devtool_onVCRevisionReady__) === null || _ufo_devtool_onVCRev === void 0 || _ufo_devtool_onVCRev.call(_ref, {
|
|
165
178
|
revision: this.revisionNo,
|
|
@@ -174,14 +187,14 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
|
|
|
174
187
|
console.error('Error in onVCRevisionReady', e);
|
|
175
188
|
}
|
|
176
189
|
}
|
|
177
|
-
return
|
|
190
|
+
return _context.abrupt("return", vcDetails);
|
|
178
191
|
case 32:
|
|
179
192
|
case "end":
|
|
180
|
-
return
|
|
193
|
+
return _context.stop();
|
|
181
194
|
}
|
|
182
|
-
},
|
|
195
|
+
}, _callee, this, [[10, 22, 25, 28]]);
|
|
183
196
|
}));
|
|
184
|
-
function calculateWithDebugInfo(
|
|
197
|
+
function calculateWithDebugInfo(_x, _x2, _x3, _x4, _x5, _x6, _x7) {
|
|
185
198
|
return _calculateWithDebugInfo.apply(this, arguments);
|
|
186
199
|
}
|
|
187
200
|
return calculateWithDebugInfo;
|
|
@@ -189,13 +202,13 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
|
|
|
189
202
|
}, {
|
|
190
203
|
key: "calculate",
|
|
191
204
|
value: function () {
|
|
192
|
-
var _calculate = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
205
|
+
var _calculate = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(_ref2) {
|
|
193
206
|
var _this = this,
|
|
194
207
|
_vcDetails$90$t,
|
|
195
208
|
_vcDetails$;
|
|
196
|
-
var startTime, stopTime, orderedEntries, interactionId, isPostInteraction, filteredEntries, isVCClean, dirtyReason, getVCCleanStatusResult,
|
|
197
|
-
return _regenerator.default.wrap(function
|
|
198
|
-
while (1) switch (
|
|
209
|
+
var startTime, stopTime, orderedEntries, interactionId, isPostInteraction, filteredEntries, isVCClean, dirtyReason, getVCCleanStatusResult, vcDetails, result;
|
|
210
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
211
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
199
212
|
case 0:
|
|
200
213
|
startTime = _ref2.startTime, stopTime = _ref2.stopTime, orderedEntries = _ref2.orderedEntries, interactionId = _ref2.interactionId, isPostInteraction = _ref2.isPostInteraction;
|
|
201
214
|
filteredEntries = orderedEntries.filter(function (entry) {
|
|
@@ -205,47 +218,37 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
|
|
|
205
218
|
isVCClean = getVCCleanStatusResult.isVCClean;
|
|
206
219
|
dirtyReason = getVCCleanStatusResult.dirtyReason;
|
|
207
220
|
if (isVCClean) {
|
|
208
|
-
|
|
221
|
+
_context2.next = 7;
|
|
209
222
|
break;
|
|
210
223
|
}
|
|
211
|
-
return
|
|
224
|
+
return _context2.abrupt("return", {
|
|
212
225
|
revision: this.revisionNo,
|
|
213
226
|
'metric:vc90': null,
|
|
214
227
|
clean: false,
|
|
215
228
|
abortReason: dirtyReason
|
|
216
229
|
});
|
|
217
230
|
case 7:
|
|
218
|
-
|
|
219
|
-
if (!useDebugInfo) {
|
|
220
|
-
_context3.next = 14;
|
|
221
|
-
break;
|
|
222
|
-
}
|
|
223
|
-
_context3.next = 11;
|
|
231
|
+
_context2.next = 9;
|
|
224
232
|
return this.calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason);
|
|
225
|
-
case
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
break;
|
|
229
|
-
case 14:
|
|
230
|
-
_context3.next = 16;
|
|
231
|
-
return this.calculateBasic(filteredEntries, startTime, stopTime);
|
|
232
|
-
case 16:
|
|
233
|
-
_context3.t0 = _context3.sent;
|
|
234
|
-
case 17:
|
|
235
|
-
vcDetails = _context3.t0;
|
|
236
|
-
return _context3.abrupt("return", {
|
|
233
|
+
case 9:
|
|
234
|
+
vcDetails = _context2.sent;
|
|
235
|
+
result = {
|
|
237
236
|
revision: this.revisionNo,
|
|
238
237
|
clean: true,
|
|
239
238
|
'metric:vc90': (_vcDetails$90$t = vcDetails === null || vcDetails === void 0 || (_vcDetails$ = vcDetails['90']) === null || _vcDetails$ === void 0 ? void 0 : _vcDetails$.t) !== null && _vcDetails$90$t !== void 0 ? _vcDetails$90$t : null,
|
|
240
239
|
vcDetails: vcDetails !== null && vcDetails !== void 0 ? vcDetails : undefined
|
|
241
|
-
}
|
|
242
|
-
|
|
240
|
+
};
|
|
241
|
+
if ((0, _platformFeatureFlags.fg)('platform_ufo_rev_ratios')) {
|
|
242
|
+
result.ratios = this.calculateRatios(filteredEntries);
|
|
243
|
+
}
|
|
244
|
+
return _context2.abrupt("return", result);
|
|
245
|
+
case 13:
|
|
243
246
|
case "end":
|
|
244
|
-
return
|
|
247
|
+
return _context2.stop();
|
|
245
248
|
}
|
|
246
|
-
},
|
|
249
|
+
}, _callee2, this);
|
|
247
250
|
}));
|
|
248
|
-
function calculate(
|
|
251
|
+
function calculate(_x8) {
|
|
249
252
|
return _calculate.apply(this, arguments);
|
|
250
253
|
}
|
|
251
254
|
return calculate;
|
|
@@ -47,7 +47,7 @@ var VCCalculator_FY25_03 = exports.default = /*#__PURE__*/function (_AbstractVCC
|
|
|
47
47
|
if (attributeName === 'data-aui-version' && (0, _platformFeatureFlags.fg)('platform_ufo_filter_out_aui_attribute_changes')) {
|
|
48
48
|
return false;
|
|
49
49
|
}
|
|
50
|
-
if (
|
|
50
|
+
if (attributeName === 'data-testid' || attributeName === 'data-vc' || attributeName === 'data-ssr-placeholder' || attributeName === 'data-ssr-placeholder-replace' || attributeName === 'data-vc-nvs' || attributeName === 'data-media-vc-wrapper' || attributeName === 'data-auto-scrollable' || attributeName === 'id' || attributeName === 'tabindex' || NON_VISUAL_ARIA_ATTRIBUTES.includes(attributeName)) {
|
|
51
51
|
return false;
|
|
52
52
|
}
|
|
53
53
|
return true;
|
package/dist/cjs/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/index.js
CHANGED
|
@@ -214,8 +214,8 @@ function calculatePercentilesWithDebugInfo(timePixelCounts, elementMap, totalPix
|
|
|
214
214
|
var sortedEntries = Array.from(timePixelCounts.entries()).sort(function (_ref7, _ref8) {
|
|
215
215
|
var _ref9 = (0, _slicedToArray2.default)(_ref7, 1),
|
|
216
216
|
timeA = _ref9[0];
|
|
217
|
-
var
|
|
218
|
-
timeB =
|
|
217
|
+
var _ref0 = (0, _slicedToArray2.default)(_ref8, 1),
|
|
218
|
+
timeB = _ref0[0];
|
|
219
219
|
return Number(timeA) - Number(timeB);
|
|
220
220
|
});
|
|
221
221
|
for (var i = 0; i < sortedEntries.length; i++) {
|
|
@@ -17,5 +17,4 @@ Object.defineProperty(exports, "calculateTTVCPercentilesWithDebugInfo", {
|
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
var _canvasHeatmap = _interopRequireWildcard(require("./canvas-heatmap"));
|
|
20
|
-
function
|
|
21
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
@@ -581,11 +581,11 @@ function callCancelCallbacks(interaction) {
|
|
|
581
581
|
export function abort(interactionId, abortReason) {
|
|
582
582
|
const interaction = interactions.get(interactionId);
|
|
583
583
|
if (interaction != null) {
|
|
584
|
-
var
|
|
584
|
+
var _getConfig0, _getConfig0$experimen;
|
|
585
585
|
callCancelCallbacks(interaction);
|
|
586
586
|
interaction.abortReason = abortReason;
|
|
587
587
|
finishInteraction(interactionId, interaction);
|
|
588
|
-
if ((
|
|
588
|
+
if ((_getConfig0 = getConfig()) !== null && _getConfig0 !== void 0 && (_getConfig0$experimen = _getConfig0.experimentalInteractionMetrics) !== null && _getConfig0$experimen !== void 0 && _getConfig0$experimen.enabled) {
|
|
589
589
|
onExperimentalInteractionComplete(interactionId, interaction);
|
|
590
590
|
remove(interactionId);
|
|
591
591
|
}
|
|
@@ -594,12 +594,12 @@ export function abort(interactionId, abortReason) {
|
|
|
594
594
|
export function abortByNewInteraction(interactionId, interactionName) {
|
|
595
595
|
const interaction = interactions.get(interactionId);
|
|
596
596
|
if (interaction != null) {
|
|
597
|
-
var
|
|
597
|
+
var _getConfig1, _getConfig1$experimen;
|
|
598
598
|
callCancelCallbacks(interaction);
|
|
599
599
|
interaction.abortReason = 'new_interaction';
|
|
600
600
|
interaction.abortedByInteractionName = interactionName;
|
|
601
601
|
finishInteraction(interactionId, interaction);
|
|
602
|
-
if ((
|
|
602
|
+
if ((_getConfig1 = getConfig()) !== null && _getConfig1 !== void 0 && (_getConfig1$experimen = _getConfig1.experimentalInteractionMetrics) !== null && _getConfig1$experimen !== void 0 && _getConfig1$experimen.enabled) {
|
|
603
603
|
onExperimentalInteractionComplete(interactionId, interaction);
|
|
604
604
|
remove(interactionId);
|
|
605
605
|
}
|
|
@@ -607,7 +607,7 @@ export function abortByNewInteraction(interactionId, interactionName) {
|
|
|
607
607
|
}
|
|
608
608
|
export function abortAll(abortReason, abortedByInteractionName) {
|
|
609
609
|
interactions.forEach((interaction, interactionId) => {
|
|
610
|
-
var
|
|
610
|
+
var _getConfig10, _getConfig10$experime;
|
|
611
611
|
const noMoreHolds = interaction.holdActive.size === 0;
|
|
612
612
|
if (!noMoreHolds) {
|
|
613
613
|
callCancelCallbacks(interaction);
|
|
@@ -617,7 +617,7 @@ export function abortAll(abortReason, abortedByInteractionName) {
|
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
619
|
finishInteraction(interactionId, interaction);
|
|
620
|
-
if ((
|
|
620
|
+
if ((_getConfig10 = getConfig()) !== null && _getConfig10 !== void 0 && (_getConfig10$experime = _getConfig10.experimentalInteractionMetrics) !== null && _getConfig10$experime !== void 0 && _getConfig10$experime.enabled) {
|
|
621
621
|
onExperimentalInteractionComplete(interactionId, interaction);
|
|
622
622
|
remove(interactionId);
|
|
623
623
|
}
|
|
@@ -628,8 +628,8 @@ export function addOnCancelCallback(id, cancelCallback) {
|
|
|
628
628
|
interaction === null || interaction === void 0 ? void 0 : interaction.cancelCallbacks.push(cancelCallback);
|
|
629
629
|
}
|
|
630
630
|
export function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelStack, routeName, trace = null) {
|
|
631
|
-
var
|
|
632
|
-
if ((
|
|
631
|
+
var _getConfig11, _getConfig11$postInte;
|
|
632
|
+
if ((_getConfig11 = getConfig()) !== null && _getConfig11 !== void 0 && (_getConfig11$postInte = _getConfig11.postInteractionLog) !== null && _getConfig11$postInte !== void 0 && _getConfig11$postInte.enabled) {
|
|
633
633
|
postInteractionLog.reset();
|
|
634
634
|
}
|
|
635
635
|
let previousTime = startTime;
|
|
@@ -717,7 +717,7 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
|
|
|
717
717
|
addHoldByID(interactionId, [], ufoName, ufoName, true);
|
|
718
718
|
}
|
|
719
719
|
if (type === 'transition') {
|
|
720
|
-
var
|
|
720
|
+
var _getConfig12, _getConfig12$experime;
|
|
721
721
|
getVCObserver().start({
|
|
722
722
|
startTime,
|
|
723
723
|
experienceKey: ufoName
|
|
@@ -725,7 +725,7 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
|
|
|
725
725
|
postInteractionLog.startVCObserver({
|
|
726
726
|
startTime
|
|
727
727
|
});
|
|
728
|
-
if ((
|
|
728
|
+
if ((_getConfig12 = getConfig()) !== null && _getConfig12 !== void 0 && (_getConfig12$experime = _getConfig12.experimentalInteractionMetrics) !== null && _getConfig12$experime !== void 0 && _getConfig12$experime.enabled) {
|
|
729
729
|
experimentalVC.start({
|
|
730
730
|
startTime
|
|
731
731
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
1
2
|
import { isVCRevisionEnabled } from '../../config';
|
|
2
3
|
import { getPageVisibilityState } from '../../hidden-timing';
|
|
3
4
|
const VCParts = ['25', '50', '75', '80', '85', '90', '95', '98', '99'];
|
|
@@ -33,27 +34,36 @@ export function getVCRevisionsData({
|
|
|
33
34
|
isEventAborted,
|
|
34
35
|
calculatedVC,
|
|
35
36
|
calculatedVCNext,
|
|
36
|
-
experienceKey
|
|
37
|
+
experienceKey,
|
|
38
|
+
ratios
|
|
37
39
|
}) {
|
|
38
40
|
const pageVisibilityUpToTTAI = getPageVisibilityState(interaction.start, interaction.end);
|
|
39
41
|
const isVisiblePageVisibleUpToTTAI = pageVisibilityUpToTTAI === 'visible';
|
|
40
42
|
const shouldHaveVCmetric = isVCClean && !isEventAborted && isVisiblePageVisibleUpToTTAI;
|
|
41
43
|
const availableVCRevisionPayloads = [];
|
|
42
44
|
if (isVCRevisionEnabled('fy25.01', experienceKey)) {
|
|
43
|
-
|
|
45
|
+
const revision = {
|
|
44
46
|
revision: 'fy25.01',
|
|
45
47
|
clean: isVCClean,
|
|
46
48
|
'metric:vc90': shouldHaveVCmetric ? calculatedVC.VC['90'] : null,
|
|
47
49
|
vcDetails: createVCDetails(calculatedVC, shouldHaveVCmetric)
|
|
48
|
-
}
|
|
50
|
+
};
|
|
51
|
+
if (shouldHaveVCmetric && fg('platform_ufo_rev_ratios')) {
|
|
52
|
+
revision.ratios = ratios;
|
|
53
|
+
}
|
|
54
|
+
availableVCRevisionPayloads.push(revision);
|
|
49
55
|
}
|
|
50
56
|
if (isVCRevisionEnabled('fy25.02', experienceKey)) {
|
|
51
|
-
|
|
57
|
+
const revision = {
|
|
52
58
|
revision: 'fy25.02',
|
|
53
59
|
clean: isVCClean,
|
|
54
60
|
'metric:vc90': shouldHaveVCmetric ? calculatedVCNext.VC['90'] : null,
|
|
55
61
|
vcDetails: createVCDetails(calculatedVCNext, shouldHaveVCmetric)
|
|
56
|
-
}
|
|
62
|
+
};
|
|
63
|
+
if (shouldHaveVCmetric && fg('platform_ufo_rev_ratios')) {
|
|
64
|
+
revision.ratios = ratios;
|
|
65
|
+
}
|
|
66
|
+
availableVCRevisionPayloads.push(revision);
|
|
57
67
|
}
|
|
58
68
|
return {
|
|
59
69
|
[`${fullPrefix}vc:rev`]: availableVCRevisionPayloads
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
2
|
import { isVCRevisionEnabled } from '../../config';
|
|
4
3
|
import { getActiveInteraction } from '../../interaction-metrics';
|
|
5
4
|
import { attachAbortListeners } from './attachAbortListeners';
|
|
@@ -284,7 +283,7 @@ export class VCObserver {
|
|
|
284
283
|
}));
|
|
285
284
|
|
|
286
285
|
// Add devtool callback for both v1 and v2
|
|
287
|
-
if (typeof window.__ufo_devtool_onVCRevisionReady__ === 'function'
|
|
286
|
+
if (typeof window.__ufo_devtool_onVCRevisionReady__ === 'function') {
|
|
288
287
|
var _ufo_devtool_onVCRev2, _ref2;
|
|
289
288
|
// Handle v1 if not disabled
|
|
290
289
|
if (!isTTVCv1Disabled) {
|
|
@@ -330,7 +329,8 @@ export class VCObserver {
|
|
|
330
329
|
VCBox: vcNext.VCBox
|
|
331
330
|
},
|
|
332
331
|
isEventAborted,
|
|
333
|
-
experienceKey
|
|
332
|
+
experienceKey,
|
|
333
|
+
ratios
|
|
334
334
|
});
|
|
335
335
|
const speedIndex = {
|
|
336
336
|
[`ufo:speedIndex`]: isTTVCv1Disabled ? vcNext.VCEntries.speedIndex : VCEntries.speedIndex,
|
|
@@ -103,9 +103,7 @@ export default class VCObserverNew {
|
|
|
103
103
|
interactionId
|
|
104
104
|
} = param;
|
|
105
105
|
const results = [];
|
|
106
|
-
|
|
107
|
-
this.addStartEntry(start);
|
|
108
|
-
}
|
|
106
|
+
this.addStartEntry(start);
|
|
109
107
|
const calculator_fy25_03 = new VCCalculator_FY25_03();
|
|
110
108
|
const orderedEntries = this.entriesTimeline.getOrderedEntries({
|
|
111
109
|
start,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
-
import {
|
|
2
|
+
import { calculateTTVCPercentilesWithDebugInfo } from './percentile-calc';
|
|
3
3
|
import getViewportHeight from './utils/get-viewport-height';
|
|
4
4
|
import getViewportWidth from './utils/get-viewport-width';
|
|
5
5
|
export default class AbstractVCCalculatorBase {
|
|
@@ -11,20 +11,30 @@ export default class AbstractVCCalculatorBase {
|
|
|
11
11
|
return 'rect' in entry.data;
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Calculate ratios for each element based on their viewport coverage.
|
|
17
|
+
*/
|
|
18
|
+
calculateRatios(filteredEntries) {
|
|
19
|
+
const ratios = {};
|
|
20
|
+
const viewportWidth = getViewportWidth();
|
|
21
|
+
const viewportHeight = getViewportHeight();
|
|
22
|
+
const totalViewportArea = viewportWidth * viewportHeight;
|
|
23
|
+
if (totalViewportArea === 0) {
|
|
24
|
+
return ratios;
|
|
25
|
+
}
|
|
26
|
+
const elementRects = new Map();
|
|
27
|
+
for (const entry of filteredEntries) {
|
|
28
|
+
if ('rect' in entry.data) {
|
|
29
|
+
const viewportEntry = entry.data;
|
|
30
|
+
elementRects.set(viewportEntry.elementName, viewportEntry.rect);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
for (const [elementName, rect] of elementRects) {
|
|
34
|
+
const elementArea = rect.width * rect.height;
|
|
35
|
+
ratios[elementName] = elementArea / totalViewportArea;
|
|
36
|
+
}
|
|
37
|
+
return ratios;
|
|
28
38
|
}
|
|
29
39
|
async calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason) {
|
|
30
40
|
const percentiles = [25, 50, 75, 80, 85, 90, 95, 98, 99];
|
|
@@ -91,7 +101,7 @@ export default class AbstractVCCalculatorBase {
|
|
|
91
101
|
}
|
|
92
102
|
|
|
93
103
|
// Handle devtool callback
|
|
94
|
-
if (!isPostInteraction && typeof window !== 'undefined' && typeof window.__ufo_devtool_onVCRevisionReady__ === 'function'
|
|
104
|
+
if (!isPostInteraction && typeof window !== 'undefined' && typeof window.__ufo_devtool_onVCRevisionReady__ === 'function') {
|
|
95
105
|
try {
|
|
96
106
|
var _ufo_devtool_onVCRev, _ref;
|
|
97
107
|
(_ufo_devtool_onVCRev = (_ref = window).__ufo_devtool_onVCRevisionReady__) === null || _ufo_devtool_onVCRev === void 0 ? void 0 : _ufo_devtool_onVCRev.call(_ref, {
|
|
@@ -133,13 +143,16 @@ export default class AbstractVCCalculatorBase {
|
|
|
133
143
|
abortReason: dirtyReason
|
|
134
144
|
};
|
|
135
145
|
}
|
|
136
|
-
const
|
|
137
|
-
const
|
|
138
|
-
return {
|
|
146
|
+
const vcDetails = await this.calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason);
|
|
147
|
+
const result = {
|
|
139
148
|
revision: this.revisionNo,
|
|
140
149
|
clean: true,
|
|
141
150
|
'metric:vc90': (_vcDetails$90$t = vcDetails === null || vcDetails === void 0 ? void 0 : (_vcDetails$ = vcDetails['90']) === null || _vcDetails$ === void 0 ? void 0 : _vcDetails$.t) !== null && _vcDetails$90$t !== void 0 ? _vcDetails$90$t : null,
|
|
142
151
|
vcDetails: vcDetails !== null && vcDetails !== void 0 ? vcDetails : undefined
|
|
143
152
|
};
|
|
153
|
+
if (fg('platform_ufo_rev_ratios')) {
|
|
154
|
+
result.ratios = this.calculateRatios(filteredEntries);
|
|
155
|
+
}
|
|
156
|
+
return result;
|
|
144
157
|
}
|
|
145
158
|
}
|
|
@@ -29,7 +29,7 @@ export default class VCCalculator_FY25_03 extends AbstractVCCalculatorBase {
|
|
|
29
29
|
if (attributeName === 'data-aui-version' && fg('platform_ufo_filter_out_aui_attribute_changes')) {
|
|
30
30
|
return false;
|
|
31
31
|
}
|
|
32
|
-
if (
|
|
32
|
+
if (attributeName === 'data-testid' || attributeName === 'data-vc' || attributeName === 'data-ssr-placeholder' || attributeName === 'data-ssr-placeholder-replace' || attributeName === 'data-vc-nvs' || attributeName === 'data-media-vc-wrapper' || attributeName === 'data-auto-scrollable' || attributeName === 'id' || attributeName === 'tabindex' || NON_VISUAL_ARIA_ATTRIBUTES.includes(attributeName)) {
|
|
33
33
|
return false;
|
|
34
34
|
}
|
|
35
35
|
return true;
|
package/dist/esm/config/index.js
CHANGED
|
@@ -283,8 +283,8 @@ export function getDoNotAbortActivePressInteraction() {
|
|
|
283
283
|
if (!config) {
|
|
284
284
|
return undefined;
|
|
285
285
|
}
|
|
286
|
-
var
|
|
287
|
-
doNotAbortActivePressInteraction =
|
|
286
|
+
var _config0 = config,
|
|
287
|
+
doNotAbortActivePressInteraction = _config0.doNotAbortActivePressInteraction;
|
|
288
288
|
return doNotAbortActivePressInteraction;
|
|
289
289
|
} catch (e) {
|
|
290
290
|
return undefined;
|
|
@@ -297,8 +297,8 @@ export function getDoNotAbortActivePressInteractionOnTransition() {
|
|
|
297
297
|
if (!config) {
|
|
298
298
|
return undefined;
|
|
299
299
|
}
|
|
300
|
-
var
|
|
301
|
-
doNotAbortActivePressInteractionOnTransition =
|
|
300
|
+
var _config1 = config,
|
|
301
|
+
doNotAbortActivePressInteractionOnTransition = _config1.doNotAbortActivePressInteractionOnTransition;
|
|
302
302
|
return doNotAbortActivePressInteractionOnTransition;
|
|
303
303
|
} catch (e) {
|
|
304
304
|
return undefined;
|