@atlaskit/editor-synced-block-provider 12.0.7 → 12.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.
@@ -5,17 +5,17 @@ import { NodeDataProvider } from '@atlaskit/node-data-provider';
5
5
  import type { TaskDecisionProvider } from '@atlaskit/task-decision/types';
6
6
  import type { SyncBlockData, SyncBlockStatus, ResourceId, SyncBlockError, SyncBlockNode, SyncBlockProduct, BlockInstanceId, SyncBlockAttrs, ReferenceSyncBlockData, DeletionReason } from '../common/types';
7
7
  type SyncBlockErrorInfo = {
8
- /**
9
- * PII-safe `Error.name` from the upstream catch, used to de-opaque `errored`
10
- * failures. Only ever `Error.name` — never node content, titles, or any UGC.
11
- */
12
- originalName?: string;
13
8
  /**
14
9
  * PII-safe `Error.message` from the upstream catch, so the classifier can bucket
15
10
  * the real cause. Distinct from `reason` (may be synthetic/enum): carries the raw
16
11
  * framework/HTTP text. Only ever `Error.message` — never node content or UGC.
17
12
  */
18
13
  originalMessage?: string;
14
+ /**
15
+ * PII-safe `Error.name` from the upstream catch, used to de-opaque `errored`
16
+ * failures. Only ever `Error.name` — never node content, titles, or any UGC.
17
+ */
18
+ originalName?: string;
19
19
  reason?: string;
20
20
  sourceAri?: string;
21
21
  /**
@@ -28,6 +28,10 @@ type SyncBlockErrorInfo = {
28
28
  statusCode?: number;
29
29
  type: SyncBlockError;
30
30
  };
31
+ type LocalSameDocumentSourceProvenance = Readonly<{
32
+ sourceBlockInstanceId: BlockInstanceId;
33
+ sourceProduct: SyncBlockProduct;
34
+ }>;
31
35
  /**
32
36
  * The instance of a sync block, containing its data and metadata.
33
37
  * Mainly used for representing the state of a sync block after fetching from a data provider.
@@ -36,6 +40,11 @@ type SyncBlockErrorInfo = {
36
40
  export type SyncBlockInstance = {
37
41
  data?: SyncBlockData;
38
42
  error?: SyncBlockErrorInfo;
43
+ /**
44
+ * In-memory-only proof that this instance was projected from a source in the
45
+ * current document. Publication status lives on `data.status`.
46
+ */
47
+ localSameDocumentSource?: LocalSameDocumentSourceProvenance;
39
48
  /**
40
49
  * The resourceId in the attrs of the block
41
50
  */
@@ -5,9 +5,11 @@ import type { ViewMode } from '@atlaskit/editor-plugin-editor-viewmode';
5
5
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
6
6
  import type { BlockInstanceId, ResourceId, SyncBlockNode, SyncBlockPrefetchData } from '../common/types';
7
7
  import type { SyncBlockInstance, SubscriptionCallback, SyncBlockDataProviderInterface, TitleSubscriptionCallback, SyncBlockSourceInfo, SyncedBlockRendererProviderOptions } from '../providers/types';
8
+ import type { SourceSyncBlockStoreManager } from './sourceSyncBlockStoreManager';
8
9
  export declare class ReferenceSyncBlockStoreManager {
9
10
  private viewMode?;
10
11
  private dataProvider?;
12
+ private sourceManager?;
11
13
  private isCacheDirty;
12
14
  private fireAnalyticsEvent?;
13
15
  private syncBlockFetchDataRequests;
@@ -29,7 +31,7 @@ export declare class ReferenceSyncBlockStoreManager {
29
31
  private _subscriptionManager;
30
32
  private _providerFactoryManager;
31
33
  private _batchFetcher;
32
- constructor(dataProvider?: SyncBlockDataProviderInterface, viewMode?: ViewMode);
34
+ constructor(dataProvider?: SyncBlockDataProviderInterface, viewMode?: ViewMode, sourceManager?: SourceSyncBlockStoreManager);
33
35
  isReferenceBlock(node: PMNode): boolean;
34
36
  /**
35
37
  * Whether the async data provider is wired and the manager is not torn down.
@@ -78,6 +80,8 @@ export declare class ReferenceSyncBlockStoreManager {
78
80
  generateResourceIdForReference(sourceId: ResourceId): ResourceId;
79
81
  updateFireAnalyticsEvent(fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void): void;
80
82
  getInitialSyncBlockData(resourceId: ResourceId): SyncBlockInstance | undefined;
83
+ private getSameDocumentReferenceParts;
84
+ private getLocalReference;
81
85
  private normalizeReferenceData;
82
86
  private updateSessionCache;
83
87
  private getFromSessionCache;
@@ -1,19 +1,26 @@
1
+ import type { ADFEntity } from '@atlaskit/adf-utils/types';
1
2
  import type { SyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
2
3
  import type { ViewMode } from '@atlaskit/editor-plugin-editor-viewmode';
3
4
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
- import type { ResourceId, SyncBlockAttrs, BlockInstanceId, DeletionReason, DeletionMechanism, ReferenceSyncBlockData, SyncBlockStatus } from '../common/types';
5
+ import type { ResourceId, SyncBlockAttrs, SyncBlockData as Data, BlockInstanceId, DeletionReason, DeletionMechanism, ReferenceSyncBlockData, SyncBlockStatus } from '../common/types';
5
6
  import type { SyncBlockDataProviderInterface, SyncBlockSourceInfo } from '../providers/types';
6
7
  import type { CreateSuccessEnrichment } from '../utils/errorHandling';
7
8
  export type ConfirmationCallback = (syncBlockIds: SyncBlockAttrs[], deleteReason: DeletionReason | undefined) => Promise<boolean>;
8
9
  type OnDelete = () => void;
9
10
  type OnCompletion = (success: boolean) => void;
10
11
  type DestroyCallback = () => void;
12
+ export type LocalSourceSnapshot = Readonly<Omit<Data, 'content' | 'status'> & {
13
+ content: ReadonlyArray<ADFEntity>;
14
+ status?: SyncBlockStatus;
15
+ }>;
16
+ export type LocalSourceSubscriber = (snapshot: LocalSourceSnapshot | undefined) => void;
11
17
  export declare class SourceSyncBlockStoreManager {
12
18
  private viewMode?;
13
19
  private isLivePage?;
14
20
  private dataProvider?;
15
21
  private fireAnalyticsEvent?;
16
22
  private syncBlockCache;
23
+ private localSourceSubscribers;
17
24
  private hasReceivedContentChange;
18
25
  private confirmationCallback?;
19
26
  private deletionRetryInfo?;
@@ -106,6 +113,9 @@ export declare class SourceSyncBlockStoreManager {
106
113
  hasPendingCreations(): boolean;
107
114
  /** Returns the source block's last known backend publication status. */
108
115
  getStatus(resourceId: ResourceId): SyncBlockStatus | undefined;
116
+ getLocalSourceSnapshot(resourceId: ResourceId): LocalSourceSnapshot | undefined;
117
+ subscribeToLocalSource(resourceId: ResourceId, callback: LocalSourceSubscriber): () => void;
118
+ private notifyLocalSource;
109
119
  /**
110
120
  * Fires callback to insert node (if creation is successful) and clears pending creation data
111
121
  * @param success
package/package.json CHANGED
@@ -16,13 +16,14 @@
16
16
  ],
17
17
  "atlaskit:src": "src/index.ts",
18
18
  "dependencies": {
19
- "@atlaskit/adf-utils": "^20.7.0",
19
+ "@atlaskit/adf-utils": "^20.8.0",
20
20
  "@atlaskit/browser-apis": "^1.2.0",
21
- "@atlaskit/editor-json-transformer": "^9.7.0",
21
+ "@atlaskit/editor-json-transformer": "^9.8.0",
22
22
  "@atlaskit/editor-prosemirror": "^8.0.0",
23
23
  "@atlaskit/node-data-provider": "^17.0.0",
24
- "@atlaskit/platform-feature-flags": "^2.1.0",
25
- "@atlaskit/tmp-editor-statsig": "^167.0.0",
24
+ "@atlaskit/platform-feature-experiments": "^0.3.0",
25
+ "@atlaskit/platform-feature-flags": "^2.2.0",
26
+ "@atlaskit/tmp-editor-statsig": "^169.0.0",
26
27
  "@babel/runtime": "^7.0.0",
27
28
  "@compiled/react": "^1.0.2",
28
29
  "bind-event-listener": "^3.0.0",
@@ -32,7 +33,7 @@
32
33
  "uuid": "^3.1.0"
33
34
  },
34
35
  "peerDependencies": {
35
- "@atlaskit/editor-common": "^120.7.0",
36
+ "@atlaskit/editor-common": "^120.10.0",
36
37
  "react": "^18.2.0 || ^19.2.0"
37
38
  },
38
39
  "devDependencies": {
@@ -76,7 +77,7 @@
76
77
  }
77
78
  },
78
79
  "name": "@atlaskit/editor-synced-block-provider",
79
- "version": "12.0.7",
80
+ "version": "12.1.1",
80
81
  "description": "Synced Block Provider for @atlaskit/editor-plugin-synced-block",
81
82
  "author": "Atlassian Pty Ltd",
82
83
  "license": "Apache-2.0",