@atlaskit/editor-synced-block-provider 15.0.3 → 15.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 (38) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/cjs/clients/block-service/ari.js +28 -1
  3. package/dist/cjs/clients/jira/ari.js +36 -1
  4. package/dist/cjs/clients/jira/sourceInfo.js +34 -10
  5. package/dist/cjs/common/types.js +5 -0
  6. package/dist/cjs/providers/block-service/blockServiceAPI.js +12 -4
  7. package/dist/cjs/providers/syncBlockProvider.js +9 -2
  8. package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +17 -5
  9. package/dist/cjs/store-manager/syncBlockStoreManager.js +5 -2
  10. package/dist/cjs/utils/fieldAwareLocations.js +30 -0
  11. package/dist/cjs/utils/resolveSyncBlockInstance.js +8 -2
  12. package/dist/es2019/clients/block-service/ari.js +28 -0
  13. package/dist/es2019/clients/jira/ari.js +35 -0
  14. package/dist/es2019/clients/jira/sourceInfo.js +52 -6
  15. package/dist/es2019/common/types.js +6 -0
  16. package/dist/es2019/providers/block-service/blockServiceAPI.js +11 -3
  17. package/dist/es2019/providers/syncBlockProvider.js +7 -1
  18. package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +14 -0
  19. package/dist/es2019/store-manager/syncBlockStoreManager.js +3 -0
  20. package/dist/es2019/utils/fieldAwareLocations.js +21 -0
  21. package/dist/es2019/utils/resolveSyncBlockInstance.js +10 -2
  22. package/dist/esm/clients/block-service/ari.js +27 -0
  23. package/dist/esm/clients/jira/ari.js +35 -0
  24. package/dist/esm/clients/jira/sourceInfo.js +35 -11
  25. package/dist/esm/common/types.js +6 -0
  26. package/dist/esm/providers/block-service/blockServiceAPI.js +13 -5
  27. package/dist/esm/providers/syncBlockProvider.js +9 -2
  28. package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +17 -5
  29. package/dist/esm/store-manager/syncBlockStoreManager.js +5 -2
  30. package/dist/esm/utils/fieldAwareLocations.js +24 -0
  31. package/dist/esm/utils/resolveSyncBlockInstance.js +8 -2
  32. package/dist/types/clients/block-service/ari.d.ts +13 -1
  33. package/dist/types/clients/jira/ari.d.ts +15 -0
  34. package/dist/types/common/types.d.ts +12 -0
  35. package/dist/types/entry-points/common-types.d.ts +1 -1
  36. package/dist/types/providers/types.d.ts +6 -1
  37. package/dist/types/utils/fieldAwareLocations.d.ts +16 -0
  38. package/package.json +3 -3
@@ -6,6 +6,12 @@ export type BlockInstanceId = string;
6
6
  export type ResourceId = string;
7
7
  export type SyncBlockProduct = (typeof SYNC_BLOCK_PRODUCTS)[number];
8
8
  export type SyncBlockStatus = 'active' | 'deleted' | 'unpublished';
9
+ /**
10
+ * Where a synced block location sits relative to the document hosting the editor.
11
+ * `same-document` is the host document itself, the same page or the same work item field.
12
+ * `same-parent-document` is another field of the host work item.
13
+ */
14
+ export type SyncBlockLocationScope = 'same-document' | 'same-parent-document' | 'elsewhere';
9
15
  export type SyncBlockAttrs = {
10
16
  localId: BlockInstanceId;
11
17
  resourceId: ResourceId;
@@ -36,8 +42,13 @@ export interface SyncBlockData {
36
42
  createdAt?: string;
37
43
  createdBy?: string;
38
44
  deletionReason?: DeletionReason;
45
+ /**
46
+ * Name of the Jira work item field holding the source block, as AGG localises it.
47
+ */
48
+ fieldName?: string;
39
49
  issueType?: SyncBlockJiraIssueType;
40
50
  isSynced?: boolean;
51
+ locationScope?: SyncBlockLocationScope;
41
52
  /**
42
53
  * Whether the block is on the same page as the source block
43
54
  */
@@ -64,6 +75,7 @@ export interface ReferenceSyncBlockResponse {
64
75
  }
65
76
  export interface ReferenceSyncBlock extends ReferenceSyncBlockResponse {
66
77
  hasAccess: boolean;
78
+ locationScope?: SyncBlockLocationScope;
67
79
  onSameDocument: boolean;
68
80
  }
69
81
  export type ReferenceSyncBlockData = {
@@ -1,2 +1,2 @@
1
1
  export { SyncBlockError } from '../common/types';
2
- export type { ResourceId, SyncBlockData, SyncBlockNode, SyncBlockProduct, SyncBlockStatus, BlockInstanceId, SyncBlockAttrs, ReferenceSyncBlockData, ReferencesSourceInfo, DeletionReason, DeletionMechanism, SyncBlockPrefetchData, } from '../common/types';
2
+ export type { ResourceId, SyncBlockData, SyncBlockNode, SyncBlockProduct, SyncBlockLocationScope, SyncBlockStatus, BlockInstanceId, SyncBlockAttrs, ReferenceSyncBlockData, ReferencesSourceInfo, DeletionReason, DeletionMechanism, SyncBlockPrefetchData, } from '../common/types';
@@ -3,7 +3,7 @@ import type { EmojiProvider } from '@atlaskit/emoji';
3
3
  import type { MentionProvider } from '@atlaskit/mention/types';
4
4
  import { NodeDataProvider } from '@atlaskit/node-data-provider';
5
5
  import type { TaskDecisionProvider } from '@atlaskit/task-decision/types';
6
- import type { SyncBlockData, SyncBlockStatus, ResourceId, SyncBlockError, SyncBlockNode, SyncBlockProduct, BlockInstanceId, SyncBlockAttrs, ReferenceSyncBlockData, DeletionReason } from '../common/types';
6
+ import type { SyncBlockData, SyncBlockStatus, ResourceId, SyncBlockError, SyncBlockNode, SyncBlockProduct, BlockInstanceId, SyncBlockAttrs, ReferenceSyncBlockData, DeletionReason, SyncBlockLocationScope } from '../common/types';
7
7
  type SyncBlockErrorInfo = {
8
8
  /**
9
9
  * PII-safe `Error.message` from the upstream catch, so the classifier can bucket
@@ -74,6 +74,10 @@ export type SyncBlockJiraIssueType = {
74
74
  name: string;
75
75
  };
76
76
  export type SyncBlockSourceInfo = {
77
+ /**
78
+ * Name of the Jira work item field holding the block, as AGG localises it.
79
+ */
80
+ fieldName?: string;
77
81
  hasAccess?: boolean;
78
82
  /**
79
83
  * Whether the source info is for a source synced block
@@ -84,6 +88,7 @@ export type SyncBlockSourceInfo = {
84
88
  * `undefined` for Confluence references.
85
89
  */
86
90
  issueType?: SyncBlockJiraIssueType;
91
+ locationScope?: SyncBlockLocationScope;
87
92
  onSameDocument?: boolean;
88
93
  productType?: SyncBlockProduct;
89
94
  sourceAri: string;
@@ -0,0 +1,16 @@
1
+ import type { SyncBlockLocationScope, SyncBlockProduct } from '../common/types';
2
+ /**
3
+ * The product check runs first so a Confluence-only document never reads the experiment.
4
+ */
5
+ export declare const isFieldAwareJiraLocation: (productType: SyncBlockProduct | undefined) => boolean;
6
+ /**
7
+ * Spreadable `{ locationScope }` for a location that should carry one, `undefined` otherwise.
8
+ * Without a host ARI there is nothing to compare against, so the experiment is not read.
9
+ */
10
+ export declare const getFieldAwareLocationScope: ({ documentAri, hostAri, productType, }: {
11
+ documentAri: string;
12
+ hostAri: string | undefined;
13
+ productType: SyncBlockProduct | undefined;
14
+ }) => {
15
+ locationScope: SyncBlockLocationScope;
16
+ } | undefined;
package/package.json CHANGED
@@ -23,7 +23,7 @@
23
23
  "@atlaskit/node-data-provider": "^20.0.0",
24
24
  "@atlaskit/platform-feature-experiments": "^0.3.0",
25
25
  "@atlaskit/platform-feature-flags": "^2.2.0",
26
- "@atlaskit/tmp-editor-statsig": "^202.0.0",
26
+ "@atlaskit/tmp-editor-statsig": "^204.0.0",
27
27
  "@babel/runtime": "^7.0.0",
28
28
  "@compiled/react": "^1.0.2",
29
29
  "bind-event-listener": "^3.0.0",
@@ -33,7 +33,7 @@
33
33
  "uuid": "^11.1.1"
34
34
  },
35
35
  "peerDependencies": {
36
- "@atlaskit/editor-common": "^123.5.0",
36
+ "@atlaskit/editor-common": "^123.8.0",
37
37
  "react": "^18.2.0 || ^19.2.0"
38
38
  },
39
39
  "devDependencies": {
@@ -42,7 +42,7 @@
42
42
  "react-dom": "^19.2.0"
43
43
  },
44
44
  "name": "@atlaskit/editor-synced-block-provider",
45
- "version": "15.0.3",
45
+ "version": "15.1.1",
46
46
  "description": "Synced Block Provider for @atlaskit/editor-plugin-synced-block",
47
47
  "author": "Atlassian Pty Ltd",
48
48
  "license": "Apache-2.0",