UNPKG

@atlaskit/mention

Version:

A React component used to display user profiles in a list for 'Mention' functionality

66 lines (65 loc) 2.67 kB
// data is returned from team search service export let MentionType = /*#__PURE__*/function (MentionType) { MentionType[MentionType["SELF"] = 0] = "SELF"; MentionType[MentionType["RESTRICTED"] = 1] = "RESTRICTED"; MentionType[MentionType["DEFAULT"] = 2] = "DEFAULT"; return MentionType; }({}); export let 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; }({}); export let 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; }({}); export let SliNames = /*#__PURE__*/function (SliNames) { SliNames["SEARCH"] = "searchUser"; SliNames["SEARCH_TEAM"] = "searchTeam"; SliNames["INITIAL_STATE"] = "initialState"; SliNames["SELECT"] = "select"; SliNames["SELECT_TEAM"] = "selectTeam"; return SliNames; }({}); export let ComponentNames = /*#__PURE__*/function (ComponentNames) { ComponentNames["TYPEAHEAD"] = "mentionTypeahead"; ComponentNames["MENTION"] = "mention"; return ComponentNames; }({}); export let Actions = /*#__PURE__*/function (Actions) { Actions["VIEWED"] = "viewed"; Actions["CLICKED"] = "clicked"; Actions["CLOSED"] = "closed"; Actions["SUCCEEDED"] = "succeeded"; Actions["FAILED"] = "failed"; return Actions; }({}); export let MentionNameStatus = /*#__PURE__*/function (MentionNameStatus) { MentionNameStatus[MentionNameStatus["UNKNOWN"] = 0] = "UNKNOWN"; MentionNameStatus[MentionNameStatus["SERVICE_ERROR"] = 1] = "SERVICE_ERROR"; MentionNameStatus[MentionNameStatus["OK"] = 2] = "OK"; return MentionNameStatus; }({}); export function isRestricted(accessLevel) { return !!accessLevel && accessLevel === UserAccessLevel[UserAccessLevel.NONE]; } export function isSpecialMention(mention) { return !!mention.userType && mention.userType === UserType[UserType.SPECIAL]; } export function isAppMention(mention) { return mention.userType && mention.userType === UserType[UserType.APP]; } export function isTeamMention(mention) { return mention.userType && mention.userType === UserType[UserType.TEAM]; } export function isSpecialMentionText(mentionText) { return mentionText && (mentionText === '@all' || mentionText === '@here'); } export const isPromise = p => !!(p && p.then);