@atlaskit/smart-card 43.2.1 → 43.3.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 +11 -0
- package/compass.yml +3 -3
- package/dist/cjs/extractors/flexible/icon/extract-document-type-icon.js +8 -0
- package/dist/cjs/extractors/flexible/icon/extract-file-formatIcon.js +2 -0
- package/dist/cjs/extractors/flexible/icon/extract-jsonld-data-icon.js +6 -0
- package/dist/cjs/extractors/flexible/index.js +1 -2
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/BlockCard/views/ResolvedView.js +1 -4
- package/dist/cjs/view/FlexibleCard/components/blocks/snippet-block/index.js +4 -10
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +1 -4
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/extractors/flexible/icon/extract-document-type-icon.js +8 -0
- package/dist/es2019/extractors/flexible/icon/extract-file-formatIcon.js +1 -0
- package/dist/es2019/extractors/flexible/icon/extract-jsonld-data-icon.js +6 -0
- package/dist/es2019/extractors/flexible/index.js +5 -7
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/BlockCard/views/ResolvedView.js +1 -4
- package/dist/es2019/view/FlexibleCard/components/blocks/snippet-block/index.js +4 -10
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +1 -4
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/extractors/flexible/icon/extract-document-type-icon.js +8 -0
- package/dist/esm/extractors/flexible/icon/extract-file-formatIcon.js +1 -0
- package/dist/esm/extractors/flexible/icon/extract-jsonld-data-icon.js +6 -0
- package/dist/esm/extractors/flexible/index.js +1 -2
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/BlockCard/views/ResolvedView.js +1 -4
- package/dist/esm/view/FlexibleCard/components/blocks/snippet-block/index.js +4 -10
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +1 -4
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/extractors/flexible/extract-placeholder-data.d.ts +2 -2
- package/dist/types-ts4.5/extractors/flexible/extract-placeholder-data.d.ts +2 -2
- package/package.json +3 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 43.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`5f5cd4138ca9d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5f5cd4138ca9d) -
|
|
8
|
+
Remove feature gate for snippet renderer option
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 43.2.1
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/compass.yml
CHANGED
|
@@ -7,7 +7,7 @@ description:
|
|
|
7
7
|
workspace, streamlining collaboration and reducing context switching.
|
|
8
8
|
configVersion: 1
|
|
9
9
|
typeId: CAPABILITY
|
|
10
|
-
ownerId: 'ari:cloud:identity::team/
|
|
10
|
+
ownerId: 'ari:cloud:identity::team/0e6dedf8-18d1-4531-b4b9-07648a425d47'
|
|
11
11
|
fields:
|
|
12
12
|
isMonorepoProject: false
|
|
13
13
|
tier: 3
|
|
@@ -18,7 +18,7 @@ links:
|
|
|
18
18
|
url: 'https://atlassian.enterprise.slack.com/archives/CFKGAQZRV'
|
|
19
19
|
- name: ''
|
|
20
20
|
type: ON_CALL
|
|
21
|
-
url: 'https://hello.jira.atlassian.cloud/jira/ops/teams/
|
|
21
|
+
url: 'https://hello.jira.atlassian.cloud/jira/ops/teams/0e6dedf8-18d1-4531-b4b9-07648a425d47/on-call'
|
|
22
22
|
- name: ''
|
|
23
23
|
type: PROJECT
|
|
24
24
|
url: 'https://hello.jira.atlassian.cloud/jira/software/projects/NAVX/boards/14605'
|
|
@@ -55,7 +55,7 @@ customFields:
|
|
|
55
55
|
value: null
|
|
56
56
|
- name: Owner or Team Name
|
|
57
57
|
type: single_select
|
|
58
|
-
value: 1e93a963-fa64-4c3a-aebb-cc835e418a0a
|
|
58
|
+
value: 1e93a963-fa64-4c3a-aebb-cc835e418a0a # This means Yes
|
|
59
59
|
- name: Perimeter
|
|
60
60
|
type: single_select
|
|
61
61
|
value: null
|
|
@@ -24,43 +24,51 @@ var _constants = require("../../../constants");
|
|
|
24
24
|
var extractDocumentTypeIcon = function extractDocumentTypeIcon(documentType, label, providerId) {
|
|
25
25
|
switch (documentType) {
|
|
26
26
|
case 'schema:BlogPosting':
|
|
27
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
27
28
|
return {
|
|
28
29
|
icon: _constants.IconType.Blog,
|
|
29
30
|
label: label || 'Blog'
|
|
30
31
|
};
|
|
31
32
|
case 'schema:DigitalDocument':
|
|
32
33
|
if (providerId && (0, _linkExtractors.isConfluenceGenerator)(providerId)) {
|
|
34
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
33
35
|
return {
|
|
34
36
|
icon: _constants.IconType.LiveDocument,
|
|
35
37
|
label: label || 'Live Document'
|
|
36
38
|
};
|
|
37
39
|
} else {
|
|
40
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
38
41
|
return {
|
|
39
42
|
icon: _constants.IconType.File,
|
|
40
43
|
label: label || 'File'
|
|
41
44
|
};
|
|
42
45
|
}
|
|
43
46
|
case 'schema:TextDigitalDocument':
|
|
47
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
44
48
|
return {
|
|
45
49
|
icon: _constants.IconType.Document,
|
|
46
50
|
label: label || 'Document'
|
|
47
51
|
};
|
|
48
52
|
case 'schema:PresentationDigitalDocument':
|
|
53
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
49
54
|
return {
|
|
50
55
|
icon: _constants.IconType.Presentation,
|
|
51
56
|
label: label || 'Presentation'
|
|
52
57
|
};
|
|
53
58
|
case 'schema:SpreadsheetDigitalDocument':
|
|
59
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
54
60
|
return {
|
|
55
61
|
icon: _constants.IconType.Spreadsheet,
|
|
56
62
|
label: label || 'Spreadsheet'
|
|
57
63
|
};
|
|
58
64
|
case 'atlassian:Template':
|
|
65
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
59
66
|
return {
|
|
60
67
|
icon: _constants.IconType.Template,
|
|
61
68
|
label: label || 'Template'
|
|
62
69
|
};
|
|
63
70
|
case 'atlassian:UndefinedLink':
|
|
71
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
64
72
|
return {
|
|
65
73
|
icon: _constants.IconType.Document,
|
|
66
74
|
label: label || 'Undefined link'
|
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _constants = require("../../../constants");
|
|
8
|
+
/* eslint-disable @atlassian/i18n/no-literal-string-in-object */
|
|
9
|
+
|
|
8
10
|
var extractFileFormatIcon = function extractFileFormatIcon(fileFormat) {
|
|
9
11
|
switch (fileFormat) {
|
|
10
12
|
// Generic documents
|
|
@@ -69,31 +69,37 @@ function typeToIconDescriptor(_ref3) {
|
|
|
69
69
|
data = _ref3.data;
|
|
70
70
|
switch (type) {
|
|
71
71
|
case 'atlassian:Goal':
|
|
72
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
72
73
|
return {
|
|
73
74
|
icon: _constants.IconType.Task,
|
|
74
75
|
label: label || 'Goal'
|
|
75
76
|
};
|
|
76
77
|
case 'atlassian:Project':
|
|
78
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
77
79
|
return {
|
|
78
80
|
icon: _constants.IconType.Project,
|
|
79
81
|
label: label || 'Project'
|
|
80
82
|
};
|
|
81
83
|
case 'atlassian:SourceCodeCommit':
|
|
84
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
82
85
|
return {
|
|
83
86
|
icon: _constants.IconType.Commit,
|
|
84
87
|
label: label || 'Commit'
|
|
85
88
|
};
|
|
86
89
|
case 'atlassian:SourceCodePullRequest':
|
|
90
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
87
91
|
return {
|
|
88
92
|
icon: _constants.IconType.PullRequest,
|
|
89
93
|
label: label || 'Pull request'
|
|
90
94
|
};
|
|
91
95
|
case 'atlassian:SourceCodeReference':
|
|
96
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
92
97
|
return {
|
|
93
98
|
icon: _constants.IconType.Branch,
|
|
94
99
|
label: label || 'Reference'
|
|
95
100
|
};
|
|
96
101
|
case 'atlassian:SourceCodeRepository':
|
|
102
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
97
103
|
return {
|
|
98
104
|
icon: _constants.IconType.Repo,
|
|
99
105
|
label: label || 'Repository'
|
|
@@ -102,8 +102,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
|
|
|
102
102
|
}), {}, {
|
|
103
103
|
url: url,
|
|
104
104
|
ari: (0, _linkExtractors.extractSmartLinkAri)(response),
|
|
105
|
-
type: (0, _linkExtractors.extractType)(data)
|
|
106
|
-
}, (0, _platformFeatureFlags.fg)('cc-ai-linking-platform-snippet-renderer') && {
|
|
105
|
+
type: (0, _linkExtractors.extractType)(data),
|
|
107
106
|
meta: {
|
|
108
107
|
objectId: (0, _utils.extractMetaObjectId)(meta),
|
|
109
108
|
resourceType: (0, _utils.extractMetaResourceType)(meta),
|
|
@@ -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: "
|
|
14
|
+
packageVersion: "0.0.0-development"
|
|
15
15
|
};
|
|
16
16
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
17
17
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -14,7 +14,6 @@ var _runtime = require("@compiled/react/runtime");
|
|
|
14
14
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
15
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
16
16
|
var _userAgent = require("@atlaskit/linking-common/user-agent");
|
|
17
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
17
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
19
18
|
var _constants = require("../../../constants");
|
|
20
19
|
var _FlexibleCard = _interopRequireDefault(require("../../FlexibleCard"));
|
|
@@ -73,9 +72,7 @@ var ResolvedView = function ResolvedView(_ref) {
|
|
|
73
72
|
}];
|
|
74
73
|
}, []);
|
|
75
74
|
var uiOptions = _utils.FlexibleCardUiOptions;
|
|
76
|
-
|
|
77
|
-
uiOptions.enableSnippetRenderer = true;
|
|
78
|
-
}
|
|
75
|
+
uiOptions.enableSnippetRenderer = true;
|
|
79
76
|
if ((0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true)) {
|
|
80
77
|
uiOptions.hideLoadingSkeleton = hideIconLoadingSkeleton;
|
|
81
78
|
}
|
|
@@ -8,7 +8,6 @@ exports.default = void 0;
|
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
11
|
var _constants = require("../../../../../constants");
|
|
13
12
|
var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
|
|
14
13
|
var _renderers = require("../../../../../state/renderers");
|
|
@@ -38,14 +37,9 @@ var SnippetBlock = function SnippetBlock(_ref) {
|
|
|
38
37
|
_ref$showFooter = _ref.showFooter,
|
|
39
38
|
showFooter = _ref$showFooter === void 0 ? true : _ref$showFooter,
|
|
40
39
|
blockProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
41
|
-
var context = (0,
|
|
42
|
-
|
|
43
|
-
(0, _flexibleUiContext.
|
|
44
|
-
var renderers = (0, _platformFeatureFlags.fg)('cc-ai-linking-platform-snippet-renderer') ?
|
|
45
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
46
|
-
(0, _renderers.useSmartLinkRenderers)() : undefined;
|
|
47
|
-
var enableSnippetRenderer = (0, _platformFeatureFlags.fg)('cc-ai-linking-platform-snippet-renderer') ? // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
48
|
-
(_useFlexibleUiOptionC = (0, _flexibleUiContext.useFlexibleUiOptionContext)()) === null || _useFlexibleUiOptionC === void 0 ? void 0 : _useFlexibleUiOptionC.enableSnippetRenderer : undefined;
|
|
40
|
+
var context = (0, _flexibleUiContext.useFlexibleUiContext)();
|
|
41
|
+
var renderers = (0, _renderers.useSmartLinkRenderers)();
|
|
42
|
+
var enableSnippetRenderer = (_useFlexibleUiOptionC = (0, _flexibleUiContext.useFlexibleUiOptionContext)()) === null || _useFlexibleUiOptionC === void 0 ? void 0 : _useFlexibleUiOptionC.enableSnippetRenderer;
|
|
49
43
|
var cardContext = (0, _flexibleUiContext.useFlexibleCardContext)();
|
|
50
44
|
if ((cardContext === null || cardContext === void 0 ? void 0 : cardContext.status) !== _constants.SmartLinkStatus.Resolved && !text) {
|
|
51
45
|
return null;
|
|
@@ -56,7 +50,7 @@ var SnippetBlock = function SnippetBlock(_ref) {
|
|
|
56
50
|
maxLines: snippetMaxLines,
|
|
57
51
|
content: text
|
|
58
52
|
});
|
|
59
|
-
if (!
|
|
53
|
+
if (!enableSnippetRenderer) {
|
|
60
54
|
var _blockProps$size, _cardContext$ui;
|
|
61
55
|
return /*#__PURE__*/_react.default.createElement(_block.default, (0, _extends2.default)({}, blockProps, {
|
|
62
56
|
size: (_blockProps$size = blockProps.size) !== null && _blockProps$size !== void 0 ? _blockProps$size : cardContext === null || cardContext === void 0 || (_cardContext$ui = cardContext.ui) === null || _cardContext$ui === void 0 ? void 0 : _cardContext$ui.size,
|
|
@@ -9,7 +9,6 @@ exports.hoverCardClassName = exports.default = void 0;
|
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
11
11
|
var _linkProvider = require("@atlaskit/link-provider");
|
|
12
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
12
|
var _useAnalyticsEvents2 = require("../../../common/analytics/generated/use-analytics-events");
|
|
14
13
|
var _constants = require("../../../constants");
|
|
15
14
|
var _helpers = require("../../../state/helpers");
|
|
@@ -115,9 +114,7 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
115
114
|
subtitle: subtitle
|
|
116
115
|
};
|
|
117
116
|
var uiOptions = _styled.flexibleUiOptions;
|
|
118
|
-
|
|
119
|
-
uiOptions.enableSnippetRenderer = true;
|
|
120
|
-
}
|
|
117
|
+
uiOptions.enableSnippetRenderer = true;
|
|
121
118
|
var flexibleCardProps = {
|
|
122
119
|
appearance: _constants.CardDisplay.HoverCardPreview,
|
|
123
120
|
cardState: cardState,
|
|
@@ -22,7 +22,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
|
|
|
22
22
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
23
23
|
var PACKAGE_DATA = {
|
|
24
24
|
packageName: "@atlaskit/smart-card",
|
|
25
|
-
packageVersion: "
|
|
25
|
+
packageVersion: "0.0.0-development",
|
|
26
26
|
componentName: 'linkUrl'
|
|
27
27
|
};
|
|
28
28
|
var Anchor = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -18,43 +18,51 @@ import { IconType } from '../../../constants';
|
|
|
18
18
|
const extractDocumentTypeIcon = (documentType, label, providerId) => {
|
|
19
19
|
switch (documentType) {
|
|
20
20
|
case 'schema:BlogPosting':
|
|
21
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
21
22
|
return {
|
|
22
23
|
icon: IconType.Blog,
|
|
23
24
|
label: label || 'Blog'
|
|
24
25
|
};
|
|
25
26
|
case 'schema:DigitalDocument':
|
|
26
27
|
if (providerId && isConfluenceGenerator(providerId)) {
|
|
28
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
27
29
|
return {
|
|
28
30
|
icon: IconType.LiveDocument,
|
|
29
31
|
label: label || 'Live Document'
|
|
30
32
|
};
|
|
31
33
|
} else {
|
|
34
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
32
35
|
return {
|
|
33
36
|
icon: IconType.File,
|
|
34
37
|
label: label || 'File'
|
|
35
38
|
};
|
|
36
39
|
}
|
|
37
40
|
case 'schema:TextDigitalDocument':
|
|
41
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
38
42
|
return {
|
|
39
43
|
icon: IconType.Document,
|
|
40
44
|
label: label || 'Document'
|
|
41
45
|
};
|
|
42
46
|
case 'schema:PresentationDigitalDocument':
|
|
47
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
43
48
|
return {
|
|
44
49
|
icon: IconType.Presentation,
|
|
45
50
|
label: label || 'Presentation'
|
|
46
51
|
};
|
|
47
52
|
case 'schema:SpreadsheetDigitalDocument':
|
|
53
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
48
54
|
return {
|
|
49
55
|
icon: IconType.Spreadsheet,
|
|
50
56
|
label: label || 'Spreadsheet'
|
|
51
57
|
};
|
|
52
58
|
case 'atlassian:Template':
|
|
59
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
53
60
|
return {
|
|
54
61
|
icon: IconType.Template,
|
|
55
62
|
label: label || 'Template'
|
|
56
63
|
};
|
|
57
64
|
case 'atlassian:UndefinedLink':
|
|
65
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
58
66
|
return {
|
|
59
67
|
icon: IconType.Document,
|
|
60
68
|
label: label || 'Undefined link'
|
|
@@ -61,31 +61,37 @@ function typeToIconDescriptor({
|
|
|
61
61
|
}) {
|
|
62
62
|
switch (type) {
|
|
63
63
|
case 'atlassian:Goal':
|
|
64
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
64
65
|
return {
|
|
65
66
|
icon: IconType.Task,
|
|
66
67
|
label: label || 'Goal'
|
|
67
68
|
};
|
|
68
69
|
case 'atlassian:Project':
|
|
70
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
69
71
|
return {
|
|
70
72
|
icon: IconType.Project,
|
|
71
73
|
label: label || 'Project'
|
|
72
74
|
};
|
|
73
75
|
case 'atlassian:SourceCodeCommit':
|
|
76
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
74
77
|
return {
|
|
75
78
|
icon: IconType.Commit,
|
|
76
79
|
label: label || 'Commit'
|
|
77
80
|
};
|
|
78
81
|
case 'atlassian:SourceCodePullRequest':
|
|
82
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
79
83
|
return {
|
|
80
84
|
icon: IconType.PullRequest,
|
|
81
85
|
label: label || 'Pull request'
|
|
82
86
|
};
|
|
83
87
|
case 'atlassian:SourceCodeReference':
|
|
88
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
84
89
|
return {
|
|
85
90
|
icon: IconType.Branch,
|
|
86
91
|
label: label || 'Reference'
|
|
87
92
|
};
|
|
88
93
|
case 'atlassian:SourceCodeRepository':
|
|
94
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
89
95
|
return {
|
|
90
96
|
icon: IconType.Repo,
|
|
91
97
|
label: label || 'Repository'
|
|
@@ -92,13 +92,11 @@ const extractFlexibleUiContext = ({
|
|
|
92
92
|
url,
|
|
93
93
|
ari: extractSmartLinkAri(response),
|
|
94
94
|
type: extractType(data),
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
})
|
|
95
|
+
meta: {
|
|
96
|
+
objectId: extractMetaObjectId(meta),
|
|
97
|
+
resourceType: extractMetaResourceType(meta),
|
|
98
|
+
tenantId: extractMetaTenantId(meta)
|
|
99
|
+
}
|
|
102
100
|
};
|
|
103
101
|
};
|
|
104
102
|
export default extractFlexibleUiContext;
|
|
@@ -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: "
|
|
5
|
+
packageVersion: "0.0.0-development"
|
|
6
6
|
};
|
|
7
7
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
8
8
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -5,7 +5,6 @@ import * as React from 'react';
|
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
6
|
import { useEffect, useMemo, useState } from 'react';
|
|
7
7
|
import { browser } from '@atlaskit/linking-common/user-agent';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
9
|
import { ActionName, ElementName, SmartLinkPosition } from '../../../constants';
|
|
11
10
|
import FlexibleCard from '../../FlexibleCard';
|
|
@@ -57,9 +56,7 @@ const ResolvedView = ({
|
|
|
57
56
|
hideIcon: true
|
|
58
57
|
}], []);
|
|
59
58
|
const uiOptions = FlexibleCardUiOptions;
|
|
60
|
-
|
|
61
|
-
uiOptions.enableSnippetRenderer = true;
|
|
62
|
-
}
|
|
59
|
+
uiOptions.enableSnippetRenderer = true;
|
|
63
60
|
if (expValEquals('platform_editor_smart_card_otp', 'isEnabled', true)) {
|
|
64
61
|
uiOptions.hideLoadingSkeleton = hideIconLoadingSkeleton;
|
|
65
62
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { SmartLinkStatus } from '../../../../../constants';
|
|
5
4
|
import { useFlexibleCardContext, useFlexibleUiContext, useFlexibleUiOptionContext } from '../../../../../state/flexible-ui-context';
|
|
6
5
|
import { useSmartLinkRenderers } from '../../../../../state/renderers';
|
|
@@ -26,14 +25,9 @@ const SnippetBlock = ({
|
|
|
26
25
|
...blockProps
|
|
27
26
|
}) => {
|
|
28
27
|
var _useFlexibleUiOptionC, _blockProps$size2, _cardContext$ui2, _ref, _context$meta$objectI, _context$meta, _context$meta$resourc, _context$meta2, _context$meta$tenantI, _context$meta3;
|
|
29
|
-
const context =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const renderers = fg('cc-ai-linking-platform-snippet-renderer') ?
|
|
33
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
34
|
-
useSmartLinkRenderers() : undefined;
|
|
35
|
-
const enableSnippetRenderer = fg('cc-ai-linking-platform-snippet-renderer') ? // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
36
|
-
(_useFlexibleUiOptionC = useFlexibleUiOptionContext()) === null || _useFlexibleUiOptionC === void 0 ? void 0 : _useFlexibleUiOptionC.enableSnippetRenderer : undefined;
|
|
28
|
+
const context = useFlexibleUiContext();
|
|
29
|
+
const renderers = useSmartLinkRenderers();
|
|
30
|
+
const enableSnippetRenderer = (_useFlexibleUiOptionC = useFlexibleUiOptionContext()) === null || _useFlexibleUiOptionC === void 0 ? void 0 : _useFlexibleUiOptionC.enableSnippetRenderer;
|
|
37
31
|
const cardContext = useFlexibleCardContext();
|
|
38
32
|
if ((cardContext === null || cardContext === void 0 ? void 0 : cardContext.status) !== SmartLinkStatus.Resolved && !text) {
|
|
39
33
|
return null;
|
|
@@ -44,7 +38,7 @@ const SnippetBlock = ({
|
|
|
44
38
|
maxLines: snippetMaxLines,
|
|
45
39
|
content: text
|
|
46
40
|
});
|
|
47
|
-
if (!
|
|
41
|
+
if (!enableSnippetRenderer) {
|
|
48
42
|
var _blockProps$size, _cardContext$ui;
|
|
49
43
|
return /*#__PURE__*/React.createElement(Block, _extends({}, blockProps, {
|
|
50
44
|
size: (_blockProps$size = blockProps.size) !== null && _blockProps$size !== void 0 ? _blockProps$size : cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$ui = cardContext.ui) === null || _cardContext$ui === void 0 ? void 0 : _cardContext$ui.size,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
2
2
|
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/analytics-next';
|
|
3
3
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
|
|
6
5
|
import { CardDisplay, SmartLinkPosition, SmartLinkSize } from '../../../constants';
|
|
7
6
|
import { getDefinitionId, getExtensionKey, getServices } from '../../../state/helpers';
|
|
@@ -106,9 +105,7 @@ const HoverCardContent = ({
|
|
|
106
105
|
subtitle: subtitle
|
|
107
106
|
};
|
|
108
107
|
const uiOptions = flexibleUiOptions;
|
|
109
|
-
|
|
110
|
-
uiOptions.enableSnippetRenderer = true;
|
|
111
|
-
}
|
|
108
|
+
uiOptions.enableSnippetRenderer = true;
|
|
112
109
|
const flexibleCardProps = {
|
|
113
110
|
appearance: CardDisplay.HoverCardPreview,
|
|
114
111
|
cardState: cardState,
|
|
@@ -12,7 +12,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
12
12
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
13
13
|
const PACKAGE_DATA = {
|
|
14
14
|
packageName: "@atlaskit/smart-card",
|
|
15
|
-
packageVersion: "
|
|
15
|
+
packageVersion: "0.0.0-development",
|
|
16
16
|
componentName: 'linkUrl'
|
|
17
17
|
};
|
|
18
18
|
const Anchor = withLinkClickedEvent('a');
|
|
@@ -18,43 +18,51 @@ import { IconType } from '../../../constants';
|
|
|
18
18
|
var extractDocumentTypeIcon = function extractDocumentTypeIcon(documentType, label, providerId) {
|
|
19
19
|
switch (documentType) {
|
|
20
20
|
case 'schema:BlogPosting':
|
|
21
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
21
22
|
return {
|
|
22
23
|
icon: IconType.Blog,
|
|
23
24
|
label: label || 'Blog'
|
|
24
25
|
};
|
|
25
26
|
case 'schema:DigitalDocument':
|
|
26
27
|
if (providerId && isConfluenceGenerator(providerId)) {
|
|
28
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
27
29
|
return {
|
|
28
30
|
icon: IconType.LiveDocument,
|
|
29
31
|
label: label || 'Live Document'
|
|
30
32
|
};
|
|
31
33
|
} else {
|
|
34
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
32
35
|
return {
|
|
33
36
|
icon: IconType.File,
|
|
34
37
|
label: label || 'File'
|
|
35
38
|
};
|
|
36
39
|
}
|
|
37
40
|
case 'schema:TextDigitalDocument':
|
|
41
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
38
42
|
return {
|
|
39
43
|
icon: IconType.Document,
|
|
40
44
|
label: label || 'Document'
|
|
41
45
|
};
|
|
42
46
|
case 'schema:PresentationDigitalDocument':
|
|
47
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
43
48
|
return {
|
|
44
49
|
icon: IconType.Presentation,
|
|
45
50
|
label: label || 'Presentation'
|
|
46
51
|
};
|
|
47
52
|
case 'schema:SpreadsheetDigitalDocument':
|
|
53
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
48
54
|
return {
|
|
49
55
|
icon: IconType.Spreadsheet,
|
|
50
56
|
label: label || 'Spreadsheet'
|
|
51
57
|
};
|
|
52
58
|
case 'atlassian:Template':
|
|
59
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
53
60
|
return {
|
|
54
61
|
icon: IconType.Template,
|
|
55
62
|
label: label || 'Template'
|
|
56
63
|
};
|
|
57
64
|
case 'atlassian:UndefinedLink':
|
|
65
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
58
66
|
return {
|
|
59
67
|
icon: IconType.Document,
|
|
60
68
|
label: label || 'Undefined link'
|
|
@@ -62,31 +62,37 @@ function typeToIconDescriptor(_ref3) {
|
|
|
62
62
|
data = _ref3.data;
|
|
63
63
|
switch (type) {
|
|
64
64
|
case 'atlassian:Goal':
|
|
65
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
65
66
|
return {
|
|
66
67
|
icon: IconType.Task,
|
|
67
68
|
label: label || 'Goal'
|
|
68
69
|
};
|
|
69
70
|
case 'atlassian:Project':
|
|
71
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
70
72
|
return {
|
|
71
73
|
icon: IconType.Project,
|
|
72
74
|
label: label || 'Project'
|
|
73
75
|
};
|
|
74
76
|
case 'atlassian:SourceCodeCommit':
|
|
77
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
75
78
|
return {
|
|
76
79
|
icon: IconType.Commit,
|
|
77
80
|
label: label || 'Commit'
|
|
78
81
|
};
|
|
79
82
|
case 'atlassian:SourceCodePullRequest':
|
|
83
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
80
84
|
return {
|
|
81
85
|
icon: IconType.PullRequest,
|
|
82
86
|
label: label || 'Pull request'
|
|
83
87
|
};
|
|
84
88
|
case 'atlassian:SourceCodeReference':
|
|
89
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
85
90
|
return {
|
|
86
91
|
icon: IconType.Branch,
|
|
87
92
|
label: label || 'Reference'
|
|
88
93
|
};
|
|
89
94
|
case 'atlassian:SourceCodeRepository':
|
|
95
|
+
// eslint-disable-next-line @atlassian/i18n/no-literal-string-in-object
|
|
90
96
|
return {
|
|
91
97
|
icon: IconType.Repo,
|
|
92
98
|
label: label || 'Repository'
|
|
@@ -95,8 +95,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
|
|
|
95
95
|
}), {}, {
|
|
96
96
|
url: url,
|
|
97
97
|
ari: extractSmartLinkAri(response),
|
|
98
|
-
type: extractType(data)
|
|
99
|
-
}, fg('cc-ai-linking-platform-snippet-renderer') && {
|
|
98
|
+
type: extractType(data),
|
|
100
99
|
meta: {
|
|
101
100
|
objectId: extractMetaObjectId(meta),
|
|
102
101
|
resourceType: extractMetaResourceType(meta),
|
|
@@ -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: "
|
|
7
|
+
packageVersion: "0.0.0-development"
|
|
8
8
|
};
|
|
9
9
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -6,7 +6,6 @@ import * as React from 'react';
|
|
|
6
6
|
import { ax, ix } from "@compiled/react/runtime";
|
|
7
7
|
import { useEffect, useMemo, useState } from 'react';
|
|
8
8
|
import { browser } from '@atlaskit/linking-common/user-agent';
|
|
9
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
9
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
10
|
import { ActionName, ElementName, SmartLinkPosition } from '../../../constants';
|
|
12
11
|
import FlexibleCard from '../../FlexibleCard';
|
|
@@ -64,9 +63,7 @@ var ResolvedView = function ResolvedView(_ref) {
|
|
|
64
63
|
}];
|
|
65
64
|
}, []);
|
|
66
65
|
var uiOptions = FlexibleCardUiOptions;
|
|
67
|
-
|
|
68
|
-
uiOptions.enableSnippetRenderer = true;
|
|
69
|
-
}
|
|
66
|
+
uiOptions.enableSnippetRenderer = true;
|
|
70
67
|
if (expValEquals('platform_editor_smart_card_otp', 'isEnabled', true)) {
|
|
71
68
|
uiOptions.hideLoadingSkeleton = hideIconLoadingSkeleton;
|
|
72
69
|
}
|
|
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["maxLines", "testId", "text", "isHidden", "showFooter"];
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { SmartLinkStatus } from '../../../../../constants';
|
|
7
6
|
import { useFlexibleCardContext, useFlexibleUiContext, useFlexibleUiOptionContext } from '../../../../../state/flexible-ui-context';
|
|
8
7
|
import { useSmartLinkRenderers } from '../../../../../state/renderers';
|
|
@@ -31,14 +30,9 @@ var SnippetBlock = function SnippetBlock(_ref) {
|
|
|
31
30
|
_ref$showFooter = _ref.showFooter,
|
|
32
31
|
showFooter = _ref$showFooter === void 0 ? true : _ref$showFooter,
|
|
33
32
|
blockProps = _objectWithoutProperties(_ref, _excluded);
|
|
34
|
-
var context =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
var renderers = fg('cc-ai-linking-platform-snippet-renderer') ?
|
|
38
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
39
|
-
useSmartLinkRenderers() : undefined;
|
|
40
|
-
var enableSnippetRenderer = fg('cc-ai-linking-platform-snippet-renderer') ? // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
41
|
-
(_useFlexibleUiOptionC = useFlexibleUiOptionContext()) === null || _useFlexibleUiOptionC === void 0 ? void 0 : _useFlexibleUiOptionC.enableSnippetRenderer : undefined;
|
|
33
|
+
var context = useFlexibleUiContext();
|
|
34
|
+
var renderers = useSmartLinkRenderers();
|
|
35
|
+
var enableSnippetRenderer = (_useFlexibleUiOptionC = useFlexibleUiOptionContext()) === null || _useFlexibleUiOptionC === void 0 ? void 0 : _useFlexibleUiOptionC.enableSnippetRenderer;
|
|
42
36
|
var cardContext = useFlexibleCardContext();
|
|
43
37
|
if ((cardContext === null || cardContext === void 0 ? void 0 : cardContext.status) !== SmartLinkStatus.Resolved && !text) {
|
|
44
38
|
return null;
|
|
@@ -49,7 +43,7 @@ var SnippetBlock = function SnippetBlock(_ref) {
|
|
|
49
43
|
maxLines: snippetMaxLines,
|
|
50
44
|
content: text
|
|
51
45
|
});
|
|
52
|
-
if (!
|
|
46
|
+
if (!enableSnippetRenderer) {
|
|
53
47
|
var _blockProps$size, _cardContext$ui;
|
|
54
48
|
return /*#__PURE__*/React.createElement(Block, _extends({}, blockProps, {
|
|
55
49
|
size: (_blockProps$size = blockProps.size) !== null && _blockProps$size !== void 0 ? _blockProps$size : cardContext === null || cardContext === void 0 || (_cardContext$ui = cardContext.ui) === null || _cardContext$ui === void 0 ? void 0 : _cardContext$ui.size,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
2
2
|
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/analytics-next';
|
|
3
3
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
|
|
6
5
|
import { CardDisplay, SmartLinkPosition, SmartLinkSize } from '../../../constants';
|
|
7
6
|
import { getDefinitionId, getExtensionKey, getServices } from '../../../state/helpers';
|
|
@@ -106,9 +105,7 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
106
105
|
subtitle: subtitle
|
|
107
106
|
};
|
|
108
107
|
var uiOptions = flexibleUiOptions;
|
|
109
|
-
|
|
110
|
-
uiOptions.enableSnippetRenderer = true;
|
|
111
|
-
}
|
|
108
|
+
uiOptions.enableSnippetRenderer = true;
|
|
112
109
|
var flexibleCardProps = {
|
|
113
110
|
appearance: CardDisplay.HoverCardPreview,
|
|
114
111
|
cardState: cardState,
|
|
@@ -15,7 +15,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
15
15
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
16
16
|
var PACKAGE_DATA = {
|
|
17
17
|
packageName: "@atlaskit/smart-card",
|
|
18
|
-
packageVersion: "
|
|
18
|
+
packageVersion: "0.0.0-development",
|
|
19
19
|
componentName: 'linkUrl'
|
|
20
20
|
};
|
|
21
21
|
var Anchor = withLinkClickedEvent('a');
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { CardState } from
|
|
2
|
-
import type { SmartLinkResponse } from
|
|
1
|
+
import type { CardState } from '@atlaskit/linking-common';
|
|
2
|
+
import type { SmartLinkResponse } from '@atlaskit/linking-types';
|
|
3
3
|
export declare const extractPlaceHolderCardState: (placeholderData: SmartLinkResponse) => CardState | undefined;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { CardState } from
|
|
2
|
-
import type { SmartLinkResponse } from
|
|
1
|
+
import type { CardState } from '@atlaskit/linking-common';
|
|
2
|
+
import type { SmartLinkResponse } from '@atlaskit/linking-types';
|
|
3
3
|
export declare const extractPlaceHolderCardState: (placeholderData: SmartLinkResponse) => CardState | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "43.
|
|
3
|
+
"version": "43.3.0",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@atlaskit/textarea": "^8.0.0",
|
|
71
71
|
"@atlaskit/textfield": "^8.0.0",
|
|
72
72
|
"@atlaskit/theme": "^21.0.0",
|
|
73
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
73
|
+
"@atlaskit/tmp-editor-statsig": "^13.18.0",
|
|
74
74
|
"@atlaskit/tokens": "^7.0.0",
|
|
75
75
|
"@atlaskit/tooltip": "^20.6.0",
|
|
76
76
|
"@atlaskit/ufo": "^0.4.0",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"@atlaskit/react-ufo": "^4.12.0",
|
|
104
104
|
"@atlaskit/ssr": "workspace:^",
|
|
105
105
|
"@atlassian/analytics-tooling": "^0.5.0",
|
|
106
|
-
"@atlassian/feature-flags-test-utils": "^0.
|
|
106
|
+
"@atlassian/feature-flags-test-utils": "^1.0.0",
|
|
107
107
|
"@atlassian/gemini": "^1.20.0",
|
|
108
108
|
"@testing-library/dom": "^10.1.0",
|
|
109
109
|
"@testing-library/jest-dom": "^6.4.5",
|
|
@@ -184,9 +184,6 @@
|
|
|
184
184
|
"dst-a11y__replace-anchor-with-link__linking-platfo": {
|
|
185
185
|
"type": "boolean"
|
|
186
186
|
},
|
|
187
|
-
"cc-ai-linking-platform-snippet-renderer": {
|
|
188
|
-
"type": "boolean"
|
|
189
|
-
},
|
|
190
187
|
"platform_editor_content_mode_button_mvp": {
|
|
191
188
|
"type": "boolean"
|
|
192
189
|
},
|