// // 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 type { AccountRole, Blob, Class, Configuration, Doc, Mixin, Ref, AccountUuid, Domain, IntegrationKind } from '@hcengineering/core' import type { Metadata, Plugin } from '@hcengineering/platform' import { Asset, IntlString, Resource, plugin } from '@hcengineering/platform' import { TemplateField, TemplateFieldCategory } from '@hcengineering/templates' import { Action, AnyComponent } from '@hcengineering/ui' import { type Integration as AccountIntegration } from '@hcengineering/account-client' import { SpaceTypeCreator, SpaceTypeEditor } from './spaceTypeEditor' export * from './spaceTypeEditor' export * from './utils' export * from './analytics' export const DOMAIN_SETTING = 'setting' as Domain /** * @public */ export type Handler = Resource<(integration: AccountIntegration) => Promise> /** * @public */ export interface IntegrationType extends Doc { label: IntlString description: IntlString descriptionComponent?: AnyComponent stateComponent?: AnyComponent icon: AnyComponent allowMultiple: boolean kind: IntegrationKind createComponent?: AnyComponent onDisconnect?: Handler onDisconnectAll?: Handler // Disconnect for all workspaces reconnectComponent?: AnyComponent configureComponent?: AnyComponent getActions?: Resource<(integration?: AccountIntegration) => Promise> } /** * @public */ export interface Integration extends Doc { type: Ref disabled: boolean value: string error?: IntlString | null shared?: AccountUuid[] } /** * @public */ export interface Editable extends Class { value: boolean // true is editable, false is not } /** * @public * * Mixin to allow delete of Custom classes. */ export interface UserMixin extends Class {} /** * @public */ export interface SettingsCategory extends Doc { name: string label: IntlString icon: Asset component: AnyComponent props?: Record // If defined, will pass kind with key to component extraComponents?: Record group?: string // If defined, will sort using order. order?: number role: AccountRole // A feature to be used with hides feature?: string expandable?: boolean adminOnly?: boolean } /** * @public */ export interface InviteSettings extends Configuration { expirationTime: number emailMask: string limit: number defaultInviteRole: AccountRole inviteLinkGeneratorRoles: AccountRole[] } /** * Stable capability IDs for role-based permissions. * Used with RoleCapabilitySettings to define which AccountRoles can perform which actions. * @public */ export const RoleCapability = { GenerateInviteLink: 'setting:capability:GenerateInviteLink', ManageInviteSettings: 'setting:capability:ManageInviteSettings' } as const /** * @public */ export type RoleCapabilityId = (typeof RoleCapability)[keyof typeof RoleCapability] /** * Workspace-level config: which AccountRoles have which capabilities. * Maps capability ID -> list of roles that have it (account has capability if hasAccountRole(account, role) for any role in the list). * @public */ export interface RoleCapabilitySettings extends Configuration { /** capabilityId -> roles that are allowed (e.g. [User, Maintainer, Owner]) */ roleByCapability: Record } /** * @public */ export interface OfficeSettings extends Configuration { defaultStartWithTranscription: boolean defaultStartWithRecording: boolean } /** * @public */ export interface WorkspaceSetting extends Doc { icon?: Ref | null } export enum IntegrationError { EMAIL_IS_ALREADY_USED = 'EMAIL_IS_ALREADY_USED' } /** * @public */ export const settingId = 'setting' as Plugin export default plugin(settingId, { ids: { SettingApp: '' as Ref, Profile: '' as Ref, Password: '' as Ref, Setting: '' as Ref, Integrations: '' as Ref, Relations: '' as Ref, Support: '' as Ref, Privacy: '' as Ref, Terms: '' as Ref, ClassSetting: '' as Ref, General: '' as Ref, Owners: '' as Ref, InviteSettings: '' as Ref, RoleCapabilitySettings: '' as Ref, WorkspaceSetting: '' as Ref, ManageSpaces: '' as Ref, Spaces: '' as Ref, Backup: '' as Ref, Export: '' as Ref, OfficeSettings: '' as Ref, DisablePermissionsConfiguration: '' as Ref, Mailboxes: '' as Ref }, mixin: { Editable: '' as Ref>, UserMixin: '' as Ref>, SpaceTypeEditor: '' as Ref>, SpaceTypeCreator: '' as Ref> }, class: { SettingsCategory: '' as Ref>, WorkspaceSettingCategory: '' as Ref>, Integration: '' as Ref>, IntegrationType: '' as Ref>, InviteSettings: '' as Ref>, RoleCapabilitySettings: '' as Ref>, OfficeSettings: '' as Ref>, WorkspaceSetting: '' as Ref> }, component: { Settings: '' as AnyComponent, Profile: '' as AnyComponent, Password: '' as AnyComponent, WorkspaceSettings: '' as AnyComponent, Integrations: '' as AnyComponent, Support: '' as AnyComponent, Privacy: '' as AnyComponent, Terms: '' as AnyComponent, ClassSetting: '' as AnyComponent, PermissionPresenter: '' as AnyComponent, AttributePermissionPresenter: '' as AnyComponent, ClassPermissionPresenter: '' as AnyComponent, SpaceTypeDescriptorPresenter: '' as AnyComponent, SpaceTypeGeneralSectionEditor: '' as AnyComponent, SpaceTypePropertiesSectionEditor: '' as AnyComponent, SpaceTypeRolesSectionEditor: '' as AnyComponent, RoleEditor: '' as AnyComponent, RoleAssignmentEditor: '' as AnyComponent, RelationSetting: '' as AnyComponent, Backup: '' as AnyComponent, CreateAttributePopup: '' as AnyComponent, CreateRelation: '' as AnyComponent, EditRelation: '' as AnyComponent, Mailboxes: '' as AnyComponent, AddEmailSocialId: '' as AnyComponent, OfficeSettings: '' as AnyComponent, UserRoleSelect: '' as AnyComponent }, string: { Settings: '' as IntlString, Setting: '' as IntlString, Spaces: '' as IntlString, WorkspaceSettings: '' as IntlString, Integrations: '' as IntlString, Support: '' as IntlString, Privacy: '' as IntlString, Terms: '' as IntlString, Categories: '' as IntlString, Delete: '' as IntlString, Disconnect: '' as IntlString, DisconnectAll: '' as IntlString, Add: '' as IntlString, Proceed: '' as IntlString, SendConfirmation: '' as IntlString, NewEmail: '' as IntlString, AccountSettings: '' as IntlString, ChangePassword: '' as IntlString, Saving: '' as IntlString, Saved: '' as IntlString, Signout: '' as IntlString, InviteWorkspace: '' as IntlString, SelectWorkspace: '' as IntlString, Reconnect: '' as IntlString, ClassSetting: '' as IntlString, Classes: '' as IntlString, Owners: '' as IntlString, Configure: '' as IntlString, InviteSettings: '' as IntlString, RoleCapabilitySettings: '' as IntlString, DefaultInviteRoleForJoin: '' as IntlString, InviteLinkGeneratorRoles: '' as IntlString, General: '' as IntlString, Properties: '' as IntlString, TaskTypes: '' as IntlString, Automations: '' as IntlString, Collections: '' as IntlString, SpaceTypes: '' as IntlString, Roles: '' as IntlString, OwnerOrMaintainerRequired: '' as IntlString, Backup: '' as IntlString, BackupLast: '' as IntlString, BackupTotalSnapshots: '' as IntlString, BackupTotalFiles: '' as IntlString, BackupSize: '' as IntlString, BackupLinkInfo: '' as IntlString, BackupBearerTokenInfo: '' as IntlString, BackupSnapshots: '' as IntlString, BackupFileDownload: '' as IntlString, BackupFiles: '' as IntlString, BackupNoBackup: '' as IntlString, NonBackupedBlobs: '' as IntlString, AddAttribute: '' as IntlString, Mailboxes: '' as IntlString, CreateMailbox: '' as IntlString, CreateMailboxPlaceholder: '' as IntlString, MailboxNoDomains: '' as IntlString, MailboxLimitReached: '' as IntlString, OfficeSettings: '' as IntlString, OfficeDefaultSettings: '' as IntlString, DefaultStartWithTranscription: '' as IntlString, DefaultStartWithRecording: '' as IntlString, MailboxErrorInvalidName: '' as IntlString, MailboxErrorDomainNotFound: '' as IntlString, MailboxErrorNameRulesViolated: '' as IntlString, MailboxErrorMailboxExists: '' as IntlString, MailboxErrorMailboxCountLimit: '' as IntlString, DeleteMailbox: '' as IntlString, MailboxDeleteConfirmation: '' as IntlString, IntegrationFailed: '' as IntlString, IntegrationError: '' as IntlString, EmailIsUsed: '' as IntlString, Customize: '' as IntlString, CodeSent: '' as IntlString, SendAgain: '' as IntlString, SendAgainIn: '' as IntlString, AllIntegrations: '' as IntlString, ConnectedIntegrations: '' as IntlString, AvailableIntegrations: '' as IntlString, Connect: '' as IntlString, Integrate: '' as IntlString, FailedToLoadIntegrations: '' as IntlString, FailedToDisconnect: '' as IntlString, ServiceIsUnavailable: '' as IntlString, Integrated: '' as IntlString, Connected: '' as IntlString, Disconnected: '' as IntlString, Available: '' as IntlString, NotConnectedIntegration: '' as IntlString, IntegrationIsUnstable: '' as IntlString }, icon: { AccountSettings: '' as Asset, Owners: '' as Asset, Password: '' as Asset, Setting: '' as Asset, Integrations: '' as Asset, Support: '' as Asset, Privacy: '' as Asset, Terms: '' as Asset, Signout: '' as Asset, SelectWorkspace: '' as Asset, Clazz: '' as Asset, Enums: '' as Asset, InviteSettings: '' as Asset, InviteWorkspace: '' as Asset, Views: '' as Asset, Relations: '' as Asset, Mailbox: '' as Asset, OfficeSettings: '' as Asset }, templateFieldCategory: { Integration: '' as Ref }, templateField: { OwnerFirstName: '' as Ref, OwnerLastName: '' as Ref, OwnerPosition: '' as Ref, Value: '' as Ref }, metadata: { BackupUrl: '' as Metadata }, function: { HasRoleCapability: '' as Resource<(capabilityId: RoleCapabilityId | string) => Promise> } })