@atlaskit/editor-synced-block-provider 2.10.5 → 2.11.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.
- package/CHANGELOG.md +21 -0
- package/dist/cjs/clients/block-service/blockService.js +5 -4
- package/dist/cjs/clients/confluence/sourceInfo.js +20 -17
- package/dist/cjs/hooks/useFetchSyncBlockData.js +20 -11
- package/dist/cjs/hooks/useHandleContentChanges.js +1 -5
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/providers/block-service/blockServiceAPI.js +17 -26
- package/dist/cjs/providers/confluence/confluenceContentAPI.js +0 -15
- package/dist/cjs/providers/syncBlockProvider.js +31 -41
- package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +138 -63
- package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +93 -43
- package/dist/cjs/store-manager/syncBlockStoreManager.js +3 -3
- package/dist/cjs/utils/errorHandling.js +31 -1
- package/dist/es2019/clients/block-service/blockService.js +5 -4
- package/dist/es2019/clients/confluence/sourceInfo.js +13 -8
- package/dist/es2019/hooks/useFetchSyncBlockData.js +15 -7
- package/dist/es2019/hooks/useHandleContentChanges.js +1 -5
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/providers/block-service/blockServiceAPI.js +13 -20
- package/dist/es2019/providers/confluence/confluenceContentAPI.js +1 -14
- package/dist/es2019/providers/syncBlockProvider.js +31 -45
- package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +124 -49
- package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +65 -24
- package/dist/es2019/store-manager/syncBlockStoreManager.js +3 -3
- package/dist/es2019/utils/errorHandling.js +17 -1
- package/dist/esm/clients/block-service/blockService.js +5 -4
- package/dist/esm/clients/confluence/sourceInfo.js +19 -16
- package/dist/esm/hooks/useFetchSyncBlockData.js +20 -11
- package/dist/esm/hooks/useHandleContentChanges.js +1 -5
- package/dist/esm/index.js +1 -1
- package/dist/esm/providers/block-service/blockServiceAPI.js +17 -26
- package/dist/esm/providers/confluence/confluenceContentAPI.js +1 -16
- package/dist/esm/providers/syncBlockProvider.js +32 -42
- package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +138 -63
- package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +93 -43
- package/dist/esm/store-manager/syncBlockStoreManager.js +3 -3
- package/dist/esm/utils/errorHandling.js +30 -0
- package/dist/types/clients/block-service/blockService.d.ts +0 -2
- package/dist/types/clients/confluence/sourceInfo.d.ts +2 -1
- package/dist/types/hooks/useFetchSyncBlockData.d.ts +2 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/providers/block-service/blockServiceAPI.d.ts +7 -5
- package/dist/types/providers/confluence/confluenceContentAPI.d.ts +2 -3
- package/dist/types/providers/syncBlockProvider.d.ts +12 -9
- package/dist/types/providers/types.d.ts +9 -9
- package/dist/types/store-manager/referenceSyncBlockStoreManager.d.ts +6 -2
- package/dist/types/store-manager/sourceSyncBlockStoreManager.d.ts +3 -1
- package/dist/types/store-manager/syncBlockStoreManager.d.ts +2 -1
- package/dist/types/utils/errorHandling.d.ts +10 -0
- package/dist/types-ts4.5/clients/block-service/blockService.d.ts +0 -2
- package/dist/types-ts4.5/clients/confluence/sourceInfo.d.ts +2 -1
- package/dist/types-ts4.5/hooks/useFetchSyncBlockData.d.ts +2 -1
- package/dist/types-ts4.5/index.d.ts +2 -2
- package/dist/types-ts4.5/providers/block-service/blockServiceAPI.d.ts +7 -5
- package/dist/types-ts4.5/providers/confluence/confluenceContentAPI.d.ts +2 -3
- package/dist/types-ts4.5/providers/syncBlockProvider.d.ts +12 -9
- package/dist/types-ts4.5/providers/types.d.ts +9 -9
- package/dist/types-ts4.5/store-manager/referenceSyncBlockStoreManager.d.ts +6 -2
- package/dist/types-ts4.5/store-manager/sourceSyncBlockStoreManager.d.ts +3 -1
- package/dist/types-ts4.5/store-manager/syncBlockStoreManager.d.ts +2 -1
- package/dist/types-ts4.5/utils/errorHandling.d.ts +10 -0
- package/package.json +2 -8
|
@@ -1,7 +1,37 @@
|
|
|
1
|
+
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from "@atlaskit/editor-common/analytics";
|
|
1
2
|
export var stringifyError = function stringifyError(error) {
|
|
2
3
|
try {
|
|
3
4
|
return JSON.stringify(error);
|
|
4
5
|
} catch (_unused) {
|
|
5
6
|
return undefined;
|
|
6
7
|
}
|
|
8
|
+
};
|
|
9
|
+
export var getErrorPayload = function getErrorPayload(actionSubjectId, error) {
|
|
10
|
+
return {
|
|
11
|
+
action: ACTION.ERROR,
|
|
12
|
+
actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
|
|
13
|
+
actionSubjectId: actionSubjectId,
|
|
14
|
+
eventType: EVENT_TYPE.OPERATIONAL,
|
|
15
|
+
attributes: {
|
|
16
|
+
error: error
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export var fetchErrorPayload = function fetchErrorPayload(error) {
|
|
21
|
+
return getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_FETCH, error);
|
|
22
|
+
};
|
|
23
|
+
export var getSourceInfoErrorPayload = function getSourceInfoErrorPayload(error) {
|
|
24
|
+
return getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_GET_SOURCE_INFO, error);
|
|
25
|
+
};
|
|
26
|
+
export var updateErrorPayload = function updateErrorPayload(error) {
|
|
27
|
+
return getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_UPDATE, error);
|
|
28
|
+
};
|
|
29
|
+
export var createErrorPayload = function createErrorPayload(error) {
|
|
30
|
+
return getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE, error);
|
|
31
|
+
};
|
|
32
|
+
export var deleteErrorPayload = function deleteErrorPayload(error) {
|
|
33
|
+
return getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_DELETE, error);
|
|
34
|
+
};
|
|
35
|
+
export var updateCacheErrorPayload = function updateCacheErrorPayload(error) {
|
|
36
|
+
return getErrorPayload(ACTION_SUBJECT_ID.SYNCED_BLOCK_UPDATE_CACHE, error);
|
|
7
37
|
};
|
|
@@ -3,10 +3,8 @@ export type BlockContentResponse = {
|
|
|
3
3
|
blockAri: string;
|
|
4
4
|
blockInstanceId: string;
|
|
5
5
|
content: string;
|
|
6
|
-
contentUpdatedAt: number;
|
|
7
6
|
createdAt: number;
|
|
8
7
|
createdBy: string;
|
|
9
|
-
isSynced: boolean;
|
|
10
8
|
product: SyncBlockProduct;
|
|
11
9
|
sourceAri: string;
|
|
12
10
|
status: 'active' | 'deleted';
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import { type RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import type { SyncBlockSourceInfo } from '../../providers/types';
|
|
2
|
-
export declare const
|
|
3
|
+
export declare const fetchConfluencePageInfo: (pageAri: string, localId?: string, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void) => Promise<SyncBlockSourceInfo | undefined>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
2
3
|
import type { SyncBlockInstance } from '../providers/types';
|
|
3
4
|
import type { SyncBlockStoreManager } from '../store-manager/syncBlockStoreManager';
|
|
@@ -7,4 +8,4 @@ export interface UseFetchSyncBlockDataResult {
|
|
|
7
8
|
reloadData: () => Promise<void>;
|
|
8
9
|
syncBlockInstance: SyncBlockInstance | null;
|
|
9
10
|
}
|
|
10
|
-
export declare const useFetchSyncBlockData: (manager: SyncBlockStoreManager, resourceId?: string, localId?: string) => UseFetchSyncBlockDataResult;
|
|
11
|
+
export declare const useFetchSyncBlockData: (manager: SyncBlockStoreManager, resourceId?: string, localId?: string, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void) => UseFetchSyncBlockDataResult;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { rebaseTransaction } from './common/rebase-transaction';
|
|
2
2
|
export { SyncBlockError } from './common/types';
|
|
3
|
-
export type { SyncBlockData, SyncBlockNode } from './common/types';
|
|
3
|
+
export type { SyncBlockData, SyncBlockNode, SyncBlockProduct, BlockInstanceId, } from './common/types';
|
|
4
4
|
export { useFetchSyncBlockData, type UseFetchSyncBlockDataResult, } from './hooks/useFetchSyncBlockData';
|
|
5
5
|
export { useFetchSyncBlockTitle } from './hooks/useFetchSyncBlockTitle';
|
|
6
6
|
export { useHandleContentChanges } from './hooks/useHandleContentChanges';
|
|
@@ -8,7 +8,7 @@ export { blockResourceIdFromSourceAndLocalId, getLocalIdFromBlockResourceId, } f
|
|
|
8
8
|
export { getConfluencePageAri, getLocalIdFromConfluencePageAri, getPageARIFromContentPropertyResourceId, getPageIdAndTypeFromConfluencePageAri, resourceIdFromConfluencePageSourceIdAndLocalId, } from './clients/confluence/ari';
|
|
9
9
|
export { useMemoizedBlockServiceAPIProviders } from './providers/block-service/blockServiceAPI';
|
|
10
10
|
export { createContentAPIProvidersWithDefaultKey, useMemoizedContentAPIProviders, } from './providers/confluence/confluenceContentAPI';
|
|
11
|
-
export {
|
|
11
|
+
export { fetchConfluencePageInfo } from './clients/confluence/sourceInfo';
|
|
12
12
|
export { SyncBlockProvider as SyncedBlockProvider, useMemoizedSyncedBlockProvider, } from './providers/syncBlockProvider';
|
|
13
13
|
export type { ADFFetchProvider, ADFWriteProvider, SyncBlockDataProvider, SyncBlockInstance, MediaEmojiProviderOptions, SyncedBlockRendererProviderOptions, SyncBlockRendererProviderCreator, } from './providers/types';
|
|
14
14
|
export { ReferenceSyncBlockStoreManager } from './store-manager/referenceSyncBlockStoreManager';
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type { ADFFetchProvider, ADFWriteProvider, DeleteSyncBlockResult,
|
|
1
|
+
import { type SyncBlockData, type SyncBlockProduct } from '../../common/types';
|
|
2
|
+
import type { ADFFetchProvider, ADFWriteProvider, DeleteSyncBlockResult, SyncBlockInstance, WriteSyncBlockResult } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* ADFFetchProvider implementation that fetches synced block data from Block Service API
|
|
5
5
|
*/
|
|
6
6
|
declare class BlockServiceADFFetchProvider implements ADFFetchProvider {
|
|
7
7
|
fetchData(resourceId: string): Promise<SyncBlockInstance>;
|
|
8
|
-
retrieveSourceInfoFetchData(resourceId: ResourceId, pageARI: string): SourceInfoFetchData;
|
|
9
8
|
}
|
|
10
9
|
/**
|
|
11
10
|
* ADFWriteProvider implementation that writes synced block data to Block Service API
|
|
12
11
|
*/
|
|
13
12
|
declare class BlockServiceADFWriteProvider implements ADFWriteProvider {
|
|
13
|
+
private sourceAri;
|
|
14
|
+
private product;
|
|
15
|
+
constructor(sourceAri: string, product: SyncBlockProduct);
|
|
14
16
|
writeData(data: SyncBlockData): Promise<WriteSyncBlockResult>;
|
|
15
17
|
deleteData(resourceId: string): Promise<DeleteSyncBlockResult>;
|
|
16
|
-
generateResourceId(
|
|
18
|
+
generateResourceId(sourceAri: string, localId: string): string;
|
|
17
19
|
}
|
|
18
|
-
export declare const useMemoizedBlockServiceAPIProviders: () => {
|
|
20
|
+
export declare const useMemoizedBlockServiceAPIProviders: (sourceAri: string, product: SyncBlockProduct) => {
|
|
19
21
|
fetchProvider: BlockServiceADFFetchProvider;
|
|
20
22
|
writeProvider: BlockServiceADFWriteProvider;
|
|
21
23
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type { ADFFetchProvider, ADFWriteProvider, DeleteSyncBlockResult,
|
|
1
|
+
import { type SyncBlockData } from '../../common/types';
|
|
2
|
+
import type { ADFFetchProvider, ADFWriteProvider, DeleteSyncBlockResult, SyncBlockInstance, WriteSyncBlockResult } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Configuration for Content API providers
|
|
5
5
|
*/
|
|
@@ -14,7 +14,6 @@ declare class ConfluenceADFFetchProvider implements ADFFetchProvider {
|
|
|
14
14
|
private config;
|
|
15
15
|
constructor(config: ContentAPIConfig);
|
|
16
16
|
fetchData(resourceId: string): Promise<SyncBlockInstance>;
|
|
17
|
-
retrieveSourceInfoFetchData(resourceId: ResourceId): SourceInfoFetchData;
|
|
18
17
|
}
|
|
19
18
|
/**
|
|
20
19
|
* ADFWriteProvider implementation that writes synced block data to Confluence Content API
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import type { JSONNode } from '@atlaskit/editor-json-transformer/types';
|
|
2
|
-
import { type SyncBlockData, type SyncBlockNode } from '../common/types';
|
|
3
|
+
import { type BlockInstanceId, type ResourceId, type SyncBlockData, type SyncBlockNode, type SyncBlockProduct } from '../common/types';
|
|
3
4
|
import { SyncBlockDataProvider, type ADFFetchProvider, type ADFWriteProvider, type DeleteSyncBlockResult, type SyncBlockInstance, type SyncBlockParentInfo, type SyncBlockSourceInfo, type SyncedBlockRendererProviderOptions, type WriteSyncBlockResult } from '../providers/types';
|
|
4
5
|
export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
5
6
|
name: string;
|
|
@@ -57,7 +58,7 @@ export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
|
57
58
|
*
|
|
58
59
|
* @returns Array of {resourceId?: string, error?: string}.
|
|
59
60
|
*/
|
|
60
|
-
deleteNodesData(resourceIds:
|
|
61
|
+
deleteNodesData(resourceIds: ResourceId[]): Promise<Array<DeleteSyncBlockResult>>;
|
|
61
62
|
/**
|
|
62
63
|
* Get the source id
|
|
63
64
|
*
|
|
@@ -65,14 +66,16 @@ export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
|
65
66
|
*/
|
|
66
67
|
getSourceId(): string;
|
|
67
68
|
/**
|
|
68
|
-
*
|
|
69
|
+
* Fetch the source info from the source id
|
|
69
70
|
*
|
|
70
|
-
* @param
|
|
71
|
+
* @param params
|
|
72
|
+
* @param params.sourceAri - The source ARI
|
|
73
|
+
* @param params.sourceProduct - The source product. e.g. 'confluence-page', 'jira-work-item'
|
|
71
74
|
*
|
|
72
75
|
* @returns The source info
|
|
73
76
|
*/
|
|
74
|
-
|
|
75
|
-
generateResourceId(sourceId: string, localId:
|
|
77
|
+
fetchSyncBlockSourceInfo(localId: BlockInstanceId, sourceAri: string, sourceProduct: SyncBlockProduct, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void): Promise<SyncBlockSourceInfo | undefined>;
|
|
78
|
+
generateResourceId(sourceId: string, localId: BlockInstanceId): string;
|
|
76
79
|
/**
|
|
77
80
|
* Get the synced block renderer provider options
|
|
78
81
|
*
|
|
@@ -82,11 +85,11 @@ export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
|
82
85
|
/**
|
|
83
86
|
* Retrieve the parent info for the sync block
|
|
84
87
|
*
|
|
85
|
-
* @param
|
|
86
|
-
* @param
|
|
88
|
+
* @param sourceAri - The source ARI
|
|
89
|
+
* @param sourceProduct - The source product. e.g. 'confluence-page', 'jira-work-item'
|
|
87
90
|
*
|
|
88
91
|
* @returns The parent info for the sync block
|
|
89
92
|
*/
|
|
90
|
-
retrieveSyncBlockParentInfo(
|
|
93
|
+
retrieveSyncBlockParentInfo(sourceAri: string, sourceProduct: SyncBlockProduct): SyncBlockParentInfo | undefined;
|
|
91
94
|
}
|
|
92
95
|
export declare const useMemoizedSyncedBlockProvider: (fetchProvider: ADFFetchProvider, writeProvider: ADFWriteProvider, sourceId: string, providerOptions: SyncedBlockRendererProviderOptions) => SyncBlockProvider;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import type { RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import type { MediaProvider, ProfilecardProvider } from '@atlaskit/editor-common/provider-factory';
|
|
2
3
|
import type { EmojiProvider } from '@atlaskit/emoji';
|
|
3
4
|
import type { MentionProvider } from '@atlaskit/mention/types';
|
|
4
5
|
import { NodeDataProvider } from '@atlaskit/node-data-provider';
|
|
5
6
|
import type { TaskDecisionProvider } from '@atlaskit/task-decision/types';
|
|
6
|
-
import type { SyncBlockData, ResourceId, SyncBlockError, SyncBlockNode, SyncBlockProduct } from '../common/types';
|
|
7
|
+
import type { SyncBlockData, ResourceId, SyncBlockError, SyncBlockNode, SyncBlockProduct, BlockInstanceId } from '../common/types';
|
|
7
8
|
/**
|
|
8
9
|
* The instance of a sync block, containing its data and metadata.
|
|
9
10
|
* Mainly used for representing the state of a sync block after fetching from a data provider.
|
|
@@ -12,11 +13,11 @@ import type { SyncBlockData, ResourceId, SyncBlockError, SyncBlockNode, SyncBloc
|
|
|
12
13
|
export type SyncBlockInstance = {
|
|
13
14
|
data?: SyncBlockData;
|
|
14
15
|
error?: SyncBlockError;
|
|
15
|
-
resourceId:
|
|
16
|
+
resourceId: ResourceId;
|
|
16
17
|
};
|
|
17
18
|
export type DeleteSyncBlockResult = {
|
|
18
19
|
error?: string;
|
|
19
|
-
resourceId:
|
|
20
|
+
resourceId: ResourceId;
|
|
20
21
|
success: boolean;
|
|
21
22
|
};
|
|
22
23
|
export type SyncBlockSourceInfo = {
|
|
@@ -29,7 +30,7 @@ export type SyncBlockParentInfo = {
|
|
|
29
30
|
};
|
|
30
31
|
export type WriteSyncBlockResult = {
|
|
31
32
|
error?: string;
|
|
32
|
-
resourceId?:
|
|
33
|
+
resourceId?: ResourceId;
|
|
33
34
|
};
|
|
34
35
|
export type SourceInfoFetchData = {
|
|
35
36
|
pageARI: string;
|
|
@@ -37,10 +38,9 @@ export type SourceInfoFetchData = {
|
|
|
37
38
|
};
|
|
38
39
|
export interface ADFFetchProvider {
|
|
39
40
|
fetchData: (resourceId: ResourceId) => Promise<SyncBlockInstance>;
|
|
40
|
-
retrieveSourceInfoFetchData: (resourceId: ResourceId, pageAri: string) => SourceInfoFetchData;
|
|
41
41
|
}
|
|
42
42
|
export interface ADFWriteProvider {
|
|
43
|
-
deleteData: (resourceId:
|
|
43
|
+
deleteData: (resourceId: ResourceId) => Promise<DeleteSyncBlockResult>;
|
|
44
44
|
generateResourceId: (sourceId: string, localId: string) => ResourceId;
|
|
45
45
|
writeData: (data: SyncBlockData) => Promise<WriteSyncBlockResult>;
|
|
46
46
|
}
|
|
@@ -65,16 +65,16 @@ export declare abstract class SyncBlockDataProvider extends NodeDataProvider<Syn
|
|
|
65
65
|
abstract writeNodesData(nodes: SyncBlockNode[], data: SyncBlockData[]): Promise<Array<WriteSyncBlockResult>>;
|
|
66
66
|
abstract deleteNodesData(resourceIds: string[]): Promise<Array<DeleteSyncBlockResult>>;
|
|
67
67
|
abstract getSourceId(): ResourceId;
|
|
68
|
-
abstract
|
|
68
|
+
abstract fetchSyncBlockSourceInfo(localId: BlockInstanceId, sourceAri: string, sourceProduct: SyncBlockProduct, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void): Promise<SyncBlockSourceInfo | undefined>;
|
|
69
69
|
abstract getSyncedBlockRendererProviderOptions(): SyncedBlockRendererProviderOptions;
|
|
70
|
-
abstract retrieveSyncBlockParentInfo(
|
|
70
|
+
abstract retrieveSyncBlockParentInfo(sourceAri: string, sourceProduct: SyncBlockProduct): SyncBlockParentInfo | undefined;
|
|
71
71
|
/**
|
|
72
72
|
* Generates a resource ID from a source ID and local ID.
|
|
73
73
|
* @param sourceId - The source document ID (e.g., page ARI)
|
|
74
74
|
* @param localId - The local block ID (usually a UUID)
|
|
75
75
|
* @returns The generated resource ID
|
|
76
76
|
*/
|
|
77
|
-
abstract generateResourceId(sourceId: ResourceId, localId:
|
|
77
|
+
abstract generateResourceId(sourceId: ResourceId, localId: BlockInstanceId): ResourceId;
|
|
78
78
|
}
|
|
79
79
|
export type SubscriptionCallback = (data: SyncBlockInstance) => void;
|
|
80
80
|
export type TitleSubscriptionCallback = (title: string) => void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
2
3
|
import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
4
|
import { type ResourceId, type SyncBlockNode } from '../common/types';
|
|
@@ -8,21 +9,24 @@ export declare class ReferenceSyncBlockStoreManager {
|
|
|
8
9
|
private subscriptions;
|
|
9
10
|
private titleSubscriptions;
|
|
10
11
|
private providerFactories;
|
|
12
|
+
private fireAnalyticsEvent?;
|
|
11
13
|
private syncBlockURLRequests;
|
|
12
14
|
private isRefreshingSubscriptions;
|
|
13
|
-
constructor(dataProvider?: SyncBlockDataProvider);
|
|
15
|
+
constructor(dataProvider?: SyncBlockDataProvider, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void);
|
|
16
|
+
updateFireAnalyticsEvent(fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void): void;
|
|
14
17
|
/**
|
|
15
18
|
* Refreshes the subscriptions for all sync blocks.
|
|
16
19
|
* @returns {Promise<void>}
|
|
17
20
|
*/
|
|
18
21
|
refreshSubscriptions(): Promise<void>;
|
|
19
|
-
private
|
|
22
|
+
private fetchSyncBlockSourceInfo;
|
|
20
23
|
/**
|
|
21
24
|
* Fetch sync block data for a given array of sync block nodes.
|
|
22
25
|
* @param syncBlockNodes - The array of sync block nodes to fetch data for
|
|
23
26
|
* @returns The fetched sync block data results
|
|
24
27
|
*/
|
|
25
28
|
fetchSyncBlocksData(syncBlockNodes: SyncBlockNode[]): Promise<SyncBlockInstance[]>;
|
|
29
|
+
private updateCacheWithSourceInfo;
|
|
26
30
|
private updateCache;
|
|
27
31
|
private updateSourceTitleSubscriptions;
|
|
28
32
|
private getFromCache;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type SyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
3
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
@@ -8,12 +9,13 @@ export type CreationCallback = () => void;
|
|
|
8
9
|
export declare class SourceSyncBlockStoreManager {
|
|
9
10
|
private dataProvider?;
|
|
10
11
|
private editorView?;
|
|
12
|
+
private fireAnalyticsEvent?;
|
|
11
13
|
private syncBlockCache;
|
|
12
14
|
private confirmationCallback?;
|
|
13
15
|
private confirmationTransaction?;
|
|
14
16
|
private pendingResourceId?;
|
|
15
17
|
private creationCallback?;
|
|
16
|
-
constructor(dataProvider?: SyncBlockDataProvider);
|
|
18
|
+
constructor(dataProvider?: SyncBlockDataProvider, fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void);
|
|
17
19
|
isSourceBlock(node: PMNode): boolean;
|
|
18
20
|
/**
|
|
19
21
|
* Add/update a sync block node to/from the local cache
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { SyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import type { SyncBlockDataProvider } from '../providers/types';
|
|
2
3
|
import { ReferenceSyncBlockStoreManager } from './referenceSyncBlockStoreManager';
|
|
3
4
|
import { SourceSyncBlockStoreManager } from './sourceSyncBlockStoreManager';
|
|
4
5
|
export declare class SyncBlockStoreManager {
|
|
5
6
|
private referenceSyncBlockStoreManager;
|
|
6
7
|
private sourceSyncBlockStoreManager;
|
|
7
|
-
constructor(dataProvider?: SyncBlockDataProvider);
|
|
8
|
+
constructor(dataProvider?: SyncBlockDataProvider, fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void);
|
|
8
9
|
get referenceManager(): ReferenceSyncBlockStoreManager;
|
|
9
10
|
get sourceManager(): SourceSyncBlockStoreManager;
|
|
10
11
|
destroy(): void;
|
|
@@ -1 +1,11 @@
|
|
|
1
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, type RendererSyncBlockEventPayload, type OperationalAEP, type SyncBlockEventPayload } from "@atlaskit/editor-common/analytics";
|
|
1
2
|
export declare const stringifyError: (error: unknown) => string | undefined;
|
|
3
|
+
export declare const getErrorPayload: <T extends ACTION_SUBJECT_ID>(actionSubjectId: T, error: string) => OperationalAEP<ACTION.ERROR, ACTION_SUBJECT.SYNCED_BLOCK, T, {
|
|
4
|
+
error: string;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const fetchErrorPayload: (error: string) => RendererSyncBlockEventPayload;
|
|
7
|
+
export declare const getSourceInfoErrorPayload: (error: string) => RendererSyncBlockEventPayload;
|
|
8
|
+
export declare const updateErrorPayload: (error: string) => SyncBlockEventPayload;
|
|
9
|
+
export declare const createErrorPayload: (error: string) => SyncBlockEventPayload;
|
|
10
|
+
export declare const deleteErrorPayload: (error: string) => SyncBlockEventPayload;
|
|
11
|
+
export declare const updateCacheErrorPayload: (error: string) => SyncBlockEventPayload;
|
|
@@ -3,10 +3,8 @@ export type BlockContentResponse = {
|
|
|
3
3
|
blockAri: string;
|
|
4
4
|
blockInstanceId: string;
|
|
5
5
|
content: string;
|
|
6
|
-
contentUpdatedAt: number;
|
|
7
6
|
createdAt: number;
|
|
8
7
|
createdBy: string;
|
|
9
|
-
isSynced: boolean;
|
|
10
8
|
product: SyncBlockProduct;
|
|
11
9
|
sourceAri: string;
|
|
12
10
|
status: 'active' | 'deleted';
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import { type RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import type { SyncBlockSourceInfo } from '../../providers/types';
|
|
2
|
-
export declare const
|
|
3
|
+
export declare const fetchConfluencePageInfo: (pageAri: string, localId?: string, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void) => Promise<SyncBlockSourceInfo | undefined>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
2
3
|
import type { SyncBlockInstance } from '../providers/types';
|
|
3
4
|
import type { SyncBlockStoreManager } from '../store-manager/syncBlockStoreManager';
|
|
@@ -7,4 +8,4 @@ export interface UseFetchSyncBlockDataResult {
|
|
|
7
8
|
reloadData: () => Promise<void>;
|
|
8
9
|
syncBlockInstance: SyncBlockInstance | null;
|
|
9
10
|
}
|
|
10
|
-
export declare const useFetchSyncBlockData: (manager: SyncBlockStoreManager, resourceId?: string, localId?: string) => UseFetchSyncBlockDataResult;
|
|
11
|
+
export declare const useFetchSyncBlockData: (manager: SyncBlockStoreManager, resourceId?: string, localId?: string, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void) => UseFetchSyncBlockDataResult;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { rebaseTransaction } from './common/rebase-transaction';
|
|
2
2
|
export { SyncBlockError } from './common/types';
|
|
3
|
-
export type { SyncBlockData, SyncBlockNode } from './common/types';
|
|
3
|
+
export type { SyncBlockData, SyncBlockNode, SyncBlockProduct, BlockInstanceId, } from './common/types';
|
|
4
4
|
export { useFetchSyncBlockData, type UseFetchSyncBlockDataResult, } from './hooks/useFetchSyncBlockData';
|
|
5
5
|
export { useFetchSyncBlockTitle } from './hooks/useFetchSyncBlockTitle';
|
|
6
6
|
export { useHandleContentChanges } from './hooks/useHandleContentChanges';
|
|
@@ -8,7 +8,7 @@ export { blockResourceIdFromSourceAndLocalId, getLocalIdFromBlockResourceId, } f
|
|
|
8
8
|
export { getConfluencePageAri, getLocalIdFromConfluencePageAri, getPageARIFromContentPropertyResourceId, getPageIdAndTypeFromConfluencePageAri, resourceIdFromConfluencePageSourceIdAndLocalId, } from './clients/confluence/ari';
|
|
9
9
|
export { useMemoizedBlockServiceAPIProviders } from './providers/block-service/blockServiceAPI';
|
|
10
10
|
export { createContentAPIProvidersWithDefaultKey, useMemoizedContentAPIProviders, } from './providers/confluence/confluenceContentAPI';
|
|
11
|
-
export {
|
|
11
|
+
export { fetchConfluencePageInfo } from './clients/confluence/sourceInfo';
|
|
12
12
|
export { SyncBlockProvider as SyncedBlockProvider, useMemoizedSyncedBlockProvider, } from './providers/syncBlockProvider';
|
|
13
13
|
export type { ADFFetchProvider, ADFWriteProvider, SyncBlockDataProvider, SyncBlockInstance, MediaEmojiProviderOptions, SyncedBlockRendererProviderOptions, SyncBlockRendererProviderCreator, } from './providers/types';
|
|
14
14
|
export { ReferenceSyncBlockStoreManager } from './store-manager/referenceSyncBlockStoreManager';
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type { ADFFetchProvider, ADFWriteProvider, DeleteSyncBlockResult,
|
|
1
|
+
import { type SyncBlockData, type SyncBlockProduct } from '../../common/types';
|
|
2
|
+
import type { ADFFetchProvider, ADFWriteProvider, DeleteSyncBlockResult, SyncBlockInstance, WriteSyncBlockResult } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* ADFFetchProvider implementation that fetches synced block data from Block Service API
|
|
5
5
|
*/
|
|
6
6
|
declare class BlockServiceADFFetchProvider implements ADFFetchProvider {
|
|
7
7
|
fetchData(resourceId: string): Promise<SyncBlockInstance>;
|
|
8
|
-
retrieveSourceInfoFetchData(resourceId: ResourceId, pageARI: string): SourceInfoFetchData;
|
|
9
8
|
}
|
|
10
9
|
/**
|
|
11
10
|
* ADFWriteProvider implementation that writes synced block data to Block Service API
|
|
12
11
|
*/
|
|
13
12
|
declare class BlockServiceADFWriteProvider implements ADFWriteProvider {
|
|
13
|
+
private sourceAri;
|
|
14
|
+
private product;
|
|
15
|
+
constructor(sourceAri: string, product: SyncBlockProduct);
|
|
14
16
|
writeData(data: SyncBlockData): Promise<WriteSyncBlockResult>;
|
|
15
17
|
deleteData(resourceId: string): Promise<DeleteSyncBlockResult>;
|
|
16
|
-
generateResourceId(
|
|
18
|
+
generateResourceId(sourceAri: string, localId: string): string;
|
|
17
19
|
}
|
|
18
|
-
export declare const useMemoizedBlockServiceAPIProviders: () => {
|
|
20
|
+
export declare const useMemoizedBlockServiceAPIProviders: (sourceAri: string, product: SyncBlockProduct) => {
|
|
19
21
|
fetchProvider: BlockServiceADFFetchProvider;
|
|
20
22
|
writeProvider: BlockServiceADFWriteProvider;
|
|
21
23
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type { ADFFetchProvider, ADFWriteProvider, DeleteSyncBlockResult,
|
|
1
|
+
import { type SyncBlockData } from '../../common/types';
|
|
2
|
+
import type { ADFFetchProvider, ADFWriteProvider, DeleteSyncBlockResult, SyncBlockInstance, WriteSyncBlockResult } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Configuration for Content API providers
|
|
5
5
|
*/
|
|
@@ -14,7 +14,6 @@ declare class ConfluenceADFFetchProvider implements ADFFetchProvider {
|
|
|
14
14
|
private config;
|
|
15
15
|
constructor(config: ContentAPIConfig);
|
|
16
16
|
fetchData(resourceId: string): Promise<SyncBlockInstance>;
|
|
17
|
-
retrieveSourceInfoFetchData(resourceId: ResourceId): SourceInfoFetchData;
|
|
18
17
|
}
|
|
19
18
|
/**
|
|
20
19
|
* ADFWriteProvider implementation that writes synced block data to Confluence Content API
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import type { JSONNode } from '@atlaskit/editor-json-transformer/types';
|
|
2
|
-
import { type SyncBlockData, type SyncBlockNode } from '../common/types';
|
|
3
|
+
import { type BlockInstanceId, type ResourceId, type SyncBlockData, type SyncBlockNode, type SyncBlockProduct } from '../common/types';
|
|
3
4
|
import { SyncBlockDataProvider, type ADFFetchProvider, type ADFWriteProvider, type DeleteSyncBlockResult, type SyncBlockInstance, type SyncBlockParentInfo, type SyncBlockSourceInfo, type SyncedBlockRendererProviderOptions, type WriteSyncBlockResult } from '../providers/types';
|
|
4
5
|
export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
5
6
|
name: string;
|
|
@@ -57,7 +58,7 @@ export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
|
57
58
|
*
|
|
58
59
|
* @returns Array of {resourceId?: string, error?: string}.
|
|
59
60
|
*/
|
|
60
|
-
deleteNodesData(resourceIds:
|
|
61
|
+
deleteNodesData(resourceIds: ResourceId[]): Promise<Array<DeleteSyncBlockResult>>;
|
|
61
62
|
/**
|
|
62
63
|
* Get the source id
|
|
63
64
|
*
|
|
@@ -65,14 +66,16 @@ export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
|
65
66
|
*/
|
|
66
67
|
getSourceId(): string;
|
|
67
68
|
/**
|
|
68
|
-
*
|
|
69
|
+
* Fetch the source info from the source id
|
|
69
70
|
*
|
|
70
|
-
* @param
|
|
71
|
+
* @param params
|
|
72
|
+
* @param params.sourceAri - The source ARI
|
|
73
|
+
* @param params.sourceProduct - The source product. e.g. 'confluence-page', 'jira-work-item'
|
|
71
74
|
*
|
|
72
75
|
* @returns The source info
|
|
73
76
|
*/
|
|
74
|
-
|
|
75
|
-
generateResourceId(sourceId: string, localId:
|
|
77
|
+
fetchSyncBlockSourceInfo(localId: BlockInstanceId, sourceAri: string, sourceProduct: SyncBlockProduct, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void): Promise<SyncBlockSourceInfo | undefined>;
|
|
78
|
+
generateResourceId(sourceId: string, localId: BlockInstanceId): string;
|
|
76
79
|
/**
|
|
77
80
|
* Get the synced block renderer provider options
|
|
78
81
|
*
|
|
@@ -82,11 +85,11 @@ export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
|
82
85
|
/**
|
|
83
86
|
* Retrieve the parent info for the sync block
|
|
84
87
|
*
|
|
85
|
-
* @param
|
|
86
|
-
* @param
|
|
88
|
+
* @param sourceAri - The source ARI
|
|
89
|
+
* @param sourceProduct - The source product. e.g. 'confluence-page', 'jira-work-item'
|
|
87
90
|
*
|
|
88
91
|
* @returns The parent info for the sync block
|
|
89
92
|
*/
|
|
90
|
-
retrieveSyncBlockParentInfo(
|
|
93
|
+
retrieveSyncBlockParentInfo(sourceAri: string, sourceProduct: SyncBlockProduct): SyncBlockParentInfo | undefined;
|
|
91
94
|
}
|
|
92
95
|
export declare const useMemoizedSyncedBlockProvider: (fetchProvider: ADFFetchProvider, writeProvider: ADFWriteProvider, sourceId: string, providerOptions: SyncedBlockRendererProviderOptions) => SyncBlockProvider;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import type { RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import type { MediaProvider, ProfilecardProvider } from '@atlaskit/editor-common/provider-factory';
|
|
2
3
|
import type { EmojiProvider } from '@atlaskit/emoji';
|
|
3
4
|
import type { MentionProvider } from '@atlaskit/mention/types';
|
|
4
5
|
import { NodeDataProvider } from '@atlaskit/node-data-provider';
|
|
5
6
|
import type { TaskDecisionProvider } from '@atlaskit/task-decision/types';
|
|
6
|
-
import type { SyncBlockData, ResourceId, SyncBlockError, SyncBlockNode, SyncBlockProduct } from '../common/types';
|
|
7
|
+
import type { SyncBlockData, ResourceId, SyncBlockError, SyncBlockNode, SyncBlockProduct, BlockInstanceId } from '../common/types';
|
|
7
8
|
/**
|
|
8
9
|
* The instance of a sync block, containing its data and metadata.
|
|
9
10
|
* Mainly used for representing the state of a sync block after fetching from a data provider.
|
|
@@ -12,11 +13,11 @@ import type { SyncBlockData, ResourceId, SyncBlockError, SyncBlockNode, SyncBloc
|
|
|
12
13
|
export type SyncBlockInstance = {
|
|
13
14
|
data?: SyncBlockData;
|
|
14
15
|
error?: SyncBlockError;
|
|
15
|
-
resourceId:
|
|
16
|
+
resourceId: ResourceId;
|
|
16
17
|
};
|
|
17
18
|
export type DeleteSyncBlockResult = {
|
|
18
19
|
error?: string;
|
|
19
|
-
resourceId:
|
|
20
|
+
resourceId: ResourceId;
|
|
20
21
|
success: boolean;
|
|
21
22
|
};
|
|
22
23
|
export type SyncBlockSourceInfo = {
|
|
@@ -29,7 +30,7 @@ export type SyncBlockParentInfo = {
|
|
|
29
30
|
};
|
|
30
31
|
export type WriteSyncBlockResult = {
|
|
31
32
|
error?: string;
|
|
32
|
-
resourceId?:
|
|
33
|
+
resourceId?: ResourceId;
|
|
33
34
|
};
|
|
34
35
|
export type SourceInfoFetchData = {
|
|
35
36
|
pageARI: string;
|
|
@@ -37,10 +38,9 @@ export type SourceInfoFetchData = {
|
|
|
37
38
|
};
|
|
38
39
|
export interface ADFFetchProvider {
|
|
39
40
|
fetchData: (resourceId: ResourceId) => Promise<SyncBlockInstance>;
|
|
40
|
-
retrieveSourceInfoFetchData: (resourceId: ResourceId, pageAri: string) => SourceInfoFetchData;
|
|
41
41
|
}
|
|
42
42
|
export interface ADFWriteProvider {
|
|
43
|
-
deleteData: (resourceId:
|
|
43
|
+
deleteData: (resourceId: ResourceId) => Promise<DeleteSyncBlockResult>;
|
|
44
44
|
generateResourceId: (sourceId: string, localId: string) => ResourceId;
|
|
45
45
|
writeData: (data: SyncBlockData) => Promise<WriteSyncBlockResult>;
|
|
46
46
|
}
|
|
@@ -65,16 +65,16 @@ export declare abstract class SyncBlockDataProvider extends NodeDataProvider<Syn
|
|
|
65
65
|
abstract writeNodesData(nodes: SyncBlockNode[], data: SyncBlockData[]): Promise<Array<WriteSyncBlockResult>>;
|
|
66
66
|
abstract deleteNodesData(resourceIds: string[]): Promise<Array<DeleteSyncBlockResult>>;
|
|
67
67
|
abstract getSourceId(): ResourceId;
|
|
68
|
-
abstract
|
|
68
|
+
abstract fetchSyncBlockSourceInfo(localId: BlockInstanceId, sourceAri: string, sourceProduct: SyncBlockProduct, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void): Promise<SyncBlockSourceInfo | undefined>;
|
|
69
69
|
abstract getSyncedBlockRendererProviderOptions(): SyncedBlockRendererProviderOptions;
|
|
70
|
-
abstract retrieveSyncBlockParentInfo(
|
|
70
|
+
abstract retrieveSyncBlockParentInfo(sourceAri: string, sourceProduct: SyncBlockProduct): SyncBlockParentInfo | undefined;
|
|
71
71
|
/**
|
|
72
72
|
* Generates a resource ID from a source ID and local ID.
|
|
73
73
|
* @param sourceId - The source document ID (e.g., page ARI)
|
|
74
74
|
* @param localId - The local block ID (usually a UUID)
|
|
75
75
|
* @returns The generated resource ID
|
|
76
76
|
*/
|
|
77
|
-
abstract generateResourceId(sourceId: ResourceId, localId:
|
|
77
|
+
abstract generateResourceId(sourceId: ResourceId, localId: BlockInstanceId): ResourceId;
|
|
78
78
|
}
|
|
79
79
|
export type SubscriptionCallback = (data: SyncBlockInstance) => void;
|
|
80
80
|
export type TitleSubscriptionCallback = (title: string) => void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
2
3
|
import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
4
|
import { type ResourceId, type SyncBlockNode } from '../common/types';
|
|
@@ -8,21 +9,24 @@ export declare class ReferenceSyncBlockStoreManager {
|
|
|
8
9
|
private subscriptions;
|
|
9
10
|
private titleSubscriptions;
|
|
10
11
|
private providerFactories;
|
|
12
|
+
private fireAnalyticsEvent?;
|
|
11
13
|
private syncBlockURLRequests;
|
|
12
14
|
private isRefreshingSubscriptions;
|
|
13
|
-
constructor(dataProvider?: SyncBlockDataProvider);
|
|
15
|
+
constructor(dataProvider?: SyncBlockDataProvider, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void);
|
|
16
|
+
updateFireAnalyticsEvent(fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void): void;
|
|
14
17
|
/**
|
|
15
18
|
* Refreshes the subscriptions for all sync blocks.
|
|
16
19
|
* @returns {Promise<void>}
|
|
17
20
|
*/
|
|
18
21
|
refreshSubscriptions(): Promise<void>;
|
|
19
|
-
private
|
|
22
|
+
private fetchSyncBlockSourceInfo;
|
|
20
23
|
/**
|
|
21
24
|
* Fetch sync block data for a given array of sync block nodes.
|
|
22
25
|
* @param syncBlockNodes - The array of sync block nodes to fetch data for
|
|
23
26
|
* @returns The fetched sync block data results
|
|
24
27
|
*/
|
|
25
28
|
fetchSyncBlocksData(syncBlockNodes: SyncBlockNode[]): Promise<SyncBlockInstance[]>;
|
|
29
|
+
private updateCacheWithSourceInfo;
|
|
26
30
|
private updateCache;
|
|
27
31
|
private updateSourceTitleSubscriptions;
|
|
28
32
|
private getFromCache;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type SyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
3
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
@@ -8,12 +9,13 @@ export type CreationCallback = () => void;
|
|
|
8
9
|
export declare class SourceSyncBlockStoreManager {
|
|
9
10
|
private dataProvider?;
|
|
10
11
|
private editorView?;
|
|
12
|
+
private fireAnalyticsEvent?;
|
|
11
13
|
private syncBlockCache;
|
|
12
14
|
private confirmationCallback?;
|
|
13
15
|
private confirmationTransaction?;
|
|
14
16
|
private pendingResourceId?;
|
|
15
17
|
private creationCallback?;
|
|
16
|
-
constructor(dataProvider?: SyncBlockDataProvider);
|
|
18
|
+
constructor(dataProvider?: SyncBlockDataProvider, fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void);
|
|
17
19
|
isSourceBlock(node: PMNode): boolean;
|
|
18
20
|
/**
|
|
19
21
|
* Add/update a sync block node to/from the local cache
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { SyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import type { SyncBlockDataProvider } from '../providers/types';
|
|
2
3
|
import { ReferenceSyncBlockStoreManager } from './referenceSyncBlockStoreManager';
|
|
3
4
|
import { SourceSyncBlockStoreManager } from './sourceSyncBlockStoreManager';
|
|
4
5
|
export declare class SyncBlockStoreManager {
|
|
5
6
|
private referenceSyncBlockStoreManager;
|
|
6
7
|
private sourceSyncBlockStoreManager;
|
|
7
|
-
constructor(dataProvider?: SyncBlockDataProvider);
|
|
8
|
+
constructor(dataProvider?: SyncBlockDataProvider, fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void);
|
|
8
9
|
get referenceManager(): ReferenceSyncBlockStoreManager;
|
|
9
10
|
get sourceManager(): SourceSyncBlockStoreManager;
|
|
10
11
|
destroy(): void;
|
|
@@ -1 +1,11 @@
|
|
|
1
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, type RendererSyncBlockEventPayload, type OperationalAEP, type SyncBlockEventPayload } from "@atlaskit/editor-common/analytics";
|
|
1
2
|
export declare const stringifyError: (error: unknown) => string | undefined;
|
|
3
|
+
export declare const getErrorPayload: <T extends ACTION_SUBJECT_ID>(actionSubjectId: T, error: string) => OperationalAEP<ACTION.ERROR, ACTION_SUBJECT.SYNCED_BLOCK, T, {
|
|
4
|
+
error: string;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const fetchErrorPayload: (error: string) => RendererSyncBlockEventPayload;
|
|
7
|
+
export declare const getSourceInfoErrorPayload: (error: string) => RendererSyncBlockEventPayload;
|
|
8
|
+
export declare const updateErrorPayload: (error: string) => SyncBlockEventPayload;
|
|
9
|
+
export declare const createErrorPayload: (error: string) => SyncBlockEventPayload;
|
|
10
|
+
export declare const deleteErrorPayload: (error: string) => SyncBlockEventPayload;
|
|
11
|
+
export declare const updateCacheErrorPayload: (error: string) => SyncBlockEventPayload;
|