@atlaskit/smart-card 23.13.0 → 23.13.2
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 +12 -0
- package/dist/cjs/extractors/common/icon/extractIcon.js +12 -6
- package/dist/cjs/extractors/common/icon/extractIconFromDocument.js +14 -7
- package/dist/cjs/extractors/common/icon/extractIconFromTask.js +25 -15
- package/dist/cjs/messages.js +1 -1
- package/dist/cjs/utils/index.js +2 -1
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/EmbedCard/components/ExpandedFrame.js +3 -1
- package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +2 -1
- package/dist/cjs/view/InlineCard/ErroredView/index.js +4 -2
- package/dist/cjs/view/InlineCard/ForbiddenView/index.js +6 -3
- package/dist/cjs/view/InlineCard/IconAndTitleLayout/index.js +2 -1
- package/dist/cjs/view/InlineCard/ResolvedView/index.js +1 -0
- package/dist/cjs/view/LinkUrl/LinkWarningModal/hooks/use-link-warning-modal.js +17 -0
- package/dist/cjs/view/LinkUrl/index.js +11 -1
- package/dist/es2019/extractors/common/icon/extractIcon.js +12 -6
- package/dist/es2019/extractors/common/icon/extractIconFromDocument.js +14 -7
- package/dist/es2019/extractors/common/icon/extractIconFromTask.js +24 -15
- package/dist/es2019/messages.js +1 -1
- package/dist/es2019/utils/index.js +2 -1
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/EmbedCard/components/ExpandedFrame.js +3 -1
- package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +2 -1
- package/dist/es2019/view/InlineCard/ErroredView/index.js +4 -2
- package/dist/es2019/view/InlineCard/ForbiddenView/index.js +6 -3
- package/dist/es2019/view/InlineCard/IconAndTitleLayout/index.js +2 -1
- package/dist/es2019/view/InlineCard/ResolvedView/index.js +1 -0
- package/dist/es2019/view/LinkUrl/LinkWarningModal/hooks/use-link-warning-modal.js +16 -0
- package/dist/es2019/view/LinkUrl/index.js +8 -1
- package/dist/esm/extractors/common/icon/extractIcon.js +12 -6
- package/dist/esm/extractors/common/icon/extractIconFromDocument.js +14 -7
- package/dist/esm/extractors/common/icon/extractIconFromTask.js +24 -15
- package/dist/esm/messages.js +1 -1
- package/dist/esm/utils/index.js +2 -1
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/EmbedCard/components/ExpandedFrame.js +3 -1
- package/dist/esm/view/HoverCard/components/HoverCardComponent.js +2 -1
- package/dist/esm/view/InlineCard/ErroredView/index.js +4 -2
- package/dist/esm/view/InlineCard/ForbiddenView/index.js +6 -3
- package/dist/esm/view/InlineCard/IconAndTitleLayout/index.js +2 -1
- package/dist/esm/view/InlineCard/ResolvedView/index.js +1 -0
- package/dist/esm/view/LinkUrl/LinkWarningModal/hooks/use-link-warning-modal.js +15 -0
- package/dist/esm/view/LinkUrl/index.js +8 -1
- package/dist/types/extractors/common/__mocks__/withIntl.d.ts +2 -0
- package/dist/types/view/LinkUrl/index.d.ts +4 -2
- package/dist/types/view/LinkUrl/types.d.ts +5 -0
- package/package.json +2 -4
- package/dist/types/extractors/common/__mocks__/render.d.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 23.13.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`465e0f001fb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/465e0f001fb) - Operational analytics event added to the LinkUrl component. It fires when Link Safety Warning message shown.
|
|
8
|
+
|
|
9
|
+
## 23.13.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`02d341ecf63`](https://bitbucket.org/atlassian/atlassian-frontend/commits/02d341ecf63) - [ux] Fix copy button tooltip to show Copy link, not Download
|
|
14
|
+
|
|
3
15
|
## 23.13.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -71,33 +71,39 @@ var extractIconByType = function extractIconByType(type, opts) {
|
|
|
71
71
|
|
|
72
72
|
case 'atlassian:Goal':
|
|
73
73
|
return opts.icon || /*#__PURE__*/_react.default.createElement(_5.default, {
|
|
74
|
-
label: opts.title || 'goal'
|
|
74
|
+
label: opts.title || 'goal',
|
|
75
|
+
testId: "task-icon"
|
|
75
76
|
});
|
|
76
77
|
|
|
77
78
|
case 'atlassian:Project':
|
|
78
79
|
return opts.icon || /*#__PURE__*/_react.default.createElement(_peopleGroup.default, {
|
|
79
80
|
label: opts.title || 'project',
|
|
80
|
-
size: "small"
|
|
81
|
+
size: "small",
|
|
82
|
+
testId: "project-icon"
|
|
81
83
|
});
|
|
82
84
|
|
|
83
85
|
case 'atlassian:SourceCodeCommit':
|
|
84
86
|
return /*#__PURE__*/_react.default.createElement(_.default, {
|
|
85
|
-
label: opts.title || 'commit'
|
|
87
|
+
label: opts.title || 'commit',
|
|
88
|
+
testId: "commit-icon"
|
|
86
89
|
});
|
|
87
90
|
|
|
88
91
|
case 'atlassian:SourceCodePullRequest':
|
|
89
92
|
return /*#__PURE__*/_react.default.createElement(_2.default, {
|
|
90
|
-
label: opts.title || 'pullRequest'
|
|
93
|
+
label: opts.title || 'pullRequest',
|
|
94
|
+
testId: "pull-request-icon"
|
|
91
95
|
});
|
|
92
96
|
|
|
93
97
|
case 'atlassian:SourceCodeReference':
|
|
94
98
|
return /*#__PURE__*/_react.default.createElement(_3.default, {
|
|
95
|
-
label: opts.title || 'reference'
|
|
99
|
+
label: opts.title || 'reference',
|
|
100
|
+
testId: "branch-icon"
|
|
96
101
|
});
|
|
97
102
|
|
|
98
103
|
case 'atlassian:SourceCodeRepository':
|
|
99
104
|
return /*#__PURE__*/_react.default.createElement(_4.default, {
|
|
100
|
-
label: opts.title || 'repository'
|
|
105
|
+
label: opts.title || 'repository',
|
|
106
|
+
testId: "repo-icon"
|
|
101
107
|
});
|
|
102
108
|
|
|
103
109
|
case 'atlassian:Task':
|
|
@@ -49,37 +49,44 @@ var documentTypeToIcon = function documentTypeToIcon(type, opts) {
|
|
|
49
49
|
switch (type) {
|
|
50
50
|
case 'schema:BlogPosting':
|
|
51
51
|
return /*#__PURE__*/_react.default.createElement(_.default, {
|
|
52
|
-
label: opts.title || 'blog'
|
|
52
|
+
label: opts.title || 'blog',
|
|
53
|
+
testId: "blog-icon"
|
|
53
54
|
});
|
|
54
55
|
|
|
55
56
|
case 'schema:DigitalDocument':
|
|
56
57
|
return /*#__PURE__*/_react.default.createElement(_2.default, {
|
|
57
|
-
label: opts.title || 'file'
|
|
58
|
+
label: opts.title || 'file',
|
|
59
|
+
testId: "file-icon"
|
|
58
60
|
});
|
|
59
61
|
|
|
60
62
|
case 'schema:TextDigitalDocument':
|
|
61
63
|
return /*#__PURE__*/_react.default.createElement(_5.default, {
|
|
62
|
-
label: opts.title || 'document'
|
|
64
|
+
label: opts.title || 'document',
|
|
65
|
+
testId: "document-icon"
|
|
63
66
|
});
|
|
64
67
|
|
|
65
68
|
case 'schema:PresentationDigitalDocument':
|
|
66
69
|
return /*#__PURE__*/_react.default.createElement(_3.default, {
|
|
67
|
-
label: opts.title || 'presentation'
|
|
70
|
+
label: opts.title || 'presentation',
|
|
71
|
+
testId: "presentation-icon"
|
|
68
72
|
});
|
|
69
73
|
|
|
70
74
|
case 'schema:SpreadsheetDigitalDocument':
|
|
71
75
|
return /*#__PURE__*/_react.default.createElement(_4.default, {
|
|
72
|
-
label: opts.title || 'spreadsheet'
|
|
76
|
+
label: opts.title || 'spreadsheet',
|
|
77
|
+
testId: "spreadsheet-icon"
|
|
73
78
|
});
|
|
74
79
|
|
|
75
80
|
case 'atlassian:Template':
|
|
76
81
|
return /*#__PURE__*/_react.default.createElement(_documentFilled.default, {
|
|
77
|
-
label: opts.title || 'template'
|
|
82
|
+
label: opts.title || 'template',
|
|
83
|
+
testId: "document-filled-icon"
|
|
78
84
|
});
|
|
79
85
|
|
|
80
86
|
case 'atlassian:UndefinedLink':
|
|
81
87
|
return /*#__PURE__*/_react.default.createElement(_5.default, {
|
|
82
|
-
label: opts.title || 'undefinedLink'
|
|
88
|
+
label: opts.title || 'undefinedLink',
|
|
89
|
+
testId: "document-icon"
|
|
83
90
|
});
|
|
84
91
|
}
|
|
85
92
|
};
|
|
@@ -35,6 +35,11 @@ var extractIconFromTask = function extractIconFromTask(opts) {
|
|
|
35
35
|
provider = opts.provider;
|
|
36
36
|
var taskLabel = opts.title || 'task';
|
|
37
37
|
|
|
38
|
+
var defaultIcon = /*#__PURE__*/_react.default.createElement(_.default, {
|
|
39
|
+
label: taskLabel,
|
|
40
|
+
testId: "default-task-icon"
|
|
41
|
+
});
|
|
42
|
+
|
|
38
43
|
if (provider && provider.id === _constants.JIRA_GENERATOR_ID && taskType && taskType.id) {
|
|
39
44
|
var taskTypeId = taskType.id;
|
|
40
45
|
var taskTypeName = taskTypeId.split('#').pop();
|
|
@@ -42,59 +47,64 @@ var extractIconFromTask = function extractIconFromTask(opts) {
|
|
|
42
47
|
switch (taskTypeName) {
|
|
43
48
|
case _constants.JIRA_TASK:
|
|
44
49
|
return /*#__PURE__*/_react.default.createElement(_.default, {
|
|
45
|
-
label: taskLabel
|
|
50
|
+
label: taskLabel,
|
|
51
|
+
testId: "jira-task-icon"
|
|
46
52
|
});
|
|
47
53
|
|
|
48
54
|
case _constants.JIRA_SUB_TASK:
|
|
49
55
|
return /*#__PURE__*/_react.default.createElement(_2.default, {
|
|
50
|
-
label: taskLabel
|
|
56
|
+
label: taskLabel,
|
|
57
|
+
testId: "jira-subtask-icon"
|
|
51
58
|
});
|
|
52
59
|
|
|
53
60
|
case _constants.JIRA_STORY:
|
|
54
61
|
return /*#__PURE__*/_react.default.createElement(_3.default, {
|
|
55
|
-
label: taskLabel
|
|
62
|
+
label: taskLabel,
|
|
63
|
+
testId: "jira-story-icon"
|
|
56
64
|
});
|
|
57
65
|
|
|
58
66
|
case _constants.JIRA_BUG:
|
|
59
67
|
return /*#__PURE__*/_react.default.createElement(_4.default, {
|
|
60
|
-
label: taskLabel
|
|
68
|
+
label: taskLabel,
|
|
69
|
+
testId: "jira-bug-icon"
|
|
61
70
|
});
|
|
62
71
|
|
|
63
72
|
case _constants.JIRA_EPIC:
|
|
64
73
|
return /*#__PURE__*/_react.default.createElement(_5.default, {
|
|
65
|
-
label: taskLabel
|
|
74
|
+
label: taskLabel,
|
|
75
|
+
testId: "jira-epic-icon"
|
|
66
76
|
});
|
|
67
77
|
|
|
68
78
|
case _constants.JIRA_INCIDENT:
|
|
69
79
|
return /*#__PURE__*/_react.default.createElement(_6.default, {
|
|
70
|
-
label: taskLabel
|
|
80
|
+
label: taskLabel,
|
|
81
|
+
testId: "jira-incident-icon"
|
|
71
82
|
});
|
|
72
83
|
|
|
73
84
|
case _constants.JIRA_SERVICE_REQUEST:
|
|
74
85
|
return /*#__PURE__*/_react.default.createElement(_7.default, {
|
|
75
|
-
label: taskLabel
|
|
86
|
+
label: taskLabel,
|
|
87
|
+
testId: "jira-service-request-icon"
|
|
76
88
|
});
|
|
77
89
|
|
|
78
90
|
case _constants.JIRA_CHANGE:
|
|
79
91
|
return /*#__PURE__*/_react.default.createElement(_8.default, {
|
|
80
|
-
label: taskLabel
|
|
92
|
+
label: taskLabel,
|
|
93
|
+
testId: "jira-change-icon"
|
|
81
94
|
});
|
|
82
95
|
|
|
83
96
|
case _constants.JIRA_PROBLEM:
|
|
84
97
|
return /*#__PURE__*/_react.default.createElement(_9.default, {
|
|
85
|
-
label: taskLabel
|
|
98
|
+
label: taskLabel,
|
|
99
|
+
testId: "jira-problem-icon"
|
|
86
100
|
});
|
|
87
101
|
|
|
88
102
|
case _constants.JIRA_CUSTOM_TASK_TYPE:
|
|
89
|
-
return taskType.icon || opts.icon || provider.icon ||
|
|
90
|
-
label: taskLabel
|
|
91
|
-
});
|
|
103
|
+
return taskType.icon || opts.icon || provider.icon || defaultIcon;
|
|
92
104
|
}
|
|
93
105
|
}
|
|
94
106
|
|
|
95
|
-
return
|
|
96
|
-
label: taskLabel
|
|
97
|
-
});
|
|
107
|
+
return defaultIcon;
|
|
98
108
|
};
|
|
99
109
|
|
|
100
110
|
exports.extractIconFromTask = extractIconFromTask;
|
package/dist/cjs/messages.js
CHANGED
|
@@ -104,7 +104,7 @@ var messages = (0, _reactIntlNext.defineMessages)({
|
|
|
104
104
|
description: 'continue'
|
|
105
105
|
},
|
|
106
106
|
copy_url_to_clipboard: {
|
|
107
|
-
id: 'fabric.linking.
|
|
107
|
+
id: 'fabric.linking.copy_url_to_clipboard',
|
|
108
108
|
defaultMessage: 'Copy link',
|
|
109
109
|
description: ''
|
|
110
110
|
},
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -84,7 +84,8 @@ var getIconForFileType = function getIconForFileType(fileMimeType) {
|
|
|
84
84
|
}); // because we're using dynamic loading here, TS will not be able to infer the type
|
|
85
85
|
|
|
86
86
|
return /*#__PURE__*/_react.default.createElement(Icon, {
|
|
87
|
-
label: label
|
|
87
|
+
label: label,
|
|
88
|
+
testId: "document-file-format-icon"
|
|
88
89
|
});
|
|
89
90
|
};
|
|
90
91
|
|
package/dist/cjs/version.json
CHANGED
|
@@ -89,7 +89,9 @@ var ExpandedFrame = function ExpandedFrame(_ref) {
|
|
|
89
89
|
"data-testid": testId,
|
|
90
90
|
"data-trello-do-not-use-override": testId,
|
|
91
91
|
"data-is-selected": isSelected,
|
|
92
|
-
"data-is-visible": isVisible
|
|
92
|
+
"data-is-visible": isVisible,
|
|
93
|
+
"data-wrapper-type": "default",
|
|
94
|
+
"data-is-interactive": isInteractive()
|
|
93
95
|
}, renderHeader(), renderContent());
|
|
94
96
|
}
|
|
95
97
|
};
|
|
@@ -173,7 +173,8 @@ var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
173
173
|
onMouseEnter: initShowCard,
|
|
174
174
|
onMouseLeave: initHideCard,
|
|
175
175
|
onMouseMove: setMousePosition,
|
|
176
|
-
onClick: onChildClick
|
|
176
|
+
onClick: onChildClick,
|
|
177
|
+
"data-testid": "hover-card-trigger-wrapper"
|
|
177
178
|
}), children));
|
|
178
179
|
},
|
|
179
180
|
zIndex: 511 // Temporary fix for Confluence inline comment on editor mod has z-index of 500, Jira issue view has z-index of 510
|
|
@@ -77,7 +77,8 @@ var InlineCardErroredView = /*#__PURE__*/function (_React$Component) {
|
|
|
77
77
|
spacing: "none",
|
|
78
78
|
appearance: "subtle-link",
|
|
79
79
|
component: _styled.IconStyledButton,
|
|
80
|
-
onClick: _this.handleRetry
|
|
80
|
+
onClick: _this.handleRetry,
|
|
81
|
+
role: "button"
|
|
81
82
|
}, /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.try_again, function (formattedMessage) {
|
|
82
83
|
return /*#__PURE__*/_react.default.createElement(_styled.LowercaseAppearance, null, formattedMessage);
|
|
83
84
|
})));
|
|
@@ -102,7 +103,8 @@ var InlineCardErroredView = /*#__PURE__*/function (_React$Component) {
|
|
|
102
103
|
icon: icon || /*#__PURE__*/_react.default.createElement(_Icon.AKIconWrapper, null, /*#__PURE__*/_react.default.createElement(_error.default, {
|
|
103
104
|
label: "error",
|
|
104
105
|
size: "small",
|
|
105
|
-
primaryColor: "var(--ds-icon-danger, ".concat(_colors.R300, ")")
|
|
106
|
+
primaryColor: "var(--ds-icon-danger, ".concat(_colors.R300, ")"),
|
|
107
|
+
testId: "errored-view-default-icon"
|
|
106
108
|
})),
|
|
107
109
|
link: url,
|
|
108
110
|
title: url,
|
|
@@ -54,7 +54,8 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
54
54
|
var FallbackForbiddenIcon = /*#__PURE__*/_react.default.createElement(_Icon.AKIconWrapper, null, /*#__PURE__*/_react.default.createElement(_lockFilled.default, {
|
|
55
55
|
label: "error",
|
|
56
56
|
size: "small",
|
|
57
|
-
primaryColor: "var(--ds-icon-danger, ".concat(_colors.R400, ")")
|
|
57
|
+
primaryColor: "var(--ds-icon-danger, ".concat(_colors.R400, ")"),
|
|
58
|
+
testId: "forbidden-view-fallback-icon"
|
|
58
59
|
}));
|
|
59
60
|
|
|
60
61
|
var InlineCardForbiddenView = /*#__PURE__*/function (_React$Component) {
|
|
@@ -115,7 +116,8 @@ var InlineCardForbiddenView = /*#__PURE__*/function (_React$Component) {
|
|
|
115
116
|
appearance: "subtle-link",
|
|
116
117
|
onClick: _this.handleRetry,
|
|
117
118
|
component: _styled.IconStyledButton,
|
|
118
|
-
testId: "button-connect-other-account"
|
|
119
|
+
testId: "button-connect-other-account",
|
|
120
|
+
role: "button"
|
|
119
121
|
}, _this.renderForbiddenAccessMessage());
|
|
120
122
|
}
|
|
121
123
|
|
|
@@ -125,7 +127,8 @@ var InlineCardForbiddenView = /*#__PURE__*/function (_React$Component) {
|
|
|
125
127
|
appearance: "subtle-link",
|
|
126
128
|
onClick: _this.handleRetry,
|
|
127
129
|
component: _styled.IconStyledButton,
|
|
128
|
-
testId: "button-connect-other-account"
|
|
130
|
+
testId: "button-connect-other-account",
|
|
131
|
+
role: "button"
|
|
129
132
|
}, /*#__PURE__*/_react.default.createElement(_styled2.LozengeWrapper, null, /*#__PURE__*/_react.default.createElement(_lozenge.default, {
|
|
130
133
|
appearance: 'moved'
|
|
131
134
|
}, _this.renderForbiddenAccessMessage()))));
|
|
@@ -171,7 +171,8 @@ var IconAndTitleLayout = /*#__PURE__*/function (_React$Component) {
|
|
|
171
171
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styled.IconTitleWrapper, {
|
|
172
172
|
style: {
|
|
173
173
|
color: titleColor
|
|
174
|
-
}
|
|
174
|
+
},
|
|
175
|
+
"data-testid": testId
|
|
175
176
|
}, link ? /*#__PURE__*/_react.default.createElement(_styled2.LinkAppearance, {
|
|
176
177
|
href: link,
|
|
177
178
|
onClick: this.handleClick,
|
|
@@ -53,6 +53,7 @@ var InlineCardResolvedView = /*#__PURE__*/function (_React$Component) {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
return /*#__PURE__*/_react.default.createElement(_styled.LozengeBlockWrapper, null, /*#__PURE__*/_react.default.createElement(_styled.LozengeWrapper, null, /*#__PURE__*/_react.default.createElement(_lozenge.default, {
|
|
56
|
+
testId: "inline-card-resolved-view-lozenge",
|
|
56
57
|
appearance: lozenge.appearance || 'default',
|
|
57
58
|
isBold: lozenge.isBold
|
|
58
59
|
}, lozenge.text)));
|
|
@@ -13,6 +13,10 @@ var _react = require("react");
|
|
|
13
13
|
|
|
14
14
|
var _url = require("@atlaskit/linking-common/url");
|
|
15
15
|
|
|
16
|
+
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
17
|
+
|
|
18
|
+
var _analytics = require("../../../../utils/analytics");
|
|
19
|
+
|
|
16
20
|
var useLinkWarningModal = function useLinkWarningModal() {
|
|
17
21
|
var _useState = (0, _react.useState)(null),
|
|
18
22
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -28,6 +32,18 @@ var useLinkWarningModal = function useLinkWarningModal() {
|
|
|
28
32
|
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
29
33
|
isOpen = _useState6[0],
|
|
30
34
|
setIsOpen = _useState6[1];
|
|
35
|
+
|
|
36
|
+
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
37
|
+
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
38
|
+
|
|
39
|
+
var sendAnalyticsEvent = function sendAnalyticsEvent() {
|
|
40
|
+
createAnalyticsEvent({
|
|
41
|
+
action: 'shown',
|
|
42
|
+
actionSubject: 'warningModal',
|
|
43
|
+
actionSubjectId: 'linkSafetyWarning',
|
|
44
|
+
eventType: 'operational'
|
|
45
|
+
}).fire(_analytics.ANALYTICS_CHANNEL);
|
|
46
|
+
};
|
|
31
47
|
/**
|
|
32
48
|
* It checks and warns if a link text is a URL and different from an actual link destination
|
|
33
49
|
*/
|
|
@@ -49,6 +65,7 @@ var useLinkWarningModal = function useLinkWarningModal() {
|
|
|
49
65
|
setUnsafeLinkText(linkText);
|
|
50
66
|
href && setUrl(href);
|
|
51
67
|
setIsOpen(true);
|
|
68
|
+
sendAnalyticsEvent();
|
|
52
69
|
}
|
|
53
70
|
};
|
|
54
71
|
|
|
@@ -17,8 +17,17 @@ var _useLinkWarningModal2 = require("./LinkWarningModal/hooks/use-link-warning-m
|
|
|
17
17
|
|
|
18
18
|
var _LinkWarningModal = _interopRequireDefault(require("./LinkWarningModal"));
|
|
19
19
|
|
|
20
|
+
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
21
|
+
|
|
22
|
+
var _version = require("../../version.json");
|
|
23
|
+
|
|
20
24
|
var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
|
|
21
25
|
_excluded2 = ["checkLinkSafety"];
|
|
26
|
+
var PACKAGE_DATA = {
|
|
27
|
+
packageName: _version.name,
|
|
28
|
+
packageVersion: _version.version,
|
|
29
|
+
componentName: 'linkUrl'
|
|
30
|
+
};
|
|
22
31
|
|
|
23
32
|
var LinkUrl = function LinkUrl(_ref) {
|
|
24
33
|
var href = _ref.href,
|
|
@@ -44,5 +53,6 @@ var LinkUrl = function LinkUrl(_ref) {
|
|
|
44
53
|
}, props), children), checkSafety && /*#__PURE__*/_react.default.createElement(_LinkWarningModal.default, linkWarningModalProps));
|
|
45
54
|
};
|
|
46
55
|
|
|
47
|
-
var _default = LinkUrl;
|
|
56
|
+
var _default = (0, _analyticsNext.withAnalyticsContext)(PACKAGE_DATA)(LinkUrl);
|
|
57
|
+
|
|
48
58
|
exports.default = _default;
|
|
@@ -44,33 +44,39 @@ const extractIconByType = (type, opts) => {
|
|
|
44
44
|
|
|
45
45
|
case 'atlassian:Goal':
|
|
46
46
|
return opts.icon || /*#__PURE__*/React.createElement(TaskIcon, {
|
|
47
|
-
label: opts.title || 'goal'
|
|
47
|
+
label: opts.title || 'goal',
|
|
48
|
+
testId: "task-icon"
|
|
48
49
|
});
|
|
49
50
|
|
|
50
51
|
case 'atlassian:Project':
|
|
51
52
|
return opts.icon || /*#__PURE__*/React.createElement(ProjectIcon, {
|
|
52
53
|
label: opts.title || 'project',
|
|
53
|
-
size: "small"
|
|
54
|
+
size: "small",
|
|
55
|
+
testId: "project-icon"
|
|
54
56
|
});
|
|
55
57
|
|
|
56
58
|
case 'atlassian:SourceCodeCommit':
|
|
57
59
|
return /*#__PURE__*/React.createElement(CommitIcon, {
|
|
58
|
-
label: opts.title || 'commit'
|
|
60
|
+
label: opts.title || 'commit',
|
|
61
|
+
testId: "commit-icon"
|
|
59
62
|
});
|
|
60
63
|
|
|
61
64
|
case 'atlassian:SourceCodePullRequest':
|
|
62
65
|
return /*#__PURE__*/React.createElement(PullRequestIcon, {
|
|
63
|
-
label: opts.title || 'pullRequest'
|
|
66
|
+
label: opts.title || 'pullRequest',
|
|
67
|
+
testId: "pull-request-icon"
|
|
64
68
|
});
|
|
65
69
|
|
|
66
70
|
case 'atlassian:SourceCodeReference':
|
|
67
71
|
return /*#__PURE__*/React.createElement(BranchIcon, {
|
|
68
|
-
label: opts.title || 'reference'
|
|
72
|
+
label: opts.title || 'reference',
|
|
73
|
+
testId: "branch-icon"
|
|
69
74
|
});
|
|
70
75
|
|
|
71
76
|
case 'atlassian:SourceCodeRepository':
|
|
72
77
|
return /*#__PURE__*/React.createElement(RepoIcon, {
|
|
73
|
-
label: opts.title || 'repository'
|
|
78
|
+
label: opts.title || 'repository',
|
|
79
|
+
testId: "repo-icon"
|
|
74
80
|
});
|
|
75
81
|
|
|
76
82
|
case 'atlassian:Task':
|
|
@@ -30,37 +30,44 @@ const documentTypeToIcon = (type, opts) => {
|
|
|
30
30
|
switch (type) {
|
|
31
31
|
case 'schema:BlogPosting':
|
|
32
32
|
return /*#__PURE__*/React.createElement(BlogIcon, {
|
|
33
|
-
label: opts.title || 'blog'
|
|
33
|
+
label: opts.title || 'blog',
|
|
34
|
+
testId: "blog-icon"
|
|
34
35
|
});
|
|
35
36
|
|
|
36
37
|
case 'schema:DigitalDocument':
|
|
37
38
|
return /*#__PURE__*/React.createElement(FileIcon, {
|
|
38
|
-
label: opts.title || 'file'
|
|
39
|
+
label: opts.title || 'file',
|
|
40
|
+
testId: "file-icon"
|
|
39
41
|
});
|
|
40
42
|
|
|
41
43
|
case 'schema:TextDigitalDocument':
|
|
42
44
|
return /*#__PURE__*/React.createElement(DocumentIcon, {
|
|
43
|
-
label: opts.title || 'document'
|
|
45
|
+
label: opts.title || 'document',
|
|
46
|
+
testId: "document-icon"
|
|
44
47
|
});
|
|
45
48
|
|
|
46
49
|
case 'schema:PresentationDigitalDocument':
|
|
47
50
|
return /*#__PURE__*/React.createElement(PresentationIcon, {
|
|
48
|
-
label: opts.title || 'presentation'
|
|
51
|
+
label: opts.title || 'presentation',
|
|
52
|
+
testId: "presentation-icon"
|
|
49
53
|
});
|
|
50
54
|
|
|
51
55
|
case 'schema:SpreadsheetDigitalDocument':
|
|
52
56
|
return /*#__PURE__*/React.createElement(SpreadsheetIcon, {
|
|
53
|
-
label: opts.title || 'spreadsheet'
|
|
57
|
+
label: opts.title || 'spreadsheet',
|
|
58
|
+
testId: "spreadsheet-icon"
|
|
54
59
|
});
|
|
55
60
|
|
|
56
61
|
case 'atlassian:Template':
|
|
57
62
|
return /*#__PURE__*/React.createElement(DocumentFilledIcon, {
|
|
58
|
-
label: opts.title || 'template'
|
|
63
|
+
label: opts.title || 'template',
|
|
64
|
+
testId: "document-filled-icon"
|
|
59
65
|
});
|
|
60
66
|
|
|
61
67
|
case 'atlassian:UndefinedLink':
|
|
62
68
|
return /*#__PURE__*/React.createElement(DocumentIcon, {
|
|
63
|
-
label: opts.title || 'undefinedLink'
|
|
69
|
+
label: opts.title || 'undefinedLink',
|
|
70
|
+
testId: "document-icon"
|
|
64
71
|
});
|
|
65
72
|
}
|
|
66
73
|
};
|
|
@@ -17,6 +17,10 @@ export const extractIconFromTask = opts => {
|
|
|
17
17
|
provider
|
|
18
18
|
} = opts;
|
|
19
19
|
const taskLabel = opts.title || 'task';
|
|
20
|
+
const defaultIcon = /*#__PURE__*/React.createElement(TaskIcon, {
|
|
21
|
+
label: taskLabel,
|
|
22
|
+
testId: "default-task-icon"
|
|
23
|
+
});
|
|
20
24
|
|
|
21
25
|
if (provider && provider.id === JIRA_GENERATOR_ID && taskType && taskType.id) {
|
|
22
26
|
const taskTypeId = taskType.id;
|
|
@@ -25,57 +29,62 @@ export const extractIconFromTask = opts => {
|
|
|
25
29
|
switch (taskTypeName) {
|
|
26
30
|
case JIRA_TASK:
|
|
27
31
|
return /*#__PURE__*/React.createElement(JiraTaskIcon, {
|
|
28
|
-
label: taskLabel
|
|
32
|
+
label: taskLabel,
|
|
33
|
+
testId: "jira-task-icon"
|
|
29
34
|
});
|
|
30
35
|
|
|
31
36
|
case JIRA_SUB_TASK:
|
|
32
37
|
return /*#__PURE__*/React.createElement(JiraSubTaskIcon, {
|
|
33
|
-
label: taskLabel
|
|
38
|
+
label: taskLabel,
|
|
39
|
+
testId: "jira-subtask-icon"
|
|
34
40
|
});
|
|
35
41
|
|
|
36
42
|
case JIRA_STORY:
|
|
37
43
|
return /*#__PURE__*/React.createElement(JiraStoryIcon, {
|
|
38
|
-
label: taskLabel
|
|
44
|
+
label: taskLabel,
|
|
45
|
+
testId: "jira-story-icon"
|
|
39
46
|
});
|
|
40
47
|
|
|
41
48
|
case JIRA_BUG:
|
|
42
49
|
return /*#__PURE__*/React.createElement(JiraBugIcon, {
|
|
43
|
-
label: taskLabel
|
|
50
|
+
label: taskLabel,
|
|
51
|
+
testId: "jira-bug-icon"
|
|
44
52
|
});
|
|
45
53
|
|
|
46
54
|
case JIRA_EPIC:
|
|
47
55
|
return /*#__PURE__*/React.createElement(JiraEpicIcon, {
|
|
48
|
-
label: taskLabel
|
|
56
|
+
label: taskLabel,
|
|
57
|
+
testId: "jira-epic-icon"
|
|
49
58
|
});
|
|
50
59
|
|
|
51
60
|
case JIRA_INCIDENT:
|
|
52
61
|
return /*#__PURE__*/React.createElement(JiraIncidentIcon, {
|
|
53
|
-
label: taskLabel
|
|
62
|
+
label: taskLabel,
|
|
63
|
+
testId: "jira-incident-icon"
|
|
54
64
|
});
|
|
55
65
|
|
|
56
66
|
case JIRA_SERVICE_REQUEST:
|
|
57
67
|
return /*#__PURE__*/React.createElement(JiraServiceRequestIcon, {
|
|
58
|
-
label: taskLabel
|
|
68
|
+
label: taskLabel,
|
|
69
|
+
testId: "jira-service-request-icon"
|
|
59
70
|
});
|
|
60
71
|
|
|
61
72
|
case JIRA_CHANGE:
|
|
62
73
|
return /*#__PURE__*/React.createElement(JiraChangeIcon, {
|
|
63
|
-
label: taskLabel
|
|
74
|
+
label: taskLabel,
|
|
75
|
+
testId: "jira-change-icon"
|
|
64
76
|
});
|
|
65
77
|
|
|
66
78
|
case JIRA_PROBLEM:
|
|
67
79
|
return /*#__PURE__*/React.createElement(JiraProblemIcon, {
|
|
68
|
-
label: taskLabel
|
|
80
|
+
label: taskLabel,
|
|
81
|
+
testId: "jira-problem-icon"
|
|
69
82
|
});
|
|
70
83
|
|
|
71
84
|
case JIRA_CUSTOM_TASK_TYPE:
|
|
72
|
-
return taskType.icon || opts.icon || provider.icon ||
|
|
73
|
-
label: taskLabel
|
|
74
|
-
});
|
|
85
|
+
return taskType.icon || opts.icon || provider.icon || defaultIcon;
|
|
75
86
|
}
|
|
76
87
|
}
|
|
77
88
|
|
|
78
|
-
return
|
|
79
|
-
label: taskLabel
|
|
80
|
-
});
|
|
89
|
+
return defaultIcon;
|
|
81
90
|
};
|
package/dist/es2019/messages.js
CHANGED
|
@@ -28,7 +28,8 @@ export const getIconForFileType = fileMimeType => {
|
|
|
28
28
|
}); // because we're using dynamic loading here, TS will not be able to infer the type
|
|
29
29
|
|
|
30
30
|
return /*#__PURE__*/React.createElement(Icon, {
|
|
31
|
-
label: label
|
|
31
|
+
label: label,
|
|
32
|
+
testId: "document-file-format-icon"
|
|
32
33
|
});
|
|
33
34
|
};
|
|
34
35
|
export const getLabelForFileType = fileMimeType => {
|
package/dist/es2019/version.json
CHANGED
|
@@ -66,7 +66,9 @@ export const ExpandedFrame = ({
|
|
|
66
66
|
"data-testid": testId,
|
|
67
67
|
"data-trello-do-not-use-override": testId,
|
|
68
68
|
"data-is-selected": isSelected,
|
|
69
|
-
"data-is-visible": isVisible
|
|
69
|
+
"data-is-visible": isVisible,
|
|
70
|
+
"data-wrapper-type": "default",
|
|
71
|
+
"data-is-interactive": isInteractive()
|
|
70
72
|
}, renderHeader(), renderContent());
|
|
71
73
|
}
|
|
72
74
|
};
|
|
@@ -137,7 +137,8 @@ export const HoverCardComponent = ({
|
|
|
137
137
|
onMouseEnter: initShowCard,
|
|
138
138
|
onMouseLeave: initHideCard,
|
|
139
139
|
onMouseMove: setMousePosition,
|
|
140
|
-
onClick: onChildClick
|
|
140
|
+
onClick: onChildClick,
|
|
141
|
+
"data-testid": "hover-card-trigger-wrapper"
|
|
141
142
|
}), children)),
|
|
142
143
|
zIndex: 511 // Temporary fix for Confluence inline comment on editor mod has z-index of 500, Jira issue view has z-index of 510
|
|
143
144
|
|
|
@@ -34,7 +34,8 @@ export class InlineCardErroredView extends React.Component {
|
|
|
34
34
|
spacing: "none",
|
|
35
35
|
appearance: "subtle-link",
|
|
36
36
|
component: IconStyledButton,
|
|
37
|
-
onClick: this.handleRetry
|
|
37
|
+
onClick: this.handleRetry,
|
|
38
|
+
role: "button"
|
|
38
39
|
}, /*#__PURE__*/React.createElement(FormattedMessage, messages.try_again, formattedMessage => {
|
|
39
40
|
return /*#__PURE__*/React.createElement(LowercaseAppearance, null, formattedMessage);
|
|
40
41
|
})));
|
|
@@ -56,7 +57,8 @@ export class InlineCardErroredView extends React.Component {
|
|
|
56
57
|
icon: icon || /*#__PURE__*/React.createElement(AKIconWrapper, null, /*#__PURE__*/React.createElement(ErrorIcon, {
|
|
57
58
|
label: "error",
|
|
58
59
|
size: "small",
|
|
59
|
-
primaryColor: `var(--ds-icon-danger, ${R300})
|
|
60
|
+
primaryColor: `var(--ds-icon-danger, ${R300})`,
|
|
61
|
+
testId: "errored-view-default-icon"
|
|
60
62
|
})),
|
|
61
63
|
link: url,
|
|
62
64
|
title: url,
|
|
@@ -15,7 +15,8 @@ import { LozengeWrapper, LozengeBlockWrapper } from '../IconAndTitleLayout/style
|
|
|
15
15
|
const FallbackForbiddenIcon = /*#__PURE__*/React.createElement(AKIconWrapper, null, /*#__PURE__*/React.createElement(LockIcon, {
|
|
16
16
|
label: "error",
|
|
17
17
|
size: "small",
|
|
18
|
-
primaryColor: `var(--ds-icon-danger, ${R400})
|
|
18
|
+
primaryColor: `var(--ds-icon-danger, ${R400})`,
|
|
19
|
+
testId: "forbidden-view-fallback-icon"
|
|
19
20
|
}));
|
|
20
21
|
export class InlineCardForbiddenView extends React.Component {
|
|
21
22
|
constructor(...args) {
|
|
@@ -73,7 +74,8 @@ export class InlineCardForbiddenView extends React.Component {
|
|
|
73
74
|
appearance: "subtle-link",
|
|
74
75
|
onClick: this.handleRetry,
|
|
75
76
|
component: IconStyledButton,
|
|
76
|
-
testId: "button-connect-other-account"
|
|
77
|
+
testId: "button-connect-other-account",
|
|
78
|
+
role: "button"
|
|
77
79
|
}, this.renderForbiddenAccessMessage());
|
|
78
80
|
}
|
|
79
81
|
|
|
@@ -83,7 +85,8 @@ export class InlineCardForbiddenView extends React.Component {
|
|
|
83
85
|
appearance: "subtle-link",
|
|
84
86
|
onClick: this.handleRetry,
|
|
85
87
|
component: IconStyledButton,
|
|
86
|
-
testId: "button-connect-other-account"
|
|
88
|
+
testId: "button-connect-other-account",
|
|
89
|
+
role: "button"
|
|
87
90
|
}, /*#__PURE__*/React.createElement(LozengeWrapper, null, /*#__PURE__*/React.createElement(Lozenge, {
|
|
88
91
|
appearance: 'moved'
|
|
89
92
|
}, this.renderForbiddenAccessMessage()))));
|
|
@@ -129,7 +129,8 @@ export class IconAndTitleLayout extends React.Component {
|
|
|
129
129
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IconTitleWrapper, {
|
|
130
130
|
style: {
|
|
131
131
|
color: titleColor
|
|
132
|
-
}
|
|
132
|
+
},
|
|
133
|
+
"data-testid": testId
|
|
133
134
|
}, link ? /*#__PURE__*/React.createElement(LinkAppearance, {
|
|
134
135
|
href: link,
|
|
135
136
|
onClick: this.handleClick,
|
|
@@ -15,6 +15,7 @@ export class InlineCardResolvedView extends React.Component {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
return /*#__PURE__*/React.createElement(LozengeBlockWrapper, null, /*#__PURE__*/React.createElement(LozengeWrapper, null, /*#__PURE__*/React.createElement(Lozenge, {
|
|
18
|
+
testId: "inline-card-resolved-view-lozenge",
|
|
18
19
|
appearance: lozenge.appearance || 'default',
|
|
19
20
|
isBold: lozenge.isBold
|
|
20
21
|
}, lozenge.text)));
|
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { normalizeUrl } from '@atlaskit/linking-common/url';
|
|
3
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
4
|
+
import { ANALYTICS_CHANNEL } from '../../../../utils/analytics';
|
|
3
5
|
export const useLinkWarningModal = () => {
|
|
4
6
|
const [unsafeLinkText, setUnsafeLinkText] = useState(null);
|
|
5
7
|
const [url, setUrl] = useState(null);
|
|
6
8
|
const [isOpen, setIsOpen] = useState(false);
|
|
9
|
+
const {
|
|
10
|
+
createAnalyticsEvent
|
|
11
|
+
} = useAnalyticsEvents();
|
|
12
|
+
|
|
13
|
+
const sendAnalyticsEvent = () => {
|
|
14
|
+
createAnalyticsEvent({
|
|
15
|
+
action: 'shown',
|
|
16
|
+
actionSubject: 'warningModal',
|
|
17
|
+
actionSubjectId: 'linkSafetyWarning',
|
|
18
|
+
eventType: 'operational'
|
|
19
|
+
}).fire(ANALYTICS_CHANNEL);
|
|
20
|
+
};
|
|
7
21
|
/**
|
|
8
22
|
* It checks and warns if a link text is a URL and different from an actual link destination
|
|
9
23
|
*/
|
|
10
24
|
|
|
25
|
+
|
|
11
26
|
const checkLinkSafety = (event, href) => {
|
|
12
27
|
const linkText = event.currentTarget.innerText;
|
|
13
28
|
const anchorLinkRegex = new RegExp(/^#/im);
|
|
@@ -24,6 +39,7 @@ export const useLinkWarningModal = () => {
|
|
|
24
39
|
setUnsafeLinkText(linkText);
|
|
25
40
|
href && setUrl(href);
|
|
26
41
|
setIsOpen(true);
|
|
42
|
+
sendAnalyticsEvent();
|
|
27
43
|
}
|
|
28
44
|
};
|
|
29
45
|
|
|
@@ -2,6 +2,13 @@ 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';
|
|
6
|
+
import { name as packageName, version as packageVersion } from '../../version.json';
|
|
7
|
+
const PACKAGE_DATA = {
|
|
8
|
+
packageName,
|
|
9
|
+
packageVersion,
|
|
10
|
+
componentName: 'linkUrl'
|
|
11
|
+
};
|
|
5
12
|
|
|
6
13
|
const LinkUrl = ({
|
|
7
14
|
href,
|
|
@@ -25,4 +32,4 @@ const LinkUrl = ({
|
|
|
25
32
|
}, props), children), checkSafety && /*#__PURE__*/React.createElement(LinkWarningModal, linkWarningModalProps));
|
|
26
33
|
};
|
|
27
34
|
|
|
28
|
-
export default LinkUrl;
|
|
35
|
+
export default withAnalyticsContext(PACKAGE_DATA)(LinkUrl);
|
|
@@ -47,33 +47,39 @@ var extractIconByType = function extractIconByType(type, opts) {
|
|
|
47
47
|
|
|
48
48
|
case 'atlassian:Goal':
|
|
49
49
|
return opts.icon || /*#__PURE__*/React.createElement(TaskIcon, {
|
|
50
|
-
label: opts.title || 'goal'
|
|
50
|
+
label: opts.title || 'goal',
|
|
51
|
+
testId: "task-icon"
|
|
51
52
|
});
|
|
52
53
|
|
|
53
54
|
case 'atlassian:Project':
|
|
54
55
|
return opts.icon || /*#__PURE__*/React.createElement(ProjectIcon, {
|
|
55
56
|
label: opts.title || 'project',
|
|
56
|
-
size: "small"
|
|
57
|
+
size: "small",
|
|
58
|
+
testId: "project-icon"
|
|
57
59
|
});
|
|
58
60
|
|
|
59
61
|
case 'atlassian:SourceCodeCommit':
|
|
60
62
|
return /*#__PURE__*/React.createElement(CommitIcon, {
|
|
61
|
-
label: opts.title || 'commit'
|
|
63
|
+
label: opts.title || 'commit',
|
|
64
|
+
testId: "commit-icon"
|
|
62
65
|
});
|
|
63
66
|
|
|
64
67
|
case 'atlassian:SourceCodePullRequest':
|
|
65
68
|
return /*#__PURE__*/React.createElement(PullRequestIcon, {
|
|
66
|
-
label: opts.title || 'pullRequest'
|
|
69
|
+
label: opts.title || 'pullRequest',
|
|
70
|
+
testId: "pull-request-icon"
|
|
67
71
|
});
|
|
68
72
|
|
|
69
73
|
case 'atlassian:SourceCodeReference':
|
|
70
74
|
return /*#__PURE__*/React.createElement(BranchIcon, {
|
|
71
|
-
label: opts.title || 'reference'
|
|
75
|
+
label: opts.title || 'reference',
|
|
76
|
+
testId: "branch-icon"
|
|
72
77
|
});
|
|
73
78
|
|
|
74
79
|
case 'atlassian:SourceCodeRepository':
|
|
75
80
|
return /*#__PURE__*/React.createElement(RepoIcon, {
|
|
76
|
-
label: opts.title || 'repository'
|
|
81
|
+
label: opts.title || 'repository',
|
|
82
|
+
testId: "repo-icon"
|
|
77
83
|
});
|
|
78
84
|
|
|
79
85
|
case 'atlassian:Task':
|
|
@@ -30,37 +30,44 @@ var documentTypeToIcon = function documentTypeToIcon(type, opts) {
|
|
|
30
30
|
switch (type) {
|
|
31
31
|
case 'schema:BlogPosting':
|
|
32
32
|
return /*#__PURE__*/React.createElement(BlogIcon, {
|
|
33
|
-
label: opts.title || 'blog'
|
|
33
|
+
label: opts.title || 'blog',
|
|
34
|
+
testId: "blog-icon"
|
|
34
35
|
});
|
|
35
36
|
|
|
36
37
|
case 'schema:DigitalDocument':
|
|
37
38
|
return /*#__PURE__*/React.createElement(FileIcon, {
|
|
38
|
-
label: opts.title || 'file'
|
|
39
|
+
label: opts.title || 'file',
|
|
40
|
+
testId: "file-icon"
|
|
39
41
|
});
|
|
40
42
|
|
|
41
43
|
case 'schema:TextDigitalDocument':
|
|
42
44
|
return /*#__PURE__*/React.createElement(DocumentIcon, {
|
|
43
|
-
label: opts.title || 'document'
|
|
45
|
+
label: opts.title || 'document',
|
|
46
|
+
testId: "document-icon"
|
|
44
47
|
});
|
|
45
48
|
|
|
46
49
|
case 'schema:PresentationDigitalDocument':
|
|
47
50
|
return /*#__PURE__*/React.createElement(PresentationIcon, {
|
|
48
|
-
label: opts.title || 'presentation'
|
|
51
|
+
label: opts.title || 'presentation',
|
|
52
|
+
testId: "presentation-icon"
|
|
49
53
|
});
|
|
50
54
|
|
|
51
55
|
case 'schema:SpreadsheetDigitalDocument':
|
|
52
56
|
return /*#__PURE__*/React.createElement(SpreadsheetIcon, {
|
|
53
|
-
label: opts.title || 'spreadsheet'
|
|
57
|
+
label: opts.title || 'spreadsheet',
|
|
58
|
+
testId: "spreadsheet-icon"
|
|
54
59
|
});
|
|
55
60
|
|
|
56
61
|
case 'atlassian:Template':
|
|
57
62
|
return /*#__PURE__*/React.createElement(DocumentFilledIcon, {
|
|
58
|
-
label: opts.title || 'template'
|
|
63
|
+
label: opts.title || 'template',
|
|
64
|
+
testId: "document-filled-icon"
|
|
59
65
|
});
|
|
60
66
|
|
|
61
67
|
case 'atlassian:UndefinedLink':
|
|
62
68
|
return /*#__PURE__*/React.createElement(DocumentIcon, {
|
|
63
|
-
label: opts.title || 'undefinedLink'
|
|
69
|
+
label: opts.title || 'undefinedLink',
|
|
70
|
+
testId: "document-icon"
|
|
64
71
|
});
|
|
65
72
|
}
|
|
66
73
|
};
|
|
@@ -15,6 +15,10 @@ export var extractIconFromTask = function extractIconFromTask(opts) {
|
|
|
15
15
|
var taskType = opts.taskType,
|
|
16
16
|
provider = opts.provider;
|
|
17
17
|
var taskLabel = opts.title || 'task';
|
|
18
|
+
var defaultIcon = /*#__PURE__*/React.createElement(TaskIcon, {
|
|
19
|
+
label: taskLabel,
|
|
20
|
+
testId: "default-task-icon"
|
|
21
|
+
});
|
|
18
22
|
|
|
19
23
|
if (provider && provider.id === JIRA_GENERATOR_ID && taskType && taskType.id) {
|
|
20
24
|
var taskTypeId = taskType.id;
|
|
@@ -23,57 +27,62 @@ export var extractIconFromTask = function extractIconFromTask(opts) {
|
|
|
23
27
|
switch (taskTypeName) {
|
|
24
28
|
case JIRA_TASK:
|
|
25
29
|
return /*#__PURE__*/React.createElement(JiraTaskIcon, {
|
|
26
|
-
label: taskLabel
|
|
30
|
+
label: taskLabel,
|
|
31
|
+
testId: "jira-task-icon"
|
|
27
32
|
});
|
|
28
33
|
|
|
29
34
|
case JIRA_SUB_TASK:
|
|
30
35
|
return /*#__PURE__*/React.createElement(JiraSubTaskIcon, {
|
|
31
|
-
label: taskLabel
|
|
36
|
+
label: taskLabel,
|
|
37
|
+
testId: "jira-subtask-icon"
|
|
32
38
|
});
|
|
33
39
|
|
|
34
40
|
case JIRA_STORY:
|
|
35
41
|
return /*#__PURE__*/React.createElement(JiraStoryIcon, {
|
|
36
|
-
label: taskLabel
|
|
42
|
+
label: taskLabel,
|
|
43
|
+
testId: "jira-story-icon"
|
|
37
44
|
});
|
|
38
45
|
|
|
39
46
|
case JIRA_BUG:
|
|
40
47
|
return /*#__PURE__*/React.createElement(JiraBugIcon, {
|
|
41
|
-
label: taskLabel
|
|
48
|
+
label: taskLabel,
|
|
49
|
+
testId: "jira-bug-icon"
|
|
42
50
|
});
|
|
43
51
|
|
|
44
52
|
case JIRA_EPIC:
|
|
45
53
|
return /*#__PURE__*/React.createElement(JiraEpicIcon, {
|
|
46
|
-
label: taskLabel
|
|
54
|
+
label: taskLabel,
|
|
55
|
+
testId: "jira-epic-icon"
|
|
47
56
|
});
|
|
48
57
|
|
|
49
58
|
case JIRA_INCIDENT:
|
|
50
59
|
return /*#__PURE__*/React.createElement(JiraIncidentIcon, {
|
|
51
|
-
label: taskLabel
|
|
60
|
+
label: taskLabel,
|
|
61
|
+
testId: "jira-incident-icon"
|
|
52
62
|
});
|
|
53
63
|
|
|
54
64
|
case JIRA_SERVICE_REQUEST:
|
|
55
65
|
return /*#__PURE__*/React.createElement(JiraServiceRequestIcon, {
|
|
56
|
-
label: taskLabel
|
|
66
|
+
label: taskLabel,
|
|
67
|
+
testId: "jira-service-request-icon"
|
|
57
68
|
});
|
|
58
69
|
|
|
59
70
|
case JIRA_CHANGE:
|
|
60
71
|
return /*#__PURE__*/React.createElement(JiraChangeIcon, {
|
|
61
|
-
label: taskLabel
|
|
72
|
+
label: taskLabel,
|
|
73
|
+
testId: "jira-change-icon"
|
|
62
74
|
});
|
|
63
75
|
|
|
64
76
|
case JIRA_PROBLEM:
|
|
65
77
|
return /*#__PURE__*/React.createElement(JiraProblemIcon, {
|
|
66
|
-
label: taskLabel
|
|
78
|
+
label: taskLabel,
|
|
79
|
+
testId: "jira-problem-icon"
|
|
67
80
|
});
|
|
68
81
|
|
|
69
82
|
case JIRA_CUSTOM_TASK_TYPE:
|
|
70
|
-
return taskType.icon || opts.icon || provider.icon ||
|
|
71
|
-
label: taskLabel
|
|
72
|
-
});
|
|
83
|
+
return taskType.icon || opts.icon || provider.icon || defaultIcon;
|
|
73
84
|
}
|
|
74
85
|
}
|
|
75
86
|
|
|
76
|
-
return
|
|
77
|
-
label: taskLabel
|
|
78
|
-
});
|
|
87
|
+
return defaultIcon;
|
|
79
88
|
};
|
package/dist/esm/messages.js
CHANGED
package/dist/esm/utils/index.js
CHANGED
|
@@ -49,7 +49,8 @@ export var getIconForFileType = function getIconForFileType(fileMimeType) {
|
|
|
49
49
|
}); // because we're using dynamic loading here, TS will not be able to infer the type
|
|
50
50
|
|
|
51
51
|
return /*#__PURE__*/React.createElement(Icon, {
|
|
52
|
-
label: label
|
|
52
|
+
label: label,
|
|
53
|
+
testId: "document-file-format-icon"
|
|
53
54
|
});
|
|
54
55
|
};
|
|
55
56
|
export var getLabelForFileType = function getLabelForFileType(fileMimeType) {
|
package/dist/esm/version.json
CHANGED
|
@@ -77,7 +77,9 @@ export var ExpandedFrame = function ExpandedFrame(_ref) {
|
|
|
77
77
|
"data-testid": testId,
|
|
78
78
|
"data-trello-do-not-use-override": testId,
|
|
79
79
|
"data-is-selected": isSelected,
|
|
80
|
-
"data-is-visible": isVisible
|
|
80
|
+
"data-is-visible": isVisible,
|
|
81
|
+
"data-wrapper-type": "default",
|
|
82
|
+
"data-is-interactive": isInteractive()
|
|
81
83
|
}, renderHeader(), renderContent());
|
|
82
84
|
}
|
|
83
85
|
};
|
|
@@ -148,7 +148,8 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
148
148
|
onMouseEnter: initShowCard,
|
|
149
149
|
onMouseLeave: initHideCard,
|
|
150
150
|
onMouseMove: setMousePosition,
|
|
151
|
-
onClick: onChildClick
|
|
151
|
+
onClick: onChildClick,
|
|
152
|
+
"data-testid": "hover-card-trigger-wrapper"
|
|
152
153
|
}), children));
|
|
153
154
|
},
|
|
154
155
|
zIndex: 511 // Temporary fix for Confluence inline comment on editor mod has z-index of 500, Jira issue view has z-index of 510
|
|
@@ -54,7 +54,8 @@ export var InlineCardErroredView = /*#__PURE__*/function (_React$Component) {
|
|
|
54
54
|
spacing: "none",
|
|
55
55
|
appearance: "subtle-link",
|
|
56
56
|
component: IconStyledButton,
|
|
57
|
-
onClick: _this.handleRetry
|
|
57
|
+
onClick: _this.handleRetry,
|
|
58
|
+
role: "button"
|
|
58
59
|
}, /*#__PURE__*/React.createElement(FormattedMessage, messages.try_again, function (formattedMessage) {
|
|
59
60
|
return /*#__PURE__*/React.createElement(LowercaseAppearance, null, formattedMessage);
|
|
60
61
|
})));
|
|
@@ -80,7 +81,8 @@ export var InlineCardErroredView = /*#__PURE__*/function (_React$Component) {
|
|
|
80
81
|
icon: icon || /*#__PURE__*/React.createElement(AKIconWrapper, null, /*#__PURE__*/React.createElement(ErrorIcon, {
|
|
81
82
|
label: "error",
|
|
82
83
|
size: "small",
|
|
83
|
-
primaryColor: "var(--ds-icon-danger, ".concat(R300, ")")
|
|
84
|
+
primaryColor: "var(--ds-icon-danger, ".concat(R300, ")"),
|
|
85
|
+
testId: "errored-view-default-icon"
|
|
84
86
|
})),
|
|
85
87
|
link: url,
|
|
86
88
|
title: url,
|
|
@@ -26,7 +26,8 @@ import { LozengeWrapper, LozengeBlockWrapper } from '../IconAndTitleLayout/style
|
|
|
26
26
|
var FallbackForbiddenIcon = /*#__PURE__*/React.createElement(AKIconWrapper, null, /*#__PURE__*/React.createElement(LockIcon, {
|
|
27
27
|
label: "error",
|
|
28
28
|
size: "small",
|
|
29
|
-
primaryColor: "var(--ds-icon-danger, ".concat(R400, ")")
|
|
29
|
+
primaryColor: "var(--ds-icon-danger, ".concat(R400, ")"),
|
|
30
|
+
testId: "forbidden-view-fallback-icon"
|
|
30
31
|
}));
|
|
31
32
|
export var InlineCardForbiddenView = /*#__PURE__*/function (_React$Component) {
|
|
32
33
|
_inherits(InlineCardForbiddenView, _React$Component);
|
|
@@ -90,7 +91,8 @@ export var InlineCardForbiddenView = /*#__PURE__*/function (_React$Component) {
|
|
|
90
91
|
appearance: "subtle-link",
|
|
91
92
|
onClick: _this.handleRetry,
|
|
92
93
|
component: IconStyledButton,
|
|
93
|
-
testId: "button-connect-other-account"
|
|
94
|
+
testId: "button-connect-other-account",
|
|
95
|
+
role: "button"
|
|
94
96
|
}, _this.renderForbiddenAccessMessage());
|
|
95
97
|
}
|
|
96
98
|
|
|
@@ -100,7 +102,8 @@ export var InlineCardForbiddenView = /*#__PURE__*/function (_React$Component) {
|
|
|
100
102
|
appearance: "subtle-link",
|
|
101
103
|
onClick: _this.handleRetry,
|
|
102
104
|
component: IconStyledButton,
|
|
103
|
-
testId: "button-connect-other-account"
|
|
105
|
+
testId: "button-connect-other-account",
|
|
106
|
+
role: "button"
|
|
104
107
|
}, /*#__PURE__*/React.createElement(LozengeWrapper, null, /*#__PURE__*/React.createElement(Lozenge, {
|
|
105
108
|
appearance: 'moved'
|
|
106
109
|
}, _this.renderForbiddenAccessMessage()))));
|
|
@@ -151,7 +151,8 @@ export var IconAndTitleLayout = /*#__PURE__*/function (_React$Component) {
|
|
|
151
151
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IconTitleWrapper, {
|
|
152
152
|
style: {
|
|
153
153
|
color: titleColor
|
|
154
|
-
}
|
|
154
|
+
},
|
|
155
|
+
"data-testid": testId
|
|
155
156
|
}, link ? /*#__PURE__*/React.createElement(LinkAppearance, {
|
|
156
157
|
href: link,
|
|
157
158
|
onClick: this.handleClick,
|
|
@@ -35,6 +35,7 @@ export var InlineCardResolvedView = /*#__PURE__*/function (_React$Component) {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
return /*#__PURE__*/React.createElement(LozengeBlockWrapper, null, /*#__PURE__*/React.createElement(LozengeWrapper, null, /*#__PURE__*/React.createElement(Lozenge, {
|
|
38
|
+
testId: "inline-card-resolved-view-lozenge",
|
|
38
39
|
appearance: lozenge.appearance || 'default',
|
|
39
40
|
isBold: lozenge.isBold
|
|
40
41
|
}, lozenge.text)));
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { normalizeUrl } from '@atlaskit/linking-common/url';
|
|
4
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
5
|
+
import { ANALYTICS_CHANNEL } from '../../../../utils/analytics';
|
|
4
6
|
export var useLinkWarningModal = function useLinkWarningModal() {
|
|
5
7
|
var _useState = useState(null),
|
|
6
8
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -16,6 +18,18 @@ export var useLinkWarningModal = function useLinkWarningModal() {
|
|
|
16
18
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
17
19
|
isOpen = _useState6[0],
|
|
18
20
|
setIsOpen = _useState6[1];
|
|
21
|
+
|
|
22
|
+
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
23
|
+
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
24
|
+
|
|
25
|
+
var sendAnalyticsEvent = function sendAnalyticsEvent() {
|
|
26
|
+
createAnalyticsEvent({
|
|
27
|
+
action: 'shown',
|
|
28
|
+
actionSubject: 'warningModal',
|
|
29
|
+
actionSubjectId: 'linkSafetyWarning',
|
|
30
|
+
eventType: 'operational'
|
|
31
|
+
}).fire(ANALYTICS_CHANNEL);
|
|
32
|
+
};
|
|
19
33
|
/**
|
|
20
34
|
* It checks and warns if a link text is a URL and different from an actual link destination
|
|
21
35
|
*/
|
|
@@ -37,6 +51,7 @@ export var useLinkWarningModal = function useLinkWarningModal() {
|
|
|
37
51
|
setUnsafeLinkText(linkText);
|
|
38
52
|
href && setUrl(href);
|
|
39
53
|
setIsOpen(true);
|
|
54
|
+
sendAnalyticsEvent();
|
|
40
55
|
}
|
|
41
56
|
};
|
|
42
57
|
|
|
@@ -5,6 +5,13 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
|
|
|
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';
|
|
9
|
+
import { name as packageName, version as packageVersion } from '../../version.json';
|
|
10
|
+
var PACKAGE_DATA = {
|
|
11
|
+
packageName: packageName,
|
|
12
|
+
packageVersion: packageVersion,
|
|
13
|
+
componentName: 'linkUrl'
|
|
14
|
+
};
|
|
8
15
|
|
|
9
16
|
var LinkUrl = function LinkUrl(_ref) {
|
|
10
17
|
var href = _ref.href,
|
|
@@ -30,4 +37,4 @@ var LinkUrl = function LinkUrl(_ref) {
|
|
|
30
37
|
}, props), children), checkSafety && /*#__PURE__*/React.createElement(LinkWarningModal, linkWarningModalProps));
|
|
31
38
|
};
|
|
32
39
|
|
|
33
|
-
export default LinkUrl;
|
|
40
|
+
export default withAnalyticsContext(PACKAGE_DATA)(LinkUrl);
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { LinkUrlProps } from './types';
|
|
3
|
-
declare const
|
|
4
|
-
|
|
3
|
+
declare const _default: React.ForwardRefExoticComponent<LinkUrlProps & {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
} & import("@atlaskit/analytics-next").WithContextProps & React.RefAttributes<any>>;
|
|
6
|
+
export default _default;
|
|
@@ -6,3 +6,8 @@ export interface LinkUrlProps extends React.AnchorHTMLAttributes<HTMLAnchorEleme
|
|
|
6
6
|
checkSafety?: boolean;
|
|
7
7
|
testId?: string;
|
|
8
8
|
}
|
|
9
|
+
export declare type PackageDataType = {
|
|
10
|
+
packageName: '@atlaskit/smart-card';
|
|
11
|
+
packageVersion: string;
|
|
12
|
+
componentName: 'linkUrl';
|
|
13
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "23.13.
|
|
3
|
+
"version": "23.13.2",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@atlaskit/icon-object": "^6.2.0",
|
|
34
34
|
"@atlaskit/icon-priority": "^6.3.0",
|
|
35
35
|
"@atlaskit/in-product-testing": "^0.1.0",
|
|
36
|
-
"@atlaskit/linking-common": "^1.
|
|
36
|
+
"@atlaskit/linking-common": "^1.20.0",
|
|
37
37
|
"@atlaskit/logo": "^13.10.0",
|
|
38
38
|
"@atlaskit/lozenge": "^11.3.0",
|
|
39
39
|
"@atlaskit/media-common": "^2.18.0",
|
|
@@ -91,13 +91,11 @@
|
|
|
91
91
|
"@testing-library/react": "^12.1.5",
|
|
92
92
|
"@testing-library/react-hooks": "^8.0.1",
|
|
93
93
|
"@testing-library/user-event": "^14.4.3",
|
|
94
|
-
"@types/enzyme": "^3.1.15",
|
|
95
94
|
"@types/lorem-ipsum": "^1.0.2",
|
|
96
95
|
"@types/react": "^16.8.0",
|
|
97
96
|
"@types/react-loadable": "^5.4.1",
|
|
98
97
|
"abortcontroller-polyfill": "^1.1.9",
|
|
99
98
|
"brace": "^0.11.1",
|
|
100
|
-
"enzyme": "^3.10.0",
|
|
101
99
|
"jest-emotion": "^10.0.32",
|
|
102
100
|
"jest-extended": "^0.11.2",
|
|
103
101
|
"jsdom": "^16.2.2",
|