UBER-845: Add NotificationPresenter to send rich text notifications (#3729)

Signed-off-by: Maxim Karmatskikh <mkarmatskih@gmail.com>
This commit is contained in:
Maksim Karmatskikh
2023-09-28 12:08:00 +07:00
committed by GitHub
parent a3fd97e3b4
commit 1ca9de297a
21 changed files with 368 additions and 47 deletions
+21 -3
View File
@@ -15,8 +15,8 @@
//
import contact, { Employee, Person, PersonAccount } from '@hcengineering/contact'
import { Account, Class, Doc, Mixin, Ref, Tx } from '@hcengineering/core'
import { NotificationType } from '@hcengineering/notification'
import { Account, Class, Doc, Mixin, Ref, Tx, TxCUD } from '@hcengineering/core'
import { NotificationType, NotificationContent } from '@hcengineering/notification'
import { Plugin, Resource, plugin } from '@hcengineering/platform'
import type { TriggerControl, TriggerFunc } from '@hcengineering/server-core'
@@ -112,6 +112,23 @@ export interface TypeMatch extends NotificationType {
func: TypeMatchFunc
}
/**
* @public
*/
export type NotificationContentProvider = (
doc: Doc,
tx: TxCUD<Doc>,
target: Ref<Account>,
control: TriggerControl
) => Promise<NotificationContent>
/**
* @public
*/
export interface NotificationPresenter extends Class<Doc> {
presenter: Resource<NotificationContentProvider>
}
/**
* @public
*/
@@ -119,7 +136,8 @@ export default plugin(serverNotificationId, {
mixin: {
HTMLPresenter: '' as Ref<Mixin<HTMLPresenter>>,
TextPresenter: '' as Ref<Mixin<TextPresenter>>,
TypeMatch: '' as Ref<Mixin<TypeMatch>>
TypeMatch: '' as Ref<Mixin<TypeMatch>>,
NotificationPresenter: '' as Ref<Mixin<NotificationPresenter>>
},
trigger: {
OnBacklinkCreate: '' as Resource<TriggerFunc>,