@atlaskit/react-ufo 3.13.0 → 3.13.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 +8 -0
- package/dist/cjs/config/index.js +15 -20
- package/dist/cjs/create-payload/utils/get-vc-metrics.js +5 -44
- package/dist/cjs/vc/index.js +49 -101
- package/dist/cjs/vc/vc-observer/getVCRevisionsData.js +13 -67
- package/dist/cjs/vc/vc-observer/index.js +27 -107
- package/dist/es2019/config/index.js +18 -23
- package/dist/es2019/create-payload/utils/get-vc-metrics.js +12 -41
- package/dist/es2019/vc/index.js +44 -88
- package/dist/es2019/vc/vc-observer/getVCRevisionsData.js +15 -71
- package/dist/es2019/vc/vc-observer/index.js +5 -87
- package/dist/esm/config/index.js +15 -20
- package/dist/esm/create-payload/utils/get-vc-metrics.js +6 -45
- package/dist/esm/vc/index.js +49 -101
- package/dist/esm/vc/vc-observer/getVCRevisionsData.js +13 -67
- package/dist/esm/vc/vc-observer/index.js +27 -107
- package/dist/types/common/vc/types.d.ts +0 -2
- package/dist/types/create-post-interaction-log-payload/index.d.ts +1 -1
- package/dist/types/vc/vc-observer/getVCRevisionsData.d.ts +2 -17
- package/dist/types/vc/vc-observer/index.d.ts +0 -4
- package/dist/types-ts4.5/common/vc/types.d.ts +0 -2
- package/dist/types-ts4.5/create-post-interaction-log-payload/index.d.ts +1 -1
- package/dist/types-ts4.5/vc/vc-observer/getVCRevisionsData.d.ts +2 -17
- package/dist/types-ts4.5/vc/vc-observer/index.d.ts +0 -4
- package/package.json +1 -4
- package/dist/cjs/vc/vc-observer/heatmap/heatmap.js +0 -281
- package/dist/cjs/vc/vc-observer/revisions/ViewportUpdateClassifier.js +0 -68
- package/dist/cjs/vc/vc-observer/revisions/fy25_01.js +0 -76
- package/dist/cjs/vc/vc-observer/revisions/fy25_02.js +0 -59
- package/dist/cjs/vc/vc-observer/revisions/revisions.js +0 -24
- package/dist/cjs/vc/vc-observer/revisions/types.js +0 -5
- package/dist/es2019/vc/vc-observer/heatmap/heatmap.js +0 -247
- package/dist/es2019/vc/vc-observer/revisions/ViewportUpdateClassifier.js +0 -48
- package/dist/es2019/vc/vc-observer/revisions/fy25_01.js +0 -55
- package/dist/es2019/vc/vc-observer/revisions/fy25_02.js +0 -35
- package/dist/es2019/vc/vc-observer/revisions/revisions.js +0 -18
- package/dist/es2019/vc/vc-observer/revisions/types.js +0 -1
- package/dist/esm/vc/vc-observer/heatmap/heatmap.js +0 -274
- package/dist/esm/vc/vc-observer/revisions/ViewportUpdateClassifier.js +0 -61
- package/dist/esm/vc/vc-observer/revisions/fy25_01.js +0 -69
- package/dist/esm/vc/vc-observer/revisions/fy25_02.js +0 -52
- package/dist/esm/vc/vc-observer/revisions/revisions.js +0 -18
- package/dist/esm/vc/vc-observer/revisions/types.js +0 -1
- package/dist/types/vc/vc-observer/heatmap/heatmap.d.ts +0 -79
- package/dist/types/vc/vc-observer/revisions/ViewportUpdateClassifier.d.ts +0 -31
- package/dist/types/vc/vc-observer/revisions/fy25_01.d.ts +0 -13
- package/dist/types/vc/vc-observer/revisions/fy25_02.d.ts +0 -16
- package/dist/types/vc/vc-observer/revisions/revisions.d.ts +0 -2
- package/dist/types/vc/vc-observer/revisions/types.d.ts +0 -28
- package/dist/types-ts4.5/vc/vc-observer/heatmap/heatmap.d.ts +0 -79
- package/dist/types-ts4.5/vc/vc-observer/revisions/ViewportUpdateClassifier.d.ts +0 -31
- package/dist/types-ts4.5/vc/vc-observer/revisions/fy25_01.d.ts +0 -13
- package/dist/types-ts4.5/vc/vc-observer/revisions/fy25_02.d.ts +0 -16
- package/dist/types-ts4.5/vc/vc-observer/revisions/revisions.d.ts +0 -2
- package/dist/types-ts4.5/vc/vc-observer/revisions/types.d.ts +0 -28
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
1
|
import { isVCRevisionEnabled } from '../../config';
|
|
3
2
|
import { getPageVisibilityState } from '../../hidden-timing';
|
|
4
|
-
import { getRevisions } from './revisions/revisions';
|
|
5
3
|
const VCParts = ['25', '50', '75', '80', '85', '90', '95', '98', '99'];
|
|
6
4
|
const READONLY_EMPTY_ARRAY = Array.from({
|
|
7
5
|
length: 0
|
|
@@ -33,85 +31,31 @@ export function getVCRevisionsData({
|
|
|
33
31
|
interaction,
|
|
34
32
|
isVCClean,
|
|
35
33
|
isEventAborted,
|
|
36
|
-
multiHeatmap,
|
|
37
|
-
ssr,
|
|
38
34
|
calculatedVC,
|
|
39
35
|
calculatedVCNext,
|
|
40
36
|
experienceKey
|
|
41
37
|
}) {
|
|
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')) {
|
|
47
|
-
if (!multiHeatmap) {
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
return {
|
|
51
|
-
[`${fullPrefix}vc:rev`]: multiHeatmap === null || multiHeatmap === void 0 ? void 0 : multiHeatmap.getPayloadShapedData({
|
|
52
|
-
VCParts: VCParts.map(v => parseInt(v)),
|
|
53
|
-
VCCalculationMethods: getRevisions().map(({
|
|
54
|
-
classifier
|
|
55
|
-
}) => classifier.VCCalculationMethod),
|
|
56
|
-
filterComponentsLog: getRevisions().map(({
|
|
57
|
-
classifier
|
|
58
|
-
}) => classifier.filterComponentsLog),
|
|
59
|
-
isEventAborted,
|
|
60
|
-
interactionStart: interaction.start,
|
|
61
|
-
ttai: interaction.end,
|
|
62
|
-
ssr,
|
|
63
|
-
clean: isVCClean
|
|
64
|
-
})
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
38
|
const pageVisibilityUpToTTAI = getPageVisibilityState(interaction.start, interaction.end);
|
|
68
39
|
const isVisiblePageVisibleUpToTTAI = pageVisibilityUpToTTAI === 'visible';
|
|
69
40
|
const shouldHaveVCmetric = isVCClean && !isEventAborted && isVisiblePageVisibleUpToTTAI;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
-
}
|
|
105
|
-
|
|
106
|
-
// Only create ttvcV1Revision when we're actually going to use it
|
|
107
|
-
const ttvcV1Revision = {
|
|
41
|
+
const availableVCRevisionPayloads = [];
|
|
42
|
+
if (isVCRevisionEnabled('fy25.01', experienceKey)) {
|
|
43
|
+
availableVCRevisionPayloads.push({
|
|
108
44
|
revision: 'fy25.01',
|
|
109
45
|
clean: isVCClean,
|
|
110
46
|
'metric:vc90': shouldHaveVCmetric ? calculatedVC.VC['90'] : null,
|
|
111
47
|
vcDetails: createVCDetails(calculatedVC, shouldHaveVCmetric)
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (isVCRevisionEnabled('fy25.02', experienceKey)) {
|
|
51
|
+
availableVCRevisionPayloads.push({
|
|
52
|
+
revision: 'fy25.02',
|
|
53
|
+
clean: isVCClean,
|
|
54
|
+
'metric:vc90': shouldHaveVCmetric ? calculatedVCNext.VC['90'] : null,
|
|
55
|
+
vcDetails: createVCDetails(calculatedVCNext, shouldHaveVCmetric)
|
|
56
|
+
});
|
|
116
57
|
}
|
|
58
|
+
return {
|
|
59
|
+
[`${fullPrefix}vc:rev`]: availableVCRevisionPayloads
|
|
60
|
+
};
|
|
117
61
|
}
|
|
@@ -6,9 +6,7 @@ import { attachAbortListeners } from './attachAbortListeners';
|
|
|
6
6
|
import { getVCRevisionDebugDetails } from './getVCRevisionDebugDetails';
|
|
7
7
|
import { getVCRevisionsData } from './getVCRevisionsData';
|
|
8
8
|
import { getViewportHeight, getViewportWidth } from './getViewport';
|
|
9
|
-
import { MultiRevisionHeatmap } from './heatmap/heatmap';
|
|
10
9
|
import { Observers } from './observers';
|
|
11
|
-
import { getRevisions } from './revisions/revisions';
|
|
12
10
|
const abortReason = {
|
|
13
11
|
scroll: 'scroll',
|
|
14
12
|
keypress: 'keypress',
|
|
@@ -41,7 +39,6 @@ export class VCObserver {
|
|
|
41
39
|
});
|
|
42
40
|
/* heatmap */
|
|
43
41
|
_defineProperty(this, "arraySize", 0);
|
|
44
|
-
_defineProperty(this, "multiHeatmap", null);
|
|
45
42
|
_defineProperty(this, "componentsLog", {});
|
|
46
43
|
_defineProperty(this, "vcRatios", {});
|
|
47
44
|
_defineProperty(this, "active", false);
|
|
@@ -75,7 +72,6 @@ export class VCObserver {
|
|
|
75
72
|
},
|
|
76
73
|
heatmap: this.heatmap,
|
|
77
74
|
heatmapNext: this.heatmapNext,
|
|
78
|
-
multiHeatmap: this.multiHeatmap,
|
|
79
75
|
outOfBoundaryInfo: this.outOfBoundaryInfo,
|
|
80
76
|
totalTime: Math.round(this.totalTime + this.observers.getTotalTime()),
|
|
81
77
|
componentsLog: {
|
|
@@ -117,10 +113,9 @@ export class VCObserver {
|
|
|
117
113
|
componentsLog,
|
|
118
114
|
viewport,
|
|
119
115
|
devToolsEnabled,
|
|
120
|
-
ratios
|
|
121
|
-
multiHeatmap
|
|
116
|
+
ratios
|
|
122
117
|
} = rawData;
|
|
123
|
-
const isTTVCv1Disabled =
|
|
118
|
+
const isTTVCv1Disabled = !isVCRevisionEnabled('fy25.01', experienceKey);
|
|
124
119
|
|
|
125
120
|
// NOTE: as part of platform_ufo_add_vc_abort_reason_by_revisions feature,
|
|
126
121
|
// we want to report abort by scroll events the same way as other abort reasons
|
|
@@ -339,8 +334,6 @@ export class VCObserver {
|
|
|
339
334
|
end: stop
|
|
340
335
|
},
|
|
341
336
|
isVCClean,
|
|
342
|
-
multiHeatmap,
|
|
343
|
-
ssr,
|
|
344
337
|
calculatedVC: {
|
|
345
338
|
VC,
|
|
346
339
|
VCBox
|
|
@@ -367,7 +360,7 @@ export class VCObserver {
|
|
|
367
360
|
...speedIndex
|
|
368
361
|
};
|
|
369
362
|
}
|
|
370
|
-
const isTTVCv3Enabled =
|
|
363
|
+
const isTTVCv3Enabled = isVCRevisionEnabled('fy25.03', experienceKey);
|
|
371
364
|
return {
|
|
372
365
|
'metrics:vc': VC,
|
|
373
366
|
[`${fullPrefix}vc:state`]: true,
|
|
@@ -390,29 +383,6 @@ export class VCObserver {
|
|
|
390
383
|
};
|
|
391
384
|
});
|
|
392
385
|
_defineProperty(this, "handleUpdate", (rawTime, intersectionRect, targetName, element, type, ignoreReason, attributeName, oldValue, newValue) => {
|
|
393
|
-
this.measureStart();
|
|
394
|
-
this.legacyHandleUpdate(rawTime, intersectionRect, targetName, element, type, ignoreReason, attributeName, oldValue, newValue);
|
|
395
|
-
let isTTVCv3Disabled = !isVCRevisionEnabled('fy25.03');
|
|
396
|
-
if (fg('platform_ufo_vc_enable_revisions_by_experience')) {
|
|
397
|
-
const interaction = getActiveInteraction();
|
|
398
|
-
isTTVCv3Disabled = !isVCRevisionEnabled('fy25.03', interaction === null || interaction === void 0 ? void 0 : interaction.ufoName);
|
|
399
|
-
}
|
|
400
|
-
if (isTTVCv3Disabled) {
|
|
401
|
-
this.onViewportChangeDetected({
|
|
402
|
-
timestamp: rawTime,
|
|
403
|
-
intersectionRect,
|
|
404
|
-
targetName,
|
|
405
|
-
element,
|
|
406
|
-
type,
|
|
407
|
-
ignoreReason,
|
|
408
|
-
attributeName,
|
|
409
|
-
oldValue,
|
|
410
|
-
newValue
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
this.measureStop();
|
|
414
|
-
});
|
|
415
|
-
_defineProperty(this, "legacyHandleUpdate", (rawTime, intersectionRect, targetName, element, type, ignoreReason, attributeName, oldValue, newValue) => {
|
|
416
386
|
if (this.abortReason.reason === null || this.abortReason.blocking === false) {
|
|
417
387
|
const time = Math.round(rawTime - this.startTime);
|
|
418
388
|
const mappedValues = this.mapPixelsToHeatmap(intersectionRect.left, intersectionRect.top, intersectionRect.width, intersectionRect.height);
|
|
@@ -420,11 +390,8 @@ export class VCObserver {
|
|
|
420
390
|
if (!ignoreReason) {
|
|
421
391
|
this.applyChangesToHeatMap(mappedValues, time, this.heatmapNext);
|
|
422
392
|
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
const interaction = getActiveInteraction();
|
|
426
|
-
isTTVCv1Disabled = !isVCRevisionEnabled('fy25.01', interaction === null || interaction === void 0 ? void 0 : interaction.ufoName);
|
|
427
|
-
}
|
|
393
|
+
const interaction = getActiveInteraction();
|
|
394
|
+
const isTTVCv1Disabled = !isVCRevisionEnabled('fy25.01', interaction === null || interaction === void 0 ? void 0 : interaction.ufoName);
|
|
428
395
|
if (!isTTVCv1Disabled && (!ignoreReason || ignoreReason === 'not-visible') && type !== 'attr') {
|
|
429
396
|
this.applyChangesToHeatMap(mappedValues, time, this.heatmap);
|
|
430
397
|
}
|
|
@@ -443,45 +410,6 @@ export class VCObserver {
|
|
|
443
410
|
});
|
|
444
411
|
}
|
|
445
412
|
});
|
|
446
|
-
_defineProperty(this, "onViewportChangeDetected", ({
|
|
447
|
-
element,
|
|
448
|
-
type,
|
|
449
|
-
ignoreReason,
|
|
450
|
-
timestamp,
|
|
451
|
-
targetName,
|
|
452
|
-
intersectionRect,
|
|
453
|
-
attributeName,
|
|
454
|
-
oldValue,
|
|
455
|
-
newValue
|
|
456
|
-
}) => {
|
|
457
|
-
if (this.multiHeatmap === null) {
|
|
458
|
-
return;
|
|
459
|
-
}
|
|
460
|
-
// @todo add abort reason handling
|
|
461
|
-
const time = Math.round(timestamp - this.startTime);
|
|
462
|
-
const revisions = getRevisions();
|
|
463
|
-
const revisionsClassification = revisions.map(revision => {
|
|
464
|
-
return revision.classifier.classifyUpdate({
|
|
465
|
-
element,
|
|
466
|
-
type,
|
|
467
|
-
ignoreReason
|
|
468
|
-
});
|
|
469
|
-
}, []);
|
|
470
|
-
this.multiHeatmap.handleUpdate({
|
|
471
|
-
time,
|
|
472
|
-
targetName,
|
|
473
|
-
intersectionRect,
|
|
474
|
-
type,
|
|
475
|
-
element,
|
|
476
|
-
classification: revisionsClassification,
|
|
477
|
-
onError: error => {
|
|
478
|
-
this.setAbortReason(abortReason.error, error.time, error.error);
|
|
479
|
-
},
|
|
480
|
-
attributeName,
|
|
481
|
-
oldValue,
|
|
482
|
-
newValue
|
|
483
|
-
});
|
|
484
|
-
});
|
|
485
413
|
_defineProperty(this, "mapPixelsToHeatmap", (left, top, width, height) => {
|
|
486
414
|
const {
|
|
487
415
|
w,
|
|
@@ -571,11 +499,6 @@ export class VCObserver {
|
|
|
571
499
|
});
|
|
572
500
|
this.heatmap = !isVCRevisionEnabled('fy25.01') ? [] : this.getCleanHeatmap();
|
|
573
501
|
this.heatmapNext = this.getCleanHeatmap();
|
|
574
|
-
this.multiHeatmap = new MultiRevisionHeatmap({
|
|
575
|
-
viewport: this.viewport,
|
|
576
|
-
revisions: getRevisions(),
|
|
577
|
-
devToolsEnabled: this.devToolsEnabled
|
|
578
|
-
});
|
|
579
502
|
this.isPostInteraction = options.isPostInteraction || false;
|
|
580
503
|
}
|
|
581
504
|
start({
|
|
@@ -727,11 +650,6 @@ export class VCObserver {
|
|
|
727
650
|
this.detachAbortListeners();
|
|
728
651
|
this.heatmap = !isVCRevisionEnabled('fy25.01') ? [] : this.getCleanHeatmap();
|
|
729
652
|
this.heatmapNext = this.getCleanHeatmap();
|
|
730
|
-
this.multiHeatmap = new MultiRevisionHeatmap({
|
|
731
|
-
viewport: this.viewport,
|
|
732
|
-
revisions: getRevisions(),
|
|
733
|
-
devToolsEnabled: this.devToolsEnabled
|
|
734
|
-
});
|
|
735
653
|
this.totalTime = 0;
|
|
736
654
|
this.componentsLog = {};
|
|
737
655
|
this.vcRatios = {};
|
package/dist/esm/config/index.js
CHANGED
|
@@ -3,7 +3,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
3
3
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
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
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
var config;
|
|
8
7
|
var DEFAULT_TTVC_REVISION = 'fy25.02';
|
|
9
8
|
|
|
@@ -11,24 +10,20 @@ var DEFAULT_TTVC_REVISION = 'fy25.02';
|
|
|
11
10
|
// and they could delete empty members
|
|
12
11
|
|
|
13
12
|
export function setUFOConfig(newConfig) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
enabledVCRevisions
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
29
|
-
} else {
|
|
30
|
-
config = newConfig;
|
|
31
|
-
}
|
|
13
|
+
var _newConfig$vc;
|
|
14
|
+
// Handle edge cases with `enabledVCRevisions`
|
|
15
|
+
var _ref = (_newConfig$vc = newConfig === null || newConfig === void 0 ? void 0 : newConfig.vc) !== null && _newConfig$vc !== void 0 ? _newConfig$vc : {},
|
|
16
|
+
enabledVCRevisions = _ref.enabledVCRevisions;
|
|
17
|
+
if (_typeof(enabledVCRevisions === null || enabledVCRevisions === void 0 ? void 0 : enabledVCRevisions.byExperience) === 'object') {
|
|
18
|
+
config = _objectSpread(_objectSpread({}, newConfig), {}, {
|
|
19
|
+
vc: _objectSpread(_objectSpread({}, newConfig.vc), {}, {
|
|
20
|
+
enabledVCRevisions: {
|
|
21
|
+
// enforce axiom about `enabledVCRevisions.all` config
|
|
22
|
+
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())))),
|
|
23
|
+
byExperience: _objectSpread({}, enabledVCRevisions === null || enabledVCRevisions === void 0 ? void 0 : enabledVCRevisions.byExperience)
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
});
|
|
32
27
|
} else {
|
|
33
28
|
config = newConfig;
|
|
34
29
|
}
|
|
@@ -50,7 +45,7 @@ export function getEnabledVCRevisions() {
|
|
|
50
45
|
var _config$vc2, _enabledVCRevisions$b;
|
|
51
46
|
var _ref2 = (_config$vc2 = config.vc) !== null && _config$vc2 !== void 0 ? _config$vc2 : {},
|
|
52
47
|
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])
|
|
48
|
+
if (isValidConfigArray(enabledVCRevisions === null || enabledVCRevisions === void 0 || (_enabledVCRevisions$b = enabledVCRevisions.byExperience) === null || _enabledVCRevisions$b === void 0 ? void 0 : _enabledVCRevisions$b[experienceKey])) {
|
|
54
49
|
var _enabledVCRevisions$b2;
|
|
55
50
|
return (_enabledVCRevisions$b2 = enabledVCRevisions.byExperience) === null || _enabledVCRevisions$b2 === void 0 ? void 0 : _enabledVCRevisions$b2[experienceKey];
|
|
56
51
|
}
|
|
@@ -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, getMostRecentVCRevision
|
|
7
|
+
import { getConfig, getMostRecentVCRevision } from '../../config';
|
|
8
8
|
import { postInteractionLog } from '../../interaction-metrics';
|
|
9
9
|
import { getVCObserver } from '../../vc';
|
|
10
10
|
import getInteractionStatus from './get-interaction-status';
|
|
@@ -15,8 +15,8 @@ function getVCMetrics(_x) {
|
|
|
15
15
|
}
|
|
16
16
|
function _getVCMetrics() {
|
|
17
17
|
_getVCMetrics = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(interaction) {
|
|
18
|
-
var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _config$experimentalI;
|
|
19
|
-
var config, interactionStatus, pageVisibilityUpToTTAI, shouldReportVCMetrics, isSSREnabled, ssr, tti, prefix, result,
|
|
18
|
+
var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _config$experimentalI, _result$ufoVcRev;
|
|
19
|
+
var config, interactionStatus, pageVisibilityUpToTTAI, shouldReportVCMetrics, isSSREnabled, ssr, tti, prefix, result, mostRecentVCRevision, mostRecentVCRevisionPayload;
|
|
20
20
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
21
21
|
while (1) switch (_context.prev = _context.next) {
|
|
22
22
|
case 0:
|
|
@@ -67,60 +67,21 @@ function _getVCMetrics() {
|
|
|
67
67
|
getVCObserver().stop(interaction.ufoName);
|
|
68
68
|
}
|
|
69
69
|
postInteractionLog.setLastInteractionFinishVCResult(result);
|
|
70
|
-
if (!fg('platform_ufo_vc_enable_revisions_by_experience')) {
|
|
71
|
-
_context.next = 29;
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
70
|
mostRecentVCRevision = getMostRecentVCRevision(interaction.ufoName);
|
|
75
71
|
mostRecentVCRevisionPayload = result === null || result === void 0 || (_result$ufoVcRev = result['ufo:vc:rev']) === null || _result$ufoVcRev === void 0 ? void 0 : _result$ufoVcRev.find(function (_ref) {
|
|
76
72
|
var revision = _ref.revision;
|
|
77
73
|
return revision === mostRecentVCRevision;
|
|
78
74
|
});
|
|
79
75
|
if (!(!shouldReportVCMetrics || !(mostRecentVCRevisionPayload !== null && mostRecentVCRevisionPayload !== void 0 && mostRecentVCRevisionPayload.clean))) {
|
|
80
|
-
_context.next =
|
|
76
|
+
_context.next = 25;
|
|
81
77
|
break;
|
|
82
78
|
}
|
|
83
79
|
return _context.abrupt("return", result);
|
|
84
|
-
case
|
|
80
|
+
case 25:
|
|
85
81
|
return _context.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
|
|
86
82
|
'metric:vc90': mostRecentVCRevisionPayload['metric:vc90']
|
|
87
83
|
}));
|
|
88
|
-
case
|
|
89
|
-
if (isVCRevisionEnabled('fy25.01')) {
|
|
90
|
-
_context.next = 36;
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
93
|
-
ttvcV2Revision = result === null || result === void 0 || (_result$ufoVcRev2 = result['ufo:vc:rev']) === null || _result$ufoVcRev2 === void 0 ? void 0 : _result$ufoVcRev2.find(function (_ref2) {
|
|
94
|
-
var revision = _ref2.revision;
|
|
95
|
-
return revision === 'fy25.02';
|
|
96
|
-
});
|
|
97
|
-
if (ttvcV2Revision !== null && ttvcV2Revision !== void 0 && ttvcV2Revision.clean) {
|
|
98
|
-
_context.next = 33;
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
return _context.abrupt("return", result);
|
|
102
|
-
case 33:
|
|
103
|
-
return _context.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
|
|
104
|
-
'metric:vc90': ttvcV2Revision['metric:vc90']
|
|
105
|
-
}));
|
|
106
|
-
case 36:
|
|
107
|
-
VC = result === null || result === void 0 ? void 0 : result['metrics:vc'];
|
|
108
|
-
if (!(!VC || !(result !== null && result !== void 0 && result["".concat(prefix, ":vc:clean")]))) {
|
|
109
|
-
_context.next = 39;
|
|
110
|
-
break;
|
|
111
|
-
}
|
|
112
|
-
return _context.abrupt("return", result);
|
|
113
|
-
case 39:
|
|
114
|
-
if (!(interactionStatus.originalInteractionStatus !== 'SUCCEEDED' || pageVisibilityUpToTTAI !== 'visible')) {
|
|
115
|
-
_context.next = 41;
|
|
116
|
-
break;
|
|
117
|
-
}
|
|
118
|
-
return _context.abrupt("return", result);
|
|
119
|
-
case 41:
|
|
120
|
-
return _context.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
|
|
121
|
-
'metric:vc90': VC['90']
|
|
122
|
-
}));
|
|
123
|
-
case 42:
|
|
84
|
+
case 26:
|
|
124
85
|
case "end":
|
|
125
86
|
return _context.stop();
|
|
126
87
|
}
|
package/dist/esm/vc/index.js
CHANGED
|
@@ -7,7 +7,6 @@ var _process;
|
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
8
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9
9
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
10
|
import { isVCRevisionEnabled } from '../config';
|
|
12
11
|
import { VCObserverNOOP } from './no-op-vc-observer';
|
|
13
12
|
import { VCObserver } from './vc-observer';
|
|
@@ -17,22 +16,13 @@ export var VCObserverWrapper = /*#__PURE__*/function () {
|
|
|
17
16
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
18
17
|
_classCallCheck(this, VCObserverWrapper);
|
|
19
18
|
this.newVCObserver = null;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (isVCRevisionEnabled('fy25.01') || isVCRevisionEnabled('fy25.02')) {
|
|
28
|
-
this.oldVCObserver = new VCObserver(opts);
|
|
29
|
-
}
|
|
30
|
-
} else {
|
|
31
|
-
if (isVCRevisionEnabled('fy25.03')) {
|
|
32
|
-
this.newVCObserver = new VCObserverNew({
|
|
33
|
-
selectorConfig: opts.selectorConfig
|
|
34
|
-
});
|
|
35
|
-
}
|
|
19
|
+
this.oldVCObserver = null;
|
|
20
|
+
if (isVCRevisionEnabled('fy25.03')) {
|
|
21
|
+
this.newVCObserver = new VCObserverNew({
|
|
22
|
+
selectorConfig: opts.selectorConfig
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
if (isVCRevisionEnabled('fy25.01') || isVCRevisionEnabled('fy25.02')) {
|
|
36
26
|
this.oldVCObserver = new VCObserver(opts);
|
|
37
27
|
}
|
|
38
28
|
}
|
|
@@ -41,25 +31,15 @@ export var VCObserverWrapper = /*#__PURE__*/function () {
|
|
|
41
31
|
value: function start(_ref) {
|
|
42
32
|
var startTime = _ref.startTime,
|
|
43
33
|
experienceKey = _ref.experienceKey;
|
|
44
|
-
if (
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
(_this$oldVCObserver = this.oldVCObserver) === null || _this$oldVCObserver === void 0 || _this$oldVCObserver.start({
|
|
48
|
-
startTime: startTime
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
if (isVCRevisionEnabled('fy25.03', experienceKey)) {
|
|
52
|
-
var _this$newVCObserver;
|
|
53
|
-
(_this$newVCObserver = this.newVCObserver) === null || _this$newVCObserver === void 0 || _this$newVCObserver.start({
|
|
54
|
-
startTime: startTime
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
} else {
|
|
58
|
-
var _this$oldVCObserver2, _this$newVCObserver2;
|
|
59
|
-
(_this$oldVCObserver2 = this.oldVCObserver) === null || _this$oldVCObserver2 === void 0 || _this$oldVCObserver2.start({
|
|
34
|
+
if (isVCRevisionEnabled('fy25.01', experienceKey) || isVCRevisionEnabled('fy25.02', experienceKey)) {
|
|
35
|
+
var _this$oldVCObserver;
|
|
36
|
+
(_this$oldVCObserver = this.oldVCObserver) === null || _this$oldVCObserver === void 0 || _this$oldVCObserver.start({
|
|
60
37
|
startTime: startTime
|
|
61
38
|
});
|
|
62
|
-
|
|
39
|
+
}
|
|
40
|
+
if (isVCRevisionEnabled('fy25.03', experienceKey)) {
|
|
41
|
+
var _this$newVCObserver;
|
|
42
|
+
(_this$newVCObserver = this.newVCObserver) === null || _this$newVCObserver === void 0 || _this$newVCObserver.start({
|
|
63
43
|
startTime: startTime
|
|
64
44
|
});
|
|
65
45
|
}
|
|
@@ -67,104 +47,72 @@ export var VCObserverWrapper = /*#__PURE__*/function () {
|
|
|
67
47
|
}, {
|
|
68
48
|
key: "stop",
|
|
69
49
|
value: function stop(experienceKey) {
|
|
70
|
-
if (
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
(_this$newVCObserver3 = this.newVCObserver) === null || _this$newVCObserver3 === void 0 || _this$newVCObserver3.stop();
|
|
78
|
-
}
|
|
79
|
-
} else {
|
|
80
|
-
var _this$oldVCObserver4, _this$newVCObserver4;
|
|
81
|
-
(_this$oldVCObserver4 = this.oldVCObserver) === null || _this$oldVCObserver4 === void 0 || _this$oldVCObserver4.stop();
|
|
82
|
-
(_this$newVCObserver4 = this.newVCObserver) === null || _this$newVCObserver4 === void 0 || _this$newVCObserver4.stop();
|
|
50
|
+
if (isVCRevisionEnabled('fy25.01', experienceKey) || isVCRevisionEnabled('fy25.02', experienceKey)) {
|
|
51
|
+
var _this$oldVCObserver2;
|
|
52
|
+
(_this$oldVCObserver2 = this.oldVCObserver) === null || _this$oldVCObserver2 === void 0 || _this$oldVCObserver2.stop();
|
|
53
|
+
}
|
|
54
|
+
if (isVCRevisionEnabled('fy25.03', experienceKey)) {
|
|
55
|
+
var _this$newVCObserver2;
|
|
56
|
+
(_this$newVCObserver2 = this.newVCObserver) === null || _this$newVCObserver2 === void 0 || _this$newVCObserver2.stop();
|
|
83
57
|
}
|
|
84
58
|
}
|
|
85
59
|
}, {
|
|
86
60
|
key: "getVCRawData",
|
|
87
61
|
value: function getVCRawData() {
|
|
88
|
-
var _this$oldVCObserver$g, _this$
|
|
89
|
-
return (_this$oldVCObserver$g = (_this$
|
|
62
|
+
var _this$oldVCObserver$g, _this$oldVCObserver3;
|
|
63
|
+
return (_this$oldVCObserver$g = (_this$oldVCObserver3 = this.oldVCObserver) === null || _this$oldVCObserver3 === void 0 ? void 0 : _this$oldVCObserver3.getVCRawData()) !== null && _this$oldVCObserver$g !== void 0 ? _this$oldVCObserver$g : null;
|
|
90
64
|
}
|
|
91
65
|
}, {
|
|
92
66
|
key: "getVCResult",
|
|
93
67
|
value: function () {
|
|
94
68
|
var _getVCResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(param) {
|
|
95
|
-
var _this$
|
|
69
|
+
var _this$oldVCObserver4, _this$newVCObserver3, _ref2;
|
|
70
|
+
var experienceKey, v1v2Result, v3Result;
|
|
96
71
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
97
72
|
while (1) switch (_context.prev = _context.next) {
|
|
98
73
|
case 0:
|
|
99
|
-
if (!fg('platform_ufo_vc_enable_revisions_by_experience')) {
|
|
100
|
-
_context.next = 23;
|
|
101
|
-
break;
|
|
102
|
-
}
|
|
103
74
|
experienceKey = param.experienceKey;
|
|
104
75
|
if (!(isVCRevisionEnabled('fy25.01', experienceKey) || isVCRevisionEnabled('fy25.02', experienceKey))) {
|
|
105
|
-
_context.next =
|
|
76
|
+
_context.next = 7;
|
|
106
77
|
break;
|
|
107
78
|
}
|
|
108
|
-
_context.next =
|
|
109
|
-
return (_this$
|
|
110
|
-
case
|
|
79
|
+
_context.next = 4;
|
|
80
|
+
return (_this$oldVCObserver4 = this.oldVCObserver) === null || _this$oldVCObserver4 === void 0 ? void 0 : _this$oldVCObserver4.getVCResult(param);
|
|
81
|
+
case 4:
|
|
111
82
|
_context.t0 = _context.sent;
|
|
112
|
-
_context.next =
|
|
83
|
+
_context.next = 8;
|
|
113
84
|
break;
|
|
114
|
-
case
|
|
85
|
+
case 7:
|
|
115
86
|
_context.t0 = {};
|
|
116
|
-
case
|
|
87
|
+
case 8:
|
|
117
88
|
v1v2Result = _context.t0;
|
|
118
89
|
if (!isVCRevisionEnabled('fy25.03', experienceKey)) {
|
|
119
|
-
_context.next =
|
|
90
|
+
_context.next = 15;
|
|
120
91
|
break;
|
|
121
92
|
}
|
|
122
|
-
_context.next =
|
|
123
|
-
return (_this$
|
|
93
|
+
_context.next = 12;
|
|
94
|
+
return (_this$newVCObserver3 = this.newVCObserver) === null || _this$newVCObserver3 === void 0 ? void 0 : _this$newVCObserver3.getVCResult({
|
|
124
95
|
start: param.start,
|
|
125
|
-
stop: param.stop
|
|
126
|
-
interactionId: param.interactionId
|
|
96
|
+
stop: param.stop
|
|
127
97
|
});
|
|
128
|
-
case
|
|
98
|
+
case 12:
|
|
129
99
|
_context.t1 = _context.sent;
|
|
130
|
-
_context.next =
|
|
100
|
+
_context.next = 16;
|
|
131
101
|
break;
|
|
132
|
-
case
|
|
102
|
+
case 15:
|
|
133
103
|
_context.t1 = [];
|
|
134
|
-
case
|
|
104
|
+
case 16:
|
|
135
105
|
v3Result = _context.t1;
|
|
136
106
|
if (v3Result) {
|
|
137
|
-
_context.next =
|
|
107
|
+
_context.next = 19;
|
|
138
108
|
break;
|
|
139
109
|
}
|
|
140
110
|
return _context.abrupt("return", v1v2Result !== null && v1v2Result !== void 0 ? v1v2Result : {});
|
|
141
|
-
case
|
|
111
|
+
case 19:
|
|
142
112
|
return _context.abrupt("return", _objectSpread(_objectSpread({}, v1v2Result), {}, {
|
|
143
113
|
'ufo:vc:rev': [].concat(_toConsumableArray((_ref2 = v1v2Result === null || v1v2Result === void 0 ? void 0 : v1v2Result['ufo:vc:rev']) !== null && _ref2 !== void 0 ? _ref2 : []), _toConsumableArray(v3Result !== null && v3Result !== void 0 ? v3Result : []))
|
|
144
114
|
}));
|
|
145
|
-
case
|
|
146
|
-
_context.next = 25;
|
|
147
|
-
return (_this$oldVCObserver7 = this.oldVCObserver) === null || _this$oldVCObserver7 === void 0 ? void 0 : _this$oldVCObserver7.getVCResult(param);
|
|
148
|
-
case 25:
|
|
149
|
-
oldResult = _context.sent;
|
|
150
|
-
_context.next = 28;
|
|
151
|
-
return (_this$newVCObserver6 = this.newVCObserver) === null || _this$newVCObserver6 === void 0 ? void 0 : _this$newVCObserver6.getVCResult({
|
|
152
|
-
start: param.start,
|
|
153
|
-
stop: param.stop,
|
|
154
|
-
interactionId: param.interactionId
|
|
155
|
-
});
|
|
156
|
-
case 28:
|
|
157
|
-
newResult = _context.sent;
|
|
158
|
-
if (!(oldResult && !newResult)) {
|
|
159
|
-
_context.next = 31;
|
|
160
|
-
break;
|
|
161
|
-
}
|
|
162
|
-
return _context.abrupt("return", oldResult);
|
|
163
|
-
case 31:
|
|
164
|
-
return _context.abrupt("return", _objectSpread(_objectSpread({}, oldResult !== null && oldResult !== void 0 ? oldResult : {}), {}, {
|
|
165
|
-
'ufo:vc:rev': [].concat(_toConsumableArray((_ref3 = oldResult === null || oldResult === void 0 ? void 0 : oldResult['ufo:vc:rev']) !== null && _ref3 !== void 0 ? _ref3 : []), _toConsumableArray(newResult !== null && newResult !== void 0 ? newResult : []))
|
|
166
|
-
}));
|
|
167
|
-
case 32:
|
|
115
|
+
case 20:
|
|
168
116
|
case "end":
|
|
169
117
|
return _context.stop();
|
|
170
118
|
}
|
|
@@ -178,20 +126,20 @@ export var VCObserverWrapper = /*#__PURE__*/function () {
|
|
|
178
126
|
}, {
|
|
179
127
|
key: "setSSRElement",
|
|
180
128
|
value: function setSSRElement(element) {
|
|
181
|
-
var _this$
|
|
182
|
-
(_this$
|
|
129
|
+
var _this$oldVCObserver5;
|
|
130
|
+
(_this$oldVCObserver5 = this.oldVCObserver) === null || _this$oldVCObserver5 === void 0 || _this$oldVCObserver5.setSSRElement(element);
|
|
183
131
|
}
|
|
184
132
|
}, {
|
|
185
133
|
key: "setReactRootRenderStart",
|
|
186
134
|
value: function setReactRootRenderStart(startTime) {
|
|
187
|
-
var _this$
|
|
188
|
-
(_this$
|
|
135
|
+
var _this$oldVCObserver6;
|
|
136
|
+
(_this$oldVCObserver6 = this.oldVCObserver) === null || _this$oldVCObserver6 === void 0 || _this$oldVCObserver6.setReactRootRenderStart(startTime || performance.now());
|
|
189
137
|
}
|
|
190
138
|
}, {
|
|
191
139
|
key: "setReactRootRenderStop",
|
|
192
140
|
value: function setReactRootRenderStop(stopTime) {
|
|
193
|
-
var _this$
|
|
194
|
-
(_this$
|
|
141
|
+
var _this$oldVCObserver7;
|
|
142
|
+
(_this$oldVCObserver7 = this.oldVCObserver) === null || _this$oldVCObserver7 === void 0 || _this$oldVCObserver7.setReactRootRenderStop(stopTime || performance.now());
|
|
195
143
|
}
|
|
196
144
|
}]);
|
|
197
145
|
}();
|