@atlaskit/react-ufo 4.8.0 → 4.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/cjs/create-extra-search-page-interaction-payload/index.js +50 -0
- package/dist/cjs/create-payload/index.js +63 -0
- package/dist/cjs/create-payload/utils/get-vc-metrics.js +15 -12
- package/dist/cjs/interaction-metrics/index.js +15 -7
- package/dist/cjs/interaction-metrics-init/index.js +29 -2
- package/dist/cjs/vc/index.js +4 -3
- package/dist/cjs/vc/vc-observer-new/index.js +4 -3
- package/dist/cjs/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +8 -8
- package/dist/cjs/vc/vc-observer-new/metric-calculator/fy25_03/index.js +5 -1
- package/dist/cjs/vc/vc-observer-new/metric-calculator/utils/is-entry-smart-answers-in-search.js +27 -0
- package/dist/es2019/create-extra-search-page-interaction-payload/index.js +32 -0
- package/dist/es2019/create-payload/index.js +49 -0
- package/dist/es2019/create-payload/utils/get-vc-metrics.js +3 -2
- package/dist/es2019/interaction-metrics/index.js +15 -7
- package/dist/es2019/interaction-metrics-init/index.js +29 -2
- package/dist/es2019/vc/index.js +4 -2
- package/dist/es2019/vc/vc-observer-new/index.js +4 -2
- package/dist/es2019/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +6 -5
- package/dist/es2019/vc/vc-observer-new/metric-calculator/fy25_03/index.js +5 -1
- package/dist/es2019/vc/vc-observer-new/metric-calculator/utils/is-entry-smart-answers-in-search.js +22 -0
- package/dist/esm/create-extra-search-page-interaction-payload/index.js +43 -0
- package/dist/esm/create-payload/index.js +62 -0
- package/dist/esm/create-payload/utils/get-vc-metrics.js +15 -12
- package/dist/esm/interaction-metrics/index.js +15 -7
- package/dist/esm/interaction-metrics-init/index.js +29 -2
- package/dist/esm/vc/index.js +4 -3
- package/dist/esm/vc/vc-observer-new/index.js +4 -3
- package/dist/esm/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +8 -8
- package/dist/esm/vc/vc-observer-new/metric-calculator/fy25_03/index.js +5 -1
- package/dist/esm/vc/vc-observer-new/metric-calculator/utils/is-entry-smart-answers-in-search.js +21 -0
- package/dist/types/config/index.d.ts +7 -0
- package/dist/types/create-extra-search-page-interaction-payload/index.d.ts +3 -0
- package/dist/types/create-payload/index.d.ts +25434 -0
- package/dist/types/create-payload/utils/get-vc-metrics.d.ts +1 -1
- package/dist/types/vc/types.d.ts +1 -0
- package/dist/types/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +2 -2
- package/dist/types/vc/vc-observer-new/metric-calculator/fy25_03/index.d.ts +1 -1
- package/dist/types/vc/vc-observer-new/metric-calculator/types.d.ts +1 -0
- package/dist/types/vc/vc-observer-new/metric-calculator/utils/is-entry-smart-answers-in-search.d.ts +2 -0
- package/dist/types/vc/vc-observer-new/types.d.ts +1 -0
- package/dist/types-ts4.5/config/index.d.ts +7 -0
- package/dist/types-ts4.5/create-extra-search-page-interaction-payload/index.d.ts +3 -0
- package/dist/types-ts4.5/create-payload/index.d.ts +25434 -0
- package/dist/types-ts4.5/create-payload/utils/get-vc-metrics.d.ts +1 -1
- package/dist/types-ts4.5/vc/types.d.ts +1 -0
- package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +2 -2
- package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/fy25_03/index.d.ts +1 -1
- package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/types.d.ts +1 -0
- package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/utils/is-entry-smart-answers-in-search.d.ts +2 -0
- package/dist/types-ts4.5/vc/vc-observer-new/types.d.ts +1 -0
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/ufo-interaction-ignore
|
|
2
2
|
|
|
3
|
+
## 4.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`c9fb4a692dc7d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c9fb4a692dc7d) -
|
|
8
|
+
Added opt-in functionality to fire an additional metric on Rovo search page loads. This additional
|
|
9
|
+
metric excludes smart answers related data."
|
|
10
|
+
|
|
3
11
|
## 4.8.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.onSearchPageInteractionComplete = onSearchPageInteractionComplete;
|
|
7
|
+
exports.sinkExtraSearchPageInteractionHandler = sinkExtraSearchPageInteractionHandler;
|
|
8
|
+
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; } } }; }
|
|
9
|
+
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; } }
|
|
10
|
+
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; }
|
|
11
|
+
var interactionBuffer = [];
|
|
12
|
+
var bufferInteractionData = function bufferInteractionData(interactionId, data) {
|
|
13
|
+
interactionBuffer.push({
|
|
14
|
+
interactionId: interactionId,
|
|
15
|
+
data: data
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
function clearInteractionBuffer() {
|
|
19
|
+
interactionBuffer.length = 0;
|
|
20
|
+
}
|
|
21
|
+
function appendInteractionData(interactionId, data) {
|
|
22
|
+
bufferInteractionData(interactionId, data);
|
|
23
|
+
}
|
|
24
|
+
function installInteractionSink(handler) {
|
|
25
|
+
var _iterator = _createForOfIteratorHelper(interactionBuffer),
|
|
26
|
+
_step;
|
|
27
|
+
try {
|
|
28
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
29
|
+
var _step$value = _step.value,
|
|
30
|
+
_interactionId = _step$value.interactionId,
|
|
31
|
+
data = _step$value.data;
|
|
32
|
+
handler(_interactionId, data);
|
|
33
|
+
}
|
|
34
|
+
} catch (err) {
|
|
35
|
+
_iterator.e(err);
|
|
36
|
+
} finally {
|
|
37
|
+
_iterator.f();
|
|
38
|
+
}
|
|
39
|
+
clearInteractionBuffer();
|
|
40
|
+
bufferInteractionData = handler;
|
|
41
|
+
}
|
|
42
|
+
function sinkExtraSearchPageInteractionHandler(sinkFn) {
|
|
43
|
+
installInteractionSink(sinkFn);
|
|
44
|
+
}
|
|
45
|
+
function onSearchPageInteractionComplete(interactionId, data) {
|
|
46
|
+
if (data.ufoName) {
|
|
47
|
+
appendInteractionData(interactionId, data);
|
|
48
|
+
clearInteractionBuffer();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.createExperimentalMetricsPayload = createExperimentalMetricsPayload;
|
|
9
|
+
exports.createExtraSearchPageInteractionPayload = createExtraSearchPageInteractionPayload;
|
|
9
10
|
exports.createPayloads = createPayloads;
|
|
10
11
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
12
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
@@ -703,4 +704,66 @@ function _createExperimentalMetricsPayload() {
|
|
|
703
704
|
}, _callee3);
|
|
704
705
|
}));
|
|
705
706
|
return _createExperimentalMetricsPayload.apply(this, arguments);
|
|
707
|
+
}
|
|
708
|
+
function createExtraSearchPageInteractionPayload(_x0, _x1) {
|
|
709
|
+
return _createExtraSearchPageInteractionPayload.apply(this, arguments);
|
|
710
|
+
}
|
|
711
|
+
function _createExtraSearchPageInteractionPayload() {
|
|
712
|
+
_createExtraSearchPageInteractionPayload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(interactionId, interaction) {
|
|
713
|
+
var SAIN_HOLD_NAMES, NAME_OVERRIDE, SEARCH_PAGE_SMART_ANSWERS_SEGMENT_LABEL, newInteractionId, newEnd, holdInfo, reactProfilerTimings, lastHold, isLastHoldSAIN, lastFilteredTime, filteredReactProfilerTimings, lastTiming, modifiedInteraction, payloads, vcMetrics, interactionMetricsPayload;
|
|
714
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
715
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
716
|
+
case 0:
|
|
717
|
+
SAIN_HOLD_NAMES = ['search-ai-dialog-visible-text-loading', 'search-ai-dialog-all-text-loading'];
|
|
718
|
+
NAME_OVERRIDE = 'search-page-ignoring-smart-answers';
|
|
719
|
+
SEARCH_PAGE_SMART_ANSWERS_SEGMENT_LABEL = 'search-page-smart-answers';
|
|
720
|
+
newInteractionId = "".concat(interactionId, "-ignoring-smart-answers"); // Calculate a new end time which excludes SAIN holds
|
|
721
|
+
holdInfo = interaction.holdInfo, reactProfilerTimings = interaction.reactProfilerTimings;
|
|
722
|
+
lastHold = holdInfo.at(-1);
|
|
723
|
+
isLastHoldSAIN = Boolean(lastHold && SAIN_HOLD_NAMES.includes(lastHold.name)); // A new end time is only calculated if the last hold is a SAIN hold
|
|
724
|
+
if (isLastHoldSAIN) {
|
|
725
|
+
lastFilteredTime = null;
|
|
726
|
+
filteredReactProfilerTimings = reactProfilerTimings.filter(function (timing) {
|
|
727
|
+
if (timing.commitTime === lastFilteredTime) {
|
|
728
|
+
return false;
|
|
729
|
+
}
|
|
730
|
+
var isTimingSmartAnswersInSearch = timing.labelStack.some(function (label) {
|
|
731
|
+
return label.name === SEARCH_PAGE_SMART_ANSWERS_SEGMENT_LABEL;
|
|
732
|
+
});
|
|
733
|
+
if (isTimingSmartAnswersInSearch) {
|
|
734
|
+
lastFilteredTime = timing.commitTime;
|
|
735
|
+
return false;
|
|
736
|
+
}
|
|
737
|
+
return true;
|
|
738
|
+
});
|
|
739
|
+
lastTiming = filteredReactProfilerTimings.at(-1);
|
|
740
|
+
if (lastTiming) {
|
|
741
|
+
newEnd = lastTiming.commitTime;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
modifiedInteraction = _objectSpread(_objectSpread({}, interaction), {}, {
|
|
745
|
+
end: newEnd !== null && newEnd !== void 0 ? newEnd : interaction.end,
|
|
746
|
+
holdInfo: [],
|
|
747
|
+
knownSegments: [],
|
|
748
|
+
reactProfilerTimings: [],
|
|
749
|
+
ufoName: NAME_OVERRIDE
|
|
750
|
+
});
|
|
751
|
+
payloads = [];
|
|
752
|
+
_context4.next = 12;
|
|
753
|
+
return (0, _getVcMetrics.default)(interaction, false, true);
|
|
754
|
+
case 12:
|
|
755
|
+
vcMetrics = _context4.sent;
|
|
756
|
+
_context4.next = 15;
|
|
757
|
+
return createInteractionMetricsPayload(modifiedInteraction, newInteractionId, undefined, undefined, vcMetrics);
|
|
758
|
+
case 15:
|
|
759
|
+
interactionMetricsPayload = _context4.sent;
|
|
760
|
+
payloads.push(interactionMetricsPayload);
|
|
761
|
+
return _context4.abrupt("return", payloads.filter(Boolean));
|
|
762
|
+
case 18:
|
|
763
|
+
case "end":
|
|
764
|
+
return _context4.stop();
|
|
765
|
+
}
|
|
766
|
+
}, _callee4);
|
|
767
|
+
}));
|
|
768
|
+
return _createExtraSearchPageInteractionPayload.apply(this, arguments);
|
|
706
769
|
}
|
|
@@ -22,6 +22,7 @@ function _getVCMetrics() {
|
|
|
22
22
|
_getVCMetrics = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(interaction) {
|
|
23
23
|
var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _config$vc2, _config$vc3, _result$ufoVcRev;
|
|
24
24
|
var include3p,
|
|
25
|
+
excludeSmartAnswersInSearch,
|
|
25
26
|
config,
|
|
26
27
|
interactionStatus,
|
|
27
28
|
pageVisibilityUpToTTAI,
|
|
@@ -39,29 +40,30 @@ function _getVCMetrics() {
|
|
|
39
40
|
while (1) switch (_context.prev = _context.next) {
|
|
40
41
|
case 0:
|
|
41
42
|
include3p = _args.length > 1 && _args[1] !== undefined ? _args[1] : false;
|
|
43
|
+
excludeSmartAnswersInSearch = _args.length > 2 && _args[2] !== undefined ? _args[2] : false;
|
|
42
44
|
config = (0, _config.getConfig)();
|
|
43
45
|
if (config !== null && config !== void 0 && (_config$vc = config.vc) !== null && _config$vc !== void 0 && _config$vc.enabled) {
|
|
44
|
-
_context.next =
|
|
46
|
+
_context.next = 5;
|
|
45
47
|
break;
|
|
46
48
|
}
|
|
47
49
|
return _context.abrupt("return", {});
|
|
48
|
-
case
|
|
50
|
+
case 5:
|
|
49
51
|
if (!(interaction.type !== 'page_load' && interaction.type !== 'transition' && interaction.type !== 'press')) {
|
|
50
|
-
_context.next =
|
|
52
|
+
_context.next = 7;
|
|
51
53
|
break;
|
|
52
54
|
}
|
|
53
55
|
return _context.abrupt("return", {});
|
|
54
|
-
case
|
|
56
|
+
case 7:
|
|
55
57
|
interactionStatus = (0, _getInteractionStatus.default)(interaction);
|
|
56
58
|
pageVisibilityUpToTTAI = (0, _getPageVisibilityUpToTtai.default)(interaction);
|
|
57
59
|
shouldReportVCMetrics = interactionStatus.originalInteractionStatus === 'SUCCEEDED' && pageVisibilityUpToTTAI === 'visible'; // Use per-interaction VC observer if available, otherwise fall back to global
|
|
58
60
|
observer = interaction.vcObserver;
|
|
59
61
|
if (observer) {
|
|
60
|
-
_context.next =
|
|
62
|
+
_context.next = 13;
|
|
61
63
|
break;
|
|
62
64
|
}
|
|
63
65
|
return _context.abrupt("return", {});
|
|
64
|
-
case
|
|
66
|
+
case 13:
|
|
65
67
|
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)));
|
|
66
68
|
ssr = interaction.type === 'page_load' && isSSREnabled ? {
|
|
67
69
|
ssr: (0, _getSsrDoneTimeValue.default)(config)
|
|
@@ -69,7 +71,7 @@ function _getVCMetrics() {
|
|
|
69
71
|
_interactionMetrics.postInteractionLog.setVCObserverSSRConfig(ssr);
|
|
70
72
|
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;
|
|
71
73
|
prefix = 'ufo';
|
|
72
|
-
_context.next =
|
|
74
|
+
_context.next = 20;
|
|
73
75
|
return observer.getVCResult(_objectSpread(_objectSpread({
|
|
74
76
|
start: interaction.start,
|
|
75
77
|
stop: interaction.end,
|
|
@@ -82,9 +84,10 @@ function _getVCMetrics() {
|
|
|
82
84
|
interactionId: interaction.id,
|
|
83
85
|
includeSSRRatio: (_config$vc3 = config.vc) === null || _config$vc3 === void 0 ? void 0 : _config$vc3.includeSSRRatio
|
|
84
86
|
}, ssr), {}, {
|
|
85
|
-
include3p: include3p
|
|
87
|
+
include3p: include3p,
|
|
88
|
+
excludeSmartAnswersInSearch: excludeSmartAnswersInSearch
|
|
86
89
|
}));
|
|
87
|
-
case
|
|
90
|
+
case 20:
|
|
88
91
|
result = _context.sent;
|
|
89
92
|
observer.stop(interaction.ufoName);
|
|
90
93
|
if (!include3p) {
|
|
@@ -97,15 +100,15 @@ function _getVCMetrics() {
|
|
|
97
100
|
return revision === mostRecentVCRevision;
|
|
98
101
|
});
|
|
99
102
|
if (!(!shouldReportVCMetrics || !(mostRecentVCRevisionPayload !== null && mostRecentVCRevisionPayload !== void 0 && mostRecentVCRevisionPayload.clean))) {
|
|
100
|
-
_context.next =
|
|
103
|
+
_context.next = 27;
|
|
101
104
|
break;
|
|
102
105
|
}
|
|
103
106
|
return _context.abrupt("return", result);
|
|
104
|
-
case
|
|
107
|
+
case 27:
|
|
105
108
|
return _context.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
|
|
106
109
|
'metric:vc90': mostRecentVCRevisionPayload['metric:vc90']
|
|
107
110
|
}));
|
|
108
|
-
case
|
|
111
|
+
case 28:
|
|
109
112
|
case "end":
|
|
110
113
|
return _context.stop();
|
|
111
114
|
}
|
|
@@ -54,6 +54,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
54
54
|
var _coinflip = _interopRequireDefault(require("../coinflip"));
|
|
55
55
|
var _config = require("../config");
|
|
56
56
|
var _createExperimentalInteractionMetricsPayload = require("../create-experimental-interaction-metrics-payload");
|
|
57
|
+
var _createExtraSearchPageInteractionPayload = require("../create-extra-search-page-interaction-payload");
|
|
57
58
|
var _utils = require("../create-payload/common/utils");
|
|
58
59
|
var _experienceTraceIdContext = require("../experience-trace-id-context");
|
|
59
60
|
var _featureFlagsAccessed = require("../feature-flags-accessed");
|
|
@@ -881,16 +882,19 @@ function tryComplete(interactionId, endTime) {
|
|
|
881
882
|
if (noMoreActiveHolds && interactionExtraMetrics.finishedInteractionId !== interactionId) {
|
|
882
883
|
// If it's not waiting for extra metrics to complete, finish the interaction as normal
|
|
883
884
|
if (!activeSubmitted) {
|
|
884
|
-
var _getConfig1;
|
|
885
|
+
var _getConfig1, _getConfig10, _getConfig11;
|
|
885
886
|
finishInteraction(interactionId, interaction, endTime);
|
|
886
887
|
if ((_getConfig1 = (0, _config.getConfig)()) !== null && _getConfig1 !== void 0 && (_getConfig1 = _getConfig1.extraInteractionMetrics) !== null && _getConfig1 !== void 0 && _getConfig1.enabled) {
|
|
887
888
|
interactionExtraMetrics.updateFinishedInteractionId(interactionId);
|
|
888
889
|
}
|
|
890
|
+
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')) {
|
|
891
|
+
(0, _createExtraSearchPageInteractionPayload.onSearchPageInteractionComplete)(interactionId, interaction);
|
|
892
|
+
}
|
|
889
893
|
activeSubmitted = true;
|
|
890
894
|
}
|
|
891
895
|
if (noMoreExpHolds) {
|
|
892
|
-
var
|
|
893
|
-
if ((
|
|
896
|
+
var _getConfig12;
|
|
897
|
+
if ((_getConfig12 = (0, _config.getConfig)()) !== null && _getConfig12 !== void 0 && (_getConfig12 = _getConfig12.experimentalInteractionMetrics) !== null && _getConfig12 !== void 0 && _getConfig12.enabled) {
|
|
894
898
|
(0, _createExperimentalInteractionMetricsPayload.onExperimentalInteractionComplete)(interactionId, interaction, endTime);
|
|
895
899
|
}
|
|
896
900
|
postInteraction();
|
|
@@ -905,12 +909,16 @@ function tryComplete(interactionId, endTime) {
|
|
|
905
909
|
} else {
|
|
906
910
|
if (noMoreActiveHolds) {
|
|
907
911
|
if (!activeSubmitted) {
|
|
912
|
+
var _getConfig13, _getConfig14;
|
|
908
913
|
finishInteraction(interactionId, interaction, endTime);
|
|
914
|
+
if ((_getConfig13 = (0, _config.getConfig)()) !== null && _getConfig13 !== void 0 && (_getConfig13 = _getConfig13.extraSearchPageInteraction) !== null && _getConfig13 !== void 0 && _getConfig13.enabled && interaction.ufoName === ((_getConfig14 = (0, _config.getConfig)()) === null || _getConfig14 === void 0 || (_getConfig14 = _getConfig14.extraSearchPageInteraction) === null || _getConfig14 === void 0 ? void 0 : _getConfig14.searchPageMetricName) && (0, _platformFeatureFlags.fg)('react_ufo_unified_search_ignoring_sain_metric')) {
|
|
915
|
+
(0, _createExtraSearchPageInteractionPayload.onSearchPageInteractionComplete)(interactionId, interaction);
|
|
916
|
+
}
|
|
909
917
|
activeSubmitted = true;
|
|
910
918
|
}
|
|
911
919
|
if (noMoreExpHolds) {
|
|
912
|
-
var
|
|
913
|
-
if ((
|
|
920
|
+
var _getConfig15;
|
|
921
|
+
if ((_getConfig15 = (0, _config.getConfig)()) !== null && _getConfig15 !== void 0 && (_getConfig15 = _getConfig15.experimentalInteractionMetrics) !== null && _getConfig15 !== void 0 && _getConfig15.enabled) {
|
|
914
922
|
(0, _createExperimentalInteractionMetricsPayload.onExperimentalInteractionComplete)(interactionId, interaction, endTime);
|
|
915
923
|
}
|
|
916
924
|
postInteraction();
|
|
@@ -1107,7 +1115,7 @@ function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelS
|
|
|
1107
1115
|
addHoldByID(interactionId, [], ufoName, ufoName, true);
|
|
1108
1116
|
}
|
|
1109
1117
|
if (type === 'transition' || type === 'page_load') {
|
|
1110
|
-
var
|
|
1118
|
+
var _getConfig16, _config$extraInteract;
|
|
1111
1119
|
// Use per-interaction VC observer if available, otherwise fall back to global
|
|
1112
1120
|
var observer = vcObserver;
|
|
1113
1121
|
if (observer) {
|
|
@@ -1118,7 +1126,7 @@ function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelS
|
|
|
1118
1126
|
}
|
|
1119
1127
|
// Start post interaction observer for all if config is enabled
|
|
1120
1128
|
// in case ufoName is updated at later time
|
|
1121
|
-
if ((
|
|
1129
|
+
if ((_getConfig16 = (0, _config.getConfig)()) !== null && _getConfig16 !== void 0 && (_getConfig16 = _getConfig16.postInteractionLog) !== null && _getConfig16 !== void 0 && _getConfig16.enabled) {
|
|
1122
1130
|
postInteractionLog.startVCObserver({
|
|
1123
1131
|
startTime: startTime
|
|
1124
1132
|
});
|
|
@@ -13,6 +13,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
13
13
|
var _additionalPayload = require("../additional-payload");
|
|
14
14
|
var _config = require("../config");
|
|
15
15
|
var _createExperimentalInteractionMetricsPayload = require("../create-experimental-interaction-metrics-payload");
|
|
16
|
+
var _createExtraSearchPageInteractionPayload = require("../create-extra-search-page-interaction-payload");
|
|
16
17
|
var _hiddenTiming = require("../hidden-timing");
|
|
17
18
|
var _interactionMetrics = require("../interaction-metrics");
|
|
18
19
|
var _interactionsPerformanceObserver = require("../interactions-performance-observer");
|
|
@@ -110,6 +111,26 @@ function sinkInteractionExtraMetrics(instance, createInteractionExtraLogPayload)
|
|
|
110
111
|
})));
|
|
111
112
|
});
|
|
112
113
|
}
|
|
114
|
+
function sinkExtraSearchPageInteraction(instance, payloadPackage) {
|
|
115
|
+
function sinkFn(interactionId, interaction) {
|
|
116
|
+
function onIdle() {
|
|
117
|
+
payloadPackage.createExtraSearchPageInteractionPayload(interactionId, interaction).then(function (payloads) {
|
|
118
|
+
// NOTE: This API is used by the UFO DevTool Chrome Extension and Criterion
|
|
119
|
+
var devToolObserver = globalThis.__ufo_devtool_onUfoPayload;
|
|
120
|
+
payloads === null || payloads === void 0 || payloads.forEach(function (payload) {
|
|
121
|
+
if (typeof devToolObserver === 'function') {
|
|
122
|
+
devToolObserver === null || devToolObserver === void 0 || devToolObserver(payload);
|
|
123
|
+
}
|
|
124
|
+
instance.sendOperationalEvent(payload);
|
|
125
|
+
});
|
|
126
|
+
}).catch(function (error) {
|
|
127
|
+
throw error;
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
(0, _scheduleIdleCallback.default)(onIdle);
|
|
131
|
+
}
|
|
132
|
+
(0, _createExtraSearchPageInteractionPayload.sinkExtraSearchPageInteractionHandler)(sinkFn);
|
|
133
|
+
}
|
|
113
134
|
function init(analyticsWebClientAsync, config) {
|
|
114
135
|
var _config$vc;
|
|
115
136
|
if (initialized) {
|
|
@@ -164,7 +185,7 @@ function init(analyticsWebClientAsync, config) {
|
|
|
164
185
|
createInteractionExtraMetricsPayloadPackage = _ref3[3];
|
|
165
186
|
if (awc.getAnalyticsWebClientPromise) {
|
|
166
187
|
awc.getAnalyticsWebClientPromise().then(function (client) {
|
|
167
|
-
var _config$experimentalI2, _config$postInteracti, _config$extraInteract2;
|
|
188
|
+
var _config$experimentalI2, _config$postInteracti, _config$extraInteract2, _config$extraSearchPa;
|
|
168
189
|
var instance = client.getInstance();
|
|
169
190
|
sinkInteraction(instance, payloadPackage);
|
|
170
191
|
if (config !== null && config !== void 0 && (_config$experimentalI2 = config.experimentalInteractionMetrics) !== null && _config$experimentalI2 !== void 0 && _config$experimentalI2.enabled) {
|
|
@@ -176,9 +197,12 @@ function init(analyticsWebClientAsync, config) {
|
|
|
176
197
|
if (config !== null && config !== void 0 && (_config$extraInteract2 = config.extraInteractionMetrics) !== null && _config$extraInteract2 !== void 0 && _config$extraInteract2.enabled && (0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
|
|
177
198
|
sinkInteractionExtraMetrics(instance, createInteractionExtraMetricsPayloadPackage.default);
|
|
178
199
|
}
|
|
200
|
+
if (config !== null && config !== void 0 && (_config$extraSearchPa = config.extraSearchPageInteraction) !== null && _config$extraSearchPa !== void 0 && _config$extraSearchPa.enabled && (0, _platformFeatureFlags.fg)('react_ufo_unified_search_ignoring_sain_metric')) {
|
|
201
|
+
sinkExtraSearchPageInteraction(instance, payloadPackage);
|
|
202
|
+
}
|
|
179
203
|
});
|
|
180
204
|
} else if (awc.sendOperationalEvent) {
|
|
181
|
-
var _config$experimentalI3, _config$postInteracti2, _config$extraInteract3;
|
|
205
|
+
var _config$experimentalI3, _config$postInteracti2, _config$extraInteract3, _config$extraSearchPa2;
|
|
182
206
|
sinkInteraction(awc, payloadPackage);
|
|
183
207
|
if (config !== null && config !== void 0 && (_config$experimentalI3 = config.experimentalInteractionMetrics) !== null && _config$experimentalI3 !== void 0 && _config$experimentalI3.enabled) {
|
|
184
208
|
sinkExperimentalInteractionMetrics(awc, payloadPackage);
|
|
@@ -189,6 +213,9 @@ function init(analyticsWebClientAsync, config) {
|
|
|
189
213
|
if (config !== null && config !== void 0 && (_config$extraInteract3 = config.extraInteractionMetrics) !== null && _config$extraInteract3 !== void 0 && _config$extraInteract3.enabled && (0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
|
|
190
214
|
sinkInteractionExtraMetrics(awc, createInteractionExtraMetricsPayloadPackage.default);
|
|
191
215
|
}
|
|
216
|
+
if (config !== null && config !== void 0 && (_config$extraSearchPa2 = config.extraSearchPageInteraction) !== null && _config$extraSearchPa2 !== void 0 && _config$extraSearchPa2.enabled) {
|
|
217
|
+
sinkExtraSearchPageInteraction(awc, payloadPackage);
|
|
218
|
+
}
|
|
192
219
|
}
|
|
193
220
|
});
|
|
194
221
|
}
|
package/dist/cjs/vc/index.js
CHANGED
|
@@ -122,11 +122,11 @@ var VCObserverWrapper = exports.VCObserverWrapper = /*#__PURE__*/function () {
|
|
|
122
122
|
value: function () {
|
|
123
123
|
var _getVCResult = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(param) {
|
|
124
124
|
var _this$oldVCObserver4, _this$newVCObserver3, _ref2;
|
|
125
|
-
var experienceKey, include3p, v1v2Result, v3Result;
|
|
125
|
+
var experienceKey, include3p, excludeSmartAnswersInSearch, v1v2Result, v3Result;
|
|
126
126
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
127
127
|
while (1) switch (_context.prev = _context.next) {
|
|
128
128
|
case 0:
|
|
129
|
-
experienceKey = param.experienceKey, include3p = param.include3p;
|
|
129
|
+
experienceKey = param.experienceKey, include3p = param.include3p, excludeSmartAnswersInSearch = param.excludeSmartAnswersInSearch;
|
|
130
130
|
if (!((0, _config.isVCRevisionEnabled)('fy25.01', experienceKey) || (0, _config.isVCRevisionEnabled)('fy25.02', experienceKey))) {
|
|
131
131
|
_context.next = 7;
|
|
132
132
|
break;
|
|
@@ -151,7 +151,8 @@ var VCObserverWrapper = exports.VCObserverWrapper = /*#__PURE__*/function () {
|
|
|
151
151
|
stop: param.stop,
|
|
152
152
|
interactionId: param.interactionId,
|
|
153
153
|
ssr: param.includeSSRInV3 ? param.ssr : undefined,
|
|
154
|
-
include3p: include3p
|
|
154
|
+
include3p: include3p,
|
|
155
|
+
excludeSmartAnswersInSearch: excludeSmartAnswersInSearch
|
|
155
156
|
});
|
|
156
157
|
case 12:
|
|
157
158
|
_context.t1 = _context.sent;
|
|
@@ -238,11 +238,11 @@ var VCObserverNew = exports.default = /*#__PURE__*/function () {
|
|
|
238
238
|
key: "getVCResult",
|
|
239
239
|
value: function () {
|
|
240
240
|
var _getVCResult = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(param) {
|
|
241
|
-
var start, stop, interactionId, include3p, results, calculator_fy25_03, orderedEntries, fy25_03, calculator_next, vcNext;
|
|
241
|
+
var start, stop, interactionId, include3p, excludeSmartAnswersInSearch, results, calculator_fy25_03, orderedEntries, fy25_03, calculator_next, vcNext;
|
|
242
242
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
243
243
|
while (1) switch (_context.prev = _context.next) {
|
|
244
244
|
case 0:
|
|
245
|
-
start = param.start, stop = param.stop, interactionId = param.interactionId, include3p = param.include3p;
|
|
245
|
+
start = param.start, stop = param.stop, interactionId = param.interactionId, include3p = param.include3p, excludeSmartAnswersInSearch = param.excludeSmartAnswersInSearch;
|
|
246
246
|
results = [];
|
|
247
247
|
this.addStartEntry(start);
|
|
248
248
|
calculator_fy25_03 = new _fy25_.default();
|
|
@@ -260,7 +260,8 @@ var VCObserverNew = exports.default = /*#__PURE__*/function () {
|
|
|
260
260
|
stopTime: stop,
|
|
261
261
|
interactionId: interactionId,
|
|
262
262
|
isPostInteraction: this.isPostInteraction,
|
|
263
|
-
include3p: include3p
|
|
263
|
+
include3p: include3p,
|
|
264
|
+
excludeSmartAnswersInSearch: excludeSmartAnswersInSearch
|
|
264
265
|
});
|
|
265
266
|
case 8:
|
|
266
267
|
fy25_03 = _context.sent;
|
|
@@ -111,7 +111,7 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
|
|
|
111
111
|
}, {
|
|
112
112
|
key: "calculateWithDebugInfo",
|
|
113
113
|
value: function () {
|
|
114
|
-
var _calculateWithDebugInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason, allEntries, include3p) {
|
|
114
|
+
var _calculateWithDebugInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason, allEntries, include3p, excludeSmartAnswersInSearch) {
|
|
115
115
|
var _window, _window2, _window6, _window8;
|
|
116
116
|
var percentiles, viewportEntries, vcLogs, vcDetails, percentileIndex, entryDataBuffer, _iterator4, _step4, _entry3, time, viewportPercentage, entries, elementNames, previousResult, i, percentile, enhancedVcLogs, shouldCalculate3p, shouldCalculateDebugDetails, _window3, _window4, _window5, sortedVcLogs, maxViewportPercentageAtTime, maxSoFar, _iterator5, _step5, log, getBiggestPreviousViewportPercentage, ignoredEntriesByTime, _iterator6, _step6, _entry4, _ignoredEntriesByTime, _viewportData$rect, _viewportData$previou, viewportData, timestamp, additionalVcLogs, _iterator7, _step7, _step7$value, _timestamp, ignoredEntries, _viewportPercentage, v3RevisionDebugDetails, _activeInteractionId$, activeInteractionId, activeInteraction, pageVisibilityUpToTTAI, isBackgrounded, _window7, _window7$__ufo_devtoo, _window9, _window9$__on_ufo_vc_;
|
|
117
117
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
@@ -264,7 +264,7 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
|
|
|
264
264
|
try {
|
|
265
265
|
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
266
266
|
_entry4 = _step6.value;
|
|
267
|
-
if ('rect' in _entry4.data && !this.isEntryIncluded(_entry4, include3p)) {
|
|
267
|
+
if ('rect' in _entry4.data && !this.isEntryIncluded(_entry4, include3p, excludeSmartAnswersInSearch)) {
|
|
268
268
|
viewportData = _entry4.data;
|
|
269
269
|
timestamp = Math.round(_entry4.time);
|
|
270
270
|
if (!ignoredEntriesByTime.has(timestamp)) {
|
|
@@ -371,7 +371,7 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
|
|
|
371
371
|
}
|
|
372
372
|
}, _callee, this, [[10, 22, 25, 28]]);
|
|
373
373
|
}));
|
|
374
|
-
function calculateWithDebugInfo(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9) {
|
|
374
|
+
function calculateWithDebugInfo(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9, _x0) {
|
|
375
375
|
return _calculateWithDebugInfo.apply(this, arguments);
|
|
376
376
|
}
|
|
377
377
|
return calculateWithDebugInfo;
|
|
@@ -383,13 +383,13 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
|
|
|
383
383
|
var _this = this,
|
|
384
384
|
_vcDetails$90$t,
|
|
385
385
|
_vcDetails$;
|
|
386
|
-
var startTime, stopTime, orderedEntries, interactionId, isPostInteraction, include3p, filteredEntries, isVCClean, dirtyReason, getVCCleanStatusResult, vcDetails, result;
|
|
386
|
+
var startTime, stopTime, orderedEntries, interactionId, isPostInteraction, include3p, excludeSmartAnswersInSearch, filteredEntries, isVCClean, dirtyReason, getVCCleanStatusResult, vcDetails, result;
|
|
387
387
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
388
388
|
while (1) switch (_context2.prev = _context2.next) {
|
|
389
389
|
case 0:
|
|
390
|
-
startTime = _ref.startTime, stopTime = _ref.stopTime, orderedEntries = _ref.orderedEntries, interactionId = _ref.interactionId, isPostInteraction = _ref.isPostInteraction, include3p = _ref.include3p;
|
|
390
|
+
startTime = _ref.startTime, stopTime = _ref.stopTime, orderedEntries = _ref.orderedEntries, interactionId = _ref.interactionId, isPostInteraction = _ref.isPostInteraction, include3p = _ref.include3p, excludeSmartAnswersInSearch = _ref.excludeSmartAnswersInSearch;
|
|
391
391
|
filteredEntries = orderedEntries.filter(function (entry) {
|
|
392
|
-
return _this.isEntryIncluded(entry, include3p);
|
|
392
|
+
return _this.isEntryIncluded(entry, include3p, excludeSmartAnswersInSearch);
|
|
393
393
|
});
|
|
394
394
|
getVCCleanStatusResult = this.getVCCleanStatus(filteredEntries);
|
|
395
395
|
isVCClean = getVCCleanStatusResult.isVCClean;
|
|
@@ -407,7 +407,7 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
|
|
|
407
407
|
});
|
|
408
408
|
case 7:
|
|
409
409
|
_context2.next = 9;
|
|
410
|
-
return this.calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason, orderedEntries, include3p);
|
|
410
|
+
return this.calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason, orderedEntries, include3p, excludeSmartAnswersInSearch);
|
|
411
411
|
case 9:
|
|
412
412
|
vcDetails = _context2.sent;
|
|
413
413
|
result = {
|
|
@@ -430,7 +430,7 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
|
|
|
430
430
|
}
|
|
431
431
|
}, _callee2, this);
|
|
432
432
|
}));
|
|
433
|
-
function calculate(
|
|
433
|
+
function calculate(_x1) {
|
|
434
434
|
return _calculate.apply(this, arguments);
|
|
435
435
|
}
|
|
436
436
|
return calculate;
|
|
@@ -12,6 +12,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
12
12
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
13
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
14
|
var _abstractBaseVcCalculator = _interopRequireDefault(require("../abstract-base-vc-calculator"));
|
|
15
|
+
var _isEntrySmartAnswersInSearch = require("../utils/is-entry-smart-answers-in-search");
|
|
15
16
|
var _isViewportEntryData = _interopRequireDefault(require("../utils/is-viewport-entry-data"));
|
|
16
17
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
17
18
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
@@ -51,10 +52,13 @@ var VCCalculator_FY25_03 = exports.default = /*#__PURE__*/function (_AbstractVCC
|
|
|
51
52
|
(0, _inherits2.default)(VCCalculator_FY25_03, _AbstractVCCalculator);
|
|
52
53
|
return (0, _createClass2.default)(VCCalculator_FY25_03, [{
|
|
53
54
|
key: "isEntryIncluded",
|
|
54
|
-
value: function isEntryIncluded(entry, include3p) {
|
|
55
|
+
value: function isEntryIncluded(entry, include3p, excludeSmartAnswersInSearch) {
|
|
55
56
|
if (!getConsideredEntryTypes(include3p).includes(entry.data.type)) {
|
|
56
57
|
return false;
|
|
57
58
|
}
|
|
59
|
+
if (excludeSmartAnswersInSearch && (0, _isEntrySmartAnswersInSearch.isEntrySmartAnswersInSearch)(entry)) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
58
62
|
if (entry.data.type === 'mutation:attribute') {
|
|
59
63
|
var entryData = entry.data;
|
|
60
64
|
var attributeName = entryData.attributeName;
|
package/dist/cjs/vc/vc-observer-new/metric-calculator/utils/is-entry-smart-answers-in-search.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isEntrySmartAnswersInSearch = isEntrySmartAnswersInSearch;
|
|
7
|
+
var _browserApis = require("@atlaskit/browser-apis");
|
|
8
|
+
function isEntrySmartAnswersInSearch(entry) {
|
|
9
|
+
var _ref = entry.data,
|
|
10
|
+
elementName = _ref.elementName;
|
|
11
|
+
if (!elementName || elementName === 'START') {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
var doc = (0, _browserApis.getDocument)();
|
|
15
|
+
if (!doc) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
var smartAnswersElement = doc.getElementById('search-page-smart-answers');
|
|
19
|
+
if (!smartAnswersElement) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
var entryDOMElement = doc.querySelector(elementName);
|
|
23
|
+
if (!entryDOMElement) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
return smartAnswersElement.contains(entryDOMElement);
|
|
27
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const interactionBuffer = [];
|
|
2
|
+
let bufferInteractionData = (interactionId, data) => {
|
|
3
|
+
interactionBuffer.push({
|
|
4
|
+
interactionId,
|
|
5
|
+
data
|
|
6
|
+
});
|
|
7
|
+
};
|
|
8
|
+
function clearInteractionBuffer() {
|
|
9
|
+
interactionBuffer.length = 0;
|
|
10
|
+
}
|
|
11
|
+
function appendInteractionData(interactionId, data) {
|
|
12
|
+
bufferInteractionData(interactionId, data);
|
|
13
|
+
}
|
|
14
|
+
function installInteractionSink(handler) {
|
|
15
|
+
for (const {
|
|
16
|
+
interactionId,
|
|
17
|
+
data
|
|
18
|
+
} of interactionBuffer) {
|
|
19
|
+
handler(interactionId, data);
|
|
20
|
+
}
|
|
21
|
+
clearInteractionBuffer();
|
|
22
|
+
bufferInteractionData = handler;
|
|
23
|
+
}
|
|
24
|
+
export function sinkExtraSearchPageInteractionHandler(sinkFn) {
|
|
25
|
+
installInteractionSink(sinkFn);
|
|
26
|
+
}
|
|
27
|
+
export function onSearchPageInteractionComplete(interactionId, data) {
|
|
28
|
+
if (data.ufoName) {
|
|
29
|
+
appendInteractionData(interactionId, data);
|
|
30
|
+
clearInteractionBuffer();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -644,4 +644,53 @@ export async function createExperimentalMetricsPayload(interactionId, interactio
|
|
|
644
644
|
}
|
|
645
645
|
const result = await createInteractionMetricsPayload(interaction, interactionId, true);
|
|
646
646
|
return result;
|
|
647
|
+
}
|
|
648
|
+
export async function createExtraSearchPageInteractionPayload(interactionId, interaction) {
|
|
649
|
+
var _newEnd;
|
|
650
|
+
const SAIN_HOLD_NAMES = ['search-ai-dialog-visible-text-loading', 'search-ai-dialog-all-text-loading'];
|
|
651
|
+
const NAME_OVERRIDE = 'search-page-ignoring-smart-answers';
|
|
652
|
+
const SEARCH_PAGE_SMART_ANSWERS_SEGMENT_LABEL = 'search-page-smart-answers';
|
|
653
|
+
const newInteractionId = `${interactionId}-ignoring-smart-answers`;
|
|
654
|
+
|
|
655
|
+
// Calculate a new end time which excludes SAIN holds
|
|
656
|
+
let newEnd;
|
|
657
|
+
const {
|
|
658
|
+
holdInfo,
|
|
659
|
+
reactProfilerTimings
|
|
660
|
+
} = interaction;
|
|
661
|
+
const lastHold = holdInfo.at(-1);
|
|
662
|
+
const isLastHoldSAIN = Boolean(lastHold && SAIN_HOLD_NAMES.includes(lastHold.name));
|
|
663
|
+
|
|
664
|
+
// A new end time is only calculated if the last hold is a SAIN hold
|
|
665
|
+
if (isLastHoldSAIN) {
|
|
666
|
+
let lastFilteredTime = null;
|
|
667
|
+
const filteredReactProfilerTimings = reactProfilerTimings.filter(timing => {
|
|
668
|
+
if (timing.commitTime === lastFilteredTime) {
|
|
669
|
+
return false;
|
|
670
|
+
}
|
|
671
|
+
const isTimingSmartAnswersInSearch = timing.labelStack.some(label => label.name === SEARCH_PAGE_SMART_ANSWERS_SEGMENT_LABEL);
|
|
672
|
+
if (isTimingSmartAnswersInSearch) {
|
|
673
|
+
lastFilteredTime = timing.commitTime;
|
|
674
|
+
return false;
|
|
675
|
+
}
|
|
676
|
+
return true;
|
|
677
|
+
});
|
|
678
|
+
const lastTiming = filteredReactProfilerTimings.at(-1);
|
|
679
|
+
if (lastTiming) {
|
|
680
|
+
newEnd = lastTiming.commitTime;
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
const modifiedInteraction = {
|
|
684
|
+
...interaction,
|
|
685
|
+
end: (_newEnd = newEnd) !== null && _newEnd !== void 0 ? _newEnd : interaction.end,
|
|
686
|
+
holdInfo: [],
|
|
687
|
+
knownSegments: [],
|
|
688
|
+
reactProfilerTimings: [],
|
|
689
|
+
ufoName: NAME_OVERRIDE
|
|
690
|
+
};
|
|
691
|
+
const payloads = [];
|
|
692
|
+
const vcMetrics = await getVCMetrics(interaction, false, true);
|
|
693
|
+
const interactionMetricsPayload = await createInteractionMetricsPayload(modifiedInteraction, newInteractionId, undefined, undefined, vcMetrics);
|
|
694
|
+
payloads.push(interactionMetricsPayload);
|
|
695
|
+
return payloads.filter(Boolean);
|
|
647
696
|
}
|
|
@@ -3,7 +3,7 @@ import { 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';
|
|
6
|
-
async function getVCMetrics(interaction, include3p = false) {
|
|
6
|
+
async function getVCMetrics(interaction, include3p = false, excludeSmartAnswersInSearch = false) {
|
|
7
7
|
var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _interaction$apdex$, _config$vc2, _config$vc3, _result$ufoVcRev;
|
|
8
8
|
const config = getConfig();
|
|
9
9
|
if (!(config !== null && config !== void 0 && (_config$vc = config.vc) !== null && _config$vc !== void 0 && _config$vc.enabled)) {
|
|
@@ -40,7 +40,8 @@ async function getVCMetrics(interaction, include3p = false) {
|
|
|
40
40
|
interactionId: interaction.id,
|
|
41
41
|
includeSSRRatio: (_config$vc3 = config.vc) === null || _config$vc3 === void 0 ? void 0 : _config$vc3.includeSSRRatio,
|
|
42
42
|
...ssr,
|
|
43
|
-
include3p
|
|
43
|
+
include3p,
|
|
44
|
+
excludeSmartAnswersInSearch
|
|
44
45
|
});
|
|
45
46
|
observer.stop(interaction.ufoName);
|
|
46
47
|
if (!include3p) {
|