@atlaskit/react-ufo 2.14.0 → 2.14.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 2.14.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 2.14.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#109596](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/109596)
14
+ [`496dea881c42e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/496dea881c42e) -
15
+ [AFO-3379] Make the DefaultInteractionID trully global across multiple bundles
16
+
3
17
  ## 2.14.0
4
18
 
5
19
  ### Minor Changes
@@ -5,6 +5,24 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.useInteractionId = exports.getInteractionId = exports.default = exports.DefaultInteractionID = void 0;
7
7
  var _react = require("react");
8
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
9
+ function getGlobalDefaultInteractionID() {
10
+ if (!(0, _platformFeatureFlags.fg)('platform_ufo_AFO-3379_fix_default_interaction')) {
11
+ return {
12
+ current: null
13
+ };
14
+ }
15
+ var ref = globalThis.__react_ufo__DefaultInteractionID;
16
+ if (ref) {
17
+ return ref;
18
+ }
19
+ var nextRef = {
20
+ current: null
21
+ };
22
+ globalThis.__react_ufo__DefaultInteractionID = nextRef;
23
+ return nextRef;
24
+ }
25
+
8
26
  // Same structure as react's useRef.
9
27
  // This allows modals to use a ref to scope their value
10
28
  // const id = useRef(null);
@@ -13,9 +31,7 @@ var _react = require("react");
13
31
  // The default InteractionID object is a global singleton
14
32
  // It's the one that holds the root value used in routing,
15
33
  // and is overwritten when we have new interactions start.
16
- var DefaultInteractionID = exports.DefaultInteractionID = {
17
- current: null
18
- };
34
+ var DefaultInteractionID = exports.DefaultInteractionID = getGlobalDefaultInteractionID();
19
35
 
20
36
  // We use a context to allow modals to have their own lifecycle
21
37
  var _default = exports.default = /*#__PURE__*/(0, _react.createContext)(DefaultInteractionID);
@@ -21,7 +21,11 @@ function sinkInteraction(instance, payloadPackage) {
21
21
  (0, _interactionMetrics.sinkInteractionHandler)(function (interactionId, interaction) {
22
22
  (0, _scheduler.unstable_scheduleCallback)(_scheduler.unstable_IdlePriority, function () {
23
23
  var payloads = payloadPackage.createPayloads(interactionId, interaction);
24
+ var devToolObserver = globalThis.__ufo_devtool_onUfoPayload;
24
25
  payloads === null || payloads === void 0 || payloads.forEach(function (payload) {
26
+ if (typeof devToolObserver === 'function') {
27
+ devToolObserver === null || devToolObserver === void 0 || devToolObserver(payload);
28
+ }
25
29
  instance.sendOperationalEvent(payload);
26
30
  });
27
31
  });
@@ -1,4 +1,21 @@
1
1
  import { createContext } from 'react';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
3
+ function getGlobalDefaultInteractionID() {
4
+ if (!fg('platform_ufo_AFO-3379_fix_default_interaction')) {
5
+ return {
6
+ current: null
7
+ };
8
+ }
9
+ const ref = globalThis.__react_ufo__DefaultInteractionID;
10
+ if (ref) {
11
+ return ref;
12
+ }
13
+ const nextRef = {
14
+ current: null
15
+ };
16
+ globalThis.__react_ufo__DefaultInteractionID = nextRef;
17
+ return nextRef;
18
+ }
2
19
 
3
20
  // Same structure as react's useRef.
4
21
  // This allows modals to use a ref to scope their value
@@ -8,9 +25,7 @@ import { createContext } from 'react';
8
25
  // The default InteractionID object is a global singleton
9
26
  // It's the one that holds the root value used in routing,
10
27
  // and is overwritten when we have new interactions start.
11
- export const DefaultInteractionID = {
12
- current: null
13
- };
28
+ export const DefaultInteractionID = getGlobalDefaultInteractionID();
14
29
 
15
30
  // We use a context to allow modals to have their own lifecycle
16
31
  export default /*#__PURE__*/createContext(DefaultInteractionID);
@@ -10,7 +10,11 @@ function sinkInteraction(instance, payloadPackage) {
10
10
  sinkInteractionHandler((interactionId, interaction) => {
11
11
  scheduleCallback(idlePriority, () => {
12
12
  const payloads = payloadPackage.createPayloads(interactionId, interaction);
13
+ const devToolObserver = globalThis.__ufo_devtool_onUfoPayload;
13
14
  payloads === null || payloads === void 0 ? void 0 : payloads.forEach(payload => {
15
+ if (typeof devToolObserver === 'function') {
16
+ devToolObserver === null || devToolObserver === void 0 ? void 0 : devToolObserver(payload);
17
+ }
14
18
  instance.sendOperationalEvent(payload);
15
19
  });
16
20
  });
@@ -1,4 +1,21 @@
1
1
  import { createContext } from 'react';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
3
+ function getGlobalDefaultInteractionID() {
4
+ if (!fg('platform_ufo_AFO-3379_fix_default_interaction')) {
5
+ return {
6
+ current: null
7
+ };
8
+ }
9
+ var ref = globalThis.__react_ufo__DefaultInteractionID;
10
+ if (ref) {
11
+ return ref;
12
+ }
13
+ var nextRef = {
14
+ current: null
15
+ };
16
+ globalThis.__react_ufo__DefaultInteractionID = nextRef;
17
+ return nextRef;
18
+ }
2
19
 
3
20
  // Same structure as react's useRef.
4
21
  // This allows modals to use a ref to scope their value
@@ -8,9 +25,7 @@ import { createContext } from 'react';
8
25
  // The default InteractionID object is a global singleton
9
26
  // It's the one that holds the root value used in routing,
10
27
  // and is overwritten when we have new interactions start.
11
- export var DefaultInteractionID = {
12
- current: null
13
- };
28
+ export var DefaultInteractionID = getGlobalDefaultInteractionID();
14
29
 
15
30
  // We use a context to allow modals to have their own lifecycle
16
31
  export default /*#__PURE__*/createContext(DefaultInteractionID);
@@ -11,7 +11,11 @@ function sinkInteraction(instance, payloadPackage) {
11
11
  sinkInteractionHandler(function (interactionId, interaction) {
12
12
  scheduleCallback(idlePriority, function () {
13
13
  var payloads = payloadPackage.createPayloads(interactionId, interaction);
14
+ var devToolObserver = globalThis.__ufo_devtool_onUfoPayload;
14
15
  payloads === null || payloads === void 0 || payloads.forEach(function (payload) {
16
+ if (typeof devToolObserver === 'function') {
17
+ devToolObserver === null || devToolObserver === void 0 || devToolObserver(payload);
18
+ }
15
19
  instance.sendOperationalEvent(payload);
16
20
  });
17
21
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "2.14.0",
3
+ "version": "2.14.2",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -75,11 +75,11 @@
75
75
  },
76
76
  "dependencies": {
77
77
  "@atlaskit/interaction-context": "^2.6.0",
78
- "@atlaskit/platform-feature-flags": "^0.3.0",
78
+ "@atlaskit/platform-feature-flags": "^1.0.0",
79
79
  "@babel/runtime": "^7.0.0",
80
80
  "bind-event-listener": "^3.0.0",
81
81
  "bowser-ultralight": "^1.0.6",
82
- "scheduler": "0.19.1",
82
+ "scheduler": "0.23.2",
83
83
  "uuid": "^3.1.0"
84
84
  },
85
85
  "peerDependencies": {
@@ -125,6 +125,9 @@
125
125
  }
126
126
  },
127
127
  "platform-feature-flags": {
128
+ "platform_ufo_AFO-3379_fix_default_interaction": {
129
+ "type": "boolean"
130
+ },
128
131
  "platform_editor_ed-25937_ignore_mutations_for_ttvc": {
129
132
  "type": "boolean"
130
133
  },