@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
|
@@ -7,9 +7,11 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
7
7
|
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; }
|
|
8
8
|
import { useMemo } from 'react';
|
|
9
9
|
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
10
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
11
|
import { getProductFromSourceAri } from '../clients/block-service/ari';
|
|
11
12
|
import { SyncBlockError } from '../common/types';
|
|
12
13
|
import { fetchReferencesErrorPayload } from '../utils/errorHandling';
|
|
14
|
+
import { getFetchReferencesExperience, getFetchSourceInfoExperience } from '../utils/experienceTracking';
|
|
13
15
|
import { ReferenceSyncBlockStoreManager } from './referenceSyncBlockStoreManager';
|
|
14
16
|
import { SourceSyncBlockStoreManager } from './sourceSyncBlockStoreManager';
|
|
15
17
|
|
|
@@ -32,7 +34,7 @@ export var SyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
32
34
|
value: function () {
|
|
33
35
|
var _fetchReferencesSourceInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(resourceId, blockInstanceId, isSourceSyncBlock) {
|
|
34
36
|
var _this = this;
|
|
35
|
-
var _response$references, response, sourceInfoPromises, sourceInfos, sourceSyncBlockData, _this$fireAnalyticsEv;
|
|
37
|
+
var _this$fetchReferences, _response$references, _this$fetchReferences5, response, _this$fetchReferences2, _this$fetchReferences3, _this$fetchReferences4, sourceInfoPromises, sourceInfos, sourceSyncBlockData, _this$fireAnalyticsEv;
|
|
36
38
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
37
39
|
while (1) switch (_context2.prev = _context2.next) {
|
|
38
40
|
case 0:
|
|
@@ -43,51 +45,69 @@ export var SyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
43
45
|
}
|
|
44
46
|
throw new Error('Data provider not set');
|
|
45
47
|
case 3:
|
|
46
|
-
|
|
48
|
+
(_this$fetchReferences = this.fetchReferencesExperience) === null || _this$fetchReferences === void 0 || _this$fetchReferences.start();
|
|
49
|
+
_context2.next = 6;
|
|
47
50
|
return this.dataProvider.fetchReferences(resourceId, isSourceSyncBlock);
|
|
48
|
-
case
|
|
51
|
+
case 6:
|
|
49
52
|
response = _context2.sent;
|
|
50
53
|
if (!response.error) {
|
|
51
|
-
_context2.next =
|
|
54
|
+
_context2.next = 10;
|
|
52
55
|
break;
|
|
53
56
|
}
|
|
57
|
+
(_this$fetchReferences2 = this.fetchReferencesExperience) === null || _this$fetchReferences2 === void 0 || _this$fetchReferences2.failure({
|
|
58
|
+
reason: response.error
|
|
59
|
+
});
|
|
54
60
|
return _context2.abrupt("return", {
|
|
55
61
|
error: response.error
|
|
56
62
|
});
|
|
57
|
-
case
|
|
63
|
+
case 10:
|
|
58
64
|
if (!(!response.references || ((_response$references = response.references) === null || _response$references === void 0 ? void 0 : _response$references.length) === 0)) {
|
|
59
|
-
_context2.next =
|
|
65
|
+
_context2.next = 13;
|
|
60
66
|
break;
|
|
61
67
|
}
|
|
68
|
+
// No reference found
|
|
69
|
+
if (isSourceSyncBlock) {
|
|
70
|
+
(_this$fetchReferences3 = this.fetchReferencesExperience) === null || _this$fetchReferences3 === void 0 || _this$fetchReferences3.success();
|
|
71
|
+
} else {
|
|
72
|
+
(_this$fetchReferences4 = this.fetchReferencesExperience) === null || _this$fetchReferences4 === void 0 || _this$fetchReferences4.failure({
|
|
73
|
+
reason: 'No references found for reference synced block'
|
|
74
|
+
});
|
|
75
|
+
}
|
|
62
76
|
return _context2.abrupt("return", isSourceSyncBlock ? {
|
|
63
77
|
references: []
|
|
64
78
|
} : {
|
|
65
79
|
error: SyncBlockError.Errored
|
|
66
80
|
});
|
|
67
|
-
case
|
|
81
|
+
case 13:
|
|
82
|
+
(_this$fetchReferences5 = this.fetchReferencesExperience) === null || _this$fetchReferences5 === void 0 || _this$fetchReferences5.success();
|
|
68
83
|
sourceInfoPromises = response.references.map( /*#__PURE__*/function () {
|
|
69
84
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(reference) {
|
|
70
|
-
var _this$dataProvider;
|
|
71
|
-
var sourceInfo;
|
|
85
|
+
var _this$fetchSourceInfo, _this$dataProvider, _this$fetchSourceInfo3;
|
|
86
|
+
var sourceInfo, _this$fetchSourceInfo2;
|
|
72
87
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
73
88
|
while (1) switch (_context.prev = _context.next) {
|
|
74
89
|
case 0:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
90
|
+
(_this$fetchSourceInfo = _this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo === void 0 || _this$fetchSourceInfo.start();
|
|
91
|
+
_context.next = 3;
|
|
92
|
+
return (_this$dataProvider = _this.dataProvider) === null || _this$dataProvider === void 0 ? void 0 : _this$dataProvider.fetchSyncBlockSourceInfo(reference.blockInstanceId || '', reference.documentAri, getProductFromSourceAri(reference.documentAri), _this.fireAnalyticsEvent, reference.hasAccess, 'view');
|
|
93
|
+
case 3:
|
|
78
94
|
sourceInfo = _context.sent;
|
|
79
95
|
if (sourceInfo) {
|
|
80
|
-
_context.next =
|
|
96
|
+
_context.next = 7;
|
|
81
97
|
break;
|
|
82
98
|
}
|
|
99
|
+
(_this$fetchSourceInfo2 = _this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo2 === void 0 || _this$fetchSourceInfo2.failure({
|
|
100
|
+
reason: "no source info returned for ari: ".concat(reference.documentAri)
|
|
101
|
+
});
|
|
83
102
|
return _context.abrupt("return", undefined);
|
|
84
|
-
case
|
|
103
|
+
case 7:
|
|
104
|
+
(_this$fetchSourceInfo3 = _this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo3 === void 0 || _this$fetchSourceInfo3.success();
|
|
85
105
|
return _context.abrupt("return", _objectSpread(_objectSpread({}, sourceInfo), {}, {
|
|
86
106
|
onSameDocument: reference.onSameDocument,
|
|
87
107
|
hasAccess: reference.hasAccess,
|
|
88
108
|
productType: sourceInfo.productType
|
|
89
109
|
}));
|
|
90
|
-
case
|
|
110
|
+
case 9:
|
|
91
111
|
case "end":
|
|
92
112
|
return _context.stop();
|
|
93
113
|
}
|
|
@@ -97,13 +117,13 @@ export var SyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
97
117
|
return _ref.apply(this, arguments);
|
|
98
118
|
};
|
|
99
119
|
}());
|
|
100
|
-
_context2.next =
|
|
120
|
+
_context2.next = 17;
|
|
101
121
|
return Promise.all(sourceInfoPromises);
|
|
102
|
-
case
|
|
122
|
+
case 17:
|
|
103
123
|
sourceInfos = _context2.sent;
|
|
104
|
-
_context2.next =
|
|
124
|
+
_context2.next = 20;
|
|
105
125
|
return isSourceSyncBlock ? this.sourceSyncBlockStoreManager.getSyncBlockSourceInfo(blockInstanceId) : this.referenceSyncBlockStoreManager.fetchSyncBlockSourceInfo(resourceId);
|
|
106
|
-
case
|
|
126
|
+
case 20:
|
|
107
127
|
sourceSyncBlockData = _context2.sent;
|
|
108
128
|
if (sourceSyncBlockData) {
|
|
109
129
|
sourceInfos.push(_objectSpread(_objectSpread({}, sourceSyncBlockData), {}, {
|
|
@@ -116,8 +136,8 @@ export var SyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
116
136
|
return _context2.abrupt("return", {
|
|
117
137
|
references: sourceInfos
|
|
118
138
|
});
|
|
119
|
-
case
|
|
120
|
-
_context2.prev =
|
|
139
|
+
case 25:
|
|
140
|
+
_context2.prev = 25;
|
|
121
141
|
_context2.t0 = _context2["catch"](0);
|
|
122
142
|
logException(_context2.t0, {
|
|
123
143
|
location: 'editor-synced-block-provider/syncBlockStoreManager'
|
|
@@ -126,11 +146,11 @@ export var SyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
126
146
|
return _context2.abrupt("return", {
|
|
127
147
|
error: SyncBlockError.Errored
|
|
128
148
|
});
|
|
129
|
-
case
|
|
149
|
+
case 30:
|
|
130
150
|
case "end":
|
|
131
151
|
return _context2.stop();
|
|
132
152
|
}
|
|
133
|
-
}, _callee2, this, [[0,
|
|
153
|
+
}, _callee2, this, [[0, 25]]);
|
|
134
154
|
}));
|
|
135
155
|
function fetchReferencesSourceInfo(_x, _x2, _x3) {
|
|
136
156
|
return _fetchReferencesSourceInfo.apply(this, arguments);
|
|
@@ -143,6 +163,10 @@ export var SyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
143
163
|
this.fireAnalyticsEvent = fireAnalyticsEvent;
|
|
144
164
|
this.referenceSyncBlockStoreManager.setFireAnalyticsEvent(fireAnalyticsEvent);
|
|
145
165
|
this.sourceSyncBlockStoreManager.setFireAnalyticsEvent(fireAnalyticsEvent);
|
|
166
|
+
if (fg('platform_synced_block_dogfooding')) {
|
|
167
|
+
this.fetchReferencesExperience = getFetchReferencesExperience(fireAnalyticsEvent);
|
|
168
|
+
this.fetchSourceInfoExperience = getFetchSourceInfoExperience(fireAnalyticsEvent);
|
|
169
|
+
}
|
|
146
170
|
}
|
|
147
171
|
}, {
|
|
148
172
|
key: "referenceManager",
|
|
@@ -157,8 +181,15 @@ export var SyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
157
181
|
}, {
|
|
158
182
|
key: "destroy",
|
|
159
183
|
value: function destroy() {
|
|
184
|
+
var _this$fetchReferences6, _this$fetchSourceInfo4;
|
|
160
185
|
this.referenceSyncBlockStoreManager.destroy();
|
|
161
186
|
this.sourceSyncBlockStoreManager.destroy();
|
|
187
|
+
(_this$fetchReferences6 = this.fetchReferencesExperience) === null || _this$fetchReferences6 === void 0 || _this$fetchReferences6.abort({
|
|
188
|
+
reason: 'editorDestroyed'
|
|
189
|
+
});
|
|
190
|
+
(_this$fetchSourceInfo4 = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo4 === void 0 || _this$fetchSourceInfo4.abort({
|
|
191
|
+
reason: 'editorDestroyed'
|
|
192
|
+
});
|
|
162
193
|
}
|
|
163
194
|
}]);
|
|
164
195
|
}();
|
|
@@ -110,4 +110,21 @@ export var getCreateSourceExperience = function getCreateSourceExperience(fireAn
|
|
|
110
110
|
durationMs: TIMEOUT_DURATION
|
|
111
111
|
})]
|
|
112
112
|
});
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* This experience tracks when a source sync block is created and registered to the BE.
|
|
117
|
+
*
|
|
118
|
+
* Start: When the fetchSourceInfo function is called.
|
|
119
|
+
* Success: When the fetching the data is successful within the timeout duration of start.
|
|
120
|
+
* Failure: When the timeout duration passes without the data being successfully fetched, or the fetch fails
|
|
121
|
+
*/
|
|
122
|
+
export var getFetchReferencesExperience = function getFetchReferencesExperience(fireAnalyticsEvent) {
|
|
123
|
+
return new Experience(EXPERIENCE_ID.ASYNC_OPERATION, {
|
|
124
|
+
action: ACTION.SYNCED_BLOCK_FETCH_REFERENCES,
|
|
125
|
+
dispatchAnalyticsEvent: createExperienceDispatcher(fireAnalyticsEvent),
|
|
126
|
+
checks: [new ExperienceCheckTimeout({
|
|
127
|
+
durationMs: TIMEOUT_DURATION
|
|
128
|
+
})]
|
|
129
|
+
});
|
|
113
130
|
};
|
|
@@ -19,8 +19,9 @@ export var resolveSyncBlockInstance = function resolveSyncBlockInstance(oldResul
|
|
|
19
19
|
if (!oldResult.data) {
|
|
20
20
|
return newResult;
|
|
21
21
|
} else if (!newResult.data) {
|
|
22
|
+
var _newResult$error, _newResult$error2;
|
|
22
23
|
// return the old result if there was an error, e.g. network error, but not if not found or forbidden
|
|
23
|
-
if (newResult.error === SyncBlockError.NotFound || newResult.error === SyncBlockError.Forbidden) {
|
|
24
|
+
if (((_newResult$error = newResult.error) === null || _newResult$error === void 0 ? void 0 : _newResult$error.type) === SyncBlockError.NotFound || ((_newResult$error2 = newResult.error) === null || _newResult$error2 === void 0 ? void 0 : _newResult$error2.type) === SyncBlockError.Forbidden) {
|
|
24
25
|
return newResult;
|
|
25
26
|
} else {
|
|
26
27
|
return oldResult;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReferenceSyncBlockResponse, SyncBlockProduct, SyncBlockStatus } from '../../common/types';
|
|
1
|
+
import type { ReferenceSyncBlockResponse, SyncBlockProduct, SyncBlockStatus, DeletionReason } from '../../common/types';
|
|
2
2
|
export type BlockContentResponse = {
|
|
3
3
|
blockAri: string;
|
|
4
4
|
blockInstanceId: string;
|
|
@@ -6,6 +6,7 @@ export type BlockContentResponse = {
|
|
|
6
6
|
contentUpdatedAt: number;
|
|
7
7
|
createdAt: number;
|
|
8
8
|
createdBy: string;
|
|
9
|
+
deletionReason: DeletionReason;
|
|
9
10
|
product: SyncBlockProduct;
|
|
10
11
|
sourceAri: string;
|
|
11
12
|
status: SyncBlockStatus;
|
|
@@ -70,6 +71,7 @@ export type GetSyncedBlockContentRequest = {
|
|
|
70
71
|
};
|
|
71
72
|
export type DeleteSyncedBlockRequest = {
|
|
72
73
|
blockAri: string;
|
|
74
|
+
deleteReason: string | undefined;
|
|
73
75
|
};
|
|
74
76
|
export type UpdateSyncedBlockRequest = {
|
|
75
77
|
blockAri: string;
|
|
@@ -82,6 +84,7 @@ export type CreateSyncedBlockRequest = {
|
|
|
82
84
|
content: string;
|
|
83
85
|
product: SyncBlockProduct;
|
|
84
86
|
sourceAri: string;
|
|
87
|
+
status?: SyncBlockStatus;
|
|
85
88
|
stepVersion?: number;
|
|
86
89
|
};
|
|
87
90
|
type ReferenceSyncedBlockIDs = {
|
|
@@ -117,7 +120,7 @@ export declare class BlockError extends Error {
|
|
|
117
120
|
readonly status: number;
|
|
118
121
|
constructor(status: number);
|
|
119
122
|
}
|
|
120
|
-
export declare const getSyncedBlockContent: ({ blockAri }: GetSyncedBlockContentRequest) => Promise<BlockContentResponse>;
|
|
123
|
+
export declare const getSyncedBlockContent: ({ blockAri, }: GetSyncedBlockContentRequest) => Promise<BlockContentResponse>;
|
|
121
124
|
/**
|
|
122
125
|
* Batch retrieves multiple synced blocks by their ARIs.
|
|
123
126
|
*
|
|
@@ -127,9 +130,9 @@ export declare const getSyncedBlockContent: ({ blockAri }: GetSyncedBlockContent
|
|
|
127
130
|
* @returns A promise containing arrays of successfully fetched blocks and any errors encountered
|
|
128
131
|
*/
|
|
129
132
|
export declare const batchRetrieveSyncedBlocks: ({ blockIdentifiers, documentAri, }: BatchRetrieveSyncedBlocksRequest) => Promise<BatchRetrieveSyncedBlocksResponse>;
|
|
130
|
-
export declare const deleteSyncedBlock: ({ blockAri }: DeleteSyncedBlockRequest) => Promise<void>;
|
|
133
|
+
export declare const deleteSyncedBlock: ({ blockAri, deleteReason, }: DeleteSyncedBlockRequest) => Promise<void>;
|
|
131
134
|
export declare const updateSyncedBlock: ({ blockAri, content, stepVersion, }: UpdateSyncedBlockRequest) => Promise<void>;
|
|
132
|
-
export declare const createSyncedBlock: ({ blockAri, blockInstanceId, sourceAri, product, content, stepVersion, }: CreateSyncedBlockRequest) => Promise<BlockContentResponse>;
|
|
135
|
+
export declare const createSyncedBlock: ({ blockAri, blockInstanceId, sourceAri, product, content, stepVersion, status, }: CreateSyncedBlockRequest) => Promise<BlockContentResponse>;
|
|
133
136
|
export declare const updateReferenceSyncedBlockOnDocument: ({ documentAri, blocks, noContent, }: UpdateReferenceSyncedBlockOnDocumentRequest) => Promise<ReferenceSyncedBlockResponse | void>;
|
|
134
137
|
export declare const getReferenceSyncedBlocksByBlockAri: ({ blockAri, }: GetReferenceSyncedBlocksByBlockAriRequest) => Promise<GetReferenceSyncedBlocksByBlockAriResponse>;
|
|
135
138
|
export {};
|
|
@@ -32,6 +32,7 @@ export interface SyncBlockData {
|
|
|
32
32
|
contentUpdatedAt?: string;
|
|
33
33
|
createdAt?: string;
|
|
34
34
|
createdBy?: string;
|
|
35
|
+
deletionReason?: DeletionReason;
|
|
35
36
|
isSynced?: boolean;
|
|
36
37
|
/**
|
|
37
38
|
* Whether the block is on the same page as the source block
|
|
@@ -47,6 +48,7 @@ export interface SyncBlockData {
|
|
|
47
48
|
sourceTitle?: string;
|
|
48
49
|
sourceURL?: string;
|
|
49
50
|
status?: SyncBlockStatus;
|
|
51
|
+
updatedAt?: string;
|
|
50
52
|
}
|
|
51
53
|
export interface ReferenceSyncBlockResponse {
|
|
52
54
|
blockAri: string;
|
|
@@ -68,3 +70,5 @@ export type ReferencesSourceInfo = {
|
|
|
68
70
|
error?: SyncBlockError;
|
|
69
71
|
references?: Array<SyncBlockSourceInfo | undefined>;
|
|
70
72
|
};
|
|
73
|
+
export type DeletionReason = 'source-block-deleted' | 'source-block-unsynced';
|
|
74
|
+
export type DeletionReasonResponse = DeletionReason | 'source-document-deleted';
|
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 { ResourceId, SyncBlockData, SyncBlockNode, SyncBlockProduct, SyncBlockStatus, BlockInstanceId, SyncBlockAttrs, ReferenceSyncBlockData, ReferencesSourceInfo } from './common/types';
|
|
3
|
+
export type { ResourceId, SyncBlockData, SyncBlockNode, SyncBlockProduct, SyncBlockStatus, BlockInstanceId, SyncBlockAttrs, ReferenceSyncBlockData, ReferencesSourceInfo, DeletionReason, } 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';
|
|
@@ -56,6 +56,7 @@ declare class BlockServiceADFFetchProvider implements ADFFetchProvider {
|
|
|
56
56
|
interface BlockServiceADFWriteProviderProps {
|
|
57
57
|
cloudId: string;
|
|
58
58
|
getVersion?: () => number | undefined;
|
|
59
|
+
isParentUnpublished?: () => boolean;
|
|
59
60
|
parentAri: string | undefined;
|
|
60
61
|
parentId?: string;
|
|
61
62
|
product: SyncBlockProduct;
|
|
@@ -67,12 +68,13 @@ declare class BlockServiceADFWriteProvider implements ADFWriteProvider {
|
|
|
67
68
|
private cloudId;
|
|
68
69
|
private parentId?;
|
|
69
70
|
private getVersion?;
|
|
71
|
+
private isParentUnpublished?;
|
|
70
72
|
product: SyncBlockProduct;
|
|
71
73
|
parentAri: string | undefined;
|
|
72
|
-
constructor({ cloudId, parentAri, parentId, product, getVersion, }: BlockServiceADFWriteProviderProps);
|
|
74
|
+
constructor({ cloudId, parentAri, parentId, product, getVersion, isParentUnpublished, }: BlockServiceADFWriteProviderProps);
|
|
73
75
|
writeData(data: SyncBlockData): Promise<WriteSyncBlockResult>;
|
|
74
76
|
createData(data: SyncBlockData): Promise<WriteSyncBlockResult>;
|
|
75
|
-
deleteData(resourceId: string): Promise<DeleteSyncBlockResult>;
|
|
77
|
+
deleteData(resourceId: string, deleteReason: string | undefined): Promise<DeleteSyncBlockResult>;
|
|
76
78
|
generateResourceIdForReference(sourceId: ResourceId): ResourceId;
|
|
77
79
|
generateResourceId(): ResourceId;
|
|
78
80
|
updateReferenceData(blocks: SyncBlockAttrs[], noContent?: boolean): Promise<UpdateReferenceSyncBlockResult>;
|
|
@@ -80,11 +82,12 @@ declare class BlockServiceADFWriteProvider implements ADFWriteProvider {
|
|
|
80
82
|
interface BlockServiceAPIProvidersProps {
|
|
81
83
|
cloudId: string;
|
|
82
84
|
getVersion?: () => number | undefined;
|
|
85
|
+
isParentUnpublished?: () => boolean;
|
|
83
86
|
parentAri: string | undefined;
|
|
84
87
|
parentId?: string;
|
|
85
88
|
product: SyncBlockProduct;
|
|
86
89
|
}
|
|
87
|
-
export declare const useMemoizedBlockServiceAPIProviders: ({ cloudId, parentAri, parentId, product, getVersion, }: BlockServiceAPIProvidersProps) => {
|
|
90
|
+
export declare const useMemoizedBlockServiceAPIProviders: ({ cloudId, parentAri, parentId, product, getVersion, isParentUnpublished, }: BlockServiceAPIProvidersProps) => {
|
|
88
91
|
fetchProvider: BlockServiceADFFetchProvider;
|
|
89
92
|
writeProvider: BlockServiceADFWriteProvider;
|
|
90
93
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { JSONNode } from '@atlaskit/editor-json-transformer/types';
|
|
3
|
-
import { type BlockInstanceId, type ReferenceSyncBlockData, type ResourceId, type SyncBlockAttrs, type SyncBlockData, type SyncBlockNode, type SyncBlockProduct } from '../common/types';
|
|
3
|
+
import { type BlockInstanceId, type DeletionReason, type ReferenceSyncBlockData, type ResourceId, type SyncBlockAttrs, type SyncBlockData, type SyncBlockNode, type SyncBlockProduct } from '../common/types';
|
|
4
4
|
import { SyncBlockDataProvider, type ADFFetchProvider, type ADFWriteProvider, type BlockSubscriptionErrorCallback, type BlockUpdateCallback, type DeleteSyncBlockResult, type SyncBlockInstance, type SyncBlockParentInfo, type SyncBlockSourceInfo, type SyncedBlockRendererProviderOptions, type Unsubscribe, type UpdateReferenceSyncBlockResult, type WriteSyncBlockResult } from './types';
|
|
5
5
|
export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
6
6
|
name: string;
|
|
@@ -58,7 +58,7 @@ export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
|
58
58
|
*
|
|
59
59
|
* @returns Array of {resourceId?: string, error?: string}.
|
|
60
60
|
*/
|
|
61
|
-
deleteNodesData(resourceIds: ResourceId[]): Promise<Array<DeleteSyncBlockResult>>;
|
|
61
|
+
deleteNodesData(resourceIds: ResourceId[], deletionReason: DeletionReason | undefined): Promise<Array<DeleteSyncBlockResult>>;
|
|
62
62
|
/**
|
|
63
63
|
* Fetch the source info from the source id
|
|
64
64
|
*
|
|
@@ -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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReferenceSyncBlockResponse, SyncBlockProduct, SyncBlockStatus } from '../../common/types';
|
|
1
|
+
import type { ReferenceSyncBlockResponse, SyncBlockProduct, SyncBlockStatus, DeletionReason } from '../../common/types';
|
|
2
2
|
export type BlockContentResponse = {
|
|
3
3
|
blockAri: string;
|
|
4
4
|
blockInstanceId: string;
|
|
@@ -6,6 +6,7 @@ export type BlockContentResponse = {
|
|
|
6
6
|
contentUpdatedAt: number;
|
|
7
7
|
createdAt: number;
|
|
8
8
|
createdBy: string;
|
|
9
|
+
deletionReason: DeletionReason;
|
|
9
10
|
product: SyncBlockProduct;
|
|
10
11
|
sourceAri: string;
|
|
11
12
|
status: SyncBlockStatus;
|
|
@@ -70,6 +71,7 @@ export type GetSyncedBlockContentRequest = {
|
|
|
70
71
|
};
|
|
71
72
|
export type DeleteSyncedBlockRequest = {
|
|
72
73
|
blockAri: string;
|
|
74
|
+
deleteReason: string | undefined;
|
|
73
75
|
};
|
|
74
76
|
export type UpdateSyncedBlockRequest = {
|
|
75
77
|
blockAri: string;
|
|
@@ -82,6 +84,7 @@ export type CreateSyncedBlockRequest = {
|
|
|
82
84
|
content: string;
|
|
83
85
|
product: SyncBlockProduct;
|
|
84
86
|
sourceAri: string;
|
|
87
|
+
status?: SyncBlockStatus;
|
|
85
88
|
stepVersion?: number;
|
|
86
89
|
};
|
|
87
90
|
type ReferenceSyncedBlockIDs = {
|
|
@@ -117,7 +120,7 @@ export declare class BlockError extends Error {
|
|
|
117
120
|
readonly status: number;
|
|
118
121
|
constructor(status: number);
|
|
119
122
|
}
|
|
120
|
-
export declare const getSyncedBlockContent: ({ blockAri }: GetSyncedBlockContentRequest) => Promise<BlockContentResponse>;
|
|
123
|
+
export declare const getSyncedBlockContent: ({ blockAri, }: GetSyncedBlockContentRequest) => Promise<BlockContentResponse>;
|
|
121
124
|
/**
|
|
122
125
|
* Batch retrieves multiple synced blocks by their ARIs.
|
|
123
126
|
*
|
|
@@ -127,9 +130,9 @@ export declare const getSyncedBlockContent: ({ blockAri }: GetSyncedBlockContent
|
|
|
127
130
|
* @returns A promise containing arrays of successfully fetched blocks and any errors encountered
|
|
128
131
|
*/
|
|
129
132
|
export declare const batchRetrieveSyncedBlocks: ({ blockIdentifiers, documentAri, }: BatchRetrieveSyncedBlocksRequest) => Promise<BatchRetrieveSyncedBlocksResponse>;
|
|
130
|
-
export declare const deleteSyncedBlock: ({ blockAri }: DeleteSyncedBlockRequest) => Promise<void>;
|
|
133
|
+
export declare const deleteSyncedBlock: ({ blockAri, deleteReason, }: DeleteSyncedBlockRequest) => Promise<void>;
|
|
131
134
|
export declare const updateSyncedBlock: ({ blockAri, content, stepVersion, }: UpdateSyncedBlockRequest) => Promise<void>;
|
|
132
|
-
export declare const createSyncedBlock: ({ blockAri, blockInstanceId, sourceAri, product, content, stepVersion, }: CreateSyncedBlockRequest) => Promise<BlockContentResponse>;
|
|
135
|
+
export declare const createSyncedBlock: ({ blockAri, blockInstanceId, sourceAri, product, content, stepVersion, status, }: CreateSyncedBlockRequest) => Promise<BlockContentResponse>;
|
|
133
136
|
export declare const updateReferenceSyncedBlockOnDocument: ({ documentAri, blocks, noContent, }: UpdateReferenceSyncedBlockOnDocumentRequest) => Promise<ReferenceSyncedBlockResponse | void>;
|
|
134
137
|
export declare const getReferenceSyncedBlocksByBlockAri: ({ blockAri, }: GetReferenceSyncedBlocksByBlockAriRequest) => Promise<GetReferenceSyncedBlocksByBlockAriResponse>;
|
|
135
138
|
export {};
|
|
@@ -32,6 +32,7 @@ export interface SyncBlockData {
|
|
|
32
32
|
contentUpdatedAt?: string;
|
|
33
33
|
createdAt?: string;
|
|
34
34
|
createdBy?: string;
|
|
35
|
+
deletionReason?: DeletionReason;
|
|
35
36
|
isSynced?: boolean;
|
|
36
37
|
/**
|
|
37
38
|
* Whether the block is on the same page as the source block
|
|
@@ -47,6 +48,7 @@ export interface SyncBlockData {
|
|
|
47
48
|
sourceTitle?: string;
|
|
48
49
|
sourceURL?: string;
|
|
49
50
|
status?: SyncBlockStatus;
|
|
51
|
+
updatedAt?: string;
|
|
50
52
|
}
|
|
51
53
|
export interface ReferenceSyncBlockResponse {
|
|
52
54
|
blockAri: string;
|
|
@@ -68,3 +70,5 @@ export type ReferencesSourceInfo = {
|
|
|
68
70
|
error?: SyncBlockError;
|
|
69
71
|
references?: Array<SyncBlockSourceInfo | undefined>;
|
|
70
72
|
};
|
|
73
|
+
export type DeletionReason = 'source-block-deleted' | 'source-block-unsynced';
|
|
74
|
+
export type DeletionReasonResponse = DeletionReason | 'source-document-deleted';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { rebaseTransaction } from './common/rebase-transaction';
|
|
2
2
|
export { SyncBlockError } from './common/types';
|
|
3
|
-
export type { ResourceId, SyncBlockData, SyncBlockNode, SyncBlockProduct, SyncBlockStatus, BlockInstanceId, SyncBlockAttrs, ReferenceSyncBlockData, ReferencesSourceInfo } from './common/types';
|
|
3
|
+
export type { ResourceId, SyncBlockData, SyncBlockNode, SyncBlockProduct, SyncBlockStatus, BlockInstanceId, SyncBlockAttrs, ReferenceSyncBlockData, ReferencesSourceInfo, DeletionReason, } 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';
|
|
@@ -56,6 +56,7 @@ declare class BlockServiceADFFetchProvider implements ADFFetchProvider {
|
|
|
56
56
|
interface BlockServiceADFWriteProviderProps {
|
|
57
57
|
cloudId: string;
|
|
58
58
|
getVersion?: () => number | undefined;
|
|
59
|
+
isParentUnpublished?: () => boolean;
|
|
59
60
|
parentAri: string | undefined;
|
|
60
61
|
parentId?: string;
|
|
61
62
|
product: SyncBlockProduct;
|
|
@@ -67,12 +68,13 @@ declare class BlockServiceADFWriteProvider implements ADFWriteProvider {
|
|
|
67
68
|
private cloudId;
|
|
68
69
|
private parentId?;
|
|
69
70
|
private getVersion?;
|
|
71
|
+
private isParentUnpublished?;
|
|
70
72
|
product: SyncBlockProduct;
|
|
71
73
|
parentAri: string | undefined;
|
|
72
|
-
constructor({ cloudId, parentAri, parentId, product, getVersion, }: BlockServiceADFWriteProviderProps);
|
|
74
|
+
constructor({ cloudId, parentAri, parentId, product, getVersion, isParentUnpublished, }: BlockServiceADFWriteProviderProps);
|
|
73
75
|
writeData(data: SyncBlockData): Promise<WriteSyncBlockResult>;
|
|
74
76
|
createData(data: SyncBlockData): Promise<WriteSyncBlockResult>;
|
|
75
|
-
deleteData(resourceId: string): Promise<DeleteSyncBlockResult>;
|
|
77
|
+
deleteData(resourceId: string, deleteReason: string | undefined): Promise<DeleteSyncBlockResult>;
|
|
76
78
|
generateResourceIdForReference(sourceId: ResourceId): ResourceId;
|
|
77
79
|
generateResourceId(): ResourceId;
|
|
78
80
|
updateReferenceData(blocks: SyncBlockAttrs[], noContent?: boolean): Promise<UpdateReferenceSyncBlockResult>;
|
|
@@ -80,11 +82,12 @@ declare class BlockServiceADFWriteProvider implements ADFWriteProvider {
|
|
|
80
82
|
interface BlockServiceAPIProvidersProps {
|
|
81
83
|
cloudId: string;
|
|
82
84
|
getVersion?: () => number | undefined;
|
|
85
|
+
isParentUnpublished?: () => boolean;
|
|
83
86
|
parentAri: string | undefined;
|
|
84
87
|
parentId?: string;
|
|
85
88
|
product: SyncBlockProduct;
|
|
86
89
|
}
|
|
87
|
-
export declare const useMemoizedBlockServiceAPIProviders: ({ cloudId, parentAri, parentId, product, getVersion, }: BlockServiceAPIProvidersProps) => {
|
|
90
|
+
export declare const useMemoizedBlockServiceAPIProviders: ({ cloudId, parentAri, parentId, product, getVersion, isParentUnpublished, }: BlockServiceAPIProvidersProps) => {
|
|
88
91
|
fetchProvider: BlockServiceADFFetchProvider;
|
|
89
92
|
writeProvider: BlockServiceADFWriteProvider;
|
|
90
93
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { JSONNode } from '@atlaskit/editor-json-transformer/types';
|
|
3
|
-
import { type BlockInstanceId, type ReferenceSyncBlockData, type ResourceId, type SyncBlockAttrs, type SyncBlockData, type SyncBlockNode, type SyncBlockProduct } from '../common/types';
|
|
3
|
+
import { type BlockInstanceId, type DeletionReason, type ReferenceSyncBlockData, type ResourceId, type SyncBlockAttrs, type SyncBlockData, type SyncBlockNode, type SyncBlockProduct } from '../common/types';
|
|
4
4
|
import { SyncBlockDataProvider, type ADFFetchProvider, type ADFWriteProvider, type BlockSubscriptionErrorCallback, type BlockUpdateCallback, type DeleteSyncBlockResult, type SyncBlockInstance, type SyncBlockParentInfo, type SyncBlockSourceInfo, type SyncedBlockRendererProviderOptions, type Unsubscribe, type UpdateReferenceSyncBlockResult, type WriteSyncBlockResult } from './types';
|
|
5
5
|
export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
6
6
|
name: string;
|
|
@@ -58,7 +58,7 @@ export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
|
58
58
|
*
|
|
59
59
|
* @returns Array of {resourceId?: string, error?: string}.
|
|
60
60
|
*/
|
|
61
|
-
deleteNodesData(resourceIds: ResourceId[]): Promise<Array<DeleteSyncBlockResult>>;
|
|
61
|
+
deleteNodesData(resourceIds: ResourceId[], deletionReason: DeletionReason | undefined): Promise<Array<DeleteSyncBlockResult>>;
|
|
62
62
|
/**
|
|
63
63
|
* Fetch the source info from the source id
|
|
64
64
|
*
|