TSK-1263 Inbox configurator (#3067)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov
2023-04-25 15:34:38 +07:00
committed by GitHub
parent aa218ab898
commit 98d71a25df
66 changed files with 1348 additions and 679 deletions
+57 -12
View File
@@ -13,12 +13,25 @@
// limitations under the License.
//
import { Account, AttachedDoc, Class, Doc, Mixin, Ref, Space, Timestamp, TxCUD } from '@hcengineering/core'
import {
Account,
AnyAttribute,
AttachedDoc,
Class,
Doc,
Mixin,
Ref,
Space,
Timestamp,
Tx,
TxCUD
} from '@hcengineering/core'
import type { Asset, IntlString, Plugin, Resource } from '@hcengineering/platform'
import { plugin } from '@hcengineering/platform'
import { IntegrationType } from '@hcengineering/setting'
import { AnyComponent } from '@hcengineering/ui'
import { Writable } from './types'
import { Preference } from '@hcengineering/preference'
export * from './types'
/**
@@ -64,9 +77,17 @@ export enum NotificationStatus {
/**
* @public
*/
export interface NotificationType extends Doc {
hidden: boolean
export interface NotificationGroup extends Doc {
label: IntlString
icon: Asset
// using for autogenerated settings
objectClass?: Ref<Class<Doc>>
}
/**
* @public
*/
export interface NotificationTemplate {
textTemplate: string
htmlTemplate: string
subjectTemplate: string
@@ -75,17 +96,40 @@ export interface NotificationType extends Doc {
/**
* @public
*/
export interface NotificationProvider extends Doc {
export interface NotificationType extends Doc {
// For show/hide with attributes
attribute?: Ref<AnyAttribute>
// Is autogenerated
generated: boolean
// allowed to to change setting (probably we should show it, but disable toggle??)
hidden: boolean
label: IntlString
default: boolean
group: Ref<NotificationGroup>
txClasses: Ref<Class<Tx>>[]
objectClass: Ref<Class<Doc>>
// check parent doc class
attachedToClass?: Ref<Class<Doc>>
// use for update/mixin txes
field?: string
// allowed providers and default value for it
providers: Record<Ref<NotificationProvider>, boolean>
// templates for email (and browser/push?)
templates?: NotificationTemplate
}
/**
* @public
*/
export interface NotificationSetting extends Doc {
export interface NotificationProvider extends Doc {
label: IntlString
}
/**
* @public
*/
export interface NotificationSetting extends Preference {
attachedTo: Ref<NotificationProvider>
type: Ref<NotificationType>
provider: Ref<NotificationProvider>
enabled: boolean
}
@@ -181,15 +225,16 @@ const notification = plugin(notificationId, {
NotificationType: '' as Ref<Class<NotificationType>>,
NotificationProvider: '' as Ref<Class<NotificationProvider>>,
NotificationSetting: '' as Ref<Class<NotificationSetting>>,
DocUpdates: '' as Ref<Class<DocUpdates>>
DocUpdates: '' as Ref<Class<DocUpdates>>,
NotificationGroup: '' as Ref<Class<NotificationGroup>>
},
ids: {
MentionNotification: '' as Ref<NotificationType>,
DMNotification: '' as Ref<NotificationType>,
NotificationSettings: '' as Ref<Doc>
},
providers: {
PlatformNotification: '' as Ref<NotificationProvider>,
BrowserNotification: '' as Ref<NotificationProvider>,
EmailNotification: '' as Ref<NotificationProvider>,
NotificationSettings: '' as Ref<Doc>
EmailNotification: '' as Ref<NotificationProvider>
},
integrationType: {
MobileApp: '' as Ref<IntegrationType>