@atlaskit/editor-synced-block-provider 3.26.0 → 3.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/cjs/clients/block-service/blockService.js +9 -14
- package/dist/cjs/clients/confluence/sourceInfo.js +3 -35
- package/dist/cjs/hooks/useFetchSyncBlockData.js +5 -11
- package/dist/cjs/providers/block-service/blockServiceAPI.js +1 -1
- package/dist/cjs/providers/syncBlockProvider.js +29 -72
- package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +75 -124
- package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +59 -93
- package/dist/cjs/store-manager/syncBlockStoreManager.js +2 -4
- package/dist/cjs/utils/errorHandling.js +2 -5
- package/dist/cjs/utils/resolveSyncBlockInstance.js +1 -3
- package/dist/cjs/utils/utils.js +5 -6
- package/dist/es2019/clients/block-service/blockService.js +5 -9
- package/dist/es2019/clients/confluence/sourceInfo.js +1 -4
- package/dist/es2019/hooks/useFetchSyncBlockData.js +6 -12
- package/dist/es2019/providers/block-service/blockServiceAPI.js +1 -1
- package/dist/es2019/providers/syncBlockProvider.js +21 -53
- package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +65 -114
- package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +60 -92
- package/dist/es2019/store-manager/syncBlockStoreManager.js +2 -4
- package/dist/es2019/utils/errorHandling.js +1 -4
- package/dist/es2019/utils/resolveSyncBlockInstance.js +2 -5
- package/dist/es2019/utils/utils.js +5 -6
- package/dist/esm/clients/block-service/blockService.js +9 -14
- package/dist/esm/clients/confluence/sourceInfo.js +2 -34
- package/dist/esm/hooks/useFetchSyncBlockData.js +5 -11
- package/dist/esm/providers/block-service/blockServiceAPI.js +1 -1
- package/dist/esm/providers/syncBlockProvider.js +29 -72
- package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +75 -124
- package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +59 -93
- package/dist/esm/store-manager/syncBlockStoreManager.js +2 -4
- package/dist/esm/utils/errorHandling.js +2 -5
- package/dist/esm/utils/resolveSyncBlockInstance.js +1 -3
- package/dist/esm/utils/utils.js +5 -6
- package/dist/types/clients/confluence/sourceInfo.d.ts +1 -2
- package/dist/types/hooks/useFetchSyncBlockData.d.ts +1 -1
- package/dist/types/providers/syncBlockProvider.d.ts +1 -1
- package/dist/types/providers/types.d.ts +2 -2
- package/dist/types/store-manager/sourceSyncBlockStoreManager.d.ts +1 -1
- package/dist/types-ts4.5/clients/confluence/sourceInfo.d.ts +1 -2
- package/dist/types-ts4.5/hooks/useFetchSyncBlockData.d.ts +1 -1
- package/dist/types-ts4.5/providers/syncBlockProvider.d.ts +1 -1
- package/dist/types-ts4.5/providers/types.d.ts +2 -2
- package/dist/types-ts4.5/store-manager/sourceSyncBlockStoreManager.d.ts +1 -1
- package/package.json +2 -5
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.updateSuccessPayload = exports.updateReferenceErrorPayload = exports.updateErrorPayload = exports.updateCacheErrorPayload = exports.stringifyError = exports.getSourceInfoErrorPayload = exports.getErrorPayload = exports.fetchSuccessPayload = exports.fetchReferencesErrorPayload = exports.fetchErrorPayload = exports.deleteSuccessPayload = exports.deleteErrorPayload = exports.createSuccessPayload = exports.createErrorPayload = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
10
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
11
|
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) { (0, _defineProperty2.default)(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; }
|
|
13
12
|
var stringifyError = exports.stringifyError = function stringifyError(error) {
|
|
@@ -23,13 +22,11 @@ var getErrorPayload = exports.getErrorPayload = function getErrorPayload(actionS
|
|
|
23
22
|
actionSubject: _analytics.ACTION_SUBJECT.SYNCED_BLOCK,
|
|
24
23
|
actionSubjectId: actionSubjectId,
|
|
25
24
|
eventType: _analytics.EVENT_TYPE.OPERATIONAL,
|
|
26
|
-
attributes:
|
|
25
|
+
attributes: _objectSpread({
|
|
27
26
|
error: error
|
|
28
27
|
}, resourceId && {
|
|
29
28
|
resourceId: resourceId
|
|
30
|
-
})
|
|
31
|
-
error: error
|
|
32
|
-
}
|
|
29
|
+
})
|
|
33
30
|
};
|
|
34
31
|
};
|
|
35
32
|
var fetchErrorPayload = exports.fetchErrorPayload = function fetchErrorPayload(error, resourceId) {
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.resolveSyncBlockInstance = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
9
|
var _types = require("../common/types");
|
|
11
10
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
11
|
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) { (0, _defineProperty2.default)(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; }
|
|
@@ -39,8 +38,7 @@ var resolveSyncBlockInstance = exports.resolveSyncBlockInstance = function resol
|
|
|
39
38
|
return _objectSpread(_objectSpread({}, newResult), {}, {
|
|
40
39
|
data: _objectSpread(_objectSpread({}, newResult.data), {}, {
|
|
41
40
|
sourceURL: ((_newResult$data = newResult.data) === null || _newResult$data === void 0 ? void 0 : _newResult$data.sourceURL) || ((_oldResult$data = oldResult.data) === null || _oldResult$data === void 0 ? void 0 : _oldResult$data.sourceURL) || undefined,
|
|
42
|
-
sourceTitle: ((_newResult$data2 = newResult.data) === null || _newResult$data2 === void 0 ? void 0 : _newResult$data2.sourceTitle) || ((_oldResult$data2 = oldResult.data) === null || _oldResult$data2 === void 0 ? void 0 : _oldResult$data2.sourceTitle) || undefined
|
|
43
|
-
}, (0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding') && {
|
|
41
|
+
sourceTitle: ((_newResult$data2 = newResult.data) === null || _newResult$data2 === void 0 ? void 0 : _newResult$data2.sourceTitle) || ((_oldResult$data2 = oldResult.data) === null || _oldResult$data2 === void 0 ? void 0 : _oldResult$data2.sourceTitle) || undefined,
|
|
44
42
|
sourceSubType: ((_newResult$data3 = newResult.data) === null || _newResult$data3 === void 0 ? void 0 : _newResult$data3.sourceSubType) || ((_oldResult$data3 = oldResult.data) === null || _oldResult$data3 === void 0 ? void 0 : _oldResult$data3.sourceSubType) || undefined,
|
|
45
43
|
onSameDocument: ((_newResult$data4 = newResult.data) === null || _newResult$data4 === void 0 ? void 0 : _newResult$data4.onSameDocument) || ((_oldResult$data4 = oldResult.data) === null || _oldResult$data4 === void 0 ? void 0 : _oldResult$data4.onSameDocument) || undefined
|
|
46
44
|
})
|
package/dist/cjs/utils/utils.js
CHANGED
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getContentIdAndProductFromResourceId = exports.createSyncBlockNode = exports.convertSyncBlockPMNodeToSyncBlockData = exports.convertSyncBlockJSONNodeToSyncBlockNode = exports.convertPMNodesToSyncBlockNodes = exports.convertPMNodeToSyncBlockNode = exports.convertContentUpdatedAt = void 0;
|
|
7
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
7
|
/* eslint-disable require-unicode-regexp */
|
|
9
8
|
|
|
10
9
|
var convertSyncBlockPMNodeToSyncBlockData = exports.convertSyncBlockPMNodeToSyncBlockData = function convertSyncBlockPMNodeToSyncBlockData(node) {
|
|
@@ -45,10 +44,10 @@ var convertPMNodesToSyncBlockNodes = exports.convertPMNodesToSyncBlockNodes = fu
|
|
|
45
44
|
};
|
|
46
45
|
|
|
47
46
|
/*
|
|
48
|
-
* From a reference block resource id (the resourceId stored in the node attributes)
|
|
49
|
-
* e.g. confluence-page/5769323474/cdf6a1bc-b241-487a-93e9-e30bde363cbc
|
|
50
|
-
* Extracts the source page content id and source product
|
|
51
|
-
*/
|
|
47
|
+
* From a reference block resource id (the resourceId stored in the node attributes)
|
|
48
|
+
* e.g. confluence-page/5769323474/cdf6a1bc-b241-487a-93e9-e30bde363cbc
|
|
49
|
+
* Extracts the source page content id and source product
|
|
50
|
+
*/
|
|
52
51
|
var getContentIdAndProductFromResourceId = exports.getContentIdAndProductFromResourceId = function getContentIdAndProductFromResourceId(resourceId) {
|
|
53
52
|
var match = resourceId.match(/^(confluence-page|jira-work-item)\/([^/]+)/);
|
|
54
53
|
if (match !== null && match !== void 0 && match[2]) {
|
|
@@ -60,7 +59,7 @@ var getContentIdAndProductFromResourceId = exports.getContentIdAndProductFromRes
|
|
|
60
59
|
throw new Error("Invalid resourceId: ".concat(resourceId));
|
|
61
60
|
};
|
|
62
61
|
var convertContentUpdatedAt = exports.convertContentUpdatedAt = function convertContentUpdatedAt(contentUpdatedAt) {
|
|
63
|
-
if (typeof contentUpdatedAt === 'number'
|
|
62
|
+
if (typeof contentUpdatedAt === 'number') {
|
|
64
63
|
try {
|
|
65
64
|
return new Date(contentUpdatedAt).toISOString();
|
|
66
65
|
} catch (_unused) {
|
|
@@ -377,7 +377,7 @@ export const deleteSyncedBlock = async ({
|
|
|
377
377
|
}
|
|
378
378
|
return;
|
|
379
379
|
}
|
|
380
|
-
const url = deleteReason
|
|
380
|
+
const url = deleteReason ? `${BLOCK_SERVICE_API_URL}/block/${encodeURIComponent(blockAri)}?deletionReason=${encodeURIComponent(deleteReason)}` : `${BLOCK_SERVICE_API_URL}/block/${encodeURIComponent(blockAri)}`;
|
|
381
381
|
const response = await fetchWithRetry(url, {
|
|
382
382
|
method: 'DELETE',
|
|
383
383
|
headers: COMMON_HEADERS
|
|
@@ -437,7 +437,7 @@ export const createSyncedBlock = async ({
|
|
|
437
437
|
if (fg('platform_synced_block_patch_1')) {
|
|
438
438
|
var _result$data4;
|
|
439
439
|
const bodyData = {
|
|
440
|
-
query: buildCreateBlockMutation(blockAri, blockInstanceId, content, product, sourceAri, stepVersion, status
|
|
440
|
+
query: buildCreateBlockMutation(blockAri, blockInstanceId, content, product, sourceAri, stepVersion, status),
|
|
441
441
|
operationName: CREATE_BLOCK_OPERATION_NAME
|
|
442
442
|
};
|
|
443
443
|
const response = await fetchWithRetry(GRAPHQL_ENDPOINT, {
|
|
@@ -467,7 +467,7 @@ export const createSyncedBlock = async ({
|
|
|
467
467
|
if (stepVersion !== undefined) {
|
|
468
468
|
requestBody.stepVersion = stepVersion;
|
|
469
469
|
}
|
|
470
|
-
if (status !== undefined
|
|
470
|
+
if (status !== undefined) {
|
|
471
471
|
requestBody.status = status;
|
|
472
472
|
}
|
|
473
473
|
const response = await fetchWithRetry(`${BLOCK_SERVICE_API_URL}/block`, {
|
|
@@ -494,9 +494,7 @@ export const updateReferenceSyncedBlockOnDocument = async ({
|
|
|
494
494
|
method: 'POST',
|
|
495
495
|
headers: COMMON_HEADERS,
|
|
496
496
|
body: JSON.stringify(bodyData),
|
|
497
|
-
|
|
498
|
-
keepalive: true
|
|
499
|
-
} : {})
|
|
497
|
+
keepalive: true
|
|
500
498
|
});
|
|
501
499
|
if (!response.ok) {
|
|
502
500
|
throw new BlockError(response.status);
|
|
@@ -520,9 +518,7 @@ export const updateReferenceSyncedBlockOnDocument = async ({
|
|
|
520
518
|
body: JSON.stringify({
|
|
521
519
|
blocks
|
|
522
520
|
}),
|
|
523
|
-
|
|
524
|
-
keepalive: true
|
|
525
|
-
} : {})
|
|
521
|
+
keepalive: true
|
|
526
522
|
});
|
|
527
523
|
if (!response.ok) {
|
|
528
524
|
throw new BlockError(response.status);
|
|
@@ -168,7 +168,7 @@ export const fetchConfluencePageInfoOld = async (pageAri, localId, fireAnalytics
|
|
|
168
168
|
return Promise.resolve(undefined);
|
|
169
169
|
}
|
|
170
170
|
};
|
|
171
|
-
export const
|
|
171
|
+
export const fetchConfluencePageInfo = async (pageAri, hasAccess, urlType, localId, isUnpublished) => {
|
|
172
172
|
// For unpublished pages, use the v2 pages API as GraphQL returns empty content.nodes
|
|
173
173
|
if (isUnpublished && fg('platform_synced_block_patch_1')) {
|
|
174
174
|
return await fetchUnpublishedConfluencePageInfo(pageAri, localId);
|
|
@@ -209,7 +209,4 @@ export const fetchConfluencePageInfoNew = async (pageAri, hasAccess, urlType, lo
|
|
|
209
209
|
} else {
|
|
210
210
|
return await resolveNoAccessPageInfo(pageAri);
|
|
211
211
|
}
|
|
212
|
-
};
|
|
213
|
-
export const fetchConfluencePageInfo = async (pageAri, hasAccess, urlType, localId, fireAnalyticsEvent, isUnpublished) => {
|
|
214
|
-
return fg('platform_synced_block_dogfooding') ? await fetchConfluencePageInfoNew(pageAri, hasAccess, urlType, localId, isUnpublished) : await fetchConfluencePageInfoOld(pageAri, localId, fireAnalyticsEvent);
|
|
215
212
|
};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
3
3
|
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
import { SyncBlockError } from '../common/types';
|
|
6
|
-
import { fetchErrorPayload } from '../utils/errorHandling';
|
|
7
5
|
import { createSyncBlockNode } from '../utils/utils';
|
|
8
|
-
export const useFetchSyncBlockData = (manager, resourceId, localId,
|
|
6
|
+
export const useFetchSyncBlockData = (manager, resourceId, localId, _fireAnalyticsEvent) => {
|
|
9
7
|
// Initialize both states from a single cache lookup to avoid race conditions.
|
|
10
8
|
// When a block is moved/remounted, the old component's cleanup may clear the cache
|
|
11
9
|
// before or after the new component mounts. By doing a single lookup, we ensure
|
|
@@ -44,17 +42,13 @@ export const useFetchSyncBlockData = (manager, resourceId, localId, fireAnalytic
|
|
|
44
42
|
// Fetch sync block data, the `subscribeToSyncBlock` will update the state once data is fetched
|
|
45
43
|
await manager.referenceManager.fetchSyncBlocksData([syncBlockNode]);
|
|
46
44
|
} catch (error) {
|
|
45
|
+
var _manager$referenceMan2, _manager$referenceMan3;
|
|
47
46
|
logException(error, {
|
|
48
47
|
location: 'editor-synced-block-provider/useFetchSyncBlockData'
|
|
49
48
|
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
reason: error.message
|
|
54
|
-
});
|
|
55
|
-
} else {
|
|
56
|
-
fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 ? void 0 : fireAnalyticsEvent(fetchErrorPayload(error.message));
|
|
57
|
-
}
|
|
49
|
+
manager === null || manager === void 0 ? void 0 : (_manager$referenceMan2 = manager.referenceManager) === null || _manager$referenceMan2 === void 0 ? void 0 : (_manager$referenceMan3 = _manager$referenceMan2.fetchExperience) === null || _manager$referenceMan3 === void 0 ? void 0 : _manager$referenceMan3.failure({
|
|
50
|
+
reason: error.message
|
|
51
|
+
});
|
|
58
52
|
|
|
59
53
|
// Set error state if fetching fails
|
|
60
54
|
setFetchState({
|
|
@@ -72,7 +66,7 @@ export const useFetchSyncBlockData = (manager, resourceId, localId, fireAnalytic
|
|
|
72
66
|
...prev,
|
|
73
67
|
isLoading: false
|
|
74
68
|
}));
|
|
75
|
-
}, [isLoading, localId, manager.referenceManager, resourceId
|
|
69
|
+
}, [isLoading, localId, manager.referenceManager, resourceId]);
|
|
76
70
|
useEffect(() => {
|
|
77
71
|
if (isSSR()) {
|
|
78
72
|
// in SSR, we don't need to subscribe to updates,
|
|
@@ -520,7 +520,7 @@ class BlockServiceADFWriteProvider {
|
|
|
520
520
|
resourceId
|
|
521
521
|
});
|
|
522
522
|
const stepVersion = this.getVersion ? await this.getVersion() : undefined;
|
|
523
|
-
const status = fg('platform_synced_block_patch_1') ? 'unpublished' :
|
|
523
|
+
const status = fg('platform_synced_block_patch_1') ? 'unpublished' : (_this$isParentUnpubli = this.isParentUnpublished) !== null && _this$isParentUnpubli !== void 0 && _this$isParentUnpubli.call(this) ? 'unpublished' : data.status || 'active';
|
|
524
524
|
try {
|
|
525
525
|
await createSyncedBlock({
|
|
526
526
|
blockAri,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { getProductFromSourceAri } from '../clients/block-service/ari';
|
|
5
4
|
import { getPageIdAndTypeFromConfluencePageAri } from '../clients/confluence/ari';
|
|
6
5
|
import { fetchConfluencePageInfo } from '../clients/confluence/sourceInfo';
|
|
@@ -63,30 +62,11 @@ export class SyncBlockProvider extends SyncBlockDataProvider {
|
|
|
63
62
|
if (blockIdentifiers.length === 0) {
|
|
64
63
|
return [];
|
|
65
64
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
// This allows loading states to be shown before errors, matching non-batch behavior
|
|
72
|
-
return Promise.allSettled(blockIdentifiers.map(blockIdentifier => {
|
|
73
|
-
return this.fetchProvider.fetchData(blockIdentifier.resourceId).then(data => {
|
|
74
|
-
return data;
|
|
75
|
-
}, () => {
|
|
76
|
-
return {
|
|
77
|
-
error: {
|
|
78
|
-
type: SyncBlockError.Errored
|
|
79
|
-
},
|
|
80
|
-
resourceId: blockIdentifier.resourceId
|
|
81
|
-
};
|
|
82
|
-
});
|
|
83
|
-
})).then(results => {
|
|
84
|
-
return results.filter(result => {
|
|
85
|
-
return result.status === 'fulfilled';
|
|
86
|
-
}).map(result => result.value);
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
} else {
|
|
65
|
+
try {
|
|
66
|
+
return await this.fetchProvider.batchFetchData(blockIdentifiers);
|
|
67
|
+
} catch {
|
|
68
|
+
// If batch fetch fails, fall back to individual fetch behavior
|
|
69
|
+
// This allows loading states to be shown before errors, matching non-batch behavior
|
|
90
70
|
return Promise.allSettled(blockIdentifiers.map(blockIdentifier => {
|
|
91
71
|
return this.fetchProvider.fetchData(blockIdentifier.resourceId).then(data => {
|
|
92
72
|
return data;
|
|
@@ -188,48 +168,36 @@ export class SyncBlockProvider extends SyncBlockDataProvider {
|
|
|
188
168
|
* @returns The source info
|
|
189
169
|
*/
|
|
190
170
|
async fetchSyncBlockSourceInfo(localId, sourceAri, sourceProduct, fireAnalyticsEvent, hasAccess = true, urlType = 'edit', isUnpublished) {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
var _this$writeProvider2;
|
|
195
|
-
ari = sourceAri !== null && sourceAri !== void 0 ? sourceAri : (_this$writeProvider2 = this.writeProvider) === null || _this$writeProvider2 === void 0 ? void 0 : _this$writeProvider2.parentAri;
|
|
196
|
-
product = sourceProduct !== null && sourceProduct !== void 0 ? sourceProduct : getProductFromSourceAri(ari);
|
|
197
|
-
}
|
|
171
|
+
var _this$writeProvider2, _this$writeProvider4;
|
|
172
|
+
const ari = sourceAri !== null && sourceAri !== void 0 ? sourceAri : (_this$writeProvider2 = this.writeProvider) === null || _this$writeProvider2 === void 0 ? void 0 : _this$writeProvider2.parentAri;
|
|
173
|
+
const product = sourceProduct !== null && sourceProduct !== void 0 ? sourceProduct : getProductFromSourceAri(ari);
|
|
198
174
|
if (!ari || !product) {
|
|
199
175
|
return Promise.reject(new Error('Source ari or source product is undefined'));
|
|
200
176
|
}
|
|
201
177
|
switch (product) {
|
|
202
178
|
case 'confluence-page':
|
|
203
179
|
{
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
var _this$writeProvider3;
|
|
207
|
-
if (!sourceInfo) {
|
|
208
|
-
return Promise.resolve(undefined);
|
|
209
|
-
}
|
|
210
|
-
return {
|
|
211
|
-
...sourceInfo,
|
|
212
|
-
onSameDocument: ((_this$writeProvider3 = this.writeProvider) === null || _this$writeProvider3 === void 0 ? void 0 : _this$writeProvider3.parentAri) === ari,
|
|
213
|
-
productType: product
|
|
214
|
-
};
|
|
215
|
-
} else {
|
|
216
|
-
return sourceInfo;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
case 'jira-work-item':
|
|
220
|
-
if (fg('platform_synced_block_dogfooding')) {
|
|
221
|
-
var _this$writeProvider4;
|
|
222
|
-
const sourceInfo = await fetchJiraWorkItemInfo(ari, hasAccess);
|
|
180
|
+
var _this$writeProvider3;
|
|
181
|
+
const sourceInfo = await fetchConfluencePageInfo(ari, hasAccess, urlType, localId, isUnpublished);
|
|
223
182
|
if (!sourceInfo) {
|
|
224
183
|
return Promise.resolve(undefined);
|
|
225
184
|
}
|
|
226
185
|
return {
|
|
227
186
|
...sourceInfo,
|
|
228
|
-
onSameDocument: ((_this$
|
|
187
|
+
onSameDocument: ((_this$writeProvider3 = this.writeProvider) === null || _this$writeProvider3 === void 0 ? void 0 : _this$writeProvider3.parentAri) === ari,
|
|
229
188
|
productType: product
|
|
230
189
|
};
|
|
231
190
|
}
|
|
232
|
-
|
|
191
|
+
case 'jira-work-item':
|
|
192
|
+
const sourceInfo = await fetchJiraWorkItemInfo(ari, hasAccess);
|
|
193
|
+
if (!sourceInfo) {
|
|
194
|
+
return Promise.resolve(undefined);
|
|
195
|
+
}
|
|
196
|
+
return {
|
|
197
|
+
...sourceInfo,
|
|
198
|
+
onSameDocument: ((_this$writeProvider4 = this.writeProvider) === null || _this$writeProvider4 === void 0 ? void 0 : _this$writeProvider4.parentAri) === ari,
|
|
199
|
+
productType: product
|
|
200
|
+
};
|
|
233
201
|
default:
|
|
234
202
|
return Promise.reject(new Error(`${product} source product not supported`));
|
|
235
203
|
}
|
|
@@ -171,7 +171,7 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
171
171
|
getInitialSyncBlockData(resourceId) {
|
|
172
172
|
var _this$dataProvider2, _this$dataProvider2$g;
|
|
173
173
|
const syncBlockNode = createSyncBlockNode('', resourceId);
|
|
174
|
-
if (isSSR()
|
|
174
|
+
if (isSSR() || fg('platform_synced_block_patch_1')) {
|
|
175
175
|
var _this$dataProvider, _this$dataProvider$ge;
|
|
176
176
|
// In SSR, prefer data from data provider cache
|
|
177
177
|
// should not take from store manager cache as it may be in incomplete state
|
|
@@ -317,17 +317,13 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
317
317
|
}
|
|
318
318
|
fetchSyncBlockSourceInfo(resourceId) {
|
|
319
319
|
try {
|
|
320
|
-
var _existingSyncBlock$da;
|
|
320
|
+
var _this$fetchSourceInfo, _existingSyncBlock$da;
|
|
321
321
|
if (!resourceId || !this.dataProvider) {
|
|
322
322
|
throw new Error('Data provider or resourceId not set');
|
|
323
323
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
return existingRequest;
|
|
328
|
-
}
|
|
329
|
-
} else if (this.syncBlockSourceInfoRequestsOld.get(resourceId)) {
|
|
330
|
-
return Promise.resolve(undefined);
|
|
324
|
+
const existingRequest = this.syncBlockSourceInfoRequests.get(resourceId);
|
|
325
|
+
if (existingRequest) {
|
|
326
|
+
return existingRequest;
|
|
331
327
|
}
|
|
332
328
|
const existingSyncBlock = this.getFromCache(resourceId);
|
|
333
329
|
if (!existingSyncBlock) {
|
|
@@ -344,28 +340,21 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
344
340
|
} = existingSyncBlock.data || {};
|
|
345
341
|
// skip if source URL and title are already present
|
|
346
342
|
if (sourceURL && sourceTitle) {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
});
|
|
356
|
-
} else {
|
|
357
|
-
return Promise.resolve(undefined);
|
|
358
|
-
}
|
|
343
|
+
return Promise.resolve({
|
|
344
|
+
title: sourceTitle,
|
|
345
|
+
url: sourceURL,
|
|
346
|
+
subType: sourceSubType,
|
|
347
|
+
sourceAri: sourceAri || '',
|
|
348
|
+
onSameDocument,
|
|
349
|
+
productType: product
|
|
350
|
+
});
|
|
359
351
|
}
|
|
360
352
|
if (!sourceAri || !product || !blockInstanceId) {
|
|
361
353
|
var _this$fireAnalyticsEv8;
|
|
362
354
|
(_this$fireAnalyticsEv8 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv8 === void 0 ? void 0 : _this$fireAnalyticsEv8.call(this, getSourceInfoErrorPayload('SourceAri, product or blockInstanceId missing', resourceId));
|
|
363
355
|
return Promise.resolve(undefined);
|
|
364
356
|
}
|
|
365
|
-
|
|
366
|
-
var _this$fetchSourceInfo;
|
|
367
|
-
(_this$fetchSourceInfo = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo === void 0 ? void 0 : _this$fetchSourceInfo.start({});
|
|
368
|
-
}
|
|
357
|
+
(_this$fetchSourceInfo = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo === void 0 ? void 0 : _this$fetchSourceInfo.start({});
|
|
369
358
|
|
|
370
359
|
// Only use unpublished endpoint if feature flag is enabled
|
|
371
360
|
const isUnpublished = fg('platform_synced_block_patch_1') && ((_existingSyncBlock$da = existingSyncBlock.data) === null || _existingSyncBlock$da === void 0 ? void 0 : _existingSyncBlock$da.status) === 'unpublished';
|
|
@@ -375,55 +364,40 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
375
364
|
// urlType
|
|
376
365
|
isUnpublished).then(sourceInfo => {
|
|
377
366
|
if (!sourceInfo) {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
(_this$fireAnalyticsEv9 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv9 === void 0 ? void 0 : _this$fireAnalyticsEv9.call(this, getSourceInfoErrorPayload('No source info returned', resourceId));
|
|
384
|
-
}
|
|
367
|
+
var _this$fetchSourceInfo2, _this$fireAnalyticsEv9;
|
|
368
|
+
(_this$fetchSourceInfo2 = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo2 === void 0 ? void 0 : _this$fetchSourceInfo2.failure({
|
|
369
|
+
reason: 'No source info returned'
|
|
370
|
+
});
|
|
371
|
+
(_this$fireAnalyticsEv9 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv9 === void 0 ? void 0 : _this$fireAnalyticsEv9.call(this, getSourceInfoErrorPayload('No source info returned', resourceId));
|
|
385
372
|
return undefined;
|
|
386
373
|
}
|
|
387
374
|
this.updateCacheWithSourceInfo(resourceId, sourceInfo);
|
|
388
375
|
if (sourceInfo.title) {
|
|
389
376
|
this.updateSourceTitleSubscriptions(resourceId, sourceInfo.title);
|
|
390
377
|
}
|
|
391
|
-
if (
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
reason: 'Missing title or url'
|
|
399
|
-
});
|
|
400
|
-
(_this$fireAnalyticsEv0 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv0 === void 0 ? void 0 : _this$fireAnalyticsEv0.call(this, getSourceInfoErrorPayload('Missing title or url', resourceId));
|
|
401
|
-
}
|
|
402
|
-
return sourceInfo;
|
|
403
|
-
}
|
|
404
|
-
}).catch(error => {
|
|
405
|
-
var _this$fireAnalyticsEv1;
|
|
406
|
-
if (fg('platform_synced_block_dogfooding')) {
|
|
407
|
-
var _this$fetchSourceInfo5;
|
|
408
|
-
(_this$fetchSourceInfo5 = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo5 === void 0 ? void 0 : _this$fetchSourceInfo5.failure({
|
|
409
|
-
reason: error.message
|
|
378
|
+
if (sourceInfo.title && sourceInfo.url) {
|
|
379
|
+
var _this$fetchSourceInfo3;
|
|
380
|
+
(_this$fetchSourceInfo3 = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo3 === void 0 ? void 0 : _this$fetchSourceInfo3.success();
|
|
381
|
+
} else {
|
|
382
|
+
var _this$fetchSourceInfo4, _this$fireAnalyticsEv0;
|
|
383
|
+
(_this$fetchSourceInfo4 = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo4 === void 0 ? void 0 : _this$fetchSourceInfo4.failure({
|
|
384
|
+
reason: 'Missing title or url'
|
|
410
385
|
});
|
|
386
|
+
(_this$fireAnalyticsEv0 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv0 === void 0 ? void 0 : _this$fireAnalyticsEv0.call(this, getSourceInfoErrorPayload('Missing title or url', resourceId));
|
|
411
387
|
}
|
|
388
|
+
return sourceInfo;
|
|
389
|
+
}).catch(error => {
|
|
390
|
+
var _this$fetchSourceInfo5, _this$fireAnalyticsEv1;
|
|
391
|
+
(_this$fetchSourceInfo5 = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo5 === void 0 ? void 0 : _this$fetchSourceInfo5.failure({
|
|
392
|
+
reason: error.message
|
|
393
|
+
});
|
|
412
394
|
(_this$fireAnalyticsEv1 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv1 === void 0 ? void 0 : _this$fireAnalyticsEv1.call(this, getSourceInfoErrorPayload(error.message, resourceId));
|
|
413
395
|
return undefined;
|
|
414
396
|
}).finally(() => {
|
|
415
|
-
|
|
416
|
-
this.syncBlockSourceInfoRequests.delete(resourceId);
|
|
417
|
-
} else {
|
|
418
|
-
this.syncBlockSourceInfoRequestsOld.delete(resourceId);
|
|
419
|
-
}
|
|
397
|
+
this.syncBlockSourceInfoRequests.delete(resourceId);
|
|
420
398
|
});
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
return sourceInfoPromise;
|
|
424
|
-
} else {
|
|
425
|
-
this.syncBlockSourceInfoRequestsOld.set(resourceId, true);
|
|
426
|
-
}
|
|
399
|
+
this.syncBlockSourceInfoRequests.set(resourceId, sourceInfoPromise);
|
|
400
|
+
return sourceInfoPromise;
|
|
427
401
|
} catch (error) {
|
|
428
402
|
var _this$fireAnalyticsEv10;
|
|
429
403
|
logException(error, {
|
|
@@ -440,6 +414,7 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
440
414
|
* @returns The fetched sync block data results
|
|
441
415
|
*/
|
|
442
416
|
async fetchSyncBlocksData(syncBlockNodes) {
|
|
417
|
+
var _this$fetchExperience;
|
|
443
418
|
if (syncBlockNodes.length === 0) {
|
|
444
419
|
return;
|
|
445
420
|
}
|
|
@@ -466,10 +441,7 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
466
441
|
nodesToFetch.forEach(node => {
|
|
467
442
|
this.syncBlockFetchDataRequests.set(node.attrs.resourceId, true);
|
|
468
443
|
});
|
|
469
|
-
|
|
470
|
-
var _this$fetchExperience;
|
|
471
|
-
(_this$fetchExperience = this.fetchExperience) === null || _this$fetchExperience === void 0 ? void 0 : _this$fetchExperience.start({});
|
|
472
|
-
}
|
|
444
|
+
(_this$fetchExperience = this.fetchExperience) === null || _this$fetchExperience === void 0 ? void 0 : _this$fetchExperience.start({});
|
|
473
445
|
const data = await this.dataProvider.fetchNodesData(nodesToFetch).finally(() => {
|
|
474
446
|
nodesToFetch.forEach(node => {
|
|
475
447
|
this.syncBlockFetchDataRequests.delete(node.attrs.resourceId);
|
|
@@ -490,7 +462,7 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
490
462
|
|
|
491
463
|
// Check if this is a newly added unpublished sync block and notify
|
|
492
464
|
// Only trigger for sync blocks that were just added (not refreshed or loaded on page init)
|
|
493
|
-
if (!syncBlockInstance.error && ((_resolvedSyncBlockIns = resolvedSyncBlockInstance.data) === null || _resolvedSyncBlockIns === void 0 ? void 0 : _resolvedSyncBlockIns.status) === 'unpublished' && this.newlyAddedSyncBlocks.has(syncBlockInstance.resourceId) && this.onUnpublishedSyncBlockDetected
|
|
465
|
+
if (!syncBlockInstance.error && ((_resolvedSyncBlockIns = resolvedSyncBlockInstance.data) === null || _resolvedSyncBlockIns === void 0 ? void 0 : _resolvedSyncBlockIns.status) === 'unpublished' && this.newlyAddedSyncBlocks.has(syncBlockInstance.resourceId) && this.onUnpublishedSyncBlockDetected) {
|
|
494
466
|
// Remove from newly added set after checking to prevent duplicate flags
|
|
495
467
|
this.newlyAddedSyncBlocks.delete(syncBlockInstance.resourceId);
|
|
496
468
|
this.onUnpublishedSyncBlockDetected(resolvedSyncBlockInstance.resourceId);
|
|
@@ -507,7 +479,7 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
507
479
|
hasUnexpectedError = true;
|
|
508
480
|
}
|
|
509
481
|
return;
|
|
510
|
-
} else
|
|
482
|
+
} else {
|
|
511
483
|
const callbacks = this.subscriptions.get(syncBlockInstance.resourceId);
|
|
512
484
|
const localIds = callbacks ? Object.keys(callbacks) : [];
|
|
513
485
|
localIds.forEach(localId => {
|
|
@@ -517,21 +489,19 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
517
489
|
}
|
|
518
490
|
this.fetchSyncBlockSourceInfo(resolvedSyncBlockInstance.resourceId);
|
|
519
491
|
});
|
|
520
|
-
if (
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
(_this$fetchExperience4 = this.fetchExperience) === null || _this$fetchExperience4 === void 0 ? void 0 : _this$fetchExperience4.success();
|
|
534
|
-
}
|
|
492
|
+
if (hasUnexpectedError) {
|
|
493
|
+
var _this$fetchExperience2;
|
|
494
|
+
(_this$fetchExperience2 = this.fetchExperience) === null || _this$fetchExperience2 === void 0 ? void 0 : _this$fetchExperience2.failure({
|
|
495
|
+
reason: 'Unexpected error during fetch'
|
|
496
|
+
});
|
|
497
|
+
} else if (hasExpectedError) {
|
|
498
|
+
var _this$fetchExperience3;
|
|
499
|
+
(_this$fetchExperience3 = this.fetchExperience) === null || _this$fetchExperience3 === void 0 ? void 0 : _this$fetchExperience3.abort({
|
|
500
|
+
reason: 'Expected error: NotFound or PermissionDenied'
|
|
501
|
+
});
|
|
502
|
+
} else {
|
|
503
|
+
var _this$fetchExperience4;
|
|
504
|
+
(_this$fetchExperience4 = this.fetchExperience) === null || _this$fetchExperience4 === void 0 ? void 0 : _this$fetchExperience4.success();
|
|
535
505
|
}
|
|
536
506
|
}
|
|
537
507
|
updateCacheWithSourceInfo(resourceId, sourceInfo) {
|
|
@@ -636,7 +606,7 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
636
606
|
|
|
637
607
|
// call the callback immediately if we have cached data
|
|
638
608
|
const cachedData = fg('platform_synced_block_patch_1') ? // When feature flag is enabled, use dataProvider cache only
|
|
639
|
-
(_this$dataProvider7 = this.dataProvider) === null || _this$dataProvider7 === void 0 ? void 0 : (_this$dataProvider7$g = _this$dataProvider7.getNodeDataFromCache(syncBlockNode)) === null || _this$dataProvider7$g === void 0 ? void 0 : _this$dataProvider7$g.data : isSSR()
|
|
609
|
+
(_this$dataProvider7 = this.dataProvider) === null || _this$dataProvider7 === void 0 ? void 0 : (_this$dataProvider7$g = _this$dataProvider7.getNodeDataFromCache(syncBlockNode)) === null || _this$dataProvider7$g === void 0 ? void 0 : _this$dataProvider7$g.data : isSSR() // in SSR, prefer data provider cache
|
|
640
610
|
? ((_this$dataProvider8 = this.dataProvider) === null || _this$dataProvider8 === void 0 ? void 0 : (_this$dataProvider8$g = _this$dataProvider8.getNodeDataFromCache(syncBlockNode)) === null || _this$dataProvider8$g === void 0 ? void 0 : _this$dataProvider8$g.data) || this.getFromCache(resourceId) : this.getFromCache(resourceId) || ((_this$dataProvider9 = this.dataProvider) === null || _this$dataProvider9 === void 0 ? void 0 : (_this$dataProvider9$g = _this$dataProvider9.getNodeDataFromCache(syncBlockNode)) === null || _this$dataProvider9$g === void 0 ? void 0 : _this$dataProvider9$g.data);
|
|
641
611
|
if (cachedData) {
|
|
642
612
|
callback(cachedData);
|
|
@@ -812,9 +782,6 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
812
782
|
return providerFactory;
|
|
813
783
|
}
|
|
814
784
|
getSSRProviders(resourceId) {
|
|
815
|
-
if (!fg('platform_synced_block_dogfooding')) {
|
|
816
|
-
return null;
|
|
817
|
-
}
|
|
818
785
|
if (!this.dataProvider) {
|
|
819
786
|
return null;
|
|
820
787
|
}
|
|
@@ -920,6 +887,7 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
920
887
|
}
|
|
921
888
|
let success = true;
|
|
922
889
|
try {
|
|
890
|
+
var _this$saveExperience;
|
|
923
891
|
const blocks = [];
|
|
924
892
|
|
|
925
893
|
// Collect all reference synced blocks on the current document
|
|
@@ -931,14 +899,6 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
931
899
|
});
|
|
932
900
|
});
|
|
933
901
|
});
|
|
934
|
-
if (!fg('platform_synced_block_dogfooding')) {
|
|
935
|
-
// It's possible that the last reference block on the document was just deleted,
|
|
936
|
-
// we still want to write to BE to update reference count
|
|
937
|
-
if (blocks.length === 0) {
|
|
938
|
-
this.isCacheDirty = false;
|
|
939
|
-
return true;
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
902
|
if (!this.dataProvider) {
|
|
943
903
|
throw new Error('Data provider not set');
|
|
944
904
|
}
|
|
@@ -949,40 +909,31 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
949
909
|
// is still making changes, the new changes might not be saved if they all happen
|
|
950
910
|
// exactly at a time when the updateReferenceData is being executed asynchronously.
|
|
951
911
|
this.isCacheDirty = false;
|
|
952
|
-
|
|
953
|
-
var _this$saveExperience;
|
|
954
|
-
(_this$saveExperience = this.saveExperience) === null || _this$saveExperience === void 0 ? void 0 : _this$saveExperience.start();
|
|
955
|
-
}
|
|
912
|
+
(_this$saveExperience = this.saveExperience) === null || _this$saveExperience === void 0 ? void 0 : _this$saveExperience.start();
|
|
956
913
|
const updateResult = await this.dataProvider.updateReferenceData(blocks);
|
|
957
914
|
if (!updateResult.success) {
|
|
958
|
-
var _this$fireAnalyticsEv19;
|
|
915
|
+
var _this$saveExperience2, _this$fireAnalyticsEv19;
|
|
959
916
|
success = false;
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
reason: updateResult.error || 'Failed to update reference synced blocks on the document'
|
|
964
|
-
});
|
|
965
|
-
}
|
|
917
|
+
(_this$saveExperience2 = this.saveExperience) === null || _this$saveExperience2 === void 0 ? void 0 : _this$saveExperience2.failure({
|
|
918
|
+
reason: updateResult.error || 'Failed to update reference synced blocks on the document'
|
|
919
|
+
});
|
|
966
920
|
(_this$fireAnalyticsEv19 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv19 === void 0 ? void 0 : _this$fireAnalyticsEv19.call(this, updateReferenceErrorPayload(updateResult.error || 'Failed to update reference synced blocks on the document'));
|
|
967
921
|
}
|
|
968
922
|
} catch (error) {
|
|
969
|
-
var _this$fireAnalyticsEv20;
|
|
923
|
+
var _this$saveExperience3, _this$fireAnalyticsEv20;
|
|
970
924
|
success = false;
|
|
971
925
|
logException(error, {
|
|
972
926
|
location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
|
|
973
927
|
});
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
reason: error.message
|
|
978
|
-
});
|
|
979
|
-
}
|
|
928
|
+
(_this$saveExperience3 = this.saveExperience) === null || _this$saveExperience3 === void 0 ? void 0 : _this$saveExperience3.failure({
|
|
929
|
+
reason: error.message
|
|
930
|
+
});
|
|
980
931
|
(_this$fireAnalyticsEv20 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv20 === void 0 ? void 0 : _this$fireAnalyticsEv20.call(this, updateReferenceErrorPayload(error.message));
|
|
981
932
|
} finally {
|
|
982
933
|
if (!success) {
|
|
983
934
|
// set isCacheDirty back to true for cases where it failed to update the reference synced blocks on the BE
|
|
984
935
|
this.isCacheDirty = true;
|
|
985
|
-
} else
|
|
936
|
+
} else {
|
|
986
937
|
var _this$saveExperience4;
|
|
987
938
|
(_this$saveExperience4 = this.saveExperience) === null || _this$saveExperience4 === void 0 ? void 0 : _this$saveExperience4.success();
|
|
988
939
|
}
|