@atlaskit/renderer 109.10.2 → 109.10.4

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,17 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 109.10.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#81323](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/81323) [`88bfdbce168d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/88bfdbce168d) - [EDF-426] Added special handling for dom errors in renderer to resolve DOM errors from Google translate interactions. This is behind a platform flag (platform.editor.renderer-error-boundary-for-dom-errors) and adds a new analytics event (CAUGHT_DOM_ERROR).
8
+
9
+ ## 109.10.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [#83164](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/83164) [`4d25a598eda2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4d25a598eda2) - [ux] Update alignment for summary block error text
14
+
3
15
  ## 109.10.2
4
16
 
5
17
  ### Patch Changes
@@ -14,9 +14,11 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
14
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
15
  var _react = _interopRequireDefault(require("react"));
16
16
  var _analytics = require("@atlaskit/editor-common/analytics");
17
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
18
  var _analyticsListeners = require("@atlaskit/analytics-listeners");
18
19
  var _monitoring = require("@atlaskit/editor-common/monitoring");
19
20
  var _events = require("../../analytics/events");
21
+ var _uuid = _interopRequireDefault(require("uuid"));
20
22
  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); }; }
21
23
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
22
24
  var ErrorBoundary = exports.ErrorBoundary = /*#__PURE__*/function (_React$Component) {
@@ -30,7 +32,8 @@ var ErrorBoundary = exports.ErrorBoundary = /*#__PURE__*/function (_React$Compon
30
32
  }
31
33
  _this = _super.call.apply(_super, [this].concat(args));
32
34
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
33
- errorCaptured: false
35
+ errorCaptured: false,
36
+ domError: false
34
37
  });
35
38
  return _this;
36
39
  }
@@ -72,6 +75,27 @@ var ErrorBoundary = exports.ErrorBoundary = /*#__PURE__*/function (_React$Compon
72
75
  (0, _monitoring.logException)(error, {
73
76
  location: 'renderer'
74
77
  });
78
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.renderer-error-boundary-for-dom-errors')) {
79
+ var pattern = /Failed to execute.*on 'Node'.*/;
80
+ var matchesPattern = pattern.test(error.message);
81
+ if (matchesPattern) {
82
+ this.fireAnalyticsEvent({
83
+ action: _analytics.ACTION.CAUGHT_DOM_ERROR,
84
+ actionSubject: this.props.component,
85
+ actionSubjectId: this.props.componentId,
86
+ eventType: _analytics.EVENT_TYPE.OPERATIONAL,
87
+ attributes: {
88
+ platform: _events.PLATFORM.WEB,
89
+ errorMessage: error === null || error === void 0 ? void 0 : error.message
90
+ }
91
+ });
92
+ this.setState(function () {
93
+ return {
94
+ domError: true
95
+ };
96
+ });
97
+ }
98
+ }
75
99
  if (this.hasFallback()) {
76
100
  this.setState({
77
101
  errorCaptured: true
@@ -85,6 +109,13 @@ var ErrorBoundary = exports.ErrorBoundary = /*#__PURE__*/function (_React$Compon
85
109
  }, {
86
110
  key: "render",
87
111
  value: function render() {
112
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.renderer-error-boundary-for-dom-errors')) {
113
+ if (this.state.domError) {
114
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
115
+ key: (0, _uuid.default)()
116
+ }, this.props.children);
117
+ }
118
+ }
88
119
  if (this.shouldRecover()) {
89
120
  return this.props.fallbackComponent;
90
121
  }
@@ -55,7 +55,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
55
55
  var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
56
56
  var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
57
57
  var packageName = "@atlaskit/renderer";
58
- var packageVersion = "109.10.2";
58
+ var packageVersion = "109.10.4";
59
59
  var Renderer = exports.Renderer = /*#__PURE__*/function (_PureComponent) {
60
60
  (0, _inherits2.default)(Renderer, _PureComponent);
61
61
  var _super = _createSuper(Renderer);
@@ -1,14 +1,17 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
3
  import { ACTION, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
4
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
4
5
  import { FabricChannel } from '@atlaskit/analytics-listeners';
5
6
  import { logException } from '@atlaskit/editor-common/monitoring';
6
7
  import { PLATFORM } from '../../analytics/events';
8
+ import uuid from 'uuid';
7
9
  export class ErrorBoundary extends React.Component {
8
10
  constructor(...args) {
9
11
  super(...args);
10
12
  _defineProperty(this, "state", {
11
- errorCaptured: false
13
+ errorCaptured: false,
14
+ domError: false
12
15
  });
13
16
  }
14
17
  fireAnalyticsEvent(event) {
@@ -42,6 +45,25 @@ export class ErrorBoundary extends React.Component {
42
45
  logException(error, {
43
46
  location: 'renderer'
44
47
  });
48
+ if (getBooleanFF('platform.editor.renderer-error-boundary-for-dom-errors')) {
49
+ const pattern = /Failed to execute.*on 'Node'.*/;
50
+ const matchesPattern = pattern.test(error.message);
51
+ if (matchesPattern) {
52
+ this.fireAnalyticsEvent({
53
+ action: ACTION.CAUGHT_DOM_ERROR,
54
+ actionSubject: this.props.component,
55
+ actionSubjectId: this.props.componentId,
56
+ eventType: EVENT_TYPE.OPERATIONAL,
57
+ attributes: {
58
+ platform: PLATFORM.WEB,
59
+ errorMessage: error === null || error === void 0 ? void 0 : error.message
60
+ }
61
+ });
62
+ this.setState(() => ({
63
+ domError: true
64
+ }));
65
+ }
66
+ }
45
67
  if (this.hasFallback()) {
46
68
  this.setState({
47
69
  errorCaptured: true
@@ -53,6 +75,13 @@ export class ErrorBoundary extends React.Component {
53
75
  }
54
76
  }
55
77
  render() {
78
+ if (getBooleanFF('platform.editor.renderer-error-boundary-for-dom-errors')) {
79
+ if (this.state.domError) {
80
+ return /*#__PURE__*/React.createElement(React.Fragment, {
81
+ key: uuid()
82
+ }, this.props.children);
83
+ }
84
+ }
56
85
  if (this.shouldRecover()) {
57
86
  return this.props.fallbackComponent;
58
87
  }
@@ -36,7 +36,7 @@ import { EditorMediaClientProvider } from '../../react/utils/EditorMediaClientPr
36
36
  export const NORMAL_SEVERITY_THRESHOLD = 2000;
37
37
  export const DEGRADED_SEVERITY_THRESHOLD = 3000;
38
38
  const packageName = "@atlaskit/renderer";
39
- const packageVersion = "109.10.2";
39
+ const packageVersion = "109.10.4";
40
40
  export class Renderer extends PureComponent {
41
41
  constructor(props) {
42
42
  super(props);
@@ -9,9 +9,11 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
9
9
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
10
10
  import React from 'react';
11
11
  import { ACTION, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
12
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
12
13
  import { FabricChannel } from '@atlaskit/analytics-listeners';
13
14
  import { logException } from '@atlaskit/editor-common/monitoring';
14
15
  import { PLATFORM } from '../../analytics/events';
16
+ import uuid from 'uuid';
15
17
  export var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
16
18
  _inherits(ErrorBoundary, _React$Component);
17
19
  var _super = _createSuper(ErrorBoundary);
@@ -23,7 +25,8 @@ export var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
23
25
  }
24
26
  _this = _super.call.apply(_super, [this].concat(args));
25
27
  _defineProperty(_assertThisInitialized(_this), "state", {
26
- errorCaptured: false
28
+ errorCaptured: false,
29
+ domError: false
27
30
  });
28
31
  return _this;
29
32
  }
@@ -65,6 +68,27 @@ export var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
65
68
  logException(error, {
66
69
  location: 'renderer'
67
70
  });
71
+ if (getBooleanFF('platform.editor.renderer-error-boundary-for-dom-errors')) {
72
+ var pattern = /Failed to execute.*on 'Node'.*/;
73
+ var matchesPattern = pattern.test(error.message);
74
+ if (matchesPattern) {
75
+ this.fireAnalyticsEvent({
76
+ action: ACTION.CAUGHT_DOM_ERROR,
77
+ actionSubject: this.props.component,
78
+ actionSubjectId: this.props.componentId,
79
+ eventType: EVENT_TYPE.OPERATIONAL,
80
+ attributes: {
81
+ platform: PLATFORM.WEB,
82
+ errorMessage: error === null || error === void 0 ? void 0 : error.message
83
+ }
84
+ });
85
+ this.setState(function () {
86
+ return {
87
+ domError: true
88
+ };
89
+ });
90
+ }
91
+ }
68
92
  if (this.hasFallback()) {
69
93
  this.setState({
70
94
  errorCaptured: true
@@ -78,6 +102,13 @@ export var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
78
102
  }, {
79
103
  key: "render",
80
104
  value: function render() {
105
+ if (getBooleanFF('platform.editor.renderer-error-boundary-for-dom-errors')) {
106
+ if (this.state.domError) {
107
+ return /*#__PURE__*/React.createElement(React.Fragment, {
108
+ key: uuid()
109
+ }, this.props.children);
110
+ }
111
+ }
81
112
  if (this.shouldRecover()) {
82
113
  return this.props.fallbackComponent;
83
114
  }
@@ -46,7 +46,7 @@ import { EditorMediaClientProvider } from '../../react/utils/EditorMediaClientPr
46
46
  export var NORMAL_SEVERITY_THRESHOLD = 2000;
47
47
  export var DEGRADED_SEVERITY_THRESHOLD = 3000;
48
48
  var packageName = "@atlaskit/renderer";
49
- var packageVersion = "109.10.2";
49
+ var packageVersion = "109.10.4";
50
50
  export var Renderer = /*#__PURE__*/function (_PureComponent) {
51
51
  _inherits(Renderer, _PureComponent);
52
52
  var _super = _createSuper(Renderer);
@@ -35,6 +35,10 @@ export type ComponentCrashErrorAEP = OperationalAEP<ACTION.CRASHED, ACTION_SUBJE
35
35
  componentStack?: string;
36
36
  errorRethrown?: boolean;
37
37
  }>;
38
+ export type ComponentCaughtDomErrorAEP = OperationalAEP<ACTION.CAUGHT_DOM_ERROR, ACTION_SUBJECT.RENDERER, ACTION_SUBJECT_ID, {
39
+ errorMessage: string;
40
+ platform: PLATFORM.WEB;
41
+ }>;
38
42
  type InvalidProsemirrorDocumentErrorAEP = AEP<ACTION.INVALID_PROSEMIRROR_DOCUMENT, ACTION_SUBJECT.RENDERER, ACTION_SUBJECT_ID, {
39
43
  platform: PLATFORM.WEB;
40
44
  errorStack?: string;
@@ -11,10 +11,12 @@ interface ErrorBoundaryProps {
11
11
  }
12
12
  interface ErrorBoundaryState {
13
13
  errorCaptured: boolean;
14
+ domError: boolean;
14
15
  }
15
16
  export declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
16
17
  state: {
17
18
  errorCaptured: boolean;
19
+ domError: boolean;
18
20
  };
19
21
  private fireAnalyticsEvent;
20
22
  private hasFallback;
@@ -35,6 +35,10 @@ export type ComponentCrashErrorAEP = OperationalAEP<ACTION.CRASHED, ACTION_SUBJE
35
35
  componentStack?: string;
36
36
  errorRethrown?: boolean;
37
37
  }>;
38
+ export type ComponentCaughtDomErrorAEP = OperationalAEP<ACTION.CAUGHT_DOM_ERROR, ACTION_SUBJECT.RENDERER, ACTION_SUBJECT_ID, {
39
+ errorMessage: string;
40
+ platform: PLATFORM.WEB;
41
+ }>;
38
42
  type InvalidProsemirrorDocumentErrorAEP = AEP<ACTION.INVALID_PROSEMIRROR_DOCUMENT, ACTION_SUBJECT.RENDERER, ACTION_SUBJECT_ID, {
39
43
  platform: PLATFORM.WEB;
40
44
  errorStack?: string;
@@ -11,10 +11,12 @@ interface ErrorBoundaryProps {
11
11
  }
12
12
  interface ErrorBoundaryState {
13
13
  errorCaptured: boolean;
14
+ domError: boolean;
14
15
  }
15
16
  export declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
16
17
  state: {
17
18
  errorCaptured: boolean;
19
+ domError: boolean;
18
20
  };
19
21
  private fireAnalyticsEvent;
20
22
  private hasFallback;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "109.10.2",
3
+ "version": "109.10.4",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -136,6 +136,9 @@
136
136
  },
137
137
  "platform.editor.allow-inline-comments-for-inline-nodes": {
138
138
  "type": "boolean"
139
+ },
140
+ "platform.editor.renderer-error-boundary-for-dom-errors": {
141
+ "type": "boolean"
139
142
  }
140
143
  },
141
144
  "af:exports": {