@atlaskit/smart-card 35.2.1 → 35.2.2

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,13 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 35.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#123971](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/123971)
8
+ [`eb093d08675da`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/eb093d08675da) -
9
+ [ux] Use new ADS button only on block card and hover card
10
+
3
11
  ## 35.2.1
4
12
 
5
13
  ### 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: "35.2.1"
14
+ packageVersion: "35.2.2"
15
15
  };
16
16
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
17
17
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -140,7 +140,8 @@ var getSimulatedBetterMetadata = exports.getSimulatedBetterMetadata = function g
140
140
  }
141
141
  };
142
142
  var FlexibleCardUiOptions = exports.FlexibleCardUiOptions = {
143
- hideElevation: true
143
+ hideElevation: true,
144
+ hideLegacyButton: true
144
145
  };
145
146
  var titleBlockOptions = exports.titleBlockOptions = {
146
147
  anchorTarget: '_self',
@@ -16,6 +16,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
16
  var _compiled = require("@atlaskit/primitives/compiled");
17
17
  var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
18
18
  var _constants = require("../../../../../../constants");
19
+ var _flexibleUiContext = require("../../../../../../state/flexible-ui-context");
19
20
  var _withOverrideCss = require("../../../common/with-override-css");
20
21
  var _utils = require("../../../utils");
21
22
  var _ActionButtonOld = _interopRequireDefault(require("./ActionButtonOld"));
@@ -194,9 +195,16 @@ var ActionButtonNew = function ActionButtonNew(_ref2) {
194
195
  "aria-label": ariaLabel
195
196
  }, content)));
196
197
  };
198
+ var ActionButtonHideLegacyButton = function ActionButtonHideLegacyButton(props) {
199
+ var ui = (0, _flexibleUiContext.useFlexibleUiOptionContext)();
200
+ if (ui !== null && ui !== void 0 && ui.hideLegacyButton) {
201
+ return /*#__PURE__*/_react.default.createElement(ActionButtonRefreshNewWithOverrideCss, props);
202
+ }
203
+ return /*#__PURE__*/_react.default.createElement(ActionButtonNew, props);
204
+ };
197
205
  var ActionButton = function ActionButton(props) {
198
206
  if ((0, _platformFeatureFlags.fg)('bandicoots-compiled-migration-smartcard')) {
199
- return (0, _platformFeatureFlags.fg)('platform-linking-visual-refresh-v1') ? /*#__PURE__*/_react.default.createElement(ActionButtonRefreshNewWithOverrideCss, props) : /*#__PURE__*/_react.default.createElement(ActionButtonNew, props);
207
+ return (0, _platformFeatureFlags.fg)('platform-linking-visual-refresh-v1') ? /*#__PURE__*/_react.default.createElement(ActionButtonHideLegacyButton, props) : /*#__PURE__*/_react.default.createElement(ActionButtonNew, props);
200
208
  }
201
209
  return /*#__PURE__*/_react.default.createElement(_ActionButtonOld.default, props);
202
210
  };
@@ -16,6 +16,7 @@ var HOVER_CARD_Z_INDEX = exports.HOVER_CARD_Z_INDEX = _constants.layers.modal();
16
16
  var flexibleUiOptions = exports.flexibleUiOptions = {
17
17
  hideBackground: true,
18
18
  hideElevation: true,
19
+ hideLegacyButton: true,
19
20
  size: _constants2.SmartLinkSize.Medium,
20
21
  zIndex: HOVER_CARD_Z_INDEX + 1
21
22
  };
@@ -20,7 +20,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
20
20
  _excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
21
21
  var PACKAGE_DATA = {
22
22
  packageName: "@atlaskit/smart-card",
23
- packageVersion: "35.2.1",
23
+ packageVersion: "35.2.2",
24
24
  componentName: 'linkUrl'
25
25
  };
26
26
  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: "35.2.1"
5
+ packageVersion: "35.2.2"
6
6
  };
7
7
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
8
8
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -134,7 +134,8 @@ export const getSimulatedBetterMetadata = cardDetails => {
134
134
  }
135
135
  };
136
136
  export const FlexibleCardUiOptions = {
137
- hideElevation: true
137
+ hideElevation: true,
138
+ hideLegacyButton: true
138
139
  };
139
140
  export const titleBlockOptions = {
140
141
  anchorTarget: '_self',
@@ -8,6 +8,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
8
8
  import { Box } from '@atlaskit/primitives/compiled';
9
9
  import Tooltip from '@atlaskit/tooltip';
10
10
  import { SmartLinkSize } from '../../../../../../constants';
11
+ import { useFlexibleUiOptionContext } from '../../../../../../state/flexible-ui-context';
11
12
  import { withOverrideCss } from '../../../common/with-override-css';
12
13
  import { sizeToButtonSpacing } from '../../../utils';
13
14
  import ActionButtonOld from './ActionButtonOld';
@@ -174,9 +175,16 @@ const ActionButtonNew = ({
174
175
  "aria-label": ariaLabel
175
176
  }, content)));
176
177
  };
178
+ const ActionButtonHideLegacyButton = props => {
179
+ const ui = useFlexibleUiOptionContext();
180
+ if (ui !== null && ui !== void 0 && ui.hideLegacyButton) {
181
+ return /*#__PURE__*/React.createElement(ActionButtonRefreshNewWithOverrideCss, props);
182
+ }
183
+ return /*#__PURE__*/React.createElement(ActionButtonNew, props);
184
+ };
177
185
  const ActionButton = props => {
178
186
  if (fg('bandicoots-compiled-migration-smartcard')) {
179
- return fg('platform-linking-visual-refresh-v1') ? /*#__PURE__*/React.createElement(ActionButtonRefreshNewWithOverrideCss, props) : /*#__PURE__*/React.createElement(ActionButtonNew, props);
187
+ return fg('platform-linking-visual-refresh-v1') ? /*#__PURE__*/React.createElement(ActionButtonHideLegacyButton, props) : /*#__PURE__*/React.createElement(ActionButtonNew, props);
180
188
  }
181
189
  return /*#__PURE__*/React.createElement(ActionButtonOld, props);
182
190
  };
@@ -8,6 +8,7 @@ export const HOVER_CARD_Z_INDEX = layers.modal();
8
8
  export const flexibleUiOptions = {
9
9
  hideBackground: true,
10
10
  hideElevation: true,
11
+ hideLegacyButton: true,
11
12
  size: SmartLinkSize.Medium,
12
13
  zIndex: HOVER_CARD_Z_INDEX + 1
13
14
  };
@@ -10,7 +10,7 @@ import LinkWarningModal from './LinkWarningModal';
10
10
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
11
11
  const PACKAGE_DATA = {
12
12
  packageName: "@atlaskit/smart-card",
13
- packageVersion: "35.2.1",
13
+ packageVersion: "35.2.2",
14
14
  componentName: 'linkUrl'
15
15
  };
16
16
  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: "35.2.1"
7
+ packageVersion: "35.2.2"
8
8
  };
9
9
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -134,7 +134,8 @@ export var getSimulatedBetterMetadata = function getSimulatedBetterMetadata(card
134
134
  }
135
135
  };
136
136
  export var FlexibleCardUiOptions = {
137
- hideElevation: true
137
+ hideElevation: true,
138
+ hideLegacyButton: true
138
139
  };
139
140
  export var titleBlockOptions = {
140
141
  anchorTarget: '_self',
@@ -8,6 +8,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
8
8
  import { Box } from '@atlaskit/primitives/compiled';
9
9
  import Tooltip from '@atlaskit/tooltip';
10
10
  import { SmartLinkSize } from '../../../../../../constants';
11
+ import { useFlexibleUiOptionContext } from '../../../../../../state/flexible-ui-context';
11
12
  import { withOverrideCss } from '../../../common/with-override-css';
12
13
  import { sizeToButtonSpacing } from '../../../utils';
13
14
  import ActionButtonOld from './ActionButtonOld';
@@ -184,9 +185,16 @@ var ActionButtonNew = function ActionButtonNew(_ref2) {
184
185
  "aria-label": ariaLabel
185
186
  }, content)));
186
187
  };
188
+ var ActionButtonHideLegacyButton = function ActionButtonHideLegacyButton(props) {
189
+ var ui = useFlexibleUiOptionContext();
190
+ if (ui !== null && ui !== void 0 && ui.hideLegacyButton) {
191
+ return /*#__PURE__*/React.createElement(ActionButtonRefreshNewWithOverrideCss, props);
192
+ }
193
+ return /*#__PURE__*/React.createElement(ActionButtonNew, props);
194
+ };
187
195
  var ActionButton = function ActionButton(props) {
188
196
  if (fg('bandicoots-compiled-migration-smartcard')) {
189
- return fg('platform-linking-visual-refresh-v1') ? /*#__PURE__*/React.createElement(ActionButtonRefreshNewWithOverrideCss, props) : /*#__PURE__*/React.createElement(ActionButtonNew, props);
197
+ return fg('platform-linking-visual-refresh-v1') ? /*#__PURE__*/React.createElement(ActionButtonHideLegacyButton, props) : /*#__PURE__*/React.createElement(ActionButtonNew, props);
190
198
  }
191
199
  return /*#__PURE__*/React.createElement(ActionButtonOld, props);
192
200
  };
@@ -10,6 +10,7 @@ export var HOVER_CARD_Z_INDEX = layers.modal();
10
10
  export var flexibleUiOptions = {
11
11
  hideBackground: true,
12
12
  hideElevation: true,
13
+ hideLegacyButton: true,
13
14
  size: SmartLinkSize.Medium,
14
15
  zIndex: HOVER_CARD_Z_INDEX + 1
15
16
  };
@@ -13,7 +13,7 @@ import LinkWarningModal from './LinkWarningModal';
13
13
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
14
14
  var PACKAGE_DATA = {
15
15
  packageName: "@atlaskit/smart-card",
16
- packageVersion: "35.2.1",
16
+ packageVersion: "35.2.2",
17
17
  componentName: 'linkUrl'
18
18
  };
19
19
  var Anchor = withLinkClickedEvent('a');
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { type FlexibleUiOptions } from '../../view/FlexibleCard/types';
3
- import type { FlexibleUiDataContext } from './types';
2
+ import { type InternalFlexibleUiOptions } from '../../view/FlexibleCard/types';
3
+ import { type FlexibleUiDataContext } from './types';
4
4
  /**
5
5
  * This provides the data that will be used by Smart Links Flexible UI to populate it's
6
6
  * underlying elements.
@@ -11,5 +11,5 @@ export declare const useFlexibleUiContext: () => FlexibleUiDataContext | undefin
11
11
  * This provides the ui options that will be used by Smart Links Flexible UI
12
12
  * to render its underlying elements.
13
13
  */
14
- export declare const FlexibleUiOptionContext: import("react").Context<FlexibleUiOptions | undefined>;
15
- export declare const useFlexibleUiOptionContext: () => FlexibleUiOptions | undefined;
14
+ export declare const FlexibleUiOptionContext: import("react").Context<InternalFlexibleUiOptions | undefined>;
15
+ export declare const useFlexibleUiOptionContext: () => InternalFlexibleUiOptions | undefined;
@@ -3,14 +3,14 @@ import type { FooterBlockProps } from '../../../FlexibleCard/components/blocks/f
3
3
  import type { PreviewBlockProps } from '../../../FlexibleCard/components/blocks/preview-block/types';
4
4
  import type { TitleBlockProps } from '../../../FlexibleCard/components/blocks/title-block/types';
5
5
  import type { ElementItem } from '../../../FlexibleCard/components/blocks/types';
6
- import type { FlexibleUiOptions } from '../../../FlexibleCard/types';
6
+ import { type InternalFlexibleUiOptions } from '../../../FlexibleCard/types';
7
7
  export declare const getSimulatedBetterMetadata: (cardDetails?: JsonLd.Response) => SimulatedMetadata;
8
8
  type SimulatedMetadata = {
9
9
  titleMetadata: ElementItem[];
10
10
  topMetadata: ElementItem[];
11
11
  bottomMetadata?: ElementItem[];
12
12
  };
13
- export declare const FlexibleCardUiOptions: FlexibleUiOptions;
13
+ export declare const FlexibleCardUiOptions: InternalFlexibleUiOptions;
14
14
  export declare const titleBlockOptions: Partial<TitleBlockProps>;
15
15
  export declare const titleBlockOptionsOld: Partial<TitleBlockProps>;
16
16
  export declare const PreviewBlockOptions: Partial<PreviewBlockProps>;
@@ -71,9 +71,9 @@ export type FlexibleCardProps = {
71
71
  testId?: string;
72
72
  /**
73
73
  * Determines the appearance of Flexible UI.
74
- * @see FlexibleUiOptions
74
+ * @see InternalFlexibleUiOptions
75
75
  */
76
- ui?: FlexibleUiOptions;
76
+ ui?: InternalFlexibleUiOptions;
77
77
  /**
78
78
  * Determines the URL of the Smart Link.
79
79
  */
@@ -88,6 +88,9 @@ export type FlexibleCardProps = {
88
88
  */
89
89
  hoverPreviewOptions?: HoverPreviewOptions;
90
90
  };
91
+ export type InternalFlexibleUiOptions = FlexibleUiOptions & {
92
+ hideLegacyButton?: boolean;
93
+ };
91
94
  export type FlexibleUiOptions = {
92
95
  /**
93
96
  * Determines whether the entire Smart Link container should be clickable.
@@ -1,6 +1,6 @@
1
- import { type FlexibleUiOptions } from '../FlexibleCard/types';
1
+ import { type InternalFlexibleUiOptions } from '../FlexibleCard/types';
2
2
  export declare const HOVER_CARD_Z_INDEX: 510;
3
- export declare const flexibleUiOptions: FlexibleUiOptions;
3
+ export declare const flexibleUiOptions: InternalFlexibleUiOptions;
4
4
  export declare const CARD_WIDTH_REM = 24;
5
5
  export declare const NEW_CARD_WIDTH_REM = 25;
6
6
  export declare const CARD_GAP_PX = 10;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { type FlexibleUiOptions } from '../../view/FlexibleCard/types';
3
- import type { FlexibleUiDataContext } from './types';
2
+ import { type InternalFlexibleUiOptions } from '../../view/FlexibleCard/types';
3
+ import { type FlexibleUiDataContext } from './types';
4
4
  /**
5
5
  * This provides the data that will be used by Smart Links Flexible UI to populate it's
6
6
  * underlying elements.
@@ -11,5 +11,5 @@ export declare const useFlexibleUiContext: () => FlexibleUiDataContext | undefin
11
11
  * This provides the ui options that will be used by Smart Links Flexible UI
12
12
  * to render its underlying elements.
13
13
  */
14
- export declare const FlexibleUiOptionContext: import("react").Context<FlexibleUiOptions | undefined>;
15
- export declare const useFlexibleUiOptionContext: () => FlexibleUiOptions | undefined;
14
+ export declare const FlexibleUiOptionContext: import("react").Context<InternalFlexibleUiOptions | undefined>;
15
+ export declare const useFlexibleUiOptionContext: () => InternalFlexibleUiOptions | undefined;
@@ -3,14 +3,14 @@ import type { FooterBlockProps } from '../../../FlexibleCard/components/blocks/f
3
3
  import type { PreviewBlockProps } from '../../../FlexibleCard/components/blocks/preview-block/types';
4
4
  import type { TitleBlockProps } from '../../../FlexibleCard/components/blocks/title-block/types';
5
5
  import type { ElementItem } from '../../../FlexibleCard/components/blocks/types';
6
- import type { FlexibleUiOptions } from '../../../FlexibleCard/types';
6
+ import { type InternalFlexibleUiOptions } from '../../../FlexibleCard/types';
7
7
  export declare const getSimulatedBetterMetadata: (cardDetails?: JsonLd.Response) => SimulatedMetadata;
8
8
  type SimulatedMetadata = {
9
9
  titleMetadata: ElementItem[];
10
10
  topMetadata: ElementItem[];
11
11
  bottomMetadata?: ElementItem[];
12
12
  };
13
- export declare const FlexibleCardUiOptions: FlexibleUiOptions;
13
+ export declare const FlexibleCardUiOptions: InternalFlexibleUiOptions;
14
14
  export declare const titleBlockOptions: Partial<TitleBlockProps>;
15
15
  export declare const titleBlockOptionsOld: Partial<TitleBlockProps>;
16
16
  export declare const PreviewBlockOptions: Partial<PreviewBlockProps>;
@@ -71,9 +71,9 @@ export type FlexibleCardProps = {
71
71
  testId?: string;
72
72
  /**
73
73
  * Determines the appearance of Flexible UI.
74
- * @see FlexibleUiOptions
74
+ * @see InternalFlexibleUiOptions
75
75
  */
76
- ui?: FlexibleUiOptions;
76
+ ui?: InternalFlexibleUiOptions;
77
77
  /**
78
78
  * Determines the URL of the Smart Link.
79
79
  */
@@ -88,6 +88,9 @@ export type FlexibleCardProps = {
88
88
  */
89
89
  hoverPreviewOptions?: HoverPreviewOptions;
90
90
  };
91
+ export type InternalFlexibleUiOptions = FlexibleUiOptions & {
92
+ hideLegacyButton?: boolean;
93
+ };
91
94
  export type FlexibleUiOptions = {
92
95
  /**
93
96
  * Determines whether the entire Smart Link container should be clickable.
@@ -1,6 +1,6 @@
1
- import { type FlexibleUiOptions } from '../FlexibleCard/types';
1
+ import { type InternalFlexibleUiOptions } from '../FlexibleCard/types';
2
2
  export declare const HOVER_CARD_Z_INDEX: 510;
3
- export declare const flexibleUiOptions: FlexibleUiOptions;
3
+ export declare const flexibleUiOptions: InternalFlexibleUiOptions;
4
4
  export declare const CARD_WIDTH_REM = 24;
5
5
  export declare const NEW_CARD_WIDTH_REM = 25;
6
6
  export declare const CARD_GAP_PX = 10;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "35.2.1",
3
+ "version": "35.2.2",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -92,18 +92,18 @@
92
92
  "react-intl-next": "npm:react-intl@^5.18.1"
93
93
  },
94
94
  "devDependencies": {
95
- "@af/integration-testing": "*",
96
- "@af/visual-regression": "*",
95
+ "@af/integration-testing": "^0.5.0",
96
+ "@af/visual-regression": "^1.3.0",
97
97
  "@atlaskit/analytics-listeners": "^9.0.0",
98
98
  "@atlaskit/css-reset": "^7.0.0",
99
99
  "@atlaskit/link-test-helpers": "^8.0.0",
100
100
  "@atlaskit/media-test-helpers": "^35.0.0",
101
101
  "@atlaskit/react-ufo": "^3.3.0",
102
- "@atlaskit/ssr": "*",
103
- "@atlaskit/visual-regression": "*",
104
- "@atlassian/analytics-tooling": "*",
102
+ "@atlaskit/ssr": "^0.4.0",
103
+ "@atlaskit/visual-regression": "^0.10.0",
104
+ "@atlassian/analytics-tooling": "^0.5.0",
105
105
  "@atlassian/feature-flags-test-utils": "^0.3.0",
106
- "@atlassian/gemini": "1.16.5",
106
+ "@atlassian/gemini": "^1.16.0",
107
107
  "@testing-library/dom": "^10.1.0",
108
108
  "@testing-library/jest-dom": "^6.4.5",
109
109
  "@testing-library/react": "^13.4.0",