@atlaskit/react-ufo 3.9.5 → 3.10.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +26 -5
  3. package/dist/cjs/config/index.js +22 -1
  4. package/dist/cjs/create-payload/utils/get-vc-metrics.js +2 -2
  5. package/dist/cjs/vc/index.js +1 -4
  6. package/dist/cjs/vc/vc-observer/getVCRevisionsData.js +2 -5
  7. package/dist/cjs/vc/vc-observer/index.js +47 -22
  8. package/dist/cjs/vc/vc-observer/revisions/revisions.js +1 -2
  9. package/dist/cjs/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +29 -9
  10. package/dist/cjs/vc/vc-observer-new/metric-calculator/fy25_03/index.js +24 -0
  11. package/dist/es2019/config/index.js +19 -0
  12. package/dist/es2019/create-payload/utils/get-vc-metrics.js +3 -3
  13. package/dist/es2019/vc/index.js +2 -5
  14. package/dist/es2019/vc/vc-observer/getVCRevisionsData.js +3 -6
  15. package/dist/es2019/vc/vc-observer/index.js +43 -15
  16. package/dist/es2019/vc/vc-observer/revisions/revisions.js +2 -3
  17. package/dist/es2019/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +24 -8
  18. package/dist/es2019/vc/vc-observer-new/metric-calculator/fy25_03/index.js +22 -0
  19. package/dist/es2019/vc/vc-observer-new/metric-calculator/percentile-calc/index.js +2 -2
  20. package/dist/esm/config/index.js +20 -1
  21. package/dist/esm/create-payload/utils/get-vc-metrics.js +3 -3
  22. package/dist/esm/vc/index.js +2 -5
  23. package/dist/esm/vc/vc-observer/getVCRevisionsData.js +3 -6
  24. package/dist/esm/vc/vc-observer/index.js +48 -23
  25. package/dist/esm/vc/vc-observer/revisions/revisions.js +2 -3
  26. package/dist/esm/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +29 -9
  27. package/dist/esm/vc/vc-observer-new/metric-calculator/fy25_03/index.js +24 -0
  28. package/dist/esm/vc/vc-observer-new/metric-calculator/percentile-calc/index.js +2 -2
  29. package/dist/types/common/vc/types.d.ts +2 -1
  30. package/dist/types/config/index.d.ts +2 -0
  31. package/dist/types/vc/vc-observer-new/index.d.ts +1 -1
  32. package/dist/types/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +6 -1
  33. package/dist/types/vc/vc-observer-new/metric-calculator/fy25_03/index.d.ts +7 -0
  34. package/dist/types/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/index.d.ts +1 -1
  35. package/dist/types/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/index.d.ts +1 -1
  36. package/dist/types/vc/vc-observer-new/metric-calculator/percentile-calc/index.d.ts +1 -1
  37. package/dist/types/vc/vc-observer-new/metric-calculator/types.d.ts +1 -13
  38. package/dist/types-ts4.5/common/vc/types.d.ts +2 -1
  39. package/dist/types-ts4.5/config/index.d.ts +2 -0
  40. package/dist/types-ts4.5/vc/vc-observer-new/index.d.ts +1 -1
  41. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +6 -1
  42. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/fy25_03/index.d.ts +7 -0
  43. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/index.d.ts +1 -1
  44. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/index.d.ts +1 -1
  45. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/percentile-calc/index.d.ts +1 -1
  46. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/types.d.ts +1 -13
  47. package/package.json +2 -2
@@ -54,6 +54,30 @@ var VCCalculator_FY25_03 = /*#__PURE__*/function (_AbstractVCCalculator) {
54
54
  });
55
55
  return !hasAbortEvent;
56
56
  }
57
+ }, {
58
+ key: "getVCCleanStatus",
59
+ value: function getVCCleanStatus(filteredEntries) {
60
+ var dirtyReason = '';
61
+ var hasAbortEvent = filteredEntries.some(function (entry) {
62
+ if (entry.type === 'window:event') {
63
+ var data = entry.data;
64
+ if (ABORTING_WINDOW_EVENT.includes(data.eventType)) {
65
+ dirtyReason = data.eventType === 'keydown' ? 'keypress' : data.eventType;
66
+ return true;
67
+ }
68
+ }
69
+ return false;
70
+ });
71
+ if (hasAbortEvent && dirtyReason) {
72
+ return {
73
+ isVCClean: false,
74
+ dirtyReason: dirtyReason
75
+ };
76
+ }
77
+ return {
78
+ isVCClean: true
79
+ };
80
+ }
57
81
  }]);
58
82
  }(AbstractVCCalculatorBase);
59
83
  export { VCCalculator_FY25_03 as default };
@@ -1,7 +1,7 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import calcUsingCanvas from './canvas-heatmap';
4
- import caclUsingOldHeatmap from './heatmap';
4
+ import calcUsingOldHeatmap from './heatmap';
5
5
  import calcUsingRectSweepingLine from './rect-sweeping-line';
6
6
  function calculateTTVCPercentiles(_x) {
7
7
  return _calculateTTVCPercentiles.apply(this, arguments);
@@ -38,7 +38,7 @@ function _calculateTTVCPercentiles() {
38
38
  break;
39
39
  }
40
40
  _context.next = 14;
41
- return caclUsingOldHeatmap(arg);
41
+ return calcUsingOldHeatmap(arg);
42
42
  case 14:
43
43
  _vcDetails2 = _context.sent;
44
44
  return _context.abrupt("return", _vcDetails2);
@@ -5,7 +5,7 @@ export declare const AbortEvent: {
5
5
  readonly keydown: "keydown";
6
6
  readonly resize: "resize";
7
7
  };
8
- export type VCAbortReason = 'custom' | 'scroll' | 'keypress' | 'resize' | 'error' | 'not-supported';
8
+ export type VCAbortReason = 'custom' | 'scroll' | 'keypress' | 'resize' | 'error' | 'not-supported' | 'wheel';
9
9
  export type VCAbortReasonType = {
10
10
  reason: null | VCAbortReason;
11
11
  info: string;
@@ -115,6 +115,7 @@ export type RevisionPayloadEntry = {
115
115
  revision: string;
116
116
  clean: boolean;
117
117
  vcDetails?: RevisionPayloadVCDetails;
118
+ abortReason?: VCAbortReason | null;
118
119
  };
119
120
  export type RevisionPayload = RevisionPayloadEntry[];
120
121
  export {};
@@ -99,6 +99,8 @@ export type Config = {
99
99
  };
100
100
  export declare function setUFOConfig(newConfig: Config): void;
101
101
  export declare function getConfig(): Config | undefined;
102
+ export declare function getEnabledVCRevisions(): TTVCRevisions[];
103
+ export declare function isVCRevisionEnabled(revision: TTVCRevisions): boolean;
102
104
  export declare function getInteractionRate(name: string, interactionKind: InteractionKind): number;
103
105
  export declare function getExperimentalInteractionRate(name: string, interactionType: InteractionType): number;
104
106
  export declare function getPostInteractionRate(name: string, interactionType: InteractionType): number;
@@ -1,5 +1,5 @@
1
+ import { RevisionPayloadEntry } from '../../common/vc/types';
1
2
  import { type SelectorConfig } from './get-element-name';
2
- import type { RevisionPayloadEntry } from './metric-calculator/types';
3
3
  import type { VCObserverGetVCResultParam } from './types';
4
4
  export type VCObserverNewConfig = {
5
5
  selectorConfig?: SelectorConfig;
@@ -1,9 +1,14 @@
1
+ import { RevisionPayloadEntry, VCAbortReason } from '../../../common/vc/types';
1
2
  import type { VCObserverEntry } from '../types';
2
- import type { RevisionPayloadEntry, VCCalculator, VCCalculatorParam } from './types';
3
+ import type { VCCalculator, VCCalculatorParam } from './types';
3
4
  export default abstract class AbstractVCCalculatorBase implements VCCalculator {
4
5
  private revisionNo;
5
6
  constructor(revisionNo: string);
6
7
  protected abstract isEntryIncluded(entry: VCObserverEntry): boolean;
7
8
  protected abstract isVCClean(filteredEntries: ReadonlyArray<VCObserverEntry>): boolean;
9
+ protected abstract getVCCleanStatus(filteredEntries: ReadonlyArray<VCObserverEntry>): {
10
+ isVCClean: boolean;
11
+ dirtyReason?: VCAbortReason;
12
+ };
8
13
  calculate({ startTime, stopTime, orderedEntries, }: VCCalculatorParam): Promise<RevisionPayloadEntry | undefined>;
9
14
  }
@@ -5,4 +5,11 @@ export default class VCCalculator_FY25_03 extends AbstractVCCalculatorBase {
5
5
  constructor();
6
6
  protected isEntryIncluded(entry: VCObserverEntry): boolean;
7
7
  protected isVCClean(filteredEntries: readonly VCObserverEntry[]): boolean;
8
+ protected getVCCleanStatus(filteredEntries: readonly VCObserverEntry[]): {
9
+ isVCClean: boolean;
10
+ dirtyReason: never;
11
+ } | {
12
+ isVCClean: boolean;
13
+ dirtyReason?: undefined;
14
+ };
8
15
  }
@@ -1,4 +1,4 @@
1
- import type { RevisionPayloadVCDetails } from '../../types';
1
+ import type { RevisionPayloadVCDetails } from '../../../../../common/vc/types';
2
2
  import type { CalcTTVCPercentilesArg } from '../types';
3
3
  declare function calculateTTVCPercentiles({ viewport, orderedEntries, percentiles, startTime, }: CalcTTVCPercentilesArg): Promise<RevisionPayloadVCDetails>;
4
4
  export default calculateTTVCPercentiles;
@@ -1,5 +1,5 @@
1
+ import type { RevisionPayloadVCDetails } from '../../../../../common/vc/types';
1
2
  import type { VCObserverEntry } from '../../../types';
2
- import type { RevisionPayloadVCDetails } from '../../types';
3
3
  import type { Viewport } from './types';
4
4
  declare function calculateTTVCPercentiles({ orderedEntries, viewport, percentiles, startTime, }: {
5
5
  orderedEntries: ReadonlyArray<VCObserverEntry>;
@@ -1,4 +1,4 @@
1
- import type { RevisionPayloadVCDetails } from '../types';
1
+ import type { RevisionPayloadVCDetails } from '../../../../common/vc/types';
2
2
  import type { CalcTTVCPercentilesArg } from './types';
3
3
  declare function calculateTTVCPercentiles(arg: CalcTTVCPercentilesArg): Promise<RevisionPayloadVCDetails | null>;
4
4
  export default calculateTTVCPercentiles;
@@ -1,17 +1,5 @@
1
+ import { RevisionPayloadEntry } from '../../../common/vc/types';
1
2
  import type { VCObserverEntry } from '../types';
2
- export type RevisionPayloadVCDetails = {
3
- [key: string]: {
4
- t: number;
5
- e: string[];
6
- };
7
- };
8
- export type RevisionPayloadEntry = {
9
- 'metric:vc90': number | null;
10
- revision: string;
11
- clean: boolean;
12
- vcDetails?: RevisionPayloadVCDetails;
13
- };
14
- export type RevisionPayload = RevisionPayloadEntry[];
15
3
  export type VCCalculatorParam = {
16
4
  startTime: DOMHighResTimeStamp;
17
5
  stopTime: DOMHighResTimeStamp;
@@ -5,7 +5,7 @@ export declare const AbortEvent: {
5
5
  readonly keydown: "keydown";
6
6
  readonly resize: "resize";
7
7
  };
8
- export type VCAbortReason = 'custom' | 'scroll' | 'keypress' | 'resize' | 'error' | 'not-supported';
8
+ export type VCAbortReason = 'custom' | 'scroll' | 'keypress' | 'resize' | 'error' | 'not-supported' | 'wheel';
9
9
  export type VCAbortReasonType = {
10
10
  reason: null | VCAbortReason;
11
11
  info: string;
@@ -115,6 +115,7 @@ export type RevisionPayloadEntry = {
115
115
  revision: string;
116
116
  clean: boolean;
117
117
  vcDetails?: RevisionPayloadVCDetails;
118
+ abortReason?: VCAbortReason | null;
118
119
  };
119
120
  export type RevisionPayload = RevisionPayloadEntry[];
120
121
  export {};
@@ -99,6 +99,8 @@ export type Config = {
99
99
  };
100
100
  export declare function setUFOConfig(newConfig: Config): void;
101
101
  export declare function getConfig(): Config | undefined;
102
+ export declare function getEnabledVCRevisions(): TTVCRevisions[];
103
+ export declare function isVCRevisionEnabled(revision: TTVCRevisions): boolean;
102
104
  export declare function getInteractionRate(name: string, interactionKind: InteractionKind): number;
103
105
  export declare function getExperimentalInteractionRate(name: string, interactionType: InteractionType): number;
104
106
  export declare function getPostInteractionRate(name: string, interactionType: InteractionType): number;
@@ -1,5 +1,5 @@
1
+ import { RevisionPayloadEntry } from '../../common/vc/types';
1
2
  import { type SelectorConfig } from './get-element-name';
2
- import type { RevisionPayloadEntry } from './metric-calculator/types';
3
3
  import type { VCObserverGetVCResultParam } from './types';
4
4
  export type VCObserverNewConfig = {
5
5
  selectorConfig?: SelectorConfig;
@@ -1,9 +1,14 @@
1
+ import { RevisionPayloadEntry, VCAbortReason } from '../../../common/vc/types';
1
2
  import type { VCObserverEntry } from '../types';
2
- import type { RevisionPayloadEntry, VCCalculator, VCCalculatorParam } from './types';
3
+ import type { VCCalculator, VCCalculatorParam } from './types';
3
4
  export default abstract class AbstractVCCalculatorBase implements VCCalculator {
4
5
  private revisionNo;
5
6
  constructor(revisionNo: string);
6
7
  protected abstract isEntryIncluded(entry: VCObserverEntry): boolean;
7
8
  protected abstract isVCClean(filteredEntries: ReadonlyArray<VCObserverEntry>): boolean;
9
+ protected abstract getVCCleanStatus(filteredEntries: ReadonlyArray<VCObserverEntry>): {
10
+ isVCClean: boolean;
11
+ dirtyReason?: VCAbortReason;
12
+ };
8
13
  calculate({ startTime, stopTime, orderedEntries, }: VCCalculatorParam): Promise<RevisionPayloadEntry | undefined>;
9
14
  }
@@ -5,4 +5,11 @@ export default class VCCalculator_FY25_03 extends AbstractVCCalculatorBase {
5
5
  constructor();
6
6
  protected isEntryIncluded(entry: VCObserverEntry): boolean;
7
7
  protected isVCClean(filteredEntries: readonly VCObserverEntry[]): boolean;
8
+ protected getVCCleanStatus(filteredEntries: readonly VCObserverEntry[]): {
9
+ isVCClean: boolean;
10
+ dirtyReason: never;
11
+ } | {
12
+ isVCClean: boolean;
13
+ dirtyReason?: undefined;
14
+ };
8
15
  }
@@ -1,4 +1,4 @@
1
- import type { RevisionPayloadVCDetails } from '../../types';
1
+ import type { RevisionPayloadVCDetails } from '../../../../../common/vc/types';
2
2
  import type { CalcTTVCPercentilesArg } from '../types';
3
3
  declare function calculateTTVCPercentiles({ viewport, orderedEntries, percentiles, startTime, }: CalcTTVCPercentilesArg): Promise<RevisionPayloadVCDetails>;
4
4
  export default calculateTTVCPercentiles;
@@ -1,5 +1,5 @@
1
+ import type { RevisionPayloadVCDetails } from '../../../../../common/vc/types';
1
2
  import type { VCObserverEntry } from '../../../types';
2
- import type { RevisionPayloadVCDetails } from '../../types';
3
3
  import type { Viewport } from './types';
4
4
  declare function calculateTTVCPercentiles({ orderedEntries, viewport, percentiles, startTime, }: {
5
5
  orderedEntries: ReadonlyArray<VCObserverEntry>;
@@ -1,4 +1,4 @@
1
- import type { RevisionPayloadVCDetails } from '../types';
1
+ import type { RevisionPayloadVCDetails } from '../../../../common/vc/types';
2
2
  import type { CalcTTVCPercentilesArg } from './types';
3
3
  declare function calculateTTVCPercentiles(arg: CalcTTVCPercentilesArg): Promise<RevisionPayloadVCDetails | null>;
4
4
  export default calculateTTVCPercentiles;
@@ -1,17 +1,5 @@
1
+ import { RevisionPayloadEntry } from '../../../common/vc/types';
1
2
  import type { VCObserverEntry } from '../types';
2
- export type RevisionPayloadVCDetails = {
3
- [key: string]: {
4
- t: number;
5
- e: string[];
6
- };
7
- };
8
- export type RevisionPayloadEntry = {
9
- 'metric:vc90': number | null;
10
- revision: string;
11
- clean: boolean;
12
- vcDetails?: RevisionPayloadVCDetails;
13
- };
14
- export type RevisionPayload = RevisionPayloadEntry[];
15
3
  export type VCCalculatorParam = {
16
4
  startTime: DOMHighResTimeStamp;
17
5
  stopTime: DOMHighResTimeStamp;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "3.9.5",
3
+ "version": "3.10.1",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -133,7 +133,7 @@
133
133
  "ufo_return_relative_request_start": {
134
134
  "type": "boolean"
135
135
  },
136
- "platform_ufo_vc_observer_new": {
136
+ "platform_ufo_add_vc_abort_reason_by_revisions": {
137
137
  "type": "boolean"
138
138
  },
139
139
  "enable_ufo_devtools_api_for_extra_events": {