@atlaskit/smart-card 26.9.8 → 26.9.9

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.9.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [`4e254433494`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4e254433494) - [ux] Remove 'open in new tab' button in Hover Cards
8
+
3
9
  ## 26.9.8
4
10
 
5
11
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.9.8",
3
+ "version": "26.9.9",
4
4
  "sideEffects": false
5
5
  }
@@ -5,12 +5,11 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.hoverCardClassName = exports.getOpenAction = exports.getCopyAction = exports.default = void 0;
8
+ exports.hoverCardClassName = exports.getCopyAction = exports.default = void 0;
9
9
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
11
  var _react = require("@emotion/react");
12
12
  var _analyticsNext = require("@atlaskit/analytics-next");
13
- var _shortcut = _interopRequireDefault(require("@atlaskit/icon/glyph/shortcut"));
14
13
  var _copy = _interopRequireDefault(require("@atlaskit/icon/glyph/copy"));
15
14
  var _react2 = _interopRequireWildcard(require("react"));
16
15
  var _constants = require("../../../constants");
@@ -34,28 +33,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
34
33
 
35
34
  var hoverCardClassName = 'smart-links-hover-preview';
36
35
  exports.hoverCardClassName = hoverCardClassName;
37
- var getOpenAction = function getOpenAction(url, analytics, onActionClick) {
38
- return {
39
- name: _constants.ActionName.CustomAction,
40
- icon: (0, _react.jsx)(_shortcut.default, {
41
- label: "open in new tab",
42
- size: "medium"
43
- }),
44
- iconPosition: 'before',
45
- onClick: function onClick() {
46
- if (onActionClick) {
47
- onActionClick('open-content');
48
- }
49
- window.open(url, '_blank');
50
- analytics.ui.hoverCardOpenLinkClickedEvent({
51
- previewDisplay: 'card'
52
- });
53
- },
54
- tooltipMessage: (0, _react.jsx)(_reactIntlNext.FormattedMessage, _messages.messages.open_link_in_a_new_tab),
55
- testId: 'hover-card-open-button'
56
- };
57
- };
58
- exports.getOpenAction = getOpenAction;
59
36
  var getCopyAction = function getCopyAction(url) {
60
37
  return {
61
38
  name: _constants.ActionName.CustomAction,
@@ -177,8 +154,8 @@ var HoverCardContent = function HoverCardContent(_ref) {
177
154
  (0, _click.fireLinkClickedEvent)(createAnalyticsEvent)(event);
178
155
  }, [createAnalyticsEvent, cardState.status, analytics.ui, id]);
179
156
  var titleActions = (0, _react2.useMemo)(function () {
180
- return [getCopyAction(url), getOpenAction(url, analytics, onActionClick)];
181
- }, [url, analytics, onActionClick]);
157
+ return [getCopyAction(url)];
158
+ }, [url]);
182
159
  var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
183
160
  var _extractMetadata = (0, _extractMetadata2.extractMetadata)((0, _utils2.getSimulatedMetadata)(extensionKey, data)),
184
161
  subtitle = _extractMetadata.subtitle;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.9.8",
3
+ "version": "26.9.9",
4
4
  "sideEffects": false
5
5
  }
@@ -1,7 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
3
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
4
- import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
5
4
  import CopyIcon from '@atlaskit/icon/glyph/copy';
6
5
  import React, { useCallback, useEffect, useMemo, useRef } from 'react';
7
6
  import { ActionName, CardDisplay, SmartLinkPosition, SmartLinkSize } from '../../../constants';
@@ -20,25 +19,6 @@ import { fireLinkClickedEvent } from '../../../utils/analytics/click';
20
19
  import { useSmartCardState } from '../../../state/store';
21
20
  import { useFeatureFlag } from '@atlaskit/link-provider';
22
21
  export const hoverCardClassName = 'smart-links-hover-preview';
23
- export const getOpenAction = (url, analytics, onActionClick) => ({
24
- name: ActionName.CustomAction,
25
- icon: jsx(ShortcutIcon, {
26
- label: "open in new tab",
27
- size: "medium"
28
- }),
29
- iconPosition: 'before',
30
- onClick: () => {
31
- if (onActionClick) {
32
- onActionClick('open-content');
33
- }
34
- window.open(url, '_blank');
35
- analytics.ui.hoverCardOpenLinkClickedEvent({
36
- previewDisplay: 'card'
37
- });
38
- },
39
- tooltipMessage: jsx(FormattedMessage, messages.open_link_in_a_new_tab),
40
- testId: 'hover-card-open-button'
41
- });
42
22
  export const getCopyAction = url => ({
43
23
  name: ActionName.CustomAction,
44
24
  icon: jsx(CopyIcon, {
@@ -135,7 +115,7 @@ const HoverCardContent = ({
135
115
  });
136
116
  fireLinkClickedEvent(createAnalyticsEvent)(event);
137
117
  }, [createAnalyticsEvent, cardState.status, analytics.ui, id]);
138
- const titleActions = useMemo(() => [getCopyAction(url), getOpenAction(url, analytics, onActionClick)], [url, analytics, onActionClick]);
118
+ const titleActions = useMemo(() => [getCopyAction(url)], [url]);
139
119
  const data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
140
120
  const {
141
121
  subtitle
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.9.8",
3
+ "version": "26.9.9",
4
4
  "sideEffects": false
5
5
  }
@@ -3,7 +3,6 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  /** @jsx jsx */
4
4
  import { jsx } from '@emotion/react';
5
5
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
6
- import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
7
6
  import CopyIcon from '@atlaskit/icon/glyph/copy';
8
7
  import React, { useCallback, useEffect, useMemo, useRef } from 'react';
9
8
  import { ActionName, CardDisplay, SmartLinkPosition, SmartLinkSize } from '../../../constants';
@@ -22,27 +21,6 @@ import { fireLinkClickedEvent } from '../../../utils/analytics/click';
22
21
  import { useSmartCardState } from '../../../state/store';
23
22
  import { useFeatureFlag } from '@atlaskit/link-provider';
24
23
  export var hoverCardClassName = 'smart-links-hover-preview';
25
- export var getOpenAction = function getOpenAction(url, analytics, onActionClick) {
26
- return {
27
- name: ActionName.CustomAction,
28
- icon: jsx(ShortcutIcon, {
29
- label: "open in new tab",
30
- size: "medium"
31
- }),
32
- iconPosition: 'before',
33
- onClick: function onClick() {
34
- if (onActionClick) {
35
- onActionClick('open-content');
36
- }
37
- window.open(url, '_blank');
38
- analytics.ui.hoverCardOpenLinkClickedEvent({
39
- previewDisplay: 'card'
40
- });
41
- },
42
- tooltipMessage: jsx(FormattedMessage, messages.open_link_in_a_new_tab),
43
- testId: 'hover-card-open-button'
44
- };
45
- };
46
24
  export var getCopyAction = function getCopyAction(url) {
47
25
  return {
48
26
  name: ActionName.CustomAction,
@@ -163,8 +141,8 @@ var HoverCardContent = function HoverCardContent(_ref) {
163
141
  fireLinkClickedEvent(createAnalyticsEvent)(event);
164
142
  }, [createAnalyticsEvent, cardState.status, analytics.ui, id]);
165
143
  var titleActions = useMemo(function () {
166
- return [getCopyAction(url), getOpenAction(url, analytics, onActionClick)];
167
- }, [url, analytics, onActionClick]);
144
+ return [getCopyAction(url)];
145
+ }, [url]);
168
146
  var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
169
147
  var _extractMetadata = extractMetadata(getSimulatedMetadata(extensionKey, data)),
170
148
  subtitle = _extractMetadata.subtitle;
@@ -1,9 +1,7 @@
1
1
  import React from 'react';
2
- import { AnalyticsFacade } from '../../../state/analytics';
3
2
  import { ActionItem } from '../../FlexibleCard/components/blocks/types';
4
3
  import { HoverCardContentProps } from '../types';
5
4
  export declare const hoverCardClassName = "smart-links-hover-preview";
6
- export declare const getOpenAction: (url: string, analytics: AnalyticsFacade, onActionClick?: ((actionId: string) => void) | undefined) => ActionItem;
7
5
  export declare const getCopyAction: (url: string) => ActionItem;
8
6
  declare const HoverCardContent: React.FC<HoverCardContentProps>;
9
7
  export default HoverCardContent;
@@ -1,9 +1,7 @@
1
1
  import React from 'react';
2
- import { AnalyticsFacade } from '../../../state/analytics';
3
2
  import { ActionItem } from '../../FlexibleCard/components/blocks/types';
4
3
  import { HoverCardContentProps } from '../types';
5
4
  export declare const hoverCardClassName = "smart-links-hover-preview";
6
- export declare const getOpenAction: (url: string, analytics: AnalyticsFacade, onActionClick?: ((actionId: string) => void) | undefined) => ActionItem;
7
5
  export declare const getCopyAction: (url: string) => ActionItem;
8
6
  declare const HoverCardContent: React.FC<HoverCardContentProps>;
9
7
  export default HoverCardContent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.9.8",
3
+ "version": "26.9.9",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"