@atlaskit/react-ufo 4.1.8 → 4.1.9
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 +8 -0
- package/dist/cjs/create-payload/utils/get-vc-metrics.js +16 -16
- package/dist/cjs/interaction-metrics/index.js +28 -24
- package/dist/cjs/interaction-metrics-init/index.js +4 -16
- package/dist/es2019/create-payload/utils/get-vc-metrics.js +6 -9
- package/dist/es2019/interaction-metrics/index.js +29 -25
- package/dist/es2019/interaction-metrics-init/index.js +4 -16
- package/dist/esm/create-payload/utils/get-vc-metrics.js +16 -16
- package/dist/esm/interaction-metrics/index.js +29 -25
- package/dist/esm/interaction-metrics-init/index.js +4 -16
- package/dist/types/create-post-interaction-log-payload/index.d.ts +3 -3
- package/dist/types-ts4.5/create-post-interaction-log-payload/index.d.ts +3 -3
- package/package.json +1 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/ufo-interaction-ignore
|
|
2
2
|
|
|
3
|
+
## 4.1.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#192603](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/192603)
|
|
8
|
+
[`75c6397ec21b6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/75c6397ec21b6) -
|
|
9
|
+
Clean fg observer per interaction
|
|
10
|
+
|
|
3
11
|
## 4.1.8
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -11,7 +11,6 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
11
11
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
12
|
var _config = require("../../config");
|
|
13
13
|
var _interactionMetrics = require("../../interaction-metrics");
|
|
14
|
-
var _vc = require("../../vc");
|
|
15
14
|
var _getInteractionStatus = _interopRequireDefault(require("./get-interaction-status"));
|
|
16
15
|
var _getPageVisibilityUpToTtai = _interopRequireDefault(require("./get-page-visibility-up-to-ttai"));
|
|
17
16
|
var _getSsrDoneTimeValue = _interopRequireDefault(require("./get-ssr-done-time-value"));
|
|
@@ -22,7 +21,7 @@ function getVCMetrics(_x) {
|
|
|
22
21
|
}
|
|
23
22
|
function _getVCMetrics() {
|
|
24
23
|
_getVCMetrics = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(interaction) {
|
|
25
|
-
var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _config$vc2, _config$vc3,
|
|
24
|
+
var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _config$vc2, _config$vc3, _result$ufoVcRev;
|
|
26
25
|
var config, interactionStatus, pageVisibilityUpToTTAI, shouldReportVCMetrics, observer, isSSREnabled, ssr, tti, prefix, result, mostRecentVCRevision, mostRecentVCRevisionPayload;
|
|
27
26
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
28
27
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -56,14 +55,20 @@ function _getVCMetrics() {
|
|
|
56
55
|
interactionStatus = (0, _getInteractionStatus.default)(interaction);
|
|
57
56
|
pageVisibilityUpToTTAI = (0, _getPageVisibilityUpToTtai.default)(interaction);
|
|
58
57
|
shouldReportVCMetrics = interactionStatus.originalInteractionStatus === 'SUCCEEDED' && pageVisibilityUpToTTAI === 'visible'; // Use per-interaction VC observer if available, otherwise fall back to global
|
|
59
|
-
observer = interaction.vcObserver
|
|
58
|
+
observer = interaction.vcObserver;
|
|
59
|
+
if (observer) {
|
|
60
|
+
_context.next = 16;
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
return _context.abrupt("return", {});
|
|
64
|
+
case 16:
|
|
60
65
|
if (!(!shouldReportVCMetrics && (0, _platformFeatureFlags.fg)('platform_ufo_no_vc_on_aborted'))) {
|
|
61
|
-
_context.next =
|
|
66
|
+
_context.next = 19;
|
|
62
67
|
break;
|
|
63
68
|
}
|
|
64
69
|
observer.stop(interaction.ufoName);
|
|
65
70
|
return _context.abrupt("return", {});
|
|
66
|
-
case
|
|
71
|
+
case 19:
|
|
67
72
|
isSSREnabled = interaction.type === 'page_load' && ((config === null || config === void 0 ? void 0 : config.ssr) || (config === null || config === void 0 || (_config$vc$ssrWhiteli = config.vc.ssrWhitelist) === null || _config$vc$ssrWhiteli === void 0 ? void 0 : _config$vc$ssrWhiteli.includes(interaction.ufoName)));
|
|
68
73
|
ssr = interaction.type === 'page_load' && isSSREnabled ? {
|
|
69
74
|
ssr: (0, _getSsrDoneTimeValue.default)(config)
|
|
@@ -71,7 +76,7 @@ function _getVCMetrics() {
|
|
|
71
76
|
_interactionMetrics.postInteractionLog.setVCObserverSSRConfig(ssr);
|
|
72
77
|
tti = (_interaction$apdex = interaction.apdex) === null || _interaction$apdex === void 0 || (_interaction$apdex = _interaction$apdex[0]) === null || _interaction$apdex === void 0 ? void 0 : _interaction$apdex.stopTime;
|
|
73
78
|
prefix = 'ufo';
|
|
74
|
-
_context.next =
|
|
79
|
+
_context.next = 26;
|
|
75
80
|
return observer.getVCResult(_objectSpread({
|
|
76
81
|
start: interaction.start,
|
|
77
82
|
stop: interaction.end,
|
|
@@ -84,14 +89,9 @@ function _getVCMetrics() {
|
|
|
84
89
|
interactionId: interaction.id,
|
|
85
90
|
includeSSRRatio: (_config$vc3 = config.vc) === null || _config$vc3 === void 0 ? void 0 : _config$vc3.includeSSRRatio
|
|
86
91
|
}, ssr));
|
|
87
|
-
case
|
|
92
|
+
case 26:
|
|
88
93
|
result = _context.sent;
|
|
89
|
-
|
|
90
|
-
observer.stop(interaction.ufoName);
|
|
91
|
-
}
|
|
92
|
-
if ((_config$experimentalI = config.experimentalInteractionMetrics) !== null && _config$experimentalI !== void 0 && _config$experimentalI.enabled) {
|
|
93
|
-
observer.stop(interaction.ufoName);
|
|
94
|
-
}
|
|
94
|
+
observer.stop(interaction.ufoName);
|
|
95
95
|
_interactionMetrics.postInteractionLog.setLastInteractionFinishVCResult(result);
|
|
96
96
|
mostRecentVCRevision = (0, _config.getMostRecentVCRevision)(interaction.ufoName);
|
|
97
97
|
mostRecentVCRevisionPayload = result === null || result === void 0 || (_result$ufoVcRev = result['ufo:vc:rev']) === null || _result$ufoVcRev === void 0 ? void 0 : _result$ufoVcRev.find(function (_ref) {
|
|
@@ -99,15 +99,15 @@ function _getVCMetrics() {
|
|
|
99
99
|
return revision === mostRecentVCRevision;
|
|
100
100
|
});
|
|
101
101
|
if (!(!shouldReportVCMetrics || !(mostRecentVCRevisionPayload !== null && mostRecentVCRevisionPayload !== void 0 && mostRecentVCRevisionPayload.clean))) {
|
|
102
|
-
_context.next =
|
|
102
|
+
_context.next = 33;
|
|
103
103
|
break;
|
|
104
104
|
}
|
|
105
105
|
return _context.abrupt("return", result);
|
|
106
|
-
case
|
|
106
|
+
case 33:
|
|
107
107
|
return _context.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
|
|
108
108
|
'metric:vc90': mostRecentVCRevisionPayload['metric:vc90']
|
|
109
109
|
}));
|
|
110
|
-
case
|
|
110
|
+
case 34:
|
|
111
111
|
case "end":
|
|
112
112
|
return _context.stop();
|
|
113
113
|
}
|
|
@@ -569,8 +569,10 @@ function finishInteraction(id, data) {
|
|
|
569
569
|
callCleanUpCallbacks(data);
|
|
570
570
|
if ((_getConfig4 = (0, _config.getConfig)()) !== null && _getConfig4 !== void 0 && (_getConfig4 = _getConfig4.vc) !== null && _getConfig4 !== void 0 && _getConfig4.stopVCAtInteractionFinish) {
|
|
571
571
|
// Use per-interaction VC observer if available, otherwise fall back to global
|
|
572
|
-
var observer = data.vcObserver
|
|
573
|
-
|
|
572
|
+
var observer = data.vcObserver;
|
|
573
|
+
if (observer) {
|
|
574
|
+
data.vc = observer.getVCRawData();
|
|
575
|
+
}
|
|
574
576
|
}
|
|
575
577
|
if (!((_getConfig5 = (0, _config.getConfig)()) !== null && _getConfig5 !== void 0 && (_getConfig5 = _getConfig5.experimentalInteractionMetrics) !== null && _getConfig5 !== void 0 && _getConfig5.enabled)) {
|
|
576
578
|
remove(id);
|
|
@@ -817,7 +819,7 @@ function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelS
|
|
|
817
819
|
ssrEnablePageLayoutPlaceholder: config.vc.ssrEnablePageLayoutPlaceholder,
|
|
818
820
|
disableSizeAndPositionCheck: config.vc.disableSizeAndPositionCheck
|
|
819
821
|
};
|
|
820
|
-
vcObserver = (0,
|
|
822
|
+
vcObserver = (0, _vc.newVCObserver)(vcOptions);
|
|
821
823
|
}
|
|
822
824
|
|
|
823
825
|
// Create per-interaction VC observer when feature flag is enabled
|
|
@@ -894,31 +896,33 @@ function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelS
|
|
|
894
896
|
}
|
|
895
897
|
if (type === 'transition' || type === 'page_load') {
|
|
896
898
|
// Use per-interaction VC observer if available, otherwise fall back to global
|
|
897
|
-
var observer = vcObserver
|
|
898
|
-
observer
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
}
|
|
899
|
+
var observer = vcObserver;
|
|
900
|
+
if (observer) {
|
|
901
|
+
observer.start({
|
|
902
|
+
startTime: startTime,
|
|
903
|
+
experienceKey: ufoName
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
if ((0, _coinflip.default)((0, _config.getPostInteractionRate)(routeName || ufoName, type))) {
|
|
907
|
+
postInteractionLog.startVCObserver({
|
|
908
|
+
startTime: startTime
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
if ((0, _coinflip.default)((0, _config.getExperimentalInteractionRate)(ufoName, type))) {
|
|
912
|
+
_createExperimentalInteractionMetricsPayload.experimentalVC.start({
|
|
913
|
+
startTime: startTime
|
|
914
|
+
});
|
|
913
915
|
}
|
|
914
916
|
}
|
|
915
917
|
if (type === 'press' && (0, _platformFeatureFlags.fg)('platform_ufo_enable_vc_press_interactions')) {
|
|
916
918
|
// Use per-interaction VC observer if available, otherwise fall back to global
|
|
917
|
-
var _observer = vcObserver
|
|
918
|
-
_observer
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
919
|
+
var _observer = vcObserver;
|
|
920
|
+
if (_observer) {
|
|
921
|
+
_observer.start({
|
|
922
|
+
startTime: startTime,
|
|
923
|
+
experienceKey: ufoName
|
|
924
|
+
});
|
|
925
|
+
}
|
|
922
926
|
}
|
|
923
927
|
}
|
|
924
928
|
function addBrowserMetricEvent(event) {
|
|
@@ -15,7 +15,6 @@ var _hiddenTiming = require("../hidden-timing");
|
|
|
15
15
|
var _interactionMetrics = require("../interaction-metrics");
|
|
16
16
|
var _interactionsPerformanceObserver = require("../interactions-performance-observer");
|
|
17
17
|
var _machineUtilisation = require("../machine-utilisation");
|
|
18
|
-
var _vc = require("../vc");
|
|
19
18
|
var _scheduleIdleCallback = _interopRequireDefault(require("./schedule-idle-callback"));
|
|
20
19
|
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" != (0, _typeof2.default)(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); }
|
|
21
20
|
var initialized = false;
|
|
@@ -105,17 +104,6 @@ function init(analyticsWebClientAsync, config) {
|
|
|
105
104
|
startTime: 0
|
|
106
105
|
});
|
|
107
106
|
}
|
|
108
|
-
if (!(0, _platformFeatureFlags.fg)('platform_ufo_enable_vc_observer_per_interaction')) {
|
|
109
|
-
var _config$postInteracti;
|
|
110
|
-
(0, _vc.getVCObserver)(vcOptions).start({
|
|
111
|
-
startTime: 0
|
|
112
|
-
});
|
|
113
|
-
if ((_config$postInteracti = config.postInteractionLog) !== null && _config$postInteracti !== void 0 && _config$postInteracti.enabled) {
|
|
114
|
-
_interactionMetrics.postInteractionLog.startVCObserver({
|
|
115
|
-
startTime: 0
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
107
|
}
|
|
120
108
|
(0, _hiddenTiming.setupHiddenTimingCapture)();
|
|
121
109
|
(0, _additionalPayload.startLighthouseObserver)();
|
|
@@ -141,23 +129,23 @@ function init(analyticsWebClientAsync, config) {
|
|
|
141
129
|
createPostInteractionLogPayloadPackage = _ref2[2];
|
|
142
130
|
if (awc.getAnalyticsWebClientPromise) {
|
|
143
131
|
awc.getAnalyticsWebClientPromise().then(function (client) {
|
|
144
|
-
var _config$experimentalI2, _config$
|
|
132
|
+
var _config$experimentalI2, _config$postInteracti;
|
|
145
133
|
var instance = client.getInstance();
|
|
146
134
|
sinkInteraction(instance, payloadPackage);
|
|
147
135
|
if (config !== null && config !== void 0 && (_config$experimentalI2 = config.experimentalInteractionMetrics) !== null && _config$experimentalI2 !== void 0 && _config$experimentalI2.enabled) {
|
|
148
136
|
sinkExperimentalInteractionMetrics(instance, payloadPackage);
|
|
149
137
|
}
|
|
150
|
-
if ((_config$
|
|
138
|
+
if ((_config$postInteracti = config.postInteractionLog) !== null && _config$postInteracti !== void 0 && _config$postInteracti.enabled) {
|
|
151
139
|
sinkPostInteractionLog(instance, createPostInteractionLogPayloadPackage.default);
|
|
152
140
|
}
|
|
153
141
|
});
|
|
154
142
|
} else if (awc.sendOperationalEvent) {
|
|
155
|
-
var _config$experimentalI3, _config$
|
|
143
|
+
var _config$experimentalI3, _config$postInteracti2;
|
|
156
144
|
sinkInteraction(awc, payloadPackage);
|
|
157
145
|
if (config !== null && config !== void 0 && (_config$experimentalI3 = config.experimentalInteractionMetrics) !== null && _config$experimentalI3 !== void 0 && _config$experimentalI3.enabled) {
|
|
158
146
|
sinkExperimentalInteractionMetrics(awc, payloadPackage);
|
|
159
147
|
}
|
|
160
|
-
if ((_config$
|
|
148
|
+
if ((_config$postInteracti2 = config.postInteractionLog) !== null && _config$postInteracti2 !== void 0 && _config$postInteracti2.enabled) {
|
|
161
149
|
sinkPostInteractionLog(awc, createPostInteractionLogPayloadPackage.default);
|
|
162
150
|
}
|
|
163
151
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
2
|
import { getConfig, getMostRecentVCRevision } from '../../config';
|
|
3
3
|
import { postInteractionLog } from '../../interaction-metrics';
|
|
4
|
-
import { getVCObserver } from '../../vc';
|
|
5
4
|
import getInteractionStatus from './get-interaction-status';
|
|
6
5
|
import getPageVisibilityUpToTTAI from './get-page-visibility-up-to-ttai';
|
|
7
6
|
import getSSRDoneTimeValue from './get-ssr-done-time-value';
|
|
8
7
|
async function getVCMetrics(interaction) {
|
|
9
|
-
var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _interaction$apdex$, _config$vc2, _config$vc3,
|
|
8
|
+
var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _interaction$apdex$, _config$vc2, _config$vc3, _result$ufoVcRev;
|
|
10
9
|
const config = getConfig();
|
|
11
10
|
if (!(config !== null && config !== void 0 && (_config$vc = config.vc) !== null && _config$vc !== void 0 && _config$vc.enabled)) {
|
|
12
11
|
return {};
|
|
@@ -25,7 +24,10 @@ async function getVCMetrics(interaction) {
|
|
|
25
24
|
const shouldReportVCMetrics = interactionStatus.originalInteractionStatus === 'SUCCEEDED' && pageVisibilityUpToTTAI === 'visible';
|
|
26
25
|
|
|
27
26
|
// Use per-interaction VC observer if available, otherwise fall back to global
|
|
28
|
-
const observer = interaction.vcObserver
|
|
27
|
+
const observer = interaction.vcObserver;
|
|
28
|
+
if (!observer) {
|
|
29
|
+
return {};
|
|
30
|
+
}
|
|
29
31
|
if (!shouldReportVCMetrics && fg('platform_ufo_no_vc_on_aborted')) {
|
|
30
32
|
observer.stop(interaction.ufoName);
|
|
31
33
|
return {};
|
|
@@ -50,12 +52,7 @@ async function getVCMetrics(interaction) {
|
|
|
50
52
|
includeSSRRatio: (_config$vc3 = config.vc) === null || _config$vc3 === void 0 ? void 0 : _config$vc3.includeSSRRatio,
|
|
51
53
|
...ssr
|
|
52
54
|
});
|
|
53
|
-
|
|
54
|
-
observer.stop(interaction.ufoName);
|
|
55
|
-
}
|
|
56
|
-
if ((_config$experimentalI = config.experimentalInteractionMetrics) !== null && _config$experimentalI !== void 0 && _config$experimentalI.enabled) {
|
|
57
|
-
observer.stop(interaction.ufoName);
|
|
58
|
-
}
|
|
55
|
+
observer.stop(interaction.ufoName);
|
|
59
56
|
postInteractionLog.setLastInteractionFinishVCResult(result);
|
|
60
57
|
const mostRecentVCRevision = getMostRecentVCRevision(interaction.ufoName);
|
|
61
58
|
const mostRecentVCRevisionPayload = result === null || result === void 0 ? void 0 : (_result$ufoVcRev = result['ufo:vc:rev']) === null || _result$ufoVcRev === void 0 ? void 0 : _result$ufoVcRev.find(({
|
|
@@ -6,7 +6,7 @@ import { experimentalVC, getExperimentalVCMetrics, onExperimentalInteractionComp
|
|
|
6
6
|
import { clearActiveTrace } from '../experience-trace-id-context';
|
|
7
7
|
import { allFeatureFlagsAccessed, currentFeatureFlagsAccessed } from '../feature-flags-accessed';
|
|
8
8
|
import { getInteractionId } from '../interaction-id-context';
|
|
9
|
-
import {
|
|
9
|
+
import { newVCObserver } from '../vc';
|
|
10
10
|
import { interactions } from './common/constants';
|
|
11
11
|
import PostInteractionLog from './post-interaction-log';
|
|
12
12
|
const PreviousInteractionLog = {
|
|
@@ -487,8 +487,10 @@ function finishInteraction(id, data, endTime = performance.now()) {
|
|
|
487
487
|
callCleanUpCallbacks(data);
|
|
488
488
|
if ((_getConfig4 = getConfig()) !== null && _getConfig4 !== void 0 && (_getConfig4$vc = _getConfig4.vc) !== null && _getConfig4$vc !== void 0 && _getConfig4$vc.stopVCAtInteractionFinish) {
|
|
489
489
|
// Use per-interaction VC observer if available, otherwise fall back to global
|
|
490
|
-
const observer = data.vcObserver
|
|
491
|
-
|
|
490
|
+
const observer = data.vcObserver;
|
|
491
|
+
if (observer) {
|
|
492
|
+
data.vc = observer.getVCRawData();
|
|
493
|
+
}
|
|
492
494
|
}
|
|
493
495
|
if (!((_getConfig5 = getConfig()) !== null && _getConfig5 !== void 0 && (_getConfig5$experimen = _getConfig5.experimentalInteractionMetrics) !== null && _getConfig5$experimen !== void 0 && _getConfig5$experimen.enabled)) {
|
|
494
496
|
remove(id);
|
|
@@ -692,7 +694,7 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
|
|
|
692
694
|
ssrEnablePageLayoutPlaceholder: config.vc.ssrEnablePageLayoutPlaceholder,
|
|
693
695
|
disableSizeAndPositionCheck: config.vc.disableSizeAndPositionCheck
|
|
694
696
|
};
|
|
695
|
-
vcObserver =
|
|
697
|
+
vcObserver = newVCObserver(vcOptions);
|
|
696
698
|
}
|
|
697
699
|
|
|
698
700
|
// Create per-interaction VC observer when feature flag is enabled
|
|
@@ -769,31 +771,33 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
|
|
|
769
771
|
}
|
|
770
772
|
if (type === 'transition' || type === 'page_load') {
|
|
771
773
|
// Use per-interaction VC observer if available, otherwise fall back to global
|
|
772
|
-
const observer = vcObserver
|
|
773
|
-
observer
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
}
|
|
774
|
+
const observer = vcObserver;
|
|
775
|
+
if (observer) {
|
|
776
|
+
observer.start({
|
|
777
|
+
startTime,
|
|
778
|
+
experienceKey: ufoName
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
if (coinflip(getPostInteractionRate(routeName || ufoName, type))) {
|
|
782
|
+
postInteractionLog.startVCObserver({
|
|
783
|
+
startTime
|
|
784
|
+
});
|
|
785
|
+
}
|
|
786
|
+
if (coinflip(getExperimentalInteractionRate(ufoName, type))) {
|
|
787
|
+
experimentalVC.start({
|
|
788
|
+
startTime
|
|
789
|
+
});
|
|
788
790
|
}
|
|
789
791
|
}
|
|
790
792
|
if (type === 'press' && fg('platform_ufo_enable_vc_press_interactions')) {
|
|
791
793
|
// Use per-interaction VC observer if available, otherwise fall back to global
|
|
792
|
-
const observer = vcObserver
|
|
793
|
-
observer
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
794
|
+
const observer = vcObserver;
|
|
795
|
+
if (observer) {
|
|
796
|
+
observer.start({
|
|
797
|
+
startTime,
|
|
798
|
+
experienceKey: ufoName
|
|
799
|
+
});
|
|
800
|
+
}
|
|
797
801
|
}
|
|
798
802
|
}
|
|
799
803
|
export function addBrowserMetricEvent(event) {
|
|
@@ -6,7 +6,6 @@ import { setupHiddenTimingCapture } from '../hidden-timing';
|
|
|
6
6
|
import { postInteractionLog, sinkInteractionHandler, sinkPostInteractionLogHandler } from '../interaction-metrics';
|
|
7
7
|
import { getPerformanceObserver } from '../interactions-performance-observer';
|
|
8
8
|
import { initialiseMemoryObserver, initialisePressureObserver } from '../machine-utilisation';
|
|
9
|
-
import { getVCObserver } from '../vc';
|
|
10
9
|
import scheduleIdleCallback from './schedule-idle-callback';
|
|
11
10
|
let initialized = false;
|
|
12
11
|
function sinkInteraction(instance, payloadPackage) {
|
|
@@ -95,17 +94,6 @@ export function init(analyticsWebClientAsync, config) {
|
|
|
95
94
|
startTime: 0
|
|
96
95
|
});
|
|
97
96
|
}
|
|
98
|
-
if (!fg('platform_ufo_enable_vc_observer_per_interaction')) {
|
|
99
|
-
var _config$postInteracti;
|
|
100
|
-
getVCObserver(vcOptions).start({
|
|
101
|
-
startTime: 0
|
|
102
|
-
});
|
|
103
|
-
if ((_config$postInteracti = config.postInteractionLog) !== null && _config$postInteracti !== void 0 && _config$postInteracti.enabled) {
|
|
104
|
-
postInteractionLog.startVCObserver({
|
|
105
|
-
startTime: 0
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
97
|
}
|
|
110
98
|
setupHiddenTimingCapture();
|
|
111
99
|
startLighthouseObserver();
|
|
@@ -123,23 +111,23 @@ export function init(analyticsWebClientAsync, config) {
|
|
|
123
111
|
Promise.all([analyticsWebClientAsync, import( /* webpackChunkName: "create-payloads" */'../create-payload'), import( /* webpackChunkName: "create-post-interaction-log-payload" */'../create-post-interaction-log-payload')]).then(([awc, payloadPackage, createPostInteractionLogPayloadPackage]) => {
|
|
124
112
|
if (awc.getAnalyticsWebClientPromise) {
|
|
125
113
|
awc.getAnalyticsWebClientPromise().then(client => {
|
|
126
|
-
var _config$experimentalI2, _config$
|
|
114
|
+
var _config$experimentalI2, _config$postInteracti;
|
|
127
115
|
const instance = client.getInstance();
|
|
128
116
|
sinkInteraction(instance, payloadPackage);
|
|
129
117
|
if (config !== null && config !== void 0 && (_config$experimentalI2 = config.experimentalInteractionMetrics) !== null && _config$experimentalI2 !== void 0 && _config$experimentalI2.enabled) {
|
|
130
118
|
sinkExperimentalInteractionMetrics(instance, payloadPackage);
|
|
131
119
|
}
|
|
132
|
-
if ((_config$
|
|
120
|
+
if ((_config$postInteracti = config.postInteractionLog) !== null && _config$postInteracti !== void 0 && _config$postInteracti.enabled) {
|
|
133
121
|
sinkPostInteractionLog(instance, createPostInteractionLogPayloadPackage.default);
|
|
134
122
|
}
|
|
135
123
|
});
|
|
136
124
|
} else if (awc.sendOperationalEvent) {
|
|
137
|
-
var _config$experimentalI3, _config$
|
|
125
|
+
var _config$experimentalI3, _config$postInteracti2;
|
|
138
126
|
sinkInteraction(awc, payloadPackage);
|
|
139
127
|
if (config !== null && config !== void 0 && (_config$experimentalI3 = config.experimentalInteractionMetrics) !== null && _config$experimentalI3 !== void 0 && _config$experimentalI3.enabled) {
|
|
140
128
|
sinkExperimentalInteractionMetrics(awc, payloadPackage);
|
|
141
129
|
}
|
|
142
|
-
if ((_config$
|
|
130
|
+
if ((_config$postInteracti2 = config.postInteractionLog) !== null && _config$postInteracti2 !== void 0 && _config$postInteracti2.enabled) {
|
|
143
131
|
sinkPostInteractionLog(awc, createPostInteractionLogPayloadPackage.default);
|
|
144
132
|
}
|
|
145
133
|
}
|
|
@@ -6,7 +6,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import { getConfig, getMostRecentVCRevision } from '../../config';
|
|
8
8
|
import { postInteractionLog } from '../../interaction-metrics';
|
|
9
|
-
import { getVCObserver } from '../../vc';
|
|
10
9
|
import getInteractionStatus from './get-interaction-status';
|
|
11
10
|
import getPageVisibilityUpToTTAI from './get-page-visibility-up-to-ttai';
|
|
12
11
|
import getSSRDoneTimeValue from './get-ssr-done-time-value';
|
|
@@ -15,7 +14,7 @@ function getVCMetrics(_x) {
|
|
|
15
14
|
}
|
|
16
15
|
function _getVCMetrics() {
|
|
17
16
|
_getVCMetrics = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(interaction) {
|
|
18
|
-
var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _config$vc2, _config$vc3,
|
|
17
|
+
var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _config$vc2, _config$vc3, _result$ufoVcRev;
|
|
19
18
|
var config, interactionStatus, pageVisibilityUpToTTAI, shouldReportVCMetrics, observer, isSSREnabled, ssr, tti, prefix, result, mostRecentVCRevision, mostRecentVCRevisionPayload;
|
|
20
19
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
21
20
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -49,14 +48,20 @@ function _getVCMetrics() {
|
|
|
49
48
|
interactionStatus = getInteractionStatus(interaction);
|
|
50
49
|
pageVisibilityUpToTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
51
50
|
shouldReportVCMetrics = interactionStatus.originalInteractionStatus === 'SUCCEEDED' && pageVisibilityUpToTTAI === 'visible'; // Use per-interaction VC observer if available, otherwise fall back to global
|
|
52
|
-
observer = interaction.vcObserver
|
|
51
|
+
observer = interaction.vcObserver;
|
|
52
|
+
if (observer) {
|
|
53
|
+
_context.next = 16;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
return _context.abrupt("return", {});
|
|
57
|
+
case 16:
|
|
53
58
|
if (!(!shouldReportVCMetrics && fg('platform_ufo_no_vc_on_aborted'))) {
|
|
54
|
-
_context.next =
|
|
59
|
+
_context.next = 19;
|
|
55
60
|
break;
|
|
56
61
|
}
|
|
57
62
|
observer.stop(interaction.ufoName);
|
|
58
63
|
return _context.abrupt("return", {});
|
|
59
|
-
case
|
|
64
|
+
case 19:
|
|
60
65
|
isSSREnabled = interaction.type === 'page_load' && ((config === null || config === void 0 ? void 0 : config.ssr) || (config === null || config === void 0 || (_config$vc$ssrWhiteli = config.vc.ssrWhitelist) === null || _config$vc$ssrWhiteli === void 0 ? void 0 : _config$vc$ssrWhiteli.includes(interaction.ufoName)));
|
|
61
66
|
ssr = interaction.type === 'page_load' && isSSREnabled ? {
|
|
62
67
|
ssr: getSSRDoneTimeValue(config)
|
|
@@ -64,7 +69,7 @@ function _getVCMetrics() {
|
|
|
64
69
|
postInteractionLog.setVCObserverSSRConfig(ssr);
|
|
65
70
|
tti = (_interaction$apdex = interaction.apdex) === null || _interaction$apdex === void 0 || (_interaction$apdex = _interaction$apdex[0]) === null || _interaction$apdex === void 0 ? void 0 : _interaction$apdex.stopTime;
|
|
66
71
|
prefix = 'ufo';
|
|
67
|
-
_context.next =
|
|
72
|
+
_context.next = 26;
|
|
68
73
|
return observer.getVCResult(_objectSpread({
|
|
69
74
|
start: interaction.start,
|
|
70
75
|
stop: interaction.end,
|
|
@@ -77,14 +82,9 @@ function _getVCMetrics() {
|
|
|
77
82
|
interactionId: interaction.id,
|
|
78
83
|
includeSSRRatio: (_config$vc3 = config.vc) === null || _config$vc3 === void 0 ? void 0 : _config$vc3.includeSSRRatio
|
|
79
84
|
}, ssr));
|
|
80
|
-
case
|
|
85
|
+
case 26:
|
|
81
86
|
result = _context.sent;
|
|
82
|
-
|
|
83
|
-
observer.stop(interaction.ufoName);
|
|
84
|
-
}
|
|
85
|
-
if ((_config$experimentalI = config.experimentalInteractionMetrics) !== null && _config$experimentalI !== void 0 && _config$experimentalI.enabled) {
|
|
86
|
-
observer.stop(interaction.ufoName);
|
|
87
|
-
}
|
|
87
|
+
observer.stop(interaction.ufoName);
|
|
88
88
|
postInteractionLog.setLastInteractionFinishVCResult(result);
|
|
89
89
|
mostRecentVCRevision = getMostRecentVCRevision(interaction.ufoName);
|
|
90
90
|
mostRecentVCRevisionPayload = result === null || result === void 0 || (_result$ufoVcRev = result['ufo:vc:rev']) === null || _result$ufoVcRev === void 0 ? void 0 : _result$ufoVcRev.find(function (_ref) {
|
|
@@ -92,15 +92,15 @@ function _getVCMetrics() {
|
|
|
92
92
|
return revision === mostRecentVCRevision;
|
|
93
93
|
});
|
|
94
94
|
if (!(!shouldReportVCMetrics || !(mostRecentVCRevisionPayload !== null && mostRecentVCRevisionPayload !== void 0 && mostRecentVCRevisionPayload.clean))) {
|
|
95
|
-
_context.next =
|
|
95
|
+
_context.next = 33;
|
|
96
96
|
break;
|
|
97
97
|
}
|
|
98
98
|
return _context.abrupt("return", result);
|
|
99
|
-
case
|
|
99
|
+
case 33:
|
|
100
100
|
return _context.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
|
|
101
101
|
'metric:vc90': mostRecentVCRevisionPayload['metric:vc90']
|
|
102
102
|
}));
|
|
103
|
-
case
|
|
103
|
+
case 34:
|
|
104
104
|
case "end":
|
|
105
105
|
return _context.stop();
|
|
106
106
|
}
|
|
@@ -16,7 +16,7 @@ import { experimentalVC, getExperimentalVCMetrics, onExperimentalInteractionComp
|
|
|
16
16
|
import { clearActiveTrace } from '../experience-trace-id-context';
|
|
17
17
|
import { allFeatureFlagsAccessed, currentFeatureFlagsAccessed } from '../feature-flags-accessed';
|
|
18
18
|
import { getInteractionId } from '../interaction-id-context';
|
|
19
|
-
import {
|
|
19
|
+
import { newVCObserver } from '../vc';
|
|
20
20
|
import { interactions } from './common/constants';
|
|
21
21
|
import PostInteractionLog from './post-interaction-log';
|
|
22
22
|
var PreviousInteractionLog = {
|
|
@@ -523,8 +523,10 @@ function finishInteraction(id, data) {
|
|
|
523
523
|
callCleanUpCallbacks(data);
|
|
524
524
|
if ((_getConfig4 = getConfig()) !== null && _getConfig4 !== void 0 && (_getConfig4 = _getConfig4.vc) !== null && _getConfig4 !== void 0 && _getConfig4.stopVCAtInteractionFinish) {
|
|
525
525
|
// Use per-interaction VC observer if available, otherwise fall back to global
|
|
526
|
-
var observer = data.vcObserver
|
|
527
|
-
|
|
526
|
+
var observer = data.vcObserver;
|
|
527
|
+
if (observer) {
|
|
528
|
+
data.vc = observer.getVCRawData();
|
|
529
|
+
}
|
|
528
530
|
}
|
|
529
531
|
if (!((_getConfig5 = getConfig()) !== null && _getConfig5 !== void 0 && (_getConfig5 = _getConfig5.experimentalInteractionMetrics) !== null && _getConfig5 !== void 0 && _getConfig5.enabled)) {
|
|
530
532
|
remove(id);
|
|
@@ -771,7 +773,7 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
|
|
|
771
773
|
ssrEnablePageLayoutPlaceholder: config.vc.ssrEnablePageLayoutPlaceholder,
|
|
772
774
|
disableSizeAndPositionCheck: config.vc.disableSizeAndPositionCheck
|
|
773
775
|
};
|
|
774
|
-
vcObserver =
|
|
776
|
+
vcObserver = newVCObserver(vcOptions);
|
|
775
777
|
}
|
|
776
778
|
|
|
777
779
|
// Create per-interaction VC observer when feature flag is enabled
|
|
@@ -848,31 +850,33 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
|
|
|
848
850
|
}
|
|
849
851
|
if (type === 'transition' || type === 'page_load') {
|
|
850
852
|
// Use per-interaction VC observer if available, otherwise fall back to global
|
|
851
|
-
var observer = vcObserver
|
|
852
|
-
observer
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
}
|
|
853
|
+
var observer = vcObserver;
|
|
854
|
+
if (observer) {
|
|
855
|
+
observer.start({
|
|
856
|
+
startTime: startTime,
|
|
857
|
+
experienceKey: ufoName
|
|
858
|
+
});
|
|
859
|
+
}
|
|
860
|
+
if (coinflip(getPostInteractionRate(routeName || ufoName, type))) {
|
|
861
|
+
postInteractionLog.startVCObserver({
|
|
862
|
+
startTime: startTime
|
|
863
|
+
});
|
|
864
|
+
}
|
|
865
|
+
if (coinflip(getExperimentalInteractionRate(ufoName, type))) {
|
|
866
|
+
experimentalVC.start({
|
|
867
|
+
startTime: startTime
|
|
868
|
+
});
|
|
867
869
|
}
|
|
868
870
|
}
|
|
869
871
|
if (type === 'press' && fg('platform_ufo_enable_vc_press_interactions')) {
|
|
870
872
|
// Use per-interaction VC observer if available, otherwise fall back to global
|
|
871
|
-
var _observer = vcObserver
|
|
872
|
-
_observer
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
873
|
+
var _observer = vcObserver;
|
|
874
|
+
if (_observer) {
|
|
875
|
+
_observer.start({
|
|
876
|
+
startTime: startTime,
|
|
877
|
+
experienceKey: ufoName
|
|
878
|
+
});
|
|
879
|
+
}
|
|
876
880
|
}
|
|
877
881
|
}
|
|
878
882
|
export function addBrowserMetricEvent(event) {
|
|
@@ -7,7 +7,6 @@ import { setupHiddenTimingCapture } from '../hidden-timing';
|
|
|
7
7
|
import { postInteractionLog, sinkInteractionHandler, sinkPostInteractionLogHandler } from '../interaction-metrics';
|
|
8
8
|
import { getPerformanceObserver } from '../interactions-performance-observer';
|
|
9
9
|
import { initialiseMemoryObserver, initialisePressureObserver } from '../machine-utilisation';
|
|
10
|
-
import { getVCObserver } from '../vc';
|
|
11
10
|
import scheduleIdleCallback from './schedule-idle-callback';
|
|
12
11
|
var initialized = false;
|
|
13
12
|
function sinkInteraction(instance, payloadPackage) {
|
|
@@ -96,17 +95,6 @@ export function init(analyticsWebClientAsync, config) {
|
|
|
96
95
|
startTime: 0
|
|
97
96
|
});
|
|
98
97
|
}
|
|
99
|
-
if (!fg('platform_ufo_enable_vc_observer_per_interaction')) {
|
|
100
|
-
var _config$postInteracti;
|
|
101
|
-
getVCObserver(vcOptions).start({
|
|
102
|
-
startTime: 0
|
|
103
|
-
});
|
|
104
|
-
if ((_config$postInteracti = config.postInteractionLog) !== null && _config$postInteracti !== void 0 && _config$postInteracti.enabled) {
|
|
105
|
-
postInteractionLog.startVCObserver({
|
|
106
|
-
startTime: 0
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
98
|
}
|
|
111
99
|
setupHiddenTimingCapture();
|
|
112
100
|
startLighthouseObserver();
|
|
@@ -128,23 +116,23 @@ export function init(analyticsWebClientAsync, config) {
|
|
|
128
116
|
createPostInteractionLogPayloadPackage = _ref2[2];
|
|
129
117
|
if (awc.getAnalyticsWebClientPromise) {
|
|
130
118
|
awc.getAnalyticsWebClientPromise().then(function (client) {
|
|
131
|
-
var _config$experimentalI2, _config$
|
|
119
|
+
var _config$experimentalI2, _config$postInteracti;
|
|
132
120
|
var instance = client.getInstance();
|
|
133
121
|
sinkInteraction(instance, payloadPackage);
|
|
134
122
|
if (config !== null && config !== void 0 && (_config$experimentalI2 = config.experimentalInteractionMetrics) !== null && _config$experimentalI2 !== void 0 && _config$experimentalI2.enabled) {
|
|
135
123
|
sinkExperimentalInteractionMetrics(instance, payloadPackage);
|
|
136
124
|
}
|
|
137
|
-
if ((_config$
|
|
125
|
+
if ((_config$postInteracti = config.postInteractionLog) !== null && _config$postInteracti !== void 0 && _config$postInteracti.enabled) {
|
|
138
126
|
sinkPostInteractionLog(instance, createPostInteractionLogPayloadPackage.default);
|
|
139
127
|
}
|
|
140
128
|
});
|
|
141
129
|
} else if (awc.sendOperationalEvent) {
|
|
142
|
-
var _config$experimentalI3, _config$
|
|
130
|
+
var _config$experimentalI3, _config$postInteracti2;
|
|
143
131
|
sinkInteraction(awc, payloadPackage);
|
|
144
132
|
if (config !== null && config !== void 0 && (_config$experimentalI3 = config.experimentalInteractionMetrics) !== null && _config$experimentalI3 !== void 0 && _config$experimentalI3.enabled) {
|
|
145
133
|
sinkExperimentalInteractionMetrics(awc, payloadPackage);
|
|
146
134
|
}
|
|
147
|
-
if ((_config$
|
|
135
|
+
if ((_config$postInteracti2 = config.postInteractionLog) !== null && _config$postInteracti2 !== void 0 && _config$postInteracti2.enabled) {
|
|
148
136
|
sinkPostInteractionLog(awc, createPostInteractionLogPayloadPackage.default);
|
|
149
137
|
}
|
|
150
138
|
}
|
|
@@ -27,10 +27,10 @@ declare function createPostInteractionLogPayload({ lastInteractionFinish, reactP
|
|
|
27
27
|
vcClean: boolean;
|
|
28
28
|
type: import("../common").InteractionType;
|
|
29
29
|
abortReason?: import("../common").AbortReasonType | undefined;
|
|
30
|
-
id: string;
|
|
31
|
-
errors: import("../common").InteractionError[];
|
|
32
|
-
abortedByInteractionName?: string | undefined;
|
|
33
30
|
routeName: string | null;
|
|
31
|
+
abortedByInteractionName?: string | undefined;
|
|
32
|
+
errors: import("../common").InteractionError[];
|
|
33
|
+
id: string;
|
|
34
34
|
experimentalTTAI?: number | undefined;
|
|
35
35
|
experimentalVC90?: number | undefined;
|
|
36
36
|
};
|
|
@@ -27,10 +27,10 @@ declare function createPostInteractionLogPayload({ lastInteractionFinish, reactP
|
|
|
27
27
|
vcClean: boolean;
|
|
28
28
|
type: import("../common").InteractionType;
|
|
29
29
|
abortReason?: import("../common").AbortReasonType | undefined;
|
|
30
|
-
id: string;
|
|
31
|
-
errors: import("../common").InteractionError[];
|
|
32
|
-
abortedByInteractionName?: string | undefined;
|
|
33
30
|
routeName: string | null;
|
|
31
|
+
abortedByInteractionName?: string | undefined;
|
|
32
|
+
errors: import("../common").InteractionError[];
|
|
33
|
+
id: string;
|
|
34
34
|
experimentalTTAI?: number | undefined;
|
|
35
35
|
experimentalVC90?: number | undefined;
|
|
36
36
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-ufo",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.9",
|
|
4
4
|
"description": "Parts of React UFO that are publicly available",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -189,9 +189,6 @@
|
|
|
189
189
|
"platform_ufo_enable_vc_press_interactions": {
|
|
190
190
|
"type": "boolean"
|
|
191
191
|
},
|
|
192
|
-
"platform_ufo_enable_vc_observer_per_interaction": {
|
|
193
|
-
"type": "boolean"
|
|
194
|
-
},
|
|
195
192
|
"platform_ufo_abort_measurement_fix": {
|
|
196
193
|
"type": "boolean"
|
|
197
194
|
},
|