@atlaskit/collab-provider 9.17.4 → 9.17.5

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/collab-provider
2
2
 
3
+ ## 9.17.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#57454](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/57454) [`3f18e6719122`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3f18e6719122) - Add provider error code logging
8
+
3
9
  ## 9.17.4
4
10
 
5
11
  ### Patch Changes
@@ -96,6 +96,20 @@ var AnalyticsHelper = exports.default = /*#__PURE__*/function () {
96
96
  };
97
97
  this.sendEvent(errorAnalyticsEvent);
98
98
  }
99
+ }, {
100
+ key: "sendProviderErrorEvent",
101
+ value: function sendProviderErrorEvent(error) {
102
+ var errorAnalyticsEvent = {
103
+ eventAction: _const.EVENT_ACTION.ERROR,
104
+ attributes: {
105
+ documentAri: this.documentAri,
106
+ errorMessage: 'Error emitted',
107
+ errorCode: error.code,
108
+ mappedError: error
109
+ }
110
+ };
111
+ this.sendEvent(errorAnalyticsEvent);
112
+ }
99
113
  }, {
100
114
  key: "sendActionEvent",
101
115
  value: function sendActionEvent(action, status, attributes // This breaks discriminated unions, because there is no obvious field to discriminate against any more
@@ -173,10 +173,10 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
173
173
  var _this$analyticsHelper2;
174
174
  (_this$analyticsHelper2 = _this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 || _this$analyticsHelper2.sendErrorEvent(error, 'Error handled');
175
175
  var mappedError = (0, _errorCodeMapper.errorCodeMapper)(error);
176
- // Temporarily only emit errors to Confluence very intentionally because they will disconnect the collab provider
176
+ // Only emit errors to Confluence very intentionally because they will disconnect the collab provider
177
177
  if (mappedError) {
178
178
  var _this$analyticsHelper3;
179
- (_this$analyticsHelper3 = _this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 || _this$analyticsHelper3.sendErrorEvent(mappedError, 'Error emitted');
179
+ (_this$analyticsHelper3 = _this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 || _this$analyticsHelper3.sendProviderErrorEvent(mappedError);
180
180
  _this.emit('error', mappedError);
181
181
  }
182
182
  }
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = exports.name = "@atlaskit/collab-provider";
8
- var version = exports.version = "9.17.4";
8
+ var version = exports.version = "9.17.5";
9
9
  var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
10
10
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
11
11
  };
@@ -81,6 +81,18 @@ export default class AnalyticsHelper {
81
81
  };
82
82
  this.sendEvent(errorAnalyticsEvent);
83
83
  }
84
+ sendProviderErrorEvent(error) {
85
+ const errorAnalyticsEvent = {
86
+ eventAction: EVENT_ACTION.ERROR,
87
+ attributes: {
88
+ documentAri: this.documentAri,
89
+ errorMessage: 'Error emitted',
90
+ errorCode: error.code,
91
+ mappedError: error
92
+ }
93
+ };
94
+ this.sendEvent(errorAnalyticsEvent);
95
+ }
84
96
  sendActionEvent(action, status, attributes // This breaks discriminated unions, because there is no obvious field to discriminate against any more
85
97
  ) {
86
98
  const analyticsEvent = {
@@ -151,10 +151,10 @@ export class Provider extends Emitter {
151
151
  var _this$analyticsHelper2;
152
152
  (_this$analyticsHelper2 = this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 ? void 0 : _this$analyticsHelper2.sendErrorEvent(error, 'Error handled');
153
153
  const mappedError = errorCodeMapper(error);
154
- // Temporarily only emit errors to Confluence very intentionally because they will disconnect the collab provider
154
+ // Only emit errors to Confluence very intentionally because they will disconnect the collab provider
155
155
  if (mappedError) {
156
156
  var _this$analyticsHelper3;
157
- (_this$analyticsHelper3 = this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 ? void 0 : _this$analyticsHelper3.sendErrorEvent(mappedError, 'Error emitted');
157
+ (_this$analyticsHelper3 = this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 ? void 0 : _this$analyticsHelper3.sendProviderErrorEvent(mappedError);
158
158
  this.emit('error', mappedError);
159
159
  }
160
160
  }
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/collab-provider";
2
- export const version = "9.17.4";
2
+ export const version = "9.17.5";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -89,6 +89,20 @@ var AnalyticsHelper = /*#__PURE__*/function () {
89
89
  };
90
90
  this.sendEvent(errorAnalyticsEvent);
91
91
  }
92
+ }, {
93
+ key: "sendProviderErrorEvent",
94
+ value: function sendProviderErrorEvent(error) {
95
+ var errorAnalyticsEvent = {
96
+ eventAction: EVENT_ACTION.ERROR,
97
+ attributes: {
98
+ documentAri: this.documentAri,
99
+ errorMessage: 'Error emitted',
100
+ errorCode: error.code,
101
+ mappedError: error
102
+ }
103
+ };
104
+ this.sendEvent(errorAnalyticsEvent);
105
+ }
92
106
  }, {
93
107
  key: "sendActionEvent",
94
108
  value: function sendActionEvent(action, status, attributes // This breaks discriminated unions, because there is no obvious field to discriminate against any more
@@ -166,10 +166,10 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
166
166
  var _this$analyticsHelper2;
167
167
  (_this$analyticsHelper2 = _this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 || _this$analyticsHelper2.sendErrorEvent(error, 'Error handled');
168
168
  var mappedError = errorCodeMapper(error);
169
- // Temporarily only emit errors to Confluence very intentionally because they will disconnect the collab provider
169
+ // Only emit errors to Confluence very intentionally because they will disconnect the collab provider
170
170
  if (mappedError) {
171
171
  var _this$analyticsHelper3;
172
- (_this$analyticsHelper3 = _this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 || _this$analyticsHelper3.sendErrorEvent(mappedError, 'Error emitted');
172
+ (_this$analyticsHelper3 = _this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 || _this$analyticsHelper3.sendProviderErrorEvent(mappedError);
173
173
  _this.emit('error', mappedError);
174
174
  }
175
175
  }
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/collab-provider";
2
- export var version = "9.17.4";
2
+ export var version = "9.17.5";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,4 +1,5 @@
1
1
  import type { AnalyticsWebClient } from '@atlaskit/analytics-listeners';
2
+ import type { ProviderError } from '@atlaskit/editor-common/collab';
2
3
  import type { ActionAnalyticsEvent, EVENT_STATUS } from '../helpers/const';
3
4
  export default class AnalyticsHelper {
4
5
  analyticsClient: AnalyticsWebClient | undefined;
@@ -6,6 +7,7 @@ export default class AnalyticsHelper {
6
7
  documentAri: string;
7
8
  constructor(documentAri: string, analyticsClient?: AnalyticsWebClient, getAnalyticsClient?: Promise<AnalyticsWebClient>);
8
9
  sendErrorEvent(error: unknown, errorMessage: string): void;
10
+ sendProviderErrorEvent(error: ProviderError): void;
9
11
  sendActionEvent(action: ActionAnalyticsEvent['eventAction'], status: EVENT_STATUS, attributes?: Omit<ActionAnalyticsEvent['attributes'], 'documentAri' | 'eventStatus'>): void;
10
12
  private sendEvent;
11
13
  }
@@ -52,7 +52,7 @@ export type ErrorAnalyticsEvent = {
52
52
  documentAri?: string;
53
53
  mappedError?: ProviderError;
54
54
  } & DocumentUpdateErrorAttributes;
55
- nonPrivacySafeAttributes: {
55
+ nonPrivacySafeAttributes?: {
56
56
  error: unknown;
57
57
  };
58
58
  };
@@ -1,4 +1,5 @@
1
1
  import type { AnalyticsWebClient } from '@atlaskit/analytics-listeners';
2
+ import type { ProviderError } from '@atlaskit/editor-common/collab';
2
3
  import type { ActionAnalyticsEvent, EVENT_STATUS } from '../helpers/const';
3
4
  export default class AnalyticsHelper {
4
5
  analyticsClient: AnalyticsWebClient | undefined;
@@ -6,6 +7,7 @@ export default class AnalyticsHelper {
6
7
  documentAri: string;
7
8
  constructor(documentAri: string, analyticsClient?: AnalyticsWebClient, getAnalyticsClient?: Promise<AnalyticsWebClient>);
8
9
  sendErrorEvent(error: unknown, errorMessage: string): void;
10
+ sendProviderErrorEvent(error: ProviderError): void;
9
11
  sendActionEvent(action: ActionAnalyticsEvent['eventAction'], status: EVENT_STATUS, attributes?: Omit<ActionAnalyticsEvent['attributes'], 'documentAri' | 'eventStatus'>): void;
10
12
  private sendEvent;
11
13
  }
@@ -52,7 +52,7 @@ export type ErrorAnalyticsEvent = {
52
52
  documentAri?: string;
53
53
  mappedError?: ProviderError;
54
54
  } & DocumentUpdateErrorAttributes;
55
- nonPrivacySafeAttributes: {
55
+ nonPrivacySafeAttributes?: {
56
56
  error: unknown;
57
57
  };
58
58
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/collab-provider",
3
- "version": "9.17.4",
3
+ "version": "9.17.5",
4
4
  "description": "A provider for collaborative editing.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"