@atlaskit/editor-plugin-card 0.9.0 → 0.9.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.
Files changed (78) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/analytics/create-events-queue.js +2 -3
  3. package/dist/cjs/analytics/events-from-tr.js +1 -2
  4. package/dist/cjs/analytics/types.js +3 -5
  5. package/dist/cjs/analytics/utils.js +8 -13
  6. package/dist/cjs/datasourceErrorBoundary.js +8 -6
  7. package/dist/cjs/messages.js +2 -3
  8. package/dist/cjs/nodeviews/blockCard.js +3 -5
  9. package/dist/cjs/nodeviews/datasource.js +7 -28
  10. package/dist/cjs/nodeviews/embedCard.js +4 -6
  11. package/dist/cjs/nodeviews/genericCard.js +1 -1
  12. package/dist/cjs/nodeviews/inlineCard.js +1 -2
  13. package/dist/cjs/plugin.js +3 -4
  14. package/dist/cjs/pm-plugins/actions.js +14 -27
  15. package/dist/cjs/pm-plugins/doc.js +23 -36
  16. package/dist/cjs/pm-plugins/main.js +8 -9
  17. package/dist/cjs/pm-plugins/mountHyperlink.js +6 -7
  18. package/dist/cjs/pm-plugins/plugin-key.js +1 -2
  19. package/dist/cjs/pm-plugins/reducers.js +2 -3
  20. package/dist/cjs/pm-plugins/util/resolve.js +3 -5
  21. package/dist/cjs/pm-plugins/util/state.js +3 -6
  22. package/dist/cjs/toolbar.js +12 -16
  23. package/dist/cjs/ui/CardContextProvider.js +1 -2
  24. package/dist/cjs/ui/DatasourceModal/ModalWithState.js +13 -6
  25. package/dist/cjs/ui/DatasourceModal/index.js +26 -11
  26. package/dist/cjs/ui/EditDatasourceButton.js +30 -70
  27. package/dist/cjs/ui/EditLinkToolbar.js +11 -15
  28. package/dist/cjs/ui/EditorAnalyticsContext.js +2 -3
  29. package/dist/cjs/ui/EditorLinkingPlatformAnalytics/DatasourceEvents.js +7 -8
  30. package/dist/cjs/ui/EditorLinkingPlatformAnalytics/LinkEvents.js +2 -3
  31. package/dist/cjs/ui/EditorLinkingPlatformAnalytics/common.js +5 -9
  32. package/dist/cjs/ui/EditorLinkingPlatformAnalytics/index.js +1 -2
  33. package/dist/cjs/ui/EditorSmartCardEvents.js +2 -3
  34. package/dist/cjs/ui/HyperlinkToolbarAppearance.js +2 -3
  35. package/dist/cjs/ui/LayoutButton/index.js +3 -5
  36. package/dist/cjs/ui/LayoutButton/utils.js +2 -3
  37. package/dist/cjs/ui/LinkToolbarAppearance.js +3 -4
  38. package/dist/cjs/ui/ResizableEmbedCard.js +1 -2
  39. package/dist/cjs/ui/ToolbarViewedEvent.js +2 -3
  40. package/dist/cjs/ui/useFetchDatasourceInfo.js +86 -0
  41. package/dist/cjs/utils.js +7 -13
  42. package/dist/es2019/datasourceErrorBoundary.js +7 -4
  43. package/dist/es2019/nodeviews/datasource.js +0 -22
  44. package/dist/es2019/ui/DatasourceModal/ModalWithState.js +10 -3
  45. package/dist/es2019/ui/DatasourceModal/index.js +23 -6
  46. package/dist/es2019/ui/EditDatasourceButton.js +11 -15
  47. package/dist/es2019/ui/useFetchDatasourceInfo.js +45 -0
  48. package/dist/esm/analytics/utils.js +2 -2
  49. package/dist/esm/datasourceErrorBoundary.js +7 -4
  50. package/dist/esm/nodeviews/datasource.js +4 -23
  51. package/dist/esm/nodeviews/embedCard.js +1 -1
  52. package/dist/esm/nodeviews/genericCard.js +1 -1
  53. package/dist/esm/plugin.js +1 -1
  54. package/dist/esm/pm-plugins/doc.js +9 -9
  55. package/dist/esm/pm-plugins/main.js +6 -6
  56. package/dist/esm/pm-plugins/mountHyperlink.js +4 -4
  57. package/dist/esm/toolbar.js +8 -8
  58. package/dist/esm/ui/DatasourceModal/ModalWithState.js +12 -4
  59. package/dist/esm/ui/DatasourceModal/index.js +24 -8
  60. package/dist/esm/ui/EditDatasourceButton.js +20 -57
  61. package/dist/esm/ui/EditLinkToolbar.js +6 -6
  62. package/dist/esm/ui/EditorLinkingPlatformAnalytics/DatasourceEvents.js +5 -5
  63. package/dist/esm/ui/LayoutButton/index.js +1 -1
  64. package/dist/esm/ui/LinkToolbarAppearance.js +2 -2
  65. package/dist/esm/ui/useFetchDatasourceInfo.js +78 -0
  66. package/dist/types/datasourceErrorBoundary.d.ts +2 -2
  67. package/dist/types/nodeviews/datasource.d.ts +0 -1
  68. package/dist/types/ui/DatasourceModal/ModalWithState.d.ts +2 -2
  69. package/dist/types/ui/DatasourceModal/index.d.ts +3 -1
  70. package/dist/types/ui/EditDatasourceButton.d.ts +1 -0
  71. package/dist/types/ui/useFetchDatasourceInfo.d.ts +14 -0
  72. package/dist/types-ts4.5/datasourceErrorBoundary.d.ts +2 -2
  73. package/dist/types-ts4.5/nodeviews/datasource.d.ts +0 -1
  74. package/dist/types-ts4.5/ui/DatasourceModal/ModalWithState.d.ts +2 -2
  75. package/dist/types-ts4.5/ui/DatasourceModal/index.d.ts +3 -1
  76. package/dist/types-ts4.5/ui/EditDatasourceButton.d.ts +1 -0
  77. package/dist/types-ts4.5/ui/useFetchDatasourceInfo.d.ts +14 -0
  78. package/package.json +6 -5
@@ -94,7 +94,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
94
94
  if (isDatasource && shouldUpdateTableRef) {
95
95
  var _node$attrs2;
96
96
  // since we use the plugin state, which is a shared state, we need to update the datasourceTableRef, layout on each selection
97
- var layout = (node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) || 'center';
97
+ var layout = (node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) || 'center';
98
98
 
99
99
  // we use cardAction to set the same meta, hence, we will need to combine both layout+datasourceTableRef in one transaction
100
100
  dispatch(setCardLayoutAndDatasourceTableRef({
@@ -123,8 +123,8 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
123
123
  * other tasks as per common implementations of the JavaScript event loop in browsers.
124
124
  */
125
125
  var invoke = rafSchedule(function () {
126
- var _pluginInjectionApi$a, _pluginInjectionApi$a2, _pluginInjectionApi$a3, _pluginInjectionApi$a4;
127
- return resolveWithProvider(view, provider, request, options, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions, (_pluginInjectionApi$a2 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : (_pluginInjectionApi$a4 = _pluginInjectionApi$a3.sharedState.currentState()) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.createAnalyticsEvent) !== null && _pluginInjectionApi$a2 !== void 0 ? _pluginInjectionApi$a2 : undefined);
126
+ var _pluginInjectionApi$a, _pluginInjectionApi$a2, _pluginInjectionApi$a3;
127
+ return resolveWithProvider(view, provider, request, options, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions, (_pluginInjectionApi$a2 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 || (_pluginInjectionApi$a3 = _pluginInjectionApi$a3.sharedState.currentState()) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.createAnalyticsEvent) !== null && _pluginInjectionApi$a2 !== void 0 ? _pluginInjectionApi$a2 : undefined);
128
128
  });
129
129
  rafCancellationCallbacks.push(invoke.cancel);
130
130
  invoke();
@@ -136,7 +136,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
136
136
  * so subscribers can now be notified and dispatch
137
137
  * analytics events
138
138
  */
139
- cardPluginEvents === null || cardPluginEvents === void 0 ? void 0 : cardPluginEvents.flush();
139
+ cardPluginEvents === null || cardPluginEvents === void 0 || cardPluginEvents.flush();
140
140
  },
141
141
  destroy: function destroy() {
142
142
  // Cancel any outstanding raf callbacks.
@@ -161,8 +161,8 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
161
161
  var hasIntlContext = true;
162
162
  var isDatasource = !!(node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.datasource);
163
163
  if (isDatasource) {
164
- var _node$attrs4, _node$attrs4$datasour;
165
- if (options.allowDatasource && platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 ? void 0 : (_node$attrs4$datasour = _node$attrs4.datasource) === null || _node$attrs4$datasour === void 0 ? void 0 : _node$attrs4$datasour.id)) {
164
+ var _node$attrs4;
165
+ if (options.allowDatasource && platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 || (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 || (_node$attrs4 = _node$attrs4.datasource) === null || _node$attrs4 === void 0 ? void 0 : _node$attrs4.id)) {
166
166
  return new Datasource({
167
167
  node: node,
168
168
  view: view,
@@ -25,8 +25,8 @@ export var mountHyperlinkPlugin = function mountHyperlinkPlugin(pluginInjectionA
25
25
  return new SafePlugin({
26
26
  view: function view(editorView) {
27
27
  requestAnimationFrame(function () {
28
- var _pluginInjectionApi$h, _pluginInjectionApi$h2;
29
- pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$h = pluginInjectionApi.hyperlink) === null || _pluginInjectionApi$h === void 0 ? void 0 : (_pluginInjectionApi$h2 = _pluginInjectionApi$h.actions) === null || _pluginInjectionApi$h2 === void 0 ? void 0 : _pluginInjectionApi$h2.prependToolbarButtons({
28
+ var _pluginInjectionApi$h;
29
+ pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$h = pluginInjectionApi.hyperlink) === null || _pluginInjectionApi$h === void 0 || (_pluginInjectionApi$h = _pluginInjectionApi$h.actions) === null || _pluginInjectionApi$h === void 0 || _pluginInjectionApi$h.prependToolbarButtons({
30
30
  items: function items(state, intl, providerFactory, link) {
31
31
  return [].concat(_toConsumableArray(getToolbarViewedItem(link)), [{
32
32
  type: 'custom',
@@ -42,8 +42,8 @@ export var mountHyperlinkPlugin = function mountHyperlinkPlugin(pluginInjectionA
42
42
  cardOptions: options,
43
43
  providerFactory: providerFactory,
44
44
  platform: options === null || options === void 0 ? void 0 : options.platform,
45
- editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions,
46
- cardActions: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions
45
+ editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions,
46
+ cardActions: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions
47
47
  });
48
48
  }
49
49
  }]);
@@ -43,7 +43,7 @@ export var removeCard = function removeCard(editorAnalyticsApi) {
43
43
  if (dispatch) {
44
44
  var tr = state.tr;
45
45
  removeSelectedNode(tr);
46
- editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent(payload)(tr);
46
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent(payload)(tr);
47
47
  dispatch(tr);
48
48
  }
49
49
  return true;
@@ -65,7 +65,7 @@ export var visitCardLink = function visitCardLink(editorAnalyticsApi) {
65
65
  window.open(url);
66
66
  if (dispatch) {
67
67
  var tr = state.tr;
68
- editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent(buildVisitedLinkPayload(type.name))(tr);
68
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent(buildVisitedLinkPayload(type.name))(tr);
69
69
  dispatch(tr);
70
70
  }
71
71
  return true;
@@ -80,7 +80,7 @@ export var openLinkSettings = function openLinkSettings(editorAnalyticsApi) {
80
80
  if (dispatch) {
81
81
  var tr = state.tr,
82
82
  type = state.selection.node.type;
83
- editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent(buildOpenedSettingsPayload(type.name))(tr);
83
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent(buildOpenedSettingsPayload(type.name))(tr);
84
84
  dispatch(tr);
85
85
  }
86
86
  return true;
@@ -183,7 +183,7 @@ var getToolbarViewedItem = function getToolbarViewedItem(url, display) {
183
183
  };
184
184
  var generateToolbarItems = function generateToolbarItems(state, featureFlags, intl, providerFactory, cardOptions, platform, linkPicker, pluginInjectionApi) {
185
185
  return function (node) {
186
- var _pluginInjectionApi$a, _pluginInjectionApi$d, _pluginInjectionApi$d2, _node$attrs, _node$attrs2, _node$attrs2$datasour;
186
+ var _pluginInjectionApi$a, _pluginInjectionApi$d, _pluginInjectionApi$d2, _node$attrs, _node$attrs2;
187
187
  var _titleUrlPairFromNode2 = titleUrlPairFromNode(node),
188
188
  url = _titleUrlPairFromNode2.url;
189
189
  var _ref = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {},
@@ -201,12 +201,12 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
201
201
  }
202
202
  var pluginState = pluginKey.getState(state);
203
203
  var currentAppearance = appearanceForNodeType(node.type);
204
- var _ref2 = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {},
204
+ var _ref2 = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d2 = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {},
205
205
  hoverDecoration = _ref2.hoverDecoration;
206
- var isDatasource = currentAppearance === 'block' && (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.datasource);
206
+ var isDatasource = currentAppearance === 'block' && (node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.datasource);
207
207
  var shouldRenderDatasourceToolbar = isDatasource &&
208
208
  // not showing toolbar in mobile for now since not sure what our plans are for it
209
- platform !== 'mobile' && cardOptions.allowDatasource && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : (_node$attrs2$datasour = _node$attrs2.datasource) === null || _node$attrs2$datasour === void 0 ? void 0 : _node$attrs2$datasour.id);
209
+ platform !== 'mobile' && cardOptions.allowDatasource && canRenderDatasource(node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 || (_node$attrs2 = _node$attrs2.datasource) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.id);
210
210
 
211
211
  /* mobile builds toolbar natively using toolbarItems */
212
212
  if (pluginState !== null && pluginState !== void 0 && pluginState.showLinkingToolbar && platform !== 'mobile') {
@@ -266,7 +266,7 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
266
266
  }]);
267
267
  if (currentAppearance === 'embed') {
268
268
  var _pluginInjectionApi$a2;
269
- var alignmentOptions = buildAlignmentOptions(state, intl, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.width, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions, cardOptions);
269
+ var alignmentOptions = buildAlignmentOptions(state, intl, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.width, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions, cardOptions);
270
270
  if (alignmentOptions.length) {
271
271
  alignmentOptions.push({
272
272
  type: 'separator'
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
2
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
3
+ import { DatasourceErrorBoundary } from '../../datasourceErrorBoundary';
4
+ import { CardContextProvider } from '../CardContextProvider';
3
5
  import { DatasourceModal } from './index';
4
6
  var ModalWithState = function ModalWithState(_ref) {
5
7
  var api = _ref.api,
@@ -9,9 +11,15 @@ var ModalWithState = function ModalWithState(_ref) {
9
11
  if (!(cardState !== null && cardState !== void 0 && cardState.showDatasourceModal)) {
10
12
  return null;
11
13
  }
12
- return /*#__PURE__*/React.createElement(DatasourceModal, {
13
- view: editorView,
14
- modalType: cardState === null || cardState === void 0 ? void 0 : cardState.datasourceModalType
15
- });
14
+ return /*#__PURE__*/React.createElement(DatasourceErrorBoundary, {
15
+ view: editorView
16
+ }, /*#__PURE__*/React.createElement(CardContextProvider, null, function (_ref2) {
17
+ var cardContext = _ref2.cardContext;
18
+ return /*#__PURE__*/React.createElement(DatasourceModal, {
19
+ view: editorView,
20
+ modalType: cardState === null || cardState === void 0 ? void 0 : cardState.datasourceModalType,
21
+ cardContext: cardContext
22
+ });
23
+ }));
16
24
  };
17
25
  export default ModalWithState;
@@ -7,13 +7,25 @@ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
7
7
  import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID, AssetsConfigModal, JIRA_LIST_OF_LINKS_DATASOURCE_ID, JiraIssuesConfigModal } from '@atlaskit/link-datasource';
8
8
  import { hideDatasourceModal } from '../../pm-plugins/actions';
9
9
  import { insertDatasource, updateCardFromDatasourceModal } from '../../pm-plugins/doc';
10
+ import { useFetchDatasourceInfo } from '../useFetchDatasourceInfo';
10
11
  export var DatasourceModal = function DatasourceModal(_ref) {
12
+ var _existingNode$attrs, _existingNode$attrs2;
11
13
  var view = _ref.view,
12
- modalType = _ref.modalType;
14
+ modalType = _ref.modalType,
15
+ cardContext = _ref.cardContext;
13
16
  var dispatch = view.dispatch,
14
17
  state = view.state;
15
18
  var selection = state.selection;
16
19
  var existingNode = selection instanceof NodeSelection ? selection.node : undefined;
20
+ var isRegularCardNode = !!(existingNode && !(existingNode !== null && existingNode !== void 0 && (_existingNode$attrs = existingNode.attrs) !== null && _existingNode$attrs !== void 0 && _existingNode$attrs.datasource));
21
+ var _useFetchDatasourceIn = useFetchDatasourceInfo({
22
+ isRegularCardNode: isRegularCardNode,
23
+ url: existingNode === null || existingNode === void 0 ? void 0 : existingNode.attrs.url,
24
+ cardContext: cardContext,
25
+ nodeParameters: existingNode === null || existingNode === void 0 || (_existingNode$attrs2 = existingNode.attrs) === null || _existingNode$attrs2 === void 0 || (_existingNode$attrs2 = _existingNode$attrs2.datasource) === null || _existingNode$attrs2 === void 0 ? void 0 : _existingNode$attrs2.parameters
26
+ }),
27
+ parameters = _useFetchDatasourceIn.parameters,
28
+ ready = _useFetchDatasourceIn.ready;
17
29
  var onClose = useCallback(function () {
18
30
  dispatch(hideDatasourceModal(state.tr));
19
31
  }, [dispatch, state.tr]);
@@ -34,23 +46,27 @@ export var DatasourceModal = function DatasourceModal(_ref) {
34
46
  }
35
47
  }, [existingNode, state, view]);
36
48
  if (modalType === 'jira') {
37
- var _existingNode$attrs, _tableView$properties;
38
- var _ref2 = (existingNode === null || existingNode === void 0 ? void 0 : (_existingNode$attrs = existingNode.attrs) === null || _existingNode$attrs === void 0 ? void 0 : _existingNode$attrs.datasource) || {},
49
+ var _existingNode$attrs3, _tableView$properties;
50
+ if (!ready) {
51
+ return null;
52
+ }
53
+ var _ref2 = (existingNode === null || existingNode === void 0 || (_existingNode$attrs3 = existingNode.attrs) === null || _existingNode$attrs3 === void 0 ? void 0 : _existingNode$attrs3.datasource) || {},
39
54
  _ref2$id = _ref2.id,
40
55
  datasourceId = _ref2$id === void 0 ? JIRA_LIST_OF_LINKS_DATASOURCE_ID : _ref2$id,
41
- parameters = _ref2.parameters,
42
56
  _ref2$views = _ref2.views,
43
57
  views = _ref2$views === void 0 ? [] : _ref2$views;
44
58
  var _ref3 = views,
45
59
  _ref4 = _slicedToArray(_ref3, 1),
46
60
  tableView = _ref4[0];
47
- var visibleColumnKeys = tableView === null || tableView === void 0 ? void 0 : (_tableView$properties = tableView.properties) === null || _tableView$properties === void 0 ? void 0 : _tableView$properties.columns.map(function (column) {
61
+ var visibleColumnKeys = tableView === null || tableView === void 0 || (_tableView$properties = tableView.properties) === null || _tableView$properties === void 0 ? void 0 : _tableView$properties.columns.map(function (column) {
48
62
  return column.key;
49
63
  });
50
64
  return /*#__PURE__*/React.createElement("div", {
51
65
  "data-testid": "jira-config-modal"
52
66
  }, /*#__PURE__*/React.createElement(JiraIssuesConfigModal, {
53
67
  datasourceId: datasourceId,
68
+ viewMode: isRegularCardNode ? 'count' : 'issue' // Want non-datasource cards to open in count view since they are in issue count view
69
+ ,
54
70
  visibleColumnKeys: visibleColumnKeys,
55
71
  parameters: parameters,
56
72
  onCancel: onClose,
@@ -58,8 +74,8 @@ export var DatasourceModal = function DatasourceModal(_ref) {
58
74
  }));
59
75
  }
60
76
  if (modalType === 'assets') {
61
- var _existingNode$attrs2, _tableView$properties2;
62
- var _ref5 = (existingNode === null || existingNode === void 0 ? void 0 : (_existingNode$attrs2 = existingNode.attrs) === null || _existingNode$attrs2 === void 0 ? void 0 : _existingNode$attrs2.datasource) || {},
77
+ var _existingNode$attrs4, _tableView$properties2;
78
+ var _ref5 = (existingNode === null || existingNode === void 0 || (_existingNode$attrs4 = existingNode.attrs) === null || _existingNode$attrs4 === void 0 ? void 0 : _existingNode$attrs4.datasource) || {},
63
79
  _ref5$id = _ref5.id,
64
80
  _datasourceId = _ref5$id === void 0 ? ASSETS_LIST_OF_LINKS_DATASOURCE_ID : _ref5$id,
65
81
  _parameters = _ref5.parameters,
@@ -68,7 +84,7 @@ export var DatasourceModal = function DatasourceModal(_ref) {
68
84
  var _ref6 = _views,
69
85
  _ref7 = _slicedToArray(_ref6, 1),
70
86
  _tableView = _ref7[0];
71
- var _visibleColumnKeys = _tableView === null || _tableView === void 0 ? void 0 : (_tableView$properties2 = _tableView.properties) === null || _tableView$properties2 === void 0 ? void 0 : _tableView$properties2.columns.map(function (column) {
87
+ var _visibleColumnKeys = _tableView === null || _tableView === void 0 || (_tableView$properties2 = _tableView.properties) === null || _tableView$properties2 === void 0 ? void 0 : _tableView$properties2.columns.map(function (column) {
72
88
  return column.key;
73
89
  });
74
90
  return /*#__PURE__*/React.createElement("div", {
@@ -1,20 +1,20 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
- import _regeneratorRuntime from "@babel/runtime/regenerator";
4
1
  /** @jsx jsx */
5
- import { useEffect, useState } from 'react';
6
2
  import { css, jsx } from '@emotion/react';
7
3
  import { cardMessages as messages } from '@atlaskit/editor-common/messages';
8
4
  import { FloatingToolbarButton as Button, FloatingToolbarSeparator as Separator, SmallerEditIcon } from '@atlaskit/editor-common/ui';
9
5
  import { canRenderDatasource, getDatasourceType } from '@atlaskit/editor-common/utils';
10
6
  import { showDatasourceModal } from '../pm-plugins/actions';
11
7
  import { CardContextProvider } from './CardContextProvider';
8
+ import { useFetchDatasourceInfo } from './useFetchDatasourceInfo';
12
9
  var buttonStyles = css({
13
10
  pointerEvents: 'auto'
14
11
  });
15
12
  var buttonWrapperStyles = css({
16
13
  display: 'flex'
17
14
  });
15
+
16
+ // Edit button in toolbar to open datasource modal. This button is shown for inline, block, and embed cards
17
+ // if they can resolve into a datasource.
18
18
  var EditDatasourceButtonWithCardContext = function EditDatasourceButtonWithCardContext(_ref) {
19
19
  var cardContext = _ref.cardContext,
20
20
  intl = _ref.intl,
@@ -22,56 +22,19 @@ var EditDatasourceButtonWithCardContext = function EditDatasourceButtonWithCardC
22
22
  url = _ref.url,
23
23
  editorView = _ref.editorView,
24
24
  editorState = _ref.editorState;
25
- var _useState = useState(null),
26
- _useState2 = _slicedToArray(_useState, 2),
27
- datasourceId = _useState2[0],
28
- setDatasourceId = _useState2[1];
29
- useEffect(function () {
30
- var fetchDatasource = /*#__PURE__*/function () {
31
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
32
- var _cardContext$connecti, _cardContext$connecti2, _datasources$, response, datasources;
33
- return _regeneratorRuntime.wrap(function _callee$(_context) {
34
- while (1) switch (_context.prev = _context.next) {
35
- case 0:
36
- _context.prev = 0;
37
- _context.t0 = url && cardContext;
38
- if (!_context.t0) {
39
- _context.next = 6;
40
- break;
41
- }
42
- _context.next = 5;
43
- return cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$connecti = cardContext.connections) === null || _cardContext$connecti === void 0 ? void 0 : (_cardContext$connecti2 = _cardContext$connecti.client) === null || _cardContext$connecti2 === void 0 ? void 0 : _cardContext$connecti2.fetchData(url);
44
- case 5:
45
- _context.t0 = _context.sent;
46
- case 6:
47
- response = _context.t0;
48
- datasources = response && response.datasources || [];
49
- setDatasourceId(((_datasources$ = datasources[0]) === null || _datasources$ === void 0 ? void 0 : _datasources$.id) || null);
50
- _context.next = 14;
51
- break;
52
- case 11:
53
- _context.prev = 11;
54
- _context.t1 = _context["catch"](0);
55
- setDatasourceId(null);
56
- case 14:
57
- case "end":
58
- return _context.stop();
59
- }
60
- }, _callee, null, [[0, 11]]);
61
- }));
62
- return function fetchDatasource() {
63
- return _ref2.apply(this, arguments);
64
- };
65
- }();
66
- void fetchDatasource();
67
- }, [cardContext, url]);
25
+ var _useFetchDatasourceIn = useFetchDatasourceInfo({
26
+ isRegularCardNode: true,
27
+ url: url,
28
+ cardContext: cardContext
29
+ }),
30
+ datasourceId = _useFetchDatasourceIn.datasourceId;
68
31
  if (!datasourceId || !canRenderDatasource(datasourceId, false)) {
69
32
  return null;
70
33
  }
71
34
  if (url) {
72
35
  var _cardContext$store, _urlState$error;
73
- var urlState = cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$store = cardContext.store) === null || _cardContext$store === void 0 ? void 0 : _cardContext$store.getState()[url];
74
- if ((urlState === null || urlState === void 0 ? void 0 : (_urlState$error = urlState.error) === null || _urlState$error === void 0 ? void 0 : _urlState$error.kind) === 'fatal') {
36
+ var urlState = cardContext === null || cardContext === void 0 || (_cardContext$store = cardContext.store) === null || _cardContext$store === void 0 ? void 0 : _cardContext$store.getState()[url];
37
+ if ((urlState === null || urlState === void 0 || (_urlState$error = urlState.error) === null || _urlState$error === void 0 ? void 0 : _urlState$error.kind) === 'fatal') {
75
38
  return null;
76
39
  }
77
40
  }
@@ -94,14 +57,14 @@ var EditDatasourceButtonWithCardContext = function EditDatasourceButtonWithCardC
94
57
  testId: 'card-edit-datasource-button'
95
58
  }), jsx(Separator, null));
96
59
  };
97
- export var EditDatasourceButton = function EditDatasourceButton(_ref3) {
98
- var intl = _ref3.intl,
99
- editorAnalyticsApi = _ref3.editorAnalyticsApi,
100
- url = _ref3.url,
101
- editorView = _ref3.editorView,
102
- editorState = _ref3.editorState;
103
- return jsx(CardContextProvider, null, function (_ref4) {
104
- var cardContext = _ref4.cardContext;
60
+ export var EditDatasourceButton = function EditDatasourceButton(_ref2) {
61
+ var intl = _ref2.intl,
62
+ editorAnalyticsApi = _ref2.editorAnalyticsApi,
63
+ url = _ref2.url,
64
+ editorView = _ref2.editorView,
65
+ editorState = _ref2.editorState;
66
+ return jsx(CardContextProvider, null, function (_ref3) {
67
+ var cardContext = _ref3.cardContext;
105
68
  return jsx(EditDatasourceButtonWithCardContext, {
106
69
  url: url,
107
70
  intl: intl,
@@ -110,9 +110,9 @@ export var EditLinkToolbar = /*#__PURE__*/function (_React$Component) {
110
110
  },
111
111
  onEscapeCallback: function onEscapeCallback(state, dispatch) {
112
112
  var tr = state.tr;
113
- pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.hyperlink.actions.hideLinkToolbar(tr);
113
+ pluginInjectionApi === null || pluginInjectionApi === void 0 || pluginInjectionApi.hyperlink.actions.hideLinkToolbar(tr);
114
114
  _hideLinkToolbar(tr);
115
- forceFocusSelector === null || forceFocusSelector === void 0 ? void 0 : forceFocusSelector("[aria-label=\"".concat(linkToolbarMessages.editLink.defaultMessage, "\"]"))(tr);
115
+ forceFocusSelector === null || forceFocusSelector === void 0 || forceFocusSelector("[aria-label=\"".concat(linkToolbarMessages.editLink.defaultMessage, "\"]"))(tr);
116
116
  if (dispatch) {
117
117
  dispatch(tr);
118
118
  return true;
@@ -121,7 +121,7 @@ export var EditLinkToolbar = /*#__PURE__*/function (_React$Component) {
121
121
  },
122
122
  onClickAwayCallback: function onClickAwayCallback(state, dispatch) {
123
123
  var tr = state.tr;
124
- pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.hyperlink.actions.hideLinkToolbar(tr);
124
+ pluginInjectionApi === null || pluginInjectionApi === void 0 || pluginInjectionApi.hyperlink.actions.hideLinkToolbar(tr);
125
125
  if (dispatch) {
126
126
  dispatch(tr);
127
127
  return true;
@@ -142,7 +142,7 @@ export var editLink = function editLink(editorAnalyticsApi) {
142
142
  if (dispatch) {
143
143
  var tr = state.tr;
144
144
  showLinkToolbar(tr);
145
- editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent(buildEditLinkPayload(type))(tr);
145
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent(buildEditLinkPayload(type))(tr);
146
146
  dispatch(tr);
147
147
  return true;
148
148
  }
@@ -175,7 +175,7 @@ export var buildEditLinkToolbar = function buildEditLinkToolbar(_ref2) {
175
175
  text: displayInfo.title || '',
176
176
  node: node,
177
177
  featureFlags: featureFlags,
178
- forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$f = pluginInjectionApi.floatingToolbar.actions) === null || _pluginInjectionApi$f === void 0 ? void 0 : _pluginInjectionApi$f.forceFocusSelector,
178
+ forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$f = pluginInjectionApi.floatingToolbar.actions) === null || _pluginInjectionApi$f === void 0 ? void 0 : _pluginInjectionApi$f.forceFocusSelector,
179
179
  onSubmit: function onSubmit(newHref, newText, inputMethod, analytic) {
180
180
  var urlChanged = newHref !== displayInfo.url;
181
181
  var titleChanged = newText !== displayInfo.title;
@@ -184,7 +184,7 @@ export var buildEditLinkToolbar = function buildEditLinkToolbar(_ref2) {
184
184
  // (even if the url was also changed) - we don't want to lose the custom title.
185
185
  if (titleChanged) {
186
186
  var _pluginInjectionApi$a;
187
- return commandWithMetadata(changeSelectedCardToLink(newText, newHref, undefined, undefined, undefined, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions), {
187
+ return commandWithMetadata(changeSelectedCardToLink(newText, newHref, undefined, undefined, undefined, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions), {
188
188
  action: ACTION.UPDATED,
189
189
  inputMethod: inputMethod,
190
190
  sourceEvent: analytic
@@ -13,8 +13,8 @@ function getDatasourceDisplay(datasourceAttrs) {
13
13
  return (_datasourceAttrs$data = datasourceAttrs.datasource.views[0]) === null || _datasourceAttrs$data === void 0 ? void 0 : _datasourceAttrs$data.type;
14
14
  }
15
15
  function getDisplayedColumnCount(datasourceAttrs) {
16
- var _datasourceAttrs$data2, _datasourceAttrs$data3, _datasourceAttrs$data4, _datasourceAttrs$data5;
17
- return (_datasourceAttrs$data2 = (_datasourceAttrs$data3 = datasourceAttrs.datasource.views[0]) === null || _datasourceAttrs$data3 === void 0 ? void 0 : (_datasourceAttrs$data4 = _datasourceAttrs$data3.properties) === null || _datasourceAttrs$data4 === void 0 ? void 0 : (_datasourceAttrs$data5 = _datasourceAttrs$data4.columns) === null || _datasourceAttrs$data5 === void 0 ? void 0 : _datasourceAttrs$data5.length) !== null && _datasourceAttrs$data2 !== void 0 ? _datasourceAttrs$data2 : 0;
16
+ var _datasourceAttrs$data2, _datasourceAttrs$data3;
17
+ return (_datasourceAttrs$data2 = (_datasourceAttrs$data3 = datasourceAttrs.datasource.views[0]) === null || _datasourceAttrs$data3 === void 0 || (_datasourceAttrs$data3 = _datasourceAttrs$data3.properties) === null || _datasourceAttrs$data3 === void 0 || (_datasourceAttrs$data3 = _datasourceAttrs$data3.columns) === null || _datasourceAttrs$data3 === void 0 ? void 0 : _datasourceAttrs$data3.length) !== null && _datasourceAttrs$data2 !== void 0 ? _datasourceAttrs$data2 : 0;
18
18
  }
19
19
  function getSearchMethod(creationMethod, metadata) {
20
20
  if (creationMethod === 'editor_paste' || creationMethod === 'editor_type') {
@@ -30,9 +30,9 @@ function getSearchMethod(creationMethod, metadata) {
30
30
  }
31
31
  function getAnalyticAttributesFromNode(datasourceAttrs, metadata) {
32
32
  var url = datasourceAttrs.url,
33
- _datasourceAttrs$data6 = datasourceAttrs.datasource,
34
- datasourceId = _datasourceAttrs$data6.id,
35
- parameters = _datasourceAttrs$data6.parameters;
33
+ _datasourceAttrs$data4 = datasourceAttrs.datasource,
34
+ datasourceId = _datasourceAttrs$data4.id,
35
+ parameters = _datasourceAttrs$data4.parameters;
36
36
  var display = getDatasourceDisplay(datasourceAttrs);
37
37
  var inputMethod = '';
38
38
  var actions = [];
@@ -80,7 +80,7 @@ var LayoutButtonWrapper = function LayoutButtonWrapper(_ref2) {
80
80
  var _ref3 = cardState !== null && cardState !== void 0 ? cardState : {},
81
81
  datasourceTableRef = _ref3.datasourceTableRef,
82
82
  _ref3$layout = _ref3.layout,
83
- layout = _ref3$layout === void 0 ? (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.layout) || 'center' : _ref3$layout;
83
+ layout = _ref3$layout === void 0 ? (node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.layout) || 'center' : _ref3$layout;
84
84
  var isDatasource = !!(node !== null && node !== void 0 && (_node$attrs2 = node.attrs) !== null && _node$attrs2 !== void 0 && _node$attrs2.datasource);
85
85
  var onLayoutChange = function onLayoutChange(layout) {
86
86
  if (pos === undefined) {
@@ -46,8 +46,8 @@ export var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
46
46
  };
47
47
  if (url) {
48
48
  var _cardContext$store, _urlState$error;
49
- var urlState = cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$store = cardContext.store) === null || _cardContext$store === void 0 ? void 0 : _cardContext$store.getState()[url];
50
- if ((urlState === null || urlState === void 0 ? void 0 : (_urlState$error = urlState.error) === null || _urlState$error === void 0 ? void 0 : _urlState$error.kind) === 'fatal') {
49
+ var urlState = cardContext === null || cardContext === void 0 || (_cardContext$store = cardContext.store) === null || _cardContext$store === void 0 ? void 0 : _cardContext$store.getState()[url];
50
+ if ((urlState === null || urlState === void 0 || (_urlState$error = urlState.error) === null || _urlState$error === void 0 ? void 0 : _urlState$error.kind) === 'fatal') {
51
51
  return null;
52
52
  }
53
53
  }
@@ -0,0 +1,78 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
+ /** @jsx jsx */
5
+ import { useEffect, useState } from 'react';
6
+ export var useFetchDatasourceInfo = function useFetchDatasourceInfo(_ref) {
7
+ var isRegularCardNode = _ref.isRegularCardNode,
8
+ url = _ref.url,
9
+ cardContext = _ref.cardContext,
10
+ nodeParameters = _ref.nodeParameters;
11
+ var _useState = useState(undefined),
12
+ _useState2 = _slicedToArray(_useState, 2),
13
+ datasourceId = _useState2[0],
14
+ setDatasourceId = _useState2[1];
15
+ var _useState3 = useState(nodeParameters),
16
+ _useState4 = _slicedToArray(_useState3, 2),
17
+ parameters = _useState4[0],
18
+ setParameters = _useState4[1];
19
+ // Since fetchData() is async, using this ready check to see if we have the parameters before passing it to the modal.
20
+ // Only non-datasource nodes will be not ready initially since we need to fetch data.
21
+ var _useState5 = useState(!isRegularCardNode),
22
+ _useState6 = _slicedToArray(_useState5, 2),
23
+ ready = _useState6[0],
24
+ setReady = _useState6[1];
25
+ useEffect(function () {
26
+ var fetchDatasource = /*#__PURE__*/function () {
27
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
28
+ var _cardContext$connecti, _datasources$, _datasources$2, response, datasources;
29
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
30
+ while (1) switch (_context.prev = _context.next) {
31
+ case 0:
32
+ _context.prev = 0;
33
+ if (!(!url || !cardContext)) {
34
+ _context.next = 4;
35
+ break;
36
+ }
37
+ // Don't block rendering of modal of somehow we don't get these two args --> just open with empty params
38
+ setReady(true);
39
+ return _context.abrupt("return");
40
+ case 4:
41
+ _context.next = 6;
42
+ return cardContext === null || cardContext === void 0 || (_cardContext$connecti = cardContext.connections) === null || _cardContext$connecti === void 0 || (_cardContext$connecti = _cardContext$connecti.client) === null || _cardContext$connecti === void 0 ? void 0 : _cardContext$connecti.fetchData(url);
43
+ case 6:
44
+ response = _context.sent;
45
+ datasources = response && response.datasources || [];
46
+ setDatasourceId((_datasources$ = datasources[0]) === null || _datasources$ === void 0 ? void 0 : _datasources$.id);
47
+ setParameters((_datasources$2 = datasources[0]) === null || _datasources$2 === void 0 ? void 0 : _datasources$2.parameters);
48
+ setReady(true);
49
+ _context.next = 18;
50
+ break;
51
+ case 13:
52
+ _context.prev = 13;
53
+ _context.t0 = _context["catch"](0);
54
+ setDatasourceId(undefined);
55
+ setParameters(undefined);
56
+ // If fetch somehow errors, still set ready as true so we don't block the rendering of the modal.
57
+ // It will just open with empty params.
58
+ setReady(true);
59
+ case 18:
60
+ case "end":
61
+ return _context.stop();
62
+ }
63
+ }, _callee, null, [[0, 13]]);
64
+ }));
65
+ return function fetchDatasource() {
66
+ return _ref2.apply(this, arguments);
67
+ };
68
+ }();
69
+ if (isRegularCardNode) {
70
+ void fetchDatasource();
71
+ }
72
+ }, [isRegularCardNode, cardContext, url]);
73
+ return {
74
+ datasourceId: datasourceId,
75
+ parameters: parameters,
76
+ ready: ready
77
+ };
78
+ };
@@ -3,8 +3,8 @@ import type { APIError } from '@atlaskit/smart-card';
3
3
  import type { DatasourceProps } from './nodeviews/datasource';
4
4
  export declare class DatasourceErrorBoundary extends React.Component<{
5
5
  url?: string;
6
- unsupportedComponent: React.ComponentType;
7
- handleError: () => void;
6
+ unsupportedComponent?: React.ComponentType;
7
+ handleError?: () => void;
8
8
  view: DatasourceProps['view'];
9
9
  }> {
10
10
  state: {
@@ -37,7 +37,6 @@ export declare class DatasourceComponent extends React.PureComponent<DatasourceC
37
37
  export declare class Datasource extends ReactNodeView<DatasourceProps> {
38
38
  private tableWidth;
39
39
  constructor(props: DatasourceProps);
40
- updateNodeRemoveAttrs: () => void;
41
40
  createDomRef(): HTMLElement;
42
41
  render(): jsx.JSX.Element;
43
42
  }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import { EditorView } from '@atlaskit/editor-prosemirror/view';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
4
  import type { cardPlugin } from '../../plugin';
5
5
  declare const ModalWithState: ({ api, editorView, }: {
6
6
  api: ExtractInjectionAPI<typeof cardPlugin> | undefined;
@@ -2,10 +2,12 @@
2
2
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
3
  import type { DatasourceModalType } from '@atlaskit/editor-common/types';
4
4
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
+ import type { CardContext } from '@atlaskit/smart-card';
5
6
  type DatasourceModalProps = {
6
7
  view: EditorView;
7
8
  editorAnalyticsApi?: EditorAnalyticsAPI;
8
9
  modalType?: DatasourceModalType;
10
+ cardContext?: CardContext;
9
11
  };
10
- export declare const DatasourceModal: ({ view, modalType }: DatasourceModalProps) => JSX.Element | null;
12
+ export declare const DatasourceModal: ({ view, modalType, cardContext, }: DatasourceModalProps) => JSX.Element | null;
11
13
  export {};
@@ -1,3 +1,4 @@
1
+ /** @jsx jsx */
1
2
  import { jsx } from '@emotion/react';
2
3
  import type { IntlShape } from 'react-intl-next';
3
4
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
@@ -0,0 +1,14 @@
1
+ import type { JiraIssueDatasourceParameters } from '@atlaskit/link-datasource';
2
+ import type { CardContext } from '@atlaskit/link-provider';
3
+ import type { DatasourceParameters } from '@atlaskit/linking-types';
4
+ export interface useFetchDatasourceInfoProps {
5
+ isRegularCardNode: boolean;
6
+ url?: string;
7
+ cardContext?: CardContext;
8
+ nodeParameters?: DatasourceParameters | JiraIssueDatasourceParameters;
9
+ }
10
+ export declare const useFetchDatasourceInfo: ({ isRegularCardNode, url, cardContext, nodeParameters, }: useFetchDatasourceInfoProps) => {
11
+ datasourceId: string | undefined;
12
+ parameters: DatasourceParameters | undefined;
13
+ ready: boolean;
14
+ };
@@ -3,8 +3,8 @@ import type { APIError } from '@atlaskit/smart-card';
3
3
  import type { DatasourceProps } from './nodeviews/datasource';
4
4
  export declare class DatasourceErrorBoundary extends React.Component<{
5
5
  url?: string;
6
- unsupportedComponent: React.ComponentType;
7
- handleError: () => void;
6
+ unsupportedComponent?: React.ComponentType;
7
+ handleError?: () => void;
8
8
  view: DatasourceProps['view'];
9
9
  }> {
10
10
  state: {
@@ -37,7 +37,6 @@ export declare class DatasourceComponent extends React.PureComponent<DatasourceC
37
37
  export declare class Datasource extends ReactNodeView<DatasourceProps> {
38
38
  private tableWidth;
39
39
  constructor(props: DatasourceProps);
40
- updateNodeRemoveAttrs: () => void;
41
40
  createDomRef(): HTMLElement;
42
41
  render(): jsx.JSX.Element;
43
42
  }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import { EditorView } from '@atlaskit/editor-prosemirror/view';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
4
  import type { cardPlugin } from '../../plugin';
5
5
  declare const ModalWithState: ({ api, editorView, }: {
6
6
  api: ExtractInjectionAPI<typeof cardPlugin> | undefined;