@atlaskit/editor-synced-block-provider 3.14.3 → 3.14.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/editor-synced-block-provider
2
2
 
3
+ ## 3.14.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`f11ff647ea458`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f11ff647ea458) -
8
+ [ux] [EDITOR-4521] Implement source deleted reference UI, update block deleted/unsynced reference
9
+ UI to add delete button, unsynced label and source title/url
10
+ - Updated dependencies
11
+
12
+ ## 3.14.4
13
+
14
+ ### Patch Changes
15
+
16
+ - [`5ec143ea91476`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5ec143ea91476) -
17
+ Do not re-convert already converted timestamps
18
+ - [`aa5302b457078`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/aa5302b457078) -
19
+ [ux] EDITOR-4763 Ensure initial source sync block data are always registered
20
+ - Updated dependencies
21
+
3
22
  ## 3.14.3
4
23
 
5
24
  ### Patch Changes
@@ -102,9 +102,7 @@ var convertToSyncBlockData = exports.convertToSyncBlockData = function convertTo
102
102
  var createdAt;
103
103
  if (data.createdAt !== undefined && data.createdAt !== null) {
104
104
  try {
105
- // BE returns microseconds, convert to milliseconds
106
- // BE should fix this in the future
107
- createdAt = new Date(data.createdAt / 1000).toISOString();
105
+ createdAt = new Date(data.createdAt).toISOString();
108
106
  } catch (_unused) {
109
107
  // fallback to undefined
110
108
  // as we don't want to block the whole process due to invalid date
@@ -211,7 +209,7 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
211
209
  key: "fetchData",
212
210
  value: function () {
213
211
  var _fetchData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(resourceId) {
214
- var blockAri, blockContentResponse, value, syncedBlockData;
212
+ var blockAri, blockContentResponse, content, sourceAri, deletionReason, blockInstanceId, contentUpdatedAt, product, status, syncedBlockData;
215
213
  return _regenerator.default.wrap(function _callee2$(_context2) {
216
214
  while (1) switch (_context2.prev = _context2.next) {
217
215
  case 0:
@@ -227,32 +225,33 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
227
225
  });
228
226
  case 4:
229
227
  blockContentResponse = _context2.sent;
230
- value = blockContentResponse.content;
231
- if (value) {
228
+ content = blockContentResponse.content, sourceAri = blockContentResponse.sourceAri, deletionReason = blockContentResponse.deletionReason, blockInstanceId = blockContentResponse.blockInstanceId, contentUpdatedAt = blockContentResponse.contentUpdatedAt, product = blockContentResponse.product, status = blockContentResponse.status;
229
+ if (content) {
232
230
  _context2.next = 8;
233
231
  break;
234
232
  }
235
233
  return _context2.abrupt("return", {
236
234
  error: {
237
235
  type: _types.SyncBlockError.NotFound,
238
- reason: blockContentResponse.deletionReason
236
+ reason: deletionReason,
237
+ sourceAri: sourceAri
239
238
  },
240
239
  resourceId: resourceId
241
240
  });
242
241
  case 8:
243
242
  // Parse the synced block content from the response's content
244
- syncedBlockData = JSON.parse(value);
243
+ syncedBlockData = JSON.parse(content);
245
244
  return _context2.abrupt("return", {
246
245
  data: {
247
246
  content: syncedBlockData,
248
247
  resourceId: blockAri,
249
- blockInstanceId: blockContentResponse.blockInstanceId,
248
+ blockInstanceId: blockInstanceId,
250
249
  // this was the node's localId, but has become the resourceId.
251
- contentUpdatedAt: (0, _utils.convertContentUpdatedAt)(blockContentResponse.contentUpdatedAt),
252
- sourceAri: blockContentResponse.sourceAri,
253
- product: blockContentResponse.product,
254
- status: blockContentResponse.status,
255
- deletionReason: blockContentResponse.deletionReason
250
+ contentUpdatedAt: (0, _utils.convertContentUpdatedAt)(contentUpdatedAt),
251
+ sourceAri: sourceAri,
252
+ product: product,
253
+ status: status,
254
+ deletionReason: deletionReason
256
255
  },
257
256
  resourceId: resourceId
258
257
  });
@@ -373,7 +372,7 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
373
372
  value: (function () {
374
373
  var _batchFetchData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(blockNodeIdentifiers) {
375
374
  var _this2 = this;
376
- var blockIdentifiers, validResourceIds, processedResourceIds, response, results, _iterator, _step, blockContentResponse, resourceId, value, syncedBlockData, _iterator2, _step2, errorResponse, _resourceId, _iterator3, _step3, blockNodeIdentifier;
375
+ var blockIdentifiers, validResourceIds, processedResourceIds, response, results, _iterator, _step, blockContentResponse, resourceId, content, deletionReason, sourceAri, blockAri, contentUpdatedAt, blockInstanceId, product, status, syncedBlockData, _iterator2, _step2, errorResponse, _resourceId, _iterator3, _step3, blockNodeIdentifier;
377
376
  return _regenerator.default.wrap(function _callee4$(_context4) {
378
377
  while (1) switch (_context4.prev = _context4.next) {
379
378
  case 0:
@@ -434,32 +433,33 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
434
433
  return _context4.abrupt("continue", 25);
435
434
  case 19:
436
435
  processedResourceIds.add(resourceId);
437
- value = blockContentResponse.content;
438
- if (value) {
436
+ content = blockContentResponse.content, deletionReason = blockContentResponse.deletionReason, sourceAri = blockContentResponse.sourceAri, blockAri = blockContentResponse.blockAri, contentUpdatedAt = blockContentResponse.contentUpdatedAt, blockInstanceId = blockContentResponse.blockInstanceId, product = blockContentResponse.product, status = blockContentResponse.status;
437
+ if (content) {
439
438
  _context4.next = 24;
440
439
  break;
441
440
  }
442
441
  results.push({
443
442
  error: {
444
443
  type: _types.SyncBlockError.NotFound,
445
- reason: blockContentResponse.deletionReason
444
+ reason: deletionReason,
445
+ sourceAri: sourceAri
446
446
  },
447
447
  resourceId: resourceId
448
448
  });
449
449
  return _context4.abrupt("continue", 25);
450
450
  case 24:
451
451
  try {
452
- syncedBlockData = JSON.parse(value);
452
+ syncedBlockData = JSON.parse(content);
453
453
  results.push({
454
454
  data: {
455
455
  content: syncedBlockData,
456
- resourceId: blockContentResponse.blockAri,
457
- contentUpdatedAt: (0, _utils.convertContentUpdatedAt)(blockContentResponse.contentUpdatedAt),
458
- blockInstanceId: blockContentResponse.blockInstanceId,
459
- sourceAri: blockContentResponse.sourceAri,
460
- product: blockContentResponse.product,
461
- status: blockContentResponse.status,
462
- deletionReason: blockContentResponse.deletionReason
456
+ resourceId: blockAri,
457
+ contentUpdatedAt: (0, _utils.convertContentUpdatedAt)(contentUpdatedAt),
458
+ blockInstanceId: blockInstanceId,
459
+ sourceAri: sourceAri,
460
+ product: product,
461
+ status: status,
462
+ deletionReason: deletionReason
463
463
  },
464
464
  resourceId: resourceId
465
465
  });
@@ -402,6 +402,26 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
402
402
  }
403
403
  this.graphqlSubscriptions.clear();
404
404
  }
405
+ }, {
406
+ key: "fetchSyncBlockSourceInfoBySourceAri",
407
+ value: function fetchSyncBlockSourceInfoBySourceAri(sourceAri) {
408
+ var hasAccess = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
409
+ var urlType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'view';
410
+ try {
411
+ if (!this.dataProvider) {
412
+ throw new Error('Data provider not set');
413
+ }
414
+ var sourceInfo = this.dataProvider.fetchSyncBlockSourceInfo(undefined, sourceAri, undefined, undefined, hasAccess, urlType);
415
+ return sourceInfo;
416
+ } catch (error) {
417
+ var _this$fireAnalyticsEv4;
418
+ (0, _monitoring.logException)(error, {
419
+ location: 'editor-synced-block-provider/referenceSyncBlockStoreManager/fetchSyncBlockSourceInfoBySourceAri'
420
+ });
421
+ (_this$fireAnalyticsEv4 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv4 === void 0 || _this$fireAnalyticsEv4.call(this, (0, _errorHandling.getSourceInfoErrorPayload)(error.message));
422
+ return Promise.resolve(undefined);
423
+ }
424
+ }
405
425
  }, {
406
426
  key: "fetchSyncBlockSourceInfo",
407
427
  value: function fetchSyncBlockSourceInfo(resourceId) {
@@ -446,8 +466,8 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
446
466
  }
447
467
  }
448
468
  if (!sourceAri || !product || !blockInstanceId) {
449
- var _this$fireAnalyticsEv4;
450
- (_this$fireAnalyticsEv4 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv4 === void 0 || _this$fireAnalyticsEv4.call(this, (0, _errorHandling.getSourceInfoErrorPayload)('SourceAri, product or blockInstanceId missing', resourceId));
469
+ var _this$fireAnalyticsEv5;
470
+ (_this$fireAnalyticsEv5 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv5 === void 0 || _this$fireAnalyticsEv5.call(this, (0, _errorHandling.getSourceInfoErrorPayload)('SourceAri, product or blockInstanceId missing', resourceId));
451
471
  return Promise.resolve(undefined);
452
472
  }
453
473
  if ((0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding')) {
@@ -506,11 +526,11 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
506
526
  this.syncBlockSourceInfoRequestsOld.set(resourceId, true);
507
527
  }
508
528
  } catch (error) {
509
- var _this$fireAnalyticsEv5;
529
+ var _this$fireAnalyticsEv6;
510
530
  (0, _monitoring.logException)(error, {
511
531
  location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
512
532
  });
513
- (_this$fireAnalyticsEv5 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv5 === void 0 || _this$fireAnalyticsEv5.call(this, (0, _errorHandling.getSourceInfoErrorPayload)(error.message, resourceId));
533
+ (_this$fireAnalyticsEv6 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv6 === void 0 || _this$fireAnalyticsEv6.call(this, (0, _errorHandling.getSourceInfoErrorPayload)(error.message, resourceId));
514
534
  }
515
535
  return Promise.resolve(undefined);
516
536
  }
@@ -819,11 +839,11 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
819
839
  }
820
840
  return this.subscribeToSyncBlock(resourceId, localId, callback);
821
841
  } catch (error) {
822
- var _this$fireAnalyticsEv6;
842
+ var _this$fireAnalyticsEv7;
823
843
  (0, _monitoring.logException)(error, {
824
844
  location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
825
845
  });
826
- (_this$fireAnalyticsEv6 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv6 === void 0 || _this$fireAnalyticsEv6.call(this, (0, _errorHandling.fetchErrorPayload)(error.message));
846
+ (_this$fireAnalyticsEv7 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv7 === void 0 || _this$fireAnalyticsEv7.call(this, (0, _errorHandling.fetchErrorPayload)(error.message));
827
847
  return function () {};
828
848
  }
829
849
  }
@@ -847,12 +867,12 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
847
867
  key: "getProviderFactory",
848
868
  value: function getProviderFactory(resourceId) {
849
869
  if (!this.dataProvider) {
850
- var _this$fireAnalyticsEv7;
870
+ var _this$fireAnalyticsEv8;
851
871
  var error = new Error('Data provider not set');
852
872
  (0, _monitoring.logException)(error, {
853
873
  location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
854
874
  });
855
- (_this$fireAnalyticsEv7 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv7 === void 0 || _this$fireAnalyticsEv7.call(this, (0, _errorHandling.fetchErrorPayload)(error.message));
875
+ (_this$fireAnalyticsEv8 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv8 === void 0 || _this$fireAnalyticsEv8.call(this, (0, _errorHandling.fetchErrorPayload)(error.message));
856
876
  return undefined;
857
877
  }
858
878
  var _this$dataProvider$ge = this.dataProvider.getSyncedBlockRendererProviderOptions(),
@@ -881,11 +901,11 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
881
901
  try {
882
902
  this.retrieveDynamicProviders(resourceId, providerFactory, providerCreator);
883
903
  } catch (error) {
884
- var _this$fireAnalyticsEv8;
904
+ var _this$fireAnalyticsEv9;
885
905
  (0, _monitoring.logException)(error, {
886
906
  location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
887
907
  });
888
- (_this$fireAnalyticsEv8 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv8 === void 0 || _this$fireAnalyticsEv8.call(this, (0, _errorHandling.fetchErrorPayload)(error.message, resourceId));
908
+ (_this$fireAnalyticsEv9 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv9 === void 0 || _this$fireAnalyticsEv9.call(this, (0, _errorHandling.fetchErrorPayload)(error.message, resourceId));
889
909
  }
890
910
  }
891
911
  return providerFactory;
@@ -945,8 +965,8 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
945
965
  return;
946
966
  }
947
967
  if (!syncBlock.data.sourceAri || !syncBlock.data.product) {
948
- var _this$fireAnalyticsEv9;
949
- (_this$fireAnalyticsEv9 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv9 === void 0 || _this$fireAnalyticsEv9.call(this, (0, _errorHandling.fetchErrorPayload)('Sync block source ari or product not found'));
968
+ var _this$fireAnalyticsEv0;
969
+ (_this$fireAnalyticsEv0 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv0 === void 0 || _this$fireAnalyticsEv0.call(this, (0, _errorHandling.fetchErrorPayload)('Sync block source ari or product not found'));
950
970
  return;
951
971
  }
952
972
  var parentInfo = this.dataProvider.retrieveSyncBlockParentInfo((_syncBlock$data2 = syncBlock.data) === null || _syncBlock$data2 === void 0 ? void 0 : _syncBlock$data2.sourceAri, (_syncBlock$data3 = syncBlock.data) === null || _syncBlock$data3 === void 0 ? void 0 : _syncBlock$data3.product);
@@ -996,7 +1016,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
996
1016
  key: "flush",
997
1017
  value: (function () {
998
1018
  var _flush = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
999
- var success, blocks, _this$saveExperience, updateResult, _this$fireAnalyticsEv0, _this$saveExperience2, _this$fireAnalyticsEv1, _this$saveExperience3, _this$saveExperience4;
1019
+ var success, blocks, _this$saveExperience, updateResult, _this$fireAnalyticsEv1, _this$saveExperience2, _this$fireAnalyticsEv10, _this$saveExperience3, _this$saveExperience4;
1000
1020
  return _regenerator.default.wrap(function _callee3$(_context4) {
1001
1021
  while (1) switch (_context4.prev = _context4.next) {
1002
1022
  case 0:
@@ -1057,7 +1077,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
1057
1077
  reason: updateResult.error || 'Failed to update reference synced blocks on the document'
1058
1078
  });
1059
1079
  }
1060
- (_this$fireAnalyticsEv0 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv0 === void 0 || _this$fireAnalyticsEv0.call(this, (0, _errorHandling.updateReferenceErrorPayload)(updateResult.error || 'Failed to update reference synced blocks on the document'));
1080
+ (_this$fireAnalyticsEv1 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv1 === void 0 || _this$fireAnalyticsEv1.call(this, (0, _errorHandling.updateReferenceErrorPayload)(updateResult.error || 'Failed to update reference synced blocks on the document'));
1061
1081
  }
1062
1082
  _context4.next = 26;
1063
1083
  break;
@@ -1073,7 +1093,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
1073
1093
  reason: _context4.t0.message
1074
1094
  });
1075
1095
  }
1076
- (_this$fireAnalyticsEv1 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv1 === void 0 || _this$fireAnalyticsEv1.call(this, (0, _errorHandling.updateReferenceErrorPayload)(_context4.t0.message));
1096
+ (_this$fireAnalyticsEv10 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv10 === void 0 || _this$fireAnalyticsEv10.call(this, (0, _errorHandling.updateReferenceErrorPayload)(_context4.t0.message));
1077
1097
  case 26:
1078
1098
  _context4.prev = 26;
1079
1099
  if (!success) {
@@ -282,7 +282,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
282
282
  */
283
283
  }, {
284
284
  key: "createBodiedSyncBlockNode",
285
- value: function createBodiedSyncBlockNode(attrs) {
285
+ value: function createBodiedSyncBlockNode(attrs, nodeData) {
286
286
  var _this4 = this;
287
287
  try {
288
288
  var _this$createExperienc;
@@ -304,6 +304,12 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
304
304
  var _this4$createExperien;
305
305
  (_this4$createExperien = _this4.createExperience) === null || _this4$createExperien === void 0 || _this4$createExperien.success();
306
306
  }
307
+
308
+ // Update the sync block data with the node data if it is provided
309
+ // to avoid any race conditions where the data could be missed during a render operation
310
+ if (nodeData) {
311
+ _this4.updateSyncBlockData(nodeData);
312
+ }
307
313
  } else {
308
314
  var _this4$fireAnalyticsE;
309
315
  _this4.commitPendingCreation(false);
@@ -556,7 +562,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
556
562
  if (!sourceInfo) {
557
563
  var _this6$fetchSourceInf;
558
564
  (_this6$fetchSourceInf = _this6.fetchSourceInfoExperience) === null || _this6$fetchSourceInf === void 0 || _this6$fetchSourceInf.failure({
559
- reason: "No source info returned"
565
+ reason: 'No source info returned'
560
566
  });
561
567
  } else {
562
568
  var _this6$fetchSourceInf2;
@@ -85,9 +85,7 @@ export const convertToSyncBlockData = (data, resourceId) => {
85
85
  let createdAt;
86
86
  if (data.createdAt !== undefined && data.createdAt !== null) {
87
87
  try {
88
- // BE returns microseconds, convert to milliseconds
89
- // BE should fix this in the future
90
- createdAt = new Date(data.createdAt / 1000).toISOString();
88
+ createdAt = new Date(data.createdAt).toISOString();
91
89
  } catch {
92
90
  // fallback to undefined
93
91
  // as we don't want to block the whole process due to invalid date
@@ -178,30 +176,39 @@ class BlockServiceADFFetchProvider {
178
176
  blockAri,
179
177
  documentAri: this.parentAri
180
178
  });
181
- const value = blockContentResponse.content;
182
- if (!value) {
179
+ const {
180
+ content,
181
+ sourceAri,
182
+ deletionReason,
183
+ blockInstanceId,
184
+ contentUpdatedAt,
185
+ product,
186
+ status
187
+ } = blockContentResponse;
188
+ if (!content) {
183
189
  return {
184
190
  error: {
185
191
  type: SyncBlockError.NotFound,
186
- reason: blockContentResponse.deletionReason
192
+ reason: deletionReason,
193
+ sourceAri
187
194
  },
188
195
  resourceId
189
196
  };
190
197
  }
191
198
 
192
199
  // Parse the synced block content from the response's content
193
- const syncedBlockData = JSON.parse(value);
200
+ const syncedBlockData = JSON.parse(content);
194
201
  return {
195
202
  data: {
196
203
  content: syncedBlockData,
197
204
  resourceId: blockAri,
198
- blockInstanceId: blockContentResponse.blockInstanceId,
205
+ blockInstanceId: blockInstanceId,
199
206
  // this was the node's localId, but has become the resourceId.
200
- contentUpdatedAt: convertContentUpdatedAt(blockContentResponse.contentUpdatedAt),
201
- sourceAri: blockContentResponse.sourceAri,
202
- product: blockContentResponse.product,
203
- status: blockContentResponse.status,
204
- deletionReason: blockContentResponse.deletionReason
207
+ contentUpdatedAt: convertContentUpdatedAt(contentUpdatedAt),
208
+ sourceAri: sourceAri,
209
+ product: product,
210
+ status: status,
211
+ deletionReason: deletionReason
205
212
  },
206
213
  resourceId
207
214
  };
@@ -316,29 +323,39 @@ class BlockServiceADFFetchProvider {
316
323
  continue;
317
324
  }
318
325
  processedResourceIds.add(resourceId);
319
- const value = blockContentResponse.content;
320
- if (!value) {
326
+ const {
327
+ content,
328
+ deletionReason,
329
+ sourceAri,
330
+ blockAri,
331
+ contentUpdatedAt,
332
+ blockInstanceId,
333
+ product,
334
+ status
335
+ } = blockContentResponse;
336
+ if (!content) {
321
337
  results.push({
322
338
  error: {
323
339
  type: SyncBlockError.NotFound,
324
- reason: blockContentResponse.deletionReason
340
+ reason: deletionReason,
341
+ sourceAri
325
342
  },
326
343
  resourceId
327
344
  });
328
345
  continue;
329
346
  }
330
347
  try {
331
- const syncedBlockData = JSON.parse(value);
348
+ const syncedBlockData = JSON.parse(content);
332
349
  results.push({
333
350
  data: {
334
351
  content: syncedBlockData,
335
- resourceId: blockContentResponse.blockAri,
336
- contentUpdatedAt: convertContentUpdatedAt(blockContentResponse.contentUpdatedAt),
337
- blockInstanceId: blockContentResponse.blockInstanceId,
338
- sourceAri: blockContentResponse.sourceAri,
339
- product: blockContentResponse.product,
340
- status: blockContentResponse.status,
341
- deletionReason: blockContentResponse.deletionReason
352
+ resourceId: blockAri,
353
+ contentUpdatedAt: convertContentUpdatedAt(contentUpdatedAt),
354
+ blockInstanceId: blockInstanceId,
355
+ sourceAri: sourceAri,
356
+ product: product,
357
+ status: status,
358
+ deletionReason: deletionReason
342
359
  },
343
360
  resourceId
344
361
  });
@@ -270,6 +270,22 @@ export class ReferenceSyncBlockStoreManager {
270
270
  }
271
271
  this.graphqlSubscriptions.clear();
272
272
  }
273
+ fetchSyncBlockSourceInfoBySourceAri(sourceAri, hasAccess = true, urlType = 'view') {
274
+ try {
275
+ if (!this.dataProvider) {
276
+ throw new Error('Data provider not set');
277
+ }
278
+ const sourceInfo = this.dataProvider.fetchSyncBlockSourceInfo(undefined, sourceAri, undefined, undefined, hasAccess, urlType);
279
+ return sourceInfo;
280
+ } catch (error) {
281
+ var _this$fireAnalyticsEv6;
282
+ logException(error, {
283
+ location: 'editor-synced-block-provider/referenceSyncBlockStoreManager/fetchSyncBlockSourceInfoBySourceAri'
284
+ });
285
+ (_this$fireAnalyticsEv6 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv6 === void 0 ? void 0 : _this$fireAnalyticsEv6.call(this, getSourceInfoErrorPayload(error.message));
286
+ return Promise.resolve(undefined);
287
+ }
288
+ }
273
289
  fetchSyncBlockSourceInfo(resourceId) {
274
290
  try {
275
291
  if (!resourceId || !this.dataProvider) {
@@ -312,8 +328,8 @@ export class ReferenceSyncBlockStoreManager {
312
328
  }
313
329
  }
314
330
  if (!sourceAri || !product || !blockInstanceId) {
315
- var _this$fireAnalyticsEv6;
316
- (_this$fireAnalyticsEv6 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv6 === void 0 ? void 0 : _this$fireAnalyticsEv6.call(this, getSourceInfoErrorPayload('SourceAri, product or blockInstanceId missing', resourceId));
331
+ var _this$fireAnalyticsEv7;
332
+ (_this$fireAnalyticsEv7 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv7 === void 0 ? void 0 : _this$fireAnalyticsEv7.call(this, getSourceInfoErrorPayload('SourceAri, product or blockInstanceId missing', resourceId));
317
333
  return Promise.resolve(undefined);
318
334
  }
319
335
  if (fg('platform_synced_block_dogfooding')) {
@@ -323,11 +339,11 @@ export class ReferenceSyncBlockStoreManager {
323
339
  const sourceInfoPromise = this.dataProvider.fetchSyncBlockSourceInfo(blockInstanceId, sourceAri, product, this.fireAnalyticsEvent).then(sourceInfo => {
324
340
  if (!sourceInfo) {
325
341
  if (fg('platform_synced_block_dogfooding')) {
326
- var _this$fetchSourceInfo2, _this$fireAnalyticsEv7;
342
+ var _this$fetchSourceInfo2, _this$fireAnalyticsEv8;
327
343
  (_this$fetchSourceInfo2 = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo2 === void 0 ? void 0 : _this$fetchSourceInfo2.failure({
328
344
  reason: 'No source info returned'
329
345
  });
330
- (_this$fireAnalyticsEv7 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv7 === void 0 ? void 0 : _this$fireAnalyticsEv7.call(this, getSourceInfoErrorPayload('No source info returned', resourceId));
346
+ (_this$fireAnalyticsEv8 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv8 === void 0 ? void 0 : _this$fireAnalyticsEv8.call(this, getSourceInfoErrorPayload('No source info returned', resourceId));
331
347
  }
332
348
  return undefined;
333
349
  }
@@ -340,23 +356,23 @@ export class ReferenceSyncBlockStoreManager {
340
356
  var _this$fetchSourceInfo3;
341
357
  (_this$fetchSourceInfo3 = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo3 === void 0 ? void 0 : _this$fetchSourceInfo3.success();
342
358
  } else {
343
- var _this$fetchSourceInfo4, _this$fireAnalyticsEv8;
359
+ var _this$fetchSourceInfo4, _this$fireAnalyticsEv9;
344
360
  (_this$fetchSourceInfo4 = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo4 === void 0 ? void 0 : _this$fetchSourceInfo4.failure({
345
361
  reason: 'Missing title or url'
346
362
  });
347
- (_this$fireAnalyticsEv8 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv8 === void 0 ? void 0 : _this$fireAnalyticsEv8.call(this, getSourceInfoErrorPayload('Missing title or url', resourceId));
363
+ (_this$fireAnalyticsEv9 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv9 === void 0 ? void 0 : _this$fireAnalyticsEv9.call(this, getSourceInfoErrorPayload('Missing title or url', resourceId));
348
364
  }
349
365
  return sourceInfo;
350
366
  }
351
367
  }).catch(error => {
352
- var _this$fireAnalyticsEv9;
368
+ var _this$fireAnalyticsEv0;
353
369
  if (fg('platform_synced_block_dogfooding')) {
354
370
  var _this$fetchSourceInfo5;
355
371
  (_this$fetchSourceInfo5 = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo5 === void 0 ? void 0 : _this$fetchSourceInfo5.failure({
356
372
  reason: error.message
357
373
  });
358
374
  }
359
- (_this$fireAnalyticsEv9 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv9 === void 0 ? void 0 : _this$fireAnalyticsEv9.call(this, getSourceInfoErrorPayload(error.message, resourceId));
375
+ (_this$fireAnalyticsEv0 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv0 === void 0 ? void 0 : _this$fireAnalyticsEv0.call(this, getSourceInfoErrorPayload(error.message, resourceId));
360
376
  return undefined;
361
377
  }).finally(() => {
362
378
  if (fg('platform_synced_block_dogfooding')) {
@@ -372,11 +388,11 @@ export class ReferenceSyncBlockStoreManager {
372
388
  this.syncBlockSourceInfoRequestsOld.set(resourceId, true);
373
389
  }
374
390
  } catch (error) {
375
- var _this$fireAnalyticsEv0;
391
+ var _this$fireAnalyticsEv1;
376
392
  logException(error, {
377
393
  location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
378
394
  });
379
- (_this$fireAnalyticsEv0 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv0 === void 0 ? void 0 : _this$fireAnalyticsEv0.call(this, getSourceInfoErrorPayload(error.message, resourceId));
395
+ (_this$fireAnalyticsEv1 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv1 === void 0 ? void 0 : _this$fireAnalyticsEv1.call(this, getSourceInfoErrorPayload(error.message, resourceId));
380
396
  }
381
397
  return Promise.resolve(undefined);
382
398
  }
@@ -427,8 +443,8 @@ export class ReferenceSyncBlockStoreManager {
427
443
  data.forEach(syncBlockInstance => {
428
444
  var _resolvedSyncBlockIns;
429
445
  if (!syncBlockInstance.resourceId) {
430
- var _this$fireAnalyticsEv1, _syncBlockInstance$er2;
431
- (_this$fireAnalyticsEv1 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv1 === void 0 ? void 0 : _this$fireAnalyticsEv1.call(this, fetchErrorPayload(((_syncBlockInstance$er2 = syncBlockInstance.error) === null || _syncBlockInstance$er2 === void 0 ? void 0 : _syncBlockInstance$er2.type) || 'Returned sync block instance does not have resource id'));
446
+ var _this$fireAnalyticsEv10, _syncBlockInstance$er2;
447
+ (_this$fireAnalyticsEv10 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv10 === void 0 ? void 0 : _this$fireAnalyticsEv10.call(this, fetchErrorPayload(((_syncBlockInstance$er2 = syncBlockInstance.error) === null || _syncBlockInstance$er2 === void 0 ? void 0 : _syncBlockInstance$er2.type) || 'Returned sync block instance does not have resource id'));
432
448
  return;
433
449
  }
434
450
  const existingSyncBlock = this.getFromCache(syncBlockInstance.resourceId);
@@ -446,8 +462,8 @@ export class ReferenceSyncBlockStoreManager {
446
462
  this.newlyAddedSyncBlocks.delete(syncBlockInstance.resourceId);
447
463
  }
448
464
  if (syncBlockInstance.error) {
449
- var _this$fireAnalyticsEv10;
450
- (_this$fireAnalyticsEv10 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv10 === void 0 ? void 0 : _this$fireAnalyticsEv10.call(this, fetchErrorPayload(syncBlockInstance.error.type, syncBlockInstance.resourceId));
465
+ var _this$fireAnalyticsEv11;
466
+ (_this$fireAnalyticsEv11 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv11 === void 0 ? void 0 : _this$fireAnalyticsEv11.call(this, fetchErrorPayload(syncBlockInstance.error.type, syncBlockInstance.resourceId));
451
467
  if (syncBlockInstance.error.type === SyncBlockError.NotFound || syncBlockInstance.error.type === SyncBlockError.Forbidden) {
452
468
  hasExpectedError = true;
453
469
  } else if (syncBlockInstance.error) {
@@ -455,8 +471,8 @@ export class ReferenceSyncBlockStoreManager {
455
471
  }
456
472
  return;
457
473
  } else if (fg('platform_synced_block_dogfooding')) {
458
- var _this$fireAnalyticsEv11, _syncBlockInstance$da3, _syncBlockInstance$da4;
459
- (_this$fireAnalyticsEv11 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv11 === void 0 ? void 0 : _this$fireAnalyticsEv11.call(this, fetchSuccessPayload(syncBlockInstance.resourceId, (_syncBlockInstance$da3 = syncBlockInstance.data) === null || _syncBlockInstance$da3 === void 0 ? void 0 : _syncBlockInstance$da3.blockInstanceId, (_syncBlockInstance$da4 = syncBlockInstance.data) === null || _syncBlockInstance$da4 === void 0 ? void 0 : _syncBlockInstance$da4.product));
474
+ var _this$fireAnalyticsEv12, _syncBlockInstance$da3, _syncBlockInstance$da4;
475
+ (_this$fireAnalyticsEv12 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv12 === void 0 ? void 0 : _this$fireAnalyticsEv12.call(this, fetchSuccessPayload(syncBlockInstance.resourceId, (_syncBlockInstance$da3 = syncBlockInstance.data) === null || _syncBlockInstance$da3 === void 0 ? void 0 : _syncBlockInstance$da3.blockInstanceId, (_syncBlockInstance$da4 = syncBlockInstance.data) === null || _syncBlockInstance$da4 === void 0 ? void 0 : _syncBlockInstance$da4.product));
460
476
  }
461
477
  this.fetchSyncBlockSourceInfo(resolvedSyncBlockInstance.resourceId);
462
478
  });
@@ -556,11 +572,11 @@ export class ReferenceSyncBlockStoreManager {
556
572
  callback(cachedData);
557
573
  } else {
558
574
  this.fetchSyncBlocksData([syncBlockNode]).catch(error => {
559
- var _this$fireAnalyticsEv12;
575
+ var _this$fireAnalyticsEv13;
560
576
  logException(error, {
561
577
  location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
562
578
  });
563
- (_this$fireAnalyticsEv12 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv12 === void 0 ? void 0 : _this$fireAnalyticsEv12.call(this, fetchErrorPayload(error.message, resourceId));
579
+ (_this$fireAnalyticsEv13 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv13 === void 0 ? void 0 : _this$fireAnalyticsEv13.call(this, fetchErrorPayload(error.message, resourceId));
564
580
  });
565
581
  }
566
582
 
@@ -653,11 +669,11 @@ export class ReferenceSyncBlockStoreManager {
653
669
  }
654
670
  return this.subscribeToSyncBlock(resourceId, localId, callback);
655
671
  } catch (error) {
656
- var _this$fireAnalyticsEv13;
672
+ var _this$fireAnalyticsEv14;
657
673
  logException(error, {
658
674
  location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
659
675
  });
660
- (_this$fireAnalyticsEv13 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv13 === void 0 ? void 0 : _this$fireAnalyticsEv13.call(this, fetchErrorPayload(error.message));
676
+ (_this$fireAnalyticsEv14 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv14 === void 0 ? void 0 : _this$fireAnalyticsEv14.call(this, fetchErrorPayload(error.message));
661
677
  return () => {};
662
678
  }
663
679
  }
@@ -677,12 +693,12 @@ export class ReferenceSyncBlockStoreManager {
677
693
  }
678
694
  getProviderFactory(resourceId) {
679
695
  if (!this.dataProvider) {
680
- var _this$fireAnalyticsEv14;
696
+ var _this$fireAnalyticsEv15;
681
697
  const error = new Error('Data provider not set');
682
698
  logException(error, {
683
699
  location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
684
700
  });
685
- (_this$fireAnalyticsEv14 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv14 === void 0 ? void 0 : _this$fireAnalyticsEv14.call(this, fetchErrorPayload(error.message));
701
+ (_this$fireAnalyticsEv15 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv15 === void 0 ? void 0 : _this$fireAnalyticsEv15.call(this, fetchErrorPayload(error.message));
686
702
  return undefined;
687
703
  }
688
704
  const {
@@ -712,11 +728,11 @@ export class ReferenceSyncBlockStoreManager {
712
728
  try {
713
729
  this.retrieveDynamicProviders(resourceId, providerFactory, providerCreator);
714
730
  } catch (error) {
715
- var _this$fireAnalyticsEv15;
731
+ var _this$fireAnalyticsEv16;
716
732
  logException(error, {
717
733
  location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
718
734
  });
719
- (_this$fireAnalyticsEv15 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv15 === void 0 ? void 0 : _this$fireAnalyticsEv15.call(this, fetchErrorPayload(error.message, resourceId));
735
+ (_this$fireAnalyticsEv16 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv16 === void 0 ? void 0 : _this$fireAnalyticsEv16.call(this, fetchErrorPayload(error.message, resourceId));
720
736
  }
721
737
  }
722
738
  return providerFactory;
@@ -775,8 +791,8 @@ export class ReferenceSyncBlockStoreManager {
775
791
  return;
776
792
  }
777
793
  if (!syncBlock.data.sourceAri || !syncBlock.data.product) {
778
- var _this$fireAnalyticsEv16;
779
- (_this$fireAnalyticsEv16 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv16 === void 0 ? void 0 : _this$fireAnalyticsEv16.call(this, fetchErrorPayload('Sync block source ari or product not found'));
794
+ var _this$fireAnalyticsEv17;
795
+ (_this$fireAnalyticsEv17 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv17 === void 0 ? void 0 : _this$fireAnalyticsEv17.call(this, fetchErrorPayload('Sync block source ari or product not found'));
780
796
  return;
781
797
  }
782
798
  const parentInfo = this.dataProvider.retrieveSyncBlockParentInfo((_syncBlock$data2 = syncBlock.data) === null || _syncBlock$data2 === void 0 ? void 0 : _syncBlock$data2.sourceAri, (_syncBlock$data3 = syncBlock.data) === null || _syncBlock$data3 === void 0 ? void 0 : _syncBlock$data3.product);
@@ -865,7 +881,7 @@ export class ReferenceSyncBlockStoreManager {
865
881
  }
866
882
  const updateResult = await this.dataProvider.updateReferenceData(blocks);
867
883
  if (!updateResult.success) {
868
- var _this$fireAnalyticsEv17;
884
+ var _this$fireAnalyticsEv18;
869
885
  success = false;
870
886
  if (fg('platform_synced_block_dogfooding')) {
871
887
  var _this$saveExperience2;
@@ -873,10 +889,10 @@ export class ReferenceSyncBlockStoreManager {
873
889
  reason: updateResult.error || 'Failed to update reference synced blocks on the document'
874
890
  });
875
891
  }
876
- (_this$fireAnalyticsEv17 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv17 === void 0 ? void 0 : _this$fireAnalyticsEv17.call(this, updateReferenceErrorPayload(updateResult.error || 'Failed to update reference synced blocks on the document'));
892
+ (_this$fireAnalyticsEv18 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv18 === void 0 ? void 0 : _this$fireAnalyticsEv18.call(this, updateReferenceErrorPayload(updateResult.error || 'Failed to update reference synced blocks on the document'));
877
893
  }
878
894
  } catch (error) {
879
- var _this$fireAnalyticsEv18;
895
+ var _this$fireAnalyticsEv19;
880
896
  success = false;
881
897
  logException(error, {
882
898
  location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
@@ -887,7 +903,7 @@ export class ReferenceSyncBlockStoreManager {
887
903
  reason: error.message
888
904
  });
889
905
  }
890
- (_this$fireAnalyticsEv18 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv18 === void 0 ? void 0 : _this$fireAnalyticsEv18.call(this, updateReferenceErrorPayload(error.message));
906
+ (_this$fireAnalyticsEv19 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv19 === void 0 ? void 0 : _this$fireAnalyticsEv19.call(this, updateReferenceErrorPayload(error.message));
891
907
  } finally {
892
908
  if (!success) {
893
909
  // set isCacheDirty back to true for cases where it failed to update the reference synced blocks on the BE
@@ -214,7 +214,7 @@ export class SourceSyncBlockStoreManager {
214
214
  * Create a bodiedSyncBlock node with empty content to backend
215
215
  * @param attrs attributes Ids of the node
216
216
  */
217
- createBodiedSyncBlockNode(attrs) {
217
+ createBodiedSyncBlockNode(attrs, nodeData) {
218
218
  try {
219
219
  var _this$createExperienc;
220
220
  if (!this.dataProvider) {
@@ -237,6 +237,12 @@ export class SourceSyncBlockStoreManager {
237
237
  var _this$createExperienc2;
238
238
  (_this$createExperienc2 = this.createExperience) === null || _this$createExperienc2 === void 0 ? void 0 : _this$createExperienc2.success();
239
239
  }
240
+
241
+ // Update the sync block data with the node data if it is provided
242
+ // to avoid any race conditions where the data could be missed during a render operation
243
+ if (nodeData) {
244
+ this.updateSyncBlockData(nodeData);
245
+ }
240
246
  } else {
241
247
  var _this$fireAnalyticsEv7;
242
248
  this.commitPendingCreation(false);
@@ -406,7 +412,7 @@ export class SourceSyncBlockStoreManager {
406
412
  if (!sourceInfo) {
407
413
  var _this$fetchSourceInfo2;
408
414
  (_this$fetchSourceInfo2 = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo2 === void 0 ? void 0 : _this$fetchSourceInfo2.failure({
409
- reason: "No source info returned"
415
+ reason: 'No source info returned'
410
416
  });
411
417
  } else {
412
418
  var _this$fetchSourceInfo3;
@@ -96,9 +96,7 @@ export var convertToSyncBlockData = function convertToSyncBlockData(data, resour
96
96
  var createdAt;
97
97
  if (data.createdAt !== undefined && data.createdAt !== null) {
98
98
  try {
99
- // BE returns microseconds, convert to milliseconds
100
- // BE should fix this in the future
101
- createdAt = new Date(data.createdAt / 1000).toISOString();
99
+ createdAt = new Date(data.createdAt).toISOString();
102
100
  } catch (_unused) {
103
101
  // fallback to undefined
104
102
  // as we don't want to block the whole process due to invalid date
@@ -205,7 +203,7 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
205
203
  key: "fetchData",
206
204
  value: function () {
207
205
  var _fetchData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(resourceId) {
208
- var blockAri, blockContentResponse, value, syncedBlockData;
206
+ var blockAri, blockContentResponse, content, sourceAri, deletionReason, blockInstanceId, contentUpdatedAt, product, status, syncedBlockData;
209
207
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
210
208
  while (1) switch (_context2.prev = _context2.next) {
211
209
  case 0:
@@ -221,32 +219,33 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
221
219
  });
222
220
  case 4:
223
221
  blockContentResponse = _context2.sent;
224
- value = blockContentResponse.content;
225
- if (value) {
222
+ content = blockContentResponse.content, sourceAri = blockContentResponse.sourceAri, deletionReason = blockContentResponse.deletionReason, blockInstanceId = blockContentResponse.blockInstanceId, contentUpdatedAt = blockContentResponse.contentUpdatedAt, product = blockContentResponse.product, status = blockContentResponse.status;
223
+ if (content) {
226
224
  _context2.next = 8;
227
225
  break;
228
226
  }
229
227
  return _context2.abrupt("return", {
230
228
  error: {
231
229
  type: SyncBlockError.NotFound,
232
- reason: blockContentResponse.deletionReason
230
+ reason: deletionReason,
231
+ sourceAri: sourceAri
233
232
  },
234
233
  resourceId: resourceId
235
234
  });
236
235
  case 8:
237
236
  // Parse the synced block content from the response's content
238
- syncedBlockData = JSON.parse(value);
237
+ syncedBlockData = JSON.parse(content);
239
238
  return _context2.abrupt("return", {
240
239
  data: {
241
240
  content: syncedBlockData,
242
241
  resourceId: blockAri,
243
- blockInstanceId: blockContentResponse.blockInstanceId,
242
+ blockInstanceId: blockInstanceId,
244
243
  // this was the node's localId, but has become the resourceId.
245
- contentUpdatedAt: convertContentUpdatedAt(blockContentResponse.contentUpdatedAt),
246
- sourceAri: blockContentResponse.sourceAri,
247
- product: blockContentResponse.product,
248
- status: blockContentResponse.status,
249
- deletionReason: blockContentResponse.deletionReason
244
+ contentUpdatedAt: convertContentUpdatedAt(contentUpdatedAt),
245
+ sourceAri: sourceAri,
246
+ product: product,
247
+ status: status,
248
+ deletionReason: deletionReason
250
249
  },
251
250
  resourceId: resourceId
252
251
  });
@@ -367,7 +366,7 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
367
366
  value: (function () {
368
367
  var _batchFetchData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(blockNodeIdentifiers) {
369
368
  var _this2 = this;
370
- var blockIdentifiers, validResourceIds, processedResourceIds, response, results, _iterator, _step, blockContentResponse, resourceId, value, syncedBlockData, _iterator2, _step2, errorResponse, _resourceId, _iterator3, _step3, blockNodeIdentifier;
369
+ var blockIdentifiers, validResourceIds, processedResourceIds, response, results, _iterator, _step, blockContentResponse, resourceId, content, deletionReason, sourceAri, blockAri, contentUpdatedAt, blockInstanceId, product, status, syncedBlockData, _iterator2, _step2, errorResponse, _resourceId, _iterator3, _step3, blockNodeIdentifier;
371
370
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
372
371
  while (1) switch (_context4.prev = _context4.next) {
373
372
  case 0:
@@ -428,32 +427,33 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
428
427
  return _context4.abrupt("continue", 25);
429
428
  case 19:
430
429
  processedResourceIds.add(resourceId);
431
- value = blockContentResponse.content;
432
- if (value) {
430
+ content = blockContentResponse.content, deletionReason = blockContentResponse.deletionReason, sourceAri = blockContentResponse.sourceAri, blockAri = blockContentResponse.blockAri, contentUpdatedAt = blockContentResponse.contentUpdatedAt, blockInstanceId = blockContentResponse.blockInstanceId, product = blockContentResponse.product, status = blockContentResponse.status;
431
+ if (content) {
433
432
  _context4.next = 24;
434
433
  break;
435
434
  }
436
435
  results.push({
437
436
  error: {
438
437
  type: SyncBlockError.NotFound,
439
- reason: blockContentResponse.deletionReason
438
+ reason: deletionReason,
439
+ sourceAri: sourceAri
440
440
  },
441
441
  resourceId: resourceId
442
442
  });
443
443
  return _context4.abrupt("continue", 25);
444
444
  case 24:
445
445
  try {
446
- syncedBlockData = JSON.parse(value);
446
+ syncedBlockData = JSON.parse(content);
447
447
  results.push({
448
448
  data: {
449
449
  content: syncedBlockData,
450
- resourceId: blockContentResponse.blockAri,
451
- contentUpdatedAt: convertContentUpdatedAt(blockContentResponse.contentUpdatedAt),
452
- blockInstanceId: blockContentResponse.blockInstanceId,
453
- sourceAri: blockContentResponse.sourceAri,
454
- product: blockContentResponse.product,
455
- status: blockContentResponse.status,
456
- deletionReason: blockContentResponse.deletionReason
450
+ resourceId: blockAri,
451
+ contentUpdatedAt: convertContentUpdatedAt(contentUpdatedAt),
452
+ blockInstanceId: blockInstanceId,
453
+ sourceAri: sourceAri,
454
+ product: product,
455
+ status: status,
456
+ deletionReason: deletionReason
457
457
  },
458
458
  resourceId: resourceId
459
459
  });
@@ -396,6 +396,26 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
396
396
  }
397
397
  this.graphqlSubscriptions.clear();
398
398
  }
399
+ }, {
400
+ key: "fetchSyncBlockSourceInfoBySourceAri",
401
+ value: function fetchSyncBlockSourceInfoBySourceAri(sourceAri) {
402
+ var hasAccess = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
403
+ var urlType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'view';
404
+ try {
405
+ if (!this.dataProvider) {
406
+ throw new Error('Data provider not set');
407
+ }
408
+ var sourceInfo = this.dataProvider.fetchSyncBlockSourceInfo(undefined, sourceAri, undefined, undefined, hasAccess, urlType);
409
+ return sourceInfo;
410
+ } catch (error) {
411
+ var _this$fireAnalyticsEv4;
412
+ logException(error, {
413
+ location: 'editor-synced-block-provider/referenceSyncBlockStoreManager/fetchSyncBlockSourceInfoBySourceAri'
414
+ });
415
+ (_this$fireAnalyticsEv4 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv4 === void 0 || _this$fireAnalyticsEv4.call(this, getSourceInfoErrorPayload(error.message));
416
+ return Promise.resolve(undefined);
417
+ }
418
+ }
399
419
  }, {
400
420
  key: "fetchSyncBlockSourceInfo",
401
421
  value: function fetchSyncBlockSourceInfo(resourceId) {
@@ -440,8 +460,8 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
440
460
  }
441
461
  }
442
462
  if (!sourceAri || !product || !blockInstanceId) {
443
- var _this$fireAnalyticsEv4;
444
- (_this$fireAnalyticsEv4 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv4 === void 0 || _this$fireAnalyticsEv4.call(this, getSourceInfoErrorPayload('SourceAri, product or blockInstanceId missing', resourceId));
463
+ var _this$fireAnalyticsEv5;
464
+ (_this$fireAnalyticsEv5 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv5 === void 0 || _this$fireAnalyticsEv5.call(this, getSourceInfoErrorPayload('SourceAri, product or blockInstanceId missing', resourceId));
445
465
  return Promise.resolve(undefined);
446
466
  }
447
467
  if (fg('platform_synced_block_dogfooding')) {
@@ -500,11 +520,11 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
500
520
  this.syncBlockSourceInfoRequestsOld.set(resourceId, true);
501
521
  }
502
522
  } catch (error) {
503
- var _this$fireAnalyticsEv5;
523
+ var _this$fireAnalyticsEv6;
504
524
  logException(error, {
505
525
  location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
506
526
  });
507
- (_this$fireAnalyticsEv5 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv5 === void 0 || _this$fireAnalyticsEv5.call(this, getSourceInfoErrorPayload(error.message, resourceId));
527
+ (_this$fireAnalyticsEv6 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv6 === void 0 || _this$fireAnalyticsEv6.call(this, getSourceInfoErrorPayload(error.message, resourceId));
508
528
  }
509
529
  return Promise.resolve(undefined);
510
530
  }
@@ -813,11 +833,11 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
813
833
  }
814
834
  return this.subscribeToSyncBlock(resourceId, localId, callback);
815
835
  } catch (error) {
816
- var _this$fireAnalyticsEv6;
836
+ var _this$fireAnalyticsEv7;
817
837
  logException(error, {
818
838
  location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
819
839
  });
820
- (_this$fireAnalyticsEv6 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv6 === void 0 || _this$fireAnalyticsEv6.call(this, fetchErrorPayload(error.message));
840
+ (_this$fireAnalyticsEv7 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv7 === void 0 || _this$fireAnalyticsEv7.call(this, fetchErrorPayload(error.message));
821
841
  return function () {};
822
842
  }
823
843
  }
@@ -841,12 +861,12 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
841
861
  key: "getProviderFactory",
842
862
  value: function getProviderFactory(resourceId) {
843
863
  if (!this.dataProvider) {
844
- var _this$fireAnalyticsEv7;
864
+ var _this$fireAnalyticsEv8;
845
865
  var error = new Error('Data provider not set');
846
866
  logException(error, {
847
867
  location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
848
868
  });
849
- (_this$fireAnalyticsEv7 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv7 === void 0 || _this$fireAnalyticsEv7.call(this, fetchErrorPayload(error.message));
869
+ (_this$fireAnalyticsEv8 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv8 === void 0 || _this$fireAnalyticsEv8.call(this, fetchErrorPayload(error.message));
850
870
  return undefined;
851
871
  }
852
872
  var _this$dataProvider$ge = this.dataProvider.getSyncedBlockRendererProviderOptions(),
@@ -875,11 +895,11 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
875
895
  try {
876
896
  this.retrieveDynamicProviders(resourceId, providerFactory, providerCreator);
877
897
  } catch (error) {
878
- var _this$fireAnalyticsEv8;
898
+ var _this$fireAnalyticsEv9;
879
899
  logException(error, {
880
900
  location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
881
901
  });
882
- (_this$fireAnalyticsEv8 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv8 === void 0 || _this$fireAnalyticsEv8.call(this, fetchErrorPayload(error.message, resourceId));
902
+ (_this$fireAnalyticsEv9 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv9 === void 0 || _this$fireAnalyticsEv9.call(this, fetchErrorPayload(error.message, resourceId));
883
903
  }
884
904
  }
885
905
  return providerFactory;
@@ -939,8 +959,8 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
939
959
  return;
940
960
  }
941
961
  if (!syncBlock.data.sourceAri || !syncBlock.data.product) {
942
- var _this$fireAnalyticsEv9;
943
- (_this$fireAnalyticsEv9 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv9 === void 0 || _this$fireAnalyticsEv9.call(this, fetchErrorPayload('Sync block source ari or product not found'));
962
+ var _this$fireAnalyticsEv0;
963
+ (_this$fireAnalyticsEv0 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv0 === void 0 || _this$fireAnalyticsEv0.call(this, fetchErrorPayload('Sync block source ari or product not found'));
944
964
  return;
945
965
  }
946
966
  var parentInfo = this.dataProvider.retrieveSyncBlockParentInfo((_syncBlock$data2 = syncBlock.data) === null || _syncBlock$data2 === void 0 ? void 0 : _syncBlock$data2.sourceAri, (_syncBlock$data3 = syncBlock.data) === null || _syncBlock$data3 === void 0 ? void 0 : _syncBlock$data3.product);
@@ -990,7 +1010,7 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
990
1010
  key: "flush",
991
1011
  value: (function () {
992
1012
  var _flush = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
993
- var success, blocks, _this$saveExperience, updateResult, _this$fireAnalyticsEv0, _this$saveExperience2, _this$fireAnalyticsEv1, _this$saveExperience3, _this$saveExperience4;
1013
+ var success, blocks, _this$saveExperience, updateResult, _this$fireAnalyticsEv1, _this$saveExperience2, _this$fireAnalyticsEv10, _this$saveExperience3, _this$saveExperience4;
994
1014
  return _regeneratorRuntime.wrap(function _callee3$(_context4) {
995
1015
  while (1) switch (_context4.prev = _context4.next) {
996
1016
  case 0:
@@ -1051,7 +1071,7 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
1051
1071
  reason: updateResult.error || 'Failed to update reference synced blocks on the document'
1052
1072
  });
1053
1073
  }
1054
- (_this$fireAnalyticsEv0 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv0 === void 0 || _this$fireAnalyticsEv0.call(this, updateReferenceErrorPayload(updateResult.error || 'Failed to update reference synced blocks on the document'));
1074
+ (_this$fireAnalyticsEv1 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv1 === void 0 || _this$fireAnalyticsEv1.call(this, updateReferenceErrorPayload(updateResult.error || 'Failed to update reference synced blocks on the document'));
1055
1075
  }
1056
1076
  _context4.next = 26;
1057
1077
  break;
@@ -1067,7 +1087,7 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
1067
1087
  reason: _context4.t0.message
1068
1088
  });
1069
1089
  }
1070
- (_this$fireAnalyticsEv1 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv1 === void 0 || _this$fireAnalyticsEv1.call(this, updateReferenceErrorPayload(_context4.t0.message));
1090
+ (_this$fireAnalyticsEv10 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv10 === void 0 || _this$fireAnalyticsEv10.call(this, updateReferenceErrorPayload(_context4.t0.message));
1071
1091
  case 26:
1072
1092
  _context4.prev = 26;
1073
1093
  if (!success) {
@@ -275,7 +275,7 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
275
275
  */
276
276
  }, {
277
277
  key: "createBodiedSyncBlockNode",
278
- value: function createBodiedSyncBlockNode(attrs) {
278
+ value: function createBodiedSyncBlockNode(attrs, nodeData) {
279
279
  var _this4 = this;
280
280
  try {
281
281
  var _this$createExperienc;
@@ -297,6 +297,12 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
297
297
  var _this4$createExperien;
298
298
  (_this4$createExperien = _this4.createExperience) === null || _this4$createExperien === void 0 || _this4$createExperien.success();
299
299
  }
300
+
301
+ // Update the sync block data with the node data if it is provided
302
+ // to avoid any race conditions where the data could be missed during a render operation
303
+ if (nodeData) {
304
+ _this4.updateSyncBlockData(nodeData);
305
+ }
300
306
  } else {
301
307
  var _this4$fireAnalyticsE;
302
308
  _this4.commitPendingCreation(false);
@@ -549,7 +555,7 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
549
555
  if (!sourceInfo) {
550
556
  var _this6$fetchSourceInf;
551
557
  (_this6$fetchSourceInf = _this6.fetchSourceInfoExperience) === null || _this6$fetchSourceInf === void 0 || _this6$fetchSourceInf.failure({
552
- reason: "No source info returned"
558
+ reason: 'No source info returned'
553
559
  });
554
560
  } else {
555
561
  var _this6$fetchSourceInf2;
@@ -68,7 +68,7 @@ export declare class SyncBlockProvider extends SyncBlockDataProvider {
68
68
  *
69
69
  * @returns The source info
70
70
  */
71
- fetchSyncBlockSourceInfo(localId: BlockInstanceId, sourceAri?: string, sourceProduct?: SyncBlockProduct, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void, hasAccess?: boolean, urlType?: 'view' | 'edit'): Promise<SyncBlockSourceInfo | undefined>;
71
+ fetchSyncBlockSourceInfo(localId?: BlockInstanceId, sourceAri?: string, sourceProduct?: SyncBlockProduct, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void, hasAccess?: boolean, urlType?: 'view' | 'edit'): Promise<SyncBlockSourceInfo | undefined>;
72
72
  generateResourceId(): {
73
73
  localId: BlockInstanceId;
74
74
  resourceId: ResourceId;
@@ -5,6 +5,11 @@ import type { MentionProvider } from '@atlaskit/mention/types';
5
5
  import { NodeDataProvider } from '@atlaskit/node-data-provider';
6
6
  import type { TaskDecisionProvider } from '@atlaskit/task-decision/types';
7
7
  import type { SyncBlockData, ResourceId, SyncBlockError, SyncBlockNode, SyncBlockProduct, BlockInstanceId, SyncBlockAttrs, ReferenceSyncBlockData, DeletionReason } from '../common/types';
8
+ type SyncBlockErrorInfo = {
9
+ reason?: string;
10
+ sourceAri?: string;
11
+ type: SyncBlockError;
12
+ };
8
13
  /**
9
14
  * The instance of a sync block, containing its data and metadata.
10
15
  * Mainly used for representing the state of a sync block after fetching from a data provider.
@@ -12,10 +17,7 @@ import type { SyncBlockData, ResourceId, SyncBlockError, SyncBlockNode, SyncBloc
12
17
  */
13
18
  export type SyncBlockInstance = {
14
19
  data?: SyncBlockData;
15
- error?: {
16
- reason?: string;
17
- type: SyncBlockError;
18
- };
20
+ error?: SyncBlockErrorInfo;
19
21
  /**
20
22
  * The resourceId in the attrs of the block
21
23
  */
@@ -110,7 +112,7 @@ export declare abstract class SyncBlockDataProvider extends NodeDataProvider<Syn
110
112
  abstract writeNodesData(nodes: SyncBlockNode[], data: SyncBlockData[]): Promise<Array<WriteSyncBlockResult>>;
111
113
  abstract createNodeData(data: SyncBlockData): Promise<WriteSyncBlockResult>;
112
114
  abstract deleteNodesData(resourceIds: string[], deleteReason: DeletionReason | undefined): Promise<Array<DeleteSyncBlockResult>>;
113
- abstract fetchSyncBlockSourceInfo(localId: BlockInstanceId, sourceAri?: string, sourceProduct?: SyncBlockProduct, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void, hasAccess?: boolean, urlType?: 'view' | 'edit'): Promise<SyncBlockSourceInfo | undefined>;
115
+ abstract fetchSyncBlockSourceInfo(localId?: BlockInstanceId, sourceAri?: string, sourceProduct?: SyncBlockProduct, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void, hasAccess?: boolean, urlType?: 'view' | 'edit'): Promise<SyncBlockSourceInfo | undefined>;
114
116
  abstract setProviderOptions(providerOptions: SyncedBlockRendererProviderOptions): void;
115
117
  abstract getSyncedBlockRendererProviderOptions(): SyncedBlockRendererProviderOptions;
116
118
  abstract retrieveSyncBlockParentInfo(sourceAri: string, sourceProduct: SyncBlockProduct): SyncBlockParentInfo | undefined;
@@ -142,3 +144,4 @@ export declare abstract class SyncBlockDataProvider extends NodeDataProvider<Syn
142
144
  }
143
145
  export type SubscriptionCallback = (data: SyncBlockInstance) => void;
144
146
  export type TitleSubscriptionCallback = (title: string) => void;
147
+ export {};
@@ -98,6 +98,7 @@ export declare class ReferenceSyncBlockStoreManager {
98
98
  * Cleans up all GraphQL subscriptions.
99
99
  */
100
100
  private cleanupAllGraphQLSubscriptions;
101
+ fetchSyncBlockSourceInfoBySourceAri(sourceAri: string, hasAccess?: boolean, urlType?: 'view' | 'edit'): Promise<SyncBlockSourceInfo | undefined>;
101
102
  fetchSyncBlockSourceInfo(resourceId: ResourceId): Promise<SyncBlockSourceInfo | undefined>;
102
103
  /**
103
104
  * Fetch sync block data for a given array of sync block nodes.
@@ -58,7 +58,7 @@ export declare class SourceSyncBlockStoreManager {
58
58
  * Create a bodiedSyncBlock node with empty content to backend
59
59
  * @param attrs attributes Ids of the node
60
60
  */
61
- createBodiedSyncBlockNode(attrs: SyncBlockAttrs): void;
61
+ createBodiedSyncBlockNode(attrs: SyncBlockAttrs, nodeData?: PMNode): void;
62
62
  private setPendingDeletion;
63
63
  private delete;
64
64
  isRetryingDeletion(): boolean;
@@ -68,7 +68,7 @@ export declare class SyncBlockProvider extends SyncBlockDataProvider {
68
68
  *
69
69
  * @returns The source info
70
70
  */
71
- fetchSyncBlockSourceInfo(localId: BlockInstanceId, sourceAri?: string, sourceProduct?: SyncBlockProduct, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void, hasAccess?: boolean, urlType?: 'view' | 'edit'): Promise<SyncBlockSourceInfo | undefined>;
71
+ fetchSyncBlockSourceInfo(localId?: BlockInstanceId, sourceAri?: string, sourceProduct?: SyncBlockProduct, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void, hasAccess?: boolean, urlType?: 'view' | 'edit'): Promise<SyncBlockSourceInfo | undefined>;
72
72
  generateResourceId(): {
73
73
  localId: BlockInstanceId;
74
74
  resourceId: ResourceId;
@@ -5,6 +5,11 @@ import type { MentionProvider } from '@atlaskit/mention/types';
5
5
  import { NodeDataProvider } from '@atlaskit/node-data-provider';
6
6
  import type { TaskDecisionProvider } from '@atlaskit/task-decision/types';
7
7
  import type { SyncBlockData, ResourceId, SyncBlockError, SyncBlockNode, SyncBlockProduct, BlockInstanceId, SyncBlockAttrs, ReferenceSyncBlockData, DeletionReason } from '../common/types';
8
+ type SyncBlockErrorInfo = {
9
+ reason?: string;
10
+ sourceAri?: string;
11
+ type: SyncBlockError;
12
+ };
8
13
  /**
9
14
  * The instance of a sync block, containing its data and metadata.
10
15
  * Mainly used for representing the state of a sync block after fetching from a data provider.
@@ -12,10 +17,7 @@ import type { SyncBlockData, ResourceId, SyncBlockError, SyncBlockNode, SyncBloc
12
17
  */
13
18
  export type SyncBlockInstance = {
14
19
  data?: SyncBlockData;
15
- error?: {
16
- reason?: string;
17
- type: SyncBlockError;
18
- };
20
+ error?: SyncBlockErrorInfo;
19
21
  /**
20
22
  * The resourceId in the attrs of the block
21
23
  */
@@ -110,7 +112,7 @@ export declare abstract class SyncBlockDataProvider extends NodeDataProvider<Syn
110
112
  abstract writeNodesData(nodes: SyncBlockNode[], data: SyncBlockData[]): Promise<Array<WriteSyncBlockResult>>;
111
113
  abstract createNodeData(data: SyncBlockData): Promise<WriteSyncBlockResult>;
112
114
  abstract deleteNodesData(resourceIds: string[], deleteReason: DeletionReason | undefined): Promise<Array<DeleteSyncBlockResult>>;
113
- abstract fetchSyncBlockSourceInfo(localId: BlockInstanceId, sourceAri?: string, sourceProduct?: SyncBlockProduct, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void, hasAccess?: boolean, urlType?: 'view' | 'edit'): Promise<SyncBlockSourceInfo | undefined>;
115
+ abstract fetchSyncBlockSourceInfo(localId?: BlockInstanceId, sourceAri?: string, sourceProduct?: SyncBlockProduct, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void, hasAccess?: boolean, urlType?: 'view' | 'edit'): Promise<SyncBlockSourceInfo | undefined>;
114
116
  abstract setProviderOptions(providerOptions: SyncedBlockRendererProviderOptions): void;
115
117
  abstract getSyncedBlockRendererProviderOptions(): SyncedBlockRendererProviderOptions;
116
118
  abstract retrieveSyncBlockParentInfo(sourceAri: string, sourceProduct: SyncBlockProduct): SyncBlockParentInfo | undefined;
@@ -142,3 +144,4 @@ export declare abstract class SyncBlockDataProvider extends NodeDataProvider<Syn
142
144
  }
143
145
  export type SubscriptionCallback = (data: SyncBlockInstance) => void;
144
146
  export type TitleSubscriptionCallback = (title: string) => void;
147
+ export {};
@@ -98,6 +98,7 @@ export declare class ReferenceSyncBlockStoreManager {
98
98
  * Cleans up all GraphQL subscriptions.
99
99
  */
100
100
  private cleanupAllGraphQLSubscriptions;
101
+ fetchSyncBlockSourceInfoBySourceAri(sourceAri: string, hasAccess?: boolean, urlType?: 'view' | 'edit'): Promise<SyncBlockSourceInfo | undefined>;
101
102
  fetchSyncBlockSourceInfo(resourceId: ResourceId): Promise<SyncBlockSourceInfo | undefined>;
102
103
  /**
103
104
  * Fetch sync block data for a given array of sync block nodes.
@@ -58,7 +58,7 @@ export declare class SourceSyncBlockStoreManager {
58
58
  * Create a bodiedSyncBlock node with empty content to backend
59
59
  * @param attrs attributes Ids of the node
60
60
  */
61
- createBodiedSyncBlockNode(attrs: SyncBlockAttrs): void;
61
+ createBodiedSyncBlockNode(attrs: SyncBlockAttrs, nodeData?: PMNode): void;
62
62
  private setPendingDeletion;
63
63
  private delete;
64
64
  isRetryingDeletion(): boolean;
package/package.json CHANGED
@@ -78,7 +78,7 @@
78
78
  }
79
79
  },
80
80
  "name": "@atlaskit/editor-synced-block-provider",
81
- "version": "3.14.3",
81
+ "version": "3.14.5",
82
82
  "description": "Synced Block Provider for @atlaskit/editor-plugin-synced-block",
83
83
  "author": "Atlassian Pty Ltd",
84
84
  "license": "Apache-2.0",