@atlaskit/editor-synced-block-provider 3.25.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cjs/clients/block-service/blockService.js +98 -57
  3. package/dist/cjs/clients/confluence/sourceInfo.js +112 -69
  4. package/dist/cjs/hooks/useFetchSyncBlockData.js +5 -11
  5. package/dist/cjs/providers/block-service/blockServiceAPI.js +1 -1
  6. package/dist/cjs/providers/syncBlockProvider.js +34 -75
  7. package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +83 -124
  8. package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +59 -93
  9. package/dist/cjs/store-manager/syncBlockStoreManager.js +2 -4
  10. package/dist/cjs/utils/errorHandling.js +2 -5
  11. package/dist/cjs/utils/resolveSyncBlockInstance.js +1 -3
  12. package/dist/cjs/utils/utils.js +5 -6
  13. package/dist/es2019/clients/block-service/blockService.js +55 -19
  14. package/dist/es2019/clients/confluence/sourceInfo.js +51 -4
  15. package/dist/es2019/hooks/useFetchSyncBlockData.js +6 -12
  16. package/dist/es2019/providers/block-service/blockServiceAPI.js +1 -1
  17. package/dist/es2019/providers/syncBlockProvider.js +22 -54
  18. package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +73 -114
  19. package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +60 -92
  20. package/dist/es2019/store-manager/syncBlockStoreManager.js +2 -4
  21. package/dist/es2019/utils/errorHandling.js +1 -4
  22. package/dist/es2019/utils/resolveSyncBlockInstance.js +2 -5
  23. package/dist/es2019/utils/utils.js +5 -6
  24. package/dist/esm/clients/block-service/blockService.js +98 -57
  25. package/dist/esm/clients/confluence/sourceInfo.js +111 -68
  26. package/dist/esm/hooks/useFetchSyncBlockData.js +5 -11
  27. package/dist/esm/providers/block-service/blockServiceAPI.js +1 -1
  28. package/dist/esm/providers/syncBlockProvider.js +34 -75
  29. package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +83 -124
  30. package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +59 -93
  31. package/dist/esm/store-manager/syncBlockStoreManager.js +2 -4
  32. package/dist/esm/utils/errorHandling.js +2 -5
  33. package/dist/esm/utils/resolveSyncBlockInstance.js +1 -3
  34. package/dist/esm/utils/utils.js +5 -6
  35. package/dist/types/clients/confluence/sourceInfo.d.ts +1 -2
  36. package/dist/types/hooks/useFetchSyncBlockData.d.ts +1 -1
  37. package/dist/types/providers/syncBlockProvider.d.ts +2 -2
  38. package/dist/types/providers/types.d.ts +3 -3
  39. package/dist/types/store-manager/sourceSyncBlockStoreManager.d.ts +1 -1
  40. package/dist/types-ts4.5/clients/confluence/sourceInfo.d.ts +1 -2
  41. package/dist/types-ts4.5/hooks/useFetchSyncBlockData.d.ts +1 -1
  42. package/dist/types-ts4.5/providers/syncBlockProvider.d.ts +2 -2
  43. package/dist/types-ts4.5/providers/types.d.ts +3 -3
  44. package/dist/types-ts4.5/store-manager/sourceSyncBlockStoreManager.d.ts +1 -1
  45. package/package.json +2 -5
@@ -113,69 +113,79 @@ var resolveNoAccessPageInfo = /*#__PURE__*/function () {
113
113
  return _ref2.apply(this, arguments);
114
114
  };
115
115
  }();
116
- export var fetchConfluencePageInfoOld = /*#__PURE__*/function () {
117
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(pageAri, localId, fireAnalyticsEvent) {
118
- var _response$data, _contentData$space, _getPageIdAndTypeFrom, pageType, response, contentData, title, url, _ref4, base;
116
+
117
+ /**
118
+ * Fetches unpublished page info from the v2 pages API
119
+ * Used when the GraphQL query returns empty content.nodes for unpublished pages
120
+ * @param pageAri - The page ARI
121
+ * @param localId - Optional local ID to append as block anchor
122
+ * @returns Source info with URL, title, and optional subtype
123
+ */
124
+ var fetchUnpublishedConfluencePageInfo = /*#__PURE__*/function () {
125
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(pageAri, localId) {
126
+ var _pageData$_links, _pageData$_links2, _getPageIdAndTypeFrom, pageId, response, pageData, base, edituiv2, title, subType, url;
119
127
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
120
128
  while (1) switch (_context3.prev = _context3.next) {
121
129
  case 0:
122
130
  _context3.prev = 0;
123
131
  _getPageIdAndTypeFrom = getPageIdAndTypeFromConfluencePageAri({
124
132
  ari: pageAri
125
- }), pageType = _getPageIdAndTypeFrom.type;
133
+ }), pageId = _getPageIdAndTypeFrom.id;
126
134
  _context3.next = 4;
127
- return getConfluenceSourceInfo(pageAri);
135
+ return fetchWithRetry("/wiki/api/v2/pages/".concat(pageId, "?draft=true"), {
136
+ method: 'GET',
137
+ headers: COMMON_HEADERS
138
+ });
128
139
  case 4:
129
140
  response = _context3.sent;
130
- contentData = (_response$data = response.data) === null || _response$data === void 0 || (_response$data = _response$data.content) === null || _response$data === void 0 || (_response$data = _response$data.nodes) === null || _response$data === void 0 ? void 0 : _response$data[0];
131
- title = contentData === null || contentData === void 0 ? void 0 : contentData.title;
132
- _ref4 = (contentData === null || contentData === void 0 ? void 0 : contentData.links) || {}, base = _ref4.base;
133
- if (base && contentData !== null && contentData !== void 0 && (_contentData$space = contentData.space) !== null && _contentData$space !== void 0 && _contentData$space.key && contentData !== null && contentData !== void 0 && contentData.id) {
134
- if (isBlogPageType(pageType)) {
135
- url = "".concat(base, "/spaces/").concat(contentData.space.key, "/blog/edit-v2/").concat(contentData.id);
136
- } else if (contentData.subType === 'live') {
137
- url = "".concat(base, "/spaces/").concat(contentData.space.key, "/pages/").concat(contentData.id);
138
- } else {
139
- url = "".concat(base, "/spaces/").concat(contentData.space.key, "/pages/edit-v2/").concat(contentData.id);
140
- }
141
+ if (response.ok) {
142
+ _context3.next = 7;
143
+ break;
141
144
  }
142
- url = url && localId ? "".concat(url, "#block-").concat(localId) : url;
143
- if (!title || !url) {
144
- fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent(getSourceInfoErrorPayload('Failed to get confluence page source info'));
145
+ throw new Error("Failed to get unpublished page info: ".concat(response.statusText));
146
+ case 7:
147
+ _context3.next = 9;
148
+ return response.json();
149
+ case 9:
150
+ pageData = _context3.sent;
151
+ base = (_pageData$_links = pageData._links) === null || _pageData$_links === void 0 ? void 0 : _pageData$_links.base;
152
+ edituiv2 = (_pageData$_links2 = pageData._links) === null || _pageData$_links2 === void 0 ? void 0 : _pageData$_links2.edituiv2;
153
+ title = pageData.title;
154
+ subType = pageData.subtype;
155
+ if (base && edituiv2) {
156
+ url = "".concat(base).concat(edituiv2);
157
+ url = url && localId ? "".concat(url, "#block-").concat(localId) : url;
145
158
  }
146
- return _context3.abrupt("return", Promise.resolve({
159
+ return _context3.abrupt("return", {
147
160
  title: title,
148
161
  url: url,
149
- sourceAri: pageAri
150
- }));
151
- case 14:
152
- _context3.prev = 14;
162
+ sourceAri: pageAri,
163
+ subType: subType
164
+ });
165
+ case 18:
166
+ _context3.prev = 18;
153
167
  _context3.t0 = _context3["catch"](0);
154
168
  logException(_context3.t0, {
155
- location: 'editor-synced-block-provider/sourceInfo'
169
+ location: 'editor-synced-block-provider/sourceInfo/fetchUnpublishedConfluencePageInfo'
156
170
  });
157
- fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent(getSourceInfoErrorPayload(_context3.t0.message));
158
171
  return _context3.abrupt("return", Promise.resolve(undefined));
159
- case 19:
172
+ case 22:
160
173
  case "end":
161
174
  return _context3.stop();
162
175
  }
163
- }, _callee3, null, [[0, 14]]);
176
+ }, _callee3, null, [[0, 18]]);
164
177
  }));
165
- return function fetchConfluencePageInfoOld(_x3, _x4, _x5) {
178
+ return function fetchUnpublishedConfluencePageInfo(_x3, _x4) {
166
179
  return _ref3.apply(this, arguments);
167
180
  };
168
181
  }();
169
- export var fetchConfluencePageInfoNew = /*#__PURE__*/function () {
170
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(pageAri, hasAccess, urlType, localId) {
171
- var _response$data2, _contentData$space2, _getPageIdAndTypeFrom2, pageType, response, contentData, _ref6, title, subType, url, _ref7, base;
182
+ export var fetchConfluencePageInfoOld = /*#__PURE__*/function () {
183
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(pageAri, localId, fireAnalyticsEvent) {
184
+ var _response$data, _contentData$space, _getPageIdAndTypeFrom2, pageType, response, contentData, title, url, _ref5, base;
172
185
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
173
186
  while (1) switch (_context4.prev = _context4.next) {
174
187
  case 0:
175
- if (!hasAccess) {
176
- _context4.next = 13;
177
- break;
178
- }
188
+ _context4.prev = 0;
179
189
  _getPageIdAndTypeFrom2 = getPageIdAndTypeFromConfluencePageAri({
180
190
  ari: pageAri
181
191
  }), pageType = _getPageIdAndTypeFrom2.type;
@@ -183,69 +193,102 @@ export var fetchConfluencePageInfoNew = /*#__PURE__*/function () {
183
193
  return getConfluenceSourceInfo(pageAri);
184
194
  case 4:
185
195
  response = _context4.sent;
186
- contentData = (_response$data2 = response.data) === null || _response$data2 === void 0 || (_response$data2 = _response$data2.content) === null || _response$data2 === void 0 || (_response$data2 = _response$data2.nodes) === null || _response$data2 === void 0 ? void 0 : _response$data2[0];
187
- _ref6 = contentData || {}, title = _ref6.title, subType = _ref6.subType;
188
- _ref7 = (contentData === null || contentData === void 0 ? void 0 : contentData.links) || {}, base = _ref7.base;
189
- if (base && contentData !== null && contentData !== void 0 && (_contentData$space2 = contentData.space) !== null && _contentData$space2 !== void 0 && _contentData$space2.key && contentData !== null && contentData !== void 0 && contentData.id) {
196
+ contentData = (_response$data = response.data) === null || _response$data === void 0 || (_response$data = _response$data.content) === null || _response$data === void 0 || (_response$data = _response$data.nodes) === null || _response$data === void 0 ? void 0 : _response$data[0];
197
+ title = contentData === null || contentData === void 0 ? void 0 : contentData.title;
198
+ _ref5 = (contentData === null || contentData === void 0 ? void 0 : contentData.links) || {}, base = _ref5.base;
199
+ if (base && contentData !== null && contentData !== void 0 && (_contentData$space = contentData.space) !== null && _contentData$space !== void 0 && _contentData$space.key && contentData !== null && contentData !== void 0 && contentData.id) {
190
200
  if (isBlogPageType(pageType)) {
191
- url = "".concat(base, "/spaces/").concat(contentData.space.key, "/blog").concat(urlType === 'edit' ? '/edit-v2' : '', "/").concat(contentData.id);
201
+ url = "".concat(base, "/spaces/").concat(contentData.space.key, "/blog/edit-v2/").concat(contentData.id);
192
202
  } else if (contentData.subType === 'live') {
193
203
  url = "".concat(base, "/spaces/").concat(contentData.space.key, "/pages/").concat(contentData.id);
194
204
  } else {
195
- url = "".concat(base, "/spaces/").concat(contentData.space.key, "/pages").concat(urlType === 'edit' ? '/edit-v2' : '', "/").concat(contentData.id);
205
+ url = "".concat(base, "/spaces/").concat(contentData.space.key, "/pages/edit-v2/").concat(contentData.id);
196
206
  }
197
207
  }
198
208
  url = url && localId ? "".concat(url, "#block-").concat(localId) : url;
209
+ if (!title || !url) {
210
+ fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent(getSourceInfoErrorPayload('Failed to get confluence page source info'));
211
+ }
199
212
  return _context4.abrupt("return", Promise.resolve({
200
213
  title: title,
201
214
  url: url,
202
- sourceAri: pageAri,
203
- subType: subType
215
+ sourceAri: pageAri
204
216
  }));
205
- case 13:
206
- _context4.next = 15;
207
- return resolveNoAccessPageInfo(pageAri);
208
- case 15:
209
- return _context4.abrupt("return", _context4.sent);
210
- case 16:
217
+ case 14:
218
+ _context4.prev = 14;
219
+ _context4.t0 = _context4["catch"](0);
220
+ logException(_context4.t0, {
221
+ location: 'editor-synced-block-provider/sourceInfo'
222
+ });
223
+ fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent(getSourceInfoErrorPayload(_context4.t0.message));
224
+ return _context4.abrupt("return", Promise.resolve(undefined));
225
+ case 19:
211
226
  case "end":
212
227
  return _context4.stop();
213
228
  }
214
- }, _callee4);
229
+ }, _callee4, null, [[0, 14]]);
215
230
  }));
216
- return function fetchConfluencePageInfoNew(_x6, _x7, _x8, _x9) {
217
- return _ref5.apply(this, arguments);
231
+ return function fetchConfluencePageInfoOld(_x5, _x6, _x7) {
232
+ return _ref4.apply(this, arguments);
218
233
  };
219
234
  }();
220
235
  export var fetchConfluencePageInfo = /*#__PURE__*/function () {
221
- var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(pageAri, hasAccess, urlType, localId, fireAnalyticsEvent) {
236
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(pageAri, hasAccess, urlType, localId, isUnpublished) {
237
+ var _response$data2, _contentData$space2, _getPageIdAndTypeFrom3, pageType, response, contentData, _ref7, title, subType, url, _ref8, base;
222
238
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
223
239
  while (1) switch (_context5.prev = _context5.next) {
224
240
  case 0:
225
- if (!fg('platform_synced_block_dogfooding')) {
226
- _context5.next = 6;
241
+ if (!(isUnpublished && fg('platform_synced_block_patch_1'))) {
242
+ _context5.next = 4;
227
243
  break;
228
244
  }
229
245
  _context5.next = 3;
230
- return fetchConfluencePageInfoNew(pageAri, hasAccess, urlType, localId);
246
+ return fetchUnpublishedConfluencePageInfo(pageAri, localId);
231
247
  case 3:
232
- _context5.t0 = _context5.sent;
233
- _context5.next = 9;
234
- break;
235
- case 6:
248
+ return _context5.abrupt("return", _context5.sent);
249
+ case 4:
250
+ if (!hasAccess) {
251
+ _context5.next = 17;
252
+ break;
253
+ }
254
+ _getPageIdAndTypeFrom3 = getPageIdAndTypeFromConfluencePageAri({
255
+ ari: pageAri
256
+ }), pageType = _getPageIdAndTypeFrom3.type;
236
257
  _context5.next = 8;
237
- return fetchConfluencePageInfoOld(pageAri, localId, fireAnalyticsEvent);
258
+ return getConfluenceSourceInfo(pageAri);
238
259
  case 8:
239
- _context5.t0 = _context5.sent;
240
- case 9:
241
- return _context5.abrupt("return", _context5.t0);
242
- case 10:
260
+ response = _context5.sent;
261
+ contentData = (_response$data2 = response.data) === null || _response$data2 === void 0 || (_response$data2 = _response$data2.content) === null || _response$data2 === void 0 || (_response$data2 = _response$data2.nodes) === null || _response$data2 === void 0 ? void 0 : _response$data2[0];
262
+ _ref7 = contentData || {}, title = _ref7.title, subType = _ref7.subType;
263
+ _ref8 = (contentData === null || contentData === void 0 ? void 0 : contentData.links) || {}, base = _ref8.base;
264
+ if (base && contentData !== null && contentData !== void 0 && (_contentData$space2 = contentData.space) !== null && _contentData$space2 !== void 0 && _contentData$space2.key && contentData !== null && contentData !== void 0 && contentData.id) {
265
+ if (isBlogPageType(pageType)) {
266
+ url = "".concat(base, "/spaces/").concat(contentData.space.key, "/blog").concat(urlType === 'edit' ? '/edit-v2' : '', "/").concat(contentData.id);
267
+ } else if (contentData.subType === 'live') {
268
+ url = "".concat(base, "/spaces/").concat(contentData.space.key, "/pages/").concat(contentData.id);
269
+ } else {
270
+ url = "".concat(base, "/spaces/").concat(contentData.space.key, "/pages").concat(urlType === 'edit' ? '/edit-v2' : '', "/").concat(contentData.id);
271
+ }
272
+ }
273
+ url = url && localId ? "".concat(url, "#block-").concat(localId) : url;
274
+ return _context5.abrupt("return", Promise.resolve({
275
+ title: title,
276
+ url: url,
277
+ sourceAri: pageAri,
278
+ subType: subType
279
+ }));
280
+ case 17:
281
+ _context5.next = 19;
282
+ return resolveNoAccessPageInfo(pageAri);
283
+ case 19:
284
+ return _context5.abrupt("return", _context5.sent);
285
+ case 20:
243
286
  case "end":
244
287
  return _context5.stop();
245
288
  }
246
289
  }, _callee5);
247
290
  }));
248
- return function fetchConfluencePageInfo(_x0, _x1, _x10, _x11, _x12) {
249
- return _ref8.apply(this, arguments);
291
+ return function fetchConfluencePageInfo(_x8, _x9, _x0, _x1, _x10) {
292
+ return _ref6.apply(this, arguments);
250
293
  };
251
294
  }();
@@ -7,11 +7,9 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  import { useCallback, useEffect, useMemo, useState } from 'react';
8
8
  import { isSSR } from '@atlaskit/editor-common/core-utils';
9
9
  import { logException } from '@atlaskit/editor-common/monitoring';
10
- import { fg } from '@atlaskit/platform-feature-flags';
11
10
  import { SyncBlockError } from '../common/types';
12
- import { fetchErrorPayload } from '../utils/errorHandling';
13
11
  import { createSyncBlockNode } from '../utils/utils';
14
- export var useFetchSyncBlockData = function useFetchSyncBlockData(manager, resourceId, localId, fireAnalyticsEvent) {
12
+ export var useFetchSyncBlockData = function useFetchSyncBlockData(manager, resourceId, localId, _fireAnalyticsEvent) {
15
13
  // Initialize both states from a single cache lookup to avoid race conditions.
16
14
  // When a block is moved/remounted, the old component's cleanup may clear the cache
17
15
  // before or after the new component mounts. By doing a single lookup, we ensure
@@ -72,13 +70,9 @@ export var useFetchSyncBlockData = function useFetchSyncBlockData(manager, resou
72
70
  logException(_context.t0, {
73
71
  location: 'editor-synced-block-provider/useFetchSyncBlockData'
74
72
  });
75
- if (fg('platform_synced_block_dogfooding')) {
76
- manager === null || manager === void 0 || (_manager$referenceMan2 = manager.referenceManager) === null || _manager$referenceMan2 === void 0 || (_manager$referenceMan2 = _manager$referenceMan2.fetchExperience) === null || _manager$referenceMan2 === void 0 || _manager$referenceMan2.failure({
77
- reason: _context.t0.message
78
- });
79
- } else {
80
- fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent(fetchErrorPayload(_context.t0.message));
81
- }
73
+ manager === null || manager === void 0 || (_manager$referenceMan2 = manager.referenceManager) === null || _manager$referenceMan2 === void 0 || (_manager$referenceMan2 = _manager$referenceMan2.fetchExperience) === null || _manager$referenceMan2 === void 0 || _manager$referenceMan2.failure({
74
+ reason: _context.t0.message
75
+ });
82
76
 
83
77
  // Set error state if fetching fails
84
78
  setFetchState({
@@ -102,7 +96,7 @@ export var useFetchSyncBlockData = function useFetchSyncBlockData(manager, resou
102
96
  return _context.stop();
103
97
  }
104
98
  }, _callee, null, [[2, 11]]);
105
- })), [isLoading, localId, manager.referenceManager, resourceId, fireAnalyticsEvent]);
99
+ })), [isLoading, localId, manager.referenceManager, resourceId]);
106
100
  useEffect(function () {
107
101
  if (isSSR()) {
108
102
  // in SSR, we don't need to subscribe to updates,
@@ -735,7 +735,7 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
735
735
  _context6.t0 = undefined;
736
736
  case 11:
737
737
  stepVersion = _context6.t0;
738
- status = fg('platform_synced_block_patch_1') ? 'unpublished' : fg('platform_synced_block_dogfooding') ? (_this$isParentUnpubli = this.isParentUnpublished) !== null && _this$isParentUnpubli !== void 0 && _this$isParentUnpubli.call(this) ? 'unpublished' : data.status || 'active' : undefined;
738
+ 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';
739
739
  _context6.prev = 13;
740
740
  _context6.next = 16;
741
741
  return createSyncedBlock({
@@ -11,7 +11,6 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
11
11
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
12
12
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
13
13
  import { useMemo } from 'react';
14
- import { fg } from '@atlaskit/platform-feature-flags';
15
14
  import { getProductFromSourceAri } from '../clients/block-service/ari';
16
15
  import { getPageIdAndTypeFromConfluencePageAri } from '../clients/confluence/ari';
17
16
  import { fetchConfluencePageInfo } from '../clients/confluence/sourceInfo';
@@ -97,40 +96,14 @@ export var SyncBlockProvider = /*#__PURE__*/function (_SyncBlockDataProvide) {
97
96
  }
98
97
  return _context.abrupt("return", []);
99
98
  case 3:
100
- if (!fg('platform_synced_block_dogfooding')) {
101
- _context.next = 15;
102
- break;
103
- }
104
- _context.prev = 4;
105
- _context.next = 7;
99
+ _context.prev = 3;
100
+ _context.next = 6;
106
101
  return this.fetchProvider.batchFetchData(blockIdentifiers);
107
- case 7:
102
+ case 6:
108
103
  return _context.abrupt("return", _context.sent);
109
- case 10:
110
- _context.prev = 10;
111
- _context.t0 = _context["catch"](4);
112
- return _context.abrupt("return", Promise.allSettled(blockIdentifiers.map(function (blockIdentifier) {
113
- return _this2.fetchProvider.fetchData(blockIdentifier.resourceId).then(function (data) {
114
- return data;
115
- }, function () {
116
- return {
117
- error: {
118
- type: SyncBlockError.Errored
119
- },
120
- resourceId: blockIdentifier.resourceId
121
- };
122
- });
123
- })).then(function (results) {
124
- return results.filter(function (result) {
125
- return result.status === 'fulfilled';
126
- }).map(function (result) {
127
- return result.value;
128
- });
129
- }));
130
- case 13:
131
- _context.next = 16;
132
- break;
133
- case 15:
104
+ case 9:
105
+ _context.prev = 9;
106
+ _context.t0 = _context["catch"](3);
134
107
  return _context.abrupt("return", Promise.allSettled(blockIdentifiers.map(function (blockIdentifier) {
135
108
  return _this2.fetchProvider.fetchData(blockIdentifier.resourceId).then(function (data) {
136
109
  return data;
@@ -149,11 +122,11 @@ export var SyncBlockProvider = /*#__PURE__*/function (_SyncBlockDataProvide) {
149
122
  return result.value;
150
123
  });
151
124
  }));
152
- case 16:
125
+ case 12:
153
126
  case "end":
154
127
  return _context.stop();
155
128
  }
156
- }, _callee, this, [[4, 10]]);
129
+ }, _callee, this, [[3, 9]]);
157
130
  }));
158
131
  function fetchNodesData(_x) {
159
132
  return _fetchNodesData.apply(this, arguments);
@@ -300,80 +273,66 @@ export var SyncBlockProvider = /*#__PURE__*/function (_SyncBlockDataProvide) {
300
273
  key: "fetchSyncBlockSourceInfo",
301
274
  value: (function () {
302
275
  var _fetchSyncBlockSourceInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(localId, sourceAri, sourceProduct, fireAnalyticsEvent) {
276
+ var _this$writeProvider, _this$writeProvider3;
303
277
  var hasAccess,
304
278
  urlType,
279
+ isUnpublished,
305
280
  ari,
306
281
  product,
307
- _this$writeProvider,
308
- sourceInfo,
309
282
  _this$writeProvider2,
310
- _this$writeProvider3,
311
283
  _sourceInfo,
284
+ sourceInfo,
312
285
  _args4 = arguments;
313
286
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
314
287
  while (1) switch (_context4.prev = _context4.next) {
315
288
  case 0:
316
289
  hasAccess = _args4.length > 4 && _args4[4] !== undefined ? _args4[4] : true;
317
290
  urlType = _args4.length > 5 && _args4[5] !== undefined ? _args4[5] : 'edit';
318
- ari = sourceAri, product = sourceProduct;
319
- if (fg('platform_synced_block_dogfooding')) {
320
- ari = sourceAri !== null && sourceAri !== void 0 ? sourceAri : (_this$writeProvider = this.writeProvider) === null || _this$writeProvider === void 0 ? void 0 : _this$writeProvider.parentAri;
321
- product = sourceProduct !== null && sourceProduct !== void 0 ? sourceProduct : getProductFromSourceAri(ari);
322
- }
291
+ isUnpublished = _args4.length > 6 ? _args4[6] : undefined;
292
+ ari = sourceAri !== null && sourceAri !== void 0 ? sourceAri : (_this$writeProvider = this.writeProvider) === null || _this$writeProvider === void 0 ? void 0 : _this$writeProvider.parentAri;
293
+ product = sourceProduct !== null && sourceProduct !== void 0 ? sourceProduct : getProductFromSourceAri(ari);
323
294
  if (!(!ari || !product)) {
324
- _context4.next = 6;
295
+ _context4.next = 7;
325
296
  break;
326
297
  }
327
298
  return _context4.abrupt("return", Promise.reject(new Error('Source ari or source product is undefined')));
328
- case 6:
299
+ case 7:
329
300
  _context4.t0 = product;
330
- _context4.next = _context4.t0 === 'confluence-page' ? 9 : _context4.t0 === 'jira-work-item' ? 19 : 27;
301
+ _context4.next = _context4.t0 === 'confluence-page' ? 10 : _context4.t0 === 'jira-work-item' ? 16 : 22;
331
302
  break;
332
- case 9:
333
- _context4.next = 11;
334
- return fetchConfluencePageInfo(ari, hasAccess, urlType, localId, fireAnalyticsEvent);
335
- case 11:
336
- sourceInfo = _context4.sent;
337
- if (!fg('platform_synced_block_dogfooding')) {
338
- _context4.next = 18;
339
- break;
340
- }
341
- if (sourceInfo) {
303
+ case 10:
304
+ _context4.next = 12;
305
+ return fetchConfluencePageInfo(ari, hasAccess, urlType, localId, isUnpublished);
306
+ case 12:
307
+ _sourceInfo = _context4.sent;
308
+ if (_sourceInfo) {
342
309
  _context4.next = 15;
343
310
  break;
344
311
  }
345
312
  return _context4.abrupt("return", Promise.resolve(undefined));
346
313
  case 15:
347
- return _context4.abrupt("return", _objectSpread(_objectSpread({}, sourceInfo), {}, {
314
+ return _context4.abrupt("return", _objectSpread(_objectSpread({}, _sourceInfo), {}, {
348
315
  onSameDocument: ((_this$writeProvider2 = this.writeProvider) === null || _this$writeProvider2 === void 0 ? void 0 : _this$writeProvider2.parentAri) === ari,
349
316
  productType: product
350
317
  }));
351
- case 18:
352
- return _context4.abrupt("return", sourceInfo);
353
- case 19:
354
- if (!fg('platform_synced_block_dogfooding')) {
355
- _context4.next = 26;
356
- break;
357
- }
358
- _context4.next = 22;
318
+ case 16:
319
+ _context4.next = 18;
359
320
  return fetchJiraWorkItemInfo(ari, hasAccess);
360
- case 22:
361
- _sourceInfo = _context4.sent;
362
- if (_sourceInfo) {
363
- _context4.next = 25;
321
+ case 18:
322
+ sourceInfo = _context4.sent;
323
+ if (sourceInfo) {
324
+ _context4.next = 21;
364
325
  break;
365
326
  }
366
327
  return _context4.abrupt("return", Promise.resolve(undefined));
367
- case 25:
368
- return _context4.abrupt("return", _objectSpread(_objectSpread({}, _sourceInfo), {}, {
328
+ case 21:
329
+ return _context4.abrupt("return", _objectSpread(_objectSpread({}, sourceInfo), {}, {
369
330
  onSameDocument: ((_this$writeProvider3 = this.writeProvider) === null || _this$writeProvider3 === void 0 ? void 0 : _this$writeProvider3.parentAri) === ari,
370
331
  productType: product
371
332
  }));
372
- case 26:
373
- return _context4.abrupt("return", Promise.reject(new Error('Jira work item source product not supported')));
374
- case 27:
333
+ case 22:
375
334
  return _context4.abrupt("return", Promise.reject(new Error("".concat(product, " source product not supported"))));
376
- case 28:
335
+ case 23:
377
336
  case "end":
378
337
  return _context4.stop();
379
338
  }