@atlaskit/editor-synced-block-renderer 6.0.2 → 6.0.4

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 (37) hide show
  1. package/AGENTS.md +112 -0
  2. package/CHANGELOG.md +16 -0
  3. package/dist/cjs/ui/AKRendererWrapper.js +1 -2
  4. package/dist/cjs/ui/SyncedBlockLoadError.js +3 -1
  5. package/dist/cjs/ui/SyncedBlockNodeComponentRenderer.js +25 -83
  6. package/dist/cjs/ui/SyncedBlockRenderer.js +14 -80
  7. package/dist/cjs/ui/renderSyncedBlockContent.js +3 -1
  8. package/dist/cjs/useSyncedBlockNodeComponent.js +3 -1
  9. package/dist/es2019/ui/AKRendererWrapper.js +1 -2
  10. package/dist/es2019/ui/SyncedBlockLoadError.js +3 -1
  11. package/dist/es2019/ui/SyncedBlockNodeComponentRenderer.js +27 -87
  12. package/dist/es2019/ui/SyncedBlockRenderer.js +15 -79
  13. package/dist/es2019/ui/renderSyncedBlockContent.js +3 -1
  14. package/dist/es2019/useSyncedBlockNodeComponent.js +3 -1
  15. package/dist/esm/ui/AKRendererWrapper.js +1 -2
  16. package/dist/esm/ui/SyncedBlockLoadError.js +3 -1
  17. package/dist/esm/ui/SyncedBlockNodeComponentRenderer.js +25 -83
  18. package/dist/esm/ui/SyncedBlockRenderer.js +14 -78
  19. package/dist/esm/ui/renderSyncedBlockContent.js +3 -1
  20. package/dist/esm/useSyncedBlockNodeComponent.js +3 -1
  21. package/dist/types/types.d.ts +1 -1
  22. package/dist/types/ui/SyncedBlockErrorComponent.d.ts +1 -1
  23. package/dist/types/ui/SyncedBlockErrorStateCard.d.ts +2 -1
  24. package/dist/types/ui/SyncedBlockNodeComponentRenderer.d.ts +1 -1
  25. package/dist/types/ui/SyncedBlockPermissionDenied.d.ts +1 -1
  26. package/dist/types/ui/SyncedBlockRenderer.d.ts +1 -1
  27. package/dist/types/ui/renderSyncedBlockContent.d.ts +1 -1
  28. package/dist/types/useSyncedBlockNodeComponent.d.ts +3 -3
  29. package/dist/types-ts4.5/types.d.ts +1 -1
  30. package/dist/types-ts4.5/ui/SyncedBlockErrorComponent.d.ts +1 -1
  31. package/dist/types-ts4.5/ui/SyncedBlockErrorStateCard.d.ts +2 -1
  32. package/dist/types-ts4.5/ui/SyncedBlockNodeComponentRenderer.d.ts +1 -1
  33. package/dist/types-ts4.5/ui/SyncedBlockPermissionDenied.d.ts +1 -1
  34. package/dist/types-ts4.5/ui/SyncedBlockRenderer.d.ts +1 -1
  35. package/dist/types-ts4.5/ui/renderSyncedBlockContent.d.ts +1 -1
  36. package/dist/types-ts4.5/useSyncedBlockNodeComponent.d.ts +3 -3
  37. package/package.json +10 -14
@@ -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);
@@ -26,6 +26,7 @@ export function renderSyncedBlockContent({
26
26
  const isSSRMode = isSSR();
27
27
  if (isOffline && !isSSRMode) {
28
28
  return {
29
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
29
30
  element: /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
30
31
  error: {
31
32
  type: SyncBlockError.Offline
@@ -67,7 +68,8 @@ export function renderSyncedBlockContent({
67
68
  if ((syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.status) === 'unpublished') {
68
69
  var _syncBlockInstance$da3;
69
70
  return {
70
- element: /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
71
+ element: /*#__PURE__*/React.createElement(SyncedBlockErrorComponent
72
+ /* eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed) */, {
71
73
  error: {
72
74
  type: SyncBlockError.Unpublished
73
75
  },
@@ -41,7 +41,9 @@ export const useMemoizedSyncedBlockNodeComponent = ({
41
41
  component: ACTION_SUBJECT.SYNCED_BLOCK,
42
42
  dispatchAnalyticsEvent: fireAnalyticsEvent,
43
43
  fallbackComponent: null
44
- }, /*#__PURE__*/React.createElement(SyncBlockActionsProvider, {
44
+ }, /*#__PURE__*/React.createElement(SyncBlockActionsProvider
45
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
46
+ , {
45
47
  fetchSyncBlockSourceInfo: sourceAri => syncBlockStoreManager.referenceManager.fetchSyncBlockSourceInfoBySourceAri(sourceAri)
46
48
  }, /*#__PURE__*/React.createElement(SyncedBlockNodeComponentRenderer, {
47
49
  key: props.localId,
@@ -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
  });
@@ -17,7 +17,9 @@ export var SyncedBlockLoadError = function SyncedBlockLoadError(_ref) {
17
17
  formatMessage = _useIntl.formatMessage;
18
18
  var button = /*#__PURE__*/React.createElement(Button, {
19
19
  appearance: "default",
20
- spacing: "compact",
20
+ spacing: "compact"
21
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
22
+ ,
21
23
  onClick: function onClick(event) {
22
24
  event.preventDefault();
23
25
  event.stopPropagation();
@@ -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);
@@ -25,6 +25,7 @@ export function renderSyncedBlockContent(_ref) {
25
25
  var isSSRMode = isSSR();
26
26
  if (isOffline && !isSSRMode) {
27
27
  return {
28
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
28
29
  element: /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
29
30
  error: {
30
31
  type: SyncBlockError.Offline
@@ -66,7 +67,8 @@ export function renderSyncedBlockContent(_ref) {
66
67
  if ((syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.status) === 'unpublished') {
67
68
  var _syncBlockInstance$da3;
68
69
  return {
69
- element: /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
70
+ element: /*#__PURE__*/React.createElement(SyncedBlockErrorComponent
71
+ /* eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed) */, {
70
72
  error: {
71
73
  type: SyncBlockError.Unpublished
72
74
  },
@@ -43,7 +43,9 @@ export var useMemoizedSyncedBlockNodeComponent = function useMemoizedSyncedBlock
43
43
  component: ACTION_SUBJECT.SYNCED_BLOCK,
44
44
  dispatchAnalyticsEvent: fireAnalyticsEvent,
45
45
  fallbackComponent: null
46
- }, /*#__PURE__*/React.createElement(SyncBlockActionsProvider, {
46
+ }, /*#__PURE__*/React.createElement(SyncBlockActionsProvider
47
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
48
+ , {
47
49
  fetchSyncBlockSourceInfo: function fetchSyncBlockSourceInfo(sourceAri) {
48
50
  return syncBlockStoreManager.referenceManager.fetchSyncBlockSourceInfoBySourceAri(sourceAri);
49
51
  }
@@ -1,2 +1,2 @@
1
- import { type RendererProps } from '@atlaskit/renderer';
1
+ import type { RendererProps } from '@atlaskit/renderer';
2
2
  export type SyncedBlockRendererOptions = Pick<RendererProps, 'appearance' | 'allowAltTextOnImages' | 'allowAnnotations' | 'allowColumnSorting' | 'allowCopyToClipboard' | 'allowCustomPanels' | 'allowHeadingAnchorLinks' | 'allowPlaceholderText' | 'allowRendererContainerStyles' | 'allowSelectAllTrap' | 'allowUgcScrubber' | 'allowWrapCodeBlock' | 'emojiResourceConfig' | 'eventHandlers' | 'media' | 'smartLinks' | 'stickyHeaders' | 'contentMode'>;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
3
- import { type SyncBlockInstance } from '@atlaskit/editor-synced-block-provider';
3
+ import type { SyncBlockInstance } from '@atlaskit/editor-synced-block-provider';
4
4
  export declare const SyncedBlockErrorComponent: ({ error, isLoading, onRetry, resourceId, fireAnalyticsEvent, sourceURL, }: {
5
5
  error: SyncBlockInstance["error"];
6
6
  fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void;
@@ -1,4 +1,5 @@
1
- import React, { type ReactNode } from 'react';
1
+ import React from 'react';
2
+ import type { ReactNode } from 'react';
2
3
  import type { NewCoreIconProps } from '@atlaskit/icon/types';
3
4
  interface SyncedBlockErrorStateCardProps {
4
5
  children?: ReactNode;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
3
- import { type NodeProps } from '@atlaskit/renderer';
3
+ import type { NodeProps } from '@atlaskit/renderer';
4
4
  import type { SyncedBlockRendererOptions } from '../types';
5
5
  export interface SyncedBlockProps {
6
6
  localId?: string;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { type SyncBlockProduct } from '@atlaskit/editor-synced-block-provider';
2
+ import type { SyncBlockProduct } from '@atlaskit/editor-synced-block-provider';
3
3
  export interface SyncedBlockPermissionDeniedProps {
4
4
  sourceContentId: string;
5
5
  sourceProduct: SyncBlockProduct;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { SyncedBlockPlugin } from '@atlaskit/editor-plugin-synced-block';
4
- import { type UseFetchSyncBlockDataResult } from '@atlaskit/editor-synced-block-provider';
4
+ import type { UseFetchSyncBlockDataResult } from '@atlaskit/editor-synced-block-provider';
5
5
  import type { SyncedBlockRendererOptions } from '../types';
6
6
  export type SyncedBlockRendererProps = {
7
7
  api?: ExtractInjectionAPI<SyncedBlockPlugin>;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
3
3
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
4
- import { type SyncBlockInstance } from '@atlaskit/editor-synced-block-provider';
4
+ import type { SyncBlockInstance } from '@atlaskit/editor-synced-block-provider';
5
5
  import type { SyncedBlockRendererOptions } from '../types';
6
6
  export type RenderSyncedBlockContentParams = {
7
7
  error?: SyncBlockInstance['error'];
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { DocNode } from '@atlaskit/adf-schema';
3
- import { type AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
4
- import { type SyncBlockNode, type SyncedBlockProvider, type SyncBlockPrefetchData } from '@atlaskit/editor-synced-block-provider';
3
+ import type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
4
+ import type { SyncBlockNode, SyncedBlockProvider, SyncBlockPrefetchData } from '@atlaskit/editor-synced-block-provider';
5
5
  import type { SyncedBlockRendererOptions } from './types';
6
- import { type SyncedBlockNodeProps } from './ui/SyncedBlockNodeComponentRenderer';
6
+ import type { SyncedBlockNodeProps } from './ui/SyncedBlockNodeComponentRenderer';
7
7
  export type GetSyncedBlockNodeComponentProps = {
8
8
  fireAnalyticsEvent?: (payload: AnalyticsEventPayload) => void;
9
9
  getPrefetchedData?: () => SyncBlockPrefetchData | undefined;
@@ -1,2 +1,2 @@
1
- import { type RendererProps } from '@atlaskit/renderer';
1
+ import type { RendererProps } from '@atlaskit/renderer';
2
2
  export type SyncedBlockRendererOptions = Pick<RendererProps, 'appearance' | 'allowAltTextOnImages' | 'allowAnnotations' | 'allowColumnSorting' | 'allowCopyToClipboard' | 'allowCustomPanels' | 'allowHeadingAnchorLinks' | 'allowPlaceholderText' | 'allowRendererContainerStyles' | 'allowSelectAllTrap' | 'allowUgcScrubber' | 'allowWrapCodeBlock' | 'emojiResourceConfig' | 'eventHandlers' | 'media' | 'smartLinks' | 'stickyHeaders' | 'contentMode'>;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
3
- import { type SyncBlockInstance } from '@atlaskit/editor-synced-block-provider';
3
+ import type { SyncBlockInstance } from '@atlaskit/editor-synced-block-provider';
4
4
  export declare const SyncedBlockErrorComponent: ({ error, isLoading, onRetry, resourceId, fireAnalyticsEvent, sourceURL, }: {
5
5
  error: SyncBlockInstance["error"];
6
6
  fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void;
@@ -1,4 +1,5 @@
1
- import React, { type ReactNode } from 'react';
1
+ import React from 'react';
2
+ import type { ReactNode } from 'react';
2
3
  import type { NewCoreIconProps } from '@atlaskit/icon/types';
3
4
  interface SyncedBlockErrorStateCardProps {
4
5
  children?: ReactNode;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
3
- import { type NodeProps } from '@atlaskit/renderer';
3
+ import type { NodeProps } from '@atlaskit/renderer';
4
4
  import type { SyncedBlockRendererOptions } from '../types';
5
5
  export interface SyncedBlockProps {
6
6
  localId?: string;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { type SyncBlockProduct } from '@atlaskit/editor-synced-block-provider';
2
+ import type { SyncBlockProduct } from '@atlaskit/editor-synced-block-provider';
3
3
  export interface SyncedBlockPermissionDeniedProps {
4
4
  sourceContentId: string;
5
5
  sourceProduct: SyncBlockProduct;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { SyncedBlockPlugin } from '@atlaskit/editor-plugin-synced-block';
4
- import { type UseFetchSyncBlockDataResult } from '@atlaskit/editor-synced-block-provider';
4
+ import type { UseFetchSyncBlockDataResult } from '@atlaskit/editor-synced-block-provider';
5
5
  import type { SyncedBlockRendererOptions } from '../types';
6
6
  export type SyncedBlockRendererProps = {
7
7
  api?: ExtractInjectionAPI<SyncedBlockPlugin>;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
3
3
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
4
- import { type SyncBlockInstance } from '@atlaskit/editor-synced-block-provider';
4
+ import type { SyncBlockInstance } from '@atlaskit/editor-synced-block-provider';
5
5
  import type { SyncedBlockRendererOptions } from '../types';
6
6
  export type RenderSyncedBlockContentParams = {
7
7
  error?: SyncBlockInstance['error'];
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { DocNode } from '@atlaskit/adf-schema';
3
- import { type AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
4
- import { type SyncBlockNode, type SyncedBlockProvider, type SyncBlockPrefetchData } from '@atlaskit/editor-synced-block-provider';
3
+ import type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
4
+ import type { SyncBlockNode, SyncedBlockProvider, SyncBlockPrefetchData } from '@atlaskit/editor-synced-block-provider';
5
5
  import type { SyncedBlockRendererOptions } from './types';
6
- import { type SyncedBlockNodeProps } from './ui/SyncedBlockNodeComponentRenderer';
6
+ import type { SyncedBlockNodeProps } from './ui/SyncedBlockNodeComponentRenderer';
7
7
  export type GetSyncedBlockNodeComponentProps = {
8
8
  fireAnalyticsEvent?: (payload: AnalyticsEventPayload) => void;
9
9
  getPrefetchedData?: () => SyncBlockPrefetchData | undefined;