@atlaskit/editor-synced-block-renderer 3.4.2 → 3.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/ui/SyncedBlockErrorComponent.js +8 -22
- package/dist/cjs/ui/SyncedBlockNodeComponentRenderer.js +4 -4
- package/dist/cjs/ui/SyncedBlockPermissionDenied.js +18 -3
- package/dist/cjs/ui/SyncedBlockRenderer.js +4 -4
- package/dist/es2019/ui/SyncedBlockErrorComponent.js +9 -25
- package/dist/es2019/ui/SyncedBlockNodeComponentRenderer.js +4 -4
- package/dist/es2019/ui/SyncedBlockPermissionDenied.js +19 -3
- package/dist/es2019/ui/SyncedBlockRenderer.js +4 -4
- package/dist/esm/ui/SyncedBlockErrorComponent.js +9 -23
- package/dist/esm/ui/SyncedBlockNodeComponentRenderer.js +4 -4
- package/dist/esm/ui/SyncedBlockPermissionDenied.js +18 -3
- package/dist/esm/ui/SyncedBlockRenderer.js +4 -4
- package/dist/types/ui/SyncedBlockErrorComponent.d.ts +4 -3
- package/dist/types/ui/SyncedBlockPermissionDenied.d.ts +5 -4
- package/dist/types-ts4.5/ui/SyncedBlockErrorComponent.d.ts +4 -3
- package/dist/types-ts4.5/ui/SyncedBlockPermissionDenied.d.ts +5 -4
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-synced-block-renderer
|
|
2
2
|
|
|
3
|
+
## 3.4.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`23c24c4b7faff`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/23c24c4b7faff) -
|
|
8
|
+
EDITOR-3312 Make data handling product agnostic
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 3.4.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 3.4.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -16,32 +16,18 @@ var SyncedBlockErrorComponent = exports.SyncedBlockErrorComponent = function Syn
|
|
|
16
16
|
var error = _ref.error,
|
|
17
17
|
isLoading = _ref.isLoading,
|
|
18
18
|
onRetry = _ref.onRetry,
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
sourceAri = _ref.sourceAri,
|
|
20
|
+
sourceProduct = _ref.sourceProduct;
|
|
21
21
|
var getErrorContent = (0, _react.useMemo)(function () {
|
|
22
22
|
switch (error) {
|
|
23
23
|
case _editorSyncedBlockProvider.SyncBlockError.Forbidden:
|
|
24
|
-
if (!
|
|
24
|
+
if (!sourceAri || !sourceProduct) {
|
|
25
25
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockGenericError.SyncedBlockGenericError, null);
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (_contentId) {
|
|
32
|
-
return /*#__PURE__*/_react.default.createElement(_SyncedBlockPermissionDenied.SyncedBlockPermissionDenied, {
|
|
33
|
-
contentId: _contentId
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
var _getPageIdAndTypeFrom2 = (0, _editorSyncedBlockProvider.getPageIdAndTypeFromConfluencePageAri)(resourceId),
|
|
38
|
-
contentId = _getPageIdAndTypeFrom2.id;
|
|
39
|
-
if (contentId) {
|
|
40
|
-
return /*#__PURE__*/_react.default.createElement(_SyncedBlockPermissionDenied.SyncedBlockPermissionDenied, {
|
|
41
|
-
contentId: contentId
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
return /*#__PURE__*/_react.default.createElement(_SyncedBlockGenericError.SyncedBlockGenericError, null);
|
|
27
|
+
return /*#__PURE__*/_react.default.createElement(_SyncedBlockPermissionDenied.SyncedBlockPermissionDenied, {
|
|
28
|
+
sourceAri: sourceAri,
|
|
29
|
+
sourceProduct: sourceProduct
|
|
30
|
+
});
|
|
45
31
|
case _editorSyncedBlockProvider.SyncBlockError.NotFound:
|
|
46
32
|
case _editorSyncedBlockProvider.SyncBlockError.Errored:
|
|
47
33
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockLoadError.SyncedBlockLoadError, {
|
|
@@ -51,7 +37,7 @@ var SyncedBlockErrorComponent = exports.SyncedBlockErrorComponent = function Syn
|
|
|
51
37
|
default:
|
|
52
38
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockGenericError.SyncedBlockGenericError, null);
|
|
53
39
|
}
|
|
54
|
-
}, [
|
|
40
|
+
}, [error, isLoading, onRetry, sourceAri, sourceProduct]);
|
|
55
41
|
return (
|
|
56
42
|
/*#__PURE__*/
|
|
57
43
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
@@ -25,13 +25,13 @@ var SyncedBlockNodeComponentRenderer = exports.SyncedBlockNodeComponentRenderer
|
|
|
25
25
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockLoadingState.SyncedBlockLoadingState, null);
|
|
26
26
|
}
|
|
27
27
|
if (!resourceId || syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error || !(syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.data)) {
|
|
28
|
-
var _syncBlockInstance$er, _syncBlockInstance$da;
|
|
28
|
+
var _syncBlockInstance$er, _syncBlockInstance$da, _syncBlockInstance$da2;
|
|
29
29
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
|
|
30
30
|
error: (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : _editorSyncedBlockProvider.SyncBlockError.Errored,
|
|
31
|
-
|
|
31
|
+
sourceAri: syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.sourceAri,
|
|
32
|
+
sourceProduct: syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.product,
|
|
32
33
|
onRetry: reloadData,
|
|
33
|
-
isLoading: isLoading
|
|
34
|
-
documentAri: syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.sourceAri
|
|
34
|
+
isLoading: isLoading
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
var syncBlockDoc = {
|
|
@@ -13,10 +13,12 @@ var _reactIntlNext = require("react-intl-next");
|
|
|
13
13
|
var _reactRelay = require("react-relay");
|
|
14
14
|
var _new = _interopRequireDefault(require("@atlaskit/button/new"));
|
|
15
15
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
16
|
+
var _editorSyncedBlockProvider = require("@atlaskit/editor-synced-block-provider");
|
|
16
17
|
var _statusSuccess = _interopRequireDefault(require("@atlaskit/icon/core/status-success"));
|
|
17
18
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
18
19
|
var _PermissionDenied = _interopRequireDefault(require("./assets/PermissionDenied.svg"));
|
|
19
20
|
var _SyncedBlockErrorStateCard = require("./SyncedBlockErrorStateCard");
|
|
21
|
+
var _SyncedBlockGenericError = require("./SyncedBlockGenericError");
|
|
20
22
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
21
23
|
var RequestAccessState = /*#__PURE__*/function (RequestAccessState) {
|
|
22
24
|
RequestAccessState["default"] = "default";
|
|
@@ -25,8 +27,9 @@ var RequestAccessState = /*#__PURE__*/function (RequestAccessState) {
|
|
|
25
27
|
RequestAccessState["pending"] = "pending";
|
|
26
28
|
return RequestAccessState;
|
|
27
29
|
}(RequestAccessState || {});
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
+
var SyncedBlockPermissionDeniedConfluencePage = function SyncedBlockPermissionDeniedConfluencePage(_ref) {
|
|
31
|
+
var sourceAri = _ref.sourceAri;
|
|
32
|
+
var contentId = (0, _editorSyncedBlockProvider.getPageIdAndTypeFromConfluencePageAri)(sourceAri).id;
|
|
30
33
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
31
34
|
formatMessage = _useIntl.formatMessage;
|
|
32
35
|
var _useState = (0, _react.useState)(RequestAccessState.default),
|
|
@@ -36,7 +39,7 @@ var SyncedBlockPermissionDenied = exports.SyncedBlockPermissionDenied = function
|
|
|
36
39
|
var handleRequestComplete = function handleRequestComplete() {
|
|
37
40
|
setRequestAccessState(RequestAccessState.pending);
|
|
38
41
|
};
|
|
39
|
-
var handleRequestError = function handleRequestError(
|
|
42
|
+
var handleRequestError = function handleRequestError() {
|
|
40
43
|
setRequestAccessState(RequestAccessState.errored);
|
|
41
44
|
};
|
|
42
45
|
var _useMutation = (0, _reactRelay.useMutation)(_SyncedBlockPermissionDeniedRequestAccessMutation2.default),
|
|
@@ -86,4 +89,16 @@ var SyncedBlockPermissionDenied = exports.SyncedBlockPermissionDenied = function
|
|
|
86
89
|
color: "color.text.warning",
|
|
87
90
|
testId: "sync-block-access-error-msg"
|
|
88
91
|
}, formatMessage(_messages.syncBlockMessages.requestAccessError))));
|
|
92
|
+
};
|
|
93
|
+
var SyncedBlockPermissionDenied = exports.SyncedBlockPermissionDenied = function SyncedBlockPermissionDenied(_ref2) {
|
|
94
|
+
var sourceAri = _ref2.sourceAri,
|
|
95
|
+
sourceProduct = _ref2.sourceProduct;
|
|
96
|
+
switch (sourceProduct) {
|
|
97
|
+
case 'confluence-page':
|
|
98
|
+
return /*#__PURE__*/_react.default.createElement(SyncedBlockPermissionDeniedConfluencePage, {
|
|
99
|
+
sourceAri: sourceAri
|
|
100
|
+
});
|
|
101
|
+
default:
|
|
102
|
+
return /*#__PURE__*/_react.default.createElement(_SyncedBlockGenericError.SyncedBlockGenericError, null);
|
|
103
|
+
}
|
|
89
104
|
};
|
|
@@ -23,13 +23,13 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
|
|
|
23
23
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockLoadingState.SyncedBlockLoadingState, null);
|
|
24
24
|
}
|
|
25
25
|
if (syncBlockInstance.error || !syncBlockInstance.data) {
|
|
26
|
-
var _syncBlockInstance$er, _syncBlockInstance$da;
|
|
26
|
+
var _syncBlockInstance$er, _syncBlockInstance$da, _syncBlockInstance$da2;
|
|
27
27
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
|
|
28
28
|
error: (_syncBlockInstance$er = syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : _editorSyncedBlockProvider.SyncBlockError.Errored,
|
|
29
|
-
|
|
29
|
+
sourceAri: (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.sourceAri,
|
|
30
|
+
sourceProduct: (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.product,
|
|
30
31
|
onRetry: reloadData,
|
|
31
|
-
isLoading: isLoading
|
|
32
|
-
documentAri: (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.sourceAri
|
|
32
|
+
isLoading: isLoading
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
var syncBlockDoc = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { SyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
|
|
3
|
-
import {
|
|
3
|
+
import { SyncBlockError } from '@atlaskit/editor-synced-block-provider';
|
|
4
4
|
import { SyncedBlockGenericError } from './SyncedBlockGenericError';
|
|
5
5
|
import { SyncedBlockLoadError } from './SyncedBlockLoadError';
|
|
6
6
|
import { SyncedBlockPermissionDenied } from './SyncedBlockPermissionDenied';
|
|
@@ -8,35 +8,19 @@ export const SyncedBlockErrorComponent = ({
|
|
|
8
8
|
error,
|
|
9
9
|
isLoading,
|
|
10
10
|
onRetry,
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
sourceAri,
|
|
12
|
+
sourceProduct
|
|
13
13
|
}) => {
|
|
14
14
|
const getErrorContent = useMemo(() => {
|
|
15
15
|
switch (error) {
|
|
16
16
|
case SyncBlockError.Forbidden:
|
|
17
|
-
if (!
|
|
17
|
+
if (!sourceAri || !sourceProduct) {
|
|
18
18
|
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} = getPageIdAndTypeFromConfluencePageAri(documentAri);
|
|
25
|
-
if (contentId) {
|
|
26
|
-
return /*#__PURE__*/React.createElement(SyncedBlockPermissionDenied, {
|
|
27
|
-
contentId: contentId
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
const {
|
|
32
|
-
id: contentId
|
|
33
|
-
} = getPageIdAndTypeFromConfluencePageAri(resourceId);
|
|
34
|
-
if (contentId) {
|
|
35
|
-
return /*#__PURE__*/React.createElement(SyncedBlockPermissionDenied, {
|
|
36
|
-
contentId: contentId
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
20
|
+
return /*#__PURE__*/React.createElement(SyncedBlockPermissionDenied, {
|
|
21
|
+
sourceAri: sourceAri,
|
|
22
|
+
sourceProduct: sourceProduct
|
|
23
|
+
});
|
|
40
24
|
case SyncBlockError.NotFound:
|
|
41
25
|
case SyncBlockError.Errored:
|
|
42
26
|
return /*#__PURE__*/React.createElement(SyncedBlockLoadError, {
|
|
@@ -46,7 +30,7 @@ export const SyncedBlockErrorComponent = ({
|
|
|
46
30
|
default:
|
|
47
31
|
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
48
32
|
}
|
|
49
|
-
}, [
|
|
33
|
+
}, [error, isLoading, onRetry, sourceAri, sourceProduct]);
|
|
50
34
|
return (
|
|
51
35
|
/*#__PURE__*/
|
|
52
36
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
@@ -22,13 +22,13 @@ export const SyncedBlockNodeComponentRenderer = ({
|
|
|
22
22
|
return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
|
|
23
23
|
}
|
|
24
24
|
if (!resourceId || syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error || !(syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.data)) {
|
|
25
|
-
var _syncBlockInstance$er, _syncBlockInstance$da;
|
|
25
|
+
var _syncBlockInstance$er, _syncBlockInstance$da, _syncBlockInstance$da2;
|
|
26
26
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
27
27
|
error: (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : SyncBlockError.Errored,
|
|
28
|
-
|
|
28
|
+
sourceAri: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.sourceAri,
|
|
29
|
+
sourceProduct: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.product,
|
|
29
30
|
onRetry: reloadData,
|
|
30
|
-
isLoading: isLoading
|
|
31
|
-
documentAri: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.sourceAri
|
|
31
|
+
isLoading: isLoading
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
const syncBlockDoc = {
|
|
@@ -4,10 +4,12 @@ import { useIntl } from 'react-intl-next';
|
|
|
4
4
|
import { useMutation, graphql } from 'react-relay';
|
|
5
5
|
import Button from '@atlaskit/button/new';
|
|
6
6
|
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
+
import { getPageIdAndTypeFromConfluencePageAri } from '@atlaskit/editor-synced-block-provider';
|
|
7
8
|
import StatusSuccessIcon from '@atlaskit/icon/core/status-success';
|
|
8
9
|
import { Text, Flex } from '@atlaskit/primitives/compiled';
|
|
9
10
|
import PermissionDenied from './assets/PermissionDenied.svg';
|
|
10
11
|
import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
|
|
12
|
+
import { SyncedBlockGenericError } from './SyncedBlockGenericError';
|
|
11
13
|
var RequestAccessState = /*#__PURE__*/function (RequestAccessState) {
|
|
12
14
|
RequestAccessState["default"] = "default";
|
|
13
15
|
RequestAccessState["errored"] = "errored";
|
|
@@ -15,9 +17,10 @@ var RequestAccessState = /*#__PURE__*/function (RequestAccessState) {
|
|
|
15
17
|
RequestAccessState["pending"] = "pending";
|
|
16
18
|
return RequestAccessState;
|
|
17
19
|
}(RequestAccessState || {});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
const SyncedBlockPermissionDeniedConfluencePage = ({
|
|
21
|
+
sourceAri
|
|
20
22
|
}) => {
|
|
23
|
+
const contentId = getPageIdAndTypeFromConfluencePageAri(sourceAri).id;
|
|
21
24
|
const {
|
|
22
25
|
formatMessage
|
|
23
26
|
} = useIntl();
|
|
@@ -25,7 +28,7 @@ export const SyncedBlockPermissionDenied = ({
|
|
|
25
28
|
const handleRequestComplete = () => {
|
|
26
29
|
setRequestAccessState(RequestAccessState.pending);
|
|
27
30
|
};
|
|
28
|
-
const handleRequestError =
|
|
31
|
+
const handleRequestError = () => {
|
|
29
32
|
setRequestAccessState(RequestAccessState.errored);
|
|
30
33
|
};
|
|
31
34
|
const [commitMutation] = useMutation(_SyncedBlockPermissionDeniedRequestAccessMutation);
|
|
@@ -73,4 +76,17 @@ export const SyncedBlockPermissionDenied = ({
|
|
|
73
76
|
color: "color.text.warning",
|
|
74
77
|
testId: "sync-block-access-error-msg"
|
|
75
78
|
}, formatMessage(messages.requestAccessError))));
|
|
79
|
+
};
|
|
80
|
+
export const SyncedBlockPermissionDenied = ({
|
|
81
|
+
sourceAri,
|
|
82
|
+
sourceProduct
|
|
83
|
+
}) => {
|
|
84
|
+
switch (sourceProduct) {
|
|
85
|
+
case 'confluence-page':
|
|
86
|
+
return /*#__PURE__*/React.createElement(SyncedBlockPermissionDeniedConfluencePage, {
|
|
87
|
+
sourceAri: sourceAri
|
|
88
|
+
});
|
|
89
|
+
default:
|
|
90
|
+
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
91
|
+
}
|
|
76
92
|
};
|
|
@@ -17,13 +17,13 @@ const SyncedBlockRendererComponent = ({
|
|
|
17
17
|
return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
|
|
18
18
|
}
|
|
19
19
|
if (syncBlockInstance.error || !syncBlockInstance.data) {
|
|
20
|
-
var _syncBlockInstance$er, _syncBlockInstance$da;
|
|
20
|
+
var _syncBlockInstance$er, _syncBlockInstance$da, _syncBlockInstance$da2;
|
|
21
21
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
22
22
|
error: (_syncBlockInstance$er = syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : SyncBlockError.Errored,
|
|
23
|
-
|
|
23
|
+
sourceAri: (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.sourceAri,
|
|
24
|
+
sourceProduct: (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.product,
|
|
24
25
|
onRetry: reloadData,
|
|
25
|
-
isLoading: isLoading
|
|
26
|
-
documentAri: (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.sourceAri
|
|
26
|
+
isLoading: isLoading
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
const syncBlockDoc = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { SyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
|
|
3
|
-
import {
|
|
3
|
+
import { SyncBlockError } from '@atlaskit/editor-synced-block-provider';
|
|
4
4
|
import { SyncedBlockGenericError } from './SyncedBlockGenericError';
|
|
5
5
|
import { SyncedBlockLoadError } from './SyncedBlockLoadError';
|
|
6
6
|
import { SyncedBlockPermissionDenied } from './SyncedBlockPermissionDenied';
|
|
@@ -8,32 +8,18 @@ export var SyncedBlockErrorComponent = function SyncedBlockErrorComponent(_ref)
|
|
|
8
8
|
var error = _ref.error,
|
|
9
9
|
isLoading = _ref.isLoading,
|
|
10
10
|
onRetry = _ref.onRetry,
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
sourceAri = _ref.sourceAri,
|
|
12
|
+
sourceProduct = _ref.sourceProduct;
|
|
13
13
|
var getErrorContent = useMemo(function () {
|
|
14
14
|
switch (error) {
|
|
15
15
|
case SyncBlockError.Forbidden:
|
|
16
|
-
if (!
|
|
16
|
+
if (!sourceAri || !sourceProduct) {
|
|
17
17
|
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (_contentId) {
|
|
24
|
-
return /*#__PURE__*/React.createElement(SyncedBlockPermissionDenied, {
|
|
25
|
-
contentId: _contentId
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
var _getPageIdAndTypeFrom2 = getPageIdAndTypeFromConfluencePageAri(resourceId),
|
|
30
|
-
contentId = _getPageIdAndTypeFrom2.id;
|
|
31
|
-
if (contentId) {
|
|
32
|
-
return /*#__PURE__*/React.createElement(SyncedBlockPermissionDenied, {
|
|
33
|
-
contentId: contentId
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
19
|
+
return /*#__PURE__*/React.createElement(SyncedBlockPermissionDenied, {
|
|
20
|
+
sourceAri: sourceAri,
|
|
21
|
+
sourceProduct: sourceProduct
|
|
22
|
+
});
|
|
37
23
|
case SyncBlockError.NotFound:
|
|
38
24
|
case SyncBlockError.Errored:
|
|
39
25
|
return /*#__PURE__*/React.createElement(SyncedBlockLoadError, {
|
|
@@ -43,7 +29,7 @@ export var SyncedBlockErrorComponent = function SyncedBlockErrorComponent(_ref)
|
|
|
43
29
|
default:
|
|
44
30
|
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
45
31
|
}
|
|
46
|
-
}, [
|
|
32
|
+
}, [error, isLoading, onRetry, sourceAri, sourceProduct]);
|
|
47
33
|
return (
|
|
48
34
|
/*#__PURE__*/
|
|
49
35
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
@@ -18,13 +18,13 @@ export var SyncedBlockNodeComponentRenderer = function SyncedBlockNodeComponentR
|
|
|
18
18
|
return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
|
|
19
19
|
}
|
|
20
20
|
if (!resourceId || syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error || !(syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.data)) {
|
|
21
|
-
var _syncBlockInstance$er, _syncBlockInstance$da;
|
|
21
|
+
var _syncBlockInstance$er, _syncBlockInstance$da, _syncBlockInstance$da2;
|
|
22
22
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
23
23
|
error: (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : SyncBlockError.Errored,
|
|
24
|
-
|
|
24
|
+
sourceAri: syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.sourceAri,
|
|
25
|
+
sourceProduct: syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.product,
|
|
25
26
|
onRetry: reloadData,
|
|
26
|
-
isLoading: isLoading
|
|
27
|
-
documentAri: syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.sourceAri
|
|
27
|
+
isLoading: isLoading
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
var syncBlockDoc = {
|
|
@@ -5,10 +5,12 @@ import { useIntl } from 'react-intl-next';
|
|
|
5
5
|
import { useMutation, graphql } from 'react-relay';
|
|
6
6
|
import Button from '@atlaskit/button/new';
|
|
7
7
|
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
8
|
+
import { getPageIdAndTypeFromConfluencePageAri } from '@atlaskit/editor-synced-block-provider';
|
|
8
9
|
import StatusSuccessIcon from '@atlaskit/icon/core/status-success';
|
|
9
10
|
import { Text, Flex } from '@atlaskit/primitives/compiled';
|
|
10
11
|
import PermissionDenied from './assets/PermissionDenied.svg';
|
|
11
12
|
import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
|
|
13
|
+
import { SyncedBlockGenericError } from './SyncedBlockGenericError';
|
|
12
14
|
var RequestAccessState = /*#__PURE__*/function (RequestAccessState) {
|
|
13
15
|
RequestAccessState["default"] = "default";
|
|
14
16
|
RequestAccessState["errored"] = "errored";
|
|
@@ -16,8 +18,9 @@ var RequestAccessState = /*#__PURE__*/function (RequestAccessState) {
|
|
|
16
18
|
RequestAccessState["pending"] = "pending";
|
|
17
19
|
return RequestAccessState;
|
|
18
20
|
}(RequestAccessState || {});
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
+
var SyncedBlockPermissionDeniedConfluencePage = function SyncedBlockPermissionDeniedConfluencePage(_ref) {
|
|
22
|
+
var sourceAri = _ref.sourceAri;
|
|
23
|
+
var contentId = getPageIdAndTypeFromConfluencePageAri(sourceAri).id;
|
|
21
24
|
var _useIntl = useIntl(),
|
|
22
25
|
formatMessage = _useIntl.formatMessage;
|
|
23
26
|
var _useState = useState(RequestAccessState.default),
|
|
@@ -27,7 +30,7 @@ export var SyncedBlockPermissionDenied = function SyncedBlockPermissionDenied(_r
|
|
|
27
30
|
var handleRequestComplete = function handleRequestComplete() {
|
|
28
31
|
setRequestAccessState(RequestAccessState.pending);
|
|
29
32
|
};
|
|
30
|
-
var handleRequestError = function handleRequestError(
|
|
33
|
+
var handleRequestError = function handleRequestError() {
|
|
31
34
|
setRequestAccessState(RequestAccessState.errored);
|
|
32
35
|
};
|
|
33
36
|
var _useMutation = useMutation(_SyncedBlockPermissionDeniedRequestAccessMutation),
|
|
@@ -77,4 +80,16 @@ export var SyncedBlockPermissionDenied = function SyncedBlockPermissionDenied(_r
|
|
|
77
80
|
color: "color.text.warning",
|
|
78
81
|
testId: "sync-block-access-error-msg"
|
|
79
82
|
}, formatMessage(messages.requestAccessError))));
|
|
83
|
+
};
|
|
84
|
+
export var SyncedBlockPermissionDenied = function SyncedBlockPermissionDenied(_ref2) {
|
|
85
|
+
var sourceAri = _ref2.sourceAri,
|
|
86
|
+
sourceProduct = _ref2.sourceProduct;
|
|
87
|
+
switch (sourceProduct) {
|
|
88
|
+
case 'confluence-page':
|
|
89
|
+
return /*#__PURE__*/React.createElement(SyncedBlockPermissionDeniedConfluencePage, {
|
|
90
|
+
sourceAri: sourceAri
|
|
91
|
+
});
|
|
92
|
+
default:
|
|
93
|
+
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
94
|
+
}
|
|
80
95
|
};
|
|
@@ -15,13 +15,13 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
|
|
|
15
15
|
return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
|
|
16
16
|
}
|
|
17
17
|
if (syncBlockInstance.error || !syncBlockInstance.data) {
|
|
18
|
-
var _syncBlockInstance$er, _syncBlockInstance$da;
|
|
18
|
+
var _syncBlockInstance$er, _syncBlockInstance$da, _syncBlockInstance$da2;
|
|
19
19
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
20
20
|
error: (_syncBlockInstance$er = syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : SyncBlockError.Errored,
|
|
21
|
-
|
|
21
|
+
sourceAri: (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.sourceAri,
|
|
22
|
+
sourceProduct: (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.product,
|
|
22
23
|
onRetry: reloadData,
|
|
23
|
-
isLoading: isLoading
|
|
24
|
-
documentAri: (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.sourceAri
|
|
24
|
+
isLoading: isLoading
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
var syncBlockDoc = {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SyncBlockError } from '@atlaskit/editor-synced-block-provider';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import type { SyncBlockProduct } from '@atlaskit/editor-synced-block-provider';
|
|
4
|
+
export declare const SyncedBlockErrorComponent: ({ error, isLoading, onRetry, sourceAri, sourceProduct, }: {
|
|
5
5
|
error: SyncBlockError;
|
|
6
6
|
isLoading?: boolean;
|
|
7
7
|
onRetry?: () => void;
|
|
8
|
-
|
|
8
|
+
sourceAri?: string;
|
|
9
|
+
sourceProduct?: SyncBlockProduct;
|
|
9
10
|
}) => React.JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { type SyncBlockProduct } from '@atlaskit/editor-synced-block-provider';
|
|
3
|
+
export interface SyncedBlockPermissionDeniedProps {
|
|
4
|
+
sourceAri: string;
|
|
5
|
+
sourceProduct: SyncBlockProduct;
|
|
4
6
|
}
|
|
5
|
-
export declare const SyncedBlockPermissionDenied: ({
|
|
6
|
-
export {};
|
|
7
|
+
export declare const SyncedBlockPermissionDenied: ({ sourceAri, sourceProduct, }: SyncedBlockPermissionDeniedProps) => React.JSX.Element;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SyncBlockError } from '@atlaskit/editor-synced-block-provider';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import type { SyncBlockProduct } from '@atlaskit/editor-synced-block-provider';
|
|
4
|
+
export declare const SyncedBlockErrorComponent: ({ error, isLoading, onRetry, sourceAri, sourceProduct, }: {
|
|
5
5
|
error: SyncBlockError;
|
|
6
6
|
isLoading?: boolean;
|
|
7
7
|
onRetry?: () => void;
|
|
8
|
-
|
|
8
|
+
sourceAri?: string;
|
|
9
|
+
sourceProduct?: SyncBlockProduct;
|
|
9
10
|
}) => React.JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { type SyncBlockProduct } from '@atlaskit/editor-synced-block-provider';
|
|
3
|
+
export interface SyncedBlockPermissionDeniedProps {
|
|
4
|
+
sourceAri: string;
|
|
5
|
+
sourceProduct: SyncBlockProduct;
|
|
4
6
|
}
|
|
5
|
-
export declare const SyncedBlockPermissionDenied: ({
|
|
6
|
-
export {};
|
|
7
|
+
export declare const SyncedBlockPermissionDenied: ({ sourceAri, sourceProduct, }: SyncedBlockPermissionDeniedProps) => React.JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-synced-block-renderer",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.4",
|
|
4
4
|
"description": "SyncedBlockRenderer for @atlaskit/editor-plugin-synced-block",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,23 +29,23 @@
|
|
|
29
29
|
"atlaskit:src": "src/index.ts",
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/button": "^23.6.0",
|
|
32
|
-
"@atlaskit/css": "^0.
|
|
33
|
-
"@atlaskit/editor-plugin-synced-block": "^4.
|
|
32
|
+
"@atlaskit/css": "^0.17.0",
|
|
33
|
+
"@atlaskit/editor-plugin-synced-block": "^4.3.0",
|
|
34
34
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
35
35
|
"@atlaskit/editor-synced-block-provider": "^2.10.0",
|
|
36
36
|
"@atlaskit/heading": "^5.2.0",
|
|
37
37
|
"@atlaskit/icon": "^29.0.0",
|
|
38
38
|
"@atlaskit/image": "^3.0.0",
|
|
39
|
-
"@atlaskit/primitives": "^16.
|
|
39
|
+
"@atlaskit/primitives": "^16.3.0",
|
|
40
40
|
"@atlaskit/renderer": "^124.16.0",
|
|
41
41
|
"@atlaskit/spinner": "^19.0.0",
|
|
42
|
-
"@atlaskit/tokens": "^8.
|
|
42
|
+
"@atlaskit/tokens": "^8.3.0",
|
|
43
43
|
"@babel/runtime": "^7.0.0",
|
|
44
44
|
"react-relay": "npm:atl-react-relay@0.0.0-main-39e79f66",
|
|
45
45
|
"relay-runtime": "npm:atl-relay-compiler@0.0.0-main-39e79f66"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@atlaskit/editor-common": "^110.
|
|
48
|
+
"@atlaskit/editor-common": "^110.34.0",
|
|
49
49
|
"react": "^18.2.0",
|
|
50
50
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
51
51
|
},
|