@atlaskit/smart-card 26.26.2 → 26.27.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 26.27.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`12f9e6886ed`](https://bitbucket.org/atlassian/atlassian-frontend/commits/12f9e6886ed) - [ux] Add follow/unfollow button to card and hover preview (behind feature flag).
8
+
3
9
  ## 26.26.2
4
10
 
5
11
  ### Patch Changes
@@ -23,7 +23,7 @@ exports.ANALYTICS_CHANNEL = ANALYTICS_CHANNEL;
23
23
  var context = {
24
24
  componentName: 'smart-cards',
25
25
  packageName: "@atlaskit/smart-card",
26
- packageVersion: "26.26.2"
26
+ packageVersion: "26.27.0"
27
27
  };
28
28
  exports.context = context;
29
29
  var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
@@ -10,7 +10,6 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
10
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
11
  var _react = _interopRequireWildcard(require("react"));
12
12
  var _FlexibleCard = _interopRequireDefault(require("../../../FlexibleCard"));
13
- var _titleBlock = _interopRequireDefault(require("../../../FlexibleCard/components/blocks/title-block"));
14
13
  var _blocks = require("../../../FlexibleCard/components/blocks");
15
14
  var _styled = require("./styled");
16
15
  var _constants = require("../../../../constants");
@@ -48,6 +47,21 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
48
47
  titleMetadata = _ref2.titleMetadata,
49
48
  topMetadata = _ref2.topMetadata,
50
49
  bottomMetadata = _ref2.bottomMetadata;
50
+ var footerActions = (0, _react.useMemo)(function () {
51
+ return [{
52
+ name: _constants.ActionName.FollowAction,
53
+ hideIcon: true
54
+ }, {
55
+ name: _constants.ActionName.PreviewAction,
56
+ hideIcon: true
57
+ }, {
58
+ name: _constants.ActionName.ViewAction,
59
+ hideIcon: true
60
+ }, {
61
+ name: _constants.ActionName.DownloadAction,
62
+ hideIcon: true
63
+ }];
64
+ }, []);
51
65
  return /*#__PURE__*/_react.default.createElement(_FlexibleCard.default, {
52
66
  analytics: analytics,
53
67
  appearance: "block",
@@ -61,7 +75,7 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
61
75
  hideElevation: true
62
76
  },
63
77
  url: url
64
- }, /*#__PURE__*/_react.default.createElement(_titleBlock.default, (0, _extends2.default)({
78
+ }, /*#__PURE__*/_react.default.createElement(_blocks.TitleBlock, (0, _extends2.default)({
65
79
  position: _constants.SmartLinkPosition.Center,
66
80
  metadata: titleMetadata,
67
81
  hideRetry: true,
@@ -88,16 +102,7 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
88
102
  }) : null, /*#__PURE__*/_react.default.createElement(_blocks.FooterBlock, (0, _extends2.default)({}, (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && {
89
103
  overrideCss: _styled.footerBlockCss
90
104
  }, {
91
- actions: [{
92
- name: _constants.ActionName.PreviewAction,
93
- hideIcon: true
94
- }, {
95
- name: _constants.ActionName.ViewAction,
96
- hideIcon: true
97
- }, {
98
- name: _constants.ActionName.DownloadAction,
99
- hideIcon: true
100
- }]
105
+ actions: footerActions
101
106
  })));
102
107
  };
103
108
  var _default = (0, _withFlexibleUIBlockCardStyle.withFlexibleUIBlockCardStyle)(FlexibleResolvedView);
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.toFooterActions = exports.default = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
11
  var _react = _interopRequireWildcard(require("react"));
11
12
  var _constants = require("../../../../../constants");
12
13
  var _blocks = require("../../../../FlexibleCard/components/blocks");
@@ -21,7 +22,11 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
21
22
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
22
23
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
24
  var toFooterActions = function toFooterActions(cardActions, onActionClick) {
24
- return cardActions.map(function (action) {
25
+ var followAction = {
26
+ hideIcon: true,
27
+ name: _constants.ActionName.FollowAction
28
+ };
29
+ var actions = cardActions.map(function (action) {
25
30
  if (action.id === 'preview-content') {
26
31
  return {
27
32
  content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.preview_improved),
@@ -48,6 +53,7 @@ var toFooterActions = function toFooterActions(cardActions, onActionClick) {
48
53
  testId: action.id
49
54
  };
50
55
  });
56
+ return [followAction].concat((0, _toConsumableArray2.default)(actions));
51
57
  };
52
58
  exports.toFooterActions = toFooterActions;
53
59
  var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
@@ -18,7 +18,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
18
18
  _excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
19
19
  var PACKAGE_DATA = {
20
20
  packageName: "@atlaskit/smart-card",
21
- packageVersion: "26.26.2",
21
+ packageVersion: "26.27.0",
22
22
  componentName: 'linkUrl'
23
23
  };
24
24
  var Link = (0, _click.withLinkClickedEvent)('a');
@@ -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: "26.26.2"
7
+ packageVersion: "26.27.0"
8
8
  };
9
9
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -1,14 +1,12 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React, { useEffect, useState } from 'react';
2
+ import React, { useEffect, useMemo, useState } from 'react';
3
3
  import FlexibleCard from '../../../FlexibleCard';
4
- import TitleBlock from '../../../FlexibleCard/components/blocks/title-block';
5
- import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock } from '../../../FlexibleCard/components/blocks';
4
+ import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock, TitleBlock } from '../../../FlexibleCard/components/blocks';
6
5
  import { metadataBlockCss, footerBlockCss } from './styled';
7
6
  import { ActionName, ElementName, MediaPlacement, SmartLinkPosition } from '../../../../constants';
8
7
  import { getSimulatedMetadata, getSimulatedBetterMetadata } from './utils';
9
8
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
10
9
  import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardStyle';
11
-
12
10
  /**
13
11
  * This view represents a Block card that has an 'Resolved' status.
14
12
  * @see SmartLinkStatus
@@ -36,6 +34,19 @@ const FlexibleResolvedView = ({
36
34
  topMetadata,
37
35
  bottomMetadata
38
36
  } = getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? getSimulatedBetterMetadata(cardState.details) : getSimulatedMetadata(cardState.details);
37
+ const footerActions = useMemo(() => [{
38
+ name: ActionName.FollowAction,
39
+ hideIcon: true
40
+ }, {
41
+ name: ActionName.PreviewAction,
42
+ hideIcon: true
43
+ }, {
44
+ name: ActionName.ViewAction,
45
+ hideIcon: true
46
+ }, {
47
+ name: ActionName.DownloadAction,
48
+ hideIcon: true
49
+ }], []);
39
50
  return /*#__PURE__*/React.createElement(FlexibleCard, {
40
51
  analytics: analytics,
41
52
  appearance: "block",
@@ -76,16 +87,7 @@ const FlexibleResolvedView = ({
76
87
  }) : null, /*#__PURE__*/React.createElement(FooterBlock, _extends({}, getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && {
77
88
  overrideCss: footerBlockCss
78
89
  }, {
79
- actions: [{
80
- name: ActionName.PreviewAction,
81
- hideIcon: true
82
- }, {
83
- name: ActionName.ViewAction,
84
- hideIcon: true
85
- }, {
86
- name: ActionName.DownloadAction,
87
- hideIcon: true
88
- }]
90
+ actions: footerActions
89
91
  })));
90
92
  };
91
93
  export default withFlexibleUIBlockCardStyle(FlexibleResolvedView);
@@ -11,7 +11,11 @@ import { messages } from '../../../../../messages';
11
11
  import { FormattedMessage } from 'react-intl-next';
12
12
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
13
13
  export const toFooterActions = (cardActions, onActionClick) => {
14
- return cardActions.map(action => {
14
+ const followAction = {
15
+ hideIcon: true,
16
+ name: ActionName.FollowAction
17
+ };
18
+ const actions = cardActions.map(action => {
15
19
  if (action.id === 'preview-content') {
16
20
  return {
17
21
  content: /*#__PURE__*/React.createElement(FormattedMessage, messages.preview_improved),
@@ -38,6 +42,7 @@ export const toFooterActions = (cardActions, onActionClick) => {
38
42
  testId: action.id
39
43
  };
40
44
  });
45
+ return [followAction, ...actions];
41
46
  };
42
47
  const HoverCardResolvedView = ({
43
48
  flexibleCardProps,
@@ -8,7 +8,7 @@ import LinkWarningModal from './LinkWarningModal';
8
8
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
9
9
  const PACKAGE_DATA = {
10
10
  packageName: "@atlaskit/smart-card",
11
- packageVersion: "26.26.2",
11
+ packageVersion: "26.27.0",
12
12
  componentName: 'linkUrl'
13
13
  };
14
14
  const Link = withLinkClickedEvent('a');
@@ -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: "26.26.2"
18
+ packageVersion: "26.27.0"
19
19
  };
20
20
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
21
21
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -1,15 +1,13 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
- import React, { useEffect, useState } from 'react';
3
+ import React, { useEffect, useMemo, useState } from 'react';
4
4
  import FlexibleCard from '../../../FlexibleCard';
5
- import TitleBlock from '../../../FlexibleCard/components/blocks/title-block';
6
- import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock } from '../../../FlexibleCard/components/blocks';
5
+ import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock, TitleBlock } from '../../../FlexibleCard/components/blocks';
7
6
  import { metadataBlockCss, footerBlockCss } from './styled';
8
7
  import { ActionName, ElementName, MediaPlacement, SmartLinkPosition } from '../../../../constants';
9
8
  import { getSimulatedMetadata, getSimulatedBetterMetadata } from './utils';
10
9
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
11
10
  import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardStyle';
12
-
13
11
  /**
14
12
  * This view represents a Block card that has an 'Resolved' status.
15
13
  * @see SmartLinkStatus
@@ -39,6 +37,21 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
39
37
  titleMetadata = _ref2.titleMetadata,
40
38
  topMetadata = _ref2.topMetadata,
41
39
  bottomMetadata = _ref2.bottomMetadata;
40
+ var footerActions = useMemo(function () {
41
+ return [{
42
+ name: ActionName.FollowAction,
43
+ hideIcon: true
44
+ }, {
45
+ name: ActionName.PreviewAction,
46
+ hideIcon: true
47
+ }, {
48
+ name: ActionName.ViewAction,
49
+ hideIcon: true
50
+ }, {
51
+ name: ActionName.DownloadAction,
52
+ hideIcon: true
53
+ }];
54
+ }, []);
42
55
  return /*#__PURE__*/React.createElement(FlexibleCard, {
43
56
  analytics: analytics,
44
57
  appearance: "block",
@@ -79,16 +92,7 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
79
92
  }) : null, /*#__PURE__*/React.createElement(FooterBlock, _extends({}, getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && {
80
93
  overrideCss: footerBlockCss
81
94
  }, {
82
- actions: [{
83
- name: ActionName.PreviewAction,
84
- hideIcon: true
85
- }, {
86
- name: ActionName.ViewAction,
87
- hideIcon: true
88
- }, {
89
- name: ActionName.DownloadAction,
90
- hideIcon: true
91
- }]
95
+ actions: footerActions
92
96
  })));
93
97
  };
94
98
  export default withFlexibleUIBlockCardStyle(FlexibleResolvedView);
@@ -1,4 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
3
  import React, { useCallback, useEffect, useMemo, useRef } from 'react';
3
4
  import { ActionName, CardDisplay, SmartLinkPosition, SmartLinkSize } from '../../../../../constants';
4
5
  import { FooterBlock, MetadataBlock, SnippetBlock, TitleBlock } from '../../../../FlexibleCard/components/blocks';
@@ -11,7 +12,11 @@ import { messages } from '../../../../../messages';
11
12
  import { FormattedMessage } from 'react-intl-next';
12
13
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
13
14
  export var toFooterActions = function toFooterActions(cardActions, onActionClick) {
14
- return cardActions.map(function (action) {
15
+ var followAction = {
16
+ hideIcon: true,
17
+ name: ActionName.FollowAction
18
+ };
19
+ var actions = cardActions.map(function (action) {
15
20
  if (action.id === 'preview-content') {
16
21
  return {
17
22
  content: /*#__PURE__*/React.createElement(FormattedMessage, messages.preview_improved),
@@ -38,6 +43,7 @@ export var toFooterActions = function toFooterActions(cardActions, onActionClick
38
43
  testId: action.id
39
44
  };
40
45
  });
46
+ return [followAction].concat(_toConsumableArray(actions));
41
47
  };
42
48
  var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
43
49
  var _cardState$details;
@@ -11,7 +11,7 @@ import LinkWarningModal from './LinkWarningModal';
11
11
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
12
12
  var PACKAGE_DATA = {
13
13
  packageName: "@atlaskit/smart-card",
14
- packageVersion: "26.26.2",
14
+ packageVersion: "26.27.0",
15
15
  componentName: 'linkUrl'
16
16
  };
17
17
  var Link = withLinkClickedEvent('a');
@@ -1,68 +1,3 @@
1
- declare const _default: {
2
- meta: {
3
- auth: never[];
4
- definitionId: string;
5
- product: string;
6
- visibility: string;
7
- access: string;
8
- key: string;
9
- };
10
- data: {
11
- '@context': {
12
- '@vocab': string;
13
- atlassian: string;
14
- schema: string;
15
- };
16
- generator: {
17
- '@type': string;
18
- '@id': string;
19
- name: string;
20
- icon: {
21
- '@type': string;
22
- url: string;
23
- };
24
- };
25
- '@type': string[];
26
- url: string;
27
- icon: {
28
- '@type': string;
29
- url: string;
30
- };
31
- name: string;
32
- summary: string;
33
- 'atlassian:state': {
34
- '@type': string;
35
- name: string;
36
- appearance: string;
37
- };
38
- attributedTo: {
39
- name: string;
40
- icon: string;
41
- }[];
42
- 'atlassian:updatedBy': {
43
- name: string;
44
- icon: string;
45
- }[];
46
- preview: {
47
- '@type': string;
48
- href: string;
49
- };
50
- 'schema:commentCount': number;
51
- 'atlassian:subscriberCount': number;
52
- endTime: string;
53
- updated: string;
54
- 'atlassian:serverAction': {
55
- '@type': string;
56
- name: string;
57
- dataUpdateAction: {
58
- '@type': string;
59
- name: string;
60
- };
61
- resourceIdentifiers: {
62
- ari: string;
63
- };
64
- refField: string;
65
- }[];
66
- };
67
- };
1
+ import { JsonLd } from 'json-ld-types';
2
+ declare const _default: JsonLd.Response<JsonLd.Data.BaseData>;
68
3
  export default _default;
@@ -1,68 +1,3 @@
1
- declare const _default: {
2
- meta: {
3
- auth: never[];
4
- definitionId: string;
5
- product: string;
6
- visibility: string;
7
- access: string;
8
- key: string;
9
- };
10
- data: {
11
- '@context': {
12
- '@vocab': string;
13
- atlassian: string;
14
- schema: string;
15
- };
16
- generator: {
17
- '@type': string;
18
- '@id': string;
19
- name: string;
20
- icon: {
21
- '@type': string;
22
- url: string;
23
- };
24
- };
25
- '@type': string[];
26
- url: string;
27
- icon: {
28
- '@type': string;
29
- url: string;
30
- };
31
- name: string;
32
- summary: string;
33
- 'atlassian:state': {
34
- '@type': string;
35
- name: string;
36
- appearance: string;
37
- };
38
- attributedTo: {
39
- name: string;
40
- icon: string;
41
- }[];
42
- 'atlassian:updatedBy': {
43
- name: string;
44
- icon: string;
45
- }[];
46
- preview: {
47
- '@type': string;
48
- href: string;
49
- };
50
- 'schema:commentCount': number;
51
- 'atlassian:subscriberCount': number;
52
- endTime: string;
53
- updated: string;
54
- 'atlassian:serverAction': {
55
- '@type': string;
56
- name: string;
57
- dataUpdateAction: {
58
- '@type': string;
59
- name: string;
60
- };
61
- resourceIdentifiers: {
62
- ari: string;
63
- };
64
- refField: string;
65
- }[];
66
- };
67
- };
1
+ import { JsonLd } from 'json-ld-types';
2
+ declare const _default: JsonLd.Response<JsonLd.Data.BaseData>;
68
3
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.26.2",
3
+ "version": "26.27.0",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -38,7 +38,7 @@
38
38
  "@atlaskit/link-analytics": "^8.3.0",
39
39
  "@atlaskit/link-client-extension": "^1.7.0",
40
40
  "@atlaskit/link-extractors": "^1.1.0",
41
- "@atlaskit/linking-common": "^4.9.0",
41
+ "@atlaskit/linking-common": "^4.10.0",
42
42
  "@atlaskit/linking-types": "^8.3.0",
43
43
  "@atlaskit/logo": "^13.14.0",
44
44
  "@atlaskit/lozenge": "^11.4.0",
@@ -48,7 +48,7 @@
48
48
  "@atlaskit/popup": "^1.9.0",
49
49
  "@atlaskit/spinner": "^15.5.0",
50
50
  "@atlaskit/theme": "^12.6.0",
51
- "@atlaskit/tokens": "^1.22.0",
51
+ "@atlaskit/tokens": "^1.23.0",
52
52
  "@atlaskit/tooltip": "^17.8.0",
53
53
  "@atlaskit/ufo": "^0.2.0",
54
54
  "@babel/runtime": "^7.0.0",