@atlaskit/collab-provider 9.46.0 → 10.1.0
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 +77 -0
- package/dist/cjs/helpers/const.js +1 -0
- package/dist/cjs/participants/participants-helper.js +5 -3
- package/dist/cjs/provider/index.js +40 -32
- package/dist/cjs/types.js +0 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/helpers/const.js +1 -0
- package/dist/es2019/index.js +3 -0
- package/dist/es2019/participants/participants-helper.js +6 -2
- package/dist/es2019/provider/index.js +40 -32
- package/dist/es2019/types.js +0 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/helpers/const.js +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/participants/participants-helper.js +5 -3
- package/dist/esm/provider/index.js +40 -32
- package/dist/esm/types.js +0 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/helpers/const.d.ts +9 -1
- package/dist/types/provider/index.d.ts +4 -2
- package/dist/types/types.d.ts +10 -2
- package/dist/types-ts4.5/helpers/const.d.ts +9 -1
- package/dist/types-ts4.5/provider/index.d.ts +4 -2
- package/dist/types-ts4.5/types.d.ts +10 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,82 @@
|
|
|
1
1
|
# @atlaskit/collab-provider
|
|
2
2
|
|
|
3
|
+
## 10.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#167312](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/167312)
|
|
8
|
+
[`4fe6eb3b36fc3`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4fe6eb3b36fc3) -
|
|
9
|
+
Add support for optional properties, presenceId and presenceActivity, within collab-provider
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 10.0.0
|
|
16
|
+
|
|
17
|
+
### Major Changes
|
|
18
|
+
|
|
19
|
+
- [#165049](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/165049)
|
|
20
|
+
[`febce5463e07f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/febce5463e07f) -
|
|
21
|
+
Enable no-re-export rule for a subset of editor packages
|
|
22
|
+
|
|
23
|
+
### Major
|
|
24
|
+
|
|
25
|
+
#### @atlaskit/collab-provider
|
|
26
|
+
|
|
27
|
+
@atlaskit/collab-provider doesn't export following types anymore:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
CollabParticipant,
|
|
31
|
+
CollabEventInitData,
|
|
32
|
+
CollabEventRemoteData,
|
|
33
|
+
CollabEventConnectionData,
|
|
34
|
+
CollabEventConnectingData,
|
|
35
|
+
CollabEventPresenceData,
|
|
36
|
+
ResolvedEditorState,
|
|
37
|
+
CollabConnectedPayload,
|
|
38
|
+
CollabConnectingPayload,
|
|
39
|
+
CollabDisconnectedPayload,
|
|
40
|
+
CollabInitPayload,
|
|
41
|
+
CollabDataPayload,
|
|
42
|
+
CollabTelepointerPayload,
|
|
43
|
+
CollabPresencePayload,
|
|
44
|
+
CollabMetadataPayload,
|
|
45
|
+
CollabLocalStepsPayload,
|
|
46
|
+
CollabCommitStatusEventPayload,
|
|
47
|
+
CollabPermissionEventPayload,
|
|
48
|
+
UserPermitType,
|
|
49
|
+
CollabEvents,
|
|
50
|
+
Metadata,
|
|
51
|
+
StepJson,
|
|
52
|
+
CollabEventTelepointerData,
|
|
53
|
+
CollabSendableSelection,
|
|
54
|
+
CollabEditProvider,
|
|
55
|
+
NewCollabSyncUpErrorAttributes,
|
|
56
|
+
SyncUpErrorFunction,
|
|
57
|
+
CollabEventLocalStepData,
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Import them from `@atlaskit/editor-common/collab`.
|
|
61
|
+
|
|
62
|
+
#### @atlaskit/editor-common
|
|
63
|
+
|
|
64
|
+
`@atlaskit/editor-common/provider-factory` doesn't export following types anymore:
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
CardAdf,
|
|
68
|
+
DatasourceAdf,
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Import them from `@atlaskit/smart-card`.
|
|
72
|
+
|
|
73
|
+
### Patch Changes
|
|
74
|
+
|
|
75
|
+
- [#166394](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/166394)
|
|
76
|
+
[`ec83c51a9acba`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ec83c51a9acba) -
|
|
77
|
+
Add analytics on reconnection events
|
|
78
|
+
- Updated dependencies
|
|
79
|
+
|
|
3
80
|
## 9.46.0
|
|
4
81
|
|
|
5
82
|
### Minor Changes
|
|
@@ -22,6 +22,7 @@ var EVENT_ACTION = exports.EVENT_ACTION = /*#__PURE__*/function (EVENT_ACTION) {
|
|
|
22
22
|
EVENT_ACTION["DROPPED_STEPS"] = "droppedStepInCatchup";
|
|
23
23
|
EVENT_ACTION["WEBSOCKET_MESSAGE_VOLUME_METRIC"] = "websocketMessageVolumeMetric";
|
|
24
24
|
EVENT_ACTION["PROVIDER_INITIALIZED"] = "providerInitialized";
|
|
25
|
+
EVENT_ACTION["RECONNECTION"] = "providerReconnection";
|
|
25
26
|
EVENT_ACTION["PROVIDER_SETUP"] = "providerSetup";
|
|
26
27
|
EVENT_ACTION["HAS_UNCONFIRMED_STEPS"] = "hasUnconfirmedSteps";
|
|
27
28
|
return EVENT_ACTION;
|
|
@@ -13,11 +13,11 @@ var PARTICIPANT_UPDATE_INTERVAL = exports.PARTICIPANT_UPDATE_INTERVAL = 300 * 10
|
|
|
13
13
|
|
|
14
14
|
var createParticipantFromPayload = exports.createParticipantFromPayload = /*#__PURE__*/function () {
|
|
15
15
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(payload, getUser) {
|
|
16
|
-
var sessionId, timestamp, clientId, userId, permit, user, participant;
|
|
16
|
+
var sessionId, timestamp, clientId, userId, permit, presenceId, presenceActivity, user, participant;
|
|
17
17
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
18
18
|
while (1) switch (_context.prev = _context.next) {
|
|
19
19
|
case 0:
|
|
20
|
-
sessionId = payload.sessionId, timestamp = payload.timestamp, clientId = payload.clientId, userId = payload.userId, permit = payload.permit;
|
|
20
|
+
sessionId = payload.sessionId, timestamp = payload.timestamp, clientId = payload.clientId, userId = payload.userId, permit = payload.permit, presenceId = payload.presenceId, presenceActivity = payload.presenceActivity;
|
|
21
21
|
_context.next = 3;
|
|
22
22
|
return getUser === null || getUser === void 0 ? void 0 : getUser(userId);
|
|
23
23
|
case 3:
|
|
@@ -31,7 +31,9 @@ var createParticipantFromPayload = exports.createParticipantFromPayload = /*#__P
|
|
|
31
31
|
userId: userId,
|
|
32
32
|
clientId: clientId,
|
|
33
33
|
permit: permit,
|
|
34
|
-
isGuest: user === null || user === void 0 ? void 0 : user.isGuest
|
|
34
|
+
isGuest: user === null || user === void 0 ? void 0 : user.isGuest,
|
|
35
|
+
presenceId: presenceId,
|
|
36
|
+
presenceActivity: presenceActivity
|
|
35
37
|
};
|
|
36
38
|
return _context.abrupt("return", participant);
|
|
37
39
|
case 6:
|
|
@@ -136,6 +136,10 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
136
136
|
if (initialized && _this.disconnectedAt &&
|
|
137
137
|
// Offline longer than `OUT_OF_SYNC_PERIOD`
|
|
138
138
|
Date.now() - _this.disconnectedAt >= OUT_OF_SYNC_PERIOD) {
|
|
139
|
+
var _this$analyticsHelper2;
|
|
140
|
+
(_this$analyticsHelper2 = _this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 || _this$analyticsHelper2.sendActionEvent(_const.EVENT_ACTION.RECONNECTION, _const.EVENT_STATUS.INFO, {
|
|
141
|
+
disconnectionPeriodSeconds: Math.floor((Date.now() - _this.disconnectedAt) / 1000)
|
|
142
|
+
});
|
|
139
143
|
_this.documentService.throttledCatchupv2(_const.CatchupEventReason.RECONNECTED);
|
|
140
144
|
}
|
|
141
145
|
_this.participantsService.startInactiveRemover(_this.sessionId);
|
|
@@ -165,7 +169,9 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
165
169
|
sessionId: _this.sessionId,
|
|
166
170
|
userId: _this.userId,
|
|
167
171
|
clientId: _this.clientId,
|
|
168
|
-
permit: _this.permit
|
|
172
|
+
permit: _this.permit,
|
|
173
|
+
presenceId: _this.presenceId,
|
|
174
|
+
presenceActivity: _this.presenceActivity
|
|
169
175
|
};
|
|
170
176
|
});
|
|
171
177
|
/**
|
|
@@ -179,13 +185,13 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
179
185
|
if (((_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.code) === _ncsErrors.NCS_ERROR_CODE.HEAD_VERSION_UPDATE_FAILED || ((_error$data2 = error.data) === null || _error$data2 === void 0 ? void 0 : _error$data2.code) === _ncsErrors.NCS_ERROR_CODE.VERSION_NUMBER_ALREADY_EXISTS) {
|
|
180
186
|
_this.documentService.onStepRejectedError();
|
|
181
187
|
} else {
|
|
182
|
-
var _this$
|
|
183
|
-
(_this$
|
|
188
|
+
var _this$analyticsHelper3;
|
|
189
|
+
(_this$analyticsHelper3 = _this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 || _this$analyticsHelper3.sendErrorEvent(error, 'Error handled');
|
|
184
190
|
var mappedError = (0, _errorCodeMapper.errorCodeMapper)(error);
|
|
185
191
|
// Only emit errors to Confluence very intentionally because they will disconnect the collab provider
|
|
186
192
|
if (mappedError) {
|
|
187
|
-
var _this$
|
|
188
|
-
(_this$
|
|
193
|
+
var _this$analyticsHelper4;
|
|
194
|
+
(_this$analyticsHelper4 = _this.analyticsHelper) === null || _this$analyticsHelper4 === void 0 || _this$analyticsHelper4.sendProviderErrorEvent(mappedError);
|
|
189
195
|
_this.emit('error', mappedError);
|
|
190
196
|
}
|
|
191
197
|
}
|
|
@@ -208,7 +214,7 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
208
214
|
* @throws {GetCurrentStateError} Something went wrong while returning the current state
|
|
209
215
|
*/
|
|
210
216
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getCurrentState", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
211
|
-
var _this$
|
|
217
|
+
var _this$analyticsHelper5;
|
|
212
218
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
213
219
|
while (1) switch (_context.prev = _context.next) {
|
|
214
220
|
case 0:
|
|
@@ -220,7 +226,7 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
220
226
|
case 6:
|
|
221
227
|
_context.prev = 6;
|
|
222
228
|
_context.t0 = _context["catch"](0);
|
|
223
|
-
(_this$
|
|
229
|
+
(_this$analyticsHelper5 = _this.analyticsHelper) === null || _this$analyticsHelper5 === void 0 || _this$analyticsHelper5.sendErrorEvent(_context.t0, 'Error while returning ADF version of current draft document');
|
|
224
230
|
throw new _customErrors.GetCurrentStateError('Error while returning the current state of the draft document', _context.t0);
|
|
225
231
|
case 10:
|
|
226
232
|
case "end":
|
|
@@ -234,7 +240,7 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
234
240
|
* @throws {GetFinalAcknowledgedStateError} Something went wrong while returning the acknowledged state
|
|
235
241
|
*/
|
|
236
242
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getFinalAcknowledgedState", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
237
|
-
var _this$
|
|
243
|
+
var _this$analyticsHelper6;
|
|
238
244
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
239
245
|
while (1) switch (_context2.prev = _context2.next) {
|
|
240
246
|
case 0:
|
|
@@ -246,7 +252,7 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
246
252
|
case 6:
|
|
247
253
|
_context2.prev = 6;
|
|
248
254
|
_context2.t0 = _context2["catch"](0);
|
|
249
|
-
(_this$
|
|
255
|
+
(_this$analyticsHelper6 = _this.analyticsHelper) === null || _this$analyticsHelper6 === void 0 || _this$analyticsHelper6.sendErrorEvent(_context2.t0, 'Error while returning ADF version of the final draft document');
|
|
250
256
|
throw new _customErrors.GetFinalAcknowledgedStateError('Error while returning the final acknowledged state of the draft document', _context2.t0);
|
|
251
257
|
case 10:
|
|
252
258
|
case "end":
|
|
@@ -294,6 +300,7 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
294
300
|
_this.participantsService = new _participantsService.ParticipantsService(_this.analyticsHelper, undefined, _this.emitCallback, _this.config.getUser, _this.channel.broadcast, _this.channel.sendPresenceJoined, _this.getPresenceData, _this.setUserId);
|
|
295
301
|
_this.metadataService = new _metadataService.MetadataService(_this.emitCallback, _this.channel.sendMetadata);
|
|
296
302
|
_this.namespaceService = new _namespaceService.NamespaceService();
|
|
303
|
+
_this.presenceId = _this.config.presenceId;
|
|
297
304
|
if (config.isPresenceOnly) {
|
|
298
305
|
// this check is specifically for the presence only
|
|
299
306
|
// This presence feature is only for the confluence view page & jira presence which do not need the document service or api
|
|
@@ -363,7 +370,7 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
363
370
|
clientId: this.clientId
|
|
364
371
|
});
|
|
365
372
|
if (this.isBufferingEnabled && this.initialDraft && !this.isProviderInitialized) {
|
|
366
|
-
var _this$
|
|
373
|
+
var _this$analyticsHelper7;
|
|
367
374
|
var _this$initialDraft2 = this.initialDraft,
|
|
368
375
|
document = _this$initialDraft2.document,
|
|
369
376
|
version = _this$initialDraft2.version,
|
|
@@ -373,7 +380,7 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
373
380
|
version: version,
|
|
374
381
|
metadata: metadata
|
|
375
382
|
});
|
|
376
|
-
(_this$
|
|
383
|
+
(_this$analyticsHelper7 = this.analyticsHelper) === null || _this$analyticsHelper7 === void 0 || _this$analyticsHelper7.sendActionEvent(_const.EVENT_ACTION.PROVIDER_INITIALIZED, _const.EVENT_STATUS.INFO, {
|
|
377
384
|
isBuffered: true
|
|
378
385
|
});
|
|
379
386
|
}
|
|
@@ -382,8 +389,8 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
382
389
|
this.isChannelInitialized = true;
|
|
383
390
|
}
|
|
384
391
|
} catch (initError) {
|
|
385
|
-
var _this$
|
|
386
|
-
(_this$
|
|
392
|
+
var _this$analyticsHelper8;
|
|
393
|
+
(_this$analyticsHelper8 = this.analyticsHelper) === null || _this$analyticsHelper8 === void 0 || _this$analyticsHelper8.sendErrorEvent(initError, 'Error while initialising the provider');
|
|
387
394
|
// Throw error so consumers are aware the initialisation failed when initialising themselves
|
|
388
395
|
throw new _customErrors.ProviderInitialisationError('Provider initialisation error', initError);
|
|
389
396
|
}
|
|
@@ -393,8 +400,9 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
393
400
|
// Only used for the presence - opts out of the document service and api service
|
|
394
401
|
}, {
|
|
395
402
|
key: "setupForPresenceOnly",
|
|
396
|
-
value: function setupForPresenceOnly(clientId) {
|
|
403
|
+
value: function setupForPresenceOnly(clientId, presenceActivity) {
|
|
397
404
|
this.clientId = clientId;
|
|
405
|
+
this.presenceActivity = presenceActivity;
|
|
398
406
|
this.checkForCookies();
|
|
399
407
|
try {
|
|
400
408
|
if (!this.isChannelInitialized) {
|
|
@@ -402,8 +410,8 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
402
410
|
this.isChannelInitialized = true;
|
|
403
411
|
}
|
|
404
412
|
} catch (initError) {
|
|
405
|
-
var _this$
|
|
406
|
-
(_this$
|
|
413
|
+
var _this$analyticsHelper9;
|
|
414
|
+
(_this$analyticsHelper9 = this.analyticsHelper) === null || _this$analyticsHelper9 === void 0 || _this$analyticsHelper9.sendErrorEvent(initError, 'Error while initialising the provider');
|
|
407
415
|
// Throw error so consumers are aware the initialisation failed when initialising themselves
|
|
408
416
|
throw new _customErrors.ProviderInitialisationError('Provider initialisation error', initError);
|
|
409
417
|
}
|
|
@@ -413,9 +421,9 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
413
421
|
key: "checkForCookies",
|
|
414
422
|
value: function checkForCookies() {
|
|
415
423
|
if (!global.navigator.cookieEnabled) {
|
|
416
|
-
var _this$
|
|
424
|
+
var _this$analyticsHelper10;
|
|
417
425
|
var initError = new _customErrors.ProviderInitialisationError('Cookies are not enabled. Please enable cookies to use collaborative editing.');
|
|
418
|
-
(_this$
|
|
426
|
+
(_this$analyticsHelper10 = this.analyticsHelper) === null || _this$analyticsHelper10 === void 0 || _this$analyticsHelper10.sendErrorEvent(initError, 'Error while initialising the provider - cookies disabled');
|
|
419
427
|
throw new _customErrors.ProviderInitialisationError('Provider initialisation error - cookies disabled', initError);
|
|
420
428
|
}
|
|
421
429
|
}
|
|
@@ -432,14 +440,14 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
432
440
|
value: function send(_tr, _oldState, newState) {
|
|
433
441
|
try {
|
|
434
442
|
if (this.isViewOnly()) {
|
|
435
|
-
var _this$
|
|
443
|
+
var _this$analyticsHelper11;
|
|
436
444
|
var error = {
|
|
437
445
|
message: 'Attempted to send steps in view only mode',
|
|
438
446
|
data: {
|
|
439
447
|
code: _internalErrors.INTERNAL_ERROR_CODE.VIEW_ONLY_STEPS_ERROR
|
|
440
448
|
}
|
|
441
449
|
};
|
|
442
|
-
(_this$
|
|
450
|
+
(_this$analyticsHelper11 = this.analyticsHelper) === null || _this$analyticsHelper11 === void 0 || _this$analyticsHelper11.sendErrorEvent(error, error.message);
|
|
443
451
|
return;
|
|
444
452
|
}
|
|
445
453
|
// Don't send steps while the document is locked (eg. when restoring the document)
|
|
@@ -449,8 +457,8 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
449
457
|
}
|
|
450
458
|
this.documentService.send(_tr, _oldState, newState);
|
|
451
459
|
} catch (error) {
|
|
452
|
-
var _this$
|
|
453
|
-
(_this$
|
|
460
|
+
var _this$analyticsHelper12;
|
|
461
|
+
(_this$analyticsHelper12 = this.analyticsHelper) === null || _this$analyticsHelper12 === void 0 || _this$analyticsHelper12.sendErrorEvent(error, 'Error while sending steps for a transaction');
|
|
454
462
|
throw new _customErrors.SendTransactionError('Error while sending steps for a transaction', error);
|
|
455
463
|
}
|
|
456
464
|
}
|
|
@@ -495,9 +503,9 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
495
503
|
this.participantsService.sendAIProviderChanged(_objectSpread(_objectSpread({}, basePayload), data));
|
|
496
504
|
}
|
|
497
505
|
} catch (error) {
|
|
498
|
-
var _this$
|
|
506
|
+
var _this$analyticsHelper13;
|
|
499
507
|
// We don't want to throw errors for Presence features as they tend to self-restore
|
|
500
|
-
(_this$
|
|
508
|
+
(_this$analyticsHelper13 = this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 || _this$analyticsHelper13.sendErrorEvent(error, 'Error while sending message - telepointer');
|
|
501
509
|
}
|
|
502
510
|
}
|
|
503
511
|
}, {
|
|
@@ -540,8 +548,8 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
540
548
|
this.sendStepsTimer = undefined;
|
|
541
549
|
}
|
|
542
550
|
} catch (error) {
|
|
543
|
-
var _this$
|
|
544
|
-
(_this$
|
|
551
|
+
var _this$analyticsHelper14;
|
|
552
|
+
(_this$analyticsHelper14 = this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 || _this$analyticsHelper14.sendErrorEvent(error, 'Error while shutting down the collab provider');
|
|
545
553
|
throw new _customErrors.DestroyError('Error while shutting down the collab provider', error);
|
|
546
554
|
}
|
|
547
555
|
this.clearTimers();
|
|
@@ -564,8 +572,8 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
564
572
|
}
|
|
565
573
|
this.metadataService.setTitle(title, broadcast);
|
|
566
574
|
} catch (error) {
|
|
567
|
-
var _this$
|
|
568
|
-
(_this$
|
|
575
|
+
var _this$analyticsHelper15;
|
|
576
|
+
(_this$analyticsHelper15 = this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 || _this$analyticsHelper15.sendErrorEvent(error, 'Error while setting title');
|
|
569
577
|
throw new _customErrors.SetTitleError('Error while setting title', error);
|
|
570
578
|
}
|
|
571
579
|
}
|
|
@@ -583,8 +591,8 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
583
591
|
try {
|
|
584
592
|
this.metadataService.setEditorWidth(editorWidth, broadcast);
|
|
585
593
|
} catch (error) {
|
|
586
|
-
var _this$
|
|
587
|
-
(_this$
|
|
594
|
+
var _this$analyticsHelper16;
|
|
595
|
+
(_this$analyticsHelper16 = this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 || _this$analyticsHelper16.sendErrorEvent(error, 'Error while setting editor width');
|
|
588
596
|
throw new _customErrors.SetEditorWidthError('Error while setting editor width', error);
|
|
589
597
|
}
|
|
590
598
|
}
|
|
@@ -603,8 +611,8 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
603
611
|
}
|
|
604
612
|
this.metadataService.setMetadata(metadata);
|
|
605
613
|
} catch (error) {
|
|
606
|
-
var _this$
|
|
607
|
-
(_this$
|
|
614
|
+
var _this$analyticsHelper17;
|
|
615
|
+
(_this$analyticsHelper17 = this.analyticsHelper) === null || _this$analyticsHelper17 === void 0 || _this$analyticsHelper17.sendErrorEvent(error, 'Error while setting metadata');
|
|
608
616
|
throw new _customErrors.SetMetadataError('Error while setting metadata', error);
|
|
609
617
|
}
|
|
610
618
|
}
|
package/dist/cjs/types.js
CHANGED
|
@@ -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 = "
|
|
8
|
+
var version = exports.version = "10.1.0";
|
|
9
9
|
var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
|
|
10
10
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
11
11
|
};
|
|
@@ -16,6 +16,7 @@ export let EVENT_ACTION = /*#__PURE__*/function (EVENT_ACTION) {
|
|
|
16
16
|
EVENT_ACTION["DROPPED_STEPS"] = "droppedStepInCatchup";
|
|
17
17
|
EVENT_ACTION["WEBSOCKET_MESSAGE_VOLUME_METRIC"] = "websocketMessageVolumeMetric";
|
|
18
18
|
EVENT_ACTION["PROVIDER_INITIALIZED"] = "providerInitialized";
|
|
19
|
+
EVENT_ACTION["RECONNECTION"] = "providerReconnection";
|
|
19
20
|
EVENT_ACTION["PROVIDER_SETUP"] = "providerSetup";
|
|
20
21
|
EVENT_ACTION["HAS_UNCONFIRMED_STEPS"] = "hasUnconfirmedSteps";
|
|
21
22
|
return EVENT_ACTION;
|
package/dist/es2019/index.js
CHANGED
|
@@ -8,7 +8,9 @@ export const createParticipantFromPayload = async (payload, getUser) => {
|
|
|
8
8
|
timestamp,
|
|
9
9
|
clientId,
|
|
10
10
|
userId,
|
|
11
|
-
permit
|
|
11
|
+
permit,
|
|
12
|
+
presenceId,
|
|
13
|
+
presenceActivity
|
|
12
14
|
} = payload;
|
|
13
15
|
const user = await (getUser === null || getUser === void 0 ? void 0 : getUser(userId));
|
|
14
16
|
const participant = {
|
|
@@ -20,7 +22,9 @@ export const createParticipantFromPayload = async (payload, getUser) => {
|
|
|
20
22
|
userId,
|
|
21
23
|
clientId,
|
|
22
24
|
permit,
|
|
23
|
-
isGuest: user === null || user === void 0 ? void 0 : user.isGuest
|
|
25
|
+
isGuest: user === null || user === void 0 ? void 0 : user.isGuest,
|
|
26
|
+
presenceId: presenceId,
|
|
27
|
+
presenceActivity: presenceActivity
|
|
24
28
|
};
|
|
25
29
|
return participant;
|
|
26
30
|
};
|
|
@@ -113,6 +113,10 @@ export class Provider extends Emitter {
|
|
|
113
113
|
if (initialized && this.disconnectedAt &&
|
|
114
114
|
// Offline longer than `OUT_OF_SYNC_PERIOD`
|
|
115
115
|
Date.now() - this.disconnectedAt >= OUT_OF_SYNC_PERIOD) {
|
|
116
|
+
var _this$analyticsHelper2;
|
|
117
|
+
(_this$analyticsHelper2 = this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 ? void 0 : _this$analyticsHelper2.sendActionEvent(EVENT_ACTION.RECONNECTION, EVENT_STATUS.INFO, {
|
|
118
|
+
disconnectionPeriodSeconds: Math.floor((Date.now() - this.disconnectedAt) / 1000)
|
|
119
|
+
});
|
|
116
120
|
this.documentService.throttledCatchupv2(CatchupEventReason.RECONNECTED);
|
|
117
121
|
}
|
|
118
122
|
this.participantsService.startInactiveRemover(this.sessionId);
|
|
@@ -141,7 +145,9 @@ export class Provider extends Emitter {
|
|
|
141
145
|
sessionId: this.sessionId,
|
|
142
146
|
userId: this.userId,
|
|
143
147
|
clientId: this.clientId,
|
|
144
|
-
permit: this.permit
|
|
148
|
+
permit: this.permit,
|
|
149
|
+
presenceId: this.presenceId,
|
|
150
|
+
presenceActivity: this.presenceActivity
|
|
145
151
|
};
|
|
146
152
|
});
|
|
147
153
|
/**
|
|
@@ -155,13 +161,13 @@ export class Provider extends Emitter {
|
|
|
155
161
|
if (((_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.code) === NCS_ERROR_CODE.HEAD_VERSION_UPDATE_FAILED || ((_error$data2 = error.data) === null || _error$data2 === void 0 ? void 0 : _error$data2.code) === NCS_ERROR_CODE.VERSION_NUMBER_ALREADY_EXISTS) {
|
|
156
162
|
this.documentService.onStepRejectedError();
|
|
157
163
|
} else {
|
|
158
|
-
var _this$
|
|
159
|
-
(_this$
|
|
164
|
+
var _this$analyticsHelper3;
|
|
165
|
+
(_this$analyticsHelper3 = this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 ? void 0 : _this$analyticsHelper3.sendErrorEvent(error, 'Error handled');
|
|
160
166
|
const mappedError = errorCodeMapper(error);
|
|
161
167
|
// Only emit errors to Confluence very intentionally because they will disconnect the collab provider
|
|
162
168
|
if (mappedError) {
|
|
163
|
-
var _this$
|
|
164
|
-
(_this$
|
|
169
|
+
var _this$analyticsHelper4;
|
|
170
|
+
(_this$analyticsHelper4 = this.analyticsHelper) === null || _this$analyticsHelper4 === void 0 ? void 0 : _this$analyticsHelper4.sendProviderErrorEvent(mappedError);
|
|
165
171
|
this.emit('error', mappedError);
|
|
166
172
|
}
|
|
167
173
|
}
|
|
@@ -188,8 +194,8 @@ export class Provider extends Emitter {
|
|
|
188
194
|
try {
|
|
189
195
|
return await this.documentService.getCurrentState();
|
|
190
196
|
} catch (error) {
|
|
191
|
-
var _this$
|
|
192
|
-
(_this$
|
|
197
|
+
var _this$analyticsHelper5;
|
|
198
|
+
(_this$analyticsHelper5 = this.analyticsHelper) === null || _this$analyticsHelper5 === void 0 ? void 0 : _this$analyticsHelper5.sendErrorEvent(error, 'Error while returning ADF version of current draft document');
|
|
193
199
|
throw new GetCurrentStateError('Error while returning the current state of the draft document', error); // Reject the promise so the consumer can react to it failing
|
|
194
200
|
}
|
|
195
201
|
});
|
|
@@ -202,8 +208,8 @@ export class Provider extends Emitter {
|
|
|
202
208
|
try {
|
|
203
209
|
return await this.documentService.getFinalAcknowledgedState();
|
|
204
210
|
} catch (error) {
|
|
205
|
-
var _this$
|
|
206
|
-
(_this$
|
|
211
|
+
var _this$analyticsHelper6;
|
|
212
|
+
(_this$analyticsHelper6 = this.analyticsHelper) === null || _this$analyticsHelper6 === void 0 ? void 0 : _this$analyticsHelper6.sendErrorEvent(error, 'Error while returning ADF version of the final draft document');
|
|
207
213
|
throw new GetFinalAcknowledgedStateError('Error while returning the final acknowledged state of the draft document', error); // Reject the promise so the consumer can react to it failing
|
|
208
214
|
}
|
|
209
215
|
});
|
|
@@ -247,6 +253,7 @@ export class Provider extends Emitter {
|
|
|
247
253
|
this.participantsService = new ParticipantsService(this.analyticsHelper, undefined, this.emitCallback, this.config.getUser, this.channel.broadcast, this.channel.sendPresenceJoined, this.getPresenceData, this.setUserId);
|
|
248
254
|
this.metadataService = new MetadataService(this.emitCallback, this.channel.sendMetadata);
|
|
249
255
|
this.namespaceService = new NamespaceService();
|
|
256
|
+
this.presenceId = this.config.presenceId;
|
|
250
257
|
if (config.isPresenceOnly) {
|
|
251
258
|
// this check is specifically for the presence only
|
|
252
259
|
// This presence feature is only for the confluence view page & jira presence which do not need the document service or api
|
|
@@ -307,7 +314,7 @@ export class Provider extends Emitter {
|
|
|
307
314
|
clientId: this.clientId
|
|
308
315
|
});
|
|
309
316
|
if (this.isBufferingEnabled && this.initialDraft && !this.isProviderInitialized) {
|
|
310
|
-
var _this$
|
|
317
|
+
var _this$analyticsHelper7;
|
|
311
318
|
const {
|
|
312
319
|
document,
|
|
313
320
|
version,
|
|
@@ -318,7 +325,7 @@ export class Provider extends Emitter {
|
|
|
318
325
|
version,
|
|
319
326
|
metadata
|
|
320
327
|
});
|
|
321
|
-
(_this$
|
|
328
|
+
(_this$analyticsHelper7 = this.analyticsHelper) === null || _this$analyticsHelper7 === void 0 ? void 0 : _this$analyticsHelper7.sendActionEvent(EVENT_ACTION.PROVIDER_INITIALIZED, EVENT_STATUS.INFO, {
|
|
322
329
|
isBuffered: true
|
|
323
330
|
});
|
|
324
331
|
}
|
|
@@ -327,8 +334,8 @@ export class Provider extends Emitter {
|
|
|
327
334
|
this.isChannelInitialized = true;
|
|
328
335
|
}
|
|
329
336
|
} catch (initError) {
|
|
330
|
-
var _this$
|
|
331
|
-
(_this$
|
|
337
|
+
var _this$analyticsHelper8;
|
|
338
|
+
(_this$analyticsHelper8 = this.analyticsHelper) === null || _this$analyticsHelper8 === void 0 ? void 0 : _this$analyticsHelper8.sendErrorEvent(initError, 'Error while initialising the provider');
|
|
332
339
|
// Throw error so consumers are aware the initialisation failed when initialising themselves
|
|
333
340
|
throw new ProviderInitialisationError('Provider initialisation error', initError);
|
|
334
341
|
}
|
|
@@ -336,8 +343,9 @@ export class Provider extends Emitter {
|
|
|
336
343
|
}
|
|
337
344
|
|
|
338
345
|
// Only used for the presence - opts out of the document service and api service
|
|
339
|
-
setupForPresenceOnly(clientId) {
|
|
346
|
+
setupForPresenceOnly(clientId, presenceActivity) {
|
|
340
347
|
this.clientId = clientId;
|
|
348
|
+
this.presenceActivity = presenceActivity;
|
|
341
349
|
this.checkForCookies();
|
|
342
350
|
try {
|
|
343
351
|
if (!this.isChannelInitialized) {
|
|
@@ -345,8 +353,8 @@ export class Provider extends Emitter {
|
|
|
345
353
|
this.isChannelInitialized = true;
|
|
346
354
|
}
|
|
347
355
|
} catch (initError) {
|
|
348
|
-
var _this$
|
|
349
|
-
(_this$
|
|
356
|
+
var _this$analyticsHelper9;
|
|
357
|
+
(_this$analyticsHelper9 = this.analyticsHelper) === null || _this$analyticsHelper9 === void 0 ? void 0 : _this$analyticsHelper9.sendErrorEvent(initError, 'Error while initialising the provider');
|
|
350
358
|
// Throw error so consumers are aware the initialisation failed when initialising themselves
|
|
351
359
|
throw new ProviderInitialisationError('Provider initialisation error', initError);
|
|
352
360
|
}
|
|
@@ -354,9 +362,9 @@ export class Provider extends Emitter {
|
|
|
354
362
|
}
|
|
355
363
|
checkForCookies() {
|
|
356
364
|
if (!global.navigator.cookieEnabled) {
|
|
357
|
-
var _this$
|
|
365
|
+
var _this$analyticsHelper10;
|
|
358
366
|
const initError = new ProviderInitialisationError('Cookies are not enabled. Please enable cookies to use collaborative editing.');
|
|
359
|
-
(_this$
|
|
367
|
+
(_this$analyticsHelper10 = this.analyticsHelper) === null || _this$analyticsHelper10 === void 0 ? void 0 : _this$analyticsHelper10.sendErrorEvent(initError, 'Error while initialising the provider - cookies disabled');
|
|
360
368
|
throw new ProviderInitialisationError('Provider initialisation error - cookies disabled', initError);
|
|
361
369
|
}
|
|
362
370
|
}
|
|
@@ -371,14 +379,14 @@ export class Provider extends Emitter {
|
|
|
371
379
|
send(_tr, _oldState, newState) {
|
|
372
380
|
try {
|
|
373
381
|
if (this.isViewOnly()) {
|
|
374
|
-
var _this$
|
|
382
|
+
var _this$analyticsHelper11;
|
|
375
383
|
const error = {
|
|
376
384
|
message: 'Attempted to send steps in view only mode',
|
|
377
385
|
data: {
|
|
378
386
|
code: INTERNAL_ERROR_CODE.VIEW_ONLY_STEPS_ERROR
|
|
379
387
|
}
|
|
380
388
|
};
|
|
381
|
-
(_this$
|
|
389
|
+
(_this$analyticsHelper11 = this.analyticsHelper) === null || _this$analyticsHelper11 === void 0 ? void 0 : _this$analyticsHelper11.sendErrorEvent(error, error.message);
|
|
382
390
|
return;
|
|
383
391
|
}
|
|
384
392
|
// Don't send steps while the document is locked (eg. when restoring the document)
|
|
@@ -388,8 +396,8 @@ export class Provider extends Emitter {
|
|
|
388
396
|
}
|
|
389
397
|
this.documentService.send(_tr, _oldState, newState);
|
|
390
398
|
} catch (error) {
|
|
391
|
-
var _this$
|
|
392
|
-
(_this$
|
|
399
|
+
var _this$analyticsHelper12;
|
|
400
|
+
(_this$analyticsHelper12 = this.analyticsHelper) === null || _this$analyticsHelper12 === void 0 ? void 0 : _this$analyticsHelper12.sendErrorEvent(error, 'Error while sending steps for a transaction');
|
|
393
401
|
throw new SendTransactionError('Error while sending steps for a transaction', error);
|
|
394
402
|
}
|
|
395
403
|
}
|
|
@@ -435,9 +443,9 @@ export class Provider extends Emitter {
|
|
|
435
443
|
});
|
|
436
444
|
}
|
|
437
445
|
} catch (error) {
|
|
438
|
-
var _this$
|
|
446
|
+
var _this$analyticsHelper13;
|
|
439
447
|
// We don't want to throw errors for Presence features as they tend to self-restore
|
|
440
|
-
(_this$
|
|
448
|
+
(_this$analyticsHelper13 = this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 ? void 0 : _this$analyticsHelper13.sendErrorEvent(error, 'Error while sending message - telepointer');
|
|
441
449
|
}
|
|
442
450
|
}
|
|
443
451
|
/**
|
|
@@ -473,8 +481,8 @@ export class Provider extends Emitter {
|
|
|
473
481
|
this.sendStepsTimer = undefined;
|
|
474
482
|
}
|
|
475
483
|
} catch (error) {
|
|
476
|
-
var _this$
|
|
477
|
-
(_this$
|
|
484
|
+
var _this$analyticsHelper14;
|
|
485
|
+
(_this$analyticsHelper14 = this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 ? void 0 : _this$analyticsHelper14.sendErrorEvent(error, 'Error while shutting down the collab provider');
|
|
478
486
|
throw new DestroyError('Error while shutting down the collab provider', error);
|
|
479
487
|
}
|
|
480
488
|
this.clearTimers();
|
|
@@ -495,8 +503,8 @@ export class Provider extends Emitter {
|
|
|
495
503
|
}
|
|
496
504
|
this.metadataService.setTitle(title, broadcast);
|
|
497
505
|
} catch (error) {
|
|
498
|
-
var _this$
|
|
499
|
-
(_this$
|
|
506
|
+
var _this$analyticsHelper15;
|
|
507
|
+
(_this$analyticsHelper15 = this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 ? void 0 : _this$analyticsHelper15.sendErrorEvent(error, 'Error while setting title');
|
|
500
508
|
throw new SetTitleError('Error while setting title', error);
|
|
501
509
|
}
|
|
502
510
|
}
|
|
@@ -512,8 +520,8 @@ export class Provider extends Emitter {
|
|
|
512
520
|
try {
|
|
513
521
|
this.metadataService.setEditorWidth(editorWidth, broadcast);
|
|
514
522
|
} catch (error) {
|
|
515
|
-
var _this$
|
|
516
|
-
(_this$
|
|
523
|
+
var _this$analyticsHelper16;
|
|
524
|
+
(_this$analyticsHelper16 = this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 ? void 0 : _this$analyticsHelper16.sendErrorEvent(error, 'Error while setting editor width');
|
|
517
525
|
throw new SetEditorWidthError('Error while setting editor width', error);
|
|
518
526
|
}
|
|
519
527
|
}
|
|
@@ -530,8 +538,8 @@ export class Provider extends Emitter {
|
|
|
530
538
|
}
|
|
531
539
|
this.metadataService.setMetadata(metadata);
|
|
532
540
|
} catch (error) {
|
|
533
|
-
var _this$
|
|
534
|
-
(_this$
|
|
541
|
+
var _this$analyticsHelper17;
|
|
542
|
+
(_this$analyticsHelper17 = this.analyticsHelper) === null || _this$analyticsHelper17 === void 0 ? void 0 : _this$analyticsHelper17.sendErrorEvent(error, 'Error while setting metadata');
|
|
535
543
|
throw new SetMetadataError('Error while setting metadata', error);
|
|
536
544
|
}
|
|
537
545
|
}
|
package/dist/es2019/types.js
CHANGED
|
@@ -16,6 +16,7 @@ export var EVENT_ACTION = /*#__PURE__*/function (EVENT_ACTION) {
|
|
|
16
16
|
EVENT_ACTION["DROPPED_STEPS"] = "droppedStepInCatchup";
|
|
17
17
|
EVENT_ACTION["WEBSOCKET_MESSAGE_VOLUME_METRIC"] = "websocketMessageVolumeMetric";
|
|
18
18
|
EVENT_ACTION["PROVIDER_INITIALIZED"] = "providerInitialized";
|
|
19
|
+
EVENT_ACTION["RECONNECTION"] = "providerReconnection";
|
|
19
20
|
EVENT_ACTION["PROVIDER_SETUP"] = "providerSetup";
|
|
20
21
|
EVENT_ACTION["HAS_UNCONFIRMED_STEPS"] = "hasUnconfirmedSteps";
|
|
21
22
|
return EVENT_ACTION;
|
package/dist/esm/index.js
CHANGED
|
@@ -6,11 +6,11 @@ export var PARTICIPANT_UPDATE_INTERVAL = 300 * 1000; // 300 seconds
|
|
|
6
6
|
|
|
7
7
|
export var createParticipantFromPayload = /*#__PURE__*/function () {
|
|
8
8
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(payload, getUser) {
|
|
9
|
-
var sessionId, timestamp, clientId, userId, permit, user, participant;
|
|
9
|
+
var sessionId, timestamp, clientId, userId, permit, presenceId, presenceActivity, user, participant;
|
|
10
10
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
11
11
|
while (1) switch (_context.prev = _context.next) {
|
|
12
12
|
case 0:
|
|
13
|
-
sessionId = payload.sessionId, timestamp = payload.timestamp, clientId = payload.clientId, userId = payload.userId, permit = payload.permit;
|
|
13
|
+
sessionId = payload.sessionId, timestamp = payload.timestamp, clientId = payload.clientId, userId = payload.userId, permit = payload.permit, presenceId = payload.presenceId, presenceActivity = payload.presenceActivity;
|
|
14
14
|
_context.next = 3;
|
|
15
15
|
return getUser === null || getUser === void 0 ? void 0 : getUser(userId);
|
|
16
16
|
case 3:
|
|
@@ -24,7 +24,9 @@ export var createParticipantFromPayload = /*#__PURE__*/function () {
|
|
|
24
24
|
userId: userId,
|
|
25
25
|
clientId: clientId,
|
|
26
26
|
permit: permit,
|
|
27
|
-
isGuest: user === null || user === void 0 ? void 0 : user.isGuest
|
|
27
|
+
isGuest: user === null || user === void 0 ? void 0 : user.isGuest,
|
|
28
|
+
presenceId: presenceId,
|
|
29
|
+
presenceActivity: presenceActivity
|
|
28
30
|
};
|
|
29
31
|
return _context.abrupt("return", participant);
|
|
30
32
|
case 6:
|
|
@@ -129,6 +129,10 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
129
129
|
if (initialized && _this.disconnectedAt &&
|
|
130
130
|
// Offline longer than `OUT_OF_SYNC_PERIOD`
|
|
131
131
|
Date.now() - _this.disconnectedAt >= OUT_OF_SYNC_PERIOD) {
|
|
132
|
+
var _this$analyticsHelper2;
|
|
133
|
+
(_this$analyticsHelper2 = _this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 || _this$analyticsHelper2.sendActionEvent(EVENT_ACTION.RECONNECTION, EVENT_STATUS.INFO, {
|
|
134
|
+
disconnectionPeriodSeconds: Math.floor((Date.now() - _this.disconnectedAt) / 1000)
|
|
135
|
+
});
|
|
132
136
|
_this.documentService.throttledCatchupv2(CatchupEventReason.RECONNECTED);
|
|
133
137
|
}
|
|
134
138
|
_this.participantsService.startInactiveRemover(_this.sessionId);
|
|
@@ -158,7 +162,9 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
158
162
|
sessionId: _this.sessionId,
|
|
159
163
|
userId: _this.userId,
|
|
160
164
|
clientId: _this.clientId,
|
|
161
|
-
permit: _this.permit
|
|
165
|
+
permit: _this.permit,
|
|
166
|
+
presenceId: _this.presenceId,
|
|
167
|
+
presenceActivity: _this.presenceActivity
|
|
162
168
|
};
|
|
163
169
|
});
|
|
164
170
|
/**
|
|
@@ -172,13 +178,13 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
172
178
|
if (((_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.code) === NCS_ERROR_CODE.HEAD_VERSION_UPDATE_FAILED || ((_error$data2 = error.data) === null || _error$data2 === void 0 ? void 0 : _error$data2.code) === NCS_ERROR_CODE.VERSION_NUMBER_ALREADY_EXISTS) {
|
|
173
179
|
_this.documentService.onStepRejectedError();
|
|
174
180
|
} else {
|
|
175
|
-
var _this$
|
|
176
|
-
(_this$
|
|
181
|
+
var _this$analyticsHelper3;
|
|
182
|
+
(_this$analyticsHelper3 = _this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 || _this$analyticsHelper3.sendErrorEvent(error, 'Error handled');
|
|
177
183
|
var mappedError = errorCodeMapper(error);
|
|
178
184
|
// Only emit errors to Confluence very intentionally because they will disconnect the collab provider
|
|
179
185
|
if (mappedError) {
|
|
180
|
-
var _this$
|
|
181
|
-
(_this$
|
|
186
|
+
var _this$analyticsHelper4;
|
|
187
|
+
(_this$analyticsHelper4 = _this.analyticsHelper) === null || _this$analyticsHelper4 === void 0 || _this$analyticsHelper4.sendProviderErrorEvent(mappedError);
|
|
182
188
|
_this.emit('error', mappedError);
|
|
183
189
|
}
|
|
184
190
|
}
|
|
@@ -201,7 +207,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
201
207
|
* @throws {GetCurrentStateError} Something went wrong while returning the current state
|
|
202
208
|
*/
|
|
203
209
|
_defineProperty(_assertThisInitialized(_this), "getCurrentState", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
204
|
-
var _this$
|
|
210
|
+
var _this$analyticsHelper5;
|
|
205
211
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
206
212
|
while (1) switch (_context.prev = _context.next) {
|
|
207
213
|
case 0:
|
|
@@ -213,7 +219,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
213
219
|
case 6:
|
|
214
220
|
_context.prev = 6;
|
|
215
221
|
_context.t0 = _context["catch"](0);
|
|
216
|
-
(_this$
|
|
222
|
+
(_this$analyticsHelper5 = _this.analyticsHelper) === null || _this$analyticsHelper5 === void 0 || _this$analyticsHelper5.sendErrorEvent(_context.t0, 'Error while returning ADF version of current draft document');
|
|
217
223
|
throw new GetCurrentStateError('Error while returning the current state of the draft document', _context.t0);
|
|
218
224
|
case 10:
|
|
219
225
|
case "end":
|
|
@@ -227,7 +233,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
227
233
|
* @throws {GetFinalAcknowledgedStateError} Something went wrong while returning the acknowledged state
|
|
228
234
|
*/
|
|
229
235
|
_defineProperty(_assertThisInitialized(_this), "getFinalAcknowledgedState", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
230
|
-
var _this$
|
|
236
|
+
var _this$analyticsHelper6;
|
|
231
237
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
232
238
|
while (1) switch (_context2.prev = _context2.next) {
|
|
233
239
|
case 0:
|
|
@@ -239,7 +245,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
239
245
|
case 6:
|
|
240
246
|
_context2.prev = 6;
|
|
241
247
|
_context2.t0 = _context2["catch"](0);
|
|
242
|
-
(_this$
|
|
248
|
+
(_this$analyticsHelper6 = _this.analyticsHelper) === null || _this$analyticsHelper6 === void 0 || _this$analyticsHelper6.sendErrorEvent(_context2.t0, 'Error while returning ADF version of the final draft document');
|
|
243
249
|
throw new GetFinalAcknowledgedStateError('Error while returning the final acknowledged state of the draft document', _context2.t0);
|
|
244
250
|
case 10:
|
|
245
251
|
case "end":
|
|
@@ -287,6 +293,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
287
293
|
_this.participantsService = new ParticipantsService(_this.analyticsHelper, undefined, _this.emitCallback, _this.config.getUser, _this.channel.broadcast, _this.channel.sendPresenceJoined, _this.getPresenceData, _this.setUserId);
|
|
288
294
|
_this.metadataService = new MetadataService(_this.emitCallback, _this.channel.sendMetadata);
|
|
289
295
|
_this.namespaceService = new NamespaceService();
|
|
296
|
+
_this.presenceId = _this.config.presenceId;
|
|
290
297
|
if (config.isPresenceOnly) {
|
|
291
298
|
// this check is specifically for the presence only
|
|
292
299
|
// This presence feature is only for the confluence view page & jira presence which do not need the document service or api
|
|
@@ -356,7 +363,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
356
363
|
clientId: this.clientId
|
|
357
364
|
});
|
|
358
365
|
if (this.isBufferingEnabled && this.initialDraft && !this.isProviderInitialized) {
|
|
359
|
-
var _this$
|
|
366
|
+
var _this$analyticsHelper7;
|
|
360
367
|
var _this$initialDraft2 = this.initialDraft,
|
|
361
368
|
document = _this$initialDraft2.document,
|
|
362
369
|
version = _this$initialDraft2.version,
|
|
@@ -366,7 +373,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
366
373
|
version: version,
|
|
367
374
|
metadata: metadata
|
|
368
375
|
});
|
|
369
|
-
(_this$
|
|
376
|
+
(_this$analyticsHelper7 = this.analyticsHelper) === null || _this$analyticsHelper7 === void 0 || _this$analyticsHelper7.sendActionEvent(EVENT_ACTION.PROVIDER_INITIALIZED, EVENT_STATUS.INFO, {
|
|
370
377
|
isBuffered: true
|
|
371
378
|
});
|
|
372
379
|
}
|
|
@@ -375,8 +382,8 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
375
382
|
this.isChannelInitialized = true;
|
|
376
383
|
}
|
|
377
384
|
} catch (initError) {
|
|
378
|
-
var _this$
|
|
379
|
-
(_this$
|
|
385
|
+
var _this$analyticsHelper8;
|
|
386
|
+
(_this$analyticsHelper8 = this.analyticsHelper) === null || _this$analyticsHelper8 === void 0 || _this$analyticsHelper8.sendErrorEvent(initError, 'Error while initialising the provider');
|
|
380
387
|
// Throw error so consumers are aware the initialisation failed when initialising themselves
|
|
381
388
|
throw new ProviderInitialisationError('Provider initialisation error', initError);
|
|
382
389
|
}
|
|
@@ -386,8 +393,9 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
386
393
|
// Only used for the presence - opts out of the document service and api service
|
|
387
394
|
}, {
|
|
388
395
|
key: "setupForPresenceOnly",
|
|
389
|
-
value: function setupForPresenceOnly(clientId) {
|
|
396
|
+
value: function setupForPresenceOnly(clientId, presenceActivity) {
|
|
390
397
|
this.clientId = clientId;
|
|
398
|
+
this.presenceActivity = presenceActivity;
|
|
391
399
|
this.checkForCookies();
|
|
392
400
|
try {
|
|
393
401
|
if (!this.isChannelInitialized) {
|
|
@@ -395,8 +403,8 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
395
403
|
this.isChannelInitialized = true;
|
|
396
404
|
}
|
|
397
405
|
} catch (initError) {
|
|
398
|
-
var _this$
|
|
399
|
-
(_this$
|
|
406
|
+
var _this$analyticsHelper9;
|
|
407
|
+
(_this$analyticsHelper9 = this.analyticsHelper) === null || _this$analyticsHelper9 === void 0 || _this$analyticsHelper9.sendErrorEvent(initError, 'Error while initialising the provider');
|
|
400
408
|
// Throw error so consumers are aware the initialisation failed when initialising themselves
|
|
401
409
|
throw new ProviderInitialisationError('Provider initialisation error', initError);
|
|
402
410
|
}
|
|
@@ -406,9 +414,9 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
406
414
|
key: "checkForCookies",
|
|
407
415
|
value: function checkForCookies() {
|
|
408
416
|
if (!global.navigator.cookieEnabled) {
|
|
409
|
-
var _this$
|
|
417
|
+
var _this$analyticsHelper10;
|
|
410
418
|
var initError = new ProviderInitialisationError('Cookies are not enabled. Please enable cookies to use collaborative editing.');
|
|
411
|
-
(_this$
|
|
419
|
+
(_this$analyticsHelper10 = this.analyticsHelper) === null || _this$analyticsHelper10 === void 0 || _this$analyticsHelper10.sendErrorEvent(initError, 'Error while initialising the provider - cookies disabled');
|
|
412
420
|
throw new ProviderInitialisationError('Provider initialisation error - cookies disabled', initError);
|
|
413
421
|
}
|
|
414
422
|
}
|
|
@@ -425,14 +433,14 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
425
433
|
value: function send(_tr, _oldState, newState) {
|
|
426
434
|
try {
|
|
427
435
|
if (this.isViewOnly()) {
|
|
428
|
-
var _this$
|
|
436
|
+
var _this$analyticsHelper11;
|
|
429
437
|
var error = {
|
|
430
438
|
message: 'Attempted to send steps in view only mode',
|
|
431
439
|
data: {
|
|
432
440
|
code: INTERNAL_ERROR_CODE.VIEW_ONLY_STEPS_ERROR
|
|
433
441
|
}
|
|
434
442
|
};
|
|
435
|
-
(_this$
|
|
443
|
+
(_this$analyticsHelper11 = this.analyticsHelper) === null || _this$analyticsHelper11 === void 0 || _this$analyticsHelper11.sendErrorEvent(error, error.message);
|
|
436
444
|
return;
|
|
437
445
|
}
|
|
438
446
|
// Don't send steps while the document is locked (eg. when restoring the document)
|
|
@@ -442,8 +450,8 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
442
450
|
}
|
|
443
451
|
this.documentService.send(_tr, _oldState, newState);
|
|
444
452
|
} catch (error) {
|
|
445
|
-
var _this$
|
|
446
|
-
(_this$
|
|
453
|
+
var _this$analyticsHelper12;
|
|
454
|
+
(_this$analyticsHelper12 = this.analyticsHelper) === null || _this$analyticsHelper12 === void 0 || _this$analyticsHelper12.sendErrorEvent(error, 'Error while sending steps for a transaction');
|
|
447
455
|
throw new SendTransactionError('Error while sending steps for a transaction', error);
|
|
448
456
|
}
|
|
449
457
|
}
|
|
@@ -488,9 +496,9 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
488
496
|
this.participantsService.sendAIProviderChanged(_objectSpread(_objectSpread({}, basePayload), data));
|
|
489
497
|
}
|
|
490
498
|
} catch (error) {
|
|
491
|
-
var _this$
|
|
499
|
+
var _this$analyticsHelper13;
|
|
492
500
|
// We don't want to throw errors for Presence features as they tend to self-restore
|
|
493
|
-
(_this$
|
|
501
|
+
(_this$analyticsHelper13 = this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 || _this$analyticsHelper13.sendErrorEvent(error, 'Error while sending message - telepointer');
|
|
494
502
|
}
|
|
495
503
|
}
|
|
496
504
|
}, {
|
|
@@ -533,8 +541,8 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
533
541
|
this.sendStepsTimer = undefined;
|
|
534
542
|
}
|
|
535
543
|
} catch (error) {
|
|
536
|
-
var _this$
|
|
537
|
-
(_this$
|
|
544
|
+
var _this$analyticsHelper14;
|
|
545
|
+
(_this$analyticsHelper14 = this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 || _this$analyticsHelper14.sendErrorEvent(error, 'Error while shutting down the collab provider');
|
|
538
546
|
throw new DestroyError('Error while shutting down the collab provider', error);
|
|
539
547
|
}
|
|
540
548
|
this.clearTimers();
|
|
@@ -557,8 +565,8 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
557
565
|
}
|
|
558
566
|
this.metadataService.setTitle(title, broadcast);
|
|
559
567
|
} catch (error) {
|
|
560
|
-
var _this$
|
|
561
|
-
(_this$
|
|
568
|
+
var _this$analyticsHelper15;
|
|
569
|
+
(_this$analyticsHelper15 = this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 || _this$analyticsHelper15.sendErrorEvent(error, 'Error while setting title');
|
|
562
570
|
throw new SetTitleError('Error while setting title', error);
|
|
563
571
|
}
|
|
564
572
|
}
|
|
@@ -576,8 +584,8 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
576
584
|
try {
|
|
577
585
|
this.metadataService.setEditorWidth(editorWidth, broadcast);
|
|
578
586
|
} catch (error) {
|
|
579
|
-
var _this$
|
|
580
|
-
(_this$
|
|
587
|
+
var _this$analyticsHelper16;
|
|
588
|
+
(_this$analyticsHelper16 = this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 || _this$analyticsHelper16.sendErrorEvent(error, 'Error while setting editor width');
|
|
581
589
|
throw new SetEditorWidthError('Error while setting editor width', error);
|
|
582
590
|
}
|
|
583
591
|
}
|
|
@@ -596,8 +604,8 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
596
604
|
}
|
|
597
605
|
this.metadataService.setMetadata(metadata);
|
|
598
606
|
} catch (error) {
|
|
599
|
-
var _this$
|
|
600
|
-
(_this$
|
|
607
|
+
var _this$analyticsHelper17;
|
|
608
|
+
(_this$analyticsHelper17 = this.analyticsHelper) === null || _this$analyticsHelper17 === void 0 || _this$analyticsHelper17.sendErrorEvent(error, 'Error while setting metadata');
|
|
601
609
|
throw new SetMetadataError('Error while setting metadata', error);
|
|
602
610
|
}
|
|
603
611
|
}
|
package/dist/esm/types.js
CHANGED
|
@@ -17,6 +17,7 @@ export declare enum EVENT_ACTION {
|
|
|
17
17
|
DROPPED_STEPS = "droppedStepInCatchup",// https://data-portal.internal.atlassian.com/analytics/registry/53724
|
|
18
18
|
WEBSOCKET_MESSAGE_VOLUME_METRIC = "websocketMessageVolumeMetric",// https://data-portal.internal.atlassian.com/analytics/registry/53596
|
|
19
19
|
PROVIDER_INITIALIZED = "providerInitialized",// https://data-portal.internal.atlassian.com/analytics/registry/54714
|
|
20
|
+
RECONNECTION = "providerReconnection",// https://data-portal.internal.atlassian.com/analytics/registry/73992
|
|
20
21
|
PROVIDER_SETUP = "providerSetup",// https://data-portal.internal.atlassian.com/analytics/registry/54715
|
|
21
22
|
HAS_UNCONFIRMED_STEPS = "hasUnconfirmedSteps"
|
|
22
23
|
}
|
|
@@ -253,7 +254,14 @@ type UpdateDocumentAnalyticsEvent = {
|
|
|
253
254
|
isDocContentValid: boolean;
|
|
254
255
|
} & BaseActionAnalyticsEventAttributes;
|
|
255
256
|
};
|
|
256
|
-
|
|
257
|
+
type ReconnectionAnalyticsEvent = {
|
|
258
|
+
eventAction: EVENT_ACTION.RECONNECTION;
|
|
259
|
+
attributes: {
|
|
260
|
+
eventStatus: EVENT_STATUS.SUCCESS;
|
|
261
|
+
disconnectionPeriodSeconds: number;
|
|
262
|
+
} & BaseActionAnalyticsEventAttributes;
|
|
263
|
+
};
|
|
264
|
+
export type ActionAnalyticsEvent = AddStepsSuccessAnalyticsEvent | AddStepsFailureAnalyticsEvent | ReInitDocFailAnalyticsEvent | ReInitDocSuccessAnalyticsEvent | ConnectionSuccessAnalyticsEvent | ConnectionFailureAnalyticsEvent | CatchUpSuccessAnalyticsEvent | CatchUpFailureAnalyticsEvent | DocumentInitSuccessAnalyticsEvent | UpdateParticipantsSuccessAnalyticsEvent | CommitUnconfirmedStepsSuccessAnalyticsEvent | CommitUnconfirmedStepsFailureAnalyticsEvent | PublishPageSuccessAnalyticsEvent | PublishPageFailureAnalyticsEvent | GetCurrentStateSuccessAnalyticsEvent | GetCurrentStateFailureAnalyticsEvent | InvalidateTokenAnalyticsEvent | SendStepsRetryAnalyticsEvent | CatchupAfterMaxSendStepsRetryAnalyticsEvent | CatchUpDroppedStepsEvent | WebsocketMessageVolumeMetricEvent | ProviderInitializedAnalyticsEvent | ProviderSetupAnalyticsEvent | ProviderHasUnconfirmedStepsAnalyticsEvent | UpdateDocumentAnalyticsEvent | ReconnectionAnalyticsEvent;
|
|
257
265
|
export declare const ACK_MAX_TRY = 60;
|
|
258
266
|
export declare const CONFLUENCE = "confluence";
|
|
259
267
|
/** Enumerable for attaching a reason to catchup (v2) call(s) */
|
|
@@ -2,7 +2,7 @@ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/stat
|
|
|
2
2
|
import type { Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform';
|
|
3
3
|
import { Emitter } from '../emitter';
|
|
4
4
|
import type { Config } from '../types';
|
|
5
|
-
import type { CollabEditProvider, CollabEvents, CollabTelepointerPayload, ResolvedEditorState, Metadata, SyncUpErrorFunction, CollabActivityJoinPayload, CollabActivityAckPayload, CollabActivityAIProviderChangedPayload } from '@atlaskit/editor-common/collab';
|
|
5
|
+
import type { CollabEditProvider, CollabEvents, CollabTelepointerPayload, ResolvedEditorState, Metadata, SyncUpErrorFunction, CollabActivityJoinPayload, CollabActivityAckPayload, CollabActivityAIProviderChangedPayload, PresenceActivity } from '@atlaskit/editor-common/collab';
|
|
6
6
|
import { Api } from '../api/api';
|
|
7
7
|
import { NullApi } from '../api/null-api';
|
|
8
8
|
export declare const MAX_STEP_REJECTED_ERROR = 15;
|
|
@@ -22,6 +22,8 @@ export declare class Provider extends Emitter<CollabEvents> implements BaseEvent
|
|
|
22
22
|
private sessionId?;
|
|
23
23
|
private clientId?;
|
|
24
24
|
private userId?;
|
|
25
|
+
private presenceId?;
|
|
26
|
+
private presenceActivity?;
|
|
25
27
|
private presenceUpdateTimeout?;
|
|
26
28
|
private disconnectedAt?;
|
|
27
29
|
private sendStepsTimer?;
|
|
@@ -66,7 +68,7 @@ export declare class Provider extends Emitter<CollabEvents> implements BaseEvent
|
|
|
66
68
|
editorApi?: any;
|
|
67
69
|
onSyncUpError?: SyncUpErrorFunction;
|
|
68
70
|
}): this;
|
|
69
|
-
setupForPresenceOnly(clientId: string): this;
|
|
71
|
+
setupForPresenceOnly(clientId: string, presenceActivity?: PresenceActivity): this;
|
|
70
72
|
private checkForCookies;
|
|
71
73
|
/**
|
|
72
74
|
* Send steps from transaction to NCS (and as a consequence to other participants), called from the collab-edit plugin in the editor
|
package/dist/types/types.d.ts
CHANGED
|
@@ -5,9 +5,8 @@ import type { InternalError } from './errors/internal-errors';
|
|
|
5
5
|
import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
6
6
|
import type { GetUserType } from './participants/participants-helper';
|
|
7
7
|
import type AnalyticsHelper from './analytics/analytics-helper';
|
|
8
|
-
import type { StepJson, CollabSendableSelection, Metadata, UserPermitType, Activity } from '@atlaskit/editor-common/collab';
|
|
8
|
+
import type { StepJson, CollabSendableSelection, Metadata, UserPermitType, Activity, PresenceActivity } from '@atlaskit/editor-common/collab';
|
|
9
9
|
import { type CatchupEventReason } from './helpers/const';
|
|
10
|
-
export type { CollabParticipant, CollabEventInitData, CollabEventRemoteData, CollabEventConnectionData, CollabEventConnectingData, CollabEventPresenceData, ResolvedEditorState, CollabConnectedPayload, CollabConnectingPayload, CollabDisconnectedPayload, CollabInitPayload, CollabDataPayload, CollabTelepointerPayload, CollabPresencePayload, CollabMetadataPayload, CollabLocalStepsPayload, CollabCommitStatusEventPayload, CollabPermissionEventPayload, UserPermitType, CollabEvents, Metadata, StepJson, CollabEventTelepointerData, CollabSendableSelection, CollabEditProvider, NewCollabSyncUpErrorAttributes, SyncUpErrorFunction, CollabEventLocalStepData, } from '@atlaskit/editor-common/collab';
|
|
11
10
|
export interface CollabEventDisconnectedData {
|
|
12
11
|
sid: string;
|
|
13
12
|
reason: 'CLIENT_DISCONNECT' | 'SERVER_DISCONNECT' | 'SOCKET_CLOSED' | 'SOCKET_ERROR' | 'SOCKET_TIMEOUT' | 'UNKNOWN_DISCONNECT';
|
|
@@ -80,6 +79,12 @@ export interface Config {
|
|
|
80
79
|
* @default false
|
|
81
80
|
*/
|
|
82
81
|
__livePage?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Configure the provider to pass along a persistent presenceId during presence events. This presenceId will be used
|
|
84
|
+
* to calculate the colors of the presence avatars as well as the editors telepointers. Since these two features are split across
|
|
85
|
+
* multiple websocket connections, the presenceId is used to correlate the two.
|
|
86
|
+
*/
|
|
87
|
+
presenceId?: string;
|
|
83
88
|
}
|
|
84
89
|
export interface InitAndAuthData {
|
|
85
90
|
initialized: boolean;
|
|
@@ -125,6 +130,8 @@ export type PresenceData = {
|
|
|
125
130
|
userId: string | undefined;
|
|
126
131
|
clientId: number | string;
|
|
127
132
|
permit?: UserPermitType;
|
|
133
|
+
presenceId?: string;
|
|
134
|
+
presenceActivity?: PresenceActivity;
|
|
128
135
|
};
|
|
129
136
|
export type PresencePayload = PresenceData & {
|
|
130
137
|
timestamp: number;
|
|
@@ -215,3 +222,4 @@ export type ProductInformation = {
|
|
|
215
222
|
product: string;
|
|
216
223
|
subProduct?: string;
|
|
217
224
|
};
|
|
225
|
+
export {};
|
|
@@ -17,6 +17,7 @@ export declare enum EVENT_ACTION {
|
|
|
17
17
|
DROPPED_STEPS = "droppedStepInCatchup",// https://data-portal.internal.atlassian.com/analytics/registry/53724
|
|
18
18
|
WEBSOCKET_MESSAGE_VOLUME_METRIC = "websocketMessageVolumeMetric",// https://data-portal.internal.atlassian.com/analytics/registry/53596
|
|
19
19
|
PROVIDER_INITIALIZED = "providerInitialized",// https://data-portal.internal.atlassian.com/analytics/registry/54714
|
|
20
|
+
RECONNECTION = "providerReconnection",// https://data-portal.internal.atlassian.com/analytics/registry/73992
|
|
20
21
|
PROVIDER_SETUP = "providerSetup",// https://data-portal.internal.atlassian.com/analytics/registry/54715
|
|
21
22
|
HAS_UNCONFIRMED_STEPS = "hasUnconfirmedSteps"
|
|
22
23
|
}
|
|
@@ -253,7 +254,14 @@ type UpdateDocumentAnalyticsEvent = {
|
|
|
253
254
|
isDocContentValid: boolean;
|
|
254
255
|
} & BaseActionAnalyticsEventAttributes;
|
|
255
256
|
};
|
|
256
|
-
|
|
257
|
+
type ReconnectionAnalyticsEvent = {
|
|
258
|
+
eventAction: EVENT_ACTION.RECONNECTION;
|
|
259
|
+
attributes: {
|
|
260
|
+
eventStatus: EVENT_STATUS.SUCCESS;
|
|
261
|
+
disconnectionPeriodSeconds: number;
|
|
262
|
+
} & BaseActionAnalyticsEventAttributes;
|
|
263
|
+
};
|
|
264
|
+
export type ActionAnalyticsEvent = AddStepsSuccessAnalyticsEvent | AddStepsFailureAnalyticsEvent | ReInitDocFailAnalyticsEvent | ReInitDocSuccessAnalyticsEvent | ConnectionSuccessAnalyticsEvent | ConnectionFailureAnalyticsEvent | CatchUpSuccessAnalyticsEvent | CatchUpFailureAnalyticsEvent | DocumentInitSuccessAnalyticsEvent | UpdateParticipantsSuccessAnalyticsEvent | CommitUnconfirmedStepsSuccessAnalyticsEvent | CommitUnconfirmedStepsFailureAnalyticsEvent | PublishPageSuccessAnalyticsEvent | PublishPageFailureAnalyticsEvent | GetCurrentStateSuccessAnalyticsEvent | GetCurrentStateFailureAnalyticsEvent | InvalidateTokenAnalyticsEvent | SendStepsRetryAnalyticsEvent | CatchupAfterMaxSendStepsRetryAnalyticsEvent | CatchUpDroppedStepsEvent | WebsocketMessageVolumeMetricEvent | ProviderInitializedAnalyticsEvent | ProviderSetupAnalyticsEvent | ProviderHasUnconfirmedStepsAnalyticsEvent | UpdateDocumentAnalyticsEvent | ReconnectionAnalyticsEvent;
|
|
257
265
|
export declare const ACK_MAX_TRY = 60;
|
|
258
266
|
export declare const CONFLUENCE = "confluence";
|
|
259
267
|
/** Enumerable for attaching a reason to catchup (v2) call(s) */
|
|
@@ -2,7 +2,7 @@ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/stat
|
|
|
2
2
|
import type { Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform';
|
|
3
3
|
import { Emitter } from '../emitter';
|
|
4
4
|
import type { Config } from '../types';
|
|
5
|
-
import type { CollabEditProvider, CollabEvents, CollabTelepointerPayload, ResolvedEditorState, Metadata, SyncUpErrorFunction, CollabActivityJoinPayload, CollabActivityAckPayload, CollabActivityAIProviderChangedPayload } from '@atlaskit/editor-common/collab';
|
|
5
|
+
import type { CollabEditProvider, CollabEvents, CollabTelepointerPayload, ResolvedEditorState, Metadata, SyncUpErrorFunction, CollabActivityJoinPayload, CollabActivityAckPayload, CollabActivityAIProviderChangedPayload, PresenceActivity } from '@atlaskit/editor-common/collab';
|
|
6
6
|
import { Api } from '../api/api';
|
|
7
7
|
import { NullApi } from '../api/null-api';
|
|
8
8
|
export declare const MAX_STEP_REJECTED_ERROR = 15;
|
|
@@ -22,6 +22,8 @@ export declare class Provider extends Emitter<CollabEvents> implements BaseEvent
|
|
|
22
22
|
private sessionId?;
|
|
23
23
|
private clientId?;
|
|
24
24
|
private userId?;
|
|
25
|
+
private presenceId?;
|
|
26
|
+
private presenceActivity?;
|
|
25
27
|
private presenceUpdateTimeout?;
|
|
26
28
|
private disconnectedAt?;
|
|
27
29
|
private sendStepsTimer?;
|
|
@@ -66,7 +68,7 @@ export declare class Provider extends Emitter<CollabEvents> implements BaseEvent
|
|
|
66
68
|
editorApi?: any;
|
|
67
69
|
onSyncUpError?: SyncUpErrorFunction;
|
|
68
70
|
}): this;
|
|
69
|
-
setupForPresenceOnly(clientId: string): this;
|
|
71
|
+
setupForPresenceOnly(clientId: string, presenceActivity?: PresenceActivity): this;
|
|
70
72
|
private checkForCookies;
|
|
71
73
|
/**
|
|
72
74
|
* Send steps from transaction to NCS (and as a consequence to other participants), called from the collab-edit plugin in the editor
|
|
@@ -5,9 +5,8 @@ import type { InternalError } from './errors/internal-errors';
|
|
|
5
5
|
import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
6
6
|
import type { GetUserType } from './participants/participants-helper';
|
|
7
7
|
import type AnalyticsHelper from './analytics/analytics-helper';
|
|
8
|
-
import type { StepJson, CollabSendableSelection, Metadata, UserPermitType, Activity } from '@atlaskit/editor-common/collab';
|
|
8
|
+
import type { StepJson, CollabSendableSelection, Metadata, UserPermitType, Activity, PresenceActivity } from '@atlaskit/editor-common/collab';
|
|
9
9
|
import { type CatchupEventReason } from './helpers/const';
|
|
10
|
-
export type { CollabParticipant, CollabEventInitData, CollabEventRemoteData, CollabEventConnectionData, CollabEventConnectingData, CollabEventPresenceData, ResolvedEditorState, CollabConnectedPayload, CollabConnectingPayload, CollabDisconnectedPayload, CollabInitPayload, CollabDataPayload, CollabTelepointerPayload, CollabPresencePayload, CollabMetadataPayload, CollabLocalStepsPayload, CollabCommitStatusEventPayload, CollabPermissionEventPayload, UserPermitType, CollabEvents, Metadata, StepJson, CollabEventTelepointerData, CollabSendableSelection, CollabEditProvider, NewCollabSyncUpErrorAttributes, SyncUpErrorFunction, CollabEventLocalStepData, } from '@atlaskit/editor-common/collab';
|
|
11
10
|
export interface CollabEventDisconnectedData {
|
|
12
11
|
sid: string;
|
|
13
12
|
reason: 'CLIENT_DISCONNECT' | 'SERVER_DISCONNECT' | 'SOCKET_CLOSED' | 'SOCKET_ERROR' | 'SOCKET_TIMEOUT' | 'UNKNOWN_DISCONNECT';
|
|
@@ -80,6 +79,12 @@ export interface Config {
|
|
|
80
79
|
* @default false
|
|
81
80
|
*/
|
|
82
81
|
__livePage?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Configure the provider to pass along a persistent presenceId during presence events. This presenceId will be used
|
|
84
|
+
* to calculate the colors of the presence avatars as well as the editors telepointers. Since these two features are split across
|
|
85
|
+
* multiple websocket connections, the presenceId is used to correlate the two.
|
|
86
|
+
*/
|
|
87
|
+
presenceId?: string;
|
|
83
88
|
}
|
|
84
89
|
export interface InitAndAuthData {
|
|
85
90
|
initialized: boolean;
|
|
@@ -125,6 +130,8 @@ export type PresenceData = {
|
|
|
125
130
|
userId: string | undefined;
|
|
126
131
|
clientId: number | string;
|
|
127
132
|
permit?: UserPermitType;
|
|
133
|
+
presenceId?: string;
|
|
134
|
+
presenceActivity?: PresenceActivity;
|
|
128
135
|
};
|
|
129
136
|
export type PresencePayload = PresenceData & {
|
|
130
137
|
timestamp: number;
|
|
@@ -215,3 +222,4 @@ export type ProductInformation = {
|
|
|
215
222
|
product: string;
|
|
216
223
|
subProduct?: string;
|
|
217
224
|
};
|
|
225
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/collab-provider",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.1.0",
|
|
4
4
|
"description": "A provider for collaborative editing.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@atlaskit/analytics-gas-types": "^5.1.0",
|
|
36
36
|
"@atlaskit/analytics-listeners": "^8.11.0",
|
|
37
|
-
"@atlaskit/editor-common": "^
|
|
37
|
+
"@atlaskit/editor-common": "^95.3.0",
|
|
38
38
|
"@atlaskit/editor-json-transformer": "^8.21.0",
|
|
39
39
|
"@atlaskit/editor-prosemirror": "6.0.0",
|
|
40
40
|
"@atlaskit/feature-gate-js-client": "^4.22.0",
|