@atlaskit/editor-synced-block-renderer 4.0.2 → 4.0.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 +17 -0
- package/afm-cc/tsconfig.json +11 -3
- package/afm-products/tsconfig.json +5 -1
- package/dist/cjs/getSyncedBlockRenderer.js +4 -2
- package/dist/cjs/ui/SyncedBlockErrorComponent.js +28 -10
- package/dist/cjs/ui/SyncedBlockErrorStateCard.compiled.css +4 -7
- package/dist/cjs/ui/SyncedBlockErrorStateCard.js +8 -21
- package/dist/cjs/ui/SyncedBlockGenericError.js +1 -3
- package/dist/cjs/ui/SyncedBlockLoadError.js +1 -4
- package/dist/cjs/ui/SyncedBlockLoadingState.compiled.css +0 -2
- package/dist/cjs/ui/SyncedBlockLoadingState.js +14 -7
- package/dist/cjs/ui/SyncedBlockNodeComponentRenderer.js +4 -4
- package/dist/cjs/ui/SyncedBlockOfflineError.js +18 -0
- package/dist/cjs/ui/SyncedBlockPermissionDenied.compiled.css +8 -0
- package/dist/cjs/ui/SyncedBlockPermissionDenied.js +27 -14
- package/dist/cjs/ui/SyncedBlockRenderer.js +19 -5
- package/dist/es2019/getSyncedBlockRenderer.js +4 -2
- package/dist/es2019/ui/SyncedBlockErrorComponent.js +30 -11
- package/dist/es2019/ui/SyncedBlockErrorStateCard.compiled.css +4 -7
- package/dist/es2019/ui/SyncedBlockErrorStateCard.js +9 -22
- package/dist/es2019/ui/SyncedBlockGenericError.js +1 -3
- package/dist/es2019/ui/SyncedBlockLoadError.js +1 -4
- package/dist/es2019/ui/SyncedBlockLoadingState.compiled.css +0 -2
- package/dist/es2019/ui/SyncedBlockLoadingState.js +14 -7
- package/dist/es2019/ui/SyncedBlockNodeComponentRenderer.js +4 -4
- package/dist/es2019/ui/SyncedBlockOfflineError.js +12 -0
- package/dist/es2019/ui/SyncedBlockPermissionDenied.compiled.css +8 -0
- package/dist/es2019/ui/SyncedBlockPermissionDenied.js +28 -15
- package/dist/es2019/ui/SyncedBlockRenderer.js +19 -5
- package/dist/esm/getSyncedBlockRenderer.js +4 -2
- package/dist/esm/ui/SyncedBlockErrorComponent.js +29 -11
- package/dist/esm/ui/SyncedBlockErrorStateCard.compiled.css +4 -7
- package/dist/esm/ui/SyncedBlockErrorStateCard.js +9 -22
- package/dist/esm/ui/SyncedBlockGenericError.js +1 -3
- package/dist/esm/ui/SyncedBlockLoadError.js +1 -4
- package/dist/esm/ui/SyncedBlockLoadingState.compiled.css +0 -2
- package/dist/esm/ui/SyncedBlockLoadingState.js +14 -7
- package/dist/esm/ui/SyncedBlockNodeComponentRenderer.js +4 -4
- package/dist/esm/ui/SyncedBlockOfflineError.js +11 -0
- package/dist/esm/ui/SyncedBlockPermissionDenied.compiled.css +8 -0
- package/dist/esm/ui/SyncedBlockPermissionDenied.js +28 -15
- package/dist/esm/ui/SyncedBlockRenderer.js +19 -5
- package/dist/types/getSyncedBlockRenderer.d.ts +1 -1
- package/dist/types/ui/SyncedBlockErrorComponent.d.ts +4 -4
- package/dist/types/ui/SyncedBlockErrorStateCard.d.ts +2 -5
- package/dist/types/ui/SyncedBlockOfflineError.d.ts +2 -0
- package/dist/types/ui/SyncedBlockPermissionDenied.d.ts +2 -2
- package/dist/types/ui/SyncedBlockRenderer.d.ts +4 -1
- package/dist/types-ts4.5/getSyncedBlockRenderer.d.ts +1 -1
- package/dist/types-ts4.5/ui/SyncedBlockErrorComponent.d.ts +4 -4
- package/dist/types-ts4.5/ui/SyncedBlockErrorStateCard.d.ts +2 -5
- package/dist/types-ts4.5/ui/SyncedBlockOfflineError.d.ts +2 -0
- package/dist/types-ts4.5/ui/SyncedBlockPermissionDenied.d.ts +2 -2
- package/dist/types-ts4.5/ui/SyncedBlockRenderer.d.ts +4 -1
- package/package.json +8 -8
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
3
|
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
|
-
import ExclamationWarning from './assets/ExclamationWarning.svg';
|
|
5
4
|
import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
|
|
6
5
|
export const SyncedBlockGenericError = () => {
|
|
7
6
|
const {
|
|
8
7
|
formatMessage
|
|
9
8
|
} = useIntl();
|
|
10
9
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorStateCard, {
|
|
11
|
-
|
|
12
|
-
secondaryMessage: formatMessage(messages.generalErrorDescription)
|
|
10
|
+
description: formatMessage(messages.generalErrorDescription)
|
|
13
11
|
});
|
|
14
12
|
};
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
3
|
import Button from '@atlaskit/button/new';
|
|
4
4
|
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
|
-
import ExclamationWarning from './assets/ExclamationWarning.svg';
|
|
6
5
|
import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
|
|
7
6
|
export const SyncedBlockLoadError = ({
|
|
8
7
|
onRetry,
|
|
@@ -12,9 +11,7 @@ export const SyncedBlockLoadError = ({
|
|
|
12
11
|
formatMessage
|
|
13
12
|
} = useIntl();
|
|
14
13
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorStateCard, {
|
|
15
|
-
|
|
16
|
-
imageAltText: formatMessage(messages.notFoundAltText),
|
|
17
|
-
secondaryMessage: formatMessage(messages.notFoundDescription)
|
|
14
|
+
description: formatMessage(messages.generalErrorDescription)
|
|
18
15
|
}, onRetry && /*#__PURE__*/React.createElement(Button, {
|
|
19
16
|
appearance: "default",
|
|
20
17
|
spacing: "compact",
|
|
@@ -2,16 +2,23 @@
|
|
|
2
2
|
import "./SyncedBlockLoadingState.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React from 'react';
|
|
5
|
+
import { SyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
|
|
5
6
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
6
7
|
import Spinner from '@atlaskit/spinner';
|
|
7
8
|
const styles = {
|
|
8
|
-
wrapper: "
|
|
9
|
+
wrapper: "_1tkevbgk _1e0c1txw _1bah1h6o _4cvr1h6o"
|
|
9
10
|
};
|
|
10
11
|
export const SyncedBlockLoadingState = () => {
|
|
11
|
-
return
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
return (
|
|
13
|
+
/*#__PURE__*/
|
|
14
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/design-system/no-unsafe-style-overrides
|
|
15
|
+
React.createElement("div", {
|
|
16
|
+
className: SyncBlockSharedCssClassName.loading
|
|
17
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
18
|
+
xcss: styles.wrapper
|
|
19
|
+
}, /*#__PURE__*/React.createElement(Spinner, {
|
|
20
|
+
size: "small",
|
|
21
|
+
label: "Loading synced content"
|
|
22
|
+
})))
|
|
23
|
+
);
|
|
17
24
|
};
|
|
@@ -24,13 +24,13 @@ export const SyncedBlockNodeComponentRenderer = ({
|
|
|
24
24
|
return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
|
|
25
25
|
}
|
|
26
26
|
if (!resourceId || syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error || !(syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.data)) {
|
|
27
|
-
var _syncBlockInstance$er
|
|
27
|
+
var _syncBlockInstance$er;
|
|
28
28
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
29
29
|
error: (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : SyncBlockError.Errored,
|
|
30
|
-
|
|
31
|
-
sourceProduct: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.product,
|
|
30
|
+
resourceId: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.resourceId,
|
|
32
31
|
onRetry: reloadData,
|
|
33
|
-
isLoading: isLoading
|
|
32
|
+
isLoading: isLoading,
|
|
33
|
+
fireAnalyticsEvent: fireAnalyticsEvent
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
const syncBlockDoc = {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl-next';
|
|
3
|
+
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
|
|
5
|
+
export const SyncedBlockOfflineError = () => {
|
|
6
|
+
const {
|
|
7
|
+
formatMessage
|
|
8
|
+
} = useIntl();
|
|
9
|
+
return /*#__PURE__*/React.createElement(SyncedBlockErrorStateCard, {
|
|
10
|
+
description: formatMessage(messages.offlineError)
|
|
11
|
+
});
|
|
12
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
|
|
2
|
+
._zulppxbi{gap:var(--ds-space-200,1pc)}._19bvv47k{padding-left:var(--ds-space-250,20px)}
|
|
3
|
+
._1bahv2br{justify-content:start}
|
|
4
|
+
._1e0c1txw{display:flex}
|
|
5
|
+
._4cvr1h6o{align-items:center}
|
|
6
|
+
._ca0qv47k{padding-top:var(--ds-space-250,20px)}
|
|
7
|
+
._n3tdv47k{padding-bottom:var(--ds-space-250,20px)}
|
|
8
|
+
._u5f3v47k{padding-right:var(--ds-space-250,20px)}
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
+
/* SyncedBlockPermissionDenied.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
+
import "./SyncedBlockPermissionDenied.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
1
4
|
import _SyncedBlockPermissionDeniedRequestAccessMutation from "./__generated__/SyncedBlockPermissionDeniedRequestAccessMutation.graphql";
|
|
2
5
|
import React, { useState } from 'react';
|
|
3
6
|
import { useIntl } from 'react-intl-next';
|
|
4
7
|
import { useMutation, graphql } from 'react-relay';
|
|
5
8
|
import Button from '@atlaskit/button/new';
|
|
6
9
|
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
-
import
|
|
10
|
+
import Heading from '@atlaskit/heading';
|
|
8
11
|
import StatusSuccessIcon from '@atlaskit/icon/core/status-success';
|
|
9
|
-
import
|
|
12
|
+
import Image from '@atlaskit/image';
|
|
13
|
+
import { Text, Flex, Stack, Box } from '@atlaskit/primitives/compiled';
|
|
10
14
|
import PermissionDenied from './assets/PermissionDenied.svg';
|
|
11
|
-
import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
|
|
12
15
|
import { SyncedBlockGenericError } from './SyncedBlockGenericError';
|
|
16
|
+
const styles = {
|
|
17
|
+
wrapper: "_zulppxbi _ca0qv47k _n3tdv47k _19bvv47k _u5f3v47k _1e0c1txw _1bahv2br _4cvr1h6o"
|
|
18
|
+
};
|
|
13
19
|
var RequestAccessState = /*#__PURE__*/function (RequestAccessState) {
|
|
14
20
|
RequestAccessState["default"] = "default";
|
|
15
21
|
RequestAccessState["errored"] = "errored";
|
|
@@ -18,9 +24,8 @@ var RequestAccessState = /*#__PURE__*/function (RequestAccessState) {
|
|
|
18
24
|
return RequestAccessState;
|
|
19
25
|
}(RequestAccessState || {});
|
|
20
26
|
const SyncedBlockPermissionDeniedConfluencePage = ({
|
|
21
|
-
|
|
27
|
+
sourceContentId
|
|
22
28
|
}) => {
|
|
23
|
-
const contentId = getPageIdAndTypeFromConfluencePageAri(sourceAri).id;
|
|
24
29
|
const {
|
|
25
30
|
formatMessage
|
|
26
31
|
} = useIntl();
|
|
@@ -37,7 +42,7 @@ const SyncedBlockPermissionDeniedConfluencePage = ({
|
|
|
37
42
|
commitMutation({
|
|
38
43
|
variables: {
|
|
39
44
|
requestPageAccessInput: {
|
|
40
|
-
pageId:
|
|
45
|
+
pageId: sourceContentId,
|
|
41
46
|
accessType: 'VIEW'
|
|
42
47
|
}
|
|
43
48
|
},
|
|
@@ -47,12 +52,20 @@ const SyncedBlockPermissionDeniedConfluencePage = ({
|
|
|
47
52
|
onError: handleRequestError
|
|
48
53
|
});
|
|
49
54
|
};
|
|
50
|
-
return /*#__PURE__*/React.createElement(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
56
|
+
xcss: styles.wrapper
|
|
57
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
58
|
+
src: PermissionDenied,
|
|
59
|
+
alt: formatMessage(messages.permissionDeniedAltText),
|
|
60
|
+
width: "48",
|
|
61
|
+
height: "48"
|
|
62
|
+
}), /*#__PURE__*/React.createElement(Stack, {
|
|
63
|
+
space: "space.100"
|
|
64
|
+
}, /*#__PURE__*/React.createElement(Heading, {
|
|
65
|
+
size: "xsmall"
|
|
66
|
+
}, formatMessage(messages.permissionDeniedHeading)), /*#__PURE__*/React.createElement(Text, {
|
|
67
|
+
color: "color.text.subtle"
|
|
68
|
+
}, formatMessage(messages.permissionDeniedDescription)), requestAccessState === RequestAccessState.pending ? /*#__PURE__*/React.createElement(Flex, {
|
|
56
69
|
columnGap: "space.050",
|
|
57
70
|
alignItems: "center"
|
|
58
71
|
}, /*#__PURE__*/React.createElement(StatusSuccessIcon, {
|
|
@@ -75,16 +88,16 @@ const SyncedBlockPermissionDeniedConfluencePage = ({
|
|
|
75
88
|
}, formatMessage(messages.requestAccessButton)), requestAccessState === RequestAccessState.errored && /*#__PURE__*/React.createElement(Text, {
|
|
76
89
|
color: "color.text.warning",
|
|
77
90
|
testId: "sync-block-access-error-msg"
|
|
78
|
-
}, formatMessage(messages.requestAccessError))));
|
|
91
|
+
}, formatMessage(messages.requestAccessError)))));
|
|
79
92
|
};
|
|
80
93
|
export const SyncedBlockPermissionDenied = ({
|
|
81
|
-
|
|
94
|
+
sourceContentId,
|
|
82
95
|
sourceProduct
|
|
83
96
|
}) => {
|
|
84
97
|
switch (sourceProduct) {
|
|
85
98
|
case 'confluence-page':
|
|
86
99
|
return /*#__PURE__*/React.createElement(SyncedBlockPermissionDeniedConfluencePage, {
|
|
87
|
-
|
|
100
|
+
sourceContentId: sourceContentId
|
|
88
101
|
});
|
|
89
102
|
default:
|
|
90
103
|
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
2
3
|
import { SyncBlockError } from '@atlaskit/editor-synced-block-provider';
|
|
3
4
|
import { AKRendererWrapper } from './AKRendererWrapper';
|
|
4
5
|
import { SyncedBlockErrorComponent } from './SyncedBlockErrorComponent';
|
|
5
6
|
import { SyncedBlockLoadingState } from './SyncedBlockLoadingState';
|
|
6
7
|
const SyncedBlockRendererComponent = ({
|
|
7
8
|
useFetchSyncBlockData,
|
|
8
|
-
syncBlockRendererOptions
|
|
9
|
+
syncBlockRendererOptions,
|
|
10
|
+
api
|
|
9
11
|
}) => {
|
|
10
12
|
const {
|
|
11
13
|
syncBlockInstance,
|
|
@@ -13,17 +15,29 @@ const SyncedBlockRendererComponent = ({
|
|
|
13
15
|
isLoading,
|
|
14
16
|
reloadData
|
|
15
17
|
} = useFetchSyncBlockData();
|
|
18
|
+
const {
|
|
19
|
+
isOffline
|
|
20
|
+
} = useSharedPluginStateWithSelector(api, ['connectivity'], ({
|
|
21
|
+
connectivityState
|
|
22
|
+
}) => ({
|
|
23
|
+
isOffline: (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'offline'
|
|
24
|
+
}));
|
|
25
|
+
if (isOffline) {
|
|
26
|
+
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
27
|
+
error: SyncBlockError.Offline
|
|
28
|
+
});
|
|
29
|
+
}
|
|
16
30
|
if (!syncBlockInstance) {
|
|
17
31
|
return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
|
|
18
32
|
}
|
|
19
33
|
if (syncBlockInstance.error || !syncBlockInstance.data) {
|
|
20
|
-
var _syncBlockInstance$er,
|
|
34
|
+
var _syncBlockInstance$er, _api$analytics;
|
|
21
35
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
22
36
|
error: (_syncBlockInstance$er = syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : SyncBlockError.Errored,
|
|
23
|
-
|
|
24
|
-
sourceProduct: (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.product,
|
|
37
|
+
resourceId: syncBlockInstance.resourceId,
|
|
25
38
|
onRetry: reloadData,
|
|
26
|
-
isLoading: isLoading
|
|
39
|
+
isLoading: isLoading,
|
|
40
|
+
fireAnalyticsEvent: api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.fireAnalyticsEvent
|
|
27
41
|
});
|
|
28
42
|
}
|
|
29
43
|
const syncBlockDoc = {
|
|
@@ -4,10 +4,12 @@ import { SyncedBlockRenderer } from './ui/SyncedBlockRenderer';
|
|
|
4
4
|
export var getSyncedBlockRenderer = function getSyncedBlockRenderer(_ref) {
|
|
5
5
|
var syncBlockRendererOptions = _ref.syncBlockRendererOptions;
|
|
6
6
|
return function (_ref2) {
|
|
7
|
-
var useFetchSyncBlockData = _ref2.useFetchSyncBlockData
|
|
7
|
+
var useFetchSyncBlockData = _ref2.useFetchSyncBlockData,
|
|
8
|
+
api = _ref2.api;
|
|
8
9
|
return /*#__PURE__*/React.createElement(SyncedBlockRenderer, {
|
|
9
10
|
syncBlockRendererOptions: syncBlockRendererOptions,
|
|
10
|
-
useFetchSyncBlockData: useFetchSyncBlockData
|
|
11
|
+
useFetchSyncBlockData: useFetchSyncBlockData,
|
|
12
|
+
api: api
|
|
11
13
|
});
|
|
12
14
|
};
|
|
13
15
|
};
|
|
@@ -1,25 +1,43 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
|
+
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
2
3
|
import { SyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
|
|
3
|
-
import { SyncBlockError } from '@atlaskit/editor-synced-block-provider';
|
|
4
|
+
import { fetchErrorPayload, getContentIdAndProductFromResourceId, SyncBlockError } from '@atlaskit/editor-synced-block-provider';
|
|
4
5
|
import { SyncedBlockGenericError } from './SyncedBlockGenericError';
|
|
5
6
|
import { SyncedBlockLoadError } from './SyncedBlockLoadError';
|
|
7
|
+
import { SyncedBlockOfflineError } from './SyncedBlockOfflineError';
|
|
6
8
|
import { SyncedBlockPermissionDenied } from './SyncedBlockPermissionDenied';
|
|
9
|
+
var getForbiddenErrorContent = function getForbiddenErrorContent(resourceId, fireAnalyticsEvent) {
|
|
10
|
+
try {
|
|
11
|
+
if (!resourceId) {
|
|
12
|
+
throw new Error('Missing resource id');
|
|
13
|
+
}
|
|
14
|
+
var _getContentIdAndProdu = getContentIdAndProductFromResourceId(resourceId),
|
|
15
|
+
sourceContentId = _getContentIdAndProdu.sourceContentId,
|
|
16
|
+
sourceProduct = _getContentIdAndProdu.sourceProduct;
|
|
17
|
+
return /*#__PURE__*/React.createElement(SyncedBlockPermissionDenied, {
|
|
18
|
+
sourceContentId: sourceContentId,
|
|
19
|
+
sourceProduct: sourceProduct
|
|
20
|
+
});
|
|
21
|
+
} catch (error) {
|
|
22
|
+
logException(error, {
|
|
23
|
+
location: 'editor-synced-block-renderer/SyncedBlockErrorComponent'
|
|
24
|
+
});
|
|
25
|
+
fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent(fetchErrorPayload(error.message));
|
|
26
|
+
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
7
29
|
export var SyncedBlockErrorComponent = function SyncedBlockErrorComponent(_ref) {
|
|
8
30
|
var error = _ref.error,
|
|
9
31
|
isLoading = _ref.isLoading,
|
|
10
32
|
onRetry = _ref.onRetry,
|
|
11
|
-
|
|
12
|
-
|
|
33
|
+
resourceId = _ref.resourceId,
|
|
34
|
+
fireAnalyticsEvent = _ref.fireAnalyticsEvent;
|
|
13
35
|
var getErrorContent = useMemo(function () {
|
|
14
36
|
switch (error) {
|
|
37
|
+
case SyncBlockError.Offline:
|
|
38
|
+
return /*#__PURE__*/React.createElement(SyncedBlockOfflineError, null);
|
|
15
39
|
case SyncBlockError.Forbidden:
|
|
16
|
-
|
|
17
|
-
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
18
|
-
}
|
|
19
|
-
return /*#__PURE__*/React.createElement(SyncedBlockPermissionDenied, {
|
|
20
|
-
sourceAri: sourceAri,
|
|
21
|
-
sourceProduct: sourceProduct
|
|
22
|
-
});
|
|
40
|
+
return getForbiddenErrorContent(resourceId, fireAnalyticsEvent);
|
|
23
41
|
case SyncBlockError.NotFound:
|
|
24
42
|
case SyncBlockError.Errored:
|
|
25
43
|
case SyncBlockError.RateLimited:
|
|
@@ -31,7 +49,7 @@ export var SyncedBlockErrorComponent = function SyncedBlockErrorComponent(_ref)
|
|
|
31
49
|
default:
|
|
32
50
|
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
33
51
|
}
|
|
34
|
-
}, [error, isLoading, onRetry,
|
|
52
|
+
}, [error, isLoading, onRetry, resourceId, fireAnalyticsEvent]);
|
|
35
53
|
return (
|
|
36
54
|
/*#__PURE__*/
|
|
37
55
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
.
|
|
3
|
-
._zulpu2gc{gap:var(--ds-space-100,8px)}._18u0u2gc{margin-left:var(--ds-space-100,8px)}
|
|
4
|
-
._19bvxy5q{padding-left:var(--ds-space-400,2pc)}
|
|
2
|
+
._zulppxbi{gap:var(--ds-space-200,1pc)}._19bvpxbi{padding-left:var(--ds-space-200,1pc)}
|
|
5
3
|
._1bahv2br{justify-content:start}
|
|
6
4
|
._1e0c1txw{display:flex}
|
|
7
5
|
._4cvr1h6o{align-items:center}
|
|
8
|
-
.
|
|
9
|
-
.
|
|
10
|
-
.
|
|
11
|
-
._u5f3v47k{padding-right:var(--ds-space-250,20px)}
|
|
6
|
+
._ca0qu2gc{padding-top:var(--ds-space-100,8px)}
|
|
7
|
+
._n3tdu2gc{padding-bottom:var(--ds-space-100,8px)}
|
|
8
|
+
._u5f3pxbi{padding-right:var(--ds-space-200,1pc)}
|
|
@@ -2,33 +2,20 @@
|
|
|
2
2
|
import "./SyncedBlockErrorStateCard.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { Box, Stack, Text } from '@atlaskit/primitives/compiled';
|
|
5
|
+
import WarningOutlineIcon from '@atlaskit/icon-lab/core/warning-outline';
|
|
6
|
+
import { Box, Text } from '@atlaskit/primitives/compiled';
|
|
8
7
|
var styles = {
|
|
9
|
-
wrapper: "
|
|
10
|
-
textWrapper: "_18u0u2gc"
|
|
8
|
+
wrapper: "_zulppxbi _ca0qu2gc _n3tdu2gc _19bvpxbi _u5f3pxbi _1e0c1txw _1bahv2br _4cvr1h6o"
|
|
11
9
|
};
|
|
12
10
|
export var SyncedBlockErrorStateCard = function SyncedBlockErrorStateCard(_ref) {
|
|
13
11
|
var children = _ref.children,
|
|
14
|
-
|
|
15
|
-
imageSrc = _ref.imageSrc,
|
|
16
|
-
primaryMessage = _ref.primaryMessage,
|
|
17
|
-
secondaryMessage = _ref.secondaryMessage;
|
|
12
|
+
description = _ref.description;
|
|
18
13
|
return /*#__PURE__*/React.createElement(Box, {
|
|
19
14
|
xcss: styles.wrapper
|
|
20
|
-
}, /*#__PURE__*/React.createElement(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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, {
|
|
15
|
+
}, /*#__PURE__*/React.createElement(WarningOutlineIcon, {
|
|
16
|
+
color: "var(--ds-icon-subtle, #505258)",
|
|
17
|
+
label: ""
|
|
18
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
32
19
|
color: "color.text.subtle"
|
|
33
|
-
},
|
|
20
|
+
}, description), children);
|
|
34
21
|
};
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
3
|
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
|
-
import ExclamationWarning from './assets/ExclamationWarning.svg';
|
|
5
4
|
import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
|
|
6
5
|
export var SyncedBlockGenericError = function SyncedBlockGenericError() {
|
|
7
6
|
var _useIntl = useIntl(),
|
|
8
7
|
formatMessage = _useIntl.formatMessage;
|
|
9
8
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorStateCard, {
|
|
10
|
-
|
|
11
|
-
secondaryMessage: formatMessage(messages.generalErrorDescription)
|
|
9
|
+
description: formatMessage(messages.generalErrorDescription)
|
|
12
10
|
});
|
|
13
11
|
};
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
3
|
import Button from '@atlaskit/button/new';
|
|
4
4
|
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
|
-
import ExclamationWarning from './assets/ExclamationWarning.svg';
|
|
6
5
|
import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
|
|
7
6
|
export var SyncedBlockLoadError = function SyncedBlockLoadError(_ref) {
|
|
8
7
|
var onRetry = _ref.onRetry,
|
|
@@ -10,9 +9,7 @@ export var SyncedBlockLoadError = function SyncedBlockLoadError(_ref) {
|
|
|
10
9
|
var _useIntl = useIntl(),
|
|
11
10
|
formatMessage = _useIntl.formatMessage;
|
|
12
11
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorStateCard, {
|
|
13
|
-
|
|
14
|
-
imageAltText: formatMessage(messages.notFoundAltText),
|
|
15
|
-
secondaryMessage: formatMessage(messages.notFoundDescription)
|
|
12
|
+
description: formatMessage(messages.generalErrorDescription)
|
|
16
13
|
}, onRetry && /*#__PURE__*/React.createElement(Button, {
|
|
17
14
|
appearance: "default",
|
|
18
15
|
spacing: "compact",
|
|
@@ -2,16 +2,23 @@
|
|
|
2
2
|
import "./SyncedBlockLoadingState.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React from 'react';
|
|
5
|
+
import { SyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
|
|
5
6
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
6
7
|
import Spinner from '@atlaskit/spinner';
|
|
7
8
|
var styles = {
|
|
8
|
-
wrapper: "
|
|
9
|
+
wrapper: "_1tkevbgk _1e0c1txw _1bah1h6o _4cvr1h6o"
|
|
9
10
|
};
|
|
10
11
|
export var SyncedBlockLoadingState = function SyncedBlockLoadingState() {
|
|
11
|
-
return
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
return (
|
|
13
|
+
/*#__PURE__*/
|
|
14
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/design-system/no-unsafe-style-overrides
|
|
15
|
+
React.createElement("div", {
|
|
16
|
+
className: SyncBlockSharedCssClassName.loading
|
|
17
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
18
|
+
xcss: styles.wrapper
|
|
19
|
+
}, /*#__PURE__*/React.createElement(Spinner, {
|
|
20
|
+
size: "small",
|
|
21
|
+
label: "Loading synced content"
|
|
22
|
+
})))
|
|
23
|
+
);
|
|
17
24
|
};
|
|
@@ -20,13 +20,13 @@ export var SyncedBlockNodeComponentRenderer = function SyncedBlockNodeComponentR
|
|
|
20
20
|
return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
|
|
21
21
|
}
|
|
22
22
|
if (!resourceId || syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error || !(syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.data)) {
|
|
23
|
-
var _syncBlockInstance$er
|
|
23
|
+
var _syncBlockInstance$er;
|
|
24
24
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
25
25
|
error: (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : SyncBlockError.Errored,
|
|
26
|
-
|
|
27
|
-
sourceProduct: syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.product,
|
|
26
|
+
resourceId: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.resourceId,
|
|
28
27
|
onRetry: reloadData,
|
|
29
|
-
isLoading: isLoading
|
|
28
|
+
isLoading: isLoading,
|
|
29
|
+
fireAnalyticsEvent: fireAnalyticsEvent
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
var syncBlockDoc = {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl-next';
|
|
3
|
+
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
|
|
5
|
+
export var SyncedBlockOfflineError = function SyncedBlockOfflineError() {
|
|
6
|
+
var _useIntl = useIntl(),
|
|
7
|
+
formatMessage = _useIntl.formatMessage;
|
|
8
|
+
return /*#__PURE__*/React.createElement(SyncedBlockErrorStateCard, {
|
|
9
|
+
description: formatMessage(messages.offlineError)
|
|
10
|
+
});
|
|
11
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
|
|
2
|
+
._zulppxbi{gap:var(--ds-space-200,1pc)}._19bvv47k{padding-left:var(--ds-space-250,20px)}
|
|
3
|
+
._1bahv2br{justify-content:start}
|
|
4
|
+
._1e0c1txw{display:flex}
|
|
5
|
+
._4cvr1h6o{align-items:center}
|
|
6
|
+
._ca0qv47k{padding-top:var(--ds-space-250,20px)}
|
|
7
|
+
._n3tdv47k{padding-bottom:var(--ds-space-250,20px)}
|
|
8
|
+
._u5f3v47k{padding-right:var(--ds-space-250,20px)}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
+
/* SyncedBlockPermissionDenied.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import "./SyncedBlockPermissionDenied.compiled.css";
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
2
5
|
import _SyncedBlockPermissionDeniedRequestAccessMutation from "./__generated__/SyncedBlockPermissionDeniedRequestAccessMutation.graphql";
|
|
3
6
|
import React, { useState } from 'react';
|
|
4
7
|
import { useIntl } from 'react-intl-next';
|
|
5
8
|
import { useMutation, graphql } from 'react-relay';
|
|
6
9
|
import Button from '@atlaskit/button/new';
|
|
7
10
|
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
8
|
-
import
|
|
11
|
+
import Heading from '@atlaskit/heading';
|
|
9
12
|
import StatusSuccessIcon from '@atlaskit/icon/core/status-success';
|
|
10
|
-
import
|
|
13
|
+
import Image from '@atlaskit/image';
|
|
14
|
+
import { Text, Flex, Stack, Box } from '@atlaskit/primitives/compiled';
|
|
11
15
|
import PermissionDenied from './assets/PermissionDenied.svg';
|
|
12
|
-
import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
|
|
13
16
|
import { SyncedBlockGenericError } from './SyncedBlockGenericError';
|
|
17
|
+
var styles = {
|
|
18
|
+
wrapper: "_zulppxbi _ca0qv47k _n3tdv47k _19bvv47k _u5f3v47k _1e0c1txw _1bahv2br _4cvr1h6o"
|
|
19
|
+
};
|
|
14
20
|
var RequestAccessState = /*#__PURE__*/function (RequestAccessState) {
|
|
15
21
|
RequestAccessState["default"] = "default";
|
|
16
22
|
RequestAccessState["errored"] = "errored";
|
|
@@ -19,8 +25,7 @@ var RequestAccessState = /*#__PURE__*/function (RequestAccessState) {
|
|
|
19
25
|
return RequestAccessState;
|
|
20
26
|
}(RequestAccessState || {});
|
|
21
27
|
var SyncedBlockPermissionDeniedConfluencePage = function SyncedBlockPermissionDeniedConfluencePage(_ref) {
|
|
22
|
-
var
|
|
23
|
-
var contentId = getPageIdAndTypeFromConfluencePageAri(sourceAri).id;
|
|
28
|
+
var sourceContentId = _ref.sourceContentId;
|
|
24
29
|
var _useIntl = useIntl(),
|
|
25
30
|
formatMessage = _useIntl.formatMessage;
|
|
26
31
|
var _useState = useState(RequestAccessState.default),
|
|
@@ -41,7 +46,7 @@ var SyncedBlockPermissionDeniedConfluencePage = function SyncedBlockPermissionDe
|
|
|
41
46
|
commitMutation({
|
|
42
47
|
variables: {
|
|
43
48
|
requestPageAccessInput: {
|
|
44
|
-
pageId:
|
|
49
|
+
pageId: sourceContentId,
|
|
45
50
|
accessType: 'VIEW'
|
|
46
51
|
}
|
|
47
52
|
},
|
|
@@ -51,12 +56,20 @@ var SyncedBlockPermissionDeniedConfluencePage = function SyncedBlockPermissionDe
|
|
|
51
56
|
onError: handleRequestError
|
|
52
57
|
});
|
|
53
58
|
};
|
|
54
|
-
return /*#__PURE__*/React.createElement(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
60
|
+
xcss: styles.wrapper
|
|
61
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
62
|
+
src: PermissionDenied,
|
|
63
|
+
alt: formatMessage(messages.permissionDeniedAltText),
|
|
64
|
+
width: "48",
|
|
65
|
+
height: "48"
|
|
66
|
+
}), /*#__PURE__*/React.createElement(Stack, {
|
|
67
|
+
space: "space.100"
|
|
68
|
+
}, /*#__PURE__*/React.createElement(Heading, {
|
|
69
|
+
size: "xsmall"
|
|
70
|
+
}, formatMessage(messages.permissionDeniedHeading)), /*#__PURE__*/React.createElement(Text, {
|
|
71
|
+
color: "color.text.subtle"
|
|
72
|
+
}, formatMessage(messages.permissionDeniedDescription)), requestAccessState === RequestAccessState.pending ? /*#__PURE__*/React.createElement(Flex, {
|
|
60
73
|
columnGap: "space.050",
|
|
61
74
|
alignItems: "center"
|
|
62
75
|
}, /*#__PURE__*/React.createElement(StatusSuccessIcon, {
|
|
@@ -79,15 +92,15 @@ var SyncedBlockPermissionDeniedConfluencePage = function SyncedBlockPermissionDe
|
|
|
79
92
|
}, formatMessage(messages.requestAccessButton)), requestAccessState === RequestAccessState.errored && /*#__PURE__*/React.createElement(Text, {
|
|
80
93
|
color: "color.text.warning",
|
|
81
94
|
testId: "sync-block-access-error-msg"
|
|
82
|
-
}, formatMessage(messages.requestAccessError))));
|
|
95
|
+
}, formatMessage(messages.requestAccessError)))));
|
|
83
96
|
};
|
|
84
97
|
export var SyncedBlockPermissionDenied = function SyncedBlockPermissionDenied(_ref2) {
|
|
85
|
-
var
|
|
98
|
+
var sourceContentId = _ref2.sourceContentId,
|
|
86
99
|
sourceProduct = _ref2.sourceProduct;
|
|
87
100
|
switch (sourceProduct) {
|
|
88
101
|
case 'confluence-page':
|
|
89
102
|
return /*#__PURE__*/React.createElement(SyncedBlockPermissionDeniedConfluencePage, {
|
|
90
|
-
|
|
103
|
+
sourceContentId: sourceContentId
|
|
91
104
|
});
|
|
92
105
|
default:
|
|
93
106
|
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|