@atlaskit/editor-synced-block-provider 6.6.2 → 6.6.3

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 (36) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cjs/clients/jira/sourceInfo.js +18 -40
  3. package/dist/cjs/entry-points/utils.js +0 -6
  4. package/dist/cjs/hooks/useFetchSyncBlockData.js +1 -1
  5. package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +4 -7
  6. package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +14 -14
  7. package/dist/cjs/store-manager/syncBlockBatchFetcher.js +1 -1
  8. package/dist/cjs/store-manager/syncBlockProviderFactoryManager.js +3 -3
  9. package/dist/cjs/store-manager/syncBlockStoreManager.js +1 -1
  10. package/dist/cjs/store-manager/syncBlockSubscriptionManager.js +3 -6
  11. package/dist/cjs/utils/utils.js +1 -13
  12. package/dist/es2019/clients/jira/sourceInfo.js +27 -48
  13. package/dist/es2019/entry-points/utils.js +1 -1
  14. package/dist/es2019/hooks/useFetchSyncBlockData.js +2 -2
  15. package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +5 -8
  16. package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +15 -15
  17. package/dist/es2019/store-manager/syncBlockBatchFetcher.js +2 -2
  18. package/dist/es2019/store-manager/syncBlockProviderFactoryManager.js +4 -4
  19. package/dist/es2019/store-manager/syncBlockStoreManager.js +2 -2
  20. package/dist/es2019/store-manager/syncBlockSubscriptionManager.js +4 -7
  21. package/dist/es2019/utils/utils.js +0 -10
  22. package/dist/esm/clients/jira/sourceInfo.js +19 -40
  23. package/dist/esm/entry-points/utils.js +1 -1
  24. package/dist/esm/hooks/useFetchSyncBlockData.js +2 -2
  25. package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +5 -8
  26. package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +15 -15
  27. package/dist/esm/store-manager/syncBlockBatchFetcher.js +2 -2
  28. package/dist/esm/store-manager/syncBlockProviderFactoryManager.js +4 -4
  29. package/dist/esm/store-manager/syncBlockStoreManager.js +2 -2
  30. package/dist/esm/store-manager/syncBlockSubscriptionManager.js +4 -7
  31. package/dist/esm/utils/utils.js +0 -12
  32. package/dist/types/entry-points/utils.d.ts +1 -1
  33. package/dist/types/utils/utils.d.ts +0 -1
  34. package/dist/types-ts4.5/entry-points/utils.d.ts +1 -1
  35. package/dist/types-ts4.5/utils/utils.d.ts +0 -1
  36. package/package.json +1 -6
@@ -1,12 +1,11 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import isEqual from 'lodash/isEqual';
3
3
  import { logException } from '@atlaskit/editor-common/monitoring';
4
- import { fg } from '@atlaskit/platform-feature-flags';
5
4
  import { SyncBlockError } from '../common/types';
6
5
  import { fetchErrorPayload, fetchSuccessPayload, getSourceInfoErrorPayload, updateReferenceErrorPayload } from '../utils/errorHandling';
7
6
  import { getFetchExperience, getFetchSourceInfoExperience, getSaveReferenceExperience } from '../utils/experienceTracking';
8
7
  import { resolveSyncBlockInstance } from '../utils/resolveSyncBlockInstance';
9
- import { createSyncBlockNode, getSourceProductFromResourceIdSafe, productAttrIfGateOn } from '../utils/utils';
8
+ import { createSyncBlockNode, getSourceProductFromResourceIdSafe } from '../utils/utils';
10
9
  import { SyncBlockBatchFetcher } from './syncBlockBatchFetcher';
11
10
  import { syncBlockInMemorySessionCache } from './syncBlockInMemorySessionCache';
12
11
  import { SyncBlockProviderFactoryManager } from './syncBlockProviderFactoryManager';
@@ -237,7 +236,7 @@ export class ReferenceSyncBlockStoreManager {
237
236
  // Derive once per call so we don't re-parse on every analytics event below.
238
237
  // `product` from cached data is preferred when available; fall back to parsing
239
238
  // the resourceId.
240
- const sourceProduct = fg('platform_synced_block_patch_11') ? product !== null && product !== void 0 ? product : getSourceProductFromResourceIdSafe(resourceId) : undefined;
239
+ const sourceProduct = product !== null && product !== void 0 ? product : getSourceProductFromResourceIdSafe(resourceId);
241
240
  if (!sourceAri || !product || !blockInstanceId) {
242
241
  var _this$fireAnalyticsEv3;
243
242
  (_this$fireAnalyticsEv3 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv3 === void 0 ? void 0 : _this$fireAnalyticsEv3.call(this, getSourceInfoErrorPayload('SourceAri, product or blockInstanceId missing', resourceId, sourceProduct));
@@ -286,7 +285,7 @@ export class ReferenceSyncBlockStoreManager {
286
285
  logException(error, {
287
286
  location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
288
287
  });
289
- (_this$fireAnalyticsEv7 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv7 === void 0 ? void 0 : _this$fireAnalyticsEv7.call(this, getSourceInfoErrorPayload(error.message, resourceId, productAttrIfGateOn(resourceId)));
288
+ (_this$fireAnalyticsEv7 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv7 === void 0 ? void 0 : _this$fireAnalyticsEv7.call(this, getSourceInfoErrorPayload(error.message, resourceId, getSourceProductFromResourceIdSafe(resourceId)));
290
289
  }
291
290
  return Promise.resolve(undefined);
292
291
  }
@@ -434,7 +433,7 @@ export class ReferenceSyncBlockStoreManager {
434
433
  }
435
434
  if (syncBlockInstance.error) {
436
435
  var _this$fireAnalyticsEv9, _syncBlockInstance$da, _syncBlockInstance$da2;
437
- (_this$fireAnalyticsEv9 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv9 === void 0 ? void 0 : _this$fireAnalyticsEv9.call(this, fetchErrorPayload(syncBlockInstance.error.reason || syncBlockInstance.error.type, syncBlockInstance.resourceId, fg('platform_synced_block_patch_11') ? (_syncBlockInstance$da = (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.product) !== null && _syncBlockInstance$da !== void 0 ? _syncBlockInstance$da : getSourceProductFromResourceIdSafe(syncBlockInstance.resourceId) : undefined));
436
+ (_this$fireAnalyticsEv9 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv9 === void 0 ? void 0 : _this$fireAnalyticsEv9.call(this, fetchErrorPayload(syncBlockInstance.error.reason || syncBlockInstance.error.type, syncBlockInstance.resourceId, (_syncBlockInstance$da = (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.product) !== null && _syncBlockInstance$da !== void 0 ? _syncBlockInstance$da : getSourceProductFromResourceIdSafe(syncBlockInstance.resourceId)));
438
437
  if (syncBlockInstance.error.type === SyncBlockError.NotFound || syncBlockInstance.error.type === SyncBlockError.Forbidden) {
439
438
  hasExpectedError = true;
440
439
  } else if (syncBlockInstance.error) {
@@ -446,9 +445,7 @@ export class ReferenceSyncBlockStoreManager {
446
445
  const localIds = callbacks ? Object.keys(callbacks) : [];
447
446
  localIds.forEach(localId => {
448
447
  var _this$fireAnalyticsEv0, _syncBlockInstance$da3, _syncBlockInstance$da4;
449
- (_this$fireAnalyticsEv0 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv0 === void 0 ? void 0 : _this$fireAnalyticsEv0.call(this, fetchSuccessPayload(syncBlockInstance.resourceId, localId,
450
- // Prefer cached product when available; fall back to parsing the resourceId.
451
- fg('platform_synced_block_patch_11') ? (_syncBlockInstance$da3 = (_syncBlockInstance$da4 = syncBlockInstance.data) === null || _syncBlockInstance$da4 === void 0 ? void 0 : _syncBlockInstance$da4.product) !== null && _syncBlockInstance$da3 !== void 0 ? _syncBlockInstance$da3 : getSourceProductFromResourceIdSafe(syncBlockInstance.resourceId) : undefined));
448
+ (_this$fireAnalyticsEv0 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv0 === void 0 ? void 0 : _this$fireAnalyticsEv0.call(this, fetchSuccessPayload(syncBlockInstance.resourceId, localId, (_syncBlockInstance$da3 = (_syncBlockInstance$da4 = syncBlockInstance.data) === null || _syncBlockInstance$da4 === void 0 ? void 0 : _syncBlockInstance$da4.product) !== null && _syncBlockInstance$da3 !== void 0 ? _syncBlockInstance$da3 : getSourceProductFromResourceIdSafe(syncBlockInstance.resourceId)));
452
449
  });
453
450
  this.fetchSyncBlockSourceInfo(resolvedSyncBlockInstance.resourceId);
454
451
  });
@@ -3,7 +3,7 @@ import { logException } from '@atlaskit/editor-common/monitoring';
3
3
  import { SyncBlockError } from '../common/types';
4
4
  import { updateErrorPayload, createErrorPayload, deleteErrorPayload, updateCacheErrorPayload, getSourceInfoErrorPayload, updateSuccessPayload, createSuccessPayload, deleteSuccessPayload, fetchReferencesErrorPayload } from '../utils/errorHandling';
5
5
  import { getCreateSourceExperience, getDeleteSourceExperience, getSaveSourceExperience, getFetchSourceInfoExperience } from '../utils/experienceTracking';
6
- import { convertSyncBlockPMNodeToSyncBlockData, productAttrIfGateOn } from '../utils/utils';
6
+ import { convertSyncBlockPMNodeToSyncBlockData, getSourceProductFromResourceIdSafe } from '../utils/utils';
7
7
  // A store manager responsible for the lifecycle and state management of source sync blocks in an editor instance.
8
8
  // Designed to manage local in-memory state and synchronize with an external data provider.
9
9
  // Supports create, flush, and delete operations for source sync blocks.
@@ -94,7 +94,7 @@ export class SourceSyncBlockStoreManager {
94
94
  });
95
95
  // We can derive the product from `syncBlockNode.attrs.resourceId` even though
96
96
  // the variable wasn't destructured (the destructuring step itself may have thrown).
97
- (_this$fireAnalyticsEv = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv === void 0 ? void 0 : _this$fireAnalyticsEv.call(this, updateCacheErrorPayload(error.message, syncBlockNode === null || syncBlockNode === void 0 ? void 0 : (_syncBlockNode$attrs = syncBlockNode.attrs) === null || _syncBlockNode$attrs === void 0 ? void 0 : _syncBlockNode$attrs.resourceId, productAttrIfGateOn(syncBlockNode === null || syncBlockNode === void 0 ? void 0 : (_syncBlockNode$attrs2 = syncBlockNode.attrs) === null || _syncBlockNode$attrs2 === void 0 ? void 0 : _syncBlockNode$attrs2.resourceId)));
97
+ (_this$fireAnalyticsEv = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv === void 0 ? void 0 : _this$fireAnalyticsEv.call(this, updateCacheErrorPayload(error.message, syncBlockNode === null || syncBlockNode === void 0 ? void 0 : (_syncBlockNode$attrs = syncBlockNode.attrs) === null || _syncBlockNode$attrs === void 0 ? void 0 : _syncBlockNode$attrs.resourceId, getSourceProductFromResourceIdSafe(syncBlockNode === null || syncBlockNode === void 0 ? void 0 : (_syncBlockNode$attrs2 = syncBlockNode.attrs) === null || _syncBlockNode$attrs2 === void 0 ? void 0 : _syncBlockNode$attrs2.resourceId)));
98
98
  return false;
99
99
  }
100
100
  }
@@ -167,7 +167,7 @@ export class SourceSyncBlockStoreManager {
167
167
  if (cachedData && result.status) {
168
168
  cachedData.status = result.status;
169
169
  }
170
- (_this$fireAnalyticsEv2 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv2 === void 0 ? void 0 : _this$fireAnalyticsEv2.call(this, updateSuccessPayload(result.resourceId, false, productAttrIfGateOn(result.resourceId)));
170
+ (_this$fireAnalyticsEv2 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv2 === void 0 ? void 0 : _this$fireAnalyticsEv2.call(this, updateSuccessPayload(result.resourceId, false, getSourceProductFromResourceIdSafe(result.resourceId)));
171
171
  }
172
172
  });
173
173
  return true;
@@ -176,7 +176,7 @@ export class SourceSyncBlockStoreManager {
176
176
  (_this$saveExperience3 = this.saveExperience) === null || _this$saveExperience3 === void 0 ? void 0 : _this$saveExperience3.failure();
177
177
  writeResults.filter(result => !result.resourceId || result.error).forEach(result => {
178
178
  var _this$fireAnalyticsEv3;
179
- (_this$fireAnalyticsEv3 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv3 === void 0 ? void 0 : _this$fireAnalyticsEv3.call(this, updateErrorPayload(result.error || 'Failed to write data', result.resourceId, productAttrIfGateOn(result.resourceId)));
179
+ (_this$fireAnalyticsEv3 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv3 === void 0 ? void 0 : _this$fireAnalyticsEv3.call(this, updateErrorPayload(result.error || 'Failed to write data', result.resourceId, getSourceProductFromResourceIdSafe(result.resourceId)));
180
180
  });
181
181
  return false;
182
182
  }
@@ -239,16 +239,16 @@ export class SourceSyncBlockStoreManager {
239
239
  }
240
240
  } else {
241
241
  var _this$fireAnalyticsEv5;
242
- (_this$fireAnalyticsEv5 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv5 === void 0 ? void 0 : _this$fireAnalyticsEv5.call(this, createErrorPayload('creation complete callback missing', resourceId, productAttrIfGateOn(resourceId)));
242
+ (_this$fireAnalyticsEv5 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv5 === void 0 ? void 0 : _this$fireAnalyticsEv5.call(this, createErrorPayload('creation complete callback missing', resourceId, getSourceProductFromResourceIdSafe(resourceId)));
243
243
  }
244
244
  if (success) {
245
245
  var _this$fireAnalyticsEv6;
246
- (_this$fireAnalyticsEv6 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv6 === void 0 ? void 0 : _this$fireAnalyticsEv6.call(this, createSuccessPayload(resourceId || '', productAttrIfGateOn(resourceId)));
246
+ (_this$fireAnalyticsEv6 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv6 === void 0 ? void 0 : _this$fireAnalyticsEv6.call(this, createSuccessPayload(resourceId || '', getSourceProductFromResourceIdSafe(resourceId)));
247
247
  } else {
248
248
  var _this$fireAnalyticsEv7;
249
249
  // Delete the node from cache if fail to create so it's not flushed to BE
250
250
  this.syncBlockCache.delete(resourceId || '');
251
- (_this$fireAnalyticsEv7 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv7 === void 0 ? void 0 : _this$fireAnalyticsEv7.call(this, createErrorPayload('Fail to create bodied sync block', resourceId, productAttrIfGateOn(resourceId)));
251
+ (_this$fireAnalyticsEv7 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv7 === void 0 ? void 0 : _this$fireAnalyticsEv7.call(this, createErrorPayload('Fail to create bodied sync block', resourceId, getSourceProductFromResourceIdSafe(resourceId)));
252
252
  }
253
253
  }
254
254
  registerConfirmationCallback(callback) {
@@ -324,7 +324,7 @@ export class SourceSyncBlockStoreManager {
324
324
  (_this$createExperienc3 = this.createExperience) === null || _this$createExperienc3 === void 0 ? void 0 : _this$createExperienc3.failure({
325
325
  reason: result.error || 'Failed to create bodied sync block'
326
326
  });
327
- (_this$fireAnalyticsEv8 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv8 === void 0 ? void 0 : _this$fireAnalyticsEv8.call(this, createErrorPayload(result.error || 'Failed to create bodied sync block', resourceId, productAttrIfGateOn(resourceId)));
327
+ (_this$fireAnalyticsEv8 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv8 === void 0 ? void 0 : _this$fireAnalyticsEv8.call(this, createErrorPayload(result.error || 'Failed to create bodied sync block', resourceId, getSourceProductFromResourceIdSafe(resourceId)));
328
328
  }
329
329
  }).catch(error => {
330
330
  var _this$createExperienc4, _this$fireAnalyticsEv9;
@@ -335,7 +335,7 @@ export class SourceSyncBlockStoreManager {
335
335
  (_this$createExperienc4 = this.createExperience) === null || _this$createExperienc4 === void 0 ? void 0 : _this$createExperienc4.failure({
336
336
  reason: error.message
337
337
  });
338
- (_this$fireAnalyticsEv9 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv9 === void 0 ? void 0 : _this$fireAnalyticsEv9.call(this, createErrorPayload(error.message, resourceId, productAttrIfGateOn(resourceId)));
338
+ (_this$fireAnalyticsEv9 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv9 === void 0 ? void 0 : _this$fireAnalyticsEv9.call(this, createErrorPayload(error.message, resourceId, getSourceProductFromResourceIdSafe(resourceId)));
339
339
  });
340
340
  } catch (error) {
341
341
  var _this$fireAnalyticsEv0;
@@ -345,7 +345,7 @@ export class SourceSyncBlockStoreManager {
345
345
  logException(error, {
346
346
  location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
347
347
  });
348
- (_this$fireAnalyticsEv0 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv0 === void 0 ? void 0 : _this$fireAnalyticsEv0.call(this, createErrorPayload(error.message, resourceId, productAttrIfGateOn(resourceId)));
348
+ (_this$fireAnalyticsEv0 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv0 === void 0 ? void 0 : _this$fireAnalyticsEv0.call(this, createErrorPayload(error.message, resourceId, getSourceProductFromResourceIdSafe(resourceId)));
349
349
  }
350
350
  }
351
351
  async delete(syncBlockIds, onDelete, onDeleteCompleted, reason) {
@@ -373,7 +373,7 @@ export class SourceSyncBlockStoreManager {
373
373
  (_this$deleteExperienc2 = this.deleteExperience) === null || _this$deleteExperienc2 === void 0 ? void 0 : _this$deleteExperienc2.success();
374
374
  results.forEach(result => {
375
375
  var _this$fireAnalyticsEv1;
376
- (_this$fireAnalyticsEv1 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv1 === void 0 ? void 0 : _this$fireAnalyticsEv1.call(this, deleteSuccessPayload(result.resourceId, productAttrIfGateOn(result.resourceId)));
376
+ (_this$fireAnalyticsEv1 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv1 === void 0 ? void 0 : _this$fireAnalyticsEv1.call(this, deleteSuccessPayload(result.resourceId, getSourceProductFromResourceIdSafe(result.resourceId)));
377
377
  });
378
378
  } else {
379
379
  var _this$deleteExperienc3;
@@ -384,10 +384,10 @@ export class SourceSyncBlockStoreManager {
384
384
  results.forEach(result => {
385
385
  if (result.success) {
386
386
  var _this$fireAnalyticsEv10;
387
- (_this$fireAnalyticsEv10 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv10 === void 0 ? void 0 : _this$fireAnalyticsEv10.call(this, deleteSuccessPayload(result.resourceId, productAttrIfGateOn(result.resourceId)));
387
+ (_this$fireAnalyticsEv10 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv10 === void 0 ? void 0 : _this$fireAnalyticsEv10.call(this, deleteSuccessPayload(result.resourceId, getSourceProductFromResourceIdSafe(result.resourceId)));
388
388
  } else {
389
389
  var _this$fireAnalyticsEv11;
390
- (_this$fireAnalyticsEv11 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv11 === void 0 ? void 0 : _this$fireAnalyticsEv11.call(this, deleteErrorPayload(result.error || 'Failed to delete synced block', result.resourceId, productAttrIfGateOn(result.resourceId)));
390
+ (_this$fireAnalyticsEv11 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv11 === void 0 ? void 0 : _this$fireAnalyticsEv11.call(this, deleteErrorPayload(result.error || 'Failed to delete synced block', result.resourceId, getSourceProductFromResourceIdSafe(result.resourceId)));
391
391
  }
392
392
  });
393
393
  }
@@ -397,7 +397,7 @@ export class SourceSyncBlockStoreManager {
397
397
  syncBlockIds.forEach(Ids => {
398
398
  var _this$fireAnalyticsEv12;
399
399
  this.setPendingDeletion(Ids, false);
400
- (_this$fireAnalyticsEv12 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv12 === void 0 ? void 0 : _this$fireAnalyticsEv12.call(this, deleteErrorPayload(error.message, Ids.resourceId, productAttrIfGateOn(Ids.resourceId)));
400
+ (_this$fireAnalyticsEv12 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv12 === void 0 ? void 0 : _this$fireAnalyticsEv12.call(this, deleteErrorPayload(error.message, Ids.resourceId, getSourceProductFromResourceIdSafe(Ids.resourceId)));
401
401
  });
402
402
  logException(error, {
403
403
  location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
@@ -572,7 +572,7 @@ export class SourceSyncBlockStoreManager {
572
572
  logException(error, {
573
573
  location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
574
574
  });
575
- (_this$fireAnalyticsEv14 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv14 === void 0 ? void 0 : _this$fireAnalyticsEv14.call(this, fetchReferencesErrorPayload(error.message, resourceId, productAttrIfGateOn(resourceId)));
575
+ (_this$fireAnalyticsEv14 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv14 === void 0 ? void 0 : _this$fireAnalyticsEv14.call(this, fetchReferencesErrorPayload(error.message, resourceId, getSourceProductFromResourceIdSafe(resourceId)));
576
576
  return Promise.resolve({
577
577
  error: SyncBlockError.Errored
578
578
  });
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import rafSchedule from 'raf-schd';
3
3
  import { logException } from '@atlaskit/editor-common/monitoring';
4
4
  import { fetchErrorPayload } from '../utils/errorHandling';
5
- import { createSyncBlockNode, productAttrIfGateOn } from '../utils/utils';
5
+ import { createSyncBlockNode, getSourceProductFromResourceIdSafe } from '../utils/utils';
6
6
  /**
7
7
  * Handles debounced batch-fetching of sync block data via `raf-schd`.
8
8
  * Accumulates resource IDs and flushes them in a single fetch per
@@ -29,7 +29,7 @@ export class SyncBlockBatchFetcher {
29
29
  });
30
30
  resourceIds.forEach(resId => {
31
31
  var _this$deps$getFireAna;
32
- (_this$deps$getFireAna = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna === void 0 ? void 0 : _this$deps$getFireAna(fetchErrorPayload(error.message, resId, productAttrIfGateOn(resId)));
32
+ (_this$deps$getFireAna = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna === void 0 ? void 0 : _this$deps$getFireAna(fetchErrorPayload(error.message, resId, getSourceProductFromResourceIdSafe(resId)));
33
33
  });
34
34
  });
35
35
  });
@@ -3,7 +3,7 @@ import { logException } from '@atlaskit/editor-common/monitoring';
3
3
  import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
4
4
  import { fetchErrorPayload } from '../utils/errorHandling';
5
5
  import { parseResourceId } from '../utils/resourceId';
6
- import { productAttrIfGateOn } from '../utils/utils';
6
+ import { getSourceProductFromResourceIdSafe } from '../utils/utils';
7
7
  /**
8
8
  * Manages creation and caching of ProviderFactory instances used to
9
9
  * render synced block content (media, emoji, smart links, etc.).
@@ -21,7 +21,7 @@ export class SyncBlockProviderFactoryManager {
21
21
  logException(error, {
22
22
  location: 'editor-synced-block-provider/syncBlockProviderFactoryManager'
23
23
  });
24
- (_this$deps$getFireAna = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna === void 0 ? void 0 : _this$deps$getFireAna(fetchErrorPayload(error.message, resourceId, productAttrIfGateOn(resourceId)));
24
+ (_this$deps$getFireAna = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna === void 0 ? void 0 : _this$deps$getFireAna(fetchErrorPayload(error.message, resourceId, getSourceProductFromResourceIdSafe(resourceId)));
25
25
  return undefined;
26
26
  }
27
27
  const {
@@ -55,7 +55,7 @@ export class SyncBlockProviderFactoryManager {
55
55
  logException(error, {
56
56
  location: 'editor-synced-block-provider/syncBlockProviderFactoryManager'
57
57
  });
58
- (_this$deps$getFireAna2 = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna2 === void 0 ? void 0 : _this$deps$getFireAna2(fetchErrorPayload(error.message, resourceId, productAttrIfGateOn(resourceId)));
58
+ (_this$deps$getFireAna2 = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna2 === void 0 ? void 0 : _this$deps$getFireAna2(fetchErrorPayload(error.message, resourceId, getSourceProductFromResourceIdSafe(resourceId)));
59
59
  }
60
60
  }
61
61
  return providerFactory;
@@ -133,7 +133,7 @@ export class SyncBlockProviderFactoryManager {
133
133
  if (!syncBlock.data.sourceAri || !syncBlock.data.product) {
134
134
  var _this$deps$getFireAna3, _syncBlock$data$produ;
135
135
  (_this$deps$getFireAna3 = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna3 === void 0 ? void 0 : _this$deps$getFireAna3(fetchErrorPayload('Sync block source ari or product not found', resourceId, // Prefer cached product when available; fall back to parsing resourceId.
136
- (_syncBlock$data$produ = syncBlock.data.product) !== null && _syncBlock$data$produ !== void 0 ? _syncBlock$data$produ : productAttrIfGateOn(resourceId)));
136
+ (_syncBlock$data$produ = syncBlock.data.product) !== null && _syncBlock$data$produ !== void 0 ? _syncBlock$data$produ : getSourceProductFromResourceIdSafe(resourceId)));
137
137
  return;
138
138
  }
139
139
  const parentInfo = dataProvider.retrieveSyncBlockParentInfo(syncBlock.data.sourceAri, syncBlock.data.product);
@@ -4,7 +4,7 @@ import { getProductFromSourceAri } from '../clients/block-service/ari';
4
4
  import { SyncBlockError } from '../common/types';
5
5
  import { fetchReferencesErrorPayload } from '../utils/errorHandling';
6
6
  import { getFetchReferencesExperience, getFetchSourceInfoExperience } from '../utils/experienceTracking';
7
- import { productAttrIfGateOn } from '../utils/utils';
7
+ import { getSourceProductFromResourceIdSafe } from '../utils/utils';
8
8
  import { ReferenceSyncBlockStoreManager } from './referenceSyncBlockStoreManager';
9
9
  import { SourceSyncBlockStoreManager } from './sourceSyncBlockStoreManager';
10
10
 
@@ -84,7 +84,7 @@ export class SyncBlockStoreManager {
84
84
  logException(error, {
85
85
  location: 'editor-synced-block-provider/syncBlockStoreManager'
86
86
  });
87
- (_this$fireAnalyticsEv = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv === void 0 ? void 0 : _this$fireAnalyticsEv.call(this, fetchReferencesErrorPayload(error.message, resourceId, productAttrIfGateOn(resourceId)));
87
+ (_this$fireAnalyticsEv = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv === void 0 ? void 0 : _this$fireAnalyticsEv.call(this, fetchReferencesErrorPayload(error.message, resourceId, getSourceProductFromResourceIdSafe(resourceId)));
88
88
  return {
89
89
  error: SyncBlockError.Errored
90
90
  };
@@ -1,9 +1,8 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { logException } from '@atlaskit/editor-common/monitoring';
3
- import { fg } from '@atlaskit/platform-feature-flags';
4
3
  import { fetchErrorPayload, fetchSuccessPayload } from '../utils/errorHandling';
5
4
  import { resolveSyncBlockInstance } from '../utils/resolveSyncBlockInstance';
6
- import { getSourceProductFromResourceIdSafe, productAttrIfGateOn } from '../utils/utils';
5
+ import { getSourceProductFromResourceIdSafe } from '../utils/utils';
7
6
  /**
8
7
  * Manages the lifecycle of GraphQL WebSocket subscriptions for sync block
9
8
  * real-time updates, owns the subscriptions and titleSubscriptions maps,
@@ -221,7 +220,7 @@ export class SyncBlockSubscriptionManager {
221
220
  logException(error, {
222
221
  location: 'editor-synced-block-provider/syncBlockSubscriptionManager/graphql-subscription'
223
222
  });
224
- (_this$deps$getFireAna2 = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna2 === void 0 ? void 0 : _this$deps$getFireAna2(fetchErrorPayload(error.message, resourceId, productAttrIfGateOn(resourceId)));
223
+ (_this$deps$getFireAna2 = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna2 === void 0 ? void 0 : _this$deps$getFireAna2(fetchErrorPayload(error.message, resourceId, getSourceProductFromResourceIdSafe(resourceId)));
225
224
  });
226
225
  if (unsubscribe) {
227
226
  this.graphqlSubscriptions.set(resourceId, unsubscribe);
@@ -273,15 +272,13 @@ export class SyncBlockSubscriptionManager {
273
272
  const localIds = callbacks ? Object.keys(callbacks) : [];
274
273
  localIds.forEach(localId => {
275
274
  var _this$deps$getFireAna3, _syncBlockInstance$da, _syncBlockInstance$da2;
276
- (_this$deps$getFireAna3 = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna3 === void 0 ? void 0 : _this$deps$getFireAna3(fetchSuccessPayload(syncBlockInstance.resourceId, localId,
277
- // Prefer cached product when available; fall back to parsing the resourceId.
278
- fg('platform_synced_block_patch_11') ? (_syncBlockInstance$da = (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.product) !== null && _syncBlockInstance$da !== void 0 ? _syncBlockInstance$da : getSourceProductFromResourceIdSafe(syncBlockInstance.resourceId) : undefined));
275
+ (_this$deps$getFireAna3 = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna3 === void 0 ? void 0 : _this$deps$getFireAna3(fetchSuccessPayload(syncBlockInstance.resourceId, localId, (_syncBlockInstance$da = (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.product) !== null && _syncBlockInstance$da !== void 0 ? _syncBlockInstance$da : getSourceProductFromResourceIdSafe(syncBlockInstance.resourceId)));
279
276
  });
280
277
  this.deps.fetchSyncBlockSourceInfo(resolved.resourceId);
281
278
  } else {
282
279
  var _syncBlockInstance$er, _syncBlockInstance$er2, _this$deps$getFireAna4, _syncBlockInstance$da3, _syncBlockInstance$da4;
283
280
  const errorMessage = ((_syncBlockInstance$er = syncBlockInstance.error) === null || _syncBlockInstance$er === void 0 ? void 0 : _syncBlockInstance$er.reason) || ((_syncBlockInstance$er2 = syncBlockInstance.error) === null || _syncBlockInstance$er2 === void 0 ? void 0 : _syncBlockInstance$er2.type);
284
- (_this$deps$getFireAna4 = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna4 === void 0 ? void 0 : _this$deps$getFireAna4(fetchErrorPayload(errorMessage, syncBlockInstance.resourceId, fg('platform_synced_block_patch_11') ? (_syncBlockInstance$da3 = (_syncBlockInstance$da4 = syncBlockInstance.data) === null || _syncBlockInstance$da4 === void 0 ? void 0 : _syncBlockInstance$da4.product) !== null && _syncBlockInstance$da3 !== void 0 ? _syncBlockInstance$da3 : getSourceProductFromResourceIdSafe(syncBlockInstance.resourceId) : undefined));
281
+ (_this$deps$getFireAna4 = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna4 === void 0 ? void 0 : _this$deps$getFireAna4(fetchErrorPayload(errorMessage, syncBlockInstance.resourceId, (_syncBlockInstance$da3 = (_syncBlockInstance$da4 = syncBlockInstance.data) === null || _syncBlockInstance$da4 === void 0 ? void 0 : _syncBlockInstance$da4.product) !== null && _syncBlockInstance$da3 !== void 0 ? _syncBlockInstance$da3 : getSourceProductFromResourceIdSafe(syncBlockInstance.resourceId)));
285
282
  }
286
283
  }
287
284
  }
@@ -1,6 +1,5 @@
1
1
  /* eslint-disable require-unicode-regexp */
2
2
 
3
- import { fg } from '@atlaskit/platform-feature-flags';
4
3
  export const convertSyncBlockPMNodeToSyncBlockData = node => {
5
4
  return {
6
5
  blockInstanceId: node.attrs.localId,
@@ -65,15 +64,6 @@ export const getSourceProductFromResourceIdSafe = resourceId => {
65
64
  return undefined;
66
65
  }
67
66
  };
68
-
69
- /*
70
- * Convenience wrapper around `getSourceProductFromResourceIdSafe` that returns
71
- * `undefined` whenever the `platform_synced_block_patch_11` rollout flag is off.
72
- * Centralised so that the flag name lives in exactly one place — when the flag is
73
- * cleaned up, this function should be deleted in its entirety and call-sites should
74
- * fall back to calling `getSourceProductFromResourceIdSafe` directly.
75
- */
76
- export const productAttrIfGateOn = resourceId => fg('platform_synced_block_patch_11') ? getSourceProductFromResourceIdSafe(resourceId) : undefined;
77
67
  export const convertContentUpdatedAt = contentUpdatedAt => {
78
68
  if (typeof contentUpdatedAt === 'number') {
79
69
  try {
@@ -4,7 +4,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
5
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
6
  /* eslint-disable require-unicode-regexp */
7
- import { fg } from '@atlaskit/platform-feature-flags';
7
+
8
8
  import { fetchWithRetry } from '../../utils/retry';
9
9
  var COMMON_HEADERS = {
10
10
  'Content-Type': 'application/json',
@@ -20,11 +20,9 @@ var GET_SOURCE_INFO_OPERATION_NAME = 'EDITOR_SYNCED_BLOCK_GET_SOURCE_INFO';
20
20
  * @param id - the ID of the work item
21
21
  * @returns url of the work item
22
22
  */
23
- // `issueType` is requested unconditionally because GraphQL field selection cannot be
24
- // gated at the network layer without a separate operation; AGG ignores unknown
25
- // front-end gating. The runtime mapping into `SyncBlockSourceInfo.issueType` is gated
26
- // by `platform_synced_block_patch_11` below.
27
- var GET_SOURCE_INFO_QUERY = "query ".concat(GET_SOURCE_INFO_OPERATION_NAME, " ($id: ID!) {\n jira {\n issueById(id: $id) {\n id\n webUrl\n summary\n issueType {\n name\n avatar {\n xsmall\n }\n }\n }\n }}");
23
+ // `issueType` is requested alongside `summary` and `webUrl` so the
24
+ // SyncedLocationDropdown can render the correct ADS issue-type icon.
25
+ var GET_SOURCE_INFO_QUERY = "query ".concat(GET_SOURCE_INFO_OPERATION_NAME, " ($id: ID!) {\n jira {\n\tissueById(id: $id) {\n\tid\n\twebUrl\n\tsummary\n\tissueType {\n\t\tname\n\t\tavatar {\n\t\txsmall\n\t\t}\n\t}\n\t}\n }}");
28
26
  var getJiraWorkItemSourceInfo = /*#__PURE__*/function () {
29
27
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(ari) {
30
28
  var bodyData, response;
@@ -135,59 +133,40 @@ var resolveNoAccessWorkItemInfo = /*#__PURE__*/function () {
135
133
  */
136
134
  export var fetchJiraWorkItemInfo = /*#__PURE__*/function () {
137
135
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(workItemAri, hasAccess) {
138
- var _response$data, _contentData$webUrl, _contentData$summary, response, contentData, _rawIssueType$avatar, _webUrl, _summary, rawIssueType, issueTypeName, issueType, webUrl, summary;
136
+ var _response$data, _contentData$issueTyp, _contentData$issueTyp2, response, contentData, webUrl, summary, issueTypeName, issueType;
139
137
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
140
138
  while (1) switch (_context3.prev = _context3.next) {
141
139
  case 0:
142
140
  if (!hasAccess) {
143
- _context3.next = 17;
141
+ _context3.next = 12;
144
142
  break;
145
143
  }
146
144
  _context3.next = 3;
147
145
  return getJiraWorkItemSourceInfo(workItemAri);
148
146
  case 3:
149
147
  response = _context3.sent;
150
- contentData = (_response$data = response.data) === null || _response$data === void 0 || (_response$data = _response$data.jira) === null || _response$data === void 0 ? void 0 : _response$data.issueById; // Defensive narrowing (gated by `platform_synced_block_patch_11`):
151
- // AGG may return `null` (not just omit the field) for `webUrl` / `summary` on
152
- // partially indexed issues. Without these guards, downstream consumers that
153
- // expect `string | undefined` would receive `null` and either crash or render
154
- // the literal string "null". The pre-gate path preserves the legacy behaviour
155
- // so this can be dialled off independently.
156
- if (!fg('platform_synced_block_patch_11')) {
157
- _context3.next = 12;
158
- break;
159
- }
160
- _webUrl = typeof (contentData === null || contentData === void 0 ? void 0 : contentData.webUrl) === 'string' ? contentData.webUrl : undefined;
161
- _summary = typeof (contentData === null || contentData === void 0 ? void 0 : contentData.summary) === 'string' ? contentData.summary : undefined; // Surface issue-type metadata so consumers can render the correct ADS issue-type
162
- // icon. Defensive narrowing mirrors the webUrl/summary treatment above: only
163
- // surfaced when `name` is a non-empty string; AGG values like `{ name: null }`
164
- // collapse back to `undefined`.
165
- rawIssueType = contentData === null || contentData === void 0 ? void 0 : contentData.issueType;
166
- issueTypeName = typeof (rawIssueType === null || rawIssueType === void 0 ? void 0 : rawIssueType.name) === 'string' && rawIssueType.name.length > 0 ? rawIssueType.name : undefined;
167
- issueType = issueTypeName ? {
148
+ contentData = (_response$data = response.data) === null || _response$data === void 0 || (_response$data = _response$data.jira) === null || _response$data === void 0 ? void 0 : _response$data.issueById;
149
+ webUrl = typeof (contentData === null || contentData === void 0 ? void 0 : contentData.webUrl) === 'string' ? contentData.webUrl : undefined;
150
+ summary = typeof (contentData === null || contentData === void 0 ? void 0 : contentData.summary) === 'string' ? contentData.summary : undefined; // Surface issue-type metadata for the SyncedLocationDropdown's ADS icon.
151
+ // Defensive narrowing: only surface when `name` is a non-empty string;
152
+ // AGG values like `{ name: null }` collapse back to `undefined`.
153
+ issueTypeName = contentData === null || contentData === void 0 || (_contentData$issueTyp = contentData.issueType) === null || _contentData$issueTyp === void 0 ? void 0 : _contentData$issueTyp.name;
154
+ issueType = typeof issueTypeName === 'string' && issueTypeName.length > 0 ? {
168
155
  name: issueTypeName,
169
- iconUrl: typeof (rawIssueType === null || rawIssueType === void 0 || (_rawIssueType$avatar = rawIssueType.avatar) === null || _rawIssueType$avatar === void 0 ? void 0 : _rawIssueType$avatar.xsmall) === 'string' ? rawIssueType.avatar.xsmall : undefined
156
+ iconUrl: typeof (contentData === null || contentData === void 0 || (_contentData$issueTyp2 = contentData.issueType) === null || _contentData$issueTyp2 === void 0 || (_contentData$issueTyp2 = _contentData$issueTyp2.avatar) === null || _contentData$issueTyp2 === void 0 ? void 0 : _contentData$issueTyp2.xsmall) === 'string' ? contentData.issueType.avatar.xsmall : undefined
170
157
  } : undefined;
171
158
  return _context3.abrupt("return", Promise.resolve({
172
- url: _webUrl,
159
+ url: webUrl,
173
160
  sourceAri: workItemAri,
174
- title: _summary,
161
+ title: summary,
175
162
  issueType: issueType
176
163
  }));
177
164
  case 12:
178
- webUrl = (_contentData$webUrl = contentData === null || contentData === void 0 ? void 0 : contentData.webUrl) !== null && _contentData$webUrl !== void 0 ? _contentData$webUrl : undefined;
179
- summary = (_contentData$summary = contentData === null || contentData === void 0 ? void 0 : contentData.summary) !== null && _contentData$summary !== void 0 ? _contentData$summary : undefined;
180
- return _context3.abrupt("return", Promise.resolve({
181
- url: webUrl,
182
- sourceAri: workItemAri,
183
- title: summary
184
- }));
185
- case 17:
186
- _context3.next = 19;
165
+ _context3.next = 14;
187
166
  return resolveNoAccessWorkItemInfo(workItemAri);
188
- case 19:
167
+ case 14:
189
168
  return _context3.abrupt("return", _context3.sent);
190
- case 20:
169
+ case 15:
191
170
  case "end":
192
171
  return _context3.stop();
193
172
  }
@@ -1,2 +1,2 @@
1
1
  /* eslint-disable @atlaskit/editor/no-re-export */
2
- export { createSyncBlockNode, convertSyncBlockPMNodeToSyncBlockData, convertSyncBlockJSONNodeToSyncBlockNode, convertPMNodesToSyncBlockNodes, convertPMNodeToSyncBlockNode, convertContentUpdatedAt, getContentIdAndProductFromResourceId, getSourceProductFromResourceIdSafe, productAttrIfGateOn } from '../utils/utils';
2
+ export { createSyncBlockNode, convertSyncBlockPMNodeToSyncBlockData, convertSyncBlockJSONNodeToSyncBlockNode, convertPMNodesToSyncBlockNodes, convertPMNodeToSyncBlockNode, convertContentUpdatedAt, getContentIdAndProductFromResourceId, getSourceProductFromResourceIdSafe } from '../utils/utils';
@@ -9,7 +9,7 @@ import { isSSR } from '@atlaskit/editor-common/core-utils';
9
9
  import { logException } from '@atlaskit/editor-common/monitoring';
10
10
  import { SyncBlockError } from '../common/types';
11
11
  import { fetchErrorPayload } from '../utils/errorHandling';
12
- import { createSyncBlockNode, productAttrIfGateOn } from '../utils/utils';
12
+ import { createSyncBlockNode, getSourceProductFromResourceIdSafe } from '../utils/utils';
13
13
  export var useFetchSyncBlockData = function useFetchSyncBlockData(manager, resourceId, localId, fireAnalyticsEvent) {
14
14
  // Initialize both states from a single cache lookup to avoid race conditions.
15
15
  // When a block is moved/remounted, the old component's cleanup may clear the cache
@@ -71,7 +71,7 @@ export var useFetchSyncBlockData = function useFetchSyncBlockData(manager, resou
71
71
  logException(_context.t0, {
72
72
  location: 'editor-synced-block-provider/useFetchSyncBlockData'
73
73
  });
74
- fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent(fetchErrorPayload(_context.t0.message, resourceId, productAttrIfGateOn(resourceId)));
74
+ fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent(fetchErrorPayload(_context.t0.message, resourceId, getSourceProductFromResourceIdSafe(resourceId)));
75
75
 
76
76
  // Set error state if fetching fails
77
77
  setFetchState({
@@ -11,12 +11,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
11
11
  import _regeneratorRuntime from "@babel/runtime/regenerator";
12
12
  import isEqual from 'lodash/isEqual';
13
13
  import { logException } from '@atlaskit/editor-common/monitoring';
14
- import { fg } from '@atlaskit/platform-feature-flags';
15
14
  import { SyncBlockError } from '../common/types';
16
15
  import { fetchErrorPayload, fetchSuccessPayload, getSourceInfoErrorPayload, updateReferenceErrorPayload } from '../utils/errorHandling';
17
16
  import { getFetchExperience, getFetchSourceInfoExperience, getSaveReferenceExperience } from '../utils/experienceTracking';
18
17
  import { resolveSyncBlockInstance } from '../utils/resolveSyncBlockInstance';
19
- import { createSyncBlockNode, getSourceProductFromResourceIdSafe, productAttrIfGateOn } from '../utils/utils';
18
+ import { createSyncBlockNode, getSourceProductFromResourceIdSafe } from '../utils/utils';
20
19
  import { SyncBlockBatchFetcher } from './syncBlockBatchFetcher';
21
20
  import { syncBlockInMemorySessionCache } from './syncBlockInMemorySessionCache';
22
21
  import { SyncBlockProviderFactoryManager } from './syncBlockProviderFactoryManager';
@@ -311,7 +310,7 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
311
310
  // Derive once per call so we don't re-parse on every analytics event below.
312
311
  // `product` from cached data is preferred when available; fall back to parsing
313
312
  // the resourceId.
314
- var sourceProduct = fg('platform_synced_block_patch_11') ? product !== null && product !== void 0 ? product : getSourceProductFromResourceIdSafe(resourceId) : undefined;
313
+ var sourceProduct = product !== null && product !== void 0 ? product : getSourceProductFromResourceIdSafe(resourceId);
315
314
  if (!sourceAri || !product || !blockInstanceId) {
316
315
  var _this$fireAnalyticsEv3;
317
316
  (_this$fireAnalyticsEv3 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv3 === void 0 || _this$fireAnalyticsEv3.call(this, getSourceInfoErrorPayload('SourceAri, product or blockInstanceId missing', resourceId, sourceProduct));
@@ -360,7 +359,7 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
360
359
  logException(error, {
361
360
  location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
362
361
  });
363
- (_this$fireAnalyticsEv4 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv4 === void 0 || _this$fireAnalyticsEv4.call(this, getSourceInfoErrorPayload(error.message, resourceId, productAttrIfGateOn(resourceId)));
362
+ (_this$fireAnalyticsEv4 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv4 === void 0 || _this$fireAnalyticsEv4.call(this, getSourceInfoErrorPayload(error.message, resourceId, getSourceProductFromResourceIdSafe(resourceId)));
364
363
  }
365
364
  return Promise.resolve(undefined);
366
365
  }
@@ -555,7 +554,7 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
555
554
  }
556
555
  if (syncBlockInstance.error) {
557
556
  var _this5$fireAnalyticsE2, _syncBlockInstance$da, _syncBlockInstance$da2;
558
- (_this5$fireAnalyticsE2 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE2 === void 0 || _this5$fireAnalyticsE2.call(_this5, fetchErrorPayload(syncBlockInstance.error.reason || syncBlockInstance.error.type, syncBlockInstance.resourceId, fg('platform_synced_block_patch_11') ? (_syncBlockInstance$da = (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.product) !== null && _syncBlockInstance$da !== void 0 ? _syncBlockInstance$da : getSourceProductFromResourceIdSafe(syncBlockInstance.resourceId) : undefined));
557
+ (_this5$fireAnalyticsE2 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE2 === void 0 || _this5$fireAnalyticsE2.call(_this5, fetchErrorPayload(syncBlockInstance.error.reason || syncBlockInstance.error.type, syncBlockInstance.resourceId, (_syncBlockInstance$da = (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.product) !== null && _syncBlockInstance$da !== void 0 ? _syncBlockInstance$da : getSourceProductFromResourceIdSafe(syncBlockInstance.resourceId)));
559
558
  if (syncBlockInstance.error.type === SyncBlockError.NotFound || syncBlockInstance.error.type === SyncBlockError.Forbidden) {
560
559
  hasExpectedError = true;
561
560
  } else if (syncBlockInstance.error) {
@@ -567,9 +566,7 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
567
566
  var localIds = callbacks ? Object.keys(callbacks) : [];
568
567
  localIds.forEach(function (localId) {
569
568
  var _this5$fireAnalyticsE3, _syncBlockInstance$da3, _syncBlockInstance$da4;
570
- (_this5$fireAnalyticsE3 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE3 === void 0 || _this5$fireAnalyticsE3.call(_this5, fetchSuccessPayload(syncBlockInstance.resourceId, localId,
571
- // Prefer cached product when available; fall back to parsing the resourceId.
572
- fg('platform_synced_block_patch_11') ? (_syncBlockInstance$da3 = (_syncBlockInstance$da4 = syncBlockInstance.data) === null || _syncBlockInstance$da4 === void 0 ? void 0 : _syncBlockInstance$da4.product) !== null && _syncBlockInstance$da3 !== void 0 ? _syncBlockInstance$da3 : getSourceProductFromResourceIdSafe(syncBlockInstance.resourceId) : undefined));
569
+ (_this5$fireAnalyticsE3 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE3 === void 0 || _this5$fireAnalyticsE3.call(_this5, fetchSuccessPayload(syncBlockInstance.resourceId, localId, (_syncBlockInstance$da3 = (_syncBlockInstance$da4 = syncBlockInstance.data) === null || _syncBlockInstance$da4 === void 0 ? void 0 : _syncBlockInstance$da4.product) !== null && _syncBlockInstance$da3 !== void 0 ? _syncBlockInstance$da3 : getSourceProductFromResourceIdSafe(syncBlockInstance.resourceId)));
573
570
  });
574
571
  _this5.fetchSyncBlockSourceInfo(resolvedSyncBlockInstance.resourceId);
575
572
  });