@atlaskit/smart-card 23.6.6 → 23.7.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 +12 -0
- package/dist/cjs/constants.js +2 -0
- package/dist/cjs/extractors/flexible/index.js +1 -0
- package/dist/cjs/extractors/flexible/utils.js +9 -2
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/BlockCard/actions/flexible/ForbiddenAction.js +12 -4
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleForbiddenView.js +35 -3
- package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/common/atlaskit-icon/index.js +4 -0
- package/dist/cjs/view/FlexibleCard/components/elements/index.js +9 -2
- package/dist/cjs/view/FlexibleCard/components/elements/utils.js +6 -0
- package/dist/cjs/view/HoverCard/utils.js +1 -1
- package/dist/es2019/constants.js +2 -0
- package/dist/es2019/extractors/flexible/index.js +2 -1
- package/dist/es2019/extractors/flexible/utils.js +5 -1
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/BlockCard/actions/flexible/ForbiddenAction.js +11 -4
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleForbiddenView.js +34 -3
- package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/common/atlaskit-icon/index.js +3 -0
- package/dist/es2019/view/FlexibleCard/components/elements/index.js +6 -0
- package/dist/es2019/view/FlexibleCard/components/elements/utils.js +7 -0
- package/dist/es2019/view/HoverCard/utils.js +1 -1
- package/dist/esm/constants.js +2 -0
- package/dist/esm/extractors/flexible/index.js +2 -1
- package/dist/esm/extractors/flexible/utils.js +4 -0
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/BlockCard/actions/flexible/ForbiddenAction.js +11 -4
- package/dist/esm/view/BlockCard/views/flexible/FlexibleForbiddenView.js +32 -4
- package/dist/esm/view/FlexibleCard/components/blocks/utils.js +1 -1
- package/dist/esm/view/FlexibleCard/components/common/atlaskit-icon/index.js +4 -0
- package/dist/esm/view/FlexibleCard/components/elements/index.js +6 -0
- package/dist/esm/view/FlexibleCard/components/elements/utils.js +6 -0
- package/dist/esm/view/HoverCard/utils.js +1 -1
- package/dist/types/constants.d.ts +2 -0
- package/dist/types/extractors/flexible/utils.d.ts +1 -0
- package/dist/types/state/flexible-ui-context/types.d.ts +5 -0
- package/dist/types/view/BlockCard/actions/flexible/ForbiddenAction.d.ts +5 -2
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +8 -1
- package/dist/types/view/FlexibleCard/components/elements/index.d.ts +5 -0
- package/package.json +1 -1
- package/report.api.md +8 -0
- package/tmp/api-report-tmp.d.ts +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 23.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`3cae92db2b6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3cae92db2b6) - [ux] Introduces ChecklistProgress element, adds to Trello Hover Cards
|
|
8
|
+
|
|
9
|
+
## 23.6.7
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`9110a0daf0e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9110a0daf0e) - [ux] Added support of different forbidden views for Block Card with Flexible UI
|
|
14
|
+
|
|
3
15
|
## 23.6.6
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/cjs/constants.js
CHANGED
|
@@ -133,6 +133,7 @@ exports.ElementName = ElementName;
|
|
|
133
133
|
(function (ElementName) {
|
|
134
134
|
ElementName["AttachmentCount"] = "AttachmentCount";
|
|
135
135
|
ElementName["AuthorGroup"] = "AuthorGroup";
|
|
136
|
+
ElementName["ChecklistProgress"] = "ChecklistProgress";
|
|
136
137
|
ElementName["CollaboratorGroup"] = "CollaboratorGroup";
|
|
137
138
|
ElementName["CommentCount"] = "CommentCount";
|
|
138
139
|
ElementName["CreatedBy"] = "CreatedBy";
|
|
@@ -225,6 +226,7 @@ exports.IconType = IconType;
|
|
|
225
226
|
IconType["Error"] = "Default:Error";
|
|
226
227
|
IconType["Forbidden"] = "Default:Forbidden";
|
|
227
228
|
IconType["Attachment"] = "Badge:Attachment";
|
|
229
|
+
IconType["CheckItem"] = "Badge:Task";
|
|
228
230
|
IconType["Comment"] = "Badge:Comment";
|
|
229
231
|
IconType["View"] = "Badge:View";
|
|
230
232
|
IconType["React"] = "Badge:React";
|
|
@@ -48,6 +48,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext(response, rende
|
|
|
48
48
|
viewCount: (0, _utils.extractViewCount)(data),
|
|
49
49
|
reactCount: (0, _utils.extractReactCount)(data),
|
|
50
50
|
voteCount: (0, _utils.extractVoteCount)(data),
|
|
51
|
+
checklistProgress: (0, _utils.extractChecklistProgress)(data),
|
|
51
52
|
createdBy: (0, _utils.extractCreatedBy)(data),
|
|
52
53
|
createdOn: (0, _extractors.extractDateCreated)(data),
|
|
53
54
|
dueOn: (0, _utils.extractDueOn)(data),
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.extractVoteCount = exports.extractViewCount = exports.extractTargetBranch = exports.extractSubscriberCount = exports.extractSourceBranch = exports.extractReactCount = exports.extractProgrammingLanguage = exports.extractModifiedBy = exports.extractDueOn = exports.extractCreatedBy = exports.extractCommentCount = exports.extractAttachmentCount = void 0;
|
|
8
|
+
exports.extractVoteCount = exports.extractViewCount = exports.extractTargetBranch = exports.extractSubscriberCount = exports.extractSourceBranch = exports.extractReactCount = exports.extractProgrammingLanguage = exports.extractModifiedBy = exports.extractDueOn = exports.extractCreatedBy = exports.extractCommentCount = exports.extractChecklistProgress = exports.extractAttachmentCount = void 0;
|
|
9
9
|
|
|
10
10
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
11
|
|
|
@@ -99,4 +99,11 @@ var extractTargetBranch = function extractTargetBranch(data) {
|
|
|
99
99
|
return extractLinkName(data['atlassian:mergeDestination']);
|
|
100
100
|
};
|
|
101
101
|
|
|
102
|
-
exports.extractTargetBranch = extractTargetBranch;
|
|
102
|
+
exports.extractTargetBranch = extractTargetBranch;
|
|
103
|
+
|
|
104
|
+
var extractChecklistProgress = function extractChecklistProgress(data) {
|
|
105
|
+
var checkItemsObj = extractValue(data, 'atlassian:checkItems');
|
|
106
|
+
return checkItemsObj ? "".concat(checkItemsObj.checkedItems, "/").concat(checkItemsObj.totalItems) : undefined;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
exports.extractChecklistProgress = extractChecklistProgress;
|
package/dist/cjs/version.json
CHANGED
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.ForbiddenAction = void 0;
|
|
9
9
|
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
10
12
|
var _react = _interopRequireDefault(require("react"));
|
|
11
13
|
|
|
12
14
|
var _reactIntlNext = require("react-intl-next");
|
|
@@ -19,13 +21,19 @@ var _messages = require("../../../../messages");
|
|
|
19
21
|
* Returns a CustomActionItem with a "Try Another Account" default message
|
|
20
22
|
*
|
|
21
23
|
* @see CustomActionItem
|
|
22
|
-
* @param
|
|
24
|
+
* @param onClick a function that will be called on the click of the button
|
|
25
|
+
* @param content is a message key for a message to be displayed in the action
|
|
26
|
+
* @param context is a variable for a message in case a message contains a placeholder
|
|
23
27
|
*/
|
|
24
|
-
var ForbiddenAction = function ForbiddenAction(
|
|
28
|
+
var ForbiddenAction = function ForbiddenAction(onClick, content, context) {
|
|
25
29
|
return {
|
|
26
30
|
name: _constants.ActionName.CustomAction,
|
|
27
|
-
content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages
|
|
28
|
-
|
|
31
|
+
content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _messages.messages[content], {
|
|
32
|
+
values: {
|
|
33
|
+
context: context
|
|
34
|
+
}
|
|
35
|
+
})),
|
|
36
|
+
onClick: onClick
|
|
29
37
|
};
|
|
30
38
|
};
|
|
31
39
|
|
|
@@ -9,6 +9,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports.default = void 0;
|
|
11
11
|
|
|
12
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
+
|
|
12
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
15
|
|
|
14
16
|
var _FlexibleCard = _interopRequireDefault(require("../../../FlexibleCard"));
|
|
@@ -31,6 +33,12 @@ var _ForbiddenAction = require("../../actions/flexible/ForbiddenAction");
|
|
|
31
33
|
|
|
32
34
|
var _text = _interopRequireDefault(require("../../../FlexibleCard/components/elements/text"));
|
|
33
35
|
|
|
36
|
+
var _jsonld = require("../../../../utils/jsonld");
|
|
37
|
+
|
|
38
|
+
var _extractors = require("@atlaskit/linking-common/extractors");
|
|
39
|
+
|
|
40
|
+
var _context = require("../../../../extractors/common/context");
|
|
41
|
+
|
|
34
42
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
35
43
|
|
|
36
44
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -43,6 +51,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
43
51
|
* @see FlexibleCardProps
|
|
44
52
|
*/
|
|
45
53
|
var FlexibleForbiddenView = function FlexibleForbiddenView(_ref) {
|
|
54
|
+
var _details$meta;
|
|
55
|
+
|
|
46
56
|
var cardState = _ref.cardState,
|
|
47
57
|
onAuthorize = _ref.onAuthorize,
|
|
48
58
|
onClick = _ref.onClick,
|
|
@@ -52,9 +62,28 @@ var FlexibleForbiddenView = function FlexibleForbiddenView(_ref) {
|
|
|
52
62
|
ui = _ref.ui,
|
|
53
63
|
url = _ref.url;
|
|
54
64
|
var status = cardState.status;
|
|
65
|
+
var details = cardState === null || cardState === void 0 ? void 0 : cardState.details;
|
|
66
|
+
var cardMetadata = (_details$meta = details === null || details === void 0 ? void 0 : details.meta) !== null && _details$meta !== void 0 ? _details$meta : (0, _jsonld.getForbiddenJsonLd)().meta;
|
|
67
|
+
var provider = (0, _extractors.extractProvider)(details === null || details === void 0 ? void 0 : details.data);
|
|
68
|
+
var providerName = (provider === null || provider === void 0 ? void 0 : provider.text) || '';
|
|
69
|
+
var requestAccessContext = (0, _context.extractRequestAccessContext)({
|
|
70
|
+
jsonLd: cardMetadata,
|
|
71
|
+
url: url,
|
|
72
|
+
context: providerName
|
|
73
|
+
});
|
|
74
|
+
var descriptiveMessageKey = requestAccessContext && requestAccessContext.descriptiveMessageKey ? requestAccessContext.descriptiveMessageKey : 'invalid_permissions_description';
|
|
55
75
|
var actions = (0, _react.useMemo)(function () {
|
|
56
|
-
|
|
57
|
-
|
|
76
|
+
var actionFromAccessContext = [];
|
|
77
|
+
var tryAnotherAccountAction = onAuthorize ? [(0, _ForbiddenAction.ForbiddenAction)(onAuthorize, 'try_another_account')] : [];
|
|
78
|
+
|
|
79
|
+
if (requestAccessContext) {
|
|
80
|
+
var action = requestAccessContext.action,
|
|
81
|
+
callToActionMessageKey = requestAccessContext.callToActionMessageKey;
|
|
82
|
+
actionFromAccessContext = action && callToActionMessageKey ? [(0, _ForbiddenAction.ForbiddenAction)(action.promise, callToActionMessageKey, providerName)] : [];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return [].concat(tryAnotherAccountAction, (0, _toConsumableArray2.default)(actionFromAccessContext));
|
|
86
|
+
}, [onAuthorize, requestAccessContext, providerName]);
|
|
58
87
|
return /*#__PURE__*/_react.default.createElement(_FlexibleCard.default, {
|
|
59
88
|
appearance: "block",
|
|
60
89
|
cardState: cardState,
|
|
@@ -73,7 +102,10 @@ var FlexibleForbiddenView = function FlexibleForbiddenView(_ref) {
|
|
|
73
102
|
testId: "".concat(testId, "-lock-icon")
|
|
74
103
|
}), /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
75
104
|
message: {
|
|
76
|
-
descriptor: _messages.messages
|
|
105
|
+
descriptor: _messages.messages[descriptiveMessageKey],
|
|
106
|
+
values: {
|
|
107
|
+
context: providerName
|
|
108
|
+
}
|
|
77
109
|
}
|
|
78
110
|
})), /*#__PURE__*/_react.default.createElement(_blocks.CustomBlock, null, /*#__PURE__*/_react.default.createElement(_footer.default, {
|
|
79
111
|
actions: actions,
|
|
@@ -48,7 +48,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
48
48
|
|
|
49
49
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
50
50
|
|
|
51
|
-
var ElementDisplaySchema = (_ElementDisplaySchema = {}, (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.AttachmentCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.AuthorGroup, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CollaboratorGroup, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CommentCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ViewCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ReactCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.VoteCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CreatedBy, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CreatedOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.DueOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.LatestCommit, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.LinkIcon, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ModifiedBy, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ModifiedOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Preview, ['block']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Priority, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ProgrammingLanguage, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Provider, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Snippet, ['block']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.SourceBranch, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.State, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.SubscriberCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.TargetBranch, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Title, ['inline']), _ElementDisplaySchema);
|
|
51
|
+
var ElementDisplaySchema = (_ElementDisplaySchema = {}, (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.AttachmentCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.AuthorGroup, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ChecklistProgress, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CollaboratorGroup, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CommentCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ViewCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ReactCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.VoteCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CreatedBy, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CreatedOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.DueOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.LatestCommit, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.LinkIcon, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ModifiedBy, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ModifiedOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Preview, ['block']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Priority, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ProgrammingLanguage, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Provider, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Snippet, ['block']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.SourceBranch, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.State, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.SubscriberCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.TargetBranch, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Title, ['inline']), _ElementDisplaySchema);
|
|
52
52
|
exports.ElementDisplaySchema = ElementDisplaySchema;
|
|
53
53
|
|
|
54
54
|
var getDirectionStyles = function getDirectionStyles(direction) {
|
|
@@ -210,6 +210,10 @@ var importIconMapper = (_importIconMapper = {}, (0, _defineProperty2.default)(_i
|
|
|
210
210
|
return Promise.resolve().then(function () {
|
|
211
211
|
return _interopRequireWildcard(require('@atlaskit/icon/glyph/attachment'));
|
|
212
212
|
});
|
|
213
|
+
}), (0, _defineProperty2.default)(_importIconMapper, _constants.IconType.CheckItem, function () {
|
|
214
|
+
return Promise.resolve().then(function () {
|
|
215
|
+
return _interopRequireWildcard(require('@atlaskit/icon/glyph/task'));
|
|
216
|
+
});
|
|
213
217
|
}), (0, _defineProperty2.default)(_importIconMapper, _constants.IconType.Comment, function () {
|
|
214
218
|
return Promise.resolve().then(function () {
|
|
215
219
|
return _interopRequireWildcard(require('@atlaskit/icon/glyph/comment'));
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.VoteCount = exports.ViewCount = exports.Title = exports.TargetBranch = exports.SubscriberCount = exports.State = exports.SourceBranch = exports.Snippet = exports.ReactCount = exports.Provider = exports.ProgrammingLanguage = exports.Priority = exports.Preview = exports.ModifiedOn = exports.ModifiedBy = exports.LinkIcon = exports.LatestCommit = exports.DueOn = exports.CreatedOn = exports.CreatedBy = exports.CommentCount = exports.CollaboratorGroup = exports.AuthorGroup = exports.AttachmentCount = void 0;
|
|
6
|
+
exports.VoteCount = exports.ViewCount = exports.Title = exports.TargetBranch = exports.SubscriberCount = exports.State = exports.SourceBranch = exports.Snippet = exports.ReactCount = exports.Provider = exports.ProgrammingLanguage = exports.Priority = exports.Preview = exports.ModifiedOn = exports.ModifiedBy = exports.LinkIcon = exports.LatestCommit = exports.DueOn = exports.CreatedOn = exports.CreatedBy = exports.CommentCount = exports.CollaboratorGroup = exports.ChecklistProgress = exports.AuthorGroup = exports.AttachmentCount = void 0;
|
|
7
7
|
|
|
8
8
|
var _utils = require("./utils");
|
|
9
9
|
|
|
@@ -25,12 +25,19 @@ var AttachmentCount = (0, _utils.createElement)(_constants.ElementName.Attachmen
|
|
|
25
25
|
|
|
26
26
|
exports.AttachmentCount = AttachmentCount;
|
|
27
27
|
var AuthorGroup = (0, _utils.createElement)(_constants.ElementName.AuthorGroup);
|
|
28
|
+
/**
|
|
29
|
+
* Creates a Checklist Badge element using the data from ChecklistProgress in the Flexible UI Context.
|
|
30
|
+
* @see Badge
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
exports.AuthorGroup = AuthorGroup;
|
|
34
|
+
var ChecklistProgress = (0, _utils.createElement)(_constants.ElementName.ChecklistProgress);
|
|
28
35
|
/**
|
|
29
36
|
* An AvatarGroup element using the data from CollaboratorGroup in the Flexible UI Context.
|
|
30
37
|
* @see AvatarGroup
|
|
31
38
|
*/
|
|
32
39
|
|
|
33
|
-
exports.
|
|
40
|
+
exports.ChecklistProgress = ChecklistProgress;
|
|
34
41
|
var CollaboratorGroup = (0, _utils.createElement)(_constants.ElementName.CollaboratorGroup);
|
|
35
42
|
/**
|
|
36
43
|
* Creates a CommentCount Badge element using the data from CommentCount in the Flexible UI Context.
|
|
@@ -59,6 +59,11 @@ var elementMappings = (_elementMappings = {}, (0, _defineProperty2.default)(_ele
|
|
|
59
59
|
}
|
|
60
60
|
}), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.AuthorGroup, {
|
|
61
61
|
component: _avatarGroup.default
|
|
62
|
+
}), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.ChecklistProgress, {
|
|
63
|
+
component: _badge.default,
|
|
64
|
+
props: {
|
|
65
|
+
icon: _constants.IconType.CheckItem
|
|
66
|
+
}
|
|
62
67
|
}), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.CollaboratorGroup, {
|
|
63
68
|
component: _avatarGroup.default
|
|
64
69
|
}), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.CommentCount, {
|
|
@@ -149,6 +154,7 @@ var getData = function getData(elementName, contextKey, context) {
|
|
|
149
154
|
return toAvatarGroupProps(data);
|
|
150
155
|
|
|
151
156
|
case _constants.ElementName.AttachmentCount:
|
|
157
|
+
case _constants.ElementName.ChecklistProgress:
|
|
152
158
|
case _constants.ElementName.CommentCount:
|
|
153
159
|
case _constants.ElementName.ViewCount:
|
|
154
160
|
case _constants.ElementName.ReactCount:
|
|
@@ -65,7 +65,7 @@ var getSimulatedMetadata = function getSimulatedMetadata() {
|
|
|
65
65
|
return {
|
|
66
66
|
metadata: {
|
|
67
67
|
primary: [_constants.ElementName.AuthorGroup, _constants.ElementName.State, _constants.ElementName.DueOn],
|
|
68
|
-
secondary: [_constants.ElementName.ReactCount, _constants.ElementName.CommentCount, _constants.ElementName.AttachmentCount],
|
|
68
|
+
secondary: [_constants.ElementName.ReactCount, _constants.ElementName.CommentCount, _constants.ElementName.AttachmentCount, _constants.ElementName.ChecklistProgress],
|
|
69
69
|
subtitle: []
|
|
70
70
|
}
|
|
71
71
|
};
|
package/dist/es2019/constants.js
CHANGED
|
@@ -110,6 +110,7 @@ export let ElementName;
|
|
|
110
110
|
(function (ElementName) {
|
|
111
111
|
ElementName["AttachmentCount"] = "AttachmentCount";
|
|
112
112
|
ElementName["AuthorGroup"] = "AuthorGroup";
|
|
113
|
+
ElementName["ChecklistProgress"] = "ChecklistProgress";
|
|
113
114
|
ElementName["CollaboratorGroup"] = "CollaboratorGroup";
|
|
114
115
|
ElementName["CommentCount"] = "CommentCount";
|
|
115
116
|
ElementName["CreatedBy"] = "CreatedBy";
|
|
@@ -198,6 +199,7 @@ export let IconType;
|
|
|
198
199
|
IconType["Error"] = "Default:Error";
|
|
199
200
|
IconType["Forbidden"] = "Default:Forbidden";
|
|
200
201
|
IconType["Attachment"] = "Badge:Attachment";
|
|
202
|
+
IconType["CheckItem"] = "Badge:Task";
|
|
201
203
|
IconType["Comment"] = "Badge:Comment";
|
|
202
204
|
IconType["View"] = "Badge:View";
|
|
203
205
|
IconType["React"] = "Badge:React";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { extractSummary } from '../common/primitives';
|
|
2
2
|
import { extractLozenge } from '../common/lozenge';
|
|
3
3
|
import { extractLinkIcon } from './icon';
|
|
4
|
-
import { extractAttachmentCount, extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount, extractViewCount, extractReactCount, extractVoteCount, extractSourceBranch, extractTargetBranch, extractDueOn } from './utils';
|
|
4
|
+
import { extractAttachmentCount, extractChecklistProgress, extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount, extractViewCount, extractReactCount, extractVoteCount, extractSourceBranch, extractTargetBranch, extractDueOn } from './utils';
|
|
5
5
|
import { extractPersonsUpdatedBy } from './collaboratorGroup';
|
|
6
6
|
import { extractPersonCreatedBy, extractTitle, extractDateUpdated, extractDateCreated, extractLink } from '@atlaskit/linking-common/extractors';
|
|
7
7
|
import extractPriority from './extract-priority';
|
|
@@ -27,6 +27,7 @@ const extractFlexibleUiContext = (response, renderers) => {
|
|
|
27
27
|
viewCount: extractViewCount(data),
|
|
28
28
|
reactCount: extractReactCount(data),
|
|
29
29
|
voteCount: extractVoteCount(data),
|
|
30
|
+
checklistProgress: extractChecklistProgress(data),
|
|
30
31
|
createdBy: extractCreatedBy(data),
|
|
31
32
|
createdOn: extractDateCreated(data),
|
|
32
33
|
dueOn: extractDueOn(data),
|
|
@@ -33,4 +33,8 @@ export const extractProgrammingLanguage = data => extractValue(data, 'schema:pro
|
|
|
33
33
|
export const extractSourceBranch = data => extractLinkName(data['atlassian:mergeSource']);
|
|
34
34
|
export const extractSubscriberCount = data => extractValue(data, 'atlassian:subscriberCount');
|
|
35
35
|
export const extractAttachmentCount = data => extractValue(data, 'atlassian:attachmentCount');
|
|
36
|
-
export const extractTargetBranch = data => extractLinkName(data['atlassian:mergeDestination']);
|
|
36
|
+
export const extractTargetBranch = data => extractLinkName(data['atlassian:mergeDestination']);
|
|
37
|
+
export const extractChecklistProgress = data => {
|
|
38
|
+
const checkItemsObj = extractValue(data, 'atlassian:checkItems');
|
|
39
|
+
return checkItemsObj ? `${checkItemsObj.checkedItems}/${checkItemsObj.totalItems}` : undefined;
|
|
40
|
+
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { FormattedMessage } from 'react-intl-next';
|
|
3
4
|
import { ActionName } from '../../../../constants';
|
|
@@ -6,11 +7,17 @@ import { messages } from '../../../../messages';
|
|
|
6
7
|
* Returns a CustomActionItem with a "Try Another Account" default message
|
|
7
8
|
*
|
|
8
9
|
* @see CustomActionItem
|
|
9
|
-
* @param
|
|
10
|
+
* @param onClick a function that will be called on the click of the button
|
|
11
|
+
* @param content is a message key for a message to be displayed in the action
|
|
12
|
+
* @param context is a variable for a message in case a message contains a placeholder
|
|
10
13
|
*/
|
|
11
14
|
|
|
12
|
-
export const ForbiddenAction =
|
|
15
|
+
export const ForbiddenAction = (onClick, content, context) => ({
|
|
13
16
|
name: ActionName.CustomAction,
|
|
14
|
-
content: /*#__PURE__*/React.createElement(FormattedMessage, messages
|
|
15
|
-
|
|
17
|
+
content: /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages[content], {
|
|
18
|
+
values: {
|
|
19
|
+
context
|
|
20
|
+
}
|
|
21
|
+
})),
|
|
22
|
+
onClick: onClick
|
|
16
23
|
});
|
|
@@ -9,7 +9,9 @@ import LockIcon from '@atlaskit/icon/glyph/lock-filled';
|
|
|
9
9
|
import BlockCardFooter from '../../components/flexible/footer';
|
|
10
10
|
import { ForbiddenAction } from '../../actions/flexible/ForbiddenAction';
|
|
11
11
|
import Text from '../../../FlexibleCard/components/elements/text';
|
|
12
|
-
|
|
12
|
+
import { getForbiddenJsonLd } from '../../../../utils/jsonld';
|
|
13
|
+
import { extractProvider } from '@atlaskit/linking-common/extractors';
|
|
14
|
+
import { extractRequestAccessContext } from '../../../../extractors/common/context';
|
|
13
15
|
/**
|
|
14
16
|
* This view represent a Block Card with the 'Forbidden' status.
|
|
15
17
|
* It should have a "Try another account" button that will allow a user to connect another account and view the block card.
|
|
@@ -17,6 +19,7 @@ import Text from '../../../FlexibleCard/components/elements/text';
|
|
|
17
19
|
* @see SmartLinkStatus
|
|
18
20
|
* @see FlexibleCardProps
|
|
19
21
|
*/
|
|
22
|
+
|
|
20
23
|
const FlexibleForbiddenView = ({
|
|
21
24
|
cardState,
|
|
22
25
|
onAuthorize,
|
|
@@ -26,8 +29,33 @@ const FlexibleForbiddenView = ({
|
|
|
26
29
|
ui,
|
|
27
30
|
url
|
|
28
31
|
}) => {
|
|
32
|
+
var _details$meta;
|
|
33
|
+
|
|
29
34
|
const status = cardState.status;
|
|
30
|
-
const
|
|
35
|
+
const details = cardState === null || cardState === void 0 ? void 0 : cardState.details;
|
|
36
|
+
const cardMetadata = (_details$meta = details === null || details === void 0 ? void 0 : details.meta) !== null && _details$meta !== void 0 ? _details$meta : getForbiddenJsonLd().meta;
|
|
37
|
+
const provider = extractProvider(details === null || details === void 0 ? void 0 : details.data);
|
|
38
|
+
const providerName = (provider === null || provider === void 0 ? void 0 : provider.text) || '';
|
|
39
|
+
const requestAccessContext = extractRequestAccessContext({
|
|
40
|
+
jsonLd: cardMetadata,
|
|
41
|
+
url,
|
|
42
|
+
context: providerName
|
|
43
|
+
});
|
|
44
|
+
const descriptiveMessageKey = requestAccessContext && requestAccessContext.descriptiveMessageKey ? requestAccessContext.descriptiveMessageKey : 'invalid_permissions_description';
|
|
45
|
+
const actions = useMemo(() => {
|
|
46
|
+
let actionFromAccessContext = [];
|
|
47
|
+
const tryAnotherAccountAction = onAuthorize ? [ForbiddenAction(onAuthorize, 'try_another_account')] : [];
|
|
48
|
+
|
|
49
|
+
if (requestAccessContext) {
|
|
50
|
+
const {
|
|
51
|
+
action,
|
|
52
|
+
callToActionMessageKey
|
|
53
|
+
} = requestAccessContext;
|
|
54
|
+
actionFromAccessContext = action && callToActionMessageKey ? [ForbiddenAction(action.promise, callToActionMessageKey, providerName)] : [];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return [...tryAnotherAccountAction, ...actionFromAccessContext];
|
|
58
|
+
}, [onAuthorize, requestAccessContext, providerName]);
|
|
31
59
|
return /*#__PURE__*/React.createElement(FlexibleCard, {
|
|
32
60
|
appearance: "block",
|
|
33
61
|
cardState: cardState,
|
|
@@ -46,7 +74,10 @@ const FlexibleForbiddenView = ({
|
|
|
46
74
|
testId: `${testId}-lock-icon`
|
|
47
75
|
}), /*#__PURE__*/React.createElement(Text, {
|
|
48
76
|
message: {
|
|
49
|
-
descriptor: messages
|
|
77
|
+
descriptor: messages[descriptiveMessageKey],
|
|
78
|
+
values: {
|
|
79
|
+
context: providerName
|
|
80
|
+
}
|
|
50
81
|
}
|
|
51
82
|
})), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(BlockCardFooter, {
|
|
52
83
|
actions: actions,
|
|
@@ -10,6 +10,7 @@ import ElementGroup from './element-group';
|
|
|
10
10
|
export const ElementDisplaySchema = {
|
|
11
11
|
[ElementName.AttachmentCount]: ['inline'],
|
|
12
12
|
[ElementName.AuthorGroup]: ['inline'],
|
|
13
|
+
[ElementName.ChecklistProgress]: ['inline'],
|
|
13
14
|
[ElementName.CollaboratorGroup]: ['inline'],
|
|
14
15
|
[ElementName.CommentCount]: ['inline'],
|
|
15
16
|
[ElementName.ViewCount]: ['inline'],
|
|
@@ -146,6 +146,9 @@ const importIconMapper = {
|
|
|
146
146
|
[IconType.Attachment]: () => import(
|
|
147
147
|
/* webpackChunkName: "glyphAttachment" */
|
|
148
148
|
'@atlaskit/icon/glyph/attachment'),
|
|
149
|
+
[IconType.CheckItem]: () => import(
|
|
150
|
+
/* webpackChunkName: "glyphAttachment" */
|
|
151
|
+
'@atlaskit/icon/glyph/task'),
|
|
149
152
|
[IconType.Comment]: () => import(
|
|
150
153
|
/* webpackChunkName: "glyphComment" */
|
|
151
154
|
'@atlaskit/icon/glyph/comment'),
|
|
@@ -15,6 +15,12 @@ export const AttachmentCount = createElement(ElementName.AttachmentCount);
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
export const AuthorGroup = createElement(ElementName.AuthorGroup);
|
|
18
|
+
/**
|
|
19
|
+
* Creates a Checklist Badge element using the data from ChecklistProgress in the Flexible UI Context.
|
|
20
|
+
* @see Badge
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
export const ChecklistProgress = createElement(ElementName.ChecklistProgress);
|
|
18
24
|
/**
|
|
19
25
|
* An AvatarGroup element using the data from CollaboratorGroup in the Flexible UI Context.
|
|
20
26
|
* @see AvatarGroup
|
|
@@ -25,6 +25,12 @@ const elementMappings = {
|
|
|
25
25
|
[ElementName.AuthorGroup]: {
|
|
26
26
|
component: AvatarGroup
|
|
27
27
|
},
|
|
28
|
+
[ElementName.ChecklistProgress]: {
|
|
29
|
+
component: Badge,
|
|
30
|
+
props: {
|
|
31
|
+
icon: IconType.CheckItem
|
|
32
|
+
}
|
|
33
|
+
},
|
|
28
34
|
[ElementName.CollaboratorGroup]: {
|
|
29
35
|
component: AvatarGroup
|
|
30
36
|
},
|
|
@@ -139,6 +145,7 @@ const getData = (elementName, contextKey, context) => {
|
|
|
139
145
|
return toAvatarGroupProps(data);
|
|
140
146
|
|
|
141
147
|
case ElementName.AttachmentCount:
|
|
148
|
+
case ElementName.ChecklistProgress:
|
|
142
149
|
case ElementName.CommentCount:
|
|
143
150
|
case ElementName.ViewCount:
|
|
144
151
|
case ElementName.ReactCount:
|
|
@@ -44,7 +44,7 @@ export const getSimulatedMetadata = (extensionKey = '', types = []) => {
|
|
|
44
44
|
return {
|
|
45
45
|
metadata: {
|
|
46
46
|
primary: [ElementName.AuthorGroup, ElementName.State, ElementName.DueOn],
|
|
47
|
-
secondary: [ElementName.ReactCount, ElementName.CommentCount, ElementName.AttachmentCount],
|
|
47
|
+
secondary: [ElementName.ReactCount, ElementName.CommentCount, ElementName.AttachmentCount, ElementName.ChecklistProgress],
|
|
48
48
|
subtitle: []
|
|
49
49
|
}
|
|
50
50
|
};
|
package/dist/esm/constants.js
CHANGED
|
@@ -110,6 +110,7 @@ export var ElementName;
|
|
|
110
110
|
(function (ElementName) {
|
|
111
111
|
ElementName["AttachmentCount"] = "AttachmentCount";
|
|
112
112
|
ElementName["AuthorGroup"] = "AuthorGroup";
|
|
113
|
+
ElementName["ChecklistProgress"] = "ChecklistProgress";
|
|
113
114
|
ElementName["CollaboratorGroup"] = "CollaboratorGroup";
|
|
114
115
|
ElementName["CommentCount"] = "CommentCount";
|
|
115
116
|
ElementName["CreatedBy"] = "CreatedBy";
|
|
@@ -198,6 +199,7 @@ export var IconType;
|
|
|
198
199
|
IconType["Error"] = "Default:Error";
|
|
199
200
|
IconType["Forbidden"] = "Default:Forbidden";
|
|
200
201
|
IconType["Attachment"] = "Badge:Attachment";
|
|
202
|
+
IconType["CheckItem"] = "Badge:Task";
|
|
201
203
|
IconType["Comment"] = "Badge:Comment";
|
|
202
204
|
IconType["View"] = "Badge:View";
|
|
203
205
|
IconType["React"] = "Badge:React";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { extractSummary } from '../common/primitives';
|
|
2
2
|
import { extractLozenge } from '../common/lozenge';
|
|
3
3
|
import { extractLinkIcon } from './icon';
|
|
4
|
-
import { extractAttachmentCount, extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount, extractViewCount, extractReactCount, extractVoteCount, extractSourceBranch, extractTargetBranch, extractDueOn } from './utils';
|
|
4
|
+
import { extractAttachmentCount, extractChecklistProgress, extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount, extractViewCount, extractReactCount, extractVoteCount, extractSourceBranch, extractTargetBranch, extractDueOn } from './utils';
|
|
5
5
|
import { extractPersonsUpdatedBy } from './collaboratorGroup';
|
|
6
6
|
import { extractPersonCreatedBy, extractTitle, extractDateUpdated, extractDateCreated, extractLink } from '@atlaskit/linking-common/extractors';
|
|
7
7
|
import extractPriority from './extract-priority';
|
|
@@ -27,6 +27,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext(response, rende
|
|
|
27
27
|
viewCount: extractViewCount(data),
|
|
28
28
|
reactCount: extractReactCount(data),
|
|
29
29
|
voteCount: extractVoteCount(data),
|
|
30
|
+
checklistProgress: extractChecklistProgress(data),
|
|
30
31
|
createdBy: extractCreatedBy(data),
|
|
31
32
|
createdOn: extractDateCreated(data),
|
|
32
33
|
dueOn: extractDueOn(data),
|
|
@@ -54,4 +54,8 @@ export var extractAttachmentCount = function extractAttachmentCount(data) {
|
|
|
54
54
|
};
|
|
55
55
|
export var extractTargetBranch = function extractTargetBranch(data) {
|
|
56
56
|
return extractLinkName(data['atlassian:mergeDestination']);
|
|
57
|
+
};
|
|
58
|
+
export var extractChecklistProgress = function extractChecklistProgress(data) {
|
|
59
|
+
var checkItemsObj = extractValue(data, 'atlassian:checkItems');
|
|
60
|
+
return checkItemsObj ? "".concat(checkItemsObj.checkedItems, "/").concat(checkItemsObj.totalItems) : undefined;
|
|
57
61
|
};
|
package/dist/esm/version.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { FormattedMessage } from 'react-intl-next';
|
|
3
4
|
import { ActionName } from '../../../../constants';
|
|
@@ -6,13 +7,19 @@ import { messages } from '../../../../messages';
|
|
|
6
7
|
* Returns a CustomActionItem with a "Try Another Account" default message
|
|
7
8
|
*
|
|
8
9
|
* @see CustomActionItem
|
|
9
|
-
* @param
|
|
10
|
+
* @param onClick a function that will be called on the click of the button
|
|
11
|
+
* @param content is a message key for a message to be displayed in the action
|
|
12
|
+
* @param context is a variable for a message in case a message contains a placeholder
|
|
10
13
|
*/
|
|
11
14
|
|
|
12
|
-
export var ForbiddenAction = function ForbiddenAction(
|
|
15
|
+
export var ForbiddenAction = function ForbiddenAction(onClick, content, context) {
|
|
13
16
|
return {
|
|
14
17
|
name: ActionName.CustomAction,
|
|
15
|
-
content: /*#__PURE__*/React.createElement(FormattedMessage, messages
|
|
16
|
-
|
|
18
|
+
content: /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages[content], {
|
|
19
|
+
values: {
|
|
20
|
+
context: context
|
|
21
|
+
}
|
|
22
|
+
})),
|
|
23
|
+
onClick: onClick
|
|
17
24
|
};
|
|
18
25
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
1
2
|
import React, { useMemo } from 'react';
|
|
2
3
|
import FlexibleCard from '../../../FlexibleCard';
|
|
3
4
|
import TitleBlock from '../../../FlexibleCard/components/blocks/title-block';
|
|
@@ -9,7 +10,9 @@ import LockIcon from '@atlaskit/icon/glyph/lock-filled';
|
|
|
9
10
|
import BlockCardFooter from '../../components/flexible/footer';
|
|
10
11
|
import { ForbiddenAction } from '../../actions/flexible/ForbiddenAction';
|
|
11
12
|
import Text from '../../../FlexibleCard/components/elements/text';
|
|
12
|
-
|
|
13
|
+
import { getForbiddenJsonLd } from '../../../../utils/jsonld';
|
|
14
|
+
import { extractProvider } from '@atlaskit/linking-common/extractors';
|
|
15
|
+
import { extractRequestAccessContext } from '../../../../extractors/common/context';
|
|
13
16
|
/**
|
|
14
17
|
* This view represent a Block Card with the 'Forbidden' status.
|
|
15
18
|
* It should have a "Try another account" button that will allow a user to connect another account and view the block card.
|
|
@@ -17,7 +20,10 @@ import Text from '../../../FlexibleCard/components/elements/text';
|
|
|
17
20
|
* @see SmartLinkStatus
|
|
18
21
|
* @see FlexibleCardProps
|
|
19
22
|
*/
|
|
23
|
+
|
|
20
24
|
var FlexibleForbiddenView = function FlexibleForbiddenView(_ref) {
|
|
25
|
+
var _details$meta;
|
|
26
|
+
|
|
21
27
|
var cardState = _ref.cardState,
|
|
22
28
|
onAuthorize = _ref.onAuthorize,
|
|
23
29
|
onClick = _ref.onClick,
|
|
@@ -27,9 +33,28 @@ var FlexibleForbiddenView = function FlexibleForbiddenView(_ref) {
|
|
|
27
33
|
ui = _ref.ui,
|
|
28
34
|
url = _ref.url;
|
|
29
35
|
var status = cardState.status;
|
|
36
|
+
var details = cardState === null || cardState === void 0 ? void 0 : cardState.details;
|
|
37
|
+
var cardMetadata = (_details$meta = details === null || details === void 0 ? void 0 : details.meta) !== null && _details$meta !== void 0 ? _details$meta : getForbiddenJsonLd().meta;
|
|
38
|
+
var provider = extractProvider(details === null || details === void 0 ? void 0 : details.data);
|
|
39
|
+
var providerName = (provider === null || provider === void 0 ? void 0 : provider.text) || '';
|
|
40
|
+
var requestAccessContext = extractRequestAccessContext({
|
|
41
|
+
jsonLd: cardMetadata,
|
|
42
|
+
url: url,
|
|
43
|
+
context: providerName
|
|
44
|
+
});
|
|
45
|
+
var descriptiveMessageKey = requestAccessContext && requestAccessContext.descriptiveMessageKey ? requestAccessContext.descriptiveMessageKey : 'invalid_permissions_description';
|
|
30
46
|
var actions = useMemo(function () {
|
|
31
|
-
|
|
32
|
-
|
|
47
|
+
var actionFromAccessContext = [];
|
|
48
|
+
var tryAnotherAccountAction = onAuthorize ? [ForbiddenAction(onAuthorize, 'try_another_account')] : [];
|
|
49
|
+
|
|
50
|
+
if (requestAccessContext) {
|
|
51
|
+
var action = requestAccessContext.action,
|
|
52
|
+
callToActionMessageKey = requestAccessContext.callToActionMessageKey;
|
|
53
|
+
actionFromAccessContext = action && callToActionMessageKey ? [ForbiddenAction(action.promise, callToActionMessageKey, providerName)] : [];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return [].concat(tryAnotherAccountAction, _toConsumableArray(actionFromAccessContext));
|
|
57
|
+
}, [onAuthorize, requestAccessContext, providerName]);
|
|
33
58
|
return /*#__PURE__*/React.createElement(FlexibleCard, {
|
|
34
59
|
appearance: "block",
|
|
35
60
|
cardState: cardState,
|
|
@@ -48,7 +73,10 @@ var FlexibleForbiddenView = function FlexibleForbiddenView(_ref) {
|
|
|
48
73
|
testId: "".concat(testId, "-lock-icon")
|
|
49
74
|
}), /*#__PURE__*/React.createElement(Text, {
|
|
50
75
|
message: {
|
|
51
|
-
descriptor: messages
|
|
76
|
+
descriptor: messages[descriptiveMessageKey],
|
|
77
|
+
values: {
|
|
78
|
+
context: providerName
|
|
79
|
+
}
|
|
52
80
|
}
|
|
53
81
|
})), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(BlockCardFooter, {
|
|
54
82
|
actions: actions,
|
|
@@ -20,7 +20,7 @@ import * as Actions from '../actions';
|
|
|
20
20
|
import { isFlexibleUiElement } from '../../../../utils/flexible';
|
|
21
21
|
import ActionGroup from './action-group';
|
|
22
22
|
import ElementGroup from './element-group';
|
|
23
|
-
export var ElementDisplaySchema = (_ElementDisplaySchema = {}, _defineProperty(_ElementDisplaySchema, ElementName.AttachmentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.AuthorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CollaboratorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CommentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ViewCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ReactCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.VoteCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.DueOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LatestCommit, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LinkIcon, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Preview, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.Priority, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ProgrammingLanguage, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Provider, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Snippet, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.SourceBranch, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.State, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.SubscriberCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.TargetBranch, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Title, ['inline']), _ElementDisplaySchema);
|
|
23
|
+
export var ElementDisplaySchema = (_ElementDisplaySchema = {}, _defineProperty(_ElementDisplaySchema, ElementName.AttachmentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.AuthorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ChecklistProgress, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CollaboratorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CommentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ViewCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ReactCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.VoteCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.DueOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LatestCommit, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LinkIcon, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Preview, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.Priority, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ProgrammingLanguage, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Provider, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Snippet, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.SourceBranch, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.State, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.SubscriberCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.TargetBranch, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Title, ['inline']), _ElementDisplaySchema);
|
|
24
24
|
|
|
25
25
|
var getDirectionStyles = function getDirectionStyles(direction) {
|
|
26
26
|
switch (direction) {
|
|
@@ -188,6 +188,10 @@ var importIconMapper = (_importIconMapper = {}, _defineProperty(_importIconMappe
|
|
|
188
188
|
return import(
|
|
189
189
|
/* webpackChunkName: "glyphAttachment" */
|
|
190
190
|
'@atlaskit/icon/glyph/attachment');
|
|
191
|
+
}), _defineProperty(_importIconMapper, IconType.CheckItem, function () {
|
|
192
|
+
return import(
|
|
193
|
+
/* webpackChunkName: "glyphAttachment" */
|
|
194
|
+
'@atlaskit/icon/glyph/task');
|
|
191
195
|
}), _defineProperty(_importIconMapper, IconType.Comment, function () {
|
|
192
196
|
return import(
|
|
193
197
|
/* webpackChunkName: "glyphComment" */
|
|
@@ -15,6 +15,12 @@ export var AttachmentCount = createElement(ElementName.AttachmentCount);
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
export var AuthorGroup = createElement(ElementName.AuthorGroup);
|
|
18
|
+
/**
|
|
19
|
+
* Creates a Checklist Badge element using the data from ChecklistProgress in the Flexible UI Context.
|
|
20
|
+
* @see Badge
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
export var ChecklistProgress = createElement(ElementName.ChecklistProgress);
|
|
18
24
|
/**
|
|
19
25
|
* An AvatarGroup element using the data from CollaboratorGroup in the Flexible UI Context.
|
|
20
26
|
* @see AvatarGroup
|
|
@@ -27,6 +27,11 @@ var elementMappings = (_elementMappings = {}, _defineProperty(_elementMappings,
|
|
|
27
27
|
}
|
|
28
28
|
}), _defineProperty(_elementMappings, ElementName.AuthorGroup, {
|
|
29
29
|
component: AvatarGroup
|
|
30
|
+
}), _defineProperty(_elementMappings, ElementName.ChecklistProgress, {
|
|
31
|
+
component: Badge,
|
|
32
|
+
props: {
|
|
33
|
+
icon: IconType.CheckItem
|
|
34
|
+
}
|
|
30
35
|
}), _defineProperty(_elementMappings, ElementName.CollaboratorGroup, {
|
|
31
36
|
component: AvatarGroup
|
|
32
37
|
}), _defineProperty(_elementMappings, ElementName.CommentCount, {
|
|
@@ -117,6 +122,7 @@ var getData = function getData(elementName, contextKey, context) {
|
|
|
117
122
|
return toAvatarGroupProps(data);
|
|
118
123
|
|
|
119
124
|
case ElementName.AttachmentCount:
|
|
125
|
+
case ElementName.ChecklistProgress:
|
|
120
126
|
case ElementName.CommentCount:
|
|
121
127
|
case ElementName.ViewCount:
|
|
122
128
|
case ElementName.ReactCount:
|
|
@@ -53,7 +53,7 @@ export var getSimulatedMetadata = function getSimulatedMetadata() {
|
|
|
53
53
|
return {
|
|
54
54
|
metadata: {
|
|
55
55
|
primary: [ElementName.AuthorGroup, ElementName.State, ElementName.DueOn],
|
|
56
|
-
secondary: [ElementName.ReactCount, ElementName.CommentCount, ElementName.AttachmentCount],
|
|
56
|
+
secondary: [ElementName.ReactCount, ElementName.CommentCount, ElementName.AttachmentCount, ElementName.ChecklistProgress],
|
|
57
57
|
subtitle: []
|
|
58
58
|
}
|
|
59
59
|
};
|
|
@@ -83,6 +83,7 @@ export declare enum SmartLinkWidth {
|
|
|
83
83
|
export declare enum ElementName {
|
|
84
84
|
AttachmentCount = "AttachmentCount",
|
|
85
85
|
AuthorGroup = "AuthorGroup",
|
|
86
|
+
ChecklistProgress = "ChecklistProgress",
|
|
86
87
|
CollaboratorGroup = "CollaboratorGroup",
|
|
87
88
|
CommentCount = "CommentCount",
|
|
88
89
|
CreatedBy = "CreatedBy",
|
|
@@ -165,6 +166,7 @@ export declare enum IconType {
|
|
|
165
166
|
Error = "Default:Error",
|
|
166
167
|
Forbidden = "Default:Forbidden",
|
|
167
168
|
Attachment = "Badge:Attachment",
|
|
169
|
+
CheckItem = "Badge:Task",
|
|
168
170
|
Comment = "Badge:Comment",
|
|
169
171
|
View = "Badge:View",
|
|
170
172
|
React = "Badge:React",
|
|
@@ -11,3 +11,4 @@ export declare const extractSourceBranch: (data: JsonLd.Data.SourceCodePullReque
|
|
|
11
11
|
export declare const extractSubscriberCount: (data: JsonLd.Data.BaseData) => number | undefined;
|
|
12
12
|
export declare const extractAttachmentCount: (data: JsonLd.Data.BaseData) => number | undefined;
|
|
13
13
|
export declare const extractTargetBranch: (data: JsonLd.Data.SourceCodePullRequest) => string | undefined;
|
|
14
|
+
export declare const extractChecklistProgress: (data: JsonLd.Data.BaseData) => string | undefined;
|
|
@@ -17,6 +17,11 @@ export declare type FlexibleUiDataContext = {
|
|
|
17
17
|
* @see AvatarGroup
|
|
18
18
|
*/
|
|
19
19
|
authorGroup?: LinkPerson[];
|
|
20
|
+
/**
|
|
21
|
+
* A string displaying progress on a checklist
|
|
22
|
+
* @see ChecklistProgress
|
|
23
|
+
*/
|
|
24
|
+
checklistProgress?: string;
|
|
20
25
|
/**
|
|
21
26
|
* An array containing a @type {LinkPerson} used to populate the CollaboratorGroup element.
|
|
22
27
|
* @see CollaboratorGroup
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { CustomActionItem } from '../../../FlexibleCard/components/blocks/types';
|
|
2
|
+
import { MessageKey, RequestAccessMessageKey } from '../../../../messages';
|
|
2
3
|
/**
|
|
3
4
|
* Returns a CustomActionItem with a "Try Another Account" default message
|
|
4
5
|
*
|
|
5
6
|
* @see CustomActionItem
|
|
6
|
-
* @param
|
|
7
|
+
* @param onClick a function that will be called on the click of the button
|
|
8
|
+
* @param content is a message key for a message to be displayed in the action
|
|
9
|
+
* @param context is a variable for a message in case a message contains a placeholder
|
|
7
10
|
*/
|
|
8
|
-
export declare const ForbiddenAction: (
|
|
11
|
+
export declare const ForbiddenAction: (onClick: () => void, content: RequestAccessMessageKey | MessageKey, context?: string | undefined) => CustomActionItem;
|
|
@@ -168,7 +168,7 @@ export declare type OnActionMenuOpenChangeOptions = {
|
|
|
168
168
|
/**
|
|
169
169
|
* A type that contains all the possible combinations of elements with their corresponding props.
|
|
170
170
|
*/
|
|
171
|
-
export declare type ElementItemProps = AttachmentCount | AuthorGroup | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | DueOn | LatestCommit | LinkIcon | ModifiedBy | ModifiedOn | Preview | Priority | ProgrammingLanguage | Provider | ReactCount | Snippet | SourceBranch | State | SubscriberCount | TargetBranch | Title | ViewCount | VoteCount;
|
|
171
|
+
export declare type ElementItemProps = AttachmentCount | AuthorGroup | ChecklistProgress | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | DueOn | LatestCommit | LinkIcon | ModifiedBy | ModifiedOn | Preview | Priority | ProgrammingLanguage | Provider | ReactCount | Snippet | SourceBranch | State | SubscriberCount | TargetBranch | Title | ViewCount | VoteCount;
|
|
172
172
|
/**
|
|
173
173
|
* Represents the props available for an AttachmentCount element.
|
|
174
174
|
* @see AttachmentCount
|
|
@@ -183,6 +183,13 @@ export declare type AttachmentCount = {
|
|
|
183
183
|
export declare type AuthorGroup = {
|
|
184
184
|
name: ElementName.AuthorGroup;
|
|
185
185
|
};
|
|
186
|
+
/**
|
|
187
|
+
* Represents the props available for an ChecklistProgress element.
|
|
188
|
+
* @see ChecklistProgress
|
|
189
|
+
*/
|
|
190
|
+
export declare type ChecklistProgress = {
|
|
191
|
+
name: ElementName.ChecklistProgress;
|
|
192
|
+
};
|
|
186
193
|
/**
|
|
187
194
|
* Represents the props available for an CollaboratorGroup element.
|
|
188
195
|
* @see CollaboratorGroup
|
|
@@ -17,6 +17,11 @@ export declare const AttachmentCount: import("react").FC<BadgeProps>;
|
|
|
17
17
|
* @see AvatarGroup
|
|
18
18
|
*/
|
|
19
19
|
export declare const AuthorGroup: import("react").FC<AvatarGroupProps>;
|
|
20
|
+
/**
|
|
21
|
+
* Creates a Checklist Badge element using the data from ChecklistProgress in the Flexible UI Context.
|
|
22
|
+
* @see Badge
|
|
23
|
+
*/
|
|
24
|
+
export declare const ChecklistProgress: import("react").FC<BadgeProps>;
|
|
20
25
|
/**
|
|
21
26
|
* An AvatarGroup element using the data from CollaboratorGroup in the Flexible UI Context.
|
|
22
27
|
* @see AvatarGroup
|
package/package.json
CHANGED
package/report.api.md
CHANGED
|
@@ -315,6 +315,11 @@ export interface CardProps extends WithAnalyticsEventsProps {
|
|
|
315
315
|
|
|
316
316
|
export { CardType };
|
|
317
317
|
|
|
318
|
+
// @public
|
|
319
|
+
type ChecklistProgress = {
|
|
320
|
+
name: ElementName.ChecklistProgress;
|
|
321
|
+
};
|
|
322
|
+
|
|
318
323
|
export { Client };
|
|
319
324
|
|
|
320
325
|
// @public
|
|
@@ -407,6 +412,7 @@ export type ElementItem = {
|
|
|
407
412
|
type ElementItemProps =
|
|
408
413
|
| AttachmentCount
|
|
409
414
|
| AuthorGroup
|
|
415
|
+
| ChecklistProgress
|
|
410
416
|
| CollaboratorGroup
|
|
411
417
|
| CommentCount
|
|
412
418
|
| CreatedBy
|
|
@@ -437,6 +443,8 @@ export enum ElementName {
|
|
|
437
443
|
// (undocumented)
|
|
438
444
|
AuthorGroup = 'AuthorGroup',
|
|
439
445
|
// (undocumented)
|
|
446
|
+
ChecklistProgress = 'ChecklistProgress',
|
|
447
|
+
// (undocumented)
|
|
440
448
|
CollaboratorGroup = 'CollaboratorGroup',
|
|
441
449
|
// (undocumented)
|
|
442
450
|
CommentCount = 'CommentCount',
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -241,6 +241,11 @@ export interface CardProps extends WithAnalyticsEventsProps {
|
|
|
241
241
|
|
|
242
242
|
export { CardType }
|
|
243
243
|
|
|
244
|
+
// @public
|
|
245
|
+
type ChecklistProgress = {
|
|
246
|
+
name: ElementName.ChecklistProgress;
|
|
247
|
+
};
|
|
248
|
+
|
|
244
249
|
export { Client }
|
|
245
250
|
|
|
246
251
|
// @public
|
|
@@ -324,7 +329,7 @@ export type ElementItem = {
|
|
|
324
329
|
} & ElementItemProps;
|
|
325
330
|
|
|
326
331
|
// @public
|
|
327
|
-
type ElementItemProps = AttachmentCount | AuthorGroup | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | DueOn | LatestCommit | LinkIcon | ModifiedBy | ModifiedOn | Preview | Priority | ProgrammingLanguage | Provider_2 | ReactCount | Snippet | SourceBranch | State_2 | SubscriberCount | TargetBranch | Title | ViewCount | VoteCount;
|
|
332
|
+
type ElementItemProps = AttachmentCount | AuthorGroup | ChecklistProgress | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | DueOn | LatestCommit | LinkIcon | ModifiedBy | ModifiedOn | Preview | Priority | ProgrammingLanguage | Provider_2 | ReactCount | Snippet | SourceBranch | State_2 | SubscriberCount | TargetBranch | Title | ViewCount | VoteCount;
|
|
328
333
|
|
|
329
334
|
// @public
|
|
330
335
|
export enum ElementName {
|
|
@@ -333,6 +338,8 @@ export enum ElementName {
|
|
|
333
338
|
// (undocumented)
|
|
334
339
|
AuthorGroup = "AuthorGroup",
|
|
335
340
|
// (undocumented)
|
|
341
|
+
ChecklistProgress = "ChecklistProgress",
|
|
342
|
+
// (undocumented)
|
|
336
343
|
CollaboratorGroup = "CollaboratorGroup",
|
|
337
344
|
// (undocumented)
|
|
338
345
|
CommentCount = "CommentCount",
|