@atlaskit/editor-synced-block-provider 3.31.2 → 3.31.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 (54) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/clients/block-service/blockService.js +20 -21
  3. package/dist/cjs/clients/confluence/fetchMediaToken.js +1 -2
  4. package/dist/cjs/clients/confluence/sourceInfo.js +27 -176
  5. package/dist/cjs/hooks/useFetchSyncBlockData.js +2 -9
  6. package/dist/cjs/hooks/useFetchSyncBlockTitle.js +8 -40
  7. package/dist/cjs/providers/block-service/blockServiceAPI.js +11 -27
  8. package/dist/cjs/providers/syncBlockProvider.js +22 -51
  9. package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +14 -29
  10. package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +1 -1
  11. package/dist/cjs/store-manager/syncBlockStoreManager.js +3 -15
  12. package/dist/cjs/store-manager/syncBlockSubscriptionManager.js +2 -2
  13. package/dist/cjs/utils/errorHandling.js +1 -10
  14. package/dist/cjs/utils/resolveSyncBlockInstance.js +11 -12
  15. package/dist/cjs/utils/retry.js +2 -23
  16. package/dist/es2019/clients/block-service/blockService.js +20 -21
  17. package/dist/es2019/clients/confluence/fetchMediaToken.js +1 -2
  18. package/dist/es2019/clients/confluence/sourceInfo.js +8 -126
  19. package/dist/es2019/hooks/useFetchSyncBlockData.js +1 -9
  20. package/dist/es2019/hooks/useFetchSyncBlockTitle.js +4 -33
  21. package/dist/es2019/providers/block-service/blockServiceAPI.js +11 -27
  22. package/dist/es2019/providers/syncBlockProvider.js +7 -29
  23. package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +27 -41
  24. package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +1 -1
  25. package/dist/es2019/store-manager/syncBlockStoreManager.js +3 -13
  26. package/dist/es2019/store-manager/syncBlockSubscriptionManager.js +2 -2
  27. package/dist/es2019/utils/errorHandling.js +1 -10
  28. package/dist/es2019/utils/resolveSyncBlockInstance.js +11 -12
  29. package/dist/es2019/utils/retry.js +2 -21
  30. package/dist/esm/clients/block-service/blockService.js +20 -21
  31. package/dist/esm/clients/confluence/fetchMediaToken.js +1 -2
  32. package/dist/esm/clients/confluence/sourceInfo.js +25 -176
  33. package/dist/esm/hooks/useFetchSyncBlockData.js +2 -9
  34. package/dist/esm/hooks/useFetchSyncBlockTitle.js +8 -40
  35. package/dist/esm/providers/block-service/blockServiceAPI.js +11 -27
  36. package/dist/esm/providers/syncBlockProvider.js +22 -51
  37. package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +14 -29
  38. package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +1 -1
  39. package/dist/esm/store-manager/syncBlockStoreManager.js +3 -15
  40. package/dist/esm/store-manager/syncBlockSubscriptionManager.js +2 -2
  41. package/dist/esm/utils/errorHandling.js +1 -10
  42. package/dist/esm/utils/resolveSyncBlockInstance.js +11 -12
  43. package/dist/esm/utils/retry.js +2 -23
  44. package/dist/types/clients/confluence/sourceInfo.d.ts +1 -3
  45. package/dist/types/providers/syncBlockProvider.d.ts +2 -3
  46. package/dist/types/providers/types.d.ts +1 -2
  47. package/dist/types/store-manager/referenceSyncBlockStoreManager.d.ts +1 -1
  48. package/dist/types/store-manager/syncBlockStoreManager.d.ts +1 -1
  49. package/dist/types-ts4.5/clients/confluence/sourceInfo.d.ts +1 -3
  50. package/dist/types-ts4.5/providers/syncBlockProvider.d.ts +2 -3
  51. package/dist/types-ts4.5/providers/types.d.ts +1 -2
  52. package/dist/types-ts4.5/store-manager/referenceSyncBlockStoreManager.d.ts +1 -1
  53. package/dist/types-ts4.5/store-manager/syncBlockStoreManager.d.ts +1 -1
  54. package/package.json +3 -10
@@ -12,7 +12,6 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
12
12
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
13
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
14
14
  var _react = require("react");
15
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
15
  var _ari = require("../../clients/block-service/ari");
17
16
  var _blockService = require("../../clients/block-service/blockService");
18
17
  var _blockSubscription = require("../../clients/block-service/blockSubscription");
@@ -301,22 +300,13 @@ var _batchFetchData = exports.batchFetchData = /*#__PURE__*/function () {
301
300
  resourceId: resourceId
302
301
  });
303
302
  } catch (_unused3) {
304
- if ((0, _platformFeatureFlags.fg)('platform_synced_block_patch_3')) {
305
- results.push({
306
- error: {
307
- type: _types.SyncBlockError.Errored,
308
- reason: "parsing JSON content response failed for resourceId: ".concat(resourceId, " localId: ").concat(blockAri)
309
- },
310
- resourceId: resourceId
311
- });
312
- } else {
313
- results.push({
314
- error: {
315
- type: _types.SyncBlockError.Errored
316
- },
317
- resourceId: resourceId
318
- });
319
- }
303
+ results.push({
304
+ error: {
305
+ type: _types.SyncBlockError.Errored,
306
+ reason: "parsing JSON content response failed for resourceId: ".concat(resourceId, " localId: ").concat(blockAri)
307
+ },
308
+ resourceId: resourceId
309
+ });
320
310
  }
321
311
  case 25:
322
312
  _context2.next = 14;
@@ -356,11 +346,9 @@ var _batchFetchData = exports.batchFetchData = /*#__PURE__*/function () {
356
346
  case 44:
357
347
  processedResourceIds.add(_resourceId);
358
348
  results.push({
359
- error: (0, _platformFeatureFlags.fg)('platform_synced_block_patch_3') ? {
349
+ error: {
360
350
  type: mapErrorResponseCode(errorResponse.code),
361
351
  reason: errorResponse.reason
362
- } : {
363
- type: mapErrorResponseCode(errorResponse.code)
364
352
  },
365
353
  resourceId: _resourceId
366
354
  });
@@ -406,7 +394,7 @@ var _batchFetchData = exports.batchFetchData = /*#__PURE__*/function () {
406
394
  return {
407
395
  error: {
408
396
  type: _context2.t2 instanceof _blockService.BlockError ? mapBlockError(_context2.t2) : _types.SyncBlockError.Errored,
409
- reason: (0, _platformFeatureFlags.fg)('platform_synced_block_patch_3') ? _context2.t2.message : undefined
397
+ reason: _context2.t2.message
410
398
  },
411
399
  resourceId: blockNodeIdentifier.resourceId
412
400
  };
@@ -656,21 +644,17 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
656
644
  break;
657
645
  }
658
646
  return _context5.abrupt("return", {
659
- error: (0, _platformFeatureFlags.fg)('platform_synced_block_patch_3') ? {
647
+ error: {
660
648
  type: mapBlockError(_context5.t0),
661
649
  reason: _context5.t0.message
662
- } : {
663
- type: mapBlockError(_context5.t0)
664
650
  },
665
651
  resourceId: resourceId
666
652
  });
667
653
  case 16:
668
654
  return _context5.abrupt("return", {
669
- error: (0, _platformFeatureFlags.fg)('platform_synced_block_patch_3') ? {
655
+ error: {
670
656
  type: _types.SyncBlockError.Errored,
671
657
  reason: _context5.t0.message
672
- } : {
673
- type: _types.SyncBlockError.Errored
674
658
  },
675
659
  resourceId: resourceId
676
660
  });
@@ -15,8 +15,6 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
15
15
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
16
16
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
17
  var _react = require("react");
18
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
19
- var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
20
18
  var _ari = require("../clients/block-service/ari");
21
19
  var _ari2 = require("../clients/confluence/ari");
22
20
  var _sourceInfo2 = require("../clients/confluence/sourceInfo");
@@ -119,11 +117,9 @@ var SyncedBlockProvider = exports.SyncedBlockProvider = /*#__PURE__*/function (_
119
117
  return data;
120
118
  }, function (error) {
121
119
  return {
122
- error: (0, _platformFeatureFlags.fg)('platform_synced_block_patch_3') ? {
120
+ error: {
123
121
  type: _types.SyncBlockError.Errored,
124
122
  reason: error
125
- } : {
126
- type: _types.SyncBlockError.Errored
127
123
  },
128
124
  resourceId: blockIdentifier.resourceId
129
125
  };
@@ -171,7 +167,7 @@ var SyncedBlockProvider = exports.SyncedBlockProvider = /*#__PURE__*/function (_
171
167
  }
172
168
  return _context2.abrupt("return", Promise.reject(new Error('Write provider not set')));
173
169
  case 2:
174
- if (!(this.writeProvider.writeDataBatch && (0, _platformFeatureFlags.fg)('platform_synced_block_patch_4'))) {
170
+ if (!this.writeProvider.writeDataBatch) {
175
171
  _context2.next = 12;
176
172
  break;
177
173
  }
@@ -316,11 +312,9 @@ var SyncedBlockProvider = exports.SyncedBlockProvider = /*#__PURE__*/function (_
316
312
  }, {
317
313
  key: "fetchSyncBlockSourceInfo",
318
314
  value: (function () {
319
- var _fetchSyncBlockSourceInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(localId, sourceAri, sourceProduct, fireAnalyticsEvent) {
315
+ var _fetchSyncBlockSourceInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(localId, sourceAri, sourceProduct) {
320
316
  var _this$writeProvider, _this$writeProvider3;
321
317
  var hasAccess,
322
- urlType,
323
- isUnpublished,
324
318
  ari,
325
319
  product,
326
320
  _this$writeProvider2,
@@ -330,59 +324,57 @@ var SyncedBlockProvider = exports.SyncedBlockProvider = /*#__PURE__*/function (_
330
324
  return _regenerator.default.wrap(function _callee4$(_context4) {
331
325
  while (1) switch (_context4.prev = _context4.next) {
332
326
  case 0:
333
- hasAccess = _args4.length > 4 && _args4[4] !== undefined ? _args4[4] : true;
334
- urlType = _args4.length > 5 && _args4[5] !== undefined ? _args4[5] : 'edit';
335
- isUnpublished = _args4.length > 6 ? _args4[6] : undefined;
327
+ hasAccess = _args4.length > 3 && _args4[3] !== undefined ? _args4[3] : true;
336
328
  ari = sourceAri !== null && sourceAri !== void 0 ? sourceAri : (_this$writeProvider = this.writeProvider) === null || _this$writeProvider === void 0 ? void 0 : _this$writeProvider.parentAri;
337
329
  product = sourceProduct !== null && sourceProduct !== void 0 ? sourceProduct : (0, _ari.getProductFromSourceAri)(ari);
338
330
  if (!(!ari || !product)) {
339
- _context4.next = 7;
331
+ _context4.next = 5;
340
332
  break;
341
333
  }
342
334
  return _context4.abrupt("return", Promise.reject(new Error('Source ari or source product is undefined')));
343
- case 7:
335
+ case 5:
344
336
  _context4.t0 = product;
345
- _context4.next = _context4.t0 === 'confluence-page' ? 10 : _context4.t0 === 'jira-work-item' ? 16 : 22;
337
+ _context4.next = _context4.t0 === 'confluence-page' ? 8 : _context4.t0 === 'jira-work-item' ? 14 : 20;
346
338
  break;
339
+ case 8:
340
+ _context4.next = 10;
341
+ return (0, _sourceInfo2.fetchConfluencePageInfo)(ari, hasAccess, localId);
347
342
  case 10:
348
- _context4.next = 12;
349
- return (0, _sourceInfo2.fetchConfluencePageInfo)(ari, hasAccess, urlType, localId, isUnpublished);
350
- case 12:
351
343
  _sourceInfo = _context4.sent;
352
344
  if (_sourceInfo) {
353
- _context4.next = 15;
345
+ _context4.next = 13;
354
346
  break;
355
347
  }
356
348
  return _context4.abrupt("return", Promise.resolve(undefined));
357
- case 15:
349
+ case 13:
358
350
  return _context4.abrupt("return", _objectSpread(_objectSpread({}, _sourceInfo), {}, {
359
351
  onSameDocument: ((_this$writeProvider2 = this.writeProvider) === null || _this$writeProvider2 === void 0 ? void 0 : _this$writeProvider2.parentAri) === ari,
360
352
  productType: product
361
353
  }));
362
- case 16:
363
- _context4.next = 18;
354
+ case 14:
355
+ _context4.next = 16;
364
356
  return (0, _sourceInfo3.fetchJiraWorkItemInfo)(ari, hasAccess);
365
- case 18:
357
+ case 16:
366
358
  sourceInfo = _context4.sent;
367
359
  if (sourceInfo) {
368
- _context4.next = 21;
360
+ _context4.next = 19;
369
361
  break;
370
362
  }
371
363
  return _context4.abrupt("return", Promise.resolve(undefined));
372
- case 21:
364
+ case 19:
373
365
  return _context4.abrupt("return", _objectSpread(_objectSpread({}, sourceInfo), {}, {
374
366
  onSameDocument: ((_this$writeProvider3 = this.writeProvider) === null || _this$writeProvider3 === void 0 ? void 0 : _this$writeProvider3.parentAri) === ari,
375
367
  productType: product
376
368
  }));
377
- case 22:
369
+ case 20:
378
370
  return _context4.abrupt("return", Promise.reject(new Error("".concat(product, " source product not supported"))));
379
- case 23:
371
+ case 21:
380
372
  case "end":
381
373
  return _context4.stop();
382
374
  }
383
375
  }, _callee4, this);
384
376
  }));
385
- function fetchSyncBlockSourceInfo(_x6, _x7, _x8, _x9) {
377
+ function fetchSyncBlockSourceInfo(_x6, _x7, _x8) {
386
378
  return _fetchSyncBlockSourceInfo.apply(this, arguments);
387
379
  }
388
380
  return fetchSyncBlockSourceInfo;
@@ -484,7 +476,7 @@ var createSyncedBlockProvider = function createSyncedBlockProvider(_ref) {
484
476
  writeProvider = _ref.writeProvider;
485
477
  return new SyncedBlockProvider(fetchProvider, writeProvider);
486
478
  };
487
- var useMemoizedSyncedBlockProviderBase = function useMemoizedSyncedBlockProviderBase(_ref2) {
479
+ var useMemoizedSyncedBlockProvider = exports.useMemoizedSyncedBlockProvider = function useMemoizedSyncedBlockProvider(_ref2) {
488
480
  var fetchProvider = _ref2.fetchProvider,
489
481
  writeProvider = _ref2.writeProvider,
490
482
  providerOptions = _ref2.providerOptions,
@@ -495,24 +487,6 @@ var useMemoizedSyncedBlockProviderBase = function useMemoizedSyncedBlockProvider
495
487
  writeProvider: writeProvider
496
488
  });
497
489
  }, [fetchProvider, writeProvider]);
498
- syncBlockProvider.setProviderOptions(providerOptions);
499
- var ssrData = getSSRData ? getSSRData() : undefined;
500
- if (ssrData) {
501
- syncBlockProvider.setSSRData(ssrData);
502
- }
503
- return syncBlockProvider;
504
- };
505
- var useMemoizedSyncedBlockProviderPatched = function useMemoizedSyncedBlockProviderPatched(_ref3) {
506
- var fetchProvider = _ref3.fetchProvider,
507
- writeProvider = _ref3.writeProvider,
508
- providerOptions = _ref3.providerOptions,
509
- getSSRData = _ref3.getSSRData;
510
- var syncBlockProvider = (0, _react.useMemo)(function () {
511
- return createSyncedBlockProvider({
512
- fetchProvider: fetchProvider,
513
- writeProvider: writeProvider
514
- });
515
- }, [fetchProvider, writeProvider]);
516
490
  var prevProviderOptionsRef = (0, _react.useRef)(undefined);
517
491
  if (providerOptions !== prevProviderOptionsRef.current) {
518
492
  prevProviderOptionsRef.current = providerOptions;
@@ -527,7 +501,4 @@ var useMemoizedSyncedBlockProviderPatched = function useMemoizedSyncedBlockProvi
527
501
  }
528
502
  }
529
503
  return syncBlockProvider;
530
- };
531
- var useMemoizedSyncedBlockProvider = exports.useMemoizedSyncedBlockProvider = (0, _platformFeatureFlagsReact.conditionalHooksFactory)(function () {
532
- return (0, _platformFeatureFlags.fg)('platform_synced_block_patch_4');
533
- }, useMemoizedSyncedBlockProviderPatched, useMemoizedSyncedBlockProviderBase);
504
+ };
@@ -465,10 +465,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
465
465
  value: function handleGraphQLSubscriptionUpdate(syncBlockInstance) {
466
466
  var _this5 = this;
467
467
  if (!syncBlockInstance.resourceId) {
468
- if ((0, _platformFeatureFlags.fg)('platform_synced_block_patch_4')) {
469
- return;
470
- }
471
- throw new Error('Sync block instance provided to graphql subscription update missing resource id');
468
+ return;
472
469
  }
473
470
  var existingSyncBlock = this.getFromCache(syncBlockInstance.resourceId);
474
471
  var resolvedSyncBlockInstance = existingSyncBlock ? (0, _resolveSyncBlockInstance.resolveSyncBlockInstance)(existingSyncBlock, syncBlockInstance) : syncBlockInstance;
@@ -482,8 +479,8 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
482
479
  });
483
480
  this.fetchSyncBlockSourceInfo(resolvedSyncBlockInstance.resourceId);
484
481
  } else {
485
- var _syncBlockInstance$er, _syncBlockInstance$er2, _syncBlockInstance$er3, _this$fireAnalyticsEv3;
486
- var errorMessage = (0, _platformFeatureFlags.fg)('platform_synced_block_patch_3') ? ((_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) : (_syncBlockInstance$er3 = syncBlockInstance.error) === null || _syncBlockInstance$er3 === void 0 ? void 0 : _syncBlockInstance$er3.type;
482
+ var _syncBlockInstance$er, _syncBlockInstance$er2, _this$fireAnalyticsEv3;
483
+ var 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);
487
484
  (_this$fireAnalyticsEv3 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv3 === void 0 || _this$fireAnalyticsEv3.call(this, (0, _errorHandling.fetchErrorPayload)(errorMessage, syncBlockInstance.resourceId));
488
485
  }
489
486
  }
@@ -558,12 +555,11 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
558
555
  key: "fetchSyncBlockSourceInfoBySourceAri",
559
556
  value: function fetchSyncBlockSourceInfoBySourceAri(sourceAri) {
560
557
  var hasAccess = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
561
- var urlType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'view';
562
558
  try {
563
559
  if (!this.dataProvider) {
564
560
  throw new Error('Data provider not set');
565
561
  }
566
- var sourceInfo = this.dataProvider.fetchSyncBlockSourceInfo(undefined, sourceAri, undefined, undefined, hasAccess, urlType);
562
+ var sourceInfo = this.dataProvider.fetchSyncBlockSourceInfo(undefined, sourceAri, undefined, hasAccess);
567
563
  return sourceInfo;
568
564
  } catch (error) {
569
565
  var _this$fireAnalyticsEv4;
@@ -579,7 +575,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
579
575
  value: function fetchSyncBlockSourceInfo(resourceId) {
580
576
  var _this6 = this;
581
577
  try {
582
- var _this$fetchSourceInfo, _existingSyncBlock$da;
578
+ var _this$fetchSourceInfo;
583
579
  if (!resourceId || !this.dataProvider) {
584
580
  throw new Error('Data provider or resourceId not set');
585
581
  }
@@ -616,12 +612,8 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
616
612
  return Promise.resolve(undefined);
617
613
  }
618
614
  (_this$fetchSourceInfo = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo === void 0 || _this$fetchSourceInfo.start({});
619
- var isUnpublished = ((_existingSyncBlock$da = existingSyncBlock.data) === null || _existingSyncBlock$da === void 0 ? void 0 : _existingSyncBlock$da.status) === 'unpublished';
620
- var sourceInfoPromise = this.dataProvider.fetchSyncBlockSourceInfo(blockInstanceId, sourceAri, product, this.fireAnalyticsEvent, true,
621
- // hasAccess
622
- 'edit',
623
- // urlType
624
- isUnpublished).then(function (sourceInfo) {
615
+ var sourceInfoPromise = this.dataProvider.fetchSyncBlockSourceInfo(blockInstanceId, sourceAri, product, true // hasAccess
616
+ ).then(function (sourceInfo) {
625
617
  if (!sourceInfo) {
626
618
  var _this6$fetchSourceInf, _this6$fireAnalyticsE;
627
619
  (_this6$fetchSourceInf = _this6.fetchSourceInfoExperience) === null || _this6$fetchSourceInf === void 0 || _this6$fetchSourceInf.failure({
@@ -835,8 +827,8 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
835
827
  data.forEach(function (syncBlockInstance) {
836
828
  var _resolvedSyncBlockIns;
837
829
  if (!syncBlockInstance.resourceId) {
838
- var _syncBlockInstance$er4, _syncBlockInstance$er5, _syncBlockInstance$er6, _this9$fireAnalyticsE;
839
- var payload = (0, _platformFeatureFlags.fg)('platform_synced_block_patch_3') ? ((_syncBlockInstance$er4 = syncBlockInstance.error) === null || _syncBlockInstance$er4 === void 0 ? void 0 : _syncBlockInstance$er4.reason) || ((_syncBlockInstance$er5 = syncBlockInstance.error) === null || _syncBlockInstance$er5 === void 0 ? void 0 : _syncBlockInstance$er5.type) || 'Returned sync block instance does not have resource id' : ((_syncBlockInstance$er6 = syncBlockInstance.error) === null || _syncBlockInstance$er6 === void 0 ? void 0 : _syncBlockInstance$er6.type) || 'Returned sync block instance does not have resource id';
830
+ var _syncBlockInstance$er3, _syncBlockInstance$er4, _this9$fireAnalyticsE;
831
+ var payload = ((_syncBlockInstance$er3 = syncBlockInstance.error) === null || _syncBlockInstance$er3 === void 0 ? void 0 : _syncBlockInstance$er3.reason) || ((_syncBlockInstance$er4 = syncBlockInstance.error) === null || _syncBlockInstance$er4 === void 0 ? void 0 : _syncBlockInstance$er4.type) || 'Returned sync block instance does not have resource id';
840
832
  (_this9$fireAnalyticsE = _this9.fireAnalyticsEvent) === null || _this9$fireAnalyticsE === void 0 || _this9$fireAnalyticsE.call(_this9, (0, _errorHandling.fetchErrorPayload)(payload));
841
833
  return;
842
834
  }
@@ -855,13 +847,8 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
855
847
  _this9.newlyAddedSyncBlocks.delete(syncBlockInstance.resourceId);
856
848
  }
857
849
  if (syncBlockInstance.error) {
858
- if ((0, _platformFeatureFlags.fg)('platform_synced_block_patch_3')) {
859
- var _this9$fireAnalyticsE2;
860
- (_this9$fireAnalyticsE2 = _this9.fireAnalyticsEvent) === null || _this9$fireAnalyticsE2 === void 0 || _this9$fireAnalyticsE2.call(_this9, (0, _errorHandling.fetchErrorPayload)(syncBlockInstance.error.reason || syncBlockInstance.error.type, syncBlockInstance.resourceId));
861
- } else {
862
- var _this9$fireAnalyticsE3;
863
- (_this9$fireAnalyticsE3 = _this9.fireAnalyticsEvent) === null || _this9$fireAnalyticsE3 === void 0 || _this9$fireAnalyticsE3.call(_this9, (0, _errorHandling.fetchErrorPayload)(syncBlockInstance.error.type, syncBlockInstance.resourceId));
864
- }
850
+ var _this9$fireAnalyticsE2;
851
+ (_this9$fireAnalyticsE2 = _this9.fireAnalyticsEvent) === null || _this9$fireAnalyticsE2 === void 0 || _this9$fireAnalyticsE2.call(_this9, (0, _errorHandling.fetchErrorPayload)(syncBlockInstance.error.reason || syncBlockInstance.error.type, syncBlockInstance.resourceId));
865
852
  if (syncBlockInstance.error.type === _types.SyncBlockError.NotFound || syncBlockInstance.error.type === _types.SyncBlockError.Forbidden) {
866
853
  hasExpectedError = true;
867
854
  } else if (syncBlockInstance.error) {
@@ -872,8 +859,8 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
872
859
  var callbacks = _this9.subscriptions.get(syncBlockInstance.resourceId);
873
860
  var localIds = callbacks ? Object.keys(callbacks) : [];
874
861
  localIds.forEach(function (localId) {
875
- var _this9$fireAnalyticsE4, _syncBlockInstance$da2;
876
- (_this9$fireAnalyticsE4 = _this9.fireAnalyticsEvent) === null || _this9$fireAnalyticsE4 === void 0 || _this9$fireAnalyticsE4.call(_this9, (0, _errorHandling.fetchSuccessPayload)(syncBlockInstance.resourceId, localId, (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.product));
862
+ var _this9$fireAnalyticsE3, _syncBlockInstance$da2;
863
+ (_this9$fireAnalyticsE3 = _this9.fireAnalyticsEvent) === null || _this9$fireAnalyticsE3 === void 0 || _this9$fireAnalyticsE3.call(_this9, (0, _errorHandling.fetchSuccessPayload)(syncBlockInstance.resourceId, localId, (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.product));
877
864
  });
878
865
  _this9.fetchSyncBlockSourceInfo(resolvedSyncBlockInstance.resourceId);
879
866
  });
@@ -913,9 +900,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
913
900
  callback(syncBlock);
914
901
  });
915
902
  }
916
- if ((0, _platformFeatureFlags.fg)('platform_synced_block_patch_3')) {
917
- this.updateSessionCache(resourceId);
918
- }
903
+ this.updateSessionCache(resourceId);
919
904
  }
920
905
  }
921
906
  }, {
@@ -529,7 +529,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
529
529
  throw new Error('Data provider not set');
530
530
  }
531
531
  (_this$fetchSourceInfo = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo === void 0 || _this$fetchSourceInfo.start();
532
- return this.dataProvider.fetchSyncBlockSourceInfo(localId, undefined, undefined, this.fireAnalyticsEvent).then(function (sourceInfo) {
532
+ return this.dataProvider.fetchSyncBlockSourceInfo(localId, undefined, undefined).then(function (sourceInfo) {
533
533
  if (!sourceInfo) {
534
534
  var _this6$fetchSourceInf;
535
535
  (_this6$fetchSourceInf = _this6.fetchSourceInfoExperience) === null || _this6$fetchSourceInf === void 0 || _this6$fetchSourceInf.failure({
@@ -12,8 +12,6 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
12
12
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
13
  var _react = require("react");
14
14
  var _monitoring = require("@atlaskit/editor-common/monitoring");
15
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
- var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
17
15
  var _ari = require("../clients/block-service/ari");
18
16
  var _types = require("../common/types");
19
17
  var _errorHandling = require("../utils/errorHandling");
@@ -97,7 +95,7 @@ var SyncBlockStoreManager = exports.SyncBlockStoreManager = /*#__PURE__*/functio
97
95
  case 0:
98
96
  (_this$fetchSourceInfo = _this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo === void 0 || _this$fetchSourceInfo.start();
99
97
  _context.next = 3;
100
- return (_this$dataProvider = _this.dataProvider) === null || _this$dataProvider === void 0 ? void 0 : _this$dataProvider.fetchSyncBlockSourceInfo(reference.blockInstanceId || '', reference.documentAri, (0, _ari.getProductFromSourceAri)(reference.documentAri), _this.fireAnalyticsEvent, reference.hasAccess, 'view');
98
+ return (_this$dataProvider = _this.dataProvider) === null || _this$dataProvider === void 0 ? void 0 : _this$dataProvider.fetchSyncBlockSourceInfo(reference.blockInstanceId || '', reference.documentAri, (0, _ari.getProductFromSourceAri)(reference.documentAri), reference.hasAccess);
101
99
  case 3:
102
100
  sourceInfo = _context.sent;
103
101
  if (sourceInfo) {
@@ -202,14 +200,7 @@ var SyncBlockStoreManager = exports.SyncBlockStoreManager = /*#__PURE__*/functio
202
200
  var createSyncBlockStoreManager = function createSyncBlockStoreManager(dataProvider) {
203
201
  return new SyncBlockStoreManager(dataProvider);
204
202
  };
205
- var useMemoizedSyncBlockStoreManagerBase = function useMemoizedSyncBlockStoreManagerBase(dataProvider, fireAnalyticsEvent) {
206
- var syncBlockStoreManager = (0, _react.useMemo)(function () {
207
- return createSyncBlockStoreManager(dataProvider);
208
- }, [dataProvider]);
209
- syncBlockStoreManager.setFireAnalyticsEvent(fireAnalyticsEvent);
210
- return syncBlockStoreManager;
211
- };
212
- var useMemoizedSyncBlockStoreManagerPatched = function useMemoizedSyncBlockStoreManagerPatched(dataProvider, fireAnalyticsEvent) {
203
+ var useMemoizedSyncBlockStoreManager = exports.useMemoizedSyncBlockStoreManager = function useMemoizedSyncBlockStoreManager(dataProvider, fireAnalyticsEvent) {
213
204
  var syncBlockStoreManager = (0, _react.useMemo)(function () {
214
205
  return createSyncBlockStoreManager(dataProvider);
215
206
  }, [dataProvider]);
@@ -219,7 +210,4 @@ var useMemoizedSyncBlockStoreManagerPatched = function useMemoizedSyncBlockStore
219
210
  syncBlockStoreManager.setFireAnalyticsEvent(fireAnalyticsEvent);
220
211
  }
221
212
  return syncBlockStoreManager;
222
- };
223
- var useMemoizedSyncBlockStoreManager = exports.useMemoizedSyncBlockStoreManager = (0, _platformFeatureFlagsReact.conditionalHooksFactory)(function () {
224
- return (0, _platformFeatureFlags.fg)('platform_synced_block_patch_4');
225
- }, useMemoizedSyncBlockStoreManagerPatched, useMemoizedSyncBlockStoreManagerBase);
213
+ };
@@ -189,8 +189,8 @@ var SyncBlockSubscriptionManager = exports.SyncBlockSubscriptionManager = /*#__P
189
189
  });
190
190
  this.deps.fetchSyncBlockSourceInfo(resolved.resourceId);
191
191
  } else {
192
- var _syncBlockInstance$er, _syncBlockInstance$er2, _syncBlockInstance$er3, _this$deps$getFireAna;
193
- var errorMessage = (0, _platformFeatureFlags.fg)('platform_synced_block_patch_3') ? ((_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) : (_syncBlockInstance$er3 = syncBlockInstance.error) === null || _syncBlockInstance$er3 === void 0 ? void 0 : _syncBlockInstance$er3.type;
192
+ var _syncBlockInstance$er, _syncBlockInstance$er2, _this$deps$getFireAna;
193
+ var 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);
194
194
  (_this$deps$getFireAna = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna === void 0 || _this$deps$getFireAna((0, _errorHandling.fetchErrorPayload)(errorMessage, syncBlockInstance.resourceId));
195
195
  }
196
196
  }
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.updateSuccessPayload = exports.updateReferenceErrorPayload = exports.updateErrorPayload = exports.updateCacheErrorPayload = exports.stringifyError = exports.getSourceInfoErrorPayload = exports.getErrorPayload = exports.fetchSuccessPayload = exports.fetchReferencesErrorPayload = exports.fetchErrorPayload = exports.deleteSuccessPayload = exports.deleteErrorPayload = exports.createSuccessPayloadNew = exports.createSuccessPayload = exports.createErrorPayload = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _analytics = require("@atlaskit/editor-common/analytics");
10
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
10
  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; }
12
11
  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) { (0, _defineProperty2.default)(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; }
13
12
  var stringifyError = exports.stringifyError = function stringifyError(error) {
@@ -71,7 +70,7 @@ var fetchSuccessPayload = exports.fetchSuccessPayload = function fetchSuccessPay
71
70
  };
72
71
  };
73
72
  var createSuccessPayload = exports.createSuccessPayload = function createSuccessPayload(resourceId) {
74
- return (0, _platformFeatureFlags.fg)('platform_synced_block_patch_3') ? {
73
+ return {
75
74
  action: _analytics.ACTION.INSERTED,
76
75
  actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
77
76
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.BODIED_SYNCED_BLOCK,
@@ -79,14 +78,6 @@ var createSuccessPayload = exports.createSuccessPayload = function createSuccess
79
78
  attributes: {
80
79
  resourceId: resourceId
81
80
  }
82
- } : {
83
- action: _analytics.ACTION.INSERTED,
84
- actionSubject: _analytics.ACTION_SUBJECT.SYNCED_BLOCK,
85
- actionSubjectId: _analytics.ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE,
86
- eventType: _analytics.EVENT_TYPE.OPERATIONAL,
87
- attributes: {
88
- resourceId: resourceId
89
- }
90
81
  };
91
82
  };
92
83
  var createSuccessPayloadNew = exports.createSuccessPayloadNew = function createSuccessPayloadNew(resourceId) {
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.resolveSyncBlockInstance = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
10
9
  var _ari = require("../clients/confluence/ari");
11
10
  var _types = require("../common/types");
12
11
  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; }
@@ -23,7 +22,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
23
22
  * @returns A merged SyncBlockInstance object.
24
23
  */
25
24
  var resolveSyncBlockInstance = exports.resolveSyncBlockInstance = function resolveSyncBlockInstance(oldResult, newResult) {
26
- var _newResult$data, _oldResult$data, _newResult$data2, _oldResult$data2, _newResult$data3, _oldResult$data3, _newResult$data4, _oldResult$data4;
25
+ var _newResult$data, _oldResult$data, _newResult$data2, _oldResult$data2, _newResult$data3, _oldResult$data3;
27
26
  // if the old result has no data, we simply return the new result
28
27
  if (!oldResult.data) {
29
28
  return newResult;
@@ -42,30 +41,30 @@ var resolveSyncBlockInstance = exports.resolveSyncBlockInstance = function resol
42
41
  data: _objectSpread(_objectSpread({}, newResult.data), {}, {
43
42
  sourceURL: ((_newResult$data = newResult.data) === null || _newResult$data === void 0 ? void 0 : _newResult$data.sourceURL) || ((_oldResult$data = oldResult.data) === null || _oldResult$data === void 0 ? void 0 : _oldResult$data.sourceURL) || undefined,
44
43
  sourceTitle: ((_newResult$data2 = newResult.data) === null || _newResult$data2 === void 0 ? void 0 : _newResult$data2.sourceTitle) || ((_oldResult$data2 = oldResult.data) === null || _oldResult$data2 === void 0 ? void 0 : _oldResult$data2.sourceTitle) || undefined,
45
- sourceSubType: (0, _platformFeatureFlags.fg)('platform_synced_block_patch_3') ? mergeSubType(oldResult, newResult) : ((_newResult$data3 = newResult.data) === null || _newResult$data3 === void 0 ? void 0 : _newResult$data3.sourceSubType) || ((_oldResult$data3 = oldResult.data) === null || _oldResult$data3 === void 0 ? void 0 : _oldResult$data3.sourceSubType) || undefined,
46
- onSameDocument: ((_newResult$data4 = newResult.data) === null || _newResult$data4 === void 0 ? void 0 : _newResult$data4.onSameDocument) || ((_oldResult$data4 = oldResult.data) === null || _oldResult$data4 === void 0 ? void 0 : _oldResult$data4.onSameDocument) || undefined
44
+ sourceSubType: mergeSubType(oldResult, newResult),
45
+ onSameDocument: ((_newResult$data3 = newResult.data) === null || _newResult$data3 === void 0 ? void 0 : _newResult$data3.onSameDocument) || ((_oldResult$data3 = oldResult.data) === null || _oldResult$data3 === void 0 ? void 0 : _oldResult$data3.onSameDocument) || undefined
47
46
  })
48
47
  });
49
48
  };
50
49
  var mergeSubType = function mergeSubType(oldResult, newResult) {
51
- var _newResult$data5, _newResult$data6, _oldResult$data5;
50
+ var _newResult$data4, _newResult$data5, _oldResult$data4;
52
51
  // for classic pages, subType is 'null'
53
- if (((_newResult$data5 = newResult.data) === null || _newResult$data5 === void 0 ? void 0 : _newResult$data5.sourceSubType) !== undefined) {
52
+ if (((_newResult$data4 = newResult.data) === null || _newResult$data4 === void 0 ? void 0 : _newResult$data4.sourceSubType) !== undefined) {
54
53
  return newResult.data.sourceSubType;
55
54
  }
56
- if ((_newResult$data6 = newResult.data) !== null && _newResult$data6 !== void 0 && _newResult$data6.sourceAri) {
55
+ if ((_newResult$data5 = newResult.data) !== null && _newResult$data5 !== void 0 && _newResult$data5.sourceAri) {
57
56
  // for blogposts, subType is always undefined
58
57
  try {
59
- var _newResult$data7;
58
+ var _newResult$data6;
60
59
  var _getPageIdAndTypeFrom = (0, _ari.getPageIdAndTypeFromConfluencePageAri)({
61
- ari: (_newResult$data7 = newResult.data) === null || _newResult$data7 === void 0 ? void 0 : _newResult$data7.sourceAri
60
+ ari: (_newResult$data6 = newResult.data) === null || _newResult$data6 === void 0 ? void 0 : _newResult$data6.sourceAri
62
61
  }),
63
62
  pageType = _getPageIdAndTypeFrom.type;
64
63
  if (pageType === 'blogpost') {
65
- var _newResult$data8;
66
- return (_newResult$data8 = newResult.data) === null || _newResult$data8 === void 0 ? void 0 : _newResult$data8.sourceSubType;
64
+ var _newResult$data7;
65
+ return (_newResult$data7 = newResult.data) === null || _newResult$data7 === void 0 ? void 0 : _newResult$data7.sourceSubType;
67
66
  }
68
67
  } catch (_unused) {}
69
68
  }
70
- return (_oldResult$data5 = oldResult.data) === null || _oldResult$data5 === void 0 ? void 0 : _oldResult$data5.sourceSubType;
69
+ return (_oldResult$data4 = oldResult.data) === null || _oldResult$data4 === void 0 ? void 0 : _oldResult$data4.sourceSubType;
71
70
  };
@@ -7,26 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.fetchWithRetry = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
- var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
12
10
  var MAX_RETRY_DELAY = 30000;
13
- var parseRetryAfterBase = function parseRetryAfterBase(retryAfter) {
14
- var newDelay;
15
-
16
- // retryAfter can either be in seconds or HTTP date
17
- var parsedRetryAfter = parseInt(retryAfter);
18
- if (!isNaN(parsedRetryAfter)) {
19
- newDelay = parsedRetryAfter * 1000;
20
- } else {
21
- var retryDate = new Date(retryAfter);
22
- var delayFromDate = retryDate.getTime() - Date.now();
23
- if (delayFromDate > 0) {
24
- newDelay = delayFromDate;
25
- }
26
- }
27
- return newDelay;
28
- };
29
- var parseRetryAfterPatched = function parseRetryAfterPatched(retryAfter) {
11
+ var parseRetryAfter = function parseRetryAfter(retryAfter) {
30
12
  // retryAfter can either be in seconds or HTTP date
31
13
  var parsedRetryAfter = parseInt(retryAfter, 10);
32
14
  if (!isNaN(parsedRetryAfter) && parsedRetryAfter > 0) {
@@ -42,9 +24,6 @@ var parseRetryAfterPatched = function parseRetryAfterPatched(retryAfter) {
42
24
  }
43
25
  return undefined;
44
26
  };
45
- var parseRetryAfter = (0, _platformFeatureFlagsReact.functionWithCondition)(function () {
46
- return (0, _platformFeatureFlags.fg)('platform_synced_block_patch_4');
47
- }, parseRetryAfterPatched, parseRetryAfterBase);
48
27
  var _fetchWithRetry = exports.fetchWithRetry = /*#__PURE__*/function () {
49
28
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(url, options) {
50
29
  var _ref2;
@@ -74,7 +53,7 @@ var _fetchWithRetry = exports.fetchWithRetry = /*#__PURE__*/function () {
74
53
  case 8:
75
54
  retryAfter = response.headers.get('Retry-After');
76
55
  parsedDelay = (_ref2 = retryAfter ? parseRetryAfter(retryAfter) : undefined) !== null && _ref2 !== void 0 ? _ref2 : delay;
77
- retryDelay = (0, _platformFeatureFlags.fg)('platform_synced_block_patch_4') ? Math.min(parsedDelay, MAX_RETRY_DELAY) : parsedDelay;
56
+ retryDelay = Math.min(parsedDelay, MAX_RETRY_DELAY);
78
57
  _context.next = 13;
79
58
  return new Promise(function (resolve) {
80
59
  return setTimeout(resolve, retryDelay);