@atlaskit/link-datasource 1.20.0 → 1.22.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 (46) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/common/utils/adf.js +15 -0
  3. package/dist/cjs/hooks/useDatasourceTableState.js +91 -88
  4. package/dist/cjs/index.js +7 -0
  5. package/dist/cjs/ui/assets-modal/modal/index.js +18 -22
  6. package/dist/cjs/ui/common/error-state/messages.js +20 -0
  7. package/dist/cjs/ui/common/error-state/provider-auth-required-svg.js +449 -0
  8. package/dist/cjs/ui/common/error-state/provider-auth-required.js +96 -0
  9. package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +16 -7
  10. package/dist/cjs/ui/jira-issues-modal/modal/index.js +18 -23
  11. package/dist/es2019/common/utils/adf.js +9 -0
  12. package/dist/es2019/hooks/useDatasourceTableState.js +26 -24
  13. package/dist/es2019/index.js +1 -0
  14. package/dist/es2019/ui/assets-modal/modal/index.js +16 -20
  15. package/dist/es2019/ui/common/error-state/messages.js +20 -0
  16. package/dist/es2019/ui/common/error-state/provider-auth-required-svg.js +442 -0
  17. package/dist/es2019/ui/common/error-state/provider-auth-required.js +62 -0
  18. package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +16 -7
  19. package/dist/es2019/ui/jira-issues-modal/modal/index.js +16 -21
  20. package/dist/esm/common/utils/adf.js +9 -0
  21. package/dist/esm/hooks/useDatasourceTableState.js +91 -88
  22. package/dist/esm/index.js +1 -0
  23. package/dist/esm/ui/assets-modal/modal/index.js +18 -22
  24. package/dist/esm/ui/common/error-state/messages.js +20 -0
  25. package/dist/esm/ui/common/error-state/provider-auth-required-svg.js +442 -0
  26. package/dist/esm/ui/common/error-state/provider-auth-required.js +85 -0
  27. package/dist/esm/ui/datasource-table-view/datasourceTableView.js +16 -7
  28. package/dist/esm/ui/jira-issues-modal/modal/index.js +18 -23
  29. package/dist/types/common/utils/adf.d.ts +2 -0
  30. package/dist/types/hooks/useDatasourceTableState.d.ts +3 -1
  31. package/dist/types/index.d.ts +1 -0
  32. package/dist/types/ui/assets-modal/types.d.ts +1 -1
  33. package/dist/types/ui/common/error-state/messages.d.ts +20 -0
  34. package/dist/types/ui/common/error-state/provider-auth-required-svg.d.ts +3 -0
  35. package/dist/types/ui/common/error-state/provider-auth-required.d.ts +9 -0
  36. package/dist/types/ui/jira-issues-modal/types.d.ts +1 -20
  37. package/dist/types-ts4.5/common/utils/adf.d.ts +2 -0
  38. package/dist/types-ts4.5/hooks/useDatasourceTableState.d.ts +3 -1
  39. package/dist/types-ts4.5/index.d.ts +1 -0
  40. package/dist/types-ts4.5/ui/assets-modal/types.d.ts +1 -1
  41. package/dist/types-ts4.5/ui/common/error-state/messages.d.ts +20 -0
  42. package/dist/types-ts4.5/ui/common/error-state/provider-auth-required-svg.d.ts +3 -0
  43. package/dist/types-ts4.5/ui/common/error-state/provider-auth-required.d.ts +9 -0
  44. package/dist/types-ts4.5/ui/jira-issues-modal/types.d.ts +1 -20
  45. package/examples-helpers/buildJiraIssuesTable.tsx +34 -6
  46. package/package.json +4 -3
@@ -1,4 +1,4 @@
1
- import { DatasourceDataResponseItem, DatasourceParameters, DatasourceResponseSchemaProperty, DatasourceTableStatusType } from '@atlaskit/linking-types';
1
+ import { DatasourceDataResponseItem, DatasourceMeta, DatasourceParameters, DatasourceResponseSchemaProperty, DatasourceTableStatusType } from '@atlaskit/linking-types';
2
2
  export interface onNextPageProps {
3
3
  isSchemaFromData?: boolean;
4
4
  shouldRequestFirstPage?: boolean;
@@ -34,6 +34,8 @@ export interface DatasourceTableState {
34
34
  destinationObjectTypes: string[];
35
35
  /** Used as an indicated of which provider type is being used - originates from ORS */
36
36
  extensionKey?: string;
37
+ /** Auth info used to connect to the provider account. */
38
+ authDetails?: DatasourceMeta['auth'];
37
39
  }
38
40
  export interface DatasourceTableStateProps {
39
41
  /** Unique identifier for which type of datasource is being rendered and for making its requests */
@@ -2,6 +2,7 @@ export { default as JiraIssuesConfigModal } from './ui/jira-issues-modal';
2
2
  export { default as AssetsConfigModal } from './ui/assets-modal';
3
3
  export { default as DatasourceTableView } from './ui/datasource-table-view';
4
4
  export { default as JSMAssetsConfigModal } from './ui/assets-modal';
5
+ export { buildDatasourceAdf } from './common/utils/adf';
5
6
  export type { JiraIssuesDatasourceAdf, JiraIssueDatasourceParameters, } from './ui/jira-issues-modal/types';
6
7
  export type { AssetsDatasourceAdf, AssetsDatasourceParameters, } from './ui/assets-modal/types';
7
8
  export { JIRA_LIST_OF_LINKS_DATASOURCE_ID } from './ui/jira-issues-modal';
@@ -1,6 +1,6 @@
1
1
  import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
2
2
  import { DatasourceAdf, DatasourceAdfView, InlineCardAdf } from '@atlaskit/linking-common/types';
3
- export interface AssetsDatasourceParameters {
3
+ export interface AssetsDatasourceParameters extends Record<string, unknown> {
4
4
  workspaceId: string;
5
5
  aql: string;
6
6
  schemaId: string;
@@ -54,4 +54,24 @@ export declare const loadingErrorMessages: {
54
54
  description: string;
55
55
  defaultMessage: string;
56
56
  };
57
+ authScreenHeaderText: {
58
+ id: string;
59
+ defaultMessage: string;
60
+ description: string;
61
+ };
62
+ authScreenDescriptionText: {
63
+ id: string;
64
+ defaultMessage: string;
65
+ description: string;
66
+ };
67
+ learnMoreAboutSmartLinks: {
68
+ id: string;
69
+ defaultMessage: string;
70
+ description: string;
71
+ };
72
+ authConnectButtonText: {
73
+ id: string;
74
+ defaultMessage: string;
75
+ description: string;
76
+ };
57
77
  };
@@ -0,0 +1,3 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ export declare const ProviderAuthRequiredSVG: () => jsx.JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { jsx } from '@emotion/react';
2
+ import { DatasourceMeta } from '@atlaskit/linking-types';
3
+ interface ProviderAuthRequiredProps {
4
+ auth: DatasourceMeta['auth'];
5
+ onAuthSuccess: () => void;
6
+ onAuthError: () => void;
7
+ }
8
+ export declare const ProviderAuthRequired: ({ auth, onAuthSuccess, onAuthError, }: ProviderAuthRequiredProps) => jsx.JSX.Element;
9
+ export {};
@@ -19,26 +19,7 @@ export interface Site {
19
19
  displayName: string;
20
20
  url: string;
21
21
  }
22
- export interface JiraIssuesDatasourceAdf extends DatasourceAdf {
23
- attrs: {
24
- url?: string;
25
- datasource: {
26
- id: string;
27
- parameters: JiraIssueDatasourceParameters;
28
- views: [
29
- {
30
- type: 'table';
31
- properties?: {
32
- columns: {
33
- key: string;
34
- width?: number;
35
- }[];
36
- };
37
- }
38
- ];
39
- };
40
- };
41
- }
22
+ export type JiraIssuesDatasourceAdf = DatasourceAdf<JiraIssueDatasourceParameters>;
42
23
  export interface JiraIssuesConfigModalProps {
43
24
  /** Unique identifier for which type of datasource is being rendered and for making its requests */
44
25
  datasourceId: string;
@@ -0,0 +1,2 @@
1
+ import { Datasource, DatasourceAdf } from '@atlaskit/linking-common/types';
2
+ export declare const buildDatasourceAdf: <P extends Record<string, unknown>>(datasource: Datasource<P>, url?: string) => DatasourceAdf<P>;
@@ -1,4 +1,4 @@
1
- import { DatasourceDataResponseItem, DatasourceParameters, DatasourceResponseSchemaProperty, DatasourceTableStatusType } from '@atlaskit/linking-types';
1
+ import { DatasourceDataResponseItem, DatasourceMeta, DatasourceParameters, DatasourceResponseSchemaProperty, DatasourceTableStatusType } from '@atlaskit/linking-types';
2
2
  export interface onNextPageProps {
3
3
  isSchemaFromData?: boolean;
4
4
  shouldRequestFirstPage?: boolean;
@@ -34,6 +34,8 @@ export interface DatasourceTableState {
34
34
  destinationObjectTypes: string[];
35
35
  /** Used as an indicated of which provider type is being used - originates from ORS */
36
36
  extensionKey?: string;
37
+ /** Auth info used to connect to the provider account. */
38
+ authDetails?: DatasourceMeta['auth'];
37
39
  }
38
40
  export interface DatasourceTableStateProps {
39
41
  /** Unique identifier for which type of datasource is being rendered and for making its requests */
@@ -2,6 +2,7 @@ export { default as JiraIssuesConfigModal } from './ui/jira-issues-modal';
2
2
  export { default as AssetsConfigModal } from './ui/assets-modal';
3
3
  export { default as DatasourceTableView } from './ui/datasource-table-view';
4
4
  export { default as JSMAssetsConfigModal } from './ui/assets-modal';
5
+ export { buildDatasourceAdf } from './common/utils/adf';
5
6
  export type { JiraIssuesDatasourceAdf, JiraIssueDatasourceParameters, } from './ui/jira-issues-modal/types';
6
7
  export type { AssetsDatasourceAdf, AssetsDatasourceParameters, } from './ui/assets-modal/types';
7
8
  export { JIRA_LIST_OF_LINKS_DATASOURCE_ID } from './ui/jira-issues-modal';
@@ -1,6 +1,6 @@
1
1
  import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
2
2
  import { DatasourceAdf, DatasourceAdfView, InlineCardAdf } from '@atlaskit/linking-common/types';
3
- export interface AssetsDatasourceParameters {
3
+ export interface AssetsDatasourceParameters extends Record<string, unknown> {
4
4
  workspaceId: string;
5
5
  aql: string;
6
6
  schemaId: string;
@@ -54,4 +54,24 @@ export declare const loadingErrorMessages: {
54
54
  description: string;
55
55
  defaultMessage: string;
56
56
  };
57
+ authScreenHeaderText: {
58
+ id: string;
59
+ defaultMessage: string;
60
+ description: string;
61
+ };
62
+ authScreenDescriptionText: {
63
+ id: string;
64
+ defaultMessage: string;
65
+ description: string;
66
+ };
67
+ learnMoreAboutSmartLinks: {
68
+ id: string;
69
+ defaultMessage: string;
70
+ description: string;
71
+ };
72
+ authConnectButtonText: {
73
+ id: string;
74
+ defaultMessage: string;
75
+ description: string;
76
+ };
57
77
  };
@@ -0,0 +1,3 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ export declare const ProviderAuthRequiredSVG: () => jsx.JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { jsx } from '@emotion/react';
2
+ import { DatasourceMeta } from '@atlaskit/linking-types';
3
+ interface ProviderAuthRequiredProps {
4
+ auth: DatasourceMeta['auth'];
5
+ onAuthSuccess: () => void;
6
+ onAuthError: () => void;
7
+ }
8
+ export declare const ProviderAuthRequired: ({ auth, onAuthSuccess, onAuthError, }: ProviderAuthRequiredProps) => jsx.JSX.Element;
9
+ export {};
@@ -19,26 +19,7 @@ export interface Site {
19
19
  displayName: string;
20
20
  url: string;
21
21
  }
22
- export interface JiraIssuesDatasourceAdf extends DatasourceAdf {
23
- attrs: {
24
- url?: string;
25
- datasource: {
26
- id: string;
27
- parameters: JiraIssueDatasourceParameters;
28
- views: [
29
- {
30
- type: 'table';
31
- properties?: {
32
- columns: {
33
- key: string;
34
- width?: number;
35
- }[];
36
- };
37
- }
38
- ];
39
- };
40
- };
41
- }
22
+ export type JiraIssuesDatasourceAdf = DatasourceAdf<JiraIssueDatasourceParameters>;
42
23
  export interface JiraIssuesConfigModalProps {
43
24
  /** Unique identifier for which type of datasource is being rendered and for making its requests */
44
25
  datasourceId: string;
@@ -1,24 +1,33 @@
1
- import React, { useCallback, useMemo, useState } from 'react';
1
+ import React, { useCallback, useEffect, useMemo, useState } from 'react';
2
2
 
3
+ import { IntlProvider } from 'react-intl-next';
4
+
5
+ import { SmartCardProvider } from '@atlaskit/link-provider';
3
6
  import {
4
7
  defaultInitialVisibleColumnKeys,
5
8
  mockDatasourceFetchRequests,
6
9
  } from '@atlaskit/link-test-helpers/datasource';
10
+ import { DatasourceParameters } from '@atlaskit/linking-types';
7
11
 
8
12
  import { DatasourceTableView } from '../src';
9
13
  import { ColumnSizesMap } from '../src/ui/issue-like-table/types';
10
14
  import { JiraIssueDatasourceParameters } from '../src/ui/jira-issues-modal/types';
11
15
 
12
- mockDatasourceFetchRequests();
16
+ import SmartLinkClient from './smartLinkCustomClient';
17
+
18
+ interface JiraIssuesTableViewProps {
19
+ parameters?: DatasourceParameters;
20
+ mockDatasourceFetchRequest?: boolean;
21
+ }
13
22
 
14
- export const ExampleJiraIssuesTableView = () => {
15
- const cloudId = 'some-cloud-id';
23
+ const JiraIssuesTableView = ({ parameters }: JiraIssuesTableViewProps) => {
24
+ const cloudId = parameters?.cloudId || 'some-cloud-id';
16
25
 
17
26
  const [visibleColumnKeys, setVisibleColumnKeys] = useState<string[]>(
18
27
  defaultInitialVisibleColumnKeys,
19
28
  );
20
29
 
21
- const parameters = useMemo<JiraIssueDatasourceParameters>(
30
+ const datasourceParameters = useMemo<JiraIssueDatasourceParameters>(
22
31
  () => ({
23
32
  cloudId,
24
33
  jql: 'some-jql',
@@ -42,7 +51,7 @@ export const ExampleJiraIssuesTableView = () => {
42
51
  return (
43
52
  <DatasourceTableView
44
53
  datasourceId={'some-datasource-id'}
45
- parameters={parameters}
54
+ parameters={datasourceParameters}
46
55
  visibleColumnKeys={visibleColumnKeys}
47
56
  onVisibleColumnKeysChange={setVisibleColumnKeys}
48
57
  columnCustomSizes={columnCustomSizes}
@@ -50,3 +59,22 @@ export const ExampleJiraIssuesTableView = () => {
50
59
  />
51
60
  );
52
61
  };
62
+
63
+ export const ExampleJiraIssuesTableView = ({
64
+ parameters,
65
+ mockDatasourceFetchRequest = true,
66
+ }: JiraIssuesTableViewProps) => {
67
+ useEffect(() => {
68
+ if (mockDatasourceFetchRequest) {
69
+ mockDatasourceFetchRequests();
70
+ }
71
+ }, [mockDatasourceFetchRequest]);
72
+
73
+ return (
74
+ <IntlProvider locale="en">
75
+ <SmartCardProvider client={new SmartLinkClient()}>
76
+ <JiraIssuesTableView parameters={parameters} />
77
+ </SmartCardProvider>
78
+ </IntlProvider>
79
+ );
80
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "1.20.0",
3
+ "version": "1.22.0",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -35,8 +35,8 @@
35
35
  "@atlaskit/avatar": "^21.4.0",
36
36
  "@atlaskit/avatar-group": "^9.5.0",
37
37
  "@atlaskit/badge": "^15.2.0",
38
- "@atlaskit/button": "^17.2.0",
39
- "@atlaskit/dropdown-menu": "^12.2.0",
38
+ "@atlaskit/button": "^17.3.0",
39
+ "@atlaskit/dropdown-menu": "^12.3.0",
40
40
  "@atlaskit/editor-prosemirror": "1.1.0",
41
41
  "@atlaskit/empty-state": "^7.5.0",
42
42
  "@atlaskit/form": "^9.0.3",
@@ -53,6 +53,7 @@
53
53
  "@atlaskit/linking-types": "^8.6.0",
54
54
  "@atlaskit/lozenge": "^11.6.0",
55
55
  "@atlaskit/modal-dialog": "^12.10.0",
56
+ "@atlaskit/outbound-auth-flow-client": "^3.4.5",
56
57
  "@atlaskit/platform-feature-flags": "^0.2.4",
57
58
  "@atlaskit/pragmatic-drag-and-drop": "^0.25.0",
58
59
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^0.12.0",