@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 0.9.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#41405](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41405) [`6619f042a24`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6619f042a24) - [ux] Fix issue where any inline/block/embeds don't open up datasource modal with proper info
8
+
9
+ ## 0.9.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#40745](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/40745) [`bba067a4049`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bba067a4049) - Datasource modal dialog now wrapped with datasource render failed analytics component
14
+ - Updated dependencies
15
+
3
16
  ## 0.9.0
4
17
 
5
18
  ### Minor Changes
@@ -17,7 +17,7 @@ exports.createEventsQueue = void 0;
17
17
  * to be subscribed to elsewhere where the react context is available (contentComponent or otherwise) (smart card context)
18
18
  * in order to be able to annotate events with additional attributes to events
19
19
  */
20
- var createEventsQueue = function createEventsQueue() {
20
+ var createEventsQueue = exports.createEventsQueue = function createEventsQueue() {
21
21
  var queue = [];
22
22
  var subscribers = new Set();
23
23
  var subscribe = function subscribe(subscriber) {
@@ -51,5 +51,4 @@ var createEventsQueue = function createEventsQueue() {
51
51
  subscribe: subscribe,
52
52
  getSize: getSize
53
53
  };
54
- };
55
- exports.createEventsQueue = createEventsQueue;
54
+ };
@@ -21,7 +21,7 @@ var _utils2 = require("./utils");
21
21
  /**
22
22
  * Find the links, smartLinks, datasources that were changed in a transaction
23
23
  */
24
- var findChanged = function findChanged(tr, state) {
24
+ var findChanged = exports.findChanged = function findChanged(tr, state) {
25
25
  var schema = tr.doc.type.schema;
26
26
  var removed = [];
27
27
  var inserted = [];
@@ -200,7 +200,6 @@ var findChanged = function findChanged(tr, state) {
200
200
  /**
201
201
  * List of actions to be considered link "updates"
202
202
  */
203
- exports.findChanged = findChanged;
204
203
  var UPDATE_ACTIONS = [_analytics.ACTION.CHANGED_TYPE, _analytics.ACTION.UPDATED];
205
204
 
206
205
  /**
@@ -4,14 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.EVENT_SUBJECT = exports.EVENT = void 0;
7
- var EVENT = /*#__PURE__*/function (EVENT) {
7
+ var EVENT = exports.EVENT = /*#__PURE__*/function (EVENT) {
8
8
  EVENT["CREATED"] = "created";
9
9
  EVENT["UPDATED"] = "updated";
10
10
  EVENT["DELETED"] = "deleted";
11
11
  return EVENT;
12
12
  }({});
13
- exports.EVENT = EVENT;
14
- var EVENT_SUBJECT = /*#__PURE__*/function (EVENT_SUBJECT) {
13
+ var EVENT_SUBJECT = exports.EVENT_SUBJECT = /*#__PURE__*/function (EVENT_SUBJECT) {
15
14
  EVENT_SUBJECT["LINK"] = "link";
16
15
  EVENT_SUBJECT["DATASOURCE"] = "datasource";
17
16
  return EVENT_SUBJECT;
@@ -20,5 +19,4 @@ var EVENT_SUBJECT = /*#__PURE__*/function (EVENT_SUBJECT) {
20
19
  * These are not GASv3 events
21
20
  * But they share a similar in shape so that GASv3
22
21
  * events can be derived from them / think of them in the same way
23
- */
24
- exports.EVENT_SUBJECT = EVENT_SUBJECT;
22
+ */
@@ -18,7 +18,7 @@ function isDatasourceNode(node) {
18
18
  /**
19
19
  * Determine if a node is considered to be a link
20
20
  */
21
- var isLinkNode = function isLinkNode(node) {
21
+ var isLinkNode = exports.isLinkNode = function isLinkNode(node) {
22
22
  if (isDatasourceNode(node)) {
23
23
  return false;
24
24
  }
@@ -27,7 +27,6 @@ var isLinkNode = function isLinkNode(node) {
27
27
  }
28
28
  return hasLinkMark(node);
29
29
  };
30
- exports.isLinkNode = isLinkNode;
31
30
  function getNodeSubject(node) {
32
31
  if (isDatasourceNode(node)) {
33
32
  return _types.EVENT_SUBJECT.DATASOURCE;
@@ -62,10 +61,10 @@ var hasLinkMark = function hasLinkMark(node) {
62
61
  return !!getLinkMark(node);
63
62
  };
64
63
  function getUrl(node) {
65
- var _node$attrs$url, _node$attrs, _getLinkMark, _getLinkMark$attrs;
66
- return (_node$attrs$url = (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.url) !== null && _node$attrs$url !== void 0 ? _node$attrs$url : (_getLinkMark = getLinkMark(node)) === null || _getLinkMark === void 0 ? void 0 : (_getLinkMark$attrs = _getLinkMark.attrs) === null || _getLinkMark$attrs === void 0 ? void 0 : _getLinkMark$attrs.href;
64
+ var _node$attrs$url, _node$attrs, _getLinkMark;
65
+ return (_node$attrs$url = (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.url) !== null && _node$attrs$url !== void 0 ? _node$attrs$url : (_getLinkMark = getLinkMark(node)) === null || _getLinkMark === void 0 || (_getLinkMark = _getLinkMark.attrs) === null || _getLinkMark === void 0 ? void 0 : _getLinkMark.href;
67
66
  }
68
- var getNodeContext = function getNodeContext(doc, pos) {
67
+ var getNodeContext = exports.getNodeContext = function getNodeContext(doc, pos) {
69
68
  var $pos = doc.resolve(pos);
70
69
  var maxDepth = 3;
71
70
  for (var i = 0; i <= maxDepth; i++) {
@@ -76,8 +75,7 @@ var getNodeContext = function getNodeContext(doc, pos) {
76
75
  }
77
76
  return 'unknown';
78
77
  };
79
- exports.getNodeContext = getNodeContext;
80
- var findAtPositions = function findAtPositions(tr, positions) {
78
+ var findAtPositions = exports.findAtPositions = function findAtPositions(tr, positions) {
81
79
  var entities = [];
82
80
  for (var i = 0; i < positions.length; i++) {
83
81
  var pos = positions[i];
@@ -94,8 +92,7 @@ var findAtPositions = function findAtPositions(tr, positions) {
94
92
  }
95
93
  return entities;
96
94
  };
97
- exports.findAtPositions = findAtPositions;
98
- var findInNodeRange = function findInNodeRange(doc, from, to, predicate) {
95
+ var findInNodeRange = exports.findInNodeRange = function findInNodeRange(doc, from, to, predicate) {
99
96
  var entities = [];
100
97
  doc.nodesBetween(from, to, function (node, pos) {
101
98
  if (predicate(node)) {
@@ -117,8 +114,7 @@ var findInNodeRange = function findInNodeRange(doc, from, to, predicate) {
117
114
  * Returns whether or not two sets of links appear to likely be the same set of links
118
115
  * That they are in the same order and that both their hrefs and appearances match
119
116
  */
120
- exports.findInNodeRange = findInNodeRange;
121
- var areSameNodes = function areSameNodes(setA, setB) {
117
+ var areSameNodes = exports.areSameNodes = function areSameNodes(setA, setB) {
122
118
  if (setA.length !== setB.length) {
123
119
  return false;
124
120
  }
@@ -130,5 +126,4 @@ var areSameNodes = function areSameNodes(setA, setB) {
130
126
  }
131
127
  }
132
128
  return true;
133
- };
134
- exports.areSameNodes = areSameNodes;
129
+ };
@@ -18,7 +18,7 @@ var _linkDatasource = require("@atlaskit/link-datasource");
18
18
  var _doc = require("./pm-plugins/doc");
19
19
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
20
20
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /* eslint-disable @repo/internal/react/no-class-components */
21
- var DatasourceErrorBoundary = /*#__PURE__*/function (_React$Component) {
21
+ var DatasourceErrorBoundary = exports.DatasourceErrorBoundary = /*#__PURE__*/function (_React$Component) {
22
22
  (0, _inherits2.default)(DatasourceErrorBoundary, _React$Component);
23
23
  var _super = _createSuper(DatasourceErrorBoundary);
24
24
  function DatasourceErrorBoundary() {
@@ -36,7 +36,9 @@ var DatasourceErrorBoundary = /*#__PURE__*/function (_React$Component) {
36
36
  (0, _createClass2.default)(DatasourceErrorBoundary, [{
37
37
  key: "componentDidCatch",
38
38
  value: function componentDidCatch(error) {
39
- this.props.handleError();
39
+ if (this.props.handleError) {
40
+ this.props.handleError();
41
+ }
40
42
  // prevent re-render children with error
41
43
  if (this.state.isError) {
42
44
  this.setState({
@@ -53,9 +55,10 @@ var DatasourceErrorBoundary = /*#__PURE__*/function (_React$Component) {
53
55
  view = _this$props.view;
54
56
  if (this.state.isError) {
55
57
  if (url && (0, _adfSchema.isSafeUrl)(url)) {
56
- return /*#__PURE__*/_react.default.createElement(_linkDatasource.DatasourceRenderFailedAnalyticsWrapper, null, (0, _doc.setSelectedCardAppearance)('inline', undefined)(view.state, view.dispatch));
58
+ return /*#__PURE__*/_react.default.createElement(_linkDatasource.LazyLoadedDatasourceRenderFailedAnalyticsWrapper, null, (0, _doc.setSelectedCardAppearance)('inline', undefined)(view.state, view.dispatch));
57
59
  } else {
58
- return /*#__PURE__*/_react.default.createElement(_linkDatasource.DatasourceRenderFailedAnalyticsWrapper, null, /*#__PURE__*/_react.default.createElement(UnsupportedComponent, null));
60
+ var unsupportedComponent = UnsupportedComponent ? /*#__PURE__*/_react.default.createElement(UnsupportedComponent, null) : null;
61
+ return /*#__PURE__*/_react.default.createElement(_linkDatasource.LazyLoadedDatasourceRenderFailedAnalyticsWrapper, null, unsupportedComponent);
59
62
  }
60
63
  } else {
61
64
  return this.props.children;
@@ -70,5 +73,4 @@ var DatasourceErrorBoundary = /*#__PURE__*/function (_React$Component) {
70
73
  }
71
74
  }]);
72
75
  return DatasourceErrorBoundary;
73
- }(_react.default.Component);
74
- exports.DatasourceErrorBoundary = DatasourceErrorBoundary;
76
+ }(_react.default.Component);
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.messages = void 0;
7
7
  var _reactIntlNext = require("react-intl-next");
8
- var messages = (0, _reactIntlNext.defineMessages)({
8
+ var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
9
9
  datasourceJiraIssue: {
10
10
  id: 'fabric.editor.datasource.jiraIssue',
11
11
  defaultMessage: 'Jira Issues',
@@ -26,5 +26,4 @@ var messages = (0, _reactIntlNext.defineMessages)({
26
26
  defaultMessage: 'Insert objects from Assets in Jira Service Management with search and filtering',
27
27
  description: 'Description text displayed when selecting the type of data to include onto the page, in this case: JSM Assets objects'
28
28
  }
29
- });
30
- exports.messages = messages;
29
+ });
@@ -25,7 +25,7 @@ var _genericCard = require("./genericCard");
25
25
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
26
26
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
27
27
  // eslint-disable-next-line @repo/internal/react/no-class-components
28
- var BlockCardComponent = /*#__PURE__*/function (_React$PureComponent) {
28
+ var BlockCardComponent = exports.BlockCardComponent = /*#__PURE__*/function (_React$PureComponent) {
29
29
  (0, _inherits2.default)(BlockCardComponent, _React$PureComponent);
30
30
  var _super = _createSuper(BlockCardComponent);
31
31
  function BlockCardComponent() {
@@ -121,12 +121,11 @@ var BlockCardComponent = /*#__PURE__*/function (_React$PureComponent) {
121
121
  }]);
122
122
  return BlockCardComponent;
123
123
  }(_react.default.PureComponent);
124
- exports.BlockCardComponent = BlockCardComponent;
125
124
  (0, _defineProperty2.default)(BlockCardComponent, "contextTypes", {
126
125
  contextAdapter: _propTypes.default.object
127
126
  });
128
127
  var WrappedBlockCard = (0, _genericCard.Card)(BlockCardComponent, _ui.UnsupportedBlock);
129
- var BlockCard = /*#__PURE__*/function (_ReactNodeView) {
128
+ var BlockCard = exports.BlockCard = /*#__PURE__*/function (_ReactNodeView) {
130
129
  (0, _inherits2.default)(BlockCard, _ReactNodeView);
131
130
  var _super2 = _createSuper(BlockCard);
132
131
  function BlockCard() {
@@ -180,5 +179,4 @@ var BlockCard = /*#__PURE__*/function (_ReactNodeView) {
180
179
  }
181
180
  }]);
182
181
  return BlockCard;
183
- }(_reactNodeView.default);
184
- exports.BlockCard = BlockCard;
182
+ }(_reactNodeView.default);
@@ -21,7 +21,6 @@ var _ui = require("@atlaskit/editor-common/ui");
21
21
  var _utils = require("@atlaskit/editor-common/utils");
22
22
  var _linkDatasource = require("@atlaskit/link-datasource");
23
23
  var _datasourceErrorBoundary = require("../datasourceErrorBoundary");
24
- var _doc = require("../pm-plugins/doc");
25
24
  var _EditorAnalyticsContext = require("../ui/EditorAnalyticsContext");
26
25
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
27
26
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -38,7 +37,7 @@ var getPosSafely = function getPosSafely(pos) {
38
37
  }
39
38
  };
40
39
  // eslint-disable-next-line @repo/internal/react/no-class-components
41
- var DatasourceComponent = /*#__PURE__*/function (_React$PureComponent) {
40
+ var DatasourceComponent = exports.DatasourceComponent = /*#__PURE__*/function (_React$PureComponent) {
42
41
  (0, _inherits2.default)(DatasourceComponent, _React$PureComponent);
43
42
  var _super = _createSuper(DatasourceComponent);
44
43
  function DatasourceComponent(props) {
@@ -126,38 +125,20 @@ var DatasourceComponent = /*#__PURE__*/function (_React$PureComponent) {
126
125
  }]);
127
126
  return DatasourceComponent;
128
127
  }(_react.default.PureComponent);
129
- exports.DatasourceComponent = DatasourceComponent;
130
128
  (0, _defineProperty2.default)(DatasourceComponent, "contextTypes", {
131
129
  contextAdapter: _propTypes.default.object
132
130
  });
133
- var Datasource = /*#__PURE__*/function (_ReactNodeView) {
131
+ var Datasource = exports.Datasource = /*#__PURE__*/function (_ReactNodeView) {
134
132
  (0, _inherits2.default)(Datasource, _ReactNodeView);
135
133
  var _super2 = _createSuper(Datasource);
136
134
  function Datasource(props) {
137
- var _props$pluginInjectio, _props$pluginInjectio2, _sharedState$currentS;
135
+ var _props$pluginInjectio, _sharedState$currentS;
138
136
  var _this2;
139
137
  (0, _classCallCheck2.default)(this, Datasource);
140
138
  _this2 = _super2.call(this, props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props, undefined, true, undefined, props.hasIntlContext);
141
- // this is necessary so that the datasource toolbar won't be rendered on error
142
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "updateNodeRemoveAttrs", function () {
143
- var url = _this2.node.attrs.url;
144
- var _this2$view = _this2.view,
145
- state = _this2$view.state,
146
- dispatch = _this2$view.dispatch;
147
- var pos = getPosSafely(_this2.getPos);
148
- if (pos === undefined) {
149
- return;
150
- }
151
- var nodeType = (0, _doc.getLinkNodeType)('inline', state.schema.nodes);
152
- var tr = state.tr.setNodeMarkup(pos, nodeType, {
153
- url: url
154
- });
155
- tr.setMeta('scrollIntoView', false);
156
- return dispatch(tr);
157
- });
158
- var sharedState = props === null || props === void 0 ? void 0 : (_props$pluginInjectio = props.pluginInjectionApi) === null || _props$pluginInjectio === void 0 ? void 0 : (_props$pluginInjectio2 = _props$pluginInjectio.width) === null || _props$pluginInjectio2 === void 0 ? void 0 : _props$pluginInjectio2.sharedState;
159
- _this2.tableWidth = sharedState === null || sharedState === void 0 ? void 0 : (_sharedState$currentS = sharedState.currentState()) === null || _sharedState$currentS === void 0 ? void 0 : _sharedState$currentS.width;
160
- sharedState === null || sharedState === void 0 ? void 0 : sharedState.onChange(function (_ref3) {
139
+ var sharedState = props === null || props === void 0 || (_props$pluginInjectio = props.pluginInjectionApi) === null || _props$pluginInjectio === void 0 || (_props$pluginInjectio = _props$pluginInjectio.width) === null || _props$pluginInjectio === void 0 ? void 0 : _props$pluginInjectio.sharedState;
140
+ _this2.tableWidth = sharedState === null || sharedState === void 0 || (_sharedState$currentS = sharedState.currentState()) === null || _sharedState$currentS === void 0 ? void 0 : _sharedState$currentS.width;
141
+ sharedState === null || sharedState === void 0 || sharedState.onChange(function (_ref3) {
161
142
  var nextSharedState = _ref3.nextSharedState;
162
143
  if (nextSharedState !== null && nextSharedState !== void 0 && nextSharedState.width && _this2.tableWidth !== (nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.width)) {
163
144
  _this2.tableWidth = nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.width;
@@ -178,7 +159,6 @@ var Datasource = /*#__PURE__*/function (_ReactNodeView) {
178
159
  value: function render() {
179
160
  var attrs = this.node.attrs;
180
161
  return (0, _react2.jsx)(_datasourceErrorBoundary.DatasourceErrorBoundary, {
181
- handleError: this.updateNodeRemoveAttrs,
182
162
  unsupportedComponent: _ui.UnsupportedInline,
183
163
  view: this.view,
184
164
  url: attrs.url
@@ -195,5 +175,4 @@ var Datasource = /*#__PURE__*/function (_ReactNodeView) {
195
175
  }
196
176
  }]);
197
177
  return Datasource;
198
- }(_reactNodeView.default);
199
- exports.Datasource = Datasource;
178
+ }(_reactNodeView.default);
@@ -79,7 +79,7 @@ var CardInner = function CardInner(_ref) {
79
79
  }
80
80
  var displayGrid = function displayGrid(visible, gridType, highlight) {
81
81
  var _pluginInjectionApi$g;
82
- return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$g = pluginInjectionApi.grid.actions) === null || _pluginInjectionApi$g === void 0 ? void 0 : _pluginInjectionApi$g.displayGrid(view)({
82
+ return pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$g = pluginInjectionApi.grid.actions) === null || _pluginInjectionApi$g === void 0 ? void 0 : _pluginInjectionApi$g.displayGrid(view)({
83
83
  visible: visible,
84
84
  gridType: gridType,
85
85
  highlight: highlight
@@ -99,7 +99,7 @@ var CardInner = function CardInner(_ref) {
99
99
  }), smartCard);
100
100
  };
101
101
  // eslint-disable-next-line @repo/internal/react/no-class-components
102
- var EmbedCardComponent = /*#__PURE__*/function (_React$PureComponent) {
102
+ var EmbedCardComponent = exports.EmbedCardComponent = /*#__PURE__*/function (_React$PureComponent) {
103
103
  (0, _inherits2.default)(EmbedCardComponent, _React$PureComponent);
104
104
  var _super = _createSuper(EmbedCardComponent);
105
105
  function EmbedCardComponent() {
@@ -338,12 +338,11 @@ var EmbedCardComponent = /*#__PURE__*/function (_React$PureComponent) {
338
338
  }]);
339
339
  return EmbedCardComponent;
340
340
  }(_react.default.PureComponent);
341
- exports.EmbedCardComponent = EmbedCardComponent;
342
341
  (0, _defineProperty2.default)(EmbedCardComponent, "contextTypes", {
343
342
  contextAdapter: _propTypes.default.object
344
343
  });
345
344
  var WrappedBlockCard = (0, _genericCard.Card)(EmbedCardComponent, _ui.UnsupportedBlock);
346
- var EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
345
+ var EmbedCard = exports.EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
347
346
  (0, _inherits2.default)(EmbedCard, _ReactNodeView);
348
347
  var _super2 = _createSuper(EmbedCard);
349
348
  function EmbedCard() {
@@ -394,5 +393,4 @@ var EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
394
393
  }
395
394
  }]);
396
395
  return EmbedCard;
397
- }(_reactNodeView.default);
398
- exports.EmbedCard = EmbedCard;
396
+ }(_reactNodeView.default);
@@ -101,7 +101,7 @@ function Card(SmartCardComponent, UnsupportedComponent) {
101
101
  if (!getPos || typeof getPos === 'boolean') {
102
102
  return;
103
103
  }
104
- (0, _doc.changeSelectedCardToLinkFallback)(undefined, url, true, node, getPos(), pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(view.state, view.dispatch);
104
+ (0, _doc.changeSelectedCardToLinkFallback)(undefined, url, true, node, getPos(), pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(view.state, view.dispatch);
105
105
  return null;
106
106
  } else {
107
107
  // Otherwise, render a blue link as fallback (above in render()).
@@ -23,7 +23,7 @@ var _genericCard = require("./genericCard");
23
23
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
24
24
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
25
25
  // eslint-disable-next-line @repo/internal/react/no-class-components
26
- var InlineCardComponent = /*#__PURE__*/function (_React$PureComponent) {
26
+ var InlineCardComponent = exports.InlineCardComponent = /*#__PURE__*/function (_React$PureComponent) {
27
27
  (0, _inherits2.default)(InlineCardComponent, _React$PureComponent);
28
28
  var _super = _createSuper(InlineCardComponent);
29
29
  function InlineCardComponent() {
@@ -111,7 +111,6 @@ var InlineCardComponent = /*#__PURE__*/function (_React$PureComponent) {
111
111
  }]);
112
112
  return InlineCardComponent;
113
113
  }(_react.default.PureComponent);
114
- exports.InlineCardComponent = InlineCardComponent;
115
114
  (0, _defineProperty2.default)(InlineCardComponent, "contextTypes", {
116
115
  contextAdapter: _propTypes.default.object
117
116
  });
@@ -30,11 +30,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
30
30
  * Card plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
31
31
  * from `@atlaskit/editor-core`.
32
32
  */
33
- var cardPlugin = function cardPlugin(_ref) {
33
+ var cardPlugin = exports.cardPlugin = function cardPlugin(_ref) {
34
34
  var _api$featureFlags;
35
35
  var options = _ref.config,
36
36
  api = _ref.api;
37
- var featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
37
+ var featureFlags = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
38
38
  var cardPluginEvents = featureFlags !== null && featureFlags !== void 0 && featureFlags.lpAnalyticsEventsNext ? (0, _createEventsQueue.createEventsQueue)() : undefined;
39
39
  return {
40
40
  name: 'card',
@@ -167,5 +167,4 @@ var cardPlugin = function cardPlugin(_ref) {
167
167
  }
168
168
  }
169
169
  };
170
- };
171
- exports.cardPlugin = cardPlugin;
170
+ };
@@ -5,11 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.showLinkToolbar = exports.showDatasourceModal = exports.setProvider = exports.setDatasourceTableRef = exports.setCardLayoutAndDatasourceTableRef = exports.setCardLayout = exports.resolveCard = exports.registerSmartCardEvents = exports.registerCard = exports.queueCards = exports.hideLinkToolbar = exports.hideDatasourceModal = exports.cardAction = void 0;
7
7
  var _pluginKey = require("./plugin-key");
8
- var cardAction = function cardAction(tr, action) {
8
+ var cardAction = exports.cardAction = function cardAction(tr, action) {
9
9
  return tr.setMeta(_pluginKey.pluginKey, action);
10
10
  };
11
- exports.cardAction = cardAction;
12
- var resolveCard = function resolveCard(url) {
11
+ var resolveCard = exports.resolveCard = function resolveCard(url) {
13
12
  return function (tr) {
14
13
  return cardAction(tr, {
15
14
  type: 'RESOLVE',
@@ -17,8 +16,7 @@ var resolveCard = function resolveCard(url) {
17
16
  });
18
17
  };
19
18
  };
20
- exports.resolveCard = resolveCard;
21
- var queueCards = function queueCards(requests) {
19
+ var queueCards = exports.queueCards = function queueCards(requests) {
22
20
  return function (tr) {
23
21
  return cardAction(tr, {
24
22
  type: 'QUEUE',
@@ -26,8 +24,7 @@ var queueCards = function queueCards(requests) {
26
24
  });
27
25
  };
28
26
  };
29
- exports.queueCards = queueCards;
30
- var registerCard = function registerCard(info) {
27
+ var registerCard = exports.registerCard = function registerCard(info) {
31
28
  return function (tr) {
32
29
  return cardAction(tr, {
33
30
  type: 'REGISTER',
@@ -35,8 +32,7 @@ var registerCard = function registerCard(info) {
35
32
  });
36
33
  };
37
34
  };
38
- exports.registerCard = registerCard;
39
- var registerSmartCardEvents = function registerSmartCardEvents(smartLinkEvents) {
35
+ var registerSmartCardEvents = exports.registerSmartCardEvents = function registerSmartCardEvents(smartLinkEvents) {
40
36
  return function (tr) {
41
37
  return cardAction(tr, {
42
38
  type: 'REGISTER_EVENTS',
@@ -44,8 +40,7 @@ var registerSmartCardEvents = function registerSmartCardEvents(smartLinkEvents)
44
40
  });
45
41
  };
46
42
  };
47
- exports.registerSmartCardEvents = registerSmartCardEvents;
48
- var setProvider = function setProvider(cardProvider) {
43
+ var setProvider = exports.setProvider = function setProvider(cardProvider) {
49
44
  return function (tr) {
50
45
  return cardAction(tr, {
51
46
  type: 'SET_PROVIDER',
@@ -53,8 +48,7 @@ var setProvider = function setProvider(cardProvider) {
53
48
  });
54
49
  };
55
50
  };
56
- exports.setProvider = setProvider;
57
- var setDatasourceTableRef = function setDatasourceTableRef(datasourceTableRef) {
51
+ var setDatasourceTableRef = exports.setDatasourceTableRef = function setDatasourceTableRef(datasourceTableRef) {
58
52
  return function (tr) {
59
53
  return cardAction(tr, {
60
54
  type: 'SET_DATASOURCE_TABLE_REF',
@@ -62,8 +56,7 @@ var setDatasourceTableRef = function setDatasourceTableRef(datasourceTableRef) {
62
56
  });
63
57
  };
64
58
  };
65
- exports.setDatasourceTableRef = setDatasourceTableRef;
66
- var setCardLayout = function setCardLayout(layout) {
59
+ var setCardLayout = exports.setCardLayout = function setCardLayout(layout) {
67
60
  return function (tr) {
68
61
  return cardAction(tr, {
69
62
  type: 'SET_CARD_LAYOUT',
@@ -71,8 +64,7 @@ var setCardLayout = function setCardLayout(layout) {
71
64
  });
72
65
  };
73
66
  };
74
- exports.setCardLayout = setCardLayout;
75
- var setCardLayoutAndDatasourceTableRef = function setCardLayoutAndDatasourceTableRef(_ref) {
67
+ var setCardLayoutAndDatasourceTableRef = exports.setCardLayoutAndDatasourceTableRef = function setCardLayoutAndDatasourceTableRef(_ref) {
76
68
  var layout = _ref.layout,
77
69
  datasourceTableRef = _ref.datasourceTableRef;
78
70
  return function (tr) {
@@ -83,20 +75,17 @@ var setCardLayoutAndDatasourceTableRef = function setCardLayoutAndDatasourceTabl
83
75
  });
84
76
  };
85
77
  };
86
- exports.setCardLayoutAndDatasourceTableRef = setCardLayoutAndDatasourceTableRef;
87
- var showLinkToolbar = function showLinkToolbar(tr) {
78
+ var showLinkToolbar = exports.showLinkToolbar = function showLinkToolbar(tr) {
88
79
  return cardAction(tr, {
89
80
  type: 'SHOW_LINK_TOOLBAR'
90
81
  });
91
82
  };
92
- exports.showLinkToolbar = showLinkToolbar;
93
- var hideLinkToolbar = function hideLinkToolbar(tr) {
83
+ var hideLinkToolbar = exports.hideLinkToolbar = function hideLinkToolbar(tr) {
94
84
  return cardAction(tr, {
95
85
  type: 'HIDE_LINK_TOOLBAR'
96
86
  });
97
87
  };
98
- exports.hideLinkToolbar = hideLinkToolbar;
99
- var showDatasourceModal = function showDatasourceModal(modalType) {
88
+ var showDatasourceModal = exports.showDatasourceModal = function showDatasourceModal(modalType) {
100
89
  return function (tr) {
101
90
  return cardAction(tr, {
102
91
  type: 'SHOW_DATASOURCE_MODAL',
@@ -104,10 +93,8 @@ var showDatasourceModal = function showDatasourceModal(modalType) {
104
93
  });
105
94
  };
106
95
  };
107
- exports.showDatasourceModal = showDatasourceModal;
108
- var hideDatasourceModal = function hideDatasourceModal(tr) {
96
+ var hideDatasourceModal = exports.hideDatasourceModal = function hideDatasourceModal(tr) {
109
97
  return cardAction(tr, {
110
98
  type: 'HIDE_DATASOURCE_MODAL'
111
99
  });
112
- };
113
- exports.hideDatasourceModal = hideDatasourceModal;
100
+ };