@atlaskit/react-ufo 4.11.1 → 4.11.3
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-interaction-extra-metrics-payload/index.js +58 -11
- package/dist/cjs/create-payload/utils/get-vc-metrics.js +1 -0
- package/dist/cjs/interaction-metrics/index.js +7 -6
- package/dist/cjs/interaction-metrics/interaction-extra-metrics.js +17 -10
- package/dist/cjs/interaction-metrics-init/index.js +2 -2
- package/dist/cjs/segment/segment.js +3 -19
- package/dist/cjs/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +8 -18
- package/dist/es2019/create-interaction-extra-metrics-payload/index.js +40 -5
- package/dist/es2019/create-payload/utils/get-vc-metrics.js +2 -1
- package/dist/es2019/interaction-metrics/index.js +7 -5
- package/dist/es2019/interaction-metrics/interaction-extra-metrics.js +14 -9
- package/dist/es2019/interaction-metrics-init/index.js +2 -2
- package/dist/es2019/segment/segment.js +2 -12
- package/dist/es2019/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +8 -18
- package/dist/esm/create-interaction-extra-metrics-payload/index.js +58 -11
- package/dist/esm/create-payload/utils/get-vc-metrics.js +2 -1
- package/dist/esm/interaction-metrics/index.js +7 -6
- package/dist/esm/interaction-metrics/interaction-extra-metrics.js +17 -10
- package/dist/esm/interaction-metrics-init/index.js +2 -2
- package/dist/esm/segment/segment.js +2 -16
- package/dist/esm/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +8 -18
- package/dist/types/config/index.d.ts +4 -0
- package/dist/types/create-interaction-extra-metrics-payload/index.d.ts +9 -1
- package/dist/types/create-post-interaction-log-payload/index.d.ts +1 -1
- package/dist/types/interaction-metrics/interaction-extra-metrics.d.ts +6 -3
- package/dist/types-ts4.5/config/index.d.ts +4 -0
- package/dist/types-ts4.5/create-interaction-extra-metrics-payload/index.d.ts +9 -1
- package/dist/types-ts4.5/create-post-interaction-log-payload/index.d.ts +1 -1
- package/dist/types-ts4.5/interaction-metrics/interaction-extra-metrics.d.ts +6 -3
- package/package.json +1 -4
- package/dist/cjs/segment/segment-highlight.js +0 -39
- package/dist/es2019/segment/segment-highlight.js +0 -27
- package/dist/esm/segment/segment-highlight.js +0 -30
- package/dist/types/segment/segment-highlight.d.ts +0 -6
- package/dist/types-ts4.5/segment/segment-highlight.d.ts +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/ufo-interaction-ignore
|
|
2
2
|
|
|
3
|
+
## 4.11.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`be9b699c35606`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/be9b699c35606) -
|
|
8
|
+
deprecate UFO segment highlighting
|
|
9
|
+
|
|
10
|
+
## 4.11.2
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`2237400c3b932`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2237400c3b932) -
|
|
15
|
+
FG cleanup - platform_ufo_unify_abort_status_in_ttvc_debug_data
|
|
16
|
+
|
|
3
17
|
## 4.11.1
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -31,13 +31,13 @@ var _interactionMetrics = require("../interaction-metrics");
|
|
|
31
31
|
var _excluded = ["labelStack"];
|
|
32
32
|
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; }
|
|
33
33
|
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; }
|
|
34
|
-
function createInteractionExtraLogPayload(_x, _x2) {
|
|
34
|
+
function createInteractionExtraLogPayload(_x, _x2, _x3, _x4) {
|
|
35
35
|
return _createInteractionExtraLogPayload.apply(this, arguments);
|
|
36
36
|
}
|
|
37
37
|
function _createInteractionExtraLogPayload() {
|
|
38
|
-
_createInteractionExtraLogPayload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(interactionId, interaction) {
|
|
39
|
-
var _getTTAI, _window$location;
|
|
40
|
-
var config, end, start, ufoName, rate, type, abortReason, routeName, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, knownSegments, sanitisedUfoName, configRate, pageVisibilityAtTTAI, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTAI, extraTTAI, newUFOName, finalVCMetrics, vcRevisionPayload, effectiveVCRevisionPayload, isThirdParty, filteredData, getDetailedInteractionMetrics, segments3p, segmentTree, payload;
|
|
38
|
+
_createInteractionExtraLogPayload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(interactionId, interaction, lastInteractionFinish, lastInteractionFinishVCResult) {
|
|
39
|
+
var _getTTAI, _lastInteractionFinis, _getTTAI2, _window$location;
|
|
40
|
+
var config, end, start, ufoName, rate, type, abortReason, routeName, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, knownSegments, minorInteractions, sanitisedUfoName, configRate, pageVisibilityAtTTAI, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTAI, extraTTAI, newUFOName, finalVCMetrics, vcRevisionPayload, effectiveVCRevisionPayload, normalTTAI, lastInteractionFinishStart, lastInteractionFinishEnd, lastInteractionFinishVC90, lastInteractionFinishVCClean, lastInteractionFinishVCRev, lastInteractionFinishRevision, isThirdParty, filteredData, getDetailedInteractionMetrics, segments3p, segmentTree, payload;
|
|
41
41
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
42
42
|
while (1) switch (_context.prev = _context.next) {
|
|
43
43
|
case 0:
|
|
@@ -48,7 +48,7 @@ function _createInteractionExtraLogPayload() {
|
|
|
48
48
|
}
|
|
49
49
|
throw Error('UFO Configuration not provided');
|
|
50
50
|
case 3:
|
|
51
|
-
end = interaction.end, start = interaction.start, ufoName = interaction.ufoName, rate = interaction.rate, type = interaction.type, abortReason = interaction.abortReason, routeName = interaction.routeName, previousInteractionName = interaction.previousInteractionName, isPreviousInteractionAborted = interaction.isPreviousInteractionAborted, abortedByInteractionName = interaction.abortedByInteractionName, knownSegments = interaction.knownSegments;
|
|
51
|
+
end = interaction.end, start = interaction.start, ufoName = interaction.ufoName, rate = interaction.rate, type = interaction.type, abortReason = interaction.abortReason, routeName = interaction.routeName, previousInteractionName = interaction.previousInteractionName, isPreviousInteractionAborted = interaction.isPreviousInteractionAborted, abortedByInteractionName = interaction.abortedByInteractionName, knownSegments = interaction.knownSegments, minorInteractions = interaction.minorInteractions;
|
|
52
52
|
sanitisedUfoName = (0, _utils.sanitizeUfoName)(ufoName);
|
|
53
53
|
configRate = (0, _config.getExtraInteractionRate)(sanitisedUfoName, type);
|
|
54
54
|
if ((0, _coinflip.default)(configRate)) {
|
|
@@ -59,7 +59,7 @@ function _createInteractionExtraLogPayload() {
|
|
|
59
59
|
case 8:
|
|
60
60
|
pageVisibilityAtTTAI = (0, _getPageVisibilityUpToTtai.default)(interaction);
|
|
61
61
|
isPageLoad = type === 'page_load' || type === 'transition';
|
|
62
|
-
if (isPageLoad) {
|
|
62
|
+
if (!(!isPageLoad || minorInteractions !== undefined && minorInteractions.length > 0)) {
|
|
63
63
|
_context.next = 12;
|
|
64
64
|
break;
|
|
65
65
|
}
|
|
@@ -85,6 +85,46 @@ function _createInteractionExtraLogPayload() {
|
|
|
85
85
|
}
|
|
86
86
|
return _context.abrupt("return", null);
|
|
87
87
|
case 23:
|
|
88
|
+
if (!(!lastInteractionFinish || lastInteractionFinish !== null && lastInteractionFinish !== void 0 && lastInteractionFinish.abortReason || lastInteractionFinish !== null && lastInteractionFinish !== void 0 && (_lastInteractionFinis = lastInteractionFinish.errors) !== null && _lastInteractionFinis !== void 0 && _lastInteractionFinis.length)) {
|
|
89
|
+
_context.next = 25;
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
return _context.abrupt("return", null);
|
|
93
|
+
case 25:
|
|
94
|
+
normalTTAI = (_getTTAI2 = (0, _getTtai.default)(lastInteractionFinish)) !== null && _getTTAI2 !== void 0 ? _getTTAI2 : undefined;
|
|
95
|
+
lastInteractionFinishStart = typeof lastInteractionFinish.start === 'number' ? Math.round(lastInteractionFinish.start) : undefined;
|
|
96
|
+
lastInteractionFinishEnd = typeof lastInteractionFinish.end === 'number' ? Math.round(lastInteractionFinish.end) : undefined;
|
|
97
|
+
lastInteractionFinishVC90 = null;
|
|
98
|
+
lastInteractionFinishVCClean = false;
|
|
99
|
+
if (!lastInteractionFinishVCResult) {
|
|
100
|
+
_context.next = 41;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
lastInteractionFinishVCRev = lastInteractionFinishVCResult['ufo:vc:rev'];
|
|
104
|
+
lastInteractionFinishRevision = lastInteractionFinishVCRev === null || lastInteractionFinishVCRev === void 0 ? void 0 : lastInteractionFinishVCRev.find(function (_ref2) {
|
|
105
|
+
var revision = _ref2.revision;
|
|
106
|
+
return revision === _config.DEFAULT_TTVC_REVISION;
|
|
107
|
+
});
|
|
108
|
+
if (!(lastInteractionFinishRevision !== null && lastInteractionFinishRevision !== void 0 && lastInteractionFinishRevision.clean)) {
|
|
109
|
+
_context.next = 38;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
lastInteractionFinishVCClean = true;
|
|
113
|
+
lastInteractionFinishVC90 = lastInteractionFinishRevision['metric:vc90'];
|
|
114
|
+
_context.next = 39;
|
|
115
|
+
break;
|
|
116
|
+
case 38:
|
|
117
|
+
return _context.abrupt("return", null);
|
|
118
|
+
case 39:
|
|
119
|
+
_context.next = 42;
|
|
120
|
+
break;
|
|
121
|
+
case 41:
|
|
122
|
+
if (normalTTAI !== undefined && typeof normalTTAI === 'number' && normalTTAI === extraTTAI) {
|
|
123
|
+
// Because TTAI is equal between with and without 3p, we can assume VC90 is also equal
|
|
124
|
+
lastInteractionFinishVC90 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90'];
|
|
125
|
+
lastInteractionFinishVCClean = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.clean;
|
|
126
|
+
}
|
|
127
|
+
case 42:
|
|
88
128
|
// Helper function to check if labelStack contains third-party type
|
|
89
129
|
isThirdParty = function isThirdParty(labelStack) {
|
|
90
130
|
var _labelStack$some;
|
|
@@ -127,9 +167,9 @@ function _createInteractionExtraLogPayload() {
|
|
|
127
167
|
getDetailedInteractionMetrics = function getDetailedInteractionMetrics() {
|
|
128
168
|
var _interaction$hold3pIn;
|
|
129
169
|
return {
|
|
130
|
-
errors: filteredData.errors.map(function (
|
|
131
|
-
var labelStack =
|
|
132
|
-
others = (0, _objectWithoutProperties2.default)(
|
|
170
|
+
errors: filteredData.errors.map(function (_ref3) {
|
|
171
|
+
var labelStack = _ref3.labelStack,
|
|
172
|
+
others = (0, _objectWithoutProperties2.default)(_ref3, _excluded);
|
|
133
173
|
return _objectSpread(_objectSpread({}, others), {}, {
|
|
134
174
|
labelStack: labelStack && (0, _utils.optimizeLabelStack)(labelStack, (0, _getReactUfoPayloadVersion.getReactUFOPayloadVersion)(interaction.type))
|
|
135
175
|
});
|
|
@@ -190,13 +230,20 @@ function _createInteractionExtraLogPayload() {
|
|
|
190
230
|
reactProfilerTimings: (0, _optimizeReactProfilerTimings.optimizeReactProfilerTimings)(filteredData.reactProfilerTimings, start, (0, _getReactUfoPayloadVersion.getReactUFOPayloadVersion)(interaction.type)),
|
|
191
231
|
customData: filteredData.customData
|
|
192
232
|
}, getDetailedInteractionMetrics()),
|
|
193
|
-
'vc:effective:revision': _config.DEFAULT_TTVC_REVISION
|
|
233
|
+
'vc:effective:revision': _config.DEFAULT_TTVC_REVISION,
|
|
234
|
+
lastInteractionFinish: {
|
|
235
|
+
start: lastInteractionFinishStart,
|
|
236
|
+
end: lastInteractionFinishEnd,
|
|
237
|
+
ttai: normalTTAI,
|
|
238
|
+
vc90: lastInteractionFinishVC90,
|
|
239
|
+
vcClean: lastInteractionFinishVCClean
|
|
240
|
+
}
|
|
194
241
|
}
|
|
195
242
|
}
|
|
196
243
|
};
|
|
197
244
|
payload.attributes.properties['event:sizeInKb'] = (0, _getPayloadSize.default)(payload.attributes.properties);
|
|
198
245
|
return _context.abrupt("return", payload);
|
|
199
|
-
case
|
|
246
|
+
case 51:
|
|
200
247
|
case "end":
|
|
201
248
|
return _context.stop();
|
|
202
249
|
}
|
|
@@ -97,6 +97,7 @@ function _getVCMetrics() {
|
|
|
97
97
|
if (!include3p) {
|
|
98
98
|
// For Post Interaction, last interaction should be without 3p
|
|
99
99
|
_interactionMetrics.postInteractionLog.setLastInteractionFinishVCResult(result);
|
|
100
|
+
_interactionMetrics.interactionExtraMetrics.setLastInteractionFinishVCResult(result);
|
|
100
101
|
}
|
|
101
102
|
mostRecentVCRevision = (0, _config.getMostRecentVCRevision)(interaction.ufoName);
|
|
102
103
|
mostRecentVCRevisionPayload = result === null || result === void 0 || (_result$ufoVcRev = result['ufo:vc:rev']) === null || _result$ufoVcRev === void 0 ? void 0 : _result$ufoVcRev.find(function (_ref) {
|
|
@@ -734,7 +734,8 @@ function finishInteraction(id, data) {
|
|
|
734
734
|
PreviousInteractionLog.isAborted = data.abortReason != null;
|
|
735
735
|
if (data.ufoName) {
|
|
736
736
|
if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
|
|
737
|
-
|
|
737
|
+
var _interactionExtraMetr;
|
|
738
|
+
if (((_interactionExtraMetr = interactionExtraMetrics.finishedInteraction) === null || _interactionExtraMetr === void 0 ? void 0 : _interactionExtraMetr.id) !== id) {
|
|
738
739
|
// If this same interaction was not already handled, handle it
|
|
739
740
|
handleInteraction(id, data);
|
|
740
741
|
}
|
|
@@ -819,7 +820,7 @@ function tryComplete(interactionId, endTime) {
|
|
|
819
820
|
var postInteraction = /*#__PURE__*/function () {
|
|
820
821
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
821
822
|
var _getConfig7;
|
|
822
|
-
var _getConfig8, experimentalVC90, experimentalTTAI, _yield$getExperimenta, start, end, _getConfig9, _getConfig0;
|
|
823
|
+
var _getConfig8, experimentalVC90, experimentalTTAI, _yield$getExperimenta, start, end, _interactionExtraMetr2, _getConfig9, _getConfig0;
|
|
823
824
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
824
825
|
while (1) switch (_context.prev = _context.next) {
|
|
825
826
|
case 0:
|
|
@@ -862,7 +863,7 @@ function tryComplete(interactionId, endTime) {
|
|
|
862
863
|
}));
|
|
863
864
|
case 17:
|
|
864
865
|
if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
|
|
865
|
-
if (interactionExtraMetrics.
|
|
866
|
+
if (((_interactionExtraMetr2 = interactionExtraMetrics.finishedInteraction) === null || _interactionExtraMetr2 === void 0 ? void 0 : _interactionExtraMetr2.id) !== interactionId) {
|
|
866
867
|
// If interactionExtraMetrics is not waiting for measuring this interaction
|
|
867
868
|
if ((_getConfig9 = (0, _config.getConfig)()) !== null && _getConfig9 !== void 0 && (_getConfig9 = _getConfig9.experimentalInteractionMetrics) !== null && _getConfig9 !== void 0 && _getConfig9.enabled) {
|
|
868
869
|
remove(interactionId);
|
|
@@ -885,15 +886,15 @@ function tryComplete(interactionId, endTime) {
|
|
|
885
886
|
};
|
|
886
887
|
}();
|
|
887
888
|
if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
|
|
888
|
-
var _interaction$hold3pAc;
|
|
889
|
+
var _interaction$hold3pAc, _interactionExtraMetr3;
|
|
889
890
|
var noMoreActive3pHolds = ((_interaction$hold3pAc = interaction.hold3pActive) === null || _interaction$hold3pAc === void 0 ? void 0 : _interaction$hold3pAc.size) === 0 || interaction.hold3pActive === undefined;
|
|
890
|
-
if (noMoreActiveHolds && interactionExtraMetrics.
|
|
891
|
+
if (noMoreActiveHolds && ((_interactionExtraMetr3 = interactionExtraMetrics.finishedInteraction) === null || _interactionExtraMetr3 === void 0 ? void 0 : _interactionExtraMetr3.id) !== interactionId) {
|
|
891
892
|
// If it's not waiting for extra metrics to complete, finish the interaction as normal
|
|
892
893
|
if (!activeSubmitted) {
|
|
893
894
|
var _getConfig1, _getConfig10, _getConfig11;
|
|
894
895
|
finishInteraction(interactionId, interaction, endTime);
|
|
895
896
|
if ((_getConfig1 = (0, _config.getConfig)()) !== null && _getConfig1 !== void 0 && (_getConfig1 = _getConfig1.extraInteractionMetrics) !== null && _getConfig1 !== void 0 && _getConfig1.enabled) {
|
|
896
|
-
interactionExtraMetrics.
|
|
897
|
+
interactionExtraMetrics.updateFinishedInteraction(interaction);
|
|
897
898
|
}
|
|
898
899
|
if ((_getConfig10 = (0, _config.getConfig)()) !== null && _getConfig10 !== void 0 && (_getConfig10 = _getConfig10.extraSearchPageInteraction) !== null && _getConfig10 !== void 0 && _getConfig10.enabled && interaction.ufoName === ((_getConfig11 = (0, _config.getConfig)()) === null || _getConfig11 === void 0 || (_getConfig11 = _getConfig11.extraSearchPageInteraction) === null || _getConfig11 === void 0 ? void 0 : _getConfig11.searchPageMetricName) && (0, _platformFeatureFlags.fg)('react_ufo_unified_search_ignoring_sain_metric')) {
|
|
899
900
|
(0, _createExtraSearchPageInteractionPayload.onSearchPageInteractionComplete)(interactionId, interaction);
|
|
@@ -16,8 +16,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
16
16
|
var InteractionExtraMetrics = exports.default = /*#__PURE__*/function () {
|
|
17
17
|
function InteractionExtraMetrics() {
|
|
18
18
|
(0, _classCallCheck2.default)(this, InteractionExtraMetrics);
|
|
19
|
-
// Store the finished interaction
|
|
20
|
-
(0, _defineProperty2.default)(this, "
|
|
19
|
+
// Store the finished interaction (as non-3p interaction)
|
|
20
|
+
(0, _defineProperty2.default)(this, "finishedInteraction", null);
|
|
21
21
|
// independent VC observer, that observes until `custom.post-interaction-logs` event is sent
|
|
22
22
|
(0, _defineProperty2.default)(this, "vcObserver", null);
|
|
23
23
|
(0, _defineProperty2.default)(this, "sinkHandlerFn", function () {});
|
|
@@ -55,12 +55,17 @@ var InteractionExtraMetrics = exports.default = /*#__PURE__*/function () {
|
|
|
55
55
|
return (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'page_load' || (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'transition';
|
|
56
56
|
}
|
|
57
57
|
}, {
|
|
58
|
-
key: "
|
|
59
|
-
value: function
|
|
60
|
-
if (
|
|
61
|
-
this.
|
|
58
|
+
key: "updateFinishedInteraction",
|
|
59
|
+
value: function updateFinishedInteraction(interaction) {
|
|
60
|
+
if ((interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'page_load' || (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'transition') {
|
|
61
|
+
this.finishedInteraction = interaction;
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
+
}, {
|
|
65
|
+
key: "setLastInteractionFinishVCResult",
|
|
66
|
+
value: function setLastInteractionFinishVCResult(result) {
|
|
67
|
+
this.lastInteractionFinishVCResult = result;
|
|
68
|
+
}
|
|
64
69
|
}, {
|
|
65
70
|
key: "sinkHandler",
|
|
66
71
|
value: function sinkHandler(fn) {
|
|
@@ -74,7 +79,7 @@ var InteractionExtraMetrics = exports.default = /*#__PURE__*/function () {
|
|
|
74
79
|
var updatedData = _objectSpread(_objectSpread({}, data), {}, {
|
|
75
80
|
vcObserver: (_this$vcObserver3 = this.vcObserver) !== null && _this$vcObserver3 !== void 0 ? _this$vcObserver3 : undefined
|
|
76
81
|
});
|
|
77
|
-
this.sinkHandlerFn(id, updatedData);
|
|
82
|
+
this.sinkHandlerFn(id, updatedData, this.finishedInteraction, this.lastInteractionFinishVCResult);
|
|
78
83
|
}
|
|
79
84
|
this.stopVCObserver();
|
|
80
85
|
(0, _index.remove)(id);
|
|
@@ -83,11 +88,13 @@ var InteractionExtraMetrics = exports.default = /*#__PURE__*/function () {
|
|
|
83
88
|
}, {
|
|
84
89
|
key: "reset",
|
|
85
90
|
value: function reset() {
|
|
91
|
+
var _this$finishedInterac;
|
|
86
92
|
this.stopVCObserver();
|
|
87
|
-
if (this.
|
|
88
|
-
(0, _index.remove)(this.
|
|
93
|
+
if ((_this$finishedInterac = this.finishedInteraction) !== null && _this$finishedInterac !== void 0 && _this$finishedInterac.id) {
|
|
94
|
+
(0, _index.remove)(this.finishedInteraction.id);
|
|
89
95
|
}
|
|
90
|
-
this.
|
|
96
|
+
this.finishedInteraction = null;
|
|
97
|
+
this.lastInteractionFinishVCResult = undefined;
|
|
91
98
|
}
|
|
92
99
|
}, {
|
|
93
100
|
key: "stopAll",
|
|
@@ -82,14 +82,14 @@ function sinkPostInteractionLog(instance, createPostInteractionLogPayload) {
|
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
84
|
function sinkInteractionExtraMetrics(instance, createInteractionExtraLogPayload) {
|
|
85
|
-
_interactionMetrics.interactionExtraMetrics.sinkHandler(function (interactionId, interaction) {
|
|
85
|
+
_interactionMetrics.interactionExtraMetrics.sinkHandler(function (interactionId, interaction, lastInteractionFinish, lastInteractionFinishVCResult) {
|
|
86
86
|
(0, _scheduleIdleCallback.default)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
87
87
|
var payload, devToolObserver;
|
|
88
88
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
89
89
|
while (1) switch (_context.prev = _context.next) {
|
|
90
90
|
case 0:
|
|
91
91
|
_context.next = 2;
|
|
92
|
-
return createInteractionExtraLogPayload(interactionId, interaction);
|
|
92
|
+
return createInteractionExtraLogPayload(interactionId, interaction, lastInteractionFinish, lastInteractionFinishVCResult);
|
|
93
93
|
case 2:
|
|
94
94
|
payload = _context.sent;
|
|
95
95
|
if (payload) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = UFOSegment;
|
|
8
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -21,24 +21,13 @@ var _interactionMetrics = require("../interaction-metrics");
|
|
|
21
21
|
var _routeNameContext = _interopRequireDefault(require("../route-name-context"));
|
|
22
22
|
var _shortId = _interopRequireDefault(require("../short-id"));
|
|
23
23
|
var _scheduleOnPaint = _interopRequireDefault(require("./schedule-on-paint"));
|
|
24
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
24
25
|
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; }
|
|
25
26
|
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; }
|
|
26
|
-
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); }
|
|
27
27
|
var tryCompleteHandle;
|
|
28
|
-
var AsyncSegmentHighlight = /*#__PURE__*/(0, _react.lazy)(function () {
|
|
29
|
-
return Promise.resolve().then(function () {
|
|
30
|
-
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_ufo-segment-highlight" */'./segment-highlight'));
|
|
31
|
-
}).then(function (module) {
|
|
32
|
-
return {
|
|
33
|
-
default: module.SegmentHighlight
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
28
|
|
|
38
|
-
// KARL TODO: finish self profiling
|
|
39
29
|
/** A portion of the page we apply measurement to */
|
|
40
30
|
function UFOSegment(_ref) {
|
|
41
|
-
var _getConfig2;
|
|
42
31
|
var segmentName = _ref.name,
|
|
43
32
|
children = _ref.children,
|
|
44
33
|
_ref$mode = _ref.mode,
|
|
@@ -289,16 +278,11 @@ function UFOSegment(_ref) {
|
|
|
289
278
|
return l.name;
|
|
290
279
|
}).join('/');
|
|
291
280
|
}, [labelStack]);
|
|
292
|
-
var enableSegmentHighlighting = (_getConfig2 = (0, _config.getConfig)()) === null || _getConfig2 === void 0 ? void 0 : _getConfig2.enableSegmentHighlighting;
|
|
293
281
|
return /*#__PURE__*/_react.default.createElement(_interactionContext.default.Provider, {
|
|
294
282
|
value: interactionContext
|
|
295
283
|
}, /*#__PURE__*/_react.default.createElement(_react.Profiler, {
|
|
296
284
|
id: reactProfilerId,
|
|
297
285
|
onRender: onRender
|
|
298
|
-
}, children
|
|
299
|
-
fallback: null
|
|
300
|
-
}, /*#__PURE__*/_react.default.createElement(AsyncSegmentHighlight, {
|
|
301
|
-
segmentName: segmentName
|
|
302
|
-
}))));
|
|
286
|
+
}, children));
|
|
303
287
|
}
|
|
304
288
|
UFOSegment.displayName = 'UFOSegment';
|
|
@@ -310,24 +310,14 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
|
|
|
310
310
|
// Only create debug details if callbacks exist
|
|
311
311
|
v3RevisionDebugDetails = null;
|
|
312
312
|
if (shouldCalculateDebugDetails) {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
};
|
|
322
|
-
} else {
|
|
323
|
-
v3RevisionDebugDetails = {
|
|
324
|
-
revision: this.revisionNo,
|
|
325
|
-
isClean: isVCClean,
|
|
326
|
-
abortReason: dirtyReason,
|
|
327
|
-
vcLogs: enhancedVcLogs,
|
|
328
|
-
interactionId: interactionId
|
|
329
|
-
};
|
|
330
|
-
}
|
|
313
|
+
v3RevisionDebugDetails = {
|
|
314
|
+
revision: this.revisionNo,
|
|
315
|
+
isClean: isVCClean && !interactionAbortReason && isPageVisible,
|
|
316
|
+
abortReason: !isPageVisible ? 'browser_backgrounded' : dirtyReason !== null && dirtyReason !== void 0 ? dirtyReason : interactionAbortReason,
|
|
317
|
+
vcLogs: enhancedVcLogs,
|
|
318
|
+
interactionId: interactionId,
|
|
319
|
+
interactionType: interactionType
|
|
320
|
+
};
|
|
331
321
|
}
|
|
332
322
|
|
|
333
323
|
// Handle devtool callback
|
|
@@ -16,8 +16,8 @@ import { optimizeReactProfilerTimings } from '../create-payload/utils/optimize-r
|
|
|
16
16
|
import { optimizeRequestInfo } from '../create-payload/utils/optimize-request-info';
|
|
17
17
|
import { optimizeSpans } from '../create-payload/utils/optimize-spans';
|
|
18
18
|
import { interactionSpans as atlaskitInteractionSpans } from '../interaction-metrics';
|
|
19
|
-
async function createInteractionExtraLogPayload(interactionId, interaction) {
|
|
20
|
-
var _getTTAI, _window$location;
|
|
19
|
+
async function createInteractionExtraLogPayload(interactionId, interaction, lastInteractionFinish, lastInteractionFinishVCResult) {
|
|
20
|
+
var _getTTAI, _lastInteractionFinis, _getTTAI2, _window$location;
|
|
21
21
|
const config = getConfig();
|
|
22
22
|
if (!config) {
|
|
23
23
|
throw Error('UFO Configuration not provided');
|
|
@@ -33,7 +33,8 @@ async function createInteractionExtraLogPayload(interactionId, interaction) {
|
|
|
33
33
|
previousInteractionName,
|
|
34
34
|
isPreviousInteractionAborted,
|
|
35
35
|
abortedByInteractionName,
|
|
36
|
-
knownSegments
|
|
36
|
+
knownSegments,
|
|
37
|
+
minorInteractions
|
|
37
38
|
} = interaction;
|
|
38
39
|
const sanitisedUfoName = sanitizeUfoName(ufoName);
|
|
39
40
|
const configRate = getExtraInteractionRate(sanitisedUfoName, type);
|
|
@@ -42,7 +43,8 @@ async function createInteractionExtraLogPayload(interactionId, interaction) {
|
|
|
42
43
|
}
|
|
43
44
|
const pageVisibilityAtTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
44
45
|
const isPageLoad = type === 'page_load' || type === 'transition';
|
|
45
|
-
if (!isPageLoad) {
|
|
46
|
+
if (!isPageLoad || minorInteractions !== undefined && minorInteractions.length > 0) {
|
|
47
|
+
// Not send if aborted by minor interaction for now
|
|
46
48
|
// Only create payload for page load
|
|
47
49
|
return null;
|
|
48
50
|
}
|
|
@@ -61,6 +63,32 @@ async function createInteractionExtraLogPayload(interactionId, interaction) {
|
|
|
61
63
|
return null;
|
|
62
64
|
}
|
|
63
65
|
|
|
66
|
+
// Get normal TTAI & VC90 for last finished interaction (without 3p)
|
|
67
|
+
if (!lastInteractionFinish || lastInteractionFinish !== null && lastInteractionFinish !== void 0 && lastInteractionFinish.abortReason || lastInteractionFinish !== null && lastInteractionFinish !== void 0 && (_lastInteractionFinis = lastInteractionFinish.errors) !== null && _lastInteractionFinis !== void 0 && _lastInteractionFinis.length) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
const normalTTAI = (_getTTAI2 = getTTAI(lastInteractionFinish)) !== null && _getTTAI2 !== void 0 ? _getTTAI2 : undefined;
|
|
71
|
+
const lastInteractionFinishStart = typeof lastInteractionFinish.start === 'number' ? Math.round(lastInteractionFinish.start) : undefined;
|
|
72
|
+
const lastInteractionFinishEnd = typeof lastInteractionFinish.end === 'number' ? Math.round(lastInteractionFinish.end) : undefined;
|
|
73
|
+
let lastInteractionFinishVC90 = null;
|
|
74
|
+
let lastInteractionFinishVCClean = false;
|
|
75
|
+
if (lastInteractionFinishVCResult) {
|
|
76
|
+
const lastInteractionFinishVCRev = lastInteractionFinishVCResult['ufo:vc:rev'];
|
|
77
|
+
const lastInteractionFinishRevision = lastInteractionFinishVCRev === null || lastInteractionFinishVCRev === void 0 ? void 0 : lastInteractionFinishVCRev.find(({
|
|
78
|
+
revision
|
|
79
|
+
}) => revision === DEFAULT_TTVC_REVISION);
|
|
80
|
+
if (lastInteractionFinishRevision !== null && lastInteractionFinishRevision !== void 0 && lastInteractionFinishRevision.clean) {
|
|
81
|
+
lastInteractionFinishVCClean = true;
|
|
82
|
+
lastInteractionFinishVC90 = lastInteractionFinishRevision['metric:vc90'];
|
|
83
|
+
} else {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
} else if (normalTTAI !== undefined && typeof normalTTAI === 'number' && normalTTAI === extraTTAI) {
|
|
87
|
+
// Because TTAI is equal between with and without 3p, we can assume VC90 is also equal
|
|
88
|
+
lastInteractionFinishVC90 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90'];
|
|
89
|
+
lastInteractionFinishVCClean = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.clean;
|
|
90
|
+
}
|
|
91
|
+
|
|
64
92
|
// Helper function to check if labelStack contains third-party type
|
|
65
93
|
const isThirdParty = labelStack => {
|
|
66
94
|
var _labelStack$some;
|
|
@@ -148,7 +176,14 @@ async function createInteractionExtraLogPayload(interactionId, interaction) {
|
|
|
148
176
|
customData: filteredData.customData,
|
|
149
177
|
...getDetailedInteractionMetrics()
|
|
150
178
|
},
|
|
151
|
-
'vc:effective:revision': DEFAULT_TTVC_REVISION
|
|
179
|
+
'vc:effective:revision': DEFAULT_TTVC_REVISION,
|
|
180
|
+
lastInteractionFinish: {
|
|
181
|
+
start: lastInteractionFinishStart,
|
|
182
|
+
end: lastInteractionFinishEnd,
|
|
183
|
+
ttai: normalTTAI,
|
|
184
|
+
vc90: lastInteractionFinishVC90,
|
|
185
|
+
vcClean: lastInteractionFinishVCClean
|
|
186
|
+
}
|
|
152
187
|
}
|
|
153
188
|
}
|
|
154
189
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getConfig, getMostRecentVCRevision } from '../../config';
|
|
2
|
-
import { postInteractionLog } from '../../interaction-metrics';
|
|
2
|
+
import { interactionExtraMetrics, postInteractionLog } from '../../interaction-metrics';
|
|
3
3
|
import getInteractionStatus from './get-interaction-status';
|
|
4
4
|
import getPageVisibilityUpToTTAI from './get-page-visibility-up-to-ttai';
|
|
5
5
|
import getSSRDoneTimeValue from './get-ssr-done-time-value';
|
|
@@ -50,6 +50,7 @@ async function getVCMetrics(interaction, include3p = false, excludeSmartAnswersI
|
|
|
50
50
|
if (!include3p) {
|
|
51
51
|
// For Post Interaction, last interaction should be without 3p
|
|
52
52
|
postInteractionLog.setLastInteractionFinishVCResult(result);
|
|
53
|
+
interactionExtraMetrics.setLastInteractionFinishVCResult(result);
|
|
53
54
|
}
|
|
54
55
|
const mostRecentVCRevision = getMostRecentVCRevision(interaction.ufoName);
|
|
55
56
|
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(({
|
|
@@ -652,7 +652,8 @@ function finishInteraction(id, data, endTime = performance.now()) {
|
|
|
652
652
|
PreviousInteractionLog.isAborted = data.abortReason != null;
|
|
653
653
|
if (data.ufoName) {
|
|
654
654
|
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
655
|
-
|
|
655
|
+
var _interactionExtraMetr;
|
|
656
|
+
if (((_interactionExtraMetr = interactionExtraMetrics.finishedInteraction) === null || _interactionExtraMetr === void 0 ? void 0 : _interactionExtraMetr.id) !== id) {
|
|
656
657
|
// If this same interaction was not already handled, handle it
|
|
657
658
|
handleInteraction(id, data);
|
|
658
659
|
}
|
|
@@ -747,7 +748,8 @@ export function tryComplete(interactionId, endTime) {
|
|
|
747
748
|
});
|
|
748
749
|
}
|
|
749
750
|
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
750
|
-
|
|
751
|
+
var _interactionExtraMetr2;
|
|
752
|
+
if (((_interactionExtraMetr2 = interactionExtraMetrics.finishedInteraction) === null || _interactionExtraMetr2 === void 0 ? void 0 : _interactionExtraMetr2.id) !== interactionId) {
|
|
751
753
|
var _getConfig9, _getConfig9$experimen;
|
|
752
754
|
// If interactionExtraMetrics is not waiting for measuring this interaction
|
|
753
755
|
if ((_getConfig9 = getConfig()) !== null && _getConfig9 !== void 0 && (_getConfig9$experimen = _getConfig9.experimentalInteractionMetrics) !== null && _getConfig9$experimen !== void 0 && _getConfig9$experimen.enabled) {
|
|
@@ -763,15 +765,15 @@ export function tryComplete(interactionId, endTime) {
|
|
|
763
765
|
activeSubmitted = false;
|
|
764
766
|
};
|
|
765
767
|
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
766
|
-
var _interaction$hold3pAc;
|
|
768
|
+
var _interaction$hold3pAc, _interactionExtraMetr3;
|
|
767
769
|
const noMoreActive3pHolds = ((_interaction$hold3pAc = interaction.hold3pActive) === null || _interaction$hold3pAc === void 0 ? void 0 : _interaction$hold3pAc.size) === 0 || interaction.hold3pActive === undefined;
|
|
768
|
-
if (noMoreActiveHolds && interactionExtraMetrics.
|
|
770
|
+
if (noMoreActiveHolds && ((_interactionExtraMetr3 = interactionExtraMetrics.finishedInteraction) === null || _interactionExtraMetr3 === void 0 ? void 0 : _interactionExtraMetr3.id) !== interactionId) {
|
|
769
771
|
// If it's not waiting for extra metrics to complete, finish the interaction as normal
|
|
770
772
|
if (!activeSubmitted) {
|
|
771
773
|
var _getConfig1, _getConfig1$extraInte, _getConfig10, _getConfig10$extraSea, _getConfig11, _getConfig11$extraSea;
|
|
772
774
|
finishInteraction(interactionId, interaction, endTime);
|
|
773
775
|
if ((_getConfig1 = getConfig()) !== null && _getConfig1 !== void 0 && (_getConfig1$extraInte = _getConfig1.extraInteractionMetrics) !== null && _getConfig1$extraInte !== void 0 && _getConfig1$extraInte.enabled) {
|
|
774
|
-
interactionExtraMetrics.
|
|
776
|
+
interactionExtraMetrics.updateFinishedInteraction(interaction);
|
|
775
777
|
}
|
|
776
778
|
if ((_getConfig10 = getConfig()) !== null && _getConfig10 !== void 0 && (_getConfig10$extraSea = _getConfig10.extraSearchPageInteraction) !== null && _getConfig10$extraSea !== void 0 && _getConfig10$extraSea.enabled && interaction.ufoName === ((_getConfig11 = getConfig()) === null || _getConfig11 === void 0 ? void 0 : (_getConfig11$extraSea = _getConfig11.extraSearchPageInteraction) === null || _getConfig11$extraSea === void 0 ? void 0 : _getConfig11$extraSea.searchPageMetricName) && fg('react_ufo_unified_search_ignoring_sain_metric')) {
|
|
777
779
|
onSearchPageInteractionComplete(interactionId, interaction);
|
|
@@ -4,8 +4,8 @@ import { interactions } from './common/constants';
|
|
|
4
4
|
import { remove } from './index';
|
|
5
5
|
export default class InteractionExtraMetrics {
|
|
6
6
|
constructor() {
|
|
7
|
-
// Store the finished interaction
|
|
8
|
-
_defineProperty(this, "
|
|
7
|
+
// Store the finished interaction (as non-3p interaction)
|
|
8
|
+
_defineProperty(this, "finishedInteraction", null);
|
|
9
9
|
// independent VC observer, that observes until `custom.post-interaction-logs` event is sent
|
|
10
10
|
_defineProperty(this, "vcObserver", null);
|
|
11
11
|
_defineProperty(this, "sinkHandlerFn", () => {});
|
|
@@ -36,11 +36,14 @@ export default class InteractionExtraMetrics {
|
|
|
36
36
|
const interaction = interactions.get(interactionId);
|
|
37
37
|
return (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'page_load' || (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'transition';
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
if (
|
|
41
|
-
this.
|
|
39
|
+
updateFinishedInteraction(interaction) {
|
|
40
|
+
if ((interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'page_load' || (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'transition') {
|
|
41
|
+
this.finishedInteraction = interaction;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
+
setLastInteractionFinishVCResult(result) {
|
|
45
|
+
this.lastInteractionFinishVCResult = result;
|
|
46
|
+
}
|
|
44
47
|
sinkHandler(fn) {
|
|
45
48
|
this.sinkHandlerFn = fn;
|
|
46
49
|
}
|
|
@@ -51,18 +54,20 @@ export default class InteractionExtraMetrics {
|
|
|
51
54
|
...data,
|
|
52
55
|
vcObserver: (_this$vcObserver3 = this.vcObserver) !== null && _this$vcObserver3 !== void 0 ? _this$vcObserver3 : undefined
|
|
53
56
|
};
|
|
54
|
-
this.sinkHandlerFn(id, updatedData);
|
|
57
|
+
this.sinkHandlerFn(id, updatedData, this.finishedInteraction, this.lastInteractionFinishVCResult);
|
|
55
58
|
}
|
|
56
59
|
this.stopVCObserver();
|
|
57
60
|
remove(id);
|
|
58
61
|
this.reset();
|
|
59
62
|
}
|
|
60
63
|
reset() {
|
|
64
|
+
var _this$finishedInterac;
|
|
61
65
|
this.stopVCObserver();
|
|
62
|
-
if (this.
|
|
63
|
-
remove(this.
|
|
66
|
+
if ((_this$finishedInterac = this.finishedInteraction) !== null && _this$finishedInterac !== void 0 && _this$finishedInterac.id) {
|
|
67
|
+
remove(this.finishedInteraction.id);
|
|
64
68
|
}
|
|
65
|
-
this.
|
|
69
|
+
this.finishedInteraction = null;
|
|
70
|
+
this.lastInteractionFinishVCResult = undefined;
|
|
66
71
|
}
|
|
67
72
|
stopAll(id) {
|
|
68
73
|
remove(id);
|
|
@@ -70,9 +70,9 @@ function sinkPostInteractionLog(instance, createPostInteractionLogPayload) {
|
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
function sinkInteractionExtraMetrics(instance, createInteractionExtraLogPayload) {
|
|
73
|
-
interactionExtraMetrics.sinkHandler((interactionId, interaction) => {
|
|
73
|
+
interactionExtraMetrics.sinkHandler((interactionId, interaction, lastInteractionFinish, lastInteractionFinishVCResult) => {
|
|
74
74
|
scheduleIdleCallback(async () => {
|
|
75
|
-
const payload = await createInteractionExtraLogPayload(interactionId, interaction);
|
|
75
|
+
const payload = await createInteractionExtraLogPayload(interactionId, interaction, lastInteractionFinish, lastInteractionFinishVCResult);
|
|
76
76
|
if (payload) {
|
|
77
77
|
// NOTE: This API is used by the UFO DevTool Chrome Extension and also by Criterion
|
|
78
78
|
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { Profiler, useCallback, useContext, useEffect, useMemo, useRef } from 'react';
|
|
2
2
|
import { unstable_NormalPriority as NormalPriority, unstable_scheduleCallback as scheduleCallback } from 'scheduler';
|
|
3
3
|
import { v4 as createUUID } from 'uuid';
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -12,11 +12,7 @@ import UFORouteName from '../route-name-context';
|
|
|
12
12
|
import generateId from '../short-id';
|
|
13
13
|
import scheduleOnPaint from './schedule-on-paint';
|
|
14
14
|
let tryCompleteHandle;
|
|
15
|
-
const AsyncSegmentHighlight = /*#__PURE__*/lazy(() => import( /* webpackChunkName: "@atlaskit-internal_ufo-segment-highlight" */'./segment-highlight').then(module => ({
|
|
16
|
-
default: module.SegmentHighlight
|
|
17
|
-
})));
|
|
18
15
|
|
|
19
|
-
// KARL TODO: finish self profiling
|
|
20
16
|
/** A portion of the page we apply measurement to */
|
|
21
17
|
export default function UFOSegment({
|
|
22
18
|
name: segmentName,
|
|
@@ -24,7 +20,6 @@ export default function UFOSegment({
|
|
|
24
20
|
mode = 'single',
|
|
25
21
|
type = 'first-party'
|
|
26
22
|
}) {
|
|
27
|
-
var _getConfig2;
|
|
28
23
|
const parentContext = useContext(UFOInteractionContext);
|
|
29
24
|
const segmentIdMap = useMemo(() => {
|
|
30
25
|
if (!(parentContext !== null && parentContext !== void 0 && parentContext.segmentIdMap)) {
|
|
@@ -260,16 +255,11 @@ export default function UFOSegment({
|
|
|
260
255
|
};
|
|
261
256
|
}, [interactionId, parentContext, interactionContext, labelStack]);
|
|
262
257
|
const reactProfilerId = useMemo(() => labelStack.map(l => l.name).join('/'), [labelStack]);
|
|
263
|
-
const enableSegmentHighlighting = (_getConfig2 = getConfig()) === null || _getConfig2 === void 0 ? void 0 : _getConfig2.enableSegmentHighlighting;
|
|
264
258
|
return /*#__PURE__*/React.createElement(UFOInteractionContext.Provider, {
|
|
265
259
|
value: interactionContext
|
|
266
260
|
}, /*#__PURE__*/React.createElement(Profiler, {
|
|
267
261
|
id: reactProfilerId,
|
|
268
262
|
onRender: onRender
|
|
269
|
-
}, children
|
|
270
|
-
fallback: null
|
|
271
|
-
}, /*#__PURE__*/React.createElement(AsyncSegmentHighlight, {
|
|
272
|
-
segmentName: segmentName
|
|
273
|
-
}))));
|
|
263
|
+
}, children));
|
|
274
264
|
}
|
|
275
265
|
UFOSegment.displayName = 'UFOSegment';
|