@atlaskit/mention
Version:
A React component used to display user profiles in a list for 'Mention' functionality
86 lines (85 loc) • 3.55 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.UserType = exports.UserAccessLevel = exports.SliNames = exports.MentionType = exports.MentionNameStatus = exports.ComponentNames = exports.Actions = void 0;
exports.isAppMention = isAppMention;
exports.isPromise = void 0;
exports.isRestricted = isRestricted;
exports.isSpecialMention = isSpecialMention;
exports.isSpecialMentionText = isSpecialMentionText;
exports.isTeamMention = isTeamMention;
/**
* Configuration for the MentionResource, which provides a JavaScript API
* for fetching and searching user mentions from a remote service.
*
* Extends {@link ServiceConfig} which provides the base `url`, `securityProvider`,
* and `refreshedSecurityProvider` fields.
*/
// data is returned from team search service
var MentionType = exports.MentionType = /*#__PURE__*/function (MentionType) {
MentionType[MentionType["SELF"] = 0] = "SELF";
MentionType[MentionType["RESTRICTED"] = 1] = "RESTRICTED";
MentionType[MentionType["DEFAULT"] = 2] = "DEFAULT";
return MentionType;
}({});
var UserAccessLevel = exports.UserAccessLevel = /*#__PURE__*/function (UserAccessLevel) {
UserAccessLevel[UserAccessLevel["NONE"] = 0] = "NONE";
UserAccessLevel[UserAccessLevel["SITE"] = 1] = "SITE";
UserAccessLevel[UserAccessLevel["APPLICATION"] = 2] = "APPLICATION";
UserAccessLevel[UserAccessLevel["CONTAINER"] = 3] = "CONTAINER";
return UserAccessLevel;
}({});
var UserType = exports.UserType = /*#__PURE__*/function (UserType) {
UserType[UserType["DEFAULT"] = 0] = "DEFAULT";
UserType[UserType["SPECIAL"] = 1] = "SPECIAL";
UserType[UserType["APP"] = 2] = "APP";
UserType[UserType["TEAM"] = 3] = "TEAM";
UserType[UserType["SYSTEM"] = 4] = "SYSTEM";
return UserType;
}({});
var SliNames = exports.SliNames = /*#__PURE__*/function (SliNames) {
SliNames["SEARCH"] = "searchUser";
SliNames["SEARCH_TEAM"] = "searchTeam";
SliNames["INITIAL_STATE"] = "initialState";
SliNames["SELECT"] = "select";
SliNames["SELECT_TEAM"] = "selectTeam";
return SliNames;
}({});
var ComponentNames = exports.ComponentNames = /*#__PURE__*/function (ComponentNames) {
ComponentNames["TYPEAHEAD"] = "mentionTypeahead";
ComponentNames["MENTION"] = "mention";
return ComponentNames;
}({});
var Actions = exports.Actions = /*#__PURE__*/function (Actions) {
Actions["VIEWED"] = "viewed";
Actions["CLICKED"] = "clicked";
Actions["CLOSED"] = "closed";
Actions["SUCCEEDED"] = "succeeded";
Actions["FAILED"] = "failed";
return Actions;
}({});
var MentionNameStatus = exports.MentionNameStatus = /*#__PURE__*/function (MentionNameStatus) {
MentionNameStatus[MentionNameStatus["UNKNOWN"] = 0] = "UNKNOWN";
MentionNameStatus[MentionNameStatus["SERVICE_ERROR"] = 1] = "SERVICE_ERROR";
MentionNameStatus[MentionNameStatus["OK"] = 2] = "OK";
return MentionNameStatus;
}({});
function isRestricted(accessLevel) {
return !!accessLevel && accessLevel === UserAccessLevel[UserAccessLevel.NONE];
}
function isSpecialMention(mention) {
return !!mention.userType && mention.userType === UserType[UserType.SPECIAL];
}
function isAppMention(mention) {
return mention.userType && mention.userType === UserType[UserType.APP];
}
function isTeamMention(mention) {
return mention.userType && mention.userType === UserType[UserType.TEAM];
}
function isSpecialMentionText(mentionText) {
return mentionText && (mentionText === '@all' || mentionText === '@here');
}
var isPromise = exports.isPromise = function isPromise(p) {
return !!(p && p.then);
};