@atlaskit/link-datasource 1.26.3 → 1.27.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/cjs/ui/common/modal/count-view-smart-link/index.js +40 -0
  3. package/dist/cjs/ui/{jira-issues-modal/modal/jira-display-view-dropdown/jira-display-view-drop-down.js → common/modal/display-view-dropdown/display-view-drop-down.js} +29 -13
  4. package/dist/cjs/ui/common/modal/display-view-dropdown/messages.js +58 -0
  5. package/dist/cjs/ui/confluence-search-modal/modal/index.js +114 -45
  6. package/dist/cjs/ui/confluence-search-modal/modal/messages.js +5 -0
  7. package/dist/cjs/ui/jira-issues-modal/modal/index.js +8 -23
  8. package/dist/cjs/ui/jira-issues-modal/modal/messages.js +0 -20
  9. package/dist/es2019/ui/common/modal/count-view-smart-link/index.js +30 -0
  10. package/dist/es2019/ui/common/modal/display-view-dropdown/display-view-drop-down.js +71 -0
  11. package/dist/es2019/ui/common/modal/display-view-dropdown/messages.js +52 -0
  12. package/dist/es2019/ui/confluence-search-modal/modal/index.js +98 -31
  13. package/dist/es2019/ui/confluence-search-modal/modal/messages.js +5 -0
  14. package/dist/es2019/ui/jira-issues-modal/modal/index.js +9 -24
  15. package/dist/es2019/ui/jira-issues-modal/modal/messages.js +0 -20
  16. package/dist/esm/ui/common/modal/count-view-smart-link/index.js +32 -0
  17. package/dist/esm/ui/common/modal/display-view-dropdown/display-view-drop-down.js +73 -0
  18. package/dist/esm/ui/common/modal/display-view-dropdown/messages.js +52 -0
  19. package/dist/esm/ui/confluence-search-modal/modal/index.js +114 -45
  20. package/dist/esm/ui/confluence-search-modal/modal/messages.js +5 -0
  21. package/dist/esm/ui/jira-issues-modal/modal/index.js +9 -24
  22. package/dist/esm/ui/jira-issues-modal/modal/messages.js +0 -20
  23. package/dist/types/common/types.d.ts +5 -5
  24. package/dist/types/ui/common/modal/count-view-smart-link/index.d.ts +9 -0
  25. package/dist/types/ui/common/modal/display-view-dropdown/display-view-drop-down.d.ts +8 -0
  26. package/dist/types/ui/common/modal/display-view-dropdown/messages.d.ts +42 -0
  27. package/dist/types/ui/confluence-search-modal/modal/messages.d.ts +5 -0
  28. package/dist/types/ui/confluence-search-modal/types.d.ts +2 -2
  29. package/dist/types/ui/jira-issues-modal/modal/messages.d.ts +0 -20
  30. package/dist/types-ts4.5/common/types.d.ts +5 -5
  31. package/dist/types-ts4.5/ui/common/modal/count-view-smart-link/index.d.ts +9 -0
  32. package/dist/types-ts4.5/ui/common/modal/display-view-dropdown/display-view-drop-down.d.ts +8 -0
  33. package/dist/types-ts4.5/ui/common/modal/display-view-dropdown/messages.d.ts +42 -0
  34. package/dist/types-ts4.5/ui/confluence-search-modal/modal/messages.d.ts +5 -0
  35. package/dist/types-ts4.5/ui/confluence-search-modal/types.d.ts +2 -2
  36. package/dist/types-ts4.5/ui/jira-issues-modal/modal/messages.d.ts +0 -20
  37. package/examples-helpers/mockSmartLinkData.ts +49 -0
  38. package/examples-helpers/smartLinkCustomClient.ts +8 -3
  39. package/package.json +1 -1
  40. package/dist/es2019/ui/jira-issues-modal/modal/jira-display-view-dropdown/jira-display-view-drop-down.js +0 -55
  41. package/dist/esm/ui/jira-issues-modal/modal/jira-display-view-dropdown/jira-display-view-drop-down.js +0 -57
  42. package/dist/types/ui/jira-issues-modal/modal/jira-display-view-dropdown/jira-display-view-drop-down.d.ts +0 -8
  43. package/dist/types-ts4.5/ui/jira-issues-modal/modal/jira-display-view-dropdown/jira-display-view-drop-down.d.ts +0 -8
@@ -108,4 +108,53 @@ export const mocks = {
108
108
  url: 'https://some.url',
109
109
  },
110
110
  } as JsonLd.Response,
111
+ confluenceSearchResolved: {
112
+ meta: {
113
+ auth: [],
114
+ definitionId: 'confluence-object-provider',
115
+ product: 'confluence',
116
+ visibility: 'restricted',
117
+ access: 'granted',
118
+ resourceType: 'search',
119
+ objectId: 'text=searchsomething',
120
+ tenantId: 'DUMMY-a5a01d21-1cc3-4f29-9565-f2bb8cd969f5',
121
+ category: 'object',
122
+ key: 'confluence-object-provider',
123
+ },
124
+ data: {
125
+ '@context': {
126
+ '@vocab': 'https://www.w3.org/ns/activitystreams#',
127
+ atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
128
+ schema: 'http://schema.org/',
129
+ },
130
+ generator: {
131
+ '@type': 'Application',
132
+ '@id': 'https://www.atlassian.com/#Confluence',
133
+ name: 'Confluence',
134
+ icon: {
135
+ '@type': 'Image',
136
+ url: 'https://cdn.bfldr.com/K3MHR9G8/at/hcwrtqnwvz33bn73b84ncpt5/confluence-mark-contained-gradient-blue.svg?auto=webp&format=png&width=320&height=320',
137
+ },
138
+ },
139
+ '@type': ['Object'],
140
+ url: 'https://pug.jira-dev.com/wiki/search?text=searchsomething',
141
+ name: '55 Results',
142
+ 'atlassian:titlePrefix': {
143
+ text: '',
144
+ '@type': 'atlassian:Emoji',
145
+ },
146
+ },
147
+ datasources: [
148
+ {
149
+ key: 'datasource-confluence-search',
150
+ parameters: {
151
+ searchString: 'searchsomething',
152
+ },
153
+ id: '768fc736-3af4-4a8f-b27e-203602bff8ca',
154
+ ari: 'ari:cloud:linking-platform::datasource/768fc736-3af4-4a8f-b27e-203602bff8ca',
155
+ description: 'For extracting a list of Confluence search results',
156
+ name: 'Confluence search',
157
+ },
158
+ ],
159
+ } as JsonLd.Response,
111
160
  };
@@ -6,9 +6,16 @@ import { APIError } from '@atlaskit/linking-common';
6
6
  import { mockJqlSmartLinkData } from './mockJqlSmartLinkData';
7
7
  import { mocks } from './mockSmartLinkData';
8
8
 
9
- const jqlUrlRegExp = /.+[jql=].+/;
9
+ const jqlUrlRegExp = /.*[?&]jql=.*/;
10
+ const confluenceSearchRegExp = /^https?:\/\/[^\/]+\/wiki\/spaces\/.*/;
10
11
 
11
12
  const mockedFetch = (url: string): Promise<JsonLd.Response> => {
13
+ if (confluenceSearchRegExp.test(url)) {
14
+ return Promise.resolve(mocks.confluenceSearchResolved);
15
+ }
16
+ if (jqlUrlRegExp.test(url)) {
17
+ return Promise.resolve(mockJqlSmartLinkData.resolved);
18
+ }
12
19
  switch (url) {
13
20
  case 'https://product-fabric.atlassian.net/browse/EDM-5941':
14
21
  case 'https://product-fabric.atlassian.net/browse/EDM-5591':
@@ -30,8 +37,6 @@ const mockedFetch = (url: string): Promise<JsonLd.Response> => {
30
37
  'received unsupported error',
31
38
  'ResolveUnsupportedError',
32
39
  );
33
- case jqlUrlRegExp.test(url) ? url : undefined:
34
- return Promise.resolve(mockJqlSmartLinkData.resolved);
35
40
  default:
36
41
  return Promise.resolve(mocks.unauthorized);
37
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "1.26.3",
3
+ "version": "1.27.0",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -1,55 +0,0 @@
1
- /** @jsx jsx */
2
- import { jsx } from '@emotion/react';
3
- import { FormattedMessage, useIntl } from 'react-intl-next';
4
- import DropdownMenu, { DropdownItem, DropdownItemGroup } from '@atlaskit/dropdown-menu';
5
- import TableIcon from '@atlaskit/icon/glyph/table';
6
- import { Box, xcss } from '@atlaskit/primitives';
7
- import { modalMessages } from '../messages';
8
- const dropDownItemGroupStyles = xcss({
9
- width: '320px',
10
- height: '140px',
11
- paddingTop: 'space.050',
12
- paddingBottom: 'space.050',
13
- borderRadius: 'border.radius'
14
- });
15
- const InlineIcon = jsx("svg", {
16
- xmlns: "http://www.w3.org/2000/svg",
17
- width: "24",
18
- height: "24",
19
- viewBox: "0 0 24 24",
20
- fill: "none"
21
- }, jsx("path", {
22
- fillRule: "evenodd",
23
- clipRule: "evenodd",
24
- d: "M4 9C2.89543 9 2 9.67155 2 10.5V13.5C2 14.3285 2.89543 15 4 15H20C21.1046 15 22 14.3285 22 13.5V10.5C22 9.67155 21.1046 9 20 9H4ZM4.22222 11.25C4.22222 10.5 4.22222 10.5 5 10.5H7C7.55556 10.5 7.55556 10.5 7.55556 11.25V13C7.55556 13.5 7.55556 13.5 7 13.5H5C4.22222 13.5 4.22222 13.5 4.22222 13V11.25ZM9 12C9 11.7929 9.2239 11.625 9.5 11.625H19.5C19.7761 11.625 20 11.7929 20 12C20 12.2071 19.7761 12.375 19.5 12.375H9.5C9.2239 12.375 9 12.2071 9 12Z",
25
- fill: 'currentColor'
26
- }));
27
- export const JiraDisplayViewDropDown = ({
28
- onViewModeChange,
29
- viewMode
30
- }) => {
31
- const {
32
- formatMessage
33
- } = useIntl();
34
- const triggerText = viewMode === 'issue' ? formatMessage(modalMessages.tableViewModeLabel) : formatMessage(modalMessages.inlineLinkViewModeLabel);
35
- return jsx(DropdownMenu, {
36
- trigger: triggerText,
37
- testId: "jira-datasource-modal--view-drop-down"
38
- }, jsx(Box, {
39
- xcss: dropDownItemGroupStyles
40
- }, jsx(DropdownItemGroup, null, jsx(DropdownItem, {
41
- testId: "dropdown-item-table",
42
- onClick: () => onViewModeChange('issue'),
43
- isSelected: viewMode === 'issue',
44
- description: formatMessage(modalMessages.tableViewModeDescription),
45
- elemBefore: jsx(TableIcon, {
46
- label: "table icon"
47
- })
48
- }, jsx(FormattedMessage, modalMessages.tableViewModeLabel)), jsx(DropdownItem, {
49
- testId: "dropdown-item-inline-link",
50
- onClick: () => onViewModeChange('count'),
51
- isSelected: viewMode === 'count',
52
- description: formatMessage(modalMessages.inlineLinkViewModeDescription),
53
- elemBefore: InlineIcon
54
- }, jsx(FormattedMessage, modalMessages.inlineLinkViewModeLabel)))));
55
- };
@@ -1,57 +0,0 @@
1
- /** @jsx jsx */
2
- import { jsx } from '@emotion/react';
3
- import { FormattedMessage, useIntl } from 'react-intl-next';
4
- import DropdownMenu, { DropdownItem, DropdownItemGroup } from '@atlaskit/dropdown-menu';
5
- import TableIcon from '@atlaskit/icon/glyph/table';
6
- import { Box, xcss } from '@atlaskit/primitives';
7
- import { modalMessages } from '../messages';
8
- var dropDownItemGroupStyles = xcss({
9
- width: '320px',
10
- height: '140px',
11
- paddingTop: 'space.050',
12
- paddingBottom: 'space.050',
13
- borderRadius: 'border.radius'
14
- });
15
- var InlineIcon = jsx("svg", {
16
- xmlns: "http://www.w3.org/2000/svg",
17
- width: "24",
18
- height: "24",
19
- viewBox: "0 0 24 24",
20
- fill: "none"
21
- }, jsx("path", {
22
- fillRule: "evenodd",
23
- clipRule: "evenodd",
24
- d: "M4 9C2.89543 9 2 9.67155 2 10.5V13.5C2 14.3285 2.89543 15 4 15H20C21.1046 15 22 14.3285 22 13.5V10.5C22 9.67155 21.1046 9 20 9H4ZM4.22222 11.25C4.22222 10.5 4.22222 10.5 5 10.5H7C7.55556 10.5 7.55556 10.5 7.55556 11.25V13C7.55556 13.5 7.55556 13.5 7 13.5H5C4.22222 13.5 4.22222 13.5 4.22222 13V11.25ZM9 12C9 11.7929 9.2239 11.625 9.5 11.625H19.5C19.7761 11.625 20 11.7929 20 12C20 12.2071 19.7761 12.375 19.5 12.375H9.5C9.2239 12.375 9 12.2071 9 12Z",
25
- fill: 'currentColor'
26
- }));
27
- export var JiraDisplayViewDropDown = function JiraDisplayViewDropDown(_ref) {
28
- var onViewModeChange = _ref.onViewModeChange,
29
- viewMode = _ref.viewMode;
30
- var _useIntl = useIntl(),
31
- formatMessage = _useIntl.formatMessage;
32
- var triggerText = viewMode === 'issue' ? formatMessage(modalMessages.tableViewModeLabel) : formatMessage(modalMessages.inlineLinkViewModeLabel);
33
- return jsx(DropdownMenu, {
34
- trigger: triggerText,
35
- testId: "jira-datasource-modal--view-drop-down"
36
- }, jsx(Box, {
37
- xcss: dropDownItemGroupStyles
38
- }, jsx(DropdownItemGroup, null, jsx(DropdownItem, {
39
- testId: "dropdown-item-table",
40
- onClick: function onClick() {
41
- return onViewModeChange('issue');
42
- },
43
- isSelected: viewMode === 'issue',
44
- description: formatMessage(modalMessages.tableViewModeDescription),
45
- elemBefore: jsx(TableIcon, {
46
- label: "table icon"
47
- })
48
- }, jsx(FormattedMessage, modalMessages.tableViewModeLabel)), jsx(DropdownItem, {
49
- testId: "dropdown-item-inline-link",
50
- onClick: function onClick() {
51
- return onViewModeChange('count');
52
- },
53
- isSelected: viewMode === 'count',
54
- description: formatMessage(modalMessages.inlineLinkViewModeDescription),
55
- elemBefore: InlineIcon
56
- }, jsx(FormattedMessage, modalMessages.inlineLinkViewModeLabel)))));
57
- };
@@ -1,8 +0,0 @@
1
- /** @jsx jsx */
2
- import { jsx } from '@emotion/react';
3
- import { IssueViewModes } from '../../../../common/types';
4
- export type JiraDisplayViewDropDownProps = {
5
- onViewModeChange: (value: IssueViewModes) => void;
6
- viewMode: IssueViewModes;
7
- };
8
- export declare const JiraDisplayViewDropDown: ({ onViewModeChange, viewMode, }: JiraDisplayViewDropDownProps) => jsx.JSX.Element;
@@ -1,8 +0,0 @@
1
- /** @jsx jsx */
2
- import { jsx } from '@emotion/react';
3
- import { IssueViewModes } from '../../../../common/types';
4
- export type JiraDisplayViewDropDownProps = {
5
- onViewModeChange: (value: IssueViewModes) => void;
6
- viewMode: IssueViewModes;
7
- };
8
- export declare const JiraDisplayViewDropDown: ({ onViewModeChange, viewMode, }: JiraDisplayViewDropDownProps) => jsx.JSX.Element;