@atlaskit/smart-card 29.0.3 → 29.1.1

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 (35) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/cjs/extractors/common/detail/extractSubscriberCount.js +4 -7
  3. package/dist/cjs/state/hooks/use-response/index.js +16 -13
  4. package/dist/cjs/utils/analytics/analytics.js +1 -1
  5. package/dist/cjs/view/BlockCard/views/ForbiddenView.js +14 -8
  6. package/dist/cjs/view/BlockCard/views/ResolvingView.js +6 -5
  7. package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +1 -0
  8. package/dist/cjs/view/FlexibleCard/components/blocks/ai-footer-block/resolved/ai-footer-metadata.js +1 -0
  9. package/dist/cjs/view/FlexibleCard/components/container/index.js +1 -0
  10. package/dist/cjs/view/LinkUrl/index.js +1 -1
  11. package/dist/es2019/extractors/common/detail/extractSubscriberCount.js +4 -7
  12. package/dist/es2019/state/hooks/use-response/index.js +15 -12
  13. package/dist/es2019/utils/analytics/analytics.js +1 -1
  14. package/dist/es2019/view/BlockCard/views/ForbiddenView.js +14 -8
  15. package/dist/es2019/view/BlockCard/views/ResolvingView.js +5 -4
  16. package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +1 -0
  17. package/dist/es2019/view/FlexibleCard/components/blocks/ai-footer-block/resolved/ai-footer-metadata.js +1 -0
  18. package/dist/es2019/view/FlexibleCard/components/container/index.js +1 -0
  19. package/dist/es2019/view/LinkUrl/index.js +1 -1
  20. package/dist/esm/extractors/common/detail/extractSubscriberCount.js +4 -7
  21. package/dist/esm/state/hooks/use-response/index.js +16 -13
  22. package/dist/esm/utils/analytics/analytics.js +1 -1
  23. package/dist/esm/view/BlockCard/views/ForbiddenView.js +14 -8
  24. package/dist/esm/view/BlockCard/views/ResolvingView.js +5 -4
  25. package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +1 -0
  26. package/dist/esm/view/FlexibleCard/components/blocks/ai-footer-block/resolved/ai-footer-metadata.js +1 -0
  27. package/dist/esm/view/FlexibleCard/components/container/index.js +1 -0
  28. package/dist/esm/view/LinkUrl/index.js +1 -1
  29. package/dist/types/state/hooks/use-response/index.d.ts +1 -1
  30. package/dist/types/view/Card/index.d.ts +3 -1
  31. package/dist/types/view/Card/types.d.ts +22 -4
  32. package/dist/types-ts4.5/state/hooks/use-response/index.d.ts +1 -1
  33. package/dist/types-ts4.5/view/Card/index.d.ts +3 -1
  34. package/dist/types-ts4.5/view/Card/types.d.ts +22 -4
  35. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 29.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#150558](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/150558)
8
+ [`da0a817f6174e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/da0a817f6174e) -
9
+ Removing unused code logic
10
+
11
+ ## 29.1.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [#149644](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/149644)
16
+ [`5a157fb05e298`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5a157fb05e298) -
17
+ [ux] Enable new icons behind a feature flag.
18
+ - [#148475](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/148475)
19
+ [`09e912b75c96d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/09e912b75c96d) -
20
+ [ux] Enable new icons behind a feature flag.
21
+ - [#148475](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/148475)
22
+ [`8a89b1fabdecc`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8a89b1fabdecc) -
23
+ [ux] Enable new icons behind a feature flag.
24
+
3
25
  ## 29.0.3
4
26
 
5
27
  ### Patch Changes
@@ -7,19 +7,16 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.extractSubscriberCount = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _colors = require("@atlaskit/theme/colors");
10
- var _people = _interopRequireDefault(require("@atlaskit/icon/glyph/people"));
10
+ var _peopleGroupPeople = _interopRequireDefault(require("@atlaskit/icon/core/migration/people-group--people"));
11
11
  var extractSubscriberCount = exports.extractSubscriberCount = function extractSubscriberCount(jsonLd) {
12
12
  var subscriberCount = jsonLd['atlassian:subscriberCount'];
13
13
  if (subscriberCount) {
14
14
  return {
15
15
  text: subscriberCount.toString(),
16
- icon:
17
- /*#__PURE__*/
18
- // eslint-disable-next-line @atlaskit/design-system/no-legacy-icons -- TODO - https://product-fabric.atlassian.net/browse/DSP-19499
19
- _react.default.createElement(_people.default, {
20
- size: "small",
16
+ icon: /*#__PURE__*/_react.default.createElement(_peopleGroupPeople.default, {
17
+ LEGACY_size: "small",
21
18
  label: "subscribers",
22
- primaryColor: "var(--ds-icon-subtle, ".concat(_colors.N600, ")")
19
+ color: "var(--ds-icon-subtle, ".concat(_colors.N600, ")")
23
20
  })
24
21
  };
25
22
  }
@@ -26,33 +26,36 @@ var useResponse = function useResponse() {
26
26
  }, undefined, undefined, metadataStatus));
27
27
  }, [dispatch]);
28
28
  var handleResolvedLinkError = (0, _react.useCallback)(function (url, error, response, isMetadataRequest) {
29
- var _ref = getState()[url] || {
30
- status: _constants.SmartLinkStatus.Pending,
31
- details: undefined
32
- },
29
+ var newState = {
30
+ status: _constants.SmartLinkStatus.Pending,
31
+ details: undefined
32
+ };
33
+ var _ref = getState()[url] || newState,
33
34
  details = _ref.details;
34
35
  var hasData = !!(details && details.data);
36
+
35
37
  // If metadata request then set metadata status, return and do not alter link status
36
38
  if (isMetadataRequest) {
37
39
  setMetadataStatus(url, 'errored');
38
40
  return;
39
41
  }
40
42
  if (error.kind === 'fatal') {
41
- // If there's no previous data in the store for this URL, then bail
42
- // out and let the editor handle fallbacks (returns to a blue link).
43
- if (!hasData && status !== 'resolved') {
44
- dispatch((0, _linkingCommon.cardAction)(_linkingCommon.ACTION_ERROR, {
45
- url: url
46
- }, details, error));
47
- throw error;
48
- }
49
43
  // If we already have resolved data for this URL in the store, then
50
44
  // simply fallback to the previous data.
51
45
  if (hasData) {
52
46
  dispatch((0, _linkingCommon.cardAction)(_linkingCommon.ACTION_RESOLVED, {
53
47
  url: url
54
48
  }, details));
49
+
50
+ // If there's no previous data in the store for this URL, then bail
51
+ // out and let the editor handle fallbacks (returns to a blue link).
52
+ } else {
53
+ dispatch((0, _linkingCommon.cardAction)(_linkingCommon.ACTION_ERROR, {
54
+ url: url
55
+ }, details, error));
56
+ throw error;
55
57
  }
58
+
56
59
  // Handle AuthErrors (user did not have access to resource) -
57
60
  // Missing AAID in ASAP claims, or missing UserContext, or 403 from downstream
58
61
  } else if (error.kind === 'auth') {
@@ -101,7 +104,7 @@ var useResponse = function useResponse() {
101
104
  }
102
105
 
103
106
  // Handle any other errors
104
- if (nextStatus === 'fatal') {
107
+ if (!response || nextStatus === 'fatal') {
105
108
  handleResolvedLinkError(resourceUrl, new _linkingCommon.APIError('fatal', hostname, _constants2.ERROR_MESSAGE_FATAL), undefined, isMetadataRequest);
106
109
  return;
107
110
  }
@@ -22,7 +22,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
22
22
  var context = exports.context = {
23
23
  componentName: 'smart-cards',
24
24
  packageName: "@atlaskit/smart-card",
25
- packageVersion: "29.0.3"
25
+ packageVersion: "29.1.1"
26
26
  };
27
27
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
28
28
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -10,7 +10,7 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
10
10
  var _react = require("@emotion/react");
11
11
  var _reactIntlNext = require("react-intl-next");
12
12
  var _colors = require("@atlaskit/theme/colors");
13
- var _lockFilled = _interopRequireDefault(require("@atlaskit/icon/glyph/lock-filled"));
13
+ var _lockLockedLockFilled = _interopRequireDefault(require("@atlaskit/icon/utility/migration/lock-locked--lock-filled"));
14
14
  var _Frame = require("../components/Frame");
15
15
  var _Provider = require("../components/Provider");
16
16
  var _Byline = require("../../common/Byline");
@@ -22,12 +22,16 @@ var _ContentHeader = require("../components/ContentHeader");
22
22
  var _handlers = require("../utils/handlers");
23
23
  var _Link = require("../components/Link");
24
24
  var _UnresolvedText = require("../components/UnresolvedText");
25
+ var _primitives = require("@atlaskit/primitives");
25
26
  /**
26
27
  * @jsxRuntime classic
27
28
  * @jsx jsx
28
29
  */
29
30
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
30
31
 
32
+ var iconWrapperStyles = (0, _primitives.xcss)({
33
+ marginRight: 'space.050'
34
+ });
31
35
  /**
32
36
  * Class name for selecting non-flexible forbidden block card
33
37
  *
@@ -90,14 +94,16 @@ var ForbiddenView = exports.ForbiddenView = function ForbiddenView(_ref) {
90
94
  ,
91
95
  className: blockCardForbiddenViewLinkClassName
92
96
  })), (0, _react.jsx)(_Byline.Byline, null, (0, _react.jsx)(_UnresolvedText.UnresolvedText, {
93
- icon:
94
- // eslint-disable-next-line @atlaskit/design-system/no-legacy-icons -- TODO - https://product-fabric.atlassian.net/browse/DSP-19497
95
- (0, _react.jsx)(_lockFilled.default, {
97
+ icon: (0, _react.jsx)(_primitives.Flex, {
98
+ alignItems: "center",
99
+ xcss: iconWrapperStyles
100
+ }, (0, _react.jsx)(_lockLockedLockFilled.default, {
96
101
  label: "forbidden-lock-icon",
97
- size: "small",
98
- primaryColor: "var(--ds-icon-danger, ".concat(_colors.R300, ")"),
99
- testId: "".concat(testId, "-lock-icon")
100
- }),
102
+ LEGACY_size: "small",
103
+ color: "var(--ds-icon-danger, ".concat(_colors.R300, ")"),
104
+ testId: "".concat(testId, "-lock-icon"),
105
+ LEGACY_margin: "0 ".concat("var(--ds-space-negative-050, -4px)", " 0 0")
106
+ })),
101
107
  text: (0, _react.jsx)(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _messages.messages[descriptiveMessageKey], {
102
108
  values: {
103
109
  product: context.text,
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.blockCardResolvingViewClassName = exports.ResolvingView = void 0;
8
8
  var _react = require("@emotion/react");
9
- var _documentFilled = _interopRequireDefault(require("@atlaskit/icon/glyph/document-filled"));
9
+ var _fileEditorFile = _interopRequireDefault(require("@atlaskit/icon/core/migration/file--editor-file"));
10
10
  var _colors = require("@atlaskit/theme/colors");
11
11
  var _constants = require("@atlaskit/theme/constants");
12
12
  var _Frame = require("../components/Frame");
@@ -46,10 +46,11 @@ var ResolvingView = exports.ResolvingView = function ResolvingView(_ref) {
46
46
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
47
47
  ,
48
48
  className: blockCardResolvingViewClassName
49
- }, (0, _react.jsx)(_documentFilled.default, {
50
- size: "small",
51
- primaryColor: "var(--ds-icon-subtle, ".concat(_colors.N50, ")"),
52
- label: "document-icon"
49
+ }, (0, _react.jsx)(_fileEditorFile.default, {
50
+ LEGACY_size: "medium",
51
+ color: "var(--ds-icon-subtle, ".concat(_colors.N50, ")"),
52
+ label: "document-icon",
53
+ LEGACY_margin: "0 -4.3px 0 -4px"
53
54
  }), (0, _react.jsx)("span", {
54
55
  css: messageStyles
55
56
  }, (0, _react.jsx)(_reactIntlNext.FormattedMessage, _messages.messages.loading)));
@@ -22,6 +22,7 @@ var _messages = require("../../../../../messages");
22
22
  var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
23
23
  var _actionGroupItem = _interopRequireDefault(require("./action-group-item"));
24
24
  var _utils2 = require("../utils");
25
+ var _reactMagneticDi = require("react-magnetic-di");
25
26
  var _excluded = ["triggerRef"];
26
27
  /**
27
28
  * @jsxRuntime classic
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.AIFooterMetadata = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
10
+ var _reactMagneticDi = require("react-magnetic-di");
10
11
  var _reactIntlNext = require("react-intl-next");
11
12
  var _primitives = require("@atlaskit/primitives");
12
13
  var _aiIcon = _interopRequireDefault(require("../../../../../common/ai-icon"));
@@ -16,6 +16,7 @@ var _layeredLink = _interopRequireDefault(require("./layered-link"));
16
16
  var _hoverCardControl = _interopRequireDefault(require("./hover-card-control"));
17
17
  var _utils = require("../../../../state/flexible-ui-context/utils");
18
18
  var _colors = require("@atlaskit/theme/colors");
19
+ var _reactMagneticDi = require("react-magnetic-di");
19
20
  var _templateObject;
20
21
  /**
21
22
  * @jsxRuntime classic
@@ -17,7 +17,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
17
17
  _excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
18
18
  var PACKAGE_DATA = {
19
19
  packageName: "@atlaskit/smart-card",
20
- packageVersion: "29.0.3",
20
+ packageVersion: "29.1.1",
21
21
  componentName: 'linkUrl'
22
22
  };
23
23
  var Link = (0, _click.withLinkClickedEvent)('a');
@@ -1,18 +1,15 @@
1
1
  import React from 'react';
2
2
  import { N600 } from '@atlaskit/theme/colors';
3
- import PeopleIcon from '@atlaskit/icon/glyph/people';
3
+ import PeopleIcon from '@atlaskit/icon/core/migration/people-group--people';
4
4
  export const extractSubscriberCount = jsonLd => {
5
5
  const subscriberCount = jsonLd['atlassian:subscriberCount'];
6
6
  if (subscriberCount) {
7
7
  return {
8
8
  text: subscriberCount.toString(),
9
- icon:
10
- /*#__PURE__*/
11
- // eslint-disable-next-line @atlaskit/design-system/no-legacy-icons -- TODO - https://product-fabric.atlassian.net/browse/DSP-19499
12
- React.createElement(PeopleIcon, {
13
- size: "small",
9
+ icon: /*#__PURE__*/React.createElement(PeopleIcon, {
10
+ LEGACY_size: "small",
14
11
  label: "subscribers",
15
- primaryColor: `var(--ds-icon-subtle, ${N600})`
12
+ color: `var(--ds-icon-subtle, ${N600})`
16
13
  })
17
14
  };
18
15
  }
@@ -23,34 +23,37 @@ const useResponse = () => {
23
23
  }, undefined, undefined, metadataStatus));
24
24
  }, [dispatch]);
25
25
  const handleResolvedLinkError = useCallback((url, error, response, isMetadataRequest) => {
26
- const {
27
- details
28
- } = getState()[url] || {
26
+ const newState = {
29
27
  status: SmartLinkStatus.Pending,
30
28
  details: undefined
31
29
  };
30
+ const {
31
+ details
32
+ } = getState()[url] || newState;
32
33
  const hasData = !!(details && details.data);
34
+
33
35
  // If metadata request then set metadata status, return and do not alter link status
34
36
  if (isMetadataRequest) {
35
37
  setMetadataStatus(url, 'errored');
36
38
  return;
37
39
  }
38
40
  if (error.kind === 'fatal') {
39
- // If there's no previous data in the store for this URL, then bail
40
- // out and let the editor handle fallbacks (returns to a blue link).
41
- if (!hasData && status !== 'resolved') {
42
- dispatch(cardAction(ACTION_ERROR, {
43
- url
44
- }, details, error));
45
- throw error;
46
- }
47
41
  // If we already have resolved data for this URL in the store, then
48
42
  // simply fallback to the previous data.
49
43
  if (hasData) {
50
44
  dispatch(cardAction(ACTION_RESOLVED, {
51
45
  url
52
46
  }, details));
47
+
48
+ // If there's no previous data in the store for this URL, then bail
49
+ // out and let the editor handle fallbacks (returns to a blue link).
50
+ } else {
51
+ dispatch(cardAction(ACTION_ERROR, {
52
+ url
53
+ }, details, error));
54
+ throw error;
53
55
  }
56
+
54
57
  // Handle AuthErrors (user did not have access to resource) -
55
58
  // Missing AAID in ASAP claims, or missing UserContext, or 403 from downstream
56
59
  } else if (error.kind === 'auth') {
@@ -97,7 +100,7 @@ const useResponse = () => {
97
100
  }
98
101
 
99
102
  // Handle any other errors
100
- if (nextStatus === 'fatal') {
103
+ if (!response || nextStatus === 'fatal') {
101
104
  handleResolvedLinkError(resourceUrl, new APIError('fatal', hostname, ERROR_MESSAGE_FATAL), undefined, isMetadataRequest);
102
105
  return;
103
106
  }
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
4
4
  export const context = {
5
5
  componentName: 'smart-cards',
6
6
  packageName: "@atlaskit/smart-card",
7
- packageVersion: "29.0.3"
7
+ packageVersion: "29.1.1"
8
8
  };
9
9
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -7,7 +7,7 @@ import _extends from "@babel/runtime/helpers/extends";
7
7
  import { jsx } from '@emotion/react';
8
8
  import { FormattedMessage } from 'react-intl-next';
9
9
  import { R300 } from '@atlaskit/theme/colors';
10
- import LockIcon from '@atlaskit/icon/glyph/lock-filled';
10
+ import LockIcon from '@atlaskit/icon/utility/migration/lock-locked--lock-filled';
11
11
  import { Frame } from '../components/Frame';
12
12
  import { Provider } from '../components/Provider';
13
13
  import { Byline } from '../../common/Byline';
@@ -19,6 +19,10 @@ import { ContentHeader } from '../components/ContentHeader';
19
19
  import { handleClickCommon } from '../utils/handlers';
20
20
  import { Link } from '../components/Link';
21
21
  import { UnresolvedText } from '../components/UnresolvedText';
22
+ import { Flex, xcss } from '@atlaskit/primitives';
23
+ const iconWrapperStyles = xcss({
24
+ marginRight: 'space.050'
25
+ });
22
26
  /**
23
27
  * Class name for selecting non-flexible forbidden block card
24
28
  *
@@ -73,14 +77,16 @@ export const ForbiddenView = ({
73
77
  ,
74
78
  className: blockCardForbiddenViewLinkClassName
75
79
  })), jsx(Byline, null, jsx(UnresolvedText, {
76
- icon:
77
- // eslint-disable-next-line @atlaskit/design-system/no-legacy-icons -- TODO - https://product-fabric.atlassian.net/browse/DSP-19497
78
- jsx(LockIcon, {
80
+ icon: jsx(Flex, {
81
+ alignItems: "center",
82
+ xcss: iconWrapperStyles
83
+ }, jsx(LockIcon, {
79
84
  label: "forbidden-lock-icon",
80
- size: "small",
81
- primaryColor: `var(--ds-icon-danger, ${R300})`,
82
- testId: `${testId}-lock-icon`
83
- }),
85
+ LEGACY_size: "small",
86
+ color: `var(--ds-icon-danger, ${R300})`,
87
+ testId: `${testId}-lock-icon`,
88
+ LEGACY_margin: `0 ${"var(--ds-space-negative-050, -4px)"} 0 0`
89
+ })),
84
90
  text: jsx(FormattedMessage, _extends({}, messages[descriptiveMessageKey], {
85
91
  values: {
86
92
  product: context.text,
@@ -4,7 +4,7 @@
4
4
  */
5
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
6
  import { css, jsx } from '@emotion/react';
7
- import DocumentFilledIcon from '@atlaskit/icon/glyph/document-filled';
7
+ import DocumentFilledIcon from '@atlaskit/icon/core/migration/file--editor-file';
8
8
  import { N50, N90 } from '@atlaskit/theme/colors';
9
9
  import { fontSize } from '@atlaskit/theme/constants';
10
10
  import { Frame } from '../components/Frame';
@@ -37,9 +37,10 @@ export const ResolvingView = ({
37
37
  ,
38
38
  className: blockCardResolvingViewClassName
39
39
  }, jsx(DocumentFilledIcon, {
40
- size: "small",
41
- primaryColor: `var(--ds-icon-subtle, ${N50})`,
42
- label: "document-icon"
40
+ LEGACY_size: "medium",
41
+ color: `var(--ds-icon-subtle, ${N50})`,
42
+ label: "document-icon",
43
+ LEGACY_margin: "0 -4.3px 0 -4px"
43
44
  }), jsx("span", {
44
45
  css: messageStyles
45
46
  }, jsx(FormattedMessage, messages.loading)));
@@ -19,6 +19,7 @@ import { messages } from '../../../../../messages';
19
19
  import { useFlexibleUiContext, useFlexibleUiOptionContext } from '../../../../../state/flexible-ui-context';
20
20
  import ActionGroupItem from './action-group-item';
21
21
  import { filterActionItems } from '../utils';
22
+ import { di } from 'react-magnetic-di';
22
23
  const styles = css({
23
24
  display: 'inline-flex',
24
25
  lineHeight: '1rem',
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import Tooltip from '@atlaskit/tooltip';
3
+ import { di } from 'react-magnetic-di';
3
4
  import { FormattedMessage } from 'react-intl-next';
4
5
  import { Box, Inline } from '@atlaskit/primitives';
5
6
  import AIIcon from '../../../../../common/ai-icon';
@@ -12,6 +12,7 @@ import LayeredLink from './layered-link';
12
12
  import HoverCardControl from './hover-card-control';
13
13
  import { isFlexUiPreviewPresent } from '../../../../state/flexible-ui-context/utils';
14
14
  import { N40 } from '@atlaskit/theme/colors';
15
+ import { di } from 'react-magnetic-di';
15
16
  const elevationStyles = css({
16
17
  border: `1px solid ${`var(--ds-border, ${N40})`}`,
17
18
  borderRadius: "var(--ds-border-radius-200, 8px)",
@@ -7,7 +7,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
7
7
  import LinkWarningModal from './LinkWarningModal';
8
8
  const PACKAGE_DATA = {
9
9
  packageName: "@atlaskit/smart-card",
10
- packageVersion: "29.0.3",
10
+ packageVersion: "29.1.1",
11
11
  componentName: 'linkUrl'
12
12
  };
13
13
  const Link = withLinkClickedEvent('a');
@@ -1,18 +1,15 @@
1
1
  import React from 'react';
2
2
  import { N600 } from '@atlaskit/theme/colors';
3
- import PeopleIcon from '@atlaskit/icon/glyph/people';
3
+ import PeopleIcon from '@atlaskit/icon/core/migration/people-group--people';
4
4
  export var extractSubscriberCount = function extractSubscriberCount(jsonLd) {
5
5
  var subscriberCount = jsonLd['atlassian:subscriberCount'];
6
6
  if (subscriberCount) {
7
7
  return {
8
8
  text: subscriberCount.toString(),
9
- icon:
10
- /*#__PURE__*/
11
- // eslint-disable-next-line @atlaskit/design-system/no-legacy-icons -- TODO - https://product-fabric.atlassian.net/browse/DSP-19499
12
- React.createElement(PeopleIcon, {
13
- size: "small",
9
+ icon: /*#__PURE__*/React.createElement(PeopleIcon, {
10
+ LEGACY_size: "small",
14
11
  label: "subscribers",
15
- primaryColor: "var(--ds-icon-subtle, ".concat(N600, ")")
12
+ color: "var(--ds-icon-subtle, ".concat(N600, ")")
16
13
  })
17
14
  };
18
15
  }
@@ -20,33 +20,36 @@ var useResponse = function useResponse() {
20
20
  }, undefined, undefined, metadataStatus));
21
21
  }, [dispatch]);
22
22
  var handleResolvedLinkError = useCallback(function (url, error, response, isMetadataRequest) {
23
- var _ref = getState()[url] || {
24
- status: SmartLinkStatus.Pending,
25
- details: undefined
26
- },
23
+ var newState = {
24
+ status: SmartLinkStatus.Pending,
25
+ details: undefined
26
+ };
27
+ var _ref = getState()[url] || newState,
27
28
  details = _ref.details;
28
29
  var hasData = !!(details && details.data);
30
+
29
31
  // If metadata request then set metadata status, return and do not alter link status
30
32
  if (isMetadataRequest) {
31
33
  setMetadataStatus(url, 'errored');
32
34
  return;
33
35
  }
34
36
  if (error.kind === 'fatal') {
35
- // If there's no previous data in the store for this URL, then bail
36
- // out and let the editor handle fallbacks (returns to a blue link).
37
- if (!hasData && status !== 'resolved') {
38
- dispatch(cardAction(ACTION_ERROR, {
39
- url: url
40
- }, details, error));
41
- throw error;
42
- }
43
37
  // If we already have resolved data for this URL in the store, then
44
38
  // simply fallback to the previous data.
45
39
  if (hasData) {
46
40
  dispatch(cardAction(ACTION_RESOLVED, {
47
41
  url: url
48
42
  }, details));
43
+
44
+ // If there's no previous data in the store for this URL, then bail
45
+ // out and let the editor handle fallbacks (returns to a blue link).
46
+ } else {
47
+ dispatch(cardAction(ACTION_ERROR, {
48
+ url: url
49
+ }, details, error));
50
+ throw error;
49
51
  }
52
+
50
53
  // Handle AuthErrors (user did not have access to resource) -
51
54
  // Missing AAID in ASAP claims, or missing UserContext, or 403 from downstream
52
55
  } else if (error.kind === 'auth') {
@@ -95,7 +98,7 @@ var useResponse = function useResponse() {
95
98
  }
96
99
 
97
100
  // Handle any other errors
98
- if (nextStatus === 'fatal') {
101
+ if (!response || nextStatus === 'fatal') {
99
102
  handleResolvedLinkError(resourceUrl, new APIError('fatal', hostname, ERROR_MESSAGE_FATAL), undefined, isMetadataRequest);
100
103
  return;
101
104
  }
@@ -15,7 +15,7 @@ export var ANALYTICS_CHANNEL = 'media';
15
15
  export var context = {
16
16
  componentName: 'smart-cards',
17
17
  packageName: "@atlaskit/smart-card",
18
- packageVersion: "29.0.3"
18
+ packageVersion: "29.1.1"
19
19
  };
20
20
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
21
21
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -8,7 +8,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
8
8
  import { jsx } from '@emotion/react';
9
9
  import { FormattedMessage } from 'react-intl-next';
10
10
  import { R300 } from '@atlaskit/theme/colors';
11
- import LockIcon from '@atlaskit/icon/glyph/lock-filled';
11
+ import LockIcon from '@atlaskit/icon/utility/migration/lock-locked--lock-filled';
12
12
  import { Frame } from '../components/Frame';
13
13
  import { Provider } from '../components/Provider';
14
14
  import { Byline } from '../../common/Byline';
@@ -20,6 +20,10 @@ import { ContentHeader } from '../components/ContentHeader';
20
20
  import { handleClickCommon } from '../utils/handlers';
21
21
  import { Link } from '../components/Link';
22
22
  import { UnresolvedText } from '../components/UnresolvedText';
23
+ import { Flex, xcss } from '@atlaskit/primitives';
24
+ var iconWrapperStyles = xcss({
25
+ marginRight: 'space.050'
26
+ });
23
27
  /**
24
28
  * Class name for selecting non-flexible forbidden block card
25
29
  *
@@ -82,14 +86,16 @@ export var ForbiddenView = function ForbiddenView(_ref) {
82
86
  ,
83
87
  className: blockCardForbiddenViewLinkClassName
84
88
  })), jsx(Byline, null, jsx(UnresolvedText, {
85
- icon:
86
- // eslint-disable-next-line @atlaskit/design-system/no-legacy-icons -- TODO - https://product-fabric.atlassian.net/browse/DSP-19497
87
- jsx(LockIcon, {
89
+ icon: jsx(Flex, {
90
+ alignItems: "center",
91
+ xcss: iconWrapperStyles
92
+ }, jsx(LockIcon, {
88
93
  label: "forbidden-lock-icon",
89
- size: "small",
90
- primaryColor: "var(--ds-icon-danger, ".concat(R300, ")"),
91
- testId: "".concat(testId, "-lock-icon")
92
- }),
94
+ LEGACY_size: "small",
95
+ color: "var(--ds-icon-danger, ".concat(R300, ")"),
96
+ testId: "".concat(testId, "-lock-icon"),
97
+ LEGACY_margin: "0 ".concat("var(--ds-space-negative-050, -4px)", " 0 0")
98
+ })),
93
99
  text: jsx(FormattedMessage, _extends({}, messages[descriptiveMessageKey], {
94
100
  values: {
95
101
  product: context.text,
@@ -4,7 +4,7 @@
4
4
  */
5
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
6
  import { css, jsx } from '@emotion/react';
7
- import DocumentFilledIcon from '@atlaskit/icon/glyph/document-filled';
7
+ import DocumentFilledIcon from '@atlaskit/icon/core/migration/file--editor-file';
8
8
  import { N50, N90 } from '@atlaskit/theme/colors';
9
9
  import { fontSize } from '@atlaskit/theme/constants';
10
10
  import { Frame } from '../components/Frame';
@@ -39,9 +39,10 @@ export var ResolvingView = function ResolvingView(_ref) {
39
39
  ,
40
40
  className: blockCardResolvingViewClassName
41
41
  }, jsx(DocumentFilledIcon, {
42
- size: "small",
43
- primaryColor: "var(--ds-icon-subtle, ".concat(N50, ")"),
44
- label: "document-icon"
42
+ LEGACY_size: "medium",
43
+ color: "var(--ds-icon-subtle, ".concat(N50, ")"),
44
+ label: "document-icon",
45
+ LEGACY_margin: "0 -4.3px 0 -4px"
45
46
  }), jsx("span", {
46
47
  css: messageStyles
47
48
  }, jsx(FormattedMessage, messages.loading)));
@@ -22,6 +22,7 @@ import { messages } from '../../../../../messages';
22
22
  import { useFlexibleUiContext, useFlexibleUiOptionContext } from '../../../../../state/flexible-ui-context';
23
23
  import ActionGroupItem from './action-group-item';
24
24
  import { filterActionItems } from '../utils';
25
+ import { di } from 'react-magnetic-di';
25
26
  var styles = css({
26
27
  display: 'inline-flex',
27
28
  lineHeight: '1rem',
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import Tooltip from '@atlaskit/tooltip';
3
+ import { di } from 'react-magnetic-di';
3
4
  import { FormattedMessage } from 'react-intl-next';
4
5
  import { Box, Inline } from '@atlaskit/primitives';
5
6
  import AIIcon from '../../../../../common/ai-icon';
@@ -14,6 +14,7 @@ import LayeredLink from './layered-link';
14
14
  import HoverCardControl from './hover-card-control';
15
15
  import { isFlexUiPreviewPresent } from '../../../../state/flexible-ui-context/utils';
16
16
  import { N40 } from '@atlaskit/theme/colors';
17
+ import { di } from 'react-magnetic-di';
17
18
  var elevationStyles = css({
18
19
  border: "1px solid ".concat("var(--ds-border, ".concat(N40, ")")),
19
20
  borderRadius: "var(--ds-border-radius-200, 8px)",
@@ -10,7 +10,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
10
10
  import LinkWarningModal from './LinkWarningModal';
11
11
  var PACKAGE_DATA = {
12
12
  packageName: "@atlaskit/smart-card",
13
- packageVersion: "29.0.3",
13
+ packageVersion: "29.1.1",
14
14
  componentName: 'linkUrl'
15
15
  };
16
16
  var Link = withLinkClickedEvent('a');
@@ -2,6 +2,6 @@ import { APIError } from '@atlaskit/linking-common';
2
2
  import { type JsonLd } from 'json-ld-types';
3
3
  declare const useResponse: () => {
4
4
  handleResolvedLinkError: (url: string, error: APIError, response?: JsonLd.Response, isMetadataRequest?: boolean) => void;
5
- handleResolvedLinkResponse: (resourceUrl: string, response: JsonLd.Response, isReloading?: any, isMetadataRequest?: boolean) => void;
5
+ handleResolvedLinkResponse: (resourceUrl: string, response: JsonLd.Response | undefined, isReloading?: any, isMetadataRequest?: boolean) => void;
6
6
  };
7
7
  export default useResponse;
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
2
  import { type CardAppearance, type CardPlatform, type CardProps } from './types';
3
3
  import { type WrappedComponentProps } from 'react-intl-next';
4
- export declare const Card: React.ForwardRefExoticComponent<Pick<Omit<import("react-intl-next").WithIntlProps<CardProps & WrappedComponentProps>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "url" | "appearance" | "container" | "children" | "data" | "key" | "id" | "placeholder" | "onError" | "onClick" | "testId" | "analyticsContext" | "isSelected" | "inheritDimensions" | "actionOptions" | "onResolve" | "ui" | "showHoverPreview" | "hoverPreviewOptions" | "showAuthTooltip" | "inlinePreloaderStyle" | "isHovered" | "removeTextHighlightingFromTitle" | "resolvingPlaceholder" | "truncateInline" | "useLegacyBlockCard" | "importer" | "fallbackComponent" | "embedIframeRef" | "embedIframeUrlType" | "frameStyle" | "platform" | "forwardedRef"> & React.RefAttributes<any>>;
4
+ export declare const Card: React.ForwardRefExoticComponent<Pick<Omit<Omit<CardProps & WrappedComponentProps, "intl"> & {
5
+ forwardedRef?: React.Ref<any> | undefined;
6
+ }, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "url" | "appearance" | "container" | "children" | "data" | "key" | "id" | "placeholder" | "onError" | "onClick" | "testId" | "analyticsContext" | "isSelected" | "inheritDimensions" | "actionOptions" | "onResolve" | "ui" | "showHoverPreview" | "hoverPreviewOptions" | "showAuthTooltip" | "inlinePreloaderStyle" | "isHovered" | "removeTextHighlightingFromTitle" | "resolvingPlaceholder" | "truncateInline" | "useLegacyBlockCard" | "importer" | "fallbackComponent" | "embedIframeRef" | "embedIframeUrlType" | "frameStyle" | "platform" | "forwardedRef"> & React.RefAttributes<any>>;
5
7
  export type { CardAppearance, CardProps, CardPlatform };
@@ -40,8 +40,17 @@ interface ActionProps {
40
40
  actionOptions?: CardActionOptions;
41
41
  }
42
42
  interface HoverPreviewProps extends ActionProps {
43
+ /**
44
+ * Flag to display hover preview on hover.
45
+ */
43
46
  showHoverPreview?: boolean;
47
+ /**
48
+ * Configuration for hover card.
49
+ */
44
50
  hoverPreviewOptions?: HoverPreviewOptions;
51
+ /**
52
+ * Flag to display unresolved views on hover preview.
53
+ */
45
54
  showAuthTooltip?: boolean;
46
55
  }
47
56
  export interface BaseCardProps {
@@ -102,13 +111,20 @@ export interface BaseCardProps {
102
111
  url?: string;
103
112
  }
104
113
  export interface InlineProps extends HoverPreviewProps {
114
+ /**
115
+ * By default, inline resolving states show a frame with a spinner on the left.
116
+ * An alternative is to remove the frame and place the spinner on the right by setting this value to `on-right-without-skeleton`.
117
+ * This property is specific to inline links in the editor.
118
+ */
105
119
  inlinePreloaderStyle?: InlinePreloaderStyle;
106
- /** A flag that determines whether a card is in a hover state in edit mode. Currently used for inline links only */
120
+ /**
121
+ * A flag that determines whether a card is in a hover state. Currently used for inline links in editor only.
122
+ */
107
123
  isHovered?: boolean;
108
124
  /**
109
125
  * When set to true, the text fragment will be removed from the title.
110
126
  * This will have no impact on the url and text highlighting will still persist in the url,
111
- * however the the text fragment will be stripped from the title of the smart card.
127
+ * however the text fragment will be stripped from the title of the smart card.
112
128
  * For example, when set to true: "my name | :~:text=highlight this" will be displayed as "my name"
113
129
  */
114
130
  removeTextHighlightingFromTitle?: boolean;
@@ -116,7 +132,9 @@ export interface InlineProps extends HoverPreviewProps {
116
132
  * When defined, this placeholder will be displayed while the smart card is resolving. This is only useful for inline cards.
117
133
  */
118
134
  resolvingPlaceholder?: string;
119
- /** When set to true, inline cards will be truncated to one line. */
135
+ /**
136
+ * When set to true, inline cards will be truncated to one line
137
+ */
120
138
  truncateInline?: boolean;
121
139
  }
122
140
  export interface BlockProps extends ActionProps {
@@ -154,7 +172,7 @@ export interface EmbedProps {
154
172
  inheritDimensions?: boolean;
155
173
  /**
156
174
  * Informs Smart Link of the device it is rendered in. Available values are `web` and `mobile`.
157
- * It is used together with link response `data.preview['atlassian:supportedPlatforms']`.
175
+ * It is used together with link response `data.preview["atlassian:supportedPlatforms"]`.
158
176
  * To make embed content available on all supported urls, use `web`.
159
177
  */
160
178
  platform?: CardPlatform;
@@ -2,6 +2,6 @@ import { APIError } from '@atlaskit/linking-common';
2
2
  import { type JsonLd } from 'json-ld-types';
3
3
  declare const useResponse: () => {
4
4
  handleResolvedLinkError: (url: string, error: APIError, response?: JsonLd.Response, isMetadataRequest?: boolean) => void;
5
- handleResolvedLinkResponse: (resourceUrl: string, response: JsonLd.Response, isReloading?: any, isMetadataRequest?: boolean) => void;
5
+ handleResolvedLinkResponse: (resourceUrl: string, response: JsonLd.Response | undefined, isReloading?: any, isMetadataRequest?: boolean) => void;
6
6
  };
7
7
  export default useResponse;
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
2
  import { type CardAppearance, type CardPlatform, type CardProps } from './types';
3
3
  import { type WrappedComponentProps } from 'react-intl-next';
4
- export declare const Card: React.ForwardRefExoticComponent<Pick<Omit<import("react-intl-next").WithIntlProps<CardProps & WrappedComponentProps>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "url" | "appearance" | "container" | "children" | "data" | "key" | "id" | "placeholder" | "onError" | "onClick" | "testId" | "analyticsContext" | "isSelected" | "inheritDimensions" | "actionOptions" | "onResolve" | "ui" | "showHoverPreview" | "hoverPreviewOptions" | "showAuthTooltip" | "inlinePreloaderStyle" | "isHovered" | "removeTextHighlightingFromTitle" | "resolvingPlaceholder" | "truncateInline" | "useLegacyBlockCard" | "importer" | "fallbackComponent" | "embedIframeRef" | "embedIframeUrlType" | "frameStyle" | "platform" | "forwardedRef"> & React.RefAttributes<any>>;
4
+ export declare const Card: React.ForwardRefExoticComponent<Pick<Omit<Omit<CardProps & WrappedComponentProps, "intl"> & {
5
+ forwardedRef?: React.Ref<any> | undefined;
6
+ }, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "url" | "appearance" | "container" | "children" | "data" | "key" | "id" | "placeholder" | "onError" | "onClick" | "testId" | "analyticsContext" | "isSelected" | "inheritDimensions" | "actionOptions" | "onResolve" | "ui" | "showHoverPreview" | "hoverPreviewOptions" | "showAuthTooltip" | "inlinePreloaderStyle" | "isHovered" | "removeTextHighlightingFromTitle" | "resolvingPlaceholder" | "truncateInline" | "useLegacyBlockCard" | "importer" | "fallbackComponent" | "embedIframeRef" | "embedIframeUrlType" | "frameStyle" | "platform" | "forwardedRef"> & React.RefAttributes<any>>;
5
7
  export type { CardAppearance, CardProps, CardPlatform };
@@ -40,8 +40,17 @@ interface ActionProps {
40
40
  actionOptions?: CardActionOptions;
41
41
  }
42
42
  interface HoverPreviewProps extends ActionProps {
43
+ /**
44
+ * Flag to display hover preview on hover.
45
+ */
43
46
  showHoverPreview?: boolean;
47
+ /**
48
+ * Configuration for hover card.
49
+ */
44
50
  hoverPreviewOptions?: HoverPreviewOptions;
51
+ /**
52
+ * Flag to display unresolved views on hover preview.
53
+ */
45
54
  showAuthTooltip?: boolean;
46
55
  }
47
56
  export interface BaseCardProps {
@@ -102,13 +111,20 @@ export interface BaseCardProps {
102
111
  url?: string;
103
112
  }
104
113
  export interface InlineProps extends HoverPreviewProps {
114
+ /**
115
+ * By default, inline resolving states show a frame with a spinner on the left.
116
+ * An alternative is to remove the frame and place the spinner on the right by setting this value to `on-right-without-skeleton`.
117
+ * This property is specific to inline links in the editor.
118
+ */
105
119
  inlinePreloaderStyle?: InlinePreloaderStyle;
106
- /** A flag that determines whether a card is in a hover state in edit mode. Currently used for inline links only */
120
+ /**
121
+ * A flag that determines whether a card is in a hover state. Currently used for inline links in editor only.
122
+ */
107
123
  isHovered?: boolean;
108
124
  /**
109
125
  * When set to true, the text fragment will be removed from the title.
110
126
  * This will have no impact on the url and text highlighting will still persist in the url,
111
- * however the the text fragment will be stripped from the title of the smart card.
127
+ * however the text fragment will be stripped from the title of the smart card.
112
128
  * For example, when set to true: "my name | :~:text=highlight this" will be displayed as "my name"
113
129
  */
114
130
  removeTextHighlightingFromTitle?: boolean;
@@ -116,7 +132,9 @@ export interface InlineProps extends HoverPreviewProps {
116
132
  * When defined, this placeholder will be displayed while the smart card is resolving. This is only useful for inline cards.
117
133
  */
118
134
  resolvingPlaceholder?: string;
119
- /** When set to true, inline cards will be truncated to one line. */
135
+ /**
136
+ * When set to true, inline cards will be truncated to one line
137
+ */
120
138
  truncateInline?: boolean;
121
139
  }
122
140
  export interface BlockProps extends ActionProps {
@@ -154,7 +172,7 @@ export interface EmbedProps {
154
172
  inheritDimensions?: boolean;
155
173
  /**
156
174
  * Informs Smart Link of the device it is rendered in. Available values are `web` and `mobile`.
157
- * It is used together with link response `data.preview['atlassian:supportedPlatforms']`.
175
+ * It is used together with link response `data.preview["atlassian:supportedPlatforms"]`.
158
176
  * To make embed content available on all supported urls, use `web`.
159
177
  */
160
178
  platform?: CardPlatform;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "29.0.3",
3
+ "version": "29.1.1",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -32,11 +32,11 @@
32
32
  "@atlaskit/badge": "^16.4.0",
33
33
  "@atlaskit/button": "^20.2.0",
34
34
  "@atlaskit/checkbox": "^14.0.0",
35
- "@atlaskit/dropdown-menu": "^12.18.0",
35
+ "@atlaskit/dropdown-menu": "^12.19.0",
36
36
  "@atlaskit/form": "^10.5.0",
37
37
  "@atlaskit/frontend-utilities": "^2.7.0",
38
38
  "@atlaskit/heading": "^2.4.0",
39
- "@atlaskit/icon": "^22.20.0",
39
+ "@atlaskit/icon": "^22.22.0",
40
40
  "@atlaskit/icon-file-type": "^6.5.0",
41
41
  "@atlaskit/icon-object": "^6.5.0",
42
42
  "@atlaskit/icon-priority": "^6.3.0",