@atlaskit/editor-synced-block-provider 4.3.0 → 4.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +45 -37
- package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +79 -39
- package/dist/cjs/store-manager/syncBlockStoreManager.js +125 -116
- package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +6 -1
- package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +29 -1
- package/dist/es2019/store-manager/syncBlockStoreManager.js +91 -91
- package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +45 -37
- package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +79 -39
- package/dist/esm/store-manager/syncBlockStoreManager.js +125 -116
- package/dist/types/store-manager/referenceSyncBlockStoreManager.d.ts +3 -1
- package/dist/types/store-manager/sourceSyncBlockStoreManager.d.ts +3 -1
- package/dist/types/store-manager/syncBlockStoreManager.d.ts +3 -1
- package/dist/types-ts4.5/store-manager/referenceSyncBlockStoreManager.d.ts +3 -1
- package/dist/types-ts4.5/store-manager/sourceSyncBlockStoreManager.d.ts +3 -1
- package/dist/types-ts4.5/store-manager/syncBlockStoreManager.d.ts +3 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-synced-block-provider
|
|
2
2
|
|
|
3
|
+
## 4.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`eaeabd907b737`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/eaeabd907b737) -
|
|
8
|
+
Move unregistered references logic into a separate method.
|
|
9
|
+
- [`38e89dd6515da`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/38e89dd6515da) -
|
|
10
|
+
Disable synced block write operations (create, update, delete, flush) when the editor is in view
|
|
11
|
+
mode, gated behind platform_synced_block_patch_8. This prevents unintended block service mutations
|
|
12
|
+
(e.g. deletion modals, data loss) when the editor is used in read-only contexts such as Version
|
|
13
|
+
History.
|
|
14
|
+
|
|
15
|
+
## 4.3.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 4.3.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
|
@@ -13,6 +13,7 @@ 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 _monitoring = require("@atlaskit/editor-common/monitoring");
|
|
16
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
17
|
var _types = require("../common/types");
|
|
17
18
|
var _errorHandling = require("../utils/errorHandling");
|
|
18
19
|
var _experienceTracking = require("../utils/experienceTracking");
|
|
@@ -37,7 +38,7 @@ var CACHE_KEY_PREFIX = 'sync-block-data-';
|
|
|
37
38
|
var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
38
39
|
// Track the setTimeout handle for queued flush so we can cancel it on destroy
|
|
39
40
|
|
|
40
|
-
function ReferenceSyncBlockStoreManager(dataProvider) {
|
|
41
|
+
function ReferenceSyncBlockStoreManager(dataProvider, viewMode) {
|
|
41
42
|
var _this = this,
|
|
42
43
|
_this$dataProvider;
|
|
43
44
|
(0, _classCallCheck2.default)(this, ReferenceSyncBlockStoreManager);
|
|
@@ -52,6 +53,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
52
53
|
// Track if another flush is needed after the current one completes
|
|
53
54
|
(0, _defineProperty2.default)(this, "flushNeededAfterCurrent", false);
|
|
54
55
|
this.dataProvider = dataProvider;
|
|
56
|
+
this.viewMode = viewMode;
|
|
55
57
|
this.syncBlockFetchDataRequests = new Map();
|
|
56
58
|
this.syncBlockSourceInfoRequests = new Map();
|
|
57
59
|
this.newlyAddedSyncBlocks = new Set();
|
|
@@ -702,14 +704,20 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
702
704
|
return _regenerator.default.wrap(function _callee3$(_context4) {
|
|
703
705
|
while (1) switch (_context4.prev = _context4.next) {
|
|
704
706
|
case 0:
|
|
705
|
-
if (this.
|
|
707
|
+
if (!(this.viewMode === 'view' && (0, _platformFeatureFlags.fg)('platform_synced_block_patch_8'))) {
|
|
706
708
|
_context4.next = 2;
|
|
707
709
|
break;
|
|
708
710
|
}
|
|
709
|
-
return _context4.abrupt("return",
|
|
711
|
+
return _context4.abrupt("return", false);
|
|
710
712
|
case 2:
|
|
713
|
+
if (this.isCacheDirty) {
|
|
714
|
+
_context4.next = 4;
|
|
715
|
+
break;
|
|
716
|
+
}
|
|
717
|
+
return _context4.abrupt("return", true);
|
|
718
|
+
case 4:
|
|
711
719
|
if (!this.isFlushInProgress) {
|
|
712
|
-
_context4.next =
|
|
720
|
+
_context4.next = 9;
|
|
713
721
|
break;
|
|
714
722
|
}
|
|
715
723
|
// Mark that another flush is needed after the current one completes
|
|
@@ -717,22 +725,22 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
717
725
|
|
|
718
726
|
// We return true here because we know the pending flush will handle the dirty cache
|
|
719
727
|
return _context4.abrupt("return", true);
|
|
720
|
-
case
|
|
728
|
+
case 9:
|
|
721
729
|
this.isFlushInProgress = true;
|
|
722
|
-
case
|
|
730
|
+
case 10:
|
|
723
731
|
success = true; // a copy of the subscriptions STRUCTURE (without the callbacks)
|
|
724
732
|
// To be saved as the last flushed structure if the flush is successful
|
|
725
733
|
syncedBlocksToFlush = {};
|
|
726
|
-
_context4.prev =
|
|
734
|
+
_context4.prev = 12;
|
|
727
735
|
if (this.dataProvider) {
|
|
728
|
-
_context4.next =
|
|
736
|
+
_context4.next = 15;
|
|
729
737
|
break;
|
|
730
738
|
}
|
|
731
739
|
throw new Error('Data provider not set');
|
|
732
|
-
case
|
|
740
|
+
case 15:
|
|
733
741
|
blocks = []; // First, build the complete subscription structure
|
|
734
742
|
_iterator = _createForOfIteratorHelper(this._subscriptionManager.getSubscriptions().entries());
|
|
735
|
-
_context4.prev =
|
|
743
|
+
_context4.prev = 17;
|
|
736
744
|
_loop = /*#__PURE__*/_regenerator.default.mark(function _loop() {
|
|
737
745
|
var _step$value, resourceId, callbacks;
|
|
738
746
|
return _regenerator.default.wrap(function _loop$(_context3) {
|
|
@@ -754,34 +762,34 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
754
762
|
}, _loop);
|
|
755
763
|
});
|
|
756
764
|
_iterator.s();
|
|
757
|
-
case
|
|
765
|
+
case 20:
|
|
758
766
|
if ((_step = _iterator.n()).done) {
|
|
759
|
-
_context4.next =
|
|
767
|
+
_context4.next = 24;
|
|
760
768
|
break;
|
|
761
769
|
}
|
|
762
|
-
return _context4.delegateYield(_loop(), "t0",
|
|
763
|
-
case 20:
|
|
764
|
-
_context4.next = 18;
|
|
765
|
-
break;
|
|
770
|
+
return _context4.delegateYield(_loop(), "t0", 22);
|
|
766
771
|
case 22:
|
|
767
|
-
_context4.next =
|
|
772
|
+
_context4.next = 20;
|
|
768
773
|
break;
|
|
769
774
|
case 24:
|
|
770
|
-
_context4.
|
|
771
|
-
|
|
775
|
+
_context4.next = 29;
|
|
776
|
+
break;
|
|
777
|
+
case 26:
|
|
778
|
+
_context4.prev = 26;
|
|
779
|
+
_context4.t1 = _context4["catch"](17);
|
|
772
780
|
_iterator.e(_context4.t1);
|
|
773
|
-
case
|
|
774
|
-
_context4.prev =
|
|
781
|
+
case 29:
|
|
782
|
+
_context4.prev = 29;
|
|
775
783
|
_iterator.f();
|
|
776
|
-
return _context4.finish(
|
|
777
|
-
case
|
|
784
|
+
return _context4.finish(29);
|
|
785
|
+
case 32:
|
|
778
786
|
if (!(0, _isEqual.default)(syncedBlocksToFlush, this.lastFlushedSyncedBlocks)) {
|
|
779
|
-
_context4.next =
|
|
787
|
+
_context4.next = 35;
|
|
780
788
|
break;
|
|
781
789
|
}
|
|
782
790
|
this.isCacheDirty = false; // Reset since we're considering this a successful no-op flush
|
|
783
791
|
return _context4.abrupt("return", true);
|
|
784
|
-
case
|
|
792
|
+
case 35:
|
|
785
793
|
// reset isCacheDirty early to prevent race condition
|
|
786
794
|
// There is a race condition where if a user makes changes (create/delete) to a reference sync block
|
|
787
795
|
// on a live page and the reference sync block is being saved while the user
|
|
@@ -789,9 +797,9 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
789
797
|
// exactly at a time when the updateReferenceData is being executed asynchronously.
|
|
790
798
|
this.isCacheDirty = false;
|
|
791
799
|
(_this$saveExperience = this.saveExperience) === null || _this$saveExperience === void 0 || _this$saveExperience.start();
|
|
792
|
-
_context4.next =
|
|
800
|
+
_context4.next = 39;
|
|
793
801
|
return this.dataProvider.updateReferenceData(blocks);
|
|
794
|
-
case
|
|
802
|
+
case 39:
|
|
795
803
|
updateResult = _context4.sent;
|
|
796
804
|
if (!updateResult.success) {
|
|
797
805
|
success = false;
|
|
@@ -800,11 +808,11 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
800
808
|
});
|
|
801
809
|
(_this$fireAnalyticsEv6 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv6 === void 0 || _this$fireAnalyticsEv6.call(this, (0, _errorHandling.updateReferenceErrorPayload)(updateResult.error || 'Failed to update reference synced blocks on the document'));
|
|
802
810
|
}
|
|
803
|
-
_context4.next =
|
|
811
|
+
_context4.next = 49;
|
|
804
812
|
break;
|
|
805
|
-
case
|
|
806
|
-
_context4.prev =
|
|
807
|
-
_context4.t2 = _context4["catch"](
|
|
813
|
+
case 43:
|
|
814
|
+
_context4.prev = 43;
|
|
815
|
+
_context4.t2 = _context4["catch"](12);
|
|
808
816
|
success = false;
|
|
809
817
|
(0, _monitoring.logException)(_context4.t2, {
|
|
810
818
|
location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
|
|
@@ -813,8 +821,8 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
813
821
|
reason: _context4.t2.message
|
|
814
822
|
});
|
|
815
823
|
(_this$fireAnalyticsEv7 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv7 === void 0 || _this$fireAnalyticsEv7.call(this, (0, _errorHandling.updateReferenceErrorPayload)(_context4.t2.message));
|
|
816
|
-
case
|
|
817
|
-
_context4.prev =
|
|
824
|
+
case 49:
|
|
825
|
+
_context4.prev = 49;
|
|
818
826
|
if (!success) {
|
|
819
827
|
// set isCacheDirty back to true for cases where it failed to update the reference synced blocks on the BE
|
|
820
828
|
this.isCacheDirty = true;
|
|
@@ -836,14 +844,14 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
836
844
|
void _this7.flush();
|
|
837
845
|
}, 0);
|
|
838
846
|
}
|
|
839
|
-
return _context4.finish(
|
|
840
|
-
case
|
|
847
|
+
return _context4.finish(49);
|
|
848
|
+
case 54:
|
|
841
849
|
return _context4.abrupt("return", success);
|
|
842
|
-
case
|
|
850
|
+
case 55:
|
|
843
851
|
case "end":
|
|
844
852
|
return _context4.stop();
|
|
845
853
|
}
|
|
846
|
-
}, _callee3, this, [[
|
|
854
|
+
}, _callee3, this, [[12, 43, 49, 54], [17, 26, 29, 32]]);
|
|
847
855
|
}));
|
|
848
856
|
function flush() {
|
|
849
857
|
return _flush.apply(this, arguments);
|
|
@@ -26,17 +26,21 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
26
26
|
// Handles caching, debouncing updates, and publish/subscribe for local changes.
|
|
27
27
|
// Ensures consistency between local and remote state, and can be used in both editor and renderer contexts.
|
|
28
28
|
var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
29
|
-
function SourceSyncBlockStoreManager(dataProvider) {
|
|
29
|
+
function SourceSyncBlockStoreManager(dataProvider, viewMode) {
|
|
30
30
|
var _this = this;
|
|
31
31
|
(0, _classCallCheck2.default)(this, SourceSyncBlockStoreManager);
|
|
32
32
|
(0, _defineProperty2.default)(this, "hasReceivedContentChange", false);
|
|
33
33
|
(0, _defineProperty2.default)(this, "setPendingDeletion", function (Ids, value) {
|
|
34
|
+
if (_this.viewMode === 'view' && (0, _platformFeatureFlags.fg)('platform_synced_block_patch_8')) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
34
37
|
var syncBlock = _this.syncBlockCache.get(Ids.resourceId);
|
|
35
38
|
if (syncBlock) {
|
|
36
39
|
syncBlock.pendingDeletion = value;
|
|
37
40
|
}
|
|
38
41
|
});
|
|
39
42
|
this.dataProvider = dataProvider;
|
|
43
|
+
this.viewMode = viewMode;
|
|
40
44
|
this.syncBlockCache = new Map();
|
|
41
45
|
this.creationCompletionCallbacks = new Map();
|
|
42
46
|
}
|
|
@@ -74,6 +78,9 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
74
78
|
key: "updateSyncBlockData",
|
|
75
79
|
value: function updateSyncBlockData(syncBlockNode) {
|
|
76
80
|
try {
|
|
81
|
+
if (this.viewMode === 'view' && (0, _platformFeatureFlags.fg)('platform_synced_block_patch_8')) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
77
84
|
if (!this.isSourceBlock(syncBlockNode)) {
|
|
78
85
|
throw new Error('Invalid sync block node type provided for updateSyncBlockData');
|
|
79
86
|
}
|
|
@@ -134,6 +141,12 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
134
141
|
while (1) switch (_context.prev = _context.next) {
|
|
135
142
|
case 0:
|
|
136
143
|
_context.prev = 0;
|
|
144
|
+
if (!(this.viewMode === 'view' && (0, _platformFeatureFlags.fg)('platform_synced_block_patch_8'))) {
|
|
145
|
+
_context.next = 3;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
return _context.abrupt("return", false);
|
|
149
|
+
case 3:
|
|
137
150
|
bodiedSyncBlockNodes = [];
|
|
138
151
|
bodiedSyncBlockData = [];
|
|
139
152
|
Array.from(this.syncBlockCache.values()).forEach(function (syncBlockData) {
|
|
@@ -163,21 +176,21 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
163
176
|
}
|
|
164
177
|
});
|
|
165
178
|
if (!(bodiedSyncBlockNodes.length === 0)) {
|
|
166
|
-
_context.next =
|
|
179
|
+
_context.next = 8;
|
|
167
180
|
break;
|
|
168
181
|
}
|
|
169
182
|
return _context.abrupt("return", Promise.resolve(true));
|
|
170
|
-
case
|
|
183
|
+
case 8:
|
|
171
184
|
if (this.dataProvider) {
|
|
172
|
-
_context.next =
|
|
185
|
+
_context.next = 10;
|
|
173
186
|
break;
|
|
174
187
|
}
|
|
175
188
|
throw new Error('Data provider not set');
|
|
176
|
-
case
|
|
189
|
+
case 10:
|
|
177
190
|
(_this$saveExperience = this.saveExperience) === null || _this$saveExperience === void 0 || _this$saveExperience.start({});
|
|
178
|
-
_context.next =
|
|
191
|
+
_context.next = 13;
|
|
179
192
|
return this.dataProvider.writeNodesData(bodiedSyncBlockNodes, bodiedSyncBlockData);
|
|
180
|
-
case
|
|
193
|
+
case 13:
|
|
181
194
|
writeResults = _context.sent;
|
|
182
195
|
writeResults.forEach(function (result) {
|
|
183
196
|
// set isDirty to true for cases where it failed to save the sync block to the BE
|
|
@@ -191,7 +204,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
191
204
|
if (!writeResults.every(function (result) {
|
|
192
205
|
return result.resourceId && !result.error;
|
|
193
206
|
})) {
|
|
194
|
-
_context.next =
|
|
207
|
+
_context.next = 21;
|
|
195
208
|
break;
|
|
196
209
|
}
|
|
197
210
|
(_this$saveExperience2 = this.saveExperience) === null || _this$saveExperience2 === void 0 || _this$saveExperience2.success();
|
|
@@ -202,7 +215,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
202
215
|
}
|
|
203
216
|
});
|
|
204
217
|
return _context.abrupt("return", true);
|
|
205
|
-
case
|
|
218
|
+
case 21:
|
|
206
219
|
(_this$saveExperience3 = this.saveExperience) === null || _this$saveExperience3 === void 0 || _this$saveExperience3.failure();
|
|
207
220
|
writeResults.filter(function (result) {
|
|
208
221
|
return !result.resourceId || result.error;
|
|
@@ -211,28 +224,28 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
211
224
|
(_this2$fireAnalyticsE2 = _this2.fireAnalyticsEvent) === null || _this2$fireAnalyticsE2 === void 0 || _this2$fireAnalyticsE2.call(_this2, (0, _errorHandling.updateErrorPayload)(result.error || 'Failed to write data', result.resourceId));
|
|
212
225
|
});
|
|
213
226
|
return _context.abrupt("return", false);
|
|
214
|
-
case 22:
|
|
215
|
-
_context.next = 29;
|
|
216
|
-
break;
|
|
217
227
|
case 24:
|
|
218
|
-
_context.
|
|
228
|
+
_context.next = 31;
|
|
229
|
+
break;
|
|
230
|
+
case 26:
|
|
231
|
+
_context.prev = 26;
|
|
219
232
|
_context.t0 = _context["catch"](0);
|
|
220
233
|
(0, _monitoring.logException)(_context.t0, {
|
|
221
234
|
location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
|
|
222
235
|
});
|
|
223
236
|
(_this$fireAnalyticsEv2 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv2 === void 0 || _this$fireAnalyticsEv2.call(this, (0, _errorHandling.updateErrorPayload)(_context.t0.message));
|
|
224
237
|
return _context.abrupt("return", false);
|
|
225
|
-
case
|
|
226
|
-
_context.prev =
|
|
238
|
+
case 31:
|
|
239
|
+
_context.prev = 31;
|
|
227
240
|
if ((0, _platformFeatureFlags.fg)('platform_synced_block_patch_7')) {
|
|
228
241
|
(_this$flushCompletion = this.flushCompletionCallback) === null || _this$flushCompletion === void 0 || _this$flushCompletion.call(this);
|
|
229
242
|
}
|
|
230
|
-
return _context.finish(
|
|
231
|
-
case
|
|
243
|
+
return _context.finish(31);
|
|
244
|
+
case 34:
|
|
232
245
|
case "end":
|
|
233
246
|
return _context.stop();
|
|
234
247
|
}
|
|
235
|
-
}, _callee, this, [[0,
|
|
248
|
+
}, _callee, this, [[0, 26, 31, 34]]);
|
|
236
249
|
}));
|
|
237
250
|
function flush() {
|
|
238
251
|
return _flush.apply(this, arguments);
|
|
@@ -242,6 +255,9 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
242
255
|
}, {
|
|
243
256
|
key: "hasUnsavedChanges",
|
|
244
257
|
value: function hasUnsavedChanges() {
|
|
258
|
+
if (this.viewMode === 'view' && (0, _platformFeatureFlags.fg)('platform_synced_block_patch_8')) {
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
245
261
|
return this.hasReceivedContentChange && Array.from(this.syncBlockCache.values()).some(function (syncBlockData) {
|
|
246
262
|
return syncBlockData.isDirty;
|
|
247
263
|
});
|
|
@@ -259,6 +275,9 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
259
275
|
}, {
|
|
260
276
|
key: "commitPendingCreation",
|
|
261
277
|
value: function commitPendingCreation(success, resourceId) {
|
|
278
|
+
if (this.viewMode === 'view' && (0, _platformFeatureFlags.fg)('platform_synced_block_patch_8')) {
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
262
281
|
var onCompletion = this.creationCompletionCallbacks.get(resourceId);
|
|
263
282
|
if (onCompletion) {
|
|
264
283
|
this.creationCompletionCallbacks.delete(resourceId);
|
|
@@ -325,6 +344,9 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
325
344
|
key: "createBodiedSyncBlockNode",
|
|
326
345
|
value: function createBodiedSyncBlockNode(attrs, onCompletion) {
|
|
327
346
|
var _this4 = this;
|
|
347
|
+
if (this.viewMode === 'view' && (0, _platformFeatureFlags.fg)('platform_synced_block_patch_8')) {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
328
350
|
var resourceId = attrs.resourceId,
|
|
329
351
|
blockInstanceId = attrs.localId;
|
|
330
352
|
try {
|
|
@@ -384,21 +406,27 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
384
406
|
while (1) switch (_context2.prev = _context2.next) {
|
|
385
407
|
case 0:
|
|
386
408
|
_context2.prev = 0;
|
|
387
|
-
if (this.
|
|
409
|
+
if (!(this.viewMode === 'view' && (0, _platformFeatureFlags.fg)('platform_synced_block_patch_8'))) {
|
|
388
410
|
_context2.next = 3;
|
|
389
411
|
break;
|
|
390
412
|
}
|
|
391
|
-
|
|
413
|
+
return _context2.abrupt("return", false);
|
|
392
414
|
case 3:
|
|
415
|
+
if (this.dataProvider) {
|
|
416
|
+
_context2.next = 5;
|
|
417
|
+
break;
|
|
418
|
+
}
|
|
419
|
+
throw new Error('Data provider not set');
|
|
420
|
+
case 5:
|
|
393
421
|
syncBlockIds.forEach(function (Ids) {
|
|
394
422
|
_this5.setPendingDeletion(Ids, true);
|
|
395
423
|
});
|
|
396
424
|
(_this$deleteExperienc = this.deleteExperience) === null || _this$deleteExperienc === void 0 || _this$deleteExperienc.start({});
|
|
397
|
-
_context2.next =
|
|
425
|
+
_context2.next = 9;
|
|
398
426
|
return this.dataProvider.deleteNodesData(syncBlockIds.map(function (attrs) {
|
|
399
427
|
return attrs.resourceId;
|
|
400
428
|
}), reason);
|
|
401
|
-
case
|
|
429
|
+
case 9:
|
|
402
430
|
results = _context2.sent;
|
|
403
431
|
isDeleteSuccessful = results.every(function (result) {
|
|
404
432
|
return result.success;
|
|
@@ -432,8 +460,8 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
432
460
|
}
|
|
433
461
|
syncBlockIds.forEach(callback);
|
|
434
462
|
return _context2.abrupt("return", isDeleteSuccessful);
|
|
435
|
-
case
|
|
436
|
-
_context2.prev =
|
|
463
|
+
case 17:
|
|
464
|
+
_context2.prev = 17;
|
|
437
465
|
_context2.t0 = _context2["catch"](0);
|
|
438
466
|
syncBlockIds.forEach(function (Ids) {
|
|
439
467
|
var _this5$fireAnalyticsE4;
|
|
@@ -445,11 +473,11 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
445
473
|
});
|
|
446
474
|
onDeleteCompleted(false);
|
|
447
475
|
return _context2.abrupt("return", false);
|
|
448
|
-
case
|
|
476
|
+
case 23:
|
|
449
477
|
case "end":
|
|
450
478
|
return _context2.stop();
|
|
451
479
|
}
|
|
452
|
-
}, _callee2, this, [[0,
|
|
480
|
+
}, _callee2, this, [[0, 17]]);
|
|
453
481
|
}));
|
|
454
482
|
function _delete(_x, _x2, _x3, _x4) {
|
|
455
483
|
return _delete2.apply(this, arguments);
|
|
@@ -469,20 +497,26 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
469
497
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
470
498
|
while (1) switch (_context3.prev = _context3.next) {
|
|
471
499
|
case 0:
|
|
472
|
-
if (this.
|
|
500
|
+
if (!(this.viewMode === 'view' && (0, _platformFeatureFlags.fg)('platform_synced_block_patch_8'))) {
|
|
473
501
|
_context3.next = 2;
|
|
474
502
|
break;
|
|
475
503
|
}
|
|
476
504
|
return _context3.abrupt("return", Promise.resolve());
|
|
477
505
|
case 2:
|
|
506
|
+
if (this.deletionRetryInfo) {
|
|
507
|
+
_context3.next = 4;
|
|
508
|
+
break;
|
|
509
|
+
}
|
|
510
|
+
return _context3.abrupt("return", Promise.resolve());
|
|
511
|
+
case 4:
|
|
478
512
|
_this$deletionRetryIn = this.deletionRetryInfo, syncBlockIds = _this$deletionRetryIn.syncBlockIds, onDelete = _this$deletionRetryIn.onDelete, onDeleteCompleted = _this$deletionRetryIn.onDeleteCompleted, deletionReason = _this$deletionRetryIn.deletionReason;
|
|
479
513
|
if (!this.confirmationCallback) {
|
|
480
|
-
_context3.next =
|
|
514
|
+
_context3.next = 8;
|
|
481
515
|
break;
|
|
482
516
|
}
|
|
483
|
-
_context3.next =
|
|
517
|
+
_context3.next = 8;
|
|
484
518
|
return this.delete(syncBlockIds, onDelete, onDeleteCompleted, deletionReason);
|
|
485
|
-
case
|
|
519
|
+
case 8:
|
|
486
520
|
case "end":
|
|
487
521
|
return _context3.stop();
|
|
488
522
|
}
|
|
@@ -516,21 +550,27 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
516
550
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
517
551
|
while (1) switch (_context4.prev = _context4.next) {
|
|
518
552
|
case 0:
|
|
553
|
+
if (!(this.viewMode === 'view' && (0, _platformFeatureFlags.fg)('platform_synced_block_patch_8'))) {
|
|
554
|
+
_context4.next = 2;
|
|
555
|
+
break;
|
|
556
|
+
}
|
|
557
|
+
return _context4.abrupt("return", Promise.resolve());
|
|
558
|
+
case 2:
|
|
519
559
|
if (!this.confirmationCallback) {
|
|
520
|
-
_context4.next =
|
|
560
|
+
_context4.next = 14;
|
|
521
561
|
break;
|
|
522
562
|
}
|
|
523
|
-
_context4.next =
|
|
563
|
+
_context4.next = 5;
|
|
524
564
|
return this.confirmationCallback(syncBlockIds, deletionReason);
|
|
525
|
-
case
|
|
565
|
+
case 5:
|
|
526
566
|
confirmed = _context4.sent;
|
|
527
567
|
if (!confirmed) {
|
|
528
|
-
_context4.next =
|
|
568
|
+
_context4.next = 13;
|
|
529
569
|
break;
|
|
530
570
|
}
|
|
531
|
-
_context4.next =
|
|
571
|
+
_context4.next = 9;
|
|
532
572
|
return this.delete(syncBlockIds, onDelete, onDeleteCompleted, deletionReason);
|
|
533
|
-
case
|
|
573
|
+
case 9:
|
|
534
574
|
isDeleteSuccessful = _context4.sent;
|
|
535
575
|
if (!isDeleteSuccessful) {
|
|
536
576
|
// If deletion failed, save deletion info for potential retry
|
|
@@ -544,11 +584,11 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
544
584
|
} else {
|
|
545
585
|
destroyCallback();
|
|
546
586
|
}
|
|
547
|
-
_context4.next =
|
|
587
|
+
_context4.next = 14;
|
|
548
588
|
break;
|
|
549
|
-
case
|
|
589
|
+
case 13:
|
|
550
590
|
destroyCallback();
|
|
551
|
-
case
|
|
591
|
+
case 14:
|
|
552
592
|
case "end":
|
|
553
593
|
return _context4.stop();
|
|
554
594
|
}
|