@atlaskit/smart-card 23.12.3 → 23.13.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.
Files changed (62) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/extractors/common/icon/extractIcon.js +12 -6
  3. package/dist/cjs/extractors/common/icon/extractIconFromDocument.js +14 -7
  4. package/dist/cjs/extractors/common/icon/extractIconFromTask.js +25 -15
  5. package/dist/cjs/linkUrl.js +15 -0
  6. package/dist/cjs/messages.js +21 -1
  7. package/dist/cjs/utils/index.js +2 -1
  8. package/dist/cjs/version.json +1 -1
  9. package/dist/cjs/view/EmbedCard/components/ExpandedFrame.js +3 -1
  10. package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +2 -1
  11. package/dist/cjs/view/InlineCard/ErroredView/index.js +4 -2
  12. package/dist/cjs/view/InlineCard/ForbiddenView/index.js +6 -3
  13. package/dist/cjs/view/InlineCard/IconAndTitleLayout/index.js +2 -1
  14. package/dist/cjs/view/InlineCard/ResolvedView/index.js +1 -0
  15. package/dist/cjs/view/LinkUrl/LinkWarningModal/hooks/use-link-warning-modal.js +76 -0
  16. package/dist/cjs/view/LinkUrl/LinkWarningModal/index.js +70 -0
  17. package/dist/cjs/view/LinkUrl/index.js +48 -0
  18. package/dist/cjs/view/LinkUrl/types.js +5 -0
  19. package/dist/es2019/extractors/common/icon/extractIcon.js +12 -6
  20. package/dist/es2019/extractors/common/icon/extractIconFromDocument.js +14 -7
  21. package/dist/es2019/extractors/common/icon/extractIconFromTask.js +24 -15
  22. package/dist/es2019/linkUrl.js +1 -0
  23. package/dist/es2019/messages.js +21 -1
  24. package/dist/es2019/utils/index.js +2 -1
  25. package/dist/es2019/version.json +1 -1
  26. package/dist/es2019/view/EmbedCard/components/ExpandedFrame.js +3 -1
  27. package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +2 -1
  28. package/dist/es2019/view/InlineCard/ErroredView/index.js +4 -2
  29. package/dist/es2019/view/InlineCard/ForbiddenView/index.js +6 -3
  30. package/dist/es2019/view/InlineCard/IconAndTitleLayout/index.js +2 -1
  31. package/dist/es2019/view/InlineCard/ResolvedView/index.js +1 -0
  32. package/dist/es2019/view/LinkUrl/LinkWarningModal/hooks/use-link-warning-modal.js +49 -0
  33. package/dist/es2019/view/LinkUrl/LinkWarningModal/index.js +46 -0
  34. package/dist/es2019/view/LinkUrl/index.js +28 -0
  35. package/dist/es2019/view/LinkUrl/types.js +1 -0
  36. package/dist/esm/extractors/common/icon/extractIcon.js +12 -6
  37. package/dist/esm/extractors/common/icon/extractIconFromDocument.js +14 -7
  38. package/dist/esm/extractors/common/icon/extractIconFromTask.js +24 -15
  39. package/dist/esm/linkUrl.js +1 -0
  40. package/dist/esm/messages.js +21 -1
  41. package/dist/esm/utils/index.js +2 -1
  42. package/dist/esm/version.json +1 -1
  43. package/dist/esm/view/EmbedCard/components/ExpandedFrame.js +3 -1
  44. package/dist/esm/view/HoverCard/components/HoverCardComponent.js +2 -1
  45. package/dist/esm/view/InlineCard/ErroredView/index.js +4 -2
  46. package/dist/esm/view/InlineCard/ForbiddenView/index.js +6 -3
  47. package/dist/esm/view/InlineCard/IconAndTitleLayout/index.js +2 -1
  48. package/dist/esm/view/InlineCard/ResolvedView/index.js +1 -0
  49. package/dist/esm/view/LinkUrl/LinkWarningModal/hooks/use-link-warning-modal.js +62 -0
  50. package/dist/esm/view/LinkUrl/LinkWarningModal/index.js +46 -0
  51. package/dist/esm/view/LinkUrl/index.js +33 -0
  52. package/dist/esm/view/LinkUrl/types.js +1 -0
  53. package/dist/types/extractors/common/__mocks__/withIntl.d.ts +2 -0
  54. package/dist/types/linkUrl.d.ts +2 -0
  55. package/dist/types/messages.d.ts +1 -1
  56. package/dist/types/view/LinkUrl/LinkWarningModal/hooks/use-link-warning-modal.d.ts +9 -0
  57. package/dist/types/view/LinkUrl/LinkWarningModal/index.d.ts +13 -0
  58. package/dist/types/view/LinkUrl/index.d.ts +4 -0
  59. package/dist/types/view/LinkUrl/types.d.ts +8 -0
  60. package/link-url/package.json +15 -0
  61. package/package.json +3 -4
  62. package/dist/types/extractors/common/__mocks__/render.d.ts +0 -2
@@ -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 || /*#__PURE__*/React.createElement(TaskIcon, {
73
- label: taskLabel
74
- });
85
+ return taskType.icon || opts.icon || provider.icon || defaultIcon;
75
86
  }
76
87
  }
77
88
 
78
- return /*#__PURE__*/React.createElement(TaskIcon, {
79
- label: taskLabel
80
- });
89
+ return defaultIcon;
81
90
  };
@@ -0,0 +1 @@
1
+ export { default } from './view/LinkUrl';
@@ -40,6 +40,11 @@ export const messages = defineMessages({
40
40
  defaultMessage: 'Close',
41
41
  description: ''
42
42
  },
43
+ check_this_link: {
44
+ id: 'fabric.linking.check_this_link',
45
+ defaultMessage: 'Check this link',
46
+ description: 'Link safety warning modal header'
47
+ },
43
48
  connect_to: {
44
49
  id: 'fabric.linking.connect_to',
45
50
  defaultMessage: 'Connect to {name}',
@@ -85,8 +90,13 @@ export const messages = defineMessages({
85
90
  defaultMessage: 'Connect to Atlassian to view more details of your work and collaborate from one place.',
86
91
  description: 'Shown when a user does not have access to a link, but can connect their external account to view the link on card view and we do not have the providers name.'
87
92
  },
93
+ continue: {
94
+ id: 'fabric.linking.continue',
95
+ defaultMessage: 'Continue',
96
+ description: 'continue'
97
+ },
88
98
  copy_url_to_clipboard: {
89
- id: 'fabric.linking.download',
99
+ id: 'fabric.linking.copy_url_to_clipboard',
90
100
  defaultMessage: 'Copy link',
91
101
  description: ''
92
102
  },
@@ -130,6 +140,11 @@ export const messages = defineMessages({
130
140
  defaultMessage: 'You don’t have access to this preview. Contact the site admin if you need access.',
131
141
  description: 'Informs the user that they cannot view this content.'
132
142
  },
143
+ go_back: {
144
+ id: 'fabric.linking.go_back',
145
+ defaultMessage: 'Go back',
146
+ description: 'go back'
147
+ },
133
148
  invalid_permissions: {
134
149
  id: 'fabric.linking.invalid_permissions',
135
150
  defaultMessage: 'Restricted content',
@@ -335,6 +350,11 @@ export const messages = defineMessages({
335
350
  defaultMessage: 'Try another account',
336
351
  description: 'Allows the user to try an action again with a different account'
337
352
  },
353
+ link_safety_warning_message: {
354
+ id: 'fabric.linking.link_safety_warning_message',
355
+ defaultMessage: 'The link {unsafeLinkText} is taking you to a different site, <a>actual link here</a>',
356
+ description: 'Link safety check warning message'
357
+ },
338
358
  unlink_account: {
339
359
  id: 'fabric.linking.unlink_account',
340
360
  defaultMessage: 'Unlink Account',
@@ -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 => {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "23.12.3",
3
+ "version": "23.13.1",
4
4
  "sideEffects": false
5
5
  }
@@ -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)));
@@ -0,0 +1,49 @@
1
+ import { useState } from 'react';
2
+ import { normalizeUrl } from '@atlaskit/linking-common/url';
3
+ export const useLinkWarningModal = () => {
4
+ const [unsafeLinkText, setUnsafeLinkText] = useState(null);
5
+ const [url, setUrl] = useState(null);
6
+ const [isOpen, setIsOpen] = useState(false);
7
+ /**
8
+ * It checks and warns if a link text is a URL and different from an actual link destination
9
+ */
10
+
11
+ const checkLinkSafety = (event, href) => {
12
+ const linkText = event.currentTarget.innerText;
13
+ const anchorLinkRegex = new RegExp(/^#/im);
14
+ const isAnchorLink = anchorLinkRegex.test(linkText);
15
+
16
+ if (isAnchorLink) {
17
+ return;
18
+ }
19
+
20
+ const normalisedUrlFromLinkText = normalizeUrl(linkText);
21
+
22
+ if (!!normalisedUrlFromLinkText && normalisedUrlFromLinkText !== href) {
23
+ event.preventDefault();
24
+ setUnsafeLinkText(linkText);
25
+ href && setUrl(href);
26
+ setIsOpen(true);
27
+ }
28
+ };
29
+
30
+ const onClose = () => {
31
+ setIsOpen(false);
32
+ setUnsafeLinkText(null);
33
+ setUrl(null);
34
+ };
35
+
36
+ const onContinue = () => {
37
+ onClose();
38
+ url && window.location.assign(url);
39
+ };
40
+
41
+ return {
42
+ checkLinkSafety,
43
+ unsafeLinkText,
44
+ onClose,
45
+ onContinue,
46
+ isOpen,
47
+ url
48
+ };
49
+ };
@@ -0,0 +1,46 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React from 'react';
3
+ import Button from '@atlaskit/button/standard-button';
4
+ import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
5
+ import { FormattedMessage, IntlProvider, injectIntl } from 'react-intl-next';
6
+ import { messages } from '../../../messages';
7
+
8
+ const WarningModal = props => {
9
+ const {
10
+ isOpen,
11
+ unsafeLinkText,
12
+ url,
13
+ onClose,
14
+ onContinue,
15
+ intl
16
+ } = props;
17
+ const content = /*#__PURE__*/React.createElement(ModalTransition, null, isOpen && /*#__PURE__*/React.createElement(Modal, {
18
+ onClose: onClose,
19
+ testId: "link-with-safety-warning"
20
+ }, /*#__PURE__*/React.createElement(ModalHeader, null, /*#__PURE__*/React.createElement(ModalTitle, {
21
+ appearance: "warning"
22
+ }, /*#__PURE__*/React.createElement(FormattedMessage, messages.check_this_link))), /*#__PURE__*/React.createElement(ModalBody, null, url && unsafeLinkText && /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.link_safety_warning_message, {
23
+ values: {
24
+ unsafeLinkText: unsafeLinkText,
25
+ a: () => /*#__PURE__*/React.createElement("a", {
26
+ href: url,
27
+ target: "_blank",
28
+ rel: "noopener noreferrer"
29
+ }, url)
30
+ }
31
+ }))), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
32
+ appearance: "subtle",
33
+ onClick: onClose
34
+ }, /*#__PURE__*/React.createElement(FormattedMessage, messages.go_back)), /*#__PURE__*/React.createElement(Button, {
35
+ appearance: "warning",
36
+ onClick: onContinue,
37
+ autoFocus: true
38
+ }, /*#__PURE__*/React.createElement(FormattedMessage, messages.continue)))));
39
+ return intl ? content : /*#__PURE__*/React.createElement(IntlProvider, {
40
+ locale: "en"
41
+ }, content);
42
+ };
43
+
44
+ export default injectIntl(WarningModal, {
45
+ enforceContext: false
46
+ });
@@ -0,0 +1,28 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React from 'react';
3
+ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
4
+ import LinkWarningModal from './LinkWarningModal';
5
+
6
+ const LinkUrl = ({
7
+ href,
8
+ children,
9
+ checkSafety = true,
10
+ onClick,
11
+ testId = 'link-with-safety',
12
+ ...props
13
+ }) => {
14
+ const {
15
+ checkLinkSafety,
16
+ ...linkWarningModalProps
17
+ } = useLinkWarningModal();
18
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("a", _extends({
19
+ "data-testid": testId,
20
+ href: href,
21
+ onClick: e => {
22
+ checkSafety && checkLinkSafety(e, href);
23
+ onClick && onClick(e);
24
+ }
25
+ }, props), children), checkSafety && /*#__PURE__*/React.createElement(LinkWarningModal, linkWarningModalProps));
26
+ };
27
+
28
+ export default LinkUrl;
@@ -0,0 +1 @@
1
+ export {};
@@ -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 || /*#__PURE__*/React.createElement(TaskIcon, {
71
- label: taskLabel
72
- });
83
+ return taskType.icon || opts.icon || provider.icon || defaultIcon;
73
84
  }
74
85
  }
75
86
 
76
- return /*#__PURE__*/React.createElement(TaskIcon, {
77
- label: taskLabel
78
- });
87
+ return defaultIcon;
79
88
  };
@@ -0,0 +1 @@
1
+ export { default } from './view/LinkUrl';