@atlaskit/editor-synced-block-provider 23.0.5 → 23.1.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 (34) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/cjs/clients/jira/ari.js +2 -2
  3. package/dist/cjs/common/types.js +1 -0
  4. package/dist/cjs/providers/block-service/blockServiceAPI.js +32 -10
  5. package/dist/cjs/providers/syncBlockProvider.js +11 -5
  6. package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +41 -23
  7. package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +15 -7
  8. package/dist/cjs/utils/errorHandling.js +16 -10
  9. package/dist/cjs/utils/fieldAwareLocations.js +26 -1
  10. package/dist/es2019/clients/jira/ari.js +1 -1
  11. package/dist/es2019/common/types.js +2 -0
  12. package/dist/es2019/providers/block-service/blockServiceAPI.js +27 -7
  13. package/dist/es2019/providers/syncBlockProvider.js +9 -3
  14. package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +41 -24
  15. package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +15 -9
  16. package/dist/es2019/utils/errorHandling.js +14 -5
  17. package/dist/es2019/utils/fieldAwareLocations.js +27 -2
  18. package/dist/esm/clients/jira/ari.js +1 -1
  19. package/dist/esm/common/types.js +2 -0
  20. package/dist/esm/providers/block-service/blockServiceAPI.js +32 -10
  21. package/dist/esm/providers/syncBlockProvider.js +11 -5
  22. package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +41 -23
  23. package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +15 -7
  24. package/dist/esm/utils/errorHandling.js +16 -10
  25. package/dist/esm/utils/fieldAwareLocations.js +26 -1
  26. package/dist/types/clients/jira/ari.d.ts +1 -0
  27. package/dist/types/common/types.d.ts +2 -0
  28. package/dist/types/providers/block-service/blockServiceAPI.d.ts +9 -2
  29. package/dist/types/providers/syncBlockProvider.d.ts +1 -1
  30. package/dist/types/providers/types.d.ts +6 -1
  31. package/dist/types/store-manager/sourceSyncBlockStoreManager.d.ts +1 -0
  32. package/dist/types/utils/errorHandling.d.ts +9 -7
  33. package/dist/types/utils/fieldAwareLocations.d.ts +9 -1
  34. package/package.json +7 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @atlaskit/editor-synced-block-provider
2
2
 
3
+ ## 23.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`b68ccfbea3aeb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b68ccfbea3aeb) -
8
+ Generate synced-block reference IDs through the fetch provider under
9
+ platform_editor_blocks_patch_12, allowing fetch-only renderers to check same-document references
10
+ without a write provider.
11
+ - Updated dependencies
12
+
13
+ ## 23.1.0
14
+
15
+ ### Minor Changes
16
+
17
+ - [`bf97ae26b480d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bf97ae26b480d) -
18
+ Add a `sourceLocation` analytics attribute (`description` | `custom-field`) to synced block create
19
+ and get-source-info events for Jira sources, behind the `platform_editor_blocks_patch_13` feature
20
+ gate and the `editor_synced_blocks_jira_custom_rich_text` experiment. With the gate off, events
21
+ are unchanged. Add an optional `getParentAri()` method to the synced block data provider.
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies
26
+
3
27
  ## 23.0.5
4
28
 
5
29
  ### Patch Changes
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.parseJiraFieldLocation = exports.getJiraWorkItemIdFromAri = exports.getJiraWorkItemAri = exports.getJiraIssueAriFromSourceAri = void 0;
6
+ exports.parseJiraFieldLocation = exports.getJiraWorkItemIdFromAri = exports.getJiraWorkItemAri = exports.getJiraIssueAriFromSourceAri = exports.JIRA_DESCRIPTION_FIELD_ID = void 0;
7
7
  /* eslint-disable require-unicode-regexp */
8
8
 
9
9
  var JIRA_WORK_ITEM_ARI_REGEX = /ari:cloud:jira:([^:]+):issue\/(\d+)/;
@@ -69,7 +69,7 @@ var getJiraIssueAriFromSourceAri = exports.getJiraIssueAriFromSourceAri = functi
69
69
  }
70
70
  return ari;
71
71
  };
72
- var JIRA_DESCRIPTION_FIELD_ID = 'description';
72
+ var JIRA_DESCRIPTION_FIELD_ID = exports.JIRA_DESCRIPTION_FIELD_ID = 'description';
73
73
 
74
74
  /**
75
75
  * One synced block location on a Jira work item, parsed once from its document ARI.
@@ -20,6 +20,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
20
20
  * `same-document` is the host document itself, the same page or the same work item field.
21
21
  * `same-parent-document` is another field of the host work item.
22
22
  */
23
+ /** Which Jira work item field holds a source block. */
23
24
  var SyncBlockError = exports.SyncBlockError = /*#__PURE__*/function (SyncBlockError) {
24
25
  SyncBlockError["Errored"] = "errored";
25
26
  SyncBlockError["NotFound"] = "not_found";
@@ -606,15 +606,27 @@ var writeDataBatch = exports.writeDataBatch = /*#__PURE__*/function () {
606
606
  var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
607
607
  function BlockServiceADFFetchProvider(_ref5) {
608
608
  var cloudId = _ref5.cloudId,
609
- parentAri = _ref5.parentAri;
609
+ parentAri = _ref5.parentAri,
610
+ parentId = _ref5.parentId,
611
+ product = _ref5.product;
610
612
  (0, _classCallCheck2.default)(this, BlockServiceADFFetchProvider);
611
613
  this.cloudId = cloudId;
612
614
  this.parentAri = parentAri;
615
+ this.parentId = parentId;
616
+ this.product = product;
613
617
  }
614
-
615
- // resourceId of the reference synced block.
616
- // the ARI must be constructed to call the block service API
617
618
  return (0, _createClass2.default)(BlockServiceADFFetchProvider, [{
619
+ key: "generateResourceIdForReference",
620
+ value: function generateResourceIdForReference(sourceId) {
621
+ if (!this.product || !this.parentId) {
622
+ return sourceId;
623
+ }
624
+ return (0, _resourceId2.createResourceIdForReference)(this.product, this.parentId, sourceId);
625
+ }
626
+
627
+ // resourceId of the reference synced block.
628
+ // the ARI must be constructed to call the block service API
629
+ }, {
618
630
  key: "fetchData",
619
631
  value: function () {
620
632
  var _fetchData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(resourceId) {
@@ -1496,7 +1508,9 @@ var createBlockServiceAPIProviders = function createBlockServiceAPIProviders(_re
1496
1508
  return {
1497
1509
  fetchProvider: new BlockServiceADFFetchProvider({
1498
1510
  cloudId: cloudId,
1499
- parentAri: parentAri
1511
+ parentAri: parentAri,
1512
+ parentId: parentId,
1513
+ product: product
1500
1514
  }),
1501
1515
  writeProvider: new BlockServiceADFWriteProvider({
1502
1516
  cloudId: cloudId,
@@ -1525,11 +1539,15 @@ var useMemoizedBlockServiceAPIProviders = exports.useMemoizedBlockServiceAPIProv
1525
1539
  };
1526
1540
  var createBlockServiceFetchOnlyAPIProvider = function createBlockServiceFetchOnlyAPIProvider(_ref1) {
1527
1541
  var cloudId = _ref1.cloudId,
1528
- parentAri = _ref1.parentAri;
1542
+ parentAri = _ref1.parentAri,
1543
+ parentId = _ref1.parentId,
1544
+ product = _ref1.product;
1529
1545
  return {
1530
1546
  fetchProvider: new BlockServiceADFFetchProvider({
1531
1547
  cloudId: cloudId,
1532
- parentAri: parentAri
1548
+ parentAri: parentAri,
1549
+ parentId: parentId,
1550
+ product: product
1533
1551
  }),
1534
1552
  writeProvider: undefined
1535
1553
  };
@@ -1540,11 +1558,15 @@ var createBlockServiceFetchOnlyAPIProvider = function createBlockServiceFetchOnl
1540
1558
  */
1541
1559
  var useMemoizedBlockServiceFetchOnlyAPIProvider = exports.useMemoizedBlockServiceFetchOnlyAPIProvider = function useMemoizedBlockServiceFetchOnlyAPIProvider(_ref10) {
1542
1560
  var cloudId = _ref10.cloudId,
1543
- parentAri = _ref10.parentAri;
1561
+ parentAri = _ref10.parentAri,
1562
+ parentId = _ref10.parentId,
1563
+ product = _ref10.product;
1544
1564
  return (0, _react.useMemo)(function () {
1545
1565
  return createBlockServiceFetchOnlyAPIProvider({
1546
1566
  cloudId: cloudId,
1547
- parentAri: parentAri
1567
+ parentAri: parentAri,
1568
+ parentId: parentId,
1569
+ product: product
1548
1570
  });
1549
- }, [cloudId, parentAri]);
1571
+ }, [cloudId, parentAri, parentId, product]);
1550
1572
  };
@@ -15,6 +15,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
15
15
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
16
16
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
17
  var _react = require("react");
18
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
18
19
  var _ari = require("../clients/block-service/ari");
19
20
  var _ari2 = require("../clients/confluence/ari");
20
21
  var _sourceInfo2 = require("../clients/confluence/sourceInfo");
@@ -388,6 +389,12 @@ var SyncedBlockProvider = exports.SyncedBlockProvider = /*#__PURE__*/function (_
388
389
  }
389
390
  return fetchSyncBlockSourceInfo;
390
391
  }())
392
+ }, {
393
+ key: "getParentAri",
394
+ value: function getParentAri() {
395
+ var _this$writeProvider5;
396
+ return (_this$writeProvider5 = this.writeProvider) === null || _this$writeProvider5 === void 0 ? void 0 : _this$writeProvider5.parentAri;
397
+ }
391
398
  }, {
392
399
  key: "generateResourceId",
393
400
  value: function generateResourceId() {
@@ -398,14 +405,13 @@ var SyncedBlockProvider = exports.SyncedBlockProvider = /*#__PURE__*/function (_
398
405
  resourceId: resourceId
399
406
  };
400
407
  }
401
- }, {
402
- key: "canGenerateResourceIdForReference",
403
- value: function canGenerateResourceIdForReference() {
404
- return this.writeProvider !== undefined;
405
- }
406
408
  }, {
407
409
  key: "generateResourceIdForReference",
408
410
  value: function generateResourceIdForReference(sourceId) {
411
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_blocks_patch_12')) {
412
+ var _this$fetchProvider$g, _this$fetchProvider$g2, _this$fetchProvider;
413
+ return (_this$fetchProvider$g = (_this$fetchProvider$g2 = (_this$fetchProvider = this.fetchProvider).generateResourceIdForReference) === null || _this$fetchProvider$g2 === void 0 ? void 0 : _this$fetchProvider$g2.call(_this$fetchProvider, sourceId)) !== null && _this$fetchProvider$g !== void 0 ? _this$fetchProvider$g : sourceId;
414
+ }
409
415
  if (!this.writeProvider) {
410
416
  throw new Error('Write provider not set');
411
417
  }
@@ -18,6 +18,7 @@ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-ex
18
18
  var _types = require("../common/types");
19
19
  var _errorHandling = require("../utils/errorHandling");
20
20
  var _experienceTracking = require("../utils/experienceTracking");
21
+ var _fieldAwareLocations = require("../utils/fieldAwareLocations");
21
22
  var _resolveSyncBlockInstance = require("../utils/resolveSyncBlockInstance");
22
23
  var _resourceId = require("../utils/resourceId");
23
24
  var _utils = require("../utils/utils");
@@ -272,9 +273,8 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
272
273
  }, {
273
274
  key: "getSameDocumentReferenceParts",
274
275
  value: function getSameDocumentReferenceParts(resourceId) {
275
- var _this$dataProvider$ca, _this$dataProvider3;
276
276
  var parsed = (0, _resourceId.parseResourceId)(resourceId);
277
- if (!parsed || !this.dataProvider || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_blocks_patch_12') && ((_this$dataProvider$ca = (_this$dataProvider3 = this.dataProvider).canGenerateResourceIdForReference) === null || _this$dataProvider$ca === void 0 ? void 0 : _this$dataProvider$ca.call(_this$dataProvider3)) === false || this.dataProvider.generateResourceIdForReference(parsed.uuid) !== resourceId) {
277
+ if (!parsed || !this.dataProvider || this.dataProvider.generateResourceIdForReference(parsed.uuid) !== resourceId) {
278
278
  return undefined;
279
279
  }
280
280
  return parsed;
@@ -440,15 +440,26 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
440
440
  (_this$fireAnalyticsEv3 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv3 === void 0 || _this$fireAnalyticsEv3.call(this, (0, _errorHandling.getSourceInfoErrorPayload)('SourceAri, product or blockInstanceId missing', resourceId, sourceProduct));
441
441
  return Promise.resolve(undefined);
442
442
  }
443
+ var sourceLocation = (0, _fieldAwareLocations.getSourceLocation)(sourceAri);
444
+ // Undefined with `platform_editor_blocks_patch_13` off, so experience calls below keep
445
+ // exactly their previous arguments (no `metadata` key, `success()` without arguments).
446
+ var experienceMetadata = sourceLocation && {
447
+ sourceLocation: sourceLocation
448
+ };
449
+ var withExperienceMetadata = function withExperienceMetadata(options) {
450
+ return experienceMetadata ? _objectSpread(_objectSpread({}, options), {}, {
451
+ metadata: experienceMetadata
452
+ }) : options;
453
+ };
443
454
  (_this$fetchSourceInfo = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo === void 0 || _this$fetchSourceInfo.start({});
444
455
  var sourceInfoPromise = this.dataProvider.fetchSyncBlockSourceInfo(blockInstanceId, sourceAri, product, true // hasAccess
445
456
  ).then(function (sourceInfo) {
446
457
  if (!sourceInfo) {
447
458
  var _this2$fetchSourceInf, _this2$fireAnalyticsE;
448
- (_this2$fetchSourceInf = _this2.fetchSourceInfoExperience) === null || _this2$fetchSourceInf === void 0 || _this2$fetchSourceInf.failure({
459
+ (_this2$fetchSourceInf = _this2.fetchSourceInfoExperience) === null || _this2$fetchSourceInf === void 0 || _this2$fetchSourceInf.failure(withExperienceMetadata({
449
460
  reason: 'No source info returned'
450
- });
451
- (_this2$fireAnalyticsE = _this2.fireAnalyticsEvent) === null || _this2$fireAnalyticsE === void 0 || _this2$fireAnalyticsE.call(_this2, (0, _errorHandling.getSourceInfoErrorPayload)('No source info returned', resourceId, sourceProduct));
461
+ }));
462
+ (_this2$fireAnalyticsE = _this2.fireAnalyticsEvent) === null || _this2$fireAnalyticsE === void 0 || _this2$fireAnalyticsE.call(_this2, (0, _errorHandling.getSourceInfoErrorPayload)('No source info returned', resourceId, sourceProduct, sourceLocation));
452
463
  return undefined;
453
464
  }
454
465
  _this2.updateCacheWithSourceInfo(resourceId, sourceInfo);
@@ -456,22 +467,29 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
456
467
  _this2._subscriptionManager.updateSourceTitleSubscriptions(resourceId, sourceInfo.title);
457
468
  }
458
469
  if (sourceInfo.title && sourceInfo.url) {
459
- var _this2$fetchSourceInf2;
460
- (_this2$fetchSourceInf2 = _this2.fetchSourceInfoExperience) === null || _this2$fetchSourceInf2 === void 0 || _this2$fetchSourceInf2.success();
470
+ if (experienceMetadata) {
471
+ var _this2$fetchSourceInf2;
472
+ (_this2$fetchSourceInf2 = _this2.fetchSourceInfoExperience) === null || _this2$fetchSourceInf2 === void 0 || _this2$fetchSourceInf2.success({
473
+ metadata: experienceMetadata
474
+ });
475
+ } else {
476
+ var _this2$fetchSourceInf3;
477
+ (_this2$fetchSourceInf3 = _this2.fetchSourceInfoExperience) === null || _this2$fetchSourceInf3 === void 0 || _this2$fetchSourceInf3.success();
478
+ }
461
479
  } else {
462
- var _this2$fetchSourceInf3, _this2$fireAnalyticsE2;
463
- (_this2$fetchSourceInf3 = _this2.fetchSourceInfoExperience) === null || _this2$fetchSourceInf3 === void 0 || _this2$fetchSourceInf3.failure({
480
+ var _this2$fetchSourceInf4, _this2$fireAnalyticsE2;
481
+ (_this2$fetchSourceInf4 = _this2.fetchSourceInfoExperience) === null || _this2$fetchSourceInf4 === void 0 || _this2$fetchSourceInf4.failure(withExperienceMetadata({
464
482
  reason: 'Missing title or url'
465
- });
466
- (_this2$fireAnalyticsE2 = _this2.fireAnalyticsEvent) === null || _this2$fireAnalyticsE2 === void 0 || _this2$fireAnalyticsE2.call(_this2, (0, _errorHandling.getSourceInfoErrorPayload)('Missing title or url', resourceId, sourceProduct));
483
+ }));
484
+ (_this2$fireAnalyticsE2 = _this2.fireAnalyticsEvent) === null || _this2$fireAnalyticsE2 === void 0 || _this2$fireAnalyticsE2.call(_this2, (0, _errorHandling.getSourceInfoErrorPayload)('Missing title or url', resourceId, sourceProduct, sourceLocation));
467
485
  }
468
486
  return sourceInfo;
469
487
  }).catch(function (error) {
470
- var _this2$fetchSourceInf4, _this2$fireAnalyticsE3;
471
- (_this2$fetchSourceInf4 = _this2.fetchSourceInfoExperience) === null || _this2$fetchSourceInf4 === void 0 || _this2$fetchSourceInf4.failure({
488
+ var _this2$fetchSourceInf5, _this2$fireAnalyticsE3;
489
+ (_this2$fetchSourceInf5 = _this2.fetchSourceInfoExperience) === null || _this2$fetchSourceInf5 === void 0 || _this2$fetchSourceInf5.failure(withExperienceMetadata({
472
490
  reason: error.message
473
- });
474
- (_this2$fireAnalyticsE3 = _this2.fireAnalyticsEvent) === null || _this2$fireAnalyticsE3 === void 0 || _this2$fireAnalyticsE3.call(_this2, (0, _errorHandling.getSourceInfoErrorPayload)(error.message, resourceId, sourceProduct));
491
+ }));
492
+ (_this2$fireAnalyticsE3 = _this2.fireAnalyticsEvent) === null || _this2$fireAnalyticsE3 === void 0 || _this2$fireAnalyticsE3.call(_this2, (0, _errorHandling.getSourceInfoErrorPayload)(error.message, resourceId, sourceProduct, sourceLocation));
475
493
  return undefined;
476
494
  }).finally(function () {
477
495
  _this2.syncBlockSourceInfoRequests.delete(resourceId);
@@ -768,8 +786,8 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
768
786
  var sanitizedSyncBlock = this.normalizeReferenceData(syncBlock);
769
787
  var resourceId = sanitizedSyncBlock.resourceId;
770
788
  if (resourceId) {
771
- var _this$dataProvider4;
772
- (_this$dataProvider4 = this.dataProvider) === null || _this$dataProvider4 === void 0 || _this$dataProvider4.updateCache((0, _defineProperty2.default)({}, resourceId, sanitizedSyncBlock), {
789
+ var _this$dataProvider3;
790
+ (_this$dataProvider3 = this.dataProvider) === null || _this$dataProvider3 === void 0 || _this$dataProvider3.updateCache((0, _defineProperty2.default)({}, resourceId, sanitizedSyncBlock), {
773
791
  strategy: 'merge',
774
792
  source: 'network'
775
793
  });
@@ -780,15 +798,15 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
780
798
  }, {
781
799
  key: "getFromCache",
782
800
  value: function getFromCache(resourceId) {
783
- var _this$dataProvider5;
801
+ var _this$dataProvider4;
784
802
  var syncBlockNode = (0, _utils.createSyncBlockNode)('', resourceId);
785
- 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;
803
+ 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;
786
804
  }
787
805
  }, {
788
806
  key: "deleteFromCache",
789
807
  value: function deleteFromCache(resourceId) {
790
- var _this$dataProvider6;
791
- (_this$dataProvider6 = this.dataProvider) === null || _this$dataProvider6 === void 0 || _this$dataProvider6.removeFromCache([resourceId]);
808
+ var _this$dataProvider5;
809
+ (_this$dataProvider5 = this.dataProvider) === null || _this$dataProvider5 === void 0 || _this$dataProvider5.removeFromCache([resourceId]);
792
810
  this._providerFactoryManager.deleteFactory(resourceId);
793
811
  // Evict in-flight source-info promise and reset reschedule counter
794
812
  // so a stale resolution can't silently merge into a re-fetched entry.
@@ -1272,7 +1290,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
1272
1290
  }, {
1273
1291
  key: "destroy",
1274
1292
  value: function destroy() {
1275
- var _this$dataProvider7, _this$saveExperience5, _this$fetchExperience0, _this$fetchSourceInfo2;
1293
+ var _this$dataProvider6, _this$saveExperience5, _this$fetchExperience0, _this$fetchSourceInfo2;
1276
1294
  // Mark destroyed first so in-flight timer callbacks can early-return.
1277
1295
  this.isDestroyed = true;
1278
1296
 
@@ -1298,7 +1316,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
1298
1316
  this._subscriptionManager.destroy();
1299
1317
  this._providerFactoryManager.destroy();
1300
1318
  this._batchFetcher.destroy();
1301
- (_this$dataProvider7 = this.dataProvider) === null || _this$dataProvider7 === void 0 || _this$dataProvider7.resetCache();
1319
+ (_this$dataProvider6 = this.dataProvider) === null || _this$dataProvider6 === void 0 || _this$dataProvider6.resetCache();
1302
1320
  this.dataProvider = undefined;
1303
1321
  this.syncBlockFetchDataRequests.clear();
1304
1322
  this.syncBlockSourceInfoRequests.clear();
@@ -18,6 +18,7 @@ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-ex
18
18
  var _types = require("../common/types");
19
19
  var _errorHandling = require("../utils/errorHandling");
20
20
  var _experienceTracking = require("../utils/experienceTracking");
21
+ var _fieldAwareLocations = require("../utils/fieldAwareLocations");
21
22
  var _utils = require("../utils/utils");
22
23
  var _excluded = ["contentFragment", "isDirty"];
23
24
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
@@ -494,16 +495,17 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
494
495
  }
495
496
  } else {
496
497
  var _this$fireAnalyticsEv3;
497
- (_this$fireAnalyticsEv3 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv3 === void 0 || _this$fireAnalyticsEv3.call(this, (0, _errorHandling.createErrorPayload)('creation complete callback missing', resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId)));
498
+ (_this$fireAnalyticsEv3 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv3 === void 0 || _this$fireAnalyticsEv3.call(this, (0, _errorHandling.createErrorPayload)('creation complete callback missing', resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId), undefined, this.getSourceLocation()));
498
499
  }
499
500
  if (success) {
500
501
  var _this$dataProvider$ge, _this$dataProvider, _this$fireAnalyticsEv4, _this$fireAnalyticsEv5, _this$syncBlockCache$2;
501
502
  var sourceProduct = (0, _utils.getSourceProductFromResourceIdSafe)(resourceId);
503
+ var sourceLocation = this.getSourceLocation();
502
504
  var documentInsertedResourceId = (_this$dataProvider$ge = (_this$dataProvider = this.dataProvider) === null || _this$dataProvider === void 0 ? void 0 : _this$dataProvider.generateResourceIdForReference(resourceId)) !== null && _this$dataProvider$ge !== void 0 ? _this$dataProvider$ge : resourceId;
503
- (_this$fireAnalyticsEv4 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv4 === void 0 || _this$fireAnalyticsEv4.call(this, (0, _errorHandling.createSuccessPayload)(documentInsertedResourceId || '', sourceProduct));
505
+ (_this$fireAnalyticsEv4 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv4 === void 0 || _this$fireAnalyticsEv4.call(this, (0, _errorHandling.createSuccessPayload)(documentInsertedResourceId || '', sourceProduct, sourceLocation));
504
506
  // Operational create-success event with the join key + creation-type
505
507
  // signals (inputMethod / createdEmpty / nodeTypes) captured at the command layer.
506
- (_this$fireAnalyticsEv5 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv5 === void 0 || _this$fireAnalyticsEv5.call(this, (0, _errorHandling.createSuccessOperationalPayload)(resourceId || '', (_this$syncBlockCache$2 = this.syncBlockCache.get(resourceId)) === null || _this$syncBlockCache$2 === void 0 ? void 0 : _this$syncBlockCache$2.blockInstanceId, sourceProduct, this.creationEnrichment.get(resourceId)));
508
+ (_this$fireAnalyticsEv5 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv5 === void 0 || _this$fireAnalyticsEv5.call(this, (0, _errorHandling.createSuccessOperationalPayload)(resourceId || '', (_this$syncBlockCache$2 = this.syncBlockCache.get(resourceId)) === null || _this$syncBlockCache$2 === void 0 ? void 0 : _this$syncBlockCache$2.blockInstanceId, sourceProduct, this.creationEnrichment.get(resourceId), sourceLocation));
507
509
  } else {
508
510
  var _this$fireAnalyticsEv6;
509
511
  // Delete the node from cache if fail to create so it's not flushed to BE
@@ -513,7 +515,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
513
515
  // Creation failed, so there is no block to add content to — drop the
514
516
  // first-content tracking entry so a later unrelated edit cannot fire it.
515
517
  this.awaitingFirstContent.delete(resourceId || '');
516
- (_this$fireAnalyticsEv6 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv6 === void 0 || _this$fireAnalyticsEv6.call(this, (0, _errorHandling.createErrorPayload)('Fail to create bodied sync block', resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId)));
518
+ (_this$fireAnalyticsEv6 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv6 === void 0 || _this$fireAnalyticsEv6.call(this, (0, _errorHandling.createErrorPayload)('Fail to create bodied sync block', resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId), undefined, this.getSourceLocation()));
517
519
  }
518
520
  // Enrichment is single-use — drop it once the create has resolved either way.
519
521
  this.creationEnrichment.delete(resourceId || '');
@@ -635,7 +637,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
635
637
  (_this5$createExperien2 = _this5.createExperience) === null || _this5$createExperien2 === void 0 || _this5$createExperien2.failure({
636
638
  reason: result.error || 'Failed to create bodied sync block'
637
639
  });
638
- (_this5$fireAnalyticsE = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE === void 0 || _this5$fireAnalyticsE.call(_this5, (0, _errorHandling.createErrorPayload)(result.error || 'Failed to create bodied sync block', resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId), (0, _errorHandling.buildErrorAttribution)(result.error, result.statusCode)));
640
+ (_this5$fireAnalyticsE = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE === void 0 || _this5$fireAnalyticsE.call(_this5, (0, _errorHandling.createErrorPayload)(result.error || 'Failed to create bodied sync block', resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId), (0, _errorHandling.buildErrorAttribution)(result.error, result.statusCode), _this5.getSourceLocation()));
639
641
  }
640
642
  }).catch(function (error) {
641
643
  var _this5$createExperien3, _this5$fireAnalyticsE2;
@@ -646,7 +648,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
646
648
  (_this5$createExperien3 = _this5.createExperience) === null || _this5$createExperien3 === void 0 || _this5$createExperien3.failure({
647
649
  reason: error.message
648
650
  });
649
- (_this5$fireAnalyticsE2 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE2 === void 0 || _this5$fireAnalyticsE2.call(_this5, (0, _errorHandling.createErrorPayload)(error.message, resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId)));
651
+ (_this5$fireAnalyticsE2 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE2 === void 0 || _this5$fireAnalyticsE2.call(_this5, (0, _errorHandling.createErrorPayload)(error.message, resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId), undefined, _this5.getSourceLocation()));
650
652
  }).finally(function () {
651
653
  _this5.pendingCreationPromises.delete(resourceId);
652
654
  });
@@ -660,9 +662,15 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
660
662
  (0, _error.logException)(error, {
661
663
  location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
662
664
  });
663
- (_this$fireAnalyticsEv8 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv8 === void 0 || _this$fireAnalyticsEv8.call(this, (0, _errorHandling.createErrorPayload)(error.message, resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId)));
665
+ (_this$fireAnalyticsEv8 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv8 === void 0 || _this$fireAnalyticsEv8.call(this, (0, _errorHandling.createErrorPayload)(error.message, resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId), undefined, this.getSourceLocation()));
664
666
  }
665
667
  }
668
+ }, {
669
+ key: "getSourceLocation",
670
+ value: function getSourceLocation() {
671
+ var _this$dataProvider2, _this$dataProvider2$g;
672
+ return (0, _fieldAwareLocations.getSourceLocation)((_this$dataProvider2 = this.dataProvider) === null || _this$dataProvider2 === void 0 || (_this$dataProvider2$g = _this$dataProvider2.getParentAri) === null || _this$dataProvider2$g === void 0 ? void 0 : _this$dataProvider2$g.call(_this$dataProvider2));
673
+ }
666
674
  }, {
667
675
  key: "pruneRecentDeleteEmissions",
668
676
  value:
@@ -221,18 +221,20 @@ var buildFetchErrorAttribution = exports.buildFetchErrorAttribution = function b
221
221
  * buckets like `source_deleted` they never emit.
222
222
  */
223
223
 
224
- function getErrorPayload(actionSubjectId, error, resourceId, sourceProduct, attribution) {
224
+ function getErrorPayload(actionSubjectId, error, resourceId, sourceProduct, attribution, sourceLocation) {
225
225
  return {
226
226
  action: _enums.ACTION.ERROR,
227
227
  actionSubject: _enums.ACTION_SUBJECT.SYNCED_BLOCK,
228
228
  actionSubjectId: actionSubjectId,
229
229
  eventType: _enums.EVENT_TYPE.OPERATIONAL,
230
- attributes: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
230
+ attributes: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
231
231
  error: error
232
232
  }, resourceId && {
233
233
  resourceId: resourceId
234
234
  }), sourceProduct && {
235
235
  sourceProduct: sourceProduct
236
+ }), sourceLocation && {
237
+ sourceLocation: sourceLocation
236
238
  }), (attribution === null || attribution === void 0 ? void 0 : attribution.reason) && {
237
239
  reason: attribution.reason
238
240
  }), (attribution === null || attribution === void 0 ? void 0 : attribution.statusCode) !== undefined && {
@@ -252,8 +254,8 @@ var fetchErrorPayload = exports.fetchErrorPayload = function fetchErrorPayload(e
252
254
  attribution ? getErrorPayload(_enums.ACTION_SUBJECT_ID.SYNCED_BLOCK_FETCH, error, resourceId, sourceProduct, attribution) : getErrorPayload(_enums.ACTION_SUBJECT_ID.SYNCED_BLOCK_FETCH, error, resourceId, sourceProduct)
253
255
  );
254
256
  };
255
- var getSourceInfoErrorPayload = exports.getSourceInfoErrorPayload = function getSourceInfoErrorPayload(error, resourceId, sourceProduct) {
256
- return getErrorPayload(_enums.ACTION_SUBJECT_ID.SYNCED_BLOCK_GET_SOURCE_INFO, error, resourceId, sourceProduct);
257
+ var getSourceInfoErrorPayload = exports.getSourceInfoErrorPayload = function getSourceInfoErrorPayload(error, resourceId, sourceProduct, sourceLocation) {
258
+ return getErrorPayload(_enums.ACTION_SUBJECT_ID.SYNCED_BLOCK_GET_SOURCE_INFO, error, resourceId, sourceProduct, undefined, sourceLocation);
257
259
  };
258
260
  var updateErrorPayload = exports.updateErrorPayload = function updateErrorPayload(error, resourceId, sourceProduct, attribution) {
259
261
  return getErrorPayload(_enums.ACTION_SUBJECT_ID.SYNCED_BLOCK_UPDATE, error, resourceId, sourceProduct, attribution);
@@ -261,8 +263,8 @@ var updateErrorPayload = exports.updateErrorPayload = function updateErrorPayloa
261
263
  var updateReferenceErrorPayload = exports.updateReferenceErrorPayload = function updateReferenceErrorPayload(error, resourceId, sourceProduct, attribution) {
262
264
  return getErrorPayload(_enums.ACTION_SUBJECT_ID.REFERENCE_SYNCED_BLOCK_UPDATE, error, resourceId, sourceProduct, attribution);
263
265
  };
264
- var createErrorPayload = exports.createErrorPayload = function createErrorPayload(error, resourceId, sourceProduct, attribution) {
265
- return getErrorPayload(_enums.ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE, error, resourceId, sourceProduct, attribution);
266
+ var createErrorPayload = exports.createErrorPayload = function createErrorPayload(error, resourceId, sourceProduct, attribution, sourceLocation) {
267
+ return getErrorPayload(_enums.ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE, error, resourceId, sourceProduct, attribution, sourceLocation);
266
268
  };
267
269
  var deleteErrorPayload = exports.deleteErrorPayload = function deleteErrorPayload(error, resourceId, sourceProduct, attribution) {
268
270
  return getErrorPayload(_enums.ACTION_SUBJECT_ID.SYNCED_BLOCK_DELETE, error, resourceId, sourceProduct, attribution);
@@ -331,16 +333,18 @@ var fetchSuccessPayload = exports.fetchSuccessPayload = function fetchSuccessPay
331
333
  })
332
334
  };
333
335
  };
334
- var createSuccessPayload = exports.createSuccessPayload = function createSuccessPayload(resourceId, sourceProduct) {
336
+ var createSuccessPayload = exports.createSuccessPayload = function createSuccessPayload(resourceId, sourceProduct, sourceLocation) {
335
337
  return {
336
338
  action: _enums.ACTION.INSERTED,
337
339
  actionSubject: _enums.ACTION_SUBJECT.DOCUMENT,
338
340
  actionSubjectId: _enums.ACTION_SUBJECT_ID.BODIED_SYNCED_BLOCK,
339
341
  eventType: _enums.EVENT_TYPE.TRACK,
340
- attributes: _objectSpread({
342
+ attributes: _objectSpread(_objectSpread({
341
343
  resourceId: resourceId
342
344
  }, sourceProduct && {
343
345
  sourceProduct: sourceProduct
346
+ }), sourceLocation && {
347
+ sourceLocation: sourceLocation
344
348
  })
345
349
  };
346
350
  };
@@ -357,14 +361,14 @@ var createSuccessPayload = exports.createSuccessPayload = function createSuccess
357
361
  * Operational `syncedBlockCreate` success event with the `blockInstanceId` join key and,
358
362
  * when available, the `inputMethod`, `createdEmpty`, and `nodeTypes` creation signals.
359
363
  */
360
- var createSuccessOperationalPayload = exports.createSuccessOperationalPayload = function createSuccessOperationalPayload(resourceId, blockInstanceId, sourceProduct, enrichment) {
364
+ var createSuccessOperationalPayload = exports.createSuccessOperationalPayload = function createSuccessOperationalPayload(resourceId, blockInstanceId, sourceProduct, enrichment, sourceLocation) {
361
365
  var _enrichment$nodeTypes;
362
366
  return {
363
367
  action: _enums.ACTION.INSERTED,
364
368
  actionSubject: _enums.ACTION_SUBJECT.SYNCED_BLOCK,
365
369
  actionSubjectId: _enums.ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE,
366
370
  eventType: _enums.EVENT_TYPE.OPERATIONAL,
367
- attributes: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
371
+ attributes: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
368
372
  resourceId: resourceId
369
373
  }, blockInstanceId && {
370
374
  blockInstanceId: blockInstanceId
@@ -376,6 +380,8 @@ var createSuccessOperationalPayload = exports.createSuccessOperationalPayload =
376
380
  createdEmpty: enrichment.createdEmpty
377
381
  }), (enrichment === null || enrichment === void 0 || (_enrichment$nodeTypes = enrichment.nodeTypes) === null || _enrichment$nodeTypes === void 0 ? void 0 : _enrichment$nodeTypes.length) && {
378
382
  nodeTypes: enrichment.nodeTypes
383
+ }), sourceLocation && {
384
+ sourceLocation: sourceLocation
379
385
  })
380
386
  };
381
387
  };
@@ -3,9 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.isFieldAwareJiraLocation = exports.getFieldAwareLocationScope = void 0;
6
+ exports.isFieldAwareJiraLocation = exports.getSourceLocation = exports.getFieldAwareLocationScope = void 0;
7
7
  var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
8
+ var _fg = require("@atlaskit/platform-feature-flags/fg");
8
9
  var _ari = require("../clients/block-service/ari");
10
+ var _ari2 = require("../clients/jira/ari");
9
11
  /**
10
12
  * The product check runs first so a Confluence-only document never reads the experiment.
11
13
  */
@@ -27,4 +29,27 @@ var getFieldAwareLocationScope = exports.getFieldAwareLocationScope = function g
27
29
  hostAri: hostAri
28
30
  })
29
31
  } : undefined;
32
+ };
33
+
34
+ /**
35
+ * Analytics `sourceLocation` for a source ARI: `undefined` for non-Jira sources and for the
36
+ * control cohort, so events outside the experiment keep their current shape.
37
+ *
38
+ * The `platform_editor_blocks_patch_13` gate runs first: with it off this returns `undefined`
39
+ * without the product check or the experiment read, so no new exposure is logged.
40
+ */
41
+ var getSourceLocation = exports.getSourceLocation = function getSourceLocation(sourceAri) {
42
+ if (!(0, _fg.fg)('platform_editor_blocks_patch_13')) {
43
+ return undefined;
44
+ }
45
+ if (!sourceAri || !isFieldAwareJiraLocation((0, _ari.getProductFromSourceAri)(sourceAri))) {
46
+ return undefined;
47
+ }
48
+ var location = (0, _ari2.parseJiraFieldLocation)({
49
+ ari: sourceAri
50
+ });
51
+ if (!location) {
52
+ return undefined;
53
+ }
54
+ return location.fieldId === _ari2.JIRA_DESCRIPTION_FIELD_ID ? 'description' : 'custom-field';
30
55
  };
@@ -66,7 +66,7 @@ export const getJiraIssueAriFromSourceAri = ({
66
66
  }
67
67
  return ari;
68
68
  };
69
- const JIRA_DESCRIPTION_FIELD_ID = 'description';
69
+ export const JIRA_DESCRIPTION_FIELD_ID = 'description';
70
70
 
71
71
  /**
72
72
  * One synced block location on a Jira work item, parsed once from its document ARI.
@@ -5,6 +5,8 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
5
  * `same-parent-document` is another field of the host work item.
6
6
  */
7
7
 
8
+ /** Which Jira work item field holds a source block. */
9
+
8
10
  export let SyncBlockError = /*#__PURE__*/function (SyncBlockError) {
9
11
  SyncBlockError["Errored"] = "errored";
10
12
  SyncBlockError["NotFound"] = "not_found";
@@ -414,10 +414,20 @@ export const writeDataBatch = async (cloudId, parentAri, parentId, product, data
414
414
  class BlockServiceADFFetchProvider {
415
415
  constructor({
416
416
  cloudId,
417
- parentAri
417
+ parentAri,
418
+ parentId,
419
+ product
418
420
  }) {
419
421
  this.cloudId = cloudId;
420
422
  this.parentAri = parentAri;
423
+ this.parentId = parentId;
424
+ this.product = product;
425
+ }
426
+ generateResourceIdForReference(sourceId) {
427
+ if (!this.product || !this.parentId) {
428
+ return sourceId;
429
+ }
430
+ return createResourceIdForReference(this.product, this.parentId, sourceId);
421
431
  }
422
432
 
423
433
  // resourceId of the reference synced block.
@@ -975,7 +985,9 @@ const createBlockServiceAPIProviders = ({
975
985
  return {
976
986
  fetchProvider: new BlockServiceADFFetchProvider({
977
987
  cloudId,
978
- parentAri
988
+ parentAri,
989
+ parentId,
990
+ product
979
991
  }),
980
992
  writeProvider: new BlockServiceADFWriteProvider({
981
993
  cloudId,
@@ -1005,12 +1017,16 @@ export const useMemoizedBlockServiceAPIProviders = ({
1005
1017
  };
1006
1018
  const createBlockServiceFetchOnlyAPIProvider = ({
1007
1019
  cloudId,
1008
- parentAri
1020
+ parentAri,
1021
+ parentId,
1022
+ product
1009
1023
  }) => {
1010
1024
  return {
1011
1025
  fetchProvider: new BlockServiceADFFetchProvider({
1012
1026
  cloudId,
1013
- parentAri
1027
+ parentAri,
1028
+ parentId,
1029
+ product
1014
1030
  }),
1015
1031
  writeProvider: undefined
1016
1032
  };
@@ -1021,8 +1037,12 @@ const createBlockServiceFetchOnlyAPIProvider = ({
1021
1037
  */
1022
1038
  export const useMemoizedBlockServiceFetchOnlyAPIProvider = ({
1023
1039
  cloudId,
1024
- parentAri
1040
+ parentAri,
1041
+ parentId,
1042
+ product
1025
1043
  }) => useMemo(() => createBlockServiceFetchOnlyAPIProvider({
1026
1044
  cloudId,
1027
- parentAri
1028
- }), [cloudId, parentAri]);
1045
+ parentAri,
1046
+ parentId,
1047
+ product
1048
+ }), [cloudId, parentAri, parentId, product]);
@@ -1,5 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { useMemo, useRef } from 'react';
3
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
3
4
  import { getProductFromSourceAri } from '../clients/block-service/ari';
4
5
  import { getPageIdAndTypeFromConfluencePageAri } from '../clients/confluence/ari';
5
6
  import { fetchConfluencePageInfo } from '../clients/confluence/sourceInfo';
@@ -244,6 +245,10 @@ export class SyncedBlockProvider extends SyncBlockDataProviderInterface {
244
245
  return Promise.reject(new Error(`${product} source product not supported`));
245
246
  }
246
247
  }
248
+ getParentAri() {
249
+ var _this$writeProvider6;
250
+ return (_this$writeProvider6 = this.writeProvider) === null || _this$writeProvider6 === void 0 ? void 0 : _this$writeProvider6.parentAri;
251
+ }
247
252
  generateResourceId() {
248
253
  const localId = crypto.randomUUID();
249
254
  const resourceId = crypto.randomUUID();
@@ -252,10 +257,11 @@ export class SyncedBlockProvider extends SyncBlockDataProviderInterface {
252
257
  resourceId
253
258
  };
254
259
  }
255
- canGenerateResourceIdForReference() {
256
- return this.writeProvider !== undefined;
257
- }
258
260
  generateResourceIdForReference(sourceId) {
261
+ if (isExperimentEnabled('platform_editor_blocks_patch_12')) {
262
+ var _this$fetchProvider$g, _this$fetchProvider$g2, _this$fetchProvider;
263
+ return (_this$fetchProvider$g = (_this$fetchProvider$g2 = (_this$fetchProvider = this.fetchProvider).generateResourceIdForReference) === null || _this$fetchProvider$g2 === void 0 ? void 0 : _this$fetchProvider$g2.call(_this$fetchProvider, sourceId)) !== null && _this$fetchProvider$g !== void 0 ? _this$fetchProvider$g : sourceId;
264
+ }
259
265
  if (!this.writeProvider) {
260
266
  throw new Error('Write provider not set');
261
267
  }