@atlaskit/editor-synced-block-renderer 5.6.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 +11 -0
- package/dist/cjs/ui/SyncedBlockErrorComponent.js +4 -2
- package/dist/cjs/ui/SyncedBlockErrorStateCard.js +5 -2
- package/dist/cjs/ui/SyncedBlockNodeComponentRenderer.js +5 -1
- package/dist/cjs/ui/SyncedBlockNotFoundError.js +27 -2
- package/dist/cjs/ui/SyncedBlockRenderer.js +8 -2
- package/dist/es2019/ui/SyncedBlockErrorComponent.js +4 -2
- package/dist/es2019/ui/SyncedBlockErrorStateCard.js +5 -2
- package/dist/es2019/ui/SyncedBlockNodeComponentRenderer.js +5 -1
- package/dist/es2019/ui/SyncedBlockNotFoundError.js +28 -2
- package/dist/es2019/ui/SyncedBlockRenderer.js +8 -2
- package/dist/esm/ui/SyncedBlockErrorComponent.js +4 -2
- package/dist/esm/ui/SyncedBlockErrorStateCard.js +5 -2
- package/dist/esm/ui/SyncedBlockNodeComponentRenderer.js +5 -1
- package/dist/esm/ui/SyncedBlockNotFoundError.js +27 -2
- package/dist/esm/ui/SyncedBlockRenderer.js +8 -2
- package/dist/types/ui/SyncedBlockErrorComponent.d.ts +2 -2
- package/dist/types/ui/SyncedBlockErrorStateCard.d.ts +7 -4
- package/dist/types/ui/SyncedBlockNotFoundError.d.ts +3 -1
- package/dist/types-ts4.5/ui/SyncedBlockErrorComponent.d.ts +2 -2
- package/dist/types-ts4.5/ui/SyncedBlockErrorStateCard.d.ts +7 -4
- package/dist/types-ts4.5/ui/SyncedBlockNotFoundError.d.ts +3 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
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
|
+
|
|
3
14
|
## 5.6.0
|
|
4
15
|
|
|
5
16
|
### 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,
|
|
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:
|
|
@@ -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(
|
|
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') ?
|
|
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
|
|
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(
|
|
40
|
+
description: formatMessage(description),
|
|
41
|
+
icon: icon
|
|
17
42
|
});
|
|
18
43
|
};
|
|
@@ -56,7 +56,9 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
|
|
|
56
56
|
// In SSR, we should always attempt to render content
|
|
57
57
|
if (isCollabOffline && !(0, _coreUtils.isSSR)()) {
|
|
58
58
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
|
|
59
|
-
error:
|
|
59
|
+
error: {
|
|
60
|
+
type: _editorSyncedBlockProvider.SyncBlockError.Offline
|
|
61
|
+
}
|
|
60
62
|
});
|
|
61
63
|
}
|
|
62
64
|
if (!syncBlockInstance) {
|
|
@@ -65,7 +67,11 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
|
|
|
65
67
|
if (syncBlockInstance.error || !syncBlockInstance.data || syncBlockInstance.data.status === 'deleted' && (0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding')) {
|
|
66
68
|
var _syncBlockInstance$er, _syncBlockInstance$da, _api$analytics;
|
|
67
69
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
|
|
68
|
-
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') ?
|
|
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
|
+
},
|
|
69
75
|
resourceId: syncBlockInstance.resourceId,
|
|
70
76
|
onRetry: reloadData,
|
|
71
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,
|
|
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:
|
|
@@ -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(
|
|
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') ?
|
|
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
|
-
|
|
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(
|
|
35
|
+
description: formatMessage(description),
|
|
36
|
+
icon: icon
|
|
11
37
|
});
|
|
12
38
|
};
|
|
@@ -49,7 +49,9 @@ const SyncedBlockRendererComponent = ({
|
|
|
49
49
|
// In SSR, we should always attempt to render content
|
|
50
50
|
if (isCollabOffline && !isSSR()) {
|
|
51
51
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
52
|
-
error:
|
|
52
|
+
error: {
|
|
53
|
+
type: SyncBlockError.Offline
|
|
54
|
+
}
|
|
53
55
|
});
|
|
54
56
|
}
|
|
55
57
|
if (!syncBlockInstance) {
|
|
@@ -58,7 +60,11 @@ const SyncedBlockRendererComponent = ({
|
|
|
58
60
|
if (syncBlockInstance.error || !syncBlockInstance.data || syncBlockInstance.data.status === 'deleted' && fg('platform_synced_block_dogfooding')) {
|
|
59
61
|
var _syncBlockInstance$er, _syncBlockInstance$da, _api$analytics;
|
|
60
62
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
61
|
-
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') ?
|
|
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
|
+
},
|
|
62
68
|
resourceId: syncBlockInstance.resourceId,
|
|
63
69
|
onRetry: reloadData,
|
|
64
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,
|
|
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:
|
|
@@ -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(
|
|
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') ?
|
|
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
|
-
|
|
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(
|
|
33
|
+
description: formatMessage(description),
|
|
34
|
+
icon: icon
|
|
10
35
|
});
|
|
11
36
|
};
|
|
@@ -47,7 +47,9 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
|
|
|
47
47
|
// In SSR, we should always attempt to render content
|
|
48
48
|
if (isCollabOffline && !isSSR()) {
|
|
49
49
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
50
|
-
error:
|
|
50
|
+
error: {
|
|
51
|
+
type: SyncBlockError.Offline
|
|
52
|
+
}
|
|
51
53
|
});
|
|
52
54
|
}
|
|
53
55
|
if (!syncBlockInstance) {
|
|
@@ -56,7 +58,11 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
|
|
|
56
58
|
if (syncBlockInstance.error || !syncBlockInstance.data || syncBlockInstance.data.status === 'deleted' && fg('platform_synced_block_dogfooding')) {
|
|
57
59
|
var _syncBlockInstance$er, _syncBlockInstance$da, _api$analytics;
|
|
58
60
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
59
|
-
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') ?
|
|
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
|
+
},
|
|
60
66
|
resourceId: syncBlockInstance.resourceId,
|
|
61
67
|
onRetry: reloadData,
|
|
62
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 {
|
|
3
|
+
import { type SyncBlockInstance } from '@atlaskit/editor-synced-block-provider';
|
|
4
4
|
export declare const SyncedBlockErrorComponent: ({ error, isLoading, onRetry, resourceId, fireAnalyticsEvent, }: {
|
|
5
|
-
error:
|
|
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?:
|
|
4
|
-
|
|
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,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import {
|
|
3
|
+
import { type SyncBlockInstance } from '@atlaskit/editor-synced-block-provider';
|
|
4
4
|
export declare const SyncedBlockErrorComponent: ({ error, isLoading, onRetry, resourceId, fireAnalyticsEvent, }: {
|
|
5
|
-
error:
|
|
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?:
|
|
4
|
-
|
|
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 {};
|