platform/plugins/gmail/src/index.ts
Denis Bykhov 2fb4763f3f
remove extra spaces (#5930)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
2024-06-28 08:55:32 +05:00

113 lines
2.6 KiB
TypeScript

//
// Copyright © 2020, 2021 Anticrm Platform Contributors.
//
// 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 { ChannelItem } from '@hcengineering/contact'
import type { Account, AttachedDoc, Class, Doc, Ref, Timestamp } from '@hcengineering/core'
import { NotificationType } from '@hcengineering/notification'
import type { IntlString, Plugin } from '@hcengineering/platform'
import { Metadata, plugin } from '@hcengineering/platform'
import type { Handler, IntegrationType } from '@hcengineering/setting'
import type { AnyComponent } from '@hcengineering/ui'
/**
* @public
*/
export interface Message extends BaseMessage, ChannelItem {
messageId: string
from: string
textContent: string
}
/**
* @public
*/
export interface BaseMessage extends Doc {
replyTo?: string
to: string
subject: string
content: string
copy?: string[]
attachments?: number
}
/**
* @public
*/
export interface NewMessage extends BaseMessage {
status: 'new' | 'sent' | 'error'
error?: string
from?: Ref<Account>
}
/**
* @public
*/
export interface SharedMessage extends Doc {
messageId: string
subject: string
content: string
sender: string
receiver: string
incoming: boolean
textContent: string
attachments?: number
copy?: string[]
sendOn: Timestamp
}
/**
* @public
*/
export interface SharedMessages extends AttachedDoc {
messages: SharedMessage[]
}
/**
* @public
*/
export const gmailId = 'gmail' as Plugin
export default plugin(gmailId, {
component: {
Main: '' as AnyComponent,
Connect: '' as AnyComponent,
IconGmail: '' as AnyComponent,
NewMessages: '' as AnyComponent,
Configure: '' as AnyComponent
},
string: {
From: '' as IntlString,
To: '' as IntlString
},
integrationType: {
Gmail: '' as Ref<IntegrationType>
},
handler: {
DisconnectHandler: '' as Handler
},
class: {
Message: '' as Ref<Class<Message>>,
NewMessage: '' as Ref<Class<NewMessage>>,
SharedMessages: '' as Ref<Class<SharedMessages>>,
SharedMessage: '' as Ref<Class<SharedMessage>>
},
ids: {
EmailNotification: '' as Ref<NotificationType>
},
metadata: {
GmailURL: '' as Metadata<string>
}
})