@atlaskit/editor-synced-block-provider 6.5.2 → 6.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/blockService/ari/package.json +17 -0
  3. package/blockService/package.json +17 -0
  4. package/blockSubscription/package.json +17 -0
  5. package/clients/confluence/ari/package.json +5 -5
  6. package/common/types/package.json +5 -5
  7. package/dist/cjs/clients/jira/sourceInfo.js +63 -10
  8. package/dist/cjs/entry-points/blockService-ari.js +24 -0
  9. package/dist/cjs/entry-points/blockService.js +18 -0
  10. package/dist/cjs/entry-points/blockServiceAPI.js +54 -0
  11. package/dist/cjs/entry-points/blockSubscription.js +18 -0
  12. package/dist/cjs/entry-points/common-types.js +12 -0
  13. package/dist/cjs/entry-points/confluence-ari.js +18 -0
  14. package/dist/cjs/entry-points/errorHandling.js +12 -0
  15. package/dist/cjs/entry-points/fetchJiraMediaToken.js +12 -0
  16. package/dist/cjs/entry-points/fetchMediaToken.js +12 -0
  17. package/dist/cjs/entry-points/jira-ari.js +18 -0
  18. package/dist/cjs/entry-points/providers-types.js +1 -0
  19. package/dist/cjs/entry-points/rebaseTransaction.js +12 -0
  20. package/dist/cjs/entry-points/referenceSyncBlockStoreManager.js +12 -0
  21. package/dist/cjs/entry-points/requestJiraIssueAccess.js +12 -0
  22. package/dist/cjs/entry-points/resolveSyncBlockInstance.js +12 -0
  23. package/dist/cjs/entry-points/resourceId.js +18 -0
  24. package/dist/cjs/entry-points/sourceInfo.js +12 -0
  25. package/dist/cjs/entry-points/syncBlockInMemorySessionCache.js +18 -0
  26. package/dist/cjs/entry-points/syncBlockProvider.js +18 -0
  27. package/dist/cjs/entry-points/syncBlockStoreManager.js +18 -0
  28. package/dist/cjs/entry-points/tokenRouting.js +18 -0
  29. package/dist/cjs/entry-points/useFetchSyncBlockData.js +12 -0
  30. package/dist/cjs/entry-points/useFetchSyncBlockTitle.js +12 -0
  31. package/dist/cjs/entry-points/useHandleContentChanges.js +12 -0
  32. package/dist/cjs/entry-points/utils.js +60 -0
  33. package/dist/cjs/entry-points/validValue.js +18 -0
  34. package/dist/cjs/hooks/useFetchSyncBlockData.js +1 -1
  35. package/dist/cjs/providers/types.js +6 -0
  36. package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +24 -12
  37. package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +18 -15
  38. package/dist/cjs/store-manager/syncBlockBatchFetcher.js +1 -1
  39. package/dist/cjs/store-manager/syncBlockProviderFactoryManager.js +6 -4
  40. package/dist/cjs/store-manager/syncBlockStoreManager.js +2 -1
  41. package/dist/cjs/store-manager/syncBlockSubscriptionManager.js +9 -5
  42. package/dist/cjs/utils/errorHandling.js +41 -26
  43. package/dist/cjs/utils/resolveSyncBlockInstance.js +11 -10
  44. package/dist/cjs/utils/utils.js +30 -2
  45. package/dist/es2019/clients/jira/sourceInfo.js +64 -4
  46. package/dist/es2019/entry-points/blockService-ari.js +2 -0
  47. package/dist/es2019/entry-points/blockService.js +2 -0
  48. package/dist/es2019/entry-points/blockServiceAPI.js +2 -0
  49. package/dist/es2019/entry-points/blockSubscription.js +2 -0
  50. package/dist/es2019/entry-points/common-types.js +2 -0
  51. package/dist/es2019/entry-points/confluence-ari.js +2 -0
  52. package/dist/es2019/entry-points/errorHandling.js +2 -0
  53. package/dist/es2019/entry-points/fetchJiraMediaToken.js +2 -0
  54. package/dist/es2019/entry-points/fetchMediaToken.js +2 -0
  55. package/dist/es2019/entry-points/jira-ari.js +2 -0
  56. package/dist/es2019/entry-points/providers-types.js +0 -0
  57. package/dist/es2019/entry-points/rebaseTransaction.js +2 -0
  58. package/dist/es2019/entry-points/referenceSyncBlockStoreManager.js +2 -0
  59. package/dist/es2019/entry-points/requestJiraIssueAccess.js +2 -0
  60. package/dist/es2019/entry-points/resolveSyncBlockInstance.js +2 -0
  61. package/dist/es2019/entry-points/resourceId.js +2 -0
  62. package/dist/es2019/entry-points/sourceInfo.js +2 -0
  63. package/dist/es2019/entry-points/syncBlockInMemorySessionCache.js +2 -0
  64. package/dist/es2019/entry-points/syncBlockProvider.js +2 -0
  65. package/dist/es2019/entry-points/syncBlockStoreManager.js +2 -0
  66. package/dist/es2019/entry-points/tokenRouting.js +2 -0
  67. package/dist/es2019/entry-points/useFetchSyncBlockData.js +2 -0
  68. package/dist/es2019/entry-points/useFetchSyncBlockTitle.js +2 -0
  69. package/dist/es2019/entry-points/useHandleContentChanges.js +2 -0
  70. package/dist/es2019/entry-points/utils.js +2 -0
  71. package/dist/es2019/entry-points/validValue.js +2 -0
  72. package/dist/es2019/hooks/useFetchSyncBlockData.js +2 -2
  73. package/dist/es2019/providers/syncBlockProvider.js +4 -2
  74. package/dist/es2019/providers/types.js +7 -0
  75. package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +25 -13
  76. package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +19 -16
  77. package/dist/es2019/store-manager/syncBlockBatchFetcher.js +2 -2
  78. package/dist/es2019/store-manager/syncBlockProviderFactoryManager.js +6 -4
  79. package/dist/es2019/store-manager/syncBlockStoreManager.js +2 -1
  80. package/dist/es2019/store-manager/syncBlockSubscriptionManager.js +9 -5
  81. package/dist/es2019/utils/errorHandling.js +33 -14
  82. package/dist/es2019/utils/resolveSyncBlockInstance.js +11 -10
  83. package/dist/es2019/utils/utils.js +26 -0
  84. package/dist/esm/clients/jira/sourceInfo.js +63 -11
  85. package/dist/esm/entry-points/blockService-ari.js +2 -0
  86. package/dist/esm/entry-points/blockService.js +2 -0
  87. package/dist/esm/entry-points/blockServiceAPI.js +2 -0
  88. package/dist/esm/entry-points/blockSubscription.js +2 -0
  89. package/dist/esm/entry-points/common-types.js +2 -0
  90. package/dist/esm/entry-points/confluence-ari.js +2 -0
  91. package/dist/esm/entry-points/errorHandling.js +2 -0
  92. package/dist/esm/entry-points/fetchJiraMediaToken.js +2 -0
  93. package/dist/esm/entry-points/fetchMediaToken.js +2 -0
  94. package/dist/esm/entry-points/jira-ari.js +2 -0
  95. package/dist/esm/entry-points/providers-types.js +0 -0
  96. package/dist/esm/entry-points/rebaseTransaction.js +2 -0
  97. package/dist/esm/entry-points/referenceSyncBlockStoreManager.js +2 -0
  98. package/dist/esm/entry-points/requestJiraIssueAccess.js +2 -0
  99. package/dist/esm/entry-points/resolveSyncBlockInstance.js +2 -0
  100. package/dist/esm/entry-points/resourceId.js +2 -0
  101. package/dist/esm/entry-points/sourceInfo.js +2 -0
  102. package/dist/esm/entry-points/syncBlockInMemorySessionCache.js +2 -0
  103. package/dist/esm/entry-points/syncBlockProvider.js +2 -0
  104. package/dist/esm/entry-points/syncBlockStoreManager.js +2 -0
  105. package/dist/esm/entry-points/tokenRouting.js +2 -0
  106. package/dist/esm/entry-points/useFetchSyncBlockData.js +2 -0
  107. package/dist/esm/entry-points/useFetchSyncBlockTitle.js +2 -0
  108. package/dist/esm/entry-points/useHandleContentChanges.js +2 -0
  109. package/dist/esm/entry-points/utils.js +2 -0
  110. package/dist/esm/entry-points/validValue.js +2 -0
  111. package/dist/esm/hooks/useFetchSyncBlockData.js +2 -2
  112. package/dist/esm/providers/types.js +7 -0
  113. package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +25 -13
  114. package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +19 -16
  115. package/dist/esm/store-manager/syncBlockBatchFetcher.js +2 -2
  116. package/dist/esm/store-manager/syncBlockProviderFactoryManager.js +6 -4
  117. package/dist/esm/store-manager/syncBlockStoreManager.js +2 -1
  118. package/dist/esm/store-manager/syncBlockSubscriptionManager.js +9 -5
  119. package/dist/esm/utils/errorHandling.js +41 -26
  120. package/dist/esm/utils/resolveSyncBlockInstance.js +11 -10
  121. package/dist/esm/utils/utils.js +29 -1
  122. package/dist/types/clients/jira/sourceInfo.d.ts +20 -0
  123. package/dist/types/common/types.d.ts +2 -1
  124. package/dist/types/entry-points/blockService-ari.d.ts +1 -0
  125. package/dist/types/entry-points/blockService.d.ts +2 -0
  126. package/dist/types/entry-points/blockServiceAPI.d.ts +1 -0
  127. package/dist/types/entry-points/blockSubscription.d.ts +1 -0
  128. package/dist/types/entry-points/common-types.d.ts +2 -0
  129. package/dist/types/entry-points/confluence-ari.d.ts +1 -0
  130. package/dist/types/entry-points/errorHandling.d.ts +1 -0
  131. package/dist/types/entry-points/fetchJiraMediaToken.d.ts +1 -0
  132. package/dist/types/entry-points/fetchMediaToken.d.ts +2 -0
  133. package/dist/types/entry-points/jira-ari.d.ts +1 -0
  134. package/dist/types/entry-points/providers-types.d.ts +1 -0
  135. package/dist/types/entry-points/rebaseTransaction.d.ts +1 -0
  136. package/dist/types/entry-points/referenceSyncBlockStoreManager.d.ts +1 -0
  137. package/dist/types/entry-points/requestJiraIssueAccess.d.ts +2 -0
  138. package/dist/types/entry-points/resolveSyncBlockInstance.d.ts +1 -0
  139. package/dist/types/entry-points/resourceId.d.ts +1 -0
  140. package/dist/types/entry-points/sourceInfo.d.ts +1 -0
  141. package/dist/types/entry-points/syncBlockInMemorySessionCache.d.ts +1 -0
  142. package/dist/types/entry-points/syncBlockProvider.d.ts +1 -0
  143. package/dist/types/entry-points/syncBlockStoreManager.d.ts +1 -0
  144. package/dist/types/entry-points/tokenRouting.d.ts +1 -0
  145. package/dist/types/entry-points/useFetchSyncBlockData.d.ts +2 -0
  146. package/dist/types/entry-points/useFetchSyncBlockTitle.d.ts +1 -0
  147. package/dist/types/entry-points/useHandleContentChanges.d.ts +1 -0
  148. package/dist/types/entry-points/utils.d.ts +1 -0
  149. package/dist/types/entry-points/validValue.d.ts +1 -0
  150. package/dist/types/providers/types.d.ts +17 -0
  151. package/dist/types/utils/errorHandling.d.ts +13 -12
  152. package/dist/types/utils/utils.d.ts +3 -1
  153. package/dist/types-ts4.5/clients/jira/sourceInfo.d.ts +20 -0
  154. package/dist/types-ts4.5/common/types.d.ts +2 -1
  155. package/dist/types-ts4.5/entry-points/blockService-ari.d.ts +1 -0
  156. package/dist/types-ts4.5/entry-points/blockService.d.ts +2 -0
  157. package/dist/types-ts4.5/entry-points/blockServiceAPI.d.ts +1 -0
  158. package/dist/types-ts4.5/entry-points/blockSubscription.d.ts +1 -0
  159. package/dist/types-ts4.5/entry-points/common-types.d.ts +2 -0
  160. package/dist/types-ts4.5/entry-points/confluence-ari.d.ts +1 -0
  161. package/dist/types-ts4.5/entry-points/errorHandling.d.ts +1 -0
  162. package/dist/types-ts4.5/entry-points/fetchJiraMediaToken.d.ts +1 -0
  163. package/dist/types-ts4.5/entry-points/fetchMediaToken.d.ts +2 -0
  164. package/dist/types-ts4.5/entry-points/jira-ari.d.ts +1 -0
  165. package/dist/types-ts4.5/entry-points/providers-types.d.ts +1 -0
  166. package/dist/types-ts4.5/entry-points/rebaseTransaction.d.ts +1 -0
  167. package/dist/types-ts4.5/entry-points/referenceSyncBlockStoreManager.d.ts +1 -0
  168. package/dist/types-ts4.5/entry-points/requestJiraIssueAccess.d.ts +2 -0
  169. package/dist/types-ts4.5/entry-points/resolveSyncBlockInstance.d.ts +1 -0
  170. package/dist/types-ts4.5/entry-points/resourceId.d.ts +1 -0
  171. package/dist/types-ts4.5/entry-points/sourceInfo.d.ts +1 -0
  172. package/dist/types-ts4.5/entry-points/syncBlockInMemorySessionCache.d.ts +1 -0
  173. package/dist/types-ts4.5/entry-points/syncBlockProvider.d.ts +1 -0
  174. package/dist/types-ts4.5/entry-points/syncBlockStoreManager.d.ts +1 -0
  175. package/dist/types-ts4.5/entry-points/tokenRouting.d.ts +1 -0
  176. package/dist/types-ts4.5/entry-points/useFetchSyncBlockData.d.ts +2 -0
  177. package/dist/types-ts4.5/entry-points/useFetchSyncBlockTitle.d.ts +1 -0
  178. package/dist/types-ts4.5/entry-points/useHandleContentChanges.d.ts +1 -0
  179. package/dist/types-ts4.5/entry-points/utils.d.ts +1 -0
  180. package/dist/types-ts4.5/entry-points/validValue.d.ts +1 -0
  181. package/dist/types-ts4.5/providers/types.d.ts +17 -0
  182. package/dist/types-ts4.5/utils/errorHandling.d.ts +13 -12
  183. package/dist/types-ts4.5/utils/utils.d.ts +3 -1
  184. package/errorHandling/package.json +17 -0
  185. package/fetchJiraMediaToken/package.json +5 -5
  186. package/fetchMediaToken/package.json +17 -0
  187. package/jira/ari/package.json +17 -0
  188. package/package.json +7 -4
  189. package/providers/block-service/blockServiceAPI/package.json +5 -5
  190. package/providers/types/package.json +5 -5
  191. package/rebaseTransaction/package.json +17 -0
  192. package/referenceSyncBlockStoreManager/package.json +17 -0
  193. package/requestJiraIssueAccess/package.json +5 -5
  194. package/resolveSyncBlockInstance/package.json +17 -0
  195. package/sourceInfo/package.json +17 -0
  196. package/syncBlockInMemorySessionCache/package.json +17 -0
  197. package/syncBlockProvider/package.json +17 -0
  198. package/syncBlockStoreManager/package.json +17 -0
  199. package/tokenRouting/package.json +5 -5
  200. package/types/package.json +17 -0
  201. package/useFetchSyncBlockData/package.json +17 -0
  202. package/useFetchSyncBlockTitle/package.json +17 -0
  203. package/useHandleContentChanges/package.json +17 -0
  204. package/utils/package.json +17 -0
  205. package/utils/resourceId/package.json +5 -5
  206. package/validValue/package.json +17 -0
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ export { parseResourceId, createResourceIdForReference } from '../utils/resourceId';
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ export { fetchConfluencePageInfo } from '../clients/confluence/sourceInfo';
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ export { SyncBlockInMemorySessionCache, syncBlockInMemorySessionCache } from '../store-manager/syncBlockInMemorySessionCache';
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ export { SyncedBlockProvider, useMemoizedSyncedBlockProvider } from '../providers/syncBlockProvider';
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ export { SyncBlockStoreManager, useMemoizedSyncBlockStoreManager } from '../store-manager/syncBlockStoreManager';
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ export { fetchTokenForSourceProduct, requiresCrossProductAuth } from '../clients/tokenRouting';
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ export { useFetchSyncBlockData } from '../hooks/useFetchSyncBlockData';
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ export { useFetchSyncBlockTitle } from '../hooks/useFetchSyncBlockTitle';
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ export { useHandleContentChanges } from '../hooks/useHandleContentChanges';
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ export { createSyncBlockNode, convertSyncBlockPMNodeToSyncBlockData, convertSyncBlockJSONNodeToSyncBlockNode, convertPMNodesToSyncBlockNodes, convertPMNodeToSyncBlockNode, convertContentUpdatedAt, getContentIdAndProductFromResourceId, getSourceProductFromResourceIdSafe, productAttrIfGateOn } from '../utils/utils';
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ export { normaliseSyncBlockProduct, normaliseSyncBlockStatus } from '../utils/validValue';
@@ -9,7 +9,7 @@ import { isSSR } from '@atlaskit/editor-common/core-utils';
9
9
  import { logException } from '@atlaskit/editor-common/monitoring';
10
10
  import { SyncBlockError } from '../common/types';
11
11
  import { fetchErrorPayload } from '../utils/errorHandling';
12
- import { createSyncBlockNode } from '../utils/utils';
12
+ import { createSyncBlockNode, productAttrIfGateOn } from '../utils/utils';
13
13
  export var useFetchSyncBlockData = function useFetchSyncBlockData(manager, resourceId, localId, fireAnalyticsEvent) {
14
14
  // Initialize both states from a single cache lookup to avoid race conditions.
15
15
  // When a block is moved/remounted, the old component's cleanup may clear the cache
@@ -71,7 +71,7 @@ export var useFetchSyncBlockData = function useFetchSyncBlockData(manager, resou
71
71
  logException(_context.t0, {
72
72
  location: 'editor-synced-block-provider/useFetchSyncBlockData'
73
73
  });
74
- fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent(fetchErrorPayload(_context.t0.message));
74
+ fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent(fetchErrorPayload(_context.t0.message, resourceId, productAttrIfGateOn(resourceId)));
75
75
 
76
76
  // Set error state if fetching fails
77
77
  setFetchState({
@@ -13,6 +13,13 @@ import { NodeDataProvider } from '@atlaskit/node-data-provider';
13
13
  * This will be used in both data processing and rendering contexts.
14
14
  */
15
15
 
16
+ /**
17
+ * Lightweight metadata for a Jira issue's type, surfaced so consumers can render the
18
+ * correct ADS issue-type icon (Task / Bug / Story / Epic / Subtask) or fall back to the
19
+ * AGG-provided `iconUrl` for custom types. Optional throughout — Confluence references
20
+ * leave it `undefined`.
21
+ */
22
+
16
23
  /**
17
24
  * Configuration options for batch fetch operations
18
25
  */
@@ -16,7 +16,7 @@ import { SyncBlockError } from '../common/types';
16
16
  import { fetchErrorPayload, fetchSuccessPayload, getSourceInfoErrorPayload, updateReferenceErrorPayload } from '../utils/errorHandling';
17
17
  import { getFetchExperience, getFetchSourceInfoExperience, getSaveReferenceExperience } from '../utils/experienceTracking';
18
18
  import { resolveSyncBlockInstance } from '../utils/resolveSyncBlockInstance';
19
- import { createSyncBlockNode } from '../utils/utils';
19
+ import { createSyncBlockNode, getSourceProductFromResourceIdSafe, productAttrIfGateOn } from '../utils/utils';
20
20
  import { SyncBlockBatchFetcher } from './syncBlockBatchFetcher';
21
21
  import { syncBlockInMemorySessionCache } from './syncBlockInMemorySessionCache';
22
22
  import { SyncBlockProviderFactoryManager } from './syncBlockProviderFactoryManager';
@@ -293,7 +293,8 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
293
293
  sourceURL = _ref.sourceURL,
294
294
  sourceTitle = _ref.sourceTitle,
295
295
  onSameDocument = _ref.onSameDocument,
296
- sourceSubType = _ref.sourceSubType;
296
+ sourceSubType = _ref.sourceSubType,
297
+ issueType = _ref.issueType;
297
298
  // skip if source URL and title are already present
298
299
  if (sourceURL && sourceTitle) {
299
300
  return Promise.resolve({
@@ -302,12 +303,18 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
302
303
  subType: sourceSubType,
303
304
  sourceAri: sourceAri || '',
304
305
  onSameDocument: onSameDocument,
305
- productType: product
306
+ productType: product,
307
+ issueType: issueType
306
308
  });
307
309
  }
310
+
311
+ // Derive once per call so we don't re-parse on every analytics event below.
312
+ // `product` from cached data is preferred when available; fall back to parsing
313
+ // the resourceId.
314
+ var sourceProduct = fg('platform_synced_block_patch_11') ? product !== null && product !== void 0 ? product : getSourceProductFromResourceIdSafe(resourceId) : undefined;
308
315
  if (!sourceAri || !product || !blockInstanceId) {
309
316
  var _this$fireAnalyticsEv3;
310
- (_this$fireAnalyticsEv3 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv3 === void 0 || _this$fireAnalyticsEv3.call(this, getSourceInfoErrorPayload('SourceAri, product or blockInstanceId missing', resourceId));
317
+ (_this$fireAnalyticsEv3 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv3 === void 0 || _this$fireAnalyticsEv3.call(this, getSourceInfoErrorPayload('SourceAri, product or blockInstanceId missing', resourceId, sourceProduct));
311
318
  return Promise.resolve(undefined);
312
319
  }
313
320
  (_this$fetchSourceInfo = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo === void 0 || _this$fetchSourceInfo.start({});
@@ -318,7 +325,7 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
318
325
  (_this2$fetchSourceInf = _this2.fetchSourceInfoExperience) === null || _this2$fetchSourceInf === void 0 || _this2$fetchSourceInf.failure({
319
326
  reason: 'No source info returned'
320
327
  });
321
- (_this2$fireAnalyticsE = _this2.fireAnalyticsEvent) === null || _this2$fireAnalyticsE === void 0 || _this2$fireAnalyticsE.call(_this2, getSourceInfoErrorPayload('No source info returned', resourceId));
328
+ (_this2$fireAnalyticsE = _this2.fireAnalyticsEvent) === null || _this2$fireAnalyticsE === void 0 || _this2$fireAnalyticsE.call(_this2, getSourceInfoErrorPayload('No source info returned', resourceId, sourceProduct));
322
329
  return undefined;
323
330
  }
324
331
  _this2.updateCacheWithSourceInfo(resourceId, sourceInfo);
@@ -333,7 +340,7 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
333
340
  (_this2$fetchSourceInf3 = _this2.fetchSourceInfoExperience) === null || _this2$fetchSourceInf3 === void 0 || _this2$fetchSourceInf3.failure({
334
341
  reason: 'Missing title or url'
335
342
  });
336
- (_this2$fireAnalyticsE2 = _this2.fireAnalyticsEvent) === null || _this2$fireAnalyticsE2 === void 0 || _this2$fireAnalyticsE2.call(_this2, getSourceInfoErrorPayload('Missing title or url', resourceId));
343
+ (_this2$fireAnalyticsE2 = _this2.fireAnalyticsEvent) === null || _this2$fireAnalyticsE2 === void 0 || _this2$fireAnalyticsE2.call(_this2, getSourceInfoErrorPayload('Missing title or url', resourceId, sourceProduct));
337
344
  }
338
345
  return sourceInfo;
339
346
  }).catch(function (error) {
@@ -341,7 +348,7 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
341
348
  (_this2$fetchSourceInf4 = _this2.fetchSourceInfoExperience) === null || _this2$fetchSourceInf4 === void 0 || _this2$fetchSourceInf4.failure({
342
349
  reason: error.message
343
350
  });
344
- (_this2$fireAnalyticsE3 = _this2.fireAnalyticsEvent) === null || _this2$fireAnalyticsE3 === void 0 || _this2$fireAnalyticsE3.call(_this2, getSourceInfoErrorPayload(error.message, resourceId));
351
+ (_this2$fireAnalyticsE3 = _this2.fireAnalyticsEvent) === null || _this2$fireAnalyticsE3 === void 0 || _this2$fireAnalyticsE3.call(_this2, getSourceInfoErrorPayload(error.message, resourceId, sourceProduct));
345
352
  return undefined;
346
353
  }).finally(function () {
347
354
  _this2.syncBlockSourceInfoRequests.delete(resourceId);
@@ -353,7 +360,7 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
353
360
  logException(error, {
354
361
  location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
355
362
  });
356
- (_this$fireAnalyticsEv4 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv4 === void 0 || _this$fireAnalyticsEv4.call(this, getSourceInfoErrorPayload(error.message, resourceId));
363
+ (_this$fireAnalyticsEv4 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv4 === void 0 || _this$fireAnalyticsEv4.call(this, getSourceInfoErrorPayload(error.message, resourceId, productAttrIfGateOn(resourceId)));
357
364
  }
358
365
  return Promise.resolve(undefined);
359
366
  }
@@ -528,6 +535,7 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
528
535
  if (!syncBlockInstance.resourceId) {
529
536
  var _syncBlockInstance$er, _syncBlockInstance$er2, _this5$fireAnalyticsE;
530
537
  var payload = ((_syncBlockInstance$er = syncBlockInstance.error) === null || _syncBlockInstance$er === void 0 ? void 0 : _syncBlockInstance$er.reason) || ((_syncBlockInstance$er2 = syncBlockInstance.error) === null || _syncBlockInstance$er2 === void 0 ? void 0 : _syncBlockInstance$er2.type) || 'Returned sync block instance does not have resource id';
538
+ // No resourceId means we cannot derive a sourceProduct here; intentionally omit.
531
539
  (_this5$fireAnalyticsE = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE === void 0 || _this5$fireAnalyticsE.call(_this5, fetchErrorPayload(payload));
532
540
  return;
533
541
  }
@@ -546,8 +554,8 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
546
554
  _this5.newlyAddedSyncBlocks.delete(syncBlockInstance.resourceId);
547
555
  }
548
556
  if (syncBlockInstance.error) {
549
- var _this5$fireAnalyticsE2;
550
- (_this5$fireAnalyticsE2 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE2 === void 0 || _this5$fireAnalyticsE2.call(_this5, fetchErrorPayload(syncBlockInstance.error.reason || syncBlockInstance.error.type, syncBlockInstance.resourceId));
557
+ var _this5$fireAnalyticsE2, _syncBlockInstance$da, _syncBlockInstance$da2;
558
+ (_this5$fireAnalyticsE2 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE2 === void 0 || _this5$fireAnalyticsE2.call(_this5, fetchErrorPayload(syncBlockInstance.error.reason || syncBlockInstance.error.type, syncBlockInstance.resourceId, fg('platform_synced_block_patch_11') ? (_syncBlockInstance$da = (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.product) !== null && _syncBlockInstance$da !== void 0 ? _syncBlockInstance$da : getSourceProductFromResourceIdSafe(syncBlockInstance.resourceId) : undefined));
551
559
  if (syncBlockInstance.error.type === SyncBlockError.NotFound || syncBlockInstance.error.type === SyncBlockError.Forbidden) {
552
560
  hasExpectedError = true;
553
561
  } else if (syncBlockInstance.error) {
@@ -558,8 +566,10 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
558
566
  var callbacks = _this5._subscriptionManager.getSubscriptions().get(syncBlockInstance.resourceId);
559
567
  var localIds = callbacks ? Object.keys(callbacks) : [];
560
568
  localIds.forEach(function (localId) {
561
- var _this5$fireAnalyticsE3, _syncBlockInstance$da;
562
- (_this5$fireAnalyticsE3 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE3 === void 0 || _this5$fireAnalyticsE3.call(_this5, fetchSuccessPayload(syncBlockInstance.resourceId, localId, (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.product));
569
+ var _this5$fireAnalyticsE3, _syncBlockInstance$da3, _syncBlockInstance$da4;
570
+ (_this5$fireAnalyticsE3 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE3 === void 0 || _this5$fireAnalyticsE3.call(_this5, fetchSuccessPayload(syncBlockInstance.resourceId, localId,
571
+ // Prefer cached product when available; fall back to parsing the resourceId.
572
+ fg('platform_synced_block_patch_11') ? (_syncBlockInstance$da3 = (_syncBlockInstance$da4 = syncBlockInstance.data) === null || _syncBlockInstance$da4 === void 0 ? void 0 : _syncBlockInstance$da4.product) !== null && _syncBlockInstance$da3 !== void 0 ? _syncBlockInstance$da3 : getSourceProductFromResourceIdSafe(syncBlockInstance.resourceId) : undefined));
563
573
  });
564
574
  _this5.fetchSyncBlockSourceInfo(resolvedSyncBlockInstance.resourceId);
565
575
  });
@@ -578,7 +588,8 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
578
588
  sourceURL: sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.url,
579
589
  sourceTitle: sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.title,
580
590
  onSameDocument: sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.onSameDocument,
581
- sourceSubType: sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.subType
591
+ sourceSubType: sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.subType,
592
+ issueType: sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.issueType
582
593
  });
583
594
  this.updateCache(existingSyncBlock);
584
595
  }
@@ -818,6 +829,7 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
818
829
  (_this$saveExperience3 = this.saveExperience) === null || _this$saveExperience3 === void 0 || _this$saveExperience3.failure({
819
830
  reason: _context4.t2.message
820
831
  });
832
+ // No `resourceId` available in this catch — sourceProduct is intentionally omitted.
821
833
  (_this$fireAnalyticsEv7 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv7 === void 0 || _this$fireAnalyticsEv7.call(this, updateReferenceErrorPayload(_context4.t2.message));
822
834
  case 49:
823
835
  _context4.prev = 49;
@@ -16,7 +16,7 @@ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
16
16
  import { SyncBlockError } from '../common/types';
17
17
  import { updateErrorPayload, createErrorPayload, deleteErrorPayload, updateCacheErrorPayload, getSourceInfoErrorPayload, updateSuccessPayload, createSuccessPayload, deleteSuccessPayload, fetchReferencesErrorPayload } from '../utils/errorHandling';
18
18
  import { getCreateSourceExperience, getDeleteSourceExperience, getSaveSourceExperience, getFetchSourceInfoExperience } from '../utils/experienceTracking';
19
- import { convertSyncBlockPMNodeToSyncBlockData } from '../utils/utils';
19
+ import { convertSyncBlockPMNodeToSyncBlockData, productAttrIfGateOn } from '../utils/utils';
20
20
  // A store manager responsible for the lifecycle and state management of source sync blocks in an editor instance.
21
21
  // Designed to manage local in-memory state and synchronize with an external data provider.
22
22
  // Supports create, flush, and delete operations for source sync blocks.
@@ -121,11 +121,13 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
121
121
  }
122
122
  return true;
123
123
  } catch (error) {
124
- var _this$fireAnalyticsEv;
124
+ var _this$fireAnalyticsEv, _syncBlockNode$attrs2, _syncBlockNode$attrs3;
125
125
  logException(error, {
126
126
  location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
127
127
  });
128
- (_this$fireAnalyticsEv = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv === void 0 || _this$fireAnalyticsEv.call(this, updateCacheErrorPayload(error.message));
128
+ // We can derive the product from `syncBlockNode.attrs.resourceId` even though
129
+ // the variable wasn't destructured (the destructuring step itself may have thrown).
130
+ (_this$fireAnalyticsEv = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv === void 0 || _this$fireAnalyticsEv.call(this, updateCacheErrorPayload(error.message, syncBlockNode === null || syncBlockNode === void 0 || (_syncBlockNode$attrs2 = syncBlockNode.attrs) === null || _syncBlockNode$attrs2 === void 0 ? void 0 : _syncBlockNode$attrs2.resourceId, productAttrIfGateOn(syncBlockNode === null || syncBlockNode === void 0 || (_syncBlockNode$attrs3 = syncBlockNode.attrs) === null || _syncBlockNode$attrs3 === void 0 ? void 0 : _syncBlockNode$attrs3.resourceId)));
129
131
  return false;
130
132
  }
131
133
  }
@@ -222,7 +224,7 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
222
224
  cachedData.status = result.status;
223
225
  }
224
226
  }
225
- (_this2$fireAnalyticsE = _this2.fireAnalyticsEvent) === null || _this2$fireAnalyticsE === void 0 || _this2$fireAnalyticsE.call(_this2, updateSuccessPayload(result.resourceId, false));
227
+ (_this2$fireAnalyticsE = _this2.fireAnalyticsEvent) === null || _this2$fireAnalyticsE === void 0 || _this2$fireAnalyticsE.call(_this2, updateSuccessPayload(result.resourceId, false, productAttrIfGateOn(result.resourceId)));
226
228
  }
227
229
  });
228
230
  return _context.abrupt("return", true);
@@ -232,7 +234,7 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
232
234
  return !result.resourceId || result.error;
233
235
  }).forEach(function (result) {
234
236
  var _this2$fireAnalyticsE2;
235
- (_this2$fireAnalyticsE2 = _this2.fireAnalyticsEvent) === null || _this2$fireAnalyticsE2 === void 0 || _this2$fireAnalyticsE2.call(_this2, updateErrorPayload(result.error || 'Failed to write data', result.resourceId));
237
+ (_this2$fireAnalyticsE2 = _this2.fireAnalyticsEvent) === null || _this2$fireAnalyticsE2 === void 0 || _this2$fireAnalyticsE2.call(_this2, updateErrorPayload(result.error || 'Failed to write data', result.resourceId, productAttrIfGateOn(result.resourceId)));
236
238
  });
237
239
  return _context.abrupt("return", false);
238
240
  case 24:
@@ -244,6 +246,7 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
244
246
  logException(_context.t0, {
245
247
  location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
246
248
  });
249
+ // Top-level flush failure is not tied to a single resourceId.
247
250
  (_this$fireAnalyticsEv2 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv2 === void 0 || _this$fireAnalyticsEv2.call(this, updateErrorPayload(_context.t0.message));
248
251
  return _context.abrupt("return", false);
249
252
  case 31:
@@ -319,16 +322,16 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
319
322
  }
320
323
  } else {
321
324
  var _this$fireAnalyticsEv3;
322
- (_this$fireAnalyticsEv3 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv3 === void 0 || _this$fireAnalyticsEv3.call(this, createErrorPayload('creation complete callback missing', resourceId));
325
+ (_this$fireAnalyticsEv3 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv3 === void 0 || _this$fireAnalyticsEv3.call(this, createErrorPayload('creation complete callback missing', resourceId, productAttrIfGateOn(resourceId)));
323
326
  }
324
327
  if (success) {
325
328
  var _this$fireAnalyticsEv4;
326
- (_this$fireAnalyticsEv4 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv4 === void 0 || _this$fireAnalyticsEv4.call(this, createSuccessPayload(resourceId || ''));
329
+ (_this$fireAnalyticsEv4 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv4 === void 0 || _this$fireAnalyticsEv4.call(this, createSuccessPayload(resourceId || '', productAttrIfGateOn(resourceId)));
327
330
  } else {
328
331
  var _this$fireAnalyticsEv5;
329
332
  // Delete the node from cache if fail to create so it's not flushed to BE
330
333
  this.syncBlockCache.delete(resourceId || '');
331
- (_this$fireAnalyticsEv5 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv5 === void 0 || _this$fireAnalyticsEv5.call(this, createErrorPayload('Fail to create bodied sync block', resourceId));
334
+ (_this$fireAnalyticsEv5 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv5 === void 0 || _this$fireAnalyticsEv5.call(this, createErrorPayload('Fail to create bodied sync block', resourceId, productAttrIfGateOn(resourceId)));
332
335
  }
333
336
  }
334
337
  }, {
@@ -414,7 +417,7 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
414
417
  (_this4$createExperien2 = _this4.createExperience) === null || _this4$createExperien2 === void 0 || _this4$createExperien2.failure({
415
418
  reason: result.error || 'Failed to create bodied sync block'
416
419
  });
417
- (_this4$fireAnalyticsE = _this4.fireAnalyticsEvent) === null || _this4$fireAnalyticsE === void 0 || _this4$fireAnalyticsE.call(_this4, createErrorPayload(result.error || 'Failed to create bodied sync block', resourceId));
420
+ (_this4$fireAnalyticsE = _this4.fireAnalyticsEvent) === null || _this4$fireAnalyticsE === void 0 || _this4$fireAnalyticsE.call(_this4, createErrorPayload(result.error || 'Failed to create bodied sync block', resourceId, productAttrIfGateOn(resourceId)));
418
421
  }
419
422
  }).catch(function (error) {
420
423
  var _this4$createExperien3, _this4$fireAnalyticsE2;
@@ -425,7 +428,7 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
425
428
  (_this4$createExperien3 = _this4.createExperience) === null || _this4$createExperien3 === void 0 || _this4$createExperien3.failure({
426
429
  reason: error.message
427
430
  });
428
- (_this4$fireAnalyticsE2 = _this4.fireAnalyticsEvent) === null || _this4$fireAnalyticsE2 === void 0 || _this4$fireAnalyticsE2.call(_this4, createErrorPayload(error.message, resourceId));
431
+ (_this4$fireAnalyticsE2 = _this4.fireAnalyticsEvent) === null || _this4$fireAnalyticsE2 === void 0 || _this4$fireAnalyticsE2.call(_this4, createErrorPayload(error.message, resourceId, productAttrIfGateOn(resourceId)));
429
432
  });
430
433
  } catch (error) {
431
434
  var _this$fireAnalyticsEv6;
@@ -435,7 +438,7 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
435
438
  logException(error, {
436
439
  location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
437
440
  });
438
- (_this$fireAnalyticsEv6 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv6 === void 0 || _this$fireAnalyticsEv6.call(this, createErrorPayload(error.message));
441
+ (_this$fireAnalyticsEv6 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv6 === void 0 || _this$fireAnalyticsEv6.call(this, createErrorPayload(error.message, resourceId, productAttrIfGateOn(resourceId)));
439
442
  }
440
443
  }
441
444
  }, {
@@ -483,7 +486,7 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
483
486
  (_this$deleteExperienc2 = this.deleteExperience) === null || _this$deleteExperienc2 === void 0 || _this$deleteExperienc2.success();
484
487
  results.forEach(function (result) {
485
488
  var _this5$fireAnalyticsE;
486
- (_this5$fireAnalyticsE = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE === void 0 || _this5$fireAnalyticsE.call(_this5, deleteSuccessPayload(result.resourceId));
489
+ (_this5$fireAnalyticsE = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE === void 0 || _this5$fireAnalyticsE.call(_this5, deleteSuccessPayload(result.resourceId, productAttrIfGateOn(result.resourceId)));
487
490
  });
488
491
  } else {
489
492
  callback = function callback(Ids) {
@@ -493,10 +496,10 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
493
496
  results.forEach(function (result) {
494
497
  if (result.success) {
495
498
  var _this5$fireAnalyticsE2;
496
- (_this5$fireAnalyticsE2 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE2 === void 0 || _this5$fireAnalyticsE2.call(_this5, deleteSuccessPayload(result.resourceId));
499
+ (_this5$fireAnalyticsE2 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE2 === void 0 || _this5$fireAnalyticsE2.call(_this5, deleteSuccessPayload(result.resourceId, productAttrIfGateOn(result.resourceId)));
497
500
  } else {
498
501
  var _this5$fireAnalyticsE3;
499
- (_this5$fireAnalyticsE3 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE3 === void 0 || _this5$fireAnalyticsE3.call(_this5, deleteErrorPayload(result.error || 'Failed to delete synced block', result.resourceId));
502
+ (_this5$fireAnalyticsE3 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE3 === void 0 || _this5$fireAnalyticsE3.call(_this5, deleteErrorPayload(result.error || 'Failed to delete synced block', result.resourceId, productAttrIfGateOn(result.resourceId)));
500
503
  }
501
504
  });
502
505
  }
@@ -508,7 +511,7 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
508
511
  syncBlockIds.forEach(function (Ids) {
509
512
  var _this5$fireAnalyticsE4;
510
513
  _this5.setPendingDeletion(Ids, false);
511
- (_this5$fireAnalyticsE4 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE4 === void 0 || _this5$fireAnalyticsE4.call(_this5, deleteErrorPayload(_context2.t0.message, Ids.resourceId));
514
+ (_this5$fireAnalyticsE4 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE4 === void 0 || _this5$fireAnalyticsE4.call(_this5, deleteErrorPayload(_context2.t0.message, Ids.resourceId, productAttrIfGateOn(Ids.resourceId)));
512
515
  });
513
516
  logException(_context2.t0, {
514
517
  location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
@@ -802,7 +805,7 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
802
805
  logException(error, {
803
806
  location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
804
807
  });
805
- (_this$fireAnalyticsEv8 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv8 === void 0 || _this$fireAnalyticsEv8.call(this, fetchReferencesErrorPayload(error.message));
808
+ (_this$fireAnalyticsEv8 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv8 === void 0 || _this$fireAnalyticsEv8.call(this, fetchReferencesErrorPayload(error.message, resourceId, productAttrIfGateOn(resourceId)));
806
809
  return Promise.resolve({
807
810
  error: SyncBlockError.Errored
808
811
  });
@@ -4,7 +4,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
4
  import rafSchedule from 'raf-schd';
5
5
  import { logException } from '@atlaskit/editor-common/monitoring';
6
6
  import { fetchErrorPayload } from '../utils/errorHandling';
7
- import { createSyncBlockNode } from '../utils/utils';
7
+ import { createSyncBlockNode, productAttrIfGateOn } from '../utils/utils';
8
8
  /**
9
9
  * Handles debounced batch-fetching of sync block data via `raf-schd`.
10
10
  * Accumulates resource IDs and flushes them in a single fetch per
@@ -33,7 +33,7 @@ export var SyncBlockBatchFetcher = /*#__PURE__*/function () {
33
33
  });
34
34
  resourceIds.forEach(function (resId) {
35
35
  var _this$deps$getFireAna;
36
- (_this$deps$getFireAna = _this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna === void 0 || _this$deps$getFireAna(fetchErrorPayload(error.message, resId));
36
+ (_this$deps$getFireAna = _this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna === void 0 || _this$deps$getFireAna(fetchErrorPayload(error.message, resId, productAttrIfGateOn(resId)));
37
37
  });
38
38
  });
39
39
  });
@@ -5,6 +5,7 @@ import { logException } from '@atlaskit/editor-common/monitoring';
5
5
  import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
6
6
  import { fetchErrorPayload } from '../utils/errorHandling';
7
7
  import { parseResourceId } from '../utils/resourceId';
8
+ import { productAttrIfGateOn } from '../utils/utils';
8
9
  /**
9
10
  * Manages creation and caching of ProviderFactory instances used to
10
11
  * render synced block content (media, emoji, smart links, etc.).
@@ -25,7 +26,7 @@ export var SyncBlockProviderFactoryManager = /*#__PURE__*/function () {
25
26
  logException(error, {
26
27
  location: 'editor-synced-block-provider/syncBlockProviderFactoryManager'
27
28
  });
28
- (_this$deps$getFireAna = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna === void 0 || _this$deps$getFireAna(fetchErrorPayload(error.message));
29
+ (_this$deps$getFireAna = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna === void 0 || _this$deps$getFireAna(fetchErrorPayload(error.message, resourceId, productAttrIfGateOn(resourceId)));
29
30
  return undefined;
30
31
  }
31
32
  var _dataProvider$getSync = dataProvider.getSyncedBlockRendererProviderOptions(),
@@ -58,7 +59,7 @@ export var SyncBlockProviderFactoryManager = /*#__PURE__*/function () {
58
59
  logException(error, {
59
60
  location: 'editor-synced-block-provider/syncBlockProviderFactoryManager'
60
61
  });
61
- (_this$deps$getFireAna2 = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna2 === void 0 || _this$deps$getFireAna2(fetchErrorPayload(error.message, resourceId));
62
+ (_this$deps$getFireAna2 = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna2 === void 0 || _this$deps$getFireAna2(fetchErrorPayload(error.message, resourceId, productAttrIfGateOn(resourceId)));
62
63
  }
63
64
  }
64
65
  return providerFactory;
@@ -141,8 +142,9 @@ export var SyncBlockProviderFactoryManager = /*#__PURE__*/function () {
141
142
  return;
142
143
  }
143
144
  if (!syncBlock.data.sourceAri || !syncBlock.data.product) {
144
- var _this$deps$getFireAna3;
145
- (_this$deps$getFireAna3 = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna3 === void 0 || _this$deps$getFireAna3(fetchErrorPayload('Sync block source ari or product not found'));
145
+ var _this$deps$getFireAna3, _syncBlock$data$produ;
146
+ (_this$deps$getFireAna3 = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna3 === void 0 || _this$deps$getFireAna3(fetchErrorPayload('Sync block source ari or product not found', resourceId, // Prefer cached product when available; fall back to parsing resourceId.
147
+ (_syncBlock$data$produ = syncBlock.data.product) !== null && _syncBlock$data$produ !== void 0 ? _syncBlock$data$produ : productAttrIfGateOn(resourceId)));
146
148
  return;
147
149
  }
148
150
  var parentInfo = dataProvider.retrieveSyncBlockParentInfo(syncBlock.data.sourceAri, syncBlock.data.product);
@@ -12,6 +12,7 @@ import { getProductFromSourceAri } from '../clients/block-service/ari';
12
12
  import { SyncBlockError } from '../common/types';
13
13
  import { fetchReferencesErrorPayload } from '../utils/errorHandling';
14
14
  import { getFetchReferencesExperience, getFetchSourceInfoExperience } from '../utils/experienceTracking';
15
+ import { productAttrIfGateOn } from '../utils/utils';
15
16
  import { ReferenceSyncBlockStoreManager } from './referenceSyncBlockStoreManager';
16
17
  import { SourceSyncBlockStoreManager } from './sourceSyncBlockStoreManager';
17
18
 
@@ -154,7 +155,7 @@ export var SyncBlockStoreManager = /*#__PURE__*/function () {
154
155
  logException(_context2.t0, {
155
156
  location: 'editor-synced-block-provider/syncBlockStoreManager'
156
157
  });
157
- (_this$fireAnalyticsEv = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv === void 0 || _this$fireAnalyticsEv.call(this, fetchReferencesErrorPayload(_context2.t0.message));
158
+ (_this$fireAnalyticsEv = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv === void 0 || _this$fireAnalyticsEv.call(this, fetchReferencesErrorPayload(_context2.t0.message, resourceId, productAttrIfGateOn(resourceId)));
158
159
  return _context2.abrupt("return", {
159
160
  error: SyncBlockError.Errored
160
161
  });
@@ -7,8 +7,10 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
7
7
  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; }
8
8
  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; }
9
9
  import { logException } from '@atlaskit/editor-common/monitoring';
10
+ import { fg } from '@atlaskit/platform-feature-flags';
10
11
  import { fetchErrorPayload, fetchSuccessPayload } from '../utils/errorHandling';
11
12
  import { resolveSyncBlockInstance } from '../utils/resolveSyncBlockInstance';
13
+ import { getSourceProductFromResourceIdSafe, productAttrIfGateOn } from '../utils/utils';
12
14
  /**
13
15
  * Manages the lifecycle of GraphQL WebSocket subscriptions for sync block
14
16
  * real-time updates, owns the subscriptions and titleSubscriptions maps,
@@ -249,7 +251,7 @@ export var SyncBlockSubscriptionManager = /*#__PURE__*/function () {
249
251
  logException(error, {
250
252
  location: 'editor-synced-block-provider/syncBlockSubscriptionManager/graphql-subscription'
251
253
  });
252
- (_this5$deps$getFireAn = _this5.deps.getFireAnalyticsEvent()) === null || _this5$deps$getFireAn === void 0 || _this5$deps$getFireAn(fetchErrorPayload(error.message));
254
+ (_this5$deps$getFireAn = _this5.deps.getFireAnalyticsEvent()) === null || _this5$deps$getFireAn === void 0 || _this5$deps$getFireAn(fetchErrorPayload(error.message, resourceId, productAttrIfGateOn(resourceId)));
253
255
  });
254
256
  if (unsubscribe) {
255
257
  this.graphqlSubscriptions.set(resourceId, unsubscribe);
@@ -340,14 +342,16 @@ export var SyncBlockSubscriptionManager = /*#__PURE__*/function () {
340
342
  var callbacks = this.subscriptions.get(syncBlockInstance.resourceId);
341
343
  var localIds = callbacks ? Object.keys(callbacks) : [];
342
344
  localIds.forEach(function (localId) {
343
- var _this6$deps$getFireAn, _syncBlockInstance$da;
344
- (_this6$deps$getFireAn = _this6.deps.getFireAnalyticsEvent()) === null || _this6$deps$getFireAn === void 0 || _this6$deps$getFireAn(fetchSuccessPayload(syncBlockInstance.resourceId, localId, (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.product));
345
+ var _this6$deps$getFireAn, _syncBlockInstance$da, _syncBlockInstance$da2;
346
+ (_this6$deps$getFireAn = _this6.deps.getFireAnalyticsEvent()) === null || _this6$deps$getFireAn === void 0 || _this6$deps$getFireAn(fetchSuccessPayload(syncBlockInstance.resourceId, localId,
347
+ // Prefer cached product when available; fall back to parsing the resourceId.
348
+ fg('platform_synced_block_patch_11') ? (_syncBlockInstance$da = (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.product) !== null && _syncBlockInstance$da !== void 0 ? _syncBlockInstance$da : getSourceProductFromResourceIdSafe(syncBlockInstance.resourceId) : undefined));
345
349
  });
346
350
  this.deps.fetchSyncBlockSourceInfo(resolved.resourceId);
347
351
  } else {
348
- var _syncBlockInstance$er, _syncBlockInstance$er2, _this$deps$getFireAna;
352
+ var _syncBlockInstance$er, _syncBlockInstance$er2, _this$deps$getFireAna, _syncBlockInstance$da3, _syncBlockInstance$da4;
349
353
  var errorMessage = ((_syncBlockInstance$er = syncBlockInstance.error) === null || _syncBlockInstance$er === void 0 ? void 0 : _syncBlockInstance$er.reason) || ((_syncBlockInstance$er2 = syncBlockInstance.error) === null || _syncBlockInstance$er2 === void 0 ? void 0 : _syncBlockInstance$er2.type);
350
- (_this$deps$getFireAna = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna === void 0 || _this$deps$getFireAna(fetchErrorPayload(errorMessage, syncBlockInstance.resourceId));
354
+ (_this$deps$getFireAna = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna === void 0 || _this$deps$getFireAna(fetchErrorPayload(errorMessage, syncBlockInstance.resourceId, fg('platform_synced_block_patch_11') ? (_syncBlockInstance$da3 = (_syncBlockInstance$da4 = syncBlockInstance.data) === null || _syncBlockInstance$da4 === void 0 ? void 0 : _syncBlockInstance$da4.product) !== null && _syncBlockInstance$da3 !== void 0 ? _syncBlockInstance$da3 : getSourceProductFromResourceIdSafe(syncBlockInstance.resourceId) : undefined));
351
355
  }
352
356
  }
353
357
  }]);
@@ -9,42 +9,51 @@ export var stringifyError = function stringifyError(error) {
9
9
  return undefined;
10
10
  }
11
11
  };
12
- export var getErrorPayload = function getErrorPayload(actionSubjectId, error, resourceId) {
12
+
13
+ // `sourceProduct` is threaded through every helper so analytics
14
+ // events can be attributed to the source product (`confluence-page` vs `jira-work-item`).
15
+ // All helpers accept it as an optional trailing argument; the spread-only-when-truthy
16
+ // pattern below ensures we never emit `sourceProduct: undefined` (which would dirty the
17
+ // event schema with empty keys).
18
+
19
+ export var getErrorPayload = function getErrorPayload(actionSubjectId, error, resourceId, sourceProduct) {
13
20
  return {
14
21
  action: ACTION.ERROR,
15
22
  actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
16
23
  actionSubjectId: actionSubjectId,
17
24
  eventType: EVENT_TYPE.OPERATIONAL,
18
- attributes: _objectSpread({
25
+ attributes: _objectSpread(_objectSpread({
19
26
  error: error
20
27
  }, resourceId && {
21
28
  resourceId: resourceId
29
+ }), sourceProduct && {
30
+ sourceProduct: sourceProduct
22
31
  })
23
32
  };
24
33
  };
25
- export var fetchErrorPayload = function fetchErrorPayload(error, resourceId) {
26
- return getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_FETCH, error, resourceId);
34
+ export var fetchErrorPayload = function fetchErrorPayload(error, resourceId, sourceProduct) {
35
+ return getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_FETCH, error, resourceId, sourceProduct);
27
36
  };
28
- export var getSourceInfoErrorPayload = function getSourceInfoErrorPayload(error, resourceId) {
29
- return getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_GET_SOURCE_INFO, error, resourceId);
37
+ export var getSourceInfoErrorPayload = function getSourceInfoErrorPayload(error, resourceId, sourceProduct) {
38
+ return getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_GET_SOURCE_INFO, error, resourceId, sourceProduct);
30
39
  };
31
- export var updateErrorPayload = function updateErrorPayload(error, resourceId) {
32
- return getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_UPDATE, error, resourceId);
40
+ export var updateErrorPayload = function updateErrorPayload(error, resourceId, sourceProduct) {
41
+ return getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_UPDATE, error, resourceId, sourceProduct);
33
42
  };
34
- export var updateReferenceErrorPayload = function updateReferenceErrorPayload(error, resourceId) {
35
- return getErrorPayload(ACTION_SUBJECT_ID.REFERENCE_SYNCED_BLOCK_UPDATE, error, resourceId);
43
+ export var updateReferenceErrorPayload = function updateReferenceErrorPayload(error, resourceId, sourceProduct) {
44
+ return getErrorPayload(ACTION_SUBJECT_ID.REFERENCE_SYNCED_BLOCK_UPDATE, error, resourceId, sourceProduct);
36
45
  };
37
- export var createErrorPayload = function createErrorPayload(error, resourceId) {
38
- return getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE, error, resourceId);
46
+ export var createErrorPayload = function createErrorPayload(error, resourceId, sourceProduct) {
47
+ return getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE, error, resourceId, sourceProduct);
39
48
  };
40
- export var deleteErrorPayload = function deleteErrorPayload(error, resourceId) {
41
- return getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_DELETE, error, resourceId);
49
+ export var deleteErrorPayload = function deleteErrorPayload(error, resourceId, sourceProduct) {
50
+ return getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_DELETE, error, resourceId, sourceProduct);
42
51
  };
43
- export var updateCacheErrorPayload = function updateCacheErrorPayload(error, resourceId) {
44
- return getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_UPDATE_CACHE, error, resourceId);
52
+ export var updateCacheErrorPayload = function updateCacheErrorPayload(error, resourceId, sourceProduct) {
53
+ return getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_UPDATE_CACHE, error, resourceId, sourceProduct);
45
54
  };
46
- export var fetchReferencesErrorPayload = function fetchReferencesErrorPayload(error, resourceId) {
47
- return getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_FETCH_REFERENCES, error, resourceId);
55
+ export var fetchReferencesErrorPayload = function fetchReferencesErrorPayload(error, resourceId, sourceProduct) {
56
+ return getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_FETCH_REFERENCES, error, resourceId, sourceProduct);
48
57
  };
49
58
 
50
59
  // Success payloads
@@ -62,15 +71,17 @@ export var fetchSuccessPayload = function fetchSuccessPayload(resourceId, blockI
62
71
  })
63
72
  };
64
73
  };
65
- export var createSuccessPayload = function createSuccessPayload(resourceId) {
74
+ export var createSuccessPayload = function createSuccessPayload(resourceId, sourceProduct) {
66
75
  return {
67
76
  action: ACTION.INSERTED,
68
77
  actionSubject: ACTION_SUBJECT.DOCUMENT,
69
78
  actionSubjectId: ACTION_SUBJECT_ID.BODIED_SYNCED_BLOCK,
70
79
  eventType: EVENT_TYPE.TRACK,
71
- attributes: {
80
+ attributes: _objectSpread({
72
81
  resourceId: resourceId
73
- }
82
+ }, sourceProduct && {
83
+ sourceProduct: sourceProduct
84
+ })
74
85
  };
75
86
  };
76
87
  export var createSuccessPayloadNew = function createSuccessPayloadNew(resourceId) {
@@ -84,27 +95,31 @@ export var createSuccessPayloadNew = function createSuccessPayloadNew(resourceId
84
95
  }
85
96
  };
86
97
  };
87
- export var updateSuccessPayload = function updateSuccessPayload(resourceId, hasReference) {
98
+ export var updateSuccessPayload = function updateSuccessPayload(resourceId, hasReference, sourceProduct) {
88
99
  return {
89
100
  action: ACTION.UPDATED,
90
101
  actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
91
102
  actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_UPDATE,
92
103
  eventType: EVENT_TYPE.OPERATIONAL,
93
- attributes: _objectSpread({
104
+ attributes: _objectSpread(_objectSpread({
94
105
  resourceId: resourceId
95
106
  }, hasReference !== undefined && {
96
107
  hasReference: hasReference
108
+ }), sourceProduct && {
109
+ sourceProduct: sourceProduct
97
110
  })
98
111
  };
99
112
  };
100
- export var deleteSuccessPayload = function deleteSuccessPayload(resourceId) {
113
+ export var deleteSuccessPayload = function deleteSuccessPayload(resourceId, sourceProduct) {
101
114
  return {
102
115
  action: ACTION.DELETED,
103
116
  actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
104
117
  actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_DELETE,
105
118
  eventType: EVENT_TYPE.OPERATIONAL,
106
- attributes: {
119
+ attributes: _objectSpread({
107
120
  resourceId: resourceId
108
- }
121
+ }, sourceProduct && {
122
+ sourceProduct: sourceProduct
123
+ })
109
124
  };
110
125
  };