@atlaskit/smart-card 40.13.3 → 40.14.0

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 (59) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/utils/analytics/analytics.js +1 -1
  3. package/dist/cjs/view/BlockCard/views/ResolvedView.js +4 -0
  4. package/dist/cjs/view/CardWithUrl/component.js +2 -1
  5. package/dist/cjs/view/EmbedCard/components/ImageIcon.compiled.css +1 -1
  6. package/dist/cjs/view/EmbedCard/components/ImageIcon.js +1 -1
  7. package/dist/cjs/view/FlexibleCard/components/blocks/preview-block/resolved/index.js +4 -1
  8. package/dist/cjs/view/FlexibleCard/components/common/image-icon/index.compiled.css +1 -1
  9. package/dist/cjs/view/FlexibleCard/components/common/image-icon/index.js +1 -1
  10. package/dist/cjs/view/FlexibleCard/components/elements/common/base-badge-element/index.js +9 -3
  11. package/dist/cjs/view/FlexibleCard/components/elements/media-element/index.js +6 -0
  12. package/dist/cjs/view/InlineCard/IconAndTitleLayout/index.compiled.css +1 -1
  13. package/dist/cjs/view/InlineCard/IconAndTitleLayout/index.js +24 -3
  14. package/dist/cjs/view/InlineCard/ResolvedView/index.js +5 -2
  15. package/dist/cjs/view/InlineCard/index.js +5 -2
  16. package/dist/cjs/view/LinkUrl/index.js +1 -1
  17. package/dist/es2019/utils/analytics/analytics.js +1 -1
  18. package/dist/es2019/view/BlockCard/views/ResolvedView.js +4 -0
  19. package/dist/es2019/view/CardWithUrl/component.js +2 -1
  20. package/dist/es2019/view/EmbedCard/components/ImageIcon.compiled.css +1 -1
  21. package/dist/es2019/view/EmbedCard/components/ImageIcon.js +1 -1
  22. package/dist/es2019/view/FlexibleCard/components/blocks/preview-block/resolved/index.js +5 -2
  23. package/dist/es2019/view/FlexibleCard/components/common/image-icon/index.compiled.css +1 -1
  24. package/dist/es2019/view/FlexibleCard/components/common/image-icon/index.js +1 -1
  25. package/dist/es2019/view/FlexibleCard/components/elements/common/base-badge-element/index.js +9 -3
  26. package/dist/es2019/view/FlexibleCard/components/elements/media-element/index.js +6 -0
  27. package/dist/es2019/view/InlineCard/IconAndTitleLayout/index.compiled.css +1 -1
  28. package/dist/es2019/view/InlineCard/IconAndTitleLayout/index.js +19 -4
  29. package/dist/es2019/view/InlineCard/ResolvedView/index.js +5 -2
  30. package/dist/es2019/view/InlineCard/index.js +5 -2
  31. package/dist/es2019/view/LinkUrl/index.js +1 -1
  32. package/dist/esm/utils/analytics/analytics.js +1 -1
  33. package/dist/esm/view/BlockCard/views/ResolvedView.js +4 -0
  34. package/dist/esm/view/CardWithUrl/component.js +2 -1
  35. package/dist/esm/view/EmbedCard/components/ImageIcon.compiled.css +1 -1
  36. package/dist/esm/view/EmbedCard/components/ImageIcon.js +1 -1
  37. package/dist/esm/view/FlexibleCard/components/blocks/preview-block/resolved/index.js +5 -2
  38. package/dist/esm/view/FlexibleCard/components/common/image-icon/index.compiled.css +1 -1
  39. package/dist/esm/view/FlexibleCard/components/common/image-icon/index.js +1 -1
  40. package/dist/esm/view/FlexibleCard/components/elements/common/base-badge-element/index.js +9 -3
  41. package/dist/esm/view/FlexibleCard/components/elements/media-element/index.js +6 -0
  42. package/dist/esm/view/InlineCard/IconAndTitleLayout/index.compiled.css +1 -1
  43. package/dist/esm/view/InlineCard/IconAndTitleLayout/index.js +25 -4
  44. package/dist/esm/view/InlineCard/ResolvedView/index.js +5 -2
  45. package/dist/esm/view/InlineCard/index.js +5 -2
  46. package/dist/esm/view/LinkUrl/index.js +1 -1
  47. package/dist/types/view/FlexibleCard/components/elements/common/base-badge-element/index.d.ts +10 -0
  48. package/dist/types/view/FlexibleCard/types.d.ts +4 -0
  49. package/dist/types/view/InlineCard/IconAndTitleLayout/index.d.ts +2 -1
  50. package/dist/types/view/InlineCard/ResolvedView/index.d.ts +5 -0
  51. package/dist/types/view/InlineCard/index.d.ts +1 -1
  52. package/dist/types/view/InlineCard/types.d.ts +1 -0
  53. package/dist/types-ts4.5/view/FlexibleCard/components/elements/common/base-badge-element/index.d.ts +10 -0
  54. package/dist/types-ts4.5/view/FlexibleCard/types.d.ts +4 -0
  55. package/dist/types-ts4.5/view/InlineCard/IconAndTitleLayout/index.d.ts +2 -1
  56. package/dist/types-ts4.5/view/InlineCard/ResolvedView/index.d.ts +5 -0
  57. package/dist/types-ts4.5/view/InlineCard/index.d.ts +1 -1
  58. package/dist/types-ts4.5/view/InlineCard/types.d.ts +1 -0
  59. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 40.14.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`5763f85b421a2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5763f85b421a2) - -
8
+ The new method `getCacheStatusForNode` is added to `NodeDataProvider` class to get the cache
9
+ status for a given node.
10
+ - The `CardSSR` component will start supporting `hideIconLoadingSkeleton` property for any type of
11
+ smart card.
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 40.13.3
4
18
 
5
19
  ### Patch Changes
@@ -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: "40.13.2"
14
+ packageVersion: "0.0.0-development"
15
15
  };
16
16
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
17
17
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -15,6 +15,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
15
15
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
16
16
  var _userAgent = require("@atlaskit/linking-common/user-agent");
17
17
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
18
19
  var _constants = require("../../../constants");
19
20
  var _FlexibleCard = _interopRequireDefault(require("../../FlexibleCard"));
20
21
  var _blocks = require("../../FlexibleCard/components/blocks");
@@ -75,6 +76,9 @@ var ResolvedView = function ResolvedView(_ref) {
75
76
  if ((0, _platformFeatureFlags.fg)('cc-ai-linking-platform-snippet-renderer')) {
76
77
  uiOptions.enableSnippetRenderer = true;
77
78
  }
79
+ if ((0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true)) {
80
+ uiOptions.hideLoadingSkeleton = hideIconLoadingSkeleton;
81
+ }
78
82
  return /*#__PURE__*/React.createElement(_FlexibleCard.default, {
79
83
  appearance: "block",
80
84
  cardState: cardState,
@@ -285,7 +285,8 @@ function Component(_ref) {
285
285
  actionOptions: actionOptions,
286
286
  removeTextHighlightingFromTitle: removeTextHighlightingFromTitle,
287
287
  resolvingPlaceholder: resolvingPlaceholder,
288
- truncateInline: truncateInline
288
+ truncateInline: truncateInline,
289
+ hideIconLoadingSkeleton: hideIconLoadingSkeleton
289
290
  });
290
291
  case 'block':
291
292
  return /*#__PURE__*/_react.default.createElement(_BlockCard.BlockCard, {
@@ -1 +1 @@
1
- ._2rko14q2{border-radius:var(--ds-border-radius-circle,2002pc)}
1
+ ._2rko1twn{border-radius:var(--ds-border-radius-circle,9999px)}
@@ -12,7 +12,7 @@ var _react = _interopRequireDefault(require("react"));
12
12
  var _reactRenderImage = _interopRequireDefault(require("react-render-image"));
13
13
  var _styled = require("./styled");
14
14
  var styles = {
15
- roundedImage: "_2rko14q2"
15
+ roundedImage: "_2rko1twn"
16
16
  };
17
17
  var ImageIcon = exports.ImageIcon = function ImageIcon(_ref) {
18
18
  var _ref$alt = _ref.alt,
@@ -65,7 +65,10 @@ var PreviewBlockResolvedView = function PreviewBlockResolvedView(_ref) {
65
65
  }
66
66
  }
67
67
  }, [ignoreContainerPadding, placement, style]);
68
- (0, _react.useEffect)(function () {
68
+
69
+ // Should be useLayoutEffect to avoid flicker.
70
+ // Styles should be set before paint.
71
+ (0, _react.useLayoutEffect)(function () {
69
72
  updateStyles();
70
73
  }, [ignoreContainerPadding, placement, updateStyles, className]);
71
74
  var handleOnLoad = (0, _react.useCallback)(function () {
@@ -1 +1 @@
1
- ._2rko14q2{border-radius:var(--ds-border-radius-circle,2002pc)}
1
+ ._2rko1twn{border-radius:var(--ds-border-radius-circle,9999px)}
@@ -16,7 +16,7 @@ var _reactRenderImage = _interopRequireDefault(require("react-render-image"));
16
16
  var _loadingSkeleton = require("../loading-skeleton");
17
17
  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); }
18
18
  var styles = {
19
- roundImg: "_2rko14q2"
19
+ roundImg: "_2rko1twn"
20
20
  };
21
21
  var ImageIcon = function ImageIcon(_ref) {
22
22
  var defaultIcon = _ref.defaultIcon,
@@ -12,8 +12,10 @@ var _runtime = require("@compiled/react/runtime");
12
12
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
13
  var _react = _interopRequireWildcard(require("react"));
14
14
  var _compiled = require("@atlaskit/primitives/compiled");
15
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
15
16
  var _constants = require("../../../../../../constants");
16
17
  var _messages = require("../../../../../../messages");
18
+ var _flexibleUiContext = require("../../../../../../state/flexible-ui-context");
17
19
  var _atlaskitIcon = _interopRequireDefault(require("../../../common/atlaskit-icon"));
18
20
  var _imageIcon = _interopRequireDefault(require("../../../common/image-icon"));
19
21
  var _withOverrideCss = require("../../../common/with-override-css");
@@ -50,11 +52,12 @@ var renderAtlaskitIcon = function renderAtlaskitIcon(icon, testId) {
50
52
  });
51
53
  }
52
54
  };
53
- var renderImageIcon = function renderImageIcon(url, testId) {
55
+ var renderImageIcon = function renderImageIcon(url, testId, hideLoadingSkeleton) {
54
56
  if (url) {
55
57
  return /*#__PURE__*/_react.default.createElement(_imageIcon.default, {
56
58
  testId: testId,
57
- url: url
59
+ url: url,
60
+ hideLoadingSkeleton: (0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true) && hideLoadingSkeleton
58
61
  });
59
62
  }
60
63
  };
@@ -83,8 +86,11 @@ var BaseBadgeRefreshNew = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
83
86
  testId = _ref$testId === void 0 ? 'smart-element-badge' : _ref$testId,
84
87
  url = _ref.url,
85
88
  color = _ref.color;
89
+ var ui = (0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true) ?
90
+ // eslint-disable-next-line react-hooks/rules-of-hooks
91
+ (0, _flexibleUiContext.useFlexibleUiOptionContext)() : undefined;
86
92
  var formattedMessageOrLabel = getFormattedMessageFromIcon(icon) || label;
87
- var badgeIcon = renderAtlaskitIcon(icon, testId) || renderImageIcon(url, testId);
93
+ var badgeIcon = renderAtlaskitIcon(icon, testId) || renderImageIcon(url, testId, ui === null || ui === void 0 ? void 0 : ui.hideLoadingSkeleton);
88
94
  if (!formattedMessageOrLabel || !badgeIcon) {
89
95
  return null;
90
96
  }
@@ -10,6 +10,8 @@ exports.default = void 0;
10
10
  require("./index.compiled.css");
11
11
  var React = _interopRequireWildcard(require("react"));
12
12
  var _runtime = require("@compiled/react/runtime");
13
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
14
+ var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
13
15
  var _imageIcon = _interopRequireDefault(require("../../common/image-icon"));
14
16
  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); }
15
17
  /**
@@ -37,6 +39,9 @@ var MediaElement = function MediaElement(_ref) {
37
39
  url = _ref.url,
38
40
  onLoad = _ref.onLoad,
39
41
  onError = _ref.onError;
42
+ var ui = (0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true) ?
43
+ // eslint-disable-next-line react-hooks/rules-of-hooks
44
+ (0, _flexibleUiContext.useFlexibleUiOptionContext)() : undefined;
40
45
  if (!type || !url) {
41
46
  return null;
42
47
  }
@@ -48,6 +53,7 @@ var MediaElement = function MediaElement(_ref) {
48
53
  ,
49
54
  className: (0, _runtime.ax)(["_1h1tcq2i _1e0c1txw _1bsb1osq _4t3i1ns9 _jqez1osq _1lg71osq _6slq1osq _x1m21osq _1chb1osq _1usb1osq _5c331osq _l9z01osq _6o691dfr _vr2g1dfr _173baqso _1niwaqso _t0h9stnw _1ulbstnw _byj21ooe _3hvr1ooe _1c0s1ssb _15j31ssb _1npy1ssb _19he1ssb _n3vc1wug _1qj91wug _4fdy1wug _18cv1wug _1aoq15vq _1iqz15vq _6fioj63w _l0jmidpf _12zuh2mm", className])
50
55
  }, /*#__PURE__*/React.createElement(_imageIcon.default, {
56
+ hideLoadingSkeleton: ui === null || ui === void 0 ? void 0 : ui.hideLoadingSkeleton,
51
57
  testId: "".concat(testId, "-image"),
52
58
  url: url,
53
59
  onError: onError,
@@ -1,5 +1,5 @@
1
1
  ._11c81o8v{font:var(--ds-font-body-small,normal 400 11px/1pc ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
2
- ._2rko14q2{border-radius:var(--ds-border-radius-circle,2002pc)}
2
+ ._2rko1twn{border-radius:var(--ds-border-radius-circle,9999px)}
3
3
  ._2rkogqwt{border-radius:var(--ds-border-radius-050,2px)}
4
4
  ._2rkoyh40{border-radius:2px}
5
5
  ._154i1ssb{top:50%}
@@ -10,6 +10,7 @@ exports.IconTitleWrapper = exports.IconAndTitleLayout = void 0;
10
10
  require("./index.compiled.css");
11
11
  var _react = _interopRequireWildcard(require("react"));
12
12
  var _runtime = require("@compiled/react/runtime");
13
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
14
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
14
15
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
15
16
  var _reactMagneticDi = require("react-magnetic-di");
@@ -17,6 +18,7 @@ var _reactRenderImage = _interopRequireDefault(require("react-render-image"));
17
18
  var _link = _interopRequireDefault(require("@atlaskit/icon/core/migration/link"));
18
19
  var _compiled = require("@atlaskit/primitives/compiled");
19
20
  var _colors = require("@atlaskit/theme/colors");
21
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
20
22
  var _utils = require("../../../utils");
21
23
  var _Icon = require("../Icon");
22
24
  var _excluded = ["as", "style"];
@@ -29,7 +31,7 @@ var styles = {
29
31
  iconTitleWrapperStyle: "_o5721jtm _1nmz9jpi _16d9qvcn _ca0qv77o _u5f31b66 _n3tdv77o _19bv1b66",
30
32
  linkStyle: "_2rkogqwt",
31
33
  noLinkAppearanceStyle: "_syaz131l _18u01b66",
32
- roundImageStyle: "_2rko14q2"
34
+ roundImageStyle: "_2rko1twn"
33
35
  };
34
36
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled,@atlaskit/design-system/no-html-anchor -- Ignored via go/DSP-18766
35
37
  var LinkAppearance = (0, _react.forwardRef)(function (_ref, __cmplr) {
@@ -59,7 +61,12 @@ var IconAndTitleLayout = exports.IconAndTitleLayout = function IconAndTitleLayou
59
61
  rightSide = _ref2.rightSide,
60
62
  _ref2$testId = _ref2.testId,
61
63
  testId = _ref2$testId === void 0 ? 'inline-card-icon-and-title' : _ref2$testId,
62
- type = _ref2.type;
64
+ type = _ref2.type,
65
+ hideIconLoadingSkeleton = _ref2.hideIconLoadingSkeleton;
66
+ var _useState = (0, _react.useState)(false),
67
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
68
+ hasImageErrored = _useState2[0],
69
+ setHasImageErrored = _useState2[1];
63
70
  var renderAtlaskitIcon = _react.default.useCallback(function () {
64
71
  if (emoji) {
65
72
  return emoji;
@@ -74,6 +81,20 @@ var IconAndTitleLayout = exports.IconAndTitleLayout = function IconAndTitleLayou
74
81
  if (!icon || typeof icon !== 'string') {
75
82
  return null;
76
83
  }
84
+ if ((0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true) && hideIconLoadingSkeleton) {
85
+ if (hasImageErrored) {
86
+ return errored;
87
+ }
88
+ return /*#__PURE__*/_react.default.createElement("img", {
89
+ src: icon,
90
+ "data-testid": "".concat(testId, "-image"),
91
+ alt: "",
92
+ onError: function onError() {
93
+ return setHasImageErrored(true);
94
+ },
95
+ className: (0, _runtime.ax)(["_c71l7vkz _p12f7vkz _1bsb1osq", profileType && styles.roundImageStyle])
96
+ });
97
+ }
77
98
  return /*#__PURE__*/_react.default.createElement(_reactRenderImage.default, {
78
99
  src: icon,
79
100
  loaded: /*#__PURE__*/_react.default.createElement("img", {
@@ -87,7 +108,7 @@ var IconAndTitleLayout = exports.IconAndTitleLayout = function IconAndTitleLayou
87
108
  testId: "".concat(testId, "-loading")
88
109
  })
89
110
  });
90
- }, [icon, profileType]);
111
+ }, [icon, profileType, hideIconLoadingSkeleton, hasImageErrored]);
91
112
  var renderIconPlaceholder = _react.default.useCallback(function (testId) {
92
113
  return defaultIcon || /*#__PURE__*/_react.default.createElement(_link.default, {
93
114
  label: "link",
@@ -12,6 +12,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
12
12
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
13
  var _react = _interopRequireDefault(require("react"));
14
14
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
15
16
  var _HoverCard = require("../../HoverCard");
16
17
  var _inlineLozenge = _interopRequireDefault(require("../common/inline-lozenge"));
17
18
  var _Frame = require("../Frame");
@@ -64,7 +65,8 @@ var InlineCardResolvedView = exports.InlineCardResolvedView = /*#__PURE__*/funct
64
65
  hoverPreviewOptions = _this$props.hoverPreviewOptions,
65
66
  actionOptions = _this$props.actionOptions,
66
67
  truncateInline = _this$props.truncateInline,
67
- type = _this$props.type;
68
+ type = _this$props.type,
69
+ hideIconLoadingSkeleton = _this$props.hideIconLoadingSkeleton;
68
70
  var inlineCardResolvedView = /*#__PURE__*/_react.default.createElement(_Frame.Frame, {
69
71
  testId: testId,
70
72
  link: link,
@@ -77,7 +79,8 @@ var InlineCardResolvedView = exports.InlineCardResolvedView = /*#__PURE__*/funct
77
79
  icon: icon,
78
80
  title: title,
79
81
  titleTextColor: titleTextColor,
80
- type: type
82
+ type: type,
83
+ hideIconLoadingSkeleton: (0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true) && hideIconLoadingSkeleton
81
84
  }), this.renderLozenge());
82
85
  if (showHoverPreview && link) {
83
86
  return /*#__PURE__*/_react.default.createElement(_HoverCard.HoverCard, {
@@ -42,6 +42,7 @@ var _analyticsNext = require("@atlaskit/analytics-next");
42
42
  var _linkExtractors = require("@atlaskit/link-extractors");
43
43
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
44
44
  var _loadHold = _interopRequireDefault(require("@atlaskit/react-ufo/load-hold"));
45
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
45
46
  var _constants = require("../../constants");
46
47
  var _extractAccessContext = require("../../extractors/common/context/extractAccessContext");
47
48
  var _inline = require("../../extractors/inline");
@@ -82,7 +83,8 @@ var InlineCard = exports.InlineCard = function InlineCard(_ref2) {
82
83
  actionOptions = _ref2.actionOptions,
83
84
  removeTextHighlightingFromTitle = _ref2.removeTextHighlightingFromTitle,
84
85
  resolvingPlaceholder = _ref2.resolvingPlaceholder,
85
- truncateInline = _ref2.truncateInline;
86
+ truncateInline = _ref2.truncateInline,
87
+ hideIconLoadingSkeleton = _ref2.hideIconLoadingSkeleton;
86
88
  var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
87
89
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
88
90
  var status = cardState.status,
@@ -135,7 +137,8 @@ var InlineCard = exports.InlineCard = function InlineCard(_ref2) {
135
137
  isHovered: isHovered,
136
138
  onClick: handleFrameClick,
137
139
  testId: testIdWithStatus,
138
- truncateInline: truncateInline
140
+ truncateInline: truncateInline,
141
+ hideIconLoadingSkeleton: (0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true) && hideIconLoadingSkeleton
139
142
  }));
140
143
  case 'unauthorized':
141
144
  var provider = (0, _linkExtractors.extractSmartLinkProvider)(details);
@@ -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: "40.13.2",
22
+ packageVersion: "0.0.0-development",
23
23
  componentName: 'linkUrl'
24
24
  };
25
25
  var Anchor = (0, _click.withLinkClickedEvent)('a');
@@ -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: "40.13.2"
5
+ packageVersion: "0.0.0-development"
6
6
  };
7
7
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
8
8
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -6,6 +6,7 @@ import { ax, ix } from "@compiled/react/runtime";
6
6
  import { useEffect, useMemo, useState } from 'react';
7
7
  import { browser } from '@atlaskit/linking-common/user-agent';
8
8
  import { fg } from '@atlaskit/platform-feature-flags';
9
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
9
10
  import { ActionName, ElementName, SmartLinkPosition } from '../../../constants';
10
11
  import FlexibleCard from '../../FlexibleCard';
11
12
  import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock, TitleBlock } from '../../FlexibleCard/components/blocks';
@@ -59,6 +60,9 @@ const ResolvedView = ({
59
60
  if (fg('cc-ai-linking-platform-snippet-renderer')) {
60
61
  uiOptions.enableSnippetRenderer = true;
61
62
  }
63
+ if (expValEquals('platform_editor_smart_card_otp', 'isEnabled', true)) {
64
+ uiOptions.hideLoadingSkeleton = hideIconLoadingSkeleton;
65
+ }
62
66
  return /*#__PURE__*/React.createElement(FlexibleCard, {
63
67
  appearance: "block",
64
68
  cardState: cardState,
@@ -274,7 +274,8 @@ function Component({
274
274
  actionOptions: actionOptions,
275
275
  removeTextHighlightingFromTitle: removeTextHighlightingFromTitle,
276
276
  resolvingPlaceholder: resolvingPlaceholder,
277
- truncateInline: truncateInline
277
+ truncateInline: truncateInline,
278
+ hideIconLoadingSkeleton: hideIconLoadingSkeleton
278
279
  });
279
280
  case 'block':
280
281
  return /*#__PURE__*/React.createElement(BlockCard, {
@@ -1 +1 @@
1
- ._2rko14q2{border-radius:var(--ds-border-radius-circle,2002pc)}
1
+ ._2rko1twn{border-radius:var(--ds-border-radius-circle,9999px)}
@@ -5,7 +5,7 @@ import React from 'react';
5
5
  import ImageLoader from 'react-render-image';
6
6
  import { Image } from './styled';
7
7
  const styles = {
8
- roundedImage: "_2rko14q2"
8
+ roundedImage: "_2rko1twn"
9
9
  };
10
10
  export const ImageIcon = ({
11
11
  alt = '',
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
3
3
  import "./index.compiled.css";
4
4
  import * as React from 'react';
5
5
  import { ax, ix } from "@compiled/react/runtime";
6
- import { useCallback, useEffect, useState } from 'react';
6
+ import { useCallback, useLayoutEffect, useState } from 'react';
7
7
  import { MediaPlacement } from '../../../../../../constants';
8
8
  import { Preview } from '../../../elements';
9
9
  import Block from '../../block';
@@ -52,7 +52,10 @@ const PreviewBlockResolvedView = ({
52
52
  }
53
53
  }
54
54
  }, [ignoreContainerPadding, placement, style]);
55
- useEffect(() => {
55
+
56
+ // Should be useLayoutEffect to avoid flicker.
57
+ // Styles should be set before paint.
58
+ useLayoutEffect(() => {
56
59
  updateStyles();
57
60
  }, [ignoreContainerPadding, placement, updateStyles, className]);
58
61
  const handleOnLoad = useCallback(() => {
@@ -1 +1 @@
1
- ._2rko14q2{border-radius:var(--ds-border-radius-circle,2002pc)}
1
+ ._2rko1twn{border-radius:var(--ds-border-radius-circle,9999px)}
@@ -6,7 +6,7 @@ import { useEffect, useState } from 'react';
6
6
  import ImageLoader from 'react-render-image';
7
7
  import { LoadingSkeleton } from '../loading-skeleton';
8
8
  const styles = {
9
- roundImg: "_2rko14q2"
9
+ roundImg: "_2rko1twn"
10
10
  };
11
11
  const ImageIcon = ({
12
12
  defaultIcon,
@@ -4,8 +4,10 @@ import "./index.compiled.css";
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
5
  import React, { forwardRef } from 'react';
6
6
  import { Box } from '@atlaskit/primitives/compiled';
7
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
8
  import { IconType } from '../../../../../../constants';
8
9
  import { messages } from '../../../../../../messages';
10
+ import { useFlexibleUiOptionContext } from '../../../../../../state/flexible-ui-context';
9
11
  import AtlaskitIcon from '../../../common/atlaskit-icon';
10
12
  import ImageIcon from '../../../common/image-icon';
11
13
  import { withOverrideCss } from '../../../common/with-override-css';
@@ -51,11 +53,12 @@ const renderAtlaskitIcon = (icon, testId) => {
51
53
  });
52
54
  }
53
55
  };
54
- const renderImageIcon = (url, testId) => {
56
+ const renderImageIcon = (url, testId, hideLoadingSkeleton) => {
55
57
  if (url) {
56
58
  return /*#__PURE__*/React.createElement(ImageIcon, {
57
59
  testId: testId,
58
- url: url
60
+ url: url,
61
+ hideLoadingSkeleton: expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) && hideLoadingSkeleton
59
62
  });
60
63
  }
61
64
  };
@@ -82,8 +85,11 @@ const BaseBadgeRefreshNew = /*#__PURE__*/forwardRef(({
82
85
  url,
83
86
  color
84
87
  }, ref) => {
88
+ const ui = expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) ?
89
+ // eslint-disable-next-line react-hooks/rules-of-hooks
90
+ useFlexibleUiOptionContext() : undefined;
85
91
  const formattedMessageOrLabel = getFormattedMessageFromIcon(icon) || label;
86
- const badgeIcon = renderAtlaskitIcon(icon, testId) || renderImageIcon(url, testId);
92
+ const badgeIcon = renderAtlaskitIcon(icon, testId) || renderImageIcon(url, testId, ui === null || ui === void 0 ? void 0 : ui.hideLoadingSkeleton);
87
93
  if (!formattedMessageOrLabel || !badgeIcon) {
88
94
  return null;
89
95
  }
@@ -2,6 +2,8 @@
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
6
+ import { useFlexibleUiOptionContext } from '../../../../../state/flexible-ui-context';
5
7
  import ImageIcon from '../../common/image-icon';
6
8
  /**
7
9
  * Media: Image
@@ -28,6 +30,9 @@ const MediaElement = ({
28
30
  onLoad,
29
31
  onError
30
32
  }) => {
33
+ const ui = expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) ?
34
+ // eslint-disable-next-line react-hooks/rules-of-hooks
35
+ useFlexibleUiOptionContext() : undefined;
31
36
  if (!type || !url) {
32
37
  return null;
33
38
  }
@@ -39,6 +44,7 @@ const MediaElement = ({
39
44
  ,
40
45
  className: ax(["_1h1tcq2i _1e0c1txw _1bsb1osq _4t3i1ns9 _jqez1osq _1lg71osq _6slq1osq _x1m21osq _1chb1osq _1usb1osq _5c331osq _l9z01osq _6o691dfr _vr2g1dfr _173baqso _1niwaqso _t0h9stnw _1ulbstnw _byj21ooe _3hvr1ooe _1c0s1ssb _15j31ssb _1npy1ssb _19he1ssb _n3vc1wug _1qj91wug _4fdy1wug _18cv1wug _1aoq15vq _1iqz15vq _6fioj63w _l0jmidpf _12zuh2mm", className])
41
46
  }, /*#__PURE__*/React.createElement(ImageIcon, {
47
+ hideLoadingSkeleton: ui === null || ui === void 0 ? void 0 : ui.hideLoadingSkeleton,
42
48
  testId: `${testId}-image`,
43
49
  url: url,
44
50
  onError: onError,
@@ -1,5 +1,5 @@
1
1
  ._11c81o8v{font:var(--ds-font-body-small,normal 400 11px/1pc ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
2
- ._2rko14q2{border-radius:var(--ds-border-radius-circle,2002pc)}
2
+ ._2rko1twn{border-radius:var(--ds-border-radius-circle,9999px)}
3
3
  ._2rkogqwt{border-radius:var(--ds-border-radius-050,2px)}
4
4
  ._2rkoyh40{border-radius:2px}
5
5
  ._154i1ssb{top:50%}
@@ -3,12 +3,13 @@ import _extends from "@babel/runtime/helpers/extends";
3
3
  import "./index.compiled.css";
4
4
  import { forwardRef } from 'react';
5
5
  import { ax, ix } from "@compiled/react/runtime";
6
- import React from 'react';
6
+ import React, { useState } from 'react';
7
7
  import { di } from 'react-magnetic-di';
8
8
  import ImageLoader from 'react-render-image';
9
9
  import LinkIcon from '@atlaskit/icon/core/migration/link';
10
10
  import { Box } from '@atlaskit/primitives/compiled';
11
11
  import { B400 } from '@atlaskit/theme/colors';
12
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
12
13
  import { isProfileType } from '../../../utils';
13
14
  import { Shimmer } from '../Icon';
14
15
  const iconWrapperStyle = null;
@@ -19,7 +20,7 @@ const styles = {
19
20
  iconTitleWrapperStyle: "_o5721jtm _1nmz9jpi _16d9qvcn _ca0qv77o _u5f31b66 _n3tdv77o _19bv1b66",
20
21
  linkStyle: "_2rkogqwt",
21
22
  noLinkAppearanceStyle: "_syaz131l _18u01b66",
22
- roundImageStyle: "_2rko14q2"
23
+ roundImageStyle: "_2rko1twn"
23
24
  };
24
25
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled,@atlaskit/design-system/no-html-anchor -- Ignored via go/DSP-18766
25
26
  const LinkAppearance = forwardRef(({
@@ -48,8 +49,10 @@ export const IconAndTitleLayout = ({
48
49
  link,
49
50
  rightSide,
50
51
  testId = 'inline-card-icon-and-title',
51
- type
52
+ type,
53
+ hideIconLoadingSkeleton
52
54
  }) => {
55
+ const [hasImageErrored, setHasImageErrored] = useState(false);
53
56
  const renderAtlaskitIcon = React.useCallback(() => {
54
57
  if (emoji) {
55
58
  return emoji;
@@ -64,6 +67,18 @@ export const IconAndTitleLayout = ({
64
67
  if (!icon || typeof icon !== 'string') {
65
68
  return null;
66
69
  }
70
+ if (expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) && hideIconLoadingSkeleton) {
71
+ if (hasImageErrored) {
72
+ return errored;
73
+ }
74
+ return /*#__PURE__*/React.createElement("img", {
75
+ src: icon,
76
+ "data-testid": `${testId}-image`,
77
+ alt: "",
78
+ onError: () => setHasImageErrored(true),
79
+ className: ax(["_c71l7vkz _p12f7vkz _1bsb1osq", profileType && styles.roundImageStyle])
80
+ });
81
+ }
67
82
  return /*#__PURE__*/React.createElement(ImageLoader, {
68
83
  src: icon,
69
84
  loaded: /*#__PURE__*/React.createElement("img", {
@@ -77,7 +92,7 @@ export const IconAndTitleLayout = ({
77
92
  testId: `${testId}-loading`
78
93
  })
79
94
  });
80
- }, [icon, profileType]);
95
+ }, [icon, profileType, hideIconLoadingSkeleton, hasImageErrored]);
81
96
  const renderIconPlaceholder = React.useCallback(testId => {
82
97
  return defaultIcon || /*#__PURE__*/React.createElement(LinkIcon, {
83
98
  label: "link",
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { fg } from '@atlaskit/platform-feature-flags';
3
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
3
4
  import { HoverCard } from '../../HoverCard';
4
5
  import InlineLozenge from '../common/inline-lozenge';
5
6
  import { Frame } from '../Frame';
@@ -40,7 +41,8 @@ export class InlineCardResolvedView extends React.Component {
40
41
  hoverPreviewOptions,
41
42
  actionOptions,
42
43
  truncateInline,
43
- type
44
+ type,
45
+ hideIconLoadingSkeleton
44
46
  } = this.props;
45
47
  const inlineCardResolvedView = /*#__PURE__*/React.createElement(Frame, {
46
48
  testId: testId,
@@ -54,7 +56,8 @@ export class InlineCardResolvedView extends React.Component {
54
56
  icon: icon,
55
57
  title: title,
56
58
  titleTextColor: titleTextColor,
57
- type: type
59
+ type: type,
60
+ hideIconLoadingSkeleton: expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) && hideIconLoadingSkeleton
58
61
  }), this.renderLozenge());
59
62
  if (showHoverPreview && link) {
60
63
  return /*#__PURE__*/React.createElement(HoverCard, {
@@ -6,6 +6,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
6
6
  // TODO: Package Owner - please fix:
7
7
  // eslint-disable-next-line import/no-extraneous-dependencies
8
8
  import UFOHoldLoad from '@atlaskit/react-ufo/load-hold';
9
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
9
10
  import { SmartLinkStatus } from '../../constants';
10
11
  import { extractRequestAccessContextImproved } from '../../extractors/common/context/extractAccessContext';
11
12
  import { extractInlineProps } from '../../extractors/inline';
@@ -43,7 +44,8 @@ export const InlineCard = ({
43
44
  actionOptions,
44
45
  removeTextHighlightingFromTitle,
45
46
  resolvingPlaceholder,
46
- truncateInline
47
+ truncateInline,
48
+ hideIconLoadingSkeleton
47
49
  }) => {
48
50
  var _details$meta, _providerForbidden$te;
49
51
  const {
@@ -101,7 +103,8 @@ export const InlineCard = ({
101
103
  isHovered: isHovered,
102
104
  onClick: handleFrameClick,
103
105
  testId: testIdWithStatus,
104
- truncateInline: truncateInline
106
+ truncateInline: truncateInline,
107
+ hideIconLoadingSkeleton: expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) && hideIconLoadingSkeleton
105
108
  }));
106
109
  case 'unauthorized':
107
110
  const provider = extractSmartLinkProvider(details);
@@ -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: "40.13.2",
12
+ packageVersion: "0.0.0-development",
13
13
  componentName: 'linkUrl'
14
14
  };
15
15
  const Anchor = withLinkClickedEvent('a');
@@ -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: "40.13.2"
7
+ packageVersion: "0.0.0-development"
8
8
  };
9
9
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -7,6 +7,7 @@ import { ax, ix } from "@compiled/react/runtime";
7
7
  import { useEffect, useMemo, useState } from 'react';
8
8
  import { browser } from '@atlaskit/linking-common/user-agent';
9
9
  import { fg } from '@atlaskit/platform-feature-flags';
10
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
10
11
  import { ActionName, ElementName, SmartLinkPosition } from '../../../constants';
11
12
  import FlexibleCard from '../../FlexibleCard';
12
13
  import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock, TitleBlock } from '../../FlexibleCard/components/blocks';
@@ -66,6 +67,9 @@ var ResolvedView = function ResolvedView(_ref) {
66
67
  if (fg('cc-ai-linking-platform-snippet-renderer')) {
67
68
  uiOptions.enableSnippetRenderer = true;
68
69
  }
70
+ if (expValEquals('platform_editor_smart_card_otp', 'isEnabled', true)) {
71
+ uiOptions.hideLoadingSkeleton = hideIconLoadingSkeleton;
72
+ }
69
73
  return /*#__PURE__*/React.createElement(FlexibleCard, {
70
74
  appearance: "block",
71
75
  cardState: cardState,
@@ -276,7 +276,8 @@ function Component(_ref) {
276
276
  actionOptions: actionOptions,
277
277
  removeTextHighlightingFromTitle: removeTextHighlightingFromTitle,
278
278
  resolvingPlaceholder: resolvingPlaceholder,
279
- truncateInline: truncateInline
279
+ truncateInline: truncateInline,
280
+ hideIconLoadingSkeleton: hideIconLoadingSkeleton
280
281
  });
281
282
  case 'block':
282
283
  return /*#__PURE__*/React.createElement(BlockCard, {
@@ -1 +1 @@
1
- ._2rko14q2{border-radius:var(--ds-border-radius-circle,2002pc)}
1
+ ._2rko1twn{border-radius:var(--ds-border-radius-circle,9999px)}
@@ -5,7 +5,7 @@ import React from 'react';
5
5
  import ImageLoader from 'react-render-image';
6
6
  import { Image } from './styled';
7
7
  var styles = {
8
- roundedImage: "_2rko14q2"
8
+ roundedImage: "_2rko1twn"
9
9
  };
10
10
  export var ImageIcon = function ImageIcon(_ref) {
11
11
  var _ref$alt = _ref.alt,
@@ -9,7 +9,7 @@ import * as React from 'react';
9
9
  import { ax, ix } from "@compiled/react/runtime";
10
10
  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; }
11
11
  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; }
12
- import { useCallback, useEffect, useState } from 'react';
12
+ import { useCallback, useLayoutEffect, useState } from 'react';
13
13
  import { MediaPlacement } from '../../../../../../constants';
14
14
  import { Preview } from '../../../elements';
15
15
  import Block from '../../block';
@@ -56,7 +56,10 @@ var PreviewBlockResolvedView = function PreviewBlockResolvedView(_ref) {
56
56
  }
57
57
  }
58
58
  }, [ignoreContainerPadding, placement, style]);
59
- useEffect(function () {
59
+
60
+ // Should be useLayoutEffect to avoid flicker.
61
+ // Styles should be set before paint.
62
+ useLayoutEffect(function () {
60
63
  updateStyles();
61
64
  }, [ignoreContainerPadding, placement, updateStyles, className]);
62
65
  var handleOnLoad = useCallback(function () {
@@ -1 +1 @@
1
- ._2rko14q2{border-radius:var(--ds-border-radius-circle,2002pc)}
1
+ ._2rko1twn{border-radius:var(--ds-border-radius-circle,9999px)}
@@ -7,7 +7,7 @@ import { useEffect, useState } from 'react';
7
7
  import ImageLoader from 'react-render-image';
8
8
  import { LoadingSkeleton } from '../loading-skeleton';
9
9
  var styles = {
10
- roundImg: "_2rko14q2"
10
+ roundImg: "_2rko1twn"
11
11
  };
12
12
  var ImageIcon = function ImageIcon(_ref) {
13
13
  var defaultIcon = _ref.defaultIcon,
@@ -7,8 +7,10 @@ import { ax, ix } from "@compiled/react/runtime";
7
7
 
8
8
  import React, { forwardRef } from 'react';
9
9
  import { Box } from '@atlaskit/primitives/compiled';
10
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
10
11
  import { IconType } from '../../../../../../constants';
11
12
  import { messages } from '../../../../../../messages';
13
+ import { useFlexibleUiOptionContext } from '../../../../../../state/flexible-ui-context';
12
14
  import AtlaskitIcon from '../../../common/atlaskit-icon';
13
15
  import ImageIcon from '../../../common/image-icon';
14
16
  import { withOverrideCss } from '../../../common/with-override-css';
@@ -42,11 +44,12 @@ var renderAtlaskitIcon = function renderAtlaskitIcon(icon, testId) {
42
44
  });
43
45
  }
44
46
  };
45
- var renderImageIcon = function renderImageIcon(url, testId) {
47
+ var renderImageIcon = function renderImageIcon(url, testId, hideLoadingSkeleton) {
46
48
  if (url) {
47
49
  return /*#__PURE__*/React.createElement(ImageIcon, {
48
50
  testId: testId,
49
- url: url
51
+ url: url,
52
+ hideLoadingSkeleton: expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) && hideLoadingSkeleton
50
53
  });
51
54
  }
52
55
  };
@@ -75,8 +78,11 @@ var BaseBadgeRefreshNew = /*#__PURE__*/forwardRef(function (_ref, ref) {
75
78
  testId = _ref$testId === void 0 ? 'smart-element-badge' : _ref$testId,
76
79
  url = _ref.url,
77
80
  color = _ref.color;
81
+ var ui = expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) ?
82
+ // eslint-disable-next-line react-hooks/rules-of-hooks
83
+ useFlexibleUiOptionContext() : undefined;
78
84
  var formattedMessageOrLabel = getFormattedMessageFromIcon(icon) || label;
79
- var badgeIcon = renderAtlaskitIcon(icon, testId) || renderImageIcon(url, testId);
85
+ var badgeIcon = renderAtlaskitIcon(icon, testId) || renderImageIcon(url, testId, ui === null || ui === void 0 ? void 0 : ui.hideLoadingSkeleton);
80
86
  if (!formattedMessageOrLabel || !badgeIcon) {
81
87
  return null;
82
88
  }
@@ -2,6 +2,8 @@
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
6
+ import { useFlexibleUiOptionContext } from '../../../../../state/flexible-ui-context';
5
7
  import ImageIcon from '../../common/image-icon';
6
8
  /**
7
9
  * Media: Image
@@ -28,6 +30,9 @@ var MediaElement = function MediaElement(_ref) {
28
30
  url = _ref.url,
29
31
  onLoad = _ref.onLoad,
30
32
  onError = _ref.onError;
33
+ var ui = expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) ?
34
+ // eslint-disable-next-line react-hooks/rules-of-hooks
35
+ useFlexibleUiOptionContext() : undefined;
31
36
  if (!type || !url) {
32
37
  return null;
33
38
  }
@@ -39,6 +44,7 @@ var MediaElement = function MediaElement(_ref) {
39
44
  ,
40
45
  className: ax(["_1h1tcq2i _1e0c1txw _1bsb1osq _4t3i1ns9 _jqez1osq _1lg71osq _6slq1osq _x1m21osq _1chb1osq _1usb1osq _5c331osq _l9z01osq _6o691dfr _vr2g1dfr _173baqso _1niwaqso _t0h9stnw _1ulbstnw _byj21ooe _3hvr1ooe _1c0s1ssb _15j31ssb _1npy1ssb _19he1ssb _n3vc1wug _1qj91wug _4fdy1wug _18cv1wug _1aoq15vq _1iqz15vq _6fioj63w _l0jmidpf _12zuh2mm", className])
41
46
  }, /*#__PURE__*/React.createElement(ImageIcon, {
47
+ hideLoadingSkeleton: ui === null || ui === void 0 ? void 0 : ui.hideLoadingSkeleton,
42
48
  testId: "".concat(testId, "-image"),
43
49
  url: url,
44
50
  onError: onError,
@@ -1,5 +1,5 @@
1
1
  ._11c81o8v{font:var(--ds-font-body-small,normal 400 11px/1pc ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
2
- ._2rko14q2{border-radius:var(--ds-border-radius-circle,2002pc)}
2
+ ._2rko1twn{border-radius:var(--ds-border-radius-circle,9999px)}
3
3
  ._2rkogqwt{border-radius:var(--ds-border-radius-050,2px)}
4
4
  ._2rkoyh40{border-radius:2px}
5
5
  ._154i1ssb{top:50%}
@@ -1,16 +1,18 @@
1
1
  /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
3
  import _extends from "@babel/runtime/helpers/extends";
3
4
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
5
  var _excluded = ["as", "style"];
5
6
  import "./index.compiled.css";
6
7
  import { forwardRef } from 'react';
7
8
  import { ax, ix } from "@compiled/react/runtime";
8
- import React from 'react';
9
+ import React, { useState } from 'react';
9
10
  import { di } from 'react-magnetic-di';
10
11
  import ImageLoader from 'react-render-image';
11
12
  import LinkIcon from '@atlaskit/icon/core/migration/link';
12
13
  import { Box } from '@atlaskit/primitives/compiled';
13
14
  import { B400 } from '@atlaskit/theme/colors';
15
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
14
16
  import { isProfileType } from '../../../utils';
15
17
  import { Shimmer } from '../Icon';
16
18
  var iconWrapperStyle = null;
@@ -21,7 +23,7 @@ var styles = {
21
23
  iconTitleWrapperStyle: "_o5721jtm _1nmz9jpi _16d9qvcn _ca0qv77o _u5f31b66 _n3tdv77o _19bv1b66",
22
24
  linkStyle: "_2rkogqwt",
23
25
  noLinkAppearanceStyle: "_syaz131l _18u01b66",
24
- roundImageStyle: "_2rko14q2"
26
+ roundImageStyle: "_2rko1twn"
25
27
  };
26
28
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled,@atlaskit/design-system/no-html-anchor -- Ignored via go/DSP-18766
27
29
  var LinkAppearance = forwardRef(function (_ref, __cmplr) {
@@ -51,7 +53,12 @@ export var IconAndTitleLayout = function IconAndTitleLayout(_ref2) {
51
53
  rightSide = _ref2.rightSide,
52
54
  _ref2$testId = _ref2.testId,
53
55
  testId = _ref2$testId === void 0 ? 'inline-card-icon-and-title' : _ref2$testId,
54
- type = _ref2.type;
56
+ type = _ref2.type,
57
+ hideIconLoadingSkeleton = _ref2.hideIconLoadingSkeleton;
58
+ var _useState = useState(false),
59
+ _useState2 = _slicedToArray(_useState, 2),
60
+ hasImageErrored = _useState2[0],
61
+ setHasImageErrored = _useState2[1];
55
62
  var renderAtlaskitIcon = React.useCallback(function () {
56
63
  if (emoji) {
57
64
  return emoji;
@@ -66,6 +73,20 @@ export var IconAndTitleLayout = function IconAndTitleLayout(_ref2) {
66
73
  if (!icon || typeof icon !== 'string') {
67
74
  return null;
68
75
  }
76
+ if (expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) && hideIconLoadingSkeleton) {
77
+ if (hasImageErrored) {
78
+ return errored;
79
+ }
80
+ return /*#__PURE__*/React.createElement("img", {
81
+ src: icon,
82
+ "data-testid": "".concat(testId, "-image"),
83
+ alt: "",
84
+ onError: function onError() {
85
+ return setHasImageErrored(true);
86
+ },
87
+ className: ax(["_c71l7vkz _p12f7vkz _1bsb1osq", profileType && styles.roundImageStyle])
88
+ });
89
+ }
69
90
  return /*#__PURE__*/React.createElement(ImageLoader, {
70
91
  src: icon,
71
92
  loaded: /*#__PURE__*/React.createElement("img", {
@@ -79,7 +100,7 @@ export var IconAndTitleLayout = function IconAndTitleLayout(_ref2) {
79
100
  testId: "".concat(testId, "-loading")
80
101
  })
81
102
  });
82
- }, [icon, profileType]);
103
+ }, [icon, profileType, hideIconLoadingSkeleton, hasImageErrored]);
83
104
  var renderIconPlaceholder = React.useCallback(function (testId) {
84
105
  return defaultIcon || /*#__PURE__*/React.createElement(LinkIcon, {
85
106
  label: "link",
@@ -7,6 +7,7 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
7
7
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
8
8
  import React from 'react';
9
9
  import { fg } from '@atlaskit/platform-feature-flags';
10
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
10
11
  import { HoverCard } from '../../HoverCard';
11
12
  import InlineLozenge from '../common/inline-lozenge';
12
13
  import { Frame } from '../Frame';
@@ -57,7 +58,8 @@ export var InlineCardResolvedView = /*#__PURE__*/function (_React$Component) {
57
58
  hoverPreviewOptions = _this$props.hoverPreviewOptions,
58
59
  actionOptions = _this$props.actionOptions,
59
60
  truncateInline = _this$props.truncateInline,
60
- type = _this$props.type;
61
+ type = _this$props.type,
62
+ hideIconLoadingSkeleton = _this$props.hideIconLoadingSkeleton;
61
63
  var inlineCardResolvedView = /*#__PURE__*/React.createElement(Frame, {
62
64
  testId: testId,
63
65
  link: link,
@@ -70,7 +72,8 @@ export var InlineCardResolvedView = /*#__PURE__*/function (_React$Component) {
70
72
  icon: icon,
71
73
  title: title,
72
74
  titleTextColor: titleTextColor,
73
- type: type
75
+ type: type,
76
+ hideIconLoadingSkeleton: expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) && hideIconLoadingSkeleton
74
77
  }), this.renderLozenge());
75
78
  if (showHoverPreview && link) {
76
79
  return /*#__PURE__*/React.createElement(HoverCard, {
@@ -6,6 +6,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
6
6
  // TODO: Package Owner - please fix:
7
7
  // eslint-disable-next-line import/no-extraneous-dependencies
8
8
  import UFOHoldLoad from '@atlaskit/react-ufo/load-hold';
9
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
9
10
  import { SmartLinkStatus } from '../../constants';
10
11
  import { extractRequestAccessContextImproved } from '../../extractors/common/context/extractAccessContext';
11
12
  import { extractInlineProps } from '../../extractors/inline';
@@ -43,7 +44,8 @@ export var InlineCard = function InlineCard(_ref2) {
43
44
  actionOptions = _ref2.actionOptions,
44
45
  removeTextHighlightingFromTitle = _ref2.removeTextHighlightingFromTitle,
45
46
  resolvingPlaceholder = _ref2.resolvingPlaceholder,
46
- truncateInline = _ref2.truncateInline;
47
+ truncateInline = _ref2.truncateInline,
48
+ hideIconLoadingSkeleton = _ref2.hideIconLoadingSkeleton;
47
49
  var _useAnalyticsEvents = useAnalyticsEvents(),
48
50
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
49
51
  var status = cardState.status,
@@ -96,7 +98,8 @@ export var InlineCard = function InlineCard(_ref2) {
96
98
  isHovered: isHovered,
97
99
  onClick: handleFrameClick,
98
100
  testId: testIdWithStatus,
99
- truncateInline: truncateInline
101
+ truncateInline: truncateInline,
102
+ hideIconLoadingSkeleton: expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) && hideIconLoadingSkeleton
100
103
  }));
101
104
  case 'unauthorized':
102
105
  var provider = extractSmartLinkProvider(details);
@@ -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: "40.13.2",
15
+ packageVersion: "0.0.0-development",
16
16
  componentName: 'linkUrl'
17
17
  };
18
18
  var Anchor = withLinkClickedEvent('a');
@@ -19,6 +19,11 @@ export type BaseBadgeElementProps = ElementProps & {
19
19
  * the badge will be displayed without the icon, showing only the label text.
20
20
  */
21
21
  hideIcon?: boolean;
22
+ /**
23
+ * When set to true, the loading skeleton for the image icon will be hidden,
24
+ * the image will be rendered directly.
25
+ */
26
+ hideIconLoadingSkeleton?: boolean;
22
27
  /**
23
28
  * The Atlaskit Icon to display next to the label. If this is not supplied,
24
29
  * then the badge icon will fallback to the URL provided.
@@ -47,6 +52,11 @@ declare const _default: (props: ElementProps & {
47
52
  * the badge will be displayed without the icon, showing only the label text.
48
53
  */
49
54
  hideIcon?: boolean;
55
+ /**
56
+ * When set to true, the loading skeleton for the image icon will be hidden,
57
+ * the image will be rendered directly.
58
+ */
59
+ hideIconLoadingSkeleton?: boolean;
50
60
  /**
51
61
  * The Atlaskit Icon to display next to the label. If this is not supplied,
52
62
  * then the badge icon will fallback to the URL provided.
@@ -100,6 +100,10 @@ export type FlexibleCardProps = {
100
100
  };
101
101
  export type InternalFlexibleUiOptions = FlexibleUiOptions & {
102
102
  hideLegacyButton?: boolean;
103
+ /**
104
+ * For images, whether to hide the loading skeleton while the image is loading.
105
+ */
106
+ hideLoadingSkeleton?: boolean;
103
107
  };
104
108
  export type FlexibleUiOptions = {
105
109
  /**
@@ -9,6 +9,7 @@ export interface IconAndTitleLayoutProps {
9
9
  children?: React.ReactNode;
10
10
  defaultIcon?: React.ReactNode;
11
11
  emoji?: React.ReactNode;
12
+ hideIconLoadingSkeleton?: boolean;
12
13
  icon?: React.ReactNode;
13
14
  link?: string;
14
15
  onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
@@ -21,5 +22,5 @@ export interface IconAndTitleLayoutProps {
21
22
  titleTextColor?: string;
22
23
  type?: string[];
23
24
  }
24
- export declare const IconAndTitleLayout: ({ icon, emoji, defaultIcon, onClick, children, title, titleColor, titleTextColor, link, rightSide, testId, type, }: IconAndTitleLayoutProps) => JSX.Element;
25
+ export declare const IconAndTitleLayout: ({ icon, emoji, defaultIcon, onClick, children, title, titleColor, titleTextColor, link, rightSide, testId, type, hideIconLoadingSkeleton, }: IconAndTitleLayoutProps) => JSX.Element;
25
26
  export declare const IconTitleWrapper: (props: ComponentPropsWithoutRef<typeof Box>) => JSX.Element;
@@ -5,6 +5,11 @@ import { type HoverPreviewOptions } from '../../HoverCard/types';
5
5
  export interface InlineCardResolvedViewProps {
6
6
  /** Configure visibility of server and client actions */
7
7
  actionOptions?: CardActionOptions;
8
+ /**
9
+ * When set to true, the loading skeleton for the image icon will be hidden,
10
+ * the image will be rendered directly.
11
+ */
12
+ hideIconLoadingSkeleton?: boolean;
8
13
  hoverPreviewOptions?: HoverPreviewOptions;
9
14
  /** The optional con of the service (e.g. Dropbox/Asana/Google/etc) to display */
10
15
  icon?: React.ReactNode;
@@ -6,4 +6,4 @@ import { InlineCardResolvingView } from './ResolvingView';
6
6
  import { type InlineCardProps } from './types';
7
7
  import { InlineCardUnauthorizedView } from './UnauthorisedView';
8
8
  export { InlineCardResolvedView, InlineCardResolvingView, InlineCardErroredView, InlineCardForbiddenView, InlineCardUnauthorizedView, };
9
- export declare const InlineCard: ({ id, url, cardState, handleAuthorize, handleFrameClick, isSelected, isHovered, renderers, onResolve, onError, testId, inlinePreloaderStyle, showHoverPreview, hoverPreviewOptions, actionOptions, removeTextHighlightingFromTitle, resolvingPlaceholder, truncateInline, }: InlineCardProps) => React.JSX.Element;
9
+ export declare const InlineCard: ({ id, url, cardState, handleAuthorize, handleFrameClick, isSelected, isHovered, renderers, onResolve, onError, testId, inlinePreloaderStyle, showHoverPreview, hoverPreviewOptions, actionOptions, removeTextHighlightingFromTitle, resolvingPlaceholder, truncateInline, hideIconLoadingSkeleton, }: InlineCardProps) => React.JSX.Element;
@@ -9,6 +9,7 @@ export type InlineCardProps = {
9
9
  cardState: CardState;
10
10
  handleAuthorize: (() => void) | undefined;
11
11
  handleFrameClick: EventHandler<MouseEvent | KeyboardEvent>;
12
+ hideIconLoadingSkeleton?: boolean;
12
13
  hoverPreviewOptions?: HoverPreviewOptions;
13
14
  id: string;
14
15
  inlinePreloaderStyle?: InlinePreloaderStyle;
@@ -19,6 +19,11 @@ export type BaseBadgeElementProps = ElementProps & {
19
19
  * the badge will be displayed without the icon, showing only the label text.
20
20
  */
21
21
  hideIcon?: boolean;
22
+ /**
23
+ * When set to true, the loading skeleton for the image icon will be hidden,
24
+ * the image will be rendered directly.
25
+ */
26
+ hideIconLoadingSkeleton?: boolean;
22
27
  /**
23
28
  * The Atlaskit Icon to display next to the label. If this is not supplied,
24
29
  * then the badge icon will fallback to the URL provided.
@@ -47,6 +52,11 @@ declare const _default: (props: ElementProps & {
47
52
  * the badge will be displayed without the icon, showing only the label text.
48
53
  */
49
54
  hideIcon?: boolean;
55
+ /**
56
+ * When set to true, the loading skeleton for the image icon will be hidden,
57
+ * the image will be rendered directly.
58
+ */
59
+ hideIconLoadingSkeleton?: boolean;
50
60
  /**
51
61
  * The Atlaskit Icon to display next to the label. If this is not supplied,
52
62
  * then the badge icon will fallback to the URL provided.
@@ -100,6 +100,10 @@ export type FlexibleCardProps = {
100
100
  };
101
101
  export type InternalFlexibleUiOptions = FlexibleUiOptions & {
102
102
  hideLegacyButton?: boolean;
103
+ /**
104
+ * For images, whether to hide the loading skeleton while the image is loading.
105
+ */
106
+ hideLoadingSkeleton?: boolean;
103
107
  };
104
108
  export type FlexibleUiOptions = {
105
109
  /**
@@ -9,6 +9,7 @@ export interface IconAndTitleLayoutProps {
9
9
  children?: React.ReactNode;
10
10
  defaultIcon?: React.ReactNode;
11
11
  emoji?: React.ReactNode;
12
+ hideIconLoadingSkeleton?: boolean;
12
13
  icon?: React.ReactNode;
13
14
  link?: string;
14
15
  onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
@@ -21,5 +22,5 @@ export interface IconAndTitleLayoutProps {
21
22
  titleTextColor?: string;
22
23
  type?: string[];
23
24
  }
24
- export declare const IconAndTitleLayout: ({ icon, emoji, defaultIcon, onClick, children, title, titleColor, titleTextColor, link, rightSide, testId, type, }: IconAndTitleLayoutProps) => JSX.Element;
25
+ export declare const IconAndTitleLayout: ({ icon, emoji, defaultIcon, onClick, children, title, titleColor, titleTextColor, link, rightSide, testId, type, hideIconLoadingSkeleton, }: IconAndTitleLayoutProps) => JSX.Element;
25
26
  export declare const IconTitleWrapper: (props: ComponentPropsWithoutRef<typeof Box>) => JSX.Element;
@@ -5,6 +5,11 @@ import { type HoverPreviewOptions } from '../../HoverCard/types';
5
5
  export interface InlineCardResolvedViewProps {
6
6
  /** Configure visibility of server and client actions */
7
7
  actionOptions?: CardActionOptions;
8
+ /**
9
+ * When set to true, the loading skeleton for the image icon will be hidden,
10
+ * the image will be rendered directly.
11
+ */
12
+ hideIconLoadingSkeleton?: boolean;
8
13
  hoverPreviewOptions?: HoverPreviewOptions;
9
14
  /** The optional con of the service (e.g. Dropbox/Asana/Google/etc) to display */
10
15
  icon?: React.ReactNode;
@@ -6,4 +6,4 @@ import { InlineCardResolvingView } from './ResolvingView';
6
6
  import { type InlineCardProps } from './types';
7
7
  import { InlineCardUnauthorizedView } from './UnauthorisedView';
8
8
  export { InlineCardResolvedView, InlineCardResolvingView, InlineCardErroredView, InlineCardForbiddenView, InlineCardUnauthorizedView, };
9
- export declare const InlineCard: ({ id, url, cardState, handleAuthorize, handleFrameClick, isSelected, isHovered, renderers, onResolve, onError, testId, inlinePreloaderStyle, showHoverPreview, hoverPreviewOptions, actionOptions, removeTextHighlightingFromTitle, resolvingPlaceholder, truncateInline, }: InlineCardProps) => React.JSX.Element;
9
+ export declare const InlineCard: ({ id, url, cardState, handleAuthorize, handleFrameClick, isSelected, isHovered, renderers, onResolve, onError, testId, inlinePreloaderStyle, showHoverPreview, hoverPreviewOptions, actionOptions, removeTextHighlightingFromTitle, resolvingPlaceholder, truncateInline, hideIconLoadingSkeleton, }: InlineCardProps) => React.JSX.Element;
@@ -9,6 +9,7 @@ export type InlineCardProps = {
9
9
  cardState: CardState;
10
10
  handleAuthorize: (() => void) | undefined;
11
11
  handleFrameClick: EventHandler<MouseEvent | KeyboardEvent>;
12
+ hideIconLoadingSkeleton?: boolean;
12
13
  hoverPreviewOptions?: HoverPreviewOptions;
13
14
  id: string;
14
15
  inlinePreloaderStyle?: InlinePreloaderStyle;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "40.13.3",
3
+ "version": "40.14.0",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -68,7 +68,7 @@
68
68
  "@atlaskit/textarea": "^8.0.0",
69
69
  "@atlaskit/textfield": "^8.0.0",
70
70
  "@atlaskit/theme": "^20.0.0",
71
- "@atlaskit/tmp-editor-statsig": "^11.8.0",
71
+ "@atlaskit/tmp-editor-statsig": "^11.9.0",
72
72
  "@atlaskit/tokens": "^6.1.0",
73
73
  "@atlaskit/tooltip": "^20.4.0",
74
74
  "@atlaskit/ufo": "^0.4.0",