@atlaskit/editor-synced-block-provider 6.6.2 → 6.6.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 +9 -0
- package/dist/cjs/clients/jira/sourceInfo.js +18 -40
- package/dist/cjs/entry-points/utils.js +0 -6
- package/dist/cjs/hooks/useFetchSyncBlockData.js +1 -1
- package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +4 -7
- package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +14 -14
- package/dist/cjs/store-manager/syncBlockBatchFetcher.js +1 -1
- package/dist/cjs/store-manager/syncBlockProviderFactoryManager.js +3 -3
- package/dist/cjs/store-manager/syncBlockStoreManager.js +1 -1
- package/dist/cjs/store-manager/syncBlockSubscriptionManager.js +3 -6
- package/dist/cjs/utils/utils.js +1 -13
- package/dist/es2019/clients/jira/sourceInfo.js +27 -48
- package/dist/es2019/entry-points/utils.js +1 -1
- package/dist/es2019/hooks/useFetchSyncBlockData.js +2 -2
- package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +5 -8
- package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +15 -15
- package/dist/es2019/store-manager/syncBlockBatchFetcher.js +2 -2
- package/dist/es2019/store-manager/syncBlockProviderFactoryManager.js +4 -4
- package/dist/es2019/store-manager/syncBlockStoreManager.js +2 -2
- package/dist/es2019/store-manager/syncBlockSubscriptionManager.js +4 -7
- package/dist/es2019/utils/utils.js +0 -10
- package/dist/esm/clients/jira/sourceInfo.js +19 -40
- package/dist/esm/entry-points/utils.js +1 -1
- package/dist/esm/hooks/useFetchSyncBlockData.js +2 -2
- package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +5 -8
- package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +15 -15
- package/dist/esm/store-manager/syncBlockBatchFetcher.js +2 -2
- package/dist/esm/store-manager/syncBlockProviderFactoryManager.js +4 -4
- package/dist/esm/store-manager/syncBlockStoreManager.js +2 -2
- package/dist/esm/store-manager/syncBlockSubscriptionManager.js +4 -7
- package/dist/esm/utils/utils.js +0 -12
- package/dist/types/entry-points/utils.d.ts +1 -1
- package/dist/types/utils/utils.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/utils.d.ts +1 -1
- package/dist/types-ts4.5/utils/utils.d.ts +0 -1
- package/package.json +1 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-synced-block-provider
|
|
2
2
|
|
|
3
|
+
## 6.6.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`cec76b6d3aeaa`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cec76b6d3aeaa) -
|
|
8
|
+
Cleanup feature gate `platform_synced_block_patch_11`. Jira work-item issue-type icons,
|
|
9
|
+
product-specific copy, and Relay environment initialisation are now permanently enabled.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 6.6.2
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -8,7 +8,6 @@ exports.fetchJiraWorkItemInfo = void 0;
|
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
11
|
var _retry = require("../../utils/retry");
|
|
13
12
|
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; }
|
|
14
13
|
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; } /* eslint-disable require-unicode-regexp */
|
|
@@ -26,11 +25,9 @@ var GET_SOURCE_INFO_OPERATION_NAME = 'EDITOR_SYNCED_BLOCK_GET_SOURCE_INFO';
|
|
|
26
25
|
* @param id - the ID of the work item
|
|
27
26
|
* @returns url of the work item
|
|
28
27
|
*/
|
|
29
|
-
// `issueType` is requested
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
// by `platform_synced_block_patch_11` below.
|
|
33
|
-
var GET_SOURCE_INFO_QUERY = "query ".concat(GET_SOURCE_INFO_OPERATION_NAME, " ($id: ID!) {\n jira {\n issueById(id: $id) {\n id\n webUrl\n summary\n issueType {\n name\n avatar {\n xsmall\n }\n }\n }\n }}");
|
|
28
|
+
// `issueType` is requested alongside `summary` and `webUrl` so the
|
|
29
|
+
// SyncedLocationDropdown can render the correct ADS issue-type icon.
|
|
30
|
+
var GET_SOURCE_INFO_QUERY = "query ".concat(GET_SOURCE_INFO_OPERATION_NAME, " ($id: ID!) {\n jira {\n\tissueById(id: $id) {\n\tid\n\twebUrl\n\tsummary\n\tissueType {\n\t\tname\n\t\tavatar {\n\t\txsmall\n\t\t}\n\t}\n\t}\n }}");
|
|
34
31
|
var getJiraWorkItemSourceInfo = /*#__PURE__*/function () {
|
|
35
32
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(ari) {
|
|
36
33
|
var bodyData, response;
|
|
@@ -141,59 +138,40 @@ var resolveNoAccessWorkItemInfo = /*#__PURE__*/function () {
|
|
|
141
138
|
*/
|
|
142
139
|
var fetchJiraWorkItemInfo = exports.fetchJiraWorkItemInfo = /*#__PURE__*/function () {
|
|
143
140
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(workItemAri, hasAccess) {
|
|
144
|
-
var _response$data, _contentData$
|
|
141
|
+
var _response$data, _contentData$issueTyp, _contentData$issueTyp2, response, contentData, webUrl, summary, issueTypeName, issueType;
|
|
145
142
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
146
143
|
while (1) switch (_context3.prev = _context3.next) {
|
|
147
144
|
case 0:
|
|
148
145
|
if (!hasAccess) {
|
|
149
|
-
_context3.next =
|
|
146
|
+
_context3.next = 12;
|
|
150
147
|
break;
|
|
151
148
|
}
|
|
152
149
|
_context3.next = 3;
|
|
153
150
|
return getJiraWorkItemSourceInfo(workItemAri);
|
|
154
151
|
case 3:
|
|
155
152
|
response = _context3.sent;
|
|
156
|
-
contentData = (_response$data = response.data) === null || _response$data === void 0 || (_response$data = _response$data.jira) === null || _response$data === void 0 ? void 0 : _response$data.issueById;
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
//
|
|
160
|
-
//
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
_context3.next = 12;
|
|
164
|
-
break;
|
|
165
|
-
}
|
|
166
|
-
_webUrl = typeof (contentData === null || contentData === void 0 ? void 0 : contentData.webUrl) === 'string' ? contentData.webUrl : undefined;
|
|
167
|
-
_summary = typeof (contentData === null || contentData === void 0 ? void 0 : contentData.summary) === 'string' ? contentData.summary : undefined; // Surface issue-type metadata so consumers can render the correct ADS issue-type
|
|
168
|
-
// icon. Defensive narrowing mirrors the webUrl/summary treatment above: only
|
|
169
|
-
// surfaced when `name` is a non-empty string; AGG values like `{ name: null }`
|
|
170
|
-
// collapse back to `undefined`.
|
|
171
|
-
rawIssueType = contentData === null || contentData === void 0 ? void 0 : contentData.issueType;
|
|
172
|
-
issueTypeName = typeof (rawIssueType === null || rawIssueType === void 0 ? void 0 : rawIssueType.name) === 'string' && rawIssueType.name.length > 0 ? rawIssueType.name : undefined;
|
|
173
|
-
issueType = issueTypeName ? {
|
|
153
|
+
contentData = (_response$data = response.data) === null || _response$data === void 0 || (_response$data = _response$data.jira) === null || _response$data === void 0 ? void 0 : _response$data.issueById;
|
|
154
|
+
webUrl = typeof (contentData === null || contentData === void 0 ? void 0 : contentData.webUrl) === 'string' ? contentData.webUrl : undefined;
|
|
155
|
+
summary = typeof (contentData === null || contentData === void 0 ? void 0 : contentData.summary) === 'string' ? contentData.summary : undefined; // Surface issue-type metadata for the SyncedLocationDropdown's ADS icon.
|
|
156
|
+
// Defensive narrowing: only surface when `name` is a non-empty string;
|
|
157
|
+
// AGG values like `{ name: null }` collapse back to `undefined`.
|
|
158
|
+
issueTypeName = contentData === null || contentData === void 0 || (_contentData$issueTyp = contentData.issueType) === null || _contentData$issueTyp === void 0 ? void 0 : _contentData$issueTyp.name;
|
|
159
|
+
issueType = typeof issueTypeName === 'string' && issueTypeName.length > 0 ? {
|
|
174
160
|
name: issueTypeName,
|
|
175
|
-
iconUrl: typeof (
|
|
161
|
+
iconUrl: typeof (contentData === null || contentData === void 0 || (_contentData$issueTyp2 = contentData.issueType) === null || _contentData$issueTyp2 === void 0 || (_contentData$issueTyp2 = _contentData$issueTyp2.avatar) === null || _contentData$issueTyp2 === void 0 ? void 0 : _contentData$issueTyp2.xsmall) === 'string' ? contentData.issueType.avatar.xsmall : undefined
|
|
176
162
|
} : undefined;
|
|
177
163
|
return _context3.abrupt("return", Promise.resolve({
|
|
178
|
-
url:
|
|
164
|
+
url: webUrl,
|
|
179
165
|
sourceAri: workItemAri,
|
|
180
|
-
title:
|
|
166
|
+
title: summary,
|
|
181
167
|
issueType: issueType
|
|
182
168
|
}));
|
|
183
169
|
case 12:
|
|
184
|
-
|
|
185
|
-
summary = (_contentData$summary = contentData === null || contentData === void 0 ? void 0 : contentData.summary) !== null && _contentData$summary !== void 0 ? _contentData$summary : undefined;
|
|
186
|
-
return _context3.abrupt("return", Promise.resolve({
|
|
187
|
-
url: webUrl,
|
|
188
|
-
sourceAri: workItemAri,
|
|
189
|
-
title: summary
|
|
190
|
-
}));
|
|
191
|
-
case 17:
|
|
192
|
-
_context3.next = 19;
|
|
170
|
+
_context3.next = 14;
|
|
193
171
|
return resolveNoAccessWorkItemInfo(workItemAri);
|
|
194
|
-
case
|
|
172
|
+
case 14:
|
|
195
173
|
return _context3.abrupt("return", _context3.sent);
|
|
196
|
-
case
|
|
174
|
+
case 15:
|
|
197
175
|
case "end":
|
|
198
176
|
return _context3.stop();
|
|
199
177
|
}
|
|
@@ -51,10 +51,4 @@ Object.defineProperty(exports, "getSourceProductFromResourceIdSafe", {
|
|
|
51
51
|
return _utils.getSourceProductFromResourceIdSafe;
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
|
-
Object.defineProperty(exports, "productAttrIfGateOn", {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function get() {
|
|
57
|
-
return _utils.productAttrIfGateOn;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
54
|
var _utils = require("../utils/utils");
|
|
@@ -78,7 +78,7 @@ var useFetchSyncBlockData = exports.useFetchSyncBlockData = function useFetchSyn
|
|
|
78
78
|
(0, _monitoring.logException)(_context.t0, {
|
|
79
79
|
location: 'editor-synced-block-provider/useFetchSyncBlockData'
|
|
80
80
|
});
|
|
81
|
-
fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent((0, _errorHandling.fetchErrorPayload)(_context.t0.message, resourceId, (0, _utils.
|
|
81
|
+
fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent((0, _errorHandling.fetchErrorPayload)(_context.t0.message, resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId)));
|
|
82
82
|
|
|
83
83
|
// Set error state if fetching fails
|
|
84
84
|
setFetchState({
|
|
@@ -13,7 +13,6 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
13
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
14
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
15
15
|
var _monitoring = require("@atlaskit/editor-common/monitoring");
|
|
16
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
16
|
var _types = require("../common/types");
|
|
18
17
|
var _errorHandling = require("../utils/errorHandling");
|
|
19
18
|
var _experienceTracking = require("../utils/experienceTracking");
|
|
@@ -318,7 +317,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
318
317
|
// Derive once per call so we don't re-parse on every analytics event below.
|
|
319
318
|
// `product` from cached data is preferred when available; fall back to parsing
|
|
320
319
|
// the resourceId.
|
|
321
|
-
var sourceProduct =
|
|
320
|
+
var sourceProduct = product !== null && product !== void 0 ? product : (0, _utils.getSourceProductFromResourceIdSafe)(resourceId);
|
|
322
321
|
if (!sourceAri || !product || !blockInstanceId) {
|
|
323
322
|
var _this$fireAnalyticsEv3;
|
|
324
323
|
(_this$fireAnalyticsEv3 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv3 === void 0 || _this$fireAnalyticsEv3.call(this, (0, _errorHandling.getSourceInfoErrorPayload)('SourceAri, product or blockInstanceId missing', resourceId, sourceProduct));
|
|
@@ -367,7 +366,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
367
366
|
(0, _monitoring.logException)(error, {
|
|
368
367
|
location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
|
|
369
368
|
});
|
|
370
|
-
(_this$fireAnalyticsEv4 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv4 === void 0 || _this$fireAnalyticsEv4.call(this, (0, _errorHandling.getSourceInfoErrorPayload)(error.message, resourceId, (0, _utils.
|
|
369
|
+
(_this$fireAnalyticsEv4 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv4 === void 0 || _this$fireAnalyticsEv4.call(this, (0, _errorHandling.getSourceInfoErrorPayload)(error.message, resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId)));
|
|
371
370
|
}
|
|
372
371
|
return Promise.resolve(undefined);
|
|
373
372
|
}
|
|
@@ -562,7 +561,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
562
561
|
}
|
|
563
562
|
if (syncBlockInstance.error) {
|
|
564
563
|
var _this5$fireAnalyticsE2, _syncBlockInstance$da, _syncBlockInstance$da2;
|
|
565
|
-
(_this5$fireAnalyticsE2 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE2 === void 0 || _this5$fireAnalyticsE2.call(_this5, (0, _errorHandling.fetchErrorPayload)(syncBlockInstance.error.reason || syncBlockInstance.error.type, syncBlockInstance.resourceId, (
|
|
564
|
+
(_this5$fireAnalyticsE2 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE2 === void 0 || _this5$fireAnalyticsE2.call(_this5, (0, _errorHandling.fetchErrorPayload)(syncBlockInstance.error.reason || syncBlockInstance.error.type, syncBlockInstance.resourceId, (_syncBlockInstance$da = (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.product) !== null && _syncBlockInstance$da !== void 0 ? _syncBlockInstance$da : (0, _utils.getSourceProductFromResourceIdSafe)(syncBlockInstance.resourceId)));
|
|
566
565
|
if (syncBlockInstance.error.type === _types.SyncBlockError.NotFound || syncBlockInstance.error.type === _types.SyncBlockError.Forbidden) {
|
|
567
566
|
hasExpectedError = true;
|
|
568
567
|
} else if (syncBlockInstance.error) {
|
|
@@ -574,9 +573,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
574
573
|
var localIds = callbacks ? Object.keys(callbacks) : [];
|
|
575
574
|
localIds.forEach(function (localId) {
|
|
576
575
|
var _this5$fireAnalyticsE3, _syncBlockInstance$da3, _syncBlockInstance$da4;
|
|
577
|
-
(_this5$fireAnalyticsE3 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE3 === void 0 || _this5$fireAnalyticsE3.call(_this5, (0, _errorHandling.fetchSuccessPayload)(syncBlockInstance.resourceId, localId,
|
|
578
|
-
// Prefer cached product when available; fall back to parsing the resourceId.
|
|
579
|
-
(0, _platformFeatureFlags.fg)('platform_synced_block_patch_11') ? (_syncBlockInstance$da3 = (_syncBlockInstance$da4 = syncBlockInstance.data) === null || _syncBlockInstance$da4 === void 0 ? void 0 : _syncBlockInstance$da4.product) !== null && _syncBlockInstance$da3 !== void 0 ? _syncBlockInstance$da3 : (0, _utils.getSourceProductFromResourceIdSafe)(syncBlockInstance.resourceId) : undefined));
|
|
576
|
+
(_this5$fireAnalyticsE3 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE3 === void 0 || _this5$fireAnalyticsE3.call(_this5, (0, _errorHandling.fetchSuccessPayload)(syncBlockInstance.resourceId, localId, (_syncBlockInstance$da3 = (_syncBlockInstance$da4 = syncBlockInstance.data) === null || _syncBlockInstance$da4 === void 0 ? void 0 : _syncBlockInstance$da4.product) !== null && _syncBlockInstance$da3 !== void 0 ? _syncBlockInstance$da3 : (0, _utils.getSourceProductFromResourceIdSafe)(syncBlockInstance.resourceId)));
|
|
580
577
|
});
|
|
581
578
|
_this5.fetchSyncBlockSourceInfo(resolvedSyncBlockInstance.resourceId);
|
|
582
579
|
});
|
|
@@ -119,7 +119,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
119
119
|
});
|
|
120
120
|
// We can derive the product from `syncBlockNode.attrs.resourceId` even though
|
|
121
121
|
// the variable wasn't destructured (the destructuring step itself may have thrown).
|
|
122
|
-
(_this$fireAnalyticsEv = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv === void 0 || _this$fireAnalyticsEv.call(this, (0, _errorHandling.updateCacheErrorPayload)(error.message, syncBlockNode === null || syncBlockNode === void 0 || (_syncBlockNode$attrs2 = syncBlockNode.attrs) === null || _syncBlockNode$attrs2 === void 0 ? void 0 : _syncBlockNode$attrs2.resourceId, (0, _utils.
|
|
122
|
+
(_this$fireAnalyticsEv = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv === void 0 || _this$fireAnalyticsEv.call(this, (0, _errorHandling.updateCacheErrorPayload)(error.message, syncBlockNode === null || syncBlockNode === void 0 || (_syncBlockNode$attrs2 = syncBlockNode.attrs) === null || _syncBlockNode$attrs2 === void 0 ? void 0 : _syncBlockNode$attrs2.resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(syncBlockNode === null || syncBlockNode === void 0 || (_syncBlockNode$attrs3 = syncBlockNode.attrs) === null || _syncBlockNode$attrs3 === void 0 ? void 0 : _syncBlockNode$attrs3.resourceId)));
|
|
123
123
|
return false;
|
|
124
124
|
}
|
|
125
125
|
}
|
|
@@ -214,7 +214,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
214
214
|
if (cachedData && result.status) {
|
|
215
215
|
cachedData.status = result.status;
|
|
216
216
|
}
|
|
217
|
-
(_this2$fireAnalyticsE = _this2.fireAnalyticsEvent) === null || _this2$fireAnalyticsE === void 0 || _this2$fireAnalyticsE.call(_this2, (0, _errorHandling.updateSuccessPayload)(result.resourceId, false, (0, _utils.
|
|
217
|
+
(_this2$fireAnalyticsE = _this2.fireAnalyticsEvent) === null || _this2$fireAnalyticsE === void 0 || _this2$fireAnalyticsE.call(_this2, (0, _errorHandling.updateSuccessPayload)(result.resourceId, false, (0, _utils.getSourceProductFromResourceIdSafe)(result.resourceId)));
|
|
218
218
|
}
|
|
219
219
|
});
|
|
220
220
|
return _context.abrupt("return", true);
|
|
@@ -224,7 +224,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
224
224
|
return !result.resourceId || result.error;
|
|
225
225
|
}).forEach(function (result) {
|
|
226
226
|
var _this2$fireAnalyticsE2;
|
|
227
|
-
(_this2$fireAnalyticsE2 = _this2.fireAnalyticsEvent) === null || _this2$fireAnalyticsE2 === void 0 || _this2$fireAnalyticsE2.call(_this2, (0, _errorHandling.updateErrorPayload)(result.error || 'Failed to write data', result.resourceId, (0, _utils.
|
|
227
|
+
(_this2$fireAnalyticsE2 = _this2.fireAnalyticsEvent) === null || _this2$fireAnalyticsE2 === void 0 || _this2$fireAnalyticsE2.call(_this2, (0, _errorHandling.updateErrorPayload)(result.error || 'Failed to write data', result.resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(result.resourceId)));
|
|
228
228
|
});
|
|
229
229
|
return _context.abrupt("return", false);
|
|
230
230
|
case 24:
|
|
@@ -310,16 +310,16 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
310
310
|
}
|
|
311
311
|
} else {
|
|
312
312
|
var _this$fireAnalyticsEv3;
|
|
313
|
-
(_this$fireAnalyticsEv3 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv3 === void 0 || _this$fireAnalyticsEv3.call(this, (0, _errorHandling.createErrorPayload)('creation complete callback missing', resourceId, (0, _utils.
|
|
313
|
+
(_this$fireAnalyticsEv3 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv3 === void 0 || _this$fireAnalyticsEv3.call(this, (0, _errorHandling.createErrorPayload)('creation complete callback missing', resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId)));
|
|
314
314
|
}
|
|
315
315
|
if (success) {
|
|
316
316
|
var _this$fireAnalyticsEv4;
|
|
317
|
-
(_this$fireAnalyticsEv4 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv4 === void 0 || _this$fireAnalyticsEv4.call(this, (0, _errorHandling.createSuccessPayload)(resourceId || '', (0, _utils.
|
|
317
|
+
(_this$fireAnalyticsEv4 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv4 === void 0 || _this$fireAnalyticsEv4.call(this, (0, _errorHandling.createSuccessPayload)(resourceId || '', (0, _utils.getSourceProductFromResourceIdSafe)(resourceId)));
|
|
318
318
|
} else {
|
|
319
319
|
var _this$fireAnalyticsEv5;
|
|
320
320
|
// Delete the node from cache if fail to create so it's not flushed to BE
|
|
321
321
|
this.syncBlockCache.delete(resourceId || '');
|
|
322
|
-
(_this$fireAnalyticsEv5 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv5 === void 0 || _this$fireAnalyticsEv5.call(this, (0, _errorHandling.createErrorPayload)('Fail to create bodied sync block', resourceId, (0, _utils.
|
|
322
|
+
(_this$fireAnalyticsEv5 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv5 === void 0 || _this$fireAnalyticsEv5.call(this, (0, _errorHandling.createErrorPayload)('Fail to create bodied sync block', resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId)));
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
}, {
|
|
@@ -402,7 +402,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
402
402
|
(_this4$createExperien2 = _this4.createExperience) === null || _this4$createExperien2 === void 0 || _this4$createExperien2.failure({
|
|
403
403
|
reason: result.error || 'Failed to create bodied sync block'
|
|
404
404
|
});
|
|
405
|
-
(_this4$fireAnalyticsE = _this4.fireAnalyticsEvent) === null || _this4$fireAnalyticsE === void 0 || _this4$fireAnalyticsE.call(_this4, (0, _errorHandling.createErrorPayload)(result.error || 'Failed to create bodied sync block', resourceId, (0, _utils.
|
|
405
|
+
(_this4$fireAnalyticsE = _this4.fireAnalyticsEvent) === null || _this4$fireAnalyticsE === void 0 || _this4$fireAnalyticsE.call(_this4, (0, _errorHandling.createErrorPayload)(result.error || 'Failed to create bodied sync block', resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId)));
|
|
406
406
|
}
|
|
407
407
|
}).catch(function (error) {
|
|
408
408
|
var _this4$createExperien3, _this4$fireAnalyticsE2;
|
|
@@ -413,7 +413,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
413
413
|
(_this4$createExperien3 = _this4.createExperience) === null || _this4$createExperien3 === void 0 || _this4$createExperien3.failure({
|
|
414
414
|
reason: error.message
|
|
415
415
|
});
|
|
416
|
-
(_this4$fireAnalyticsE2 = _this4.fireAnalyticsEvent) === null || _this4$fireAnalyticsE2 === void 0 || _this4$fireAnalyticsE2.call(_this4, (0, _errorHandling.createErrorPayload)(error.message, resourceId, (0, _utils.
|
|
416
|
+
(_this4$fireAnalyticsE2 = _this4.fireAnalyticsEvent) === null || _this4$fireAnalyticsE2 === void 0 || _this4$fireAnalyticsE2.call(_this4, (0, _errorHandling.createErrorPayload)(error.message, resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId)));
|
|
417
417
|
});
|
|
418
418
|
} catch (error) {
|
|
419
419
|
var _this$fireAnalyticsEv6;
|
|
@@ -423,7 +423,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
423
423
|
(0, _monitoring.logException)(error, {
|
|
424
424
|
location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
|
|
425
425
|
});
|
|
426
|
-
(_this$fireAnalyticsEv6 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv6 === void 0 || _this$fireAnalyticsEv6.call(this, (0, _errorHandling.createErrorPayload)(error.message, resourceId, (0, _utils.
|
|
426
|
+
(_this$fireAnalyticsEv6 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv6 === void 0 || _this$fireAnalyticsEv6.call(this, (0, _errorHandling.createErrorPayload)(error.message, resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId)));
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
429
|
}, {
|
|
@@ -471,7 +471,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
471
471
|
(_this$deleteExperienc2 = this.deleteExperience) === null || _this$deleteExperienc2 === void 0 || _this$deleteExperienc2.success();
|
|
472
472
|
results.forEach(function (result) {
|
|
473
473
|
var _this5$fireAnalyticsE;
|
|
474
|
-
(_this5$fireAnalyticsE = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE === void 0 || _this5$fireAnalyticsE.call(_this5, (0, _errorHandling.deleteSuccessPayload)(result.resourceId, (0, _utils.
|
|
474
|
+
(_this5$fireAnalyticsE = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE === void 0 || _this5$fireAnalyticsE.call(_this5, (0, _errorHandling.deleteSuccessPayload)(result.resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(result.resourceId)));
|
|
475
475
|
});
|
|
476
476
|
} else {
|
|
477
477
|
callback = function callback(Ids) {
|
|
@@ -481,10 +481,10 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
481
481
|
results.forEach(function (result) {
|
|
482
482
|
if (result.success) {
|
|
483
483
|
var _this5$fireAnalyticsE2;
|
|
484
|
-
(_this5$fireAnalyticsE2 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE2 === void 0 || _this5$fireAnalyticsE2.call(_this5, (0, _errorHandling.deleteSuccessPayload)(result.resourceId, (0, _utils.
|
|
484
|
+
(_this5$fireAnalyticsE2 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE2 === void 0 || _this5$fireAnalyticsE2.call(_this5, (0, _errorHandling.deleteSuccessPayload)(result.resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(result.resourceId)));
|
|
485
485
|
} else {
|
|
486
486
|
var _this5$fireAnalyticsE3;
|
|
487
|
-
(_this5$fireAnalyticsE3 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE3 === void 0 || _this5$fireAnalyticsE3.call(_this5, (0, _errorHandling.deleteErrorPayload)(result.error || 'Failed to delete synced block', result.resourceId, (0, _utils.
|
|
487
|
+
(_this5$fireAnalyticsE3 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE3 === void 0 || _this5$fireAnalyticsE3.call(_this5, (0, _errorHandling.deleteErrorPayload)(result.error || 'Failed to delete synced block', result.resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(result.resourceId)));
|
|
488
488
|
}
|
|
489
489
|
});
|
|
490
490
|
}
|
|
@@ -496,7 +496,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
496
496
|
syncBlockIds.forEach(function (Ids) {
|
|
497
497
|
var _this5$fireAnalyticsE4;
|
|
498
498
|
_this5.setPendingDeletion(Ids, false);
|
|
499
|
-
(_this5$fireAnalyticsE4 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE4 === void 0 || _this5$fireAnalyticsE4.call(_this5, (0, _errorHandling.deleteErrorPayload)(_context2.t0.message, Ids.resourceId, (0, _utils.
|
|
499
|
+
(_this5$fireAnalyticsE4 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE4 === void 0 || _this5$fireAnalyticsE4.call(_this5, (0, _errorHandling.deleteErrorPayload)(_context2.t0.message, Ids.resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(Ids.resourceId)));
|
|
500
500
|
});
|
|
501
501
|
(0, _monitoring.logException)(_context2.t0, {
|
|
502
502
|
location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
|
|
@@ -787,7 +787,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
787
787
|
(0, _monitoring.logException)(error, {
|
|
788
788
|
location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
|
|
789
789
|
});
|
|
790
|
-
(_this$fireAnalyticsEv8 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv8 === void 0 || _this$fireAnalyticsEv8.call(this, (0, _errorHandling.fetchReferencesErrorPayload)(error.message, resourceId, (0, _utils.
|
|
790
|
+
(_this$fireAnalyticsEv8 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv8 === void 0 || _this$fireAnalyticsEv8.call(this, (0, _errorHandling.fetchReferencesErrorPayload)(error.message, resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId)));
|
|
791
791
|
return Promise.resolve({
|
|
792
792
|
error: _types.SyncBlockError.Errored
|
|
793
793
|
});
|
|
@@ -40,7 +40,7 @@ var SyncBlockBatchFetcher = exports.SyncBlockBatchFetcher = /*#__PURE__*/functio
|
|
|
40
40
|
});
|
|
41
41
|
resourceIds.forEach(function (resId) {
|
|
42
42
|
var _this$deps$getFireAna;
|
|
43
|
-
(_this$deps$getFireAna = _this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna === void 0 || _this$deps$getFireAna((0, _errorHandling.fetchErrorPayload)(error.message, resId, (0, _utils.
|
|
43
|
+
(_this$deps$getFireAna = _this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna === void 0 || _this$deps$getFireAna((0, _errorHandling.fetchErrorPayload)(error.message, resId, (0, _utils.getSourceProductFromResourceIdSafe)(resId)));
|
|
44
44
|
});
|
|
45
45
|
});
|
|
46
46
|
});
|
|
@@ -33,7 +33,7 @@ var SyncBlockProviderFactoryManager = exports.SyncBlockProviderFactoryManager =
|
|
|
33
33
|
(0, _monitoring.logException)(error, {
|
|
34
34
|
location: 'editor-synced-block-provider/syncBlockProviderFactoryManager'
|
|
35
35
|
});
|
|
36
|
-
(_this$deps$getFireAna = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna === void 0 || _this$deps$getFireAna((0, _errorHandling.fetchErrorPayload)(error.message, resourceId, (0, _utils.
|
|
36
|
+
(_this$deps$getFireAna = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna === void 0 || _this$deps$getFireAna((0, _errorHandling.fetchErrorPayload)(error.message, resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId)));
|
|
37
37
|
return undefined;
|
|
38
38
|
}
|
|
39
39
|
var _dataProvider$getSync = dataProvider.getSyncedBlockRendererProviderOptions(),
|
|
@@ -66,7 +66,7 @@ var SyncBlockProviderFactoryManager = exports.SyncBlockProviderFactoryManager =
|
|
|
66
66
|
(0, _monitoring.logException)(error, {
|
|
67
67
|
location: 'editor-synced-block-provider/syncBlockProviderFactoryManager'
|
|
68
68
|
});
|
|
69
|
-
(_this$deps$getFireAna2 = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna2 === void 0 || _this$deps$getFireAna2((0, _errorHandling.fetchErrorPayload)(error.message, resourceId, (0, _utils.
|
|
69
|
+
(_this$deps$getFireAna2 = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna2 === void 0 || _this$deps$getFireAna2((0, _errorHandling.fetchErrorPayload)(error.message, resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId)));
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
return providerFactory;
|
|
@@ -151,7 +151,7 @@ var SyncBlockProviderFactoryManager = exports.SyncBlockProviderFactoryManager =
|
|
|
151
151
|
if (!syncBlock.data.sourceAri || !syncBlock.data.product) {
|
|
152
152
|
var _this$deps$getFireAna3, _syncBlock$data$produ;
|
|
153
153
|
(_this$deps$getFireAna3 = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna3 === void 0 || _this$deps$getFireAna3((0, _errorHandling.fetchErrorPayload)('Sync block source ari or product not found', resourceId, // Prefer cached product when available; fall back to parsing resourceId.
|
|
154
|
-
(_syncBlock$data$produ = syncBlock.data.product) !== null && _syncBlock$data$produ !== void 0 ? _syncBlock$data$produ : (0, _utils.
|
|
154
|
+
(_syncBlock$data$produ = syncBlock.data.product) !== null && _syncBlock$data$produ !== void 0 ? _syncBlock$data$produ : (0, _utils.getSourceProductFromResourceIdSafe)(resourceId)));
|
|
155
155
|
return;
|
|
156
156
|
}
|
|
157
157
|
var parentInfo = dataProvider.retrieveSyncBlockParentInfo(syncBlock.data.sourceAri, syncBlock.data.product);
|
|
@@ -142,7 +142,7 @@ var SyncBlockStoreManager = exports.SyncBlockStoreManager = /*#__PURE__*/functio
|
|
|
142
142
|
(0, _monitoring.logException)(_context2.t0, {
|
|
143
143
|
location: 'editor-synced-block-provider/syncBlockStoreManager'
|
|
144
144
|
});
|
|
145
|
-
(_this$fireAnalyticsEv = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv === void 0 || _this$fireAnalyticsEv.call(this, (0, _errorHandling.fetchReferencesErrorPayload)(_context2.t0.message, resourceId, (0, _utils.
|
|
145
|
+
(_this$fireAnalyticsEv = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv === void 0 || _this$fireAnalyticsEv.call(this, (0, _errorHandling.fetchReferencesErrorPayload)(_context2.t0.message, resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId)));
|
|
146
146
|
return _context2.abrupt("return", {
|
|
147
147
|
error: _types.SyncBlockError.Errored
|
|
148
148
|
});
|
|
@@ -9,7 +9,6 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _monitoring = require("@atlaskit/editor-common/monitoring");
|
|
12
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
12
|
var _errorHandling = require("../utils/errorHandling");
|
|
14
13
|
var _resolveSyncBlockInstance = require("../utils/resolveSyncBlockInstance");
|
|
15
14
|
var _utils = require("../utils/utils");
|
|
@@ -258,7 +257,7 @@ var SyncBlockSubscriptionManager = exports.SyncBlockSubscriptionManager = /*#__P
|
|
|
258
257
|
(0, _monitoring.logException)(error, {
|
|
259
258
|
location: 'editor-synced-block-provider/syncBlockSubscriptionManager/graphql-subscription'
|
|
260
259
|
});
|
|
261
|
-
(_this5$deps$getFireAn = _this5.deps.getFireAnalyticsEvent()) === null || _this5$deps$getFireAn === void 0 || _this5$deps$getFireAn((0, _errorHandling.fetchErrorPayload)(error.message, resourceId, (0, _utils.
|
|
260
|
+
(_this5$deps$getFireAn = _this5.deps.getFireAnalyticsEvent()) === null || _this5$deps$getFireAn === void 0 || _this5$deps$getFireAn((0, _errorHandling.fetchErrorPayload)(error.message, resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId)));
|
|
262
261
|
});
|
|
263
262
|
if (unsubscribe) {
|
|
264
263
|
this.graphqlSubscriptions.set(resourceId, unsubscribe);
|
|
@@ -350,15 +349,13 @@ var SyncBlockSubscriptionManager = exports.SyncBlockSubscriptionManager = /*#__P
|
|
|
350
349
|
var localIds = callbacks ? Object.keys(callbacks) : [];
|
|
351
350
|
localIds.forEach(function (localId) {
|
|
352
351
|
var _this6$deps$getFireAn, _syncBlockInstance$da, _syncBlockInstance$da2;
|
|
353
|
-
(_this6$deps$getFireAn = _this6.deps.getFireAnalyticsEvent()) === null || _this6$deps$getFireAn === void 0 || _this6$deps$getFireAn((0, _errorHandling.fetchSuccessPayload)(syncBlockInstance.resourceId, localId,
|
|
354
|
-
// Prefer cached product when available; fall back to parsing the resourceId.
|
|
355
|
-
(0, _platformFeatureFlags.fg)('platform_synced_block_patch_11') ? (_syncBlockInstance$da = (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.product) !== null && _syncBlockInstance$da !== void 0 ? _syncBlockInstance$da : (0, _utils.getSourceProductFromResourceIdSafe)(syncBlockInstance.resourceId) : undefined));
|
|
352
|
+
(_this6$deps$getFireAn = _this6.deps.getFireAnalyticsEvent()) === null || _this6$deps$getFireAn === void 0 || _this6$deps$getFireAn((0, _errorHandling.fetchSuccessPayload)(syncBlockInstance.resourceId, localId, (_syncBlockInstance$da = (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.product) !== null && _syncBlockInstance$da !== void 0 ? _syncBlockInstance$da : (0, _utils.getSourceProductFromResourceIdSafe)(syncBlockInstance.resourceId)));
|
|
356
353
|
});
|
|
357
354
|
this.deps.fetchSyncBlockSourceInfo(resolved.resourceId);
|
|
358
355
|
} else {
|
|
359
356
|
var _syncBlockInstance$er, _syncBlockInstance$er2, _this$deps$getFireAna, _syncBlockInstance$da3, _syncBlockInstance$da4;
|
|
360
357
|
var errorMessage = ((_syncBlockInstance$er = syncBlockInstance.error) === null || _syncBlockInstance$er === void 0 ? void 0 : _syncBlockInstance$er.reason) || ((_syncBlockInstance$er2 = syncBlockInstance.error) === null || _syncBlockInstance$er2 === void 0 ? void 0 : _syncBlockInstance$er2.type);
|
|
361
|
-
(_this$deps$getFireAna = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna === void 0 || _this$deps$getFireAna((0, _errorHandling.fetchErrorPayload)(errorMessage, syncBlockInstance.resourceId, (
|
|
358
|
+
(_this$deps$getFireAna = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna === void 0 || _this$deps$getFireAna((0, _errorHandling.fetchErrorPayload)(errorMessage, syncBlockInstance.resourceId, (_syncBlockInstance$da3 = (_syncBlockInstance$da4 = syncBlockInstance.data) === null || _syncBlockInstance$da4 === void 0 ? void 0 : _syncBlockInstance$da4.product) !== null && _syncBlockInstance$da3 !== void 0 ? _syncBlockInstance$da3 : (0, _utils.getSourceProductFromResourceIdSafe)(syncBlockInstance.resourceId)));
|
|
362
359
|
}
|
|
363
360
|
}
|
|
364
361
|
}]);
|
package/dist/cjs/utils/utils.js
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
6
|
+
exports.getSourceProductFromResourceIdSafe = exports.getContentIdAndProductFromResourceId = exports.createSyncBlockNode = exports.convertSyncBlockPMNodeToSyncBlockData = exports.convertSyncBlockJSONNodeToSyncBlockNode = exports.convertPMNodesToSyncBlockNodes = exports.convertPMNodeToSyncBlockNode = exports.convertContentUpdatedAt = void 0;
|
|
8
7
|
/* eslint-disable require-unicode-regexp */
|
|
9
8
|
|
|
10
9
|
var convertSyncBlockPMNodeToSyncBlockData = exports.convertSyncBlockPMNodeToSyncBlockData = function convertSyncBlockPMNodeToSyncBlockData(node) {
|
|
@@ -75,17 +74,6 @@ var getSourceProductFromResourceIdSafe = exports.getSourceProductFromResourceIdS
|
|
|
75
74
|
return undefined;
|
|
76
75
|
}
|
|
77
76
|
};
|
|
78
|
-
|
|
79
|
-
/*
|
|
80
|
-
* Convenience wrapper around `getSourceProductFromResourceIdSafe` that returns
|
|
81
|
-
* `undefined` whenever the `platform_synced_block_patch_11` rollout flag is off.
|
|
82
|
-
* Centralised so that the flag name lives in exactly one place — when the flag is
|
|
83
|
-
* cleaned up, this function should be deleted in its entirety and call-sites should
|
|
84
|
-
* fall back to calling `getSourceProductFromResourceIdSafe` directly.
|
|
85
|
-
*/
|
|
86
|
-
var productAttrIfGateOn = exports.productAttrIfGateOn = function productAttrIfGateOn(resourceId) {
|
|
87
|
-
return (0, _platformFeatureFlags.fg)('platform_synced_block_patch_11') ? getSourceProductFromResourceIdSafe(resourceId) : undefined;
|
|
88
|
-
};
|
|
89
77
|
var convertContentUpdatedAt = exports.convertContentUpdatedAt = function convertContentUpdatedAt(contentUpdatedAt) {
|
|
90
78
|
if (typeof contentUpdatedAt === 'number') {
|
|
91
79
|
try {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable require-unicode-regexp */
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import { fetchWithRetry } from '../../utils/retry';
|
|
4
4
|
const COMMON_HEADERS = {
|
|
5
5
|
'Content-Type': 'application/json',
|
|
@@ -15,23 +15,21 @@ const GET_SOURCE_INFO_OPERATION_NAME = 'EDITOR_SYNCED_BLOCK_GET_SOURCE_INFO';
|
|
|
15
15
|
* @param id - the ID of the work item
|
|
16
16
|
* @returns url of the work item
|
|
17
17
|
*/
|
|
18
|
-
// `issueType` is requested
|
|
19
|
-
//
|
|
20
|
-
// front-end gating. The runtime mapping into `SyncBlockSourceInfo.issueType` is gated
|
|
21
|
-
// by `platform_synced_block_patch_11` below.
|
|
18
|
+
// `issueType` is requested alongside `summary` and `webUrl` so the
|
|
19
|
+
// SyncedLocationDropdown can render the correct ADS issue-type icon.
|
|
22
20
|
const GET_SOURCE_INFO_QUERY = `query ${GET_SOURCE_INFO_OPERATION_NAME} ($id: ID!) {
|
|
23
21
|
jira {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
22
|
+
issueById(id: $id) {
|
|
23
|
+
id
|
|
24
|
+
webUrl
|
|
25
|
+
summary
|
|
26
|
+
issueType {
|
|
27
|
+
name
|
|
28
|
+
avatar {
|
|
29
|
+
xsmall
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
35
33
|
}}`;
|
|
36
34
|
const getJiraWorkItemSourceInfo = async ari => {
|
|
37
35
|
const bodyData = {
|
|
@@ -102,44 +100,25 @@ const resolveNoAccessWorkItemInfo = async ari => {
|
|
|
102
100
|
*/
|
|
103
101
|
export const fetchJiraWorkItemInfo = async (workItemAri, hasAccess) => {
|
|
104
102
|
if (hasAccess) {
|
|
105
|
-
var _response$data, _response$data$jira, _contentData$
|
|
103
|
+
var _response$data, _response$data$jira, _contentData$issueTyp, _contentData$issueTyp2, _contentData$issueTyp3;
|
|
106
104
|
const response = await getJiraWorkItemSourceInfo(workItemAri);
|
|
107
105
|
const contentData = (_response$data = response.data) === null || _response$data === void 0 ? void 0 : (_response$data$jira = _response$data.jira) === null || _response$data$jira === void 0 ? void 0 : _response$data$jira.issueById;
|
|
106
|
+
const webUrl = typeof (contentData === null || contentData === void 0 ? void 0 : contentData.webUrl) === 'string' ? contentData.webUrl : undefined;
|
|
107
|
+
const summary = typeof (contentData === null || contentData === void 0 ? void 0 : contentData.summary) === 'string' ? contentData.summary : undefined;
|
|
108
108
|
|
|
109
|
-
//
|
|
110
|
-
//
|
|
111
|
-
//
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const webUrl = typeof (contentData === null || contentData === void 0 ? void 0 : contentData.webUrl) === 'string' ? contentData.webUrl : undefined;
|
|
118
|
-
const summary = typeof (contentData === null || contentData === void 0 ? void 0 : contentData.summary) === 'string' ? contentData.summary : undefined;
|
|
119
|
-
|
|
120
|
-
// Surface issue-type metadata so consumers can render the correct ADS issue-type
|
|
121
|
-
// icon. Defensive narrowing mirrors the webUrl/summary treatment above: only
|
|
122
|
-
// surfaced when `name` is a non-empty string; AGG values like `{ name: null }`
|
|
123
|
-
// collapse back to `undefined`.
|
|
124
|
-
const rawIssueType = contentData === null || contentData === void 0 ? void 0 : contentData.issueType;
|
|
125
|
-
const issueTypeName = typeof (rawIssueType === null || rawIssueType === void 0 ? void 0 : rawIssueType.name) === 'string' && rawIssueType.name.length > 0 ? rawIssueType.name : undefined;
|
|
126
|
-
const issueType = issueTypeName ? {
|
|
127
|
-
name: issueTypeName,
|
|
128
|
-
iconUrl: typeof (rawIssueType === null || rawIssueType === void 0 ? void 0 : (_rawIssueType$avatar = rawIssueType.avatar) === null || _rawIssueType$avatar === void 0 ? void 0 : _rawIssueType$avatar.xsmall) === 'string' ? rawIssueType.avatar.xsmall : undefined
|
|
129
|
-
} : undefined;
|
|
130
|
-
return Promise.resolve({
|
|
131
|
-
url: webUrl,
|
|
132
|
-
sourceAri: workItemAri,
|
|
133
|
-
title: summary,
|
|
134
|
-
issueType
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
const webUrl = (_contentData$webUrl = contentData === null || contentData === void 0 ? void 0 : contentData.webUrl) !== null && _contentData$webUrl !== void 0 ? _contentData$webUrl : undefined;
|
|
138
|
-
const summary = (_contentData$summary = contentData === null || contentData === void 0 ? void 0 : contentData.summary) !== null && _contentData$summary !== void 0 ? _contentData$summary : undefined;
|
|
109
|
+
// Surface issue-type metadata for the SyncedLocationDropdown's ADS icon.
|
|
110
|
+
// Defensive narrowing: only surface when `name` is a non-empty string;
|
|
111
|
+
// AGG values like `{ name: null }` collapse back to `undefined`.
|
|
112
|
+
const issueTypeName = contentData === null || contentData === void 0 ? void 0 : (_contentData$issueTyp = contentData.issueType) === null || _contentData$issueTyp === void 0 ? void 0 : _contentData$issueTyp.name;
|
|
113
|
+
const issueType = typeof issueTypeName === 'string' && issueTypeName.length > 0 ? {
|
|
114
|
+
name: issueTypeName,
|
|
115
|
+
iconUrl: typeof (contentData === null || contentData === void 0 ? void 0 : (_contentData$issueTyp2 = contentData.issueType) === null || _contentData$issueTyp2 === void 0 ? void 0 : (_contentData$issueTyp3 = _contentData$issueTyp2.avatar) === null || _contentData$issueTyp3 === void 0 ? void 0 : _contentData$issueTyp3.xsmall) === 'string' ? contentData.issueType.avatar.xsmall : undefined
|
|
116
|
+
} : undefined;
|
|
139
117
|
return Promise.resolve({
|
|
140
118
|
url: webUrl,
|
|
141
119
|
sourceAri: workItemAri,
|
|
142
|
-
title: summary
|
|
120
|
+
title: summary,
|
|
121
|
+
issueType
|
|
143
122
|
});
|
|
144
123
|
} else {
|
|
145
124
|
return await resolveNoAccessWorkItemInfo(workItemAri);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
2
|
-
export { createSyncBlockNode, convertSyncBlockPMNodeToSyncBlockData, convertSyncBlockJSONNodeToSyncBlockNode, convertPMNodesToSyncBlockNodes, convertPMNodeToSyncBlockNode, convertContentUpdatedAt, getContentIdAndProductFromResourceId, getSourceProductFromResourceIdSafe
|
|
2
|
+
export { createSyncBlockNode, convertSyncBlockPMNodeToSyncBlockData, convertSyncBlockJSONNodeToSyncBlockNode, convertPMNodesToSyncBlockNodes, convertPMNodeToSyncBlockNode, convertContentUpdatedAt, getContentIdAndProductFromResourceId, getSourceProductFromResourceIdSafe } from '../utils/utils';
|
|
@@ -3,7 +3,7 @@ import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
|
3
3
|
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
4
4
|
import { SyncBlockError } from '../common/types';
|
|
5
5
|
import { fetchErrorPayload } from '../utils/errorHandling';
|
|
6
|
-
import { createSyncBlockNode,
|
|
6
|
+
import { createSyncBlockNode, getSourceProductFromResourceIdSafe } from '../utils/utils';
|
|
7
7
|
export const useFetchSyncBlockData = (manager, resourceId, localId, fireAnalyticsEvent) => {
|
|
8
8
|
// Initialize both states from a single cache lookup to avoid race conditions.
|
|
9
9
|
// When a block is moved/remounted, the old component's cleanup may clear the cache
|
|
@@ -46,7 +46,7 @@ export const useFetchSyncBlockData = (manager, resourceId, localId, fireAnalytic
|
|
|
46
46
|
logException(error, {
|
|
47
47
|
location: 'editor-synced-block-provider/useFetchSyncBlockData'
|
|
48
48
|
});
|
|
49
|
-
fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 ? void 0 : fireAnalyticsEvent(fetchErrorPayload(error.message, resourceId,
|
|
49
|
+
fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 ? void 0 : fireAnalyticsEvent(fetchErrorPayload(error.message, resourceId, getSourceProductFromResourceIdSafe(resourceId)));
|
|
50
50
|
|
|
51
51
|
// Set error state if fetching fails
|
|
52
52
|
setFetchState({
|