@atlaskit/editor-synced-block-provider 3.14.4 → 3.14.6

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,22 @@
1
1
  # @atlaskit/editor-synced-block-provider
2
2
 
3
+ ## 3.14.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`faddbf566c913`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/faddbf566c913) -
8
+ [ux] Add error message in reference sync block when source is unpublished
9
+ - Updated dependencies
10
+
11
+ ## 3.14.5
12
+
13
+ ### Patch Changes
14
+
15
+ - [`f11ff647ea458`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f11ff647ea458) -
16
+ [ux] [EDITOR-4521] Implement source deleted reference UI, update block deleted/unsynced reference
17
+ UI to add delete button, unsynced label and source title/url
18
+ - Updated dependencies
19
+
3
20
  ## 3.14.4
4
21
 
5
22
  ### Patch Changes
@@ -16,5 +16,6 @@ var SyncBlockError = exports.SyncBlockError = /*#__PURE__*/function (SyncBlockEr
16
16
  SyncBlockError["InvalidContent"] = "invalid_content";
17
17
  // content is not a valid JSON
18
18
  SyncBlockError["Offline"] = "offline";
19
+ SyncBlockError["Unpublished"] = "unpublished";
19
20
  return SyncBlockError;
20
21
  }({});
@@ -209,7 +209,7 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
209
209
  key: "fetchData",
210
210
  value: function () {
211
211
  var _fetchData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(resourceId) {
212
- var blockAri, blockContentResponse, value, syncedBlockData;
212
+ var blockAri, blockContentResponse, content, sourceAri, deletionReason, blockInstanceId, contentUpdatedAt, product, status, syncedBlockData;
213
213
  return _regenerator.default.wrap(function _callee2$(_context2) {
214
214
  while (1) switch (_context2.prev = _context2.next) {
215
215
  case 0:
@@ -225,32 +225,33 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
225
225
  });
226
226
  case 4:
227
227
  blockContentResponse = _context2.sent;
228
- value = blockContentResponse.content;
229
- 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) {
230
230
  _context2.next = 8;
231
231
  break;
232
232
  }
233
233
  return _context2.abrupt("return", {
234
234
  error: {
235
235
  type: _types.SyncBlockError.NotFound,
236
- reason: blockContentResponse.deletionReason
236
+ reason: deletionReason,
237
+ sourceAri: sourceAri
237
238
  },
238
239
  resourceId: resourceId
239
240
  });
240
241
  case 8:
241
242
  // Parse the synced block content from the response's content
242
- syncedBlockData = JSON.parse(value);
243
+ syncedBlockData = JSON.parse(content);
243
244
  return _context2.abrupt("return", {
244
245
  data: {
245
246
  content: syncedBlockData,
246
247
  resourceId: blockAri,
247
- blockInstanceId: blockContentResponse.blockInstanceId,
248
+ blockInstanceId: blockInstanceId,
248
249
  // this was the node's localId, but has become the resourceId.
249
- contentUpdatedAt: (0, _utils.convertContentUpdatedAt)(blockContentResponse.contentUpdatedAt),
250
- sourceAri: blockContentResponse.sourceAri,
251
- product: blockContentResponse.product,
252
- status: blockContentResponse.status,
253
- deletionReason: blockContentResponse.deletionReason
250
+ contentUpdatedAt: (0, _utils.convertContentUpdatedAt)(contentUpdatedAt),
251
+ sourceAri: sourceAri,
252
+ product: product,
253
+ status: status,
254
+ deletionReason: deletionReason
254
255
  },
255
256
  resourceId: resourceId
256
257
  });
@@ -371,7 +372,7 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
371
372
  value: (function () {
372
373
  var _batchFetchData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(blockNodeIdentifiers) {
373
374
  var _this2 = this;
374
- 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;
375
376
  return _regenerator.default.wrap(function _callee4$(_context4) {
376
377
  while (1) switch (_context4.prev = _context4.next) {
377
378
  case 0:
@@ -432,32 +433,33 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
432
433
  return _context4.abrupt("continue", 25);
433
434
  case 19:
434
435
  processedResourceIds.add(resourceId);
435
- value = blockContentResponse.content;
436
- 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) {
437
438
  _context4.next = 24;
438
439
  break;
439
440
  }
440
441
  results.push({
441
442
  error: {
442
443
  type: _types.SyncBlockError.NotFound,
443
- reason: blockContentResponse.deletionReason
444
+ reason: deletionReason,
445
+ sourceAri: sourceAri
444
446
  },
445
447
  resourceId: resourceId
446
448
  });
447
449
  return _context4.abrupt("continue", 25);
448
450
  case 24:
449
451
  try {
450
- syncedBlockData = JSON.parse(value);
452
+ syncedBlockData = JSON.parse(content);
451
453
  results.push({
452
454
  data: {
453
455
  content: syncedBlockData,
454
- resourceId: blockContentResponse.blockAri,
455
- contentUpdatedAt: (0, _utils.convertContentUpdatedAt)(blockContentResponse.contentUpdatedAt),
456
- blockInstanceId: blockContentResponse.blockInstanceId,
457
- sourceAri: blockContentResponse.sourceAri,
458
- product: blockContentResponse.product,
459
- status: blockContentResponse.status,
460
- 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
461
463
  },
462
464
  resourceId: resourceId
463
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) {
@@ -10,5 +10,6 @@ export let SyncBlockError = /*#__PURE__*/function (SyncBlockError) {
10
10
  SyncBlockError["InvalidContent"] = "invalid_content";
11
11
  // content is not a valid JSON
12
12
  SyncBlockError["Offline"] = "offline";
13
+ SyncBlockError["Unpublished"] = "unpublished";
13
14
  return SyncBlockError;
14
15
  }({});
@@ -176,30 +176,39 @@ class BlockServiceADFFetchProvider {
176
176
  blockAri,
177
177
  documentAri: this.parentAri
178
178
  });
179
- const value = blockContentResponse.content;
180
- if (!value) {
179
+ const {
180
+ content,
181
+ sourceAri,
182
+ deletionReason,
183
+ blockInstanceId,
184
+ contentUpdatedAt,
185
+ product,
186
+ status
187
+ } = blockContentResponse;
188
+ if (!content) {
181
189
  return {
182
190
  error: {
183
191
  type: SyncBlockError.NotFound,
184
- reason: blockContentResponse.deletionReason
192
+ reason: deletionReason,
193
+ sourceAri
185
194
  },
186
195
  resourceId
187
196
  };
188
197
  }
189
198
 
190
199
  // Parse the synced block content from the response's content
191
- const syncedBlockData = JSON.parse(value);
200
+ const syncedBlockData = JSON.parse(content);
192
201
  return {
193
202
  data: {
194
203
  content: syncedBlockData,
195
204
  resourceId: blockAri,
196
- blockInstanceId: blockContentResponse.blockInstanceId,
205
+ blockInstanceId: blockInstanceId,
197
206
  // this was the node's localId, but has become the resourceId.
198
- contentUpdatedAt: convertContentUpdatedAt(blockContentResponse.contentUpdatedAt),
199
- sourceAri: blockContentResponse.sourceAri,
200
- product: blockContentResponse.product,
201
- status: blockContentResponse.status,
202
- deletionReason: blockContentResponse.deletionReason
207
+ contentUpdatedAt: convertContentUpdatedAt(contentUpdatedAt),
208
+ sourceAri: sourceAri,
209
+ product: product,
210
+ status: status,
211
+ deletionReason: deletionReason
203
212
  },
204
213
  resourceId
205
214
  };
@@ -314,29 +323,39 @@ class BlockServiceADFFetchProvider {
314
323
  continue;
315
324
  }
316
325
  processedResourceIds.add(resourceId);
317
- const value = blockContentResponse.content;
318
- 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) {
319
337
  results.push({
320
338
  error: {
321
339
  type: SyncBlockError.NotFound,
322
- reason: blockContentResponse.deletionReason
340
+ reason: deletionReason,
341
+ sourceAri
323
342
  },
324
343
  resourceId
325
344
  });
326
345
  continue;
327
346
  }
328
347
  try {
329
- const syncedBlockData = JSON.parse(value);
348
+ const syncedBlockData = JSON.parse(content);
330
349
  results.push({
331
350
  data: {
332
351
  content: syncedBlockData,
333
- resourceId: blockContentResponse.blockAri,
334
- contentUpdatedAt: convertContentUpdatedAt(blockContentResponse.contentUpdatedAt),
335
- blockInstanceId: blockContentResponse.blockInstanceId,
336
- sourceAri: blockContentResponse.sourceAri,
337
- product: blockContentResponse.product,
338
- status: blockContentResponse.status,
339
- 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
340
359
  },
341
360
  resourceId
342
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
@@ -10,5 +10,6 @@ export var SyncBlockError = /*#__PURE__*/function (SyncBlockError) {
10
10
  SyncBlockError["InvalidContent"] = "invalid_content";
11
11
  // content is not a valid JSON
12
12
  SyncBlockError["Offline"] = "offline";
13
+ SyncBlockError["Unpublished"] = "unpublished";
13
14
  return SyncBlockError;
14
15
  }({});
@@ -203,7 +203,7 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
203
203
  key: "fetchData",
204
204
  value: function () {
205
205
  var _fetchData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(resourceId) {
206
- var blockAri, blockContentResponse, value, syncedBlockData;
206
+ var blockAri, blockContentResponse, content, sourceAri, deletionReason, blockInstanceId, contentUpdatedAt, product, status, syncedBlockData;
207
207
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
208
208
  while (1) switch (_context2.prev = _context2.next) {
209
209
  case 0:
@@ -219,32 +219,33 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
219
219
  });
220
220
  case 4:
221
221
  blockContentResponse = _context2.sent;
222
- value = blockContentResponse.content;
223
- 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) {
224
224
  _context2.next = 8;
225
225
  break;
226
226
  }
227
227
  return _context2.abrupt("return", {
228
228
  error: {
229
229
  type: SyncBlockError.NotFound,
230
- reason: blockContentResponse.deletionReason
230
+ reason: deletionReason,
231
+ sourceAri: sourceAri
231
232
  },
232
233
  resourceId: resourceId
233
234
  });
234
235
  case 8:
235
236
  // Parse the synced block content from the response's content
236
- syncedBlockData = JSON.parse(value);
237
+ syncedBlockData = JSON.parse(content);
237
238
  return _context2.abrupt("return", {
238
239
  data: {
239
240
  content: syncedBlockData,
240
241
  resourceId: blockAri,
241
- blockInstanceId: blockContentResponse.blockInstanceId,
242
+ blockInstanceId: blockInstanceId,
242
243
  // this was the node's localId, but has become the resourceId.
243
- contentUpdatedAt: convertContentUpdatedAt(blockContentResponse.contentUpdatedAt),
244
- sourceAri: blockContentResponse.sourceAri,
245
- product: blockContentResponse.product,
246
- status: blockContentResponse.status,
247
- deletionReason: blockContentResponse.deletionReason
244
+ contentUpdatedAt: convertContentUpdatedAt(contentUpdatedAt),
245
+ sourceAri: sourceAri,
246
+ product: product,
247
+ status: status,
248
+ deletionReason: deletionReason
248
249
  },
249
250
  resourceId: resourceId
250
251
  });
@@ -365,7 +366,7 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
365
366
  value: (function () {
366
367
  var _batchFetchData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(blockNodeIdentifiers) {
367
368
  var _this2 = this;
368
- 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;
369
370
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
370
371
  while (1) switch (_context4.prev = _context4.next) {
371
372
  case 0:
@@ -426,32 +427,33 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
426
427
  return _context4.abrupt("continue", 25);
427
428
  case 19:
428
429
  processedResourceIds.add(resourceId);
429
- value = blockContentResponse.content;
430
- 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) {
431
432
  _context4.next = 24;
432
433
  break;
433
434
  }
434
435
  results.push({
435
436
  error: {
436
437
  type: SyncBlockError.NotFound,
437
- reason: blockContentResponse.deletionReason
438
+ reason: deletionReason,
439
+ sourceAri: sourceAri
438
440
  },
439
441
  resourceId: resourceId
440
442
  });
441
443
  return _context4.abrupt("continue", 25);
442
444
  case 24:
443
445
  try {
444
- syncedBlockData = JSON.parse(value);
446
+ syncedBlockData = JSON.parse(content);
445
447
  results.push({
446
448
  data: {
447
449
  content: syncedBlockData,
448
- resourceId: blockContentResponse.blockAri,
449
- contentUpdatedAt: convertContentUpdatedAt(blockContentResponse.contentUpdatedAt),
450
- blockInstanceId: blockContentResponse.blockInstanceId,
451
- sourceAri: blockContentResponse.sourceAri,
452
- product: blockContentResponse.product,
453
- status: blockContentResponse.status,
454
- 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
455
457
  },
456
458
  resourceId: resourceId
457
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) {
@@ -24,7 +24,8 @@ export declare enum SyncBlockError {
24
24
  Conflict = "conflict",// attempt to create block that already exists
25
25
  ServerError = "server_error",
26
26
  InvalidContent = "invalid_content",// content is not a valid JSON
27
- Offline = "offline"
27
+ Offline = "offline",
28
+ Unpublished = "unpublished"
28
29
  }
29
30
  export interface SyncBlockData {
30
31
  blockInstanceId: BlockInstanceId;
@@ -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.
@@ -24,7 +24,8 @@ export declare enum SyncBlockError {
24
24
  Conflict = "conflict",// attempt to create block that already exists
25
25
  ServerError = "server_error",
26
26
  InvalidContent = "invalid_content",// content is not a valid JSON
27
- Offline = "offline"
27
+ Offline = "offline",
28
+ Unpublished = "unpublished"
28
29
  }
29
30
  export interface SyncBlockData {
30
31
  blockInstanceId: BlockInstanceId;
@@ -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.
package/package.json CHANGED
@@ -78,7 +78,7 @@
78
78
  }
79
79
  },
80
80
  "name": "@atlaskit/editor-synced-block-provider",
81
- "version": "3.14.4",
81
+ "version": "3.14.6",
82
82
  "description": "Synced Block Provider for @atlaskit/editor-plugin-synced-block",
83
83
  "author": "Atlassian Pty Ltd",
84
84
  "license": "Apache-2.0",