@atlaskit/smart-card 40.15.2 → 40.16.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,27 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 40.16.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`38a07e571c534`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/38a07e571c534) -
8
+ CNS-19292: Adds a "preview size" option to action options prop on Smart Card. This allows users of
9
+ Smart Card to define a size of the modal that will be opened when a Preview Action is clicked.
10
+
11
+ Usage:
12
+
13
+ ```TSX
14
+ // Both of these accept a EmbedModalSize enum "small" or "large".
15
+ // To enable "small" modal when preview action is clicked.
16
+ <Card actionOptions={{previewAction: {size: "small"}, hide: false}}/>
17
+ // To enable "large" (default) modal when preview action is clicked.
18
+ <Card actionOptions={{previewAction: {size: "large"}, hide: false}}/>
19
+ ```
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies
24
+
3
25
  ## 40.15.2
4
26
 
5
27
  ### Patch Changes
@@ -8,6 +8,7 @@ exports.extractInvokePreviewAction = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _linkExtractors = require("@atlaskit/link-extractors");
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
12
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
12
13
  var _index = require("../../index");
13
14
  var _helpers = require("../../state/helpers");
@@ -48,7 +49,7 @@ var extractInvokePreviewAction = exports.extractInvokePreviewAction = function e
48
49
  invokeAction: {
49
50
  actionFn: function () {
50
51
  var _actionFn = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
51
- var _extractSmartLinkProv, _extractSmartLinkEmbe;
52
+ var _extractSmartLinkProv, _extractSmartLinkEmbe, _actionOptions$previe;
52
53
  return _regenerator.default.wrap(function _callee$(_context) {
53
54
  while (1) switch (_context.prev = _context.next) {
54
55
  case 0:
@@ -80,7 +81,8 @@ var extractInvokePreviewAction = exports.extractInvokePreviewAction = function e
80
81
  origin: origin,
81
82
  src: (_extractSmartLinkEmbe = (0, _linkExtractors.extractSmartLinkEmbed)(response)) === null || _extractSmartLinkEmbe === void 0 ? void 0 : _extractSmartLinkEmbe.src,
82
83
  title: (0, _linkExtractors.extractSmartLinkTitle)(response),
83
- url: url
84
+ url: url,
85
+ size: (0, _platformFeatureFlags.fg)('platform_linking_enable_card_preview_action_size') ? actionOptions === null || actionOptions === void 0 || (_actionOptions$previe = actionOptions.previewAction) === null || _actionOptions$previe === void 0 ? void 0 : _actionOptions$previe.size : undefined
84
86
  });
85
87
  case 6:
86
88
  case "end":
@@ -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: "0.0.0-development"
14
+ packageVersion: "40.15.2"
15
15
  };
16
16
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
17
17
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -14,4 +14,10 @@ var CardAction = exports.CardAction = /*#__PURE__*/function (CardAction) {
14
14
  CardAction["AISummaryAction"] = "AISummaryAction";
15
15
  CardAction["AutomationAction"] = "AutomationAction";
16
16
  return CardAction;
17
- }({});
17
+ }({});
18
+ /**
19
+ * A CardActionOptions object contains the configuration for the actions available on the card.
20
+ */
21
+ /**
22
+ * Determines which actions are visible on the card.
23
+ */
@@ -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: "0.0.0-development",
22
+ packageVersion: "40.15.2",
23
23
  componentName: 'linkUrl'
24
24
  };
25
25
  var Anchor = (0, _click.withLinkClickedEvent)('a');
@@ -1,4 +1,5 @@
1
1
  import { extractPreview as extractPreviewData, extractSmartLinkAri, extractSmartLinkEmbed, extractSmartLinkProvider, extractSmartLinkTitle, extractSmartLinkUrl } from '@atlaskit/link-extractors';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
3
4
  import { ActionName, CardAction } from '../../index';
4
5
  import { getExtensionKey } from '../../state/helpers';
@@ -48,7 +49,7 @@ export const extractInvokePreviewAction = param => {
48
49
  iconUrl: undefined
49
50
  });
50
51
  } else {
51
- var _extractSmartLinkProv, _extractSmartLinkEmbe;
52
+ var _extractSmartLinkProv, _extractSmartLinkEmbe, _actionOptions$previe;
52
53
  await openEmbedModal({
53
54
  fireEvent,
54
55
  extensionKey,
@@ -63,7 +64,8 @@ export const extractInvokePreviewAction = param => {
63
64
  origin,
64
65
  src: (_extractSmartLinkEmbe = extractSmartLinkEmbed(response)) === null || _extractSmartLinkEmbe === void 0 ? void 0 : _extractSmartLinkEmbe.src,
65
66
  title: extractSmartLinkTitle(response),
66
- url
67
+ url,
68
+ size: fg('platform_linking_enable_card_preview_action_size') ? actionOptions === null || actionOptions === void 0 ? void 0 : (_actionOptions$previe = actionOptions.previewAction) === null || _actionOptions$previe === void 0 ? void 0 : _actionOptions$previe.size : undefined
67
69
  });
68
70
  }
69
71
  },
@@ -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: "0.0.0-development"
5
+ packageVersion: "40.15.2"
6
6
  };
7
7
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
8
8
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -8,4 +8,12 @@ export let CardAction = /*#__PURE__*/function (CardAction) {
8
8
  CardAction["AISummaryAction"] = "AISummaryAction";
9
9
  CardAction["AutomationAction"] = "AutomationAction";
10
10
  return CardAction;
11
- }({});
11
+ }({});
12
+
13
+ /**
14
+ * A CardActionOptions object contains the configuration for the actions available on the card.
15
+ */
16
+
17
+ /**
18
+ * Determines which actions are visible on the card.
19
+ */
@@ -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: "0.0.0-development",
12
+ packageVersion: "40.15.2",
13
13
  componentName: 'linkUrl'
14
14
  };
15
15
  const Anchor = withLinkClickedEvent('a');
@@ -1,6 +1,7 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import { extractPreview as extractPreviewData, extractSmartLinkAri, extractSmartLinkEmbed, extractSmartLinkProvider, extractSmartLinkTitle, extractSmartLinkUrl } from '@atlaskit/link-extractors';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
6
  import { ActionName, CardAction } from '../../index';
6
7
  import { getExtensionKey } from '../../state/helpers';
@@ -41,7 +42,7 @@ export var extractInvokePreviewAction = function extractInvokePreviewAction(para
41
42
  invokeAction: {
42
43
  actionFn: function () {
43
44
  var _actionFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
44
- var _extractSmartLinkProv, _extractSmartLinkEmbe;
45
+ var _extractSmartLinkProv, _extractSmartLinkEmbe, _actionOptions$previe;
45
46
  return _regeneratorRuntime.wrap(function _callee$(_context) {
46
47
  while (1) switch (_context.prev = _context.next) {
47
48
  case 0:
@@ -73,7 +74,8 @@ export var extractInvokePreviewAction = function extractInvokePreviewAction(para
73
74
  origin: origin,
74
75
  src: (_extractSmartLinkEmbe = extractSmartLinkEmbed(response)) === null || _extractSmartLinkEmbe === void 0 ? void 0 : _extractSmartLinkEmbe.src,
75
76
  title: extractSmartLinkTitle(response),
76
- url: url
77
+ url: url,
78
+ size: fg('platform_linking_enable_card_preview_action_size') ? actionOptions === null || actionOptions === void 0 || (_actionOptions$previe = actionOptions.previewAction) === null || _actionOptions$previe === void 0 ? void 0 : _actionOptions$previe.size : undefined
77
79
  });
78
80
  case 6:
79
81
  case "end":
@@ -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: "0.0.0-development"
7
+ packageVersion: "40.15.2"
8
8
  };
9
9
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -8,4 +8,12 @@ export var CardAction = /*#__PURE__*/function (CardAction) {
8
8
  CardAction["AISummaryAction"] = "AISummaryAction";
9
9
  CardAction["AutomationAction"] = "AutomationAction";
10
10
  return CardAction;
11
- }({});
11
+ }({});
12
+
13
+ /**
14
+ * A CardActionOptions object contains the configuration for the actions available on the card.
15
+ */
16
+
17
+ /**
18
+ * Determines which actions are visible on the card.
19
+ */
@@ -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: "0.0.0-development",
15
+ packageVersion: "40.15.2",
16
16
  componentName: 'linkUrl'
17
17
  };
18
18
  var Anchor = withLinkClickedEvent('a');
@@ -2,6 +2,7 @@ import { type WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
2
2
  import { type CardPlatform } from '@atlaskit/link-extractors';
3
3
  import { type CardAppearance } from '@atlaskit/linking-common';
4
4
  import { type FrameStyle } from '../EmbedCard/types';
5
+ import type { EmbedModalSize } from '../EmbedModal/types';
5
6
  import { type FlexibleUiOptions } from '../FlexibleCard/types';
6
7
  import { type HoverPreviewOptions } from '../HoverCard/types';
7
8
  import { type InlinePreloaderStyle, type OnErrorCallback } from '../types';
@@ -23,7 +24,24 @@ export declare enum CardAction {
23
24
  AISummaryAction = "AISummaryAction",
24
25
  AutomationAction = "AutomationAction"
25
26
  }
26
- export type CardActionOptions = {
27
+ /**
28
+ * A CardActionOptions object contains the configuration for the actions available on the card.
29
+ */
30
+ export type CardActionOptions = CardActionVisibilityOptions & {
31
+ /**
32
+ * Contains configuration for the preview action.
33
+ */
34
+ previewAction?: {
35
+ /**
36
+ * Determines the size of the preview modal when the preview action is clicked.
37
+ */
38
+ size?: EmbedModalSize;
39
+ };
40
+ };
41
+ /**
42
+ * Determines which actions are visible on the card.
43
+ */
44
+ export type CardActionVisibilityOptions = {
27
45
  hide: true;
28
46
  } | {
29
47
  exclude?: Array<CardAction>;
@@ -2,6 +2,7 @@ import { type WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
2
2
  import { type CardPlatform } from '@atlaskit/link-extractors';
3
3
  import { type CardAppearance } from '@atlaskit/linking-common';
4
4
  import { type FrameStyle } from '../EmbedCard/types';
5
+ import type { EmbedModalSize } from '../EmbedModal/types';
5
6
  import { type FlexibleUiOptions } from '../FlexibleCard/types';
6
7
  import { type HoverPreviewOptions } from '../HoverCard/types';
7
8
  import { type InlinePreloaderStyle, type OnErrorCallback } from '../types';
@@ -23,7 +24,24 @@ export declare enum CardAction {
23
24
  AISummaryAction = "AISummaryAction",
24
25
  AutomationAction = "AutomationAction"
25
26
  }
26
- export type CardActionOptions = {
27
+ /**
28
+ * A CardActionOptions object contains the configuration for the actions available on the card.
29
+ */
30
+ export type CardActionOptions = CardActionVisibilityOptions & {
31
+ /**
32
+ * Contains configuration for the preview action.
33
+ */
34
+ previewAction?: {
35
+ /**
36
+ * Determines the size of the preview modal when the preview action is clicked.
37
+ */
38
+ size?: EmbedModalSize;
39
+ };
40
+ };
41
+ /**
42
+ * Determines which actions are visible on the card.
43
+ */
44
+ export type CardActionVisibilityOptions = {
27
45
  hide: true;
28
46
  } | {
29
47
  exclude?: Array<CardAction>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "40.15.2",
3
+ "version": "40.16.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.11.0",
71
+ "@atlaskit/tmp-editor-statsig": "^11.12.0",
72
72
  "@atlaskit/tokens": "^6.1.0",
73
73
  "@atlaskit/tooltip": "^20.4.0",
74
74
  "@atlaskit/ufo": "^0.4.0",
@@ -166,6 +166,9 @@
166
166
  ".": "./src/index.ts"
167
167
  },
168
168
  "platform-feature-flags": {
169
+ "platform_linking_enable_card_preview_action_size": {
170
+ "type": "boolean"
171
+ },
169
172
  "platform-visual-refresh-icons": {
170
173
  "type": "boolean"
171
174
  },