@atlaskit/smart-card 45.2.4 → 45.2.5

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/smart-card
2
2
 
3
+ ## 45.2.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`8e8fa5c982de0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8e8fa5c982de0) -
8
+ Cleanup feature gate `platform_sl_event_ui_seen`. The new SSR card implementation using
9
+ CardErrorBoundary and the smart link seen event tracking are now permanently enabled.
10
+ - [`5960cad1ecc81`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5960cad1ecc81) -
11
+ Remove unused platform feature flag declarations (no runtime impact)
12
+ - [`ee28cf33718b0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ee28cf33718b0) -
13
+ Add @atlassian/react-compiler-gating as a runtime dependency to enable React Compiler platform
14
+ gating.
15
+ - Updated dependencies
16
+
3
17
  ## 45.2.4
4
18
 
5
19
  ### Patch Changes
package/dist/cjs/ssr.js CHANGED
@@ -9,7 +9,6 @@ exports.CardSSR = void 0;
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
11
  var _react = _interopRequireWildcard(require("react"));
12
- var _reactErrorBoundary = require("react-error-boundary");
13
12
  var _uuid = _interopRequireDefault(require("uuid"));
14
13
  var _analyticsNext = require("@atlaskit/analytics-next");
15
14
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
@@ -17,14 +16,13 @@ var _analytics = require("./utils/analytics/analytics");
17
16
  var _flexible = require("./utils/flexible");
18
17
  var _cardErrorBoundary = _interopRequireDefault(require("./view/CardWithUrl/card-error-boundary"));
19
18
  var _component = require("./view/CardWithUrl/component");
20
- var _LoadingCardLink = require("./view/CardWithUrl/component-lazy/LoadingCardLink");
21
19
  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); }
22
20
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
23
21
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
24
22
  // SSR friendly version of smart-card
25
23
  // simplifies the logic around rendering and loading placeholders and
26
24
  // only contains whats necessary to render the card on SSR mode
27
- var CardSSROld = function CardSSROld(props) {
25
+ var CardSSR = exports.CardSSR = function CardSSR(props) {
28
26
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
29
27
  var _useState = (0, _react.useState)(function () {
30
28
  var _props$id;
@@ -36,42 +34,6 @@ var CardSSROld = function CardSSROld(props) {
36
34
  // because they render custom blocks (TitleBlock etc.) requiring a complete response.
37
35
  // Override appearance to 'block' for FlexibleCards when FG is enabled.
38
36
  var effectiveAppearance = (0, _flexible.isFlexibleUiCard)(props.children, props.ui) && (0, _platformFeatureFlags.fg)('platform_smartlink_inline_resolve_optimization') ? 'block' : props.appearance;
39
- var cardProps = _objectSpread(_objectSpread({}, props), {}, {
40
- id: id,
41
- appearance: effectiveAppearance
42
- });
43
- var ErrorFallbackComponent = cardProps.fallbackComponent;
44
- var errorBoundaryFallbackComponent = function errorBoundaryFallbackComponent() {
45
- if (ErrorFallbackComponent) {
46
- return /*#__PURE__*/_react.default.createElement(ErrorFallbackComponent, null);
47
- }
48
- return /*#__PURE__*/_react.default.createElement(_LoadingCardLink.LoadingCardLink, cardProps);
49
- };
50
- var Component = effectiveAppearance === 'inline' ? 'span' : 'div';
51
- return /*#__PURE__*/_react.default.createElement(_analyticsNext.AnalyticsContext, {
52
- data: _analytics.context
53
- }, /*#__PURE__*/_react.default.createElement(_reactErrorBoundary.ErrorBoundary, {
54
- FallbackComponent: errorBoundaryFallbackComponent
55
- }, /*#__PURE__*/_react.default.createElement(Component, {
56
- className: "loader-wrapper"
57
- }, /*#__PURE__*/_react.default.createElement(_component.CardWithUrlContent, cardProps))));
58
- };
59
-
60
- // SSR friendly version of smart-card
61
- // simplifies the logic around rendering and loading placeholders and
62
- // only contains whats necessary to render the card on SSR mode
63
- var CardSSRNew = function CardSSRNew(props) {
64
- // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
65
- var _useState3 = (0, _react.useState)(function () {
66
- var _props$id2;
67
- return (_props$id2 = props.id) !== null && _props$id2 !== void 0 ? _props$id2 : (0, _uuid.default)();
68
- }),
69
- _useState4 = (0, _slicedToArray2.default)(_useState3, 1),
70
- id = _useState4[0];
71
- // FlexibleCards always need full ORS data regardless of appearance prop,
72
- // because they render custom blocks (TitleBlock etc.) requiring a complete response.
73
- // Override appearance to 'block' for FlexibleCards when FG is enabled.
74
- var effectiveAppearance = (0, _flexible.isFlexibleUiCard)(props.children, props.ui) && (0, _platformFeatureFlags.fg)('platform_smartlink_inline_resolve_optimization') ? 'block' : props.appearance;
75
37
  var propsWithId = _objectSpread(_objectSpread({}, props), {}, {
76
38
  id: id,
77
39
  appearance: effectiveAppearance
@@ -79,10 +41,4 @@ var CardSSRNew = function CardSSRNew(props) {
79
41
  return /*#__PURE__*/_react.default.createElement(_analyticsNext.AnalyticsContext, {
80
42
  data: _analytics.context
81
43
  }, /*#__PURE__*/_react.default.createElement(_cardErrorBoundary.default, propsWithId, /*#__PURE__*/_react.default.createElement(_component.CardWithUrl, propsWithId)));
82
- };
83
- var CardSSR = exports.CardSSR = function CardSSR(props) {
84
- if ((0, _platformFeatureFlags.fg)('platform_sl_event_ui_seen')) {
85
- return /*#__PURE__*/_react.default.createElement(CardSSRNew, props);
86
- }
87
- return /*#__PURE__*/_react.default.createElement(CardSSROld, props);
88
44
  };
@@ -11,7 +11,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
11
11
  var context = exports.context = {
12
12
  componentName: 'smart-cards',
13
13
  packageName: "@atlaskit/smart-card" || '',
14
- packageVersion: "45.2.3" || ''
14
+ packageVersion: "45.2.4" || ''
15
15
  };
16
16
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
17
17
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -9,7 +9,6 @@ exports.LazyIntersectionObserverCard = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
11
  var _react = _interopRequireWildcard(require("react"));
12
- var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
13
12
  var _state = require("../../../state");
14
13
  var _ufoExperiences = require("../../../state/analytics/ufoExperiences");
15
14
  var _useIntersectionObserver = _interopRequireDefault(require("../../../state/hooks/use-intersection-observer"));
@@ -19,69 +18,14 @@ var _cardLoaderWrapper = _interopRequireDefault(require("../card-loader-wrapper"
19
18
  var _component = require("../component");
20
19
  var _LoadingCardLink = require("./LoadingCardLink");
21
20
  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); }
22
- // This property enables the intersection observer to be run once the
23
- // HTML element being observed is within `X` px of the target container it is
24
- // being compared to. Since the default container is the `document`, we set this
25
- // up to check once a Smart Link is within `X` px from the bottom of the viewport.
26
- var ROOT_MARGIN_VERTICAL = '360px';
27
- function LazyIntersectionObserverCardOld(props) {
28
- var ref = (0, _react.useRef)(null);
21
+ var LazyIntersectionObserverCard = exports.LazyIntersectionObserverCard = function LazyIntersectionObserverCard(props) {
29
22
  var _useState = (0, _react.useState)(false),
30
23
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
31
- isIntersecting = _useState2[0],
32
- setIsIntersecting = _useState2[1];
24
+ isIntersected = _useState2[0],
25
+ setIsIntersected = _useState2[1];
33
26
  var _useState3 = (0, _react.useState)((0, _shouldSample.shouldSample)()),
34
27
  _useState4 = (0, _slicedToArray2.default)(_useState3, 1),
35
28
  shouldSendRenderedUFOEvent = _useState4[0];
36
- var appearance = props.appearance,
37
- url = props.url,
38
- id = props.id;
39
- var prefetch = (0, _state.usePrefetch)(url, appearance);
40
- var Component = appearance === 'inline' ? 'span' : 'div';
41
- var ComponentObserver = Component;
42
- var onIntersection = (0, _react.useCallback)(function (entries, observer) {
43
- var isVisible = entries.some(function (entry) {
44
- return entry.isIntersecting;
45
- });
46
- if (isVisible) {
47
- if (shouldSendRenderedUFOEvent) {
48
- (0, _ufoExperiences.startUfoExperience)('smart-link-rendered', id);
49
- }
50
- setIsIntersecting(true);
51
- observer.disconnect();
52
- } else {
53
- prefetch();
54
- }
55
- }, [id, prefetch, shouldSendRenderedUFOEvent]);
56
- (0, _react.useEffect)(function () {
57
- if (!ref.current) {
58
- return;
59
- }
60
- var intersectionObserver = new IntersectionObserver(onIntersection, {
61
- rootMargin: "".concat(ROOT_MARGIN_VERTICAL, " 0px ").concat(ROOT_MARGIN_VERTICAL, " 0px")
62
- });
63
- intersectionObserver.observe(ref.current);
64
- return function () {
65
- return intersectionObserver.disconnect();
66
- };
67
- }, [ref, onIntersection]);
68
- var content = isIntersecting ? /*#__PURE__*/_react.default.createElement(_component.CardWithUrlContent, props) : /*#__PURE__*/_react.default.createElement(ComponentObserver, {
69
- ref: ref
70
- }, /*#__PURE__*/_react.default.createElement(_LoadingCardLink.LoadingCardLink, props));
71
-
72
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
73
- return /*#__PURE__*/_react.default.createElement(Component, {
74
- className: "loader-wrapper"
75
- }, content);
76
- }
77
- var LazyIntersectionObserverCardNew = function LazyIntersectionObserverCardNew(props) {
78
- var _useState5 = (0, _react.useState)(false),
79
- _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
80
- isIntersected = _useState6[0],
81
- setIsIntersected = _useState6[1];
82
- var _useState7 = (0, _react.useState)((0, _shouldSample.shouldSample)()),
83
- _useState8 = (0, _slicedToArray2.default)(_useState7, 1),
84
- shouldSendRenderedUFOEvent = _useState8[0];
85
29
  var appearance = props.appearance,
86
30
  children = props.children,
87
31
  id = props.id,
@@ -127,5 +71,4 @@ var LazyIntersectionObserverCardNew = function LazyIntersectionObserverCardNew(p
127
71
  return /*#__PURE__*/_react.default.createElement(_cardLoaderWrapper.default, {
128
72
  appearance: appearance
129
73
  }, content);
130
- };
131
- var LazyIntersectionObserverCard = exports.LazyIntersectionObserverCard = (0, _platformFeatureFlagsReact.componentWithFG)('platform_sl_event_ui_seen', LazyIntersectionObserverCardNew, LazyIntersectionObserverCardOld);
74
+ };
@@ -19,7 +19,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
19
19
  _excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
20
20
  var PACKAGE_DATA = {
21
21
  packageName: "@atlaskit/smart-card",
22
- packageVersion: "45.2.3",
22
+ packageVersion: "45.2.4",
23
23
  componentName: 'linkUrl'
24
24
  };
25
25
  var LinkUrl = function LinkUrl(_ref) {
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react';
2
- import { ErrorBoundary } from 'react-error-boundary';
2
+
3
3
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
4
4
  import uuid from 'uuid';
5
5
  import { AnalyticsContext } from '@atlaskit/analytics-next';
@@ -7,12 +7,11 @@ import { fg } from '@atlaskit/platform-feature-flags';
7
7
  import { context } from './utils/analytics/analytics';
8
8
  import { isFlexibleUiCard } from './utils/flexible';
9
9
  import CardErrorBoundary from './view/CardWithUrl/card-error-boundary';
10
- import { CardWithUrl, CardWithUrlContent } from './view/CardWithUrl/component';
11
- import { LoadingCardLink } from './view/CardWithUrl/component-lazy/LoadingCardLink';
10
+ import { CardWithUrl } from './view/CardWithUrl/component';
12
11
  // SSR friendly version of smart-card
13
12
  // simplifies the logic around rendering and loading placeholders and
14
13
  // only contains whats necessary to render the card on SSR mode
15
- const CardSSROld = props => {
14
+ export const CardSSR = props => {
16
15
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
17
16
  const [id] = useState(() => {
18
17
  var _props$id;
@@ -22,41 +21,6 @@ const CardSSROld = props => {
22
21
  // because they render custom blocks (TitleBlock etc.) requiring a complete response.
23
22
  // Override appearance to 'block' for FlexibleCards when FG is enabled.
24
23
  const effectiveAppearance = isFlexibleUiCard(props.children, props.ui) && fg('platform_smartlink_inline_resolve_optimization') ? 'block' : props.appearance;
25
- const cardProps = {
26
- ...props,
27
- id,
28
- appearance: effectiveAppearance
29
- };
30
- const ErrorFallbackComponent = cardProps.fallbackComponent;
31
- const errorBoundaryFallbackComponent = () => {
32
- if (ErrorFallbackComponent) {
33
- return /*#__PURE__*/React.createElement(ErrorFallbackComponent, null);
34
- }
35
- return /*#__PURE__*/React.createElement(LoadingCardLink, cardProps);
36
- };
37
- const Component = effectiveAppearance === 'inline' ? 'span' : 'div';
38
- return /*#__PURE__*/React.createElement(AnalyticsContext, {
39
- data: context
40
- }, /*#__PURE__*/React.createElement(ErrorBoundary, {
41
- FallbackComponent: errorBoundaryFallbackComponent
42
- }, /*#__PURE__*/React.createElement(Component, {
43
- className: "loader-wrapper"
44
- }, /*#__PURE__*/React.createElement(CardWithUrlContent, cardProps))));
45
- };
46
-
47
- // SSR friendly version of smart-card
48
- // simplifies the logic around rendering and loading placeholders and
49
- // only contains whats necessary to render the card on SSR mode
50
- const CardSSRNew = props => {
51
- // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
52
- const [id] = useState(() => {
53
- var _props$id2;
54
- return (_props$id2 = props.id) !== null && _props$id2 !== void 0 ? _props$id2 : uuid();
55
- });
56
- // FlexibleCards always need full ORS data regardless of appearance prop,
57
- // because they render custom blocks (TitleBlock etc.) requiring a complete response.
58
- // Override appearance to 'block' for FlexibleCards when FG is enabled.
59
- const effectiveAppearance = isFlexibleUiCard(props.children, props.ui) && fg('platform_smartlink_inline_resolve_optimization') ? 'block' : props.appearance;
60
24
  const propsWithId = {
61
25
  ...props,
62
26
  id,
@@ -65,10 +29,4 @@ const CardSSRNew = props => {
65
29
  return /*#__PURE__*/React.createElement(AnalyticsContext, {
66
30
  data: context
67
31
  }, /*#__PURE__*/React.createElement(CardErrorBoundary, propsWithId, /*#__PURE__*/React.createElement(CardWithUrl, propsWithId)));
68
- };
69
- export const CardSSR = props => {
70
- if (fg('platform_sl_event_ui_seen')) {
71
- return /*#__PURE__*/React.createElement(CardSSRNew, props);
72
- }
73
- return /*#__PURE__*/React.createElement(CardSSROld, props);
74
32
  };
@@ -2,7 +2,7 @@ export const ANALYTICS_CHANNEL = 'media';
2
2
  export const context = {
3
3
  componentName: 'smart-cards',
4
4
  packageName: "@atlaskit/smart-card" || '',
5
- packageVersion: "45.2.3" || ''
5
+ packageVersion: "45.2.4" || ''
6
6
  };
7
7
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
8
8
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -1,6 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React, { useCallback, useEffect, useRef, useState } from 'react';
3
- import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
2
+ import React, { useCallback, useState } from 'react';
4
3
  import { usePrefetch } from '../../../state';
5
4
  import { startUfoExperience } from '../../../state/analytics/ufoExperiences';
6
5
  import useIntersectionObserver from '../../../state/hooks/use-intersection-observer';
@@ -9,56 +8,7 @@ import { shouldSample } from '../../../utils/shouldSample';
9
8
  import CardLoaderWrapper from '../card-loader-wrapper';
10
9
  import { CardWithUrlContent } from '../component';
11
10
  import { LoadingCardLink } from './LoadingCardLink';
12
-
13
- // This property enables the intersection observer to be run once the
14
- // HTML element being observed is within `X` px of the target container it is
15
- // being compared to. Since the default container is the `document`, we set this
16
- // up to check once a Smart Link is within `X` px from the bottom of the viewport.
17
- const ROOT_MARGIN_VERTICAL = '360px';
18
- function LazyIntersectionObserverCardOld(props) {
19
- const ref = useRef(null);
20
- const [isIntersecting, setIsIntersecting] = useState(false);
21
- const [shouldSendRenderedUFOEvent] = useState(shouldSample());
22
- const {
23
- appearance,
24
- url,
25
- id
26
- } = props;
27
- const prefetch = usePrefetch(url, appearance);
28
- const Component = appearance === 'inline' ? 'span' : 'div';
29
- const ComponentObserver = Component;
30
- const onIntersection = useCallback((entries, observer) => {
31
- const isVisible = entries.some(entry => entry.isIntersecting);
32
- if (isVisible) {
33
- if (shouldSendRenderedUFOEvent) {
34
- startUfoExperience('smart-link-rendered', id);
35
- }
36
- setIsIntersecting(true);
37
- observer.disconnect();
38
- } else {
39
- prefetch();
40
- }
41
- }, [id, prefetch, shouldSendRenderedUFOEvent]);
42
- useEffect(() => {
43
- if (!ref.current) {
44
- return;
45
- }
46
- const intersectionObserver = new IntersectionObserver(onIntersection, {
47
- rootMargin: `${ROOT_MARGIN_VERTICAL} 0px ${ROOT_MARGIN_VERTICAL} 0px`
48
- });
49
- intersectionObserver.observe(ref.current);
50
- return () => intersectionObserver.disconnect();
51
- }, [ref, onIntersection]);
52
- const content = isIntersecting ? /*#__PURE__*/React.createElement(CardWithUrlContent, props) : /*#__PURE__*/React.createElement(ComponentObserver, {
53
- ref: ref
54
- }, /*#__PURE__*/React.createElement(LoadingCardLink, props));
55
-
56
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
57
- return /*#__PURE__*/React.createElement(Component, {
58
- className: "loader-wrapper"
59
- }, content);
60
- }
61
- const LazyIntersectionObserverCardNew = props => {
11
+ export const LazyIntersectionObserverCard = props => {
62
12
  const [isIntersected, setIsIntersected] = useState(false);
63
13
  const [shouldSendRenderedUFOEvent] = useState(shouldSample());
64
14
  const {
@@ -109,5 +59,4 @@ const LazyIntersectionObserverCardNew = props => {
109
59
  return /*#__PURE__*/React.createElement(CardLoaderWrapper, {
110
60
  appearance: appearance
111
61
  }, content);
112
- };
113
- export const LazyIntersectionObserverCard = componentWithFG('platform_sl_event_ui_seen', LazyIntersectionObserverCardNew, LazyIntersectionObserverCardOld);
62
+ };
@@ -9,7 +9,7 @@ import LinkWarningModal from './LinkWarningModal';
9
9
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
10
10
  const PACKAGE_DATA = {
11
11
  packageName: "@atlaskit/smart-card",
12
- packageVersion: "45.2.3",
12
+ packageVersion: "45.2.4",
13
13
  componentName: 'linkUrl'
14
14
  };
15
15
  const LinkUrl = ({
package/dist/esm/ssr.js CHANGED
@@ -3,7 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  import React, { useState } from 'react';
6
- import { ErrorBoundary } from 'react-error-boundary';
6
+
7
7
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
8
8
  import uuid from 'uuid';
9
9
  import { AnalyticsContext } from '@atlaskit/analytics-next';
@@ -11,12 +11,11 @@ import { fg } from '@atlaskit/platform-feature-flags';
11
11
  import { context } from './utils/analytics/analytics';
12
12
  import { isFlexibleUiCard } from './utils/flexible';
13
13
  import CardErrorBoundary from './view/CardWithUrl/card-error-boundary';
14
- import { CardWithUrl, CardWithUrlContent } from './view/CardWithUrl/component';
15
- import { LoadingCardLink } from './view/CardWithUrl/component-lazy/LoadingCardLink';
14
+ import { CardWithUrl } from './view/CardWithUrl/component';
16
15
  // SSR friendly version of smart-card
17
16
  // simplifies the logic around rendering and loading placeholders and
18
17
  // only contains whats necessary to render the card on SSR mode
19
- var CardSSROld = function CardSSROld(props) {
18
+ export var CardSSR = function CardSSR(props) {
20
19
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
21
20
  var _useState = useState(function () {
22
21
  var _props$id;
@@ -28,42 +27,6 @@ var CardSSROld = function CardSSROld(props) {
28
27
  // because they render custom blocks (TitleBlock etc.) requiring a complete response.
29
28
  // Override appearance to 'block' for FlexibleCards when FG is enabled.
30
29
  var effectiveAppearance = isFlexibleUiCard(props.children, props.ui) && fg('platform_smartlink_inline_resolve_optimization') ? 'block' : props.appearance;
31
- var cardProps = _objectSpread(_objectSpread({}, props), {}, {
32
- id: id,
33
- appearance: effectiveAppearance
34
- });
35
- var ErrorFallbackComponent = cardProps.fallbackComponent;
36
- var errorBoundaryFallbackComponent = function errorBoundaryFallbackComponent() {
37
- if (ErrorFallbackComponent) {
38
- return /*#__PURE__*/React.createElement(ErrorFallbackComponent, null);
39
- }
40
- return /*#__PURE__*/React.createElement(LoadingCardLink, cardProps);
41
- };
42
- var Component = effectiveAppearance === 'inline' ? 'span' : 'div';
43
- return /*#__PURE__*/React.createElement(AnalyticsContext, {
44
- data: context
45
- }, /*#__PURE__*/React.createElement(ErrorBoundary, {
46
- FallbackComponent: errorBoundaryFallbackComponent
47
- }, /*#__PURE__*/React.createElement(Component, {
48
- className: "loader-wrapper"
49
- }, /*#__PURE__*/React.createElement(CardWithUrlContent, cardProps))));
50
- };
51
-
52
- // SSR friendly version of smart-card
53
- // simplifies the logic around rendering and loading placeholders and
54
- // only contains whats necessary to render the card on SSR mode
55
- var CardSSRNew = function CardSSRNew(props) {
56
- // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
57
- var _useState3 = useState(function () {
58
- var _props$id2;
59
- return (_props$id2 = props.id) !== null && _props$id2 !== void 0 ? _props$id2 : uuid();
60
- }),
61
- _useState4 = _slicedToArray(_useState3, 1),
62
- id = _useState4[0];
63
- // FlexibleCards always need full ORS data regardless of appearance prop,
64
- // because they render custom blocks (TitleBlock etc.) requiring a complete response.
65
- // Override appearance to 'block' for FlexibleCards when FG is enabled.
66
- var effectiveAppearance = isFlexibleUiCard(props.children, props.ui) && fg('platform_smartlink_inline_resolve_optimization') ? 'block' : props.appearance;
67
30
  var propsWithId = _objectSpread(_objectSpread({}, props), {}, {
68
31
  id: id,
69
32
  appearance: effectiveAppearance
@@ -71,10 +34,4 @@ var CardSSRNew = function CardSSRNew(props) {
71
34
  return /*#__PURE__*/React.createElement(AnalyticsContext, {
72
35
  data: context
73
36
  }, /*#__PURE__*/React.createElement(CardErrorBoundary, propsWithId, /*#__PURE__*/React.createElement(CardWithUrl, propsWithId)));
74
- };
75
- export var CardSSR = function CardSSR(props) {
76
- if (fg('platform_sl_event_ui_seen')) {
77
- return /*#__PURE__*/React.createElement(CardSSRNew, props);
78
- }
79
- return /*#__PURE__*/React.createElement(CardSSROld, props);
80
37
  };
@@ -4,7 +4,7 @@ export var ANALYTICS_CHANNEL = 'media';
4
4
  export var context = {
5
5
  componentName: 'smart-cards',
6
6
  packageName: "@atlaskit/smart-card" || '',
7
- packageVersion: "45.2.3" || ''
7
+ packageVersion: "45.2.4" || ''
8
8
  };
9
9
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -1,7 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
- import React, { useCallback, useEffect, useRef, useState } from 'react';
4
- import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
3
+ import React, { useCallback, useState } from 'react';
5
4
  import { usePrefetch } from '../../../state';
6
5
  import { startUfoExperience } from '../../../state/analytics/ufoExperiences';
7
6
  import useIntersectionObserver from '../../../state/hooks/use-intersection-observer';
@@ -10,70 +9,14 @@ import { shouldSample } from '../../../utils/shouldSample';
10
9
  import CardLoaderWrapper from '../card-loader-wrapper';
11
10
  import { CardWithUrlContent } from '../component';
12
11
  import { LoadingCardLink } from './LoadingCardLink';
13
-
14
- // This property enables the intersection observer to be run once the
15
- // HTML element being observed is within `X` px of the target container it is
16
- // being compared to. Since the default container is the `document`, we set this
17
- // up to check once a Smart Link is within `X` px from the bottom of the viewport.
18
- var ROOT_MARGIN_VERTICAL = '360px';
19
- function LazyIntersectionObserverCardOld(props) {
20
- var ref = useRef(null);
12
+ export var LazyIntersectionObserverCard = function LazyIntersectionObserverCard(props) {
21
13
  var _useState = useState(false),
22
14
  _useState2 = _slicedToArray(_useState, 2),
23
- isIntersecting = _useState2[0],
24
- setIsIntersecting = _useState2[1];
15
+ isIntersected = _useState2[0],
16
+ setIsIntersected = _useState2[1];
25
17
  var _useState3 = useState(shouldSample()),
26
18
  _useState4 = _slicedToArray(_useState3, 1),
27
19
  shouldSendRenderedUFOEvent = _useState4[0];
28
- var appearance = props.appearance,
29
- url = props.url,
30
- id = props.id;
31
- var prefetch = usePrefetch(url, appearance);
32
- var Component = appearance === 'inline' ? 'span' : 'div';
33
- var ComponentObserver = Component;
34
- var onIntersection = useCallback(function (entries, observer) {
35
- var isVisible = entries.some(function (entry) {
36
- return entry.isIntersecting;
37
- });
38
- if (isVisible) {
39
- if (shouldSendRenderedUFOEvent) {
40
- startUfoExperience('smart-link-rendered', id);
41
- }
42
- setIsIntersecting(true);
43
- observer.disconnect();
44
- } else {
45
- prefetch();
46
- }
47
- }, [id, prefetch, shouldSendRenderedUFOEvent]);
48
- useEffect(function () {
49
- if (!ref.current) {
50
- return;
51
- }
52
- var intersectionObserver = new IntersectionObserver(onIntersection, {
53
- rootMargin: "".concat(ROOT_MARGIN_VERTICAL, " 0px ").concat(ROOT_MARGIN_VERTICAL, " 0px")
54
- });
55
- intersectionObserver.observe(ref.current);
56
- return function () {
57
- return intersectionObserver.disconnect();
58
- };
59
- }, [ref, onIntersection]);
60
- var content = isIntersecting ? /*#__PURE__*/React.createElement(CardWithUrlContent, props) : /*#__PURE__*/React.createElement(ComponentObserver, {
61
- ref: ref
62
- }, /*#__PURE__*/React.createElement(LoadingCardLink, props));
63
-
64
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
65
- return /*#__PURE__*/React.createElement(Component, {
66
- className: "loader-wrapper"
67
- }, content);
68
- }
69
- var LazyIntersectionObserverCardNew = function LazyIntersectionObserverCardNew(props) {
70
- var _useState5 = useState(false),
71
- _useState6 = _slicedToArray(_useState5, 2),
72
- isIntersected = _useState6[0],
73
- setIsIntersected = _useState6[1];
74
- var _useState7 = useState(shouldSample()),
75
- _useState8 = _slicedToArray(_useState7, 1),
76
- shouldSendRenderedUFOEvent = _useState8[0];
77
20
  var appearance = props.appearance,
78
21
  children = props.children,
79
22
  id = props.id,
@@ -119,5 +62,4 @@ var LazyIntersectionObserverCardNew = function LazyIntersectionObserverCardNew(p
119
62
  return /*#__PURE__*/React.createElement(CardLoaderWrapper, {
120
63
  appearance: appearance
121
64
  }, content);
122
- };
123
- export var LazyIntersectionObserverCard = componentWithFG('platform_sl_event_ui_seen', LazyIntersectionObserverCardNew, LazyIntersectionObserverCardOld);
65
+ };
@@ -12,7 +12,7 @@ import LinkWarningModal from './LinkWarningModal';
12
12
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
13
13
  var PACKAGE_DATA = {
14
14
  packageName: "@atlaskit/smart-card",
15
- packageVersion: "45.2.3",
15
+ packageVersion: "45.2.4",
16
16
  componentName: 'linkUrl'
17
17
  };
18
18
  var LinkUrl = function LinkUrl(_ref) {
@@ -4,12 +4,12 @@ import type { CardProps } from './types';
4
4
  export type CardSSRProps = CardProps & {
5
5
  hideIconLoadingSkeleton?: boolean;
6
6
  placeholderData?: SmartLinkResponse;
7
- url: string;
8
7
  /**
9
8
  * Server-rendered title fallback passed through to FlexibleCard layered links.
10
9
  * On SSR we cannot reliably derive TitleBlock text from children, so this keeps
11
10
  * server/client link text aligned and avoids hydration mismatches.
12
11
  */
13
12
  title?: string;
13
+ url: string;
14
14
  };
15
15
  export declare const CardSSR: (props: CardSSRProps) => React.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "45.2.4",
3
+ "version": "45.2.5",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -56,7 +56,7 @@
56
56
  "@atlaskit/heading": "^6.0.0",
57
57
  "@atlaskit/icon": "^36.0.0",
58
58
  "@atlaskit/icon-file-type": "^8.0.0",
59
- "@atlaskit/icon-lab": "^7.0.0",
59
+ "@atlaskit/icon-lab": "^7.1.0",
60
60
  "@atlaskit/image": "^4.0.0",
61
61
  "@atlaskit/json-ld-types": "^2.0.0",
62
62
  "@atlaskit/link": "^4.0.0",
@@ -87,11 +87,12 @@
87
87
  "@atlaskit/textfield": "^9.0.0",
88
88
  "@atlaskit/theme": "^26.0.0",
89
89
  "@atlaskit/tile": "^2.0.0",
90
- "@atlaskit/tmp-editor-statsig": "^109.3.0",
91
- "@atlaskit/tokens": "^14.0.0",
90
+ "@atlaskit/tmp-editor-statsig": "^110.0.0",
91
+ "@atlaskit/tokens": "^15.0.0",
92
92
  "@atlaskit/tooltip": "^23.0.0",
93
93
  "@atlaskit/ufo": "^1.0.0",
94
94
  "@atlaskit/width-detector": "^6.0.0",
95
+ "@atlassian/react-compiler-gating": "^0.2.0",
95
96
  "@babel/runtime": "^7.0.0",
96
97
  "@compiled/react": "^0.20.0",
97
98
  "@formatjs/intl-utils": "^3.8.4",
@@ -123,7 +124,6 @@
123
124
  "@atlassian/analytics-tooling": "workspace:^",
124
125
  "@atlassian/feature-flags-test-utils": "^1.1.0",
125
126
  "@atlassian/gemini": "^1.47.0",
126
- "@atlassian/react-compiler-gating": "workspace:^",
127
127
  "@atlassian/structured-docs-types": "workspace:^",
128
128
  "@atlassian/testing-library": "^0.6.0",
129
129
  "@testing-library/dom": "^10.1.0",
@@ -176,9 +176,6 @@
176
176
  "platform_lp_use_entity_icon_url_for_icon": {
177
177
  "type": "boolean"
178
178
  },
179
- "platform-component-visual-refresh": {
180
- "type": "boolean"
181
- },
182
179
  "platform_bandicoots-smartlink-unresolved-error-key": {
183
180
  "type": "boolean"
184
181
  },
@@ -212,9 +209,6 @@
212
209
  "platform_sl_3p_auth_rovo_action_kill_switch": {
213
210
  "type": "boolean"
214
211
  },
215
- "platform_sl_event_ui_seen": {
216
- "type": "boolean"
217
- },
218
212
  "platform_sl_connect_account_flag": {
219
213
  "type": "boolean"
220
214
  },