@atlaskit/editor-synced-block-renderer 3.2.0 → 3.3.0
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/afm-cc/tsconfig.json +3 -0
- package/dist/cjs/ui/SyncedBlockErrorComponent.js +25 -16
- package/dist/cjs/ui/SyncedBlockErrorStateCard.js +41 -0
- package/dist/cjs/ui/SyncedBlockGenericError.js +20 -0
- package/dist/cjs/ui/SyncedBlockLoadError.js +34 -0
- package/dist/cjs/ui/SyncedBlockLoadingState.compiled.css +6 -0
- package/dist/cjs/ui/SyncedBlockLoadingState.js +14 -1
- package/dist/cjs/ui/SyncedBlockNodeComponentRenderer.js +4 -1
- package/dist/cjs/ui/SyncedBlockPermissionDenied.js +8 -26
- package/dist/cjs/ui/SyncedBlockRenderer.js +6 -2
- package/dist/es2019/ui/SyncedBlockErrorComponent.js +24 -16
- package/dist/es2019/ui/SyncedBlockErrorStateCard.js +35 -0
- package/dist/es2019/ui/SyncedBlockGenericError.js +14 -0
- package/dist/es2019/ui/SyncedBlockLoadError.js +29 -0
- package/dist/es2019/ui/SyncedBlockLoadingState.compiled.css +6 -0
- package/dist/es2019/ui/SyncedBlockLoadingState.js +14 -1
- package/dist/es2019/ui/SyncedBlockNodeComponentRenderer.js +4 -1
- package/dist/es2019/ui/SyncedBlockPermissionDenied.js +9 -27
- package/dist/es2019/ui/SyncedBlockRenderer.js +6 -2
- package/dist/esm/ui/SyncedBlockErrorComponent.js +23 -15
- package/dist/esm/ui/SyncedBlockErrorStateCard.js +34 -0
- package/dist/esm/ui/SyncedBlockGenericError.js +13 -0
- package/dist/esm/ui/SyncedBlockLoadError.js +27 -0
- package/dist/esm/ui/SyncedBlockLoadingState.compiled.css +6 -0
- package/dist/esm/ui/SyncedBlockLoadingState.js +14 -1
- package/dist/esm/ui/SyncedBlockNodeComponentRenderer.js +4 -1
- package/dist/esm/ui/SyncedBlockPermissionDenied.js +9 -27
- package/dist/esm/ui/SyncedBlockRenderer.js +6 -2
- package/dist/types/ui/SyncedBlockErrorComponent.d.ts +3 -1
- package/dist/types/ui/SyncedBlockErrorStateCard.d.ts +10 -0
- package/dist/types/ui/SyncedBlockGenericError.d.ts +2 -0
- package/dist/types/ui/SyncedBlockLoadError.d.ts +8 -0
- package/dist/types-ts4.5/ui/SyncedBlockErrorComponent.d.ts +3 -1
- package/dist/types-ts4.5/ui/SyncedBlockErrorStateCard.d.ts +10 -0
- package/dist/types-ts4.5/ui/SyncedBlockGenericError.d.ts +2 -0
- package/dist/types-ts4.5/ui/SyncedBlockLoadError.d.ts +8 -0
- package/package.json +4 -3
- /package/dist/cjs/ui/{SyncedBlockPermissionDenied.compiled.css → SyncedBlockErrorStateCard.compiled.css} +0 -0
- /package/dist/es2019/ui/{SyncedBlockPermissionDenied.compiled.css → SyncedBlockErrorStateCard.compiled.css} +0 -0
- /package/dist/esm/ui/{SyncedBlockPermissionDenied.compiled.css → SyncedBlockErrorStateCard.compiled.css} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/editor-synced-block-renderer
|
|
2
2
|
|
|
3
|
+
## 3.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`721d3790d48fe`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/721d3790d48fe) -
|
|
8
|
+
EDITOR-2533 implement error-ui with retry
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 3.2.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -1,42 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.SyncedBlockErrorComponent = void 0;
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _syncBlock = require("@atlaskit/editor-common/sync-block");
|
|
10
10
|
var _editorSyncedBlockProvider = require("@atlaskit/editor-synced-block-provider");
|
|
11
|
+
var _SyncedBlockGenericError = require("./SyncedBlockGenericError");
|
|
12
|
+
var _SyncedBlockLoadError = require("./SyncedBlockLoadError");
|
|
11
13
|
var _SyncedBlockPermissionDenied = require("./SyncedBlockPermissionDenied");
|
|
14
|
+
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); }
|
|
12
15
|
var SyncedBlockErrorComponent = exports.SyncedBlockErrorComponent = function SyncedBlockErrorComponent(_ref) {
|
|
13
16
|
var error = _ref.error,
|
|
17
|
+
isLoading = _ref.isLoading,
|
|
18
|
+
onRetry = _ref.onRetry,
|
|
14
19
|
resourceId = _ref.resourceId;
|
|
15
|
-
var getErrorContent = function
|
|
20
|
+
var getErrorContent = (0, _react.useMemo)(function () {
|
|
16
21
|
switch (error) {
|
|
17
22
|
case _editorSyncedBlockProvider.SyncBlockError.Forbidden:
|
|
18
|
-
if (resourceId) {
|
|
19
|
-
|
|
20
|
-
contentId = _getPageIdAndTypeFrom.id;
|
|
21
|
-
if (contentId) {
|
|
22
|
-
return /*#__PURE__*/_react.default.createElement(_SyncedBlockPermissionDenied.SyncedBlockPermissionDenied, {
|
|
23
|
-
contentId: contentId
|
|
24
|
-
});
|
|
25
|
-
}
|
|
23
|
+
if (!resourceId) {
|
|
24
|
+
return /*#__PURE__*/_react.default.createElement(_SyncedBlockGenericError.SyncedBlockGenericError, null);
|
|
26
25
|
}
|
|
27
|
-
|
|
26
|
+
var _getPageIdAndTypeFrom = (0, _editorSyncedBlockProvider.getPageIdAndTypeFromAri)(resourceId),
|
|
27
|
+
contentId = _getPageIdAndTypeFrom.id;
|
|
28
|
+
if (contentId) {
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement(_SyncedBlockPermissionDenied.SyncedBlockPermissionDenied, {
|
|
30
|
+
contentId: contentId
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return /*#__PURE__*/_react.default.createElement(_SyncedBlockGenericError.SyncedBlockGenericError, null);
|
|
28
34
|
case _editorSyncedBlockProvider.SyncBlockError.NotFound:
|
|
29
|
-
return /*#__PURE__*/_react.default.createElement("div", null, "Sync Block Not Found");
|
|
30
35
|
case _editorSyncedBlockProvider.SyncBlockError.Errored:
|
|
36
|
+
return /*#__PURE__*/_react.default.createElement(_SyncedBlockLoadError.SyncedBlockLoadError, {
|
|
37
|
+
onRetry: onRetry,
|
|
38
|
+
isLoading: isLoading
|
|
39
|
+
});
|
|
31
40
|
default:
|
|
32
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
41
|
+
return /*#__PURE__*/_react.default.createElement(_SyncedBlockGenericError.SyncedBlockGenericError, null);
|
|
33
42
|
}
|
|
34
|
-
};
|
|
43
|
+
}, [error, isLoading, onRetry, resourceId]);
|
|
35
44
|
return (
|
|
36
45
|
/*#__PURE__*/
|
|
37
46
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
38
47
|
_react.default.createElement("div", {
|
|
39
48
|
className: _syncBlock.SyncBlockSharedCssClassName.error
|
|
40
|
-
}, getErrorContent
|
|
49
|
+
}, getErrorContent)
|
|
41
50
|
);
|
|
42
51
|
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* SyncedBlockErrorStateCard.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.SyncedBlockErrorStateCard = void 0;
|
|
9
|
+
require("./SyncedBlockErrorStateCard.compiled.css");
|
|
10
|
+
var _runtime = require("@compiled/react/runtime");
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _heading = _interopRequireDefault(require("@atlaskit/heading"));
|
|
13
|
+
var _image = _interopRequireDefault(require("@atlaskit/image"));
|
|
14
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
15
|
+
var styles = {
|
|
16
|
+
wrapper: "_2rko12b0 _zulpu2gc _ca0qv47k _n3tdv47k _19bvxy5q _u5f3v47k _bfhkby5v _1e0c1txw _1bahv2br _4cvr1h6o",
|
|
17
|
+
textWrapper: "_18u0u2gc"
|
|
18
|
+
};
|
|
19
|
+
var SyncedBlockErrorStateCard = exports.SyncedBlockErrorStateCard = function SyncedBlockErrorStateCard(_ref) {
|
|
20
|
+
var children = _ref.children,
|
|
21
|
+
imageAltText = _ref.imageAltText,
|
|
22
|
+
imageSrc = _ref.imageSrc,
|
|
23
|
+
primaryMessage = _ref.primaryMessage,
|
|
24
|
+
secondaryMessage = _ref.secondaryMessage;
|
|
25
|
+
return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
26
|
+
xcss: styles.wrapper
|
|
27
|
+
}, /*#__PURE__*/_react.default.createElement(_image.default, {
|
|
28
|
+
src: imageSrc,
|
|
29
|
+
alt: imageAltText,
|
|
30
|
+
width: "48",
|
|
31
|
+
height: "48"
|
|
32
|
+
}), /*#__PURE__*/_react.default.createElement(_compiled.Stack, {
|
|
33
|
+
space: "space.100",
|
|
34
|
+
alignInline: "start",
|
|
35
|
+
xcss: styles.textWrapper
|
|
36
|
+
}, primaryMessage && /*#__PURE__*/_react.default.createElement(_heading.default, {
|
|
37
|
+
size: "xsmall"
|
|
38
|
+
}, primaryMessage), secondaryMessage && /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
39
|
+
color: "color.text.subtle"
|
|
40
|
+
}, secondaryMessage), children));
|
|
41
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.SyncedBlockGenericError = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _reactIntlNext = require("react-intl-next");
|
|
10
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
11
|
+
var _ExclamationWarning = _interopRequireDefault(require("./assets/ExclamationWarning.svg"));
|
|
12
|
+
var _SyncedBlockErrorStateCard = require("./SyncedBlockErrorStateCard");
|
|
13
|
+
var SyncedBlockGenericError = exports.SyncedBlockGenericError = function SyncedBlockGenericError() {
|
|
14
|
+
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
15
|
+
formatMessage = _useIntl.formatMessage;
|
|
16
|
+
return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorStateCard.SyncedBlockErrorStateCard, {
|
|
17
|
+
imageSrc: _ExclamationWarning.default,
|
|
18
|
+
secondaryMessage: formatMessage(_messages.syncBlockMessages.generalErrorDescription)
|
|
19
|
+
});
|
|
20
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.SyncedBlockLoadError = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _reactIntlNext = require("react-intl-next");
|
|
10
|
+
var _new = _interopRequireDefault(require("@atlaskit/button/new"));
|
|
11
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
12
|
+
var _ExclamationWarning = _interopRequireDefault(require("./assets/ExclamationWarning.svg"));
|
|
13
|
+
var _SyncedBlockErrorStateCard = require("./SyncedBlockErrorStateCard");
|
|
14
|
+
var SyncedBlockLoadError = exports.SyncedBlockLoadError = function SyncedBlockLoadError(_ref) {
|
|
15
|
+
var onRetry = _ref.onRetry,
|
|
16
|
+
isLoading = _ref.isLoading;
|
|
17
|
+
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
18
|
+
formatMessage = _useIntl.formatMessage;
|
|
19
|
+
return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorStateCard.SyncedBlockErrorStateCard, {
|
|
20
|
+
imageSrc: _ExclamationWarning.default,
|
|
21
|
+
imageAltText: formatMessage(_messages.syncBlockMessages.notFoundAltText),
|
|
22
|
+
secondaryMessage: formatMessage(_messages.syncBlockMessages.notFoundDescription)
|
|
23
|
+
}, onRetry && /*#__PURE__*/_react.default.createElement(_new.default, {
|
|
24
|
+
appearance: "default",
|
|
25
|
+
spacing: "compact",
|
|
26
|
+
onClick: function onClick(event) {
|
|
27
|
+
event.preventDefault();
|
|
28
|
+
event.stopPropagation();
|
|
29
|
+
onRetry();
|
|
30
|
+
},
|
|
31
|
+
isLoading: isLoading,
|
|
32
|
+
testId: "sync-block-retry-btn"
|
|
33
|
+
}, formatMessage(_messages.syncBlockMessages.retryButton)));
|
|
34
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* SyncedBlockLoadingState.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,7 +6,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.SyncedBlockLoadingState = void 0;
|
|
9
|
+
require("./SyncedBlockLoadingState.compiled.css");
|
|
10
|
+
var _runtime = require("@compiled/react/runtime");
|
|
8
11
|
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
13
|
+
var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
|
|
14
|
+
var styles = {
|
|
15
|
+
wrapper: "_19itia51 _2rko12b0 _1tkevbgk _1e0c1txw _1bah1h6o _4cvr1h6o"
|
|
16
|
+
};
|
|
9
17
|
var SyncedBlockLoadingState = exports.SyncedBlockLoadingState = function SyncedBlockLoadingState() {
|
|
10
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
18
|
+
return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
19
|
+
xcss: styles.wrapper
|
|
20
|
+
}, /*#__PURE__*/_react.default.createElement(_spinner.default, {
|
|
21
|
+
size: "small",
|
|
22
|
+
label: "Loading synced content"
|
|
23
|
+
}));
|
|
11
24
|
};
|
|
@@ -19,6 +19,7 @@ var SyncedBlockNodeComponentRenderer = exports.SyncedBlockNodeComponentRenderer
|
|
|
19
19
|
var _useFetchSyncBlockDat = (0, _editorSyncedBlockProvider.useFetchSyncBlockData)(syncBlockStoreManager, resourceId, localId),
|
|
20
20
|
syncBlockInstance = _useFetchSyncBlockDat.syncBlockInstance,
|
|
21
21
|
isLoading = _useFetchSyncBlockDat.isLoading,
|
|
22
|
+
reloadData = _useFetchSyncBlockDat.reloadData,
|
|
22
23
|
providerFactory = _useFetchSyncBlockDat.providerFactory;
|
|
23
24
|
if (isLoading && !syncBlockInstance) {
|
|
24
25
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockLoadingState.SyncedBlockLoadingState, null);
|
|
@@ -27,7 +28,9 @@ var SyncedBlockNodeComponentRenderer = exports.SyncedBlockNodeComponentRenderer
|
|
|
27
28
|
var _syncBlockInstance$er;
|
|
28
29
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
|
|
29
30
|
error: (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : _editorSyncedBlockProvider.SyncBlockError.Errored,
|
|
30
|
-
resourceId: resourceId
|
|
31
|
+
resourceId: resourceId,
|
|
32
|
+
onRetry: reloadData,
|
|
33
|
+
isLoading: isLoading
|
|
31
34
|
});
|
|
32
35
|
}
|
|
33
36
|
var syncBlockDoc = {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* SyncedBlockPermissionDenied.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
1
|
"use strict";
|
|
3
2
|
|
|
4
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -7,8 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
6
|
value: true
|
|
8
7
|
});
|
|
9
8
|
exports.SyncedBlockPermissionDenied = void 0;
|
|
10
|
-
require("./SyncedBlockPermissionDenied.compiled.css");
|
|
11
|
-
var _runtime = require("@compiled/react/runtime");
|
|
12
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
10
|
var _SyncedBlockPermissionDeniedRequestAccessMutation2 = _interopRequireDefault(require("./__generated__/SyncedBlockPermissionDeniedRequestAccessMutation.graphql"));
|
|
14
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -16,16 +13,11 @@ var _reactIntlNext = require("react-intl-next");
|
|
|
16
13
|
var _reactRelay = require("react-relay");
|
|
17
14
|
var _new = _interopRequireDefault(require("@atlaskit/button/new"));
|
|
18
15
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
19
|
-
var _heading = _interopRequireDefault(require("@atlaskit/heading"));
|
|
20
16
|
var _statusSuccess = _interopRequireDefault(require("@atlaskit/icon/core/status-success"));
|
|
21
|
-
var _image = _interopRequireDefault(require("@atlaskit/image"));
|
|
22
17
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
23
18
|
var _PermissionDenied = _interopRequireDefault(require("./assets/PermissionDenied.svg"));
|
|
19
|
+
var _SyncedBlockErrorStateCard = require("./SyncedBlockErrorStateCard");
|
|
24
20
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
25
|
-
var styles = {
|
|
26
|
-
wrapper: "_2rko12b0 _zulpu2gc _ca0qv47k _n3tdv47k _19bvxy5q _u5f3v47k _bfhkby5v _1e0c1txw _1bahv2br _4cvr1h6o",
|
|
27
|
-
textWrapper: "_18u0u2gc"
|
|
28
|
-
};
|
|
29
21
|
var RequestAccessState = /*#__PURE__*/function (RequestAccessState) {
|
|
30
22
|
RequestAccessState["default"] = "default";
|
|
31
23
|
RequestAccessState["errored"] = "errored";
|
|
@@ -65,22 +57,12 @@ var SyncedBlockPermissionDenied = exports.SyncedBlockPermissionDenied = function
|
|
|
65
57
|
onError: handleRequestError
|
|
66
58
|
});
|
|
67
59
|
};
|
|
68
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
height: "48"
|
|
75
|
-
}), /*#__PURE__*/_react.default.createElement(_compiled.Stack, {
|
|
76
|
-
space: "space.100",
|
|
77
|
-
alignInline: "start",
|
|
78
|
-
xcss: styles.textWrapper
|
|
79
|
-
}, /*#__PURE__*/_react.default.createElement(_heading.default, {
|
|
80
|
-
size: "xsmall"
|
|
81
|
-
}, formatMessage(_messages.syncBlockMessages.permissionDeniedHeading)), /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
82
|
-
color: "color.text.subtle"
|
|
83
|
-
}, formatMessage(_messages.syncBlockMessages.permissionDeniedDescription)), requestAccessState === RequestAccessState.pending ? /*#__PURE__*/_react.default.createElement(_compiled.Flex, {
|
|
60
|
+
return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorStateCard.SyncedBlockErrorStateCard, {
|
|
61
|
+
imageSrc: _PermissionDenied.default,
|
|
62
|
+
imageAltText: formatMessage(_messages.syncBlockMessages.permissionDeniedAltText),
|
|
63
|
+
primaryMessage: formatMessage(_messages.syncBlockMessages.permissionDeniedHeading),
|
|
64
|
+
secondaryMessage: formatMessage(_messages.syncBlockMessages.permissionDeniedDescription)
|
|
65
|
+
}, requestAccessState === RequestAccessState.pending ? /*#__PURE__*/_react.default.createElement(_compiled.Flex, {
|
|
84
66
|
columnGap: "space.050",
|
|
85
67
|
alignItems: "center"
|
|
86
68
|
}, /*#__PURE__*/_react.default.createElement(_statusSuccess.default, {
|
|
@@ -103,5 +85,5 @@ var SyncedBlockPermissionDenied = exports.SyncedBlockPermissionDenied = function
|
|
|
103
85
|
}, formatMessage(_messages.syncBlockMessages.requestAccessButton)), requestAccessState === RequestAccessState.errored && /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
104
86
|
color: "color.text.warning",
|
|
105
87
|
testId: "sync-block-access-error-msg"
|
|
106
|
-
}, formatMessage(_messages.syncBlockMessages.requestAccessError))))
|
|
88
|
+
}, formatMessage(_messages.syncBlockMessages.requestAccessError))));
|
|
107
89
|
};
|
|
@@ -16,7 +16,9 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
|
|
|
16
16
|
syncBlockRendererOptions = _ref.syncBlockRendererOptions;
|
|
17
17
|
var _useFetchSyncBlockDat = useFetchSyncBlockData(),
|
|
18
18
|
syncBlockInstance = _useFetchSyncBlockDat.syncBlockInstance,
|
|
19
|
-
providerFactory = _useFetchSyncBlockDat.providerFactory
|
|
19
|
+
providerFactory = _useFetchSyncBlockDat.providerFactory,
|
|
20
|
+
isLoading = _useFetchSyncBlockDat.isLoading,
|
|
21
|
+
reloadData = _useFetchSyncBlockDat.reloadData;
|
|
20
22
|
if (!syncBlockInstance) {
|
|
21
23
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockLoadingState.SyncedBlockLoadingState, null);
|
|
22
24
|
}
|
|
@@ -24,7 +26,9 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
|
|
|
24
26
|
var _syncBlockInstance$er;
|
|
25
27
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
|
|
26
28
|
error: (_syncBlockInstance$er = syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : _editorSyncedBlockProvider.SyncBlockError.Errored,
|
|
27
|
-
resourceId: syncBlockInstance.resourceId
|
|
29
|
+
resourceId: syncBlockInstance.resourceId,
|
|
30
|
+
onRetry: reloadData,
|
|
31
|
+
isLoading: isLoading
|
|
28
32
|
});
|
|
29
33
|
}
|
|
30
34
|
var syncBlockDoc = {
|
|
@@ -1,37 +1,45 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
2
|
import { SyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
|
|
3
3
|
import { getPageIdAndTypeFromAri, SyncBlockError } from '@atlaskit/editor-synced-block-provider';
|
|
4
|
+
import { SyncedBlockGenericError } from './SyncedBlockGenericError';
|
|
5
|
+
import { SyncedBlockLoadError } from './SyncedBlockLoadError';
|
|
4
6
|
import { SyncedBlockPermissionDenied } from './SyncedBlockPermissionDenied';
|
|
5
7
|
export const SyncedBlockErrorComponent = ({
|
|
6
8
|
error,
|
|
9
|
+
isLoading,
|
|
10
|
+
onRetry,
|
|
7
11
|
resourceId
|
|
8
12
|
}) => {
|
|
9
|
-
const getErrorContent = () => {
|
|
13
|
+
const getErrorContent = useMemo(() => {
|
|
10
14
|
switch (error) {
|
|
11
15
|
case SyncBlockError.Forbidden:
|
|
12
|
-
if (resourceId) {
|
|
13
|
-
|
|
14
|
-
id: contentId
|
|
15
|
-
} = getPageIdAndTypeFromAri(resourceId);
|
|
16
|
-
if (contentId) {
|
|
17
|
-
return /*#__PURE__*/React.createElement(SyncedBlockPermissionDenied, {
|
|
18
|
-
contentId: contentId
|
|
19
|
-
});
|
|
20
|
-
}
|
|
16
|
+
if (!resourceId) {
|
|
17
|
+
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
21
18
|
}
|
|
22
|
-
|
|
19
|
+
const {
|
|
20
|
+
id: contentId
|
|
21
|
+
} = getPageIdAndTypeFromAri(resourceId);
|
|
22
|
+
if (contentId) {
|
|
23
|
+
return /*#__PURE__*/React.createElement(SyncedBlockPermissionDenied, {
|
|
24
|
+
contentId: contentId
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
23
28
|
case SyncBlockError.NotFound:
|
|
24
|
-
return /*#__PURE__*/React.createElement("div", null, "Sync Block Not Found");
|
|
25
29
|
case SyncBlockError.Errored:
|
|
30
|
+
return /*#__PURE__*/React.createElement(SyncedBlockLoadError, {
|
|
31
|
+
onRetry: onRetry,
|
|
32
|
+
isLoading: isLoading
|
|
33
|
+
});
|
|
26
34
|
default:
|
|
27
|
-
return /*#__PURE__*/React.createElement(
|
|
35
|
+
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
28
36
|
}
|
|
29
|
-
};
|
|
37
|
+
}, [error, isLoading, onRetry, resourceId]);
|
|
30
38
|
return (
|
|
31
39
|
/*#__PURE__*/
|
|
32
40
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
33
41
|
React.createElement("div", {
|
|
34
42
|
className: SyncBlockSharedCssClassName.error
|
|
35
|
-
}, getErrorContent
|
|
43
|
+
}, getErrorContent)
|
|
36
44
|
);
|
|
37
45
|
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/* SyncedBlockErrorStateCard.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
+
import "./SyncedBlockErrorStateCard.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import Heading from '@atlaskit/heading';
|
|
6
|
+
import Image from '@atlaskit/image';
|
|
7
|
+
import { Box, Stack, Text } from '@atlaskit/primitives/compiled';
|
|
8
|
+
const styles = {
|
|
9
|
+
wrapper: "_2rko12b0 _zulpu2gc _ca0qv47k _n3tdv47k _19bvxy5q _u5f3v47k _bfhkby5v _1e0c1txw _1bahv2br _4cvr1h6o",
|
|
10
|
+
textWrapper: "_18u0u2gc"
|
|
11
|
+
};
|
|
12
|
+
export const SyncedBlockErrorStateCard = ({
|
|
13
|
+
children,
|
|
14
|
+
imageAltText,
|
|
15
|
+
imageSrc,
|
|
16
|
+
primaryMessage,
|
|
17
|
+
secondaryMessage
|
|
18
|
+
}) => {
|
|
19
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
20
|
+
xcss: styles.wrapper
|
|
21
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
22
|
+
src: imageSrc,
|
|
23
|
+
alt: imageAltText,
|
|
24
|
+
width: "48",
|
|
25
|
+
height: "48"
|
|
26
|
+
}), /*#__PURE__*/React.createElement(Stack, {
|
|
27
|
+
space: "space.100",
|
|
28
|
+
alignInline: "start",
|
|
29
|
+
xcss: styles.textWrapper
|
|
30
|
+
}, primaryMessage && /*#__PURE__*/React.createElement(Heading, {
|
|
31
|
+
size: "xsmall"
|
|
32
|
+
}, primaryMessage), secondaryMessage && /*#__PURE__*/React.createElement(Text, {
|
|
33
|
+
color: "color.text.subtle"
|
|
34
|
+
}, secondaryMessage), children));
|
|
35
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl-next';
|
|
3
|
+
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import ExclamationWarning from './assets/ExclamationWarning.svg';
|
|
5
|
+
import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
|
|
6
|
+
export const SyncedBlockGenericError = () => {
|
|
7
|
+
const {
|
|
8
|
+
formatMessage
|
|
9
|
+
} = useIntl();
|
|
10
|
+
return /*#__PURE__*/React.createElement(SyncedBlockErrorStateCard, {
|
|
11
|
+
imageSrc: ExclamationWarning,
|
|
12
|
+
secondaryMessage: formatMessage(messages.generalErrorDescription)
|
|
13
|
+
});
|
|
14
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl-next';
|
|
3
|
+
import Button from '@atlaskit/button/new';
|
|
4
|
+
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
|
+
import ExclamationWarning from './assets/ExclamationWarning.svg';
|
|
6
|
+
import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
|
|
7
|
+
export const SyncedBlockLoadError = ({
|
|
8
|
+
onRetry,
|
|
9
|
+
isLoading
|
|
10
|
+
}) => {
|
|
11
|
+
const {
|
|
12
|
+
formatMessage
|
|
13
|
+
} = useIntl();
|
|
14
|
+
return /*#__PURE__*/React.createElement(SyncedBlockErrorStateCard, {
|
|
15
|
+
imageSrc: ExclamationWarning,
|
|
16
|
+
imageAltText: formatMessage(messages.notFoundAltText),
|
|
17
|
+
secondaryMessage: formatMessage(messages.notFoundDescription)
|
|
18
|
+
}, onRetry && /*#__PURE__*/React.createElement(Button, {
|
|
19
|
+
appearance: "default",
|
|
20
|
+
spacing: "compact",
|
|
21
|
+
onClick: event => {
|
|
22
|
+
event.preventDefault();
|
|
23
|
+
event.stopPropagation();
|
|
24
|
+
onRetry();
|
|
25
|
+
},
|
|
26
|
+
isLoading: isLoading,
|
|
27
|
+
testId: "sync-block-retry-btn"
|
|
28
|
+
}, formatMessage(messages.retryButton)));
|
|
29
|
+
};
|
|
@@ -1,4 +1,17 @@
|
|
|
1
|
+
/* SyncedBlockLoadingState.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
+
import "./SyncedBlockLoadingState.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
1
4
|
import React from 'react';
|
|
5
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
6
|
+
import Spinner from '@atlaskit/spinner';
|
|
7
|
+
const styles = {
|
|
8
|
+
wrapper: "_19itia51 _2rko12b0 _1tkevbgk _1e0c1txw _1bah1h6o _4cvr1h6o"
|
|
9
|
+
};
|
|
2
10
|
export const SyncedBlockLoadingState = () => {
|
|
3
|
-
return /*#__PURE__*/React.createElement(
|
|
11
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
12
|
+
xcss: styles.wrapper
|
|
13
|
+
}, /*#__PURE__*/React.createElement(Spinner, {
|
|
14
|
+
size: "small",
|
|
15
|
+
label: "Loading synced content"
|
|
16
|
+
}));
|
|
4
17
|
};
|
|
@@ -15,6 +15,7 @@ export const SyncedBlockNodeComponentRenderer = ({
|
|
|
15
15
|
const {
|
|
16
16
|
syncBlockInstance,
|
|
17
17
|
isLoading,
|
|
18
|
+
reloadData,
|
|
18
19
|
providerFactory
|
|
19
20
|
} = useFetchSyncBlockData(syncBlockStoreManager, resourceId, localId);
|
|
20
21
|
if (isLoading && !syncBlockInstance) {
|
|
@@ -24,7 +25,9 @@ export const SyncedBlockNodeComponentRenderer = ({
|
|
|
24
25
|
var _syncBlockInstance$er;
|
|
25
26
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
26
27
|
error: (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : SyncBlockError.Errored,
|
|
27
|
-
resourceId: resourceId
|
|
28
|
+
resourceId: resourceId,
|
|
29
|
+
onRetry: reloadData,
|
|
30
|
+
isLoading: isLoading
|
|
28
31
|
});
|
|
29
32
|
}
|
|
30
33
|
const syncBlockDoc = {
|
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
/* SyncedBlockPermissionDenied.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
-
import "./SyncedBlockPermissionDenied.compiled.css";
|
|
3
|
-
import { ax, ix } from "@compiled/react/runtime";
|
|
4
1
|
import _SyncedBlockPermissionDeniedRequestAccessMutation from "./__generated__/SyncedBlockPermissionDeniedRequestAccessMutation.graphql";
|
|
5
2
|
import React, { useState } from 'react';
|
|
6
3
|
import { useIntl } from 'react-intl-next';
|
|
7
4
|
import { useMutation, graphql } from 'react-relay';
|
|
8
5
|
import Button from '@atlaskit/button/new';
|
|
9
6
|
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
10
|
-
import Heading from '@atlaskit/heading';
|
|
11
7
|
import StatusSuccessIcon from '@atlaskit/icon/core/status-success';
|
|
12
|
-
import
|
|
13
|
-
import { Box, Text, Stack, Flex } from '@atlaskit/primitives/compiled';
|
|
8
|
+
import { Text, Flex } from '@atlaskit/primitives/compiled';
|
|
14
9
|
import PermissionDenied from './assets/PermissionDenied.svg';
|
|
15
|
-
|
|
16
|
-
wrapper: "_2rko12b0 _zulpu2gc _ca0qv47k _n3tdv47k _19bvxy5q _u5f3v47k _bfhkby5v _1e0c1txw _1bahv2br _4cvr1h6o",
|
|
17
|
-
textWrapper: "_18u0u2gc"
|
|
18
|
-
};
|
|
10
|
+
import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
|
|
19
11
|
var RequestAccessState = /*#__PURE__*/function (RequestAccessState) {
|
|
20
12
|
RequestAccessState["default"] = "default";
|
|
21
13
|
RequestAccessState["errored"] = "errored";
|
|
@@ -52,22 +44,12 @@ export const SyncedBlockPermissionDenied = ({
|
|
|
52
44
|
onError: handleRequestError
|
|
53
45
|
});
|
|
54
46
|
};
|
|
55
|
-
return /*#__PURE__*/React.createElement(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
height: "48"
|
|
62
|
-
}), /*#__PURE__*/React.createElement(Stack, {
|
|
63
|
-
space: "space.100",
|
|
64
|
-
alignInline: "start",
|
|
65
|
-
xcss: styles.textWrapper
|
|
66
|
-
}, /*#__PURE__*/React.createElement(Heading, {
|
|
67
|
-
size: "xsmall"
|
|
68
|
-
}, formatMessage(messages.permissionDeniedHeading)), /*#__PURE__*/React.createElement(Text, {
|
|
69
|
-
color: "color.text.subtle"
|
|
70
|
-
}, formatMessage(messages.permissionDeniedDescription)), requestAccessState === RequestAccessState.pending ? /*#__PURE__*/React.createElement(Flex, {
|
|
47
|
+
return /*#__PURE__*/React.createElement(SyncedBlockErrorStateCard, {
|
|
48
|
+
imageSrc: PermissionDenied,
|
|
49
|
+
imageAltText: formatMessage(messages.permissionDeniedAltText),
|
|
50
|
+
primaryMessage: formatMessage(messages.permissionDeniedHeading),
|
|
51
|
+
secondaryMessage: formatMessage(messages.permissionDeniedDescription)
|
|
52
|
+
}, requestAccessState === RequestAccessState.pending ? /*#__PURE__*/React.createElement(Flex, {
|
|
71
53
|
columnGap: "space.050",
|
|
72
54
|
alignItems: "center"
|
|
73
55
|
}, /*#__PURE__*/React.createElement(StatusSuccessIcon, {
|
|
@@ -90,5 +72,5 @@ export const SyncedBlockPermissionDenied = ({
|
|
|
90
72
|
}, formatMessage(messages.requestAccessButton)), requestAccessState === RequestAccessState.errored && /*#__PURE__*/React.createElement(Text, {
|
|
91
73
|
color: "color.text.warning",
|
|
92
74
|
testId: "sync-block-access-error-msg"
|
|
93
|
-
}, formatMessage(messages.requestAccessError))))
|
|
75
|
+
}, formatMessage(messages.requestAccessError))));
|
|
94
76
|
};
|
|
@@ -9,7 +9,9 @@ const SyncedBlockRendererComponent = ({
|
|
|
9
9
|
}) => {
|
|
10
10
|
const {
|
|
11
11
|
syncBlockInstance,
|
|
12
|
-
providerFactory
|
|
12
|
+
providerFactory,
|
|
13
|
+
isLoading,
|
|
14
|
+
reloadData
|
|
13
15
|
} = useFetchSyncBlockData();
|
|
14
16
|
if (!syncBlockInstance) {
|
|
15
17
|
return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
|
|
@@ -18,7 +20,9 @@ const SyncedBlockRendererComponent = ({
|
|
|
18
20
|
var _syncBlockInstance$er;
|
|
19
21
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
20
22
|
error: (_syncBlockInstance$er = syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : SyncBlockError.Errored,
|
|
21
|
-
resourceId: syncBlockInstance.resourceId
|
|
23
|
+
resourceId: syncBlockInstance.resourceId,
|
|
24
|
+
onRetry: reloadData,
|
|
25
|
+
isLoading: isLoading
|
|
22
26
|
});
|
|
23
27
|
}
|
|
24
28
|
const syncBlockDoc = {
|
|
@@ -1,35 +1,43 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
2
|
import { SyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
|
|
3
3
|
import { getPageIdAndTypeFromAri, SyncBlockError } from '@atlaskit/editor-synced-block-provider';
|
|
4
|
+
import { SyncedBlockGenericError } from './SyncedBlockGenericError';
|
|
5
|
+
import { SyncedBlockLoadError } from './SyncedBlockLoadError';
|
|
4
6
|
import { SyncedBlockPermissionDenied } from './SyncedBlockPermissionDenied';
|
|
5
7
|
export var SyncedBlockErrorComponent = function SyncedBlockErrorComponent(_ref) {
|
|
6
8
|
var error = _ref.error,
|
|
9
|
+
isLoading = _ref.isLoading,
|
|
10
|
+
onRetry = _ref.onRetry,
|
|
7
11
|
resourceId = _ref.resourceId;
|
|
8
|
-
var getErrorContent = function
|
|
12
|
+
var getErrorContent = useMemo(function () {
|
|
9
13
|
switch (error) {
|
|
10
14
|
case SyncBlockError.Forbidden:
|
|
11
|
-
if (resourceId) {
|
|
12
|
-
|
|
13
|
-
contentId = _getPageIdAndTypeFrom.id;
|
|
14
|
-
if (contentId) {
|
|
15
|
-
return /*#__PURE__*/React.createElement(SyncedBlockPermissionDenied, {
|
|
16
|
-
contentId: contentId
|
|
17
|
-
});
|
|
18
|
-
}
|
|
15
|
+
if (!resourceId) {
|
|
16
|
+
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
19
17
|
}
|
|
20
|
-
|
|
18
|
+
var _getPageIdAndTypeFrom = getPageIdAndTypeFromAri(resourceId),
|
|
19
|
+
contentId = _getPageIdAndTypeFrom.id;
|
|
20
|
+
if (contentId) {
|
|
21
|
+
return /*#__PURE__*/React.createElement(SyncedBlockPermissionDenied, {
|
|
22
|
+
contentId: contentId
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
21
26
|
case SyncBlockError.NotFound:
|
|
22
|
-
return /*#__PURE__*/React.createElement("div", null, "Sync Block Not Found");
|
|
23
27
|
case SyncBlockError.Errored:
|
|
28
|
+
return /*#__PURE__*/React.createElement(SyncedBlockLoadError, {
|
|
29
|
+
onRetry: onRetry,
|
|
30
|
+
isLoading: isLoading
|
|
31
|
+
});
|
|
24
32
|
default:
|
|
25
|
-
return /*#__PURE__*/React.createElement(
|
|
33
|
+
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
26
34
|
}
|
|
27
|
-
};
|
|
35
|
+
}, [error, isLoading, onRetry, resourceId]);
|
|
28
36
|
return (
|
|
29
37
|
/*#__PURE__*/
|
|
30
38
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
31
39
|
React.createElement("div", {
|
|
32
40
|
className: SyncBlockSharedCssClassName.error
|
|
33
|
-
}, getErrorContent
|
|
41
|
+
}, getErrorContent)
|
|
34
42
|
);
|
|
35
43
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* SyncedBlockErrorStateCard.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
+
import "./SyncedBlockErrorStateCard.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import Heading from '@atlaskit/heading';
|
|
6
|
+
import Image from '@atlaskit/image';
|
|
7
|
+
import { Box, Stack, Text } from '@atlaskit/primitives/compiled';
|
|
8
|
+
var styles = {
|
|
9
|
+
wrapper: "_2rko12b0 _zulpu2gc _ca0qv47k _n3tdv47k _19bvxy5q _u5f3v47k _bfhkby5v _1e0c1txw _1bahv2br _4cvr1h6o",
|
|
10
|
+
textWrapper: "_18u0u2gc"
|
|
11
|
+
};
|
|
12
|
+
export var SyncedBlockErrorStateCard = function SyncedBlockErrorStateCard(_ref) {
|
|
13
|
+
var children = _ref.children,
|
|
14
|
+
imageAltText = _ref.imageAltText,
|
|
15
|
+
imageSrc = _ref.imageSrc,
|
|
16
|
+
primaryMessage = _ref.primaryMessage,
|
|
17
|
+
secondaryMessage = _ref.secondaryMessage;
|
|
18
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
19
|
+
xcss: styles.wrapper
|
|
20
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
21
|
+
src: imageSrc,
|
|
22
|
+
alt: imageAltText,
|
|
23
|
+
width: "48",
|
|
24
|
+
height: "48"
|
|
25
|
+
}), /*#__PURE__*/React.createElement(Stack, {
|
|
26
|
+
space: "space.100",
|
|
27
|
+
alignInline: "start",
|
|
28
|
+
xcss: styles.textWrapper
|
|
29
|
+
}, primaryMessage && /*#__PURE__*/React.createElement(Heading, {
|
|
30
|
+
size: "xsmall"
|
|
31
|
+
}, primaryMessage), secondaryMessage && /*#__PURE__*/React.createElement(Text, {
|
|
32
|
+
color: "color.text.subtle"
|
|
33
|
+
}, secondaryMessage), children));
|
|
34
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl-next';
|
|
3
|
+
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import ExclamationWarning from './assets/ExclamationWarning.svg';
|
|
5
|
+
import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
|
|
6
|
+
export var SyncedBlockGenericError = function SyncedBlockGenericError() {
|
|
7
|
+
var _useIntl = useIntl(),
|
|
8
|
+
formatMessage = _useIntl.formatMessage;
|
|
9
|
+
return /*#__PURE__*/React.createElement(SyncedBlockErrorStateCard, {
|
|
10
|
+
imageSrc: ExclamationWarning,
|
|
11
|
+
secondaryMessage: formatMessage(messages.generalErrorDescription)
|
|
12
|
+
});
|
|
13
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl-next';
|
|
3
|
+
import Button from '@atlaskit/button/new';
|
|
4
|
+
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
|
+
import ExclamationWarning from './assets/ExclamationWarning.svg';
|
|
6
|
+
import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
|
|
7
|
+
export var SyncedBlockLoadError = function SyncedBlockLoadError(_ref) {
|
|
8
|
+
var onRetry = _ref.onRetry,
|
|
9
|
+
isLoading = _ref.isLoading;
|
|
10
|
+
var _useIntl = useIntl(),
|
|
11
|
+
formatMessage = _useIntl.formatMessage;
|
|
12
|
+
return /*#__PURE__*/React.createElement(SyncedBlockErrorStateCard, {
|
|
13
|
+
imageSrc: ExclamationWarning,
|
|
14
|
+
imageAltText: formatMessage(messages.notFoundAltText),
|
|
15
|
+
secondaryMessage: formatMessage(messages.notFoundDescription)
|
|
16
|
+
}, onRetry && /*#__PURE__*/React.createElement(Button, {
|
|
17
|
+
appearance: "default",
|
|
18
|
+
spacing: "compact",
|
|
19
|
+
onClick: function onClick(event) {
|
|
20
|
+
event.preventDefault();
|
|
21
|
+
event.stopPropagation();
|
|
22
|
+
onRetry();
|
|
23
|
+
},
|
|
24
|
+
isLoading: isLoading,
|
|
25
|
+
testId: "sync-block-retry-btn"
|
|
26
|
+
}, formatMessage(messages.retryButton)));
|
|
27
|
+
};
|
|
@@ -1,4 +1,17 @@
|
|
|
1
|
+
/* SyncedBlockLoadingState.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
+
import "./SyncedBlockLoadingState.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
1
4
|
import React from 'react';
|
|
5
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
6
|
+
import Spinner from '@atlaskit/spinner';
|
|
7
|
+
var styles = {
|
|
8
|
+
wrapper: "_19itia51 _2rko12b0 _1tkevbgk _1e0c1txw _1bah1h6o _4cvr1h6o"
|
|
9
|
+
};
|
|
2
10
|
export var SyncedBlockLoadingState = function SyncedBlockLoadingState() {
|
|
3
|
-
return /*#__PURE__*/React.createElement(
|
|
11
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
12
|
+
xcss: styles.wrapper
|
|
13
|
+
}, /*#__PURE__*/React.createElement(Spinner, {
|
|
14
|
+
size: "small",
|
|
15
|
+
label: "Loading synced content"
|
|
16
|
+
}));
|
|
4
17
|
};
|
|
@@ -12,6 +12,7 @@ export var SyncedBlockNodeComponentRenderer = function SyncedBlockNodeComponentR
|
|
|
12
12
|
var _useFetchSyncBlockDat = useFetchSyncBlockData(syncBlockStoreManager, resourceId, localId),
|
|
13
13
|
syncBlockInstance = _useFetchSyncBlockDat.syncBlockInstance,
|
|
14
14
|
isLoading = _useFetchSyncBlockDat.isLoading,
|
|
15
|
+
reloadData = _useFetchSyncBlockDat.reloadData,
|
|
15
16
|
providerFactory = _useFetchSyncBlockDat.providerFactory;
|
|
16
17
|
if (isLoading && !syncBlockInstance) {
|
|
17
18
|
return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
|
|
@@ -20,7 +21,9 @@ export var SyncedBlockNodeComponentRenderer = function SyncedBlockNodeComponentR
|
|
|
20
21
|
var _syncBlockInstance$er;
|
|
21
22
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
22
23
|
error: (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : SyncBlockError.Errored,
|
|
23
|
-
resourceId: resourceId
|
|
24
|
+
resourceId: resourceId,
|
|
25
|
+
onRetry: reloadData,
|
|
26
|
+
isLoading: isLoading
|
|
24
27
|
});
|
|
25
28
|
}
|
|
26
29
|
var syncBlockDoc = {
|
|
@@ -1,22 +1,14 @@
|
|
|
1
|
-
/* SyncedBlockPermissionDenied.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
-
import "./SyncedBlockPermissionDenied.compiled.css";
|
|
4
|
-
import { ax, ix } from "@compiled/react/runtime";
|
|
5
2
|
import _SyncedBlockPermissionDeniedRequestAccessMutation from "./__generated__/SyncedBlockPermissionDeniedRequestAccessMutation.graphql";
|
|
6
3
|
import React, { useState } from 'react';
|
|
7
4
|
import { useIntl } from 'react-intl-next';
|
|
8
5
|
import { useMutation, graphql } from 'react-relay';
|
|
9
6
|
import Button from '@atlaskit/button/new';
|
|
10
7
|
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
11
|
-
import Heading from '@atlaskit/heading';
|
|
12
8
|
import StatusSuccessIcon from '@atlaskit/icon/core/status-success';
|
|
13
|
-
import
|
|
14
|
-
import { Box, Text, Stack, Flex } from '@atlaskit/primitives/compiled';
|
|
9
|
+
import { Text, Flex } from '@atlaskit/primitives/compiled';
|
|
15
10
|
import PermissionDenied from './assets/PermissionDenied.svg';
|
|
16
|
-
|
|
17
|
-
wrapper: "_2rko12b0 _zulpu2gc _ca0qv47k _n3tdv47k _19bvxy5q _u5f3v47k _bfhkby5v _1e0c1txw _1bahv2br _4cvr1h6o",
|
|
18
|
-
textWrapper: "_18u0u2gc"
|
|
19
|
-
};
|
|
11
|
+
import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
|
|
20
12
|
var RequestAccessState = /*#__PURE__*/function (RequestAccessState) {
|
|
21
13
|
RequestAccessState["default"] = "default";
|
|
22
14
|
RequestAccessState["errored"] = "errored";
|
|
@@ -56,22 +48,12 @@ export var SyncedBlockPermissionDenied = function SyncedBlockPermissionDenied(_r
|
|
|
56
48
|
onError: handleRequestError
|
|
57
49
|
});
|
|
58
50
|
};
|
|
59
|
-
return /*#__PURE__*/React.createElement(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
height: "48"
|
|
66
|
-
}), /*#__PURE__*/React.createElement(Stack, {
|
|
67
|
-
space: "space.100",
|
|
68
|
-
alignInline: "start",
|
|
69
|
-
xcss: styles.textWrapper
|
|
70
|
-
}, /*#__PURE__*/React.createElement(Heading, {
|
|
71
|
-
size: "xsmall"
|
|
72
|
-
}, formatMessage(messages.permissionDeniedHeading)), /*#__PURE__*/React.createElement(Text, {
|
|
73
|
-
color: "color.text.subtle"
|
|
74
|
-
}, formatMessage(messages.permissionDeniedDescription)), requestAccessState === RequestAccessState.pending ? /*#__PURE__*/React.createElement(Flex, {
|
|
51
|
+
return /*#__PURE__*/React.createElement(SyncedBlockErrorStateCard, {
|
|
52
|
+
imageSrc: PermissionDenied,
|
|
53
|
+
imageAltText: formatMessage(messages.permissionDeniedAltText),
|
|
54
|
+
primaryMessage: formatMessage(messages.permissionDeniedHeading),
|
|
55
|
+
secondaryMessage: formatMessage(messages.permissionDeniedDescription)
|
|
56
|
+
}, requestAccessState === RequestAccessState.pending ? /*#__PURE__*/React.createElement(Flex, {
|
|
75
57
|
columnGap: "space.050",
|
|
76
58
|
alignItems: "center"
|
|
77
59
|
}, /*#__PURE__*/React.createElement(StatusSuccessIcon, {
|
|
@@ -94,5 +76,5 @@ export var SyncedBlockPermissionDenied = function SyncedBlockPermissionDenied(_r
|
|
|
94
76
|
}, formatMessage(messages.requestAccessButton)), requestAccessState === RequestAccessState.errored && /*#__PURE__*/React.createElement(Text, {
|
|
95
77
|
color: "color.text.warning",
|
|
96
78
|
testId: "sync-block-access-error-msg"
|
|
97
|
-
}, formatMessage(messages.requestAccessError))))
|
|
79
|
+
}, formatMessage(messages.requestAccessError))));
|
|
98
80
|
};
|
|
@@ -8,7 +8,9 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
|
|
|
8
8
|
syncBlockRendererOptions = _ref.syncBlockRendererOptions;
|
|
9
9
|
var _useFetchSyncBlockDat = useFetchSyncBlockData(),
|
|
10
10
|
syncBlockInstance = _useFetchSyncBlockDat.syncBlockInstance,
|
|
11
|
-
providerFactory = _useFetchSyncBlockDat.providerFactory
|
|
11
|
+
providerFactory = _useFetchSyncBlockDat.providerFactory,
|
|
12
|
+
isLoading = _useFetchSyncBlockDat.isLoading,
|
|
13
|
+
reloadData = _useFetchSyncBlockDat.reloadData;
|
|
12
14
|
if (!syncBlockInstance) {
|
|
13
15
|
return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
|
|
14
16
|
}
|
|
@@ -16,7 +18,9 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
|
|
|
16
18
|
var _syncBlockInstance$er;
|
|
17
19
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
18
20
|
error: (_syncBlockInstance$er = syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : SyncBlockError.Errored,
|
|
19
|
-
resourceId: syncBlockInstance.resourceId
|
|
21
|
+
resourceId: syncBlockInstance.resourceId,
|
|
22
|
+
onRetry: reloadData,
|
|
23
|
+
isLoading: isLoading
|
|
20
24
|
});
|
|
21
25
|
}
|
|
22
26
|
var syncBlockDoc = {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SyncBlockError } from '@atlaskit/editor-synced-block-provider';
|
|
3
|
-
export declare const SyncedBlockErrorComponent: ({ error, resourceId, }: {
|
|
3
|
+
export declare const SyncedBlockErrorComponent: ({ error, isLoading, onRetry, resourceId, }: {
|
|
4
4
|
error: SyncBlockError;
|
|
5
|
+
isLoading?: boolean;
|
|
6
|
+
onRetry?: () => void;
|
|
5
7
|
resourceId?: string;
|
|
6
8
|
}) => React.JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface SyncedBlockErrorStateCardProps {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
imageAltText?: string;
|
|
5
|
+
imageSrc: string;
|
|
6
|
+
primaryMessage?: string;
|
|
7
|
+
secondaryMessage?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const SyncedBlockErrorStateCard: ({ children, imageAltText, imageSrc, primaryMessage, secondaryMessage, }: SyncedBlockErrorStateCardProps) => React.JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface SyncedBlockNotFoundProps {
|
|
3
|
+
contentId?: string;
|
|
4
|
+
isLoading?: boolean;
|
|
5
|
+
onRetry?: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const SyncedBlockLoadError: ({ onRetry, isLoading }: SyncedBlockNotFoundProps) => React.JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SyncBlockError } from '@atlaskit/editor-synced-block-provider';
|
|
3
|
-
export declare const SyncedBlockErrorComponent: ({ error, resourceId, }: {
|
|
3
|
+
export declare const SyncedBlockErrorComponent: ({ error, isLoading, onRetry, resourceId, }: {
|
|
4
4
|
error: SyncBlockError;
|
|
5
|
+
isLoading?: boolean;
|
|
6
|
+
onRetry?: () => void;
|
|
5
7
|
resourceId?: string;
|
|
6
8
|
}) => React.JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface SyncedBlockErrorStateCardProps {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
imageAltText?: string;
|
|
5
|
+
imageSrc: string;
|
|
6
|
+
primaryMessage?: string;
|
|
7
|
+
secondaryMessage?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const SyncedBlockErrorStateCard: ({ children, imageAltText, imageSrc, primaryMessage, secondaryMessage, }: SyncedBlockErrorStateCardProps) => React.JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface SyncedBlockNotFoundProps {
|
|
3
|
+
contentId?: string;
|
|
4
|
+
isLoading?: boolean;
|
|
5
|
+
onRetry?: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const SyncedBlockLoadError: ({ onRetry, isLoading }: SyncedBlockNotFoundProps) => React.JSX.Element;
|
|
8
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-synced-block-renderer",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "SyncedBlockRenderer for @atlaskit/editor-plugin-synced-block",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -37,14 +37,15 @@
|
|
|
37
37
|
"@atlaskit/icon": "^29.0.0",
|
|
38
38
|
"@atlaskit/image": "^3.0.0",
|
|
39
39
|
"@atlaskit/primitives": "^16.1.0",
|
|
40
|
-
"@atlaskit/renderer": "^124.
|
|
40
|
+
"@atlaskit/renderer": "^124.14.0",
|
|
41
|
+
"@atlaskit/spinner": "^19.0.0",
|
|
41
42
|
"@atlaskit/tokens": "^8.0.0",
|
|
42
43
|
"@babel/runtime": "^7.0.0",
|
|
43
44
|
"react-relay": "npm:atl-react-relay@0.0.0-main-6ff96079",
|
|
44
45
|
"relay-runtime": "npm:atl-relay-compiler@0.0.0-main-6ff96079"
|
|
45
46
|
},
|
|
46
47
|
"peerDependencies": {
|
|
47
|
-
"@atlaskit/editor-common": "^110.
|
|
48
|
+
"@atlaskit/editor-common": "^110.31.0",
|
|
48
49
|
"react": "^18.2.0",
|
|
49
50
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
50
51
|
},
|
|
File without changes
|
|
File without changes
|
|
File without changes
|