@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
package/AGENTS.md ADDED
@@ -0,0 +1,112 @@
1
+ # Synced Block Renderer — Developer Agent Guide
2
+
3
+ > **Package**: `@atlaskit/editor-synced-block-renderer` **Purpose**: View-mode rendering of
4
+ > reference synced blocks using nested renderer with SSR support. **Full Knowledge Base**:
5
+ > [Synced Blocks — Comprehensive Knowledge Base](https://hello.atlassian.net/wiki/spaces/egcuc/pages/6679548384)
6
+
7
+ ---
8
+
9
+ ## Quick Context
10
+
11
+ This package renders reference `syncBlock` nodes in view mode (Confluence page view, Jira issue
12
+ view). It fetches content from the Block Service, handles loading/error/offline states, and supports
13
+ SSR for performance-critical page loads.
14
+
15
+ ---
16
+
17
+ ## Source Structure
18
+
19
+ ```
20
+ src/
21
+ ├── index.ts ← Barrel exports
22
+ ├── useSyncedBlockNodeComponent.tsx ← Core hooks for node management and memoization
23
+ ├── ui/
24
+ │ ├── renderSyncedBlockContent.tsx ← Shared render branching logic (loading → error → success)
25
+ │ └── SyncedBlockNodeComponentRenderer.tsx ← Renderer component with store manager + media SSR
26
+ └── types.ts ← SyncedBlockRendererOptions type
27
+ ```
28
+
29
+ ---
30
+
31
+ ## Key Exports
32
+
33
+ ```typescript
34
+ getSyncBlockNodesFromDoc; // Extract SyncBlockNode[] from a DocNode
35
+ useMemoizedSyncedBlockNodeComponent; // Returns memoized component for rendering reference blocks
36
+ getSyncedBlockRenderer; // Factory for editor-mode synced block renderer
37
+ renderSyncedBlockContent; // Shared render branching logic
38
+ ```
39
+
40
+ ---
41
+
42
+ ## How It Works
43
+
44
+ ### `getSyncBlockNodesFromDoc(doc: DocNode)`
45
+
46
+ Extracts all `syncBlock` nodes from a document's content array. Maps through `doc.content`, converts
47
+ each via `convertSyncBlockJSONNodeToSyncBlockNode`, filters out undefined entries. Returns `[]` if
48
+ content is empty.
49
+
50
+ ### `renderSyncedBlockContent(params)`
51
+
52
+ Central rendering decision tree (checked sequentially):
53
+
54
+ 1. **Offline + not SSR** → offline error component
55
+ 2. **Loading + no instance** → loading skeleton
56
+ 3. **SSR + instance error** → loading state (deferred to client-side hydration)
57
+ 4. **Missing resourceId / error / no data / deleted** → error component
58
+ 5. **Unpublished** → unpublished error component
59
+ 6. **Success** → wraps content in `AKRendererWrapper` and renders
60
+
61
+ ### `useMemoizedSyncedBlockNodeComponent(options)`
62
+
63
+ 1. Creates memoized `SyncBlockStoreManager` via `useMemoizedSyncBlockStoreManager`
64
+ 2. First `useEffect`: processes prefetched data via `getPrefetchedData()`
65
+ 3. Second `useEffect`: triggers initial fetch of synced block data
66
+ 4. Returns memoized callback wrapping `SyncedBlockNodeComponentRenderer` in `ErrorBoundary` +
67
+ `SyncBlockActionsProvider`
68
+
69
+ ### SSR Behaviour
70
+
71
+ - `renderSyncedBlockContent`: Skips offline error in SSR; returns loading if SSR + error (deferred)
72
+ - `SyncedBlockNodeComponentRenderer`: Sets media SSR mode to `'server'` during SSR, `'client'` after
73
+ hydration
74
+ - SSR errors tracked via `handleSSRErrorsAnalytics` in deferred `useEffect`
75
+ - Uses `isSSR()` from `@atlaskit/editor-common/core-utils`
76
+
77
+ ---
78
+
79
+ ## Common Tasks
80
+
81
+ ### Fixing a rendering bug
82
+
83
+ 1. Identify if it's a loading state, error state, or content rendering issue
84
+ 2. Check `renderSyncedBlockContent` branching logic — which path is being hit?
85
+ 3. For content issues, check if the ADF node type is supported:
86
+ [Supported nodes](https://hello.atlassian.net/wiki/spaces/egcuc/pages/5926568979)
87
+ 4. For SSR issues, check if `isSSR()` detection and hydration timing are correct
88
+
89
+ ### Adding a new error state
90
+
91
+ 1. Add condition check in `renderSyncedBlockContent.tsx`
92
+ 2. Create error component UI
93
+ 3. Add analytics event for the new error state
94
+ 4. Ensure SSR path handles it gracefully (deferred to client if needed)
95
+
96
+ ### Performance considerations
97
+
98
+ - Reference blocks can regress VC90 due to content shift (CLS)
99
+ - SSR preloading mitigates this — ensure `getPrefetchedData()` is populated
100
+ - Use `SyncBlockInMemorySessionCache` for view→edit transitions
101
+ - Monitor: [VC90 investigation](https://hello.atlassian.net/wiki/spaces/egcuc/pages/6528071518)
102
+
103
+ ---
104
+
105
+ ## Related Packages
106
+
107
+ - **Plugin**: `platform/packages/editor/editor-plugin-synced-block/` — uses `getSyncedBlockRenderer`
108
+ - **Provider**: `platform/packages/editor/editor-synced-block-provider/` — provides store manager
109
+ and fetch
110
+ - **Confluence renderer**: `confluence/next/packages/adf-renderer/` — integrates this for page view
111
+ - **Jira**: `jira/src/packages/issue/issue-view-synced-block-provider/` — uses
112
+ `useMemoizedSyncedBlockNodeComponent`
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/editor-synced-block-renderer
2
2
 
3
+ ## 6.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`5221db0d676ef`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5221db0d676ef) -
8
+ Mechanical type-import autofix for tables, collab, and synchrony packages.
9
+ - Updated dependencies
10
+
11
+ ## 6.0.3
12
+
13
+ ### Patch Changes
14
+
15
+ - [`7428d9bf3aa13`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7428d9bf3aa13) -
16
+ Clean up platform_synced_block_patch_5 feature gate
17
+ - Updated dependencies
18
+
3
19
  ## 6.0.2
4
20
 
5
21
  ### 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
  });
@@ -24,7 +24,9 @@ var SyncedBlockLoadError = exports.SyncedBlockLoadError = function SyncedBlockLo
24
24
  formatMessage = _useIntl.formatMessage;
25
25
  var button = /*#__PURE__*/_react.default.createElement(_new.default, {
26
26
  appearance: "default",
27
- spacing: "compact",
27
+ spacing: "compact"
28
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
29
+ ,
28
30
  onClick: function onClick(event) {
29
31
  event.preventDefault();
30
32
  event.stopPropagation();
@@ -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);
@@ -32,6 +32,7 @@ function renderSyncedBlockContent(_ref) {
32
32
  var isSSRMode = (0, _coreUtils.isSSR)();
33
33
  if (isOffline && !isSSRMode) {
34
34
  return {
35
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
35
36
  element: /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
36
37
  error: {
37
38
  type: _editorSyncedBlockProvider.SyncBlockError.Offline
@@ -73,7 +74,8 @@ function renderSyncedBlockContent(_ref) {
73
74
  if ((syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.status) === 'unpublished') {
74
75
  var _syncBlockInstance$da3;
75
76
  return {
76
- element: /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
77
+ element: /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent
78
+ /* eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed) */, {
77
79
  error: {
78
80
  type: _editorSyncedBlockProvider.SyncBlockError.Unpublished
79
81
  },
@@ -51,7 +51,9 @@ var useMemoizedSyncedBlockNodeComponent = exports.useMemoizedSyncedBlockNodeComp
51
51
  component: _analytics.ACTION_SUBJECT.SYNCED_BLOCK,
52
52
  dispatchAnalyticsEvent: fireAnalyticsEvent,
53
53
  fallbackComponent: null
54
- }, /*#__PURE__*/_react.default.createElement(_syncBlock.SyncBlockActionsProvider, {
54
+ }, /*#__PURE__*/_react.default.createElement(_syncBlock.SyncBlockActionsProvider
55
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
56
+ , {
55
57
  fetchSyncBlockSourceInfo: function fetchSyncBlockSourceInfo(sourceAri) {
56
58
  return syncBlockStoreManager.referenceManager.fetchSyncBlockSourceInfoBySourceAri(sourceAri);
57
59
  }
@@ -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
  });
@@ -19,7 +19,9 @@ export const SyncedBlockLoadError = ({
19
19
  } = useIntl();
20
20
  const button = /*#__PURE__*/React.createElement(Button, {
21
21
  appearance: "default",
22
- spacing: "compact",
22
+ spacing: "compact"
23
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
24
+ ,
23
25
  onClick: event => {
24
26
  event.preventDefault();
25
27
  event.stopPropagation();
@@ -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
  };