@atlaskit/editor-synced-block-provider 2.10.6 → 2.11.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 +13 -0
- package/dist/cjs/clients/block-service/blockService.js +5 -4
- package/dist/cjs/clients/confluence/sourceInfo.js +18 -15
- package/dist/cjs/hooks/useFetchSyncBlockData.js +20 -11
- package/dist/cjs/hooks/useHandleContentChanges.js +1 -5
- package/dist/cjs/providers/block-service/blockServiceAPI.js +17 -12
- package/dist/cjs/providers/syncBlockProvider.js +4 -4
- package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +118 -66
- package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +93 -43
- package/dist/cjs/store-manager/syncBlockStoreManager.js +3 -3
- package/dist/cjs/utils/errorHandling.js +31 -1
- package/dist/es2019/clients/block-service/blockService.js +5 -4
- package/dist/es2019/clients/confluence/sourceInfo.js +13 -8
- package/dist/es2019/hooks/useFetchSyncBlockData.js +15 -7
- package/dist/es2019/hooks/useHandleContentChanges.js +1 -5
- package/dist/es2019/providers/block-service/blockServiceAPI.js +13 -8
- package/dist/es2019/providers/syncBlockProvider.js +4 -4
- package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +105 -51
- package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +65 -24
- package/dist/es2019/store-manager/syncBlockStoreManager.js +3 -3
- package/dist/es2019/utils/errorHandling.js +17 -1
- package/dist/esm/clients/block-service/blockService.js +5 -4
- package/dist/esm/clients/confluence/sourceInfo.js +18 -15
- package/dist/esm/hooks/useFetchSyncBlockData.js +20 -11
- package/dist/esm/hooks/useHandleContentChanges.js +1 -5
- package/dist/esm/providers/block-service/blockServiceAPI.js +17 -12
- package/dist/esm/providers/syncBlockProvider.js +4 -4
- package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +118 -66
- package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +93 -43
- package/dist/esm/store-manager/syncBlockStoreManager.js +3 -3
- package/dist/esm/utils/errorHandling.js +30 -0
- package/dist/types/clients/block-service/blockService.d.ts +0 -2
- package/dist/types/clients/confluence/sourceInfo.d.ts +2 -1
- package/dist/types/hooks/useFetchSyncBlockData.d.ts +2 -1
- package/dist/types/providers/block-service/blockServiceAPI.d.ts +6 -3
- package/dist/types/providers/syncBlockProvider.d.ts +2 -1
- package/dist/types/providers/types.d.ts +2 -1
- package/dist/types/store-manager/referenceSyncBlockStoreManager.d.ts +4 -1
- package/dist/types/store-manager/sourceSyncBlockStoreManager.d.ts +3 -1
- package/dist/types/store-manager/syncBlockStoreManager.d.ts +2 -1
- package/dist/types/utils/errorHandling.d.ts +10 -0
- package/dist/types-ts4.5/clients/block-service/blockService.d.ts +0 -2
- package/dist/types-ts4.5/clients/confluence/sourceInfo.d.ts +2 -1
- package/dist/types-ts4.5/hooks/useFetchSyncBlockData.d.ts +2 -1
- package/dist/types-ts4.5/providers/block-service/blockServiceAPI.d.ts +6 -3
- package/dist/types-ts4.5/providers/syncBlockProvider.d.ts +2 -1
- package/dist/types-ts4.5/providers/types.d.ts +2 -1
- package/dist/types-ts4.5/store-manager/referenceSyncBlockStoreManager.d.ts +4 -1
- package/dist/types-ts4.5/store-manager/sourceSyncBlockStoreManager.d.ts +3 -1
- package/dist/types-ts4.5/store-manager/syncBlockStoreManager.d.ts +2 -1
- package/dist/types-ts4.5/utils/errorHandling.d.ts +10 -0
- package/package.json +2 -8
|
@@ -5,7 +5,9 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
5
5
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
6
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
7
7
|
import uuid from 'uuid';
|
|
8
|
+
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
8
9
|
import { rebaseTransaction as _rebaseTransaction } from '../common/rebase-transaction';
|
|
10
|
+
import { updateErrorPayload, createErrorPayload, deleteErrorPayload, updateCacheErrorPayload } from '../utils/errorHandling';
|
|
9
11
|
import { convertSyncBlockPMNodeToSyncBlockData, createBodiedSyncBlockNode as _createBodiedSyncBlockNode } from '../utils/utils';
|
|
10
12
|
// A store manager responsible for the lifecycle and state management of source sync blocks in an editor instance.
|
|
11
13
|
// Designed to manage local in-memory state and synchronize with an external data provider.
|
|
@@ -13,7 +15,7 @@ import { convertSyncBlockPMNodeToSyncBlockData, createBodiedSyncBlockNode as _cr
|
|
|
13
15
|
// Handles caching, debouncing updates, and publish/subscribe for local changes.
|
|
14
16
|
// Ensures consistency between local and remote state, and can be used in both editor and renderer contexts.
|
|
15
17
|
export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
16
|
-
function SourceSyncBlockStoreManager(dataProvider) {
|
|
18
|
+
function SourceSyncBlockStoreManager(dataProvider, fireAnalyticsEvent) {
|
|
17
19
|
var _this = this;
|
|
18
20
|
_classCallCheck(this, SourceSyncBlockStoreManager);
|
|
19
21
|
_defineProperty(this, "setPendingDeletion", function (Ids, value) {
|
|
@@ -24,6 +26,7 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
24
26
|
});
|
|
25
27
|
this.dataProvider = dataProvider;
|
|
26
28
|
this.syncBlockCache = new Map();
|
|
29
|
+
this.fireAnalyticsEvent = fireAnalyticsEvent;
|
|
27
30
|
}
|
|
28
31
|
return _createClass(SourceSyncBlockStoreManager, [{
|
|
29
32
|
key: "isSourceBlock",
|
|
@@ -38,18 +41,27 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
38
41
|
}, {
|
|
39
42
|
key: "updateSyncBlockData",
|
|
40
43
|
value: function updateSyncBlockData(syncBlockNode) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
try {
|
|
45
|
+
if (!this.isSourceBlock(syncBlockNode)) {
|
|
46
|
+
throw new Error('Invalid sync block node type provided for updateSyncBlockData');
|
|
47
|
+
}
|
|
48
|
+
var _syncBlockNode$attrs = syncBlockNode.attrs,
|
|
49
|
+
localId = _syncBlockNode$attrs.localId,
|
|
50
|
+
resourceId = _syncBlockNode$attrs.resourceId;
|
|
51
|
+
if (!localId || !resourceId) {
|
|
52
|
+
throw new Error('Local ID or resource ID is not set');
|
|
53
|
+
}
|
|
54
|
+
var syncBlockData = convertSyncBlockPMNodeToSyncBlockData(syncBlockNode);
|
|
55
|
+
this.syncBlockCache.set(resourceId, syncBlockData);
|
|
56
|
+
return true;
|
|
57
|
+
} catch (error) {
|
|
58
|
+
var _this$fireAnalyticsEv;
|
|
59
|
+
logException(error, {
|
|
60
|
+
location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
|
|
61
|
+
});
|
|
62
|
+
(_this$fireAnalyticsEv = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv === void 0 || _this$fireAnalyticsEv.call(this, updateCacheErrorPayload(error.message));
|
|
63
|
+
return false;
|
|
49
64
|
}
|
|
50
|
-
var syncBlockData = convertSyncBlockPMNodeToSyncBlockData(syncBlockNode);
|
|
51
|
-
this.syncBlockCache.set(resourceId, syncBlockData);
|
|
52
|
-
return true;
|
|
53
65
|
}
|
|
54
66
|
|
|
55
67
|
/**
|
|
@@ -61,7 +73,8 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
61
73
|
key: "flush",
|
|
62
74
|
value: (function () {
|
|
63
75
|
var _flush = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
64
|
-
var
|
|
76
|
+
var _this2 = this;
|
|
77
|
+
var bodiedSyncBlockNodes, bodiedSyncBlockData, writeResults, _this$fireAnalyticsEv2;
|
|
65
78
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
66
79
|
while (1) switch (_context.prev = _context.next) {
|
|
67
80
|
case 0:
|
|
@@ -97,18 +110,37 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
97
110
|
return this.dataProvider.writeNodesData(bodiedSyncBlockNodes, bodiedSyncBlockData);
|
|
98
111
|
case 10:
|
|
99
112
|
writeResults = _context.sent;
|
|
100
|
-
|
|
113
|
+
if (!writeResults.every(function (result) {
|
|
101
114
|
return result.resourceId !== undefined;
|
|
102
|
-
}))
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
115
|
+
})) {
|
|
116
|
+
_context.next = 15;
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
return _context.abrupt("return", true);
|
|
120
|
+
case 15:
|
|
121
|
+
writeResults.filter(function (result) {
|
|
122
|
+
return result.resourceId === undefined;
|
|
123
|
+
}).forEach(function (result) {
|
|
124
|
+
var _this2$fireAnalyticsE;
|
|
125
|
+
(_this2$fireAnalyticsE = _this2.fireAnalyticsEvent) === null || _this2$fireAnalyticsE === void 0 || _this2$fireAnalyticsE.call(_this2, updateErrorPayload(result.error || 'Failed to write data'));
|
|
126
|
+
});
|
|
106
127
|
return _context.abrupt("return", false);
|
|
107
128
|
case 17:
|
|
129
|
+
_context.next = 24;
|
|
130
|
+
break;
|
|
131
|
+
case 19:
|
|
132
|
+
_context.prev = 19;
|
|
133
|
+
_context.t0 = _context["catch"](0);
|
|
134
|
+
logException(_context.t0, {
|
|
135
|
+
location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
|
|
136
|
+
});
|
|
137
|
+
(_this$fireAnalyticsEv2 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv2 === void 0 || _this$fireAnalyticsEv2.call(this, updateErrorPayload(_context.t0.message));
|
|
138
|
+
return _context.abrupt("return", false);
|
|
139
|
+
case 24:
|
|
108
140
|
case "end":
|
|
109
141
|
return _context.stop();
|
|
110
142
|
}
|
|
111
|
-
}, _callee, this, [[0,
|
|
143
|
+
}, _callee, this, [[0, 19]]);
|
|
112
144
|
}));
|
|
113
145
|
function flush() {
|
|
114
146
|
return _flush.apply(this, arguments);
|
|
@@ -161,10 +193,10 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
161
193
|
}, {
|
|
162
194
|
key: "registerConfirmationCallback",
|
|
163
195
|
value: function registerConfirmationCallback(callback) {
|
|
164
|
-
var
|
|
196
|
+
var _this3 = this;
|
|
165
197
|
this.confirmationCallback = callback;
|
|
166
198
|
return function () {
|
|
167
|
-
|
|
199
|
+
_this3.confirmationCallback = undefined;
|
|
168
200
|
};
|
|
169
201
|
}
|
|
170
202
|
}, {
|
|
@@ -184,7 +216,7 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
184
216
|
var localId = uuid();
|
|
185
217
|
var sourceId = (_this$dataProvider = this.dataProvider) === null || _this$dataProvider === void 0 ? void 0 : _this$dataProvider.getSourceId();
|
|
186
218
|
if (!this.dataProvider || !sourceId) {
|
|
187
|
-
throw new Error('
|
|
219
|
+
throw new Error('Data provider not set or source id not set');
|
|
188
220
|
}
|
|
189
221
|
var resourceId = this.dataProvider.generateResourceId(sourceId, localId);
|
|
190
222
|
return {
|
|
@@ -200,7 +232,7 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
200
232
|
}, {
|
|
201
233
|
key: "createBodiedSyncBlockNode",
|
|
202
234
|
value: function createBodiedSyncBlockNode(attrs) {
|
|
203
|
-
var
|
|
235
|
+
var _this4 = this;
|
|
204
236
|
try {
|
|
205
237
|
if (!this.dataProvider) {
|
|
206
238
|
throw new Error('Data provider not set');
|
|
@@ -215,35 +247,44 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
215
247
|
results.forEach(function (result) {
|
|
216
248
|
var resourceId = result.resourceId;
|
|
217
249
|
if (resourceId) {
|
|
218
|
-
|
|
250
|
+
_this4.commitPendingCreation(true);
|
|
219
251
|
} else {
|
|
220
|
-
|
|
221
|
-
|
|
252
|
+
var _this4$fireAnalyticsE;
|
|
253
|
+
_this4.commitPendingCreation(false);
|
|
254
|
+
(_this4$fireAnalyticsE = _this4.fireAnalyticsEvent) === null || _this4$fireAnalyticsE === void 0 || _this4$fireAnalyticsE.call(_this4, createErrorPayload(result.error || 'Failed to create bodied sync block'));
|
|
222
255
|
}
|
|
223
256
|
});
|
|
224
|
-
}).catch(function (
|
|
225
|
-
|
|
226
|
-
|
|
257
|
+
}).catch(function (error) {
|
|
258
|
+
var _this4$fireAnalyticsE2;
|
|
259
|
+
_this4.commitPendingCreation(false);
|
|
260
|
+
logException(error, {
|
|
261
|
+
location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
|
|
262
|
+
});
|
|
263
|
+
(_this4$fireAnalyticsE2 = _this4.fireAnalyticsEvent) === null || _this4$fireAnalyticsE2 === void 0 || _this4$fireAnalyticsE2.call(_this4, createErrorPayload(error.message));
|
|
227
264
|
});
|
|
228
265
|
this.registerPendingCreation(resourceId);
|
|
229
266
|
} catch (error) {
|
|
267
|
+
var _this$fireAnalyticsEv3;
|
|
230
268
|
if (this.hasPendingCreation()) {
|
|
231
269
|
this.commitPendingCreation(false);
|
|
232
270
|
}
|
|
233
|
-
|
|
271
|
+
logException(error, {
|
|
272
|
+
location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
|
|
273
|
+
});
|
|
274
|
+
(_this$fireAnalyticsEv3 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv3 === void 0 || _this$fireAnalyticsEv3.call(this, createErrorPayload(error.message));
|
|
234
275
|
}
|
|
235
276
|
}
|
|
236
277
|
}, {
|
|
237
278
|
key: "deleteSyncBlocksWithConfirmation",
|
|
238
279
|
value: function () {
|
|
239
280
|
var _deleteSyncBlocksWithConfirmation = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(tr, syncBlockIds) {
|
|
240
|
-
var
|
|
241
|
-
var confirmed, _this$editorView, results, callback;
|
|
281
|
+
var _this5 = this;
|
|
282
|
+
var confirmed, _this$editorView, results, callback, _this$fireAnalyticsEv4;
|
|
242
283
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
243
284
|
while (1) switch (_context2.prev = _context2.next) {
|
|
244
285
|
case 0:
|
|
245
286
|
if (!this.confirmationCallback) {
|
|
246
|
-
_context2.next =
|
|
287
|
+
_context2.next = 24;
|
|
247
288
|
break;
|
|
248
289
|
}
|
|
249
290
|
this.confirmationTransaction = tr;
|
|
@@ -252,7 +293,7 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
252
293
|
case 4:
|
|
253
294
|
confirmed = _context2.sent;
|
|
254
295
|
if (!confirmed) {
|
|
255
|
-
_context2.next =
|
|
296
|
+
_context2.next = 23;
|
|
256
297
|
break;
|
|
257
298
|
}
|
|
258
299
|
(_this$editorView = this.editorView) === null || _this$editorView === void 0 || _this$editorView.dispatch(this.confirmationTransaction.setMeta('isConfirmedSyncBlockDeletion', true));
|
|
@@ -264,7 +305,7 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
264
305
|
throw new Error('Data provider not set');
|
|
265
306
|
case 10:
|
|
266
307
|
syncBlockIds.forEach(function (Ids) {
|
|
267
|
-
|
|
308
|
+
_this5.setPendingDeletion(Ids, true);
|
|
268
309
|
});
|
|
269
310
|
_context2.next = 13;
|
|
270
311
|
return this.dataProvider.deleteNodesData(syncBlockIds.map(function (attrs) {
|
|
@@ -276,27 +317,35 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
276
317
|
return result.success;
|
|
277
318
|
})) {
|
|
278
319
|
callback = function callback(Ids) {
|
|
279
|
-
return
|
|
320
|
+
return _this5.syncBlockCache.delete(Ids.resourceId);
|
|
280
321
|
};
|
|
281
322
|
} else {
|
|
282
323
|
callback = function callback(Ids) {
|
|
283
|
-
|
|
324
|
+
_this5.setPendingDeletion(Ids, false);
|
|
284
325
|
};
|
|
285
|
-
|
|
326
|
+
results.filter(function (result) {
|
|
327
|
+
return result.resourceId === undefined;
|
|
328
|
+
}).forEach(function (result) {
|
|
329
|
+
var _this5$fireAnalyticsE;
|
|
330
|
+
(_this5$fireAnalyticsE = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE === void 0 || _this5$fireAnalyticsE.call(_this5, deleteErrorPayload(result.error || 'Failed to delete synced block'));
|
|
331
|
+
});
|
|
286
332
|
}
|
|
287
333
|
syncBlockIds.forEach(callback);
|
|
288
|
-
_context2.next =
|
|
334
|
+
_context2.next = 23;
|
|
289
335
|
break;
|
|
290
336
|
case 18:
|
|
291
337
|
_context2.prev = 18;
|
|
292
338
|
_context2.t0 = _context2["catch"](7);
|
|
293
339
|
syncBlockIds.forEach(function (Ids) {
|
|
294
|
-
|
|
340
|
+
_this5.setPendingDeletion(Ids, false);
|
|
341
|
+
});
|
|
342
|
+
logException(_context2.t0, {
|
|
343
|
+
location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
|
|
295
344
|
});
|
|
296
|
-
|
|
297
|
-
case
|
|
345
|
+
(_this$fireAnalyticsEv4 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv4 === void 0 || _this$fireAnalyticsEv4.call(this, deleteErrorPayload(_context2.t0.message));
|
|
346
|
+
case 23:
|
|
298
347
|
this.confirmationTransaction = undefined;
|
|
299
|
-
case
|
|
348
|
+
case 24:
|
|
300
349
|
case "end":
|
|
301
350
|
return _context2.stop();
|
|
302
351
|
}
|
|
@@ -325,6 +374,7 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
325
374
|
this.creationCallback = undefined;
|
|
326
375
|
this.dataProvider = undefined;
|
|
327
376
|
this.editorView = undefined;
|
|
377
|
+
this.fireAnalyticsEvent = undefined;
|
|
328
378
|
}
|
|
329
379
|
}]);
|
|
330
380
|
}();
|
|
@@ -9,12 +9,12 @@ import { SourceSyncBlockStoreManager } from './sourceSyncBlockStoreManager';
|
|
|
9
9
|
// SourceSyncBlockStoreManager is responsible for the lifecycle and state management of source sync blocks in an editor instance.
|
|
10
10
|
// Can be used in both editor and renderer contexts.
|
|
11
11
|
export var SyncBlockStoreManager = /*#__PURE__*/function () {
|
|
12
|
-
function SyncBlockStoreManager(dataProvider) {
|
|
12
|
+
function SyncBlockStoreManager(dataProvider, fireAnalyticsEvent) {
|
|
13
13
|
_classCallCheck(this, SyncBlockStoreManager);
|
|
14
14
|
// In future, if reference manager needs to reach to source manager and read it's current in memorey cache
|
|
15
15
|
// we can pass the source manager as a parameter to the reference manager constructor
|
|
16
|
-
this.sourceSyncBlockStoreManager = new SourceSyncBlockStoreManager(dataProvider);
|
|
17
|
-
this.referenceSyncBlockStoreManager = new ReferenceSyncBlockStoreManager(dataProvider);
|
|
16
|
+
this.sourceSyncBlockStoreManager = new SourceSyncBlockStoreManager(dataProvider, fireAnalyticsEvent);
|
|
17
|
+
this.referenceSyncBlockStoreManager = new ReferenceSyncBlockStoreManager(dataProvider, fireAnalyticsEvent);
|
|
18
18
|
}
|
|
19
19
|
return _createClass(SyncBlockStoreManager, [{
|
|
20
20
|
key: "referenceManager",
|
|
@@ -1,7 +1,37 @@
|
|
|
1
|
+
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from "@atlaskit/editor-common/analytics";
|
|
1
2
|
export var stringifyError = function stringifyError(error) {
|
|
2
3
|
try {
|
|
3
4
|
return JSON.stringify(error);
|
|
4
5
|
} catch (_unused) {
|
|
5
6
|
return undefined;
|
|
6
7
|
}
|
|
8
|
+
};
|
|
9
|
+
export var getErrorPayload = function getErrorPayload(actionSubjectId, error) {
|
|
10
|
+
return {
|
|
11
|
+
action: ACTION.ERROR,
|
|
12
|
+
actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
|
|
13
|
+
actionSubjectId: actionSubjectId,
|
|
14
|
+
eventType: EVENT_TYPE.OPERATIONAL,
|
|
15
|
+
attributes: {
|
|
16
|
+
error: error
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export var fetchErrorPayload = function fetchErrorPayload(error) {
|
|
21
|
+
return getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_FETCH, error);
|
|
22
|
+
};
|
|
23
|
+
export var getSourceInfoErrorPayload = function getSourceInfoErrorPayload(error) {
|
|
24
|
+
return getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_GET_SOURCE_INFO, error);
|
|
25
|
+
};
|
|
26
|
+
export var updateErrorPayload = function updateErrorPayload(error) {
|
|
27
|
+
return getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_UPDATE, error);
|
|
28
|
+
};
|
|
29
|
+
export var createErrorPayload = function createErrorPayload(error) {
|
|
30
|
+
return getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE, error);
|
|
31
|
+
};
|
|
32
|
+
export var deleteErrorPayload = function deleteErrorPayload(error) {
|
|
33
|
+
return getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_DELETE, error);
|
|
34
|
+
};
|
|
35
|
+
export var updateCacheErrorPayload = function updateCacheErrorPayload(error) {
|
|
36
|
+
return getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_UPDATE_CACHE, error);
|
|
7
37
|
};
|
|
@@ -3,10 +3,8 @@ export type BlockContentResponse = {
|
|
|
3
3
|
blockAri: string;
|
|
4
4
|
blockInstanceId: string;
|
|
5
5
|
content: string;
|
|
6
|
-
contentUpdatedAt: number;
|
|
7
6
|
createdAt: number;
|
|
8
7
|
createdBy: string;
|
|
9
|
-
isSynced: boolean;
|
|
10
8
|
product: SyncBlockProduct;
|
|
11
9
|
sourceAri: string;
|
|
12
10
|
status: 'active' | 'deleted';
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import { type RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import type { SyncBlockSourceInfo } from '../../providers/types';
|
|
2
|
-
export declare const fetchConfluencePageInfo: (pageAri: string, localId?: string) => Promise<SyncBlockSourceInfo | undefined>;
|
|
3
|
+
export declare const fetchConfluencePageInfo: (pageAri: string, localId?: string, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void) => Promise<SyncBlockSourceInfo | undefined>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
2
3
|
import type { SyncBlockInstance } from '../providers/types';
|
|
3
4
|
import type { SyncBlockStoreManager } from '../store-manager/syncBlockStoreManager';
|
|
@@ -7,4 +8,4 @@ export interface UseFetchSyncBlockDataResult {
|
|
|
7
8
|
reloadData: () => Promise<void>;
|
|
8
9
|
syncBlockInstance: SyncBlockInstance | null;
|
|
9
10
|
}
|
|
10
|
-
export declare const useFetchSyncBlockData: (manager: SyncBlockStoreManager, resourceId?: string, localId?: string) => UseFetchSyncBlockDataResult;
|
|
11
|
+
export declare const useFetchSyncBlockData: (manager: SyncBlockStoreManager, resourceId?: string, localId?: string, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void) => UseFetchSyncBlockDataResult;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type SyncBlockData } from '../../common/types';
|
|
1
|
+
import { type SyncBlockData, type SyncBlockProduct } from '../../common/types';
|
|
2
2
|
import type { ADFFetchProvider, ADFWriteProvider, DeleteSyncBlockResult, SyncBlockInstance, WriteSyncBlockResult } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* ADFFetchProvider implementation that fetches synced block data from Block Service API
|
|
@@ -10,11 +10,14 @@ declare class BlockServiceADFFetchProvider implements ADFFetchProvider {
|
|
|
10
10
|
* ADFWriteProvider implementation that writes synced block data to Block Service API
|
|
11
11
|
*/
|
|
12
12
|
declare class BlockServiceADFWriteProvider implements ADFWriteProvider {
|
|
13
|
+
private sourceAri;
|
|
14
|
+
private product;
|
|
15
|
+
constructor(sourceAri: string, product: SyncBlockProduct);
|
|
13
16
|
writeData(data: SyncBlockData): Promise<WriteSyncBlockResult>;
|
|
14
17
|
deleteData(resourceId: string): Promise<DeleteSyncBlockResult>;
|
|
15
|
-
generateResourceId(
|
|
18
|
+
generateResourceId(sourceAri: string, localId: string): string;
|
|
16
19
|
}
|
|
17
|
-
export declare const useMemoizedBlockServiceAPIProviders: () => {
|
|
20
|
+
export declare const useMemoizedBlockServiceAPIProviders: (sourceAri: string, product: SyncBlockProduct) => {
|
|
18
21
|
fetchProvider: BlockServiceADFFetchProvider;
|
|
19
22
|
writeProvider: BlockServiceADFWriteProvider;
|
|
20
23
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import type { JSONNode } from '@atlaskit/editor-json-transformer/types';
|
|
2
3
|
import { type BlockInstanceId, type ResourceId, type SyncBlockData, type SyncBlockNode, type SyncBlockProduct } from '../common/types';
|
|
3
4
|
import { SyncBlockDataProvider, type ADFFetchProvider, type ADFWriteProvider, type DeleteSyncBlockResult, type SyncBlockInstance, type SyncBlockParentInfo, type SyncBlockSourceInfo, type SyncedBlockRendererProviderOptions, type WriteSyncBlockResult } from '../providers/types';
|
|
@@ -73,7 +74,7 @@ export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
|
73
74
|
*
|
|
74
75
|
* @returns The source info
|
|
75
76
|
*/
|
|
76
|
-
fetchSyncBlockSourceInfo(localId: BlockInstanceId, sourceAri: string, sourceProduct: SyncBlockProduct): Promise<SyncBlockSourceInfo | undefined>;
|
|
77
|
+
fetchSyncBlockSourceInfo(localId: BlockInstanceId, sourceAri: string, sourceProduct: SyncBlockProduct, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void): Promise<SyncBlockSourceInfo | undefined>;
|
|
77
78
|
generateResourceId(sourceId: string, localId: BlockInstanceId): string;
|
|
78
79
|
/**
|
|
79
80
|
* Get the synced block renderer provider options
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import type { MediaProvider, ProfilecardProvider } from '@atlaskit/editor-common/provider-factory';
|
|
2
3
|
import type { EmojiProvider } from '@atlaskit/emoji';
|
|
3
4
|
import type { MentionProvider } from '@atlaskit/mention/types';
|
|
@@ -64,7 +65,7 @@ export declare abstract class SyncBlockDataProvider extends NodeDataProvider<Syn
|
|
|
64
65
|
abstract writeNodesData(nodes: SyncBlockNode[], data: SyncBlockData[]): Promise<Array<WriteSyncBlockResult>>;
|
|
65
66
|
abstract deleteNodesData(resourceIds: string[]): Promise<Array<DeleteSyncBlockResult>>;
|
|
66
67
|
abstract getSourceId(): ResourceId;
|
|
67
|
-
abstract fetchSyncBlockSourceInfo(localId: BlockInstanceId, sourceAri: string, sourceProduct: SyncBlockProduct): Promise<SyncBlockSourceInfo | undefined>;
|
|
68
|
+
abstract fetchSyncBlockSourceInfo(localId: BlockInstanceId, sourceAri: string, sourceProduct: SyncBlockProduct, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void): Promise<SyncBlockSourceInfo | undefined>;
|
|
68
69
|
abstract getSyncedBlockRendererProviderOptions(): SyncedBlockRendererProviderOptions;
|
|
69
70
|
abstract retrieveSyncBlockParentInfo(sourceAri: string, sourceProduct: SyncBlockProduct): SyncBlockParentInfo | undefined;
|
|
70
71
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
2
3
|
import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
4
|
import { type ResourceId, type SyncBlockNode } from '../common/types';
|
|
@@ -8,9 +9,11 @@ export declare class ReferenceSyncBlockStoreManager {
|
|
|
8
9
|
private subscriptions;
|
|
9
10
|
private titleSubscriptions;
|
|
10
11
|
private providerFactories;
|
|
12
|
+
private fireAnalyticsEvent?;
|
|
11
13
|
private syncBlockURLRequests;
|
|
12
14
|
private isRefreshingSubscriptions;
|
|
13
|
-
constructor(dataProvider?: SyncBlockDataProvider);
|
|
15
|
+
constructor(dataProvider?: SyncBlockDataProvider, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void);
|
|
16
|
+
updateFireAnalyticsEvent(fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void): void;
|
|
14
17
|
/**
|
|
15
18
|
* Refreshes the subscriptions for all sync blocks.
|
|
16
19
|
* @returns {Promise<void>}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type SyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
3
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
@@ -8,12 +9,13 @@ export type CreationCallback = () => void;
|
|
|
8
9
|
export declare class SourceSyncBlockStoreManager {
|
|
9
10
|
private dataProvider?;
|
|
10
11
|
private editorView?;
|
|
12
|
+
private fireAnalyticsEvent?;
|
|
11
13
|
private syncBlockCache;
|
|
12
14
|
private confirmationCallback?;
|
|
13
15
|
private confirmationTransaction?;
|
|
14
16
|
private pendingResourceId?;
|
|
15
17
|
private creationCallback?;
|
|
16
|
-
constructor(dataProvider?: SyncBlockDataProvider);
|
|
18
|
+
constructor(dataProvider?: SyncBlockDataProvider, fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void);
|
|
17
19
|
isSourceBlock(node: PMNode): boolean;
|
|
18
20
|
/**
|
|
19
21
|
* Add/update a sync block node to/from the local cache
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { SyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import type { SyncBlockDataProvider } from '../providers/types';
|
|
2
3
|
import { ReferenceSyncBlockStoreManager } from './referenceSyncBlockStoreManager';
|
|
3
4
|
import { SourceSyncBlockStoreManager } from './sourceSyncBlockStoreManager';
|
|
4
5
|
export declare class SyncBlockStoreManager {
|
|
5
6
|
private referenceSyncBlockStoreManager;
|
|
6
7
|
private sourceSyncBlockStoreManager;
|
|
7
|
-
constructor(dataProvider?: SyncBlockDataProvider);
|
|
8
|
+
constructor(dataProvider?: SyncBlockDataProvider, fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void);
|
|
8
9
|
get referenceManager(): ReferenceSyncBlockStoreManager;
|
|
9
10
|
get sourceManager(): SourceSyncBlockStoreManager;
|
|
10
11
|
destroy(): void;
|
|
@@ -1 +1,11 @@
|
|
|
1
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, type RendererSyncBlockEventPayload, type OperationalAEP, type SyncBlockEventPayload } from "@atlaskit/editor-common/analytics";
|
|
1
2
|
export declare const stringifyError: (error: unknown) => string | undefined;
|
|
3
|
+
export declare const getErrorPayload: <T extends ACTION_SUBJECT_ID>(actionSubjectId: T, error: string) => OperationalAEP<ACTION.ERROR, ACTION_SUBJECT.SYNCED_BLOCK, T, {
|
|
4
|
+
error: string;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const fetchErrorPayload: (error: string) => RendererSyncBlockEventPayload;
|
|
7
|
+
export declare const getSourceInfoErrorPayload: (error: string) => RendererSyncBlockEventPayload;
|
|
8
|
+
export declare const updateErrorPayload: (error: string) => SyncBlockEventPayload;
|
|
9
|
+
export declare const createErrorPayload: (error: string) => SyncBlockEventPayload;
|
|
10
|
+
export declare const deleteErrorPayload: (error: string) => SyncBlockEventPayload;
|
|
11
|
+
export declare const updateCacheErrorPayload: (error: string) => SyncBlockEventPayload;
|
|
@@ -3,10 +3,8 @@ export type BlockContentResponse = {
|
|
|
3
3
|
blockAri: string;
|
|
4
4
|
blockInstanceId: string;
|
|
5
5
|
content: string;
|
|
6
|
-
contentUpdatedAt: number;
|
|
7
6
|
createdAt: number;
|
|
8
7
|
createdBy: string;
|
|
9
|
-
isSynced: boolean;
|
|
10
8
|
product: SyncBlockProduct;
|
|
11
9
|
sourceAri: string;
|
|
12
10
|
status: 'active' | 'deleted';
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import { type RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import type { SyncBlockSourceInfo } from '../../providers/types';
|
|
2
|
-
export declare const fetchConfluencePageInfo: (pageAri: string, localId?: string) => Promise<SyncBlockSourceInfo | undefined>;
|
|
3
|
+
export declare const fetchConfluencePageInfo: (pageAri: string, localId?: string, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void) => Promise<SyncBlockSourceInfo | undefined>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
2
3
|
import type { SyncBlockInstance } from '../providers/types';
|
|
3
4
|
import type { SyncBlockStoreManager } from '../store-manager/syncBlockStoreManager';
|
|
@@ -7,4 +8,4 @@ export interface UseFetchSyncBlockDataResult {
|
|
|
7
8
|
reloadData: () => Promise<void>;
|
|
8
9
|
syncBlockInstance: SyncBlockInstance | null;
|
|
9
10
|
}
|
|
10
|
-
export declare const useFetchSyncBlockData: (manager: SyncBlockStoreManager, resourceId?: string, localId?: string) => UseFetchSyncBlockDataResult;
|
|
11
|
+
export declare const useFetchSyncBlockData: (manager: SyncBlockStoreManager, resourceId?: string, localId?: string, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void) => UseFetchSyncBlockDataResult;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type SyncBlockData } from '../../common/types';
|
|
1
|
+
import { type SyncBlockData, type SyncBlockProduct } from '../../common/types';
|
|
2
2
|
import type { ADFFetchProvider, ADFWriteProvider, DeleteSyncBlockResult, SyncBlockInstance, WriteSyncBlockResult } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* ADFFetchProvider implementation that fetches synced block data from Block Service API
|
|
@@ -10,11 +10,14 @@ declare class BlockServiceADFFetchProvider implements ADFFetchProvider {
|
|
|
10
10
|
* ADFWriteProvider implementation that writes synced block data to Block Service API
|
|
11
11
|
*/
|
|
12
12
|
declare class BlockServiceADFWriteProvider implements ADFWriteProvider {
|
|
13
|
+
private sourceAri;
|
|
14
|
+
private product;
|
|
15
|
+
constructor(sourceAri: string, product: SyncBlockProduct);
|
|
13
16
|
writeData(data: SyncBlockData): Promise<WriteSyncBlockResult>;
|
|
14
17
|
deleteData(resourceId: string): Promise<DeleteSyncBlockResult>;
|
|
15
|
-
generateResourceId(
|
|
18
|
+
generateResourceId(sourceAri: string, localId: string): string;
|
|
16
19
|
}
|
|
17
|
-
export declare const useMemoizedBlockServiceAPIProviders: () => {
|
|
20
|
+
export declare const useMemoizedBlockServiceAPIProviders: (sourceAri: string, product: SyncBlockProduct) => {
|
|
18
21
|
fetchProvider: BlockServiceADFFetchProvider;
|
|
19
22
|
writeProvider: BlockServiceADFWriteProvider;
|
|
20
23
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import type { JSONNode } from '@atlaskit/editor-json-transformer/types';
|
|
2
3
|
import { type BlockInstanceId, type ResourceId, type SyncBlockData, type SyncBlockNode, type SyncBlockProduct } from '../common/types';
|
|
3
4
|
import { SyncBlockDataProvider, type ADFFetchProvider, type ADFWriteProvider, type DeleteSyncBlockResult, type SyncBlockInstance, type SyncBlockParentInfo, type SyncBlockSourceInfo, type SyncedBlockRendererProviderOptions, type WriteSyncBlockResult } from '../providers/types';
|
|
@@ -73,7 +74,7 @@ export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
|
73
74
|
*
|
|
74
75
|
* @returns The source info
|
|
75
76
|
*/
|
|
76
|
-
fetchSyncBlockSourceInfo(localId: BlockInstanceId, sourceAri: string, sourceProduct: SyncBlockProduct): Promise<SyncBlockSourceInfo | undefined>;
|
|
77
|
+
fetchSyncBlockSourceInfo(localId: BlockInstanceId, sourceAri: string, sourceProduct: SyncBlockProduct, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void): Promise<SyncBlockSourceInfo | undefined>;
|
|
77
78
|
generateResourceId(sourceId: string, localId: BlockInstanceId): string;
|
|
78
79
|
/**
|
|
79
80
|
* Get the synced block renderer provider options
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import type { MediaProvider, ProfilecardProvider } from '@atlaskit/editor-common/provider-factory';
|
|
2
3
|
import type { EmojiProvider } from '@atlaskit/emoji';
|
|
3
4
|
import type { MentionProvider } from '@atlaskit/mention/types';
|
|
@@ -64,7 +65,7 @@ export declare abstract class SyncBlockDataProvider extends NodeDataProvider<Syn
|
|
|
64
65
|
abstract writeNodesData(nodes: SyncBlockNode[], data: SyncBlockData[]): Promise<Array<WriteSyncBlockResult>>;
|
|
65
66
|
abstract deleteNodesData(resourceIds: string[]): Promise<Array<DeleteSyncBlockResult>>;
|
|
66
67
|
abstract getSourceId(): ResourceId;
|
|
67
|
-
abstract fetchSyncBlockSourceInfo(localId: BlockInstanceId, sourceAri: string, sourceProduct: SyncBlockProduct): Promise<SyncBlockSourceInfo | undefined>;
|
|
68
|
+
abstract fetchSyncBlockSourceInfo(localId: BlockInstanceId, sourceAri: string, sourceProduct: SyncBlockProduct, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void): Promise<SyncBlockSourceInfo | undefined>;
|
|
68
69
|
abstract getSyncedBlockRendererProviderOptions(): SyncedBlockRendererProviderOptions;
|
|
69
70
|
abstract retrieveSyncBlockParentInfo(sourceAri: string, sourceProduct: SyncBlockProduct): SyncBlockParentInfo | undefined;
|
|
70
71
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
2
3
|
import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
4
|
import { type ResourceId, type SyncBlockNode } from '../common/types';
|
|
@@ -8,9 +9,11 @@ export declare class ReferenceSyncBlockStoreManager {
|
|
|
8
9
|
private subscriptions;
|
|
9
10
|
private titleSubscriptions;
|
|
10
11
|
private providerFactories;
|
|
12
|
+
private fireAnalyticsEvent?;
|
|
11
13
|
private syncBlockURLRequests;
|
|
12
14
|
private isRefreshingSubscriptions;
|
|
13
|
-
constructor(dataProvider?: SyncBlockDataProvider);
|
|
15
|
+
constructor(dataProvider?: SyncBlockDataProvider, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void);
|
|
16
|
+
updateFireAnalyticsEvent(fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void): void;
|
|
14
17
|
/**
|
|
15
18
|
* Refreshes the subscriptions for all sync blocks.
|
|
16
19
|
* @returns {Promise<void>}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type SyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
3
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
@@ -8,12 +9,13 @@ export type CreationCallback = () => void;
|
|
|
8
9
|
export declare class SourceSyncBlockStoreManager {
|
|
9
10
|
private dataProvider?;
|
|
10
11
|
private editorView?;
|
|
12
|
+
private fireAnalyticsEvent?;
|
|
11
13
|
private syncBlockCache;
|
|
12
14
|
private confirmationCallback?;
|
|
13
15
|
private confirmationTransaction?;
|
|
14
16
|
private pendingResourceId?;
|
|
15
17
|
private creationCallback?;
|
|
16
|
-
constructor(dataProvider?: SyncBlockDataProvider);
|
|
18
|
+
constructor(dataProvider?: SyncBlockDataProvider, fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void);
|
|
17
19
|
isSourceBlock(node: PMNode): boolean;
|
|
18
20
|
/**
|
|
19
21
|
* Add/update a sync block node to/from the local cache
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { SyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import type { SyncBlockDataProvider } from '../providers/types';
|
|
2
3
|
import { ReferenceSyncBlockStoreManager } from './referenceSyncBlockStoreManager';
|
|
3
4
|
import { SourceSyncBlockStoreManager } from './sourceSyncBlockStoreManager';
|
|
4
5
|
export declare class SyncBlockStoreManager {
|
|
5
6
|
private referenceSyncBlockStoreManager;
|
|
6
7
|
private sourceSyncBlockStoreManager;
|
|
7
|
-
constructor(dataProvider?: SyncBlockDataProvider);
|
|
8
|
+
constructor(dataProvider?: SyncBlockDataProvider, fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void);
|
|
8
9
|
get referenceManager(): ReferenceSyncBlockStoreManager;
|
|
9
10
|
get sourceManager(): SourceSyncBlockStoreManager;
|
|
10
11
|
destroy(): void;
|
|
@@ -1 +1,11 @@
|
|
|
1
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, type RendererSyncBlockEventPayload, type OperationalAEP, type SyncBlockEventPayload } from "@atlaskit/editor-common/analytics";
|
|
1
2
|
export declare const stringifyError: (error: unknown) => string | undefined;
|
|
3
|
+
export declare const getErrorPayload: <T extends ACTION_SUBJECT_ID>(actionSubjectId: T, error: string) => OperationalAEP<ACTION.ERROR, ACTION_SUBJECT.SYNCED_BLOCK, T, {
|
|
4
|
+
error: string;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const fetchErrorPayload: (error: string) => RendererSyncBlockEventPayload;
|
|
7
|
+
export declare const getSourceInfoErrorPayload: (error: string) => RendererSyncBlockEventPayload;
|
|
8
|
+
export declare const updateErrorPayload: (error: string) => SyncBlockEventPayload;
|
|
9
|
+
export declare const createErrorPayload: (error: string) => SyncBlockEventPayload;
|
|
10
|
+
export declare const deleteErrorPayload: (error: string) => SyncBlockEventPayload;
|
|
11
|
+
export declare const updateCacheErrorPayload: (error: string) => SyncBlockEventPayload;
|