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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/clients/block-service/blockService.js +9 -14
  3. package/dist/cjs/clients/confluence/sourceInfo.js +3 -35
  4. package/dist/cjs/hooks/useFetchSyncBlockData.js +5 -11
  5. package/dist/cjs/providers/block-service/blockServiceAPI.js +1 -1
  6. package/dist/cjs/providers/syncBlockProvider.js +29 -72
  7. package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +75 -124
  8. package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +59 -93
  9. package/dist/cjs/store-manager/syncBlockStoreManager.js +2 -4
  10. package/dist/cjs/utils/errorHandling.js +2 -5
  11. package/dist/cjs/utils/resolveSyncBlockInstance.js +1 -3
  12. package/dist/cjs/utils/utils.js +5 -6
  13. package/dist/es2019/clients/block-service/blockService.js +5 -9
  14. package/dist/es2019/clients/confluence/sourceInfo.js +1 -4
  15. package/dist/es2019/hooks/useFetchSyncBlockData.js +6 -12
  16. package/dist/es2019/providers/block-service/blockServiceAPI.js +1 -1
  17. package/dist/es2019/providers/syncBlockProvider.js +21 -53
  18. package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +65 -114
  19. package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +60 -92
  20. package/dist/es2019/store-manager/syncBlockStoreManager.js +2 -4
  21. package/dist/es2019/utils/errorHandling.js +1 -4
  22. package/dist/es2019/utils/resolveSyncBlockInstance.js +2 -5
  23. package/dist/es2019/utils/utils.js +5 -6
  24. package/dist/esm/clients/block-service/blockService.js +9 -14
  25. package/dist/esm/clients/confluence/sourceInfo.js +2 -34
  26. package/dist/esm/hooks/useFetchSyncBlockData.js +5 -11
  27. package/dist/esm/providers/block-service/blockServiceAPI.js +1 -1
  28. package/dist/esm/providers/syncBlockProvider.js +29 -72
  29. package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +75 -124
  30. package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +59 -93
  31. package/dist/esm/store-manager/syncBlockStoreManager.js +2 -4
  32. package/dist/esm/utils/errorHandling.js +2 -5
  33. package/dist/esm/utils/resolveSyncBlockInstance.js +1 -3
  34. package/dist/esm/utils/utils.js +5 -6
  35. package/dist/types/clients/confluence/sourceInfo.d.ts +1 -2
  36. package/dist/types/hooks/useFetchSyncBlockData.d.ts +1 -1
  37. package/dist/types/providers/syncBlockProvider.d.ts +1 -1
  38. package/dist/types/providers/types.d.ts +2 -2
  39. package/dist/types/store-manager/sourceSyncBlockStoreManager.d.ts +1 -1
  40. package/dist/types-ts4.5/clients/confluence/sourceInfo.d.ts +1 -2
  41. package/dist/types-ts4.5/hooks/useFetchSyncBlockData.d.ts +1 -1
  42. package/dist/types-ts4.5/providers/syncBlockProvider.d.ts +1 -1
  43. package/dist/types-ts4.5/providers/types.d.ts +2 -2
  44. package/dist/types-ts4.5/store-manager/sourceSyncBlockStoreManager.d.ts +1 -1
  45. package/package.json +2 -5
@@ -1,6 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { logException } from '@atlaskit/editor-common/monitoring';
3
- import { fg } from '@atlaskit/platform-feature-flags';
4
3
  import { SyncBlockError } from '../common/types';
5
4
  import { updateErrorPayload, createErrorPayload, deleteErrorPayload, updateCacheErrorPayload, getSourceInfoErrorPayload, updateSuccessPayload, createSuccessPayload, deleteSuccessPayload, fetchReferencesErrorPayload } from '../utils/errorHandling';
6
5
  import { getCreateSourceExperience, getDeleteSourceExperience, getSaveSourceExperience, getFetchSourceInfoExperience } from '../utils/experienceTracking';
@@ -71,6 +70,7 @@ export class SourceSyncBlockStoreManager {
71
70
  */
72
71
  async flush() {
73
72
  try {
73
+ var _this$saveExperience;
74
74
  const bodiedSyncBlockNodes = [];
75
75
  const bodiedSyncBlockData = [];
76
76
  Array.from(this.syncBlockCache.values()).forEach(syncBlockData => {
@@ -100,10 +100,7 @@ export class SourceSyncBlockStoreManager {
100
100
  if (!this.dataProvider) {
101
101
  throw new Error('Data provider not set');
102
102
  }
103
- if (fg('platform_synced_block_dogfooding')) {
104
- var _this$saveExperience;
105
- (_this$saveExperience = this.saveExperience) === null || _this$saveExperience === void 0 ? void 0 : _this$saveExperience.start({});
106
- }
103
+ (_this$saveExperience = this.saveExperience) === null || _this$saveExperience === void 0 ? void 0 : _this$saveExperience.start({});
107
104
  const writeResults = await this.dataProvider.writeNodesData(bodiedSyncBlockNodes, bodiedSyncBlockData);
108
105
  writeResults.forEach(result => {
109
106
  // set isDirty to true for cases where it failed to save the sync block to the BE
@@ -115,22 +112,18 @@ export class SourceSyncBlockStoreManager {
115
112
  }
116
113
  });
117
114
  if (writeResults.every(result => result.resourceId && !result.error)) {
118
- if (fg('platform_synced_block_dogfooding')) {
119
- var _this$saveExperience2;
120
- (_this$saveExperience2 = this.saveExperience) === null || _this$saveExperience2 === void 0 ? void 0 : _this$saveExperience2.success();
121
- writeResults.forEach(result => {
122
- if (result.resourceId && !result.error) {
123
- var _this$fireAnalyticsEv2;
124
- (_this$fireAnalyticsEv2 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv2 === void 0 ? void 0 : _this$fireAnalyticsEv2.call(this, updateSuccessPayload(result.resourceId, false));
125
- }
126
- });
127
- }
115
+ var _this$saveExperience2;
116
+ (_this$saveExperience2 = this.saveExperience) === null || _this$saveExperience2 === void 0 ? void 0 : _this$saveExperience2.success();
117
+ writeResults.forEach(result => {
118
+ if (result.resourceId && !result.error) {
119
+ var _this$fireAnalyticsEv2;
120
+ (_this$fireAnalyticsEv2 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv2 === void 0 ? void 0 : _this$fireAnalyticsEv2.call(this, updateSuccessPayload(result.resourceId, false));
121
+ }
122
+ });
128
123
  return true;
129
124
  } else {
130
- if (fg('platform_synced_block_dogfooding')) {
131
- var _this$saveExperience3;
132
- (_this$saveExperience3 = this.saveExperience) === null || _this$saveExperience3 === void 0 ? void 0 : _this$saveExperience3.failure();
133
- }
125
+ var _this$saveExperience3;
126
+ (_this$saveExperience3 = this.saveExperience) === null || _this$saveExperience3 === void 0 ? void 0 : _this$saveExperience3.failure();
134
127
  writeResults.filter(result => !result.resourceId || result.error).forEach(result => {
135
128
  var _this$fireAnalyticsEv3;
136
129
  (_this$fireAnalyticsEv3 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv3 === void 0 ? void 0 : _this$fireAnalyticsEv3.call(this, updateErrorPayload(result.error || 'Failed to write data', result.resourceId));
@@ -163,12 +156,10 @@ export class SourceSyncBlockStoreManager {
163
156
  */
164
157
  commitPendingCreation(success) {
165
158
  if (success && this.creationCallback) {
159
+ var _this$fireAnalyticsEv5;
166
160
  this.creationCallback();
167
- if (fg('platform_synced_block_dogfooding')) {
168
- var _this$fireAnalyticsEv5;
169
- (_this$fireAnalyticsEv5 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv5 === void 0 ? void 0 : _this$fireAnalyticsEv5.call(this, createSuccessPayload(this.pendingResourceId || ''));
170
- }
171
- } else if (success && !this.creationCallback && fg('platform_synced_block_dogfooding')) {
161
+ (_this$fireAnalyticsEv5 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv5 === void 0 ? void 0 : _this$fireAnalyticsEv5.call(this, createSuccessPayload(this.pendingResourceId || ''));
162
+ } else if (success && !this.creationCallback) {
172
163
  var _this$fireAnalyticsEv6;
173
164
  (_this$fireAnalyticsEv6 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv6 === void 0 ? void 0 : _this$fireAnalyticsEv6.call(this, createErrorPayload('creation callback missing', this.pendingResourceId));
174
165
  }
@@ -232,11 +223,9 @@ export class SourceSyncBlockStoreManager {
232
223
  }).then(result => {
233
224
  const resourceId = result.resourceId;
234
225
  if (resourceId) {
226
+ var _this$createExperienc2;
235
227
  this.commitPendingCreation(true);
236
- if (fg('platform_synced_block_dogfooding')) {
237
- var _this$createExperienc2;
238
- (_this$createExperienc2 = this.createExperience) === null || _this$createExperienc2 === void 0 ? void 0 : _this$createExperienc2.success();
239
- }
228
+ (_this$createExperienc2 = this.createExperience) === null || _this$createExperienc2 === void 0 ? void 0 : _this$createExperienc2.success();
240
229
 
241
230
  // Update the sync block data with the node data if it is provided
242
231
  // to avoid any race conditions where the data could be missed during a render operation
@@ -244,28 +233,22 @@ export class SourceSyncBlockStoreManager {
244
233
  this.updateSyncBlockData(nodeData);
245
234
  }
246
235
  } else {
247
- var _this$fireAnalyticsEv7;
236
+ var _this$createExperienc3, _this$fireAnalyticsEv7;
248
237
  this.commitPendingCreation(false);
249
- if (fg('platform_synced_block_dogfooding')) {
250
- var _this$createExperienc3;
251
- (_this$createExperienc3 = this.createExperience) === null || _this$createExperienc3 === void 0 ? void 0 : _this$createExperienc3.failure({
252
- reason: result.error || 'Failed to create bodied sync block'
253
- });
254
- }
238
+ (_this$createExperienc3 = this.createExperience) === null || _this$createExperienc3 === void 0 ? void 0 : _this$createExperienc3.failure({
239
+ reason: result.error || 'Failed to create bodied sync block'
240
+ });
255
241
  (_this$fireAnalyticsEv7 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv7 === void 0 ? void 0 : _this$fireAnalyticsEv7.call(this, createErrorPayload(result.error || 'Failed to create bodied sync block', resourceId));
256
242
  }
257
243
  }).catch(error => {
258
- var _this$fireAnalyticsEv8;
244
+ var _this$createExperienc4, _this$fireAnalyticsEv8;
259
245
  this.commitPendingCreation(false);
260
246
  logException(error, {
261
247
  location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
262
248
  });
263
- if (fg('platform_synced_block_dogfooding')) {
264
- var _this$createExperienc4;
265
- (_this$createExperienc4 = this.createExperience) === null || _this$createExperienc4 === void 0 ? void 0 : _this$createExperienc4.failure({
266
- reason: error.message
267
- });
268
- }
249
+ (_this$createExperienc4 = this.createExperience) === null || _this$createExperienc4 === void 0 ? void 0 : _this$createExperienc4.failure({
250
+ reason: error.message
251
+ });
269
252
  (_this$fireAnalyticsEv8 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv8 === void 0 ? void 0 : _this$fireAnalyticsEv8.call(this, createErrorPayload(error.message, resourceId));
270
253
  });
271
254
  this.registerPendingCreation(resourceId);
@@ -282,62 +265,51 @@ export class SourceSyncBlockStoreManager {
282
265
  }
283
266
  async delete(syncBlockIds, onDelete, onDeleteCompleted, reason) {
284
267
  try {
268
+ var _this$deleteExperienc;
285
269
  if (!this.dataProvider) {
286
270
  throw new Error('Data provider not set');
287
271
  }
288
272
  syncBlockIds.forEach(Ids => {
289
273
  this.setPendingDeletion(Ids, true);
290
274
  });
291
- if (fg('platform_synced_block_dogfooding')) {
292
- var _this$deleteExperienc;
293
- (_this$deleteExperienc = this.deleteExperience) === null || _this$deleteExperienc === void 0 ? void 0 : _this$deleteExperienc.start({});
294
- }
275
+ (_this$deleteExperienc = this.deleteExperience) === null || _this$deleteExperienc === void 0 ? void 0 : _this$deleteExperienc.start({});
295
276
  const results = await this.dataProvider.deleteNodesData(syncBlockIds.map(attrs => attrs.resourceId), reason);
296
277
  let callback;
297
278
  const isDeleteSuccessful = results.every(result => result.success);
298
279
  onDeleteCompleted(isDeleteSuccessful);
299
280
  if (isDeleteSuccessful) {
281
+ var _this$deleteExperienc2;
300
282
  onDelete();
301
283
  callback = Ids => this.syncBlockCache.delete(Ids.resourceId);
302
284
  this.clearPendingDeletion();
303
- if (fg('platform_synced_block_dogfooding')) {
304
- var _this$deleteExperienc2;
305
- (_this$deleteExperienc2 = this.deleteExperience) === null || _this$deleteExperienc2 === void 0 ? void 0 : _this$deleteExperienc2.success();
306
- results.forEach(result => {
307
- var _this$fireAnalyticsEv0;
308
- (_this$fireAnalyticsEv0 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv0 === void 0 ? void 0 : _this$fireAnalyticsEv0.call(this, deleteSuccessPayload(result.resourceId));
309
- });
310
- }
285
+ (_this$deleteExperienc2 = this.deleteExperience) === null || _this$deleteExperienc2 === void 0 ? void 0 : _this$deleteExperienc2.success();
286
+ results.forEach(result => {
287
+ var _this$fireAnalyticsEv0;
288
+ (_this$fireAnalyticsEv0 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv0 === void 0 ? void 0 : _this$fireAnalyticsEv0.call(this, deleteSuccessPayload(result.resourceId));
289
+ });
311
290
  } else {
291
+ var _this$deleteExperienc3;
312
292
  callback = Ids => {
313
293
  this.setPendingDeletion(Ids, false);
314
294
  };
315
- if (fg('platform_synced_block_dogfooding')) {
316
- var _this$deleteExperienc3;
317
- (_this$deleteExperienc3 = this.deleteExperience) === null || _this$deleteExperienc3 === void 0 ? void 0 : _this$deleteExperienc3.failure();
318
- results.forEach(result => {
319
- if (result.success) {
320
- var _this$fireAnalyticsEv1;
321
- (_this$fireAnalyticsEv1 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv1 === void 0 ? void 0 : _this$fireAnalyticsEv1.call(this, deleteSuccessPayload(result.resourceId));
322
- } else {
323
- var _this$fireAnalyticsEv10;
324
- (_this$fireAnalyticsEv10 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv10 === void 0 ? void 0 : _this$fireAnalyticsEv10.call(this, deleteErrorPayload(result.error || 'Failed to delete synced block', result.resourceId));
325
- }
326
- });
327
- } else {
328
- results.filter(result => result.resourceId === undefined).forEach(result => {
329
- var _this$fireAnalyticsEv11;
330
- (_this$fireAnalyticsEv11 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv11 === void 0 ? void 0 : _this$fireAnalyticsEv11.call(this, deleteErrorPayload(result.error || 'Failed to delete synced block'));
331
- });
332
- }
295
+ (_this$deleteExperienc3 = this.deleteExperience) === null || _this$deleteExperienc3 === void 0 ? void 0 : _this$deleteExperienc3.failure();
296
+ results.forEach(result => {
297
+ if (result.success) {
298
+ var _this$fireAnalyticsEv1;
299
+ (_this$fireAnalyticsEv1 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv1 === void 0 ? void 0 : _this$fireAnalyticsEv1.call(this, deleteSuccessPayload(result.resourceId));
300
+ } else {
301
+ var _this$fireAnalyticsEv10;
302
+ (_this$fireAnalyticsEv10 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv10 === void 0 ? void 0 : _this$fireAnalyticsEv10.call(this, deleteErrorPayload(result.error || 'Failed to delete synced block', result.resourceId));
303
+ }
304
+ });
333
305
  }
334
306
  syncBlockIds.forEach(callback);
335
307
  return isDeleteSuccessful;
336
308
  } catch (error) {
337
309
  syncBlockIds.forEach(Ids => {
338
- var _this$fireAnalyticsEv12;
310
+ var _this$fireAnalyticsEv11;
339
311
  this.setPendingDeletion(Ids, false);
340
- (_this$fireAnalyticsEv12 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv12 === void 0 ? void 0 : _this$fireAnalyticsEv12.call(this, deleteErrorPayload(error.message, Ids.resourceId));
312
+ (_this$fireAnalyticsEv11 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv11 === void 0 ? void 0 : _this$fireAnalyticsEv11.call(this, deleteErrorPayload(error.message, Ids.resourceId));
341
313
  });
342
314
  logException(error, {
343
315
  location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
@@ -400,33 +372,29 @@ export class SourceSyncBlockStoreManager {
400
372
  }
401
373
  getSyncBlockSourceInfo(localId) {
402
374
  try {
375
+ var _this$fetchSourceInfo;
403
376
  if (!this.dataProvider) {
404
377
  throw new Error('Data provider not set');
405
378
  }
406
- if (fg('platform_synced_block_dogfooding')) {
407
- var _this$fetchSourceInfo;
408
- (_this$fetchSourceInfo = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo === void 0 ? void 0 : _this$fetchSourceInfo.start();
409
- }
379
+ (_this$fetchSourceInfo = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo === void 0 ? void 0 : _this$fetchSourceInfo.start();
410
380
  return this.dataProvider.fetchSyncBlockSourceInfo(localId, undefined, undefined, this.fireAnalyticsEvent).then(sourceInfo => {
411
- if (fg('platform_synced_block_dogfooding')) {
412
- if (!sourceInfo) {
413
- var _this$fetchSourceInfo2;
414
- (_this$fetchSourceInfo2 = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo2 === void 0 ? void 0 : _this$fetchSourceInfo2.failure({
415
- reason: 'No source info returned'
416
- });
417
- } else {
418
- var _this$fetchSourceInfo3;
419
- (_this$fetchSourceInfo3 = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo3 === void 0 ? void 0 : _this$fetchSourceInfo3.success();
420
- }
381
+ if (!sourceInfo) {
382
+ var _this$fetchSourceInfo2;
383
+ (_this$fetchSourceInfo2 = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo2 === void 0 ? void 0 : _this$fetchSourceInfo2.failure({
384
+ reason: 'No source info returned'
385
+ });
386
+ } else {
387
+ var _this$fetchSourceInfo3;
388
+ (_this$fetchSourceInfo3 = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo3 === void 0 ? void 0 : _this$fetchSourceInfo3.success();
421
389
  }
422
390
  return sourceInfo;
423
391
  });
424
392
  } catch (error) {
425
- var _this$fireAnalyticsEv13;
393
+ var _this$fireAnalyticsEv12;
426
394
  logException(error, {
427
395
  location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
428
396
  });
429
- (_this$fireAnalyticsEv13 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv13 === void 0 ? void 0 : _this$fireAnalyticsEv13.call(this, getSourceInfoErrorPayload(error.message));
397
+ (_this$fireAnalyticsEv12 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv12 === void 0 ? void 0 : _this$fireAnalyticsEv12.call(this, getSourceInfoErrorPayload(error.message));
430
398
  return Promise.resolve(undefined);
431
399
  }
432
400
  }
@@ -437,11 +405,11 @@ export class SourceSyncBlockStoreManager {
437
405
  }
438
406
  return this.dataProvider.fetchReferences(resourceId, true);
439
407
  } catch (error) {
440
- var _this$fireAnalyticsEv14;
408
+ var _this$fireAnalyticsEv13;
441
409
  logException(error, {
442
410
  location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
443
411
  });
444
- (_this$fireAnalyticsEv14 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv14 === void 0 ? void 0 : _this$fireAnalyticsEv14.call(this, fetchReferencesErrorPayload(error.message));
412
+ (_this$fireAnalyticsEv13 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv13 === void 0 ? void 0 : _this$fireAnalyticsEv13.call(this, fetchReferencesErrorPayload(error.message));
445
413
  return Promise.resolve({
446
414
  error: SyncBlockError.Errored
447
415
  });
@@ -105,10 +105,8 @@ export class SyncBlockStoreManager {
105
105
  this.fireAnalyticsEvent = fireAnalyticsEvent;
106
106
  this.referenceSyncBlockStoreManager.setFireAnalyticsEvent(fireAnalyticsEvent);
107
107
  this.sourceSyncBlockStoreManager.setFireAnalyticsEvent(fireAnalyticsEvent);
108
- if (fg('platform_synced_block_dogfooding')) {
109
- this.fetchReferencesExperience = getFetchReferencesExperience(fireAnalyticsEvent);
110
- this.fetchSourceInfoExperience = getFetchSourceInfoExperience(fireAnalyticsEvent);
111
- }
108
+ this.fetchReferencesExperience = getFetchReferencesExperience(fireAnalyticsEvent);
109
+ this.fetchSourceInfoExperience = getFetchSourceInfoExperience(fireAnalyticsEvent);
112
110
  }
113
111
  get referenceManager() {
114
112
  return this.referenceSyncBlockStoreManager;
@@ -1,5 +1,4 @@
1
1
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
2
  export const stringifyError = error => {
4
3
  try {
5
4
  return JSON.stringify(error);
@@ -12,13 +11,11 @@ export const getErrorPayload = (actionSubjectId, error, resourceId) => ({
12
11
  actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
13
12
  actionSubjectId,
14
13
  eventType: EVENT_TYPE.OPERATIONAL,
15
- attributes: fg('platform_synced_block_dogfooding') ? {
14
+ attributes: {
16
15
  error,
17
16
  ...(resourceId && {
18
17
  resourceId
19
18
  })
20
- } : {
21
- error
22
19
  }
23
20
  });
24
21
  export const fetchErrorPayload = (error, resourceId) => getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_FETCH, error, resourceId);
@@ -1,4 +1,3 @@
1
- import { fg } from '@atlaskit/platform-feature-flags';
2
1
  import { SyncBlockError } from '../common/types';
3
2
  /**
4
3
  * Merges two SyncBlockInstance objects,
@@ -32,10 +31,8 @@ export const resolveSyncBlockInstance = (oldResult, newResult) => {
32
31
  ...newResult.data,
33
32
  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,
34
33
  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,
35
- ...(fg('platform_synced_block_dogfooding') && {
36
- sourceSubType: ((_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,
37
- 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
38
- })
34
+ sourceSubType: ((_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,
35
+ 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
39
36
  }
40
37
  };
41
38
  };
@@ -1,6 +1,5 @@
1
1
  /* eslint-disable require-unicode-regexp */
2
2
 
3
- import { fg } from '@atlaskit/platform-feature-flags';
4
3
  export const convertSyncBlockPMNodeToSyncBlockData = node => {
5
4
  return {
6
5
  blockInstanceId: node.attrs.localId,
@@ -35,10 +34,10 @@ export const convertPMNodesToSyncBlockNodes = nodes => {
35
34
  };
36
35
 
37
36
  /*
38
- * From a reference block resource id (the resourceId stored in the node attributes)
39
- * e.g. confluence-page/5769323474/cdf6a1bc-b241-487a-93e9-e30bde363cbc
40
- * Extracts the source page content id and source product
41
- */
37
+ * From a reference block resource id (the resourceId stored in the node attributes)
38
+ * e.g. confluence-page/5769323474/cdf6a1bc-b241-487a-93e9-e30bde363cbc
39
+ * Extracts the source page content id and source product
40
+ */
42
41
  export const getContentIdAndProductFromResourceId = resourceId => {
43
42
  const match = resourceId.match(/^(confluence-page|jira-work-item)\/([^/]+)/);
44
43
  if (match !== null && match !== void 0 && match[2]) {
@@ -50,7 +49,7 @@ export const getContentIdAndProductFromResourceId = resourceId => {
50
49
  throw new Error(`Invalid resourceId: ${resourceId}`);
51
50
  };
52
51
  export const convertContentUpdatedAt = contentUpdatedAt => {
53
- if (typeof contentUpdatedAt === 'number' && fg('platform_synced_block_dogfooding')) {
52
+ if (typeof contentUpdatedAt === 'number') {
54
53
  try {
55
54
  return new Date(contentUpdatedAt).toISOString();
56
55
  } catch {
@@ -1,4 +1,3 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
1
  import _createClass from "@babel/runtime/helpers/createClass";
3
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
3
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
@@ -6,8 +5,6 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
5
  import _inherits from "@babel/runtime/helpers/inherits";
7
6
  import _wrapNativeSuper from "@babel/runtime/helpers/wrapNativeSuper";
8
7
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
9
- 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; }
10
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11
8
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
12
9
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
13
10
  import _regeneratorRuntime from "@babel/runtime/regenerator";
@@ -428,7 +425,7 @@ export var deleteSyncedBlock = /*#__PURE__*/function () {
428
425
  case 15:
429
426
  return _context4.abrupt("return");
430
427
  case 16:
431
- url = deleteReason && fg('platform_synced_block_dogfooding') ? "".concat(BLOCK_SERVICE_API_URL, "/block/").concat(encodeURIComponent(blockAri), "?deletionReason=").concat(encodeURIComponent(deleteReason)) : "".concat(BLOCK_SERVICE_API_URL, "/block/").concat(encodeURIComponent(blockAri));
428
+ url = deleteReason ? "".concat(BLOCK_SERVICE_API_URL, "/block/").concat(encodeURIComponent(blockAri), "?deletionReason=").concat(encodeURIComponent(deleteReason)) : "".concat(BLOCK_SERVICE_API_URL, "/block/").concat(encodeURIComponent(blockAri));
432
429
  _context4.next = 19;
433
430
  return fetchWithRetry(url, {
434
431
  method: 'DELETE',
@@ -535,7 +532,7 @@ export var createSyncedBlock = /*#__PURE__*/function () {
535
532
  break;
536
533
  }
537
534
  bodyData = {
538
- query: buildCreateBlockMutation(blockAri, blockInstanceId, content, product, sourceAri, stepVersion, status !== undefined && fg('platform_synced_block_dogfooding') ? status : undefined),
535
+ query: buildCreateBlockMutation(blockAri, blockInstanceId, content, product, sourceAri, stepVersion, status),
539
536
  operationName: CREATE_BLOCK_OPERATION_NAME
540
537
  };
541
538
  _context6.next = 5;
@@ -582,7 +579,7 @@ export var createSyncedBlock = /*#__PURE__*/function () {
582
579
  if (stepVersion !== undefined) {
583
580
  requestBody.stepVersion = stepVersion;
584
581
  }
585
- if (status !== undefined && fg('platform_synced_block_dogfooding')) {
582
+ if (status !== undefined) {
586
583
  requestBody.status = status;
587
584
  }
588
585
  _context6.next = 21;
@@ -629,13 +626,12 @@ export var updateReferenceSyncedBlockOnDocument = /*#__PURE__*/function () {
629
626
  operationName: UPDATE_DOCUMENT_REFERENCES_OPERATION_NAME
630
627
  };
631
628
  _context7.next = 5;
632
- return fetchWithRetry(GRAPHQL_ENDPOINT, _objectSpread({
629
+ return fetchWithRetry(GRAPHQL_ENDPOINT, {
633
630
  method: 'POST',
634
631
  headers: COMMON_HEADERS,
635
- body: JSON.stringify(bodyData)
636
- }, fg('platform_synced_block_dogfooding') ? {
632
+ body: JSON.stringify(bodyData),
637
633
  keepalive: true
638
- } : {}));
634
+ });
639
635
  case 5:
640
636
  _response6 = _context7.sent;
641
637
  if (_response6.ok) {
@@ -671,15 +667,14 @@ export var updateReferenceSyncedBlockOnDocument = /*#__PURE__*/function () {
671
667
  return _context7.abrupt("return");
672
668
  case 18:
673
669
  _context7.next = 20;
674
- return fetchWithRetry("".concat(BLOCK_SERVICE_API_URL, "/block/document/").concat(encodeURIComponent(documentAri), "/references?noContent=").concat(noContent), _objectSpread({
670
+ return fetchWithRetry("".concat(BLOCK_SERVICE_API_URL, "/block/document/").concat(encodeURIComponent(documentAri), "/references?noContent=").concat(noContent), {
675
671
  method: 'PUT',
676
672
  headers: COMMON_HEADERS,
677
673
  body: JSON.stringify({
678
674
  blocks: blocks
679
- })
680
- }, fg('platform_synced_block_dogfooding') ? {
675
+ }),
681
676
  keepalive: true
682
- } : {}));
677
+ });
683
678
  case 20:
684
679
  response = _context7.sent;
685
680
  if (response.ok) {
@@ -232,7 +232,7 @@ export var fetchConfluencePageInfoOld = /*#__PURE__*/function () {
232
232
  return _ref4.apply(this, arguments);
233
233
  };
234
234
  }();
235
- export var fetchConfluencePageInfoNew = /*#__PURE__*/function () {
235
+ export var fetchConfluencePageInfo = /*#__PURE__*/function () {
236
236
  var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(pageAri, hasAccess, urlType, localId, isUnpublished) {
237
237
  var _response$data2, _contentData$space2, _getPageIdAndTypeFrom3, pageType, response, contentData, _ref7, title, subType, url, _ref8, base;
238
238
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
@@ -288,39 +288,7 @@ export var fetchConfluencePageInfoNew = /*#__PURE__*/function () {
288
288
  }
289
289
  }, _callee5);
290
290
  }));
291
- return function fetchConfluencePageInfoNew(_x8, _x9, _x0, _x1, _x10) {
291
+ return function fetchConfluencePageInfo(_x8, _x9, _x0, _x1, _x10) {
292
292
  return _ref6.apply(this, arguments);
293
293
  };
294
- }();
295
- export var fetchConfluencePageInfo = /*#__PURE__*/function () {
296
- var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(pageAri, hasAccess, urlType, localId, fireAnalyticsEvent, isUnpublished) {
297
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
298
- while (1) switch (_context6.prev = _context6.next) {
299
- case 0:
300
- if (!fg('platform_synced_block_dogfooding')) {
301
- _context6.next = 6;
302
- break;
303
- }
304
- _context6.next = 3;
305
- return fetchConfluencePageInfoNew(pageAri, hasAccess, urlType, localId, isUnpublished);
306
- case 3:
307
- _context6.t0 = _context6.sent;
308
- _context6.next = 9;
309
- break;
310
- case 6:
311
- _context6.next = 8;
312
- return fetchConfluencePageInfoOld(pageAri, localId, fireAnalyticsEvent);
313
- case 8:
314
- _context6.t0 = _context6.sent;
315
- case 9:
316
- return _context6.abrupt("return", _context6.t0);
317
- case 10:
318
- case "end":
319
- return _context6.stop();
320
- }
321
- }, _callee6);
322
- }));
323
- return function fetchConfluencePageInfo(_x11, _x12, _x13, _x14, _x15, _x16) {
324
- return _ref9.apply(this, arguments);
325
- };
326
294
  }();
@@ -7,11 +7,9 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  import { useCallback, useEffect, useMemo, useState } from 'react';
8
8
  import { isSSR } from '@atlaskit/editor-common/core-utils';
9
9
  import { logException } from '@atlaskit/editor-common/monitoring';
10
- import { fg } from '@atlaskit/platform-feature-flags';
11
10
  import { SyncBlockError } from '../common/types';
12
- import { fetchErrorPayload } from '../utils/errorHandling';
13
11
  import { createSyncBlockNode } from '../utils/utils';
14
- export var useFetchSyncBlockData = function useFetchSyncBlockData(manager, resourceId, localId, fireAnalyticsEvent) {
12
+ export var useFetchSyncBlockData = function useFetchSyncBlockData(manager, resourceId, localId, _fireAnalyticsEvent) {
15
13
  // Initialize both states from a single cache lookup to avoid race conditions.
16
14
  // When a block is moved/remounted, the old component's cleanup may clear the cache
17
15
  // before or after the new component mounts. By doing a single lookup, we ensure
@@ -72,13 +70,9 @@ export var useFetchSyncBlockData = function useFetchSyncBlockData(manager, resou
72
70
  logException(_context.t0, {
73
71
  location: 'editor-synced-block-provider/useFetchSyncBlockData'
74
72
  });
75
- if (fg('platform_synced_block_dogfooding')) {
76
- manager === null || manager === void 0 || (_manager$referenceMan2 = manager.referenceManager) === null || _manager$referenceMan2 === void 0 || (_manager$referenceMan2 = _manager$referenceMan2.fetchExperience) === null || _manager$referenceMan2 === void 0 || _manager$referenceMan2.failure({
77
- reason: _context.t0.message
78
- });
79
- } else {
80
- fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent(fetchErrorPayload(_context.t0.message));
81
- }
73
+ manager === null || manager === void 0 || (_manager$referenceMan2 = manager.referenceManager) === null || _manager$referenceMan2 === void 0 || (_manager$referenceMan2 = _manager$referenceMan2.fetchExperience) === null || _manager$referenceMan2 === void 0 || _manager$referenceMan2.failure({
74
+ reason: _context.t0.message
75
+ });
82
76
 
83
77
  // Set error state if fetching fails
84
78
  setFetchState({
@@ -102,7 +96,7 @@ export var useFetchSyncBlockData = function useFetchSyncBlockData(manager, resou
102
96
  return _context.stop();
103
97
  }
104
98
  }, _callee, null, [[2, 11]]);
105
- })), [isLoading, localId, manager.referenceManager, resourceId, fireAnalyticsEvent]);
99
+ })), [isLoading, localId, manager.referenceManager, resourceId]);
106
100
  useEffect(function () {
107
101
  if (isSSR()) {
108
102
  // in SSR, we don't need to subscribe to updates,
@@ -735,7 +735,7 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
735
735
  _context6.t0 = undefined;
736
736
  case 11:
737
737
  stepVersion = _context6.t0;
738
- status = fg('platform_synced_block_patch_1') ? 'unpublished' : fg('platform_synced_block_dogfooding') ? (_this$isParentUnpubli = this.isParentUnpublished) !== null && _this$isParentUnpubli !== void 0 && _this$isParentUnpubli.call(this) ? 'unpublished' : data.status || 'active' : undefined;
738
+ status = fg('platform_synced_block_patch_1') ? 'unpublished' : (_this$isParentUnpubli = this.isParentUnpublished) !== null && _this$isParentUnpubli !== void 0 && _this$isParentUnpubli.call(this) ? 'unpublished' : data.status || 'active';
739
739
  _context6.prev = 13;
740
740
  _context6.next = 16;
741
741
  return createSyncedBlock({