@atlaskit/editor-synced-block-renderer 5.6.3 → 5.6.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 +8 -0
- package/afm-jira/tsconfig.json +3 -0
- package/afm-products/tsconfig.json +3 -0
- package/dist/cjs/ui/SyncedBlockErrorComponent.js +8 -2
- package/dist/cjs/ui/SyncedBlockNodeComponentRenderer.js +12 -0
- package/dist/cjs/ui/SyncedBlockRenderer.js +14 -0
- package/dist/cjs/ui/SyncedBlockUnpublishedError.compiled.css +3 -0
- package/dist/cjs/ui/SyncedBlockUnpublishedError.js +37 -0
- package/dist/es2019/ui/SyncedBlockErrorComponent.js +8 -2
- package/dist/es2019/ui/SyncedBlockNodeComponentRenderer.js +12 -0
- package/dist/es2019/ui/SyncedBlockRenderer.js +14 -0
- package/dist/es2019/ui/SyncedBlockUnpublishedError.compiled.css +3 -0
- package/dist/es2019/ui/SyncedBlockUnpublishedError.js +30 -0
- package/dist/esm/ui/SyncedBlockErrorComponent.js +8 -2
- package/dist/esm/ui/SyncedBlockNodeComponentRenderer.js +12 -0
- package/dist/esm/ui/SyncedBlockRenderer.js +14 -0
- package/dist/esm/ui/SyncedBlockUnpublishedError.compiled.css +3 -0
- package/dist/esm/ui/SyncedBlockUnpublishedError.js +30 -0
- package/dist/types/ui/SyncedBlockErrorComponent.d.ts +2 -1
- package/dist/types/ui/SyncedBlockUnpublishedError.d.ts +4 -0
- package/dist/types-ts4.5/ui/SyncedBlockErrorComponent.d.ts +2 -1
- package/dist/types-ts4.5/ui/SyncedBlockUnpublishedError.d.ts +4 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-synced-block-renderer
|
|
2
2
|
|
|
3
|
+
## 5.6.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`faddbf566c913`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/faddbf566c913) -
|
|
8
|
+
[ux] Add error message in reference sync block when source is unpublished
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 5.6.3
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/afm-jira/tsconfig.json
CHANGED
|
@@ -14,6 +14,7 @@ var _SyncedBlockLoadError = require("./SyncedBlockLoadError");
|
|
|
14
14
|
var _SyncedBlockNotFoundError = require("./SyncedBlockNotFoundError");
|
|
15
15
|
var _SyncedBlockOfflineError = require("./SyncedBlockOfflineError");
|
|
16
16
|
var _SyncedBlockPermissionDenied = require("./SyncedBlockPermissionDenied");
|
|
17
|
+
var _SyncedBlockUnpublishedError = require("./SyncedBlockUnpublishedError");
|
|
17
18
|
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); }
|
|
18
19
|
var getForbiddenErrorContent = function getForbiddenErrorContent(resourceId, fireAnalyticsEvent) {
|
|
19
20
|
try {
|
|
@@ -40,7 +41,8 @@ var SyncedBlockErrorComponent = exports.SyncedBlockErrorComponent = function Syn
|
|
|
40
41
|
isLoading = _ref.isLoading,
|
|
41
42
|
onRetry = _ref.onRetry,
|
|
42
43
|
resourceId = _ref.resourceId,
|
|
43
|
-
fireAnalyticsEvent = _ref.fireAnalyticsEvent
|
|
44
|
+
fireAnalyticsEvent = _ref.fireAnalyticsEvent,
|
|
45
|
+
sourceURL = _ref.sourceURL;
|
|
44
46
|
var getErrorContent = (0, _react.useMemo)(function () {
|
|
45
47
|
switch (error === null || error === void 0 ? void 0 : error.type) {
|
|
46
48
|
case _editorSyncedBlockProvider.SyncBlockError.Offline:
|
|
@@ -52,6 +54,10 @@ var SyncedBlockErrorComponent = exports.SyncedBlockErrorComponent = function Syn
|
|
|
52
54
|
reason: error.reason,
|
|
53
55
|
sourceAri: error.sourceAri
|
|
54
56
|
});
|
|
57
|
+
case _editorSyncedBlockProvider.SyncBlockError.Unpublished:
|
|
58
|
+
return /*#__PURE__*/_react.default.createElement(_SyncedBlockUnpublishedError.SyncedBlockUnpublishedError, {
|
|
59
|
+
sourceURL: sourceURL
|
|
60
|
+
});
|
|
55
61
|
case _editorSyncedBlockProvider.SyncBlockError.Errored:
|
|
56
62
|
case _editorSyncedBlockProvider.SyncBlockError.RateLimited:
|
|
57
63
|
case _editorSyncedBlockProvider.SyncBlockError.ServerError:
|
|
@@ -62,7 +68,7 @@ var SyncedBlockErrorComponent = exports.SyncedBlockErrorComponent = function Syn
|
|
|
62
68
|
default:
|
|
63
69
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockGenericError.SyncedBlockGenericError, null);
|
|
64
70
|
}
|
|
65
|
-
}, [error, isLoading, onRetry, resourceId, fireAnalyticsEvent]);
|
|
71
|
+
}, [error, isLoading, onRetry, resourceId, fireAnalyticsEvent, sourceURL]);
|
|
66
72
|
return (
|
|
67
73
|
/*#__PURE__*/
|
|
68
74
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
@@ -20,6 +20,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
20
20
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
21
21
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
22
22
|
var SyncedBlockNodeComponentRenderer = exports.SyncedBlockNodeComponentRenderer = function SyncedBlockNodeComponentRenderer(_ref) {
|
|
23
|
+
var _syncBlockInstance$da2;
|
|
23
24
|
var nodeProps = _ref.nodeProps,
|
|
24
25
|
syncBlockStoreManager = _ref.syncBlockStoreManager,
|
|
25
26
|
rendererOptions = _ref.rendererOptions;
|
|
@@ -73,6 +74,17 @@ var SyncedBlockNodeComponentRenderer = exports.SyncedBlockNodeComponentRenderer
|
|
|
73
74
|
fireAnalyticsEvent: fireAnalyticsEvent
|
|
74
75
|
});
|
|
75
76
|
}
|
|
77
|
+
if ((syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.status) === 'unpublished' && (0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding')) {
|
|
78
|
+
var _syncBlockInstance$da3;
|
|
79
|
+
return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
|
|
80
|
+
error: {
|
|
81
|
+
type: _editorSyncedBlockProvider.SyncBlockError.Unpublished
|
|
82
|
+
},
|
|
83
|
+
resourceId: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.resourceId,
|
|
84
|
+
sourceURL: (_syncBlockInstance$da3 = syncBlockInstance.data) === null || _syncBlockInstance$da3 === void 0 ? void 0 : _syncBlockInstance$da3.sourceURL,
|
|
85
|
+
fireAnalyticsEvent: fireAnalyticsEvent
|
|
86
|
+
});
|
|
87
|
+
}
|
|
76
88
|
var syncBlockDoc = {
|
|
77
89
|
content: syncBlockInstance.data.content,
|
|
78
90
|
version: 1,
|
|
@@ -19,6 +19,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
19
19
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
20
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
21
|
var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
|
|
22
|
+
var _syncBlockInstance$da2;
|
|
22
23
|
var syncBlockRendererOptions = _ref.syncBlockRendererOptions,
|
|
23
24
|
syncBlockFetchResult = _ref.syncBlockFetchResult,
|
|
24
25
|
api = _ref.api;
|
|
@@ -84,6 +85,19 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
|
|
|
84
85
|
fireAnalyticsEvent: api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.fireAnalyticsEvent
|
|
85
86
|
});
|
|
86
87
|
}
|
|
88
|
+
|
|
89
|
+
// Check for unpublished status
|
|
90
|
+
if (((_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.status) === 'unpublished' && (0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding')) {
|
|
91
|
+
var _syncBlockInstance$da3, _api$analytics2;
|
|
92
|
+
return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
|
|
93
|
+
error: {
|
|
94
|
+
type: _editorSyncedBlockProvider.SyncBlockError.Unpublished
|
|
95
|
+
},
|
|
96
|
+
resourceId: syncBlockInstance.resourceId,
|
|
97
|
+
sourceURL: (_syncBlockInstance$da3 = syncBlockInstance.data) === null || _syncBlockInstance$da3 === void 0 ? void 0 : _syncBlockInstance$da3.sourceURL,
|
|
98
|
+
fireAnalyticsEvent: api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.fireAnalyticsEvent
|
|
99
|
+
});
|
|
100
|
+
}
|
|
87
101
|
var syncBlockDoc = {
|
|
88
102
|
content: syncBlockInstance.data.content,
|
|
89
103
|
version: 1,
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* SyncedBlockUnpublishedError.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.SyncedBlockUnpublishedError = void 0;
|
|
9
|
+
require("./SyncedBlockUnpublishedError.compiled.css");
|
|
10
|
+
var _runtime = require("@compiled/react/runtime");
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _reactIntlNext = require("react-intl-next");
|
|
13
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
14
|
+
var _eyeOpenStrikethrough = _interopRequireDefault(require("@atlaskit/icon/core/eye-open-strikethrough"));
|
|
15
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
16
|
+
var _SyncedBlockErrorStateCard = require("./SyncedBlockErrorStateCard");
|
|
17
|
+
var styles = {
|
|
18
|
+
link: "_4bfu1r31 _1hmsglyw _ajmmnqa1"
|
|
19
|
+
};
|
|
20
|
+
var SyncedBlockUnpublishedError = exports.SyncedBlockUnpublishedError = function SyncedBlockUnpublishedError(_ref) {
|
|
21
|
+
var sourceURL = _ref.sourceURL;
|
|
22
|
+
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
23
|
+
formatMessage = _useIntl.formatMessage;
|
|
24
|
+
var description = formatMessage(_messages.syncBlockMessages.unpublishedError, {
|
|
25
|
+
link: function link(chunks) {
|
|
26
|
+
return sourceURL ? /*#__PURE__*/_react.default.createElement(_compiled.Text, null, /*#__PURE__*/_react.default.createElement(_compiled.Anchor, {
|
|
27
|
+
href: sourceURL,
|
|
28
|
+
target: "_blank",
|
|
29
|
+
xcss: styles.link
|
|
30
|
+
}, chunks)) : chunks;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorStateCard.SyncedBlockErrorStateCard, {
|
|
34
|
+
description: description,
|
|
35
|
+
icon: _eyeOpenStrikethrough.default
|
|
36
|
+
});
|
|
37
|
+
};
|
|
@@ -7,6 +7,7 @@ import { SyncedBlockLoadError } from './SyncedBlockLoadError';
|
|
|
7
7
|
import { SyncedBlockNotFoundError } from './SyncedBlockNotFoundError';
|
|
8
8
|
import { SyncedBlockOfflineError } from './SyncedBlockOfflineError';
|
|
9
9
|
import { SyncedBlockPermissionDenied } from './SyncedBlockPermissionDenied';
|
|
10
|
+
import { SyncedBlockUnpublishedError } from './SyncedBlockUnpublishedError';
|
|
10
11
|
const getForbiddenErrorContent = (resourceId, fireAnalyticsEvent) => {
|
|
11
12
|
try {
|
|
12
13
|
if (!resourceId) {
|
|
@@ -33,7 +34,8 @@ export const SyncedBlockErrorComponent = ({
|
|
|
33
34
|
isLoading,
|
|
34
35
|
onRetry,
|
|
35
36
|
resourceId,
|
|
36
|
-
fireAnalyticsEvent
|
|
37
|
+
fireAnalyticsEvent,
|
|
38
|
+
sourceURL
|
|
37
39
|
}) => {
|
|
38
40
|
const getErrorContent = useMemo(() => {
|
|
39
41
|
switch (error === null || error === void 0 ? void 0 : error.type) {
|
|
@@ -46,6 +48,10 @@ export const SyncedBlockErrorComponent = ({
|
|
|
46
48
|
reason: error.reason,
|
|
47
49
|
sourceAri: error.sourceAri
|
|
48
50
|
});
|
|
51
|
+
case SyncBlockError.Unpublished:
|
|
52
|
+
return /*#__PURE__*/React.createElement(SyncedBlockUnpublishedError, {
|
|
53
|
+
sourceURL: sourceURL
|
|
54
|
+
});
|
|
49
55
|
case SyncBlockError.Errored:
|
|
50
56
|
case SyncBlockError.RateLimited:
|
|
51
57
|
case SyncBlockError.ServerError:
|
|
@@ -56,7 +62,7 @@ export const SyncedBlockErrorComponent = ({
|
|
|
56
62
|
default:
|
|
57
63
|
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
58
64
|
}
|
|
59
|
-
}, [error, isLoading, onRetry, resourceId, fireAnalyticsEvent]);
|
|
65
|
+
}, [error, isLoading, onRetry, resourceId, fireAnalyticsEvent, sourceURL]);
|
|
60
66
|
return (
|
|
61
67
|
/*#__PURE__*/
|
|
62
68
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
@@ -11,6 +11,7 @@ export const SyncedBlockNodeComponentRenderer = ({
|
|
|
11
11
|
syncBlockStoreManager,
|
|
12
12
|
rendererOptions
|
|
13
13
|
}) => {
|
|
14
|
+
var _syncBlockInstance$da2;
|
|
14
15
|
const {
|
|
15
16
|
resourceId,
|
|
16
17
|
localId,
|
|
@@ -66,6 +67,17 @@ export const SyncedBlockNodeComponentRenderer = ({
|
|
|
66
67
|
fireAnalyticsEvent: fireAnalyticsEvent
|
|
67
68
|
});
|
|
68
69
|
}
|
|
70
|
+
if ((syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.status) === 'unpublished' && fg('platform_synced_block_dogfooding')) {
|
|
71
|
+
var _syncBlockInstance$da3;
|
|
72
|
+
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
73
|
+
error: {
|
|
74
|
+
type: SyncBlockError.Unpublished
|
|
75
|
+
},
|
|
76
|
+
resourceId: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.resourceId,
|
|
77
|
+
sourceURL: (_syncBlockInstance$da3 = syncBlockInstance.data) === null || _syncBlockInstance$da3 === void 0 ? void 0 : _syncBlockInstance$da3.sourceURL,
|
|
78
|
+
fireAnalyticsEvent: fireAnalyticsEvent
|
|
79
|
+
});
|
|
80
|
+
}
|
|
69
81
|
const syncBlockDoc = {
|
|
70
82
|
content: syncBlockInstance.data.content,
|
|
71
83
|
version: 1,
|
|
@@ -11,6 +11,7 @@ const SyncedBlockRendererComponent = ({
|
|
|
11
11
|
syncBlockFetchResult,
|
|
12
12
|
api
|
|
13
13
|
}) => {
|
|
14
|
+
var _syncBlockInstance$da2;
|
|
14
15
|
const {
|
|
15
16
|
isLoading,
|
|
16
17
|
providerFactory,
|
|
@@ -77,6 +78,19 @@ const SyncedBlockRendererComponent = ({
|
|
|
77
78
|
fireAnalyticsEvent: api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.fireAnalyticsEvent
|
|
78
79
|
});
|
|
79
80
|
}
|
|
81
|
+
|
|
82
|
+
// Check for unpublished status
|
|
83
|
+
if (((_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.status) === 'unpublished' && fg('platform_synced_block_dogfooding')) {
|
|
84
|
+
var _syncBlockInstance$da3, _api$analytics2;
|
|
85
|
+
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
86
|
+
error: {
|
|
87
|
+
type: SyncBlockError.Unpublished
|
|
88
|
+
},
|
|
89
|
+
resourceId: syncBlockInstance.resourceId,
|
|
90
|
+
sourceURL: (_syncBlockInstance$da3 = syncBlockInstance.data) === null || _syncBlockInstance$da3 === void 0 ? void 0 : _syncBlockInstance$da3.sourceURL,
|
|
91
|
+
fireAnalyticsEvent: api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.fireAnalyticsEvent
|
|
92
|
+
});
|
|
93
|
+
}
|
|
80
94
|
const syncBlockDoc = {
|
|
81
95
|
content: syncBlockInstance.data.content,
|
|
82
96
|
version: 1,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* SyncedBlockUnpublishedError.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
+
import "./SyncedBlockUnpublishedError.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { useIntl } from 'react-intl-next';
|
|
6
|
+
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
+
import EyeOpenStrikethroughIcon from '@atlaskit/icon/core/eye-open-strikethrough';
|
|
8
|
+
import { Anchor, Text } from '@atlaskit/primitives/compiled';
|
|
9
|
+
import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
|
|
10
|
+
const styles = {
|
|
11
|
+
link: "_4bfu1r31 _1hmsglyw _ajmmnqa1"
|
|
12
|
+
};
|
|
13
|
+
export const SyncedBlockUnpublishedError = ({
|
|
14
|
+
sourceURL
|
|
15
|
+
}) => {
|
|
16
|
+
const {
|
|
17
|
+
formatMessage
|
|
18
|
+
} = useIntl();
|
|
19
|
+
const description = formatMessage(messages.unpublishedError, {
|
|
20
|
+
link: chunks => sourceURL ? /*#__PURE__*/React.createElement(Text, null, /*#__PURE__*/React.createElement(Anchor, {
|
|
21
|
+
href: sourceURL,
|
|
22
|
+
target: "_blank",
|
|
23
|
+
xcss: styles.link
|
|
24
|
+
}, chunks)) : chunks
|
|
25
|
+
});
|
|
26
|
+
return /*#__PURE__*/React.createElement(SyncedBlockErrorStateCard, {
|
|
27
|
+
description: description,
|
|
28
|
+
icon: EyeOpenStrikethroughIcon
|
|
29
|
+
});
|
|
30
|
+
};
|
|
@@ -7,6 +7,7 @@ import { SyncedBlockLoadError } from './SyncedBlockLoadError';
|
|
|
7
7
|
import { SyncedBlockNotFoundError } from './SyncedBlockNotFoundError';
|
|
8
8
|
import { SyncedBlockOfflineError } from './SyncedBlockOfflineError';
|
|
9
9
|
import { SyncedBlockPermissionDenied } from './SyncedBlockPermissionDenied';
|
|
10
|
+
import { SyncedBlockUnpublishedError } from './SyncedBlockUnpublishedError';
|
|
10
11
|
var getForbiddenErrorContent = function getForbiddenErrorContent(resourceId, fireAnalyticsEvent) {
|
|
11
12
|
try {
|
|
12
13
|
if (!resourceId) {
|
|
@@ -32,7 +33,8 @@ export var SyncedBlockErrorComponent = function SyncedBlockErrorComponent(_ref)
|
|
|
32
33
|
isLoading = _ref.isLoading,
|
|
33
34
|
onRetry = _ref.onRetry,
|
|
34
35
|
resourceId = _ref.resourceId,
|
|
35
|
-
fireAnalyticsEvent = _ref.fireAnalyticsEvent
|
|
36
|
+
fireAnalyticsEvent = _ref.fireAnalyticsEvent,
|
|
37
|
+
sourceURL = _ref.sourceURL;
|
|
36
38
|
var getErrorContent = useMemo(function () {
|
|
37
39
|
switch (error === null || error === void 0 ? void 0 : error.type) {
|
|
38
40
|
case SyncBlockError.Offline:
|
|
@@ -44,6 +46,10 @@ export var SyncedBlockErrorComponent = function SyncedBlockErrorComponent(_ref)
|
|
|
44
46
|
reason: error.reason,
|
|
45
47
|
sourceAri: error.sourceAri
|
|
46
48
|
});
|
|
49
|
+
case SyncBlockError.Unpublished:
|
|
50
|
+
return /*#__PURE__*/React.createElement(SyncedBlockUnpublishedError, {
|
|
51
|
+
sourceURL: sourceURL
|
|
52
|
+
});
|
|
47
53
|
case SyncBlockError.Errored:
|
|
48
54
|
case SyncBlockError.RateLimited:
|
|
49
55
|
case SyncBlockError.ServerError:
|
|
@@ -54,7 +60,7 @@ export var SyncedBlockErrorComponent = function SyncedBlockErrorComponent(_ref)
|
|
|
54
60
|
default:
|
|
55
61
|
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
56
62
|
}
|
|
57
|
-
}, [error, isLoading, onRetry, resourceId, fireAnalyticsEvent]);
|
|
63
|
+
}, [error, isLoading, onRetry, resourceId, fireAnalyticsEvent, sourceURL]);
|
|
58
64
|
return (
|
|
59
65
|
/*#__PURE__*/
|
|
60
66
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
@@ -11,6 +11,7 @@ import { AKRendererWrapper } from './AKRendererWrapper';
|
|
|
11
11
|
import { SyncedBlockErrorComponent } from './SyncedBlockErrorComponent';
|
|
12
12
|
import { SyncedBlockLoadingState } from './SyncedBlockLoadingState';
|
|
13
13
|
export var SyncedBlockNodeComponentRenderer = function SyncedBlockNodeComponentRenderer(_ref) {
|
|
14
|
+
var _syncBlockInstance$da2;
|
|
14
15
|
var nodeProps = _ref.nodeProps,
|
|
15
16
|
syncBlockStoreManager = _ref.syncBlockStoreManager,
|
|
16
17
|
rendererOptions = _ref.rendererOptions;
|
|
@@ -64,6 +65,17 @@ export var SyncedBlockNodeComponentRenderer = function SyncedBlockNodeComponentR
|
|
|
64
65
|
fireAnalyticsEvent: fireAnalyticsEvent
|
|
65
66
|
});
|
|
66
67
|
}
|
|
68
|
+
if ((syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.status) === 'unpublished' && fg('platform_synced_block_dogfooding')) {
|
|
69
|
+
var _syncBlockInstance$da3;
|
|
70
|
+
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
71
|
+
error: {
|
|
72
|
+
type: SyncBlockError.Unpublished
|
|
73
|
+
},
|
|
74
|
+
resourceId: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.resourceId,
|
|
75
|
+
sourceURL: (_syncBlockInstance$da3 = syncBlockInstance.data) === null || _syncBlockInstance$da3 === void 0 ? void 0 : _syncBlockInstance$da3.sourceURL,
|
|
76
|
+
fireAnalyticsEvent: fireAnalyticsEvent
|
|
77
|
+
});
|
|
78
|
+
}
|
|
67
79
|
var syncBlockDoc = {
|
|
68
80
|
content: syncBlockInstance.data.content,
|
|
69
81
|
version: 1,
|
|
@@ -10,6 +10,7 @@ import { AKRendererWrapper } from './AKRendererWrapper';
|
|
|
10
10
|
import { SyncedBlockErrorComponent } from './SyncedBlockErrorComponent';
|
|
11
11
|
import { SyncedBlockLoadingState } from './SyncedBlockLoadingState';
|
|
12
12
|
var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
|
|
13
|
+
var _syncBlockInstance$da2;
|
|
13
14
|
var syncBlockRendererOptions = _ref.syncBlockRendererOptions,
|
|
14
15
|
syncBlockFetchResult = _ref.syncBlockFetchResult,
|
|
15
16
|
api = _ref.api;
|
|
@@ -75,6 +76,19 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
|
|
|
75
76
|
fireAnalyticsEvent: api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.fireAnalyticsEvent
|
|
76
77
|
});
|
|
77
78
|
}
|
|
79
|
+
|
|
80
|
+
// Check for unpublished status
|
|
81
|
+
if (((_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.status) === 'unpublished' && fg('platform_synced_block_dogfooding')) {
|
|
82
|
+
var _syncBlockInstance$da3, _api$analytics2;
|
|
83
|
+
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
84
|
+
error: {
|
|
85
|
+
type: SyncBlockError.Unpublished
|
|
86
|
+
},
|
|
87
|
+
resourceId: syncBlockInstance.resourceId,
|
|
88
|
+
sourceURL: (_syncBlockInstance$da3 = syncBlockInstance.data) === null || _syncBlockInstance$da3 === void 0 ? void 0 : _syncBlockInstance$da3.sourceURL,
|
|
89
|
+
fireAnalyticsEvent: api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.fireAnalyticsEvent
|
|
90
|
+
});
|
|
91
|
+
}
|
|
78
92
|
var syncBlockDoc = {
|
|
79
93
|
content: syncBlockInstance.data.content,
|
|
80
94
|
version: 1,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* SyncedBlockUnpublishedError.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
+
import "./SyncedBlockUnpublishedError.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { useIntl } from 'react-intl-next';
|
|
6
|
+
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
+
import EyeOpenStrikethroughIcon from '@atlaskit/icon/core/eye-open-strikethrough';
|
|
8
|
+
import { Anchor, Text } from '@atlaskit/primitives/compiled';
|
|
9
|
+
import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
|
|
10
|
+
var styles = {
|
|
11
|
+
link: "_4bfu1r31 _1hmsglyw _ajmmnqa1"
|
|
12
|
+
};
|
|
13
|
+
export var SyncedBlockUnpublishedError = function SyncedBlockUnpublishedError(_ref) {
|
|
14
|
+
var sourceURL = _ref.sourceURL;
|
|
15
|
+
var _useIntl = useIntl(),
|
|
16
|
+
formatMessage = _useIntl.formatMessage;
|
|
17
|
+
var description = formatMessage(messages.unpublishedError, {
|
|
18
|
+
link: function link(chunks) {
|
|
19
|
+
return sourceURL ? /*#__PURE__*/React.createElement(Text, null, /*#__PURE__*/React.createElement(Anchor, {
|
|
20
|
+
href: sourceURL,
|
|
21
|
+
target: "_blank",
|
|
22
|
+
xcss: styles.link
|
|
23
|
+
}, chunks)) : chunks;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
return /*#__PURE__*/React.createElement(SyncedBlockErrorStateCard, {
|
|
27
|
+
description: description,
|
|
28
|
+
icon: EyeOpenStrikethroughIcon
|
|
29
|
+
});
|
|
30
|
+
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { type SyncBlockInstance } from '@atlaskit/editor-synced-block-provider';
|
|
4
|
-
export declare const SyncedBlockErrorComponent: ({ error, isLoading, onRetry, resourceId, fireAnalyticsEvent, }: {
|
|
4
|
+
export declare const SyncedBlockErrorComponent: ({ error, isLoading, onRetry, resourceId, fireAnalyticsEvent, sourceURL, }: {
|
|
5
5
|
error: SyncBlockInstance["error"];
|
|
6
6
|
fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void;
|
|
7
7
|
isLoading?: boolean;
|
|
8
8
|
onRetry?: () => void;
|
|
9
9
|
resourceId?: string;
|
|
10
|
+
sourceURL?: string;
|
|
10
11
|
}) => React.JSX.Element;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { type SyncBlockInstance } from '@atlaskit/editor-synced-block-provider';
|
|
4
|
-
export declare const SyncedBlockErrorComponent: ({ error, isLoading, onRetry, resourceId, fireAnalyticsEvent, }: {
|
|
4
|
+
export declare const SyncedBlockErrorComponent: ({ error, isLoading, onRetry, resourceId, fireAnalyticsEvent, sourceURL, }: {
|
|
5
5
|
error: SyncBlockInstance["error"];
|
|
6
6
|
fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void;
|
|
7
7
|
isLoading?: boolean;
|
|
8
8
|
onRetry?: () => void;
|
|
9
9
|
resourceId?: string;
|
|
10
|
+
sourceURL?: string;
|
|
10
11
|
}) => React.JSX.Element;
|