@atlaskit/editor-synced-block-provider 3.14.1 → 3.14.3
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.
- package/CHANGELOG.md +22 -0
- package/dist/cjs/clients/block-service/blockService.js +21 -16
- package/dist/cjs/hooks/useFetchSyncBlockData.js +3 -1
- package/dist/cjs/providers/block-service/blockServiceAPI.js +75 -36
- package/dist/cjs/providers/syncBlockProvider.js +10 -6
- package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +65 -26
- package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +68 -28
- package/dist/cjs/store-manager/syncBlockStoreManager.js +54 -23
- package/dist/cjs/utils/experienceTracking.js +18 -1
- package/dist/cjs/utils/resolveSyncBlockInstance.js +2 -1
- package/dist/es2019/clients/block-service/blockService.js +10 -3
- package/dist/es2019/hooks/useFetchSyncBlockData.js +3 -1
- package/dist/es2019/providers/block-service/blockServiceAPI.js +62 -23
- package/dist/es2019/providers/syncBlockProvider.js +8 -4
- package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +71 -36
- package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +55 -17
- package/dist/es2019/store-manager/syncBlockStoreManager.js +37 -3
- package/dist/es2019/utils/experienceTracking.js +17 -0
- package/dist/es2019/utils/resolveSyncBlockInstance.js +2 -1
- package/dist/esm/clients/block-service/blockService.js +21 -16
- package/dist/esm/hooks/useFetchSyncBlockData.js +3 -1
- package/dist/esm/providers/block-service/blockServiceAPI.js +75 -36
- package/dist/esm/providers/syncBlockProvider.js +10 -6
- package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +65 -26
- package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +70 -30
- package/dist/esm/store-manager/syncBlockStoreManager.js +54 -23
- package/dist/esm/utils/experienceTracking.js +17 -0
- package/dist/esm/utils/resolveSyncBlockInstance.js +2 -1
- package/dist/types/clients/block-service/blockService.d.ts +7 -4
- package/dist/types/common/types.d.ts +4 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/providers/block-service/blockServiceAPI.d.ts +6 -3
- package/dist/types/providers/syncBlockProvider.d.ts +2 -2
- package/dist/types/providers/types.d.ts +8 -4
- package/dist/types/store-manager/referenceSyncBlockStoreManager.d.ts +9 -0
- package/dist/types/store-manager/sourceSyncBlockStoreManager.d.ts +5 -3
- package/dist/types/store-manager/syncBlockStoreManager.d.ts +2 -0
- package/dist/types/utils/experienceTracking.d.ts +8 -0
- package/dist/types-ts4.5/clients/block-service/blockService.d.ts +7 -4
- package/dist/types-ts4.5/common/types.d.ts +4 -0
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/providers/block-service/blockServiceAPI.d.ts +6 -3
- package/dist/types-ts4.5/providers/syncBlockProvider.d.ts +2 -2
- package/dist/types-ts4.5/providers/types.d.ts +8 -4
- package/dist/types-ts4.5/store-manager/referenceSyncBlockStoreManager.d.ts +9 -0
- package/dist/types-ts4.5/store-manager/sourceSyncBlockStoreManager.d.ts +5 -3
- package/dist/types-ts4.5/store-manager/syncBlockStoreManager.d.ts +2 -0
- package/dist/types-ts4.5/utils/experienceTracking.d.ts +8 -0
- package/package.json +2 -2
|
@@ -4,7 +4,7 @@ import type { EmojiProvider } from '@atlaskit/emoji';
|
|
|
4
4
|
import type { MentionProvider } from '@atlaskit/mention/types';
|
|
5
5
|
import { NodeDataProvider } from '@atlaskit/node-data-provider';
|
|
6
6
|
import type { TaskDecisionProvider } from '@atlaskit/task-decision/types';
|
|
7
|
-
import type { SyncBlockData, ResourceId, SyncBlockError, SyncBlockNode, SyncBlockProduct, BlockInstanceId, SyncBlockAttrs, ReferenceSyncBlockData } from '../common/types';
|
|
7
|
+
import type { SyncBlockData, ResourceId, SyncBlockError, SyncBlockNode, SyncBlockProduct, BlockInstanceId, SyncBlockAttrs, ReferenceSyncBlockData, DeletionReason } from '../common/types';
|
|
8
8
|
/**
|
|
9
9
|
* The instance of a sync block, containing its data and metadata.
|
|
10
10
|
* Mainly used for representing the state of a sync block after fetching from a data provider.
|
|
@@ -12,7 +12,10 @@ import type { SyncBlockData, ResourceId, SyncBlockError, SyncBlockNode, SyncBloc
|
|
|
12
12
|
*/
|
|
13
13
|
export type SyncBlockInstance = {
|
|
14
14
|
data?: SyncBlockData;
|
|
15
|
-
error?:
|
|
15
|
+
error?: {
|
|
16
|
+
reason?: string;
|
|
17
|
+
type: SyncBlockError;
|
|
18
|
+
};
|
|
16
19
|
/**
|
|
17
20
|
* The resourceId in the attrs of the block
|
|
18
21
|
*/
|
|
@@ -73,10 +76,11 @@ export interface ADFWriteProvider {
|
|
|
73
76
|
/**
|
|
74
77
|
* Delete source block.
|
|
75
78
|
* @param resourceId the resourceId of the block to be deleted
|
|
79
|
+
* @param deleteReason the reason for the deletion, e.g. 'source-block-unsynced', 'source-block-deleted'
|
|
76
80
|
* @returns Object representing the result of the deletion. {resourceId: string, success: boolean, error?: string}.
|
|
77
81
|
* User should not be blocked by not_found error when deleting, so successful result should be returned for 404 error
|
|
78
82
|
*/
|
|
79
|
-
deleteData: (resourceId: ResourceId) => Promise<DeleteSyncBlockResult>;
|
|
83
|
+
deleteData: (resourceId: ResourceId, deleteReason: string | undefined) => Promise<DeleteSyncBlockResult>;
|
|
80
84
|
generateResourceIdForReference: (sourceId: ResourceId) => ResourceId;
|
|
81
85
|
parentAri?: string;
|
|
82
86
|
product: SyncBlockProduct;
|
|
@@ -105,7 +109,7 @@ export type SyncedBlockRendererProviderOptions = {
|
|
|
105
109
|
export declare abstract class SyncBlockDataProvider extends NodeDataProvider<SyncBlockNode, SyncBlockInstance> {
|
|
106
110
|
abstract writeNodesData(nodes: SyncBlockNode[], data: SyncBlockData[]): Promise<Array<WriteSyncBlockResult>>;
|
|
107
111
|
abstract createNodeData(data: SyncBlockData): Promise<WriteSyncBlockResult>;
|
|
108
|
-
abstract deleteNodesData(resourceIds: string[]): Promise<Array<DeleteSyncBlockResult>>;
|
|
112
|
+
abstract deleteNodesData(resourceIds: string[], deleteReason: DeletionReason | undefined): Promise<Array<DeleteSyncBlockResult>>;
|
|
109
113
|
abstract fetchSyncBlockSourceInfo(localId: BlockInstanceId, sourceAri?: string, sourceProduct?: SyncBlockProduct, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void, hasAccess?: boolean, urlType?: 'view' | 'edit'): Promise<SyncBlockSourceInfo | undefined>;
|
|
110
114
|
abstract setProviderOptions(providerOptions: SyncedBlockRendererProviderOptions): void;
|
|
111
115
|
abstract getSyncedBlockRendererProviderOptions(): SyncedBlockRendererProviderOptions;
|
|
@@ -20,6 +20,8 @@ export declare class ReferenceSyncBlockStoreManager {
|
|
|
20
20
|
private graphqlSubscriptions;
|
|
21
21
|
private useRealTimeSubscriptions;
|
|
22
22
|
private subscriptionChangeListeners;
|
|
23
|
+
private newlyAddedSyncBlocks;
|
|
24
|
+
private onUnpublishedSyncBlockDetected?;
|
|
23
25
|
fetchExperience: Experience | undefined;
|
|
24
26
|
private fetchSourceInfoExperience;
|
|
25
27
|
private saveExperience;
|
|
@@ -57,6 +59,13 @@ export declare class ReferenceSyncBlockStoreManager {
|
|
|
57
59
|
*/
|
|
58
60
|
handleSubscriptionUpdate(syncBlockInstance: SyncBlockInstance): void;
|
|
59
61
|
setFireAnalyticsEvent(fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void): void;
|
|
62
|
+
setOnUnpublishedSyncBlockDetected(callback?: (resourceId: ResourceId) => void): void;
|
|
63
|
+
/**
|
|
64
|
+
* Mark a sync block as newly added to the document.
|
|
65
|
+
* This should be called when a sync block node is added via a transaction.
|
|
66
|
+
* @param resourceId - The resource ID of the newly added sync block
|
|
67
|
+
*/
|
|
68
|
+
markAsNewlyAdded(resourceId: ResourceId): void;
|
|
60
69
|
generateResourceIdForReference(sourceId: ResourceId): ResourceId;
|
|
61
70
|
updateFireAnalyticsEvent(fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void): void;
|
|
62
71
|
getInitialSyncBlockData(resourceId: ResourceId): SyncBlockInstance | undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type SyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import { type ResourceId, type SyncBlockAttrs, type BlockInstanceId } from '../common/types';
|
|
3
|
+
import { type ResourceId, type SyncBlockAttrs, type BlockInstanceId, type DeletionReason, type ReferenceSyncBlockData } from '../common/types';
|
|
4
4
|
import type { SyncBlockDataProvider, SyncBlockSourceInfo } from '../providers/types';
|
|
5
|
-
export type ConfirmationCallback = (
|
|
5
|
+
export type ConfirmationCallback = (syncBlockIds: SyncBlockAttrs[], deleteReason: DeletionReason | undefined) => Promise<boolean>;
|
|
6
6
|
type OnDelete = () => void;
|
|
7
7
|
type OnDeleteCompleted = (success: boolean) => void;
|
|
8
8
|
type DestroyCallback = () => void;
|
|
@@ -18,6 +18,7 @@ export declare class SourceSyncBlockStoreManager {
|
|
|
18
18
|
private createExperience;
|
|
19
19
|
private saveExperience;
|
|
20
20
|
private deleteExperience;
|
|
21
|
+
private fetchSourceInfoExperience;
|
|
21
22
|
constructor(dataProvider?: SyncBlockDataProvider);
|
|
22
23
|
setFireAnalyticsEvent(fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void): void;
|
|
23
24
|
isSourceBlock(node: PMNode): boolean;
|
|
@@ -70,8 +71,9 @@ export declare class SourceSyncBlockStoreManager {
|
|
|
70
71
|
* @param onDeleteCompleted - The callback for after the deletion is saved to BE (whether successful or not)
|
|
71
72
|
* @param destroyCallback - The callback to clear any reference stored for deletion (regardless if deletion is completed or abort)
|
|
72
73
|
*/
|
|
73
|
-
deleteSyncBlocksWithConfirmation(syncBlockIds: SyncBlockAttrs[], onDelete: OnDelete, onDeleteCompleted: OnDeleteCompleted, destroyCallback: DestroyCallback): Promise<void>;
|
|
74
|
+
deleteSyncBlocksWithConfirmation(syncBlockIds: SyncBlockAttrs[], deletionReason: DeletionReason | undefined, onDelete: OnDelete, onDeleteCompleted: OnDeleteCompleted, destroyCallback: DestroyCallback): Promise<void>;
|
|
74
75
|
getSyncBlockSourceInfo(localId: BlockInstanceId): Promise<SyncBlockSourceInfo | undefined>;
|
|
76
|
+
fetchReferences(resourceId: string): Promise<ReferenceSyncBlockData>;
|
|
75
77
|
destroy(): void;
|
|
76
78
|
}
|
|
77
79
|
export {};
|
|
@@ -8,6 +8,8 @@ export declare class SyncBlockStoreManager {
|
|
|
8
8
|
private sourceSyncBlockStoreManager;
|
|
9
9
|
private dataProvider?;
|
|
10
10
|
private fireAnalyticsEvent?;
|
|
11
|
+
private fetchReferencesExperience;
|
|
12
|
+
private fetchSourceInfoExperience;
|
|
11
13
|
constructor(dataProvider?: SyncBlockDataProvider);
|
|
12
14
|
fetchReferencesSourceInfo(resourceId: ResourceId, blockInstanceId: BlockInstanceId, isSourceSyncBlock: boolean): Promise<ReferencesSourceInfo>;
|
|
13
15
|
setFireAnalyticsEvent(fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void): void;
|
|
@@ -49,3 +49,11 @@ export declare const getDeleteSourceExperience: (fireAnalyticsEvent?: (payload:
|
|
|
49
49
|
* Failure: When the timeout duration passes without the data being successfully fetched, or the fetch fails
|
|
50
50
|
*/
|
|
51
51
|
export declare const getCreateSourceExperience: (fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void) => Experience;
|
|
52
|
+
/**
|
|
53
|
+
* This experience tracks when a source sync block is created and registered to the BE.
|
|
54
|
+
*
|
|
55
|
+
* Start: When the fetchSourceInfo function is called.
|
|
56
|
+
* Success: When the fetching the data is successful within the timeout duration of start.
|
|
57
|
+
* Failure: When the timeout duration passes without the data being successfully fetched, or the fetch fails
|
|
58
|
+
*/
|
|
59
|
+
export declare const getFetchReferencesExperience: (fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void) => Experience;
|
package/package.json
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"uuid": "^3.1.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@atlaskit/editor-common": "^111.
|
|
38
|
+
"@atlaskit/editor-common": "^111.9.0",
|
|
39
39
|
"react": "^18.2.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
80
|
"name": "@atlaskit/editor-synced-block-provider",
|
|
81
|
-
"version": "3.14.
|
|
81
|
+
"version": "3.14.3",
|
|
82
82
|
"description": "Synced Block Provider for @atlaskit/editor-plugin-synced-block",
|
|
83
83
|
"author": "Atlassian Pty Ltd",
|
|
84
84
|
"license": "Apache-2.0",
|