@atlaskit/editor-synced-block-renderer 5.5.0 → 5.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-synced-block-renderer
2
2
 
3
+ ## 5.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`28434cbe03f1e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/28434cbe03f1e) -
8
+ [ux] [EDITOR-2851]
9
+ - Implement unsync feature for source sync block
10
+ - Update deletion confirmation modal and reference block UI after source deletion
11
+
12
+ - Updated dependencies
13
+
14
+ ## 5.6.0
15
+
16
+ ### Minor Changes
17
+
18
+ - [`f998026c7a01a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f998026c7a01a) -
19
+ EDITOR-2849 fix editor SSR
20
+
3
21
  ## 5.5.0
4
22
 
5
23
  ### Minor Changes
@@ -42,13 +42,15 @@ var SyncedBlockErrorComponent = exports.SyncedBlockErrorComponent = function Syn
42
42
  resourceId = _ref.resourceId,
43
43
  fireAnalyticsEvent = _ref.fireAnalyticsEvent;
44
44
  var getErrorContent = (0, _react.useMemo)(function () {
45
- switch (error) {
45
+ switch (error === null || error === void 0 ? void 0 : error.type) {
46
46
  case _editorSyncedBlockProvider.SyncBlockError.Offline:
47
47
  return /*#__PURE__*/_react.default.createElement(_SyncedBlockOfflineError.SyncedBlockOfflineError, null);
48
48
  case _editorSyncedBlockProvider.SyncBlockError.Forbidden:
49
49
  return getForbiddenErrorContent(resourceId, fireAnalyticsEvent);
50
50
  case _editorSyncedBlockProvider.SyncBlockError.NotFound:
51
- return /*#__PURE__*/_react.default.createElement(_SyncedBlockNotFoundError.SyncedBlockNotFoundError, null);
51
+ return /*#__PURE__*/_react.default.createElement(_SyncedBlockNotFoundError.SyncedBlockNotFoundError, {
52
+ reason: error.reason
53
+ });
52
54
  case _editorSyncedBlockProvider.SyncBlockError.Errored:
53
55
  case _editorSyncedBlockProvider.SyncBlockError.RateLimited:
54
56
  case _editorSyncedBlockProvider.SyncBlockError.ServerError:
@@ -64,6 +66,7 @@ var SyncedBlockErrorComponent = exports.SyncedBlockErrorComponent = function Syn
64
66
  /*#__PURE__*/
65
67
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
66
68
  _react.default.createElement("div", {
69
+ "data-testid": "sync-block-error",
67
70
  className: _syncBlock.SyncBlockSharedCssClassName.error
68
71
  }, getErrorContent)
69
72
  );
@@ -10,16 +10,19 @@ require("./SyncedBlockErrorStateCard.compiled.css");
10
10
  var _runtime = require("@compiled/react/runtime");
11
11
  var _react = _interopRequireDefault(require("react"));
12
12
  var _warningOutline = _interopRequireDefault(require("@atlaskit/icon-lab/core/warning-outline"));
13
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
14
  var _compiled = require("@atlaskit/primitives/compiled");
14
15
  var styles = {
15
16
  wrapper: "_zulppxbi _ca0qu2gc _n3tdu2gc _19bvpxbi _u5f3pxbi _1e0c1txw _1bahv2br _4cvr1h6o"
16
17
  };
17
18
  var SyncedBlockErrorStateCard = exports.SyncedBlockErrorStateCard = function SyncedBlockErrorStateCard(_ref) {
18
19
  var children = _ref.children,
19
- description = _ref.description;
20
+ description = _ref.description,
21
+ icon = _ref.icon;
22
+ var Icon = (0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding') ? icon !== null && icon !== void 0 ? icon : _warningOutline.default : _warningOutline.default;
20
23
  return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
21
24
  xcss: styles.wrapper
22
- }, /*#__PURE__*/_react.default.createElement(_warningOutline.default, {
25
+ }, /*#__PURE__*/_react.default.createElement(Icon, {
23
26
  color: "var(--ds-icon-subtle, #505258)",
24
27
  label: ""
25
28
  }), /*#__PURE__*/_react.default.createElement(_compiled.Text, {
@@ -56,7 +56,11 @@ var SyncedBlockNodeComponentRenderer = exports.SyncedBlockNodeComponentRenderer
56
56
  if (!resourceId || syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error || !(syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.data) || syncBlockInstance.data.status === 'deleted' && (0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding')) {
57
57
  var _syncBlockInstance$er, _syncBlockInstance$da;
58
58
  return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
59
- error: (_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' && (0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding') ? _editorSyncedBlockProvider.SyncBlockError.NotFound : _editorSyncedBlockProvider.SyncBlockError.Errored,
59
+ error: (_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' && (0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding') ? {
60
+ type: _editorSyncedBlockProvider.SyncBlockError.NotFound
61
+ } : {
62
+ type: _editorSyncedBlockProvider.SyncBlockError.Errored
63
+ },
60
64
  resourceId: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.resourceId,
61
65
  onRetry: reloadData,
62
66
  isLoading: isLoading,
@@ -8,11 +8,36 @@ exports.SyncedBlockNotFoundError = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _reactIntlNext = require("react-intl-next");
10
10
  var _messages = require("@atlaskit/editor-common/messages");
11
+ var _linkBroken = _interopRequireDefault(require("@atlaskit/icon/core/link-broken"));
12
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
13
  var _SyncedBlockErrorStateCard = require("./SyncedBlockErrorStateCard");
12
- var SyncedBlockNotFoundError = exports.SyncedBlockNotFoundError = function SyncedBlockNotFoundError() {
14
+ var errorMap = {
15
+ 'source-block-unsynced': {
16
+ description: _messages.syncBlockMessages.sourceUnsyncedDescription,
17
+ icon: _linkBroken.default
18
+ },
19
+ 'source-block-deleted': {
20
+ description: _messages.syncBlockMessages.sourceDeletedDescription,
21
+ icon: _linkBroken.default
22
+ }
23
+ };
24
+ var SyncedBlockNotFoundError = exports.SyncedBlockNotFoundError = function SyncedBlockNotFoundError(_ref) {
25
+ var _ref$reason = _ref.reason,
26
+ reason = _ref$reason === void 0 ? 'source-block-deleted' : _ref$reason;
13
27
  var _useIntl = (0, _reactIntlNext.useIntl)(),
14
28
  formatMessage = _useIntl.formatMessage;
29
+ var errorInfo = {
30
+ description: _messages.syncBlockMessages.notFoundDescription
31
+ };
32
+ if ((0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding')) {
33
+ var _errorMap$reason;
34
+ errorInfo = (_errorMap$reason = errorMap[reason]) !== null && _errorMap$reason !== void 0 ? _errorMap$reason : {};
35
+ }
36
+ var _errorInfo = errorInfo,
37
+ description = _errorInfo.description,
38
+ icon = _errorInfo.icon;
15
39
  return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorStateCard.SyncedBlockErrorStateCard, {
16
- description: formatMessage(_messages.syncBlockMessages.notFoundDescription)
40
+ description: formatMessage(description),
41
+ icon: icon
17
42
  });
18
43
  };
@@ -47,13 +47,18 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
47
47
  var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['connectivity'], function (_ref2) {
48
48
  var connectivityState = _ref2.connectivityState;
49
49
  return {
50
- isInternetOffline: (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'collab-offline'
50
+ isCollabOffline: (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'collab-offline'
51
51
  };
52
52
  }),
53
- isInternetOffline = _useSharedPluginState.isInternetOffline;
54
- if (isInternetOffline) {
53
+ isCollabOffline = _useSharedPluginState.isCollabOffline;
54
+
55
+ // Show offline error only when collaboration is offline and not in SSR mode
56
+ // In SSR, we should always attempt to render content
57
+ if (isCollabOffline && !(0, _coreUtils.isSSR)()) {
55
58
  return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
56
- error: _editorSyncedBlockProvider.SyncBlockError.Offline
59
+ error: {
60
+ type: _editorSyncedBlockProvider.SyncBlockError.Offline
61
+ }
57
62
  });
58
63
  }
59
64
  if (!syncBlockInstance) {
@@ -62,7 +67,11 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
62
67
  if (syncBlockInstance.error || !syncBlockInstance.data || syncBlockInstance.data.status === 'deleted' && (0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding')) {
63
68
  var _syncBlockInstance$er, _syncBlockInstance$da, _api$analytics;
64
69
  return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
65
- 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' && (0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding') ? _editorSyncedBlockProvider.SyncBlockError.NotFound : _editorSyncedBlockProvider.SyncBlockError.Errored,
70
+ 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' && (0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding') ? {
71
+ type: _editorSyncedBlockProvider.SyncBlockError.NotFound
72
+ } : {
73
+ type: _editorSyncedBlockProvider.SyncBlockError.Errored
74
+ },
66
75
  resourceId: syncBlockInstance.resourceId,
67
76
  onRetry: reloadData,
68
77
  isLoading: isLoading,
@@ -36,13 +36,15 @@ export const SyncedBlockErrorComponent = ({
36
36
  fireAnalyticsEvent
37
37
  }) => {
38
38
  const getErrorContent = useMemo(() => {
39
- switch (error) {
39
+ switch (error === null || error === void 0 ? void 0 : error.type) {
40
40
  case SyncBlockError.Offline:
41
41
  return /*#__PURE__*/React.createElement(SyncedBlockOfflineError, null);
42
42
  case SyncBlockError.Forbidden:
43
43
  return getForbiddenErrorContent(resourceId, fireAnalyticsEvent);
44
44
  case SyncBlockError.NotFound:
45
- return /*#__PURE__*/React.createElement(SyncedBlockNotFoundError, null);
45
+ return /*#__PURE__*/React.createElement(SyncedBlockNotFoundError, {
46
+ reason: error.reason
47
+ });
46
48
  case SyncBlockError.Errored:
47
49
  case SyncBlockError.RateLimited:
48
50
  case SyncBlockError.ServerError:
@@ -58,6 +60,7 @@ export const SyncedBlockErrorComponent = ({
58
60
  /*#__PURE__*/
59
61
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
60
62
  React.createElement("div", {
63
+ "data-testid": "sync-block-error",
61
64
  className: SyncBlockSharedCssClassName.error
62
65
  }, getErrorContent)
63
66
  );
@@ -3,17 +3,20 @@ import "./SyncedBlockErrorStateCard.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React from 'react';
5
5
  import WarningOutlineIcon from '@atlaskit/icon-lab/core/warning-outline';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
  import { Box, Text } from '@atlaskit/primitives/compiled';
7
8
  const styles = {
8
9
  wrapper: "_zulppxbi _ca0qu2gc _n3tdu2gc _19bvpxbi _u5f3pxbi _1e0c1txw _1bahv2br _4cvr1h6o"
9
10
  };
10
11
  export const SyncedBlockErrorStateCard = ({
11
12
  children,
12
- description
13
+ description,
14
+ icon
13
15
  }) => {
16
+ const Icon = fg('platform_synced_block_dogfooding') ? icon !== null && icon !== void 0 ? icon : WarningOutlineIcon : WarningOutlineIcon;
14
17
  return /*#__PURE__*/React.createElement(Box, {
15
18
  xcss: styles.wrapper
16
- }, /*#__PURE__*/React.createElement(WarningOutlineIcon, {
19
+ }, /*#__PURE__*/React.createElement(Icon, {
17
20
  color: "var(--ds-icon-subtle, #505258)",
18
21
  label: ""
19
22
  }), /*#__PURE__*/React.createElement(Text, {
@@ -49,7 +49,11 @@ export const SyncedBlockNodeComponentRenderer = ({
49
49
  if (!resourceId || syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error || !(syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.data) || syncBlockInstance.data.status === 'deleted' && fg('platform_synced_block_dogfooding')) {
50
50
  var _syncBlockInstance$er, _syncBlockInstance$da;
51
51
  return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
52
- error: (_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' && fg('platform_synced_block_dogfooding') ? SyncBlockError.NotFound : SyncBlockError.Errored,
52
+ error: (_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' && fg('platform_synced_block_dogfooding') ? {
53
+ type: SyncBlockError.NotFound
54
+ } : {
55
+ type: SyncBlockError.Errored
56
+ },
53
57
  resourceId: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.resourceId,
54
58
  onRetry: reloadData,
55
59
  isLoading: isLoading,
@@ -1,12 +1,38 @@
1
1
  import React from 'react';
2
2
  import { useIntl } from 'react-intl-next';
3
3
  import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
4
+ import LinkBrokenIcon from '@atlaskit/icon/core/link-broken';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
4
6
  import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
5
- export const SyncedBlockNotFoundError = () => {
7
+ const errorMap = {
8
+ 'source-block-unsynced': {
9
+ description: messages.sourceUnsyncedDescription,
10
+ icon: LinkBrokenIcon
11
+ },
12
+ 'source-block-deleted': {
13
+ description: messages.sourceDeletedDescription,
14
+ icon: LinkBrokenIcon
15
+ }
16
+ };
17
+ export const SyncedBlockNotFoundError = ({
18
+ reason = 'source-block-deleted'
19
+ }) => {
6
20
  const {
7
21
  formatMessage
8
22
  } = useIntl();
23
+ let errorInfo = {
24
+ description: messages.notFoundDescription
25
+ };
26
+ if (fg('platform_synced_block_dogfooding')) {
27
+ var _errorMap$reason;
28
+ errorInfo = (_errorMap$reason = errorMap[reason]) !== null && _errorMap$reason !== void 0 ? _errorMap$reason : {};
29
+ }
30
+ const {
31
+ description,
32
+ icon
33
+ } = errorInfo;
9
34
  return /*#__PURE__*/React.createElement(SyncedBlockErrorStateCard, {
10
- description: formatMessage(messages.notFoundDescription)
35
+ description: formatMessage(description),
36
+ icon: icon
11
37
  });
12
38
  };
@@ -38,15 +38,20 @@ const SyncedBlockRendererComponent = ({
38
38
  };
39
39
  }, [syncBlockRendererOptions, ssrProviders]);
40
40
  const {
41
- isInternetOffline
41
+ isCollabOffline
42
42
  } = useSharedPluginStateWithSelector(api, ['connectivity'], ({
43
43
  connectivityState
44
44
  }) => ({
45
- isInternetOffline: (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'collab-offline'
45
+ isCollabOffline: (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'collab-offline'
46
46
  }));
47
- if (isInternetOffline) {
47
+
48
+ // Show offline error only when collaboration is offline and not in SSR mode
49
+ // In SSR, we should always attempt to render content
50
+ if (isCollabOffline && !isSSR()) {
48
51
  return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
49
- error: SyncBlockError.Offline
52
+ error: {
53
+ type: SyncBlockError.Offline
54
+ }
50
55
  });
51
56
  }
52
57
  if (!syncBlockInstance) {
@@ -55,7 +60,11 @@ const SyncedBlockRendererComponent = ({
55
60
  if (syncBlockInstance.error || !syncBlockInstance.data || syncBlockInstance.data.status === 'deleted' && fg('platform_synced_block_dogfooding')) {
56
61
  var _syncBlockInstance$er, _syncBlockInstance$da, _api$analytics;
57
62
  return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
58
- 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' && fg('platform_synced_block_dogfooding') ? SyncBlockError.NotFound : SyncBlockError.Errored,
63
+ 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' && fg('platform_synced_block_dogfooding') ? {
64
+ type: SyncBlockError.NotFound
65
+ } : {
66
+ type: SyncBlockError.Errored
67
+ },
59
68
  resourceId: syncBlockInstance.resourceId,
60
69
  onRetry: reloadData,
61
70
  isLoading: isLoading,
@@ -34,13 +34,15 @@ export var SyncedBlockErrorComponent = function SyncedBlockErrorComponent(_ref)
34
34
  resourceId = _ref.resourceId,
35
35
  fireAnalyticsEvent = _ref.fireAnalyticsEvent;
36
36
  var getErrorContent = useMemo(function () {
37
- switch (error) {
37
+ switch (error === null || error === void 0 ? void 0 : error.type) {
38
38
  case SyncBlockError.Offline:
39
39
  return /*#__PURE__*/React.createElement(SyncedBlockOfflineError, null);
40
40
  case SyncBlockError.Forbidden:
41
41
  return getForbiddenErrorContent(resourceId, fireAnalyticsEvent);
42
42
  case SyncBlockError.NotFound:
43
- return /*#__PURE__*/React.createElement(SyncedBlockNotFoundError, null);
43
+ return /*#__PURE__*/React.createElement(SyncedBlockNotFoundError, {
44
+ reason: error.reason
45
+ });
44
46
  case SyncBlockError.Errored:
45
47
  case SyncBlockError.RateLimited:
46
48
  case SyncBlockError.ServerError:
@@ -56,6 +58,7 @@ export var SyncedBlockErrorComponent = function SyncedBlockErrorComponent(_ref)
56
58
  /*#__PURE__*/
57
59
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
58
60
  React.createElement("div", {
61
+ "data-testid": "sync-block-error",
59
62
  className: SyncBlockSharedCssClassName.error
60
63
  }, getErrorContent)
61
64
  );
@@ -3,16 +3,19 @@ import "./SyncedBlockErrorStateCard.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React from 'react';
5
5
  import WarningOutlineIcon from '@atlaskit/icon-lab/core/warning-outline';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
  import { Box, Text } from '@atlaskit/primitives/compiled';
7
8
  var styles = {
8
9
  wrapper: "_zulppxbi _ca0qu2gc _n3tdu2gc _19bvpxbi _u5f3pxbi _1e0c1txw _1bahv2br _4cvr1h6o"
9
10
  };
10
11
  export var SyncedBlockErrorStateCard = function SyncedBlockErrorStateCard(_ref) {
11
12
  var children = _ref.children,
12
- description = _ref.description;
13
+ description = _ref.description,
14
+ icon = _ref.icon;
15
+ var Icon = fg('platform_synced_block_dogfooding') ? icon !== null && icon !== void 0 ? icon : WarningOutlineIcon : WarningOutlineIcon;
13
16
  return /*#__PURE__*/React.createElement(Box, {
14
17
  xcss: styles.wrapper
15
- }, /*#__PURE__*/React.createElement(WarningOutlineIcon, {
18
+ }, /*#__PURE__*/React.createElement(Icon, {
16
19
  color: "var(--ds-icon-subtle, #505258)",
17
20
  label: ""
18
21
  }), /*#__PURE__*/React.createElement(Text, {
@@ -47,7 +47,11 @@ export var SyncedBlockNodeComponentRenderer = function SyncedBlockNodeComponentR
47
47
  if (!resourceId || syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error || !(syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.data) || syncBlockInstance.data.status === 'deleted' && fg('platform_synced_block_dogfooding')) {
48
48
  var _syncBlockInstance$er, _syncBlockInstance$da;
49
49
  return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
50
- error: (_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' && fg('platform_synced_block_dogfooding') ? SyncBlockError.NotFound : SyncBlockError.Errored,
50
+ error: (_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' && fg('platform_synced_block_dogfooding') ? {
51
+ type: SyncBlockError.NotFound
52
+ } : {
53
+ type: SyncBlockError.Errored
54
+ },
51
55
  resourceId: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.resourceId,
52
56
  onRetry: reloadData,
53
57
  isLoading: isLoading,
@@ -1,11 +1,36 @@
1
1
  import React from 'react';
2
2
  import { useIntl } from 'react-intl-next';
3
3
  import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
4
+ import LinkBrokenIcon from '@atlaskit/icon/core/link-broken';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
4
6
  import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
5
- export var SyncedBlockNotFoundError = function SyncedBlockNotFoundError() {
7
+ var errorMap = {
8
+ 'source-block-unsynced': {
9
+ description: messages.sourceUnsyncedDescription,
10
+ icon: LinkBrokenIcon
11
+ },
12
+ 'source-block-deleted': {
13
+ description: messages.sourceDeletedDescription,
14
+ icon: LinkBrokenIcon
15
+ }
16
+ };
17
+ export var SyncedBlockNotFoundError = function SyncedBlockNotFoundError(_ref) {
18
+ var _ref$reason = _ref.reason,
19
+ reason = _ref$reason === void 0 ? 'source-block-deleted' : _ref$reason;
6
20
  var _useIntl = useIntl(),
7
21
  formatMessage = _useIntl.formatMessage;
22
+ var errorInfo = {
23
+ description: messages.notFoundDescription
24
+ };
25
+ if (fg('platform_synced_block_dogfooding')) {
26
+ var _errorMap$reason;
27
+ errorInfo = (_errorMap$reason = errorMap[reason]) !== null && _errorMap$reason !== void 0 ? _errorMap$reason : {};
28
+ }
29
+ var _errorInfo = errorInfo,
30
+ description = _errorInfo.description,
31
+ icon = _errorInfo.icon;
8
32
  return /*#__PURE__*/React.createElement(SyncedBlockErrorStateCard, {
9
- description: formatMessage(messages.notFoundDescription)
33
+ description: formatMessage(description),
34
+ icon: icon
10
35
  });
11
36
  };
@@ -38,13 +38,18 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
38
38
  var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['connectivity'], function (_ref2) {
39
39
  var connectivityState = _ref2.connectivityState;
40
40
  return {
41
- isInternetOffline: (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'collab-offline'
41
+ isCollabOffline: (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'collab-offline'
42
42
  };
43
43
  }),
44
- isInternetOffline = _useSharedPluginState.isInternetOffline;
45
- if (isInternetOffline) {
44
+ isCollabOffline = _useSharedPluginState.isCollabOffline;
45
+
46
+ // Show offline error only when collaboration is offline and not in SSR mode
47
+ // In SSR, we should always attempt to render content
48
+ if (isCollabOffline && !isSSR()) {
46
49
  return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
47
- error: SyncBlockError.Offline
50
+ error: {
51
+ type: SyncBlockError.Offline
52
+ }
48
53
  });
49
54
  }
50
55
  if (!syncBlockInstance) {
@@ -53,7 +58,11 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
53
58
  if (syncBlockInstance.error || !syncBlockInstance.data || syncBlockInstance.data.status === 'deleted' && fg('platform_synced_block_dogfooding')) {
54
59
  var _syncBlockInstance$er, _syncBlockInstance$da, _api$analytics;
55
60
  return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
56
- 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' && fg('platform_synced_block_dogfooding') ? SyncBlockError.NotFound : SyncBlockError.Errored,
61
+ 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' && fg('platform_synced_block_dogfooding') ? {
62
+ type: SyncBlockError.NotFound
63
+ } : {
64
+ type: SyncBlockError.Errored
65
+ },
57
66
  resourceId: syncBlockInstance.resourceId,
58
67
  onRetry: reloadData,
59
68
  isLoading: isLoading,
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import type { RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
3
- import { SyncBlockError } 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, }: {
5
- error: SyncBlockError;
5
+ error: SyncBlockInstance["error"];
6
6
  fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void;
7
7
  isLoading?: boolean;
8
8
  onRetry?: () => void;
@@ -1,7 +1,10 @@
1
- import React from 'react';
1
+ import React, { type ReactNode } from 'react';
2
+ import type { NewCoreIconProps } from '@atlaskit/icon/types';
2
3
  interface SyncedBlockErrorStateCardProps {
3
- children?: React.ReactNode;
4
- description: string;
4
+ children?: ReactNode;
5
+ closeButton?: ReactNode;
6
+ description: ReactNode;
7
+ icon?: (props: NewCoreIconProps) => JSX.Element;
5
8
  }
6
- export declare const SyncedBlockErrorStateCard: ({ children, description, }: SyncedBlockErrorStateCardProps) => React.JSX.Element;
9
+ export declare const SyncedBlockErrorStateCard: ({ children, description, icon, }: SyncedBlockErrorStateCardProps) => React.JSX.Element;
7
10
  export {};
@@ -1,2 +1,4 @@
1
1
  import React from 'react';
2
- export declare const SyncedBlockNotFoundError: () => React.JSX.Element;
2
+ export declare const SyncedBlockNotFoundError: ({ reason, }: {
3
+ reason?: string;
4
+ }) => React.JSX.Element;
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import type { RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
3
- import { SyncBlockError } 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, }: {
5
- error: SyncBlockError;
5
+ error: SyncBlockInstance["error"];
6
6
  fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void;
7
7
  isLoading?: boolean;
8
8
  onRetry?: () => void;
@@ -1,7 +1,10 @@
1
- import React from 'react';
1
+ import React, { type ReactNode } from 'react';
2
+ import type { NewCoreIconProps } from '@atlaskit/icon/types';
2
3
  interface SyncedBlockErrorStateCardProps {
3
- children?: React.ReactNode;
4
- description: string;
4
+ children?: ReactNode;
5
+ closeButton?: ReactNode;
6
+ description: ReactNode;
7
+ icon?: (props: NewCoreIconProps) => JSX.Element;
5
8
  }
6
- export declare const SyncedBlockErrorStateCard: ({ children, description, }: SyncedBlockErrorStateCardProps) => React.JSX.Element;
9
+ export declare const SyncedBlockErrorStateCard: ({ children, description, icon, }: SyncedBlockErrorStateCardProps) => React.JSX.Element;
7
10
  export {};
@@ -1,2 +1,4 @@
1
1
  import React from 'react';
2
- export declare const SyncedBlockNotFoundError: () => React.JSX.Element;
2
+ export declare const SyncedBlockNotFoundError: ({ reason, }: {
3
+ reason?: string;
4
+ }) => React.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-synced-block-renderer",
3
- "version": "5.5.0",
3
+ "version": "5.6.1",
4
4
  "description": "SyncedBlockRenderer for @atlaskit/editor-plugin-synced-block",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,7 +31,7 @@
31
31
  "@atlaskit/button": "^23.9.0",
32
32
  "@atlaskit/css": "^0.19.0",
33
33
  "@atlaskit/editor-plugin-synced-block": "^5.3.0",
34
- "@atlaskit/editor-synced-block-provider": "^3.13.0",
34
+ "@atlaskit/editor-synced-block-provider": "^3.14.0",
35
35
  "@atlaskit/heading": "^5.2.0",
36
36
  "@atlaskit/icon": "^30.0.0",
37
37
  "@atlaskit/icon-lab": "^5.14.0",