@atlaskit/react-ufo 3.3.1 → 3.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/cjs/create-payload/index.js +63 -148
- package/dist/cjs/create-payload/utils/get-interaction-status.js +37 -0
- package/dist/cjs/create-payload/utils/get-page-visibility-up-to-ttai.js +12 -0
- package/dist/cjs/create-payload/utils/get-ssr-done-time-value.js +14 -0
- package/dist/cjs/create-payload/utils/get-vc-metrics.js +96 -0
- package/dist/es2019/create-payload/index.js +11 -71
- package/dist/es2019/create-payload/utils/get-interaction-status.js +31 -0
- package/dist/es2019/create-payload/utils/get-page-visibility-up-to-ttai.js +8 -0
- package/dist/es2019/create-payload/utils/get-ssr-done-time-value.js +5 -0
- package/dist/es2019/create-payload/utils/get-vc-metrics.js +53 -0
- package/dist/esm/create-payload/index.js +56 -141
- package/dist/esm/create-payload/utils/get-interaction-status.js +31 -0
- package/dist/esm/create-payload/utils/get-page-visibility-up-to-ttai.js +6 -0
- package/dist/esm/create-payload/utils/get-ssr-done-time-value.js +5 -0
- package/dist/esm/create-payload/utils/get-vc-metrics.js +89 -0
- package/dist/types/create-payload/utils/get-interaction-status.d.ts +27 -0
- package/dist/types/create-payload/utils/get-page-visibility-up-to-ttai.d.ts +2 -0
- package/dist/types/create-payload/utils/get-ssr-done-time-value.d.ts +2 -0
- package/dist/types/create-payload/utils/get-vc-metrics.d.ts +5 -0
- package/dist/types-ts4.5/create-payload/utils/get-interaction-status.d.ts +27 -0
- package/dist/types-ts4.5/create-payload/utils/get-page-visibility-up-to-ttai.d.ts +2 -0
- package/dist/types-ts4.5/create-payload/utils/get-ssr-done-time-value.d.ts +2 -0
- package/dist/types-ts4.5/create-payload/utils/get-vc-metrics.d.ts +5 -0
- package/package.json +4 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determines the interaction status based on abort reason and BM3 TTI presence.
|
|
3
|
+
*
|
|
4
|
+
* @param {InteractionMetrics} interaction - The interaction metrics object containing abort reason and apdex data
|
|
5
|
+
* @returns {{
|
|
6
|
+
* originalInteractionStatus: 'ABORTED' | 'SUCCEEDED',
|
|
7
|
+
* overrideStatus: 'ABORTED' | 'SUCCEEDED'
|
|
8
|
+
* }} An object containing both the original and override status
|
|
9
|
+
*
|
|
10
|
+
* @description
|
|
11
|
+
* This function evaluates the interaction status in two ways:
|
|
12
|
+
* 1. originalInteractionStatus: Based on whether there's an abort reason
|
|
13
|
+
* 2. overrideStatus: Based on the presence of BM3 TTI (apdex data)
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const interaction = {
|
|
17
|
+
* abortReason: null,
|
|
18
|
+
* apdex: [1, 2, 3]
|
|
19
|
+
* };
|
|
20
|
+
* const result = getInteractionStatus(interaction);
|
|
21
|
+
* // Returns: { originalInteractionStatus: 'SUCCEEDED', overrideStatus: 'SUCCEEDED' }
|
|
22
|
+
*/
|
|
23
|
+
export default function getInteractionStatus(interaction) {
|
|
24
|
+
var originalInteractionStatus = interaction.abortReason ? 'ABORTED' : 'SUCCEEDED';
|
|
25
|
+
var hasBm3TTI = interaction.apdex.length > 0;
|
|
26
|
+
var overrideStatus = hasBm3TTI ? 'SUCCEEDED' : originalInteractionStatus;
|
|
27
|
+
return {
|
|
28
|
+
originalInteractionStatus: originalInteractionStatus,
|
|
29
|
+
overrideStatus: overrideStatus
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as ssr from '../../ssr';
|
|
2
|
+
export default function getSSRDoneTimeValue(config) {
|
|
3
|
+
var _config$ssr, _config$ssr2;
|
|
4
|
+
return config !== null && config !== void 0 && (_config$ssr = config.ssr) !== null && _config$ssr !== void 0 && _config$ssr.getSSRDoneTime ? config === null || config === void 0 || (_config$ssr2 = config.ssr) === null || _config$ssr2 === void 0 ? void 0 : _config$ssr2.getSSRDoneTime() : ssr.getSSRDoneTime();
|
|
5
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
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';
|
|
7
|
+
import { getConfig } from '../../config';
|
|
8
|
+
import { postInteractionLog } from '../../interaction-metrics';
|
|
9
|
+
import { getVCObserver } from '../../vc';
|
|
10
|
+
import getInteractionStatus from './get-interaction-status';
|
|
11
|
+
import getPageVisibilityUpToTTAI from './get-page-visibility-up-to-ttai';
|
|
12
|
+
import getSSRDoneTimeValue from './get-ssr-done-time-value';
|
|
13
|
+
export default function getVCMetrics(_x) {
|
|
14
|
+
return _getVCMetrics.apply(this, arguments);
|
|
15
|
+
}
|
|
16
|
+
function _getVCMetrics() {
|
|
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, isSSREnabled, ssr, tti, prefix, result, VC;
|
|
20
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
21
|
+
while (1) switch (_context.prev = _context.next) {
|
|
22
|
+
case 0:
|
|
23
|
+
config = getConfig();
|
|
24
|
+
if (config !== null && config !== void 0 && (_config$vc = config.vc) !== null && _config$vc !== void 0 && _config$vc.enabled) {
|
|
25
|
+
_context.next = 3;
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
return _context.abrupt("return", {});
|
|
29
|
+
case 3:
|
|
30
|
+
if (!(interaction.type !== 'page_load' && interaction.type !== 'transition')) {
|
|
31
|
+
_context.next = 5;
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
return _context.abrupt("return", {});
|
|
35
|
+
case 5:
|
|
36
|
+
interactionStatus = getInteractionStatus(interaction);
|
|
37
|
+
pageVisibilityUpToTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
38
|
+
if (!((interactionStatus.originalInteractionStatus !== 'SUCCEEDED' || pageVisibilityUpToTTAI !== 'visible') && fg('platform_ufo_no_vc_on_aborted'))) {
|
|
39
|
+
_context.next = 9;
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
return _context.abrupt("return", {});
|
|
43
|
+
case 9:
|
|
44
|
+
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));
|
|
45
|
+
ssr = interaction.type === 'page_load' && isSSREnabled ? {
|
|
46
|
+
ssr: getSSRDoneTimeValue(config)
|
|
47
|
+
} : null;
|
|
48
|
+
postInteractionLog.setVCObserverSSRConfig(ssr);
|
|
49
|
+
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;
|
|
50
|
+
prefix = 'ufo';
|
|
51
|
+
_context.next = 16;
|
|
52
|
+
return getVCObserver().getVCResult(_objectSpread({
|
|
53
|
+
start: interaction.start,
|
|
54
|
+
stop: interaction.end,
|
|
55
|
+
tti: tti,
|
|
56
|
+
prefix: prefix,
|
|
57
|
+
vc: interaction.vc,
|
|
58
|
+
isEventAborted: interactionStatus.originalInteractionStatus !== 'SUCCEEDED'
|
|
59
|
+
}, ssr));
|
|
60
|
+
case 16:
|
|
61
|
+
result = _context.sent;
|
|
62
|
+
if ((_config$experimentalI = config.experimentalInteractionMetrics) !== null && _config$experimentalI !== void 0 && _config$experimentalI.enabled) {
|
|
63
|
+
getVCObserver().stop();
|
|
64
|
+
}
|
|
65
|
+
postInteractionLog.setLastInteractionFinishVCResult(result);
|
|
66
|
+
VC = result === null || result === void 0 ? void 0 : result['metrics:vc'];
|
|
67
|
+
if (!(!VC || !(result !== null && result !== void 0 && result["".concat(prefix, ":vc:clean")]))) {
|
|
68
|
+
_context.next = 22;
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
return _context.abrupt("return", result);
|
|
72
|
+
case 22:
|
|
73
|
+
if (!(interactionStatus.originalInteractionStatus !== 'SUCCEEDED' || pageVisibilityUpToTTAI !== 'visible')) {
|
|
74
|
+
_context.next = 24;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
return _context.abrupt("return", result);
|
|
78
|
+
case 24:
|
|
79
|
+
return _context.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
|
|
80
|
+
'metric:vc90': VC['90']
|
|
81
|
+
}));
|
|
82
|
+
case 25:
|
|
83
|
+
case "end":
|
|
84
|
+
return _context.stop();
|
|
85
|
+
}
|
|
86
|
+
}, _callee);
|
|
87
|
+
}));
|
|
88
|
+
return _getVCMetrics.apply(this, arguments);
|
|
89
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { InteractionMetrics } from '../../common';
|
|
2
|
+
/**
|
|
3
|
+
* Determines the interaction status based on abort reason and BM3 TTI presence.
|
|
4
|
+
*
|
|
5
|
+
* @param {InteractionMetrics} interaction - The interaction metrics object containing abort reason and apdex data
|
|
6
|
+
* @returns {{
|
|
7
|
+
* originalInteractionStatus: 'ABORTED' | 'SUCCEEDED',
|
|
8
|
+
* overrideStatus: 'ABORTED' | 'SUCCEEDED'
|
|
9
|
+
* }} An object containing both the original and override status
|
|
10
|
+
*
|
|
11
|
+
* @description
|
|
12
|
+
* This function evaluates the interaction status in two ways:
|
|
13
|
+
* 1. originalInteractionStatus: Based on whether there's an abort reason
|
|
14
|
+
* 2. overrideStatus: Based on the presence of BM3 TTI (apdex data)
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const interaction = {
|
|
18
|
+
* abortReason: null,
|
|
19
|
+
* apdex: [1, 2, 3]
|
|
20
|
+
* };
|
|
21
|
+
* const result = getInteractionStatus(interaction);
|
|
22
|
+
* // Returns: { originalInteractionStatus: 'SUCCEEDED', overrideStatus: 'SUCCEEDED' }
|
|
23
|
+
*/
|
|
24
|
+
export default function getInteractionStatus(interaction: InteractionMetrics): {
|
|
25
|
+
readonly originalInteractionStatus: "ABORTED" | "SUCCEEDED";
|
|
26
|
+
readonly overrideStatus: "ABORTED" | "SUCCEEDED";
|
|
27
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { InteractionMetrics } from '../../common';
|
|
2
|
+
/**
|
|
3
|
+
* Determines the interaction status based on abort reason and BM3 TTI presence.
|
|
4
|
+
*
|
|
5
|
+
* @param {InteractionMetrics} interaction - The interaction metrics object containing abort reason and apdex data
|
|
6
|
+
* @returns {{
|
|
7
|
+
* originalInteractionStatus: 'ABORTED' | 'SUCCEEDED',
|
|
8
|
+
* overrideStatus: 'ABORTED' | 'SUCCEEDED'
|
|
9
|
+
* }} An object containing both the original and override status
|
|
10
|
+
*
|
|
11
|
+
* @description
|
|
12
|
+
* This function evaluates the interaction status in two ways:
|
|
13
|
+
* 1. originalInteractionStatus: Based on whether there's an abort reason
|
|
14
|
+
* 2. overrideStatus: Based on the presence of BM3 TTI (apdex data)
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const interaction = {
|
|
18
|
+
* abortReason: null,
|
|
19
|
+
* apdex: [1, 2, 3]
|
|
20
|
+
* };
|
|
21
|
+
* const result = getInteractionStatus(interaction);
|
|
22
|
+
* // Returns: { originalInteractionStatus: 'SUCCEEDED', overrideStatus: 'SUCCEEDED' }
|
|
23
|
+
*/
|
|
24
|
+
export default function getInteractionStatus(interaction: InteractionMetrics): {
|
|
25
|
+
readonly originalInteractionStatus: "ABORTED" | "SUCCEEDED";
|
|
26
|
+
readonly overrideStatus: "ABORTED" | "SUCCEEDED";
|
|
27
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-ufo",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.2",
|
|
4
4
|
"description": "Parts of React UFO that are publicly available",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -174,6 +174,9 @@
|
|
|
174
174
|
},
|
|
175
175
|
"platform_ufo_multiheatmap_killswitch": {
|
|
176
176
|
"type": "boolean"
|
|
177
|
+
},
|
|
178
|
+
"platform_ufo_no_vc_on_aborted": {
|
|
179
|
+
"type": "boolean"
|
|
177
180
|
}
|
|
178
181
|
}
|
|
179
182
|
}
|