@atlaskit/smart-card 25.5.2 → 25.5.4

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,17 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 25.5.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`19622f395b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/19622f395b0) - Connect `showServerActions` prop to flexible smart links, surfacing the lozenge dropdown action behind feature flag.
8
+
9
+ ## 25.5.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [`da5d5b2dbef`](https://bitbucket.org/atlassian/atlassian-frontend/commits/da5d5b2dbef) - Fire link clicked analytics event for LinkUrl component
14
+
3
15
  ## 25.5.2
4
16
 
5
17
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "25.5.2",
3
+ "version": "25.5.4",
4
4
  "sideEffects": false
5
5
  }
@@ -36,6 +36,7 @@ function CardWithUrlContent(_ref) {
36
36
  onError = _ref.onError,
37
37
  testId = _ref.testId,
38
38
  showActions = _ref.showActions,
39
+ showServerActionsProp = _ref.showServerActions,
39
40
  inheritDimensions = _ref.inheritDimensions,
40
41
  embedIframeRef = _ref.embedIframeRef,
41
42
  embedIframeUrlType = _ref.embedIframeUrlType,
@@ -69,6 +70,7 @@ function CardWithUrlContent(_ref) {
69
70
  var showAuthTooltipFeatureFlagValue = (0, _linkProvider.useFeatureFlag)('showAuthTooltip');
70
71
  var showAuthTooltip = showAuthTooltipFeatureFlagValue !== undefined ? showAuthTooltipFeatureFlagValue === 'experiment' : showAuthTooltipProp;
71
72
  var enableFlexibleBlockCardFlag = Boolean((0, _linkProvider.useFeatureFlag)('enableFlexibleBlockCard'));
73
+ var showServerActions = showServerActionsProp && platform !== 'mobile';
72
74
 
73
75
  // Setup UI handlers.
74
76
  var handleClickWrapper = (0, _react.useCallback)(function (event) {
@@ -188,6 +190,7 @@ function CardWithUrlContent(_ref) {
188
190
  renderers: renderers,
189
191
  ui: ui,
190
192
  showHoverPreview: showHoverPreview,
193
+ showServerActions: showServerActions,
191
194
  url: url,
192
195
  testId: testId,
193
196
  onResolve: onResolve,
@@ -48,6 +48,7 @@ function CardWithURLRenderer(props) {
48
48
  onError = props.onError,
49
49
  testId = props.testId,
50
50
  showActions = props.showActions,
51
+ showServerActions = props.showServerActions,
51
52
  inheritDimensions = props.inheritDimensions,
52
53
  platform = props.platform,
53
54
  embedIframeRef = props.embedIframeRef,
@@ -119,6 +120,7 @@ function CardWithURLRenderer(props) {
119
120
  onError: onError,
120
121
  testId: testId,
121
122
  showActions: showActions,
123
+ showServerActions: showServerActions,
122
124
  inheritDimensions: inheritDimensions,
123
125
  platform: platform,
124
126
  embedIframeRef: embedIframeRef,
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.default = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var _react = _interopRequireWildcard(require("react"));
11
+ var _linkProvider = require("@atlaskit/link-provider");
11
12
  var _constants = require("../../constants");
12
13
  var _container = _interopRequireDefault(require("./components/container"));
13
14
  var _flexibleUiContext = require("../../state/flexible-ui-context");
@@ -38,16 +39,23 @@ var FlexibleCard = function FlexibleCard(_ref) {
38
39
  var cardType = cardState.status,
39
40
  details = cardState.details;
40
41
  var status = cardType;
42
+ var useLozengeAction = (0, _linkProvider.useFeatureFlag)('useLozengeAction');
43
+ var featureFlags = (0, _react.useMemo)(function () {
44
+ return {
45
+ useLozengeAction: useLozengeAction
46
+ };
47
+ }, [useLozengeAction]);
41
48
  var context = (0, _react.useMemo)(function () {
42
49
  return (0, _utils.getContextByStatus)({
43
50
  response: details,
51
+ featureFlags: featureFlags,
44
52
  id: id,
45
53
  renderers: renderers,
46
54
  showServerActions: showServerActions,
47
55
  status: status,
48
56
  url: url
49
57
  });
50
- }, [details, id, renderers, showServerActions, status, url]);
58
+ }, [details, featureFlags, id, renderers, showServerActions, status, url]);
51
59
  var retry = (0, _utils.getRetryOptions)(url, status, details, onAuthorize);
52
60
  var _ref2 = context || {},
53
61
  title = _ref2.title;
@@ -12,7 +12,9 @@ var _useLinkWarningModal2 = require("./LinkWarningModal/hooks/use-link-warning-m
12
12
  var _LinkWarningModal = _interopRequireDefault(require("./LinkWarningModal"));
13
13
  var _analyticsNext = require("@atlaskit/analytics-next");
14
14
  var _version = require("../../version.json");
15
- var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
15
+ var _click = require("../../utils/analytics/click");
16
+ var _useMouseDownEvent = _interopRequireDefault(require("../../state/analytics/useMouseDownEvent"));
17
+ var _excluded = ["href", "children", "checkSafety", "onClick", "onMouseDown", "testId"],
16
18
  _excluded2 = ["checkLinkSafety"];
17
19
  var PACKAGE_DATA = {
18
20
  packageName: _version.name,
@@ -25,18 +27,27 @@ var LinkUrl = function LinkUrl(_ref) {
25
27
  _ref$checkSafety = _ref.checkSafety,
26
28
  checkSafety = _ref$checkSafety === void 0 ? true : _ref$checkSafety,
27
29
  _onClick = _ref.onClick,
30
+ _onMouseDown = _ref.onMouseDown,
28
31
  _ref$testId = _ref.testId,
29
32
  testId = _ref$testId === void 0 ? 'link-with-safety' : _ref$testId,
30
33
  props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
31
34
  var _useLinkWarningModal = (0, _useLinkWarningModal2.useLinkWarningModal)(),
32
35
  checkLinkSafety = _useLinkWarningModal.checkLinkSafety,
33
36
  linkWarningModalProps = (0, _objectWithoutProperties2.default)(_useLinkWarningModal, _excluded2);
37
+ var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
38
+ createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
39
+ var handleMouseDown = (0, _useMouseDownEvent.default)();
34
40
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("a", (0, _extends2.default)({
35
41
  "data-testid": testId,
36
42
  href: href,
37
43
  onClick: function onClick(e) {
38
44
  checkSafety && checkLinkSafety(e, href);
39
45
  _onClick && _onClick(e);
46
+ (0, _click.fireLinkClickedEvent)(createAnalyticsEvent)(e);
47
+ },
48
+ onMouseDown: function onMouseDown(e) {
49
+ _onMouseDown && _onMouseDown(e);
50
+ handleMouseDown(e); // add analytics
40
51
  }
41
52
  }, props), children), checkSafety && /*#__PURE__*/_react.default.createElement(_LinkWarningModal.default, linkWarningModalProps));
42
53
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "25.5.2",
3
+ "version": "25.5.4",
4
4
  "sideEffects": false
5
5
  }
@@ -26,6 +26,7 @@ export function CardWithUrlContent({
26
26
  onError,
27
27
  testId,
28
28
  showActions,
29
+ showServerActions: showServerActionsProp,
29
30
  inheritDimensions,
30
31
  embedIframeRef,
31
32
  embedIframeUrlType,
@@ -60,6 +61,7 @@ export function CardWithUrlContent({
60
61
  const showAuthTooltipFeatureFlagValue = useFeatureFlag('showAuthTooltip');
61
62
  const showAuthTooltip = showAuthTooltipFeatureFlagValue !== undefined ? showAuthTooltipFeatureFlagValue === 'experiment' : showAuthTooltipProp;
62
63
  const enableFlexibleBlockCardFlag = Boolean(useFeatureFlag('enableFlexibleBlockCard'));
64
+ const showServerActions = showServerActionsProp && platform !== 'mobile';
63
65
 
64
66
  // Setup UI handlers.
65
67
  const handleClickWrapper = useCallback(event => {
@@ -175,6 +177,7 @@ export function CardWithUrlContent({
175
177
  renderers: renderers,
176
178
  ui: ui,
177
179
  showHoverPreview: showHoverPreview,
180
+ showServerActions: showServerActions,
178
181
  url: url,
179
182
  testId: testId,
180
183
  onResolve: onResolve,
@@ -28,6 +28,7 @@ export function CardWithURLRenderer(props) {
28
28
  onError,
29
29
  testId,
30
30
  showActions,
31
+ showServerActions,
31
32
  inheritDimensions,
32
33
  platform,
33
34
  embedIframeRef,
@@ -102,6 +103,7 @@ export function CardWithURLRenderer(props) {
102
103
  onError,
103
104
  testId,
104
105
  showActions,
106
+ showServerActions,
105
107
  inheritDimensions,
106
108
  platform,
107
109
  embedIframeRef,
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useEffect, useMemo } from 'react';
3
+ import { useFeatureFlag } from '@atlaskit/link-provider';
3
4
  import { SmartLinkStatus } from '../../constants';
4
5
  import Container from './components/container';
5
6
  import { FlexibleUiAnalyticsContext, FlexibleUiContext } from '../../state/flexible-ui-context';
@@ -32,14 +33,19 @@ const FlexibleCard = ({
32
33
  details
33
34
  } = cardState;
34
35
  const status = cardType;
36
+ const useLozengeAction = useFeatureFlag('useLozengeAction');
37
+ const featureFlags = useMemo(() => ({
38
+ useLozengeAction
39
+ }), [useLozengeAction]);
35
40
  const context = useMemo(() => getContextByStatus({
36
41
  response: details,
42
+ featureFlags,
37
43
  id,
38
44
  renderers,
39
45
  showServerActions,
40
46
  status,
41
47
  url
42
- }), [details, id, renderers, showServerActions, status, url]);
48
+ }), [details, featureFlags, id, renderers, showServerActions, status, url]);
43
49
  const retry = getRetryOptions(url, status, details, onAuthorize);
44
50
  const {
45
51
  title
@@ -2,8 +2,10 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
4
4
  import LinkWarningModal from './LinkWarningModal';
5
- import { withAnalyticsContext } from '@atlaskit/analytics-next';
5
+ import { useAnalyticsEvents, withAnalyticsContext } from '@atlaskit/analytics-next';
6
6
  import { name as packageName, version as packageVersion } from '../../version.json';
7
+ import { fireLinkClickedEvent } from '../../utils/analytics/click';
8
+ import useMouseDownEvent from '../../state/analytics/useMouseDownEvent';
7
9
  const PACKAGE_DATA = {
8
10
  packageName,
9
11
  packageVersion,
@@ -14,6 +16,7 @@ const LinkUrl = ({
14
16
  children,
15
17
  checkSafety = true,
16
18
  onClick,
19
+ onMouseDown,
17
20
  testId = 'link-with-safety',
18
21
  ...props
19
22
  }) => {
@@ -21,12 +24,21 @@ const LinkUrl = ({
21
24
  checkLinkSafety,
22
25
  ...linkWarningModalProps
23
26
  } = useLinkWarningModal();
27
+ const {
28
+ createAnalyticsEvent
29
+ } = useAnalyticsEvents();
30
+ const handleMouseDown = useMouseDownEvent();
24
31
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("a", _extends({
25
32
  "data-testid": testId,
26
33
  href: href,
27
34
  onClick: e => {
28
35
  checkSafety && checkLinkSafety(e, href);
29
36
  onClick && onClick(e);
37
+ fireLinkClickedEvent(createAnalyticsEvent)(e);
38
+ },
39
+ onMouseDown: e => {
40
+ onMouseDown && onMouseDown(e);
41
+ handleMouseDown(e); // add analytics
30
42
  }
31
43
  }, props), children), checkSafety && /*#__PURE__*/React.createElement(LinkWarningModal, linkWarningModalProps));
32
44
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "25.5.2",
3
+ "version": "25.5.4",
4
4
  "sideEffects": false
5
5
  }
@@ -26,6 +26,7 @@ export function CardWithUrlContent(_ref) {
26
26
  onError = _ref.onError,
27
27
  testId = _ref.testId,
28
28
  showActions = _ref.showActions,
29
+ showServerActionsProp = _ref.showServerActions,
29
30
  inheritDimensions = _ref.inheritDimensions,
30
31
  embedIframeRef = _ref.embedIframeRef,
31
32
  embedIframeUrlType = _ref.embedIframeUrlType,
@@ -59,6 +60,7 @@ export function CardWithUrlContent(_ref) {
59
60
  var showAuthTooltipFeatureFlagValue = useFeatureFlag('showAuthTooltip');
60
61
  var showAuthTooltip = showAuthTooltipFeatureFlagValue !== undefined ? showAuthTooltipFeatureFlagValue === 'experiment' : showAuthTooltipProp;
61
62
  var enableFlexibleBlockCardFlag = Boolean(useFeatureFlag('enableFlexibleBlockCard'));
63
+ var showServerActions = showServerActionsProp && platform !== 'mobile';
62
64
 
63
65
  // Setup UI handlers.
64
66
  var handleClickWrapper = useCallback(function (event) {
@@ -178,6 +180,7 @@ export function CardWithUrlContent(_ref) {
178
180
  renderers: renderers,
179
181
  ui: ui,
180
182
  showHoverPreview: showHoverPreview,
183
+ showServerActions: showServerActions,
181
184
  url: url,
182
185
  testId: testId,
183
186
  onResolve: onResolve,
@@ -36,6 +36,7 @@ export function CardWithURLRenderer(props) {
36
36
  onError = props.onError,
37
37
  testId = props.testId,
38
38
  showActions = props.showActions,
39
+ showServerActions = props.showServerActions,
39
40
  inheritDimensions = props.inheritDimensions,
40
41
  platform = props.platform,
41
42
  embedIframeRef = props.embedIframeRef,
@@ -107,6 +108,7 @@ export function CardWithURLRenderer(props) {
107
108
  onError: onError,
108
109
  testId: testId,
109
110
  showActions: showActions,
111
+ showServerActions: showServerActions,
110
112
  inheritDimensions: inheritDimensions,
111
113
  platform: platform,
112
114
  embedIframeRef: embedIframeRef,
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useEffect, useMemo } from 'react';
3
+ import { useFeatureFlag } from '@atlaskit/link-provider';
3
4
  import { SmartLinkStatus } from '../../constants';
4
5
  import Container from './components/container';
5
6
  import { FlexibleUiAnalyticsContext, FlexibleUiContext } from '../../state/flexible-ui-context';
@@ -29,16 +30,23 @@ var FlexibleCard = function FlexibleCard(_ref) {
29
30
  var cardType = cardState.status,
30
31
  details = cardState.details;
31
32
  var status = cardType;
33
+ var useLozengeAction = useFeatureFlag('useLozengeAction');
34
+ var featureFlags = useMemo(function () {
35
+ return {
36
+ useLozengeAction: useLozengeAction
37
+ };
38
+ }, [useLozengeAction]);
32
39
  var context = useMemo(function () {
33
40
  return getContextByStatus({
34
41
  response: details,
42
+ featureFlags: featureFlags,
35
43
  id: id,
36
44
  renderers: renderers,
37
45
  showServerActions: showServerActions,
38
46
  status: status,
39
47
  url: url
40
48
  });
41
- }, [details, id, renderers, showServerActions, status, url]);
49
+ }, [details, featureFlags, id, renderers, showServerActions, status, url]);
42
50
  var retry = getRetryOptions(url, status, details, onAuthorize);
43
51
  var _ref2 = context || {},
44
52
  title = _ref2.title;
@@ -1,12 +1,14 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
3
+ var _excluded = ["href", "children", "checkSafety", "onClick", "onMouseDown", "testId"],
4
4
  _excluded2 = ["checkLinkSafety"];
5
5
  import React from 'react';
6
6
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
7
7
  import LinkWarningModal from './LinkWarningModal';
8
- import { withAnalyticsContext } from '@atlaskit/analytics-next';
8
+ import { useAnalyticsEvents, withAnalyticsContext } from '@atlaskit/analytics-next';
9
9
  import { name as packageName, version as packageVersion } from '../../version.json';
10
+ import { fireLinkClickedEvent } from '../../utils/analytics/click';
11
+ import useMouseDownEvent from '../../state/analytics/useMouseDownEvent';
10
12
  var PACKAGE_DATA = {
11
13
  packageName: packageName,
12
14
  packageVersion: packageVersion,
@@ -18,18 +20,27 @@ var LinkUrl = function LinkUrl(_ref) {
18
20
  _ref$checkSafety = _ref.checkSafety,
19
21
  checkSafety = _ref$checkSafety === void 0 ? true : _ref$checkSafety,
20
22
  _onClick = _ref.onClick,
23
+ _onMouseDown = _ref.onMouseDown,
21
24
  _ref$testId = _ref.testId,
22
25
  testId = _ref$testId === void 0 ? 'link-with-safety' : _ref$testId,
23
26
  props = _objectWithoutProperties(_ref, _excluded);
24
27
  var _useLinkWarningModal = useLinkWarningModal(),
25
28
  checkLinkSafety = _useLinkWarningModal.checkLinkSafety,
26
29
  linkWarningModalProps = _objectWithoutProperties(_useLinkWarningModal, _excluded2);
30
+ var _useAnalyticsEvents = useAnalyticsEvents(),
31
+ createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
32
+ var handleMouseDown = useMouseDownEvent();
27
33
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("a", _extends({
28
34
  "data-testid": testId,
29
35
  href: href,
30
36
  onClick: function onClick(e) {
31
37
  checkSafety && checkLinkSafety(e, href);
32
38
  _onClick && _onClick(e);
39
+ fireLinkClickedEvent(createAnalyticsEvent)(e);
40
+ },
41
+ onMouseDown: function onMouseDown(e) {
42
+ _onMouseDown && _onMouseDown(e);
43
+ handleMouseDown(e); // add analytics
33
44
  }
34
45
  }, props), children), checkSafety && /*#__PURE__*/React.createElement(LinkWarningModal, linkWarningModalProps));
35
46
  };
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { CardWithUrlContentProps } from './types';
3
- export declare function CardWithUrlContent({ id, url, isSelected, isFrameVisible, frameStyle, platform, onClick, appearance, dispatchAnalytics, onResolve, onError, testId, showActions, inheritDimensions, embedIframeRef, embedIframeUrlType, inlinePreloaderStyle, ui, children, showHoverPreview, showAuthTooltip: showAuthTooltipProp, analyticsEvents, }: CardWithUrlContentProps): JSX.Element;
3
+ export declare function CardWithUrlContent({ id, url, isSelected, isFrameVisible, frameStyle, platform, onClick, appearance, dispatchAnalytics, onResolve, onError, testId, showActions, showServerActions: showServerActionsProp, inheritDimensions, embedIframeRef, embedIframeUrlType, inlinePreloaderStyle, ui, children, showHoverPreview, showAuthTooltip: showAuthTooltipProp, analyticsEvents, }: CardWithUrlContentProps): JSX.Element;
@@ -20,6 +20,7 @@ export declare type CardWithUrlContentProps = {
20
20
  onResolve?: OnResolveCallback;
21
21
  onError?: OnErrorCallback;
22
22
  showActions?: boolean;
23
+ showServerActions?: boolean;
23
24
  inheritDimensions?: boolean;
24
25
  embedIframeRef?: React.Ref<HTMLIFrameElement>;
25
26
  embedIframeUrlType?: EmbedIframeUrlType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "25.5.2",
3
+ "version": "25.5.4",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"