@atlaskit/react-ufo 2.0.9 → 2.2.1
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 +30 -0
- package/dist/cjs/interaction-metrics/index.js +21 -17
- package/dist/cjs/interaction-metrics-init/index.js +3 -0
- package/dist/cjs/vc/vc-observer/media-wrapper/MediaWrapper.js +16 -0
- package/dist/cjs/vc/vc-observer/media-wrapper/index.js +22 -10
- package/dist/cjs/vc/vc-observer/observers/index.js +46 -1
- package/dist/es2019/interaction-metrics/index.js +21 -17
- package/dist/es2019/interaction-metrics-init/index.js +3 -0
- package/dist/es2019/vc/vc-observer/media-wrapper/MediaWrapper.js +10 -0
- package/dist/es2019/vc/vc-observer/media-wrapper/index.js +1 -9
- package/dist/es2019/vc/vc-observer/observers/index.js +26 -1
- package/dist/esm/interaction-metrics/index.js +21 -17
- package/dist/esm/interaction-metrics-init/index.js +3 -0
- package/dist/esm/vc/vc-observer/media-wrapper/MediaWrapper.js +8 -0
- package/dist/esm/vc/vc-observer/media-wrapper/index.js +1 -7
- package/dist/esm/vc/vc-observer/observers/index.js +46 -1
- package/dist/types/config/index.d.ts +2 -1
- package/dist/types/vc/vc-observer/media-wrapper/MediaWrapper.d.ts +10 -0
- package/dist/types/vc/vc-observer/media-wrapper/index.d.ts +1 -7
- package/dist/types/vc/vc-observer/observers/index.d.ts +2 -1
- package/dist/types/vc/vc-observer/observers/types.d.ts +2 -1
- package/dist/types-ts4.5/config/index.d.ts +2 -1
- package/dist/types-ts4.5/vc/vc-observer/media-wrapper/MediaWrapper.d.ts +10 -0
- package/dist/types-ts4.5/vc/vc-observer/media-wrapper/index.d.ts +1 -7
- package/dist/types-ts4.5/vc/vc-observer/observers/index.d.ts +2 -1
- package/dist/types-ts4.5/vc/vc-observer/observers/types.d.ts +2 -1
- package/package.json +2 -2
- package/vc-media/package.json +15 -0
- package/vc/media/package.json +0 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @atlaskit/ufo-interaction-ignore
|
|
2
2
|
|
|
3
|
+
## 2.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#162445](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/162445)
|
|
8
|
+
[`19a11c825b2fe`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/19a11c825b2fe) -
|
|
9
|
+
enable additional performance marks in performance tab
|
|
10
|
+
|
|
11
|
+
## 2.2.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#160594](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/160594)
|
|
16
|
+
[`4a91df26ce837`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4a91df26ce837) -
|
|
17
|
+
Capture Style display changes
|
|
18
|
+
|
|
19
|
+
## 2.1.0
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- [#160884](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/160884)
|
|
24
|
+
[`52e16a1e398bf`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/52e16a1e398bf) -
|
|
25
|
+
Exposing VC Media Wrapper Props object
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- [#160884](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/160884)
|
|
30
|
+
[`52e16a1e398bf`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/52e16a1e398bf) -
|
|
31
|
+
Renamed entry point for VC Media export
|
|
32
|
+
|
|
3
33
|
## 2.0.9
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
|
@@ -75,6 +75,10 @@ function getActiveInteraction() {
|
|
|
75
75
|
}
|
|
76
76
|
return _constants.default.get(interactionId.current);
|
|
77
77
|
}
|
|
78
|
+
function isPerformanceTracingEnabled() {
|
|
79
|
+
var _getConfig;
|
|
80
|
+
return ((_getConfig = (0, _config.getConfig)()) === null || _getConfig === void 0 ? void 0 : _getConfig.enableAdditionalPerformanceMarks) || window.__REACT_UFO_ENABLE_PERF_TRACING || process.env.NODE_ENV !== 'production';
|
|
81
|
+
}
|
|
78
82
|
function labelStackToString(labelStack, name) {
|
|
79
83
|
var _stack$map;
|
|
80
84
|
var stack = (0, _toConsumableArray2.default)(labelStack !== null && labelStack !== void 0 ? labelStack : []);
|
|
@@ -154,7 +158,7 @@ function addCustomTiming(interactionId, labelStack, data) {
|
|
|
154
158
|
labelStack: labelStack,
|
|
155
159
|
data: data
|
|
156
160
|
});
|
|
157
|
-
if (
|
|
161
|
+
if (isPerformanceTracingEnabled()) {
|
|
158
162
|
for (var _i = 0, _Object$entries = Object.entries(data); _i < _Object$entries.length; _i++) {
|
|
159
163
|
var _Object$entries$_i = (0, _slicedToArray2.default)(_Object$entries[_i], 2),
|
|
160
164
|
key = _Object$entries$_i[0],
|
|
@@ -185,7 +189,7 @@ function addMark(interactionId, type, name, labelStack) {
|
|
|
185
189
|
time: time
|
|
186
190
|
});
|
|
187
191
|
}
|
|
188
|
-
if (
|
|
192
|
+
if (isPerformanceTracingEnabled()) {
|
|
189
193
|
performance.mark("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, name), " [").concat(type, "]"), {
|
|
190
194
|
startTime: time
|
|
191
195
|
});
|
|
@@ -201,7 +205,7 @@ function addMarkToAll(type, name, labelStack) {
|
|
|
201
205
|
time: time
|
|
202
206
|
});
|
|
203
207
|
});
|
|
204
|
-
if (
|
|
208
|
+
if (isPerformanceTracingEnabled()) {
|
|
205
209
|
performance.mark("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, name), " [").concat(type, "]"), {
|
|
206
210
|
startTime: time
|
|
207
211
|
});
|
|
@@ -220,7 +224,7 @@ function addSpan(interactionId, type, name, labelStack, start) {
|
|
|
220
224
|
end: end,
|
|
221
225
|
size: size
|
|
222
226
|
});
|
|
223
|
-
if (
|
|
227
|
+
if (isPerformanceTracingEnabled()) {
|
|
224
228
|
try {
|
|
225
229
|
// for Firefox 102 and older
|
|
226
230
|
performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, name), " [").concat(type, "]"), {
|
|
@@ -246,7 +250,7 @@ function addSpanToAll(type, name, labelStack, start) {
|
|
|
246
250
|
size: size
|
|
247
251
|
});
|
|
248
252
|
});
|
|
249
|
-
if (
|
|
253
|
+
if (isPerformanceTracingEnabled()) {
|
|
250
254
|
try {
|
|
251
255
|
// for Firefox 102 and older
|
|
252
256
|
performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, name), " [").concat(type, "]"), {
|
|
@@ -299,7 +303,7 @@ function addHold(interactionId, labelStack, name) {
|
|
|
299
303
|
addHoldCriterion(id, labelStack, name, start);
|
|
300
304
|
return function () {
|
|
301
305
|
var end = performance.now();
|
|
302
|
-
if (
|
|
306
|
+
if (isPerformanceTracingEnabled()) {
|
|
303
307
|
try {
|
|
304
308
|
// for Firefox 102 and older
|
|
305
309
|
performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, name), " [hold]"), {
|
|
@@ -419,8 +423,8 @@ function addErrorToAll(name, labelStack, errorType, errorMessage, errorStack) {
|
|
|
419
423
|
});
|
|
420
424
|
}
|
|
421
425
|
var addProfilerTimings = exports.addProfilerTimings = function addProfilerTimings(interactionId, labelStack, type, actualDuration, baseDuration, startTime, commitTime) {
|
|
422
|
-
var
|
|
423
|
-
if (
|
|
426
|
+
var _getConfig2;
|
|
427
|
+
if (isPerformanceTracingEnabled()) {
|
|
424
428
|
try {
|
|
425
429
|
// for Firefox 102 and older
|
|
426
430
|
performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack), " [react-profiler] ").concat(type), {
|
|
@@ -441,7 +445,7 @@ var addProfilerTimings = exports.addProfilerTimings = function addProfilerTiming
|
|
|
441
445
|
startTime: startTime,
|
|
442
446
|
commitTime: commitTime
|
|
443
447
|
});
|
|
444
|
-
} else if ((
|
|
448
|
+
} else if ((_getConfig2 = (0, _config.getConfig)()) !== null && _getConfig2 !== void 0 && (_getConfig2 = _getConfig2.postInteractionLog) !== null && _getConfig2 !== void 0 && _getConfig2.enabled) {
|
|
445
449
|
postInteractionLog.addProfilerTimings(labelStack, type, actualDuration, baseDuration, startTime, commitTime);
|
|
446
450
|
}
|
|
447
451
|
};
|
|
@@ -458,7 +462,7 @@ function callCleanUpCallbacks(interaction) {
|
|
|
458
462
|
});
|
|
459
463
|
}
|
|
460
464
|
var finishInteraction = function finishInteraction(id, data) {
|
|
461
|
-
var
|
|
465
|
+
var _getConfig3;
|
|
462
466
|
var endTime = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : performance.now();
|
|
463
467
|
// eslint-disable-next-line no-param-reassign
|
|
464
468
|
data.end = endTime;
|
|
@@ -477,7 +481,7 @@ var finishInteraction = function finishInteraction(id, data) {
|
|
|
477
481
|
}
|
|
478
482
|
(0, _experienceTraceIdContext.clearActiveTrace)();
|
|
479
483
|
callCleanUpCallbacks(data);
|
|
480
|
-
if ((
|
|
484
|
+
if ((_getConfig3 = (0, _config.getConfig)()) !== null && _getConfig3 !== void 0 && (_getConfig3 = _getConfig3.vc) !== null && _getConfig3 !== void 0 && _getConfig3.stopVCAtInteractionFinish) {
|
|
481
485
|
data.vc = (0, _vc.getVCObserver)().getVCRawData();
|
|
482
486
|
}
|
|
483
487
|
remove(id);
|
|
@@ -486,7 +490,7 @@ var finishInteraction = function finishInteraction(id, data) {
|
|
|
486
490
|
if (data.ufoName) {
|
|
487
491
|
handleInteraction(id, data);
|
|
488
492
|
}
|
|
489
|
-
if (
|
|
493
|
+
if (isPerformanceTracingEnabled()) {
|
|
490
494
|
var profilerTimingMap = new Map();
|
|
491
495
|
data.reactProfilerTimings.forEach(function (profilerTiming) {
|
|
492
496
|
var labelStackId = labelStackToIdString(profilerTiming.labelStack);
|
|
@@ -551,9 +555,9 @@ function tryComplete(interactionId, endTime) {
|
|
|
551
555
|
if (interaction != null) {
|
|
552
556
|
var noMoreHolds = interaction.holdActive.size === 0;
|
|
553
557
|
if (noMoreHolds) {
|
|
554
|
-
var
|
|
558
|
+
var _getConfig4;
|
|
555
559
|
finishInteraction(interactionId, interaction, endTime);
|
|
556
|
-
if ((
|
|
560
|
+
if ((_getConfig4 = (0, _config.getConfig)()) !== null && _getConfig4 !== void 0 && (_getConfig4 = _getConfig4.postInteractionLog) !== null && _getConfig4 !== void 0 && _getConfig4.enabled) {
|
|
557
561
|
postInteractionLog.onInteractionComplete(interaction);
|
|
558
562
|
}
|
|
559
563
|
}
|
|
@@ -601,9 +605,9 @@ function addOnCancelCallback(id, cancelCallback) {
|
|
|
601
605
|
interaction === null || interaction === void 0 || interaction.cancelCallbacks.push(cancelCallback);
|
|
602
606
|
}
|
|
603
607
|
function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelStack, routeName) {
|
|
604
|
-
var
|
|
608
|
+
var _getConfig5;
|
|
605
609
|
var trace = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
606
|
-
if ((
|
|
610
|
+
if ((_getConfig5 = (0, _config.getConfig)()) !== null && _getConfig5 !== void 0 && (_getConfig5 = _getConfig5.postInteractionLog) !== null && _getConfig5 !== void 0 && _getConfig5.enabled) {
|
|
607
611
|
postInteractionLog.reset();
|
|
608
612
|
}
|
|
609
613
|
var previousTime = startTime;
|
|
@@ -799,7 +803,7 @@ function addRedirect(interactionId, fromUfoName, nextUfoName, nextRouteName, tim
|
|
|
799
803
|
fromInteractionName: fromUfoName,
|
|
800
804
|
time: time
|
|
801
805
|
});
|
|
802
|
-
if (
|
|
806
|
+
if (isPerformanceTracingEnabled()) {
|
|
803
807
|
var prevRedirect = interaction.redirects.at(-2);
|
|
804
808
|
try {
|
|
805
809
|
var _prevRedirect$time;
|
|
@@ -41,6 +41,9 @@ var init = exports.init = function init(analyticsWebClientAsync, config) {
|
|
|
41
41
|
if (initialized) {
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
|
+
if (window !== undefined) {
|
|
45
|
+
window.__REACT_UFO_ENABLE_PERF_TRACING = Boolean(sessionStorage.getItem('additionalPerfMarks') === 'true');
|
|
46
|
+
}
|
|
44
47
|
(0, _config.setUFOConfig)(config);
|
|
45
48
|
if ((_config$vc = config.vc) !== null && _config$vc !== void 0 && _config$vc.enabled) {
|
|
46
49
|
var vcOptions = {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.VcMediaWrapperProps = exports.MEDIA_WRAPPER_TAG = void 0;
|
|
8
|
+
exports.default = MediaWrapper;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var MEDIA_WRAPPER_TAG = exports.MEDIA_WRAPPER_TAG = 'data-media-vc-wrapper';
|
|
12
|
+
var VcMediaWrapperProps = exports.VcMediaWrapperProps = (0, _defineProperty2.default)({}, MEDIA_WRAPPER_TAG, true);
|
|
13
|
+
function MediaWrapper(_ref) {
|
|
14
|
+
var children = _ref.children;
|
|
15
|
+
return /*#__PURE__*/_react.default.createElement("div", VcMediaWrapperProps, children);
|
|
16
|
+
}
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
Object.defineProperty(exports, "MEDIA_WRAPPER_TAG", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function get() {
|
|
10
|
+
return _MediaWrapper.MEDIA_WRAPPER_TAG;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "VcMediaWrapperProps", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function get() {
|
|
16
|
+
return _MediaWrapper.VcMediaWrapperProps;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "default", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function get() {
|
|
22
|
+
return _MediaWrapper.default;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
var _MediaWrapper = _interopRequireWildcard(require("./MediaWrapper"));
|
|
26
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
27
|
+
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; }
|
|
@@ -5,11 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.Observers = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
8
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
12
|
var _vcUtils = require("../media-wrapper/vc-utils");
|
|
12
13
|
var _ssrPlaceholders = require("./ssr-placeholders");
|
|
14
|
+
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; } } }; }
|
|
15
|
+
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; } }
|
|
16
|
+
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; }
|
|
13
17
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
18
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
19
|
var state = {
|
|
@@ -179,13 +183,54 @@ var Observers = exports.Observers = /*#__PURE__*/function () {
|
|
|
179
183
|
});
|
|
180
184
|
} else if (mutation.type === 'attributes') {
|
|
181
185
|
if (mutation.target instanceof HTMLElement) {
|
|
182
|
-
|
|
186
|
+
// Commenting the following line temporarily.
|
|
187
|
+
// this.observeElement(mutation.target, mutation, 'attr', ignoreReason);
|
|
188
|
+
|
|
189
|
+
// using the if below to collect data
|
|
190
|
+
// how would VC90 changes if only style display changes are accounted for
|
|
191
|
+
if (mutation.attributeName === 'style' && _this2.getStyleDisplay(mutation.target.getAttribute('style')) !== _this2.getStyleDisplay(mutation.oldValue)) {
|
|
192
|
+
_this2.observeElement(mutation.target, mutation, 'attr', ignoreReason);
|
|
193
|
+
}
|
|
183
194
|
}
|
|
184
195
|
}
|
|
185
196
|
});
|
|
186
197
|
_this2.measureStop();
|
|
187
198
|
}) : null;
|
|
188
199
|
}
|
|
200
|
+
}, {
|
|
201
|
+
key: "getStyleDisplay",
|
|
202
|
+
value: function getStyleDisplay(styleAttributeValue) {
|
|
203
|
+
if (!styleAttributeValue) {
|
|
204
|
+
return undefined;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// Split the style string into individual declarations
|
|
208
|
+
var declarations = styleAttributeValue.split(';');
|
|
209
|
+
// Iterate over each declaration
|
|
210
|
+
var _iterator = _createForOfIteratorHelper(declarations),
|
|
211
|
+
_step;
|
|
212
|
+
try {
|
|
213
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
214
|
+
var declaration = _step.value;
|
|
215
|
+
// Trim whitespace and split into property and value
|
|
216
|
+
var _declaration$split$ma = declaration.split(':').map(function (part) {
|
|
217
|
+
return part.trim();
|
|
218
|
+
}),
|
|
219
|
+
_declaration$split$ma2 = (0, _slicedToArray2.default)(_declaration$split$ma, 2),
|
|
220
|
+
property = _declaration$split$ma2[0],
|
|
221
|
+
value = _declaration$split$ma2[1];
|
|
222
|
+
// Check if the property is 'display'
|
|
223
|
+
if (property && property.toLowerCase() === 'display') {
|
|
224
|
+
return value;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
} catch (err) {
|
|
228
|
+
_iterator.e(err);
|
|
229
|
+
} finally {
|
|
230
|
+
_iterator.f();
|
|
231
|
+
}
|
|
232
|
+
return undefined;
|
|
233
|
+
}
|
|
189
234
|
}, {
|
|
190
235
|
key: "getElementName",
|
|
191
236
|
value: function getElementName(element) {
|
|
@@ -24,6 +24,10 @@ export function getActiveInteraction() {
|
|
|
24
24
|
}
|
|
25
25
|
return interactions.get(interactionId.current);
|
|
26
26
|
}
|
|
27
|
+
function isPerformanceTracingEnabled() {
|
|
28
|
+
var _getConfig;
|
|
29
|
+
return ((_getConfig = getConfig()) === null || _getConfig === void 0 ? void 0 : _getConfig.enableAdditionalPerformanceMarks) || window.__REACT_UFO_ENABLE_PERF_TRACING || process.env.NODE_ENV !== 'production';
|
|
30
|
+
}
|
|
27
31
|
function labelStackToString(labelStack, name) {
|
|
28
32
|
var _stack$map;
|
|
29
33
|
const stack = [...(labelStack !== null && labelStack !== void 0 ? labelStack : [])];
|
|
@@ -89,7 +93,7 @@ export function addCustomTiming(interactionId, labelStack, data) {
|
|
|
89
93
|
labelStack,
|
|
90
94
|
data
|
|
91
95
|
});
|
|
92
|
-
if (
|
|
96
|
+
if (isPerformanceTracingEnabled()) {
|
|
93
97
|
for (const [key, timingData] of Object.entries(data)) {
|
|
94
98
|
const {
|
|
95
99
|
startTime,
|
|
@@ -118,7 +122,7 @@ export function addMark(interactionId, type, name, labelStack, time = performanc
|
|
|
118
122
|
time
|
|
119
123
|
});
|
|
120
124
|
}
|
|
121
|
-
if (
|
|
125
|
+
if (isPerformanceTracingEnabled()) {
|
|
122
126
|
performance.mark(`🛸 ${labelStackToString(labelStack, name)} [${type}]`, {
|
|
123
127
|
startTime: time
|
|
124
128
|
});
|
|
@@ -133,7 +137,7 @@ export function addMarkToAll(type, name, labelStack, time = performance.now()) {
|
|
|
133
137
|
time
|
|
134
138
|
});
|
|
135
139
|
});
|
|
136
|
-
if (
|
|
140
|
+
if (isPerformanceTracingEnabled()) {
|
|
137
141
|
performance.mark(`🛸 ${labelStackToString(labelStack, name)} [${type}]`, {
|
|
138
142
|
startTime: time
|
|
139
143
|
});
|
|
@@ -150,7 +154,7 @@ export function addSpan(interactionId, type, name, labelStack, start, end = perf
|
|
|
150
154
|
end,
|
|
151
155
|
size
|
|
152
156
|
});
|
|
153
|
-
if (
|
|
157
|
+
if (isPerformanceTracingEnabled()) {
|
|
154
158
|
try {
|
|
155
159
|
// for Firefox 102 and older
|
|
156
160
|
performance.measure(`🛸 ${labelStackToString(labelStack, name)} [${type}]`, {
|
|
@@ -174,7 +178,7 @@ export function addSpanToAll(type, name, labelStack, start, end = performance.no
|
|
|
174
178
|
size
|
|
175
179
|
});
|
|
176
180
|
});
|
|
177
|
-
if (
|
|
181
|
+
if (isPerformanceTracingEnabled()) {
|
|
178
182
|
try {
|
|
179
183
|
// for Firefox 102 and older
|
|
180
184
|
performance.measure(`🛸 ${labelStackToString(labelStack, name)} [${type}]`, {
|
|
@@ -227,7 +231,7 @@ export function addHold(interactionId, labelStack, name) {
|
|
|
227
231
|
addHoldCriterion(id, labelStack, name, start);
|
|
228
232
|
return () => {
|
|
229
233
|
const end = performance.now();
|
|
230
|
-
if (
|
|
234
|
+
if (isPerformanceTracingEnabled()) {
|
|
231
235
|
try {
|
|
232
236
|
// for Firefox 102 and older
|
|
233
237
|
performance.measure(`🛸 ${labelStackToString(labelStack, name)} [hold]`, {
|
|
@@ -349,8 +353,8 @@ export function addErrorToAll(name, labelStack, errorType, errorMessage, errorSt
|
|
|
349
353
|
});
|
|
350
354
|
}
|
|
351
355
|
export const addProfilerTimings = (interactionId, labelStack, type, actualDuration, baseDuration, startTime, commitTime) => {
|
|
352
|
-
var
|
|
353
|
-
if (
|
|
356
|
+
var _getConfig2, _getConfig2$postInter;
|
|
357
|
+
if (isPerformanceTracingEnabled()) {
|
|
354
358
|
try {
|
|
355
359
|
// for Firefox 102 and older
|
|
356
360
|
performance.measure(`🛸 ${labelStackToString(labelStack)} [react-profiler] ${type}`, {
|
|
@@ -371,7 +375,7 @@ export const addProfilerTimings = (interactionId, labelStack, type, actualDurati
|
|
|
371
375
|
startTime,
|
|
372
376
|
commitTime
|
|
373
377
|
});
|
|
374
|
-
} else if ((
|
|
378
|
+
} else if ((_getConfig2 = getConfig()) !== null && _getConfig2 !== void 0 && (_getConfig2$postInter = _getConfig2.postInteractionLog) !== null && _getConfig2$postInter !== void 0 && _getConfig2$postInter.enabled) {
|
|
375
379
|
postInteractionLog.addProfilerTimings(labelStack, type, actualDuration, baseDuration, startTime, commitTime);
|
|
376
380
|
}
|
|
377
381
|
};
|
|
@@ -388,7 +392,7 @@ function callCleanUpCallbacks(interaction) {
|
|
|
388
392
|
});
|
|
389
393
|
}
|
|
390
394
|
const finishInteraction = (id, data, endTime = performance.now()) => {
|
|
391
|
-
var
|
|
395
|
+
var _getConfig3, _getConfig3$vc;
|
|
392
396
|
// eslint-disable-next-line no-param-reassign
|
|
393
397
|
data.end = endTime;
|
|
394
398
|
try {
|
|
@@ -406,7 +410,7 @@ const finishInteraction = (id, data, endTime = performance.now()) => {
|
|
|
406
410
|
}
|
|
407
411
|
clearActiveTrace();
|
|
408
412
|
callCleanUpCallbacks(data);
|
|
409
|
-
if ((
|
|
413
|
+
if ((_getConfig3 = getConfig()) !== null && _getConfig3 !== void 0 && (_getConfig3$vc = _getConfig3.vc) !== null && _getConfig3$vc !== void 0 && _getConfig3$vc.stopVCAtInteractionFinish) {
|
|
410
414
|
data.vc = getVCObserver().getVCRawData();
|
|
411
415
|
}
|
|
412
416
|
remove(id);
|
|
@@ -415,7 +419,7 @@ const finishInteraction = (id, data, endTime = performance.now()) => {
|
|
|
415
419
|
if (data.ufoName) {
|
|
416
420
|
handleInteraction(id, data);
|
|
417
421
|
}
|
|
418
|
-
if (
|
|
422
|
+
if (isPerformanceTracingEnabled()) {
|
|
419
423
|
const profilerTimingMap = new Map();
|
|
420
424
|
data.reactProfilerTimings.forEach(profilerTiming => {
|
|
421
425
|
const labelStackId = labelStackToIdString(profilerTiming.labelStack);
|
|
@@ -471,9 +475,9 @@ export function tryComplete(interactionId, endTime) {
|
|
|
471
475
|
if (interaction != null) {
|
|
472
476
|
const noMoreHolds = interaction.holdActive.size === 0;
|
|
473
477
|
if (noMoreHolds) {
|
|
474
|
-
var
|
|
478
|
+
var _getConfig4, _getConfig4$postInter;
|
|
475
479
|
finishInteraction(interactionId, interaction, endTime);
|
|
476
|
-
if ((
|
|
480
|
+
if ((_getConfig4 = getConfig()) !== null && _getConfig4 !== void 0 && (_getConfig4$postInter = _getConfig4.postInteractionLog) !== null && _getConfig4$postInter !== void 0 && _getConfig4$postInter.enabled) {
|
|
477
481
|
postInteractionLog.onInteractionComplete(interaction);
|
|
478
482
|
}
|
|
479
483
|
}
|
|
@@ -521,8 +525,8 @@ export function addOnCancelCallback(id, cancelCallback) {
|
|
|
521
525
|
interaction === null || interaction === void 0 ? void 0 : interaction.cancelCallbacks.push(cancelCallback);
|
|
522
526
|
}
|
|
523
527
|
export function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelStack, routeName, trace = null) {
|
|
524
|
-
var
|
|
525
|
-
if ((
|
|
528
|
+
var _getConfig5, _getConfig5$postInter;
|
|
529
|
+
if ((_getConfig5 = getConfig()) !== null && _getConfig5 !== void 0 && (_getConfig5$postInter = _getConfig5.postInteractionLog) !== null && _getConfig5$postInter !== void 0 && _getConfig5$postInter.enabled) {
|
|
526
530
|
postInteractionLog.reset();
|
|
527
531
|
}
|
|
528
532
|
let previousTime = startTime;
|
|
@@ -719,7 +723,7 @@ export function addRedirect(interactionId, fromUfoName, nextUfoName, nextRouteNa
|
|
|
719
723
|
fromInteractionName: fromUfoName,
|
|
720
724
|
time
|
|
721
725
|
});
|
|
722
|
-
if (
|
|
726
|
+
if (isPerformanceTracingEnabled()) {
|
|
723
727
|
const prevRedirect = interaction.redirects.at(-2);
|
|
724
728
|
try {
|
|
725
729
|
var _prevRedirect$time;
|
|
@@ -30,6 +30,9 @@ export const init = (analyticsWebClientAsync, config) => {
|
|
|
30
30
|
if (initialized) {
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
+
if (window !== undefined) {
|
|
34
|
+
window.__REACT_UFO_ENABLE_PERF_TRACING = Boolean(sessionStorage.getItem('additionalPerfMarks') === 'true');
|
|
35
|
+
}
|
|
33
36
|
setUFOConfig(config);
|
|
34
37
|
if ((_config$vc = config.vc) !== null && _config$vc !== void 0 && _config$vc.enabled) {
|
|
35
38
|
const vcOptions = {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export const MEDIA_WRAPPER_TAG = 'data-media-vc-wrapper';
|
|
3
|
+
export const VcMediaWrapperProps = {
|
|
4
|
+
[MEDIA_WRAPPER_TAG]: true
|
|
5
|
+
};
|
|
6
|
+
export default function MediaWrapper({
|
|
7
|
+
children
|
|
8
|
+
}) {
|
|
9
|
+
return /*#__PURE__*/React.createElement("div", VcMediaWrapperProps, children);
|
|
10
|
+
}
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export const MEDIA_WRAPPER_TAG = 'data-media-vc-wrapper';
|
|
3
|
-
export default function MediaWrapper({
|
|
4
|
-
children
|
|
5
|
-
}) {
|
|
6
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
7
|
-
[MEDIA_WRAPPER_TAG]: true
|
|
8
|
-
}, children);
|
|
9
|
-
}
|
|
1
|
+
export { default, MEDIA_WRAPPER_TAG, VcMediaWrapperProps } from './MediaWrapper';
|
|
@@ -150,13 +150,38 @@ export class Observers {
|
|
|
150
150
|
});
|
|
151
151
|
} else if (mutation.type === 'attributes') {
|
|
152
152
|
if (mutation.target instanceof HTMLElement) {
|
|
153
|
-
|
|
153
|
+
// Commenting the following line temporarily.
|
|
154
|
+
// this.observeElement(mutation.target, mutation, 'attr', ignoreReason);
|
|
155
|
+
|
|
156
|
+
// using the if below to collect data
|
|
157
|
+
// how would VC90 changes if only style display changes are accounted for
|
|
158
|
+
if (mutation.attributeName === 'style' && this.getStyleDisplay(mutation.target.getAttribute('style')) !== this.getStyleDisplay(mutation.oldValue)) {
|
|
159
|
+
this.observeElement(mutation.target, mutation, 'attr', ignoreReason);
|
|
160
|
+
}
|
|
154
161
|
}
|
|
155
162
|
}
|
|
156
163
|
});
|
|
157
164
|
this.measureStop();
|
|
158
165
|
}) : null;
|
|
159
166
|
}
|
|
167
|
+
getStyleDisplay(styleAttributeValue) {
|
|
168
|
+
if (!styleAttributeValue) {
|
|
169
|
+
return undefined;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Split the style string into individual declarations
|
|
173
|
+
const declarations = styleAttributeValue.split(';');
|
|
174
|
+
// Iterate over each declaration
|
|
175
|
+
for (const declaration of declarations) {
|
|
176
|
+
// Trim whitespace and split into property and value
|
|
177
|
+
const [property, value] = declaration.split(':').map(part => part.trim());
|
|
178
|
+
// Check if the property is 'display'
|
|
179
|
+
if (property && property.toLowerCase() === 'display') {
|
|
180
|
+
return value;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return undefined;
|
|
184
|
+
}
|
|
160
185
|
getElementName(element) {
|
|
161
186
|
try {
|
|
162
187
|
const tagName = element.localName;
|
|
@@ -32,6 +32,10 @@ export function getActiveInteraction() {
|
|
|
32
32
|
}
|
|
33
33
|
return interactions.get(interactionId.current);
|
|
34
34
|
}
|
|
35
|
+
function isPerformanceTracingEnabled() {
|
|
36
|
+
var _getConfig;
|
|
37
|
+
return ((_getConfig = getConfig()) === null || _getConfig === void 0 ? void 0 : _getConfig.enableAdditionalPerformanceMarks) || window.__REACT_UFO_ENABLE_PERF_TRACING || process.env.NODE_ENV !== 'production';
|
|
38
|
+
}
|
|
35
39
|
function labelStackToString(labelStack, name) {
|
|
36
40
|
var _stack$map;
|
|
37
41
|
var stack = _toConsumableArray(labelStack !== null && labelStack !== void 0 ? labelStack : []);
|
|
@@ -111,7 +115,7 @@ export function addCustomTiming(interactionId, labelStack, data) {
|
|
|
111
115
|
labelStack: labelStack,
|
|
112
116
|
data: data
|
|
113
117
|
});
|
|
114
|
-
if (
|
|
118
|
+
if (isPerformanceTracingEnabled()) {
|
|
115
119
|
for (var _i = 0, _Object$entries = Object.entries(data); _i < _Object$entries.length; _i++) {
|
|
116
120
|
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
117
121
|
key = _Object$entries$_i[0],
|
|
@@ -142,7 +146,7 @@ export function addMark(interactionId, type, name, labelStack) {
|
|
|
142
146
|
time: time
|
|
143
147
|
});
|
|
144
148
|
}
|
|
145
|
-
if (
|
|
149
|
+
if (isPerformanceTracingEnabled()) {
|
|
146
150
|
performance.mark("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, name), " [").concat(type, "]"), {
|
|
147
151
|
startTime: time
|
|
148
152
|
});
|
|
@@ -158,7 +162,7 @@ export function addMarkToAll(type, name, labelStack) {
|
|
|
158
162
|
time: time
|
|
159
163
|
});
|
|
160
164
|
});
|
|
161
|
-
if (
|
|
165
|
+
if (isPerformanceTracingEnabled()) {
|
|
162
166
|
performance.mark("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, name), " [").concat(type, "]"), {
|
|
163
167
|
startTime: time
|
|
164
168
|
});
|
|
@@ -177,7 +181,7 @@ export function addSpan(interactionId, type, name, labelStack, start) {
|
|
|
177
181
|
end: end,
|
|
178
182
|
size: size
|
|
179
183
|
});
|
|
180
|
-
if (
|
|
184
|
+
if (isPerformanceTracingEnabled()) {
|
|
181
185
|
try {
|
|
182
186
|
// for Firefox 102 and older
|
|
183
187
|
performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, name), " [").concat(type, "]"), {
|
|
@@ -203,7 +207,7 @@ export function addSpanToAll(type, name, labelStack, start) {
|
|
|
203
207
|
size: size
|
|
204
208
|
});
|
|
205
209
|
});
|
|
206
|
-
if (
|
|
210
|
+
if (isPerformanceTracingEnabled()) {
|
|
207
211
|
try {
|
|
208
212
|
// for Firefox 102 and older
|
|
209
213
|
performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, name), " [").concat(type, "]"), {
|
|
@@ -256,7 +260,7 @@ export function addHold(interactionId, labelStack, name) {
|
|
|
256
260
|
addHoldCriterion(id, labelStack, name, start);
|
|
257
261
|
return function () {
|
|
258
262
|
var end = performance.now();
|
|
259
|
-
if (
|
|
263
|
+
if (isPerformanceTracingEnabled()) {
|
|
260
264
|
try {
|
|
261
265
|
// for Firefox 102 and older
|
|
262
266
|
performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, name), " [hold]"), {
|
|
@@ -376,8 +380,8 @@ export function addErrorToAll(name, labelStack, errorType, errorMessage, errorSt
|
|
|
376
380
|
});
|
|
377
381
|
}
|
|
378
382
|
export var addProfilerTimings = function addProfilerTimings(interactionId, labelStack, type, actualDuration, baseDuration, startTime, commitTime) {
|
|
379
|
-
var
|
|
380
|
-
if (
|
|
383
|
+
var _getConfig2;
|
|
384
|
+
if (isPerformanceTracingEnabled()) {
|
|
381
385
|
try {
|
|
382
386
|
// for Firefox 102 and older
|
|
383
387
|
performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack), " [react-profiler] ").concat(type), {
|
|
@@ -398,7 +402,7 @@ export var addProfilerTimings = function addProfilerTimings(interactionId, label
|
|
|
398
402
|
startTime: startTime,
|
|
399
403
|
commitTime: commitTime
|
|
400
404
|
});
|
|
401
|
-
} else if ((
|
|
405
|
+
} else if ((_getConfig2 = getConfig()) !== null && _getConfig2 !== void 0 && (_getConfig2 = _getConfig2.postInteractionLog) !== null && _getConfig2 !== void 0 && _getConfig2.enabled) {
|
|
402
406
|
postInteractionLog.addProfilerTimings(labelStack, type, actualDuration, baseDuration, startTime, commitTime);
|
|
403
407
|
}
|
|
404
408
|
};
|
|
@@ -415,7 +419,7 @@ function callCleanUpCallbacks(interaction) {
|
|
|
415
419
|
});
|
|
416
420
|
}
|
|
417
421
|
var finishInteraction = function finishInteraction(id, data) {
|
|
418
|
-
var
|
|
422
|
+
var _getConfig3;
|
|
419
423
|
var endTime = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : performance.now();
|
|
420
424
|
// eslint-disable-next-line no-param-reassign
|
|
421
425
|
data.end = endTime;
|
|
@@ -434,7 +438,7 @@ var finishInteraction = function finishInteraction(id, data) {
|
|
|
434
438
|
}
|
|
435
439
|
clearActiveTrace();
|
|
436
440
|
callCleanUpCallbacks(data);
|
|
437
|
-
if ((
|
|
441
|
+
if ((_getConfig3 = getConfig()) !== null && _getConfig3 !== void 0 && (_getConfig3 = _getConfig3.vc) !== null && _getConfig3 !== void 0 && _getConfig3.stopVCAtInteractionFinish) {
|
|
438
442
|
data.vc = getVCObserver().getVCRawData();
|
|
439
443
|
}
|
|
440
444
|
remove(id);
|
|
@@ -443,7 +447,7 @@ var finishInteraction = function finishInteraction(id, data) {
|
|
|
443
447
|
if (data.ufoName) {
|
|
444
448
|
handleInteraction(id, data);
|
|
445
449
|
}
|
|
446
|
-
if (
|
|
450
|
+
if (isPerformanceTracingEnabled()) {
|
|
447
451
|
var profilerTimingMap = new Map();
|
|
448
452
|
data.reactProfilerTimings.forEach(function (profilerTiming) {
|
|
449
453
|
var labelStackId = labelStackToIdString(profilerTiming.labelStack);
|
|
@@ -508,9 +512,9 @@ export function tryComplete(interactionId, endTime) {
|
|
|
508
512
|
if (interaction != null) {
|
|
509
513
|
var noMoreHolds = interaction.holdActive.size === 0;
|
|
510
514
|
if (noMoreHolds) {
|
|
511
|
-
var
|
|
515
|
+
var _getConfig4;
|
|
512
516
|
finishInteraction(interactionId, interaction, endTime);
|
|
513
|
-
if ((
|
|
517
|
+
if ((_getConfig4 = getConfig()) !== null && _getConfig4 !== void 0 && (_getConfig4 = _getConfig4.postInteractionLog) !== null && _getConfig4 !== void 0 && _getConfig4.enabled) {
|
|
514
518
|
postInteractionLog.onInteractionComplete(interaction);
|
|
515
519
|
}
|
|
516
520
|
}
|
|
@@ -558,9 +562,9 @@ export function addOnCancelCallback(id, cancelCallback) {
|
|
|
558
562
|
interaction === null || interaction === void 0 || interaction.cancelCallbacks.push(cancelCallback);
|
|
559
563
|
}
|
|
560
564
|
export function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelStack, routeName) {
|
|
561
|
-
var
|
|
565
|
+
var _getConfig5;
|
|
562
566
|
var trace = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
563
|
-
if ((
|
|
567
|
+
if ((_getConfig5 = getConfig()) !== null && _getConfig5 !== void 0 && (_getConfig5 = _getConfig5.postInteractionLog) !== null && _getConfig5 !== void 0 && _getConfig5.enabled) {
|
|
564
568
|
postInteractionLog.reset();
|
|
565
569
|
}
|
|
566
570
|
var previousTime = startTime;
|
|
@@ -756,7 +760,7 @@ export function addRedirect(interactionId, fromUfoName, nextUfoName, nextRouteNa
|
|
|
756
760
|
fromInteractionName: fromUfoName,
|
|
757
761
|
time: time
|
|
758
762
|
});
|
|
759
|
-
if (
|
|
763
|
+
if (isPerformanceTracingEnabled()) {
|
|
760
764
|
var prevRedirect = interaction.redirects.at(-2);
|
|
761
765
|
try {
|
|
762
766
|
var _prevRedirect$time;
|
|
@@ -31,6 +31,9 @@ export var init = function init(analyticsWebClientAsync, config) {
|
|
|
31
31
|
if (initialized) {
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
+
if (window !== undefined) {
|
|
35
|
+
window.__REACT_UFO_ENABLE_PERF_TRACING = Boolean(sessionStorage.getItem('additionalPerfMarks') === 'true');
|
|
36
|
+
}
|
|
34
37
|
setUFOConfig(config);
|
|
35
38
|
if ((_config$vc = config.vc) !== null && _config$vc !== void 0 && _config$vc.enabled) {
|
|
36
39
|
var vcOptions = {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export var MEDIA_WRAPPER_TAG = 'data-media-vc-wrapper';
|
|
4
|
+
export var VcMediaWrapperProps = _defineProperty({}, MEDIA_WRAPPER_TAG, true);
|
|
5
|
+
export default function MediaWrapper(_ref) {
|
|
6
|
+
var children = _ref.children;
|
|
7
|
+
return /*#__PURE__*/React.createElement("div", VcMediaWrapperProps, children);
|
|
8
|
+
}
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import React from 'react';
|
|
3
|
-
export var MEDIA_WRAPPER_TAG = 'data-media-vc-wrapper';
|
|
4
|
-
export default function MediaWrapper(_ref) {
|
|
5
|
-
var children = _ref.children;
|
|
6
|
-
return /*#__PURE__*/React.createElement("div", _defineProperty({}, MEDIA_WRAPPER_TAG, true), children);
|
|
7
|
-
}
|
|
1
|
+
export { default, MEDIA_WRAPPER_TAG, VcMediaWrapperProps } from './MediaWrapper';
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
1
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
|
+
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; } } }; }
|
|
6
|
+
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; } }
|
|
7
|
+
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; }
|
|
4
8
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
9
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
10
|
import { isContainedWithinMediaWrapper } from '../media-wrapper/vc-utils';
|
|
@@ -172,13 +176,54 @@ export var Observers = /*#__PURE__*/function () {
|
|
|
172
176
|
});
|
|
173
177
|
} else if (mutation.type === 'attributes') {
|
|
174
178
|
if (mutation.target instanceof HTMLElement) {
|
|
175
|
-
|
|
179
|
+
// Commenting the following line temporarily.
|
|
180
|
+
// this.observeElement(mutation.target, mutation, 'attr', ignoreReason);
|
|
181
|
+
|
|
182
|
+
// using the if below to collect data
|
|
183
|
+
// how would VC90 changes if only style display changes are accounted for
|
|
184
|
+
if (mutation.attributeName === 'style' && _this2.getStyleDisplay(mutation.target.getAttribute('style')) !== _this2.getStyleDisplay(mutation.oldValue)) {
|
|
185
|
+
_this2.observeElement(mutation.target, mutation, 'attr', ignoreReason);
|
|
186
|
+
}
|
|
176
187
|
}
|
|
177
188
|
}
|
|
178
189
|
});
|
|
179
190
|
_this2.measureStop();
|
|
180
191
|
}) : null;
|
|
181
192
|
}
|
|
193
|
+
}, {
|
|
194
|
+
key: "getStyleDisplay",
|
|
195
|
+
value: function getStyleDisplay(styleAttributeValue) {
|
|
196
|
+
if (!styleAttributeValue) {
|
|
197
|
+
return undefined;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Split the style string into individual declarations
|
|
201
|
+
var declarations = styleAttributeValue.split(';');
|
|
202
|
+
// Iterate over each declaration
|
|
203
|
+
var _iterator = _createForOfIteratorHelper(declarations),
|
|
204
|
+
_step;
|
|
205
|
+
try {
|
|
206
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
207
|
+
var declaration = _step.value;
|
|
208
|
+
// Trim whitespace and split into property and value
|
|
209
|
+
var _declaration$split$ma = declaration.split(':').map(function (part) {
|
|
210
|
+
return part.trim();
|
|
211
|
+
}),
|
|
212
|
+
_declaration$split$ma2 = _slicedToArray(_declaration$split$ma, 2),
|
|
213
|
+
property = _declaration$split$ma2[0],
|
|
214
|
+
value = _declaration$split$ma2[1];
|
|
215
|
+
// Check if the property is 'display'
|
|
216
|
+
if (property && property.toLowerCase() === 'display') {
|
|
217
|
+
return value;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
} catch (err) {
|
|
221
|
+
_iterator.e(err);
|
|
222
|
+
} finally {
|
|
223
|
+
_iterator.f();
|
|
224
|
+
}
|
|
225
|
+
return undefined;
|
|
226
|
+
}
|
|
182
227
|
}, {
|
|
183
228
|
key: "getElementName",
|
|
184
229
|
value: function getElementName(element) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { InteractionMetrics, InteractionType } from '../common';
|
|
2
2
|
export interface AdditionalData {
|
|
3
|
-
[key: string]: null |
|
|
3
|
+
[key: string]: null | string | number | boolean | undefined | AdditionalData | Record<string, AdditionalData> | Array<AdditionalData>;
|
|
4
4
|
}
|
|
5
5
|
export interface SSRTiming {
|
|
6
6
|
label: string;
|
|
@@ -73,6 +73,7 @@ export type Config = {
|
|
|
73
73
|
readonly kind?: Record<InteractionType, number>;
|
|
74
74
|
};
|
|
75
75
|
readonly enableSegmentHighlighting?: boolean;
|
|
76
|
+
readonly enableAdditionalPerformanceMarks?: boolean;
|
|
76
77
|
readonly shouldCalculateLighthouseMetricsFromTTAI?: boolean;
|
|
77
78
|
readonly timeWindowForLateMutationsInMilliseconds?: number;
|
|
78
79
|
readonly manuallyTrackReactProfilerMounts?: boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
};
|
|
5
|
+
export declare const MEDIA_WRAPPER_TAG = "data-media-vc-wrapper";
|
|
6
|
+
export declare const VcMediaWrapperProps: {
|
|
7
|
+
"data-media-vc-wrapper": boolean;
|
|
8
|
+
};
|
|
9
|
+
export default function MediaWrapper({ children }: Props): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
type Props = {
|
|
3
|
-
children: React.ReactNode;
|
|
4
|
-
};
|
|
5
|
-
export declare const MEDIA_WRAPPER_TAG = "data-media-vc-wrapper";
|
|
6
|
-
export default function MediaWrapper({ children }: Props): JSX.Element;
|
|
7
|
-
export {};
|
|
1
|
+
export { default, MEDIA_WRAPPER_TAG, VcMediaWrapperProps } from './MediaWrapper';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BrowserObservers, Callback } from './types';
|
|
2
|
+
export type { ObservedMutationType } from './types';
|
|
2
3
|
export type SelectorConfig = {
|
|
3
4
|
id: boolean;
|
|
4
5
|
testId: boolean;
|
|
@@ -31,9 +32,9 @@ export declare class Observers implements BrowserObservers {
|
|
|
31
32
|
setReactRootRenderStop(stopTime?: number): void;
|
|
32
33
|
private observeElement;
|
|
33
34
|
private getMutationObserver;
|
|
35
|
+
private getStyleDisplay;
|
|
34
36
|
private getElementName;
|
|
35
37
|
private getIntersectionObserver;
|
|
36
38
|
private measureStart;
|
|
37
39
|
private measureStop;
|
|
38
40
|
}
|
|
39
|
-
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type VCIgnoreReason } from '../../../common/vc/types';
|
|
2
|
-
export type
|
|
2
|
+
export type ObservedMutationType = 'html' | 'attr' | 'text';
|
|
3
|
+
export type Callback = (time: number, box: DOMRectReadOnly, targetName: string, node: HTMLElement, type: ObservedMutationType, ignoreReason?: VCIgnoreReason) => void;
|
|
3
4
|
export type MutationRecordWithTimestamp = MutationRecord & {
|
|
4
5
|
timestamp?: number;
|
|
5
6
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { InteractionMetrics, InteractionType } from '../common';
|
|
2
2
|
export interface AdditionalData {
|
|
3
|
-
[key: string]: null |
|
|
3
|
+
[key: string]: null | string | number | boolean | undefined | AdditionalData | Record<string, AdditionalData> | Array<AdditionalData>;
|
|
4
4
|
}
|
|
5
5
|
export interface SSRTiming {
|
|
6
6
|
label: string;
|
|
@@ -73,6 +73,7 @@ export type Config = {
|
|
|
73
73
|
readonly kind?: Record<InteractionType, number>;
|
|
74
74
|
};
|
|
75
75
|
readonly enableSegmentHighlighting?: boolean;
|
|
76
|
+
readonly enableAdditionalPerformanceMarks?: boolean;
|
|
76
77
|
readonly shouldCalculateLighthouseMetricsFromTTAI?: boolean;
|
|
77
78
|
readonly timeWindowForLateMutationsInMilliseconds?: number;
|
|
78
79
|
readonly manuallyTrackReactProfilerMounts?: boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
};
|
|
5
|
+
export declare const MEDIA_WRAPPER_TAG = "data-media-vc-wrapper";
|
|
6
|
+
export declare const VcMediaWrapperProps: {
|
|
7
|
+
"data-media-vc-wrapper": boolean;
|
|
8
|
+
};
|
|
9
|
+
export default function MediaWrapper({ children }: Props): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
type Props = {
|
|
3
|
-
children: React.ReactNode;
|
|
4
|
-
};
|
|
5
|
-
export declare const MEDIA_WRAPPER_TAG = "data-media-vc-wrapper";
|
|
6
|
-
export default function MediaWrapper({ children }: Props): JSX.Element;
|
|
7
|
-
export {};
|
|
1
|
+
export { default, MEDIA_WRAPPER_TAG, VcMediaWrapperProps } from './MediaWrapper';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BrowserObservers, Callback } from './types';
|
|
2
|
+
export type { ObservedMutationType } from './types';
|
|
2
3
|
export type SelectorConfig = {
|
|
3
4
|
id: boolean;
|
|
4
5
|
testId: boolean;
|
|
@@ -31,9 +32,9 @@ export declare class Observers implements BrowserObservers {
|
|
|
31
32
|
setReactRootRenderStop(stopTime?: number): void;
|
|
32
33
|
private observeElement;
|
|
33
34
|
private getMutationObserver;
|
|
35
|
+
private getStyleDisplay;
|
|
34
36
|
private getElementName;
|
|
35
37
|
private getIntersectionObserver;
|
|
36
38
|
private measureStart;
|
|
37
39
|
private measureStop;
|
|
38
40
|
}
|
|
39
|
-
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type VCIgnoreReason } from '../../../common/vc/types';
|
|
2
|
-
export type
|
|
2
|
+
export type ObservedMutationType = 'html' | 'attr' | 'text';
|
|
3
|
+
export type Callback = (time: number, box: DOMRectReadOnly, targetName: string, node: HTMLElement, type: ObservedMutationType, ignoreReason?: VCIgnoreReason) => void;
|
|
3
4
|
export type MutationRecordWithTimestamp = MutationRecord & {
|
|
4
5
|
timestamp?: number;
|
|
5
6
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-ufo",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "Parts of React UFO that are publicly available",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"./typing-performance-tracing": "./src/typing-performance-tracing/index.ts",
|
|
70
70
|
"./use-press-tracing": "./src/use-press-tracing/index.ts",
|
|
71
71
|
"./vc": "./src/vc/index.ts",
|
|
72
|
-
"./vc
|
|
72
|
+
"./vc-media": "./src/vc/vc-observer/media-wrapper/index.ts",
|
|
73
73
|
".": "./src/index.ts"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/react-ufo/vc-media",
|
|
3
|
+
"main": "../dist/cjs/vc/vc-observer/media-wrapper/index.js",
|
|
4
|
+
"module": "../dist/esm/vc/vc-observer/media-wrapper/index.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/vc/vc-observer/media-wrapper/index.js",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"types": "../dist/types/vc/vc-observer/media-wrapper/index.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.5 <5.4": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.5/vc/vc-observer/media-wrapper/index.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
package/vc/media/package.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@atlaskit/react-ufo/vc/media",
|
|
3
|
-
"main": "../../dist/cjs/vc/vc-observer/media-wrapper/index.js",
|
|
4
|
-
"module": "../../dist/esm/vc/vc-observer/media-wrapper/index.js",
|
|
5
|
-
"module:es2019": "../../dist/es2019/vc/vc-observer/media-wrapper/index.js",
|
|
6
|
-
"sideEffects": false,
|
|
7
|
-
"types": "../../dist/types/vc/vc-observer/media-wrapper/index.d.ts",
|
|
8
|
-
"typesVersions": {
|
|
9
|
-
">=4.5 <5.4": {
|
|
10
|
-
"*": [
|
|
11
|
-
"../../dist/types-ts4.5/vc/vc-observer/media-wrapper/index.d.ts"
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|