@atlaskit/editor-synced-block-renderer 6.0.2 → 6.0.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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-synced-block-renderer
2
2
 
3
+ ## 6.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`7428d9bf3aa13`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7428d9bf3aa13) -
8
+ Clean up platform_synced_block_patch_5 feature gate
9
+ - Updated dependencies
10
+
3
11
  ## 6.0.2
4
12
 
5
13
  ### Patch Changes
@@ -12,7 +12,6 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
12
12
  var _react = _interopRequireWildcard(require("react"));
13
13
  var _reactIntlNext = require("react-intl-next");
14
14
  var _messages = require("@atlaskit/editor-common/messages");
15
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
15
  var _renderer = require("@atlaskit/renderer");
17
16
  var _actions = require("@atlaskit/renderer/actions");
18
17
  var _rendererContext = require("@atlaskit/renderer/renderer-context");
@@ -139,6 +138,6 @@ var AKRendererWrapper = exports.AKRendererWrapper = /*#__PURE__*/(0, _react.memo
139
138
  media: media,
140
139
  smartLinks: smartLinks,
141
140
  stickyHeaders: stickyHeaders,
142
- contentMode: (0, _platformFeatureFlags.fg)('platform_synced_block_patch_5') ? contentMode : undefined
141
+ contentMode: contentMode
143
142
  })))));
144
143
  });
@@ -12,16 +12,12 @@ var _react = _interopRequireWildcard(require("react"));
12
12
  var _coreUtils = require("@atlaskit/editor-common/core-utils");
13
13
  var _syncBlock = require("@atlaskit/editor-common/sync-block");
14
14
  var _editorSyncedBlockProvider = require("@atlaskit/editor-synced-block-provider");
15
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
- var _AKRendererWrapper = require("./AKRendererWrapper");
17
15
  var _renderSyncedBlockContent = require("./renderSyncedBlockContent");
18
- var _SyncedBlockErrorComponent = require("./SyncedBlockErrorComponent");
19
- var _SyncedBlockLoadingState = require("./SyncedBlockLoadingState");
20
16
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
21
17
  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; }
22
18
  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; }
23
19
  var SyncedBlockNodeComponentRenderer = exports.SyncedBlockNodeComponentRenderer = function SyncedBlockNodeComponentRenderer(_ref) {
24
- var _syncBlockInstance$da5;
20
+ var _syncBlockInstance$er, _syncBlockInstance$da, _syncBlockInstance$da2;
25
21
  var nodeProps = _ref.nodeProps,
26
22
  syncBlockStoreManager = _ref.syncBlockStoreManager,
27
23
  rendererOptions = _ref.rendererOptions;
@@ -65,83 +61,29 @@ var SyncedBlockNodeComponentRenderer = exports.SyncedBlockNodeComponentRenderer
65
61
  })
66
62
  });
67
63
  }, [rendererOptions, ssrProviders]);
68
- if ((0, _platformFeatureFlags.fg)('platform_synced_block_patch_5')) {
69
- var _syncBlockInstance$er, _syncBlockInstance$da, _syncBlockInstance$da2;
70
- var errorForDisplay = (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : (syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.status) === 'deleted' ? {
71
- type: _editorSyncedBlockProvider.SyncBlockError.NotFound,
72
- reason: (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.deletionReason
73
- } : {
74
- type: _editorSyncedBlockProvider.SyncBlockError.Errored,
75
- reason: !resourceId ? 'missing resource id' : "missing data for block ".concat(resourceId)
76
- };
77
- var result = (0, _renderSyncedBlockContent.renderSyncedBlockContent)({
78
- syncBlockInstance: syncBlockInstance !== null && syncBlockInstance !== void 0 ? syncBlockInstance : undefined,
79
- isLoading: isLoading,
80
- rendererOptions: finalRendererOptions,
81
- providerFactory: providerFactory,
82
- reloadData: reloadData,
83
- fireAnalyticsEvent: fireAnalyticsEvent,
84
- resourceId: resourceId,
85
- error: errorForDisplay
86
- });
87
- if (result.isSuccess) {
88
- return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
89
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
90
- className: _syncBlock.SyncBlockSharedCssClassName.renderer
91
- // eslint-disable-next-line react/jsx-props-no-spreading
92
- }, (0, _defineProperty2.default)({}, _syncBlock.SyncBlockRendererDataAttributeName, true)), result.element);
93
- }
94
- return result.element;
95
- }
96
- if (isLoading && !syncBlockInstance) {
97
- return /*#__PURE__*/_react.default.createElement(_SyncedBlockLoadingState.SyncedBlockLoadingState, null);
98
- }
99
-
100
- // In SSR, if server returned error, we should render loading state instead of error state
101
- // since FE will do another fetch and render the error state or proper data then
102
- if ((0, _coreUtils.isSSR)() && syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error) {
103
- return /*#__PURE__*/_react.default.createElement(_SyncedBlockLoadingState.SyncedBlockLoadingState, null);
104
- }
105
- if (!resourceId || syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error || !(syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.data) || syncBlockInstance.data.status === 'deleted') {
106
- var _syncBlockInstance$er2, _syncBlockInstance$da3, _syncBlockInstance$da4;
107
- var errorMessage = (_syncBlockInstance$er2 = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er2 !== void 0 ? _syncBlockInstance$er2 : (syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da3 = syncBlockInstance.data) === null || _syncBlockInstance$da3 === void 0 ? void 0 : _syncBlockInstance$da3.status) === 'deleted' ? {
108
- type: _editorSyncedBlockProvider.SyncBlockError.NotFound,
109
- reason: (_syncBlockInstance$da4 = syncBlockInstance.data) === null || _syncBlockInstance$da4 === void 0 ? void 0 : _syncBlockInstance$da4.deletionReason
110
- } : {
111
- type: _editorSyncedBlockProvider.SyncBlockError.Errored,
112
- reason: !resourceId ? 'missing resource id' : "missing data for block ".concat(resourceId)
113
- };
114
- return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
115
- error: errorMessage,
116
- resourceId: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.resourceId,
117
- onRetry: reloadData,
118
- isLoading: isLoading,
119
- fireAnalyticsEvent: fireAnalyticsEvent
120
- });
121
- }
122
- if ((syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da5 = syncBlockInstance.data) === null || _syncBlockInstance$da5 === void 0 ? void 0 : _syncBlockInstance$da5.status) === 'unpublished') {
123
- var _syncBlockInstance$da6;
124
- return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
125
- error: {
126
- type: _editorSyncedBlockProvider.SyncBlockError.Unpublished
127
- },
128
- resourceId: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.resourceId,
129
- sourceURL: (_syncBlockInstance$da6 = syncBlockInstance.data) === null || _syncBlockInstance$da6 === void 0 ? void 0 : _syncBlockInstance$da6.sourceURL,
130
- fireAnalyticsEvent: fireAnalyticsEvent
131
- });
132
- }
133
- var syncBlockDoc = {
134
- content: syncBlockInstance.data.content,
135
- version: 1,
136
- type: 'doc'
64
+ var errorForDisplay = (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : (syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.status) === 'deleted' ? {
65
+ type: _editorSyncedBlockProvider.SyncBlockError.NotFound,
66
+ reason: (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.deletionReason
67
+ } : {
68
+ type: _editorSyncedBlockProvider.SyncBlockError.Errored,
69
+ reason: !resourceId ? 'missing resource id' : "missing data for block ".concat(resourceId)
137
70
  };
138
- return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
139
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
140
- className: _syncBlock.SyncBlockSharedCssClassName.renderer
141
- // eslint-disable-next-line react/jsx-props-no-spreading
142
- }, (0, _defineProperty2.default)({}, _syncBlock.SyncBlockRendererDataAttributeName, true)), /*#__PURE__*/_react.default.createElement(_AKRendererWrapper.AKRendererWrapper, {
143
- doc: syncBlockDoc,
144
- dataProviders: providerFactory,
145
- options: finalRendererOptions
146
- }));
71
+ var result = (0, _renderSyncedBlockContent.renderSyncedBlockContent)({
72
+ syncBlockInstance: syncBlockInstance !== null && syncBlockInstance !== void 0 ? syncBlockInstance : undefined,
73
+ isLoading: isLoading,
74
+ rendererOptions: finalRendererOptions,
75
+ providerFactory: providerFactory,
76
+ reloadData: reloadData,
77
+ fireAnalyticsEvent: fireAnalyticsEvent,
78
+ resourceId: resourceId,
79
+ error: errorForDisplay
80
+ });
81
+ if (result.isSuccess) {
82
+ return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
83
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
84
+ className: _syncBlock.SyncBlockSharedCssClassName.renderer
85
+ // eslint-disable-next-line react/jsx-props-no-spreading
86
+ }, (0, _defineProperty2.default)({}, _syncBlock.SyncBlockRendererDataAttributeName, true)), result.element);
87
+ }
88
+ return result.element;
147
89
  };
@@ -1,27 +1,20 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.SyncedBlockRenderer = void 0;
9
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
- var _react = _interopRequireWildcard(require("react"));
9
+ var _react = require("react");
11
10
  var _coreUtils = require("@atlaskit/editor-common/core-utils");
12
11
  var _hooks = require("@atlaskit/editor-common/hooks");
13
12
  var _syncBlock = require("@atlaskit/editor-common/sync-block");
14
- var _editorSyncedBlockProvider = require("@atlaskit/editor-synced-block-provider");
15
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
- var _AKRendererWrapper = require("./AKRendererWrapper");
17
13
  var _renderSyncedBlockContent = require("./renderSyncedBlockContent");
18
- var _SyncedBlockErrorComponent = require("./SyncedBlockErrorComponent");
19
- var _SyncedBlockLoadingState = require("./SyncedBlockLoadingState");
20
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
21
14
  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; }
22
15
  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; }
23
16
  var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
24
- var _syncBlockInstance$da2;
17
+ var _api$analytics2;
25
18
  var syncBlockRendererOptions = _ref.syncBlockRendererOptions,
26
19
  syncBlockFetchResult = _ref.syncBlockFetchResult,
27
20
  api = _ref.api;
@@ -68,77 +61,18 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
68
61
  }),
69
62
  isCollabOffline = _useSharedPluginState.isCollabOffline,
70
63
  contentMode = _useSharedPluginState.contentMode;
71
- if ((0, _platformFeatureFlags.fg)('platform_synced_block_patch_5')) {
72
- var _api$analytics2;
73
- var result = (0, _renderSyncedBlockContent.renderSyncedBlockContent)({
74
- syncBlockInstance: syncBlockInstance,
75
- isLoading: isLoading,
76
- rendererOptions: contentMode ? _objectSpread(_objectSpread({}, rendererOptions), {}, {
77
- contentMode: contentMode
78
- }) : rendererOptions,
79
- providerFactory: providerFactory,
80
- reloadData: reloadData,
81
- fireAnalyticsEvent: api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.fireAnalyticsEvent,
82
- resourceId: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.resourceId,
83
- isOffline: isCollabOffline
84
- });
85
- return result.element;
86
- }
87
-
88
- // Show offline error only when collaboration is offline and not in SSR mode
89
- // In SSR, we should always attempt to render content
90
- if (isCollabOffline && !isSSRMode) {
91
- return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
92
- error: {
93
- type: _editorSyncedBlockProvider.SyncBlockError.Offline
94
- }
95
- });
96
- }
97
- if (!syncBlockInstance) {
98
- return /*#__PURE__*/_react.default.createElement(_SyncedBlockLoadingState.SyncedBlockLoadingState, null);
99
- }
100
-
101
- // In SSR, if server returned error, we should render loading state instead of error state
102
- // since FE will do another fetch and render the error state or proper data then
103
- if (isSSRMode && syncBlockInstance.error) {
104
- return /*#__PURE__*/_react.default.createElement(_SyncedBlockLoadingState.SyncedBlockLoadingState, null);
105
- }
106
- if (syncBlockInstance.error || !syncBlockInstance.data || syncBlockInstance.data.status === 'deleted') {
107
- var _syncBlockInstance$er, _syncBlockInstance$da, _api$analytics3;
108
- return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
109
- error: (_syncBlockInstance$er = syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : (syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.status) === 'deleted' ? {
110
- type: _editorSyncedBlockProvider.SyncBlockError.NotFound
111
- } : {
112
- type: _editorSyncedBlockProvider.SyncBlockError.Errored
113
- },
114
- resourceId: syncBlockInstance.resourceId,
115
- onRetry: reloadData,
116
- isLoading: isLoading,
117
- fireAnalyticsEvent: api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions.fireAnalyticsEvent
118
- });
119
- }
120
-
121
- // Check for unpublished status
122
- if (((_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.status) === 'unpublished') {
123
- var _syncBlockInstance$da3, _api$analytics4;
124
- return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
125
- error: {
126
- type: _editorSyncedBlockProvider.SyncBlockError.Unpublished
127
- },
128
- resourceId: syncBlockInstance.resourceId,
129
- sourceURL: (_syncBlockInstance$da3 = syncBlockInstance.data) === null || _syncBlockInstance$da3 === void 0 ? void 0 : _syncBlockInstance$da3.sourceURL,
130
- fireAnalyticsEvent: api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions.fireAnalyticsEvent
131
- });
132
- }
133
- var syncBlockDoc = {
134
- content: syncBlockInstance.data.content,
135
- version: 1,
136
- type: 'doc'
137
- };
138
- return /*#__PURE__*/_react.default.createElement(_AKRendererWrapper.AKRendererWrapper, {
139
- doc: syncBlockDoc,
140
- dataProviders: providerFactory,
141
- options: rendererOptions
64
+ var result = (0, _renderSyncedBlockContent.renderSyncedBlockContent)({
65
+ syncBlockInstance: syncBlockInstance,
66
+ isLoading: isLoading,
67
+ rendererOptions: contentMode ? _objectSpread(_objectSpread({}, rendererOptions), {}, {
68
+ contentMode: contentMode
69
+ }) : rendererOptions,
70
+ providerFactory: providerFactory,
71
+ reloadData: reloadData,
72
+ fireAnalyticsEvent: api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.fireAnalyticsEvent,
73
+ resourceId: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.resourceId,
74
+ isOffline: isCollabOffline
142
75
  });
76
+ return result.element;
143
77
  };
144
78
  var SyncedBlockRenderer = exports.SyncedBlockRenderer = /*#__PURE__*/(0, _react.memo)(SyncedBlockRendererComponent);
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { memo, useMemo } from 'react';
3
3
  import { useIntl } from 'react-intl-next';
4
4
  import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
5
- import { fg } from '@atlaskit/platform-feature-flags';
6
5
  import { ReactRenderer, ValidationContextProvider, defaultNodeComponents } from '@atlaskit/renderer';
7
6
  import { RendererActionsContext } from '@atlaskit/renderer/actions';
8
7
  import { RendererContextProvider } from '@atlaskit/renderer/renderer-context';
@@ -131,6 +130,6 @@ export const AKRendererWrapper = /*#__PURE__*/memo(({
131
130
  media: media,
132
131
  smartLinks: smartLinks,
133
132
  stickyHeaders: stickyHeaders,
134
- contentMode: fg('platform_synced_block_patch_5') ? contentMode : undefined
133
+ contentMode: contentMode
135
134
  })))));
136
135
  });
@@ -2,17 +2,13 @@ import React, { useEffect, useMemo } from 'react';
2
2
  import { isSSR } from '@atlaskit/editor-common/core-utils';
3
3
  import { SyncBlockSharedCssClassName, SyncBlockRendererDataAttributeName, handleSSRErrorsAnalytics } from '@atlaskit/editor-common/sync-block';
4
4
  import { SyncBlockError, useFetchSyncBlockData } from '@atlaskit/editor-synced-block-provider';
5
- import { fg } from '@atlaskit/platform-feature-flags';
6
- import { AKRendererWrapper } from './AKRendererWrapper';
7
5
  import { renderSyncedBlockContent } from './renderSyncedBlockContent';
8
- import { SyncedBlockErrorComponent } from './SyncedBlockErrorComponent';
9
- import { SyncedBlockLoadingState } from './SyncedBlockLoadingState';
10
6
  export const SyncedBlockNodeComponentRenderer = ({
11
7
  nodeProps,
12
8
  syncBlockStoreManager,
13
9
  rendererOptions
14
10
  }) => {
15
- var _syncBlockInstance$da5;
11
+ var _syncBlockInstance$er, _syncBlockInstance$da, _syncBlockInstance$da2;
16
12
  const {
17
13
  resourceId,
18
14
  localId,
@@ -58,87 +54,31 @@ export const SyncedBlockNodeComponentRenderer = ({
58
54
  }
59
55
  };
60
56
  }, [rendererOptions, ssrProviders]);
61
- if (fg('platform_synced_block_patch_5')) {
62
- var _syncBlockInstance$er, _syncBlockInstance$da, _syncBlockInstance$da2;
63
- const errorForDisplay = (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : (syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.status) === 'deleted' ? {
64
- type: SyncBlockError.NotFound,
65
- reason: (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.deletionReason
66
- } : {
67
- type: SyncBlockError.Errored,
68
- reason: !resourceId ? 'missing resource id' : `missing data for block ${resourceId}`
69
- };
70
- const result = renderSyncedBlockContent({
71
- syncBlockInstance: syncBlockInstance !== null && syncBlockInstance !== void 0 ? syncBlockInstance : undefined,
72
- isLoading,
73
- rendererOptions: finalRendererOptions,
74
- providerFactory,
75
- reloadData,
76
- fireAnalyticsEvent,
77
- resourceId,
78
- error: errorForDisplay
79
- });
80
- if (result.isSuccess) {
81
- return /*#__PURE__*/React.createElement("div", {
82
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
83
- className: SyncBlockSharedCssClassName.renderer
84
- // eslint-disable-next-line react/jsx-props-no-spreading
85
- ,
86
- [SyncBlockRendererDataAttributeName]: true
87
- }, result.element);
88
- }
89
- return result.element;
90
- }
91
- if (isLoading && !syncBlockInstance) {
92
- return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
93
- }
94
-
95
- // In SSR, if server returned error, we should render loading state instead of error state
96
- // since FE will do another fetch and render the error state or proper data then
97
- if (isSSR() && syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error) {
98
- return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
99
- }
100
- if (!resourceId || syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error || !(syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.data) || syncBlockInstance.data.status === 'deleted') {
101
- var _syncBlockInstance$er2, _syncBlockInstance$da3, _syncBlockInstance$da4;
102
- const errorMessage = (_syncBlockInstance$er2 = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er2 !== void 0 ? _syncBlockInstance$er2 : (syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : (_syncBlockInstance$da3 = syncBlockInstance.data) === null || _syncBlockInstance$da3 === void 0 ? void 0 : _syncBlockInstance$da3.status) === 'deleted' ? {
103
- type: SyncBlockError.NotFound,
104
- reason: (_syncBlockInstance$da4 = syncBlockInstance.data) === null || _syncBlockInstance$da4 === void 0 ? void 0 : _syncBlockInstance$da4.deletionReason
105
- } : {
106
- type: SyncBlockError.Errored,
107
- reason: !resourceId ? 'missing resource id' : `missing data for block ${resourceId}`
108
- };
109
- return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
110
- error: errorMessage,
111
- resourceId: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.resourceId,
112
- onRetry: reloadData,
113
- isLoading: isLoading,
114
- fireAnalyticsEvent: fireAnalyticsEvent
115
- });
116
- }
117
- if ((syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : (_syncBlockInstance$da5 = syncBlockInstance.data) === null || _syncBlockInstance$da5 === void 0 ? void 0 : _syncBlockInstance$da5.status) === 'unpublished') {
118
- var _syncBlockInstance$da6;
119
- return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
120
- error: {
121
- type: SyncBlockError.Unpublished
122
- },
123
- resourceId: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.resourceId,
124
- sourceURL: (_syncBlockInstance$da6 = syncBlockInstance.data) === null || _syncBlockInstance$da6 === void 0 ? void 0 : _syncBlockInstance$da6.sourceURL,
125
- fireAnalyticsEvent: fireAnalyticsEvent
126
- });
127
- }
128
- const syncBlockDoc = {
129
- content: syncBlockInstance.data.content,
130
- version: 1,
131
- type: 'doc'
57
+ const errorForDisplay = (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : (syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.status) === 'deleted' ? {
58
+ type: SyncBlockError.NotFound,
59
+ reason: (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.deletionReason
60
+ } : {
61
+ type: SyncBlockError.Errored,
62
+ reason: !resourceId ? 'missing resource id' : `missing data for block ${resourceId}`
132
63
  };
133
- return /*#__PURE__*/React.createElement("div", {
134
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
135
- className: SyncBlockSharedCssClassName.renderer
136
- // eslint-disable-next-line react/jsx-props-no-spreading
137
- ,
138
- [SyncBlockRendererDataAttributeName]: true
139
- }, /*#__PURE__*/React.createElement(AKRendererWrapper, {
140
- doc: syncBlockDoc,
141
- dataProviders: providerFactory,
142
- options: finalRendererOptions
143
- }));
64
+ const result = renderSyncedBlockContent({
65
+ syncBlockInstance: syncBlockInstance !== null && syncBlockInstance !== void 0 ? syncBlockInstance : undefined,
66
+ isLoading,
67
+ rendererOptions: finalRendererOptions,
68
+ providerFactory,
69
+ reloadData,
70
+ fireAnalyticsEvent,
71
+ resourceId,
72
+ error: errorForDisplay
73
+ });
74
+ if (result.isSuccess) {
75
+ return /*#__PURE__*/React.createElement("div", {
76
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
77
+ className: SyncBlockSharedCssClassName.renderer
78
+ // eslint-disable-next-line react/jsx-props-no-spreading
79
+ ,
80
+ [SyncBlockRendererDataAttributeName]: true
81
+ }, result.element);
82
+ }
83
+ return result.element;
144
84
  };
@@ -1,19 +1,14 @@
1
- import React, { memo, useEffect, useMemo } from 'react';
1
+ import { memo, useEffect, useMemo } from 'react';
2
2
  import { isSSR } from '@atlaskit/editor-common/core-utils';
3
3
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
4
  import { handleSSRErrorsAnalytics } from '@atlaskit/editor-common/sync-block';
5
- import { SyncBlockError } from '@atlaskit/editor-synced-block-provider';
6
- import { fg } from '@atlaskit/platform-feature-flags';
7
- import { AKRendererWrapper } from './AKRendererWrapper';
8
5
  import { renderSyncedBlockContent } from './renderSyncedBlockContent';
9
- import { SyncedBlockErrorComponent } from './SyncedBlockErrorComponent';
10
- import { SyncedBlockLoadingState } from './SyncedBlockLoadingState';
11
6
  const SyncedBlockRendererComponent = ({
12
7
  syncBlockRendererOptions,
13
8
  syncBlockFetchResult,
14
9
  api
15
10
  }) => {
16
- var _syncBlockInstance$da2;
11
+ var _api$analytics2;
17
12
  useEffect(() => {
18
13
  const timeoutId = setTimeout(() => {
19
14
  var _api$analytics;
@@ -61,78 +56,19 @@ const SyncedBlockRendererComponent = ({
61
56
  isCollabOffline: (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'collab-offline',
62
57
  contentMode: contentFormatState === null || contentFormatState === void 0 ? void 0 : contentFormatState.contentMode
63
58
  }));
64
- if (fg('platform_synced_block_patch_5')) {
65
- var _api$analytics2;
66
- const result = renderSyncedBlockContent({
67
- syncBlockInstance,
68
- isLoading,
69
- rendererOptions: contentMode ? {
70
- ...rendererOptions,
71
- contentMode
72
- } : rendererOptions,
73
- providerFactory,
74
- reloadData,
75
- fireAnalyticsEvent: api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.fireAnalyticsEvent,
76
- resourceId: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.resourceId,
77
- isOffline: isCollabOffline
78
- });
79
- return result.element;
80
- }
81
-
82
- // Show offline error only when collaboration is offline and not in SSR mode
83
- // In SSR, we should always attempt to render content
84
- if (isCollabOffline && !isSSRMode) {
85
- return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
86
- error: {
87
- type: SyncBlockError.Offline
88
- }
89
- });
90
- }
91
- if (!syncBlockInstance) {
92
- return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
93
- }
94
-
95
- // In SSR, if server returned error, we should render loading state instead of error state
96
- // since FE will do another fetch and render the error state or proper data then
97
- if (isSSRMode && syncBlockInstance.error) {
98
- return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
99
- }
100
- if (syncBlockInstance.error || !syncBlockInstance.data || syncBlockInstance.data.status === 'deleted') {
101
- var _syncBlockInstance$er, _syncBlockInstance$da, _api$analytics3;
102
- return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
103
- error: (_syncBlockInstance$er = syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : (syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.status) === 'deleted' ? {
104
- type: SyncBlockError.NotFound
105
- } : {
106
- type: SyncBlockError.Errored
107
- },
108
- resourceId: syncBlockInstance.resourceId,
109
- onRetry: reloadData,
110
- isLoading: isLoading,
111
- fireAnalyticsEvent: api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions.fireAnalyticsEvent
112
- });
113
- }
114
-
115
- // Check for unpublished status
116
- if (((_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.status) === 'unpublished') {
117
- var _syncBlockInstance$da3, _api$analytics4;
118
- return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
119
- error: {
120
- type: SyncBlockError.Unpublished
121
- },
122
- resourceId: syncBlockInstance.resourceId,
123
- sourceURL: (_syncBlockInstance$da3 = syncBlockInstance.data) === null || _syncBlockInstance$da3 === void 0 ? void 0 : _syncBlockInstance$da3.sourceURL,
124
- fireAnalyticsEvent: api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions.fireAnalyticsEvent
125
- });
126
- }
127
- const syncBlockDoc = {
128
- content: syncBlockInstance.data.content,
129
- version: 1,
130
- type: 'doc'
131
- };
132
- return /*#__PURE__*/React.createElement(AKRendererWrapper, {
133
- doc: syncBlockDoc,
134
- dataProviders: providerFactory,
135
- options: rendererOptions
59
+ const result = renderSyncedBlockContent({
60
+ syncBlockInstance,
61
+ isLoading,
62
+ rendererOptions: contentMode ? {
63
+ ...rendererOptions,
64
+ contentMode
65
+ } : rendererOptions,
66
+ providerFactory,
67
+ reloadData,
68
+ fireAnalyticsEvent: api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.fireAnalyticsEvent,
69
+ resourceId: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.resourceId,
70
+ isOffline: isCollabOffline
136
71
  });
72
+ return result.element;
137
73
  };
138
74
  export const SyncedBlockRenderer = /*#__PURE__*/memo(SyncedBlockRendererComponent);
@@ -7,7 +7,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  import React, { memo, useMemo } from 'react';
8
8
  import { useIntl } from 'react-intl-next';
9
9
  import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
10
- import { fg } from '@atlaskit/platform-feature-flags';
11
10
  import { ReactRenderer, ValidationContextProvider, defaultNodeComponents } from '@atlaskit/renderer';
12
11
  import { RendererActionsContext } from '@atlaskit/renderer/actions';
13
12
  import { RendererContextProvider } from '@atlaskit/renderer/renderer-context';
@@ -130,6 +129,6 @@ export var AKRendererWrapper = /*#__PURE__*/memo(function (_ref3) {
130
129
  media: media,
131
130
  smartLinks: smartLinks,
132
131
  stickyHeaders: stickyHeaders,
133
- contentMode: fg('platform_synced_block_patch_5') ? contentMode : undefined
132
+ contentMode: contentMode
134
133
  })))));
135
134
  });
@@ -6,13 +6,9 @@ import React, { useEffect, useMemo } from 'react';
6
6
  import { isSSR } from '@atlaskit/editor-common/core-utils';
7
7
  import { SyncBlockSharedCssClassName, SyncBlockRendererDataAttributeName, handleSSRErrorsAnalytics } from '@atlaskit/editor-common/sync-block';
8
8
  import { SyncBlockError, useFetchSyncBlockData } from '@atlaskit/editor-synced-block-provider';
9
- import { fg } from '@atlaskit/platform-feature-flags';
10
- import { AKRendererWrapper } from './AKRendererWrapper';
11
9
  import { renderSyncedBlockContent } from './renderSyncedBlockContent';
12
- import { SyncedBlockErrorComponent } from './SyncedBlockErrorComponent';
13
- import { SyncedBlockLoadingState } from './SyncedBlockLoadingState';
14
10
  export var SyncedBlockNodeComponentRenderer = function SyncedBlockNodeComponentRenderer(_ref) {
15
- var _syncBlockInstance$da5;
11
+ var _syncBlockInstance$er, _syncBlockInstance$da, _syncBlockInstance$da2;
16
12
  var nodeProps = _ref.nodeProps,
17
13
  syncBlockStoreManager = _ref.syncBlockStoreManager,
18
14
  rendererOptions = _ref.rendererOptions;
@@ -56,83 +52,29 @@ export var SyncedBlockNodeComponentRenderer = function SyncedBlockNodeComponentR
56
52
  })
57
53
  });
58
54
  }, [rendererOptions, ssrProviders]);
59
- if (fg('platform_synced_block_patch_5')) {
60
- var _syncBlockInstance$er, _syncBlockInstance$da, _syncBlockInstance$da2;
61
- var errorForDisplay = (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : (syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.status) === 'deleted' ? {
62
- type: SyncBlockError.NotFound,
63
- reason: (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.deletionReason
64
- } : {
65
- type: SyncBlockError.Errored,
66
- reason: !resourceId ? 'missing resource id' : "missing data for block ".concat(resourceId)
67
- };
68
- var result = renderSyncedBlockContent({
69
- syncBlockInstance: syncBlockInstance !== null && syncBlockInstance !== void 0 ? syncBlockInstance : undefined,
70
- isLoading: isLoading,
71
- rendererOptions: finalRendererOptions,
72
- providerFactory: providerFactory,
73
- reloadData: reloadData,
74
- fireAnalyticsEvent: fireAnalyticsEvent,
75
- resourceId: resourceId,
76
- error: errorForDisplay
77
- });
78
- if (result.isSuccess) {
79
- return /*#__PURE__*/React.createElement("div", _extends({
80
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
81
- className: SyncBlockSharedCssClassName.renderer
82
- // eslint-disable-next-line react/jsx-props-no-spreading
83
- }, _defineProperty({}, SyncBlockRendererDataAttributeName, true)), result.element);
84
- }
85
- return result.element;
86
- }
87
- if (isLoading && !syncBlockInstance) {
88
- return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
89
- }
90
-
91
- // In SSR, if server returned error, we should render loading state instead of error state
92
- // since FE will do another fetch and render the error state or proper data then
93
- if (isSSR() && syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error) {
94
- return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
95
- }
96
- if (!resourceId || syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error || !(syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.data) || syncBlockInstance.data.status === 'deleted') {
97
- var _syncBlockInstance$er2, _syncBlockInstance$da3, _syncBlockInstance$da4;
98
- var errorMessage = (_syncBlockInstance$er2 = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er2 !== void 0 ? _syncBlockInstance$er2 : (syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da3 = syncBlockInstance.data) === null || _syncBlockInstance$da3 === void 0 ? void 0 : _syncBlockInstance$da3.status) === 'deleted' ? {
99
- type: SyncBlockError.NotFound,
100
- reason: (_syncBlockInstance$da4 = syncBlockInstance.data) === null || _syncBlockInstance$da4 === void 0 ? void 0 : _syncBlockInstance$da4.deletionReason
101
- } : {
102
- type: SyncBlockError.Errored,
103
- reason: !resourceId ? 'missing resource id' : "missing data for block ".concat(resourceId)
104
- };
105
- return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
106
- error: errorMessage,
107
- resourceId: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.resourceId,
108
- onRetry: reloadData,
109
- isLoading: isLoading,
110
- fireAnalyticsEvent: fireAnalyticsEvent
111
- });
112
- }
113
- if ((syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da5 = syncBlockInstance.data) === null || _syncBlockInstance$da5 === void 0 ? void 0 : _syncBlockInstance$da5.status) === 'unpublished') {
114
- var _syncBlockInstance$da6;
115
- return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
116
- error: {
117
- type: SyncBlockError.Unpublished
118
- },
119
- resourceId: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.resourceId,
120
- sourceURL: (_syncBlockInstance$da6 = syncBlockInstance.data) === null || _syncBlockInstance$da6 === void 0 ? void 0 : _syncBlockInstance$da6.sourceURL,
121
- fireAnalyticsEvent: fireAnalyticsEvent
122
- });
123
- }
124
- var syncBlockDoc = {
125
- content: syncBlockInstance.data.content,
126
- version: 1,
127
- type: 'doc'
55
+ var errorForDisplay = (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : (syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.status) === 'deleted' ? {
56
+ type: SyncBlockError.NotFound,
57
+ reason: (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.deletionReason
58
+ } : {
59
+ type: SyncBlockError.Errored,
60
+ reason: !resourceId ? 'missing resource id' : "missing data for block ".concat(resourceId)
128
61
  };
129
- return /*#__PURE__*/React.createElement("div", _extends({
130
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
131
- className: SyncBlockSharedCssClassName.renderer
132
- // eslint-disable-next-line react/jsx-props-no-spreading
133
- }, _defineProperty({}, SyncBlockRendererDataAttributeName, true)), /*#__PURE__*/React.createElement(AKRendererWrapper, {
134
- doc: syncBlockDoc,
135
- dataProviders: providerFactory,
136
- options: finalRendererOptions
137
- }));
62
+ var result = renderSyncedBlockContent({
63
+ syncBlockInstance: syncBlockInstance !== null && syncBlockInstance !== void 0 ? syncBlockInstance : undefined,
64
+ isLoading: isLoading,
65
+ rendererOptions: finalRendererOptions,
66
+ providerFactory: providerFactory,
67
+ reloadData: reloadData,
68
+ fireAnalyticsEvent: fireAnalyticsEvent,
69
+ resourceId: resourceId,
70
+ error: errorForDisplay
71
+ });
72
+ if (result.isSuccess) {
73
+ return /*#__PURE__*/React.createElement("div", _extends({
74
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
75
+ className: SyncBlockSharedCssClassName.renderer
76
+ // eslint-disable-next-line react/jsx-props-no-spreading
77
+ }, _defineProperty({}, SyncBlockRendererDataAttributeName, true)), result.element);
78
+ }
79
+ return result.element;
138
80
  };
@@ -1,18 +1,13 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  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; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- import React, { memo, useEffect, useMemo } from 'react';
4
+ import { memo, useEffect, useMemo } from 'react';
5
5
  import { isSSR } from '@atlaskit/editor-common/core-utils';
6
6
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
7
7
  import { handleSSRErrorsAnalytics } from '@atlaskit/editor-common/sync-block';
8
- import { SyncBlockError } from '@atlaskit/editor-synced-block-provider';
9
- import { fg } from '@atlaskit/platform-feature-flags';
10
- import { AKRendererWrapper } from './AKRendererWrapper';
11
8
  import { renderSyncedBlockContent } from './renderSyncedBlockContent';
12
- import { SyncedBlockErrorComponent } from './SyncedBlockErrorComponent';
13
- import { SyncedBlockLoadingState } from './SyncedBlockLoadingState';
14
9
  var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
15
- var _syncBlockInstance$da2;
10
+ var _api$analytics2;
16
11
  var syncBlockRendererOptions = _ref.syncBlockRendererOptions,
17
12
  syncBlockFetchResult = _ref.syncBlockFetchResult,
18
13
  api = _ref.api;
@@ -59,77 +54,18 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
59
54
  }),
60
55
  isCollabOffline = _useSharedPluginState.isCollabOffline,
61
56
  contentMode = _useSharedPluginState.contentMode;
62
- if (fg('platform_synced_block_patch_5')) {
63
- var _api$analytics2;
64
- var result = renderSyncedBlockContent({
65
- syncBlockInstance: syncBlockInstance,
66
- isLoading: isLoading,
67
- rendererOptions: contentMode ? _objectSpread(_objectSpread({}, rendererOptions), {}, {
68
- contentMode: contentMode
69
- }) : rendererOptions,
70
- providerFactory: providerFactory,
71
- reloadData: reloadData,
72
- fireAnalyticsEvent: api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.fireAnalyticsEvent,
73
- resourceId: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.resourceId,
74
- isOffline: isCollabOffline
75
- });
76
- return result.element;
77
- }
78
-
79
- // Show offline error only when collaboration is offline and not in SSR mode
80
- // In SSR, we should always attempt to render content
81
- if (isCollabOffline && !isSSRMode) {
82
- return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
83
- error: {
84
- type: SyncBlockError.Offline
85
- }
86
- });
87
- }
88
- if (!syncBlockInstance) {
89
- return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
90
- }
91
-
92
- // In SSR, if server returned error, we should render loading state instead of error state
93
- // since FE will do another fetch and render the error state or proper data then
94
- if (isSSRMode && syncBlockInstance.error) {
95
- return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
96
- }
97
- if (syncBlockInstance.error || !syncBlockInstance.data || syncBlockInstance.data.status === 'deleted') {
98
- var _syncBlockInstance$er, _syncBlockInstance$da, _api$analytics3;
99
- return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
100
- error: (_syncBlockInstance$er = syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : (syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.status) === 'deleted' ? {
101
- type: SyncBlockError.NotFound
102
- } : {
103
- type: SyncBlockError.Errored
104
- },
105
- resourceId: syncBlockInstance.resourceId,
106
- onRetry: reloadData,
107
- isLoading: isLoading,
108
- fireAnalyticsEvent: api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions.fireAnalyticsEvent
109
- });
110
- }
111
-
112
- // Check for unpublished status
113
- if (((_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.status) === 'unpublished') {
114
- var _syncBlockInstance$da3, _api$analytics4;
115
- return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
116
- error: {
117
- type: SyncBlockError.Unpublished
118
- },
119
- resourceId: syncBlockInstance.resourceId,
120
- sourceURL: (_syncBlockInstance$da3 = syncBlockInstance.data) === null || _syncBlockInstance$da3 === void 0 ? void 0 : _syncBlockInstance$da3.sourceURL,
121
- fireAnalyticsEvent: api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions.fireAnalyticsEvent
122
- });
123
- }
124
- var syncBlockDoc = {
125
- content: syncBlockInstance.data.content,
126
- version: 1,
127
- type: 'doc'
128
- };
129
- return /*#__PURE__*/React.createElement(AKRendererWrapper, {
130
- doc: syncBlockDoc,
131
- dataProviders: providerFactory,
132
- options: rendererOptions
57
+ var result = renderSyncedBlockContent({
58
+ syncBlockInstance: syncBlockInstance,
59
+ isLoading: isLoading,
60
+ rendererOptions: contentMode ? _objectSpread(_objectSpread({}, rendererOptions), {}, {
61
+ contentMode: contentMode
62
+ }) : rendererOptions,
63
+ providerFactory: providerFactory,
64
+ reloadData: reloadData,
65
+ fireAnalyticsEvent: api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.fireAnalyticsEvent,
66
+ resourceId: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.resourceId,
67
+ isOffline: isCollabOffline
133
68
  });
69
+ return result.element;
134
70
  };
135
71
  export var SyncedBlockRenderer = /*#__PURE__*/memo(SyncedBlockRendererComponent);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-synced-block-renderer",
3
- "version": "6.0.2",
3
+ "version": "6.0.3",
4
4
  "description": "SyncedBlockRenderer for @atlaskit/editor-plugin-synced-block",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,24 +31,24 @@
31
31
  "@atlaskit/button": "^23.10.0",
32
32
  "@atlaskit/css": "^0.19.0",
33
33
  "@atlaskit/editor-plugin-synced-block": "^6.0.0",
34
- "@atlaskit/editor-synced-block-provider": "^4.0.0",
34
+ "@atlaskit/editor-synced-block-provider": "^4.1.0",
35
35
  "@atlaskit/heading": "^5.3.0",
36
36
  "@atlaskit/icon": "^33.0.0",
37
37
  "@atlaskit/icon-lab": "^6.0.0",
38
38
  "@atlaskit/image": "^3.0.0",
39
39
  "@atlaskit/platform-feature-flags": "^1.1.0",
40
40
  "@atlaskit/primitives": "^18.0.0",
41
- "@atlaskit/renderer": "^128.0.0",
41
+ "@atlaskit/renderer": "^128.2.0",
42
42
  "@atlaskit/spinner": "^19.0.0",
43
43
  "@atlaskit/tokens": "^11.1.0",
44
- "@atlaskit/tooltip": "^20.14.0",
44
+ "@atlaskit/tooltip": "^21.0.0",
45
45
  "@babel/runtime": "^7.0.0",
46
46
  "@compiled/react": "^0.20.0",
47
47
  "react-relay": "npm:atl-react-relay@0.0.0-main-39e79f66",
48
48
  "relay-runtime": "npm:atl-relay-runtime@0.0.0-main-39e79f66"
49
49
  },
50
50
  "peerDependencies": {
51
- "@atlaskit/editor-common": "^112.4.0",
51
+ "@atlaskit/editor-common": "^112.6.0",
52
52
  "react": "^18.2.0",
53
53
  "react-intl-next": "npm:react-intl@^5.18.1"
54
54
  },
@@ -88,9 +88,5 @@
88
88
  ]
89
89
  }
90
90
  },
91
- "platform-feature-flags": {
92
- "platform_synced_block_patch_5": {
93
- "type": "boolean"
94
- }
95
- }
91
+ "platform-feature-flags": {}
96
92
  }