@atlaskit/smart-card 19.1.31 → 20.0.1
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 +22 -0
- package/dist/cjs/extractors/block/index.js +9 -19
- package/dist/cjs/extractors/common/actions/extractPreviewAction.js +3 -5
- package/dist/cjs/extractors/common/byline/extractByline.js +5 -11
- package/dist/cjs/extractors/common/context/index.js +0 -16
- package/dist/cjs/extractors/common/icon/extractIcon.js +4 -8
- package/dist/cjs/extractors/common/lozenge/extractLozenge.js +2 -2
- package/dist/cjs/extractors/common/lozenge/extractTaskType.js +2 -2
- package/dist/cjs/extractors/common/primitives/index.js +0 -16
- package/dist/cjs/extractors/embed/index.js +5 -9
- package/dist/cjs/extractors/flexible/collaboratorGroup/index.js +2 -2
- package/dist/cjs/extractors/flexible/extract-preview.js +2 -2
- package/dist/cjs/extractors/flexible/extract-priority.js +2 -2
- package/dist/cjs/extractors/flexible/icon/extract-jsonld-data-icon.js +2 -2
- package/dist/cjs/extractors/flexible/icon/extract-provider-icon.js +2 -2
- package/dist/cjs/extractors/flexible/icon/extract-url-icon.js +2 -2
- package/dist/cjs/extractors/flexible/index.js +6 -10
- package/dist/cjs/extractors/flexible/utils.js +3 -3
- package/dist/cjs/extractors/inline/index.js +4 -4
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/FlexibleCard/utils.js +3 -1
- package/dist/cjs/view/HoverCard/components/hover-card-content.js +17 -8
- package/dist/cjs/view/HoverCard/index.js +18 -12
- package/dist/cjs/view/InlineCard/index.js +5 -3
- package/dist/cjs/view/common/Modal.js +2 -1
- package/dist/es2019/extractors/block/index.js +2 -7
- package/dist/es2019/extractors/common/actions/extractPreviewAction.js +1 -2
- package/dist/es2019/extractors/common/byline/extractByline.js +1 -4
- package/dist/es2019/extractors/common/context/index.js +0 -2
- package/dist/es2019/extractors/common/icon/extractIcon.js +1 -3
- package/dist/es2019/extractors/common/lozenge/extractLozenge.js +1 -1
- package/dist/es2019/extractors/common/lozenge/extractTaskType.js +1 -1
- package/dist/es2019/extractors/common/primitives/index.js +0 -2
- package/dist/es2019/extractors/embed/index.js +1 -3
- package/dist/es2019/extractors/flexible/collaboratorGroup/index.js +1 -1
- package/dist/es2019/extractors/flexible/extract-preview.js +1 -1
- package/dist/es2019/extractors/flexible/extract-priority.js +1 -1
- package/dist/es2019/extractors/flexible/icon/extract-jsonld-data-icon.js +1 -1
- package/dist/es2019/extractors/flexible/icon/extract-provider-icon.js +1 -1
- package/dist/es2019/extractors/flexible/icon/extract-url-icon.js +1 -1
- package/dist/es2019/extractors/flexible/index.js +2 -4
- package/dist/es2019/extractors/flexible/utils.js +1 -1
- package/dist/es2019/extractors/inline/index.js +2 -2
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/FlexibleCard/utils.js +2 -1
- package/dist/es2019/view/HoverCard/components/hover-card-content.js +17 -6
- package/dist/es2019/view/HoverCard/index.js +18 -12
- package/dist/es2019/view/InlineCard/index.js +2 -1
- package/dist/es2019/view/common/Modal.js +1 -1
- package/dist/esm/extractors/block/index.js +2 -7
- package/dist/esm/extractors/common/actions/extractPreviewAction.js +1 -2
- package/dist/esm/extractors/common/byline/extractByline.js +1 -4
- package/dist/esm/extractors/common/context/index.js +0 -2
- package/dist/esm/extractors/common/icon/extractIcon.js +1 -3
- package/dist/esm/extractors/common/lozenge/extractLozenge.js +1 -1
- package/dist/esm/extractors/common/lozenge/extractTaskType.js +1 -1
- package/dist/esm/extractors/common/primitives/index.js +0 -2
- package/dist/esm/extractors/embed/index.js +1 -3
- package/dist/esm/extractors/flexible/collaboratorGroup/index.js +1 -1
- package/dist/esm/extractors/flexible/extract-preview.js +1 -1
- package/dist/esm/extractors/flexible/extract-priority.js +1 -1
- package/dist/esm/extractors/flexible/icon/extract-jsonld-data-icon.js +1 -1
- package/dist/esm/extractors/flexible/icon/extract-provider-icon.js +1 -1
- package/dist/esm/extractors/flexible/icon/extract-url-icon.js +1 -1
- package/dist/esm/extractors/flexible/index.js +2 -4
- package/dist/esm/extractors/flexible/utils.js +1 -1
- package/dist/esm/extractors/inline/index.js +2 -2
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/FlexibleCard/utils.js +2 -1
- package/dist/esm/view/HoverCard/components/hover-card-content.js +16 -7
- package/dist/esm/view/HoverCard/index.js +18 -12
- package/dist/esm/view/InlineCard/index.js +2 -1
- package/dist/esm/view/common/Modal.js +2 -1
- package/dist/types/extractors/block/index.d.ts +1 -1
- package/dist/types/extractors/common/context/index.d.ts +0 -2
- package/dist/types/extractors/common/icon/extractIcon.d.ts +1 -1
- package/dist/types/extractors/common/primitives/index.d.ts +0 -2
- package/dist/types/extractors/flexible/collaboratorGroup/index.d.ts +1 -1
- package/dist/types/state/flexible-ui-context/types.d.ts +1 -1
- package/dist/types/view/HoverCard/types.d.ts +1 -0
- package/package.json +3 -3
- package/dist/cjs/extractors/common/context/extractContext.js +0 -38
- package/dist/cjs/extractors/common/context/extractProvider.js +0 -83
- package/dist/cjs/extractors/common/date/extractDateCreated.js +0 -14
- package/dist/cjs/extractors/common/date/extractDateUpdated.js +0 -14
- package/dist/cjs/extractors/common/person/extractMembers.js +0 -37
- package/dist/cjs/extractors/common/person/extractPersonAssignedTo.js +0 -18
- package/dist/cjs/extractors/common/person/extractPersonCreatedBy.js +0 -28
- package/dist/cjs/extractors/common/person/extractPersonUpdatedBy.js +0 -18
- package/dist/cjs/extractors/common/person/index.js +0 -37
- package/dist/cjs/extractors/common/person/types.js +0 -5
- package/dist/cjs/extractors/common/preview/extractImage.js +0 -26
- package/dist/cjs/extractors/common/preview/index.js +0 -21
- package/dist/cjs/extractors/common/primitives/extractLink.js +0 -22
- package/dist/cjs/extractors/common/primitives/extractTitle.js +0 -55
- package/dist/cjs/extractors/common/primitives/extractType.js +0 -20
- package/dist/cjs/extractors/common/utils.js +0 -43
- package/dist/es2019/extractors/common/context/extractContext.js +0 -27
- package/dist/es2019/extractors/common/context/extractProvider.js +0 -65
- package/dist/es2019/extractors/common/date/extractDateCreated.js +0 -5
- package/dist/es2019/extractors/common/date/extractDateUpdated.js +0 -5
- package/dist/es2019/extractors/common/person/extractMembers.js +0 -23
- package/dist/es2019/extractors/common/person/extractPersonAssignedTo.js +0 -8
- package/dist/es2019/extractors/common/person/extractPersonCreatedBy.js +0 -16
- package/dist/es2019/extractors/common/person/extractPersonUpdatedBy.js +0 -8
- package/dist/es2019/extractors/common/person/index.js +0 -4
- package/dist/es2019/extractors/common/person/types.js +0 -1
- package/dist/es2019/extractors/common/preview/extractImage.js +0 -16
- package/dist/es2019/extractors/common/preview/index.js +0 -2
- package/dist/es2019/extractors/common/primitives/extractLink.js +0 -12
- package/dist/es2019/extractors/common/primitives/extractTitle.js +0 -37
- package/dist/es2019/extractors/common/primitives/extractType.js +0 -11
- package/dist/es2019/extractors/common/utils.js +0 -30
- package/dist/esm/extractors/common/context/extractContext.js +0 -27
- package/dist/esm/extractors/common/context/extractProvider.js +0 -65
- package/dist/esm/extractors/common/date/extractDateCreated.js +0 -5
- package/dist/esm/extractors/common/date/extractDateUpdated.js +0 -5
- package/dist/esm/extractors/common/person/extractMembers.js +0 -27
- package/dist/esm/extractors/common/person/extractPersonAssignedTo.js +0 -8
- package/dist/esm/extractors/common/person/extractPersonCreatedBy.js +0 -18
- package/dist/esm/extractors/common/person/extractPersonUpdatedBy.js +0 -8
- package/dist/esm/extractors/common/person/index.js +0 -4
- package/dist/esm/extractors/common/person/types.js +0 -1
- package/dist/esm/extractors/common/preview/extractImage.js +0 -16
- package/dist/esm/extractors/common/preview/index.js +0 -2
- package/dist/esm/extractors/common/primitives/extractLink.js +0 -12
- package/dist/esm/extractors/common/primitives/extractTitle.js +0 -41
- package/dist/esm/extractors/common/primitives/extractType.js +0 -11
- package/dist/esm/extractors/common/utils.js +0 -30
- package/dist/types/extractors/common/context/extractContext.d.ts +0 -7
- package/dist/types/extractors/common/context/extractProvider.d.ts +0 -8
- package/dist/types/extractors/common/date/extractDateCreated.d.ts +0 -3
- package/dist/types/extractors/common/date/extractDateUpdated.d.ts +0 -2
- package/dist/types/extractors/common/person/extractMembers.d.ts +0 -3
- package/dist/types/extractors/common/person/extractPersonAssignedTo.d.ts +0 -4
- package/dist/types/extractors/common/person/extractPersonCreatedBy.d.ts +0 -3
- package/dist/types/extractors/common/person/extractPersonUpdatedBy.d.ts +0 -5
- package/dist/types/extractors/common/person/index.d.ts +0 -5
- package/dist/types/extractors/common/person/types.d.ts +0 -4
- package/dist/types/extractors/common/preview/extractImage.d.ts +0 -2
- package/dist/types/extractors/common/preview/index.d.ts +0 -3
- package/dist/types/extractors/common/primitives/extractLink.d.ts +0 -2
- package/dist/types/extractors/common/primitives/extractTitle.d.ts +0 -2
- package/dist/types/extractors/common/primitives/extractType.d.ts +0 -2
- package/dist/types/extractors/common/utils.d.ts +0 -4
|
@@ -63,21 +63,24 @@ var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
63
63
|
var renderers = (0, _renderers.useSmartLinkRenderers)();
|
|
64
64
|
var linkState = (0, _store.useSmartCardState)(url);
|
|
65
65
|
var analytics = (0, _analytics2.useSmartLinkAnalytics)(url, analyticsHandler, id);
|
|
66
|
+
var hideCard = (0, _react.useCallback)(function () {
|
|
67
|
+
//Check its previously open to avoid firing events when moving between the child and hover card components
|
|
68
|
+
if (isOpen === true && cardOpenTime.current) {
|
|
69
|
+
var hoverTime = Date.now() - cardOpenTime.current;
|
|
70
|
+
analytics.ui.hoverCardDismissedEvent('card', hoverTime, 'mouse_hover');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
setIsOpen(false);
|
|
74
|
+
}, [analytics.ui, isOpen]);
|
|
66
75
|
var initHideCard = (0, _react.useCallback)(function () {
|
|
67
76
|
if (fadeInTimeoutId.current) {
|
|
68
77
|
clearTimeout(fadeInTimeoutId.current);
|
|
69
78
|
}
|
|
70
79
|
|
|
71
80
|
fadeOutTimeoutId.current = setTimeout(function () {
|
|
72
|
-
|
|
73
|
-
if (isOpen === true && cardOpenTime.current) {
|
|
74
|
-
var hoverTime = Date.now() - cardOpenTime.current;
|
|
75
|
-
analytics.ui.hoverCardDismissedEvent('card', hoverTime, 'mouse_hover');
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
setIsOpen(false);
|
|
81
|
+
return hideCard();
|
|
79
82
|
}, delay);
|
|
80
|
-
}, [
|
|
83
|
+
}, [hideCard]);
|
|
81
84
|
var initShowCard = (0, _react.useCallback)(function () {
|
|
82
85
|
if (fadeOutTimeoutId.current) {
|
|
83
86
|
clearTimeout(fadeOutTimeoutId.current);
|
|
@@ -98,13 +101,15 @@ var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
98
101
|
appearance: _utils.HOVER_CARD_ANALYTICS_DISPLAY,
|
|
99
102
|
analyticsHandler: analyticsHandler
|
|
100
103
|
});
|
|
101
|
-
var
|
|
102
|
-
|
|
103
|
-
|
|
104
|
+
var onActionClick = (0, _react.useCallback)(function (actionId) {
|
|
105
|
+
if (actionId === 'preview-content') {
|
|
106
|
+
hideCard();
|
|
107
|
+
}
|
|
108
|
+
}, [hideCard]);
|
|
104
109
|
return (0, _core.jsx)(_popup.default, {
|
|
105
110
|
testId: "hover-card",
|
|
106
111
|
isOpen: isOpen,
|
|
107
|
-
onClose:
|
|
112
|
+
onClose: hideCard,
|
|
108
113
|
placement: "bottom-start",
|
|
109
114
|
content: function content(_ref2) {
|
|
110
115
|
var update = _ref2.update;
|
|
@@ -116,6 +121,7 @@ var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
116
121
|
analytics: analytics,
|
|
117
122
|
cardActions: linkActions,
|
|
118
123
|
cardState: linkState,
|
|
124
|
+
onActionClick: onActionClick,
|
|
119
125
|
onResolve: update,
|
|
120
126
|
renderers: renderers,
|
|
121
127
|
url: url
|
|
@@ -59,6 +59,8 @@ var _ResolvingView = require("./ResolvingView");
|
|
|
59
59
|
|
|
60
60
|
var _UnauthorisedView = require("./UnauthorisedView");
|
|
61
61
|
|
|
62
|
+
var _extractors = require("@atlaskit/linking-common/extractors");
|
|
63
|
+
|
|
62
64
|
var InlineCard = function InlineCard(_ref) {
|
|
63
65
|
var _details$meta;
|
|
64
66
|
|
|
@@ -109,7 +111,7 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
109
111
|
}));
|
|
110
112
|
|
|
111
113
|
case 'unauthorized':
|
|
112
|
-
var provider = (0,
|
|
114
|
+
var provider = (0, _extractors.extractProvider)(cardDetails);
|
|
113
115
|
return /*#__PURE__*/_react.default.createElement(_UnauthorisedView.InlineCardUnauthorizedView, {
|
|
114
116
|
icon: provider && provider.icon,
|
|
115
117
|
url: url,
|
|
@@ -120,7 +122,7 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
120
122
|
});
|
|
121
123
|
|
|
122
124
|
case 'forbidden':
|
|
123
|
-
var providerForbidden = (0,
|
|
125
|
+
var providerForbidden = (0, _extractors.extractProvider)(cardDetails);
|
|
124
126
|
var cardMetadata = (_details$meta = details === null || details === void 0 ? void 0 : details.meta) !== null && _details$meta !== void 0 ? _details$meta : (0, _jsonld.getUnauthorizedJsonLd)().meta;
|
|
125
127
|
var requestAccessContext = (0, _context.extractRequestAccessContext)({
|
|
126
128
|
jsonLd: cardMetadata,
|
|
@@ -139,7 +141,7 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
139
141
|
});
|
|
140
142
|
|
|
141
143
|
case 'not_found':
|
|
142
|
-
var providerNotFound = (0,
|
|
144
|
+
var providerNotFound = (0, _extractors.extractProvider)(cardDetails);
|
|
143
145
|
return /*#__PURE__*/_react.default.createElement(_ErroredView.InlineCardErroredView, {
|
|
144
146
|
url: url,
|
|
145
147
|
icon: providerNotFound && providerNotFound.icon,
|
|
@@ -72,7 +72,8 @@ var Modal = function Modal(_ref) {
|
|
|
72
72
|
var onClose = _ref.onClose,
|
|
73
73
|
onOpen = _ref.onOpen,
|
|
74
74
|
src = _ref.src,
|
|
75
|
-
testId = _ref.testId,
|
|
75
|
+
_ref$testId = _ref.testId,
|
|
76
|
+
testId = _ref$testId === void 0 ? 'smart-links-preview-modal' : _ref$testId,
|
|
76
77
|
showModal = _ref.showModal,
|
|
77
78
|
providerName = _ref.providerName,
|
|
78
79
|
metadata = _ref.metadata,
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { extractTitleTextColor, extractSummary } from '../common/primitives';
|
|
2
2
|
import { extractLozenge } from '../common/lozenge';
|
|
3
3
|
import { extractIcon } from '../common/icon';
|
|
4
|
-
import { extractProvider } from '../common/context/extractProvider';
|
|
5
4
|
import { extractCommentCount, extractProgrammingLanguage, extractSubscriberCount } from '../common/detail';
|
|
6
|
-
import { extractMembers } from '
|
|
7
|
-
import { extractPersonAssignedTo } from '../common/person/extractPersonAssignedTo';
|
|
8
|
-
import { extractPersonCreatedBy } from '../common/person/extractPersonCreatedBy';
|
|
9
|
-
import { extractPersonUpdatedBy } from '../common/person/extractPersonUpdatedBy';
|
|
5
|
+
import { extractLink, extractTitle, extractProvider, extractMembers, extractPersonAssignedTo, extractPersonCreatedBy, extractPersonUpdatedBy, extractImage } from '@atlaskit/linking-common/extractors';
|
|
10
6
|
import { extractByline } from '../common/byline/extractByline';
|
|
11
7
|
import { extractTitlePrefix } from '../common/title-prefix/extractTitlePrefix';
|
|
12
|
-
import { extractImage } from '../common/preview/extractImage';
|
|
13
8
|
import { extractActions } from '../common/actions/extractActions';
|
|
14
9
|
import { extractPreviewAction } from '../common/actions/extractPreviewAction';
|
|
15
10
|
import { extractIsTrusted } from '../common/meta/extractIsTrusted';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { uiRenderSuccessEvent, uiRenderFailedEvent } from '../../../utils/analytics';
|
|
2
2
|
import { extractDownloadUrl } from '../detail';
|
|
3
|
-
import { extractProvider } from '
|
|
4
|
-
import { extractPreview } from '../preview';
|
|
3
|
+
import { extractProvider, extractPreview } from '@atlaskit/linking-common/extractors';
|
|
5
4
|
import { PreviewAction } from '../../../view/BlockCard';
|
|
6
5
|
|
|
7
6
|
const getMetadataFromJsonLd = (jsonLd, platform) => {
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FormattedRelativeTime } from 'react-intl-next';
|
|
3
3
|
import { selectUnit } from '@formatjs/intl-utils';
|
|
4
|
-
import { extractPersonUpdatedBy } from '
|
|
5
|
-
import { extractPersonCreatedBy } from '../person/extractPersonCreatedBy';
|
|
6
|
-
import { extractDateCreated } from '../date/extractDateCreated';
|
|
7
|
-
import { extractDateUpdated } from '../date/extractDateUpdated';
|
|
4
|
+
import { extractDateCreated, extractDateUpdated, extractPersonCreatedBy, extractPersonUpdatedBy } from '@atlaskit/linking-common/extractors';
|
|
8
5
|
export const extractByline = jsonLd => {
|
|
9
6
|
const updatedAt = extractDateUpdated(jsonLd);
|
|
10
7
|
const createdAt = extractDateCreated(jsonLd);
|
|
@@ -6,13 +6,11 @@ import BranchIcon from '@atlaskit/icon-object/glyph/branch/16';
|
|
|
6
6
|
import RepoIcon from '@atlaskit/icon-object/glyph/code/16';
|
|
7
7
|
import TaskIcon from '@atlaskit/icon-object/glyph/task/16';
|
|
8
8
|
import { extractorPriorityMap } from './priority';
|
|
9
|
-
import { extractProvider } from '
|
|
10
|
-
import { extractTitle } from '../primitives/extractTitle';
|
|
9
|
+
import { extractProvider, extractUrlFromIconJsonLd, extractTitle } from '@atlaskit/linking-common/extractors';
|
|
11
10
|
import { extractFileFormat } from './extractFileFormat';
|
|
12
11
|
import { extractIconFromDocument } from './extractIconFromDocument';
|
|
13
12
|
import { extractIconFromTask } from './extractIconFromTask';
|
|
14
13
|
import { extractTaskType } from '../lozenge/extractTaskType';
|
|
15
|
-
import { extractUrlFromIconJsonLd } from '../utils';
|
|
16
14
|
export const extractIcon = (jsonLd, priority = 'type') => {
|
|
17
15
|
const type = jsonLd['@type'];
|
|
18
16
|
const opts = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { extractState } from './extractState';
|
|
2
2
|
import { extractTag } from './extractTag';
|
|
3
3
|
import { extractTaskStatus } from './extractTaskStatus';
|
|
4
|
-
import { extractType } from '
|
|
4
|
+
import { extractType } from '@atlaskit/linking-common/extractors';
|
|
5
5
|
import { extractTaskType } from './extractTaskType';
|
|
6
6
|
const DOC_TYPES = ['schema:BlogPosting', 'schema:TextDigitalDocument', 'schema:DigitalDocument', 'schema:PresentationDigitalDocument', 'schema:SpreadsheetDigitalDocument'];
|
|
7
7
|
export const extractLozenge = jsonLd => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { extractUrlFromIconJsonLd } from '
|
|
1
|
+
import { extractUrlFromIconJsonLd } from '@atlaskit/linking-common/extractors';
|
|
2
2
|
export const extractTaskType = jsonLd => {
|
|
3
3
|
// TODO: Remove once Jira migrate to the correct type.
|
|
4
4
|
const taskType = jsonLd['atlassian:taskType'] || jsonLd.taskType;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { extractLink, extractTitle } from '
|
|
2
|
-
import { extractProvider } from '../common/context';
|
|
3
|
-
import { extractPreview } from '@atlaskit/linking-common';
|
|
1
|
+
import { extractLink, extractTitle, extractProvider, extractPreview } from '@atlaskit/linking-common/extractors';
|
|
4
2
|
import { extractIsTrusted } from '../common/meta/extractIsTrusted';
|
|
5
3
|
|
|
6
4
|
const extractEmbedPreview = (jsonLd, platform) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { extractPersonFromJsonLd } from '
|
|
1
|
+
import { extractPersonFromJsonLd } from '@atlaskit/linking-common/extractors';
|
|
2
2
|
// Temporary Extractor until https://product-fabric.atlassian.net/browse/EDM-2652 is ready
|
|
3
3
|
export const extractPersonsUpdatedBy = jsonLd => {
|
|
4
4
|
const updatedBy = jsonLd['atlassian:updatedBy'];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IconType } from '../../constants';
|
|
2
|
-
import { extractUrlFromIconJsonLd } from '
|
|
2
|
+
import { extractUrlFromIconJsonLd } from '@atlaskit/linking-common/extractors';
|
|
3
3
|
const priorityMapper = {
|
|
4
4
|
blocker: IconType.PriorityBlocker,
|
|
5
5
|
critical: IconType.PriorityCritical,
|
|
@@ -5,7 +5,7 @@ import extractJiraTaskIcon from './extract-jira-task-icon';
|
|
|
5
5
|
import extractProviderIcon from './extract-provider-icon';
|
|
6
6
|
import extractUrlIcon from './extract-url-icon';
|
|
7
7
|
import { extractTaskType } from '../../common/lozenge';
|
|
8
|
-
import { extractTitle } from '
|
|
8
|
+
import { extractTitle } from '@atlaskit/linking-common/extractors';
|
|
9
9
|
import { extractorPriorityMap as priorityMap } from '../../common/icon/priority';
|
|
10
10
|
import { IconType } from '../../../constants';
|
|
11
11
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CONFLUENCE_GENERATOR_ID, JIRA_GENERATOR_ID } from '../../constants';
|
|
2
2
|
import { IconType } from '../../../constants';
|
|
3
3
|
import extractUrlIcon from './extract-url-icon';
|
|
4
|
-
import { extractTitle } from '
|
|
4
|
+
import { extractTitle } from '@atlaskit/linking-common/extractors';
|
|
5
5
|
|
|
6
6
|
const extractProviderIcon = data => {
|
|
7
7
|
if (!data) {
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { extractSummary } from '../common/primitives';
|
|
2
2
|
import { extractLozenge } from '../common/lozenge';
|
|
3
3
|
import { extractLinkIcon } from './icon';
|
|
4
4
|
import { extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount, extractViewCount, extractReactCount, extractVoteCount, extractSourceBranch, extractTargetBranch, extractDueOn } from './utils';
|
|
5
|
-
import { extractPersonCreatedBy } from '../common/person';
|
|
6
5
|
import { extractPersonsUpdatedBy } from './collaboratorGroup';
|
|
7
|
-
import { extractDateUpdated } from '
|
|
8
|
-
import { extractDateCreated } from '../common/date/extractDateCreated';
|
|
6
|
+
import { extractPersonCreatedBy, extractLink, extractTitle, extractDateUpdated, extractDateCreated } from '@atlaskit/linking-common/extractors';
|
|
9
7
|
import extractPriority from './extract-priority';
|
|
10
8
|
import extractProviderIcon from './icon/extract-provider-icon';
|
|
11
9
|
import extractPreview from './extract-preview';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { extractPersonCreatedBy, extractPersonUpdatedBy } from '
|
|
1
|
+
import { extractPersonCreatedBy, extractPersonUpdatedBy } from '@atlaskit/linking-common/extractors';
|
|
2
2
|
|
|
3
3
|
const extractLinkName = link => {
|
|
4
4
|
if (link && typeof link === 'object' && link['@type'] === 'Link') {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { extractTitleTextColor } from '../common/primitives';
|
|
2
2
|
import { extractLozenge } from '../common/lozenge';
|
|
3
3
|
import { extractIcon } from '../common/icon';
|
|
4
4
|
import { extractTitlePrefix } from '../common/title-prefix';
|
|
5
|
-
import { extractProvider } from '
|
|
5
|
+
import { extractLink, extractTitle, extractProvider } from '@atlaskit/linking-common/extractors';
|
|
6
6
|
import { CONFLUENCE_GENERATOR_ID, JIRA_GENERATOR_ID } from '../constants';
|
|
7
7
|
export const extractInlineIcon = jsonLd => {
|
|
8
8
|
const provider = extractProvider(jsonLd);
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { SmartLinkStatus } from '../../constants';
|
|
2
2
|
import { getEmptyJsonLd, getUnauthorizedJsonLd } from '../../utils/jsonld';
|
|
3
|
-
import {
|
|
3
|
+
import { extractRequestAccessContext } from '../../extractors/common/context';
|
|
4
4
|
import { messages } from '../../messages';
|
|
5
5
|
import extractFlexibleLinkContext from '../../extractors/flexible';
|
|
6
6
|
import { extractErrorIcon } from '../../extractors/flexible/icon';
|
|
7
7
|
import { handleOnClick } from '../../utils';
|
|
8
|
+
import { extractProvider } from '@atlaskit/linking-common/extractors';
|
|
8
9
|
export const getContextByStatus = (url, status, details, renderers) => {
|
|
9
10
|
switch (status) {
|
|
10
11
|
case SmartLinkStatus.Pending:
|
|
@@ -9,7 +9,7 @@ import { isSpecialEvent } from '../../../utils';
|
|
|
9
9
|
import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
|
|
10
10
|
import { getExtensionKey } from '../../../state/helpers';
|
|
11
11
|
import { titleBlockCss, metadataBlockCss, footerBlockCss } from '../styled';
|
|
12
|
-
import { extractType } from '
|
|
12
|
+
import { extractType } from '@atlaskit/linking-common/extractors';
|
|
13
13
|
const flexibleUiOptions = {
|
|
14
14
|
hideElevation: true,
|
|
15
15
|
size: SmartLinkSize.Medium,
|
|
@@ -18,7 +18,7 @@ const flexibleUiOptions = {
|
|
|
18
18
|
hidePadding: true
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
const getOpenAction = (url, analytics) => ({
|
|
21
|
+
const getOpenAction = (url, analytics, onActionClick) => ({
|
|
22
22
|
name: ActionName.CustomAction,
|
|
23
23
|
icon: /*#__PURE__*/React.createElement(ShortcutIcon, {
|
|
24
24
|
label: "open in new tab",
|
|
@@ -26,16 +26,26 @@ const getOpenAction = (url, analytics) => ({
|
|
|
26
26
|
}),
|
|
27
27
|
iconPosition: 'before',
|
|
28
28
|
onClick: () => {
|
|
29
|
+
if (onActionClick) {
|
|
30
|
+
onActionClick('open-content');
|
|
31
|
+
}
|
|
32
|
+
|
|
29
33
|
window.open(url, '_blank');
|
|
30
34
|
analytics.ui.hoverCardOpenLinkClickedEvent('card');
|
|
31
35
|
},
|
|
32
36
|
testId: 'hover-card-open-button'
|
|
33
37
|
});
|
|
34
38
|
|
|
35
|
-
const toFooterActions = cardActions => cardActions.map(action => ({
|
|
39
|
+
const toFooterActions = (cardActions, onActionClick) => cardActions.map(action => ({
|
|
36
40
|
content: action.text,
|
|
37
41
|
name: ActionName.CustomAction,
|
|
38
|
-
onClick: () =>
|
|
42
|
+
onClick: () => {
|
|
43
|
+
if (onActionClick) {
|
|
44
|
+
onActionClick(action.id);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return action.invoke();
|
|
48
|
+
},
|
|
39
49
|
testId: action.id
|
|
40
50
|
}));
|
|
41
51
|
|
|
@@ -43,6 +53,7 @@ const HoverCardContent = ({
|
|
|
43
53
|
analytics,
|
|
44
54
|
cardActions = [],
|
|
45
55
|
cardState,
|
|
56
|
+
onActionClick,
|
|
46
57
|
onResolve,
|
|
47
58
|
renderers,
|
|
48
59
|
url
|
|
@@ -59,8 +70,8 @@ const HoverCardContent = ({
|
|
|
59
70
|
const isModifierKeyPressed = isSpecialEvent(event);
|
|
60
71
|
analytics.ui.cardClickedEvent(undefined, HOVER_CARD_ANALYTICS_DISPLAY, cardState.status, undefined, undefined, isModifierKeyPressed, undefined, undefined, undefined, 'titleGoToLink');
|
|
61
72
|
}, [cardState.status, analytics.ui]);
|
|
62
|
-
const titleActions = useMemo(() => [getOpenAction(url, analytics)], [url, analytics]);
|
|
63
|
-
const footerActions = useMemo(() => toFooterActions(cardActions), [cardActions]);
|
|
73
|
+
const titleActions = useMemo(() => [getOpenAction(url, analytics, onActionClick)], [url, analytics, onActionClick]);
|
|
74
|
+
const footerActions = useMemo(() => toFooterActions(cardActions, onActionClick), [cardActions, onActionClick]);
|
|
64
75
|
const data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
65
76
|
const types = data ? extractType(data) : undefined; //TODO: EDM-3224 deleted simulated and use real JsonLd
|
|
66
77
|
|
|
@@ -30,21 +30,22 @@ export const HoverCardComponent = ({
|
|
|
30
30
|
const renderers = useSmartLinkRenderers();
|
|
31
31
|
const linkState = useLinkState(url);
|
|
32
32
|
const analytics = useSmartLinkAnalytics(url, analyticsHandler, id);
|
|
33
|
+
const hideCard = useCallback(() => {
|
|
34
|
+
//Check its previously open to avoid firing events when moving between the child and hover card components
|
|
35
|
+
if (isOpen === true && cardOpenTime.current) {
|
|
36
|
+
const hoverTime = Date.now() - cardOpenTime.current;
|
|
37
|
+
analytics.ui.hoverCardDismissedEvent('card', hoverTime, 'mouse_hover');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
setIsOpen(false);
|
|
41
|
+
}, [analytics.ui, isOpen]);
|
|
33
42
|
const initHideCard = useCallback(() => {
|
|
34
43
|
if (fadeInTimeoutId.current) {
|
|
35
44
|
clearTimeout(fadeInTimeoutId.current);
|
|
36
45
|
}
|
|
37
46
|
|
|
38
|
-
fadeOutTimeoutId.current = setTimeout(() =>
|
|
39
|
-
|
|
40
|
-
if (isOpen === true && cardOpenTime.current) {
|
|
41
|
-
const hoverTime = Date.now() - cardOpenTime.current;
|
|
42
|
-
analytics.ui.hoverCardDismissedEvent('card', hoverTime, 'mouse_hover');
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
setIsOpen(false);
|
|
46
|
-
}, delay);
|
|
47
|
-
}, [delay, isOpen, analytics.ui]);
|
|
47
|
+
fadeOutTimeoutId.current = setTimeout(() => hideCard(), delay);
|
|
48
|
+
}, [hideCard]);
|
|
48
49
|
const initShowCard = useCallback(() => {
|
|
49
50
|
if (fadeOutTimeoutId.current) {
|
|
50
51
|
clearTimeout(fadeOutTimeoutId.current);
|
|
@@ -65,11 +66,15 @@ export const HoverCardComponent = ({
|
|
|
65
66
|
appearance: HOVER_CARD_ANALYTICS_DISPLAY,
|
|
66
67
|
analyticsHandler
|
|
67
68
|
});
|
|
68
|
-
const
|
|
69
|
+
const onActionClick = useCallback(actionId => {
|
|
70
|
+
if (actionId === 'preview-content') {
|
|
71
|
+
hideCard();
|
|
72
|
+
}
|
|
73
|
+
}, [hideCard]);
|
|
69
74
|
return jsx(Popup, {
|
|
70
75
|
testId: "hover-card",
|
|
71
76
|
isOpen: isOpen,
|
|
72
|
-
onClose:
|
|
77
|
+
onClose: hideCard,
|
|
73
78
|
placement: "bottom-start",
|
|
74
79
|
content: ({
|
|
75
80
|
update
|
|
@@ -81,6 +86,7 @@ export const HoverCardComponent = ({
|
|
|
81
86
|
analytics: analytics,
|
|
82
87
|
cardActions: linkActions,
|
|
83
88
|
cardState: linkState,
|
|
89
|
+
onActionClick: onActionClick,
|
|
84
90
|
onResolve: update,
|
|
85
91
|
renderers: renderers,
|
|
86
92
|
url: url
|
|
@@ -2,13 +2,14 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { getEmptyJsonLd, getUnauthorizedJsonLd } from '../../utils/jsonld';
|
|
4
4
|
import { extractInlineProps } from '../../extractors/inline';
|
|
5
|
-
import {
|
|
5
|
+
import { extractRequestAccessContext } from '../../extractors/common/context';
|
|
6
6
|
import { CardLinkView } from '../LinkView';
|
|
7
7
|
import { InlineCardErroredView } from './ErroredView';
|
|
8
8
|
import { InlineCardForbiddenView } from './ForbiddenView';
|
|
9
9
|
import { InlineCardResolvedView } from './ResolvedView';
|
|
10
10
|
import { InlineCardResolvingView } from './ResolvingView';
|
|
11
11
|
import { InlineCardUnauthorizedView } from './UnauthorisedView';
|
|
12
|
+
import { extractProvider } from '@atlaskit/linking-common/extractors';
|
|
12
13
|
export { InlineCardResolvedView, InlineCardResolvingView, InlineCardErroredView, InlineCardForbiddenView, InlineCardUnauthorizedView };
|
|
13
14
|
export const InlineCard = ({
|
|
14
15
|
id,
|
|
@@ -4,18 +4,13 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
4
4
|
|
|
5
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { extractTitleTextColor, extractSummary } from '../common/primitives';
|
|
8
8
|
import { extractLozenge } from '../common/lozenge';
|
|
9
9
|
import { extractIcon } from '../common/icon';
|
|
10
|
-
import { extractProvider } from '../common/context/extractProvider';
|
|
11
10
|
import { extractCommentCount, extractProgrammingLanguage, extractSubscriberCount } from '../common/detail';
|
|
12
|
-
import { extractMembers } from '
|
|
13
|
-
import { extractPersonAssignedTo } from '../common/person/extractPersonAssignedTo';
|
|
14
|
-
import { extractPersonCreatedBy } from '../common/person/extractPersonCreatedBy';
|
|
15
|
-
import { extractPersonUpdatedBy } from '../common/person/extractPersonUpdatedBy';
|
|
11
|
+
import { extractLink, extractTitle, extractProvider, extractMembers, extractPersonAssignedTo, extractPersonCreatedBy, extractPersonUpdatedBy, extractImage } from '@atlaskit/linking-common/extractors';
|
|
16
12
|
import { extractByline } from '../common/byline/extractByline';
|
|
17
13
|
import { extractTitlePrefix } from '../common/title-prefix/extractTitlePrefix';
|
|
18
|
-
import { extractImage } from '../common/preview/extractImage';
|
|
19
14
|
import { extractActions } from '../common/actions/extractActions';
|
|
20
15
|
import { extractPreviewAction } from '../common/actions/extractPreviewAction';
|
|
21
16
|
import { extractIsTrusted } from '../common/meta/extractIsTrusted';
|
|
@@ -6,8 +6,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
6
6
|
|
|
7
7
|
import { uiRenderSuccessEvent, uiRenderFailedEvent } from '../../../utils/analytics';
|
|
8
8
|
import { extractDownloadUrl } from '../detail';
|
|
9
|
-
import { extractProvider } from '
|
|
10
|
-
import { extractPreview } from '../preview';
|
|
9
|
+
import { extractProvider, extractPreview } from '@atlaskit/linking-common/extractors';
|
|
11
10
|
import { PreviewAction } from '../../../view/BlockCard';
|
|
12
11
|
|
|
13
12
|
var getMetadataFromJsonLd = function getMetadataFromJsonLd(jsonLd, platform) {
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FormattedRelativeTime } from 'react-intl-next';
|
|
3
3
|
import { selectUnit } from '@formatjs/intl-utils';
|
|
4
|
-
import { extractPersonUpdatedBy } from '
|
|
5
|
-
import { extractPersonCreatedBy } from '../person/extractPersonCreatedBy';
|
|
6
|
-
import { extractDateCreated } from '../date/extractDateCreated';
|
|
7
|
-
import { extractDateUpdated } from '../date/extractDateUpdated';
|
|
4
|
+
import { extractDateCreated, extractDateUpdated, extractPersonCreatedBy, extractPersonUpdatedBy } from '@atlaskit/linking-common/extractors';
|
|
8
5
|
export var extractByline = function extractByline(jsonLd) {
|
|
9
6
|
var updatedAt = extractDateUpdated(jsonLd);
|
|
10
7
|
var createdAt = extractDateCreated(jsonLd);
|
|
@@ -6,13 +6,11 @@ import BranchIcon from '@atlaskit/icon-object/glyph/branch/16';
|
|
|
6
6
|
import RepoIcon from '@atlaskit/icon-object/glyph/code/16';
|
|
7
7
|
import TaskIcon from '@atlaskit/icon-object/glyph/task/16';
|
|
8
8
|
import { extractorPriorityMap } from './priority';
|
|
9
|
-
import { extractProvider } from '
|
|
10
|
-
import { extractTitle } from '../primitives/extractTitle';
|
|
9
|
+
import { extractProvider, extractUrlFromIconJsonLd, extractTitle } from '@atlaskit/linking-common/extractors';
|
|
11
10
|
import { extractFileFormat } from './extractFileFormat';
|
|
12
11
|
import { extractIconFromDocument } from './extractIconFromDocument';
|
|
13
12
|
import { extractIconFromTask } from './extractIconFromTask';
|
|
14
13
|
import { extractTaskType } from '../lozenge/extractTaskType';
|
|
15
|
-
import { extractUrlFromIconJsonLd } from '../utils';
|
|
16
14
|
export var extractIcon = function extractIcon(jsonLd) {
|
|
17
15
|
var priority = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'type';
|
|
18
16
|
var type = jsonLd['@type'];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { extractState } from './extractState';
|
|
2
2
|
import { extractTag } from './extractTag';
|
|
3
3
|
import { extractTaskStatus } from './extractTaskStatus';
|
|
4
|
-
import { extractType } from '
|
|
4
|
+
import { extractType } from '@atlaskit/linking-common/extractors';
|
|
5
5
|
import { extractTaskType } from './extractTaskType';
|
|
6
6
|
var DOC_TYPES = ['schema:BlogPosting', 'schema:TextDigitalDocument', 'schema:DigitalDocument', 'schema:PresentationDigitalDocument', 'schema:SpreadsheetDigitalDocument'];
|
|
7
7
|
export var extractLozenge = function extractLozenge(jsonLd) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { extractUrlFromIconJsonLd } from '
|
|
1
|
+
import { extractUrlFromIconJsonLd } from '@atlaskit/linking-common/extractors';
|
|
2
2
|
export var extractTaskType = function extractTaskType(jsonLd) {
|
|
3
3
|
// TODO: Remove once Jira migrate to the correct type.
|
|
4
4
|
var taskType = jsonLd['atlassian:taskType'] || jsonLd.taskType;
|
|
@@ -4,9 +4,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
4
4
|
|
|
5
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
6
|
|
|
7
|
-
import { extractLink, extractTitle } from '
|
|
8
|
-
import { extractProvider } from '../common/context';
|
|
9
|
-
import { extractPreview } from '@atlaskit/linking-common';
|
|
7
|
+
import { extractLink, extractTitle, extractProvider, extractPreview } from '@atlaskit/linking-common/extractors';
|
|
10
8
|
import { extractIsTrusted } from '../common/meta/extractIsTrusted';
|
|
11
9
|
|
|
12
10
|
var extractEmbedPreview = function extractEmbedPreview(jsonLd, platform) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { extractPersonFromJsonLd } from '
|
|
1
|
+
import { extractPersonFromJsonLd } from '@atlaskit/linking-common/extractors';
|
|
2
2
|
// Temporary Extractor until https://product-fabric.atlassian.net/browse/EDM-2652 is ready
|
|
3
3
|
export var extractPersonsUpdatedBy = function extractPersonsUpdatedBy(jsonLd) {
|
|
4
4
|
var updatedBy = jsonLd['atlassian:updatedBy'];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IconType } from '../../constants';
|
|
2
|
-
import { extractUrlFromIconJsonLd } from '
|
|
2
|
+
import { extractUrlFromIconJsonLd } from '@atlaskit/linking-common/extractors';
|
|
3
3
|
var priorityMapper = {
|
|
4
4
|
blocker: IconType.PriorityBlocker,
|
|
5
5
|
critical: IconType.PriorityCritical,
|
|
@@ -5,7 +5,7 @@ import extractJiraTaskIcon from './extract-jira-task-icon';
|
|
|
5
5
|
import extractProviderIcon from './extract-provider-icon';
|
|
6
6
|
import extractUrlIcon from './extract-url-icon';
|
|
7
7
|
import { extractTaskType } from '../../common/lozenge';
|
|
8
|
-
import { extractTitle } from '
|
|
8
|
+
import { extractTitle } from '@atlaskit/linking-common/extractors';
|
|
9
9
|
import { extractorPriorityMap as priorityMap } from '../../common/icon/priority';
|
|
10
10
|
import { IconType } from '../../../constants';
|
|
11
11
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CONFLUENCE_GENERATOR_ID, JIRA_GENERATOR_ID } from '../../constants';
|
|
2
2
|
import { IconType } from '../../../constants';
|
|
3
3
|
import extractUrlIcon from './extract-url-icon';
|
|
4
|
-
import { extractTitle } from '
|
|
4
|
+
import { extractTitle } from '@atlaskit/linking-common/extractors';
|
|
5
5
|
|
|
6
6
|
var extractProviderIcon = function extractProviderIcon(data) {
|
|
7
7
|
if (!data) {
|