@atlaskit/react-ufo 3.11.1 → 3.11.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.
Files changed (28) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/vc/vc-observer/index.js +6 -5
  3. package/dist/cjs/vc/vc-observer/observers/index.js +2 -2
  4. package/dist/es2019/vc/vc-observer/index.js +8 -3
  5. package/dist/es2019/vc/vc-observer/observers/index.js +2 -2
  6. package/dist/esm/vc/vc-observer/index.js +6 -5
  7. package/dist/esm/vc/vc-observer/observers/index.js +2 -2
  8. package/dist/types/common/react-ufo-payload-schema.d.ts +1 -1
  9. package/dist/types/create-payload/index.d.ts +1 -1
  10. package/dist/types/create-post-interaction-log-payload/get-late-mutations.d.ts +3 -3
  11. package/dist/types/create-post-interaction-log-payload/index.d.ts +1 -1
  12. package/dist/types/vc/no-op-vc-observer.d.ts +1 -1
  13. package/dist/types/vc/vc-observer/getVCRevisionsData.d.ts +2 -2
  14. package/dist/types/vc/vc-observer-new/index.d.ts +1 -1
  15. package/dist/types/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +1 -1
  16. package/dist/types/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/heatmap.d.ts +1 -1
  17. package/dist/types/vc/vc-observer-new/metric-calculator/types.d.ts +1 -1
  18. package/dist/types-ts4.5/common/react-ufo-payload-schema.d.ts +1 -1
  19. package/dist/types-ts4.5/create-payload/index.d.ts +1 -1
  20. package/dist/types-ts4.5/create-post-interaction-log-payload/get-late-mutations.d.ts +3 -3
  21. package/dist/types-ts4.5/create-post-interaction-log-payload/index.d.ts +1 -1
  22. package/dist/types-ts4.5/vc/no-op-vc-observer.d.ts +1 -1
  23. package/dist/types-ts4.5/vc/vc-observer/getVCRevisionsData.d.ts +2 -2
  24. package/dist/types-ts4.5/vc/vc-observer-new/index.d.ts +1 -1
  25. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +1 -1
  26. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/heatmap.d.ts +1 -1
  27. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/types.d.ts +1 -1
  28. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 3.11.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#153697](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/153697)
8
+ [`e513d2cda4042`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e513d2cda4042) -
9
+ AFO-3823 improve VCObserver stop() performance
10
+
3
11
  ## 3.11.1
4
12
 
5
13
  ### Patch Changes
@@ -644,11 +644,12 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
644
644
  }, {
645
645
  key: "detachAbortListeners",
646
646
  value: function detachAbortListeners() {
647
- if (Array.isArray(this.unbind)) {
648
- this.unbind.forEach(function (fn) {
649
- return fn();
650
- });
651
- this.unbind = [];
647
+ if (this.unbind) {
648
+ var unbind = this.unbind;
649
+ for (var i = 0; i < unbind.length; i++) {
650
+ unbind[i]();
651
+ }
652
+ this.unbind.length = 0;
652
653
  }
653
654
  }
654
655
  }, {
@@ -104,8 +104,8 @@ var Observers = exports.Observers = /*#__PURE__*/function () {
104
104
  (_this$mutationObserve2 = this.mutationObserver) === null || _this$mutationObserve2 === void 0 || _this$mutationObserve2.disconnect();
105
105
  (_this$intersectionObs2 = this.intersectionObserver) === null || _this$intersectionObs2 === void 0 || _this$intersectionObs2.disconnect();
106
106
  this.observedMutations = new WeakMap();
107
- this.elementsInView = new Set();
108
- this.callbacks = new Set();
107
+ this.elementsInView.clear();
108
+ this.callbacks.clear();
109
109
  this.ssr.reactRootElement = null;
110
110
  this.ssrPlaceholderHandler.clear();
111
111
  }
@@ -739,9 +739,14 @@ export class VCObserver {
739
739
  return vc;
740
740
  }
741
741
  detachAbortListeners() {
742
- if (Array.isArray(this.unbind)) {
743
- this.unbind.forEach(fn => fn());
744
- this.unbind = [];
742
+ if (this.unbind) {
743
+ const {
744
+ unbind
745
+ } = this;
746
+ for (let i = 0; i < unbind.length; i++) {
747
+ unbind[i]();
748
+ }
749
+ this.unbind.length = 0;
745
750
  }
746
751
  }
747
752
  measureStart() {
@@ -86,8 +86,8 @@ export class Observers {
86
86
  (_this$mutationObserve2 = this.mutationObserver) === null || _this$mutationObserve2 === void 0 ? void 0 : _this$mutationObserve2.disconnect();
87
87
  (_this$intersectionObs2 = this.intersectionObserver) === null || _this$intersectionObs2 === void 0 ? void 0 : _this$intersectionObs2.disconnect();
88
88
  this.observedMutations = new WeakMap();
89
- this.elementsInView = new Set();
90
- this.callbacks = new Set();
89
+ this.elementsInView.clear();
90
+ this.callbacks.clear();
91
91
  this.ssr.reactRootElement = null;
92
92
  this.ssrPlaceholderHandler.clear();
93
93
  }
@@ -637,11 +637,12 @@ export var VCObserver = /*#__PURE__*/function () {
637
637
  }, {
638
638
  key: "detachAbortListeners",
639
639
  value: function detachAbortListeners() {
640
- if (Array.isArray(this.unbind)) {
641
- this.unbind.forEach(function (fn) {
642
- return fn();
643
- });
644
- this.unbind = [];
640
+ if (this.unbind) {
641
+ var unbind = this.unbind;
642
+ for (var i = 0; i < unbind.length; i++) {
643
+ unbind[i]();
644
+ }
645
+ this.unbind.length = 0;
645
646
  }
646
647
  }
647
648
  }, {
@@ -97,8 +97,8 @@ export var Observers = /*#__PURE__*/function () {
97
97
  (_this$mutationObserve2 = this.mutationObserver) === null || _this$mutationObserve2 === void 0 || _this$mutationObserve2.disconnect();
98
98
  (_this$intersectionObs2 = this.intersectionObserver) === null || _this$intersectionObs2 === void 0 || _this$intersectionObs2.disconnect();
99
99
  this.observedMutations = new WeakMap();
100
- this.elementsInView = new Set();
101
- this.callbacks = new Set();
100
+ this.elementsInView.clear();
101
+ this.callbacks.clear();
102
102
  this.ssr.reactRootElement = null;
103
103
  this.ssrPlaceholderHandler.clear();
104
104
  }
@@ -1,5 +1,5 @@
1
1
  import { createPayloads } from '../create-payload';
2
- import { LabelStack } from '../interaction-context';
2
+ import { type LabelStack } from '../interaction-context';
3
3
  import { VCObserver } from '../vc/vc-observer';
4
4
  import type { AbortReasonType, ApdexType, InteractionError, InteractionType, SegmentInfo } from './common/types';
5
5
  import type { RevisionPayload } from './vc/types';
@@ -1,5 +1,5 @@
1
1
  import type { InteractionMetrics, InteractionType } from '../common';
2
- import { ResourceTiming } from '../common/react-ufo-payload-schema';
2
+ import { type ResourceTiming } from '../common/react-ufo-payload-schema';
3
3
  import * as ssr from '../ssr';
4
4
  import type { OptimizedLabelStack } from './common/types';
5
5
  export declare function createPayloads(interactionId: string, interaction: InteractionMetrics): Promise<{
@@ -1,5 +1,5 @@
1
- import { LastInteractionFinishInfo } from '../common';
2
- import { RevisionPayloadVCDetails } from '../common/vc/types';
3
- import { LateMutation } from './types';
1
+ import type { LastInteractionFinishInfo } from '../common';
2
+ import type { RevisionPayloadVCDetails } from '../common/vc/types';
3
+ import type { LateMutation } from './types';
4
4
  declare function getLateMutations(vcDetails: RevisionPayloadVCDetails, lastInteractionFinish: LastInteractionFinishInfo, postInteractionFinishVCRatios: Record<string, number>): LateMutation[];
5
5
  export default getLateMutations;
@@ -1,5 +1,5 @@
1
1
  import { type PostInteractionLogOutput } from '../common';
2
- import { LateMutation } from './types';
2
+ import type { LateMutation } from './types';
3
3
  declare function createPostInteractionLogPayload({ lastInteractionFinish, reactProfilerTimings, lastInteractionFinishVCResult, postInteractionFinishVCResult, }: PostInteractionLogOutput): {
4
4
  actionSubject: string;
5
5
  action: string;
@@ -1,4 +1,4 @@
1
- import { VCResult } from '../common/vc/types';
1
+ import type { VCResult } from '../common/vc/types';
2
2
  import type { GetVCResultType, VCObserverInterface } from './types';
3
3
  export declare class VCObserverNOOP implements VCObserverInterface {
4
4
  start(startArg: {
@@ -1,5 +1,5 @@
1
- import { InteractionMetrics } from '../../common/common/types';
2
- import { RevisionPayload } from '../../common/vc/types';
1
+ import type { InteractionMetrics } from '../../common/common/types';
2
+ import type { RevisionPayload } from '../../common/vc/types';
3
3
  import type { MultiRevisionHeatmap } from './heatmap/heatmap';
4
4
  type CalculatedVC = {
5
5
  VC: {
@@ -1,4 +1,4 @@
1
- import { RevisionPayloadEntry } from '../../common/vc/types';
1
+ import { type RevisionPayloadEntry } from '../../common/vc/types';
2
2
  import { type SelectorConfig } from './get-element-name';
3
3
  import type { VCObserverGetVCResultParam } from './types';
4
4
  export type VCObserverNewConfig = {
@@ -1,4 +1,4 @@
1
- import { RevisionPayloadEntry, VCAbortReason } from '../../../common/vc/types';
1
+ import type { RevisionPayloadEntry, VCAbortReason } from '../../../common/vc/types';
2
2
  import type { VCObserverEntry } from '../types';
3
3
  import type { VCCalculator, VCCalculatorParam } from './types';
4
4
  export default abstract class AbstractVCCalculatorBase implements VCCalculator {
@@ -1,5 +1,5 @@
1
1
  import type { VCObserverEntry } from '../../../types';
2
- import { HeatmapCheckpointMetrics, HeatmapEntry, HeatmapOptions } from './types';
2
+ import type { HeatmapCheckpointMetrics, HeatmapEntry, HeatmapOptions } from './types';
3
3
  export default class Heatmap {
4
4
  private viewport;
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { RevisionPayloadEntry } from '../../../common/vc/types';
1
+ import type { RevisionPayloadEntry } from '../../../common/vc/types';
2
2
  import type { VCObserverEntry } from '../types';
3
3
  export type VCCalculatorParam = {
4
4
  startTime: DOMHighResTimeStamp;
@@ -1,5 +1,5 @@
1
1
  import { createPayloads } from '../create-payload';
2
- import { LabelStack } from '../interaction-context';
2
+ import { type LabelStack } from '../interaction-context';
3
3
  import { VCObserver } from '../vc/vc-observer';
4
4
  import type { AbortReasonType, ApdexType, InteractionError, InteractionType, SegmentInfo } from './common/types';
5
5
  import type { RevisionPayload } from './vc/types';
@@ -1,5 +1,5 @@
1
1
  import type { InteractionMetrics, InteractionType } from '../common';
2
- import { ResourceTiming } from '../common/react-ufo-payload-schema';
2
+ import { type ResourceTiming } from '../common/react-ufo-payload-schema';
3
3
  import * as ssr from '../ssr';
4
4
  import type { OptimizedLabelStack } from './common/types';
5
5
  export declare function createPayloads(interactionId: string, interaction: InteractionMetrics): Promise<{
@@ -1,5 +1,5 @@
1
- import { LastInteractionFinishInfo } from '../common';
2
- import { RevisionPayloadVCDetails } from '../common/vc/types';
3
- import { LateMutation } from './types';
1
+ import type { LastInteractionFinishInfo } from '../common';
2
+ import type { RevisionPayloadVCDetails } from '../common/vc/types';
3
+ import type { LateMutation } from './types';
4
4
  declare function getLateMutations(vcDetails: RevisionPayloadVCDetails, lastInteractionFinish: LastInteractionFinishInfo, postInteractionFinishVCRatios: Record<string, number>): LateMutation[];
5
5
  export default getLateMutations;
@@ -1,5 +1,5 @@
1
1
  import { type PostInteractionLogOutput } from '../common';
2
- import { LateMutation } from './types';
2
+ import type { LateMutation } from './types';
3
3
  declare function createPostInteractionLogPayload({ lastInteractionFinish, reactProfilerTimings, lastInteractionFinishVCResult, postInteractionFinishVCResult, }: PostInteractionLogOutput): {
4
4
  actionSubject: string;
5
5
  action: string;
@@ -1,4 +1,4 @@
1
- import { VCResult } from '../common/vc/types';
1
+ import type { VCResult } from '../common/vc/types';
2
2
  import type { GetVCResultType, VCObserverInterface } from './types';
3
3
  export declare class VCObserverNOOP implements VCObserverInterface {
4
4
  start(startArg: {
@@ -1,5 +1,5 @@
1
- import { InteractionMetrics } from '../../common/common/types';
2
- import { RevisionPayload } from '../../common/vc/types';
1
+ import type { InteractionMetrics } from '../../common/common/types';
2
+ import type { RevisionPayload } from '../../common/vc/types';
3
3
  import type { MultiRevisionHeatmap } from './heatmap/heatmap';
4
4
  type CalculatedVC = {
5
5
  VC: {
@@ -1,4 +1,4 @@
1
- import { RevisionPayloadEntry } from '../../common/vc/types';
1
+ import { type RevisionPayloadEntry } from '../../common/vc/types';
2
2
  import { type SelectorConfig } from './get-element-name';
3
3
  import type { VCObserverGetVCResultParam } from './types';
4
4
  export type VCObserverNewConfig = {
@@ -1,4 +1,4 @@
1
- import { RevisionPayloadEntry, VCAbortReason } from '../../../common/vc/types';
1
+ import type { RevisionPayloadEntry, VCAbortReason } from '../../../common/vc/types';
2
2
  import type { VCObserverEntry } from '../types';
3
3
  import type { VCCalculator, VCCalculatorParam } from './types';
4
4
  export default abstract class AbstractVCCalculatorBase implements VCCalculator {
@@ -1,5 +1,5 @@
1
1
  import type { VCObserverEntry } from '../../../types';
2
- import { HeatmapCheckpointMetrics, HeatmapEntry, HeatmapOptions } from './types';
2
+ import type { HeatmapCheckpointMetrics, HeatmapEntry, HeatmapOptions } from './types';
3
3
  export default class Heatmap {
4
4
  private viewport;
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { RevisionPayloadEntry } from '../../../common/vc/types';
1
+ import type { RevisionPayloadEntry } from '../../../common/vc/types';
2
2
  import type { VCObserverEntry } from '../types';
3
3
  export type VCCalculatorParam = {
4
4
  startTime: DOMHighResTimeStamp;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "3.11.1",
3
+ "version": "3.11.2",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",