@atlaskit/react-ufo 5.4.1 → 5.4.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 +7 -0
- package/dist/cjs/ignore-holds/index.js +5 -3
- package/dist/cjs/segment/segment.js +5 -3
- package/dist/cjs/segment/third-party-segment.js +4 -3
- package/dist/cjs/vc/vc-observer-new/viewport-observer/index.js +23 -18
- package/dist/es2019/ignore-holds/index.js +5 -3
- package/dist/es2019/segment/segment.js +5 -3
- package/dist/es2019/segment/third-party-segment.js +3 -2
- package/dist/es2019/vc/vc-observer-new/viewport-observer/index.js +7 -2
- package/dist/esm/ignore-holds/index.js +4 -2
- package/dist/esm/segment/segment.js +4 -2
- package/dist/esm/segment/third-party-segment.js +3 -2
- package/dist/esm/vc/vc-observer-new/viewport-observer/index.js +21 -16
- package/dist/types/ignore-holds/index.d.ts +5 -1
- package/dist/types/segment/segment.d.ts +5 -1
- package/dist/types/segment/third-party-segment.d.ts +4 -1
- package/dist/types/vc/vc-observer-new/viewport-observer/index.d.ts +1 -0
- package/dist/types-ts4.5/ignore-holds/index.d.ts +5 -1
- package/dist/types-ts4.5/segment/segment.d.ts +5 -1
- package/dist/types-ts4.5/segment/third-party-segment.d.ts +4 -1
- package/dist/types-ts4.5/vc/vc-observer-new/viewport-observer/index.d.ts +1 -0
- package/package.json +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/ufo-interaction-ignore
|
|
2
2
|
|
|
3
|
+
## 5.4.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`59746ec1f8366`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/59746ec1f8366) -
|
|
8
|
+
Bring back the displayNames that were removed from the ufo components
|
|
9
|
+
|
|
3
10
|
## 5.4.1
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default =
|
|
8
|
+
exports.default = void 0;
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _interactionContext = _interopRequireDefault(require("@atlaskit/interaction-context"));
|
|
@@ -31,7 +31,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
31
31
|
* Has an `ignore` prop, to allow you to use it conditionally
|
|
32
32
|
* Has a `reason` prop, to specify why the hold is being ignored
|
|
33
33
|
*/
|
|
34
|
-
function UFOIgnoreHolds(_ref) {
|
|
34
|
+
var UFOIgnoreHolds = function UFOIgnoreHolds(_ref) {
|
|
35
35
|
var children = _ref.children,
|
|
36
36
|
_ref$ignore = _ref.ignore,
|
|
37
37
|
ignore = _ref$ignore === void 0 ? true : _ref$ignore;
|
|
@@ -57,4 +57,6 @@ function UFOIgnoreHolds(_ref) {
|
|
|
57
57
|
return /*#__PURE__*/_react.default.createElement(_interactionContext.default.Provider, {
|
|
58
58
|
value: ignoredInteractionContext
|
|
59
59
|
}, kids);
|
|
60
|
-
}
|
|
60
|
+
};
|
|
61
|
+
UFOIgnoreHolds.displayName = 'UFOIgnoreHolds';
|
|
62
|
+
var _default = exports.default = UFOIgnoreHolds;
|
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default =
|
|
8
|
+
exports.default = void 0;
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -29,7 +29,7 @@ var tryCompleteHandle;
|
|
|
29
29
|
var hasMarkedFirstSegmentLoad = false;
|
|
30
30
|
|
|
31
31
|
/** A portion of the page we apply measurement to */
|
|
32
|
-
function UFOSegment(_ref) {
|
|
32
|
+
var UFOSegment = function UFOSegment(_ref) {
|
|
33
33
|
var segmentName = _ref.name,
|
|
34
34
|
children = _ref.children,
|
|
35
35
|
_ref$mode = _ref.mode,
|
|
@@ -301,4 +301,6 @@ function UFOSegment(_ref) {
|
|
|
301
301
|
}, ufoSegment);
|
|
302
302
|
}
|
|
303
303
|
return ufoSegment;
|
|
304
|
-
}
|
|
304
|
+
};
|
|
305
|
+
UFOSegment.displayName = 'UFOSegment';
|
|
306
|
+
var _default = exports.default = UFOSegment;
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.UFOThirdPartySegment =
|
|
7
|
+
exports.UFOThirdPartySegment = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -12,7 +12,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
12
12
|
var _ignoreHolds = _interopRequireDefault(require("../ignore-holds"));
|
|
13
13
|
var _segment = _interopRequireDefault(require("./segment"));
|
|
14
14
|
var _excluded = ["children"];
|
|
15
|
-
function UFOThirdPartySegment(props) {
|
|
15
|
+
var UFOThirdPartySegment = exports.UFOThirdPartySegment = function UFOThirdPartySegment(props) {
|
|
16
16
|
var children = props.children,
|
|
17
17
|
otherProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
18
18
|
return (0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p') ? /*#__PURE__*/_react.default.createElement(_segment.default, (0, _extends2.default)({
|
|
@@ -23,4 +23,5 @@ function UFOThirdPartySegment(props) {
|
|
|
23
23
|
ignore: (0, _platformFeatureFlags.fg)('platform_ufo_exclude_3p_elements_from_ttai'),
|
|
24
24
|
reason: "third-party-element"
|
|
25
25
|
}, children));
|
|
26
|
-
}
|
|
26
|
+
};
|
|
27
|
+
UFOThirdPartySegment.displayName = 'UFOThirdPartySegment';
|
|
@@ -19,7 +19,7 @@ var _rllPlaceholders = require("../../vc-observer/observers/rll-placeholders");
|
|
|
19
19
|
var _intersectionObserver = require("./intersection-observer");
|
|
20
20
|
var _mutationObserver = _interopRequireDefault(require("./mutation-observer"));
|
|
21
21
|
var _performanceObserver = _interopRequireDefault(require("./performance-observer"));
|
|
22
|
-
var
|
|
22
|
+
var _checkWithinComponent = _interopRequireWildcard(require("./utils/check-within-component"));
|
|
23
23
|
var _isContainedWithinSmartAnswers = require("./utils/is-contained-within-smart-answers");
|
|
24
24
|
var _isElementVisible = require("./utils/is-element-visible");
|
|
25
25
|
var _isInVcIgnoreIfNoLayoutShiftMarker = _interopRequireDefault(require("./utils/is-in-vc-ignore-if-no-layout-shift-marker"));
|
|
@@ -277,7 +277,7 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
277
277
|
_context2.prev = 4;
|
|
278
278
|
_loop = /*#__PURE__*/_regenerator.default.mark(function _loop() {
|
|
279
279
|
var _this$getSSRState, _this$intersectionObs;
|
|
280
|
-
var addedNodeRef, addedNode, hasSameDeletedNode,
|
|
280
|
+
var addedNodeRef, addedNode, hasSameDeletedNode, _ref7, isWithinThirdPartySegment, isWithinSmartAnswersSegment, isTargetReactRoot;
|
|
281
281
|
return _regenerator.default.wrap(function _loop$(_context) {
|
|
282
282
|
while (1) switch (_context.prev = _context.next) {
|
|
283
283
|
case 0:
|
|
@@ -296,7 +296,9 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
296
296
|
}
|
|
297
297
|
return n.isEqualNode(addedNode);
|
|
298
298
|
});
|
|
299
|
-
|
|
299
|
+
_ref7 = _this.enableThirdPartyTracking ? (0, _checkWithinComponent.default)(addedNode, 'UFOThirdPartySegment', _this.mapIs3pResult) : {
|
|
300
|
+
isWithin: false
|
|
301
|
+
}, isWithinThirdPartySegment = _ref7.isWithin;
|
|
300
302
|
isWithinSmartAnswersSegment = Boolean(_this.shouldCheckSmartAnswersMutations() && (0, _isContainedWithinSmartAnswers.isContainedWithinSmartAnswers)(addedNode));
|
|
301
303
|
isTargetReactRoot = targetNode === ((_this$getSSRState = _this.getSSRState) === null || _this$getSSRState === void 0 || (_this$getSSRState = _this$getSSRState.call(_this)) === null || _this$getSSRState === void 0 ? void 0 : _this$getSSRState.reactRootElement);
|
|
302
304
|
(_this$intersectionObs = _this.intersectionObserver) === null || _this$intersectionObs === void 0 || _this$intersectionObs.watchAndTag(addedNode, (_this.trackLayoutShiftOffenders ? createElementMutationsWatcherNew : createElementMutationsWatcher)(removedNodeRects, isWithinThirdPartySegment, isWithinSmartAnswersSegment, !!hasSameDeletedNode, timestamp, isTargetReactRoot, _this.getSSRState, _this.getSSRPlaceholderHandler));
|
|
@@ -343,16 +345,16 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
343
345
|
return _ref6.apply(this, arguments);
|
|
344
346
|
};
|
|
345
347
|
}());
|
|
346
|
-
(0, _defineProperty2.default)(this, "handleAttributeMutation", function (
|
|
348
|
+
(0, _defineProperty2.default)(this, "handleAttributeMutation", function (_ref8) {
|
|
347
349
|
var _this$intersectionObs2;
|
|
348
|
-
var target =
|
|
349
|
-
attributeName =
|
|
350
|
-
oldValue =
|
|
351
|
-
newValue =
|
|
352
|
-
timestamp =
|
|
353
|
-
(_this$intersectionObs2 = _this.intersectionObserver) === null || _this$intersectionObs2 === void 0 || _this$intersectionObs2.watchAndTag(target, function (
|
|
354
|
-
var target =
|
|
355
|
-
rect =
|
|
350
|
+
var target = _ref8.target,
|
|
351
|
+
attributeName = _ref8.attributeName,
|
|
352
|
+
oldValue = _ref8.oldValue,
|
|
353
|
+
newValue = _ref8.newValue,
|
|
354
|
+
timestamp = _ref8.timestamp;
|
|
355
|
+
(_this$intersectionObs2 = _this.intersectionObserver) === null || _this$intersectionObs2 === void 0 || _this$intersectionObs2.watchAndTag(target, function (_ref9) {
|
|
356
|
+
var target = _ref9.target,
|
|
357
|
+
rect = _ref9.rect;
|
|
356
358
|
if ((0, _vcUtils.isContainedWithinMediaWrapper)(target)) {
|
|
357
359
|
return {
|
|
358
360
|
type: 'mutation:media',
|
|
@@ -365,8 +367,10 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
365
367
|
};
|
|
366
368
|
}
|
|
367
369
|
if ((0, _platformFeatureFlags.fg)('platform_ufo_exclude_3p_attribute_changes')) {
|
|
368
|
-
var
|
|
369
|
-
|
|
370
|
+
var _ref0 = _this.enableThirdPartyTracking ? (0, _checkWithinComponent.default)(target, 'UFOThirdPartySegment', _this.mapIs3pResult) : {
|
|
371
|
+
isWithin: false
|
|
372
|
+
},
|
|
373
|
+
isWithinThirdPartySegment = _ref0.isWithin;
|
|
370
374
|
if (isWithinThirdPartySegment) {
|
|
371
375
|
return {
|
|
372
376
|
type: 'mutation:third-party-attribute',
|
|
@@ -471,9 +475,9 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
471
475
|
};
|
|
472
476
|
});
|
|
473
477
|
});
|
|
474
|
-
(0, _defineProperty2.default)(this, "handleLayoutShift", function (
|
|
475
|
-
var time =
|
|
476
|
-
changedRects =
|
|
478
|
+
(0, _defineProperty2.default)(this, "handleLayoutShift", function (_ref1) {
|
|
479
|
+
var time = _ref1.time,
|
|
480
|
+
changedRects = _ref1.changedRects;
|
|
477
481
|
var _iterator2 = _createForOfIteratorHelper(changedRects),
|
|
478
482
|
_step2;
|
|
479
483
|
try {
|
|
@@ -515,6 +519,7 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
515
519
|
this.getSSRState = getSSRState;
|
|
516
520
|
this.getSSRPlaceholderHandler = getSSRPlaceholderHandler;
|
|
517
521
|
this.searchPageConfig = searchPageConfig;
|
|
522
|
+
this.enableThirdPartyTracking = (0, _platformFeatureFlags.fg)('platform_ufo_reenable_3p_tracking');
|
|
518
523
|
}
|
|
519
524
|
return (0, _createClass2.default)(ViewportObserver, [{
|
|
520
525
|
key: "initializeObservers",
|
|
@@ -567,7 +572,7 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
567
572
|
(_this$performanceObse2 = this.performanceObserver) === null || _this$performanceObse2 === void 0 || _this$performanceObse2.disconnect();
|
|
568
573
|
this.isStarted = false;
|
|
569
574
|
// Clean up caches when stopping
|
|
570
|
-
(0,
|
|
575
|
+
(0, _checkWithinComponent.cleanupCaches)(this.mapIs3pResult);
|
|
571
576
|
}
|
|
572
577
|
}]);
|
|
573
578
|
}();
|
|
@@ -19,10 +19,10 @@ import InteractionContext from '@atlaskit/interaction-context';
|
|
|
19
19
|
* Has an `ignore` prop, to allow you to use it conditionally
|
|
20
20
|
* Has a `reason` prop, to specify why the hold is being ignored
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
const UFOIgnoreHolds = ({
|
|
23
23
|
children,
|
|
24
24
|
ignore = true
|
|
25
|
-
}) {
|
|
25
|
+
}) => {
|
|
26
26
|
const parentContext = useContext(InteractionContext);
|
|
27
27
|
const ignoredInteractionContext = useMemo(() => {
|
|
28
28
|
if (!parentContext) {
|
|
@@ -46,4 +46,6 @@ export default function UFOIgnoreHolds({
|
|
|
46
46
|
return /*#__PURE__*/React.createElement(InteractionContext.Provider, {
|
|
47
47
|
value: ignoredInteractionContext
|
|
48
48
|
}, kids);
|
|
49
|
-
}
|
|
49
|
+
};
|
|
50
|
+
UFOIgnoreHolds.displayName = 'UFOIgnoreHolds';
|
|
51
|
+
export default UFOIgnoreHolds;
|
|
@@ -17,12 +17,12 @@ let tryCompleteHandle;
|
|
|
17
17
|
let hasMarkedFirstSegmentLoad = false;
|
|
18
18
|
|
|
19
19
|
/** A portion of the page we apply measurement to */
|
|
20
|
-
|
|
20
|
+
const UFOSegment = ({
|
|
21
21
|
name: segmentName,
|
|
22
22
|
children,
|
|
23
23
|
mode = 'single',
|
|
24
24
|
type = 'first-party'
|
|
25
|
-
}) {
|
|
25
|
+
}) => {
|
|
26
26
|
// If UFO is disabled, render children without any tracking overhead
|
|
27
27
|
// This is gated behind platform_ufo_enable_killswitch_config feature flag
|
|
28
28
|
// Note: isUFOEnabled() returns a stable value based on config, so it's safe to call before hooks
|
|
@@ -279,4 +279,6 @@ export default function UFOSegment({
|
|
|
279
279
|
}, ufoSegment);
|
|
280
280
|
}
|
|
281
281
|
return ufoSegment;
|
|
282
|
-
}
|
|
282
|
+
};
|
|
283
|
+
UFOSegment.displayName = 'UFOSegment';
|
|
284
|
+
export default UFOSegment;
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
4
|
import UFOIgnoreHolds from '../ignore-holds';
|
|
5
5
|
import UFOSegment from './segment';
|
|
6
|
-
export
|
|
6
|
+
export const UFOThirdPartySegment = props => {
|
|
7
7
|
const {
|
|
8
8
|
children,
|
|
9
9
|
...otherProps
|
|
@@ -16,4 +16,5 @@ export function UFOThirdPartySegment(props) {
|
|
|
16
16
|
ignore: fg('platform_ufo_exclude_3p_elements_from_ttai'),
|
|
17
17
|
reason: "third-party-element"
|
|
18
18
|
}, children));
|
|
19
|
-
}
|
|
19
|
+
};
|
|
20
|
+
UFOThirdPartySegment.displayName = 'UFOThirdPartySegment';
|
|
@@ -264,7 +264,9 @@ export default class ViewportObserver {
|
|
|
264
264
|
});
|
|
265
265
|
const {
|
|
266
266
|
isWithin: isWithinThirdPartySegment
|
|
267
|
-
} = checkWithinComponent(addedNode, 'UFOThirdPartySegment', this.mapIs3pResult)
|
|
267
|
+
} = this.enableThirdPartyTracking ? checkWithinComponent(addedNode, 'UFOThirdPartySegment', this.mapIs3pResult) : {
|
|
268
|
+
isWithin: false
|
|
269
|
+
};
|
|
268
270
|
const isWithinSmartAnswersSegment = Boolean(this.shouldCheckSmartAnswersMutations() && isContainedWithinSmartAnswers(addedNode));
|
|
269
271
|
const isTargetReactRoot = targetNode === ((_this$getSSRState = this.getSSRState) === null || _this$getSSRState === void 0 ? void 0 : (_this$getSSRState$cal = _this$getSSRState.call(this)) === null || _this$getSSRState$cal === void 0 ? void 0 : _this$getSSRState$cal.reactRootElement);
|
|
270
272
|
(_this$intersectionObs = this.intersectionObserver) === null || _this$intersectionObs === void 0 ? void 0 : _this$intersectionObs.watchAndTag(addedNode, (this.trackLayoutShiftOffenders ? createElementMutationsWatcherNew : createElementMutationsWatcher)(removedNodeRects, isWithinThirdPartySegment, isWithinSmartAnswersSegment, !!hasSameDeletedNode, timestamp, isTargetReactRoot, this.getSSRState, this.getSSRPlaceholderHandler));
|
|
@@ -296,7 +298,9 @@ export default class ViewportObserver {
|
|
|
296
298
|
if (fg('platform_ufo_exclude_3p_attribute_changes')) {
|
|
297
299
|
const {
|
|
298
300
|
isWithin: isWithinThirdPartySegment
|
|
299
|
-
} = checkWithinComponent(target, 'UFOThirdPartySegment', this.mapIs3pResult)
|
|
301
|
+
} = this.enableThirdPartyTracking ? checkWithinComponent(target, 'UFOThirdPartySegment', this.mapIs3pResult) : {
|
|
302
|
+
isWithin: false
|
|
303
|
+
};
|
|
300
304
|
if (isWithinThirdPartySegment) {
|
|
301
305
|
return {
|
|
302
306
|
type: 'mutation:third-party-attribute',
|
|
@@ -437,6 +441,7 @@ export default class ViewportObserver {
|
|
|
437
441
|
this.getSSRState = getSSRState;
|
|
438
442
|
this.getSSRPlaceholderHandler = getSSRPlaceholderHandler;
|
|
439
443
|
this.searchPageConfig = searchPageConfig;
|
|
444
|
+
this.enableThirdPartyTracking = fg('platform_ufo_reenable_3p_tracking');
|
|
440
445
|
}
|
|
441
446
|
initializeObservers() {
|
|
442
447
|
if (this.isStarted) {
|
|
@@ -22,7 +22,7 @@ import InteractionContext from '@atlaskit/interaction-context';
|
|
|
22
22
|
* Has an `ignore` prop, to allow you to use it conditionally
|
|
23
23
|
* Has a `reason` prop, to specify why the hold is being ignored
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
var UFOIgnoreHolds = function UFOIgnoreHolds(_ref) {
|
|
26
26
|
var children = _ref.children,
|
|
27
27
|
_ref$ignore = _ref.ignore,
|
|
28
28
|
ignore = _ref$ignore === void 0 ? true : _ref$ignore;
|
|
@@ -48,4 +48,6 @@ export default function UFOIgnoreHolds(_ref) {
|
|
|
48
48
|
return /*#__PURE__*/React.createElement(InteractionContext.Provider, {
|
|
49
49
|
value: ignoredInteractionContext
|
|
50
50
|
}, kids);
|
|
51
|
-
}
|
|
51
|
+
};
|
|
52
|
+
UFOIgnoreHolds.displayName = 'UFOIgnoreHolds';
|
|
53
|
+
export default UFOIgnoreHolds;
|
|
@@ -21,7 +21,7 @@ var tryCompleteHandle;
|
|
|
21
21
|
var hasMarkedFirstSegmentLoad = false;
|
|
22
22
|
|
|
23
23
|
/** A portion of the page we apply measurement to */
|
|
24
|
-
|
|
24
|
+
var UFOSegment = function UFOSegment(_ref) {
|
|
25
25
|
var segmentName = _ref.name,
|
|
26
26
|
children = _ref.children,
|
|
27
27
|
_ref$mode = _ref.mode,
|
|
@@ -293,4 +293,6 @@ export default function UFOSegment(_ref) {
|
|
|
293
293
|
}, ufoSegment);
|
|
294
294
|
}
|
|
295
295
|
return ufoSegment;
|
|
296
|
-
}
|
|
296
|
+
};
|
|
297
|
+
UFOSegment.displayName = 'UFOSegment';
|
|
298
|
+
export default UFOSegment;
|
|
@@ -5,7 +5,7 @@ import React from 'react';
|
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
import UFOIgnoreHolds from '../ignore-holds';
|
|
7
7
|
import UFOSegment from './segment';
|
|
8
|
-
export function UFOThirdPartySegment(props) {
|
|
8
|
+
export var UFOThirdPartySegment = function UFOThirdPartySegment(props) {
|
|
9
9
|
var children = props.children,
|
|
10
10
|
otherProps = _objectWithoutProperties(props, _excluded);
|
|
11
11
|
return fg('platform_ufo_enable_ttai_with_3p') ? /*#__PURE__*/React.createElement(UFOSegment, _extends({
|
|
@@ -16,4 +16,5 @@ export function UFOThirdPartySegment(props) {
|
|
|
16
16
|
ignore: fg('platform_ufo_exclude_3p_elements_from_ttai'),
|
|
17
17
|
reason: "third-party-element"
|
|
18
18
|
}, children));
|
|
19
|
-
}
|
|
19
|
+
};
|
|
20
|
+
UFOThirdPartySegment.displayName = 'UFOThirdPartySegment';
|
|
@@ -268,7 +268,7 @@ var ViewportObserver = /*#__PURE__*/function () {
|
|
|
268
268
|
_context2.prev = 4;
|
|
269
269
|
_loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop() {
|
|
270
270
|
var _this$getSSRState, _this$intersectionObs;
|
|
271
|
-
var addedNodeRef, addedNode, hasSameDeletedNode,
|
|
271
|
+
var addedNodeRef, addedNode, hasSameDeletedNode, _ref7, isWithinThirdPartySegment, isWithinSmartAnswersSegment, isTargetReactRoot;
|
|
272
272
|
return _regeneratorRuntime.wrap(function _loop$(_context) {
|
|
273
273
|
while (1) switch (_context.prev = _context.next) {
|
|
274
274
|
case 0:
|
|
@@ -287,7 +287,9 @@ var ViewportObserver = /*#__PURE__*/function () {
|
|
|
287
287
|
}
|
|
288
288
|
return n.isEqualNode(addedNode);
|
|
289
289
|
});
|
|
290
|
-
|
|
290
|
+
_ref7 = _this.enableThirdPartyTracking ? checkWithinComponent(addedNode, 'UFOThirdPartySegment', _this.mapIs3pResult) : {
|
|
291
|
+
isWithin: false
|
|
292
|
+
}, isWithinThirdPartySegment = _ref7.isWithin;
|
|
291
293
|
isWithinSmartAnswersSegment = Boolean(_this.shouldCheckSmartAnswersMutations() && isContainedWithinSmartAnswers(addedNode));
|
|
292
294
|
isTargetReactRoot = targetNode === ((_this$getSSRState = _this.getSSRState) === null || _this$getSSRState === void 0 || (_this$getSSRState = _this$getSSRState.call(_this)) === null || _this$getSSRState === void 0 ? void 0 : _this$getSSRState.reactRootElement);
|
|
293
295
|
(_this$intersectionObs = _this.intersectionObserver) === null || _this$intersectionObs === void 0 || _this$intersectionObs.watchAndTag(addedNode, (_this.trackLayoutShiftOffenders ? createElementMutationsWatcherNew : createElementMutationsWatcher)(removedNodeRects, isWithinThirdPartySegment, isWithinSmartAnswersSegment, !!hasSameDeletedNode, timestamp, isTargetReactRoot, _this.getSSRState, _this.getSSRPlaceholderHandler));
|
|
@@ -334,16 +336,16 @@ var ViewportObserver = /*#__PURE__*/function () {
|
|
|
334
336
|
return _ref6.apply(this, arguments);
|
|
335
337
|
};
|
|
336
338
|
}());
|
|
337
|
-
_defineProperty(this, "handleAttributeMutation", function (
|
|
339
|
+
_defineProperty(this, "handleAttributeMutation", function (_ref8) {
|
|
338
340
|
var _this$intersectionObs2;
|
|
339
|
-
var target =
|
|
340
|
-
attributeName =
|
|
341
|
-
oldValue =
|
|
342
|
-
newValue =
|
|
343
|
-
timestamp =
|
|
344
|
-
(_this$intersectionObs2 = _this.intersectionObserver) === null || _this$intersectionObs2 === void 0 || _this$intersectionObs2.watchAndTag(target, function (
|
|
345
|
-
var target =
|
|
346
|
-
rect =
|
|
341
|
+
var target = _ref8.target,
|
|
342
|
+
attributeName = _ref8.attributeName,
|
|
343
|
+
oldValue = _ref8.oldValue,
|
|
344
|
+
newValue = _ref8.newValue,
|
|
345
|
+
timestamp = _ref8.timestamp;
|
|
346
|
+
(_this$intersectionObs2 = _this.intersectionObserver) === null || _this$intersectionObs2 === void 0 || _this$intersectionObs2.watchAndTag(target, function (_ref9) {
|
|
347
|
+
var target = _ref9.target,
|
|
348
|
+
rect = _ref9.rect;
|
|
347
349
|
if (isContainedWithinMediaWrapper(target)) {
|
|
348
350
|
return {
|
|
349
351
|
type: 'mutation:media',
|
|
@@ -356,8 +358,10 @@ var ViewportObserver = /*#__PURE__*/function () {
|
|
|
356
358
|
};
|
|
357
359
|
}
|
|
358
360
|
if (fg('platform_ufo_exclude_3p_attribute_changes')) {
|
|
359
|
-
var
|
|
360
|
-
|
|
361
|
+
var _ref0 = _this.enableThirdPartyTracking ? checkWithinComponent(target, 'UFOThirdPartySegment', _this.mapIs3pResult) : {
|
|
362
|
+
isWithin: false
|
|
363
|
+
},
|
|
364
|
+
isWithinThirdPartySegment = _ref0.isWithin;
|
|
361
365
|
if (isWithinThirdPartySegment) {
|
|
362
366
|
return {
|
|
363
367
|
type: 'mutation:third-party-attribute',
|
|
@@ -462,9 +466,9 @@ var ViewportObserver = /*#__PURE__*/function () {
|
|
|
462
466
|
};
|
|
463
467
|
});
|
|
464
468
|
});
|
|
465
|
-
_defineProperty(this, "handleLayoutShift", function (
|
|
466
|
-
var time =
|
|
467
|
-
changedRects =
|
|
469
|
+
_defineProperty(this, "handleLayoutShift", function (_ref1) {
|
|
470
|
+
var time = _ref1.time,
|
|
471
|
+
changedRects = _ref1.changedRects;
|
|
468
472
|
var _iterator2 = _createForOfIteratorHelper(changedRects),
|
|
469
473
|
_step2;
|
|
470
474
|
try {
|
|
@@ -506,6 +510,7 @@ var ViewportObserver = /*#__PURE__*/function () {
|
|
|
506
510
|
this.getSSRState = getSSRState;
|
|
507
511
|
this.getSSRPlaceholderHandler = getSSRPlaceholderHandler;
|
|
508
512
|
this.searchPageConfig = searchPageConfig;
|
|
513
|
+
this.enableThirdPartyTracking = fg('platform_ufo_reenable_3p_tracking');
|
|
509
514
|
}
|
|
510
515
|
return _createClass(ViewportObserver, [{
|
|
511
516
|
key: "initializeObservers",
|
|
@@ -24,4 +24,8 @@ export type UFOIgnoreHoldsProps = {
|
|
|
24
24
|
* Has an `ignore` prop, to allow you to use it conditionally
|
|
25
25
|
* Has a `reason` prop, to specify why the hold is being ignored
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
declare const UFOIgnoreHolds: {
|
|
28
|
+
(props: UFOIgnoreHoldsProps): React.JSX.Element;
|
|
29
|
+
displayName: string;
|
|
30
|
+
};
|
|
31
|
+
export default UFOIgnoreHolds;
|
|
@@ -7,4 +7,8 @@ export type Props = {
|
|
|
7
7
|
type?: UFOSegmentType;
|
|
8
8
|
};
|
|
9
9
|
/** A portion of the page we apply measurement to */
|
|
10
|
-
|
|
10
|
+
declare const UFOSegment: {
|
|
11
|
+
(props: Props): React.JSX.Element;
|
|
12
|
+
displayName: string;
|
|
13
|
+
};
|
|
14
|
+
export default UFOSegment;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type Props as SegmentProps } from './segment';
|
|
3
|
-
export declare
|
|
3
|
+
export declare const UFOThirdPartySegment: {
|
|
4
|
+
(props: Omit<SegmentProps, 'type'>): React.JSX.Element;
|
|
5
|
+
displayName: string;
|
|
6
|
+
};
|
|
@@ -26,6 +26,7 @@ export default class ViewportObserver {
|
|
|
26
26
|
private isStarted;
|
|
27
27
|
private trackLayoutShiftOffenders;
|
|
28
28
|
private searchPageConfig;
|
|
29
|
+
private enableThirdPartyTracking;
|
|
29
30
|
private getSSRState?;
|
|
30
31
|
private getSSRPlaceholderHandler?;
|
|
31
32
|
constructor({ onChange, getSSRState, getSSRPlaceholderHandler, trackLayoutShiftOffenders, searchPageConfig, }: ViewPortObserverConstructorArgs);
|
|
@@ -24,4 +24,8 @@ export type UFOIgnoreHoldsProps = {
|
|
|
24
24
|
* Has an `ignore` prop, to allow you to use it conditionally
|
|
25
25
|
* Has a `reason` prop, to specify why the hold is being ignored
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
declare const UFOIgnoreHolds: {
|
|
28
|
+
(props: UFOIgnoreHoldsProps): React.JSX.Element;
|
|
29
|
+
displayName: string;
|
|
30
|
+
};
|
|
31
|
+
export default UFOIgnoreHolds;
|
|
@@ -7,4 +7,8 @@ export type Props = {
|
|
|
7
7
|
type?: UFOSegmentType;
|
|
8
8
|
};
|
|
9
9
|
/** A portion of the page we apply measurement to */
|
|
10
|
-
|
|
10
|
+
declare const UFOSegment: {
|
|
11
|
+
(props: Props): React.JSX.Element;
|
|
12
|
+
displayName: string;
|
|
13
|
+
};
|
|
14
|
+
export default UFOSegment;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type Props as SegmentProps } from './segment';
|
|
3
|
-
export declare
|
|
3
|
+
export declare const UFOThirdPartySegment: {
|
|
4
|
+
(props: Omit<SegmentProps, 'type'>): React.JSX.Element;
|
|
5
|
+
displayName: string;
|
|
6
|
+
};
|
|
@@ -26,6 +26,7 @@ export default class ViewportObserver {
|
|
|
26
26
|
private isStarted;
|
|
27
27
|
private trackLayoutShiftOffenders;
|
|
28
28
|
private searchPageConfig;
|
|
29
|
+
private enableThirdPartyTracking;
|
|
29
30
|
private getSSRState?;
|
|
30
31
|
private getSSRPlaceholderHandler?;
|
|
31
32
|
constructor({ onChange, getSSRState, getSSRPlaceholderHandler, trackLayoutShiftOffenders, searchPageConfig, }: ViewPortObserverConstructorArgs);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-ufo",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.2",
|
|
4
4
|
"description": "Parts of React UFO that are publicly available",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -208,6 +208,12 @@
|
|
|
208
208
|
},
|
|
209
209
|
"ufo_update_and_enforce_ttvc_v4_default_version": {
|
|
210
210
|
"type": "boolean"
|
|
211
|
+
},
|
|
212
|
+
"platform_ufo_page_visibility_timeline": {
|
|
213
|
+
"type": "boolean"
|
|
214
|
+
},
|
|
215
|
+
"platform_ufo_reenable_3p_tracking": {
|
|
216
|
+
"type": "boolean"
|
|
211
217
|
}
|
|
212
218
|
}
|
|
213
219
|
}
|