// // Copyright © 2020, 2021 Anticrm Platform Contributors. // Copyright © 2023 Hardcore Engineering Inc. // // Licensed under the Eclipse Public License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. You may // obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // // See the License for the specific language governing permissions and // limitations under the License. // import { Account, AttachedDoc, Class, Doc, Ref, Space, Timestamp, UXObject, type Blob, type Data, type WithLookup } from '@hcengineering/core' import type { Asset, Metadata, Plugin, Resource } from '@hcengineering/platform' import { IntlString, plugin } from '@hcengineering/platform' import { TemplateField, TemplateFieldCategory } from '@hcengineering/templates' import type { AnyComponent, ColorDefinition, ResolvedLocation, Location } from '@hcengineering/ui' import { Action, FilterMode, Viewlet } from '@hcengineering/view' /** * @public */ export interface ChannelProvider extends Doc, UXObject { // Placeholder placeholder: IntlString // Presenter will be shown on click for channel presenter?: AnyComponent // Action to be performed if there is no presenter defined. action?: Ref // Integration type integrationType?: Ref } /** * @public */ export interface Channel extends AttachedDoc { provider: Ref value: string items?: number lastMessage?: Timestamp } /** * @public */ export interface ChannelItem extends AttachedDoc { attachedTo: Ref attachedToClass: Ref> incoming: boolean sendOn: Timestamp attachments?: number } /** * @public */ export enum AvatarType { COLOR = 'color', IMAGE = 'image', GRAVATAR = 'gravatar', EXTERNAL = 'external' } /** * @public */ export type GetAvatarUrl = ( uri: Data>, name: string, width?: number ) => Promise<{ url?: string, srcSet?: string, color: ColorDefinition }> /** * @public */ export interface AvatarProvider extends Doc { type: AvatarType getUrl: Resource } export interface AvatarInfo extends Doc { avatarType: AvatarType avatar?: Ref | null avatarProps?: { color?: string url?: string } } /** * @public */ export interface Contact extends Doc, AvatarInfo { name: string attachments?: number comments?: number channels?: number city: string } /** * @public */ export interface Person extends Contact { birthday?: Timestamp | null } /** * @public */ export interface Member extends AttachedDoc { contact: Ref } /** * @public */ export interface Organization extends Contact { members: number description?: string } /** * @public */ export interface Status extends AttachedDoc { attachedTo: Ref attachedToClass: Ref> name: string dueDate: Timestamp } /** * @public */ export interface Employee extends Person { active: boolean statuses?: number position?: string | null } /** * @public */ export interface PersonAccount extends Account { person: Ref } /** * @public */ export interface ContactsTab extends Doc { label: IntlString component: AnyComponent index: number } /** * @public */ export const contactId = 'contact' as Plugin /** * @public */ export const contactPlugin = plugin(contactId, { class: { AvatarProvider: '' as Ref>, ChannelProvider: '' as Ref>, Channel: '' as Ref>, Contact: '' as Ref>, Person: '' as Ref>, Member: '' as Ref>, Organization: '' as Ref>, PersonAccount: '' as Ref>, Status: '' as Ref>, ContactsTab: '' as Ref> }, mixin: { Employee: '' as Ref> }, component: { SocialEditor: '' as AnyComponent, CreateOrganization: '' as AnyComponent, CreatePerson: '' as AnyComponent, ChannelsPresenter: '' as AnyComponent, MembersPresenter: '' as AnyComponent, Avatar: '' as AnyComponent, AvatarRef: '' as AnyComponent, UserBoxList: '' as AnyComponent, ChannelPresenter: '' as AnyComponent, SpaceMembers: '' as AnyComponent, DeleteConfirmationPopup: '' as AnyComponent, AccountArrayEditor: '' as AnyComponent, PersonIcon: '' as AnyComponent, EditOrganizationPanel: '' as AnyComponent, CollaborationUserAvatar: '' as AnyComponent, CreateGuest: '' as AnyComponent, SpaceMembersEditor: '' as AnyComponent }, channelProvider: { Email: '' as Ref, Phone: '' as Ref, LinkedIn: '' as Ref, Twitter: '' as Ref, Telegram: '' as Ref, GitHub: '' as Ref, Facebook: '' as Ref, Homepage: '' as Ref, Whatsapp: '' as Ref, Skype: '' as Ref, Profile: '' as Ref }, avatarProvider: { Color: '' as Ref, Image: '' as Ref, Gravatar: '' as Ref }, function: { GetColorUrl: '' as Resource, GetFileUrl: '' as Resource, GetGravatarUrl: '' as Resource, GetExternalUrl: '' as Resource }, icon: { ContactApplication: '' as Asset, Phone: '' as Asset, Email: '' as Asset, Discord: '' as Asset, Facebook: '' as Asset, Instagram: '' as Asset, LinkedIn: '' as Asset, Telegram: '' as Asset, Twitter: '' as Asset, VK: '' as Asset, WhatsApp: '' as Asset, Skype: '' as Asset, Youtube: '' as Asset, GitHub: '' as Asset, Edit: '' as Asset, Person: '' as Asset, Persona: '' as Asset, Company: '' as Asset, SocialEdit: '' as Asset, Homepage: '' as Asset, Whatsapp: '' as Asset, ComponentMembers: '' as Asset, Profile: '' as Asset, KickUser: '' as Asset, Contacts: '' as Asset }, space: { Contacts: '' as Ref }, app: { Contacts: '' as Ref }, metadata: { LastNameFirst: '' as Metadata }, string: { PersonAlreadyExists: '' as IntlString, Person: '' as IntlString, Employee: '' as IntlString, CreateOrganization: '' as IntlString, UseImage: '' as IntlString, UseGravatar: '' as IntlString, UseColor: '' as IntlString, PersonFirstNamePlaceholder: '' as IntlString, PersonLastNamePlaceholder: '' as IntlString, NumberMembers: '' as IntlString, Position: '' as IntlString, For: '' as IntlString, SelectUsers: '' as IntlString, AddGuest: '' as IntlString, Members: '' as IntlString, Contacts: '' as IntlString }, viewlet: { TableMember: '' as Ref, TablePerson: '' as Ref, TableEmployee: '' as Ref, TableOrganization: '' as Ref }, filter: { FilterChannelIn: '' as Ref, FilterChannelNin: '' as Ref, FilterChannelHasMessages: '' as Ref, FilterChannelHasNewMessages: '' as Ref }, resolver: { Location: '' as Resource<(loc: Location) => Promise> }, templateFieldCategory: { CurrentEmployee: '' as Ref, Contact: '' as Ref }, templateField: { CurrentEmployeeName: '' as Ref, CurrentEmployeePosition: '' as Ref, CurrentEmployeeEmail: '' as Ref, ContactName: '' as Ref, ContactFirstName: '' as Ref, ContactLastName: '' as Ref }, ids: { MentionCommonNotificationType: '' as Ref } }) export default contactPlugin export * from './types' export * from './utils'