@atlaskit/react-ufo 3.13.15 → 3.13.16
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 +8 -0
- package/dist/cjs/interaction-id-context/index.js +2 -7
- package/dist/cjs/load-hold/UFOLoadHold.js +6 -13
- package/dist/es2019/interaction-id-context/index.js +2 -7
- package/dist/es2019/load-hold/UFOLoadHold.js +6 -13
- package/dist/esm/interaction-id-context/index.js +2 -7
- package/dist/esm/load-hold/UFOLoadHold.js +6 -13
- package/package.json +1 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/ufo-interaction-ignore
|
|
2
2
|
|
|
3
|
+
## 3.13.16
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#164300](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/164300)
|
|
8
|
+
[`cd25a7f650fa4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cd25a7f650fa4) -
|
|
9
|
+
AFO-3919 cleanup platform_ufo_hold_cross_interaction
|
|
10
|
+
|
|
3
11
|
## 3.13.15
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -9,7 +9,6 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _react = require("react");
|
|
12
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
12
|
// Same structure as react's useRef.
|
|
14
13
|
// This allows modals to use a ref to scope their value
|
|
15
14
|
// const id = useRef(null);
|
|
@@ -34,8 +33,8 @@ var ObservableInteractionID = /*#__PURE__*/function () {
|
|
|
34
33
|
var oldId = this._current;
|
|
35
34
|
this._current = newId;
|
|
36
35
|
|
|
37
|
-
// Notify all listeners if the ID actually changed
|
|
38
|
-
if (oldId !== newId
|
|
36
|
+
// Notify all listeners if the ID actually changed
|
|
37
|
+
if (oldId !== newId) {
|
|
39
38
|
listeners.forEach(function (listener) {
|
|
40
39
|
return listener(newId);
|
|
41
40
|
});
|
|
@@ -63,10 +62,6 @@ var DefaultInteractionID = exports.DefaultInteractionID = initializeGlobalDefaul
|
|
|
63
62
|
|
|
64
63
|
// Subscription functions
|
|
65
64
|
var subscribeToInteractionIdChanges = exports.subscribeToInteractionIdChanges = function subscribeToInteractionIdChanges(listener) {
|
|
66
|
-
if (!(0, _platformFeatureFlags.fg)('platform_ufo_hold_cross_interaction')) {
|
|
67
|
-
// Return a no-op unsubscribe function when feature flag is disabled
|
|
68
|
-
return function () {};
|
|
69
|
-
}
|
|
70
65
|
listeners.add(listener);
|
|
71
66
|
return function () {
|
|
72
67
|
listeners.delete(listener);
|
|
@@ -8,7 +8,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = UFOLoadHold;
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
11
|
var _interactionContext = _interopRequireDefault(require("../interaction-context"));
|
|
13
12
|
var _interactionIdContext = _interopRequireWildcard(require("../interaction-id-context"));
|
|
14
13
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
@@ -16,7 +15,7 @@ var useLayoutEffectSAFE = typeof window === 'undefined' ? _react.useEffect : _re
|
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
17
|
* Custom hook to track changes to the interaction ID.
|
|
19
|
-
* Uses a subscription system
|
|
18
|
+
* Uses a subscription system to automatically update when the interaction ID changes.
|
|
20
19
|
*/
|
|
21
20
|
function useInteractionIdValue() {
|
|
22
21
|
var interactionId = (0, _react.useContext)(_interactionIdContext.default);
|
|
@@ -25,17 +24,11 @@ function useInteractionIdValue() {
|
|
|
25
24
|
currentId = _useState2[0],
|
|
26
25
|
setCurrentId = _useState2[1];
|
|
27
26
|
useLayoutEffectSAFE(function () {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
setCurrentId(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
});
|
|
34
|
-
return unsubscribe;
|
|
35
|
-
} else {
|
|
36
|
-
// Legacy behavior - just return the current value without subscription
|
|
37
|
-
setCurrentId((interactionId === null || interactionId === void 0 ? void 0 : interactionId.current) || null);
|
|
38
|
-
}
|
|
27
|
+
setCurrentId((interactionId === null || interactionId === void 0 ? void 0 : interactionId.current) || null);
|
|
28
|
+
var unsubscribe = (0, _interactionIdContext.subscribeToInteractionIdChanges)(function (newId) {
|
|
29
|
+
setCurrentId(newId);
|
|
30
|
+
});
|
|
31
|
+
return unsubscribe;
|
|
39
32
|
}, [interactionId]);
|
|
40
33
|
return currentId;
|
|
41
34
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { createContext } from 'react';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
|
|
5
4
|
// Same structure as react's useRef.
|
|
6
5
|
// This allows modals to use a ref to scope their value
|
|
@@ -23,8 +22,8 @@ class ObservableInteractionID {
|
|
|
23
22
|
const oldId = this._current;
|
|
24
23
|
this._current = newId;
|
|
25
24
|
|
|
26
|
-
// Notify all listeners if the ID actually changed
|
|
27
|
-
if (oldId !== newId
|
|
25
|
+
// Notify all listeners if the ID actually changed
|
|
26
|
+
if (oldId !== newId) {
|
|
28
27
|
listeners.forEach(listener => listener(newId));
|
|
29
28
|
}
|
|
30
29
|
}
|
|
@@ -52,10 +51,6 @@ export const DefaultInteractionID = initializeGlobalDefaultInteractionID();
|
|
|
52
51
|
|
|
53
52
|
// Subscription functions
|
|
54
53
|
export const subscribeToInteractionIdChanges = listener => {
|
|
55
|
-
if (!fg('platform_ufo_hold_cross_interaction')) {
|
|
56
|
-
// Return a no-op unsubscribe function when feature flag is disabled
|
|
57
|
-
return () => {};
|
|
58
|
-
}
|
|
59
54
|
listeners.add(listener);
|
|
60
55
|
return () => {
|
|
61
56
|
listeners.delete(listener);
|
|
@@ -1,28 +1,21 @@
|
|
|
1
1
|
import React, { useContext, useEffect, useLayoutEffect, useState } from 'react';
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
2
|
import UFOInteractionContext from '../interaction-context';
|
|
4
3
|
import UFOInteractionIDContext, { subscribeToInteractionIdChanges } from '../interaction-id-context';
|
|
5
4
|
const useLayoutEffectSAFE = typeof window === 'undefined' ? useEffect : useLayoutEffect;
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Custom hook to track changes to the interaction ID.
|
|
9
|
-
* Uses a subscription system
|
|
8
|
+
* Uses a subscription system to automatically update when the interaction ID changes.
|
|
10
9
|
*/
|
|
11
10
|
function useInteractionIdValue() {
|
|
12
11
|
const interactionId = useContext(UFOInteractionIDContext);
|
|
13
12
|
const [currentId, setCurrentId] = useState((interactionId === null || interactionId === void 0 ? void 0 : interactionId.current) || null);
|
|
14
13
|
useLayoutEffectSAFE(() => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
setCurrentId(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
});
|
|
21
|
-
return unsubscribe;
|
|
22
|
-
} else {
|
|
23
|
-
// Legacy behavior - just return the current value without subscription
|
|
24
|
-
setCurrentId((interactionId === null || interactionId === void 0 ? void 0 : interactionId.current) || null);
|
|
25
|
-
}
|
|
14
|
+
setCurrentId((interactionId === null || interactionId === void 0 ? void 0 : interactionId.current) || null);
|
|
15
|
+
const unsubscribe = subscribeToInteractionIdChanges(newId => {
|
|
16
|
+
setCurrentId(newId);
|
|
17
|
+
});
|
|
18
|
+
return unsubscribe;
|
|
26
19
|
}, [interactionId]);
|
|
27
20
|
return currentId;
|
|
28
21
|
}
|
|
@@ -2,7 +2,6 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
import { createContext } from 'react';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
|
|
7
6
|
// Same structure as react's useRef.
|
|
8
7
|
// This allows modals to use a ref to scope their value
|
|
@@ -28,8 +27,8 @@ var ObservableInteractionID = /*#__PURE__*/function () {
|
|
|
28
27
|
var oldId = this._current;
|
|
29
28
|
this._current = newId;
|
|
30
29
|
|
|
31
|
-
// Notify all listeners if the ID actually changed
|
|
32
|
-
if (oldId !== newId
|
|
30
|
+
// Notify all listeners if the ID actually changed
|
|
31
|
+
if (oldId !== newId) {
|
|
33
32
|
listeners.forEach(function (listener) {
|
|
34
33
|
return listener(newId);
|
|
35
34
|
});
|
|
@@ -57,10 +56,6 @@ export var DefaultInteractionID = initializeGlobalDefaultInteractionID();
|
|
|
57
56
|
|
|
58
57
|
// Subscription functions
|
|
59
58
|
export var subscribeToInteractionIdChanges = function subscribeToInteractionIdChanges(listener) {
|
|
60
|
-
if (!fg('platform_ufo_hold_cross_interaction')) {
|
|
61
|
-
// Return a no-op unsubscribe function when feature flag is disabled
|
|
62
|
-
return function () {};
|
|
63
|
-
}
|
|
64
59
|
listeners.add(listener);
|
|
65
60
|
return function () {
|
|
66
61
|
listeners.delete(listener);
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import React, { useContext, useEffect, useLayoutEffect, useState } from 'react';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import UFOInteractionContext from '../interaction-context';
|
|
5
4
|
import UFOInteractionIDContext, { subscribeToInteractionIdChanges } from '../interaction-id-context';
|
|
6
5
|
var useLayoutEffectSAFE = typeof window === 'undefined' ? useEffect : useLayoutEffect;
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Custom hook to track changes to the interaction ID.
|
|
10
|
-
* Uses a subscription system
|
|
9
|
+
* Uses a subscription system to automatically update when the interaction ID changes.
|
|
11
10
|
*/
|
|
12
11
|
function useInteractionIdValue() {
|
|
13
12
|
var interactionId = useContext(UFOInteractionIDContext);
|
|
@@ -16,17 +15,11 @@ function useInteractionIdValue() {
|
|
|
16
15
|
currentId = _useState2[0],
|
|
17
16
|
setCurrentId = _useState2[1];
|
|
18
17
|
useLayoutEffectSAFE(function () {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
setCurrentId(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
25
|
-
return unsubscribe;
|
|
26
|
-
} else {
|
|
27
|
-
// Legacy behavior - just return the current value without subscription
|
|
28
|
-
setCurrentId((interactionId === null || interactionId === void 0 ? void 0 : interactionId.current) || null);
|
|
29
|
-
}
|
|
18
|
+
setCurrentId((interactionId === null || interactionId === void 0 ? void 0 : interactionId.current) || null);
|
|
19
|
+
var unsubscribe = subscribeToInteractionIdChanges(function (newId) {
|
|
20
|
+
setCurrentId(newId);
|
|
21
|
+
});
|
|
22
|
+
return unsubscribe;
|
|
30
23
|
}, [interactionId]);
|
|
31
24
|
return currentId;
|
|
32
25
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-ufo",
|
|
3
|
-
"version": "3.13.
|
|
3
|
+
"version": "3.13.16",
|
|
4
4
|
"description": "Parts of React UFO that are publicly available",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -157,9 +157,6 @@
|
|
|
157
157
|
"platform_ufo_vc_observer_new_ssr_abort_listener": {
|
|
158
158
|
"type": "boolean"
|
|
159
159
|
},
|
|
160
|
-
"platform_ufo_hold_cross_interaction": {
|
|
161
|
-
"type": "boolean"
|
|
162
|
-
},
|
|
163
160
|
"platform_ufo_rev_ratios": {
|
|
164
161
|
"type": "boolean"
|
|
165
162
|
}
|