@atlaskit/editor-plugin-card 1.0.5 → 1.0.6

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 1.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#75568](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/75568) [`cf557c64b311`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/cf557c64b311) - Updated DatasourceErrorBoundary to pass error, datasourceId and datasourceModalType to LazyLoadedDatasourceRenderFailedAnalyticsWrapper
8
+
3
9
  ## 1.0.5
4
10
 
5
11
  ### Patch Changes
@@ -29,7 +29,8 @@ var DatasourceErrorBoundary = exports.DatasourceErrorBoundary = /*#__PURE__*/fun
29
29
  }
30
30
  _this = _super.call.apply(_super, [this].concat(args));
31
31
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
32
- isError: false
32
+ isError: false,
33
+ error: null
33
34
  });
34
35
  return _this;
35
36
  }
@@ -42,7 +43,8 @@ var DatasourceErrorBoundary = exports.DatasourceErrorBoundary = /*#__PURE__*/fun
42
43
  // prevent re-render children with error
43
44
  if (this.state.isError) {
44
45
  this.setState({
45
- isError: true
46
+ isError: true,
47
+ error: error
46
48
  });
47
49
  }
48
50
  }
@@ -52,13 +54,22 @@ var DatasourceErrorBoundary = exports.DatasourceErrorBoundary = /*#__PURE__*/fun
52
54
  var _this$props = this.props,
53
55
  url = _this$props.url,
54
56
  UnsupportedComponent = _this$props.unsupportedComponent,
55
- view = _this$props.view;
57
+ view = _this$props.view,
58
+ datasourceModalType = _this$props.datasourceModalType,
59
+ datasourceId = _this$props.datasourceId;
56
60
  if (this.state.isError) {
57
61
  if (url && (0, _adfSchema.isSafeUrl)(url)) {
58
- return /*#__PURE__*/_react.default.createElement(_linkDatasource.LazyLoadedDatasourceRenderFailedAnalyticsWrapper, null, (0, _doc.setSelectedCardAppearance)('inline', undefined)(view.state, view.dispatch));
62
+ return /*#__PURE__*/_react.default.createElement(_linkDatasource.LazyLoadedDatasourceRenderFailedAnalyticsWrapper, {
63
+ datasourceId: datasourceId,
64
+ error: this.state.error
65
+ }, (0, _doc.setSelectedCardAppearance)('inline', undefined)(view.state, view.dispatch));
59
66
  } else {
60
67
  var unsupportedComponent = UnsupportedComponent ? /*#__PURE__*/_react.default.createElement(UnsupportedComponent, null) : null;
61
- return /*#__PURE__*/_react.default.createElement(_linkDatasource.LazyLoadedDatasourceRenderFailedAnalyticsWrapper, null, unsupportedComponent);
68
+ return /*#__PURE__*/_react.default.createElement(_linkDatasource.LazyLoadedDatasourceRenderFailedAnalyticsWrapper, {
69
+ datasourceModalType: datasourceModalType,
70
+ datasourceId: datasourceId,
71
+ error: this.state.error
72
+ }, unsupportedComponent);
62
73
  }
63
74
  } else {
64
75
  return this.props.children;
@@ -68,7 +79,8 @@ var DatasourceErrorBoundary = exports.DatasourceErrorBoundary = /*#__PURE__*/fun
68
79
  key: "getDerivedStateFromError",
69
80
  value: function getDerivedStateFromError(error) {
70
81
  return {
71
- isError: true
82
+ isError: true,
83
+ error: error
72
84
  };
73
85
  }
74
86
  }]);
@@ -230,11 +230,13 @@ var Datasource = exports.Datasource = /*#__PURE__*/function (_ReactNodeView) {
230
230
  }, {
231
231
  key: "render",
232
232
  value: function render() {
233
+ var _attrs$datasource;
233
234
  var attrs = this.node.attrs;
234
235
  return (0, _react2.jsx)(_datasourceErrorBoundary.DatasourceErrorBoundary, {
235
236
  unsupportedComponent: _ui.UnsupportedInline,
236
237
  view: this.view,
237
- url: attrs.url
238
+ url: attrs.url,
239
+ datasourceId: attrs === null || attrs === void 0 || (_attrs$datasource = attrs.datasource) === null || _attrs$datasource === void 0 ? void 0 : _attrs$datasource.id
238
240
  }, (0, _react2.jsx)("div", {
239
241
  className: _styles.DATASOURCE_INNER_CONTAINER_CLASSNAME,
240
242
  style: {
@@ -19,7 +19,8 @@ var ModalWithState = function ModalWithState(_ref) {
19
19
  return null;
20
20
  }
21
21
  return /*#__PURE__*/_react.default.createElement(_datasourceErrorBoundary.DatasourceErrorBoundary, {
22
- view: editorView
22
+ view: editorView,
23
+ datasourceModalType: cardState === null || cardState === void 0 ? void 0 : cardState.datasourceModalType
23
24
  }, /*#__PURE__*/_react.default.createElement(_CardContextProvider.CardContextProvider, null, function (_ref2) {
24
25
  var cardContext = _ref2.cardContext;
25
26
  return /*#__PURE__*/_react.default.createElement(_index.DatasourceModal, {
@@ -8,12 +8,14 @@ export class DatasourceErrorBoundary extends React.Component {
8
8
  constructor(...args) {
9
9
  super(...args);
10
10
  _defineProperty(this, "state", {
11
- isError: false
11
+ isError: false,
12
+ error: null
12
13
  });
13
14
  }
14
15
  static getDerivedStateFromError(error) {
15
16
  return {
16
- isError: true
17
+ isError: true,
18
+ error
17
19
  };
18
20
  }
19
21
  componentDidCatch(error) {
@@ -23,7 +25,8 @@ export class DatasourceErrorBoundary extends React.Component {
23
25
  // prevent re-render children with error
24
26
  if (this.state.isError) {
25
27
  this.setState({
26
- isError: true
28
+ isError: true,
29
+ error
27
30
  });
28
31
  }
29
32
  }
@@ -31,14 +34,23 @@ export class DatasourceErrorBoundary extends React.Component {
31
34
  const {
32
35
  url,
33
36
  unsupportedComponent: UnsupportedComponent,
34
- view
37
+ view,
38
+ datasourceModalType,
39
+ datasourceId
35
40
  } = this.props;
36
41
  if (this.state.isError) {
37
42
  if (url && isSafeUrl(url)) {
38
- return /*#__PURE__*/React.createElement(LazyLoadedDatasourceRenderFailedAnalyticsWrapper, null, setSelectedCardAppearance('inline', undefined)(view.state, view.dispatch));
43
+ return /*#__PURE__*/React.createElement(LazyLoadedDatasourceRenderFailedAnalyticsWrapper, {
44
+ datasourceId: datasourceId,
45
+ error: this.state.error
46
+ }, setSelectedCardAppearance('inline', undefined)(view.state, view.dispatch));
39
47
  } else {
40
48
  const unsupportedComponent = UnsupportedComponent ? /*#__PURE__*/React.createElement(UnsupportedComponent, null) : null;
41
- return /*#__PURE__*/React.createElement(LazyLoadedDatasourceRenderFailedAnalyticsWrapper, null, unsupportedComponent);
49
+ return /*#__PURE__*/React.createElement(LazyLoadedDatasourceRenderFailedAnalyticsWrapper, {
50
+ datasourceModalType: datasourceModalType,
51
+ datasourceId: datasourceId,
52
+ error: this.state.error
53
+ }, unsupportedComponent);
42
54
  }
43
55
  } else {
44
56
  return this.props.children;
@@ -185,13 +185,15 @@ export class Datasource extends ReactNodeView {
185
185
  return domRef;
186
186
  }
187
187
  render() {
188
+ var _attrs$datasource;
188
189
  const {
189
190
  attrs
190
191
  } = this.node;
191
192
  return jsx(DatasourceErrorBoundary, {
192
193
  unsupportedComponent: UnsupportedInline,
193
194
  view: this.view,
194
- url: attrs.url
195
+ url: attrs.url,
196
+ datasourceId: attrs === null || attrs === void 0 ? void 0 : (_attrs$datasource = attrs.datasource) === null || _attrs$datasource === void 0 ? void 0 : _attrs$datasource.id
195
197
  }, jsx("div", {
196
198
  className: DATASOURCE_INNER_CONTAINER_CLASSNAME,
197
199
  style: {
@@ -14,7 +14,8 @@ const ModalWithState = ({
14
14
  return null;
15
15
  }
16
16
  return /*#__PURE__*/React.createElement(DatasourceErrorBoundary, {
17
- view: editorView
17
+ view: editorView,
18
+ datasourceModalType: cardState === null || cardState === void 0 ? void 0 : cardState.datasourceModalType
18
19
  }, /*#__PURE__*/React.createElement(CardContextProvider, null, ({
19
20
  cardContext
20
21
  }) => /*#__PURE__*/React.createElement(DatasourceModal, {
@@ -23,7 +23,8 @@ export var DatasourceErrorBoundary = /*#__PURE__*/function (_React$Component) {
23
23
  }
24
24
  _this = _super.call.apply(_super, [this].concat(args));
25
25
  _defineProperty(_assertThisInitialized(_this), "state", {
26
- isError: false
26
+ isError: false,
27
+ error: null
27
28
  });
28
29
  return _this;
29
30
  }
@@ -36,7 +37,8 @@ export var DatasourceErrorBoundary = /*#__PURE__*/function (_React$Component) {
36
37
  // prevent re-render children with error
37
38
  if (this.state.isError) {
38
39
  this.setState({
39
- isError: true
40
+ isError: true,
41
+ error: error
40
42
  });
41
43
  }
42
44
  }
@@ -46,13 +48,22 @@ export var DatasourceErrorBoundary = /*#__PURE__*/function (_React$Component) {
46
48
  var _this$props = this.props,
47
49
  url = _this$props.url,
48
50
  UnsupportedComponent = _this$props.unsupportedComponent,
49
- view = _this$props.view;
51
+ view = _this$props.view,
52
+ datasourceModalType = _this$props.datasourceModalType,
53
+ datasourceId = _this$props.datasourceId;
50
54
  if (this.state.isError) {
51
55
  if (url && isSafeUrl(url)) {
52
- return /*#__PURE__*/React.createElement(LazyLoadedDatasourceRenderFailedAnalyticsWrapper, null, setSelectedCardAppearance('inline', undefined)(view.state, view.dispatch));
56
+ return /*#__PURE__*/React.createElement(LazyLoadedDatasourceRenderFailedAnalyticsWrapper, {
57
+ datasourceId: datasourceId,
58
+ error: this.state.error
59
+ }, setSelectedCardAppearance('inline', undefined)(view.state, view.dispatch));
53
60
  } else {
54
61
  var unsupportedComponent = UnsupportedComponent ? /*#__PURE__*/React.createElement(UnsupportedComponent, null) : null;
55
- return /*#__PURE__*/React.createElement(LazyLoadedDatasourceRenderFailedAnalyticsWrapper, null, unsupportedComponent);
62
+ return /*#__PURE__*/React.createElement(LazyLoadedDatasourceRenderFailedAnalyticsWrapper, {
63
+ datasourceModalType: datasourceModalType,
64
+ datasourceId: datasourceId,
65
+ error: this.state.error
66
+ }, unsupportedComponent);
56
67
  }
57
68
  } else {
58
69
  return this.props.children;
@@ -62,7 +73,8 @@ export var DatasourceErrorBoundary = /*#__PURE__*/function (_React$Component) {
62
73
  key: "getDerivedStateFromError",
63
74
  value: function getDerivedStateFromError(error) {
64
75
  return {
65
- isError: true
76
+ isError: true,
77
+ error: error
66
78
  };
67
79
  }
68
80
  }]);
@@ -224,11 +224,13 @@ export var Datasource = /*#__PURE__*/function (_ReactNodeView) {
224
224
  }, {
225
225
  key: "render",
226
226
  value: function render() {
227
+ var _attrs$datasource;
227
228
  var attrs = this.node.attrs;
228
229
  return jsx(DatasourceErrorBoundary, {
229
230
  unsupportedComponent: UnsupportedInline,
230
231
  view: this.view,
231
- url: attrs.url
232
+ url: attrs.url,
233
+ datasourceId: attrs === null || attrs === void 0 || (_attrs$datasource = attrs.datasource) === null || _attrs$datasource === void 0 ? void 0 : _attrs$datasource.id
232
234
  }, jsx("div", {
233
235
  className: DATASOURCE_INNER_CONTAINER_CLASSNAME,
234
236
  style: {
@@ -12,7 +12,8 @@ var ModalWithState = function ModalWithState(_ref) {
12
12
  return null;
13
13
  }
14
14
  return /*#__PURE__*/React.createElement(DatasourceErrorBoundary, {
15
- view: editorView
15
+ view: editorView,
16
+ datasourceModalType: cardState === null || cardState === void 0 ? void 0 : cardState.datasourceModalType
16
17
  }, /*#__PURE__*/React.createElement(CardContextProvider, null, function (_ref2) {
17
18
  var cardContext = _ref2.cardContext;
18
19
  return /*#__PURE__*/React.createElement(DatasourceModal, {
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import type { DatasourceModalType } from '@atlaskit/editor-common/types';
2
3
  import type { APIError } from '@atlaskit/smart-card';
3
4
  import type { DatasourceProps } from './nodeviews/datasource';
4
5
  export type DatasourceErrorBoundaryProps = {
@@ -6,13 +7,17 @@ export type DatasourceErrorBoundaryProps = {
6
7
  unsupportedComponent?: React.ComponentType;
7
8
  handleError?: () => void;
8
9
  view: DatasourceProps['view'];
10
+ datasourceModalType?: DatasourceModalType;
11
+ datasourceId?: string;
9
12
  };
10
13
  export declare class DatasourceErrorBoundary extends React.Component<DatasourceErrorBoundaryProps> {
11
14
  state: {
12
15
  isError: boolean;
16
+ error: null;
13
17
  };
14
18
  static getDerivedStateFromError(error: Error | APIError): {
15
19
  isError: boolean;
20
+ error: Error | APIError;
16
21
  };
17
22
  componentDidCatch(error: Error | APIError): void;
18
23
  render(): React.ReactNode;
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import type { DatasourceModalType } from '@atlaskit/editor-common/types';
2
3
  import type { APIError } from '@atlaskit/smart-card';
3
4
  import type { DatasourceProps } from './nodeviews/datasource';
4
5
  export type DatasourceErrorBoundaryProps = {
@@ -6,13 +7,17 @@ export type DatasourceErrorBoundaryProps = {
6
7
  unsupportedComponent?: React.ComponentType;
7
8
  handleError?: () => void;
8
9
  view: DatasourceProps['view'];
10
+ datasourceModalType?: DatasourceModalType;
11
+ datasourceId?: string;
9
12
  };
10
13
  export declare class DatasourceErrorBoundary extends React.Component<DatasourceErrorBoundaryProps> {
11
14
  state: {
12
15
  isError: boolean;
16
+ error: null;
13
17
  };
14
18
  static getDerivedStateFromError(error: Error | APIError): {
15
19
  isError: boolean;
20
+ error: Error | APIError;
16
21
  };
17
22
  componentDidCatch(error: Error | APIError): void;
18
23
  render(): React.ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,7 +35,7 @@
35
35
  "@atlaskit/adf-schema": "^35.5.1",
36
36
  "@atlaskit/analytics-next": "^9.2.0",
37
37
  "@atlaskit/custom-steps": "^0.0.13",
38
- "@atlaskit/editor-common": "^78.7.0",
38
+ "@atlaskit/editor-common": "^78.9.0",
39
39
  "@atlaskit/editor-plugin-analytics": "^1.0.0",
40
40
  "@atlaskit/editor-plugin-decorations": "^1.0.0",
41
41
  "@atlaskit/editor-plugin-feature-flags": "^1.0.0",
@@ -53,7 +53,7 @@
53
53
  "@atlaskit/linking-common": "^5.3.0",
54
54
  "@atlaskit/linking-types": "^8.6.0",
55
55
  "@atlaskit/platform-feature-flags": "^0.2.0",
56
- "@atlaskit/primitives": "^3.0.0",
56
+ "@atlaskit/primitives": "^3.1.0",
57
57
  "@atlaskit/smart-card": "^26.48.0",
58
58
  "@atlaskit/theme": "^12.6.0",
59
59
  "@atlaskit/tokens": "^1.38.0",