@atlaskit/editor-synced-block-renderer 5.6.2 → 5.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/afm-cc/tsconfig.json +3 -0
- package/dist/cjs/ui/SyncedBlockErrorComponent.js +2 -1
- package/dist/cjs/ui/SyncedBlockErrorStateCard.compiled.css +3 -5
- package/dist/cjs/ui/SyncedBlockErrorStateCard.js +5 -2
- package/dist/cjs/ui/SyncedBlockLoadError.compiled.css +3 -0
- package/dist/cjs/ui/SyncedBlockLoadError.js +16 -5
- package/dist/cjs/ui/SyncedBlockNotFoundError.compiled.css +10 -0
- package/dist/cjs/ui/SyncedBlockNotFoundError.js +155 -17
- package/dist/cjs/useSyncedBlockNodeComponent.js +6 -1
- package/dist/es2019/ui/SyncedBlockErrorComponent.js +2 -1
- package/dist/es2019/ui/SyncedBlockErrorStateCard.compiled.css +3 -5
- package/dist/es2019/ui/SyncedBlockErrorStateCard.js +5 -2
- package/dist/es2019/ui/SyncedBlockLoadError.compiled.css +3 -0
- package/dist/es2019/ui/SyncedBlockLoadError.js +16 -5
- package/dist/es2019/ui/SyncedBlockNotFoundError.compiled.css +10 -0
- package/dist/es2019/ui/SyncedBlockNotFoundError.js +128 -14
- package/dist/es2019/useSyncedBlockNodeComponent.js +4 -1
- package/dist/esm/ui/SyncedBlockErrorComponent.js +2 -1
- package/dist/esm/ui/SyncedBlockErrorStateCard.compiled.css +3 -5
- package/dist/esm/ui/SyncedBlockErrorStateCard.js +5 -2
- package/dist/esm/ui/SyncedBlockLoadError.compiled.css +3 -0
- package/dist/esm/ui/SyncedBlockLoadError.js +16 -5
- package/dist/esm/ui/SyncedBlockNotFoundError.compiled.css +10 -0
- package/dist/esm/ui/SyncedBlockNotFoundError.js +153 -17
- package/dist/esm/useSyncedBlockNodeComponent.js +6 -1
- package/dist/types/ui/SyncedBlockErrorStateCard.d.ts +0 -1
- package/dist/types/ui/SyncedBlockLoadError.d.ts +1 -1
- package/dist/types/ui/SyncedBlockNotFoundError.d.ts +2 -1
- package/dist/types-ts4.5/ui/SyncedBlockErrorStateCard.d.ts +0 -1
- package/dist/types-ts4.5/ui/SyncedBlockLoadError.d.ts +1 -1
- package/dist/types-ts4.5/ui/SyncedBlockNotFoundError.d.ts +2 -1
- package/package.json +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-synced-block-renderer
|
|
2
2
|
|
|
3
|
+
## 5.6.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`f11ff647ea458`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f11ff647ea458) -
|
|
8
|
+
[ux] [EDITOR-4521] Implement source deleted reference UI, update block deleted/unsynced reference
|
|
9
|
+
UI to add delete button, unsynced label and source title/url
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 5.6.2
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -49,7 +49,8 @@ var SyncedBlockErrorComponent = exports.SyncedBlockErrorComponent = function Syn
|
|
|
49
49
|
return getForbiddenErrorContent(resourceId, fireAnalyticsEvent);
|
|
50
50
|
case _editorSyncedBlockProvider.SyncBlockError.NotFound:
|
|
51
51
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockNotFoundError.SyncedBlockNotFoundError, {
|
|
52
|
-
reason: error.reason
|
|
52
|
+
reason: error.reason,
|
|
53
|
+
sourceAri: error.sourceAri
|
|
53
54
|
});
|
|
54
55
|
case _editorSyncedBlockProvider.SyncBlockError.Errored:
|
|
55
56
|
case _editorSyncedBlockProvider.SyncBlockError.RateLimited:
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
._zulppxbi{gap:var(--ds-space-200,1pc)}
|
|
3
|
-
._1bahv2br{justify-content:start}
|
|
2
|
+
._zulppxbi{gap:var(--ds-space-200,1pc)}
|
|
3
|
+
._1rjc12x7{padding-block:var(--ds-space-075,6px)}._1bahv2br{justify-content:start}
|
|
4
4
|
._1e0c1txw{display:flex}
|
|
5
5
|
._4cvr1h6o{align-items:center}
|
|
6
|
-
.
|
|
7
|
-
._n3tdu2gc{padding-bottom:var(--ds-space-100,8px)}
|
|
8
|
-
._u5f3pxbi{padding-right:var(--ds-space-200,1pc)}
|
|
6
|
+
._bozgpxbi{padding-inline-start:var(--ds-space-200,1pc)}
|
|
@@ -13,7 +13,8 @@ var _warningOutline = _interopRequireDefault(require("@atlaskit/icon-lab/core/wa
|
|
|
13
13
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
14
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
15
15
|
var styles = {
|
|
16
|
-
wrapper: "_zulppxbi
|
|
16
|
+
wrapper: "_zulppxbi _1rjc12x7 _bozgpxbi _1e0c1txw _1bahv2br _4cvr1h6o",
|
|
17
|
+
container: "_1e0c1txw"
|
|
17
18
|
};
|
|
18
19
|
var SyncedBlockErrorStateCard = exports.SyncedBlockErrorStateCard = function SyncedBlockErrorStateCard(_ref) {
|
|
19
20
|
var children = _ref.children,
|
|
@@ -21,11 +22,13 @@ var SyncedBlockErrorStateCard = exports.SyncedBlockErrorStateCard = function Syn
|
|
|
21
22
|
icon = _ref.icon;
|
|
22
23
|
var Icon = (0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding') ? icon !== null && icon !== void 0 ? icon : _warningOutline.default : _warningOutline.default;
|
|
23
24
|
return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
25
|
+
xcss: styles.container
|
|
26
|
+
}, /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
24
27
|
xcss: styles.wrapper
|
|
25
28
|
}, /*#__PURE__*/_react.default.createElement(Icon, {
|
|
26
29
|
color: "var(--ds-icon-subtle, #505258)",
|
|
27
30
|
label: ""
|
|
28
31
|
}), /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
29
32
|
color: "color.text.subtle"
|
|
30
|
-
}, description), children);
|
|
33
|
+
}, description), !(0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding') && children), (0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding') && children);
|
|
31
34
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* SyncedBlockLoadError.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
1
2
|
"use strict";
|
|
2
3
|
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -5,27 +6,37 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.SyncedBlockLoadError = void 0;
|
|
9
|
+
require("./SyncedBlockLoadError.compiled.css");
|
|
10
|
+
var _runtime = require("@compiled/react/runtime");
|
|
8
11
|
var _react = _interopRequireDefault(require("react"));
|
|
9
12
|
var _reactIntlNext = require("react-intl-next");
|
|
10
13
|
var _new = _interopRequireDefault(require("@atlaskit/button/new"));
|
|
11
14
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
15
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
12
17
|
var _SyncedBlockErrorStateCard = require("./SyncedBlockErrorStateCard");
|
|
18
|
+
var styles = {
|
|
19
|
+
buttonContainer: "_18u0u2gc _1e0c1txw _4cvr1h6o"
|
|
20
|
+
};
|
|
13
21
|
var SyncedBlockLoadError = exports.SyncedBlockLoadError = function SyncedBlockLoadError(_ref) {
|
|
14
22
|
var onRetry = _ref.onRetry,
|
|
15
23
|
isLoading = _ref.isLoading;
|
|
16
24
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
17
25
|
formatMessage = _useIntl.formatMessage;
|
|
18
|
-
|
|
19
|
-
description: formatMessage(_messages.syncBlockMessages.generalErrorDescription)
|
|
20
|
-
}, onRetry && /*#__PURE__*/_react.default.createElement(_new.default, {
|
|
26
|
+
var button = /*#__PURE__*/_react.default.createElement(_new.default, {
|
|
21
27
|
appearance: "default",
|
|
22
28
|
spacing: "compact",
|
|
23
29
|
onClick: function onClick(event) {
|
|
24
30
|
event.preventDefault();
|
|
25
31
|
event.stopPropagation();
|
|
26
|
-
onRetry();
|
|
32
|
+
onRetry === null || onRetry === void 0 || onRetry();
|
|
27
33
|
},
|
|
28
34
|
isLoading: isLoading,
|
|
29
35
|
testId: "sync-block-retry-btn"
|
|
30
|
-
}, formatMessage(_messages.syncBlockMessages.retryButton))
|
|
36
|
+
}, formatMessage(_messages.syncBlockMessages.retryButton));
|
|
37
|
+
return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorStateCard.SyncedBlockErrorStateCard, {
|
|
38
|
+
description: formatMessage(_messages.syncBlockMessages.generalErrorDescription)
|
|
39
|
+
}, onRetry && ((0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding') ? /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
40
|
+
xcss: styles.buttonContainer
|
|
41
|
+
}, button) : button));
|
|
31
42
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
._1rjcutpp{padding-block:var(--ds-space-150,9pt)}._16jlkb7n{flex-grow:1}
|
|
3
|
+
._1bah1h6o{justify-content:center}
|
|
4
|
+
._1bahesu3{justify-content:flex-end}
|
|
5
|
+
._1e0c1txw{display:flex}
|
|
6
|
+
._1hmsglyw{text-decoration-line:none}
|
|
7
|
+
._1o9zkb7n{flex-shrink:1}
|
|
8
|
+
._4bfu1r31{text-decoration-color:currentColor}
|
|
9
|
+
._ajmmnqa1{text-decoration-style:solid}
|
|
10
|
+
._i0dlf1ug{flex-basis:0%}
|
|
@@ -1,16 +1,36 @@
|
|
|
1
|
+
/* SyncedBlockNotFoundError.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
1
2
|
"use strict";
|
|
2
3
|
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
6
|
Object.defineProperty(exports, "__esModule", {
|
|
5
7
|
value: true
|
|
6
8
|
});
|
|
7
9
|
exports.SyncedBlockNotFoundError = void 0;
|
|
8
|
-
|
|
10
|
+
require("./SyncedBlockNotFoundError.compiled.css");
|
|
11
|
+
var _runtime = require("@compiled/react/runtime");
|
|
12
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
16
|
var _reactIntlNext = require("react-intl-next");
|
|
10
|
-
var
|
|
17
|
+
var _new = require("@atlaskit/button/new");
|
|
18
|
+
var _messages = _interopRequireWildcard(require("@atlaskit/editor-common/messages"));
|
|
19
|
+
var _syncBlock = require("@atlaskit/editor-common/sync-block");
|
|
20
|
+
var _cross = _interopRequireDefault(require("@atlaskit/icon/core/cross"));
|
|
21
|
+
var _eyeOpenStrikethrough = _interopRequireDefault(require("@atlaskit/icon/core/eye-open-strikethrough"));
|
|
11
22
|
var _linkBroken = _interopRequireDefault(require("@atlaskit/icon/core/link-broken"));
|
|
12
23
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
24
|
+
var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
|
|
25
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
26
|
+
var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
|
|
13
27
|
var _SyncedBlockErrorStateCard = require("./SyncedBlockErrorStateCard");
|
|
28
|
+
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); }
|
|
29
|
+
var styles = {
|
|
30
|
+
link: "_4bfu1r31 _1hmsglyw _ajmmnqa1",
|
|
31
|
+
spinner: "_1rjcutpp _1e0c1txw _1bah1h6o",
|
|
32
|
+
closeButton: "_16jlkb7n _1o9zkb7n _i0dlf1ug _1e0c1txw _1bahesu3"
|
|
33
|
+
};
|
|
14
34
|
var errorMap = {
|
|
15
35
|
'source-block-unsynced': {
|
|
16
36
|
description: _messages.syncBlockMessages.sourceUnsyncedDescription,
|
|
@@ -19,25 +39,143 @@ var errorMap = {
|
|
|
19
39
|
'source-block-deleted': {
|
|
20
40
|
description: _messages.syncBlockMessages.sourceDeletedDescription,
|
|
21
41
|
icon: _linkBroken.default
|
|
42
|
+
},
|
|
43
|
+
'source-document-deleted': {
|
|
44
|
+
description: _messages.syncBlockMessages.notFoundDescription,
|
|
45
|
+
icon: _eyeOpenStrikethrough.default
|
|
46
|
+
},
|
|
47
|
+
generic: {
|
|
48
|
+
description: _messages.syncBlockMessages.genericNotFoundDescription,
|
|
49
|
+
icon: _linkBroken.default
|
|
22
50
|
}
|
|
23
51
|
};
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
52
|
+
var useSyncBlockInfo = (0, _platformFeatureFlagsReact.conditionalHooksFactory)(function () {
|
|
53
|
+
return (0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding');
|
|
54
|
+
}, function () {
|
|
55
|
+
var _useSyncBlockActions;
|
|
56
|
+
var _ref = (_useSyncBlockActions = (0, _syncBlock.useSyncBlockActions)()) !== null && _useSyncBlockActions !== void 0 ? _useSyncBlockActions : {},
|
|
57
|
+
deleteSyncBlock = _ref.deleteSyncBlock,
|
|
58
|
+
fetchSourceInfo = _ref.fetchSourceInfo;
|
|
59
|
+
return {
|
|
60
|
+
deleteSyncBlock: deleteSyncBlock,
|
|
61
|
+
fetchSourceInfo: fetchSourceInfo
|
|
62
|
+
};
|
|
63
|
+
}, function () {
|
|
64
|
+
return {
|
|
65
|
+
deleteSyncBlock: undefined,
|
|
66
|
+
fetchSourceInfo: undefined
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
var useErrorInfo = (0, _platformFeatureFlagsReact.conditionalHooksFactory)(function () {
|
|
70
|
+
return (0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding');
|
|
71
|
+
}, function (reason, url, title) {
|
|
27
72
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
28
73
|
formatMessage = _useIntl.formatMessage;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
74
|
+
if (reason === 'source-document-deleted') {
|
|
75
|
+
var _errorMap$sourceDocu = errorMap['source-document-deleted'],
|
|
76
|
+
_icon = _errorMap$sourceDocu.icon,
|
|
77
|
+
_description = _errorMap$sourceDocu.description;
|
|
78
|
+
return {
|
|
79
|
+
description: formatMessage(_description),
|
|
80
|
+
icon: _icon
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
if (!url || !title) {
|
|
84
|
+
var _errorMap$generic = errorMap['generic'],
|
|
85
|
+
_icon2 = _errorMap$generic.icon,
|
|
86
|
+
_description2 = _errorMap$generic.description;
|
|
87
|
+
return {
|
|
88
|
+
description: formatMessage(_description2),
|
|
89
|
+
icon: _icon2
|
|
90
|
+
};
|
|
35
91
|
}
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return
|
|
40
|
-
description: formatMessage(description
|
|
92
|
+
var _errorMap = errorMap[reason || 'generic'],
|
|
93
|
+
icon = _errorMap.icon,
|
|
94
|
+
description = _errorMap.description;
|
|
95
|
+
return {
|
|
96
|
+
description: formatMessage(description, {
|
|
97
|
+
title: title,
|
|
98
|
+
a: function a(chunk) {
|
|
99
|
+
return /*#__PURE__*/_react.default.createElement(_compiled.Anchor, {
|
|
100
|
+
href: url,
|
|
101
|
+
target: "_blank",
|
|
102
|
+
xcss: styles.link
|
|
103
|
+
}, chunk);
|
|
104
|
+
}
|
|
105
|
+
}),
|
|
106
|
+
icon: icon
|
|
107
|
+
};
|
|
108
|
+
}, function (_) {
|
|
109
|
+
var _useIntl2 = (0, _reactIntlNext.useIntl)(),
|
|
110
|
+
formatMessage = _useIntl2.formatMessage;
|
|
111
|
+
return {
|
|
112
|
+
description: formatMessage(_messages.syncBlockMessages.notFoundDescription),
|
|
113
|
+
icon: undefined
|
|
114
|
+
};
|
|
115
|
+
});
|
|
116
|
+
var SyncedBlockNotFoundError = exports.SyncedBlockNotFoundError = function SyncedBlockNotFoundError(_ref2) {
|
|
117
|
+
var _ref2$reason = _ref2.reason,
|
|
118
|
+
reason = _ref2$reason === void 0 ? 'source-block-deleted' : _ref2$reason,
|
|
119
|
+
sourceAri = _ref2.sourceAri;
|
|
120
|
+
var _useSyncBlockInfo = useSyncBlockInfo(),
|
|
121
|
+
deleteSyncBlock = _useSyncBlockInfo.deleteSyncBlock,
|
|
122
|
+
fetchSourceInfo = _useSyncBlockInfo.fetchSourceInfo;
|
|
123
|
+
var _useState = (0, _react.useState)(undefined),
|
|
124
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
125
|
+
sourceInfo = _useState2[0],
|
|
126
|
+
setSourceInfo = _useState2[1];
|
|
127
|
+
var _useIntl3 = (0, _reactIntlNext.useIntl)(),
|
|
128
|
+
formatMessage = _useIntl3.formatMessage;
|
|
129
|
+
(0, _react.useEffect)(function () {
|
|
130
|
+
if (!(0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding') || !sourceAri ||
|
|
131
|
+
// Only fetch source info for these 2 cases
|
|
132
|
+
!['source-block-deleted', 'source-block-unsynced'].includes(reason)) {
|
|
133
|
+
setSourceInfo({});
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
var getSourceInfo = /*#__PURE__*/function () {
|
|
137
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
138
|
+
var sourceInfo;
|
|
139
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
140
|
+
while (1) switch (_context.prev = _context.next) {
|
|
141
|
+
case 0:
|
|
142
|
+
_context.next = 2;
|
|
143
|
+
return fetchSourceInfo === null || fetchSourceInfo === void 0 ? void 0 : fetchSourceInfo(sourceAri, true);
|
|
144
|
+
case 2:
|
|
145
|
+
sourceInfo = _context.sent;
|
|
146
|
+
setSourceInfo({
|
|
147
|
+
url: sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.url,
|
|
148
|
+
title: sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.title
|
|
149
|
+
});
|
|
150
|
+
case 4:
|
|
151
|
+
case "end":
|
|
152
|
+
return _context.stop();
|
|
153
|
+
}
|
|
154
|
+
}, _callee);
|
|
155
|
+
}));
|
|
156
|
+
return function getSourceInfo() {
|
|
157
|
+
return _ref3.apply(this, arguments);
|
|
158
|
+
};
|
|
159
|
+
}();
|
|
160
|
+
getSourceInfo();
|
|
161
|
+
}, [reason, sourceAri, fetchSourceInfo]);
|
|
162
|
+
var _useErrorInfo = useErrorInfo(reason, sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.url, sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.title),
|
|
163
|
+
description = _useErrorInfo.description,
|
|
164
|
+
icon = _useErrorInfo.icon;
|
|
165
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding') ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, sourceInfo === undefined ? /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
166
|
+
xcss: styles.spinner
|
|
167
|
+
}, /*#__PURE__*/_react.default.createElement(_spinner.default, null)) : /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorStateCard.SyncedBlockErrorStateCard, {
|
|
168
|
+
description: description,
|
|
169
|
+
icon: icon
|
|
170
|
+
}, deleteSyncBlock && /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
171
|
+
xcss: styles.closeButton
|
|
172
|
+
}, /*#__PURE__*/_react.default.createElement(_new.IconButton, {
|
|
173
|
+
appearance: "subtle",
|
|
174
|
+
icon: _cross.default,
|
|
175
|
+
label: formatMessage(_messages.default.delete),
|
|
176
|
+
onClick: deleteSyncBlock
|
|
177
|
+
})))) : /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorStateCard.SyncedBlockErrorStateCard, {
|
|
178
|
+
description: description,
|
|
41
179
|
icon: icon
|
|
42
|
-
});
|
|
180
|
+
}));
|
|
43
181
|
};
|
|
@@ -8,6 +8,7 @@ exports.useMemoizedSyncedBlockNodeComponent = exports.getSyncBlockNodesFromDoc =
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
10
|
var _errorBoundary = require("@atlaskit/editor-common/error-boundary");
|
|
11
|
+
var _syncBlock = require("@atlaskit/editor-common/sync-block");
|
|
11
12
|
var _editorSyncedBlockProvider = require("@atlaskit/editor-synced-block-provider");
|
|
12
13
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
14
|
var _SyncedBlockNodeComponentRenderer = require("./ui/SyncedBlockNodeComponentRenderer");
|
|
@@ -49,12 +50,16 @@ var useMemoizedSyncedBlockNodeComponent = exports.useMemoizedSyncedBlockNodeComp
|
|
|
49
50
|
component: _analytics.ACTION_SUBJECT.SYNCED_BLOCK,
|
|
50
51
|
dispatchAnalyticsEvent: fireAnalyticsEvent,
|
|
51
52
|
fallbackComponent: null
|
|
53
|
+
}, /*#__PURE__*/_react.default.createElement(_syncBlock.SyncBlockActionsProvider, {
|
|
54
|
+
fetchSyncBlockSourceInfo: function fetchSyncBlockSourceInfo(sourceAri) {
|
|
55
|
+
return syncBlockStoreManager.referenceManager.fetchSyncBlockSourceInfoBySourceAri(sourceAri);
|
|
56
|
+
}
|
|
52
57
|
}, /*#__PURE__*/_react.default.createElement(_SyncedBlockNodeComponentRenderer.SyncedBlockNodeComponentRenderer, {
|
|
53
58
|
key: props.localId,
|
|
54
59
|
nodeProps: props,
|
|
55
60
|
syncBlockStoreManager: syncBlockStoreManager,
|
|
56
61
|
rendererOptions: syncBlockRendererOptions
|
|
57
|
-
})) : /*#__PURE__*/_react.default.createElement(_SyncedBlockNodeComponentRenderer.SyncedBlockNodeComponentRenderer, {
|
|
62
|
+
}))) : /*#__PURE__*/_react.default.createElement(_SyncedBlockNodeComponentRenderer.SyncedBlockNodeComponentRenderer, {
|
|
58
63
|
key: props.localId,
|
|
59
64
|
nodeProps: props,
|
|
60
65
|
syncBlockStoreManager: syncBlockStoreManager,
|
|
@@ -43,7 +43,8 @@ export const SyncedBlockErrorComponent = ({
|
|
|
43
43
|
return getForbiddenErrorContent(resourceId, fireAnalyticsEvent);
|
|
44
44
|
case SyncBlockError.NotFound:
|
|
45
45
|
return /*#__PURE__*/React.createElement(SyncedBlockNotFoundError, {
|
|
46
|
-
reason: error.reason
|
|
46
|
+
reason: error.reason,
|
|
47
|
+
sourceAri: error.sourceAri
|
|
47
48
|
});
|
|
48
49
|
case SyncBlockError.Errored:
|
|
49
50
|
case SyncBlockError.RateLimited:
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
._zulppxbi{gap:var(--ds-space-200,1pc)}
|
|
3
|
-
._1bahv2br{justify-content:start}
|
|
2
|
+
._zulppxbi{gap:var(--ds-space-200,1pc)}
|
|
3
|
+
._1rjc12x7{padding-block:var(--ds-space-075,6px)}._1bahv2br{justify-content:start}
|
|
4
4
|
._1e0c1txw{display:flex}
|
|
5
5
|
._4cvr1h6o{align-items:center}
|
|
6
|
-
.
|
|
7
|
-
._n3tdu2gc{padding-bottom:var(--ds-space-100,8px)}
|
|
8
|
-
._u5f3pxbi{padding-right:var(--ds-space-200,1pc)}
|
|
6
|
+
._bozgpxbi{padding-inline-start:var(--ds-space-200,1pc)}
|
|
@@ -6,7 +6,8 @@ import WarningOutlineIcon from '@atlaskit/icon-lab/core/warning-outline';
|
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import { Box, Text } from '@atlaskit/primitives/compiled';
|
|
8
8
|
const styles = {
|
|
9
|
-
wrapper: "_zulppxbi
|
|
9
|
+
wrapper: "_zulppxbi _1rjc12x7 _bozgpxbi _1e0c1txw _1bahv2br _4cvr1h6o",
|
|
10
|
+
container: "_1e0c1txw"
|
|
10
11
|
};
|
|
11
12
|
export const SyncedBlockErrorStateCard = ({
|
|
12
13
|
children,
|
|
@@ -15,11 +16,13 @@ export const SyncedBlockErrorStateCard = ({
|
|
|
15
16
|
}) => {
|
|
16
17
|
const Icon = fg('platform_synced_block_dogfooding') ? icon !== null && icon !== void 0 ? icon : WarningOutlineIcon : WarningOutlineIcon;
|
|
17
18
|
return /*#__PURE__*/React.createElement(Box, {
|
|
19
|
+
xcss: styles.container
|
|
20
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
18
21
|
xcss: styles.wrapper
|
|
19
22
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
20
23
|
color: "var(--ds-icon-subtle, #505258)",
|
|
21
24
|
label: ""
|
|
22
25
|
}), /*#__PURE__*/React.createElement(Text, {
|
|
23
26
|
color: "color.text.subtle"
|
|
24
|
-
}, description), children);
|
|
27
|
+
}, description), !fg('platform_synced_block_dogfooding') && children), fg('platform_synced_block_dogfooding') && children);
|
|
25
28
|
};
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
/* SyncedBlockLoadError.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
+
import "./SyncedBlockLoadError.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
1
4
|
import React from 'react';
|
|
2
5
|
import { useIntl } from 'react-intl-next';
|
|
3
6
|
import Button from '@atlaskit/button/new';
|
|
4
7
|
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
5
10
|
import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
|
|
11
|
+
const styles = {
|
|
12
|
+
buttonContainer: "_18u0u2gc _1e0c1txw _4cvr1h6o"
|
|
13
|
+
};
|
|
6
14
|
export const SyncedBlockLoadError = ({
|
|
7
15
|
onRetry,
|
|
8
16
|
isLoading
|
|
@@ -10,17 +18,20 @@ export const SyncedBlockLoadError = ({
|
|
|
10
18
|
const {
|
|
11
19
|
formatMessage
|
|
12
20
|
} = useIntl();
|
|
13
|
-
|
|
14
|
-
description: formatMessage(messages.generalErrorDescription)
|
|
15
|
-
}, onRetry && /*#__PURE__*/React.createElement(Button, {
|
|
21
|
+
const button = /*#__PURE__*/React.createElement(Button, {
|
|
16
22
|
appearance: "default",
|
|
17
23
|
spacing: "compact",
|
|
18
24
|
onClick: event => {
|
|
19
25
|
event.preventDefault();
|
|
20
26
|
event.stopPropagation();
|
|
21
|
-
onRetry();
|
|
27
|
+
onRetry === null || onRetry === void 0 ? void 0 : onRetry();
|
|
22
28
|
},
|
|
23
29
|
isLoading: isLoading,
|
|
24
30
|
testId: "sync-block-retry-btn"
|
|
25
|
-
}, formatMessage(messages.retryButton))
|
|
31
|
+
}, formatMessage(messages.retryButton));
|
|
32
|
+
return /*#__PURE__*/React.createElement(SyncedBlockErrorStateCard, {
|
|
33
|
+
description: formatMessage(messages.generalErrorDescription)
|
|
34
|
+
}, onRetry && (fg('platform_synced_block_dogfooding') ? /*#__PURE__*/React.createElement(Box, {
|
|
35
|
+
xcss: styles.buttonContainer
|
|
36
|
+
}, button) : button));
|
|
26
37
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
._1rjcutpp{padding-block:var(--ds-space-150,9pt)}._16jlkb7n{flex-grow:1}
|
|
3
|
+
._1bah1h6o{justify-content:center}
|
|
4
|
+
._1bahesu3{justify-content:flex-end}
|
|
5
|
+
._1e0c1txw{display:flex}
|
|
6
|
+
._1hmsglyw{text-decoration-line:none}
|
|
7
|
+
._1o9zkb7n{flex-shrink:1}
|
|
8
|
+
._4bfu1r31{text-decoration-color:currentColor}
|
|
9
|
+
._ajmmnqa1{text-decoration-style:solid}
|
|
10
|
+
._i0dlf1ug{flex-basis:0%}
|
|
@@ -1,9 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
/* SyncedBlockNotFoundError.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
+
import "./SyncedBlockNotFoundError.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
+
import React, { useEffect, useState } from 'react';
|
|
2
5
|
import { useIntl } from 'react-intl-next';
|
|
3
|
-
import {
|
|
6
|
+
import { IconButton } from '@atlaskit/button/new';
|
|
7
|
+
import commonMessages, { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
8
|
+
import { useSyncBlockActions } from '@atlaskit/editor-common/sync-block';
|
|
9
|
+
import CrossIcon from '@atlaskit/icon/core/cross';
|
|
10
|
+
import EyeOpenStrikethroughIcon from '@atlaskit/icon/core/eye-open-strikethrough';
|
|
4
11
|
import LinkBrokenIcon from '@atlaskit/icon/core/link-broken';
|
|
5
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
|
+
import { conditionalHooksFactory } from '@atlaskit/platform-feature-flags-react';
|
|
14
|
+
import { Anchor, Box } from '@atlaskit/primitives/compiled';
|
|
15
|
+
import Spinner from '@atlaskit/spinner';
|
|
6
16
|
import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
|
|
17
|
+
const styles = {
|
|
18
|
+
link: "_4bfu1r31 _1hmsglyw _ajmmnqa1",
|
|
19
|
+
spinner: "_1rjcutpp _1e0c1txw _1bah1h6o",
|
|
20
|
+
closeButton: "_16jlkb7n _1o9zkb7n _i0dlf1ug _1e0c1txw _1bahesu3"
|
|
21
|
+
};
|
|
7
22
|
const errorMap = {
|
|
8
23
|
'source-block-unsynced': {
|
|
9
24
|
description: messages.sourceUnsyncedDescription,
|
|
@@ -12,27 +27,126 @@ const errorMap = {
|
|
|
12
27
|
'source-block-deleted': {
|
|
13
28
|
description: messages.sourceDeletedDescription,
|
|
14
29
|
icon: LinkBrokenIcon
|
|
30
|
+
},
|
|
31
|
+
'source-document-deleted': {
|
|
32
|
+
description: messages.notFoundDescription,
|
|
33
|
+
icon: EyeOpenStrikethroughIcon
|
|
34
|
+
},
|
|
35
|
+
generic: {
|
|
36
|
+
description: messages.genericNotFoundDescription,
|
|
37
|
+
icon: LinkBrokenIcon
|
|
15
38
|
}
|
|
16
39
|
};
|
|
40
|
+
const useSyncBlockInfo = conditionalHooksFactory(() => fg('platform_synced_block_dogfooding'), () => {
|
|
41
|
+
var _useSyncBlockActions;
|
|
42
|
+
const {
|
|
43
|
+
deleteSyncBlock,
|
|
44
|
+
fetchSourceInfo
|
|
45
|
+
} = (_useSyncBlockActions = useSyncBlockActions()) !== null && _useSyncBlockActions !== void 0 ? _useSyncBlockActions : {};
|
|
46
|
+
return {
|
|
47
|
+
deleteSyncBlock,
|
|
48
|
+
fetchSourceInfo
|
|
49
|
+
};
|
|
50
|
+
}, () => {
|
|
51
|
+
return {
|
|
52
|
+
deleteSyncBlock: undefined,
|
|
53
|
+
fetchSourceInfo: undefined
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
const useErrorInfo = conditionalHooksFactory(() => fg('platform_synced_block_dogfooding'), (reason, url, title) => {
|
|
57
|
+
const {
|
|
58
|
+
formatMessage
|
|
59
|
+
} = useIntl();
|
|
60
|
+
if (reason === 'source-document-deleted') {
|
|
61
|
+
const {
|
|
62
|
+
icon,
|
|
63
|
+
description
|
|
64
|
+
} = errorMap['source-document-deleted'];
|
|
65
|
+
return {
|
|
66
|
+
description: formatMessage(description),
|
|
67
|
+
icon
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
if (!url || !title) {
|
|
71
|
+
const {
|
|
72
|
+
icon,
|
|
73
|
+
description
|
|
74
|
+
} = errorMap['generic'];
|
|
75
|
+
return {
|
|
76
|
+
description: formatMessage(description),
|
|
77
|
+
icon
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const {
|
|
81
|
+
icon,
|
|
82
|
+
description
|
|
83
|
+
} = errorMap[reason || 'generic'];
|
|
84
|
+
return {
|
|
85
|
+
description: formatMessage(description, {
|
|
86
|
+
title,
|
|
87
|
+
a: chunk => /*#__PURE__*/React.createElement(Anchor, {
|
|
88
|
+
href: url,
|
|
89
|
+
target: "_blank",
|
|
90
|
+
xcss: styles.link
|
|
91
|
+
}, chunk)
|
|
92
|
+
}),
|
|
93
|
+
icon
|
|
94
|
+
};
|
|
95
|
+
}, _ => {
|
|
96
|
+
const {
|
|
97
|
+
formatMessage
|
|
98
|
+
} = useIntl();
|
|
99
|
+
return {
|
|
100
|
+
description: formatMessage(messages.notFoundDescription),
|
|
101
|
+
icon: undefined
|
|
102
|
+
};
|
|
103
|
+
});
|
|
17
104
|
export const SyncedBlockNotFoundError = ({
|
|
18
|
-
reason = 'source-block-deleted'
|
|
105
|
+
reason = 'source-block-deleted',
|
|
106
|
+
sourceAri
|
|
19
107
|
}) => {
|
|
108
|
+
const {
|
|
109
|
+
deleteSyncBlock,
|
|
110
|
+
fetchSourceInfo
|
|
111
|
+
} = useSyncBlockInfo();
|
|
112
|
+
const [sourceInfo, setSourceInfo] = useState(undefined);
|
|
20
113
|
const {
|
|
21
114
|
formatMessage
|
|
22
115
|
} = useIntl();
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
if (!fg('platform_synced_block_dogfooding') || !sourceAri ||
|
|
118
|
+
// Only fetch source info for these 2 cases
|
|
119
|
+
!['source-block-deleted', 'source-block-unsynced'].includes(reason)) {
|
|
120
|
+
setSourceInfo({});
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const getSourceInfo = async () => {
|
|
124
|
+
const sourceInfo = await (fetchSourceInfo === null || fetchSourceInfo === void 0 ? void 0 : fetchSourceInfo(sourceAri, true));
|
|
125
|
+
setSourceInfo({
|
|
126
|
+
url: sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.url,
|
|
127
|
+
title: sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.title
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
getSourceInfo();
|
|
131
|
+
}, [reason, sourceAri, fetchSourceInfo]);
|
|
30
132
|
const {
|
|
31
133
|
description,
|
|
32
134
|
icon
|
|
33
|
-
} =
|
|
34
|
-
return /*#__PURE__*/React.createElement(
|
|
35
|
-
|
|
135
|
+
} = useErrorInfo(reason, sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.url, sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.title);
|
|
136
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, fg('platform_synced_block_dogfooding') ? /*#__PURE__*/React.createElement(React.Fragment, null, sourceInfo === undefined ? /*#__PURE__*/React.createElement(Box, {
|
|
137
|
+
xcss: styles.spinner
|
|
138
|
+
}, /*#__PURE__*/React.createElement(Spinner, null)) : /*#__PURE__*/React.createElement(SyncedBlockErrorStateCard, {
|
|
139
|
+
description: description,
|
|
140
|
+
icon: icon
|
|
141
|
+
}, deleteSyncBlock && /*#__PURE__*/React.createElement(Box, {
|
|
142
|
+
xcss: styles.closeButton
|
|
143
|
+
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
144
|
+
appearance: "subtle",
|
|
145
|
+
icon: CrossIcon,
|
|
146
|
+
label: formatMessage(commonMessages.delete),
|
|
147
|
+
onClick: deleteSyncBlock
|
|
148
|
+
})))) : /*#__PURE__*/React.createElement(SyncedBlockErrorStateCard, {
|
|
149
|
+
description: description,
|
|
36
150
|
icon: icon
|
|
37
|
-
});
|
|
151
|
+
}));
|
|
38
152
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useEffect } from 'react';
|
|
2
2
|
import { ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
4
|
+
import { SyncBlockActionsProvider } from '@atlaskit/editor-common/sync-block';
|
|
4
5
|
import { convertSyncBlockJSONNodeToSyncBlockNode, useMemoizedSyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
|
|
5
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { SyncedBlockNodeComponentRenderer } from './ui/SyncedBlockNodeComponentRenderer';
|
|
@@ -39,12 +40,14 @@ export const useMemoizedSyncedBlockNodeComponent = ({
|
|
|
39
40
|
component: ACTION_SUBJECT.SYNCED_BLOCK,
|
|
40
41
|
dispatchAnalyticsEvent: fireAnalyticsEvent,
|
|
41
42
|
fallbackComponent: null
|
|
43
|
+
}, /*#__PURE__*/React.createElement(SyncBlockActionsProvider, {
|
|
44
|
+
fetchSyncBlockSourceInfo: sourceAri => syncBlockStoreManager.referenceManager.fetchSyncBlockSourceInfoBySourceAri(sourceAri)
|
|
42
45
|
}, /*#__PURE__*/React.createElement(SyncedBlockNodeComponentRenderer, {
|
|
43
46
|
key: props.localId,
|
|
44
47
|
nodeProps: props,
|
|
45
48
|
syncBlockStoreManager: syncBlockStoreManager,
|
|
46
49
|
rendererOptions: syncBlockRendererOptions
|
|
47
|
-
})) : /*#__PURE__*/React.createElement(SyncedBlockNodeComponentRenderer, {
|
|
50
|
+
}))) : /*#__PURE__*/React.createElement(SyncedBlockNodeComponentRenderer, {
|
|
48
51
|
key: props.localId,
|
|
49
52
|
nodeProps: props,
|
|
50
53
|
syncBlockStoreManager: syncBlockStoreManager,
|
|
@@ -41,7 +41,8 @@ export var SyncedBlockErrorComponent = function SyncedBlockErrorComponent(_ref)
|
|
|
41
41
|
return getForbiddenErrorContent(resourceId, fireAnalyticsEvent);
|
|
42
42
|
case SyncBlockError.NotFound:
|
|
43
43
|
return /*#__PURE__*/React.createElement(SyncedBlockNotFoundError, {
|
|
44
|
-
reason: error.reason
|
|
44
|
+
reason: error.reason,
|
|
45
|
+
sourceAri: error.sourceAri
|
|
45
46
|
});
|
|
46
47
|
case SyncBlockError.Errored:
|
|
47
48
|
case SyncBlockError.RateLimited:
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
._zulppxbi{gap:var(--ds-space-200,1pc)}
|
|
3
|
-
._1bahv2br{justify-content:start}
|
|
2
|
+
._zulppxbi{gap:var(--ds-space-200,1pc)}
|
|
3
|
+
._1rjc12x7{padding-block:var(--ds-space-075,6px)}._1bahv2br{justify-content:start}
|
|
4
4
|
._1e0c1txw{display:flex}
|
|
5
5
|
._4cvr1h6o{align-items:center}
|
|
6
|
-
.
|
|
7
|
-
._n3tdu2gc{padding-bottom:var(--ds-space-100,8px)}
|
|
8
|
-
._u5f3pxbi{padding-right:var(--ds-space-200,1pc)}
|
|
6
|
+
._bozgpxbi{padding-inline-start:var(--ds-space-200,1pc)}
|
|
@@ -6,7 +6,8 @@ import WarningOutlineIcon from '@atlaskit/icon-lab/core/warning-outline';
|
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import { Box, Text } from '@atlaskit/primitives/compiled';
|
|
8
8
|
var styles = {
|
|
9
|
-
wrapper: "_zulppxbi
|
|
9
|
+
wrapper: "_zulppxbi _1rjc12x7 _bozgpxbi _1e0c1txw _1bahv2br _4cvr1h6o",
|
|
10
|
+
container: "_1e0c1txw"
|
|
10
11
|
};
|
|
11
12
|
export var SyncedBlockErrorStateCard = function SyncedBlockErrorStateCard(_ref) {
|
|
12
13
|
var children = _ref.children,
|
|
@@ -14,11 +15,13 @@ export var SyncedBlockErrorStateCard = function SyncedBlockErrorStateCard(_ref)
|
|
|
14
15
|
icon = _ref.icon;
|
|
15
16
|
var Icon = fg('platform_synced_block_dogfooding') ? icon !== null && icon !== void 0 ? icon : WarningOutlineIcon : WarningOutlineIcon;
|
|
16
17
|
return /*#__PURE__*/React.createElement(Box, {
|
|
18
|
+
xcss: styles.container
|
|
19
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
17
20
|
xcss: styles.wrapper
|
|
18
21
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
19
22
|
color: "var(--ds-icon-subtle, #505258)",
|
|
20
23
|
label: ""
|
|
21
24
|
}), /*#__PURE__*/React.createElement(Text, {
|
|
22
25
|
color: "color.text.subtle"
|
|
23
|
-
}, description), children);
|
|
26
|
+
}, description), !fg('platform_synced_block_dogfooding') && children), fg('platform_synced_block_dogfooding') && children);
|
|
24
27
|
};
|
|
@@ -1,24 +1,35 @@
|
|
|
1
|
+
/* SyncedBlockLoadError.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
+
import "./SyncedBlockLoadError.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
1
4
|
import React from 'react';
|
|
2
5
|
import { useIntl } from 'react-intl-next';
|
|
3
6
|
import Button from '@atlaskit/button/new';
|
|
4
7
|
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
5
10
|
import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
|
|
11
|
+
var styles = {
|
|
12
|
+
buttonContainer: "_18u0u2gc _1e0c1txw _4cvr1h6o"
|
|
13
|
+
};
|
|
6
14
|
export var SyncedBlockLoadError = function SyncedBlockLoadError(_ref) {
|
|
7
15
|
var onRetry = _ref.onRetry,
|
|
8
16
|
isLoading = _ref.isLoading;
|
|
9
17
|
var _useIntl = useIntl(),
|
|
10
18
|
formatMessage = _useIntl.formatMessage;
|
|
11
|
-
|
|
12
|
-
description: formatMessage(messages.generalErrorDescription)
|
|
13
|
-
}, onRetry && /*#__PURE__*/React.createElement(Button, {
|
|
19
|
+
var button = /*#__PURE__*/React.createElement(Button, {
|
|
14
20
|
appearance: "default",
|
|
15
21
|
spacing: "compact",
|
|
16
22
|
onClick: function onClick(event) {
|
|
17
23
|
event.preventDefault();
|
|
18
24
|
event.stopPropagation();
|
|
19
|
-
onRetry();
|
|
25
|
+
onRetry === null || onRetry === void 0 || onRetry();
|
|
20
26
|
},
|
|
21
27
|
isLoading: isLoading,
|
|
22
28
|
testId: "sync-block-retry-btn"
|
|
23
|
-
}, formatMessage(messages.retryButton))
|
|
29
|
+
}, formatMessage(messages.retryButton));
|
|
30
|
+
return /*#__PURE__*/React.createElement(SyncedBlockErrorStateCard, {
|
|
31
|
+
description: formatMessage(messages.generalErrorDescription)
|
|
32
|
+
}, onRetry && (fg('platform_synced_block_dogfooding') ? /*#__PURE__*/React.createElement(Box, {
|
|
33
|
+
xcss: styles.buttonContainer
|
|
34
|
+
}, button) : button));
|
|
24
35
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
._1rjcutpp{padding-block:var(--ds-space-150,9pt)}._16jlkb7n{flex-grow:1}
|
|
3
|
+
._1bah1h6o{justify-content:center}
|
|
4
|
+
._1bahesu3{justify-content:flex-end}
|
|
5
|
+
._1e0c1txw{display:flex}
|
|
6
|
+
._1hmsglyw{text-decoration-line:none}
|
|
7
|
+
._1o9zkb7n{flex-shrink:1}
|
|
8
|
+
._4bfu1r31{text-decoration-color:currentColor}
|
|
9
|
+
._ajmmnqa1{text-decoration-style:solid}
|
|
10
|
+
._i0dlf1ug{flex-basis:0%}
|
|
@@ -1,9 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
/* SyncedBlockNotFoundError.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
+
import "./SyncedBlockNotFoundError.compiled.css";
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
|
+
import React, { useEffect, useState } from 'react';
|
|
2
8
|
import { useIntl } from 'react-intl-next';
|
|
3
|
-
import {
|
|
9
|
+
import { IconButton } from '@atlaskit/button/new';
|
|
10
|
+
import commonMessages, { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
11
|
+
import { useSyncBlockActions } from '@atlaskit/editor-common/sync-block';
|
|
12
|
+
import CrossIcon from '@atlaskit/icon/core/cross';
|
|
13
|
+
import EyeOpenStrikethroughIcon from '@atlaskit/icon/core/eye-open-strikethrough';
|
|
4
14
|
import LinkBrokenIcon from '@atlaskit/icon/core/link-broken';
|
|
5
15
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
|
+
import { conditionalHooksFactory } from '@atlaskit/platform-feature-flags-react';
|
|
17
|
+
import { Anchor, Box } from '@atlaskit/primitives/compiled';
|
|
18
|
+
import Spinner from '@atlaskit/spinner';
|
|
6
19
|
import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
|
|
20
|
+
var styles = {
|
|
21
|
+
link: "_4bfu1r31 _1hmsglyw _ajmmnqa1",
|
|
22
|
+
spinner: "_1rjcutpp _1e0c1txw _1bah1h6o",
|
|
23
|
+
closeButton: "_16jlkb7n _1o9zkb7n _i0dlf1ug _1e0c1txw _1bahesu3"
|
|
24
|
+
};
|
|
7
25
|
var errorMap = {
|
|
8
26
|
'source-block-unsynced': {
|
|
9
27
|
description: messages.sourceUnsyncedDescription,
|
|
@@ -12,25 +30,143 @@ var errorMap = {
|
|
|
12
30
|
'source-block-deleted': {
|
|
13
31
|
description: messages.sourceDeletedDescription,
|
|
14
32
|
icon: LinkBrokenIcon
|
|
33
|
+
},
|
|
34
|
+
'source-document-deleted': {
|
|
35
|
+
description: messages.notFoundDescription,
|
|
36
|
+
icon: EyeOpenStrikethroughIcon
|
|
37
|
+
},
|
|
38
|
+
generic: {
|
|
39
|
+
description: messages.genericNotFoundDescription,
|
|
40
|
+
icon: LinkBrokenIcon
|
|
15
41
|
}
|
|
16
42
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
43
|
+
var useSyncBlockInfo = conditionalHooksFactory(function () {
|
|
44
|
+
return fg('platform_synced_block_dogfooding');
|
|
45
|
+
}, function () {
|
|
46
|
+
var _useSyncBlockActions;
|
|
47
|
+
var _ref = (_useSyncBlockActions = useSyncBlockActions()) !== null && _useSyncBlockActions !== void 0 ? _useSyncBlockActions : {},
|
|
48
|
+
deleteSyncBlock = _ref.deleteSyncBlock,
|
|
49
|
+
fetchSourceInfo = _ref.fetchSourceInfo;
|
|
50
|
+
return {
|
|
51
|
+
deleteSyncBlock: deleteSyncBlock,
|
|
52
|
+
fetchSourceInfo: fetchSourceInfo
|
|
53
|
+
};
|
|
54
|
+
}, function () {
|
|
55
|
+
return {
|
|
56
|
+
deleteSyncBlock: undefined,
|
|
57
|
+
fetchSourceInfo: undefined
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
var useErrorInfo = conditionalHooksFactory(function () {
|
|
61
|
+
return fg('platform_synced_block_dogfooding');
|
|
62
|
+
}, function (reason, url, title) {
|
|
20
63
|
var _useIntl = useIntl(),
|
|
21
64
|
formatMessage = _useIntl.formatMessage;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
65
|
+
if (reason === 'source-document-deleted') {
|
|
66
|
+
var _errorMap$sourceDocu = errorMap['source-document-deleted'],
|
|
67
|
+
_icon = _errorMap$sourceDocu.icon,
|
|
68
|
+
_description = _errorMap$sourceDocu.description;
|
|
69
|
+
return {
|
|
70
|
+
description: formatMessage(_description),
|
|
71
|
+
icon: _icon
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (!url || !title) {
|
|
75
|
+
var _errorMap$generic = errorMap['generic'],
|
|
76
|
+
_icon2 = _errorMap$generic.icon,
|
|
77
|
+
_description2 = _errorMap$generic.description;
|
|
78
|
+
return {
|
|
79
|
+
description: formatMessage(_description2),
|
|
80
|
+
icon: _icon2
|
|
81
|
+
};
|
|
28
82
|
}
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return
|
|
33
|
-
description: formatMessage(description
|
|
83
|
+
var _errorMap = errorMap[reason || 'generic'],
|
|
84
|
+
icon = _errorMap.icon,
|
|
85
|
+
description = _errorMap.description;
|
|
86
|
+
return {
|
|
87
|
+
description: formatMessage(description, {
|
|
88
|
+
title: title,
|
|
89
|
+
a: function a(chunk) {
|
|
90
|
+
return /*#__PURE__*/React.createElement(Anchor, {
|
|
91
|
+
href: url,
|
|
92
|
+
target: "_blank",
|
|
93
|
+
xcss: styles.link
|
|
94
|
+
}, chunk);
|
|
95
|
+
}
|
|
96
|
+
}),
|
|
97
|
+
icon: icon
|
|
98
|
+
};
|
|
99
|
+
}, function (_) {
|
|
100
|
+
var _useIntl2 = useIntl(),
|
|
101
|
+
formatMessage = _useIntl2.formatMessage;
|
|
102
|
+
return {
|
|
103
|
+
description: formatMessage(messages.notFoundDescription),
|
|
104
|
+
icon: undefined
|
|
105
|
+
};
|
|
106
|
+
});
|
|
107
|
+
export var SyncedBlockNotFoundError = function SyncedBlockNotFoundError(_ref2) {
|
|
108
|
+
var _ref2$reason = _ref2.reason,
|
|
109
|
+
reason = _ref2$reason === void 0 ? 'source-block-deleted' : _ref2$reason,
|
|
110
|
+
sourceAri = _ref2.sourceAri;
|
|
111
|
+
var _useSyncBlockInfo = useSyncBlockInfo(),
|
|
112
|
+
deleteSyncBlock = _useSyncBlockInfo.deleteSyncBlock,
|
|
113
|
+
fetchSourceInfo = _useSyncBlockInfo.fetchSourceInfo;
|
|
114
|
+
var _useState = useState(undefined),
|
|
115
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
116
|
+
sourceInfo = _useState2[0],
|
|
117
|
+
setSourceInfo = _useState2[1];
|
|
118
|
+
var _useIntl3 = useIntl(),
|
|
119
|
+
formatMessage = _useIntl3.formatMessage;
|
|
120
|
+
useEffect(function () {
|
|
121
|
+
if (!fg('platform_synced_block_dogfooding') || !sourceAri ||
|
|
122
|
+
// Only fetch source info for these 2 cases
|
|
123
|
+
!['source-block-deleted', 'source-block-unsynced'].includes(reason)) {
|
|
124
|
+
setSourceInfo({});
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
var getSourceInfo = /*#__PURE__*/function () {
|
|
128
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
129
|
+
var sourceInfo;
|
|
130
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
131
|
+
while (1) switch (_context.prev = _context.next) {
|
|
132
|
+
case 0:
|
|
133
|
+
_context.next = 2;
|
|
134
|
+
return fetchSourceInfo === null || fetchSourceInfo === void 0 ? void 0 : fetchSourceInfo(sourceAri, true);
|
|
135
|
+
case 2:
|
|
136
|
+
sourceInfo = _context.sent;
|
|
137
|
+
setSourceInfo({
|
|
138
|
+
url: sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.url,
|
|
139
|
+
title: sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.title
|
|
140
|
+
});
|
|
141
|
+
case 4:
|
|
142
|
+
case "end":
|
|
143
|
+
return _context.stop();
|
|
144
|
+
}
|
|
145
|
+
}, _callee);
|
|
146
|
+
}));
|
|
147
|
+
return function getSourceInfo() {
|
|
148
|
+
return _ref3.apply(this, arguments);
|
|
149
|
+
};
|
|
150
|
+
}();
|
|
151
|
+
getSourceInfo();
|
|
152
|
+
}, [reason, sourceAri, fetchSourceInfo]);
|
|
153
|
+
var _useErrorInfo = useErrorInfo(reason, sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.url, sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.title),
|
|
154
|
+
description = _useErrorInfo.description,
|
|
155
|
+
icon = _useErrorInfo.icon;
|
|
156
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, fg('platform_synced_block_dogfooding') ? /*#__PURE__*/React.createElement(React.Fragment, null, sourceInfo === undefined ? /*#__PURE__*/React.createElement(Box, {
|
|
157
|
+
xcss: styles.spinner
|
|
158
|
+
}, /*#__PURE__*/React.createElement(Spinner, null)) : /*#__PURE__*/React.createElement(SyncedBlockErrorStateCard, {
|
|
159
|
+
description: description,
|
|
160
|
+
icon: icon
|
|
161
|
+
}, deleteSyncBlock && /*#__PURE__*/React.createElement(Box, {
|
|
162
|
+
xcss: styles.closeButton
|
|
163
|
+
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
164
|
+
appearance: "subtle",
|
|
165
|
+
icon: CrossIcon,
|
|
166
|
+
label: formatMessage(commonMessages.delete),
|
|
167
|
+
onClick: deleteSyncBlock
|
|
168
|
+
})))) : /*#__PURE__*/React.createElement(SyncedBlockErrorStateCard, {
|
|
169
|
+
description: description,
|
|
34
170
|
icon: icon
|
|
35
|
-
});
|
|
171
|
+
}));
|
|
36
172
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useEffect } from 'react';
|
|
2
2
|
import { ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
4
|
+
import { SyncBlockActionsProvider } from '@atlaskit/editor-common/sync-block';
|
|
4
5
|
import { convertSyncBlockJSONNodeToSyncBlockNode, useMemoizedSyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
|
|
5
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { SyncedBlockNodeComponentRenderer } from './ui/SyncedBlockNodeComponentRenderer';
|
|
@@ -41,12 +42,16 @@ export var useMemoizedSyncedBlockNodeComponent = function useMemoizedSyncedBlock
|
|
|
41
42
|
component: ACTION_SUBJECT.SYNCED_BLOCK,
|
|
42
43
|
dispatchAnalyticsEvent: fireAnalyticsEvent,
|
|
43
44
|
fallbackComponent: null
|
|
45
|
+
}, /*#__PURE__*/React.createElement(SyncBlockActionsProvider, {
|
|
46
|
+
fetchSyncBlockSourceInfo: function fetchSyncBlockSourceInfo(sourceAri) {
|
|
47
|
+
return syncBlockStoreManager.referenceManager.fetchSyncBlockSourceInfoBySourceAri(sourceAri);
|
|
48
|
+
}
|
|
44
49
|
}, /*#__PURE__*/React.createElement(SyncedBlockNodeComponentRenderer, {
|
|
45
50
|
key: props.localId,
|
|
46
51
|
nodeProps: props,
|
|
47
52
|
syncBlockStoreManager: syncBlockStoreManager,
|
|
48
53
|
rendererOptions: syncBlockRendererOptions
|
|
49
|
-
})) : /*#__PURE__*/React.createElement(SyncedBlockNodeComponentRenderer, {
|
|
54
|
+
}))) : /*#__PURE__*/React.createElement(SyncedBlockNodeComponentRenderer, {
|
|
50
55
|
key: props.localId,
|
|
51
56
|
nodeProps: props,
|
|
52
57
|
syncBlockStoreManager: syncBlockStoreManager,
|
|
@@ -2,7 +2,6 @@ import React, { type ReactNode } from 'react';
|
|
|
2
2
|
import type { NewCoreIconProps } from '@atlaskit/icon/types';
|
|
3
3
|
interface SyncedBlockErrorStateCardProps {
|
|
4
4
|
children?: ReactNode;
|
|
5
|
-
closeButton?: ReactNode;
|
|
6
5
|
description: ReactNode;
|
|
7
6
|
icon?: (props: NewCoreIconProps) => JSX.Element;
|
|
8
7
|
}
|
|
@@ -4,5 +4,5 @@ interface SyncedBlockNotFoundProps {
|
|
|
4
4
|
isLoading?: boolean;
|
|
5
5
|
onRetry?: () => void;
|
|
6
6
|
}
|
|
7
|
-
export declare const SyncedBlockLoadError: ({ onRetry, isLoading }: SyncedBlockNotFoundProps) => React.JSX.Element;
|
|
7
|
+
export declare const SyncedBlockLoadError: ({ onRetry, isLoading, }: SyncedBlockNotFoundProps) => React.JSX.Element;
|
|
8
8
|
export {};
|
|
@@ -2,7 +2,6 @@ import React, { type ReactNode } from 'react';
|
|
|
2
2
|
import type { NewCoreIconProps } from '@atlaskit/icon/types';
|
|
3
3
|
interface SyncedBlockErrorStateCardProps {
|
|
4
4
|
children?: ReactNode;
|
|
5
|
-
closeButton?: ReactNode;
|
|
6
5
|
description: ReactNode;
|
|
7
6
|
icon?: (props: NewCoreIconProps) => JSX.Element;
|
|
8
7
|
}
|
|
@@ -4,5 +4,5 @@ interface SyncedBlockNotFoundProps {
|
|
|
4
4
|
isLoading?: boolean;
|
|
5
5
|
onRetry?: () => void;
|
|
6
6
|
}
|
|
7
|
-
export declare const SyncedBlockLoadError: ({ onRetry, isLoading }: SyncedBlockNotFoundProps) => React.JSX.Element;
|
|
7
|
+
export declare const SyncedBlockLoadError: ({ onRetry, isLoading, }: SyncedBlockNotFoundProps) => React.JSX.Element;
|
|
8
8
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-synced-block-renderer",
|
|
3
|
-
"version": "5.6.
|
|
3
|
+
"version": "5.6.3",
|
|
4
4
|
"description": "SyncedBlockRenderer for @atlaskit/editor-plugin-synced-block",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -37,12 +37,14 @@
|
|
|
37
37
|
"@atlaskit/icon-lab": "^5.15.0",
|
|
38
38
|
"@atlaskit/image": "^3.0.0",
|
|
39
39
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
40
|
+
"@atlaskit/platform-feature-flags-react": "^0.4.0",
|
|
40
41
|
"@atlaskit/primitives": "^17.1.0",
|
|
41
42
|
"@atlaskit/renderer": "^126.2.0",
|
|
42
43
|
"@atlaskit/spinner": "^19.0.0",
|
|
43
44
|
"@atlaskit/tokens": "^10.1.0",
|
|
44
45
|
"@atlaskit/tooltip": "^20.14.0",
|
|
45
46
|
"@babel/runtime": "^7.0.0",
|
|
47
|
+
"@compiled/react": "^0.18.6",
|
|
46
48
|
"react-relay": "npm:atl-react-relay@0.0.0-main-39e79f66",
|
|
47
49
|
"relay-runtime": "npm:atl-relay-runtime@0.0.0-main-39e79f66"
|
|
48
50
|
},
|