@atlaskit/editor-synced-block-provider 2.10.6 → 2.11.1
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 +20 -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 +112 -55
- 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 +73 -25
- 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 +110 -53
- 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
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
2
3
|
import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
3
4
|
import { SyncBlockError } from '../common/types';
|
|
5
|
+
import { fetchErrorPayload, getSourceInfoErrorPayload } from '../utils/errorHandling';
|
|
4
6
|
import { resolveSyncBlockInstance } from '../utils/resolveSyncBlockInstance';
|
|
5
7
|
import { createSyncBlockNode } from '../utils/utils';
|
|
6
8
|
|
|
@@ -10,7 +12,7 @@ import { createSyncBlockNode } from '../utils/utils';
|
|
|
10
12
|
// Handles fetching source URL and title for sync blocks.
|
|
11
13
|
// Can be used in both editor and renderer contexts.
|
|
12
14
|
export class ReferenceSyncBlockStoreManager {
|
|
13
|
-
constructor(dataProvider) {
|
|
15
|
+
constructor(dataProvider, fireAnalyticsEvent) {
|
|
14
16
|
_defineProperty(this, "isRefreshingSubscriptions", false);
|
|
15
17
|
this.syncBlockCache = new Map();
|
|
16
18
|
this.subscriptions = new Map();
|
|
@@ -18,6 +20,10 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
18
20
|
this.dataProvider = dataProvider;
|
|
19
21
|
this.syncBlockURLRequests = new Map();
|
|
20
22
|
this.providerFactories = new Map();
|
|
23
|
+
this.fireAnalyticsEvent = fireAnalyticsEvent;
|
|
24
|
+
}
|
|
25
|
+
updateFireAnalyticsEvent(fireAnalyticsEvent) {
|
|
26
|
+
this.fireAnalyticsEvent = fireAnalyticsEvent;
|
|
21
27
|
}
|
|
22
28
|
|
|
23
29
|
/**
|
|
@@ -40,48 +46,63 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
40
46
|
// this function will update the cache and call the subscriptions
|
|
41
47
|
await this.fetchSyncBlocksData(syncBlocks);
|
|
42
48
|
} catch (error) {
|
|
43
|
-
|
|
49
|
+
var _this$fireAnalyticsEv;
|
|
50
|
+
logException(error, {
|
|
51
|
+
location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
|
|
52
|
+
});
|
|
53
|
+
(_this$fireAnalyticsEv = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv === void 0 ? void 0 : _this$fireAnalyticsEv.call(this, fetchErrorPayload(error.message));
|
|
44
54
|
} finally {
|
|
45
55
|
this.isRefreshingSubscriptions = false;
|
|
46
56
|
}
|
|
47
57
|
}
|
|
48
58
|
fetchSyncBlockSourceInfo(resourceId) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
try {
|
|
60
|
+
var _existingSyncBlock$da, _existingSyncBlock$da2;
|
|
61
|
+
if (!resourceId || !this.dataProvider) {
|
|
62
|
+
throw new Error('Data provider or resourceId not set');
|
|
63
|
+
}
|
|
64
|
+
if (this.syncBlockURLRequests.get(resourceId)) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
this.syncBlockURLRequests.set(resourceId, true);
|
|
68
|
+
const existingSyncBlock = this.getFromCache(resourceId);
|
|
69
|
+
if (!existingSyncBlock) {
|
|
70
|
+
throw new Error('No existing sync block to fetch source info for');
|
|
71
|
+
}
|
|
61
72
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const {
|
|
67
|
-
sourceAri,
|
|
68
|
-
product,
|
|
69
|
-
blockInstanceId
|
|
70
|
-
} = existingSyncBlock.data || {};
|
|
71
|
-
if (!sourceAri || !product || !blockInstanceId) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
this.dataProvider.fetchSyncBlockSourceInfo(blockInstanceId, sourceAri, product).then(sourceInfo => {
|
|
75
|
-
if (!sourceInfo) {
|
|
73
|
+
// skip if source URL and title are already present
|
|
74
|
+
if ((_existingSyncBlock$da = existingSyncBlock.data) !== null && _existingSyncBlock$da !== void 0 && _existingSyncBlock$da.sourceURL && (_existingSyncBlock$da2 = existingSyncBlock.data) !== null && _existingSyncBlock$da2 !== void 0 && _existingSyncBlock$da2.sourceTitle) {
|
|
76
75
|
return;
|
|
77
76
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
const {
|
|
78
|
+
sourceAri,
|
|
79
|
+
product,
|
|
80
|
+
blockInstanceId
|
|
81
|
+
} = existingSyncBlock.data || {};
|
|
82
|
+
if (!sourceAri || !product || !blockInstanceId) {
|
|
83
|
+
throw new Error('SourceAri, product or blockInstanceId missing');
|
|
81
84
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
+
this.dataProvider.fetchSyncBlockSourceInfo(blockInstanceId, sourceAri, product, this.fireAnalyticsEvent).then(sourceInfo => {
|
|
86
|
+
if (!sourceInfo) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
this.updateCacheWithSourceInfo(resourceId, sourceInfo);
|
|
90
|
+
if (sourceInfo.title) {
|
|
91
|
+
this.updateSourceTitleSubscriptions(resourceId, sourceInfo.title);
|
|
92
|
+
}
|
|
93
|
+
}).catch(error => {
|
|
94
|
+
var _this$fireAnalyticsEv2;
|
|
95
|
+
(_this$fireAnalyticsEv2 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv2 === void 0 ? void 0 : _this$fireAnalyticsEv2.call(this, getSourceInfoErrorPayload(error.message));
|
|
96
|
+
}).finally(() => {
|
|
97
|
+
this.syncBlockURLRequests.delete(resourceId);
|
|
98
|
+
});
|
|
99
|
+
} catch (error) {
|
|
100
|
+
var _this$fireAnalyticsEv3;
|
|
101
|
+
logException(error, {
|
|
102
|
+
location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
|
|
103
|
+
});
|
|
104
|
+
(_this$fireAnalyticsEv3 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv3 === void 0 ? void 0 : _this$fireAnalyticsEv3.call(this, getSourceInfoErrorPayload(error.message));
|
|
105
|
+
}
|
|
85
106
|
}
|
|
86
107
|
|
|
87
108
|
/**
|
|
@@ -109,15 +130,16 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
109
130
|
}
|
|
110
131
|
});
|
|
111
132
|
const data = await this.dataProvider.fetchNodesData(nodesToFetch);
|
|
112
|
-
if (!data) {
|
|
113
|
-
throw new Error('Failed to fetch sync block node data');
|
|
114
|
-
}
|
|
115
133
|
const resolvedData = [];
|
|
116
134
|
data.forEach(syncBlockInstance => {
|
|
117
135
|
if (!syncBlockInstance.resourceId) {
|
|
136
|
+
var _this$fireAnalyticsEv4;
|
|
137
|
+
(_this$fireAnalyticsEv4 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv4 === void 0 ? void 0 : _this$fireAnalyticsEv4.call(this, fetchErrorPayload(syncBlockInstance.error || 'Returned sync block instance does not have resource id'));
|
|
118
138
|
return;
|
|
119
139
|
}
|
|
120
140
|
if (syncBlockInstance.error) {
|
|
141
|
+
var _this$fireAnalyticsEv5;
|
|
142
|
+
(_this$fireAnalyticsEv5 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv5 === void 0 ? void 0 : _this$fireAnalyticsEv5.call(this, fetchErrorPayload(syncBlockInstance.error));
|
|
121
143
|
this.updateCache(syncBlockInstance);
|
|
122
144
|
resolvedData.push(syncBlockInstance);
|
|
123
145
|
return;
|
|
@@ -184,7 +206,13 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
184
206
|
if (cachedData) {
|
|
185
207
|
callback(cachedData);
|
|
186
208
|
} else {
|
|
187
|
-
this.fetchSyncBlocksData([createSyncBlockNode(localId, resourceId)]).catch(
|
|
209
|
+
this.fetchSyncBlocksData([createSyncBlockNode(localId, resourceId)]).catch(error => {
|
|
210
|
+
var _this$fireAnalyticsEv6;
|
|
211
|
+
logException(error, {
|
|
212
|
+
location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
|
|
213
|
+
});
|
|
214
|
+
(_this$fireAnalyticsEv6 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv6 === void 0 ? void 0 : _this$fireAnalyticsEv6.call(this, fetchErrorPayload(error.message));
|
|
215
|
+
});
|
|
188
216
|
}
|
|
189
217
|
return () => {
|
|
190
218
|
const resourceSubscriptions = this.subscriptions.get(resourceId);
|
|
@@ -236,18 +264,27 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
236
264
|
};
|
|
237
265
|
}
|
|
238
266
|
subscribe(node, callback) {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
267
|
+
try {
|
|
268
|
+
// check node is a sync block, as we only support sync block subscriptions
|
|
269
|
+
if (node.type.name !== 'syncBlock') {
|
|
270
|
+
throw new Error('Only sync block node subscriptions are supported');
|
|
271
|
+
}
|
|
272
|
+
const {
|
|
273
|
+
resourceId,
|
|
274
|
+
localId
|
|
275
|
+
} = node.attrs;
|
|
276
|
+
if (!localId || !resourceId) {
|
|
277
|
+
throw new Error('Missing local id or resource id');
|
|
278
|
+
}
|
|
279
|
+
return this.subscribeToSyncBlock(resourceId, localId, callback);
|
|
280
|
+
} catch (error) {
|
|
281
|
+
var _this$fireAnalyticsEv7;
|
|
282
|
+
logException(error, {
|
|
283
|
+
location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
|
|
284
|
+
});
|
|
285
|
+
(_this$fireAnalyticsEv7 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv7 === void 0 ? void 0 : _this$fireAnalyticsEv7.call(this, fetchErrorPayload(error.message));
|
|
248
286
|
return () => {};
|
|
249
287
|
}
|
|
250
|
-
return this.subscribeToSyncBlock(resourceId, localId, callback);
|
|
251
288
|
}
|
|
252
289
|
|
|
253
290
|
/**
|
|
@@ -265,6 +302,12 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
265
302
|
}
|
|
266
303
|
getProviderFactory(resourceId) {
|
|
267
304
|
if (!this.dataProvider) {
|
|
305
|
+
var _this$fireAnalyticsEv8;
|
|
306
|
+
const error = new Error('Data provider not set');
|
|
307
|
+
logException(error, {
|
|
308
|
+
location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
|
|
309
|
+
});
|
|
310
|
+
(_this$fireAnalyticsEv8 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv8 === void 0 ? void 0 : _this$fireAnalyticsEv8.call(this, fetchErrorPayload(error.message));
|
|
268
311
|
return undefined;
|
|
269
312
|
}
|
|
270
313
|
const {
|
|
@@ -281,14 +324,22 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
281
324
|
this.providerFactories.set(resourceId, providerFactory);
|
|
282
325
|
}
|
|
283
326
|
if (providerCreator) {
|
|
284
|
-
|
|
327
|
+
try {
|
|
328
|
+
this.retrieveDynamicProviders(resourceId, providerFactory, providerCreator);
|
|
329
|
+
} catch (error) {
|
|
330
|
+
var _this$fireAnalyticsEv9;
|
|
331
|
+
logException(error, {
|
|
332
|
+
location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
|
|
333
|
+
});
|
|
334
|
+
(_this$fireAnalyticsEv9 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv9 === void 0 ? void 0 : _this$fireAnalyticsEv9.call(this, fetchErrorPayload(error.message));
|
|
335
|
+
}
|
|
285
336
|
}
|
|
286
337
|
return providerFactory;
|
|
287
338
|
}
|
|
288
339
|
retrieveDynamicProviders(resourceId, providerFactory, providerCreator) {
|
|
289
340
|
var _syncBlock$data2, _syncBlock$data3, _syncBlock$data4, _syncBlock$data5;
|
|
290
341
|
if (!this.dataProvider) {
|
|
291
|
-
|
|
342
|
+
throw new Error('Data provider not set');
|
|
292
343
|
}
|
|
293
344
|
const hasMediaProvider = providerFactory.hasProvider('mediaProvider');
|
|
294
345
|
const hasEmojiProvider = providerFactory.hasProvider('emojiProvider');
|
|
@@ -297,11 +348,13 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
297
348
|
}
|
|
298
349
|
const syncBlock = this.getFromCache(resourceId);
|
|
299
350
|
if (!syncBlock || !((_syncBlock$data2 = syncBlock.data) !== null && _syncBlock$data2 !== void 0 && _syncBlock$data2.sourceAri) || !((_syncBlock$data3 = syncBlock.data) !== null && _syncBlock$data3 !== void 0 && _syncBlock$data3.product)) {
|
|
351
|
+
var _this$fireAnalyticsEv0;
|
|
352
|
+
(_this$fireAnalyticsEv0 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv0 === void 0 ? void 0 : _this$fireAnalyticsEv0.call(this, fetchErrorPayload('Sync block or source ari or product not found'));
|
|
300
353
|
return;
|
|
301
354
|
}
|
|
302
355
|
const parentInfo = this.dataProvider.retrieveSyncBlockParentInfo((_syncBlock$data4 = syncBlock.data) === null || _syncBlock$data4 === void 0 ? void 0 : _syncBlock$data4.sourceAri, (_syncBlock$data5 = syncBlock.data) === null || _syncBlock$data5 === void 0 ? void 0 : _syncBlock$data5.product);
|
|
303
356
|
if (!parentInfo) {
|
|
304
|
-
|
|
357
|
+
throw new Error('Unable to retrive sync block parent info');
|
|
305
358
|
}
|
|
306
359
|
const {
|
|
307
360
|
contentId,
|
|
@@ -342,5 +395,6 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
342
395
|
providerFactory.destroy();
|
|
343
396
|
});
|
|
344
397
|
this.providerFactories.clear();
|
|
398
|
+
this.fireAnalyticsEvent = undefined;
|
|
345
399
|
}
|
|
346
400
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
3
3
|
import uuid from 'uuid';
|
|
4
|
+
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
5
|
+
import { pmHistoryPluginKey } from '@atlaskit/editor-common/utils';
|
|
4
6
|
import { rebaseTransaction } from '../common/rebase-transaction';
|
|
7
|
+
import { updateErrorPayload, createErrorPayload, deleteErrorPayload, updateCacheErrorPayload } from '../utils/errorHandling';
|
|
5
8
|
import { convertSyncBlockPMNodeToSyncBlockData, createBodiedSyncBlockNode } from '../utils/utils';
|
|
6
9
|
// A store manager responsible for the lifecycle and state management of source sync blocks in an editor instance.
|
|
7
10
|
// Designed to manage local in-memory state and synchronize with an external data provider.
|
|
@@ -9,7 +12,7 @@ import { convertSyncBlockPMNodeToSyncBlockData, createBodiedSyncBlockNode } from
|
|
|
9
12
|
// Handles caching, debouncing updates, and publish/subscribe for local changes.
|
|
10
13
|
// Ensures consistency between local and remote state, and can be used in both editor and renderer contexts.
|
|
11
14
|
export class SourceSyncBlockStoreManager {
|
|
12
|
-
constructor(dataProvider) {
|
|
15
|
+
constructor(dataProvider, fireAnalyticsEvent) {
|
|
13
16
|
_defineProperty(this, "setPendingDeletion", (Ids, value) => {
|
|
14
17
|
const syncBlock = this.syncBlockCache.get(Ids.resourceId);
|
|
15
18
|
if (syncBlock) {
|
|
@@ -18,6 +21,7 @@ export class SourceSyncBlockStoreManager {
|
|
|
18
21
|
});
|
|
19
22
|
this.dataProvider = dataProvider;
|
|
20
23
|
this.syncBlockCache = new Map();
|
|
24
|
+
this.fireAnalyticsEvent = fireAnalyticsEvent;
|
|
21
25
|
}
|
|
22
26
|
isSourceBlock(node) {
|
|
23
27
|
return node.type.name === 'bodiedSyncBlock';
|
|
@@ -28,19 +32,28 @@ export class SourceSyncBlockStoreManager {
|
|
|
28
32
|
* @param syncBlockNode - The sync block node to update
|
|
29
33
|
*/
|
|
30
34
|
updateSyncBlockData(syncBlockNode) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
try {
|
|
36
|
+
if (!this.isSourceBlock(syncBlockNode)) {
|
|
37
|
+
throw new Error('Invalid sync block node type provided for updateSyncBlockData');
|
|
38
|
+
}
|
|
39
|
+
const {
|
|
40
|
+
localId,
|
|
41
|
+
resourceId
|
|
42
|
+
} = syncBlockNode.attrs;
|
|
43
|
+
if (!localId || !resourceId) {
|
|
44
|
+
throw new Error('Local ID or resource ID is not set');
|
|
45
|
+
}
|
|
46
|
+
const syncBlockData = convertSyncBlockPMNodeToSyncBlockData(syncBlockNode);
|
|
47
|
+
this.syncBlockCache.set(resourceId, syncBlockData);
|
|
48
|
+
return true;
|
|
49
|
+
} catch (error) {
|
|
50
|
+
var _this$fireAnalyticsEv;
|
|
51
|
+
logException(error, {
|
|
52
|
+
location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
|
|
53
|
+
});
|
|
54
|
+
(_this$fireAnalyticsEv = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv === void 0 ? void 0 : _this$fireAnalyticsEv.call(this, updateCacheErrorPayload(error.message));
|
|
55
|
+
return false;
|
|
40
56
|
}
|
|
41
|
-
const syncBlockData = convertSyncBlockPMNodeToSyncBlockData(syncBlockNode);
|
|
42
|
-
this.syncBlockCache.set(resourceId, syncBlockData);
|
|
43
|
-
return true;
|
|
44
57
|
}
|
|
45
58
|
|
|
46
59
|
/**
|
|
@@ -72,9 +85,21 @@ export class SourceSyncBlockStoreManager {
|
|
|
72
85
|
return Promise.resolve(true);
|
|
73
86
|
}
|
|
74
87
|
const writeResults = await this.dataProvider.writeNodesData(bodiedSyncBlockNodes, bodiedSyncBlockData);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
88
|
+
if (writeResults.every(result => result.resourceId !== undefined)) {
|
|
89
|
+
return true;
|
|
90
|
+
} else {
|
|
91
|
+
writeResults.filter(result => result.resourceId === undefined).forEach(result => {
|
|
92
|
+
var _this$fireAnalyticsEv2;
|
|
93
|
+
(_this$fireAnalyticsEv2 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv2 === void 0 ? void 0 : _this$fireAnalyticsEv2.call(this, updateErrorPayload(result.error || 'Failed to write data'));
|
|
94
|
+
});
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
} catch (error) {
|
|
98
|
+
var _this$fireAnalyticsEv3;
|
|
99
|
+
logException(error, {
|
|
100
|
+
location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
|
|
101
|
+
});
|
|
102
|
+
(_this$fireAnalyticsEv3 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv3 === void 0 ? void 0 : _this$fireAnalyticsEv3.call(this, updateErrorPayload(error.message));
|
|
78
103
|
return false;
|
|
79
104
|
}
|
|
80
105
|
}
|
|
@@ -130,7 +155,7 @@ export class SourceSyncBlockStoreManager {
|
|
|
130
155
|
const localId = uuid();
|
|
131
156
|
const sourceId = (_this$dataProvider = this.dataProvider) === null || _this$dataProvider === void 0 ? void 0 : _this$dataProvider.getSourceId();
|
|
132
157
|
if (!this.dataProvider || !sourceId) {
|
|
133
|
-
throw new Error('
|
|
158
|
+
throw new Error('Data provider not set or source id not set');
|
|
134
159
|
}
|
|
135
160
|
const resourceId = this.dataProvider.generateResourceId(sourceId, localId);
|
|
136
161
|
return {
|
|
@@ -162,20 +187,29 @@ export class SourceSyncBlockStoreManager {
|
|
|
162
187
|
if (resourceId) {
|
|
163
188
|
this.commitPendingCreation(true);
|
|
164
189
|
} else {
|
|
190
|
+
var _this$fireAnalyticsEv4;
|
|
165
191
|
this.commitPendingCreation(false);
|
|
166
|
-
|
|
192
|
+
(_this$fireAnalyticsEv4 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv4 === void 0 ? void 0 : _this$fireAnalyticsEv4.call(this, createErrorPayload(result.error || 'Failed to create bodied sync block'));
|
|
167
193
|
}
|
|
168
194
|
});
|
|
169
|
-
}).catch(
|
|
195
|
+
}).catch(error => {
|
|
196
|
+
var _this$fireAnalyticsEv5;
|
|
170
197
|
this.commitPendingCreation(false);
|
|
171
|
-
|
|
198
|
+
logException(error, {
|
|
199
|
+
location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
|
|
200
|
+
});
|
|
201
|
+
(_this$fireAnalyticsEv5 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv5 === void 0 ? void 0 : _this$fireAnalyticsEv5.call(this, createErrorPayload(error.message));
|
|
172
202
|
});
|
|
173
203
|
this.registerPendingCreation(resourceId);
|
|
174
204
|
} catch (error) {
|
|
205
|
+
var _this$fireAnalyticsEv6;
|
|
175
206
|
if (this.hasPendingCreation()) {
|
|
176
207
|
this.commitPendingCreation(false);
|
|
177
208
|
}
|
|
178
|
-
|
|
209
|
+
logException(error, {
|
|
210
|
+
location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
|
|
211
|
+
});
|
|
212
|
+
(_this$fireAnalyticsEv6 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv6 === void 0 ? void 0 : _this$fireAnalyticsEv6.call(this, createErrorPayload(error.message));
|
|
179
213
|
}
|
|
180
214
|
}
|
|
181
215
|
async deleteSyncBlocksWithConfirmation(tr, syncBlockIds) {
|
|
@@ -184,7 +218,13 @@ export class SourceSyncBlockStoreManager {
|
|
|
184
218
|
const confirmed = await this.confirmationCallback(syncBlockIds.length);
|
|
185
219
|
if (confirmed) {
|
|
186
220
|
var _this$editorView;
|
|
187
|
-
|
|
221
|
+
const trToDispatch = this.confirmationTransaction.setMeta('isConfirmedSyncBlockDeletion', true);
|
|
222
|
+
if (!trToDispatch.getMeta(pmHistoryPluginKey)) {
|
|
223
|
+
// bodiedSyncBlock deletion is expected to be permanent (cannot be undo)
|
|
224
|
+
// For a normal delete (not triggered by undo), remove it from history so that it cannot be undone
|
|
225
|
+
trToDispatch.setMeta('addToHistory', false);
|
|
226
|
+
}
|
|
227
|
+
(_this$editorView = this.editorView) === null || _this$editorView === void 0 ? void 0 : _this$editorView.dispatch(trToDispatch);
|
|
188
228
|
try {
|
|
189
229
|
if (!this.dataProvider) {
|
|
190
230
|
throw new Error('Data provider not set');
|
|
@@ -200,14 +240,21 @@ export class SourceSyncBlockStoreManager {
|
|
|
200
240
|
callback = Ids => {
|
|
201
241
|
this.setPendingDeletion(Ids, false);
|
|
202
242
|
};
|
|
203
|
-
|
|
243
|
+
results.filter(result => result.resourceId === undefined).forEach(result => {
|
|
244
|
+
var _this$fireAnalyticsEv7;
|
|
245
|
+
(_this$fireAnalyticsEv7 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv7 === void 0 ? void 0 : _this$fireAnalyticsEv7.call(this, deleteErrorPayload(result.error || 'Failed to delete synced block'));
|
|
246
|
+
});
|
|
204
247
|
}
|
|
205
248
|
syncBlockIds.forEach(callback);
|
|
206
|
-
} catch (
|
|
249
|
+
} catch (error) {
|
|
250
|
+
var _this$fireAnalyticsEv8;
|
|
207
251
|
syncBlockIds.forEach(Ids => {
|
|
208
252
|
this.setPendingDeletion(Ids, false);
|
|
209
253
|
});
|
|
210
|
-
|
|
254
|
+
logException(error, {
|
|
255
|
+
location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
|
|
256
|
+
});
|
|
257
|
+
(_this$fireAnalyticsEv8 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv8 === void 0 ? void 0 : _this$fireAnalyticsEv8.call(this, deleteErrorPayload(error.message));
|
|
211
258
|
}
|
|
212
259
|
}
|
|
213
260
|
this.confirmationTransaction = undefined;
|
|
@@ -227,5 +274,6 @@ export class SourceSyncBlockStoreManager {
|
|
|
227
274
|
this.creationCallback = undefined;
|
|
228
275
|
this.dataProvider = undefined;
|
|
229
276
|
this.editorView = undefined;
|
|
277
|
+
this.fireAnalyticsEvent = undefined;
|
|
230
278
|
}
|
|
231
279
|
}
|
|
@@ -7,11 +7,11 @@ import { SourceSyncBlockStoreManager } from './sourceSyncBlockStoreManager';
|
|
|
7
7
|
// SourceSyncBlockStoreManager is responsible for the lifecycle and state management of source sync blocks in an editor instance.
|
|
8
8
|
// Can be used in both editor and renderer contexts.
|
|
9
9
|
export class SyncBlockStoreManager {
|
|
10
|
-
constructor(dataProvider) {
|
|
10
|
+
constructor(dataProvider, fireAnalyticsEvent) {
|
|
11
11
|
// In future, if reference manager needs to reach to source manager and read it's current in memorey cache
|
|
12
12
|
// we can pass the source manager as a parameter to the reference manager constructor
|
|
13
|
-
this.sourceSyncBlockStoreManager = new SourceSyncBlockStoreManager(dataProvider);
|
|
14
|
-
this.referenceSyncBlockStoreManager = new ReferenceSyncBlockStoreManager(dataProvider);
|
|
13
|
+
this.sourceSyncBlockStoreManager = new SourceSyncBlockStoreManager(dataProvider, fireAnalyticsEvent);
|
|
14
|
+
this.referenceSyncBlockStoreManager = new ReferenceSyncBlockStoreManager(dataProvider, fireAnalyticsEvent);
|
|
15
15
|
}
|
|
16
16
|
get referenceManager() {
|
|
17
17
|
return this.referenceSyncBlockStoreManager;
|
|
@@ -1,7 +1,23 @@
|
|
|
1
|
+
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from "@atlaskit/editor-common/analytics";
|
|
1
2
|
export const stringifyError = error => {
|
|
2
3
|
try {
|
|
3
4
|
return JSON.stringify(error);
|
|
4
5
|
} catch {
|
|
5
6
|
return undefined;
|
|
6
7
|
}
|
|
7
|
-
};
|
|
8
|
+
};
|
|
9
|
+
export const getErrorPayload = (actionSubjectId, error) => ({
|
|
10
|
+
action: ACTION.ERROR,
|
|
11
|
+
actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
|
|
12
|
+
actionSubjectId,
|
|
13
|
+
eventType: EVENT_TYPE.OPERATIONAL,
|
|
14
|
+
attributes: {
|
|
15
|
+
error
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
export const fetchErrorPayload = error => getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_FETCH, error);
|
|
19
|
+
export const getSourceInfoErrorPayload = error => getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_GET_SOURCE_INFO, error);
|
|
20
|
+
export const updateErrorPayload = error => getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_UPDATE, error);
|
|
21
|
+
export const createErrorPayload = error => getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE, error);
|
|
22
|
+
export const deleteErrorPayload = error => getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_DELETE, error);
|
|
23
|
+
export const updateCacheErrorPayload = error => getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_UPDATE_CACHE, error);
|
|
@@ -32,7 +32,7 @@ export var getSyncedBlockContent = /*#__PURE__*/function () {
|
|
|
32
32
|
case 0:
|
|
33
33
|
blockAri = _ref.blockAri;
|
|
34
34
|
_context.next = 3;
|
|
35
|
-
return fetch("".concat(BLOCK_SERVICE_API_URL, "/block/").concat(blockAri), {
|
|
35
|
+
return fetch("".concat(BLOCK_SERVICE_API_URL, "/block/").concat(encodeURIComponent(blockAri)), {
|
|
36
36
|
method: 'GET',
|
|
37
37
|
headers: COMMON_HEADERS
|
|
38
38
|
});
|
|
@@ -66,7 +66,7 @@ export var deleteSyncedBlock = /*#__PURE__*/function () {
|
|
|
66
66
|
case 0:
|
|
67
67
|
blockAri = _ref3.blockAri;
|
|
68
68
|
_context2.next = 3;
|
|
69
|
-
return fetch("".concat(BLOCK_SERVICE_API_URL, "/block/").concat(blockAri), {
|
|
69
|
+
return fetch("".concat(BLOCK_SERVICE_API_URL, "/block/").concat(encodeURIComponent(blockAri)), {
|
|
70
70
|
method: 'DELETE',
|
|
71
71
|
headers: COMMON_HEADERS
|
|
72
72
|
});
|
|
@@ -95,7 +95,7 @@ export var updateSyncedBlock = /*#__PURE__*/function () {
|
|
|
95
95
|
case 0:
|
|
96
96
|
blockAri = _ref5.blockAri, content = _ref5.content;
|
|
97
97
|
_context3.next = 3;
|
|
98
|
-
return fetch("".concat(BLOCK_SERVICE_API_URL, "/block/").concat(blockAri), {
|
|
98
|
+
return fetch("".concat(BLOCK_SERVICE_API_URL, "/block/").concat(encodeURIComponent(blockAri)), {
|
|
99
99
|
method: 'PUT',
|
|
100
100
|
headers: COMMON_HEADERS,
|
|
101
101
|
body: JSON.stringify({
|
|
@@ -127,10 +127,11 @@ export var createSyncedBlock = /*#__PURE__*/function () {
|
|
|
127
127
|
case 0:
|
|
128
128
|
blockAri = _ref7.blockAri, blockInstanceId = _ref7.blockInstanceId, sourceAri = _ref7.sourceAri, product = _ref7.product, content = _ref7.content;
|
|
129
129
|
_context4.next = 3;
|
|
130
|
-
return fetch("".concat(BLOCK_SERVICE_API_URL, "/block
|
|
130
|
+
return fetch("".concat(BLOCK_SERVICE_API_URL, "/block"), {
|
|
131
131
|
method: 'POST',
|
|
132
132
|
headers: COMMON_HEADERS,
|
|
133
133
|
body: JSON.stringify({
|
|
134
|
+
blockAri: blockAri,
|
|
134
135
|
blockInstanceId: blockInstanceId,
|
|
135
136
|
sourceAri: sourceAri,
|
|
136
137
|
product: product,
|
|
@@ -5,6 +5,8 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
6
|
/* eslint-disable require-unicode-regexp */
|
|
7
7
|
|
|
8
|
+
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
9
|
+
import { getSourceInfoErrorPayload } from '../../utils/errorHandling';
|
|
8
10
|
import { getPageIdAndTypeFromConfluencePageAri } from './ari';
|
|
9
11
|
import { isBlogPageType } from './utils';
|
|
10
12
|
var COMMON_HEADERS = {
|
|
@@ -64,7 +66,7 @@ var getConfluenceSourceInfo = /*#__PURE__*/function () {
|
|
|
64
66
|
};
|
|
65
67
|
}();
|
|
66
68
|
export var fetchConfluencePageInfo = /*#__PURE__*/function () {
|
|
67
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(pageAri, localId) {
|
|
69
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(pageAri, localId, fireAnalyticsEvent) {
|
|
68
70
|
var _response$data, _contentData$space, _getPageIdAndTypeFrom, pageType, response, contentData, title, url, _ref3, base;
|
|
69
71
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
70
72
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -76,15 +78,9 @@ export var fetchConfluencePageInfo = /*#__PURE__*/function () {
|
|
|
76
78
|
case 4:
|
|
77
79
|
response = _context2.sent;
|
|
78
80
|
contentData = (_response$data = response.data) === null || _response$data === void 0 || (_response$data = _response$data.content) === null || _response$data === void 0 || (_response$data = _response$data.nodes) === null || _response$data === void 0 ? void 0 : _response$data[0];
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
throw new Error("Failed to get content data");
|
|
84
|
-
case 8:
|
|
85
|
-
title = contentData.title;
|
|
86
|
-
_ref3 = contentData.links || {}, base = _ref3.base;
|
|
87
|
-
if (base && (_contentData$space = contentData.space) !== null && _contentData$space !== void 0 && _contentData$space.key && contentData.id) {
|
|
81
|
+
title = contentData === null || contentData === void 0 ? void 0 : contentData.title;
|
|
82
|
+
_ref3 = (contentData === null || contentData === void 0 ? void 0 : contentData.links) || {}, base = _ref3.base;
|
|
83
|
+
if (base && contentData !== null && contentData !== void 0 && (_contentData$space = contentData.space) !== null && _contentData$space !== void 0 && _contentData$space.key && contentData !== null && contentData !== void 0 && contentData.id) {
|
|
88
84
|
if (isBlogPageType(pageType)) {
|
|
89
85
|
url = "".concat(base, "/spaces/").concat(contentData.space.key, "/blog/edit-v2/").concat(contentData.id);
|
|
90
86
|
} else if (contentData.subType === 'live') {
|
|
@@ -94,21 +90,28 @@ export var fetchConfluencePageInfo = /*#__PURE__*/function () {
|
|
|
94
90
|
}
|
|
95
91
|
}
|
|
96
92
|
url = url && localId ? "".concat(url, "#block-").concat(localId) : url;
|
|
93
|
+
if (!title || !url) {
|
|
94
|
+
fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent(getSourceInfoErrorPayload('Failed to get confluence page source info'));
|
|
95
|
+
}
|
|
97
96
|
return _context2.abrupt("return", Promise.resolve({
|
|
98
97
|
title: title,
|
|
99
98
|
url: url
|
|
100
99
|
}));
|
|
101
|
-
case
|
|
102
|
-
_context2.prev =
|
|
100
|
+
case 14:
|
|
101
|
+
_context2.prev = 14;
|
|
103
102
|
_context2.t0 = _context2["catch"](0);
|
|
103
|
+
logException(_context2.t0, {
|
|
104
|
+
location: 'editor-synced-block-provider/sourceInfo'
|
|
105
|
+
});
|
|
106
|
+
fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent(getSourceInfoErrorPayload(_context2.t0.message));
|
|
104
107
|
return _context2.abrupt("return", Promise.resolve(undefined));
|
|
105
|
-
case
|
|
108
|
+
case 19:
|
|
106
109
|
case "end":
|
|
107
110
|
return _context2.stop();
|
|
108
111
|
}
|
|
109
|
-
}, _callee2, null, [[0,
|
|
112
|
+
}, _callee2, null, [[0, 14]]);
|
|
110
113
|
}));
|
|
111
|
-
return function fetchConfluencePageInfo(_x2, _x3) {
|
|
114
|
+
return function fetchConfluencePageInfo(_x2, _x3, _x4) {
|
|
112
115
|
return _ref2.apply(this, arguments);
|
|
113
116
|
};
|
|
114
117
|
}();
|
|
@@ -2,9 +2,11 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
4
|
import { useCallback, useEffect, useState } from 'react';
|
|
5
|
+
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
5
6
|
import { SyncBlockError } from '../common/types';
|
|
7
|
+
import { fetchErrorPayload } from '../utils/errorHandling';
|
|
6
8
|
import { createSyncBlockNode } from '../utils/utils';
|
|
7
|
-
export var useFetchSyncBlockData = function useFetchSyncBlockData(manager, resourceId, localId) {
|
|
9
|
+
export var useFetchSyncBlockData = function useFetchSyncBlockData(manager, resourceId, localId, fireAnalyticsEvent) {
|
|
8
10
|
var _useState = useState(null),
|
|
9
11
|
_useState2 = _slicedToArray(_useState, 2),
|
|
10
12
|
syncBlockInstance = _useState2[0],
|
|
@@ -24,36 +26,43 @@ export var useFetchSyncBlockData = function useFetchSyncBlockData(manager, resou
|
|
|
24
26
|
}
|
|
25
27
|
return _context.abrupt("return");
|
|
26
28
|
case 2:
|
|
29
|
+
_context.prev = 2;
|
|
27
30
|
syncBlockNode = resourceId && localId ? createSyncBlockNode(localId, resourceId) : null;
|
|
28
31
|
if (syncBlockNode) {
|
|
29
|
-
_context.next =
|
|
32
|
+
_context.next = 6;
|
|
30
33
|
break;
|
|
31
34
|
}
|
|
32
|
-
|
|
33
|
-
case
|
|
35
|
+
throw new Error('Failed to create sync block node from resourceid and localid');
|
|
36
|
+
case 6:
|
|
34
37
|
setIsLoading(true);
|
|
35
|
-
|
|
38
|
+
|
|
39
|
+
// Fetch sync block data, the `subscribeToSyncBlock` will update the state once data is fetched
|
|
36
40
|
_context.next = 9;
|
|
37
41
|
return manager.referenceManager.fetchSyncBlocksData([syncBlockNode]);
|
|
38
42
|
case 9:
|
|
39
|
-
_context.next =
|
|
43
|
+
_context.next = 16;
|
|
40
44
|
break;
|
|
41
45
|
case 11:
|
|
42
46
|
_context.prev = 11;
|
|
43
|
-
_context.t0 = _context["catch"](
|
|
47
|
+
_context.t0 = _context["catch"](2);
|
|
48
|
+
logException(_context.t0, {
|
|
49
|
+
location: 'editor-synced-block-provider/useFetchSyncBlockData'
|
|
50
|
+
});
|
|
51
|
+
fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent(fetchErrorPayload(_context.t0.message));
|
|
52
|
+
|
|
44
53
|
// Set error state if fetching fails
|
|
45
54
|
setSyncBlockInstance({
|
|
46
55
|
resourceId: resourceId || '',
|
|
47
56
|
error: SyncBlockError.Errored
|
|
48
57
|
});
|
|
49
|
-
case
|
|
58
|
+
case 16:
|
|
50
59
|
setIsLoading(false);
|
|
51
|
-
case
|
|
60
|
+
case 17:
|
|
52
61
|
case "end":
|
|
53
62
|
return _context.stop();
|
|
54
63
|
}
|
|
55
|
-
}, _callee, null, [[
|
|
56
|
-
})), [isLoading, localId, manager.referenceManager, resourceId]);
|
|
64
|
+
}, _callee, null, [[2, 11]]);
|
|
65
|
+
})), [isLoading, localId, manager.referenceManager, resourceId, fireAnalyticsEvent]);
|
|
57
66
|
useEffect(function () {
|
|
58
67
|
var unsubscribe = manager.referenceManager.subscribeToSyncBlock(resourceId || '', localId || '', function (data) {
|
|
59
68
|
setSyncBlockInstance(data);
|