@atlaskit/editor-synced-block-renderer 8.1.1 → 8.2.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 +20 -0
- package/dist/cjs/getSyncedBlockRenderer.js +4 -2
- package/dist/cjs/ui/SyncedBlockErrorComponent.js +8 -5
- package/dist/cjs/ui/SyncedBlockNodeComponentRenderer.js +4 -2
- package/dist/cjs/ui/SyncedBlockPermissionDenied.js +93 -2
- package/dist/cjs/ui/SyncedBlockRenderer.js +4 -2
- package/dist/cjs/ui/renderSyncedBlockContent.js +6 -3
- package/dist/cjs/useSyncedBlockNodeComponent.js +4 -2
- package/dist/es2019/getSyncedBlockRenderer.js +4 -2
- package/dist/es2019/ui/SyncedBlockErrorComponent.js +8 -5
- package/dist/es2019/ui/SyncedBlockNodeComponentRenderer.js +4 -2
- package/dist/es2019/ui/SyncedBlockPermissionDenied.js +77 -2
- package/dist/es2019/ui/SyncedBlockRenderer.js +4 -2
- package/dist/es2019/ui/renderSyncedBlockContent.js +6 -3
- package/dist/es2019/useSyncedBlockNodeComponent.js +4 -2
- package/dist/esm/getSyncedBlockRenderer.js +4 -2
- package/dist/esm/ui/SyncedBlockErrorComponent.js +8 -5
- package/dist/esm/ui/SyncedBlockNodeComponentRenderer.js +4 -2
- package/dist/esm/ui/SyncedBlockPermissionDenied.js +94 -3
- package/dist/esm/ui/SyncedBlockRenderer.js +4 -2
- package/dist/esm/ui/renderSyncedBlockContent.js +6 -3
- package/dist/esm/useSyncedBlockNodeComponent.js +4 -2
- package/dist/types/getSyncedBlockRenderer.d.ts +2 -1
- package/dist/types/ui/SyncedBlockErrorComponent.d.ts +2 -1
- package/dist/types/ui/SyncedBlockNodeComponentRenderer.d.ts +2 -1
- package/dist/types/ui/SyncedBlockPermissionDenied.d.ts +2 -1
- package/dist/types/ui/SyncedBlockRenderer.d.ts +2 -1
- package/dist/types/ui/renderSyncedBlockContent.d.ts +2 -1
- package/dist/types/useSyncedBlockNodeComponent.d.ts +2 -1
- package/dist/types-ts4.5/getSyncedBlockRenderer.d.ts +2 -1
- package/dist/types-ts4.5/ui/SyncedBlockErrorComponent.d.ts +2 -1
- package/dist/types-ts4.5/ui/SyncedBlockNodeComponentRenderer.d.ts +2 -1
- package/dist/types-ts4.5/ui/SyncedBlockPermissionDenied.d.ts +2 -1
- package/dist/types-ts4.5/ui/SyncedBlockRenderer.d.ts +2 -1
- package/dist/types-ts4.5/ui/renderSyncedBlockContent.d.ts +2 -1
- package/dist/types-ts4.5/useSyncedBlockNodeComponent.d.ts +2 -1
- package/package.json +10 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-synced-block-renderer
|
|
2
2
|
|
|
3
|
+
## 8.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`717df2cfeca9e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/717df2cfeca9e) -
|
|
8
|
+
[ux] Pass accountId to SyncedBlockRenderer from Jira.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 8.1.2
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [`d3b98f06b9def`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d3b98f06b9def) -
|
|
19
|
+
[ux] EDITOR-6025 Implement request access flow for synced blocks whose source is a Jira work item
|
|
20
|
+
the viewer cannot access.
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 8.1.1
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -9,14 +9,16 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
var _SyncedBlockRenderer = require("./ui/SyncedBlockRenderer");
|
|
10
10
|
// For rendering reference synced block nodes in Editor
|
|
11
11
|
var getSyncedBlockRenderer = exports.getSyncedBlockRenderer = function getSyncedBlockRenderer(_ref) {
|
|
12
|
-
var syncBlockRendererOptions = _ref.syncBlockRendererOptions
|
|
12
|
+
var syncBlockRendererOptions = _ref.syncBlockRendererOptions,
|
|
13
|
+
getAccountId = _ref.getAccountId;
|
|
13
14
|
return function (_ref2) {
|
|
14
15
|
var syncBlockFetchResult = _ref2.syncBlockFetchResult,
|
|
15
16
|
api = _ref2.api;
|
|
16
17
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockRenderer.SyncedBlockRenderer, {
|
|
17
18
|
syncBlockRendererOptions: syncBlockRendererOptions,
|
|
18
19
|
syncBlockFetchResult: syncBlockFetchResult,
|
|
19
|
-
api: api
|
|
20
|
+
api: api,
|
|
21
|
+
getAccountId: getAccountId
|
|
20
22
|
});
|
|
21
23
|
};
|
|
22
24
|
};
|
|
@@ -18,8 +18,9 @@ var _SyncedBlockOfflineError = require("./SyncedBlockOfflineError");
|
|
|
18
18
|
var _SyncedBlockPermissionDenied = require("./SyncedBlockPermissionDenied");
|
|
19
19
|
var _SyncedBlockUnpublishedError = require("./SyncedBlockUnpublishedError");
|
|
20
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); }
|
|
21
|
-
var getForbiddenErrorContent = function getForbiddenErrorContent(resourceId, fireAnalyticsEvent) {
|
|
21
|
+
var getForbiddenErrorContent = function getForbiddenErrorContent(resourceId, fireAnalyticsEvent, getAccountId) {
|
|
22
22
|
try {
|
|
23
|
+
var _getAccountId;
|
|
23
24
|
if (!resourceId) {
|
|
24
25
|
throw new Error('Missing resource id');
|
|
25
26
|
}
|
|
@@ -28,7 +29,8 @@ var getForbiddenErrorContent = function getForbiddenErrorContent(resourceId, fir
|
|
|
28
29
|
sourceProduct = _getContentIdAndProdu.sourceProduct;
|
|
29
30
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockPermissionDenied.SyncedBlockPermissionDenied, {
|
|
30
31
|
sourceContentId: sourceContentId,
|
|
31
|
-
sourceProduct: sourceProduct
|
|
32
|
+
sourceProduct: sourceProduct,
|
|
33
|
+
accountId: (_getAccountId = getAccountId === null || getAccountId === void 0 ? void 0 : getAccountId()) !== null && _getAccountId !== void 0 ? _getAccountId : null
|
|
32
34
|
});
|
|
33
35
|
} catch (error) {
|
|
34
36
|
(0, _monitoring.logException)(error, {
|
|
@@ -44,7 +46,8 @@ var SyncedBlockErrorComponent = exports.SyncedBlockErrorComponent = function Syn
|
|
|
44
46
|
onRetry = _ref.onRetry,
|
|
45
47
|
resourceId = _ref.resourceId,
|
|
46
48
|
fireAnalyticsEvent = _ref.fireAnalyticsEvent,
|
|
47
|
-
sourceURL = _ref.sourceURL
|
|
49
|
+
sourceURL = _ref.sourceURL,
|
|
50
|
+
getAccountId = _ref.getAccountId;
|
|
48
51
|
(0, _react.useEffect)(function () {
|
|
49
52
|
fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent({
|
|
50
53
|
action: _analytics.ACTION.ERROR,
|
|
@@ -64,7 +67,7 @@ var SyncedBlockErrorComponent = exports.SyncedBlockErrorComponent = function Syn
|
|
|
64
67
|
case _editorSyncedBlockProvider.SyncBlockError.Offline:
|
|
65
68
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockOfflineError.SyncedBlockOfflineError, null);
|
|
66
69
|
case _editorSyncedBlockProvider.SyncBlockError.Forbidden:
|
|
67
|
-
return getForbiddenErrorContent(resourceId, fireAnalyticsEvent);
|
|
70
|
+
return getForbiddenErrorContent(resourceId, fireAnalyticsEvent, getAccountId);
|
|
68
71
|
case _editorSyncedBlockProvider.SyncBlockError.NotFound:
|
|
69
72
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockNotFoundError.SyncedBlockNotFoundError, {
|
|
70
73
|
reason: error.reason,
|
|
@@ -84,7 +87,7 @@ var SyncedBlockErrorComponent = exports.SyncedBlockErrorComponent = function Syn
|
|
|
84
87
|
default:
|
|
85
88
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockGenericError.SyncedBlockGenericError, null);
|
|
86
89
|
}
|
|
87
|
-
}, [error, isLoading, onRetry, resourceId, fireAnalyticsEvent, sourceURL]);
|
|
90
|
+
}, [error, isLoading, onRetry, resourceId, fireAnalyticsEvent, sourceURL, getAccountId]);
|
|
88
91
|
return (
|
|
89
92
|
/*#__PURE__*/
|
|
90
93
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
@@ -20,7 +20,8 @@ var SyncedBlockNodeComponentRenderer = exports.SyncedBlockNodeComponentRenderer
|
|
|
20
20
|
var _syncBlockInstance$er, _syncBlockInstance$da, _syncBlockInstance$da2;
|
|
21
21
|
var nodeProps = _ref.nodeProps,
|
|
22
22
|
syncBlockStoreManager = _ref.syncBlockStoreManager,
|
|
23
|
-
rendererOptions = _ref.rendererOptions
|
|
23
|
+
rendererOptions = _ref.rendererOptions,
|
|
24
|
+
getAccountId = _ref.getAccountId;
|
|
24
25
|
var resourceId = nodeProps.resourceId,
|
|
25
26
|
localId = nodeProps.localId,
|
|
26
27
|
fireAnalyticsEvent = nodeProps.fireAnalyticsEvent;
|
|
@@ -76,7 +77,8 @@ var SyncedBlockNodeComponentRenderer = exports.SyncedBlockNodeComponentRenderer
|
|
|
76
77
|
reloadData: reloadData,
|
|
77
78
|
fireAnalyticsEvent: fireAnalyticsEvent,
|
|
78
79
|
resourceId: resourceId,
|
|
79
|
-
error: errorForDisplay
|
|
80
|
+
error: errorForDisplay,
|
|
81
|
+
getAccountId: getAccountId
|
|
80
82
|
});
|
|
81
83
|
if (result.isSuccess) {
|
|
82
84
|
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
|
|
@@ -9,6 +9,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
exports.SyncedBlockPermissionDenied = void 0;
|
|
10
10
|
require("./SyncedBlockPermissionDenied.compiled.css");
|
|
11
11
|
var _runtime = require("@compiled/react/runtime");
|
|
12
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
12
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
15
|
var _SyncedBlockPermissionDeniedRequestAccessMutation2 = _interopRequireDefault(require("./__generated__/SyncedBlockPermissionDeniedRequestAccessMutation.graphql"));
|
|
14
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -16,9 +18,11 @@ var _reactIntl = require("react-intl");
|
|
|
16
18
|
var _reactRelay = require("react-relay");
|
|
17
19
|
var _new = _interopRequireDefault(require("@atlaskit/button/new"));
|
|
18
20
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
21
|
+
var _requestJiraIssueAccess = require("@atlaskit/editor-synced-block-provider/requestJiraIssueAccess");
|
|
19
22
|
var _heading = _interopRequireDefault(require("@atlaskit/heading"));
|
|
20
23
|
var _statusSuccess = _interopRequireDefault(require("@atlaskit/icon/core/status-success"));
|
|
21
24
|
var _image = _interopRequireDefault(require("@atlaskit/image"));
|
|
25
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
22
26
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
23
27
|
var _PermissionDenied = _interopRequireDefault(require("./assets/PermissionDenied.svg"));
|
|
24
28
|
var _SyncedBlockGenericError = require("./SyncedBlockGenericError");
|
|
@@ -103,14 +107,101 @@ var SyncedBlockPermissionDeniedConfluencePage = function SyncedBlockPermissionDe
|
|
|
103
107
|
testId: "sync-block-access-error-msg"
|
|
104
108
|
}, formatMessage(_messages.syncBlockMessages.requestAccessError)))));
|
|
105
109
|
};
|
|
106
|
-
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* For Jira we deliberately collapse "success" and "failure" into a single
|
|
113
|
+
* `pending` state — matching the behaviour of `useRequestAccessSubmit` in
|
|
114
|
+
* `jira/src/packages/issue/request-access-modal`. The endpoint returns no
|
|
115
|
+
* distinguishable error information for security reasons.
|
|
116
|
+
*/
|
|
117
|
+
|
|
118
|
+
var SyncedBlockPermissionDeniedJiraWorkItem = function SyncedBlockPermissionDeniedJiraWorkItem(_ref2) {
|
|
107
119
|
var sourceContentId = _ref2.sourceContentId,
|
|
108
|
-
|
|
120
|
+
accountId = _ref2.accountId;
|
|
121
|
+
var _useIntl2 = (0, _reactIntl.useIntl)(),
|
|
122
|
+
formatMessage = _useIntl2.formatMessage;
|
|
123
|
+
var _useState3 = (0, _react.useState)(RequestAccessState.default),
|
|
124
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
125
|
+
requestAccessState = _useState4[0],
|
|
126
|
+
setRequestAccessState = _useState4[1];
|
|
127
|
+
var onClick = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
128
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
129
|
+
while (1) switch (_context.prev = _context.next) {
|
|
130
|
+
case 0:
|
|
131
|
+
setRequestAccessState(RequestAccessState.loading);
|
|
132
|
+
// Fire and forget. Per the Jira backend contract the response is
|
|
133
|
+
// intentionally opaque (empty 204 on success, generic on failure) to
|
|
134
|
+
// prevent issue-existence enumeration. We always end in `pending`.
|
|
135
|
+
_context.prev = 1;
|
|
136
|
+
_context.next = 4;
|
|
137
|
+
return (0, _requestJiraIssueAccess.requestJiraSpaceAccess)({
|
|
138
|
+
accountId: accountId,
|
|
139
|
+
issueId: Number(sourceContentId) || null,
|
|
140
|
+
projectKey: null
|
|
141
|
+
});
|
|
142
|
+
case 4:
|
|
143
|
+
_context.next = 8;
|
|
144
|
+
break;
|
|
145
|
+
case 6:
|
|
146
|
+
_context.prev = 6;
|
|
147
|
+
_context.t0 = _context["catch"](1);
|
|
148
|
+
case 8:
|
|
149
|
+
setRequestAccessState(RequestAccessState.pending);
|
|
150
|
+
case 9:
|
|
151
|
+
case "end":
|
|
152
|
+
return _context.stop();
|
|
153
|
+
}
|
|
154
|
+
}, _callee, null, [[1, 6]]);
|
|
155
|
+
})), [accountId, sourceContentId]);
|
|
156
|
+
return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
157
|
+
xcss: styles.wrapper
|
|
158
|
+
}, /*#__PURE__*/_react.default.createElement(_image.default, {
|
|
159
|
+
src: _PermissionDenied.default,
|
|
160
|
+
alt: formatMessage(_messages.syncBlockMessages.permissionDeniedAltText),
|
|
161
|
+
width: "48",
|
|
162
|
+
height: "48"
|
|
163
|
+
}), /*#__PURE__*/_react.default.createElement(_compiled.Stack, {
|
|
164
|
+
space: "space.100"
|
|
165
|
+
}, /*#__PURE__*/_react.default.createElement(_heading.default, {
|
|
166
|
+
size: "xsmall"
|
|
167
|
+
}, formatMessage(_messages.syncBlockMessages.permissionDeniedHeading)), /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
168
|
+
color: "color.text.subtle"
|
|
169
|
+
}, formatMessage(_messages.syncBlockMessages.permissionDeniedDescription)), requestAccessState === RequestAccessState.pending ? /*#__PURE__*/_react.default.createElement(_compiled.Flex, {
|
|
170
|
+
columnGap: "space.050",
|
|
171
|
+
alignItems: "center"
|
|
172
|
+
}, /*#__PURE__*/_react.default.createElement(_statusSuccess.default, {
|
|
173
|
+
size: "small",
|
|
174
|
+
color: "var(--ds-icon-subtle, #505258)",
|
|
175
|
+
label: formatMessage(_messages.syncBlockMessages.accessRequested)
|
|
176
|
+
}), /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
177
|
+
color: "color.text.subtlest",
|
|
178
|
+
weight: "bold",
|
|
179
|
+
testId: "sync-block-access-requested-msg"
|
|
180
|
+
}, formatMessage(_messages.syncBlockMessages.accessRequested))) : /*#__PURE__*/_react.default.createElement(_compiled.Flex, {
|
|
181
|
+
columnGap: "space.100",
|
|
182
|
+
alignItems: "center"
|
|
183
|
+
}, /*#__PURE__*/_react.default.createElement(_new.default, {
|
|
184
|
+
appearance: "default",
|
|
185
|
+
spacing: "compact",
|
|
186
|
+
onClick: onClick,
|
|
187
|
+
isLoading: requestAccessState === RequestAccessState.loading,
|
|
188
|
+
testId: "sync-block-request-access-btn"
|
|
189
|
+
}, formatMessage(_messages.syncBlockMessages.requestAccessButton)))));
|
|
190
|
+
};
|
|
191
|
+
var SyncedBlockPermissionDenied = exports.SyncedBlockPermissionDenied = function SyncedBlockPermissionDenied(_ref4) {
|
|
192
|
+
var sourceContentId = _ref4.sourceContentId,
|
|
193
|
+
sourceProduct = _ref4.sourceProduct,
|
|
194
|
+
accountId = _ref4.accountId;
|
|
109
195
|
switch (sourceProduct) {
|
|
110
196
|
case 'confluence-page':
|
|
111
197
|
return /*#__PURE__*/_react.default.createElement(SyncedBlockPermissionDeniedConfluencePage, {
|
|
112
198
|
sourceContentId: sourceContentId
|
|
113
199
|
});
|
|
200
|
+
case 'jira-work-item':
|
|
201
|
+
return (0, _platformFeatureFlags.fg)('platform_synced_block_patch_10') ? /*#__PURE__*/_react.default.createElement(SyncedBlockPermissionDeniedJiraWorkItem, {
|
|
202
|
+
sourceContentId: sourceContentId,
|
|
203
|
+
accountId: accountId
|
|
204
|
+
}) : /*#__PURE__*/_react.default.createElement(_SyncedBlockGenericError.SyncedBlockGenericError, null);
|
|
114
205
|
default:
|
|
115
206
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockGenericError.SyncedBlockGenericError, null);
|
|
116
207
|
}
|
|
@@ -17,7 +17,8 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
|
|
|
17
17
|
var _api$analytics2;
|
|
18
18
|
var syncBlockRendererOptions = _ref.syncBlockRendererOptions,
|
|
19
19
|
syncBlockFetchResult = _ref.syncBlockFetchResult,
|
|
20
|
-
api = _ref.api
|
|
20
|
+
api = _ref.api,
|
|
21
|
+
getAccountId = _ref.getAccountId;
|
|
21
22
|
(0, _react.useEffect)(function () {
|
|
22
23
|
var timeoutId = setTimeout(function () {
|
|
23
24
|
var _api$analytics;
|
|
@@ -71,7 +72,8 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
|
|
|
71
72
|
reloadData: reloadData,
|
|
72
73
|
fireAnalyticsEvent: api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.fireAnalyticsEvent,
|
|
73
74
|
resourceId: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.resourceId,
|
|
74
|
-
isOffline: isCollabOffline
|
|
75
|
+
isOffline: isCollabOffline,
|
|
76
|
+
getAccountId: getAccountId
|
|
75
77
|
});
|
|
76
78
|
return result.element;
|
|
77
79
|
};
|
|
@@ -28,7 +28,8 @@ function renderSyncedBlockContent(_ref) {
|
|
|
28
28
|
fireAnalyticsEvent = _ref.fireAnalyticsEvent,
|
|
29
29
|
resourceId = _ref.resourceId,
|
|
30
30
|
isOffline = _ref.isOffline,
|
|
31
|
-
error = _ref.error
|
|
31
|
+
error = _ref.error,
|
|
32
|
+
getAccountId = _ref.getAccountId;
|
|
32
33
|
var isSSRMode = (0, _coreUtils.isSSR)();
|
|
33
34
|
if (isOffline && !isSSRMode) {
|
|
34
35
|
return {
|
|
@@ -66,7 +67,8 @@ function renderSyncedBlockContent(_ref) {
|
|
|
66
67
|
resourceId: resourceId,
|
|
67
68
|
onRetry: reloadData,
|
|
68
69
|
isLoading: isLoading,
|
|
69
|
-
fireAnalyticsEvent: fireAnalyticsEvent
|
|
70
|
+
fireAnalyticsEvent: fireAnalyticsEvent,
|
|
71
|
+
getAccountId: getAccountId
|
|
70
72
|
}),
|
|
71
73
|
isSuccess: false
|
|
72
74
|
};
|
|
@@ -81,7 +83,8 @@ function renderSyncedBlockContent(_ref) {
|
|
|
81
83
|
},
|
|
82
84
|
resourceId: resourceId,
|
|
83
85
|
sourceURL: (_syncBlockInstance$da3 = syncBlockInstance.data) === null || _syncBlockInstance$da3 === void 0 ? void 0 : _syncBlockInstance$da3.sourceURL,
|
|
84
|
-
fireAnalyticsEvent: fireAnalyticsEvent
|
|
86
|
+
fireAnalyticsEvent: fireAnalyticsEvent,
|
|
87
|
+
getAccountId: getAccountId
|
|
85
88
|
}),
|
|
86
89
|
isSuccess: false
|
|
87
90
|
};
|
|
@@ -27,6 +27,7 @@ var useMemoizedSyncedBlockNodeComponent = exports.useMemoizedSyncedBlockNodeComp
|
|
|
27
27
|
syncBlockProvider = _ref.syncBlockProvider,
|
|
28
28
|
syncBlockRendererOptions = _ref.syncBlockRendererOptions,
|
|
29
29
|
fireAnalyticsEvent = _ref.fireAnalyticsEvent,
|
|
30
|
+
getAccountId = _ref.getAccountId,
|
|
30
31
|
getPrefetchedData = _ref.getPrefetchedData;
|
|
31
32
|
var syncBlockStoreManager = (0, _editorSyncedBlockProvider.useMemoizedSyncBlockStoreManager)(syncBlockProvider, fireAnalyticsEvent);
|
|
32
33
|
|
|
@@ -61,7 +62,8 @@ var useMemoizedSyncedBlockNodeComponent = exports.useMemoizedSyncedBlockNodeComp
|
|
|
61
62
|
key: props.localId,
|
|
62
63
|
nodeProps: props,
|
|
63
64
|
syncBlockStoreManager: syncBlockStoreManager,
|
|
64
|
-
rendererOptions: syncBlockRendererOptions
|
|
65
|
+
rendererOptions: syncBlockRendererOptions,
|
|
66
|
+
getAccountId: getAccountId
|
|
65
67
|
})));
|
|
66
|
-
}, [syncBlockStoreManager, syncBlockRendererOptions, fireAnalyticsEvent]);
|
|
68
|
+
}, [syncBlockStoreManager, syncBlockRendererOptions, fireAnalyticsEvent, getAccountId]);
|
|
67
69
|
};
|
|
@@ -2,7 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import { SyncedBlockRenderer } from './ui/SyncedBlockRenderer';
|
|
3
3
|
// For rendering reference synced block nodes in Editor
|
|
4
4
|
export const getSyncedBlockRenderer = ({
|
|
5
|
-
syncBlockRendererOptions
|
|
5
|
+
syncBlockRendererOptions,
|
|
6
|
+
getAccountId
|
|
6
7
|
}) => ({
|
|
7
8
|
syncBlockFetchResult,
|
|
8
9
|
api
|
|
@@ -10,6 +11,7 @@ export const getSyncedBlockRenderer = ({
|
|
|
10
11
|
return /*#__PURE__*/React.createElement(SyncedBlockRenderer, {
|
|
11
12
|
syncBlockRendererOptions: syncBlockRendererOptions,
|
|
12
13
|
syncBlockFetchResult: syncBlockFetchResult,
|
|
13
|
-
api: api
|
|
14
|
+
api: api,
|
|
15
|
+
getAccountId: getAccountId
|
|
14
16
|
});
|
|
15
17
|
};
|
|
@@ -10,8 +10,9 @@ import { SyncedBlockNotFoundError } from './SyncedBlockNotFoundError';
|
|
|
10
10
|
import { SyncedBlockOfflineError } from './SyncedBlockOfflineError';
|
|
11
11
|
import { SyncedBlockPermissionDenied } from './SyncedBlockPermissionDenied';
|
|
12
12
|
import { SyncedBlockUnpublishedError } from './SyncedBlockUnpublishedError';
|
|
13
|
-
const getForbiddenErrorContent = (resourceId, fireAnalyticsEvent) => {
|
|
13
|
+
const getForbiddenErrorContent = (resourceId, fireAnalyticsEvent, getAccountId) => {
|
|
14
14
|
try {
|
|
15
|
+
var _getAccountId;
|
|
15
16
|
if (!resourceId) {
|
|
16
17
|
throw new Error('Missing resource id');
|
|
17
18
|
}
|
|
@@ -21,7 +22,8 @@ const getForbiddenErrorContent = (resourceId, fireAnalyticsEvent) => {
|
|
|
21
22
|
} = getContentIdAndProductFromResourceId(resourceId);
|
|
22
23
|
return /*#__PURE__*/React.createElement(SyncedBlockPermissionDenied, {
|
|
23
24
|
sourceContentId: sourceContentId,
|
|
24
|
-
sourceProduct: sourceProduct
|
|
25
|
+
sourceProduct: sourceProduct,
|
|
26
|
+
accountId: (_getAccountId = getAccountId === null || getAccountId === void 0 ? void 0 : getAccountId()) !== null && _getAccountId !== void 0 ? _getAccountId : null
|
|
25
27
|
});
|
|
26
28
|
} catch (error) {
|
|
27
29
|
logException(error, {
|
|
@@ -37,7 +39,8 @@ export const SyncedBlockErrorComponent = ({
|
|
|
37
39
|
onRetry,
|
|
38
40
|
resourceId,
|
|
39
41
|
fireAnalyticsEvent,
|
|
40
|
-
sourceURL
|
|
42
|
+
sourceURL,
|
|
43
|
+
getAccountId
|
|
41
44
|
}) => {
|
|
42
45
|
useEffect(() => {
|
|
43
46
|
fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 ? void 0 : fireAnalyticsEvent({
|
|
@@ -58,7 +61,7 @@ export const SyncedBlockErrorComponent = ({
|
|
|
58
61
|
case SyncBlockError.Offline:
|
|
59
62
|
return /*#__PURE__*/React.createElement(SyncedBlockOfflineError, null);
|
|
60
63
|
case SyncBlockError.Forbidden:
|
|
61
|
-
return getForbiddenErrorContent(resourceId, fireAnalyticsEvent);
|
|
64
|
+
return getForbiddenErrorContent(resourceId, fireAnalyticsEvent, getAccountId);
|
|
62
65
|
case SyncBlockError.NotFound:
|
|
63
66
|
return /*#__PURE__*/React.createElement(SyncedBlockNotFoundError, {
|
|
64
67
|
reason: error.reason,
|
|
@@ -78,7 +81,7 @@ export const SyncedBlockErrorComponent = ({
|
|
|
78
81
|
default:
|
|
79
82
|
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
80
83
|
}
|
|
81
|
-
}, [error, isLoading, onRetry, resourceId, fireAnalyticsEvent, sourceURL]);
|
|
84
|
+
}, [error, isLoading, onRetry, resourceId, fireAnalyticsEvent, sourceURL, getAccountId]);
|
|
82
85
|
return (
|
|
83
86
|
/*#__PURE__*/
|
|
84
87
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
@@ -6,7 +6,8 @@ import { renderSyncedBlockContent } from './renderSyncedBlockContent';
|
|
|
6
6
|
export const SyncedBlockNodeComponentRenderer = ({
|
|
7
7
|
nodeProps,
|
|
8
8
|
syncBlockStoreManager,
|
|
9
|
-
rendererOptions
|
|
9
|
+
rendererOptions,
|
|
10
|
+
getAccountId
|
|
10
11
|
}) => {
|
|
11
12
|
var _syncBlockInstance$er, _syncBlockInstance$da, _syncBlockInstance$da2;
|
|
12
13
|
const {
|
|
@@ -69,7 +70,8 @@ export const SyncedBlockNodeComponentRenderer = ({
|
|
|
69
70
|
reloadData,
|
|
70
71
|
fireAnalyticsEvent,
|
|
71
72
|
resourceId,
|
|
72
|
-
error: errorForDisplay
|
|
73
|
+
error: errorForDisplay,
|
|
74
|
+
getAccountId
|
|
73
75
|
});
|
|
74
76
|
if (result.isSuccess) {
|
|
75
77
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
import "./SyncedBlockPermissionDenied.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import _SyncedBlockPermissionDeniedRequestAccessMutation from "./__generated__/SyncedBlockPermissionDeniedRequestAccessMutation.graphql";
|
|
5
|
-
import React, { useState } from 'react';
|
|
5
|
+
import React, { useCallback, useState } from 'react';
|
|
6
6
|
import { useIntl } from 'react-intl';
|
|
7
7
|
import { useMutation, graphql } from 'react-relay';
|
|
8
8
|
import Button from '@atlaskit/button/new';
|
|
9
9
|
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
10
|
+
import { requestJiraSpaceAccess } from '@atlaskit/editor-synced-block-provider/requestJiraIssueAccess';
|
|
10
11
|
import Heading from '@atlaskit/heading';
|
|
11
12
|
import StatusSuccessIcon from '@atlaskit/icon/core/status-success';
|
|
12
13
|
import Image from '@atlaskit/image';
|
|
14
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
15
|
import { Text, Flex, Stack, Box } from '@atlaskit/primitives/compiled';
|
|
14
16
|
import PermissionDenied from './assets/PermissionDenied.svg';
|
|
15
17
|
import { SyncedBlockGenericError } from './SyncedBlockGenericError';
|
|
@@ -90,15 +92,88 @@ const SyncedBlockPermissionDeniedConfluencePage = ({
|
|
|
90
92
|
testId: "sync-block-access-error-msg"
|
|
91
93
|
}, formatMessage(messages.requestAccessError)))));
|
|
92
94
|
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* For Jira we deliberately collapse "success" and "failure" into a single
|
|
98
|
+
* `pending` state — matching the behaviour of `useRequestAccessSubmit` in
|
|
99
|
+
* `jira/src/packages/issue/request-access-modal`. The endpoint returns no
|
|
100
|
+
* distinguishable error information for security reasons.
|
|
101
|
+
*/
|
|
102
|
+
|
|
103
|
+
const SyncedBlockPermissionDeniedJiraWorkItem = ({
|
|
104
|
+
sourceContentId,
|
|
105
|
+
accountId
|
|
106
|
+
}) => {
|
|
107
|
+
const {
|
|
108
|
+
formatMessage
|
|
109
|
+
} = useIntl();
|
|
110
|
+
const [requestAccessState, setRequestAccessState] = useState(RequestAccessState.default);
|
|
111
|
+
const onClick = useCallback(async () => {
|
|
112
|
+
setRequestAccessState(RequestAccessState.loading);
|
|
113
|
+
// Fire and forget. Per the Jira backend contract the response is
|
|
114
|
+
// intentionally opaque (empty 204 on success, generic on failure) to
|
|
115
|
+
// prevent issue-existence enumeration. We always end in `pending`.
|
|
116
|
+
try {
|
|
117
|
+
await requestJiraSpaceAccess({
|
|
118
|
+
accountId,
|
|
119
|
+
issueId: Number(sourceContentId) || null,
|
|
120
|
+
projectKey: null
|
|
121
|
+
});
|
|
122
|
+
} catch (_e) {
|
|
123
|
+
// Swallow — see comment above.
|
|
124
|
+
}
|
|
125
|
+
setRequestAccessState(RequestAccessState.pending);
|
|
126
|
+
}, [accountId, sourceContentId]);
|
|
127
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
128
|
+
xcss: styles.wrapper
|
|
129
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
130
|
+
src: PermissionDenied,
|
|
131
|
+
alt: formatMessage(messages.permissionDeniedAltText),
|
|
132
|
+
width: "48",
|
|
133
|
+
height: "48"
|
|
134
|
+
}), /*#__PURE__*/React.createElement(Stack, {
|
|
135
|
+
space: "space.100"
|
|
136
|
+
}, /*#__PURE__*/React.createElement(Heading, {
|
|
137
|
+
size: "xsmall"
|
|
138
|
+
}, formatMessage(messages.permissionDeniedHeading)), /*#__PURE__*/React.createElement(Text, {
|
|
139
|
+
color: "color.text.subtle"
|
|
140
|
+
}, formatMessage(messages.permissionDeniedDescription)), requestAccessState === RequestAccessState.pending ? /*#__PURE__*/React.createElement(Flex, {
|
|
141
|
+
columnGap: "space.050",
|
|
142
|
+
alignItems: "center"
|
|
143
|
+
}, /*#__PURE__*/React.createElement(StatusSuccessIcon, {
|
|
144
|
+
size: "small",
|
|
145
|
+
color: "var(--ds-icon-subtle, #505258)",
|
|
146
|
+
label: formatMessage(messages.accessRequested)
|
|
147
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
148
|
+
color: "color.text.subtlest",
|
|
149
|
+
weight: "bold",
|
|
150
|
+
testId: "sync-block-access-requested-msg"
|
|
151
|
+
}, formatMessage(messages.accessRequested))) : /*#__PURE__*/React.createElement(Flex, {
|
|
152
|
+
columnGap: "space.100",
|
|
153
|
+
alignItems: "center"
|
|
154
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
155
|
+
appearance: "default",
|
|
156
|
+
spacing: "compact",
|
|
157
|
+
onClick: onClick,
|
|
158
|
+
isLoading: requestAccessState === RequestAccessState.loading,
|
|
159
|
+
testId: "sync-block-request-access-btn"
|
|
160
|
+
}, formatMessage(messages.requestAccessButton)))));
|
|
161
|
+
};
|
|
93
162
|
export const SyncedBlockPermissionDenied = ({
|
|
94
163
|
sourceContentId,
|
|
95
|
-
sourceProduct
|
|
164
|
+
sourceProduct,
|
|
165
|
+
accountId
|
|
96
166
|
}) => {
|
|
97
167
|
switch (sourceProduct) {
|
|
98
168
|
case 'confluence-page':
|
|
99
169
|
return /*#__PURE__*/React.createElement(SyncedBlockPermissionDeniedConfluencePage, {
|
|
100
170
|
sourceContentId: sourceContentId
|
|
101
171
|
});
|
|
172
|
+
case 'jira-work-item':
|
|
173
|
+
return fg('platform_synced_block_patch_10') ? /*#__PURE__*/React.createElement(SyncedBlockPermissionDeniedJiraWorkItem, {
|
|
174
|
+
sourceContentId: sourceContentId,
|
|
175
|
+
accountId: accountId
|
|
176
|
+
}) : /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
102
177
|
default:
|
|
103
178
|
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
104
179
|
}
|
|
@@ -6,7 +6,8 @@ import { renderSyncedBlockContent } from './renderSyncedBlockContent';
|
|
|
6
6
|
const SyncedBlockRendererComponent = ({
|
|
7
7
|
syncBlockRendererOptions,
|
|
8
8
|
syncBlockFetchResult,
|
|
9
|
-
api
|
|
9
|
+
api,
|
|
10
|
+
getAccountId
|
|
10
11
|
}) => {
|
|
11
12
|
var _api$analytics2;
|
|
12
13
|
useEffect(() => {
|
|
@@ -67,7 +68,8 @@ const SyncedBlockRendererComponent = ({
|
|
|
67
68
|
reloadData,
|
|
68
69
|
fireAnalyticsEvent: api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.fireAnalyticsEvent,
|
|
69
70
|
resourceId: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.resourceId,
|
|
70
|
-
isOffline: isCollabOffline
|
|
71
|
+
isOffline: isCollabOffline,
|
|
72
|
+
getAccountId
|
|
71
73
|
});
|
|
72
74
|
return result.element;
|
|
73
75
|
};
|
|
@@ -20,7 +20,8 @@ export function renderSyncedBlockContent({
|
|
|
20
20
|
fireAnalyticsEvent,
|
|
21
21
|
resourceId,
|
|
22
22
|
isOffline,
|
|
23
|
-
error
|
|
23
|
+
error,
|
|
24
|
+
getAccountId
|
|
24
25
|
}) {
|
|
25
26
|
var _syncBlockInstance$da2;
|
|
26
27
|
const isSSRMode = isSSR();
|
|
@@ -60,7 +61,8 @@ export function renderSyncedBlockContent({
|
|
|
60
61
|
resourceId: resourceId,
|
|
61
62
|
onRetry: reloadData,
|
|
62
63
|
isLoading: isLoading,
|
|
63
|
-
fireAnalyticsEvent: fireAnalyticsEvent
|
|
64
|
+
fireAnalyticsEvent: fireAnalyticsEvent,
|
|
65
|
+
getAccountId: getAccountId
|
|
64
66
|
}),
|
|
65
67
|
isSuccess: false
|
|
66
68
|
};
|
|
@@ -75,7 +77,8 @@ export function renderSyncedBlockContent({
|
|
|
75
77
|
},
|
|
76
78
|
resourceId: resourceId,
|
|
77
79
|
sourceURL: (_syncBlockInstance$da3 = syncBlockInstance.data) === null || _syncBlockInstance$da3 === void 0 ? void 0 : _syncBlockInstance$da3.sourceURL,
|
|
78
|
-
fireAnalyticsEvent: fireAnalyticsEvent
|
|
80
|
+
fireAnalyticsEvent: fireAnalyticsEvent,
|
|
81
|
+
getAccountId: getAccountId
|
|
79
82
|
}),
|
|
80
83
|
isSuccess: false
|
|
81
84
|
};
|
|
@@ -17,6 +17,7 @@ export const useMemoizedSyncedBlockNodeComponent = ({
|
|
|
17
17
|
syncBlockProvider,
|
|
18
18
|
syncBlockRendererOptions,
|
|
19
19
|
fireAnalyticsEvent,
|
|
20
|
+
getAccountId,
|
|
20
21
|
getPrefetchedData
|
|
21
22
|
}) => {
|
|
22
23
|
const syncBlockStoreManager = useMemoizedSyncBlockStoreManager(syncBlockProvider, fireAnalyticsEvent);
|
|
@@ -49,6 +50,7 @@ export const useMemoizedSyncedBlockNodeComponent = ({
|
|
|
49
50
|
key: props.localId,
|
|
50
51
|
nodeProps: props,
|
|
51
52
|
syncBlockStoreManager: syncBlockStoreManager,
|
|
52
|
-
rendererOptions: syncBlockRendererOptions
|
|
53
|
-
|
|
53
|
+
rendererOptions: syncBlockRendererOptions,
|
|
54
|
+
getAccountId: getAccountId
|
|
55
|
+
}))), [syncBlockStoreManager, syncBlockRendererOptions, fireAnalyticsEvent, getAccountId]);
|
|
54
56
|
};
|
|
@@ -2,14 +2,16 @@ import React from 'react';
|
|
|
2
2
|
import { SyncedBlockRenderer } from './ui/SyncedBlockRenderer';
|
|
3
3
|
// For rendering reference synced block nodes in Editor
|
|
4
4
|
export var getSyncedBlockRenderer = function getSyncedBlockRenderer(_ref) {
|
|
5
|
-
var syncBlockRendererOptions = _ref.syncBlockRendererOptions
|
|
5
|
+
var syncBlockRendererOptions = _ref.syncBlockRendererOptions,
|
|
6
|
+
getAccountId = _ref.getAccountId;
|
|
6
7
|
return function (_ref2) {
|
|
7
8
|
var syncBlockFetchResult = _ref2.syncBlockFetchResult,
|
|
8
9
|
api = _ref2.api;
|
|
9
10
|
return /*#__PURE__*/React.createElement(SyncedBlockRenderer, {
|
|
10
11
|
syncBlockRendererOptions: syncBlockRendererOptions,
|
|
11
12
|
syncBlockFetchResult: syncBlockFetchResult,
|
|
12
|
-
api: api
|
|
13
|
+
api: api,
|
|
14
|
+
getAccountId: getAccountId
|
|
13
15
|
});
|
|
14
16
|
};
|
|
15
17
|
};
|
|
@@ -10,8 +10,9 @@ import { SyncedBlockNotFoundError } from './SyncedBlockNotFoundError';
|
|
|
10
10
|
import { SyncedBlockOfflineError } from './SyncedBlockOfflineError';
|
|
11
11
|
import { SyncedBlockPermissionDenied } from './SyncedBlockPermissionDenied';
|
|
12
12
|
import { SyncedBlockUnpublishedError } from './SyncedBlockUnpublishedError';
|
|
13
|
-
var getForbiddenErrorContent = function getForbiddenErrorContent(resourceId, fireAnalyticsEvent) {
|
|
13
|
+
var getForbiddenErrorContent = function getForbiddenErrorContent(resourceId, fireAnalyticsEvent, getAccountId) {
|
|
14
14
|
try {
|
|
15
|
+
var _getAccountId;
|
|
15
16
|
if (!resourceId) {
|
|
16
17
|
throw new Error('Missing resource id');
|
|
17
18
|
}
|
|
@@ -20,7 +21,8 @@ var getForbiddenErrorContent = function getForbiddenErrorContent(resourceId, fir
|
|
|
20
21
|
sourceProduct = _getContentIdAndProdu.sourceProduct;
|
|
21
22
|
return /*#__PURE__*/React.createElement(SyncedBlockPermissionDenied, {
|
|
22
23
|
sourceContentId: sourceContentId,
|
|
23
|
-
sourceProduct: sourceProduct
|
|
24
|
+
sourceProduct: sourceProduct,
|
|
25
|
+
accountId: (_getAccountId = getAccountId === null || getAccountId === void 0 ? void 0 : getAccountId()) !== null && _getAccountId !== void 0 ? _getAccountId : null
|
|
24
26
|
});
|
|
25
27
|
} catch (error) {
|
|
26
28
|
logException(error, {
|
|
@@ -36,7 +38,8 @@ export var SyncedBlockErrorComponent = function SyncedBlockErrorComponent(_ref)
|
|
|
36
38
|
onRetry = _ref.onRetry,
|
|
37
39
|
resourceId = _ref.resourceId,
|
|
38
40
|
fireAnalyticsEvent = _ref.fireAnalyticsEvent,
|
|
39
|
-
sourceURL = _ref.sourceURL
|
|
41
|
+
sourceURL = _ref.sourceURL,
|
|
42
|
+
getAccountId = _ref.getAccountId;
|
|
40
43
|
useEffect(function () {
|
|
41
44
|
fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent({
|
|
42
45
|
action: ACTION.ERROR,
|
|
@@ -56,7 +59,7 @@ export var SyncedBlockErrorComponent = function SyncedBlockErrorComponent(_ref)
|
|
|
56
59
|
case SyncBlockError.Offline:
|
|
57
60
|
return /*#__PURE__*/React.createElement(SyncedBlockOfflineError, null);
|
|
58
61
|
case SyncBlockError.Forbidden:
|
|
59
|
-
return getForbiddenErrorContent(resourceId, fireAnalyticsEvent);
|
|
62
|
+
return getForbiddenErrorContent(resourceId, fireAnalyticsEvent, getAccountId);
|
|
60
63
|
case SyncBlockError.NotFound:
|
|
61
64
|
return /*#__PURE__*/React.createElement(SyncedBlockNotFoundError, {
|
|
62
65
|
reason: error.reason,
|
|
@@ -76,7 +79,7 @@ export var SyncedBlockErrorComponent = function SyncedBlockErrorComponent(_ref)
|
|
|
76
79
|
default:
|
|
77
80
|
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
78
81
|
}
|
|
79
|
-
}, [error, isLoading, onRetry, resourceId, fireAnalyticsEvent, sourceURL]);
|
|
82
|
+
}, [error, isLoading, onRetry, resourceId, fireAnalyticsEvent, sourceURL, getAccountId]);
|
|
80
83
|
return (
|
|
81
84
|
/*#__PURE__*/
|
|
82
85
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
@@ -11,7 +11,8 @@ export var SyncedBlockNodeComponentRenderer = function SyncedBlockNodeComponentR
|
|
|
11
11
|
var _syncBlockInstance$er, _syncBlockInstance$da, _syncBlockInstance$da2;
|
|
12
12
|
var nodeProps = _ref.nodeProps,
|
|
13
13
|
syncBlockStoreManager = _ref.syncBlockStoreManager,
|
|
14
|
-
rendererOptions = _ref.rendererOptions
|
|
14
|
+
rendererOptions = _ref.rendererOptions,
|
|
15
|
+
getAccountId = _ref.getAccountId;
|
|
15
16
|
var resourceId = nodeProps.resourceId,
|
|
16
17
|
localId = nodeProps.localId,
|
|
17
18
|
fireAnalyticsEvent = nodeProps.fireAnalyticsEvent;
|
|
@@ -67,7 +68,8 @@ export var SyncedBlockNodeComponentRenderer = function SyncedBlockNodeComponentR
|
|
|
67
68
|
reloadData: reloadData,
|
|
68
69
|
fireAnalyticsEvent: fireAnalyticsEvent,
|
|
69
70
|
resourceId: resourceId,
|
|
70
|
-
error: errorForDisplay
|
|
71
|
+
error: errorForDisplay,
|
|
72
|
+
getAccountId: getAccountId
|
|
71
73
|
});
|
|
72
74
|
if (result.isSuccess) {
|
|
73
75
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
/* SyncedBlockPermissionDenied.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
4
|
import "./SyncedBlockPermissionDenied.compiled.css";
|
|
4
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
7
|
import _SyncedBlockPermissionDeniedRequestAccessMutation from "./__generated__/SyncedBlockPermissionDeniedRequestAccessMutation.graphql";
|
|
6
|
-
import React, { useState } from 'react';
|
|
8
|
+
import React, { useCallback, useState } from 'react';
|
|
7
9
|
import { useIntl } from 'react-intl';
|
|
8
10
|
import { useMutation, graphql } from 'react-relay';
|
|
9
11
|
import Button from '@atlaskit/button/new';
|
|
10
12
|
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
13
|
+
import { requestJiraSpaceAccess } from '@atlaskit/editor-synced-block-provider/requestJiraIssueAccess';
|
|
11
14
|
import Heading from '@atlaskit/heading';
|
|
12
15
|
import StatusSuccessIcon from '@atlaskit/icon/core/status-success';
|
|
13
16
|
import Image from '@atlaskit/image';
|
|
17
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
18
|
import { Text, Flex, Stack, Box } from '@atlaskit/primitives/compiled';
|
|
15
19
|
import PermissionDenied from './assets/PermissionDenied.svg';
|
|
16
20
|
import { SyncedBlockGenericError } from './SyncedBlockGenericError';
|
|
@@ -94,14 +98,101 @@ var SyncedBlockPermissionDeniedConfluencePage = function SyncedBlockPermissionDe
|
|
|
94
98
|
testId: "sync-block-access-error-msg"
|
|
95
99
|
}, formatMessage(messages.requestAccessError)))));
|
|
96
100
|
};
|
|
97
|
-
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* For Jira we deliberately collapse "success" and "failure" into a single
|
|
104
|
+
* `pending` state — matching the behaviour of `useRequestAccessSubmit` in
|
|
105
|
+
* `jira/src/packages/issue/request-access-modal`. The endpoint returns no
|
|
106
|
+
* distinguishable error information for security reasons.
|
|
107
|
+
*/
|
|
108
|
+
|
|
109
|
+
var SyncedBlockPermissionDeniedJiraWorkItem = function SyncedBlockPermissionDeniedJiraWorkItem(_ref2) {
|
|
98
110
|
var sourceContentId = _ref2.sourceContentId,
|
|
99
|
-
|
|
111
|
+
accountId = _ref2.accountId;
|
|
112
|
+
var _useIntl2 = useIntl(),
|
|
113
|
+
formatMessage = _useIntl2.formatMessage;
|
|
114
|
+
var _useState3 = useState(RequestAccessState.default),
|
|
115
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
116
|
+
requestAccessState = _useState4[0],
|
|
117
|
+
setRequestAccessState = _useState4[1];
|
|
118
|
+
var onClick = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
119
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
120
|
+
while (1) switch (_context.prev = _context.next) {
|
|
121
|
+
case 0:
|
|
122
|
+
setRequestAccessState(RequestAccessState.loading);
|
|
123
|
+
// Fire and forget. Per the Jira backend contract the response is
|
|
124
|
+
// intentionally opaque (empty 204 on success, generic on failure) to
|
|
125
|
+
// prevent issue-existence enumeration. We always end in `pending`.
|
|
126
|
+
_context.prev = 1;
|
|
127
|
+
_context.next = 4;
|
|
128
|
+
return requestJiraSpaceAccess({
|
|
129
|
+
accountId: accountId,
|
|
130
|
+
issueId: Number(sourceContentId) || null,
|
|
131
|
+
projectKey: null
|
|
132
|
+
});
|
|
133
|
+
case 4:
|
|
134
|
+
_context.next = 8;
|
|
135
|
+
break;
|
|
136
|
+
case 6:
|
|
137
|
+
_context.prev = 6;
|
|
138
|
+
_context.t0 = _context["catch"](1);
|
|
139
|
+
case 8:
|
|
140
|
+
setRequestAccessState(RequestAccessState.pending);
|
|
141
|
+
case 9:
|
|
142
|
+
case "end":
|
|
143
|
+
return _context.stop();
|
|
144
|
+
}
|
|
145
|
+
}, _callee, null, [[1, 6]]);
|
|
146
|
+
})), [accountId, sourceContentId]);
|
|
147
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
148
|
+
xcss: styles.wrapper
|
|
149
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
150
|
+
src: PermissionDenied,
|
|
151
|
+
alt: formatMessage(messages.permissionDeniedAltText),
|
|
152
|
+
width: "48",
|
|
153
|
+
height: "48"
|
|
154
|
+
}), /*#__PURE__*/React.createElement(Stack, {
|
|
155
|
+
space: "space.100"
|
|
156
|
+
}, /*#__PURE__*/React.createElement(Heading, {
|
|
157
|
+
size: "xsmall"
|
|
158
|
+
}, formatMessage(messages.permissionDeniedHeading)), /*#__PURE__*/React.createElement(Text, {
|
|
159
|
+
color: "color.text.subtle"
|
|
160
|
+
}, formatMessage(messages.permissionDeniedDescription)), requestAccessState === RequestAccessState.pending ? /*#__PURE__*/React.createElement(Flex, {
|
|
161
|
+
columnGap: "space.050",
|
|
162
|
+
alignItems: "center"
|
|
163
|
+
}, /*#__PURE__*/React.createElement(StatusSuccessIcon, {
|
|
164
|
+
size: "small",
|
|
165
|
+
color: "var(--ds-icon-subtle, #505258)",
|
|
166
|
+
label: formatMessage(messages.accessRequested)
|
|
167
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
168
|
+
color: "color.text.subtlest",
|
|
169
|
+
weight: "bold",
|
|
170
|
+
testId: "sync-block-access-requested-msg"
|
|
171
|
+
}, formatMessage(messages.accessRequested))) : /*#__PURE__*/React.createElement(Flex, {
|
|
172
|
+
columnGap: "space.100",
|
|
173
|
+
alignItems: "center"
|
|
174
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
175
|
+
appearance: "default",
|
|
176
|
+
spacing: "compact",
|
|
177
|
+
onClick: onClick,
|
|
178
|
+
isLoading: requestAccessState === RequestAccessState.loading,
|
|
179
|
+
testId: "sync-block-request-access-btn"
|
|
180
|
+
}, formatMessage(messages.requestAccessButton)))));
|
|
181
|
+
};
|
|
182
|
+
export var SyncedBlockPermissionDenied = function SyncedBlockPermissionDenied(_ref4) {
|
|
183
|
+
var sourceContentId = _ref4.sourceContentId,
|
|
184
|
+
sourceProduct = _ref4.sourceProduct,
|
|
185
|
+
accountId = _ref4.accountId;
|
|
100
186
|
switch (sourceProduct) {
|
|
101
187
|
case 'confluence-page':
|
|
102
188
|
return /*#__PURE__*/React.createElement(SyncedBlockPermissionDeniedConfluencePage, {
|
|
103
189
|
sourceContentId: sourceContentId
|
|
104
190
|
});
|
|
191
|
+
case 'jira-work-item':
|
|
192
|
+
return fg('platform_synced_block_patch_10') ? /*#__PURE__*/React.createElement(SyncedBlockPermissionDeniedJiraWorkItem, {
|
|
193
|
+
sourceContentId: sourceContentId,
|
|
194
|
+
accountId: accountId
|
|
195
|
+
}) : /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
105
196
|
default:
|
|
106
197
|
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
107
198
|
}
|
|
@@ -10,7 +10,8 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
|
|
|
10
10
|
var _api$analytics2;
|
|
11
11
|
var syncBlockRendererOptions = _ref.syncBlockRendererOptions,
|
|
12
12
|
syncBlockFetchResult = _ref.syncBlockFetchResult,
|
|
13
|
-
api = _ref.api
|
|
13
|
+
api = _ref.api,
|
|
14
|
+
getAccountId = _ref.getAccountId;
|
|
14
15
|
useEffect(function () {
|
|
15
16
|
var timeoutId = setTimeout(function () {
|
|
16
17
|
var _api$analytics;
|
|
@@ -64,7 +65,8 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
|
|
|
64
65
|
reloadData: reloadData,
|
|
65
66
|
fireAnalyticsEvent: api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.fireAnalyticsEvent,
|
|
66
67
|
resourceId: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.resourceId,
|
|
67
|
-
isOffline: isCollabOffline
|
|
68
|
+
isOffline: isCollabOffline,
|
|
69
|
+
getAccountId: getAccountId
|
|
68
70
|
});
|
|
69
71
|
return result.element;
|
|
70
72
|
};
|
|
@@ -21,7 +21,8 @@ export function renderSyncedBlockContent(_ref) {
|
|
|
21
21
|
fireAnalyticsEvent = _ref.fireAnalyticsEvent,
|
|
22
22
|
resourceId = _ref.resourceId,
|
|
23
23
|
isOffline = _ref.isOffline,
|
|
24
|
-
error = _ref.error
|
|
24
|
+
error = _ref.error,
|
|
25
|
+
getAccountId = _ref.getAccountId;
|
|
25
26
|
var isSSRMode = isSSR();
|
|
26
27
|
if (isOffline && !isSSRMode) {
|
|
27
28
|
return {
|
|
@@ -59,7 +60,8 @@ export function renderSyncedBlockContent(_ref) {
|
|
|
59
60
|
resourceId: resourceId,
|
|
60
61
|
onRetry: reloadData,
|
|
61
62
|
isLoading: isLoading,
|
|
62
|
-
fireAnalyticsEvent: fireAnalyticsEvent
|
|
63
|
+
fireAnalyticsEvent: fireAnalyticsEvent,
|
|
64
|
+
getAccountId: getAccountId
|
|
63
65
|
}),
|
|
64
66
|
isSuccess: false
|
|
65
67
|
};
|
|
@@ -74,7 +76,8 @@ export function renderSyncedBlockContent(_ref) {
|
|
|
74
76
|
},
|
|
75
77
|
resourceId: resourceId,
|
|
76
78
|
sourceURL: (_syncBlockInstance$da3 = syncBlockInstance.data) === null || _syncBlockInstance$da3 === void 0 ? void 0 : _syncBlockInstance$da3.sourceURL,
|
|
77
|
-
fireAnalyticsEvent: fireAnalyticsEvent
|
|
79
|
+
fireAnalyticsEvent: fireAnalyticsEvent,
|
|
80
|
+
getAccountId: getAccountId
|
|
78
81
|
}),
|
|
79
82
|
isSuccess: false
|
|
80
83
|
};
|
|
@@ -19,6 +19,7 @@ export var useMemoizedSyncedBlockNodeComponent = function useMemoizedSyncedBlock
|
|
|
19
19
|
syncBlockProvider = _ref.syncBlockProvider,
|
|
20
20
|
syncBlockRendererOptions = _ref.syncBlockRendererOptions,
|
|
21
21
|
fireAnalyticsEvent = _ref.fireAnalyticsEvent,
|
|
22
|
+
getAccountId = _ref.getAccountId,
|
|
22
23
|
getPrefetchedData = _ref.getPrefetchedData;
|
|
23
24
|
var syncBlockStoreManager = useMemoizedSyncBlockStoreManager(syncBlockProvider, fireAnalyticsEvent);
|
|
24
25
|
|
|
@@ -53,7 +54,8 @@ export var useMemoizedSyncedBlockNodeComponent = function useMemoizedSyncedBlock
|
|
|
53
54
|
key: props.localId,
|
|
54
55
|
nodeProps: props,
|
|
55
56
|
syncBlockStoreManager: syncBlockStoreManager,
|
|
56
|
-
rendererOptions: syncBlockRendererOptions
|
|
57
|
+
rendererOptions: syncBlockRendererOptions,
|
|
58
|
+
getAccountId: getAccountId
|
|
57
59
|
})));
|
|
58
|
-
}, [syncBlockStoreManager, syncBlockRendererOptions, fireAnalyticsEvent]);
|
|
60
|
+
}, [syncBlockStoreManager, syncBlockRendererOptions, fireAnalyticsEvent, getAccountId]);
|
|
59
61
|
};
|
|
@@ -2,7 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import type { SyncedBlockRendererProps } from '@atlaskit/editor-plugin-synced-block';
|
|
3
3
|
import type { SyncedBlockRendererOptions } from './types';
|
|
4
4
|
type GetSyncedBlockRendererProps = {
|
|
5
|
+
getAccountId?: () => string | null;
|
|
5
6
|
syncBlockRendererOptions: SyncedBlockRendererOptions | undefined;
|
|
6
7
|
};
|
|
7
|
-
export declare const getSyncedBlockRenderer: ({ syncBlockRendererOptions }: GetSyncedBlockRendererProps) => ({ syncBlockFetchResult, api }: SyncedBlockRendererProps) => React.JSX.Element;
|
|
8
|
+
export declare const getSyncedBlockRenderer: ({ syncBlockRendererOptions, getAccountId }: GetSyncedBlockRendererProps) => ({ syncBlockFetchResult, api }: SyncedBlockRendererProps) => React.JSX.Element;
|
|
8
9
|
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
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, sourceURL, }: {
|
|
4
|
+
export declare const SyncedBlockErrorComponent: ({ error, isLoading, onRetry, resourceId, fireAnalyticsEvent, sourceURL, getAccountId, }: {
|
|
5
5
|
error: SyncBlockInstance["error"];
|
|
6
6
|
fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void;
|
|
7
|
+
getAccountId?: () => string | null;
|
|
7
8
|
isLoading?: boolean;
|
|
8
9
|
onRetry?: () => void;
|
|
9
10
|
resourceId?: string;
|
|
@@ -8,8 +8,9 @@ export interface SyncedBlockProps {
|
|
|
8
8
|
}
|
|
9
9
|
export type SyncedBlockNodeProps = NodeProps<SyncedBlockProps>;
|
|
10
10
|
export type SyncedBlockNodeComponentRendererProps = {
|
|
11
|
+
getAccountId?: () => string | null;
|
|
11
12
|
nodeProps: SyncedBlockNodeProps;
|
|
12
13
|
rendererOptions: SyncedBlockRendererOptions | undefined;
|
|
13
14
|
syncBlockStoreManager: SyncBlockStoreManager;
|
|
14
15
|
};
|
|
15
|
-
export declare const SyncedBlockNodeComponentRenderer: ({ nodeProps, syncBlockStoreManager, rendererOptions, }: SyncedBlockNodeComponentRendererProps) => React.JSX.Element;
|
|
16
|
+
export declare const SyncedBlockNodeComponentRenderer: ({ nodeProps, syncBlockStoreManager, rendererOptions, getAccountId, }: SyncedBlockNodeComponentRendererProps) => React.JSX.Element;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { SyncBlockProduct } from '@atlaskit/editor-synced-block-provider';
|
|
3
3
|
export interface SyncedBlockPermissionDeniedProps {
|
|
4
|
+
accountId: string | null;
|
|
4
5
|
sourceContentId: string;
|
|
5
6
|
sourceProduct: SyncBlockProduct;
|
|
6
7
|
}
|
|
7
|
-
export declare const SyncedBlockPermissionDenied: ({ sourceContentId, sourceProduct, }: SyncedBlockPermissionDeniedProps) => React.JSX.Element;
|
|
8
|
+
export declare const SyncedBlockPermissionDenied: ({ sourceContentId, sourceProduct, accountId, }: SyncedBlockPermissionDeniedProps) => React.JSX.Element;
|
|
@@ -5,7 +5,8 @@ import type { UseFetchSyncBlockDataResult } from '@atlaskit/editor-synced-block-
|
|
|
5
5
|
import type { SyncedBlockRendererOptions } from '../types';
|
|
6
6
|
export type SyncedBlockRendererProps = {
|
|
7
7
|
api?: ExtractInjectionAPI<SyncedBlockPlugin>;
|
|
8
|
+
getAccountId?: () => string | null;
|
|
8
9
|
syncBlockFetchResult: UseFetchSyncBlockDataResult;
|
|
9
10
|
syncBlockRendererOptions?: SyncedBlockRendererOptions;
|
|
10
11
|
};
|
|
11
|
-
export declare const SyncedBlockRenderer: React.MemoExoticComponent<({ syncBlockRendererOptions, syncBlockFetchResult, api, }: SyncedBlockRendererProps) => React.JSX.Element>;
|
|
12
|
+
export declare const SyncedBlockRenderer: React.MemoExoticComponent<({ syncBlockRendererOptions, syncBlockFetchResult, api, getAccountId, }: SyncedBlockRendererProps) => React.JSX.Element>;
|
|
@@ -6,6 +6,7 @@ import type { SyncedBlockRendererOptions } from '../types';
|
|
|
6
6
|
export type RenderSyncedBlockContentParams = {
|
|
7
7
|
error?: SyncBlockInstance['error'];
|
|
8
8
|
fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void;
|
|
9
|
+
getAccountId?: () => string | null;
|
|
9
10
|
isLoading: boolean;
|
|
10
11
|
isOffline?: boolean;
|
|
11
12
|
providerFactory: ProviderFactory | undefined;
|
|
@@ -21,7 +22,7 @@ export type RenderSyncedBlockContentParams = {
|
|
|
21
22
|
* Handles the common branching: loading -> SSR error -> error/deleted -> unpublished -> success.
|
|
22
23
|
* Returns null if the caller should handle rendering itself (e.g. wrapping in a container div).
|
|
23
24
|
*/
|
|
24
|
-
export declare function renderSyncedBlockContent({ syncBlockInstance, isLoading, rendererOptions, providerFactory, reloadData, fireAnalyticsEvent, resourceId, isOffline, error, }: RenderSyncedBlockContentParams): {
|
|
25
|
+
export declare function renderSyncedBlockContent({ syncBlockInstance, isLoading, rendererOptions, providerFactory, reloadData, fireAnalyticsEvent, resourceId, isOffline, error, getAccountId, }: RenderSyncedBlockContentParams): {
|
|
25
26
|
element: React.JSX.Element;
|
|
26
27
|
isSuccess: boolean;
|
|
27
28
|
};
|
|
@@ -6,10 +6,11 @@ import type { SyncedBlockRendererOptions } from './types';
|
|
|
6
6
|
import type { SyncedBlockNodeProps } from './ui/SyncedBlockNodeComponentRenderer';
|
|
7
7
|
export type GetSyncedBlockNodeComponentProps = {
|
|
8
8
|
fireAnalyticsEvent?: (payload: AnalyticsEventPayload) => void;
|
|
9
|
+
getAccountId?: () => string | null;
|
|
9
10
|
getPrefetchedData?: () => SyncBlockPrefetchData | undefined;
|
|
10
11
|
syncBlockNodes: SyncBlockNode[];
|
|
11
12
|
syncBlockProvider: SyncedBlockProvider;
|
|
12
13
|
syncBlockRendererOptions: SyncedBlockRendererOptions | undefined;
|
|
13
14
|
};
|
|
14
15
|
export declare const getSyncBlockNodesFromDoc: (doc: DocNode) => SyncBlockNode[];
|
|
15
|
-
export declare const useMemoizedSyncedBlockNodeComponent: ({ syncBlockNodes, syncBlockProvider, syncBlockRendererOptions, fireAnalyticsEvent, getPrefetchedData, }: GetSyncedBlockNodeComponentProps) => ((props: SyncedBlockNodeProps) => React.JSX.Element);
|
|
16
|
+
export declare const useMemoizedSyncedBlockNodeComponent: ({ syncBlockNodes, syncBlockProvider, syncBlockRendererOptions, fireAnalyticsEvent, getAccountId, getPrefetchedData, }: GetSyncedBlockNodeComponentProps) => ((props: SyncedBlockNodeProps) => React.JSX.Element);
|
|
@@ -2,7 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import type { SyncedBlockRendererProps } from '@atlaskit/editor-plugin-synced-block';
|
|
3
3
|
import type { SyncedBlockRendererOptions } from './types';
|
|
4
4
|
type GetSyncedBlockRendererProps = {
|
|
5
|
+
getAccountId?: () => string | null;
|
|
5
6
|
syncBlockRendererOptions: SyncedBlockRendererOptions | undefined;
|
|
6
7
|
};
|
|
7
|
-
export declare const getSyncedBlockRenderer: ({ syncBlockRendererOptions }: GetSyncedBlockRendererProps) => ({ syncBlockFetchResult, api }: SyncedBlockRendererProps) => React.JSX.Element;
|
|
8
|
+
export declare const getSyncedBlockRenderer: ({ syncBlockRendererOptions, getAccountId }: GetSyncedBlockRendererProps) => ({ syncBlockFetchResult, api }: SyncedBlockRendererProps) => React.JSX.Element;
|
|
8
9
|
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
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, sourceURL, }: {
|
|
4
|
+
export declare const SyncedBlockErrorComponent: ({ error, isLoading, onRetry, resourceId, fireAnalyticsEvent, sourceURL, getAccountId, }: {
|
|
5
5
|
error: SyncBlockInstance["error"];
|
|
6
6
|
fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void;
|
|
7
|
+
getAccountId?: () => string | null;
|
|
7
8
|
isLoading?: boolean;
|
|
8
9
|
onRetry?: () => void;
|
|
9
10
|
resourceId?: string;
|
|
@@ -8,8 +8,9 @@ export interface SyncedBlockProps {
|
|
|
8
8
|
}
|
|
9
9
|
export type SyncedBlockNodeProps = NodeProps<SyncedBlockProps>;
|
|
10
10
|
export type SyncedBlockNodeComponentRendererProps = {
|
|
11
|
+
getAccountId?: () => string | null;
|
|
11
12
|
nodeProps: SyncedBlockNodeProps;
|
|
12
13
|
rendererOptions: SyncedBlockRendererOptions | undefined;
|
|
13
14
|
syncBlockStoreManager: SyncBlockStoreManager;
|
|
14
15
|
};
|
|
15
|
-
export declare const SyncedBlockNodeComponentRenderer: ({ nodeProps, syncBlockStoreManager, rendererOptions, }: SyncedBlockNodeComponentRendererProps) => React.JSX.Element;
|
|
16
|
+
export declare const SyncedBlockNodeComponentRenderer: ({ nodeProps, syncBlockStoreManager, rendererOptions, getAccountId, }: SyncedBlockNodeComponentRendererProps) => React.JSX.Element;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { SyncBlockProduct } from '@atlaskit/editor-synced-block-provider';
|
|
3
3
|
export interface SyncedBlockPermissionDeniedProps {
|
|
4
|
+
accountId: string | null;
|
|
4
5
|
sourceContentId: string;
|
|
5
6
|
sourceProduct: SyncBlockProduct;
|
|
6
7
|
}
|
|
7
|
-
export declare const SyncedBlockPermissionDenied: ({ sourceContentId, sourceProduct, }: SyncedBlockPermissionDeniedProps) => React.JSX.Element;
|
|
8
|
+
export declare const SyncedBlockPermissionDenied: ({ sourceContentId, sourceProduct, accountId, }: SyncedBlockPermissionDeniedProps) => React.JSX.Element;
|
|
@@ -5,7 +5,8 @@ import type { UseFetchSyncBlockDataResult } from '@atlaskit/editor-synced-block-
|
|
|
5
5
|
import type { SyncedBlockRendererOptions } from '../types';
|
|
6
6
|
export type SyncedBlockRendererProps = {
|
|
7
7
|
api?: ExtractInjectionAPI<SyncedBlockPlugin>;
|
|
8
|
+
getAccountId?: () => string | null;
|
|
8
9
|
syncBlockFetchResult: UseFetchSyncBlockDataResult;
|
|
9
10
|
syncBlockRendererOptions?: SyncedBlockRendererOptions;
|
|
10
11
|
};
|
|
11
|
-
export declare const SyncedBlockRenderer: React.MemoExoticComponent<({ syncBlockRendererOptions, syncBlockFetchResult, api, }: SyncedBlockRendererProps) => React.JSX.Element>;
|
|
12
|
+
export declare const SyncedBlockRenderer: React.MemoExoticComponent<({ syncBlockRendererOptions, syncBlockFetchResult, api, getAccountId, }: SyncedBlockRendererProps) => React.JSX.Element>;
|
|
@@ -6,6 +6,7 @@ import type { SyncedBlockRendererOptions } from '../types';
|
|
|
6
6
|
export type RenderSyncedBlockContentParams = {
|
|
7
7
|
error?: SyncBlockInstance['error'];
|
|
8
8
|
fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void;
|
|
9
|
+
getAccountId?: () => string | null;
|
|
9
10
|
isLoading: boolean;
|
|
10
11
|
isOffline?: boolean;
|
|
11
12
|
providerFactory: ProviderFactory | undefined;
|
|
@@ -21,7 +22,7 @@ export type RenderSyncedBlockContentParams = {
|
|
|
21
22
|
* Handles the common branching: loading -> SSR error -> error/deleted -> unpublished -> success.
|
|
22
23
|
* Returns null if the caller should handle rendering itself (e.g. wrapping in a container div).
|
|
23
24
|
*/
|
|
24
|
-
export declare function renderSyncedBlockContent({ syncBlockInstance, isLoading, rendererOptions, providerFactory, reloadData, fireAnalyticsEvent, resourceId, isOffline, error, }: RenderSyncedBlockContentParams): {
|
|
25
|
+
export declare function renderSyncedBlockContent({ syncBlockInstance, isLoading, rendererOptions, providerFactory, reloadData, fireAnalyticsEvent, resourceId, isOffline, error, getAccountId, }: RenderSyncedBlockContentParams): {
|
|
25
26
|
element: React.JSX.Element;
|
|
26
27
|
isSuccess: boolean;
|
|
27
28
|
};
|
|
@@ -6,10 +6,11 @@ import type { SyncedBlockRendererOptions } from './types';
|
|
|
6
6
|
import type { SyncedBlockNodeProps } from './ui/SyncedBlockNodeComponentRenderer';
|
|
7
7
|
export type GetSyncedBlockNodeComponentProps = {
|
|
8
8
|
fireAnalyticsEvent?: (payload: AnalyticsEventPayload) => void;
|
|
9
|
+
getAccountId?: () => string | null;
|
|
9
10
|
getPrefetchedData?: () => SyncBlockPrefetchData | undefined;
|
|
10
11
|
syncBlockNodes: SyncBlockNode[];
|
|
11
12
|
syncBlockProvider: SyncedBlockProvider;
|
|
12
13
|
syncBlockRendererOptions: SyncedBlockRendererOptions | undefined;
|
|
13
14
|
};
|
|
14
15
|
export declare const getSyncBlockNodesFromDoc: (doc: DocNode) => SyncBlockNode[];
|
|
15
|
-
export declare const useMemoizedSyncedBlockNodeComponent: ({ syncBlockNodes, syncBlockProvider, syncBlockRendererOptions, fireAnalyticsEvent, getPrefetchedData, }: GetSyncedBlockNodeComponentProps) => ((props: SyncedBlockNodeProps) => React.JSX.Element);
|
|
16
|
+
export declare const useMemoizedSyncedBlockNodeComponent: ({ syncBlockNodes, syncBlockProvider, syncBlockRendererOptions, fireAnalyticsEvent, getAccountId, getPrefetchedData, }: GetSyncedBlockNodeComponentProps) => ((props: SyncedBlockNodeProps) => React.JSX.Element);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-synced-block-renderer",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.2.0",
|
|
4
4
|
"description": "SyncedBlockRenderer for @atlaskit/editor-plugin-synced-block",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -37,25 +37,25 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@atlaskit/button": "^23.11.0",
|
|
39
39
|
"@atlaskit/css": "^0.19.0",
|
|
40
|
-
"@atlaskit/editor-plugin-synced-block": "^8.
|
|
41
|
-
"@atlaskit/editor-synced-block-provider": "^6.
|
|
40
|
+
"@atlaskit/editor-plugin-synced-block": "^8.1.0",
|
|
41
|
+
"@atlaskit/editor-synced-block-provider": "^6.3.0",
|
|
42
42
|
"@atlaskit/heading": "^5.4.0",
|
|
43
|
-
"@atlaskit/icon": "^34.
|
|
44
|
-
"@atlaskit/icon-lab": "^6.
|
|
43
|
+
"@atlaskit/icon": "^34.3.0",
|
|
44
|
+
"@atlaskit/icon-lab": "^6.6.0",
|
|
45
45
|
"@atlaskit/image": "^3.0.0",
|
|
46
46
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
47
47
|
"@atlaskit/primitives": "^19.0.0",
|
|
48
48
|
"@atlaskit/renderer": "^130.2.0",
|
|
49
49
|
"@atlaskit/spinner": "^19.1.0",
|
|
50
50
|
"@atlaskit/tokens": "^13.0.0",
|
|
51
|
-
"@atlaskit/tooltip": "^21.
|
|
51
|
+
"@atlaskit/tooltip": "^21.2.0",
|
|
52
52
|
"@babel/runtime": "^7.0.0",
|
|
53
53
|
"@compiled/react": "^0.20.0",
|
|
54
54
|
"react-relay": "npm:atl-react-relay@0.0.0-main-39e79f66",
|
|
55
55
|
"relay-runtime": "npm:atl-relay-runtime@0.0.0-main-39e79f66"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"@atlaskit/editor-common": "^114.
|
|
58
|
+
"@atlaskit/editor-common": "^114.13.0",
|
|
59
59
|
"react": "^18.2.0",
|
|
60
60
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
61
61
|
},
|
|
@@ -100,6 +100,9 @@
|
|
|
100
100
|
"platform-feature-flags": {
|
|
101
101
|
"platform_synced_block_patch_8": {
|
|
102
102
|
"type": "boolean"
|
|
103
|
+
},
|
|
104
|
+
"platform_synced_block_patch_10": {
|
|
105
|
+
"type": "boolean"
|
|
103
106
|
}
|
|
104
107
|
}
|
|
105
108
|
}
|