@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,4 +1,5 @@
|
|
|
1
1
|
import { InteractionMetrics } from '../../common/common/types';
|
|
2
|
+
import { RevisionPayload } from '../../common/vc/types';
|
|
2
3
|
import type { MultiRevisionHeatmap } from './heatmap/heatmap';
|
|
3
4
|
type CalculatedVC = {
|
|
4
5
|
VC: {
|
|
@@ -8,7 +9,7 @@ type CalculatedVC = {
|
|
|
8
9
|
[key: string]: string[] | null;
|
|
9
10
|
};
|
|
10
11
|
};
|
|
11
|
-
export declare function getVCRevisionsData({ fullPrefix, interaction, isVCClean, isEventAborted, multiHeatmap, ssr, calculatedVC, calculatedVCNext, }: {
|
|
12
|
+
export declare function getVCRevisionsData({ fullPrefix, interaction, isVCClean, isEventAborted, multiHeatmap, ssr, calculatedVC, calculatedVCNext, experienceKey, }: {
|
|
12
13
|
fullPrefix?: string;
|
|
13
14
|
interaction: Pick<InteractionMetrics, 'start' | 'end'>;
|
|
14
15
|
isVCClean: boolean;
|
|
@@ -16,9 +17,10 @@ export declare function getVCRevisionsData({ fullPrefix, interaction, isVCClean,
|
|
|
16
17
|
multiHeatmap: MultiRevisionHeatmap | null;
|
|
17
18
|
calculatedVC: CalculatedVC;
|
|
18
19
|
calculatedVCNext: CalculatedVC;
|
|
20
|
+
experienceKey: string;
|
|
19
21
|
ssr?: number;
|
|
20
22
|
}): {
|
|
21
|
-
[x: string]:
|
|
23
|
+
[x: string]: RevisionPayload;
|
|
22
24
|
} | {
|
|
23
25
|
[x: string]: {
|
|
24
26
|
revision: string;
|
|
@@ -26,7 +28,7 @@ export declare function getVCRevisionsData({ fullPrefix, interaction, isVCClean,
|
|
|
26
28
|
'metric:vc90': number | null;
|
|
27
29
|
vcDetails: {
|
|
28
30
|
[key: string]: {
|
|
29
|
-
t: number
|
|
31
|
+
t: number;
|
|
30
32
|
e: string[];
|
|
31
33
|
};
|
|
32
34
|
};
|
|
@@ -41,7 +41,7 @@ export declare class VCObserver implements VCObserverInterface {
|
|
|
41
41
|
targetName: string;
|
|
42
42
|
ignoreReason: VCIgnoreReason | undefined;
|
|
43
43
|
}[];
|
|
44
|
-
getVCResult: ({ start, stop, tti, prefix, ssr, vc, isEventAborted, }: GetVCResultType) => Promise<VCResult>;
|
|
44
|
+
getVCResult: ({ start, stop, tti, prefix, ssr, vc, isEventAborted, experienceKey, }: GetVCResultType) => Promise<VCResult>;
|
|
45
45
|
static calculateVC({ heatmap, ssr, componentsLog, viewport, }: {
|
|
46
46
|
heatmap: number[][];
|
|
47
47
|
ssr?: number;
|
|
@@ -202,7 +202,7 @@ export type BM3Event = {
|
|
|
202
202
|
pageVisibleState?: string;
|
|
203
203
|
type: string;
|
|
204
204
|
};
|
|
205
|
-
export type LastInteractionFinishInfo = Pick<InteractionMetrics, 'ufoName' | 'start' | 'end' | 'id' | 'abortReason' | 'abortedByInteractionName' | 'routeName' | 'type' | 'experimentalVC90' | 'experimentalTTAI'>;
|
|
205
|
+
export type LastInteractionFinishInfo = Pick<InteractionMetrics, 'ufoName' | 'start' | 'end' | 'id' | 'abortReason' | 'abortedByInteractionName' | 'routeName' | 'type' | 'experimentalVC90' | 'experimentalTTAI' | 'errors'>;
|
|
206
206
|
export type PostInteractionLogOutput = {
|
|
207
207
|
lastInteractionFinish: LastInteractionFinishInfo;
|
|
208
208
|
reactProfilerTimings?: ReactProfilerTiming[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createPayloads } from '../create-payload';
|
|
2
2
|
import { LabelStack } from '../interaction-context';
|
|
3
3
|
import { VCObserver } from '../vc/vc-observer';
|
|
4
|
-
import type { AbortReasonType, ApdexType, InteractionType, SegmentInfo } from './common/types';
|
|
4
|
+
import type { AbortReasonType, ApdexType, InteractionError, InteractionType, SegmentInfo } from './common/types';
|
|
5
5
|
import type { RevisionPayload } from './vc/types';
|
|
6
6
|
type ExtractPromise<T> = T extends Promise<infer U> ? U : never;
|
|
7
7
|
export type PageVisibility = 'hidden' | 'mixed' | 'visible';
|
|
@@ -137,6 +137,7 @@ export type ReactUFOPayload = {
|
|
|
137
137
|
segments: SegmentInfo[] | RootSegment;
|
|
138
138
|
reactProfilerTimings: ReactProfilerTiming[];
|
|
139
139
|
holdInfo: HoldInfo[];
|
|
140
|
+
errors: InteractionError[];
|
|
140
141
|
};
|
|
141
142
|
'ufo:vc:rev': RevisionPayload;
|
|
142
143
|
'ufo:vc:ratios': Record<string, number>;
|
|
@@ -145,6 +146,8 @@ export type ReactUFOPayload = {
|
|
|
145
146
|
h: number;
|
|
146
147
|
};
|
|
147
148
|
'ufo:vc:time': number;
|
|
149
|
+
'ufo:speedIndex'?: number;
|
|
150
|
+
'ufo:vc:ignored'?: string[];
|
|
148
151
|
'ufo:vc:abort:reason'?: string;
|
|
149
152
|
'ufo:vc:state'?: boolean;
|
|
150
153
|
'ufo:vc:clean'?: boolean;
|
|
@@ -163,9 +166,7 @@ export type ReactUFOPayload = {
|
|
|
163
166
|
elements: string[];
|
|
164
167
|
}>;
|
|
165
168
|
'ufo:vc:next:dom'?: Record<VCParts, string[]>;
|
|
166
|
-
'ufo:vc:ignored'?: string[];
|
|
167
169
|
'metric:vc90'?: number;
|
|
168
|
-
'ufo:speedIndex'?: number;
|
|
169
170
|
'ufo:next:speedIndex'?: number;
|
|
170
171
|
'ufo:vc:updates:next'?: Array<{
|
|
171
172
|
time: number;
|
|
@@ -175,4 +176,51 @@ export type ReactUFOPayload = {
|
|
|
175
176
|
};
|
|
176
177
|
};
|
|
177
178
|
};
|
|
179
|
+
type LateElement = {
|
|
180
|
+
time: number;
|
|
181
|
+
element: string;
|
|
182
|
+
viewportHeatmapPercentage: number;
|
|
183
|
+
};
|
|
184
|
+
export type PostInteractionLogPayload = {
|
|
185
|
+
actionSubject: 'experience';
|
|
186
|
+
action: 'measured';
|
|
187
|
+
eventType: 'operational';
|
|
188
|
+
source: 'measured';
|
|
189
|
+
tags: [
|
|
190
|
+
'observability'
|
|
191
|
+
];
|
|
192
|
+
attributes: {
|
|
193
|
+
properties: {
|
|
194
|
+
'event:hostname': string;
|
|
195
|
+
'event:product': string;
|
|
196
|
+
'event:schema': '1.0.0';
|
|
197
|
+
'event:source': {
|
|
198
|
+
name: 'react-ufo/web';
|
|
199
|
+
version: '1.0.1';
|
|
200
|
+
};
|
|
201
|
+
'event:region': string;
|
|
202
|
+
'experience:key': 'custom.post-interaction-logs';
|
|
203
|
+
postInteractionLog: {
|
|
204
|
+
lastInteractionFinish: {
|
|
205
|
+
ufoName: string;
|
|
206
|
+
start: number;
|
|
207
|
+
end: number;
|
|
208
|
+
id: string;
|
|
209
|
+
routeName: string;
|
|
210
|
+
type: InteractionType;
|
|
211
|
+
errors: InteractionError[];
|
|
212
|
+
ttai: number;
|
|
213
|
+
vc90: number;
|
|
214
|
+
vcClean: boolean;
|
|
215
|
+
};
|
|
216
|
+
revisedEndTime: number;
|
|
217
|
+
revisedTtai: number;
|
|
218
|
+
revisedVC90: number;
|
|
219
|
+
vcClean: boolean;
|
|
220
|
+
lateMutations: LateElement[];
|
|
221
|
+
reactProfilerTimings: ReactProfilerTiming[];
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
};
|
|
178
226
|
export {};
|
|
@@ -74,7 +74,17 @@ export type Config = {
|
|
|
74
74
|
readonly ssr?: boolean;
|
|
75
75
|
readonly ssrWhitelist?: string[];
|
|
76
76
|
readonly stopVCAtInteractionFinish?: boolean;
|
|
77
|
-
|
|
77
|
+
/**
|
|
78
|
+
* The revisions of TTVC that will be calculated
|
|
79
|
+
* - `all` is the TTVC revisions that are used on a product level
|
|
80
|
+
* - `byExperience` is the version that is used on an experience level.
|
|
81
|
+
* Note that an entry in the `byExperience` config should only be a SUBSET of the `all` config,
|
|
82
|
+
* i.e. every element for all `byExperience` entry configs should exist in the `all` config
|
|
83
|
+
*/
|
|
84
|
+
readonly enabledVCRevisions?: {
|
|
85
|
+
all: readonly TTVCRevisions[];
|
|
86
|
+
byExperience?: Record<string, readonly TTVCRevisions[]>;
|
|
87
|
+
};
|
|
78
88
|
};
|
|
79
89
|
readonly postInteractionLog?: {
|
|
80
90
|
readonly enabled?: boolean;
|
|
@@ -99,8 +109,9 @@ export type Config = {
|
|
|
99
109
|
};
|
|
100
110
|
export declare function setUFOConfig(newConfig: Config): void;
|
|
101
111
|
export declare function getConfig(): Config | undefined;
|
|
102
|
-
export declare function getEnabledVCRevisions(): TTVCRevisions[];
|
|
103
|
-
export declare function isVCRevisionEnabled(revision: TTVCRevisions): boolean;
|
|
112
|
+
export declare function getEnabledVCRevisions(experienceKey?: string): readonly TTVCRevisions[];
|
|
113
|
+
export declare function isVCRevisionEnabled(revision: TTVCRevisions, experienceKey?: string): boolean;
|
|
114
|
+
export declare function getMostRecentVCRevision(experienceKey?: string): TTVCRevisions;
|
|
104
115
|
export declare function getInteractionRate(name: string, interactionKind: InteractionKind): number;
|
|
105
116
|
export declare function getExperimentalInteractionRate(name: string, interactionType: InteractionType): number;
|
|
106
117
|
export declare function getPostInteractionRate(name: string, interactionType: InteractionType): number;
|
|
@@ -26,12 +26,13 @@ declare function createPostInteractionLogPayload({ lastInteractionFinish, reactP
|
|
|
26
26
|
vc90: number | null;
|
|
27
27
|
vcClean: boolean;
|
|
28
28
|
type: import("../common").InteractionType;
|
|
29
|
-
id: string;
|
|
30
29
|
abortReason?: import("../common").AbortReasonType | undefined;
|
|
30
|
+
id: string;
|
|
31
31
|
abortedByInteractionName?: string | undefined;
|
|
32
32
|
routeName: string | null;
|
|
33
|
-
experimentalTTAI?: number | undefined;
|
|
34
33
|
experimentalVC90?: number | undefined;
|
|
34
|
+
experimentalTTAI?: number | undefined;
|
|
35
|
+
errors: import("../common").InteractionError[];
|
|
35
36
|
};
|
|
36
37
|
revisedEndTime: number;
|
|
37
38
|
revisedTtai: number;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { type LastInteractionFinishInfo, type PostInteractionLogOutput, type ReactProfilerTiming } from '../common/common/types';
|
|
2
2
|
import type { VCResult } from '../common/vc/types';
|
|
3
3
|
import type { LabelStack } from '../interaction-context';
|
|
4
|
-
import type { VCObserverOptions } from '../vc/types';
|
|
5
|
-
import { VCObserver } from '../vc/vc-observer';
|
|
4
|
+
import type { VCObserverInterface, VCObserverOptions } from '../vc/types';
|
|
6
5
|
export default class PostInteractionLog {
|
|
7
6
|
/**
|
|
8
7
|
* Basic info about interaction that has just finished
|
|
@@ -19,7 +18,7 @@ export default class PostInteractionLog {
|
|
|
19
18
|
/**
|
|
20
19
|
* independent VC observer, that observes until `custom.post-interaction-logs` event is sent
|
|
21
20
|
*/
|
|
22
|
-
vcObserver:
|
|
21
|
+
vcObserver: VCObserverInterface | null;
|
|
23
22
|
vcObserverSSRConfig: {
|
|
24
23
|
ssr: number | undefined;
|
|
25
24
|
} | null;
|
|
@@ -62,7 +61,7 @@ export default class PostInteractionLog {
|
|
|
62
61
|
* Basic details about the finished interaction will be recorded
|
|
63
62
|
* A timeout will be setup to send the post interaction observation after some time.
|
|
64
63
|
*/
|
|
65
|
-
onInteractionComplete({ ufoName, start, end, id, abortReason, abortedByInteractionName, routeName, type, experimentalTTAI, experimentalVC90, }: LastInteractionFinishInfo): void;
|
|
64
|
+
onInteractionComplete({ ufoName, start, end, id, abortReason, abortedByInteractionName, routeName, type, experimentalTTAI, experimentalVC90, errors, }: LastInteractionFinishInfo): void;
|
|
66
65
|
/**
|
|
67
66
|
* This fn should be invoked when a React render happens after interaction has finished
|
|
68
67
|
*/
|
|
@@ -1,6 +1,22 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { VCRawDataType, VCResult } from '../common/vc/types';
|
|
2
|
+
import type { GetVCResultType, VCObserverInterface, VCObserverOptions } from './types';
|
|
2
3
|
declare global {
|
|
3
4
|
var __vcObserver: VCObserverInterface;
|
|
4
5
|
}
|
|
6
|
+
export declare class VCObserverWrapper implements VCObserverInterface {
|
|
7
|
+
private oldVCObserver;
|
|
8
|
+
private newVCObserver;
|
|
9
|
+
constructor(opts?: VCObserverOptions);
|
|
10
|
+
start({ startTime, experienceKey }: {
|
|
11
|
+
startTime: number;
|
|
12
|
+
experienceKey: string;
|
|
13
|
+
}): void;
|
|
14
|
+
stop(experienceKey?: string): void;
|
|
15
|
+
getVCRawData(): VCRawDataType | null;
|
|
16
|
+
getVCResult(param: GetVCResultType): Promise<VCResult>;
|
|
17
|
+
setSSRElement(element: HTMLElement): void;
|
|
18
|
+
setReactRootRenderStart(startTime: number): void;
|
|
19
|
+
setReactRootRenderStop(stopTime: number): void;
|
|
20
|
+
}
|
|
5
21
|
export declare function isEnvironmentSupported(): boolean;
|
|
6
22
|
export declare function getVCObserver(opts?: VCObserverOptions): VCObserverInterface;
|
|
@@ -7,6 +7,7 @@ export type GetVCResultType = {
|
|
|
7
7
|
prefix?: string;
|
|
8
8
|
ssr?: number;
|
|
9
9
|
vc?: VCRawDataType | null;
|
|
10
|
+
experienceKey: string;
|
|
10
11
|
};
|
|
11
12
|
export type SelectorConfig = {
|
|
12
13
|
id: boolean;
|
|
@@ -25,8 +26,9 @@ export type VCObserverOptions = {
|
|
|
25
26
|
export interface VCObserverInterface {
|
|
26
27
|
start(startArg: {
|
|
27
28
|
startTime: number;
|
|
29
|
+
experienceKey?: string;
|
|
28
30
|
}): void;
|
|
29
|
-
stop(): void;
|
|
31
|
+
stop(experienceKey?: string): void;
|
|
30
32
|
getVCRawData(): VCRawDataType | null;
|
|
31
33
|
getVCResult(param: GetVCResultType): Promise<VCResult>;
|
|
32
34
|
setSSRElement(element: HTMLElement): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { InteractionMetrics } from '../../common/common/types';
|
|
2
|
+
import { RevisionPayload } from '../../common/vc/types';
|
|
2
3
|
import type { MultiRevisionHeatmap } from './heatmap/heatmap';
|
|
3
4
|
type CalculatedVC = {
|
|
4
5
|
VC: {
|
|
@@ -8,7 +9,7 @@ type CalculatedVC = {
|
|
|
8
9
|
[key: string]: string[] | null;
|
|
9
10
|
};
|
|
10
11
|
};
|
|
11
|
-
export declare function getVCRevisionsData({ fullPrefix, interaction, isVCClean, isEventAborted, multiHeatmap, ssr, calculatedVC, calculatedVCNext, }: {
|
|
12
|
+
export declare function getVCRevisionsData({ fullPrefix, interaction, isVCClean, isEventAborted, multiHeatmap, ssr, calculatedVC, calculatedVCNext, experienceKey, }: {
|
|
12
13
|
fullPrefix?: string;
|
|
13
14
|
interaction: Pick<InteractionMetrics, 'start' | 'end'>;
|
|
14
15
|
isVCClean: boolean;
|
|
@@ -16,9 +17,10 @@ export declare function getVCRevisionsData({ fullPrefix, interaction, isVCClean,
|
|
|
16
17
|
multiHeatmap: MultiRevisionHeatmap | null;
|
|
17
18
|
calculatedVC: CalculatedVC;
|
|
18
19
|
calculatedVCNext: CalculatedVC;
|
|
20
|
+
experienceKey: string;
|
|
19
21
|
ssr?: number;
|
|
20
22
|
}): {
|
|
21
|
-
[x: string]:
|
|
23
|
+
[x: string]: RevisionPayload;
|
|
22
24
|
} | {
|
|
23
25
|
[x: string]: {
|
|
24
26
|
revision: string;
|
|
@@ -26,7 +28,7 @@ export declare function getVCRevisionsData({ fullPrefix, interaction, isVCClean,
|
|
|
26
28
|
'metric:vc90': number | null;
|
|
27
29
|
vcDetails: {
|
|
28
30
|
[key: string]: {
|
|
29
|
-
t: number
|
|
31
|
+
t: number;
|
|
30
32
|
e: string[];
|
|
31
33
|
};
|
|
32
34
|
};
|
|
@@ -51,7 +51,7 @@ export declare class VCObserver implements VCObserverInterface {
|
|
|
51
51
|
targetName: string;
|
|
52
52
|
ignoreReason: VCIgnoreReason | undefined;
|
|
53
53
|
}[];
|
|
54
|
-
getVCResult: ({ start, stop, tti, prefix, ssr, vc, isEventAborted, }: GetVCResultType) => Promise<VCResult>;
|
|
54
|
+
getVCResult: ({ start, stop, tti, prefix, ssr, vc, isEventAborted, experienceKey, }: GetVCResultType) => Promise<VCResult>;
|
|
55
55
|
static calculateVC({ heatmap, ssr, componentsLog, viewport, }: {
|
|
56
56
|
heatmap: number[][];
|
|
57
57
|
ssr?: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-ufo",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.11.1",
|
|
4
4
|
"description": "Parts of React UFO that are publicly available",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -130,9 +130,15 @@
|
|
|
130
130
|
"platform_ufo_use_offscreen_canvas": {
|
|
131
131
|
"type": "boolean"
|
|
132
132
|
},
|
|
133
|
+
"platform_ufo_vc_align_revisions_on_watchdog_event": {
|
|
134
|
+
"type": "boolean"
|
|
135
|
+
},
|
|
133
136
|
"platform_ufo_canvas_heatmap_full_precision": {
|
|
134
137
|
"type": "boolean"
|
|
135
138
|
},
|
|
139
|
+
"platform_ufo_vc_enable_revisions_by_experience": {
|
|
140
|
+
"type": "boolean"
|
|
141
|
+
},
|
|
136
142
|
"ufo_return_relative_request_start": {
|
|
137
143
|
"type": "boolean"
|
|
138
144
|
},
|