@atlaskit/editor-synced-block-provider 3.28.0 → 3.29.0

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 (28) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/clients/block-service/blockService.js +118 -310
  3. package/dist/cjs/clients/confluence/sourceInfo.js +19 -37
  4. package/dist/cjs/providers/block-service/blockServiceAPI.js +8 -18
  5. package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +20 -68
  6. package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +29 -84
  7. package/dist/cjs/store-manager/syncBlockStoreManager.js +1 -2
  8. package/dist/es2019/clients/block-service/blockService.js +119 -235
  9. package/dist/es2019/clients/confluence/sourceInfo.js +5 -15
  10. package/dist/es2019/providers/block-service/blockServiceAPI.js +8 -18
  11. package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +34 -80
  12. package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +40 -90
  13. package/dist/es2019/store-manager/syncBlockStoreManager.js +1 -2
  14. package/dist/esm/clients/block-service/blockService.js +118 -310
  15. package/dist/esm/clients/confluence/sourceInfo.js +19 -37
  16. package/dist/esm/providers/block-service/blockServiceAPI.js +8 -18
  17. package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +20 -68
  18. package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +29 -84
  19. package/dist/esm/store-manager/syncBlockStoreManager.js +1 -2
  20. package/dist/types/clients/block-service/blockService.d.ts +3 -6
  21. package/dist/types/providers/block-service/blockServiceAPI.d.ts +2 -5
  22. package/dist/types/store-manager/referenceSyncBlockStoreManager.d.ts +0 -2
  23. package/dist/types/store-manager/sourceSyncBlockStoreManager.d.ts +0 -14
  24. package/dist/types-ts4.5/clients/block-service/blockService.d.ts +3 -6
  25. package/dist/types-ts4.5/providers/block-service/blockServiceAPI.d.ts +2 -5
  26. package/dist/types-ts4.5/store-manager/referenceSyncBlockStoreManager.d.ts +0 -2
  27. package/dist/types-ts4.5/store-manager/sourceSyncBlockStoreManager.d.ts +0 -14
  28. package/package.json +2 -5
@@ -9,7 +9,6 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
11
  var _monitoring = require("@atlaskit/editor-common/monitoring");
12
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
12
  var _errorHandling = require("../../utils/errorHandling");
14
13
  var _retry = require("../../utils/retry");
15
14
  var _ari = require("./ari");
@@ -128,7 +127,7 @@ var resolveNoAccessPageInfo = /*#__PURE__*/function () {
128
127
  */
129
128
  var fetchCompleteConfluencePageInfo = /*#__PURE__*/function () {
130
129
  var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(pageAri, localId) {
131
- var _pageData$_links, _pageData$_links2, _pageData$_links3, _getPageIdAndTypeFrom, pageId, response, pageData, base, edituiv2, webui, title, subType, status, url;
130
+ var _pageData$_links, _pageData$_links2, _getPageIdAndTypeFrom, pageId, response, pageData, base, edituiv2, title, subType, url;
132
131
  return _regenerator.default.wrap(function _callee3$(_context3) {
133
132
  while (1) switch (_context3.prev = _context3.next) {
134
133
  case 0:
@@ -155,15 +154,11 @@ var fetchCompleteConfluencePageInfo = /*#__PURE__*/function () {
155
154
  pageData = _context3.sent;
156
155
  base = (_pageData$_links = pageData._links) === null || _pageData$_links === void 0 ? void 0 : _pageData$_links.base;
157
156
  edituiv2 = (_pageData$_links2 = pageData._links) === null || _pageData$_links2 === void 0 ? void 0 : _pageData$_links2.edituiv2;
158
- webui = (_pageData$_links3 = pageData._links) === null || _pageData$_links3 === void 0 ? void 0 : _pageData$_links3.webui;
159
157
  title = pageData.title;
160
158
  subType = pageData.subtype;
161
- status = pageData.status;
162
- if (base && edituiv2 && ((0, _platformFeatureFlags.fg)('platform_synced_block_patch_2') ? status !== 'archived' : true)) {
159
+ if (base && edituiv2) {
163
160
  url = "".concat(base).concat(edituiv2);
164
161
  url = url && localId ? "".concat(url, "#block-").concat(localId) : url;
165
- } else if (base && webui && (0, _platformFeatureFlags.fg)('platform_synced_block_patch_2')) {
166
- url = "".concat(base).concat(webui);
167
162
  }
168
163
  return _context3.abrupt("return", {
169
164
  title: title,
@@ -171,18 +166,18 @@ var fetchCompleteConfluencePageInfo = /*#__PURE__*/function () {
171
166
  sourceAri: pageAri,
172
167
  subType: subType
173
168
  });
174
- case 20:
175
- _context3.prev = 20;
169
+ case 18:
170
+ _context3.prev = 18;
176
171
  _context3.t0 = _context3["catch"](0);
177
172
  (0, _monitoring.logException)(_context3.t0, {
178
- location: 'editor-synced-block-provider/sourceInfo/fetchCompleteConfluencePageInfo'
173
+ location: 'editor-synced-block-provider/sourceInfo/fetchUnpublishedConfluencePageInfo'
179
174
  });
180
175
  return _context3.abrupt("return", Promise.resolve(undefined));
181
- case 24:
176
+ case 22:
182
177
  case "end":
183
178
  return _context3.stop();
184
179
  }
185
- }, _callee3, null, [[0, 20]]);
180
+ }, _callee3, null, [[0, 18]]);
186
181
  }));
187
182
  return function fetchCompleteConfluencePageInfo(_x3, _x4) {
188
183
  return _ref3.apply(this, arguments);
@@ -247,38 +242,25 @@ var fetchConfluencePageInfo = exports.fetchConfluencePageInfo = /*#__PURE__*/fun
247
242
  return _regenerator.default.wrap(function _callee5$(_context5) {
248
243
  while (1) switch (_context5.prev = _context5.next) {
249
244
  case 0:
250
- if (!(isUnpublished && (0, _platformFeatureFlags.fg)('platform_synced_block_patch_1'))) {
251
- _context5.next = 5;
252
- break;
253
- }
254
- if ((0, _platformFeatureFlags.fg)('platform_synced_block_patch_2')) {
255
- _context5.next = 5;
245
+ if (!isUnpublished) {
246
+ _context5.next = 4;
256
247
  break;
257
248
  }
258
- _context5.next = 4;
249
+ _context5.next = 3;
259
250
  return fetchCompleteConfluencePageInfo(pageAri, localId);
260
- case 4:
251
+ case 3:
261
252
  return _context5.abrupt("return", _context5.sent);
262
- case 5:
253
+ case 4:
263
254
  if (!hasAccess) {
264
- _context5.next = 22;
255
+ _context5.next = 17;
265
256
  break;
266
257
  }
267
258
  _getPageIdAndTypeFrom3 = (0, _ari.getPageIdAndTypeFromConfluencePageAri)({
268
259
  ari: pageAri
269
260
  }), pageType = _getPageIdAndTypeFrom3.type;
270
- if (!(pageType === 'page' && (0, _platformFeatureFlags.fg)('platform_synced_block_patch_2'))) {
271
- _context5.next = 11;
272
- break;
273
- }
274
- _context5.next = 10;
275
- return fetchCompleteConfluencePageInfo(pageAri, localId);
276
- case 10:
277
- return _context5.abrupt("return", _context5.sent);
278
- case 11:
279
- _context5.next = 13;
261
+ _context5.next = 8;
280
262
  return getConfluenceSourceInfo(pageAri);
281
- case 13:
263
+ case 8:
282
264
  response = _context5.sent;
283
265
  contentData = (_response$data2 = response.data) === null || _response$data2 === void 0 || (_response$data2 = _response$data2.content) === null || _response$data2 === void 0 || (_response$data2 = _response$data2.nodes) === null || _response$data2 === void 0 ? void 0 : _response$data2[0];
284
266
  _ref7 = contentData || {}, title = _ref7.title, subType = _ref7.subType;
@@ -299,12 +281,12 @@ var fetchConfluencePageInfo = exports.fetchConfluencePageInfo = /*#__PURE__*/fun
299
281
  sourceAri: pageAri,
300
282
  subType: subType
301
283
  }));
302
- case 22:
303
- _context5.next = 24;
284
+ case 17:
285
+ _context5.next = 19;
304
286
  return resolveNoAccessPageInfo(pageAri);
305
- case 24:
287
+ case 19:
306
288
  return _context5.abrupt("return", _context5.sent);
307
- case 25:
289
+ case 20:
308
290
  case "end":
309
291
  return _context5.stop();
310
292
  }
@@ -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");
@@ -243,7 +242,6 @@ var _batchFetchData = exports.batchFetchData = /*#__PURE__*/function () {
243
242
  _context2.prev = 5;
244
243
  _context2.next = 8;
245
244
  return (0, _blockService.batchRetrieveSyncedBlocks)({
246
- documentAri: parentAri,
247
245
  blockIdentifiers: blockIdentifiers
248
246
  });
249
247
  case 8:
@@ -437,8 +435,7 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
437
435
  _context3.prev = 1;
438
436
  _context3.next = 4;
439
437
  return (0, _blockService.getSyncedBlockContent)({
440
- blockAri: blockAri,
441
- documentAri: this.parentAri
438
+ blockAri: blockAri
442
439
  });
443
440
  case 4:
444
441
  blockContentResponse = _context3.sent;
@@ -640,15 +637,13 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
640
637
  parentAri = _ref5.parentAri,
641
638
  parentId = _ref5.parentId,
642
639
  product = _ref5.product,
643
- getVersion = _ref5.getVersion,
644
- isParentUnpublished = _ref5.isParentUnpublished;
640
+ getVersion = _ref5.getVersion;
645
641
  (0, _classCallCheck2.default)(this, BlockServiceADFWriteProvider);
646
642
  this.cloudId = cloudId;
647
643
  this.parentAri = parentAri;
648
644
  this.parentId = parentId;
649
645
  this.product = product;
650
646
  this.getVersion = getVersion;
651
- this.isParentUnpublished = isParentUnpublished;
652
647
  }
653
648
 
654
649
  // it will first try to update and if it can't (404) then it will try to create
@@ -733,7 +728,6 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
733
728
  key: "createData",
734
729
  value: function () {
735
730
  var _createData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(data) {
736
- var _this$isParentUnpubli;
737
731
  var resourceId, blockAri, stepVersion, status;
738
732
  return _regenerator.default.wrap(function _callee7$(_context7) {
739
733
  while (1) switch (_context7.prev = _context7.next) {
@@ -767,7 +761,7 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
767
761
  _context7.t0 = undefined;
768
762
  case 11:
769
763
  stepVersion = _context7.t0;
770
- status = (0, _platformFeatureFlags.fg)('platform_synced_block_patch_1') ? 'unpublished' : (_this$isParentUnpubli = this.isParentUnpublished) !== null && _this$isParentUnpubli !== void 0 && _this$isParentUnpubli.call(this) ? 'unpublished' : data.status || 'active';
764
+ status = 'unpublished';
771
765
  _context7.prev = 13;
772
766
  _context7.next = 16;
773
767
  return (0, _blockService.createSyncedBlock)({
@@ -964,8 +958,7 @@ var createBlockServiceAPIProviders = function createBlockServiceAPIProviders(_re
964
958
  parentAri = _ref6.parentAri,
965
959
  parentId = _ref6.parentId,
966
960
  product = _ref6.product,
967
- getVersion = _ref6.getVersion,
968
- isParentUnpublished = _ref6.isParentUnpublished;
961
+ getVersion = _ref6.getVersion;
969
962
  return {
970
963
  fetchProvider: new BlockServiceADFFetchProvider({
971
964
  cloudId: cloudId,
@@ -976,8 +969,7 @@ var createBlockServiceAPIProviders = function createBlockServiceAPIProviders(_re
976
969
  parentAri: parentAri,
977
970
  parentId: parentId,
978
971
  product: product,
979
- getVersion: getVersion,
980
- isParentUnpublished: isParentUnpublished
972
+ getVersion: getVersion
981
973
  })
982
974
  };
983
975
  };
@@ -986,18 +978,16 @@ var useMemoizedBlockServiceAPIProviders = exports.useMemoizedBlockServiceAPIProv
986
978
  parentAri = _ref7.parentAri,
987
979
  parentId = _ref7.parentId,
988
980
  product = _ref7.product,
989
- getVersion = _ref7.getVersion,
990
- isParentUnpublished = _ref7.isParentUnpublished;
981
+ getVersion = _ref7.getVersion;
991
982
  return (0, _react.useMemo)(function () {
992
983
  return createBlockServiceAPIProviders({
993
984
  cloudId: cloudId,
994
985
  parentAri: parentAri,
995
986
  parentId: parentId,
996
987
  product: product,
997
- getVersion: getVersion,
998
- isParentUnpublished: isParentUnpublished
988
+ getVersion: getVersion
999
989
  });
1000
- }, [cloudId, parentAri, parentId, product, getVersion, isParentUnpublished]);
990
+ }, [cloudId, parentAri, parentId, product, getVersion]);
1001
991
  };
1002
992
  var createBlockServiceFetchOnlyAPIProvider = function createBlockServiceFetchOnlyAPIProvider(_ref8) {
1003
993
  var cloudId = _ref8.cloudId,
@@ -13,7 +13,6 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
13
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
14
  var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
15
15
  var _rafSchd = _interopRequireDefault(require("raf-schd"));
16
- var _coreUtils = require("@atlaskit/editor-common/core-utils");
17
16
  var _monitoring = require("@atlaskit/editor-common/monitoring");
18
17
  var _providerFactory = require("@atlaskit/editor-common/provider-factory");
19
18
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
@@ -72,12 +71,10 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
72
71
  });
73
72
  });
74
73
  }));
75
- this.syncBlockCache = new Map();
76
74
  this.subscriptions = new Map();
77
75
  this.titleSubscriptions = new Map();
78
76
  this.dataProvider = dataProvider;
79
77
  this.syncBlockFetchDataRequests = new Map();
80
- this.syncBlockSourceInfoRequestsOld = new Map();
81
78
  this.syncBlockSourceInfoRequests = new Map();
82
79
  this.providerFactories = new Map();
83
80
  this.pendingCacheDeletions = new Map();
@@ -220,16 +217,9 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
220
217
  }, {
221
218
  key: "getInitialSyncBlockData",
222
219
  value: function getInitialSyncBlockData(resourceId) {
223
- var _this$dataProvider2;
220
+ var _this$dataProvider;
224
221
  var syncBlockNode = (0, _utils.createSyncBlockNode)('', resourceId);
225
- if ((0, _coreUtils.isSSR)() || (0, _platformFeatureFlags.fg)('platform_synced_block_patch_1')) {
226
- var _this$dataProvider;
227
- // In SSR, prefer data from data provider cache
228
- // should not take from store manager cache as it may be in incomplete state
229
- // will be unified to the same cache later.
230
- return (_this$dataProvider = this.dataProvider) === null || _this$dataProvider === void 0 || (_this$dataProvider = _this$dataProvider.getNodeDataFromCache(syncBlockNode)) === null || _this$dataProvider === void 0 ? void 0 : _this$dataProvider.data;
231
- }
232
- return this.getFromCache(resourceId) || ((_this$dataProvider2 = this.dataProvider) === null || _this$dataProvider2 === void 0 || (_this$dataProvider2 = _this$dataProvider2.getNodeDataFromCache(syncBlockNode)) === null || _this$dataProvider2 === void 0 ? void 0 : _this$dataProvider2.data);
222
+ return (_this$dataProvider = this.dataProvider) === null || _this$dataProvider === void 0 || (_this$dataProvider = _this$dataProvider.getNodeDataFromCache(syncBlockNode)) === null || _this$dataProvider === void 0 ? void 0 : _this$dataProvider.data;
233
223
  }
234
224
 
235
225
  /**
@@ -334,13 +324,13 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
334
324
  }, {
335
325
  key: "setupGraphQLSubscription",
336
326
  value: function setupGraphQLSubscription(resourceId) {
337
- var _this$dataProvider3,
327
+ var _this$dataProvider2,
338
328
  _this4 = this;
339
329
  // Don't set up duplicate subscriptions
340
330
  if (this.graphqlSubscriptions.has(resourceId)) {
341
331
  return;
342
332
  }
343
- if (!((_this$dataProvider3 = this.dataProvider) !== null && _this$dataProvider3 !== void 0 && _this$dataProvider3.subscribeToBlockUpdates)) {
333
+ if (!((_this$dataProvider2 = this.dataProvider) !== null && _this$dataProvider2 !== void 0 && _this$dataProvider2.subscribeToBlockUpdates)) {
344
334
  return;
345
335
  }
346
336
  var unsubscribe = this.dataProvider.subscribeToBlockUpdates(resourceId, function (syncBlockInstance) {
@@ -502,9 +492,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
502
492
  return Promise.resolve(undefined);
503
493
  }
504
494
  (_this$fetchSourceInfo = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo === void 0 || _this$fetchSourceInfo.start({});
505
-
506
- // Only use unpublished endpoint if feature flag is enabled
507
- var isUnpublished = (0, _platformFeatureFlags.fg)('platform_synced_block_patch_1') && ((_existingSyncBlock$da = existingSyncBlock.data) === null || _existingSyncBlock$da === void 0 ? void 0 : _existingSyncBlock$da.status) === 'unpublished';
495
+ var isUnpublished = ((_existingSyncBlock$da = existingSyncBlock.data) === null || _existingSyncBlock$da === void 0 ? void 0 : _existingSyncBlock$da.status) === 'unpublished';
508
496
  var sourceInfoPromise = this.dataProvider.fetchSyncBlockSourceInfo(blockInstanceId, sourceAri, product, this.fireAnalyticsEvent, true,
509
497
  // hasAccess
510
498
  'edit',
@@ -785,16 +773,11 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
785
773
  value: function updateCache(syncBlock) {
786
774
  var resourceId = syncBlock.resourceId;
787
775
  if (resourceId) {
788
- if ((0, _platformFeatureFlags.fg)('platform_synced_block_patch_1')) {
789
- var _this$dataProvider4;
790
- // Use the cache in dataProvider
791
- (_this$dataProvider4 = this.dataProvider) === null || _this$dataProvider4 === void 0 || _this$dataProvider4.updateCache((0, _defineProperty2.default)({}, resourceId, syncBlock), {
792
- strategy: 'merge',
793
- source: 'network'
794
- });
795
- } else {
796
- this.syncBlockCache.set(resourceId, syncBlock);
797
- }
776
+ var _this$dataProvider3;
777
+ (_this$dataProvider3 = this.dataProvider) === null || _this$dataProvider3 === void 0 || _this$dataProvider3.updateCache((0, _defineProperty2.default)({}, resourceId, syncBlock), {
778
+ strategy: 'merge',
779
+ source: 'network'
780
+ });
798
781
  var callbacks = this.subscriptions.get(resourceId);
799
782
  if (callbacks) {
800
783
  Object.values(callbacks).forEach(function (callback) {
@@ -816,25 +799,15 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
816
799
  }, {
817
800
  key: "getFromCache",
818
801
  value: function getFromCache(resourceId) {
819
- if ((0, _platformFeatureFlags.fg)('platform_synced_block_patch_1')) {
820
- var _this$dataProvider5;
821
- // Use the cache in dataProvider
822
- var syncBlockNode = (0, _utils.createSyncBlockNode)('', resourceId);
823
- return (_this$dataProvider5 = this.dataProvider) === null || _this$dataProvider5 === void 0 || (_this$dataProvider5 = _this$dataProvider5.getNodeDataFromCache(syncBlockNode)) === null || _this$dataProvider5 === void 0 ? void 0 : _this$dataProvider5.data;
824
- }
825
- return this.syncBlockCache.get(resourceId);
802
+ var _this$dataProvider4;
803
+ var syncBlockNode = (0, _utils.createSyncBlockNode)('', resourceId);
804
+ return (_this$dataProvider4 = this.dataProvider) === null || _this$dataProvider4 === void 0 || (_this$dataProvider4 = _this$dataProvider4.getNodeDataFromCache(syncBlockNode)) === null || _this$dataProvider4 === void 0 ? void 0 : _this$dataProvider4.data;
826
805
  }
827
806
  }, {
828
807
  key: "deleteFromCache",
829
808
  value: function deleteFromCache(resourceId) {
830
- if ((0, _platformFeatureFlags.fg)('platform_synced_block_patch_1')) {
831
- var _this$dataProvider6;
832
- // For dataProvider cache, we update with empty/deleted state
833
- // The cache is managed per-node basis via resetCache if needed
834
- // For now, we don't explicitly delete from dataProvider cache
835
- // as the cache is meant to persist for cache-first-then-network strategy
836
- (_this$dataProvider6 = this.dataProvider) === null || _this$dataProvider6 === void 0 || _this$dataProvider6.removeFromCache([resourceId]);
837
- }
809
+ var _this$dataProvider5;
810
+ (_this$dataProvider5 = this.dataProvider) === null || _this$dataProvider5 === void 0 || _this$dataProvider5.removeFromCache([resourceId]);
838
811
  this.providerFactories.delete(resourceId);
839
812
  }
840
813
  }, {
@@ -856,9 +829,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
856
829
  }, {
857
830
  key: "subscribeToSyncBlock",
858
831
  value: function subscribeToSyncBlock(resourceId, localId, callback) {
859
- var _this$dataProvider7,
860
- _this$dataProvider8,
861
- _this$dataProvider9,
832
+ var _this$dataProvider6,
862
833
  _this0 = this;
863
834
  // Cancel any pending cache deletion for this resourceId.
864
835
  // This handles the case where a block is moved - the old component unmounts
@@ -885,23 +856,11 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
885
856
  var syncBlockNode = (0, _utils.createSyncBlockNode)(localId, resourceId);
886
857
 
887
858
  // call the callback immediately if we have cached data
888
- var cachedData = (0, _platformFeatureFlags.fg)('platform_synced_block_patch_1') ? // When feature flag is enabled, use dataProvider cache only
889
- (_this$dataProvider7 = this.dataProvider) === null || _this$dataProvider7 === void 0 || (_this$dataProvider7 = _this$dataProvider7.getNodeDataFromCache(syncBlockNode)) === null || _this$dataProvider7 === void 0 ? void 0 : _this$dataProvider7.data : (0, _coreUtils.isSSR)() // in SSR, prefer data provider cache
890
- ? ((_this$dataProvider8 = this.dataProvider) === null || _this$dataProvider8 === void 0 || (_this$dataProvider8 = _this$dataProvider8.getNodeDataFromCache(syncBlockNode)) === null || _this$dataProvider8 === void 0 ? void 0 : _this$dataProvider8.data) || this.getFromCache(resourceId) : this.getFromCache(resourceId) || ((_this$dataProvider9 = this.dataProvider) === null || _this$dataProvider9 === void 0 || (_this$dataProvider9 = _this$dataProvider9.getNodeDataFromCache(syncBlockNode)) === null || _this$dataProvider9 === void 0 ? void 0 : _this$dataProvider9.data);
859
+ var cachedData = (_this$dataProvider6 = this.dataProvider) === null || _this$dataProvider6 === void 0 || (_this$dataProvider6 = _this$dataProvider6.getNodeDataFromCache(syncBlockNode)) === null || _this$dataProvider6 === void 0 ? void 0 : _this$dataProvider6.data;
891
860
  if (cachedData) {
892
861
  callback(cachedData);
893
862
  } else {
894
- if ((0, _platformFeatureFlags.fg)('platform_synced_block_patch_1')) {
895
- this.debouncedBatchedFetchSyncBlocks(resourceId);
896
- } else {
897
- this.fetchSyncBlocksData([syncBlockNode]).catch(function (error) {
898
- var _this0$fireAnalyticsE;
899
- (0, _monitoring.logException)(error, {
900
- location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
901
- });
902
- (_this0$fireAnalyticsE = _this0.fireAnalyticsEvent) === null || _this0$fireAnalyticsE === void 0 || _this0$fireAnalyticsE.call(_this0, (0, _errorHandling.fetchErrorPayload)(error.message, resourceId));
903
- });
904
- }
863
+ this.debouncedBatchedFetchSyncBlocks(resourceId);
905
864
  }
906
865
 
907
866
  // Set up GraphQL subscription if real-time subscriptions are enabled
@@ -1351,7 +1310,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
1351
1310
  }, {
1352
1311
  key: "destroy",
1353
1312
  value: function destroy() {
1354
- var _this$saveExperience5, _this$fetchExperience0, _this$fetchSourceInfo2;
1313
+ var _this$dataProvider7, _this$saveExperience5, _this$fetchExperience0, _this$fetchSourceInfo2;
1355
1314
  // Cancel any queued flush to prevent it from running after destroy
1356
1315
  if (this.queuedFlushTimeout) {
1357
1316
  clearTimeout(this.queuedFlushTimeout);
@@ -1360,20 +1319,13 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
1360
1319
 
1361
1320
  // Clean up all GraphQL subscriptions first
1362
1321
  this.cleanupAllGraphQLSubscriptions();
1363
- if ((0, _platformFeatureFlags.fg)('platform_synced_block_patch_1')) {
1364
- var _this$dataProvider0;
1365
- // Reset cache in dataProvider
1366
- (_this$dataProvider0 = this.dataProvider) === null || _this$dataProvider0 === void 0 || _this$dataProvider0.resetCache();
1367
- } else {
1368
- this.syncBlockCache.clear();
1369
- }
1322
+ (_this$dataProvider7 = this.dataProvider) === null || _this$dataProvider7 === void 0 || _this$dataProvider7.resetCache();
1370
1323
  this.scheduledBatchFetch.cancel();
1371
1324
  this.pendingFetchRequests.clear();
1372
1325
  this.dataProvider = undefined;
1373
1326
  this.subscriptions.clear();
1374
1327
  this.titleSubscriptions.clear();
1375
1328
  this.syncBlockFetchDataRequests.clear();
1376
- this.syncBlockSourceInfoRequestsOld.clear();
1377
1329
  this.syncBlockSourceInfoRequests.clear();
1378
1330
  this.providerFactories.clear();
1379
1331
  this.isRefreshingSubscriptions = false;
@@ -11,7 +11,6 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
11
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
12
12
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
13
  var _monitoring = require("@atlaskit/editor-common/monitoring");
14
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
14
  var _types = require("../common/types");
16
15
  var _errorHandling = require("../utils/errorHandling");
17
16
  var _experienceTracking = require("../utils/experienceTracking");
@@ -106,7 +105,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
106
105
  // - are waiting to be deleted to avoid nodes being re-created
107
106
  // - haven't been updated since we last flushed
108
107
  // - are still pending BE creation
109
- if (!syncBlockData.pendingDeletion && syncBlockData.isDirty && !(_this2.isPendingCreation(syncBlockData.resourceId) && (0, _platformFeatureFlags.fg)('platform_synced_block_patch_1'))) {
108
+ if (!syncBlockData.pendingDeletion && syncBlockData.isDirty && !_this2.isPendingCreation(syncBlockData.resourceId)) {
110
109
  bodiedSyncBlockNodes.push({
111
110
  type: 'bodiedSyncBlock',
112
111
  attrs: {
@@ -120,10 +119,10 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
120
119
  // is still making changes, the new changes might not be saved if they all happen
121
120
  // exactly at a time when the writeNodesData is being executed asynchronously.
122
121
  syncBlockData.isDirty = false;
123
- // When flushing, set status to 'active' so the block is published (when feature gate is on)
124
- var dataToFlush = (0, _platformFeatureFlags.fg)('platform_synced_block_patch_1') ? _objectSpread(_objectSpread({}, syncBlockData), {}, {
122
+ // When flushing, set status to 'active' so the block is published
123
+ var dataToFlush = _objectSpread(_objectSpread({}, syncBlockData), {}, {
125
124
  status: 'active'
126
- }) : syncBlockData;
125
+ });
127
126
  bodiedSyncBlockData.push(dataToFlush);
128
127
  }
129
128
  });
@@ -197,28 +196,13 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
197
196
  return _flush.apply(this, arguments);
198
197
  }
199
198
  return flush;
200
- }() // Remove this method and pendingResourceId when cleaning up platform_synced_block_patch_1
201
- )
202
- }, {
203
- key: "registerPendingCreation",
204
- value: function registerPendingCreation(resourceId) {
205
- this.pendingResourceId = resourceId;
206
- }
199
+ }())
207
200
  }, {
208
201
  key: "isPendingCreation",
209
202
  value: function isPendingCreation(resourceId) {
210
203
  return this.creationCompletionCallbacks.has(resourceId);
211
204
  }
212
205
 
213
- /**
214
- * Register callback function (which inserts node, handles focus etc) to be used later when creation to backend succeed
215
- */
216
- }, {
217
- key: "registerCreationCallback",
218
- value: function registerCreationCallback(callback) {
219
- this.creationCallback = callback;
220
- }
221
-
222
206
  /**
223
207
  * Fires callback to insert node (if creation is successful) and clears pending creation data
224
208
  * @param success
@@ -226,47 +210,23 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
226
210
  }, {
227
211
  key: "commitPendingCreation",
228
212
  value: function commitPendingCreation(success, resourceId) {
229
- if ((0, _platformFeatureFlags.fg)('platform_synced_block_patch_1')) {
230
- var onCompletion = this.creationCompletionCallbacks.get(resourceId);
231
- if (onCompletion) {
232
- this.creationCompletionCallbacks.delete(resourceId);
233
- onCompletion(success);
234
- } else {
235
- var _this$fireAnalyticsEv3;
236
- (_this$fireAnalyticsEv3 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv3 === void 0 || _this$fireAnalyticsEv3.call(this, (0, _errorHandling.createErrorPayload)('creation complete callback missing', resourceId));
237
- }
238
- if (success) {
239
- var _this$fireAnalyticsEv4;
240
- (_this$fireAnalyticsEv4 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv4 === void 0 || _this$fireAnalyticsEv4.call(this, (0, _errorHandling.createSuccessPayload)(resourceId || ''));
241
- } else {
242
- var _this$fireAnalyticsEv5;
243
- // Delete the node from cache if fail to create so it's not flushed to BE
244
- this.syncBlockCache.delete(resourceId || '');
245
- (_this$fireAnalyticsEv5 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv5 === void 0 || _this$fireAnalyticsEv5.call(this, (0, _errorHandling.createErrorPayload)('Fail to create bodied sync block', resourceId));
246
- }
213
+ var onCompletion = this.creationCompletionCallbacks.get(resourceId);
214
+ if (onCompletion) {
215
+ this.creationCompletionCallbacks.delete(resourceId);
216
+ onCompletion(success);
247
217
  } else {
248
- if (success && this.creationCallback) {
249
- var _this$fireAnalyticsEv6;
250
- this.creationCallback();
251
- (_this$fireAnalyticsEv6 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv6 === void 0 || _this$fireAnalyticsEv6.call(this, (0, _errorHandling.createSuccessPayload)(this.pendingResourceId || ''));
252
- } else if (success && !this.creationCallback) {
253
- var _this$fireAnalyticsEv7;
254
- (_this$fireAnalyticsEv7 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv7 === void 0 || _this$fireAnalyticsEv7.call(this, (0, _errorHandling.createErrorPayload)('creation callback missing', this.pendingResourceId));
255
- }
256
- this.pendingResourceId = undefined;
218
+ var _this$fireAnalyticsEv3;
219
+ (_this$fireAnalyticsEv3 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv3 === void 0 || _this$fireAnalyticsEv3.call(this, (0, _errorHandling.createErrorPayload)('creation complete callback missing', resourceId));
220
+ }
221
+ if (success) {
222
+ var _this$fireAnalyticsEv4;
223
+ (_this$fireAnalyticsEv4 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv4 === void 0 || _this$fireAnalyticsEv4.call(this, (0, _errorHandling.createSuccessPayload)(resourceId || ''));
224
+ } else {
225
+ var _this$fireAnalyticsEv5;
226
+ // Delete the node from cache if fail to create so it's not flushed to BE
227
+ this.syncBlockCache.delete(resourceId || '');
228
+ (_this$fireAnalyticsEv5 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv5 === void 0 || _this$fireAnalyticsEv5.call(this, (0, _errorHandling.createErrorPayload)('Fail to create bodied sync block', resourceId));
257
229
  }
258
- this.creationCallback = undefined;
259
- }
260
-
261
- /**
262
- *
263
- * @returns true if waiting for the result of saving new bodiedSyncBlock to backend
264
- * Remove this method when cleaning up platform_synced_block_patch_1
265
- */
266
- }, {
267
- key: "hasPendingCreation",
268
- value: function hasPendingCreation() {
269
- return (0, _platformFeatureFlags.fg)('platform_synced_block_patch_1') ? this.creationCompletionCallbacks.size > 0 : !!this.pendingResourceId;
270
230
  }
271
231
  }, {
272
232
  key: "registerConfirmationCallback",
@@ -316,9 +276,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
316
276
  if (!this.dataProvider) {
317
277
  throw new Error('Data provider not set');
318
278
  }
319
- if ((0, _platformFeatureFlags.fg)('platform_synced_block_patch_1')) {
320
- this.creationCompletionCallbacks.set(resourceId, onCompletion);
321
- }
279
+ this.creationCompletionCallbacks.set(resourceId, onCompletion);
322
280
  (_this$createExperienc = this.createExperience) === null || _this$createExperienc === void 0 || _this$createExperienc.start({});
323
281
  this.dataProvider.createNodeData({
324
282
  content: [],
@@ -326,18 +284,10 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
326
284
  resourceId: resourceId
327
285
  }).then(function (result) {
328
286
  var resourceId = result.resourceId || '';
329
- if (resourceId && (!(0, _platformFeatureFlags.fg)('platform_synced_block_patch_1') || !result.error)) {
287
+ if (resourceId && !result.error) {
330
288
  var _this4$createExperien;
331
289
  _this4.commitPendingCreation(true, resourceId);
332
290
  (_this4$createExperien = _this4.createExperience) === null || _this4$createExperien === void 0 || _this4$createExperien.success();
333
-
334
- // Update the sync block data with the node data if it is provided
335
- // to avoid any race conditions where the data could be missed during a render operation
336
- if (!(0, _platformFeatureFlags.fg)('platform_synced_block_patch_1')) {
337
- if (nodeData) {
338
- _this4.updateSyncBlockData(nodeData);
339
- }
340
- }
341
291
  } else {
342
292
  var _this4$createExperien2, _this4$fireAnalyticsE;
343
293
  _this4.commitPendingCreation(false, resourceId);
@@ -357,18 +307,15 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
357
307
  });
358
308
  (_this4$fireAnalyticsE2 = _this4.fireAnalyticsEvent) === null || _this4$fireAnalyticsE2 === void 0 || _this4$fireAnalyticsE2.call(_this4, (0, _errorHandling.createErrorPayload)(error.message, resourceId));
359
309
  });
360
- if (!(0, _platformFeatureFlags.fg)('platform_synced_block_patch_1')) {
361
- this.registerPendingCreation(resourceId);
362
- }
363
310
  } catch (error) {
364
- var _this$fireAnalyticsEv8;
365
- if ((0, _platformFeatureFlags.fg)('platform_synced_block_patch_1') ? this.isPendingCreation(resourceId) : this.hasPendingCreation()) {
311
+ var _this$fireAnalyticsEv6;
312
+ if (this.isPendingCreation(resourceId)) {
366
313
  this.commitPendingCreation(false, resourceId);
367
314
  }
368
315
  (0, _monitoring.logException)(error, {
369
316
  location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
370
317
  });
371
- (_this$fireAnalyticsEv8 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv8 === void 0 || _this$fireAnalyticsEv8.call(this, (0, _errorHandling.createErrorPayload)(error.message));
318
+ (_this$fireAnalyticsEv6 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv6 === void 0 || _this$fireAnalyticsEv6.call(this, (0, _errorHandling.createErrorPayload)(error.message));
372
319
  }
373
320
  }
374
321
  }, {
@@ -579,11 +526,11 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
579
526
  return sourceInfo;
580
527
  });
581
528
  } catch (error) {
582
- var _this$fireAnalyticsEv9;
529
+ var _this$fireAnalyticsEv7;
583
530
  (0, _monitoring.logException)(error, {
584
531
  location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
585
532
  });
586
- (_this$fireAnalyticsEv9 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv9 === void 0 || _this$fireAnalyticsEv9.call(this, (0, _errorHandling.getSourceInfoErrorPayload)(error.message));
533
+ (_this$fireAnalyticsEv7 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv7 === void 0 || _this$fireAnalyticsEv7.call(this, (0, _errorHandling.getSourceInfoErrorPayload)(error.message));
587
534
  return Promise.resolve(undefined);
588
535
  }
589
536
  }
@@ -596,11 +543,11 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
596
543
  }
597
544
  return this.dataProvider.fetchReferences(resourceId, true);
598
545
  } catch (error) {
599
- var _this$fireAnalyticsEv0;
546
+ var _this$fireAnalyticsEv8;
600
547
  (0, _monitoring.logException)(error, {
601
548
  location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
602
549
  });
603
- (_this$fireAnalyticsEv0 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv0 === void 0 || _this$fireAnalyticsEv0.call(this, (0, _errorHandling.fetchReferencesErrorPayload)(error.message));
550
+ (_this$fireAnalyticsEv8 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv8 === void 0 || _this$fireAnalyticsEv8.call(this, (0, _errorHandling.fetchReferencesErrorPayload)(error.message));
604
551
  return Promise.resolve({
605
552
  error: _types.SyncBlockError.Errored
606
553
  });
@@ -612,9 +559,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
612
559
  var _this$saveExperience4, _this$createExperienc2, _this$deleteExperienc4, _this$fetchSourceInfo2;
613
560
  this.syncBlockCache.clear();
614
561
  this.confirmationCallback = undefined;
615
- this.pendingResourceId = undefined;
616
562
  this.creationCompletionCallbacks.clear();
617
- this.creationCallback = undefined;
618
563
  this.dataProvider = undefined;
619
564
  (_this$saveExperience4 = this.saveExperience) === null || _this$saveExperience4 === void 0 || _this$saveExperience4.abort({
620
565
  reason: 'editorDestroyed'
@@ -12,7 +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
15
  var _ari = require("../clients/block-service/ari");
17
16
  var _types = require("../common/types");
18
17
  var _errorHandling = require("../utils/errorHandling");
@@ -34,7 +33,7 @@ var SyncBlockStoreManager = exports.SyncBlockStoreManager = /*#__PURE__*/functio
34
33
  this.sourceSyncBlockStoreManager = new _sourceSyncBlockStoreManager.SourceSyncBlockStoreManager(dataProvider);
35
34
  this.referenceSyncBlockStoreManager = new _referenceSyncBlockStoreManager.ReferenceSyncBlockStoreManager(dataProvider);
36
35
  this.dataProvider = dataProvider;
37
- this.referenceSyncBlockStoreManager.setRealTimeSubscriptionsEnabled((0, _platformFeatureFlags.fg)('platform_synced_block_patch_1'));
36
+ this.referenceSyncBlockStoreManager.setRealTimeSubscriptionsEnabled(true);
38
37
  }
39
38
  return (0, _createClass2.default)(SyncBlockStoreManager, [{
40
39
  key: "fetchReferencesSourceInfo",