export type AccountPlanServices = { email: number webchat: number 'sms-wavy': number telegram: number whatsapp: number instagram: number 'reclame-aqui': number 'whatsapp-remote': number 'whatsapp-business': number 'facebook-messenger': number 'google-business-message': number } export type AccountPlan = { /** AI feature settings; transcription holds the number of AI transcription requests allowed. */ ai: { transcription: string | null } /** Maximum number of users allowed for the account. */ users: number /** Maximum number of WhatsApp HSM (template) messages allowed. */ hsmLimit: number services: AccountPlanServices /** Current count of HSM templates already used. */ hsmUsedLimit: number /** Indicates if the account is in trial mode. */ isTrial?: boolean /** Indicates if the account is in a grace period after expiration. */ isOnGracePeriod?: boolean /** Indicates if the grace period is locked and requires user action to extend. */ isGracePeriodOnHold?: boolean /** Number of times the grace period can still be extended. */ gracePeriodExtendTimesRemaining?: number /** ISO date string when the current grace period extension expires. */ gracePeriodEndsAt?: string /** Base number of users included in the contracted plan. */ planBaseUsers?: number /** Base service limits (by service type) included in the contracted plan. */ planBaseServices?: { [serviceName: string]: number } emailNotifications?: { /** Tracks whether the account expiration email has been sent. */ expiredNotificationSent?: boolean /** Tracks whether the account expiration warning email has been sent. */ expirationNotificationSent?: boolean } } export type AccountSettingsFlags = { /** Enables the third version of the bot builder with improved workflow and AI node support. */ 'bots-v3'?: boolean /** Enables the second (legacy) version of the bot builder. */ 'bots-v2'?: boolean /** Enables employee absence management and status tracking features. */ 'absence-management'?: boolean /** Enables the AI node within the bot v3 builder for intelligent agent blocks. */ 'enable-bots-v3-ai-node'?: boolean /** Shows separate tabs by agent and by department in service statistics. */ 'by-user-and-by-department-tabs'?: boolean /** Enables service-based message blocking rules to restrict interactions by phone area code. */ 'use-block-message-rules-by-service'?: boolean /** Removes the limit on WhatsApp Business template (HSM) message sends. */ 'disable-hsm-limit'?: boolean /** Enables automatic ticket distribution and assignment based on configured rules. */ distribution?: boolean /** Enables transcription of audio messages and voice notes to text. */ 'enable-audio-transcription'?: boolean /** Enables AI-powered intelligent conversation summarization. */ 'enable-smart-summary'?: boolean /** Enables ChatGPT integration for AI-powered features. */ 'enable-chatgpt'?: boolean /** Enables sales funnel and opportunity tracking functionality. */ 'enable-sales-funnel'?: boolean /** Enables internal team chat and communication between agents. */ 'internal-chat'?: boolean /** Enables automatic deactivation of invalid or broken webhook endpoints. */ 'invalid-webhooks-inactivator'?: boolean /** Enables full-text search over messages and conversation history. */ 'search-messages'?: boolean /** Enables AI-powered magic text for intelligent message suggestions. */ 'enable-magic-text'?: boolean /** Enables AI-powered CSAT (Customer Satisfaction) scoring for survey responses. */ 'enable-smart-csat-score'?: boolean /** Enables waveform visualization for audio messages. */ 'enable-audio-waveform'?: boolean /** Enables Single Sign-On (SSO) authentication for user login. */ 'enable-sso'?: boolean /** Enables AI copilot assistant for agent support and message assistance. */ 'enable-copilot'?: boolean /** Enables kanban board functionality for visual task and ticket management. */ 'enable-kanban-boards'?: boolean /** Enables blocking of specific file extensions based on service type. */ 'enable-file-extension-blocking'?: boolean } export type AccountSettingsDrivers = { email?: boolean webchat?: boolean 'sms-wavy'?: boolean telegram?: boolean whatsapp?: boolean instagram?: boolean 'reclame-aqui'?: boolean 'whatsapp-business'?: boolean 'facebook-messenger'?: boolean 'whatsapp-remote-pod'?: boolean 'google-business-message'?: boolean } export type AccountSettingsCampaign = { /** Toggle enabling SMS campaigns via Wavy provider. */ 'sms-wavy'?: boolean /** Toggle enabling WhatsApp message campaigns. */ whatsapp?: boolean /** Toggle enabling Instagram message campaigns. */ instagram?: boolean /** Campaign auto-pause setting: 'disabled', 'enabled', or a specific quality threshold. */ 'auto-pause-mode'?: string /** Toggle enabling WhatsApp Business API message campaigns. */ 'whatsapp-business'?: boolean /** Toggle enabling Facebook Messenger campaigns. */ 'facebook-messenger'?: boolean } export type AccountSettings = { /** Feature flags that toggle specific platform capabilities. */ flags?: AccountSettingsFlags /** Enables/disables specific communication channels (whatsapp, telegram, webchat, etc.). */ drivers?: AccountSettingsDrivers /** Campaign channel toggles and auto-pause mode configuration. */ campaign?: AccountSettingsCampaign /** Timezone of the account for scheduling and time-based features. */ timezone?: string /** Requires agents to select a topic when closing a ticket. */ topicRequired?: boolean /** Enables visibility of tags in the chat interface. */ showTagsInChat?: boolean /** Enables the ticket (SAC) functionality for the account. */ ticketsEnabled?: boolean /** Toggles the display of support information. */ showSupportInfo?: boolean /** Allows duplicate contact names in the system. */ allowDuplicateNames?: boolean /** Makes email a mandatory field when creating users. */ isUserEmailRequired?: boolean /** Minutes of inactivity until a user is marked as away. */ userAwayMinutesTime?: number /** Enables notifications when new messages are received. */ newMessageNotification?: boolean /** Enables notifications when tickets are opened. */ ticketOpenNotification?: boolean /** Enables queue notifications in mobile applications. */ isQueueNotificationActive?: boolean /** Enables notifications when tickets are transferred. */ ticketTransferNotification?: boolean /** Defines how user passwords are created: manually, automatically, or via a link. */ userPasswordCreationMethod?: 'manual' | 'automatic' | 'link' /** Forces users to change their password on first login. */ changeUserPasswordOnFirstAccess?: boolean /** Disables automatic ticket transfer to the default department or user. */ disableDefaultTicketTransfer?: boolean /** Enables AI features outside of the knowledge base context. */ outsideTheKnowledgeBase?: boolean /** Enables automatic transcription of audio messages. */ enableAudioTranscription?: boolean /** Enables audio transcription specifically for copilot features. */ enableAudioTranscriptionCopilot?: boolean /** Enables audio transcription specifically for agent features. */ enableAudioTranscriptionAgent?: boolean /** Automatically generates a conversation summary when a ticket is closed. */ autoGenerateSummaryOnClosure?: boolean /** Automatically generates a conversation summary when a ticket is transferred. */ autoGenerateSummaryOnTransfer?: boolean /** Allows agents to modify tag visibility settings within the chat. */ userCanChangeVisibilityTagsOnChat?: boolean /** Minutes of inactivity before a ticket is considered inactive. */ ticketInactiveTime?: number /** Toggles display of the operator/agent name in messages. */ operatorName?: boolean /** Format template for ticket protocol numbers (e.g. '{{date}}{{count}}'). */ protocolFormat?: string /** Enables IP address restriction to limit account access by IP. */ ipRestriction?: boolean /** List of IP addresses allowed to access the account when IP restriction is active. */ allowedIps?: string[] /** Enables password expiration policy for users. */ isPasswordExpirationActive?: boolean /** Number of days before user passwords expire. */ expirationPasswordTime?: number /** Makes two-factor authentication mandatory for all users. */ twoFactorAuthMandatory?: boolean /** Enables blocking of file uploads by extension type. */ fileExtensionRestrictionEnabled?: boolean /** Maps service types to their arrays of blocked file extensions. */ blockedFileExtensions?: { [serviceType: string]: string[] } /** Configures user absence/unavailability settings. */ absence?: { enabled?: boolean } /** Defines company working hours with start/end times and weekdays. */ workPlan?: { start: string; end: string; weekDays: string[] }[] /** SSO configuration; supports Azure AD with tenant, client, and secret settings. */ sso?: { azureAd?: { enabled: boolean label: string tenantId: string clientId: string clientSecret: string } } } export type AccountCreditNotificationRange = { /** Display name for the notification threshold (e.g. '50%'). */ name: string /** Percentage of credits used that triggers this notification. */ percent: number /** Delivery methods for the notification: push (app), email, or modal (popup). */ modes: ('push' | 'email' | 'modal')[] } export type AccountCreditNotificationSent = { percent: number /** ISO date string of when the notification was sent. */ sentAt: string } export type AccountCreditsControl = { /** Indicates if the credit control system is active for the account. */ enabled: boolean /** Day of the month for billing cycle closure, set by ERP. */ closingDay: number | null /** Date of the most recent credit renewal. */ lastRenewalDate: string | null /** Date when credits will next be renewed. */ nextRenewalDate: string | null /** Allows the account to overdraw (go negative) on credits. */ allowExceedLimit: boolean /** Credit billing mode: 'charge-credits', 'not-charge-credits', or null. */ creditsSystemType: 'not-charge-credits' | 'charge-credits' | null /** Amount of credits added in the last renewal. */ lastRenewalAmount: number /** Amount of credits that will be added in the next renewal. */ nextRenewalAmount: number /** Tracks which credit usage notification ranges have been sent this period. */ notificationsSent: AccountCreditNotificationSent[] /** Configured credit usage thresholds that trigger notifications. */ notificationRanges: AccountCreditNotificationRange[] /** ISO date string of when the credit control system was activated. */ useCreditsSystemAt: string | null /** ERP event ID for the contracted plan. */ contractedPlanEventId: string | null /** ERP product ID for the contracted plan. */ contractedPlanProductId: string | null /** Indicates if the account has no credits remaining. */ withoutCreditsAvailable: boolean /** ERP product name for the contracted plan. */ contractedPlanProductName: string | null /** ISO date string of the last contract update received from the ERP. */ lastUpdateContractFromAgnus: string | null } export type Account = { id: string name: string alias: string isActive: boolean isCampaignActive: boolean createdAt: string updatedAt: string expiresAt: string | null deletedAt: string | null data: { managerNumber: string } plan: AccountPlan settings: AccountSettings wizardProgress: string encryptionKey: string branch: string correlationId: string promptAiFinalize: string | null promptAiTransfer: string | null promptAiCsat: string | null creditsControl: AccountCreditsControl defaultDepartmentId: string clusterId: string | null agnusSignatureKey: string | null twoFactorAuthMandatoryActive: boolean } export type CreateAccountPayload = { name: string email: string password: string passwordConfirmation: string phoneNumber?: string branch?: string isClientUser?: boolean roles?: string[] departments?: string[] services?: string[] scheduleId?: string } export type UpdateAccountPayload = { name?: string email?: string phoneNumber?: string branch?: string isClientUser?: boolean roles?: string[] departments?: string[] services?: string[] scheduleId?: string }