@atlaskit/react-ufo 2.4.5 → 2.4.7
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 +25 -0
- package/create-experimental-interaction-metrics-payload/package.json +15 -0
- package/dist/cjs/config/index.js +40 -18
- package/dist/cjs/create-experimental-interaction-metrics-payload/index.js +89 -0
- package/dist/cjs/create-payload/common/utils/index.js +85 -1
- package/dist/cjs/create-payload/index.js +49 -85
- package/dist/cjs/create-post-interaction-log-payload/index.js +1 -4
- package/dist/cjs/interaction-metrics/common/constants.js +7 -1
- package/dist/cjs/interaction-metrics/common/index.js +151 -0
- package/dist/cjs/interaction-metrics/index.js +139 -204
- package/dist/cjs/interaction-metrics/post-interaction-log.js +6 -2
- package/dist/cjs/interaction-metrics-init/index.js +27 -9
- package/dist/cjs/load-hold/UFOLoadHold.js +3 -4
- package/dist/cjs/segment/segment.js +7 -9
- package/dist/cjs/trace-pageload/index.js +2 -1
- package/dist/cjs/vc/vc-observer/observers/index.js +1 -40
- package/dist/es2019/config/index.js +22 -0
- package/dist/es2019/create-experimental-interaction-metrics-payload/index.js +67 -0
- package/dist/es2019/create-payload/common/utils/index.js +86 -1
- package/dist/es2019/create-payload/index.js +40 -81
- package/dist/es2019/create-post-interaction-log-payload/index.js +1 -4
- package/dist/es2019/interaction-metrics/common/constants.js +6 -0
- package/dist/es2019/interaction-metrics/common/index.js +103 -0
- package/dist/es2019/interaction-metrics/index.js +92 -129
- package/dist/es2019/interaction-metrics/post-interaction-log.js +6 -2
- package/dist/es2019/interaction-metrics-init/index.js +21 -8
- package/dist/es2019/load-hold/UFOLoadHold.js +3 -4
- package/dist/es2019/segment/segment.js +6 -12
- package/dist/es2019/trace-pageload/index.js +1 -1
- package/dist/es2019/vc/vc-observer/observers/index.js +1 -20
- package/dist/esm/config/index.js +39 -18
- package/dist/esm/create-experimental-interaction-metrics-payload/index.js +81 -0
- package/dist/esm/create-payload/common/utils/index.js +80 -1
- package/dist/esm/create-payload/index.js +45 -83
- package/dist/esm/create-post-interaction-log-payload/index.js +1 -4
- package/dist/esm/interaction-metrics/common/constants.js +6 -0
- package/dist/esm/interaction-metrics/common/index.js +132 -0
- package/dist/esm/interaction-metrics/index.js +87 -156
- package/dist/esm/interaction-metrics/post-interaction-log.js +6 -2
- package/dist/esm/interaction-metrics-init/index.js +24 -10
- package/dist/esm/load-hold/UFOLoadHold.js +3 -4
- package/dist/esm/segment/segment.js +7 -9
- package/dist/esm/trace-pageload/index.js +1 -1
- package/dist/esm/vc/vc-observer/observers/index.js +1 -40
- package/dist/types/common/common/types.d.ts +9 -5
- package/dist/types/config/index.d.ts +6 -0
- package/dist/types/create-experimental-interaction-metrics-payload/index.d.ts +31 -0
- package/dist/types/create-payload/common/utils/index.d.ts +12 -0
- package/dist/types/create-payload/index.d.ts +13 -5716
- package/dist/types/create-post-interaction-log-payload/index.d.ts +2 -0
- package/dist/types/interaction-metrics/common/constants.d.ts +31 -1
- package/dist/types/interaction-metrics/common/index.d.ts +16 -0
- package/dist/types/interaction-metrics/index.d.ts +4 -15
- package/dist/types/interaction-metrics/post-interaction-log.d.ts +1 -1
- package/dist/types/load-hold/UFOLoadHold.d.ts +1 -2
- package/dist/types/trace-pageload/index.d.ts +1 -0
- package/dist/types/vc/vc-observer/observers/index.d.ts +0 -1
- package/dist/types-ts4.5/common/common/types.d.ts +9 -5
- package/dist/types-ts4.5/config/index.d.ts +6 -0
- package/dist/types-ts4.5/create-experimental-interaction-metrics-payload/index.d.ts +31 -0
- package/dist/types-ts4.5/create-payload/common/utils/index.d.ts +12 -0
- package/dist/types-ts4.5/create-payload/index.d.ts +13 -5716
- package/dist/types-ts4.5/create-post-interaction-log-payload/index.d.ts +2 -0
- package/dist/types-ts4.5/interaction-metrics/common/constants.d.ts +31 -1
- package/dist/types-ts4.5/interaction-metrics/common/index.d.ts +16 -0
- package/dist/types-ts4.5/interaction-metrics/index.d.ts +4 -15
- package/dist/types-ts4.5/interaction-metrics/post-interaction-log.d.ts +1 -1
- package/dist/types-ts4.5/load-hold/UFOLoadHold.d.ts +1 -2
- package/dist/types-ts4.5/trace-pageload/index.d.ts +1 -0
- package/dist/types-ts4.5/vc/vc-observer/observers/index.d.ts +0 -1
- package/package.json +2 -1
|
@@ -79,15 +79,14 @@ export default function UFOSegment(_ref) {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
function _internalHold(labelStack, name
|
|
83
|
-
|
|
84
|
-
) {
|
|
82
|
+
function _internalHold(labelStack, name) {
|
|
83
|
+
var experimental = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
85
84
|
if (interactionId.current != null) {
|
|
86
85
|
if (parentContext) {
|
|
87
|
-
return parentContext._internalHold(labelStack, name);
|
|
86
|
+
return parentContext._internalHold(labelStack, name, experimental);
|
|
88
87
|
} else {
|
|
89
88
|
var capturedInteractionId = interactionId.current;
|
|
90
|
-
var disposeHold = addHold(interactionId.current, labelStack, name);
|
|
89
|
+
var disposeHold = addHold(interactionId.current, labelStack, name, experimental);
|
|
91
90
|
return function () {
|
|
92
91
|
if (capturedInteractionId === interactionId.current) {
|
|
93
92
|
disposeHold();
|
|
@@ -96,9 +95,7 @@ export default function UFOSegment(_ref) {
|
|
|
96
95
|
}
|
|
97
96
|
}
|
|
98
97
|
}
|
|
99
|
-
function _internalHoldByID(labelStack, id, name, remove
|
|
100
|
-
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
101
|
-
) {
|
|
98
|
+
function _internalHoldByID(labelStack, id, name, remove) {
|
|
102
99
|
if (interactionId.current != null) {
|
|
103
100
|
if (parentContext) {
|
|
104
101
|
parentContext._internalHoldByID(labelStack, name, id, remove);
|
|
@@ -121,7 +118,8 @@ export default function UFOSegment(_ref) {
|
|
|
121
118
|
labelStack: labelStack,
|
|
122
119
|
hold: function hold() {
|
|
123
120
|
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'unknown';
|
|
124
|
-
|
|
121
|
+
var experimental = arguments.length > 1 ? arguments[1] : undefined;
|
|
122
|
+
return this._internalHold(this.labelStack, name, experimental);
|
|
125
123
|
},
|
|
126
124
|
addHoldByID: function addHoldByID(labelStack, id) {
|
|
127
125
|
var name = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'unknown';
|
|
@@ -5,7 +5,7 @@ import { getActiveTrace } from '../experience-trace-id-context';
|
|
|
5
5
|
import { DefaultInteractionID } from '../interaction-id-context';
|
|
6
6
|
import { abort, addHoldByID, addNewInteraction, getActiveInteraction, removeHoldByID, updatePageLoadInteractionName } from '../interaction-metrics';
|
|
7
7
|
import UFORouteName from '../route-name-context';
|
|
8
|
-
var AWAITING_PAGELOAD_NAME = 'awaiting_pageload_name';
|
|
8
|
+
export var AWAITING_PAGELOAD_NAME = 'awaiting_pageload_name';
|
|
9
9
|
export default function traceUFOPageLoad(ufoName) {
|
|
10
10
|
var routeName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ufoName;
|
|
11
11
|
var activeInteraction = getActiveInteraction();
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
|
-
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; } } }; }
|
|
6
|
-
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; } }
|
|
7
|
-
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; }
|
|
8
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; }
|
|
9
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; }
|
|
10
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -195,8 +191,7 @@ export var Observers = /*#__PURE__*/function () {
|
|
|
195
191
|
});
|
|
196
192
|
} else if (mutation.type === 'attributes') {
|
|
197
193
|
if (mutation.target instanceof HTMLElement) {
|
|
198
|
-
|
|
199
|
-
if (fg('platform-ufo-vc-observe-attributes') || isDisplayStyleAttributeMutation) {
|
|
194
|
+
if (fg('platform-ufo-vc-observe-attributes')) {
|
|
200
195
|
_this2.observeElement(mutation.target, mutation, 'attr', ignoreReason);
|
|
201
196
|
}
|
|
202
197
|
}
|
|
@@ -205,40 +200,6 @@ export var Observers = /*#__PURE__*/function () {
|
|
|
205
200
|
_this2.measureStop();
|
|
206
201
|
}) : null;
|
|
207
202
|
}
|
|
208
|
-
}, {
|
|
209
|
-
key: "getStyleDisplay",
|
|
210
|
-
value: function getStyleDisplay(styleAttributeValue) {
|
|
211
|
-
if (!styleAttributeValue) {
|
|
212
|
-
return undefined;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// Split the style string into individual declarations
|
|
216
|
-
var declarations = styleAttributeValue.split(';');
|
|
217
|
-
// Iterate over each declaration
|
|
218
|
-
var _iterator = _createForOfIteratorHelper(declarations),
|
|
219
|
-
_step;
|
|
220
|
-
try {
|
|
221
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
222
|
-
var declaration = _step.value;
|
|
223
|
-
// Trim whitespace and split into property and value
|
|
224
|
-
var _declaration$split$ma = declaration.split(':').map(function (part) {
|
|
225
|
-
return part.trim();
|
|
226
|
-
}),
|
|
227
|
-
_declaration$split$ma2 = _slicedToArray(_declaration$split$ma, 2),
|
|
228
|
-
property = _declaration$split$ma2[0],
|
|
229
|
-
value = _declaration$split$ma2[1];
|
|
230
|
-
// Check if the property is 'display'
|
|
231
|
-
if (property && property.toLowerCase() === 'display') {
|
|
232
|
-
return value;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
} catch (err) {
|
|
236
|
-
_iterator.e(err);
|
|
237
|
-
} finally {
|
|
238
|
-
_iterator.f();
|
|
239
|
-
}
|
|
240
|
-
return undefined;
|
|
241
|
-
}
|
|
242
203
|
}, {
|
|
243
204
|
key: "getElementName",
|
|
244
205
|
value: function getElementName(element) {
|
|
@@ -63,7 +63,7 @@ export interface SegmentInfo {
|
|
|
63
63
|
labelStack: LabelStack;
|
|
64
64
|
}
|
|
65
65
|
export interface CustomData {
|
|
66
|
-
[key: string]: null |
|
|
66
|
+
[key: string]: null | string | number | boolean | undefined | CustomData | Record<string, CustomData>;
|
|
67
67
|
}
|
|
68
68
|
export type CustomTiming = Record<string, {
|
|
69
69
|
startTime: number;
|
|
@@ -104,7 +104,9 @@ export interface InteractionMetrics {
|
|
|
104
104
|
labelStack: LabelStack;
|
|
105
105
|
})[];
|
|
106
106
|
holdInfo: HoldInfo[];
|
|
107
|
+
holdExpInfo: HoldInfo[];
|
|
107
108
|
holdActive: Map<string, HoldActive>;
|
|
109
|
+
holdExpActive: Map<string, HoldActive>;
|
|
108
110
|
reactProfilerTimings: ReactProfilerTiming[];
|
|
109
111
|
measureStart: number;
|
|
110
112
|
rate: number;
|
|
@@ -115,11 +117,11 @@ export interface InteractionMetrics {
|
|
|
115
117
|
abortReason?: AbortReasonType;
|
|
116
118
|
abortedByInteractionName?: string;
|
|
117
119
|
/**
|
|
118
|
-
* Apdex is legacy performance measurement where it is
|
|
120
|
+
* Apdex is a legacy performance measurement where it is
|
|
119
121
|
* capturing TTI at arbitrary point in the code (bm3/UFOv1)
|
|
120
122
|
*
|
|
121
123
|
* We are intercepting its values now just so we can use it for
|
|
122
|
-
* topline metric, but should encourage teams adopt TTAI
|
|
124
|
+
* topline metric, but should encourage teams to adopt TTAI
|
|
123
125
|
*
|
|
124
126
|
* This field might be ignored/dropped in the future.
|
|
125
127
|
*/
|
|
@@ -150,6 +152,8 @@ export interface InteractionMetrics {
|
|
|
150
152
|
trace: TraceIdContext | null;
|
|
151
153
|
legacyMetrics?: BM3Event[];
|
|
152
154
|
vc?: VCRawDataType | null;
|
|
155
|
+
experimentalTTAI?: number;
|
|
156
|
+
experimentalVC90?: number;
|
|
153
157
|
}
|
|
154
158
|
export type LoadProfilerEventInfo = {
|
|
155
159
|
identifier: string;
|
|
@@ -162,7 +166,7 @@ export interface LazyLoadProfilerContext {
|
|
|
162
166
|
addLoad(identifier: string, start: number, end: number): void;
|
|
163
167
|
}
|
|
164
168
|
export interface EnhancedUFOInteractionContextType extends UFOInteractionContextType, RelayMetricsRecorder, LazyLoadProfilerContext {
|
|
165
|
-
_internalHold(labelStack: LabelStack, name: string): void | (() => void);
|
|
169
|
+
_internalHold(labelStack: LabelStack, name: string, experimental: boolean): void | (() => void);
|
|
166
170
|
_internalHoldByID(labelStack: LabelStack, id: string, name: string, remove: boolean): void | (() => void);
|
|
167
171
|
addHoldByID(labelStack: LabelStack, id: string, name?: string): void;
|
|
168
172
|
removeHoldByID(labelStack: LabelStack, id: string, name?: string): void;
|
|
@@ -191,7 +195,7 @@ export type BM3Event = {
|
|
|
191
195
|
pageVisibleState?: string;
|
|
192
196
|
type: string;
|
|
193
197
|
};
|
|
194
|
-
export type LastInteractionFinishInfo = Pick<InteractionMetrics, 'ufoName' | 'start' | 'end' | 'id' | 'abortReason' | 'abortedByInteractionName' | 'routeName' | 'type'>;
|
|
198
|
+
export type LastInteractionFinishInfo = Pick<InteractionMetrics, 'ufoName' | 'start' | 'end' | 'id' | 'abortReason' | 'abortedByInteractionName' | 'routeName' | 'type' | 'experimentalVC90' | 'experimentalTTAI'>;
|
|
195
199
|
export type PostInteractionLogOutput = {
|
|
196
200
|
lastInteractionFinish: LastInteractionFinishInfo;
|
|
197
201
|
reactProfilerTimings?: ReactProfilerTiming[];
|
|
@@ -72,6 +72,11 @@ export type Config = {
|
|
|
72
72
|
readonly rates?: Rates;
|
|
73
73
|
readonly kind?: Record<InteractionType, number>;
|
|
74
74
|
};
|
|
75
|
+
readonly experimentalInteractionMetrics?: {
|
|
76
|
+
readonly enabled?: boolean;
|
|
77
|
+
readonly rates?: Rates;
|
|
78
|
+
readonly kind?: Record<InteractionType, number>;
|
|
79
|
+
};
|
|
75
80
|
readonly enableSegmentHighlighting?: boolean;
|
|
76
81
|
readonly enableAdditionalPerformanceMarks?: boolean;
|
|
77
82
|
readonly shouldCalculateLighthouseMetricsFromTTAI?: boolean;
|
|
@@ -85,6 +90,7 @@ export type Config = {
|
|
|
85
90
|
export declare function setUFOConfig(newConfig: Config): void;
|
|
86
91
|
export declare function getConfig(): Config | undefined;
|
|
87
92
|
export declare function getInteractionRate(name: string, interactionKind: InteractionKind): number;
|
|
93
|
+
export declare function getExperimentalInteractionRate(name: string, interactionType: InteractionType): number;
|
|
88
94
|
export declare function getPostInteractionRate(name: string, interactionType: InteractionType): number;
|
|
89
95
|
export declare function getCapabilityRate(capability: Capability): number;
|
|
90
96
|
declare const validTypingMethods: readonly ["timeout", "timeoutNoAlloc", "mutationObserver"];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { InteractionMetrics } from '../common';
|
|
2
|
+
import { VCObserver, type VCObserverOptions } from '../vc/vc-observer';
|
|
3
|
+
export declare class ExperimentalInteractionMetrics {
|
|
4
|
+
/**
|
|
5
|
+
* Handler function to process / send the observation data
|
|
6
|
+
*/
|
|
7
|
+
sinkHandlerFn: (interactionId: string, interactionMetrics: InteractionMetrics) => void | Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Set the fn that would be invoked to process / send the observation data
|
|
10
|
+
*/
|
|
11
|
+
sinkHandler(sinkHandlerFn: (interactionId: string, interaction: InteractionMetrics) => void | Promise<void>): void;
|
|
12
|
+
onInteractionComplete(interactionId: string, data: InteractionMetrics, endTime?: number): void;
|
|
13
|
+
/**
|
|
14
|
+
* independent VC observer that observes until `custom.post-interaction-logs` event is sent
|
|
15
|
+
*/
|
|
16
|
+
vcObserver: VCObserver | null;
|
|
17
|
+
initializeVCObserver(options: VCObserverOptions): this;
|
|
18
|
+
startVCObserver({ startTime }: {
|
|
19
|
+
startTime: number;
|
|
20
|
+
}): void;
|
|
21
|
+
}
|
|
22
|
+
export declare function createExperimentalInteractionMetricsPayload(interactionId: string, interaction: InteractionMetrics): {
|
|
23
|
+
actionSubject: string;
|
|
24
|
+
action: string;
|
|
25
|
+
eventType: string;
|
|
26
|
+
source: string;
|
|
27
|
+
tags: string[];
|
|
28
|
+
attributes: {
|
|
29
|
+
properties: any;
|
|
30
|
+
};
|
|
31
|
+
} | null;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { InteractionMetrics } from '../../../common';
|
|
2
|
+
import { type Config } from '../../../config';
|
|
1
3
|
import type { LabelStack, SegmentLabel } from '../../../interaction-context';
|
|
2
4
|
export type SegmentItem = {
|
|
3
5
|
n: string;
|
|
@@ -15,3 +17,13 @@ export declare function optimizeLabelStack(labelStack: LabelStack): string | {
|
|
|
15
17
|
s?: string | undefined;
|
|
16
18
|
n: string;
|
|
17
19
|
}[];
|
|
20
|
+
export declare const getInteractionStatus: (interaction: InteractionMetrics) => {
|
|
21
|
+
readonly originalInteractionStatus: "ABORTED" | "SUCCEEDED";
|
|
22
|
+
readonly overrideStatus: "ABORTED" | "SUCCEEDED";
|
|
23
|
+
};
|
|
24
|
+
export declare const getPageVisibilityUpToTTAI: (interaction: InteractionMetrics) => import("../../../hidden-timing").PageVisibility;
|
|
25
|
+
export declare const calculateVCMetrics: (interaction: InteractionMetrics, prefix: string, getVCResultFn: (props: any) => any) => any;
|
|
26
|
+
export declare function getSSRDoneTimeValue(config: Config | undefined): number | undefined;
|
|
27
|
+
export declare const getVCMetrics: (interaction: InteractionMetrics) => any;
|
|
28
|
+
export declare const getExperimentalVCMetrics: (interaction: InteractionMetrics) => any;
|
|
29
|
+
export declare const getTTAI: (interaction: InteractionMetrics) => number | undefined;
|