@atlaskit/react-ufo 3.10.4 → 3.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/config/index.js +51 -5
- package/dist/cjs/create-experimental-interaction-metrics-payload/index.js +2 -1
- package/dist/cjs/create-payload/utils/get-vc-metrics.js +41 -20
- package/dist/cjs/create-post-interaction-log-payload/index.js +11 -0
- package/dist/cjs/interaction-metrics/index.js +2 -1
- package/dist/cjs/interaction-metrics/post-interaction-log.js +15 -5
- package/dist/cjs/vc/index.js +125 -36
- package/dist/cjs/vc/vc-observer/getVCRevisionsData.js +48 -23
- package/dist/cjs/vc/vc-observer/index.js +17 -6
- package/dist/es2019/config/index.js +49 -6
- package/dist/es2019/create-experimental-interaction-metrics-payload/index.js +2 -1
- package/dist/es2019/create-payload/utils/get-vc-metrics.js +36 -19
- package/dist/es2019/create-post-interaction-log-payload/index.js +11 -0
- package/dist/es2019/interaction-metrics/index.js +2 -1
- package/dist/es2019/interaction-metrics/post-interaction-log.js +14 -4
- package/dist/es2019/vc/index.js +99 -36
- package/dist/es2019/vc/vc-observer/getVCRevisionsData.js +52 -25
- package/dist/es2019/vc/vc-observer/index.js +18 -6
- package/dist/esm/config/index.js +49 -5
- package/dist/esm/create-experimental-interaction-metrics-payload/index.js +2 -1
- package/dist/esm/create-payload/utils/get-vc-metrics.js +42 -21
- package/dist/esm/create-post-interaction-log-payload/index.js +11 -0
- package/dist/esm/interaction-metrics/index.js +2 -1
- package/dist/esm/interaction-metrics/post-interaction-log.js +15 -5
- package/dist/esm/vc/index.js +127 -37
- package/dist/esm/vc/vc-observer/getVCRevisionsData.js +48 -23
- package/dist/esm/vc/vc-observer/index.js +17 -6
- package/dist/types/common/common/types.d.ts +1 -1
- package/dist/types/common/react-ufo-payload-schema.d.ts +49 -3
- package/dist/types/config/index.d.ts +14 -3
- package/dist/types/create-post-interaction-log-payload/index.d.ts +3 -2
- package/dist/types/interaction-metrics/post-interaction-log.d.ts +3 -4
- package/dist/types/vc/index.d.ts +17 -1
- package/dist/types/vc/types.d.ts +3 -1
- package/dist/types/vc/vc-observer/getVCRevisionsData.d.ts +5 -3
- package/dist/types/vc/vc-observer/index.d.ts +1 -1
- package/dist/types-ts4.5/common/common/types.d.ts +1 -1
- package/dist/types-ts4.5/common/react-ufo-payload-schema.d.ts +51 -3
- package/dist/types-ts4.5/config/index.d.ts +14 -3
- package/dist/types-ts4.5/create-post-interaction-log-payload/index.d.ts +3 -2
- package/dist/types-ts4.5/interaction-metrics/post-interaction-log.d.ts +3 -4
- package/dist/types-ts4.5/vc/index.d.ts +17 -1
- package/dist/types-ts4.5/vc/types.d.ts +3 -1
- package/dist/types-ts4.5/vc/vc-observer/getVCRevisionsData.d.ts +5 -3
- package/dist/types-ts4.5/vc/vc-observer/index.d.ts +1 -1
- package/package.json +7 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
1
2
|
import { isVCRevisionEnabled } from '../../config';
|
|
2
3
|
import { getPageVisibilityState } from '../../hidden-timing';
|
|
3
4
|
import { getRevisions } from './revisions/revisions';
|
|
@@ -19,7 +20,7 @@ function createVCDetails(calculatedVC, shouldHaveVCmetric) {
|
|
|
19
20
|
|
|
20
21
|
for (const key of VCParts) {
|
|
21
22
|
details[key] = {
|
|
22
|
-
t: VC[key],
|
|
23
|
+
t: VC[key] || -1,
|
|
23
24
|
e: VCBox[key] || READONLY_EMPTY_ARRAY
|
|
24
25
|
};
|
|
25
26
|
}
|
|
@@ -35,9 +36,14 @@ export function getVCRevisionsData({
|
|
|
35
36
|
multiHeatmap,
|
|
36
37
|
ssr,
|
|
37
38
|
calculatedVC,
|
|
38
|
-
calculatedVCNext
|
|
39
|
+
calculatedVCNext,
|
|
40
|
+
experienceKey
|
|
39
41
|
}) {
|
|
40
|
-
|
|
42
|
+
const isTTVCv3Enabled = fg('platform_ufo_vc_enable_revisions_by_experience') ? isVCRevisionEnabled('fy25.03', experienceKey) : isVCRevisionEnabled('fy25.03');
|
|
43
|
+
|
|
44
|
+
// As part of `platform_ufo_vc_enable_revisions_by_experience`, we are looking to turn off the `multiHeatmap` branch of code
|
|
45
|
+
// for calculating TTVC, and instead rely on existing values already available, e.g. `calculatedVC` and `calculatedVCNext`
|
|
46
|
+
if (!isTTVCv3Enabled && !fg('platform_ufo_vc_enable_revisions_by_experience')) {
|
|
41
47
|
if (!multiHeatmap) {
|
|
42
48
|
return null;
|
|
43
49
|
}
|
|
@@ -58,33 +64,54 @@ export function getVCRevisionsData({
|
|
|
58
64
|
})
|
|
59
65
|
};
|
|
60
66
|
}
|
|
61
|
-
|
|
62
|
-
// Calculate these conditions once
|
|
63
67
|
const pageVisibilityUpToTTAI = getPageVisibilityState(interaction.start, interaction.end);
|
|
64
68
|
const isVisiblePageVisibleUpToTTAI = pageVisibilityUpToTTAI === 'visible';
|
|
65
69
|
const shouldHaveVCmetric = isVCClean && !isEventAborted && isVisiblePageVisibleUpToTTAI;
|
|
70
|
+
if (fg('platform_ufo_vc_enable_revisions_by_experience')) {
|
|
71
|
+
const availableVCRevisionPayloads = [];
|
|
72
|
+
if (isVCRevisionEnabled('fy25.01', experienceKey)) {
|
|
73
|
+
availableVCRevisionPayloads.push({
|
|
74
|
+
revision: 'fy25.01',
|
|
75
|
+
clean: isVCClean,
|
|
76
|
+
'metric:vc90': shouldHaveVCmetric ? calculatedVC.VC['90'] : null,
|
|
77
|
+
vcDetails: createVCDetails(calculatedVC, shouldHaveVCmetric)
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (isVCRevisionEnabled('fy25.02', experienceKey)) {
|
|
81
|
+
availableVCRevisionPayloads.push({
|
|
82
|
+
revision: 'fy25.02',
|
|
83
|
+
clean: isVCClean,
|
|
84
|
+
'metric:vc90': shouldHaveVCmetric ? calculatedVCNext.VC['90'] : null,
|
|
85
|
+
vcDetails: createVCDetails(calculatedVCNext, shouldHaveVCmetric)
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
[`${fullPrefix}vc:rev`]: availableVCRevisionPayloads
|
|
90
|
+
};
|
|
91
|
+
} else {
|
|
92
|
+
// Create the V2 revision object which is always needed
|
|
93
|
+
const ttvcV2Revision = {
|
|
94
|
+
revision: 'fy25.02',
|
|
95
|
+
clean: isVCClean,
|
|
96
|
+
'metric:vc90': shouldHaveVCmetric ? calculatedVCNext.VC['90'] : null,
|
|
97
|
+
vcDetails: createVCDetails(calculatedVCNext, shouldHaveVCmetric)
|
|
98
|
+
};
|
|
99
|
+
const isTTVCv1Disabled = !isVCRevisionEnabled('fy25.01');
|
|
100
|
+
if (isTTVCv1Disabled) {
|
|
101
|
+
return {
|
|
102
|
+
[`${fullPrefix}vc:rev`]: [ttvcV2Revision]
|
|
103
|
+
};
|
|
104
|
+
}
|
|
66
105
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if (!isVCRevisionEnabled('fy25.01')) {
|
|
106
|
+
// Only create ttvcV1Revision when we're actually going to use it
|
|
107
|
+
const ttvcV1Revision = {
|
|
108
|
+
revision: 'fy25.01',
|
|
109
|
+
clean: isVCClean,
|
|
110
|
+
'metric:vc90': shouldHaveVCmetric ? calculatedVC.VC['90'] : null,
|
|
111
|
+
vcDetails: createVCDetails(calculatedVC, shouldHaveVCmetric)
|
|
112
|
+
};
|
|
75
113
|
return {
|
|
76
|
-
[`${fullPrefix}vc:rev`]: [ttvcV2Revision]
|
|
114
|
+
[`${fullPrefix}vc:rev`]: [ttvcV1Revision, ttvcV2Revision]
|
|
77
115
|
};
|
|
78
116
|
}
|
|
79
|
-
|
|
80
|
-
// Only create ttvcV1Revision when we're actually going to use it
|
|
81
|
-
const ttvcV1Revision = {
|
|
82
|
-
revision: 'fy25.01',
|
|
83
|
-
clean: isVCClean,
|
|
84
|
-
'metric:vc90': shouldHaveVCmetric ? calculatedVC.VC['90'] : null,
|
|
85
|
-
vcDetails: createVCDetails(calculatedVC, shouldHaveVCmetric)
|
|
86
|
-
};
|
|
87
|
-
return {
|
|
88
|
-
[`${fullPrefix}vc:rev`]: [ttvcV1Revision, ttvcV2Revision]
|
|
89
|
-
};
|
|
90
117
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
3
|
import { isVCRevisionEnabled } from '../../config';
|
|
4
|
+
import { getActiveInteraction } from '../../interaction-metrics';
|
|
4
5
|
import { attachAbortListeners } from './attachAbortListeners';
|
|
5
6
|
import { getVCRevisionsData } from './getVCRevisionsData';
|
|
6
7
|
import { getViewportHeight, getViewportWidth } from './getViewport';
|
|
@@ -94,7 +95,8 @@ export class VCObserver {
|
|
|
94
95
|
prefix,
|
|
95
96
|
ssr,
|
|
96
97
|
vc,
|
|
97
|
-
isEventAborted
|
|
98
|
+
isEventAborted,
|
|
99
|
+
experienceKey
|
|
98
100
|
}) => {
|
|
99
101
|
const startTime = performance.now();
|
|
100
102
|
// add local measurement
|
|
@@ -116,7 +118,7 @@ export class VCObserver {
|
|
|
116
118
|
ratios,
|
|
117
119
|
multiHeatmap
|
|
118
120
|
} = rawData;
|
|
119
|
-
const isTTVCv1Disabled = !isVCRevisionEnabled('fy25.01');
|
|
121
|
+
const isTTVCv1Disabled = fg('platform_ufo_vc_enable_revisions_by_experience') ? !isVCRevisionEnabled('fy25.01', experienceKey) : !isVCRevisionEnabled('fy25.01');
|
|
120
122
|
|
|
121
123
|
// NOTE: as part of platform_ufo_add_vc_abort_reason_by_revisions feature,
|
|
122
124
|
// we want to report abort by scroll events the same way as other abort reasons
|
|
@@ -318,7 +320,8 @@ export class VCObserver {
|
|
|
318
320
|
VC: vcNext.VC,
|
|
319
321
|
VCBox: vcNext.VCBox
|
|
320
322
|
},
|
|
321
|
-
isEventAborted
|
|
323
|
+
isEventAborted,
|
|
324
|
+
experienceKey
|
|
322
325
|
});
|
|
323
326
|
const speedIndex = {
|
|
324
327
|
[`ufo:speedIndex`]: isTTVCv1Disabled ? vcNext.VCEntries.speedIndex : VCEntries.speedIndex,
|
|
@@ -335,7 +338,7 @@ export class VCObserver {
|
|
|
335
338
|
...speedIndex
|
|
336
339
|
};
|
|
337
340
|
}
|
|
338
|
-
const isTTVCv3Enabled = isVCRevisionEnabled('fy25.03');
|
|
341
|
+
const isTTVCv3Enabled = fg('platform_ufo_vc_enable_revisions_by_experience') ? isVCRevisionEnabled('fy25.03', experienceKey) : isVCRevisionEnabled('fy25.03');
|
|
339
342
|
return {
|
|
340
343
|
'metrics:vc': VC,
|
|
341
344
|
[`${fullPrefix}vc:state`]: true,
|
|
@@ -360,7 +363,12 @@ export class VCObserver {
|
|
|
360
363
|
_defineProperty(this, "handleUpdate", (rawTime, intersectionRect, targetName, element, type, ignoreReason, attributeName, oldValue, newValue) => {
|
|
361
364
|
this.measureStart();
|
|
362
365
|
this.legacyHandleUpdate(rawTime, intersectionRect, targetName, element, type, ignoreReason, attributeName, oldValue, newValue);
|
|
363
|
-
|
|
366
|
+
let isTTVCv3Disabled = !isVCRevisionEnabled('fy25.03');
|
|
367
|
+
if (fg('platform_ufo_vc_enable_revisions_by_experience')) {
|
|
368
|
+
const interaction = getActiveInteraction();
|
|
369
|
+
isTTVCv3Disabled = !isVCRevisionEnabled('fy25.03', interaction === null || interaction === void 0 ? void 0 : interaction.ufoName);
|
|
370
|
+
}
|
|
371
|
+
if (isTTVCv3Disabled) {
|
|
364
372
|
this.onViewportChangeDetected({
|
|
365
373
|
timestamp: rawTime,
|
|
366
374
|
intersectionRect,
|
|
@@ -383,7 +391,11 @@ export class VCObserver {
|
|
|
383
391
|
if (!ignoreReason) {
|
|
384
392
|
this.applyChangesToHeatMap(mappedValues, time, this.heatmapNext);
|
|
385
393
|
}
|
|
386
|
-
|
|
394
|
+
let isTTVCv1Disabled = !isVCRevisionEnabled('fy25.01');
|
|
395
|
+
if (fg('platform_ufo_vc_enable_revisions_by_experience')) {
|
|
396
|
+
const interaction = getActiveInteraction();
|
|
397
|
+
isTTVCv1Disabled = !isVCRevisionEnabled('fy25.01', interaction === null || interaction === void 0 ? void 0 : interaction.ufoName);
|
|
398
|
+
}
|
|
387
399
|
if (!isTTVCv1Disabled && (!ignoreReason || ignoreReason === 'not-visible') && type !== 'attr') {
|
|
388
400
|
this.applyChangesToHeatMap(mappedValues, time, this.heatmap);
|
|
389
401
|
}
|
package/dist/esm/config/index.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
1
7
|
var config;
|
|
2
8
|
var DEFAULT_TTVC_REVISION = 'fy25.02';
|
|
3
9
|
|
|
@@ -5,28 +11,66 @@ var DEFAULT_TTVC_REVISION = 'fy25.02';
|
|
|
5
11
|
// and they could delete empty members
|
|
6
12
|
|
|
7
13
|
export function setUFOConfig(newConfig) {
|
|
8
|
-
|
|
14
|
+
if (fg('platform_ufo_vc_enable_revisions_by_experience')) {
|
|
15
|
+
var _newConfig$vc;
|
|
16
|
+
// Handle edge cases with `enabledVCRevisions`
|
|
17
|
+
var _ref = (_newConfig$vc = newConfig === null || newConfig === void 0 ? void 0 : newConfig.vc) !== null && _newConfig$vc !== void 0 ? _newConfig$vc : {},
|
|
18
|
+
enabledVCRevisions = _ref.enabledVCRevisions;
|
|
19
|
+
if (_typeof(enabledVCRevisions === null || enabledVCRevisions === void 0 ? void 0 : enabledVCRevisions.byExperience) === 'object') {
|
|
20
|
+
config = _objectSpread(_objectSpread({}, newConfig), {}, {
|
|
21
|
+
vc: _objectSpread(_objectSpread({}, newConfig.vc), {}, {
|
|
22
|
+
enabledVCRevisions: {
|
|
23
|
+
// enforce axiom about `enabledVCRevisions.all` config
|
|
24
|
+
all: Array.from(new Set([DEFAULT_TTVC_REVISION].concat(_toConsumableArray(enabledVCRevisions === null || enabledVCRevisions === void 0 ? void 0 : enabledVCRevisions.all), _toConsumableArray(Object.values(enabledVCRevisions === null || enabledVCRevisions === void 0 ? void 0 : enabledVCRevisions.byExperience).flat())))),
|
|
25
|
+
byExperience: _objectSpread({}, enabledVCRevisions === null || enabledVCRevisions === void 0 ? void 0 : enabledVCRevisions.byExperience)
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
} else {
|
|
30
|
+
config = newConfig;
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
config = newConfig;
|
|
34
|
+
}
|
|
9
35
|
}
|
|
10
36
|
export function getConfig() {
|
|
11
37
|
return config;
|
|
12
38
|
}
|
|
39
|
+
var isValidConfigArray = function isValidConfigArray(array) {
|
|
40
|
+
return Array.isArray(array) && array.length > 0;
|
|
41
|
+
};
|
|
13
42
|
export function getEnabledVCRevisions() {
|
|
43
|
+
var experienceKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
14
44
|
try {
|
|
15
45
|
var _config$vc;
|
|
16
46
|
if (!config) {
|
|
17
47
|
return [];
|
|
18
48
|
}
|
|
19
49
|
if ((_config$vc = config.vc) !== null && _config$vc !== void 0 && _config$vc.enabled) {
|
|
20
|
-
var _config$vc2,
|
|
21
|
-
|
|
50
|
+
var _config$vc2, _enabledVCRevisions$b;
|
|
51
|
+
var _ref2 = (_config$vc2 = config.vc) !== null && _config$vc2 !== void 0 ? _config$vc2 : {},
|
|
52
|
+
enabledVCRevisions = _ref2.enabledVCRevisions;
|
|
53
|
+
if (isValidConfigArray(enabledVCRevisions === null || enabledVCRevisions === void 0 || (_enabledVCRevisions$b = enabledVCRevisions.byExperience) === null || _enabledVCRevisions$b === void 0 ? void 0 : _enabledVCRevisions$b[experienceKey]) && fg('platform_ufo_vc_enable_revisions_by_experience')) {
|
|
54
|
+
var _enabledVCRevisions$b2;
|
|
55
|
+
return (_enabledVCRevisions$b2 = enabledVCRevisions.byExperience) === null || _enabledVCRevisions$b2 === void 0 ? void 0 : _enabledVCRevisions$b2[experienceKey];
|
|
56
|
+
}
|
|
57
|
+
if (isValidConfigArray(enabledVCRevisions === null || enabledVCRevisions === void 0 ? void 0 : enabledVCRevisions.all)) {
|
|
58
|
+
return enabledVCRevisions.all;
|
|
59
|
+
}
|
|
60
|
+
return [DEFAULT_TTVC_REVISION];
|
|
22
61
|
}
|
|
23
62
|
return [];
|
|
24
63
|
} catch (_unused) {
|
|
25
64
|
return [];
|
|
26
65
|
}
|
|
27
66
|
}
|
|
28
|
-
export function isVCRevisionEnabled(revision) {
|
|
29
|
-
return getEnabledVCRevisions().includes(revision);
|
|
67
|
+
export function isVCRevisionEnabled(revision, experienceKey) {
|
|
68
|
+
return getEnabledVCRevisions(experienceKey).includes(revision);
|
|
69
|
+
}
|
|
70
|
+
export function getMostRecentVCRevision() {
|
|
71
|
+
var experienceKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
72
|
+
var enabledVCRevisions = getEnabledVCRevisions(experienceKey);
|
|
73
|
+
return enabledVCRevisions[enabledVCRevisions.length - 1];
|
|
30
74
|
}
|
|
31
75
|
export function getInteractionRate(name, interactionKind) {
|
|
32
76
|
try {
|
|
@@ -100,7 +100,8 @@ function _getExperimentalVCMetrics() {
|
|
|
100
100
|
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,
|
|
101
101
|
isEventAborted: !!interaction.abortReason,
|
|
102
102
|
prefix: prefix,
|
|
103
|
-
vc: interaction.vc
|
|
103
|
+
vc: interaction.vc,
|
|
104
|
+
experienceKey: interaction.ufoName
|
|
104
105
|
});
|
|
105
106
|
case 4:
|
|
106
107
|
result = _context.sent;
|
|
@@ -4,7 +4,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
-
import { getConfig, isVCRevisionEnabled } from '../../config';
|
|
7
|
+
import { getConfig, getMostRecentVCRevision, isVCRevisionEnabled } from '../../config';
|
|
8
8
|
import { postInteractionLog } from '../../interaction-metrics';
|
|
9
9
|
import { getVCObserver } from '../../vc';
|
|
10
10
|
import getInteractionStatus from './get-interaction-status';
|
|
@@ -16,7 +16,7 @@ function getVCMetrics(_x) {
|
|
|
16
16
|
function _getVCMetrics() {
|
|
17
17
|
_getVCMetrics = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(interaction) {
|
|
18
18
|
var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _config$experimentalI;
|
|
19
|
-
var config, interactionStatus, pageVisibilityUpToTTAI, isSSREnabled, ssr, tti, prefix, result, _result$ufoVcRev, ttvcV2Revision, VC;
|
|
19
|
+
var config, interactionStatus, pageVisibilityUpToTTAI, shouldReportVCMetrics, isSSREnabled, ssr, tti, prefix, result, _result$ufoVcRev, mostRecentVCRevision, mostRecentVCRevisionPayload, _result$ufoVcRev2, ttvcV2Revision, VC;
|
|
20
20
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
21
21
|
while (1) switch (_context.prev = _context.next) {
|
|
22
22
|
case 0:
|
|
@@ -35,13 +35,14 @@ function _getVCMetrics() {
|
|
|
35
35
|
case 5:
|
|
36
36
|
interactionStatus = getInteractionStatus(interaction);
|
|
37
37
|
pageVisibilityUpToTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
shouldReportVCMetrics = interactionStatus.originalInteractionStatus === 'SUCCEEDED' && pageVisibilityUpToTTAI === 'visible';
|
|
39
|
+
if (!(!shouldReportVCMetrics && fg('platform_ufo_no_vc_on_aborted'))) {
|
|
40
|
+
_context.next = 11;
|
|
40
41
|
break;
|
|
41
42
|
}
|
|
42
|
-
getVCObserver().stop();
|
|
43
|
+
getVCObserver().stop(interaction.ufoName);
|
|
43
44
|
return _context.abrupt("return", {});
|
|
44
|
-
case
|
|
45
|
+
case 11:
|
|
45
46
|
isSSREnabled = (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));
|
|
46
47
|
ssr = interaction.type === 'page_load' && isSSREnabled ? {
|
|
47
48
|
ssr: getSSRDoneTimeValue(config)
|
|
@@ -49,56 +50,76 @@ function _getVCMetrics() {
|
|
|
49
50
|
postInteractionLog.setVCObserverSSRConfig(ssr);
|
|
50
51
|
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;
|
|
51
52
|
prefix = 'ufo';
|
|
52
|
-
_context.next =
|
|
53
|
+
_context.next = 18;
|
|
53
54
|
return getVCObserver().getVCResult(_objectSpread({
|
|
54
55
|
start: interaction.start,
|
|
55
56
|
stop: interaction.end,
|
|
56
57
|
tti: tti,
|
|
57
58
|
prefix: prefix,
|
|
58
59
|
vc: interaction.vc,
|
|
59
|
-
isEventAborted: interactionStatus.originalInteractionStatus !== 'SUCCEEDED'
|
|
60
|
+
isEventAborted: interactionStatus.originalInteractionStatus !== 'SUCCEEDED',
|
|
61
|
+
experienceKey: interaction.ufoName
|
|
60
62
|
}, ssr));
|
|
61
|
-
case
|
|
63
|
+
case 18:
|
|
62
64
|
result = _context.sent;
|
|
63
65
|
if ((_config$experimentalI = config.experimentalInteractionMetrics) !== null && _config$experimentalI !== void 0 && _config$experimentalI.enabled) {
|
|
64
|
-
getVCObserver().stop();
|
|
66
|
+
getVCObserver().stop(interaction.ufoName);
|
|
65
67
|
}
|
|
66
68
|
postInteractionLog.setLastInteractionFinishVCResult(result);
|
|
67
|
-
if (
|
|
68
|
-
_context.next =
|
|
69
|
+
if (!fg('platform_ufo_vc_enable_revisions_by_experience')) {
|
|
70
|
+
_context.next = 29;
|
|
69
71
|
break;
|
|
70
72
|
}
|
|
71
|
-
|
|
73
|
+
mostRecentVCRevision = getMostRecentVCRevision(interaction.ufoName);
|
|
74
|
+
mostRecentVCRevisionPayload = result === null || result === void 0 || (_result$ufoVcRev = result['ufo:vc:rev']) === null || _result$ufoVcRev === void 0 ? void 0 : _result$ufoVcRev.find(function (_ref) {
|
|
72
75
|
var revision = _ref.revision;
|
|
76
|
+
return revision === mostRecentVCRevision;
|
|
77
|
+
});
|
|
78
|
+
if (!(!shouldReportVCMetrics || !(mostRecentVCRevisionPayload !== null && mostRecentVCRevisionPayload !== void 0 && mostRecentVCRevisionPayload.clean))) {
|
|
79
|
+
_context.next = 26;
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
return _context.abrupt("return", result);
|
|
83
|
+
case 26:
|
|
84
|
+
return _context.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
|
|
85
|
+
'metric:vc90': mostRecentVCRevisionPayload['metric:vc90']
|
|
86
|
+
}));
|
|
87
|
+
case 29:
|
|
88
|
+
if (isVCRevisionEnabled('fy25.01')) {
|
|
89
|
+
_context.next = 36;
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
ttvcV2Revision = result === null || result === void 0 || (_result$ufoVcRev2 = result['ufo:vc:rev']) === null || _result$ufoVcRev2 === void 0 ? void 0 : _result$ufoVcRev2.find(function (_ref2) {
|
|
93
|
+
var revision = _ref2.revision;
|
|
73
94
|
return revision === 'fy25.02';
|
|
74
95
|
});
|
|
75
96
|
if (ttvcV2Revision !== null && ttvcV2Revision !== void 0 && ttvcV2Revision.clean) {
|
|
76
|
-
_context.next =
|
|
97
|
+
_context.next = 33;
|
|
77
98
|
break;
|
|
78
99
|
}
|
|
79
100
|
return _context.abrupt("return", result);
|
|
80
|
-
case
|
|
101
|
+
case 33:
|
|
81
102
|
return _context.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
|
|
82
103
|
'metric:vc90': ttvcV2Revision['metric:vc90']
|
|
83
104
|
}));
|
|
84
|
-
case
|
|
105
|
+
case 36:
|
|
85
106
|
VC = result === null || result === void 0 ? void 0 : result['metrics:vc'];
|
|
86
107
|
if (!(!VC || !(result !== null && result !== void 0 && result["".concat(prefix, ":vc:clean")]))) {
|
|
87
|
-
_context.next =
|
|
108
|
+
_context.next = 39;
|
|
88
109
|
break;
|
|
89
110
|
}
|
|
90
111
|
return _context.abrupt("return", result);
|
|
91
|
-
case
|
|
112
|
+
case 39:
|
|
92
113
|
if (!(interactionStatus.originalInteractionStatus !== 'SUCCEEDED' || pageVisibilityUpToTTAI !== 'visible')) {
|
|
93
|
-
_context.next =
|
|
114
|
+
_context.next = 41;
|
|
94
115
|
break;
|
|
95
116
|
}
|
|
96
117
|
return _context.abrupt("return", result);
|
|
97
|
-
case
|
|
118
|
+
case 41:
|
|
98
119
|
return _context.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
|
|
99
120
|
'metric:vc90': VC['90']
|
|
100
121
|
}));
|
|
101
|
-
case
|
|
122
|
+
case 42:
|
|
102
123
|
case "end":
|
|
103
124
|
return _context.stop();
|
|
104
125
|
}
|
|
@@ -126,6 +126,17 @@ function createPostInteractionLogPayload(_ref2) {
|
|
|
126
126
|
if (pageVisibilityState !== 'visible') {
|
|
127
127
|
return null;
|
|
128
128
|
}
|
|
129
|
+
|
|
130
|
+
// Align post-interaction-logs closer to UFO event behaviour,
|
|
131
|
+
// e.g. also check for aborted or failed events
|
|
132
|
+
if (fg('platform_ufo_vc_align_revisions_on_watchdog_event')) {
|
|
133
|
+
if (lastInteractionFinish.abortReason) {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
if (lastInteractionFinish.errors.length > 0) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
129
140
|
var maxEndTimeFromProfiler = reactProfilerTimings ? Math.max.apply(Math, _toConsumableArray(reactProfilerTimings.map(function (t) {
|
|
130
141
|
return t.commitTime;
|
|
131
142
|
}))) : lastInteractionFinish.end;
|
|
@@ -798,7 +798,8 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
|
|
|
798
798
|
if (type === 'transition') {
|
|
799
799
|
var _getConfig14;
|
|
800
800
|
getVCObserver().start({
|
|
801
|
-
startTime: startTime
|
|
801
|
+
startTime: startTime,
|
|
802
|
+
experienceKey: ufoName
|
|
802
803
|
});
|
|
803
804
|
postInteractionLog.startVCObserver({
|
|
804
805
|
startTime: startTime
|
|
@@ -5,7 +5,9 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
5
5
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
6
|
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; }
|
|
7
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
import { getConfig } from '../config';
|
|
10
|
+
import { VCObserverWrapper } from '../vc';
|
|
9
11
|
import { VCObserver } from '../vc/vc-observer';
|
|
10
12
|
var POST_INTERACTION_LOG_SEND_DEFAULT_TIMEOUT = 3000;
|
|
11
13
|
var PostInteractionLog = /*#__PURE__*/function () {
|
|
@@ -36,7 +38,11 @@ var PostInteractionLog = /*#__PURE__*/function () {
|
|
|
36
38
|
return _createClass(PostInteractionLog, [{
|
|
37
39
|
key: "initializeVCObserver",
|
|
38
40
|
value: function initializeVCObserver(options) {
|
|
39
|
-
if (
|
|
41
|
+
if (fg('platform_ufo_vc_align_revisions_on_watchdog_event')) {
|
|
42
|
+
this.vcObserver = new VCObserverWrapper(_objectSpread(_objectSpread({}, options), {}, {
|
|
43
|
+
isPostInteraction: true
|
|
44
|
+
}));
|
|
45
|
+
} else if (this.vcObserver === null) {
|
|
40
46
|
this.vcObserver = new VCObserver(_objectSpread(_objectSpread({}, options), {}, {
|
|
41
47
|
isPostInteraction: true
|
|
42
48
|
}));
|
|
@@ -125,14 +131,16 @@ var PostInteractionLog = /*#__PURE__*/function () {
|
|
|
125
131
|
return _context.abrupt("return");
|
|
126
132
|
case 4:
|
|
127
133
|
_context.next = 6;
|
|
128
|
-
return (_this$vcObserver3 = this.vcObserver) === null || _this$vcObserver3 === void 0 ? void 0 : _this$vcObserver3.getVCResult(_objectSpread({
|
|
134
|
+
return (_this$vcObserver3 = this.vcObserver) === null || _this$vcObserver3 === void 0 ? void 0 : _this$vcObserver3.getVCResult(_objectSpread(_objectSpread({
|
|
129
135
|
start: this.lastInteractionFinish.start,
|
|
130
136
|
stop: performance.now(),
|
|
131
137
|
tti: -1,
|
|
132
138
|
// no need for TTI value here
|
|
133
139
|
isEventAborted: !!this.lastInteractionFinish.abortReason,
|
|
134
140
|
prefix: 'ufo'
|
|
135
|
-
}, this.vcObserverSSRConfig)
|
|
141
|
+
}, this.vcObserverSSRConfig), {}, {
|
|
142
|
+
experienceKey: this.lastInteractionFinish.ufoName
|
|
143
|
+
}));
|
|
136
144
|
case 6:
|
|
137
145
|
postInteractionFinishVCResult = _context.sent;
|
|
138
146
|
if ((_getConfig2 = getConfig()) !== null && _getConfig2 !== void 0 && (_getConfig2 = _getConfig2.experimentalInteractionMetrics) !== null && _getConfig2 !== void 0 && _getConfig2.enabled) {
|
|
@@ -177,7 +185,8 @@ var PostInteractionLog = /*#__PURE__*/function () {
|
|
|
177
185
|
routeName = _ref2.routeName,
|
|
178
186
|
type = _ref2.type,
|
|
179
187
|
experimentalTTAI = _ref2.experimentalTTAI,
|
|
180
|
-
experimentalVC90 = _ref2.experimentalVC90
|
|
188
|
+
experimentalVC90 = _ref2.experimentalVC90,
|
|
189
|
+
errors = _ref2.errors;
|
|
181
190
|
this.lastInteractionFinish = {
|
|
182
191
|
ufoName: ufoName,
|
|
183
192
|
start: start,
|
|
@@ -188,7 +197,8 @@ var PostInteractionLog = /*#__PURE__*/function () {
|
|
|
188
197
|
routeName: routeName,
|
|
189
198
|
type: type,
|
|
190
199
|
experimentalTTAI: experimentalTTAI,
|
|
191
|
-
experimentalVC90: experimentalVC90
|
|
200
|
+
experimentalVC90: experimentalVC90,
|
|
201
|
+
errors: errors
|
|
192
202
|
};
|
|
193
203
|
var timeout = ((_getConfig3 = getConfig()) === null || _getConfig3 === void 0 ? void 0 : _getConfig3.timeWindowForLateMutationsInMilliseconds) || POST_INTERACTION_LOG_SEND_DEFAULT_TIMEOUT;
|
|
194
204
|
this.sinkTimeoutId = window.setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|