@atlaskit/react-ufo 2.7.0 → 2.8.0

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/config/index.js +18 -40
  3. package/dist/cjs/create-payload/common/utils/index.js +2 -66
  4. package/dist/cjs/create-payload/index.js +78 -55
  5. package/dist/cjs/interaction-metrics/common/constants.js +3 -8
  6. package/dist/cjs/interaction-metrics/index.js +238 -166
  7. package/dist/cjs/interaction-metrics-init/index.js +9 -31
  8. package/dist/cjs/load-hold/UFOLoadHold.js +3 -5
  9. package/dist/cjs/segment/segment.js +8 -9
  10. package/dist/es2019/config/index.js +0 -22
  11. package/dist/es2019/create-payload/common/utils/index.js +1 -68
  12. package/dist/es2019/create-payload/index.js +77 -48
  13. package/dist/es2019/interaction-metrics/common/constants.js +2 -7
  14. package/dist/es2019/interaction-metrics/index.js +131 -91
  15. package/dist/es2019/interaction-metrics-init/index.js +8 -28
  16. package/dist/es2019/load-hold/UFOLoadHold.js +3 -5
  17. package/dist/es2019/segment/segment.js +11 -8
  18. package/dist/esm/config/index.js +18 -39
  19. package/dist/esm/create-payload/common/utils/index.js +1 -63
  20. package/dist/esm/create-payload/index.js +78 -53
  21. package/dist/esm/interaction-metrics/common/constants.js +2 -7
  22. package/dist/esm/interaction-metrics/index.js +158 -86
  23. package/dist/esm/interaction-metrics-init/index.js +8 -28
  24. package/dist/esm/load-hold/UFOLoadHold.js +3 -5
  25. package/dist/esm/segment/segment.js +8 -9
  26. package/dist/types/common/common/types.d.ts +4 -6
  27. package/dist/types/config/index.d.ts +0 -6
  28. package/dist/types/create-payload/common/utils/index.d.ts +0 -9
  29. package/dist/types/create-payload/index.d.ts +5660 -13
  30. package/dist/types/interaction-context/index.d.ts +0 -1
  31. package/dist/types/interaction-metrics/common/constants.d.ts +3 -32
  32. package/dist/types/interaction-metrics/index.d.ts +17 -1
  33. package/dist/types/load-hold/UFOLoadHold.d.ts +2 -1
  34. package/dist/types-ts4.5/common/common/types.d.ts +4 -6
  35. package/dist/types-ts4.5/config/index.d.ts +0 -6
  36. package/dist/types-ts4.5/create-payload/common/utils/index.d.ts +0 -9
  37. package/dist/types-ts4.5/create-payload/index.d.ts +5660 -13
  38. package/dist/types-ts4.5/interaction-context/index.d.ts +0 -1
  39. package/dist/types-ts4.5/interaction-metrics/common/constants.d.ts +3 -32
  40. package/dist/types-ts4.5/interaction-metrics/index.d.ts +17 -1
  41. package/dist/types-ts4.5/load-hold/UFOLoadHold.d.ts +2 -1
  42. package/package.json +2 -3
  43. package/create-experimental-interaction-metrics-payload/package.json +0 -15
  44. package/dist/cjs/create-experimental-interaction-metrics-payload/index.js +0 -100
  45. package/dist/cjs/interaction-metrics/common/index.js +0 -151
  46. package/dist/es2019/create-experimental-interaction-metrics-payload/index.js +0 -71
  47. package/dist/es2019/interaction-metrics/common/index.js +0 -103
  48. package/dist/esm/create-experimental-interaction-metrics-payload/index.js +0 -90
  49. package/dist/esm/interaction-metrics/common/index.js +0 -132
  50. package/dist/types/create-experimental-interaction-metrics-payload/index.d.ts +0 -16
  51. package/dist/types/interaction-metrics/common/index.d.ts +0 -16
  52. package/dist/types-ts4.5/create-experimental-interaction-metrics-payload/index.d.ts +0 -16
  53. package/dist/types-ts4.5/interaction-metrics/common/index.d.ts +0 -16
@@ -27,7 +27,6 @@ export interface UFOInteractionContextType extends InteractionContextType {
27
27
  startTime?: number;
28
28
  stopTime: number;
29
29
  }): void;
30
- holdExperimental?(name: string): void | (() => void);
31
30
  }
32
31
  declare const _default: Context<UFOInteractionContextType | null>;
33
32
  export default _default;
@@ -1,32 +1,3 @@
1
- import type { InteractionMetrics, SegmentInfo } from '../../common';
2
- import type { FeatureFlagValue } from '../../feature-flags-accessed';
3
- export declare const interactions: Map<string, InteractionMetrics>;
4
- export declare const CLEANUP_TIMEOUT: number;
5
- export declare const CLEANUP_TIMEOUT_AFTER_APDEX: number;
6
- export type SegmentObserver = {
7
- onAdd: (segment: SegmentInfo) => void;
8
- onRemove: (segment: SegmentInfo) => void;
9
- };
10
- export declare const interactionQueue: {
11
- id: string;
12
- data: InteractionMetrics;
13
- }[];
14
- export declare const segmentCache: Map<string, SegmentInfo>;
15
- export declare const segmentObservers: SegmentObserver[];
16
- export declare const moduleLoadingRequests: Record<string, {
17
- start: number;
18
- timeoutId: ReturnType<typeof setTimeout> | number | undefined;
19
- }>;
20
- declare global {
21
- interface Window {
22
- __REACT_UFO_ENABLE_PERF_TRACING?: boolean;
23
- __UFO_COMPACT_PAYLOAD__?: boolean;
24
- __CRITERION__?: {
25
- addFeatureFlagAccessed?: (flagName: string, flagValue: FeatureFlagValue) => void;
26
- addUFOHold?: (id: string, name: string, labelStack: string, startTime: number) => void;
27
- removeUFOHold?: (id: string) => void;
28
- getFeatureFlagOverride?: (flagName: string) => boolean | undefined;
29
- getExperimentValueOverride?: <T>(experimentName: string, parameterName: string) => T;
30
- };
31
- }
32
- }
1
+ import type { InteractionMetrics } from '../../common';
2
+ declare const interactions: Map<string, InteractionMetrics>;
3
+ export default interactions;
@@ -1,7 +1,10 @@
1
1
  import type { AbortReasonType, ApdexType, BM3Event, CustomData, CustomTiming, InteractionError, InteractionMetrics, InteractionType, LifecycleMarkType, LoadProfilerEventInfo, Mark, MarkType, PostInteractionLogOutput, ReactProfilerTiming, RequestInfo, Span, SpanType } from '../common';
2
2
  import { type TraceIdContext } from '../experience-trace-id-context';
3
+ import { type FeatureFlagValue } from '../feature-flags-accessed';
3
4
  import type { LabelStack } from '../interaction-context';
5
+ import PostInteractionLog from './post-interaction-log';
4
6
  export type { InteractionMetrics, LifecycleMarkType, Span, Mark, MarkType, InteractionType, AbortReasonType, ReactProfilerTiming, RequestInfo, ApdexType, CustomData, CustomTiming, InteractionError, };
7
+ export declare const postInteractionLog: PostInteractionLog;
5
8
  export declare function getActiveInteraction(): InteractionMetrics | undefined;
6
9
  export declare function remove(interactionId: string): void;
7
10
  export declare function updatePageLoadInteractionName(ufoName: string, routeName?: string | null | undefined): void;
@@ -15,7 +18,7 @@ export declare function addSpanToAll(type: SpanType, name: string, labelStack: L
15
18
  export declare function addPreload(moduleId: string, timestamp: number): void;
16
19
  export declare function addLoad(identifier: string, start: number, end: number): void;
17
20
  export declare function extractModuleName(input: string): string;
18
- export declare function addHold(interactionId: string, labelStack: LabelStack, name: string, experimental: boolean): () => void;
21
+ export declare function addHold(interactionId: string, labelStack: LabelStack, name: string): () => void;
19
22
  export declare function addHoldByID(interactionId: string, labelStack: LabelStack, name: string, id: string, ignoreOnSubmit?: boolean): () => void;
20
23
  export declare function removeHoldByID(interactionId: string, id: string): void;
21
24
  export declare function getCurrentInteractionType(interactionId: string): InteractionType | null;
@@ -49,5 +52,18 @@ export declare function addRequestInfo(interactionId: string, labelStack: LabelS
49
52
  export declare function addSegment(labelStack: LabelStack): void;
50
53
  export declare function removeSegment(labelStack: LabelStack): void;
51
54
  export declare function addRedirect(interactionId: string, fromUfoName: string, nextUfoName: string, nextRouteName: string, time: number): void;
55
+ declare global {
56
+ interface Window {
57
+ __REACT_UFO_ENABLE_PERF_TRACING?: boolean;
58
+ __UFO_COMPACT_PAYLOAD__?: boolean;
59
+ __CRITERION__?: {
60
+ addFeatureFlagAccessed?: (flagName: string, flagValue: FeatureFlagValue) => void;
61
+ addUFOHold?: (id: string, name: string, labelStack: string, startTime: number) => void;
62
+ removeUFOHold?: (id: string) => void;
63
+ getFeatureFlagOverride?: (flagName: string) => boolean | undefined;
64
+ getExperimentValueOverride?: <T>(experimentName: string, parameterName: string) => T;
65
+ };
66
+ }
67
+ }
52
68
  export declare const interactionSpans: Span[];
53
69
  export declare function addCustomSpans(name: string, start: number, end?: number, size?: number, labelStack?: LabelStack): void;
@@ -19,7 +19,8 @@ import { type ReactNode } from 'react';
19
19
  * return (
20
20
  * <>
21
21
  * <Skeleton />
22
- * <UFOLoadHold name="card" />
22
+ * <UFOLoadHold name="card">
23
+ * </UFOLoadHold>
23
24
  * )
24
25
  * }
25
26
  * ```
@@ -63,7 +63,7 @@ export interface SegmentInfo {
63
63
  labelStack: LabelStack;
64
64
  }
65
65
  export interface CustomData {
66
- [key: string]: null | string | number | boolean | undefined | CustomData | Record<string, CustomData>;
66
+ [key: string]: null | undefined | string | number | boolean | undefined | CustomData | Record<string, CustomData>;
67
67
  }
68
68
  export type CustomTiming = Record<string, {
69
69
  startTime: number;
@@ -104,9 +104,7 @@ export interface InteractionMetrics {
104
104
  labelStack: LabelStack;
105
105
  })[];
106
106
  holdInfo: HoldInfo[];
107
- holdExpInfo: HoldInfo[];
108
107
  holdActive: Map<string, HoldActive>;
109
- holdExpActive: Map<string, HoldActive>;
110
108
  reactProfilerTimings: ReactProfilerTiming[];
111
109
  measureStart: number;
112
110
  rate: number;
@@ -117,11 +115,11 @@ export interface InteractionMetrics {
117
115
  abortReason?: AbortReasonType;
118
116
  abortedByInteractionName?: string;
119
117
  /**
120
- * Apdex is a legacy performance measurement where it is
118
+ * Apdex is legacy performance measurement where it is
121
119
  * capturing TTI at arbitrary point in the code (bm3/UFOv1)
122
120
  *
123
121
  * We are intercepting its values now just so we can use it for
124
- * topline metric, but should encourage teams to adopt TTAI
122
+ * topline metric, but should encourage teams adopt TTAI
125
123
  *
126
124
  * This field might be ignored/dropped in the future.
127
125
  */
@@ -166,7 +164,7 @@ export interface LazyLoadProfilerContext {
166
164
  addLoad(identifier: string, start: number, end: number): void;
167
165
  }
168
166
  export interface EnhancedUFOInteractionContextType extends UFOInteractionContextType, RelayMetricsRecorder, LazyLoadProfilerContext {
169
- _internalHold(labelStack: LabelStack, name: string, experimental?: boolean): void | (() => void);
167
+ _internalHold(labelStack: LabelStack, name: string): void | (() => void);
170
168
  _internalHoldByID(labelStack: LabelStack, id: string, name: string, remove: boolean): void | (() => void);
171
169
  addHoldByID(labelStack: LabelStack, id: string, name?: string): void;
172
170
  removeHoldByID(labelStack: LabelStack, id: string, name?: string): void;
@@ -73,11 +73,6 @@ export type Config = {
73
73
  readonly rates?: Rates;
74
74
  readonly kind?: Record<InteractionType, number>;
75
75
  };
76
- readonly experimentalInteractionMetrics?: {
77
- readonly enabled?: boolean;
78
- readonly rates?: Rates;
79
- readonly kind?: Record<InteractionType, number>;
80
- };
81
76
  readonly enableSegmentHighlighting?: boolean;
82
77
  readonly enableAdditionalPerformanceMarks?: boolean;
83
78
  readonly shouldCalculateLighthouseMetricsFromTTAI?: boolean;
@@ -91,7 +86,6 @@ export type Config = {
91
86
  export declare function setUFOConfig(newConfig: Config): void;
92
87
  export declare function getConfig(): Config | undefined;
93
88
  export declare function getInteractionRate(name: string, interactionKind: InteractionKind): number;
94
- export declare function getExperimentalInteractionRate(name: string, interactionType: InteractionType): number;
95
89
  export declare function getPostInteractionRate(name: string, interactionType: InteractionType): number;
96
90
  export declare function getCapabilityRate(capability: Capability): number;
97
91
  declare const validTypingMethods: readonly [
@@ -1,8 +1,4 @@
1
- import type { InteractionMetrics } from '../../../common';
2
- import { type Config } from '../../../config';
3
1
  import type { LabelStack, SegmentLabel } from '../../../interaction-context';
4
- import PostInteractionLog from '../../../interaction-metrics/post-interaction-log';
5
- export declare const postInteractionLog: PostInteractionLog;
6
2
  export type SegmentItem = {
7
3
  n: string;
8
4
  c?: Record<string, SegmentItem>;
@@ -19,8 +15,3 @@ export declare function optimizeLabelStack(labelStack: LabelStack): string | {
19
15
  s?: string | undefined;
20
16
  n: string;
21
17
  }[];
22
- export declare const getPageVisibilityUpToTTAI: (interaction: InteractionMetrics) => import("../../../hidden-timing").PageVisibility;
23
- export declare const calculateVCMetrics: (interaction: InteractionMetrics, prefix: string, getVCResultFn: (props: any) => any) => any;
24
- export declare function getSSRDoneTimeValue(config: Config | undefined): number | undefined;
25
- export declare const getVCMetrics: (interaction: InteractionMetrics) => any;
26
- export declare const getTTAI: (interaction: InteractionMetrics) => number | undefined;