@atlaskit/editor-synced-block-provider 3.26.0 → 3.26.2

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/clients/block-service/blockService.js +9 -14
  3. package/dist/cjs/clients/confluence/sourceInfo.js +3 -35
  4. package/dist/cjs/hooks/useFetchSyncBlockData.js +5 -11
  5. package/dist/cjs/providers/block-service/blockServiceAPI.js +1 -1
  6. package/dist/cjs/providers/syncBlockProvider.js +29 -72
  7. package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +75 -124
  8. package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +125 -120
  9. package/dist/cjs/store-manager/syncBlockStoreManager.js +2 -4
  10. package/dist/cjs/utils/errorHandling.js +2 -5
  11. package/dist/cjs/utils/resolveSyncBlockInstance.js +1 -3
  12. package/dist/cjs/utils/utils.js +5 -6
  13. package/dist/es2019/clients/block-service/blockService.js +5 -9
  14. package/dist/es2019/clients/confluence/sourceInfo.js +1 -4
  15. package/dist/es2019/hooks/useFetchSyncBlockData.js +6 -12
  16. package/dist/es2019/providers/block-service/blockServiceAPI.js +1 -1
  17. package/dist/es2019/providers/syncBlockProvider.js +21 -53
  18. package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +65 -114
  19. package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +125 -119
  20. package/dist/es2019/store-manager/syncBlockStoreManager.js +2 -4
  21. package/dist/es2019/utils/errorHandling.js +1 -4
  22. package/dist/es2019/utils/resolveSyncBlockInstance.js +2 -5
  23. package/dist/es2019/utils/utils.js +5 -6
  24. package/dist/esm/clients/block-service/blockService.js +9 -14
  25. package/dist/esm/clients/confluence/sourceInfo.js +2 -34
  26. package/dist/esm/hooks/useFetchSyncBlockData.js +5 -11
  27. package/dist/esm/providers/block-service/blockServiceAPI.js +1 -1
  28. package/dist/esm/providers/syncBlockProvider.js +29 -72
  29. package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +75 -124
  30. package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +125 -120
  31. package/dist/esm/store-manager/syncBlockStoreManager.js +2 -4
  32. package/dist/esm/utils/errorHandling.js +2 -5
  33. package/dist/esm/utils/resolveSyncBlockInstance.js +1 -3
  34. package/dist/esm/utils/utils.js +5 -6
  35. package/dist/types/clients/confluence/sourceInfo.d.ts +1 -2
  36. package/dist/types/hooks/useFetchSyncBlockData.d.ts +1 -1
  37. package/dist/types/providers/syncBlockProvider.d.ts +1 -1
  38. package/dist/types/providers/types.d.ts +2 -2
  39. package/dist/types/store-manager/sourceSyncBlockStoreManager.d.ts +8 -5
  40. package/dist/types-ts4.5/clients/confluence/sourceInfo.d.ts +1 -2
  41. package/dist/types-ts4.5/hooks/useFetchSyncBlockData.d.ts +1 -1
  42. package/dist/types-ts4.5/providers/syncBlockProvider.d.ts +1 -1
  43. package/dist/types-ts4.5/providers/types.d.ts +2 -2
  44. package/dist/types-ts4.5/store-manager/sourceSyncBlockStoreManager.d.ts +8 -5
  45. package/package.json +2 -5
@@ -520,7 +520,7 @@ class BlockServiceADFWriteProvider {
520
520
  resourceId
521
521
  });
522
522
  const stepVersion = this.getVersion ? await this.getVersion() : undefined;
523
- const status = fg('platform_synced_block_patch_1') ? 'unpublished' : fg('platform_synced_block_dogfooding') ? (_this$isParentUnpubli = this.isParentUnpublished) !== null && _this$isParentUnpubli !== void 0 && _this$isParentUnpubli.call(this) ? 'unpublished' : data.status || 'active' : undefined;
523
+ const status = fg('platform_synced_block_patch_1') ? 'unpublished' : (_this$isParentUnpubli = this.isParentUnpublished) !== null && _this$isParentUnpubli !== void 0 && _this$isParentUnpubli.call(this) ? 'unpublished' : data.status || 'active';
524
524
  try {
525
525
  await createSyncedBlock({
526
526
  blockAri,
@@ -1,6 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { useMemo } from 'react';
3
- import { fg } from '@atlaskit/platform-feature-flags';
4
3
  import { getProductFromSourceAri } from '../clients/block-service/ari';
5
4
  import { getPageIdAndTypeFromConfluencePageAri } from '../clients/confluence/ari';
6
5
  import { fetchConfluencePageInfo } from '../clients/confluence/sourceInfo';
@@ -63,30 +62,11 @@ export class SyncBlockProvider extends SyncBlockDataProvider {
63
62
  if (blockIdentifiers.length === 0) {
64
63
  return [];
65
64
  }
66
- if (fg('platform_synced_block_dogfooding')) {
67
- try {
68
- return await this.fetchProvider.batchFetchData(blockIdentifiers);
69
- } catch {
70
- // If batch fetch fails, fall back to individual fetch behavior
71
- // This allows loading states to be shown before errors, matching non-batch behavior
72
- return Promise.allSettled(blockIdentifiers.map(blockIdentifier => {
73
- return this.fetchProvider.fetchData(blockIdentifier.resourceId).then(data => {
74
- return data;
75
- }, () => {
76
- return {
77
- error: {
78
- type: SyncBlockError.Errored
79
- },
80
- resourceId: blockIdentifier.resourceId
81
- };
82
- });
83
- })).then(results => {
84
- return results.filter(result => {
85
- return result.status === 'fulfilled';
86
- }).map(result => result.value);
87
- });
88
- }
89
- } else {
65
+ try {
66
+ return await this.fetchProvider.batchFetchData(blockIdentifiers);
67
+ } catch {
68
+ // If batch fetch fails, fall back to individual fetch behavior
69
+ // This allows loading states to be shown before errors, matching non-batch behavior
90
70
  return Promise.allSettled(blockIdentifiers.map(blockIdentifier => {
91
71
  return this.fetchProvider.fetchData(blockIdentifier.resourceId).then(data => {
92
72
  return data;
@@ -188,48 +168,36 @@ export class SyncBlockProvider extends SyncBlockDataProvider {
188
168
  * @returns The source info
189
169
  */
190
170
  async fetchSyncBlockSourceInfo(localId, sourceAri, sourceProduct, fireAnalyticsEvent, hasAccess = true, urlType = 'edit', isUnpublished) {
191
- let ari = sourceAri,
192
- product = sourceProduct;
193
- if (fg('platform_synced_block_dogfooding')) {
194
- var _this$writeProvider2;
195
- ari = sourceAri !== null && sourceAri !== void 0 ? sourceAri : (_this$writeProvider2 = this.writeProvider) === null || _this$writeProvider2 === void 0 ? void 0 : _this$writeProvider2.parentAri;
196
- product = sourceProduct !== null && sourceProduct !== void 0 ? sourceProduct : getProductFromSourceAri(ari);
197
- }
171
+ var _this$writeProvider2, _this$writeProvider4;
172
+ const ari = sourceAri !== null && sourceAri !== void 0 ? sourceAri : (_this$writeProvider2 = this.writeProvider) === null || _this$writeProvider2 === void 0 ? void 0 : _this$writeProvider2.parentAri;
173
+ const product = sourceProduct !== null && sourceProduct !== void 0 ? sourceProduct : getProductFromSourceAri(ari);
198
174
  if (!ari || !product) {
199
175
  return Promise.reject(new Error('Source ari or source product is undefined'));
200
176
  }
201
177
  switch (product) {
202
178
  case 'confluence-page':
203
179
  {
204
- const sourceInfo = await fetchConfluencePageInfo(ari, hasAccess, urlType, localId, fireAnalyticsEvent, isUnpublished);
205
- if (fg('platform_synced_block_dogfooding')) {
206
- var _this$writeProvider3;
207
- if (!sourceInfo) {
208
- return Promise.resolve(undefined);
209
- }
210
- return {
211
- ...sourceInfo,
212
- onSameDocument: ((_this$writeProvider3 = this.writeProvider) === null || _this$writeProvider3 === void 0 ? void 0 : _this$writeProvider3.parentAri) === ari,
213
- productType: product
214
- };
215
- } else {
216
- return sourceInfo;
217
- }
218
- }
219
- case 'jira-work-item':
220
- if (fg('platform_synced_block_dogfooding')) {
221
- var _this$writeProvider4;
222
- const sourceInfo = await fetchJiraWorkItemInfo(ari, hasAccess);
180
+ var _this$writeProvider3;
181
+ const sourceInfo = await fetchConfluencePageInfo(ari, hasAccess, urlType, localId, isUnpublished);
223
182
  if (!sourceInfo) {
224
183
  return Promise.resolve(undefined);
225
184
  }
226
185
  return {
227
186
  ...sourceInfo,
228
- onSameDocument: ((_this$writeProvider4 = this.writeProvider) === null || _this$writeProvider4 === void 0 ? void 0 : _this$writeProvider4.parentAri) === ari,
187
+ onSameDocument: ((_this$writeProvider3 = this.writeProvider) === null || _this$writeProvider3 === void 0 ? void 0 : _this$writeProvider3.parentAri) === ari,
229
188
  productType: product
230
189
  };
231
190
  }
232
- return Promise.reject(new Error('Jira work item source product not supported'));
191
+ case 'jira-work-item':
192
+ const sourceInfo = await fetchJiraWorkItemInfo(ari, hasAccess);
193
+ if (!sourceInfo) {
194
+ return Promise.resolve(undefined);
195
+ }
196
+ return {
197
+ ...sourceInfo,
198
+ onSameDocument: ((_this$writeProvider4 = this.writeProvider) === null || _this$writeProvider4 === void 0 ? void 0 : _this$writeProvider4.parentAri) === ari,
199
+ productType: product
200
+ };
233
201
  default:
234
202
  return Promise.reject(new Error(`${product} source product not supported`));
235
203
  }
@@ -171,7 +171,7 @@ export class ReferenceSyncBlockStoreManager {
171
171
  getInitialSyncBlockData(resourceId) {
172
172
  var _this$dataProvider2, _this$dataProvider2$g;
173
173
  const syncBlockNode = createSyncBlockNode('', resourceId);
174
- if (isSSR() && fg('platform_synced_block_dogfooding') || fg('platform_synced_block_patch_1')) {
174
+ if (isSSR() || fg('platform_synced_block_patch_1')) {
175
175
  var _this$dataProvider, _this$dataProvider$ge;
176
176
  // In SSR, prefer data from data provider cache
177
177
  // should not take from store manager cache as it may be in incomplete state
@@ -317,17 +317,13 @@ export class ReferenceSyncBlockStoreManager {
317
317
  }
318
318
  fetchSyncBlockSourceInfo(resourceId) {
319
319
  try {
320
- var _existingSyncBlock$da;
320
+ var _this$fetchSourceInfo, _existingSyncBlock$da;
321
321
  if (!resourceId || !this.dataProvider) {
322
322
  throw new Error('Data provider or resourceId not set');
323
323
  }
324
- if (fg('platform_synced_block_dogfooding')) {
325
- const existingRequest = this.syncBlockSourceInfoRequests.get(resourceId);
326
- if (existingRequest) {
327
- return existingRequest;
328
- }
329
- } else if (this.syncBlockSourceInfoRequestsOld.get(resourceId)) {
330
- return Promise.resolve(undefined);
324
+ const existingRequest = this.syncBlockSourceInfoRequests.get(resourceId);
325
+ if (existingRequest) {
326
+ return existingRequest;
331
327
  }
332
328
  const existingSyncBlock = this.getFromCache(resourceId);
333
329
  if (!existingSyncBlock) {
@@ -344,28 +340,21 @@ export class ReferenceSyncBlockStoreManager {
344
340
  } = existingSyncBlock.data || {};
345
341
  // skip if source URL and title are already present
346
342
  if (sourceURL && sourceTitle) {
347
- if (fg('platform_synced_block_dogfooding')) {
348
- return Promise.resolve({
349
- title: sourceTitle,
350
- url: sourceURL,
351
- subType: sourceSubType,
352
- sourceAri: sourceAri || '',
353
- onSameDocument,
354
- productType: product
355
- });
356
- } else {
357
- return Promise.resolve(undefined);
358
- }
343
+ return Promise.resolve({
344
+ title: sourceTitle,
345
+ url: sourceURL,
346
+ subType: sourceSubType,
347
+ sourceAri: sourceAri || '',
348
+ onSameDocument,
349
+ productType: product
350
+ });
359
351
  }
360
352
  if (!sourceAri || !product || !blockInstanceId) {
361
353
  var _this$fireAnalyticsEv8;
362
354
  (_this$fireAnalyticsEv8 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv8 === void 0 ? void 0 : _this$fireAnalyticsEv8.call(this, getSourceInfoErrorPayload('SourceAri, product or blockInstanceId missing', resourceId));
363
355
  return Promise.resolve(undefined);
364
356
  }
365
- if (fg('platform_synced_block_dogfooding')) {
366
- var _this$fetchSourceInfo;
367
- (_this$fetchSourceInfo = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo === void 0 ? void 0 : _this$fetchSourceInfo.start({});
368
- }
357
+ (_this$fetchSourceInfo = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo === void 0 ? void 0 : _this$fetchSourceInfo.start({});
369
358
 
370
359
  // Only use unpublished endpoint if feature flag is enabled
371
360
  const isUnpublished = fg('platform_synced_block_patch_1') && ((_existingSyncBlock$da = existingSyncBlock.data) === null || _existingSyncBlock$da === void 0 ? void 0 : _existingSyncBlock$da.status) === 'unpublished';
@@ -375,55 +364,40 @@ export class ReferenceSyncBlockStoreManager {
375
364
  // urlType
376
365
  isUnpublished).then(sourceInfo => {
377
366
  if (!sourceInfo) {
378
- if (fg('platform_synced_block_dogfooding')) {
379
- var _this$fetchSourceInfo2, _this$fireAnalyticsEv9;
380
- (_this$fetchSourceInfo2 = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo2 === void 0 ? void 0 : _this$fetchSourceInfo2.failure({
381
- reason: 'No source info returned'
382
- });
383
- (_this$fireAnalyticsEv9 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv9 === void 0 ? void 0 : _this$fireAnalyticsEv9.call(this, getSourceInfoErrorPayload('No source info returned', resourceId));
384
- }
367
+ var _this$fetchSourceInfo2, _this$fireAnalyticsEv9;
368
+ (_this$fetchSourceInfo2 = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo2 === void 0 ? void 0 : _this$fetchSourceInfo2.failure({
369
+ reason: 'No source info returned'
370
+ });
371
+ (_this$fireAnalyticsEv9 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv9 === void 0 ? void 0 : _this$fireAnalyticsEv9.call(this, getSourceInfoErrorPayload('No source info returned', resourceId));
385
372
  return undefined;
386
373
  }
387
374
  this.updateCacheWithSourceInfo(resourceId, sourceInfo);
388
375
  if (sourceInfo.title) {
389
376
  this.updateSourceTitleSubscriptions(resourceId, sourceInfo.title);
390
377
  }
391
- if (fg('platform_synced_block_dogfooding')) {
392
- if (sourceInfo.title && sourceInfo.url) {
393
- var _this$fetchSourceInfo3;
394
- (_this$fetchSourceInfo3 = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo3 === void 0 ? void 0 : _this$fetchSourceInfo3.success();
395
- } else {
396
- var _this$fetchSourceInfo4, _this$fireAnalyticsEv0;
397
- (_this$fetchSourceInfo4 = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo4 === void 0 ? void 0 : _this$fetchSourceInfo4.failure({
398
- reason: 'Missing title or url'
399
- });
400
- (_this$fireAnalyticsEv0 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv0 === void 0 ? void 0 : _this$fireAnalyticsEv0.call(this, getSourceInfoErrorPayload('Missing title or url', resourceId));
401
- }
402
- return sourceInfo;
403
- }
404
- }).catch(error => {
405
- var _this$fireAnalyticsEv1;
406
- if (fg('platform_synced_block_dogfooding')) {
407
- var _this$fetchSourceInfo5;
408
- (_this$fetchSourceInfo5 = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo5 === void 0 ? void 0 : _this$fetchSourceInfo5.failure({
409
- reason: error.message
378
+ if (sourceInfo.title && sourceInfo.url) {
379
+ var _this$fetchSourceInfo3;
380
+ (_this$fetchSourceInfo3 = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo3 === void 0 ? void 0 : _this$fetchSourceInfo3.success();
381
+ } else {
382
+ var _this$fetchSourceInfo4, _this$fireAnalyticsEv0;
383
+ (_this$fetchSourceInfo4 = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo4 === void 0 ? void 0 : _this$fetchSourceInfo4.failure({
384
+ reason: 'Missing title or url'
410
385
  });
386
+ (_this$fireAnalyticsEv0 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv0 === void 0 ? void 0 : _this$fireAnalyticsEv0.call(this, getSourceInfoErrorPayload('Missing title or url', resourceId));
411
387
  }
388
+ return sourceInfo;
389
+ }).catch(error => {
390
+ var _this$fetchSourceInfo5, _this$fireAnalyticsEv1;
391
+ (_this$fetchSourceInfo5 = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo5 === void 0 ? void 0 : _this$fetchSourceInfo5.failure({
392
+ reason: error.message
393
+ });
412
394
  (_this$fireAnalyticsEv1 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv1 === void 0 ? void 0 : _this$fireAnalyticsEv1.call(this, getSourceInfoErrorPayload(error.message, resourceId));
413
395
  return undefined;
414
396
  }).finally(() => {
415
- if (fg('platform_synced_block_dogfooding')) {
416
- this.syncBlockSourceInfoRequests.delete(resourceId);
417
- } else {
418
- this.syncBlockSourceInfoRequestsOld.delete(resourceId);
419
- }
397
+ this.syncBlockSourceInfoRequests.delete(resourceId);
420
398
  });
421
- if (fg('platform_synced_block_dogfooding')) {
422
- this.syncBlockSourceInfoRequests.set(resourceId, sourceInfoPromise);
423
- return sourceInfoPromise;
424
- } else {
425
- this.syncBlockSourceInfoRequestsOld.set(resourceId, true);
426
- }
399
+ this.syncBlockSourceInfoRequests.set(resourceId, sourceInfoPromise);
400
+ return sourceInfoPromise;
427
401
  } catch (error) {
428
402
  var _this$fireAnalyticsEv10;
429
403
  logException(error, {
@@ -440,6 +414,7 @@ export class ReferenceSyncBlockStoreManager {
440
414
  * @returns The fetched sync block data results
441
415
  */
442
416
  async fetchSyncBlocksData(syncBlockNodes) {
417
+ var _this$fetchExperience;
443
418
  if (syncBlockNodes.length === 0) {
444
419
  return;
445
420
  }
@@ -466,10 +441,7 @@ export class ReferenceSyncBlockStoreManager {
466
441
  nodesToFetch.forEach(node => {
467
442
  this.syncBlockFetchDataRequests.set(node.attrs.resourceId, true);
468
443
  });
469
- if (fg('platform_synced_block_dogfooding')) {
470
- var _this$fetchExperience;
471
- (_this$fetchExperience = this.fetchExperience) === null || _this$fetchExperience === void 0 ? void 0 : _this$fetchExperience.start({});
472
- }
444
+ (_this$fetchExperience = this.fetchExperience) === null || _this$fetchExperience === void 0 ? void 0 : _this$fetchExperience.start({});
473
445
  const data = await this.dataProvider.fetchNodesData(nodesToFetch).finally(() => {
474
446
  nodesToFetch.forEach(node => {
475
447
  this.syncBlockFetchDataRequests.delete(node.attrs.resourceId);
@@ -490,7 +462,7 @@ export class ReferenceSyncBlockStoreManager {
490
462
 
491
463
  // Check if this is a newly added unpublished sync block and notify
492
464
  // Only trigger for sync blocks that were just added (not refreshed or loaded on page init)
493
- if (!syncBlockInstance.error && ((_resolvedSyncBlockIns = resolvedSyncBlockInstance.data) === null || _resolvedSyncBlockIns === void 0 ? void 0 : _resolvedSyncBlockIns.status) === 'unpublished' && this.newlyAddedSyncBlocks.has(syncBlockInstance.resourceId) && this.onUnpublishedSyncBlockDetected && fg('platform_synced_block_dogfooding')) {
465
+ if (!syncBlockInstance.error && ((_resolvedSyncBlockIns = resolvedSyncBlockInstance.data) === null || _resolvedSyncBlockIns === void 0 ? void 0 : _resolvedSyncBlockIns.status) === 'unpublished' && this.newlyAddedSyncBlocks.has(syncBlockInstance.resourceId) && this.onUnpublishedSyncBlockDetected) {
494
466
  // Remove from newly added set after checking to prevent duplicate flags
495
467
  this.newlyAddedSyncBlocks.delete(syncBlockInstance.resourceId);
496
468
  this.onUnpublishedSyncBlockDetected(resolvedSyncBlockInstance.resourceId);
@@ -507,7 +479,7 @@ export class ReferenceSyncBlockStoreManager {
507
479
  hasUnexpectedError = true;
508
480
  }
509
481
  return;
510
- } else if (fg('platform_synced_block_dogfooding')) {
482
+ } else {
511
483
  const callbacks = this.subscriptions.get(syncBlockInstance.resourceId);
512
484
  const localIds = callbacks ? Object.keys(callbacks) : [];
513
485
  localIds.forEach(localId => {
@@ -517,21 +489,19 @@ export class ReferenceSyncBlockStoreManager {
517
489
  }
518
490
  this.fetchSyncBlockSourceInfo(resolvedSyncBlockInstance.resourceId);
519
491
  });
520
- if (fg('platform_synced_block_dogfooding')) {
521
- if (hasUnexpectedError) {
522
- var _this$fetchExperience2;
523
- (_this$fetchExperience2 = this.fetchExperience) === null || _this$fetchExperience2 === void 0 ? void 0 : _this$fetchExperience2.failure({
524
- reason: 'Unexpected error during fetch'
525
- });
526
- } else if (hasExpectedError) {
527
- var _this$fetchExperience3;
528
- (_this$fetchExperience3 = this.fetchExperience) === null || _this$fetchExperience3 === void 0 ? void 0 : _this$fetchExperience3.abort({
529
- reason: 'Expected error: NotFound or PermissionDenied'
530
- });
531
- } else {
532
- var _this$fetchExperience4;
533
- (_this$fetchExperience4 = this.fetchExperience) === null || _this$fetchExperience4 === void 0 ? void 0 : _this$fetchExperience4.success();
534
- }
492
+ if (hasUnexpectedError) {
493
+ var _this$fetchExperience2;
494
+ (_this$fetchExperience2 = this.fetchExperience) === null || _this$fetchExperience2 === void 0 ? void 0 : _this$fetchExperience2.failure({
495
+ reason: 'Unexpected error during fetch'
496
+ });
497
+ } else if (hasExpectedError) {
498
+ var _this$fetchExperience3;
499
+ (_this$fetchExperience3 = this.fetchExperience) === null || _this$fetchExperience3 === void 0 ? void 0 : _this$fetchExperience3.abort({
500
+ reason: 'Expected error: NotFound or PermissionDenied'
501
+ });
502
+ } else {
503
+ var _this$fetchExperience4;
504
+ (_this$fetchExperience4 = this.fetchExperience) === null || _this$fetchExperience4 === void 0 ? void 0 : _this$fetchExperience4.success();
535
505
  }
536
506
  }
537
507
  updateCacheWithSourceInfo(resourceId, sourceInfo) {
@@ -636,7 +606,7 @@ export class ReferenceSyncBlockStoreManager {
636
606
 
637
607
  // call the callback immediately if we have cached data
638
608
  const cachedData = fg('platform_synced_block_patch_1') ? // When feature flag is enabled, use dataProvider cache only
639
- (_this$dataProvider7 = this.dataProvider) === null || _this$dataProvider7 === void 0 ? void 0 : (_this$dataProvider7$g = _this$dataProvider7.getNodeDataFromCache(syncBlockNode)) === null || _this$dataProvider7$g === void 0 ? void 0 : _this$dataProvider7$g.data : isSSR() && fg('platform_synced_block_dogfooding') // in SSR, prefer data provider cache
609
+ (_this$dataProvider7 = this.dataProvider) === null || _this$dataProvider7 === void 0 ? void 0 : (_this$dataProvider7$g = _this$dataProvider7.getNodeDataFromCache(syncBlockNode)) === null || _this$dataProvider7$g === void 0 ? void 0 : _this$dataProvider7$g.data : isSSR() // in SSR, prefer data provider cache
640
610
  ? ((_this$dataProvider8 = this.dataProvider) === null || _this$dataProvider8 === void 0 ? void 0 : (_this$dataProvider8$g = _this$dataProvider8.getNodeDataFromCache(syncBlockNode)) === null || _this$dataProvider8$g === void 0 ? void 0 : _this$dataProvider8$g.data) || this.getFromCache(resourceId) : this.getFromCache(resourceId) || ((_this$dataProvider9 = this.dataProvider) === null || _this$dataProvider9 === void 0 ? void 0 : (_this$dataProvider9$g = _this$dataProvider9.getNodeDataFromCache(syncBlockNode)) === null || _this$dataProvider9$g === void 0 ? void 0 : _this$dataProvider9$g.data);
641
611
  if (cachedData) {
642
612
  callback(cachedData);
@@ -812,9 +782,6 @@ export class ReferenceSyncBlockStoreManager {
812
782
  return providerFactory;
813
783
  }
814
784
  getSSRProviders(resourceId) {
815
- if (!fg('platform_synced_block_dogfooding')) {
816
- return null;
817
- }
818
785
  if (!this.dataProvider) {
819
786
  return null;
820
787
  }
@@ -920,6 +887,7 @@ export class ReferenceSyncBlockStoreManager {
920
887
  }
921
888
  let success = true;
922
889
  try {
890
+ var _this$saveExperience;
923
891
  const blocks = [];
924
892
 
925
893
  // Collect all reference synced blocks on the current document
@@ -931,14 +899,6 @@ export class ReferenceSyncBlockStoreManager {
931
899
  });
932
900
  });
933
901
  });
934
- if (!fg('platform_synced_block_dogfooding')) {
935
- // It's possible that the last reference block on the document was just deleted,
936
- // we still want to write to BE to update reference count
937
- if (blocks.length === 0) {
938
- this.isCacheDirty = false;
939
- return true;
940
- }
941
- }
942
902
  if (!this.dataProvider) {
943
903
  throw new Error('Data provider not set');
944
904
  }
@@ -949,40 +909,31 @@ export class ReferenceSyncBlockStoreManager {
949
909
  // is still making changes, the new changes might not be saved if they all happen
950
910
  // exactly at a time when the updateReferenceData is being executed asynchronously.
951
911
  this.isCacheDirty = false;
952
- if (fg('platform_synced_block_dogfooding')) {
953
- var _this$saveExperience;
954
- (_this$saveExperience = this.saveExperience) === null || _this$saveExperience === void 0 ? void 0 : _this$saveExperience.start();
955
- }
912
+ (_this$saveExperience = this.saveExperience) === null || _this$saveExperience === void 0 ? void 0 : _this$saveExperience.start();
956
913
  const updateResult = await this.dataProvider.updateReferenceData(blocks);
957
914
  if (!updateResult.success) {
958
- var _this$fireAnalyticsEv19;
915
+ var _this$saveExperience2, _this$fireAnalyticsEv19;
959
916
  success = false;
960
- if (fg('platform_synced_block_dogfooding')) {
961
- var _this$saveExperience2;
962
- (_this$saveExperience2 = this.saveExperience) === null || _this$saveExperience2 === void 0 ? void 0 : _this$saveExperience2.failure({
963
- reason: updateResult.error || 'Failed to update reference synced blocks on the document'
964
- });
965
- }
917
+ (_this$saveExperience2 = this.saveExperience) === null || _this$saveExperience2 === void 0 ? void 0 : _this$saveExperience2.failure({
918
+ reason: updateResult.error || 'Failed to update reference synced blocks on the document'
919
+ });
966
920
  (_this$fireAnalyticsEv19 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv19 === void 0 ? void 0 : _this$fireAnalyticsEv19.call(this, updateReferenceErrorPayload(updateResult.error || 'Failed to update reference synced blocks on the document'));
967
921
  }
968
922
  } catch (error) {
969
- var _this$fireAnalyticsEv20;
923
+ var _this$saveExperience3, _this$fireAnalyticsEv20;
970
924
  success = false;
971
925
  logException(error, {
972
926
  location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
973
927
  });
974
- if (fg('platform_synced_block_dogfooding')) {
975
- var _this$saveExperience3;
976
- (_this$saveExperience3 = this.saveExperience) === null || _this$saveExperience3 === void 0 ? void 0 : _this$saveExperience3.failure({
977
- reason: error.message
978
- });
979
- }
928
+ (_this$saveExperience3 = this.saveExperience) === null || _this$saveExperience3 === void 0 ? void 0 : _this$saveExperience3.failure({
929
+ reason: error.message
930
+ });
980
931
  (_this$fireAnalyticsEv20 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv20 === void 0 ? void 0 : _this$fireAnalyticsEv20.call(this, updateReferenceErrorPayload(error.message));
981
932
  } finally {
982
933
  if (!success) {
983
934
  // set isCacheDirty back to true for cases where it failed to update the reference synced blocks on the BE
984
935
  this.isCacheDirty = true;
985
- } else if (fg('platform_synced_block_dogfooding')) {
936
+ } else {
986
937
  var _this$saveExperience4;
987
938
  (_this$saveExperience4 = this.saveExperience) === null || _this$saveExperience4 === void 0 ? void 0 : _this$saveExperience4.success();
988
939
  }