@atlaskit/smart-card 23.9.3 → 23.10.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
+ ## 23.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`aa44d74bf40`](https://bitbucket.org/atlassian/atlassian-frontend/commits/aa44d74bf40) - Expose a new entry point to hover cards at @atlaskit/smart-card/hover-card
8
+
3
9
  ## 23.9.3
4
10
 
5
11
  ### Patch Changes
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "HoverCard", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _HoverCard.HoverCard;
10
+ }
11
+ });
12
+
13
+ var _HoverCard = require("./view/HoverCard");
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "23.9.3",
3
+ "version": "23.10.0",
4
4
  "sideEffects": false
5
5
  }
@@ -39,6 +39,8 @@ var _reactIntlNext = require("react-intl-next");
39
39
 
40
40
  var _messages = require("../../../messages");
41
41
 
42
+ var _actions = require("../../../state/actions");
43
+
42
44
  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); }
43
45
 
44
46
  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; }
@@ -90,6 +92,10 @@ var HoverCardContent = function HoverCardContent(_ref) {
90
92
  var extensionKey = (0, _react2.useMemo)(function () {
91
93
  return (0, _helpers.getExtensionKey)(cardState.details);
92
94
  }, [cardState.details]);
95
+ var actions = (0, _actions.useSmartCardActions)(id, url, analytics);
96
+ (0, _react2.useEffect)(function () {
97
+ actions.loadMetadata();
98
+ }, [actions]);
93
99
  var onClick = (0, _react2.useCallback)(function (event) {
94
100
  var isModifierKeyPressed = (0, _utils.isSpecialEvent)(event);
95
101
  analytics.ui.cardClickedEvent({
@@ -23,8 +23,6 @@ var _styled = require("./styled");
23
23
 
24
24
  var _FlexibleCard = _interopRequireDefault(require("../../../../FlexibleCard"));
25
25
 
26
- var _actions = require("../../../../../state/actions");
27
-
28
26
  var _utils = require("../../../utils");
29
27
 
30
28
  var _SnippetOrPreview = _interopRequireDefault(require("../../SnippetOrPreview"));
@@ -69,10 +67,6 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
69
67
  onActionClick = _ref.onActionClick,
70
68
  extensionKey = _ref.extensionKey;
71
69
  var showActionableElement = (0, _linkProvider.useFeatureFlag)('enableActionableElement');
72
- var actions = (0, _actions.useSmartCardActions)(id, url, analytics);
73
- (0, _react.useEffect)(function () {
74
- actions.loadMetadata();
75
- }, [actions]);
76
70
  (0, _react.useEffect)(function () {
77
71
  // Since this hover view is only rendered on resolved status,
78
72
  // there is no need to check for statuses.
@@ -0,0 +1 @@
1
+ export { HoverCard } from './view/HoverCard';
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "23.9.3",
3
+ "version": "23.10.0",
4
4
  "sideEffects": false
5
5
  }
@@ -2,7 +2,7 @@
2
2
  import { jsx } from '@emotion/react';
3
3
  import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
4
4
  import { extractType } from '@atlaskit/linking-common/extractors';
5
- import React, { useCallback, useMemo } from 'react';
5
+ import React, { useCallback, useEffect, useMemo } from 'react';
6
6
  import { ActionName, CardDisplay, SmartLinkPosition, SmartLinkSize } from '../../../constants';
7
7
  import { extractMetadata } from '../../../extractors/hover/extractMetadata';
8
8
  import { getExtensionKey } from '../../../state/helpers';
@@ -14,6 +14,7 @@ import HoverCardUnauthorisedView from './views/unauthorised';
14
14
  import HoverCardResolvedView from './views/resolved';
15
15
  import { FormattedMessage } from 'react-intl-next';
16
16
  import { messages } from '../../../messages';
17
+ import { useSmartCardActions } from '../../../state/actions';
17
18
  export const hoverCardClassName = 'smart-links-hover-preview';
18
19
  export const getOpenAction = (url, analytics, onActionClick) => ({
19
20
  name: ActionName.CustomAction,
@@ -51,6 +52,10 @@ const HoverCardContent = ({
51
52
  var _cardState$details;
52
53
 
53
54
  const extensionKey = useMemo(() => getExtensionKey(cardState.details), [cardState.details]);
55
+ const actions = useSmartCardActions(id, url, analytics);
56
+ useEffect(() => {
57
+ actions.loadMetadata();
58
+ }, [actions]);
54
59
  const onClick = useCallback(event => {
55
60
  const isModifierKeyPressed = isSpecialEvent(event);
56
61
  analytics.ui.cardClickedEvent({
@@ -5,7 +5,6 @@ import { ActionName, CardDisplay, SmartLinkSize } from '../../../../../constants
5
5
  import { FooterBlock, MetadataBlock, SnippetBlock, TitleBlock } from '../../../../FlexibleCard/components/blocks';
6
6
  import { footerBlockCss, hiddenSnippetStyles, metadataBlockCss } from './styled';
7
7
  import FlexibleCard from '../../../../FlexibleCard';
8
- import { useSmartCardActions } from '../../../../../state/actions';
9
8
  import { getSimulatedMetadata, toActionableMetadata } from '../../../utils';
10
9
  import SnippetOrPreview from '../../SnippetOrPreview';
11
10
  import { extractMetadata } from '../../../../../extractors/hover/extractMetadata';
@@ -36,10 +35,6 @@ const HoverCardResolvedView = ({
36
35
  var _cardState$details;
37
36
 
38
37
  const showActionableElement = useFeatureFlag('enableActionableElement');
39
- const actions = useSmartCardActions(id, url, analytics);
40
- useEffect(() => {
41
- actions.loadMetadata();
42
- }, [actions]);
43
38
  useEffect(() => {
44
39
  // Since this hover view is only rendered on resolved status,
45
40
  // there is no need to check for statuses.
@@ -0,0 +1 @@
1
+ export { HoverCard } from './view/HoverCard';
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "23.9.3",
3
+ "version": "23.10.0",
4
4
  "sideEffects": false
5
5
  }
@@ -2,7 +2,7 @@
2
2
  import { jsx } from '@emotion/react';
3
3
  import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
4
4
  import { extractType } from '@atlaskit/linking-common/extractors';
5
- import React, { useCallback, useMemo } from 'react';
5
+ import React, { useCallback, useEffect, useMemo } from 'react';
6
6
  import { ActionName, CardDisplay, SmartLinkPosition, SmartLinkSize } from '../../../constants';
7
7
  import { extractMetadata } from '../../../extractors/hover/extractMetadata';
8
8
  import { getExtensionKey } from '../../../state/helpers';
@@ -14,6 +14,7 @@ import HoverCardUnauthorisedView from './views/unauthorised';
14
14
  import HoverCardResolvedView from './views/resolved';
15
15
  import { FormattedMessage } from 'react-intl-next';
16
16
  import { messages } from '../../../messages';
17
+ import { useSmartCardActions } from '../../../state/actions';
17
18
  export var hoverCardClassName = 'smart-links-hover-preview';
18
19
  export var getOpenAction = function getOpenAction(url, analytics, onActionClick) {
19
20
  return {
@@ -56,6 +57,10 @@ var HoverCardContent = function HoverCardContent(_ref) {
56
57
  var extensionKey = useMemo(function () {
57
58
  return getExtensionKey(cardState.details);
58
59
  }, [cardState.details]);
60
+ var actions = useSmartCardActions(id, url, analytics);
61
+ useEffect(function () {
62
+ actions.loadMetadata();
63
+ }, [actions]);
59
64
  var onClick = useCallback(function (event) {
60
65
  var isModifierKeyPressed = isSpecialEvent(event);
61
66
  analytics.ui.cardClickedEvent({
@@ -5,7 +5,6 @@ import { ActionName, CardDisplay, SmartLinkSize } from '../../../../../constants
5
5
  import { FooterBlock, MetadataBlock, SnippetBlock, TitleBlock } from '../../../../FlexibleCard/components/blocks';
6
6
  import { footerBlockCss, hiddenSnippetStyles, metadataBlockCss } from './styled';
7
7
  import FlexibleCard from '../../../../FlexibleCard';
8
- import { useSmartCardActions } from '../../../../../state/actions';
9
8
  import { getSimulatedMetadata, toActionableMetadata } from '../../../utils';
10
9
  import SnippetOrPreview from '../../SnippetOrPreview';
11
10
  import { extractMetadata } from '../../../../../extractors/hover/extractMetadata';
@@ -41,10 +40,6 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
41
40
  onActionClick = _ref.onActionClick,
42
41
  extensionKey = _ref.extensionKey;
43
42
  var showActionableElement = useFeatureFlag('enableActionableElement');
44
- var actions = useSmartCardActions(id, url, analytics);
45
- useEffect(function () {
46
- actions.loadMetadata();
47
- }, [actions]);
48
43
  useEffect(function () {
49
44
  // Since this hover view is only rendered on resolved status,
50
45
  // there is no need to check for statuses.
@@ -0,0 +1,2 @@
1
+ export { HoverCard } from './view/HoverCard';
2
+ export type { HoverCardProps } from './view/HoverCard/types';
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@atlaskit/smart-card/hover-card",
3
+ "main": "../dist/cjs/hoverCard.js",
4
+ "module": "../dist/esm/hoverCard.js",
5
+ "module:es2019": "../dist/es2019/hoverCard.js",
6
+ "sideEffects": false,
7
+ "types": "../dist/types/hoverCard.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/hoverCard.d.ts"
12
+ ]
13
+ }
14
+ }
15
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "23.9.3",
3
+ "version": "23.10.0",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -119,6 +119,7 @@
119
119
  "./client": "./src/client/index.ts",
120
120
  "./types": "./src/types.ts",
121
121
  "./hooks": "./src/hooks.ts",
122
+ "./hover-card": "./src/hoverCard.ts",
122
123
  ".": "./src/index.ts"
123
124
  },
124
125
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1",