@atlaskit/react-ufo 4.13.0 → 4.14.0
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 +14 -0
- package/dist/cjs/create-payload/index.js +12 -9
- package/dist/cjs/create-payload/utils/get-battery-info.js +97 -0
- package/dist/cjs/vc/vc-observer-new/metric-calculator/fy25_03/index.js +1 -0
- package/dist/cjs/vc/vc-observer-new/viewport-observer/index.js +17 -19
- package/dist/es2019/create-payload/index.js +3 -1
- package/dist/es2019/create-payload/utils/get-battery-info.js +42 -0
- package/dist/es2019/vc/vc-observer-new/metric-calculator/fy25_03/index.js +1 -0
- package/dist/es2019/vc/vc-observer-new/viewport-observer/index.js +14 -15
- package/dist/esm/create-payload/index.js +12 -9
- package/dist/esm/create-payload/utils/get-battery-info.js +93 -0
- package/dist/esm/vc/vc-observer-new/metric-calculator/fy25_03/index.js +1 -0
- package/dist/esm/vc/vc-observer-new/viewport-observer/index.js +13 -15
- package/dist/types/create-payload/index.d.ts +192 -0
- package/dist/types/create-payload/utils/get-battery-info.d.ts +10 -0
- package/dist/types/vc/vc-observer-new/types.d.ts +1 -1
- package/dist/types-ts4.5/create-payload/index.d.ts +192 -0
- package/dist/types-ts4.5/create-payload/utils/get-battery-info.d.ts +10 -0
- package/dist/types-ts4.5/vc/vc-observer-new/types.d.ts +1 -1
- package/package.json +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/ufo-interaction-ignore
|
|
2
2
|
|
|
3
|
+
## 4.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`55c867098e0ab`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/55c867098e0ab) -
|
|
8
|
+
Added battery info and webdriver
|
|
9
|
+
|
|
10
|
+
## 4.13.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`8dedd89369b84`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8dedd89369b84) -
|
|
15
|
+
Exclude 3p from attribute change behind feature gate
|
|
16
|
+
|
|
3
17
|
## 4.13.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -35,6 +35,7 @@ var ssr = _interopRequireWildcard(require("../ssr"));
|
|
|
35
35
|
var _utils = require("./common/utils");
|
|
36
36
|
var _criticalMetricsPayload = require("./critical-metrics-payload");
|
|
37
37
|
var _addPerformanceMeasures = require("./utils/add-performance-measures");
|
|
38
|
+
var _getBatteryInfo = require("./utils/get-battery-info");
|
|
38
39
|
var _getBrowserMetadata = require("./utils/get-browser-metadata");
|
|
39
40
|
var _getInteractionStatus = _interopRequireDefault(require("./utils/get-interaction-status"));
|
|
40
41
|
var _getMoreAccuratePageVisibilityUpToTtai = require("./utils/get-more-accurate-page-visibility-up-to-ttai");
|
|
@@ -397,7 +398,7 @@ function createInteractionMetricsPayload(_x, _x2, _x3, _x4, _x5) {
|
|
|
397
398
|
function _createInteractionMetricsPayload() {
|
|
398
399
|
_createInteractionMetricsPayload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(interaction, interactionId, experimental, criticalPayloadCount, vcMetrics) {
|
|
399
400
|
var _window$location, _config$additionalPay;
|
|
400
|
-
var interactionPayloadStart, config, end, start, ufoName, knownSegments, rate, type, abortReason, routeName, featureFlags, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, responsiveness, unknownElementName, unknownElementHierarchy, hydration, pageVisibilityAtTTI, pageVisibilityAtTTAI, segments, segmentTree, isDetailedPayload, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTI, moreAccuratePageVisibilityAtTTAI, labelStack, getInitialPageLoadSSRMetrics, pageLoadInteractionMetrics, getDetailedInteractionMetrics, getPageLoadDetailedInteractionMetrics, newUFOName, resourceTimings, _yield$Promise$all, _yield$Promise$all2, finalVCMetrics, experimentalMetrics, paintMetrics, getReactHydrationStats, payload;
|
|
401
|
+
var interactionPayloadStart, config, end, start, ufoName, knownSegments, rate, type, abortReason, routeName, featureFlags, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, responsiveness, unknownElementName, unknownElementHierarchy, hydration, pageVisibilityAtTTI, pageVisibilityAtTTAI, segments, segmentTree, isDetailedPayload, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTI, moreAccuratePageVisibilityAtTTAI, labelStack, getInitialPageLoadSSRMetrics, pageLoadInteractionMetrics, getDetailedInteractionMetrics, getPageLoadDetailedInteractionMetrics, newUFOName, resourceTimings, _yield$Promise$all, _yield$Promise$all2, finalVCMetrics, experimentalMetrics, paintMetrics, batteryInfo, getReactHydrationStats, payload;
|
|
401
402
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
402
403
|
while (1) switch (_context.prev = _context.next) {
|
|
403
404
|
case 0:
|
|
@@ -510,15 +511,17 @@ function _createInteractionMetricsPayload() {
|
|
|
510
511
|
_context.t2 = _context.t1;
|
|
511
512
|
_context.t3 = experimental ? (0, _createExperimentalInteractionMetricsPayload.getExperimentalVCMetrics)(interaction) : Promise.resolve(undefined);
|
|
512
513
|
_context.t4 = (0, _getPaintMetrics.getPaintMetricsToLegacyFormat)(type, end);
|
|
513
|
-
_context.t5 =
|
|
514
|
-
_context.
|
|
515
|
-
|
|
516
|
-
|
|
514
|
+
_context.t5 = (0, _getBatteryInfo.getBatteryInfoToLegacyFormat)();
|
|
515
|
+
_context.t6 = [_context.t2, _context.t3, _context.t4, _context.t5];
|
|
516
|
+
_context.next = 35;
|
|
517
|
+
return _context.t0.all.call(_context.t0, _context.t6);
|
|
518
|
+
case 35:
|
|
517
519
|
_yield$Promise$all = _context.sent;
|
|
518
|
-
_yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all,
|
|
520
|
+
_yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 4);
|
|
519
521
|
finalVCMetrics = _yield$Promise$all2[0];
|
|
520
522
|
experimentalMetrics = _yield$Promise$all2[1];
|
|
521
523
|
paintMetrics = _yield$Promise$all2[2];
|
|
524
|
+
batteryInfo = _yield$Promise$all2[3];
|
|
522
525
|
if (!experimental) {
|
|
523
526
|
(0, _addPerformanceMeasures.addPerformanceMeasures)(interaction.start, (0, _toConsumableArray2.default)((finalVCMetrics === null || finalVCMetrics === void 0 ? void 0 : finalVCMetrics['ufo:vc:rev']) || []));
|
|
524
527
|
}
|
|
@@ -537,7 +540,7 @@ function _createInteractionMetricsPayload() {
|
|
|
537
540
|
source: 'measured',
|
|
538
541
|
tags: ['observability'],
|
|
539
542
|
attributes: {
|
|
540
|
-
properties: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
543
|
+
properties: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
541
544
|
// basic
|
|
542
545
|
'event:hostname': ((_window$location = window.location) === null || _window$location === void 0 ? void 0 : _window$location.hostname) || 'unknown',
|
|
543
546
|
'event:product': config.product,
|
|
@@ -556,7 +559,7 @@ function _createInteractionMetricsPayload() {
|
|
|
556
559
|
}, criticalPayloadCount !== undefined ? {
|
|
557
560
|
'ufo:multipayload': true,
|
|
558
561
|
'ufo:criticalPayloadCount': criticalPayloadCount
|
|
559
|
-
} : {}), (0, _getBrowserMetadata.getBrowserMetadataToLegacyFormat)()), getSSRProperties(type)), getAssetsMetrics(interaction, pageLoadInteractionMetrics === null || pageLoadInteractionMetrics === void 0 ? void 0 : pageLoadInteractionMetrics.SSRDoneTime)), getPPSMetrics(interaction)), paintMetrics), (0, _getNavigationMetrics.getNavigationMetricsToLegacyFormat)(type)), finalVCMetrics), experimentalMetrics), (_config$additionalPay = config.additionalPayloadData) === null || _config$additionalPay === void 0 ? void 0 : _config$additionalPay.call(config, interaction)), getTracingContextData(interaction)), getStylesheetMetrics()), getErrorCounts(interaction)), getReactHydrationStats()), {}, {
|
|
562
|
+
} : {}), (0, _getBrowserMetadata.getBrowserMetadataToLegacyFormat)()), batteryInfo), getSSRProperties(type)), getAssetsMetrics(interaction, pageLoadInteractionMetrics === null || pageLoadInteractionMetrics === void 0 ? void 0 : pageLoadInteractionMetrics.SSRDoneTime)), getPPSMetrics(interaction)), paintMetrics), (0, _getNavigationMetrics.getNavigationMetricsToLegacyFormat)(type)), finalVCMetrics), experimentalMetrics), (_config$additionalPay = config.additionalPayloadData) === null || _config$additionalPay === void 0 ? void 0 : _config$additionalPay.call(config, interaction)), getTracingContextData(interaction)), getStylesheetMetrics()), getErrorCounts(interaction)), getReactHydrationStats()), {}, {
|
|
560
563
|
interactionMetrics: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
561
564
|
namePrefix: config.namePrefix || '',
|
|
562
565
|
segmentPrefix: config.segmentPrefix || '',
|
|
@@ -603,7 +606,7 @@ function _createInteractionMetricsPayload() {
|
|
|
603
606
|
}
|
|
604
607
|
payload.attributes.properties['event:sizeInKb'] = (0, _getPayloadSize.default)(payload.attributes.properties);
|
|
605
608
|
return _context.abrupt("return", payload);
|
|
606
|
-
case
|
|
609
|
+
case 47:
|
|
607
610
|
case "end":
|
|
608
611
|
return _context.stop();
|
|
609
612
|
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = getBatteryInfo;
|
|
8
|
+
exports.getBatteryInfoToLegacyFormat = getBatteryInfoToLegacyFormat;
|
|
9
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
|
+
// Type definitions for battery info
|
|
13
|
+
// Main function returns compact nested format
|
|
14
|
+
function getBatteryInfo() {
|
|
15
|
+
return _getBatteryInfo.apply(this, arguments);
|
|
16
|
+
} // Helper function to get battery info in legacy colon format for backward compatibility
|
|
17
|
+
function _getBatteryInfo() {
|
|
18
|
+
_getBatteryInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
19
|
+
var battery;
|
|
20
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
21
|
+
while (1) switch (_context.prev = _context.next) {
|
|
22
|
+
case 0:
|
|
23
|
+
if ((0, _platformFeatureFlags.fg)('react_ufo_battery_info')) {
|
|
24
|
+
_context.next = 2;
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
return _context.abrupt("return", {});
|
|
28
|
+
case 2:
|
|
29
|
+
if (!(typeof navigator === 'undefined')) {
|
|
30
|
+
_context.next = 4;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
return _context.abrupt("return", {});
|
|
34
|
+
case 4:
|
|
35
|
+
_context.prev = 4;
|
|
36
|
+
if (!('getBattery' in navigator)) {
|
|
37
|
+
_context.next = 11;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
_context.next = 8;
|
|
41
|
+
return navigator.getBattery();
|
|
42
|
+
case 8:
|
|
43
|
+
battery = _context.sent;
|
|
44
|
+
if (!(battery && typeof battery.level === 'number' && typeof battery.charging === 'boolean')) {
|
|
45
|
+
_context.next = 11;
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
return _context.abrupt("return", {
|
|
49
|
+
level: Math.round(battery.level * 100) / 100,
|
|
50
|
+
// Round to 0.01
|
|
51
|
+
charging: battery.charging
|
|
52
|
+
});
|
|
53
|
+
case 11:
|
|
54
|
+
_context.next = 15;
|
|
55
|
+
break;
|
|
56
|
+
case 13:
|
|
57
|
+
_context.prev = 13;
|
|
58
|
+
_context.t0 = _context["catch"](4);
|
|
59
|
+
case 15:
|
|
60
|
+
return _context.abrupt("return", {});
|
|
61
|
+
case 16:
|
|
62
|
+
case "end":
|
|
63
|
+
return _context.stop();
|
|
64
|
+
}
|
|
65
|
+
}, _callee, null, [[4, 13]]);
|
|
66
|
+
}));
|
|
67
|
+
return _getBatteryInfo.apply(this, arguments);
|
|
68
|
+
}
|
|
69
|
+
function getBatteryInfoToLegacyFormat() {
|
|
70
|
+
return _getBatteryInfoToLegacyFormat.apply(this, arguments);
|
|
71
|
+
}
|
|
72
|
+
function _getBatteryInfoToLegacyFormat() {
|
|
73
|
+
_getBatteryInfoToLegacyFormat = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
74
|
+
var battery, legacyFormat;
|
|
75
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
76
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
77
|
+
case 0:
|
|
78
|
+
_context2.next = 2;
|
|
79
|
+
return getBatteryInfo();
|
|
80
|
+
case 2:
|
|
81
|
+
battery = _context2.sent;
|
|
82
|
+
legacyFormat = {};
|
|
83
|
+
if (battery.level !== undefined) {
|
|
84
|
+
legacyFormat['event:battery:level'] = battery.level;
|
|
85
|
+
}
|
|
86
|
+
if (battery.charging !== undefined) {
|
|
87
|
+
legacyFormat['event:battery:charging'] = battery.charging;
|
|
88
|
+
}
|
|
89
|
+
return _context2.abrupt("return", legacyFormat);
|
|
90
|
+
case 7:
|
|
91
|
+
case "end":
|
|
92
|
+
return _context2.stop();
|
|
93
|
+
}
|
|
94
|
+
}, _callee2);
|
|
95
|
+
}));
|
|
96
|
+
return _getBatteryInfoToLegacyFormat.apply(this, arguments);
|
|
97
|
+
}
|
|
@@ -25,6 +25,7 @@ var getConsideredEntryTypes = function getConsideredEntryTypes(include3p) {
|
|
|
25
25
|
// including the tags into the ConsideredEntryTypes so that it won't be ignored for TTVC calculation
|
|
26
26
|
if (!(0, _platformFeatureFlags.fg)('platform_ufo_exclude_3p_elements_from_ttvc') || include3p) {
|
|
27
27
|
entryTypes.push('mutation:third-party-element');
|
|
28
|
+
entryTypes.push('mutation:third-party-attribute');
|
|
28
29
|
}
|
|
29
30
|
if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_media_for_ttvc_v3')) {
|
|
30
31
|
entryTypes.push('mutation:media');
|
|
@@ -13,13 +13,12 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
13
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
14
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
15
|
var _vcUtils = require("../../vc-observer/media-wrapper/vc-utils");
|
|
16
|
-
var _isDndStyleMutation = _interopRequireDefault(require("../../vc-observer/observers/non-visual-styles/is-dnd-style-mutation"));
|
|
17
16
|
var _isNonVisualStyleMutation = _interopRequireDefault(require("../../vc-observer/observers/non-visual-styles/is-non-visual-style-mutation"));
|
|
18
17
|
var _rllPlaceholders = require("../../vc-observer/observers/rll-placeholders");
|
|
19
18
|
var _intersectionObserver = require("./intersection-observer");
|
|
20
19
|
var _mutationObserver = _interopRequireDefault(require("./mutation-observer"));
|
|
21
20
|
var _performanceObserver = _interopRequireDefault(require("./performance-observer"));
|
|
22
|
-
var
|
|
21
|
+
var _checkWithinComponent3 = _interopRequireWildcard(require("./utils/check-within-component"));
|
|
23
22
|
var _getMutatedElements = require("./utils/get-mutated-elements");
|
|
24
23
|
var _isElementVisible = require("./utils/is-element-visible");
|
|
25
24
|
var _isInVcIgnoreIfNoLayoutShiftMarker = _interopRequireDefault(require("./utils/is-in-vc-ignore-if-no-layout-shift-marker"));
|
|
@@ -215,7 +214,7 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
215
214
|
(_this$intersectionObs6 = _this.intersectionObserver) === null || _this$intersectionObs6 === void 0 || _this$intersectionObs6.watchAndTag(element, 'mutation:media');
|
|
216
215
|
return _context.abrupt("return", 0);
|
|
217
216
|
case 38:
|
|
218
|
-
_ref6 = element instanceof HTMLElement ? (0,
|
|
217
|
+
_ref6 = element instanceof HTMLElement ? (0, _checkWithinComponent3.default)(element, 'UFOThirdPartySegment', _this.mapIs3pResult) : {
|
|
219
218
|
isWithin: false
|
|
220
219
|
}, isWithinThirdPartySegment = _ref6.isWithin;
|
|
221
220
|
if (!isWithinThirdPartySegment) {
|
|
@@ -360,7 +359,7 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
360
359
|
(_this$intersectionObs13 = _this.intersectionObserver) === null || _this$intersectionObs13 === void 0 || _this$intersectionObs13.watchAndTag(addedNode, 'mutation:media');
|
|
361
360
|
return _context2.abrupt("return", 0);
|
|
362
361
|
case 63:
|
|
363
|
-
_checkWithinComponent = (0,
|
|
362
|
+
_checkWithinComponent = (0, _checkWithinComponent3.default)(addedNode, 'UFOThirdPartySegment', _this.mapIs3pResult), isWithinThirdPartySegment = _checkWithinComponent.isWithin;
|
|
364
363
|
if (!isWithinThirdPartySegment) {
|
|
365
364
|
_context2.next = 67;
|
|
366
365
|
break;
|
|
@@ -446,20 +445,19 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
446
445
|
}
|
|
447
446
|
};
|
|
448
447
|
}
|
|
449
|
-
if ((0,
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
};
|
|
448
|
+
if ((0, _platformFeatureFlags.fg)('platform_ufo_exclude_3p_attribute_changes')) {
|
|
449
|
+
var _checkWithinComponent2 = (0, _checkWithinComponent3.default)(target, 'UFOThirdPartySegment', _this.mapIs3pResult),
|
|
450
|
+
isWithinThirdPartySegment = _checkWithinComponent2.isWithin;
|
|
451
|
+
if (isWithinThirdPartySegment) {
|
|
452
|
+
return {
|
|
453
|
+
type: 'mutation:third-party-attribute',
|
|
454
|
+
mutationData: {
|
|
455
|
+
attributeName: attributeName,
|
|
456
|
+
oldValue: oldValue,
|
|
457
|
+
newValue: newValue
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
}
|
|
463
461
|
}
|
|
464
462
|
if ((0, _isNonVisualStyleMutation.default)({
|
|
465
463
|
target: target,
|
|
@@ -597,7 +595,7 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
597
595
|
(_this$performanceObse2 = this.performanceObserver) === null || _this$performanceObse2 === void 0 || _this$performanceObse2.disconnect();
|
|
598
596
|
this.isStarted = false;
|
|
599
597
|
// Clean up caches when stopping
|
|
600
|
-
(0,
|
|
598
|
+
(0, _checkWithinComponent3.cleanupCaches)(this.mapIs3pResult);
|
|
601
599
|
}
|
|
602
600
|
}]);
|
|
603
601
|
}();
|
|
@@ -22,6 +22,7 @@ import * as ssr from '../ssr';
|
|
|
22
22
|
import { buildSegmentTree, getOldSegmentsLabelStack, labelStackStartWith, optimizeLabelStack, sanitizeUfoName, stringifyLabelStackFully } from './common/utils';
|
|
23
23
|
import { createCriticalMetricsPayloads } from './critical-metrics-payload';
|
|
24
24
|
import { addPerformanceMeasures } from './utils/add-performance-measures';
|
|
25
|
+
import { getBatteryInfoToLegacyFormat } from './utils/get-battery-info';
|
|
25
26
|
import { getBrowserMetadataToLegacyFormat } from './utils/get-browser-metadata';
|
|
26
27
|
import getInteractionStatus from './utils/get-interaction-status';
|
|
27
28
|
import { getMoreAccuratePageVisibilityUpToTTAI } from './utils/get-more-accurate-page-visibility-up-to-ttai';
|
|
@@ -499,7 +500,7 @@ async function createInteractionMetricsPayload(interaction, interactionId, exper
|
|
|
499
500
|
}
|
|
500
501
|
const newUFOName = sanitizeUfoName(ufoName);
|
|
501
502
|
const resourceTimings = getResourceTimings(start, end);
|
|
502
|
-
const [finalVCMetrics, experimentalMetrics, paintMetrics] = await Promise.all([vcMetrics || (await getVCMetrics(interaction)), experimental ? getExperimentalVCMetrics(interaction) : Promise.resolve(undefined), getPaintMetricsToLegacyFormat(type, end)]);
|
|
503
|
+
const [finalVCMetrics, experimentalMetrics, paintMetrics, batteryInfo] = await Promise.all([vcMetrics || (await getVCMetrics(interaction)), experimental ? getExperimentalVCMetrics(interaction) : Promise.resolve(undefined), getPaintMetricsToLegacyFormat(type, end), getBatteryInfoToLegacyFormat()]);
|
|
503
504
|
if (!experimental) {
|
|
504
505
|
addPerformanceMeasures(interaction.start, [...((finalVCMetrics === null || finalVCMetrics === void 0 ? void 0 : finalVCMetrics['ufo:vc:rev']) || [])]);
|
|
505
506
|
}
|
|
@@ -540,6 +541,7 @@ async function createInteractionMetricsPayload(interaction, interactionId, exper
|
|
|
540
541
|
} : {}),
|
|
541
542
|
// root
|
|
542
543
|
...getBrowserMetadataToLegacyFormat(),
|
|
544
|
+
...batteryInfo,
|
|
543
545
|
...getSSRProperties(type),
|
|
544
546
|
...getAssetsMetrics(interaction, pageLoadInteractionMetrics === null || pageLoadInteractionMetrics === void 0 ? void 0 : pageLoadInteractionMetrics.SSRDoneTime),
|
|
545
547
|
...getPPSMetrics(interaction),
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
+
|
|
3
|
+
// Type definitions for battery info
|
|
4
|
+
|
|
5
|
+
// Main function returns compact nested format
|
|
6
|
+
export default async function getBatteryInfo() {
|
|
7
|
+
if (!fg('react_ufo_battery_info')) {
|
|
8
|
+
return {};
|
|
9
|
+
}
|
|
10
|
+
if (typeof navigator === 'undefined') {
|
|
11
|
+
return {};
|
|
12
|
+
}
|
|
13
|
+
try {
|
|
14
|
+
// Try modern getBattery() API first
|
|
15
|
+
if ('getBattery' in navigator) {
|
|
16
|
+
const battery = await navigator.getBattery();
|
|
17
|
+
if (battery && typeof battery.level === 'number' && typeof battery.charging === 'boolean') {
|
|
18
|
+
return {
|
|
19
|
+
level: Math.round(battery.level * 100) / 100,
|
|
20
|
+
// Round to 0.01
|
|
21
|
+
charging: battery.charging
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
} catch (error) {
|
|
26
|
+
// Silently ignore errors - battery info is optional
|
|
27
|
+
}
|
|
28
|
+
return {};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Helper function to get battery info in legacy colon format for backward compatibility
|
|
32
|
+
export async function getBatteryInfoToLegacyFormat() {
|
|
33
|
+
const battery = await getBatteryInfo();
|
|
34
|
+
const legacyFormat = {};
|
|
35
|
+
if (battery.level !== undefined) {
|
|
36
|
+
legacyFormat['event:battery:level'] = battery.level;
|
|
37
|
+
}
|
|
38
|
+
if (battery.charging !== undefined) {
|
|
39
|
+
legacyFormat['event:battery:charging'] = battery.charging;
|
|
40
|
+
}
|
|
41
|
+
return legacyFormat;
|
|
42
|
+
}
|
|
@@ -11,6 +11,7 @@ const getConsideredEntryTypes = include3p => {
|
|
|
11
11
|
// including the tags into the ConsideredEntryTypes so that it won't be ignored for TTVC calculation
|
|
12
12
|
if (!fg('platform_ufo_exclude_3p_elements_from_ttvc') || include3p) {
|
|
13
13
|
entryTypes.push('mutation:third-party-element');
|
|
14
|
+
entryTypes.push('mutation:third-party-attribute');
|
|
14
15
|
}
|
|
15
16
|
if (fg('platform_ufo_enable_media_for_ttvc_v3')) {
|
|
16
17
|
entryTypes.push('mutation:media');
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
3
|
import { isContainedWithinMediaWrapper } from '../../vc-observer/media-wrapper/vc-utils';
|
|
4
|
-
import isDnDStyleMutation from '../../vc-observer/observers/non-visual-styles/is-dnd-style-mutation';
|
|
5
4
|
import isNonVisualStyleMutation from '../../vc-observer/observers/non-visual-styles/is-non-visual-style-mutation';
|
|
6
5
|
import { RLLPlaceholderHandlers } from '../../vc-observer/observers/rll-placeholders';
|
|
7
6
|
import { createIntersectionObserver } from './intersection-observer';
|
|
@@ -289,20 +288,20 @@ export default class ViewportObserver {
|
|
|
289
288
|
}
|
|
290
289
|
};
|
|
291
290
|
}
|
|
292
|
-
if (
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
}
|
|
305
|
-
}
|
|
291
|
+
if (fg('platform_ufo_exclude_3p_attribute_changes')) {
|
|
292
|
+
const {
|
|
293
|
+
isWithin: isWithinThirdPartySegment
|
|
294
|
+
} = checkWithinComponent(target, 'UFOThirdPartySegment', this.mapIs3pResult);
|
|
295
|
+
if (isWithinThirdPartySegment) {
|
|
296
|
+
return {
|
|
297
|
+
type: 'mutation:third-party-attribute',
|
|
298
|
+
mutationData: {
|
|
299
|
+
attributeName,
|
|
300
|
+
oldValue,
|
|
301
|
+
newValue
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
}
|
|
306
305
|
}
|
|
307
306
|
if (isNonVisualStyleMutation({
|
|
308
307
|
target,
|
|
@@ -31,6 +31,7 @@ import * as ssr from '../ssr';
|
|
|
31
31
|
import { buildSegmentTree, getOldSegmentsLabelStack, labelStackStartWith, optimizeLabelStack, sanitizeUfoName, stringifyLabelStackFully } from './common/utils';
|
|
32
32
|
import { createCriticalMetricsPayloads } from './critical-metrics-payload';
|
|
33
33
|
import { addPerformanceMeasures } from './utils/add-performance-measures';
|
|
34
|
+
import { getBatteryInfoToLegacyFormat } from './utils/get-battery-info';
|
|
34
35
|
import { getBrowserMetadataToLegacyFormat } from './utils/get-browser-metadata';
|
|
35
36
|
import getInteractionStatus from './utils/get-interaction-status';
|
|
36
37
|
import { getMoreAccuratePageVisibilityUpToTTAI } from './utils/get-more-accurate-page-visibility-up-to-ttai';
|
|
@@ -389,7 +390,7 @@ function createInteractionMetricsPayload(_x, _x2, _x3, _x4, _x5) {
|
|
|
389
390
|
function _createInteractionMetricsPayload() {
|
|
390
391
|
_createInteractionMetricsPayload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(interaction, interactionId, experimental, criticalPayloadCount, vcMetrics) {
|
|
391
392
|
var _window$location, _config$additionalPay;
|
|
392
|
-
var interactionPayloadStart, config, end, start, ufoName, knownSegments, rate, type, abortReason, routeName, featureFlags, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, responsiveness, unknownElementName, unknownElementHierarchy, hydration, pageVisibilityAtTTI, pageVisibilityAtTTAI, segments, segmentTree, isDetailedPayload, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTI, moreAccuratePageVisibilityAtTTAI, labelStack, getInitialPageLoadSSRMetrics, pageLoadInteractionMetrics, getDetailedInteractionMetrics, getPageLoadDetailedInteractionMetrics, newUFOName, resourceTimings, _yield$Promise$all, _yield$Promise$all2, finalVCMetrics, experimentalMetrics, paintMetrics, getReactHydrationStats, payload;
|
|
393
|
+
var interactionPayloadStart, config, end, start, ufoName, knownSegments, rate, type, abortReason, routeName, featureFlags, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, responsiveness, unknownElementName, unknownElementHierarchy, hydration, pageVisibilityAtTTI, pageVisibilityAtTTAI, segments, segmentTree, isDetailedPayload, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTI, moreAccuratePageVisibilityAtTTAI, labelStack, getInitialPageLoadSSRMetrics, pageLoadInteractionMetrics, getDetailedInteractionMetrics, getPageLoadDetailedInteractionMetrics, newUFOName, resourceTimings, _yield$Promise$all, _yield$Promise$all2, finalVCMetrics, experimentalMetrics, paintMetrics, batteryInfo, getReactHydrationStats, payload;
|
|
393
394
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
394
395
|
while (1) switch (_context.prev = _context.next) {
|
|
395
396
|
case 0:
|
|
@@ -502,15 +503,17 @@ function _createInteractionMetricsPayload() {
|
|
|
502
503
|
_context.t2 = _context.t1;
|
|
503
504
|
_context.t3 = experimental ? getExperimentalVCMetrics(interaction) : Promise.resolve(undefined);
|
|
504
505
|
_context.t4 = getPaintMetricsToLegacyFormat(type, end);
|
|
505
|
-
_context.t5 =
|
|
506
|
-
_context.
|
|
507
|
-
|
|
508
|
-
|
|
506
|
+
_context.t5 = getBatteryInfoToLegacyFormat();
|
|
507
|
+
_context.t6 = [_context.t2, _context.t3, _context.t4, _context.t5];
|
|
508
|
+
_context.next = 35;
|
|
509
|
+
return _context.t0.all.call(_context.t0, _context.t6);
|
|
510
|
+
case 35:
|
|
509
511
|
_yield$Promise$all = _context.sent;
|
|
510
|
-
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all,
|
|
512
|
+
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 4);
|
|
511
513
|
finalVCMetrics = _yield$Promise$all2[0];
|
|
512
514
|
experimentalMetrics = _yield$Promise$all2[1];
|
|
513
515
|
paintMetrics = _yield$Promise$all2[2];
|
|
516
|
+
batteryInfo = _yield$Promise$all2[3];
|
|
514
517
|
if (!experimental) {
|
|
515
518
|
addPerformanceMeasures(interaction.start, _toConsumableArray((finalVCMetrics === null || finalVCMetrics === void 0 ? void 0 : finalVCMetrics['ufo:vc:rev']) || []));
|
|
516
519
|
}
|
|
@@ -529,7 +532,7 @@ function _createInteractionMetricsPayload() {
|
|
|
529
532
|
source: 'measured',
|
|
530
533
|
tags: ['observability'],
|
|
531
534
|
attributes: {
|
|
532
|
-
properties: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
535
|
+
properties: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
533
536
|
// basic
|
|
534
537
|
'event:hostname': ((_window$location = window.location) === null || _window$location === void 0 ? void 0 : _window$location.hostname) || 'unknown',
|
|
535
538
|
'event:product': config.product,
|
|
@@ -548,7 +551,7 @@ function _createInteractionMetricsPayload() {
|
|
|
548
551
|
}, criticalPayloadCount !== undefined ? {
|
|
549
552
|
'ufo:multipayload': true,
|
|
550
553
|
'ufo:criticalPayloadCount': criticalPayloadCount
|
|
551
|
-
} : {}), getBrowserMetadataToLegacyFormat()), getSSRProperties(type)), getAssetsMetrics(interaction, pageLoadInteractionMetrics === null || pageLoadInteractionMetrics === void 0 ? void 0 : pageLoadInteractionMetrics.SSRDoneTime)), getPPSMetrics(interaction)), paintMetrics), getNavigationMetricsToLegacyFormat(type)), finalVCMetrics), experimentalMetrics), (_config$additionalPay = config.additionalPayloadData) === null || _config$additionalPay === void 0 ? void 0 : _config$additionalPay.call(config, interaction)), getTracingContextData(interaction)), getStylesheetMetrics()), getErrorCounts(interaction)), getReactHydrationStats()), {}, {
|
|
554
|
+
} : {}), getBrowserMetadataToLegacyFormat()), batteryInfo), getSSRProperties(type)), getAssetsMetrics(interaction, pageLoadInteractionMetrics === null || pageLoadInteractionMetrics === void 0 ? void 0 : pageLoadInteractionMetrics.SSRDoneTime)), getPPSMetrics(interaction)), paintMetrics), getNavigationMetricsToLegacyFormat(type)), finalVCMetrics), experimentalMetrics), (_config$additionalPay = config.additionalPayloadData) === null || _config$additionalPay === void 0 ? void 0 : _config$additionalPay.call(config, interaction)), getTracingContextData(interaction)), getStylesheetMetrics()), getErrorCounts(interaction)), getReactHydrationStats()), {}, {
|
|
552
555
|
interactionMetrics: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
553
556
|
namePrefix: config.namePrefix || '',
|
|
554
557
|
segmentPrefix: config.segmentPrefix || '',
|
|
@@ -595,7 +598,7 @@ function _createInteractionMetricsPayload() {
|
|
|
595
598
|
}
|
|
596
599
|
payload.attributes.properties['event:sizeInKb'] = getPayloadSize(payload.attributes.properties);
|
|
597
600
|
return _context.abrupt("return", payload);
|
|
598
|
-
case
|
|
601
|
+
case 47:
|
|
599
602
|
case "end":
|
|
600
603
|
return _context.stop();
|
|
601
604
|
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
|
|
5
|
+
// Type definitions for battery info
|
|
6
|
+
|
|
7
|
+
// Main function returns compact nested format
|
|
8
|
+
export default function getBatteryInfo() {
|
|
9
|
+
return _getBatteryInfo.apply(this, arguments);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Helper function to get battery info in legacy colon format for backward compatibility
|
|
13
|
+
function _getBatteryInfo() {
|
|
14
|
+
_getBatteryInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
15
|
+
var battery;
|
|
16
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
17
|
+
while (1) switch (_context.prev = _context.next) {
|
|
18
|
+
case 0:
|
|
19
|
+
if (fg('react_ufo_battery_info')) {
|
|
20
|
+
_context.next = 2;
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
return _context.abrupt("return", {});
|
|
24
|
+
case 2:
|
|
25
|
+
if (!(typeof navigator === 'undefined')) {
|
|
26
|
+
_context.next = 4;
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
return _context.abrupt("return", {});
|
|
30
|
+
case 4:
|
|
31
|
+
_context.prev = 4;
|
|
32
|
+
if (!('getBattery' in navigator)) {
|
|
33
|
+
_context.next = 11;
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
_context.next = 8;
|
|
37
|
+
return navigator.getBattery();
|
|
38
|
+
case 8:
|
|
39
|
+
battery = _context.sent;
|
|
40
|
+
if (!(battery && typeof battery.level === 'number' && typeof battery.charging === 'boolean')) {
|
|
41
|
+
_context.next = 11;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
return _context.abrupt("return", {
|
|
45
|
+
level: Math.round(battery.level * 100) / 100,
|
|
46
|
+
// Round to 0.01
|
|
47
|
+
charging: battery.charging
|
|
48
|
+
});
|
|
49
|
+
case 11:
|
|
50
|
+
_context.next = 15;
|
|
51
|
+
break;
|
|
52
|
+
case 13:
|
|
53
|
+
_context.prev = 13;
|
|
54
|
+
_context.t0 = _context["catch"](4);
|
|
55
|
+
case 15:
|
|
56
|
+
return _context.abrupt("return", {});
|
|
57
|
+
case 16:
|
|
58
|
+
case "end":
|
|
59
|
+
return _context.stop();
|
|
60
|
+
}
|
|
61
|
+
}, _callee, null, [[4, 13]]);
|
|
62
|
+
}));
|
|
63
|
+
return _getBatteryInfo.apply(this, arguments);
|
|
64
|
+
}
|
|
65
|
+
export function getBatteryInfoToLegacyFormat() {
|
|
66
|
+
return _getBatteryInfoToLegacyFormat.apply(this, arguments);
|
|
67
|
+
}
|
|
68
|
+
function _getBatteryInfoToLegacyFormat() {
|
|
69
|
+
_getBatteryInfoToLegacyFormat = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
70
|
+
var battery, legacyFormat;
|
|
71
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
72
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
73
|
+
case 0:
|
|
74
|
+
_context2.next = 2;
|
|
75
|
+
return getBatteryInfo();
|
|
76
|
+
case 2:
|
|
77
|
+
battery = _context2.sent;
|
|
78
|
+
legacyFormat = {};
|
|
79
|
+
if (battery.level !== undefined) {
|
|
80
|
+
legacyFormat['event:battery:level'] = battery.level;
|
|
81
|
+
}
|
|
82
|
+
if (battery.charging !== undefined) {
|
|
83
|
+
legacyFormat['event:battery:charging'] = battery.charging;
|
|
84
|
+
}
|
|
85
|
+
return _context2.abrupt("return", legacyFormat);
|
|
86
|
+
case 7:
|
|
87
|
+
case "end":
|
|
88
|
+
return _context2.stop();
|
|
89
|
+
}
|
|
90
|
+
}, _callee2);
|
|
91
|
+
}));
|
|
92
|
+
return _getBatteryInfoToLegacyFormat.apply(this, arguments);
|
|
93
|
+
}
|
|
@@ -18,6 +18,7 @@ var getConsideredEntryTypes = function getConsideredEntryTypes(include3p) {
|
|
|
18
18
|
// including the tags into the ConsideredEntryTypes so that it won't be ignored for TTVC calculation
|
|
19
19
|
if (!fg('platform_ufo_exclude_3p_elements_from_ttvc') || include3p) {
|
|
20
20
|
entryTypes.push('mutation:third-party-element');
|
|
21
|
+
entryTypes.push('mutation:third-party-attribute');
|
|
21
22
|
}
|
|
22
23
|
if (fg('platform_ufo_enable_media_for_ttvc_v3')) {
|
|
23
24
|
entryTypes.push('mutation:media');
|
|
@@ -8,7 +8,6 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
8
8
|
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; }
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
10
|
import { isContainedWithinMediaWrapper } from '../../vc-observer/media-wrapper/vc-utils';
|
|
11
|
-
import isDnDStyleMutation from '../../vc-observer/observers/non-visual-styles/is-dnd-style-mutation';
|
|
12
11
|
import isNonVisualStyleMutation from '../../vc-observer/observers/non-visual-styles/is-non-visual-style-mutation';
|
|
13
12
|
import { RLLPlaceholderHandlers } from '../../vc-observer/observers/rll-placeholders';
|
|
14
13
|
import { createIntersectionObserver } from './intersection-observer';
|
|
@@ -437,20 +436,19 @@ var ViewportObserver = /*#__PURE__*/function () {
|
|
|
437
436
|
}
|
|
438
437
|
};
|
|
439
438
|
}
|
|
440
|
-
if (
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
};
|
|
439
|
+
if (fg('platform_ufo_exclude_3p_attribute_changes')) {
|
|
440
|
+
var _checkWithinComponent2 = checkWithinComponent(target, 'UFOThirdPartySegment', _this.mapIs3pResult),
|
|
441
|
+
isWithinThirdPartySegment = _checkWithinComponent2.isWithin;
|
|
442
|
+
if (isWithinThirdPartySegment) {
|
|
443
|
+
return {
|
|
444
|
+
type: 'mutation:third-party-attribute',
|
|
445
|
+
mutationData: {
|
|
446
|
+
attributeName: attributeName,
|
|
447
|
+
oldValue: oldValue,
|
|
448
|
+
newValue: newValue
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
}
|
|
454
452
|
}
|
|
455
453
|
if (isNonVisualStyleMutation({
|
|
456
454
|
target: target,
|