import { AccountUsages, CompletionModel, DcChatbot, DcChatbotLean, DcChatbotStatus, DcDocument, OrganizationData, OrganizationUser, User, UserDocument } from "../CommonTypes"; import { ChatBotAnalyticsData } from "../CommonTypes/AnalyticsData.js"; import { AnalyticsReportStatus } from "../CommonTypes/AnalyticsReportStatus"; import { EnforceDataResidencyError } from "../CommonTypes/EnforceDataResidencyError"; import { PlanData } from "../CommonTypes/PlanData"; import { SessionData } from "../CommonTypes/SessionData.js"; export interface ResponseBase { } export declare namespace ResTypes { interface DoesUserExistResponse extends ResponseBase { exists: boolean; correctedEmail: string; } interface CreateChatBotResponse extends ResponseBase { chatbotId: string; } interface EditChatBotResponse extends ResponseBase { afterEditChatBot: DcChatbot; } /** * Answer for this kind of response will be provided in a stream * @see StreamableData */ interface QueryChatBotResponse extends ResponseBase { } interface GetChatBotsResponse extends ResponseBase { chatbots: DcChatbot[]; publicChatbotIds: string[]; favoriteChatbotIds: string[]; userChatbotIds: string[]; organizationChatBotIds: string[]; pagination: { page: number; pageSize: number; totalCount: number; totalPages: number; hasNextPage: boolean; hasPreviousPage: boolean; }; } interface GetChatbotResponse extends ResponseBase { chatbot: DcChatbot; } interface InitChatResponse extends ResponseBase { sessionId: string; } interface GetChatBotDocumentsResponse extends ResponseBase { documents: DcDocument[]; } interface GetUserDocumentsResponse extends ResponseBase { documents: UserDocument[]; } interface GetChatBotForChatResponse extends ResponseBase { chatbot: DcChatbotLean; } interface DeleteChatBotResponse extends ResponseBase { } interface UpdateChatBotFavoriteStatusResponse extends ResponseBase { } interface GetChatBotIdAndStatusesForUserResponse { idAndStatuses: { id: string; status: DcChatbotStatus; }[]; } interface GetDocumentIdAndStatusesForUserResponse { idAndStatuses: { id: string; status: DcChatbotStatus; }[]; } interface GetUserInfoResponse extends ResponseBase { user: User; organizationData: OrganizationData; accountUsages: AccountUsages; planData: PlanData; /** * If this is a plan which doesn't have a payment (i.e. admin, expired, free) this will be null. Otherwise, this will be the date when the plan will renew * In case the plan is cancelled but still active, this will be the date when the plan would have been renewed */ planPaymentCycleEndsAt?: Date; planWillRenew: boolean; } interface SetCompletedOnBoardingResponse extends ResponseBase { } interface SignupResponse extends ResponseBase { } interface SendResetPasswordEmailResponse extends ResponseBase { } interface IsPasswordResetTokenValidResponse extends ResponseBase { } interface ResetPasswordResponse extends ResponseBase { } interface UpsertOrganizationUserResponse extends ResponseBase { credentials: { userName: string; password: string; }[]; } interface SetOrganizationDataResponse extends ResponseBase { } interface ChangeOranizationUserRoleResponse extends ResponseBase { } interface GetOrganizationUsersResponse extends ResponseBase { users: OrganizationUser[]; } interface CreateUserForExternalSignupResponse extends ResponseBase { } interface GetChatBotForEmbedResponse extends ResponseBase { chatbot: DcChatbotLean; } interface GetChatBotVisibleUrlResponse extends ResponseBase { visibleUrl: string[]; widgetUrl?: string; } interface AddDocumentsResponse extends ResponseBase { documentIds: string[]; } interface DeleteDocumentsResponse extends ResponseBase { } interface RenameDocumentsResponse extends ResponseBase { } interface DownloadDocumentResponse extends ResponseBase { fullFileName: string; contentBase64: string; } interface SigninWithPasswordResponse extends ResponseBase { userId: string; } interface GetPlansResponse extends ResponseBase { plans: PlanData[]; } interface GetAccountUsagesResponse extends ResponseBase { usage: AccountUsages; } interface UpdatePlanResponse extends ResponseBase { redirectUrl: string; } interface GetBillingPortalUrlResponse extends ResponseBase { redirectUrl: string; } /** * Cancels the renewal upon the next billing date, if the user has a subscription */ interface CancelSubscriptionResponse extends ResponseBase { } interface RateAnswerResponse extends ResponseBase { } interface GetChatbotSessionsResponse extends ResponseBase { sessions: SessionData[]; } interface GetChatbotAnalyticsResponse extends ResponseBase { years: { /** * i.e: 2023, 2024 */ year: number; months: { /** * zero base index, i.e. 0 is January */ monthNumber: number; analytics: ChatBotAnalyticsData[]; }[]; }[]; } interface UpsertAzureOpenAiCredentialsResponse extends ResponseBase { } interface GetAzureOpenAiCredentialsResponse extends ResponseBase { credentials: { maskedKey: string; endpoint: string; model: CompletionModel; }[]; } interface EditChatBotShareOptionsResponse extends ResponseBase { } interface EditChatbotLimitsOptionsResponse extends ResponseBase { } interface EditChatbotVisibleResponse extends ResponseBase { } interface EditChatbotWidgetUrlResponse extends ResponseBase { } interface DuplicateChatbotResponse extends ResponseBase { chatbotId: string; } interface EnforceDataResidencyResponse extends ResponseBase { succesfullyModified: boolean; failureReasons: EnforceDataResidencyError[]; } interface GetOrganizationCssByChatBotIdResponse extends ResponseBase { customCss: string; } interface UpsertGoogleDriveIntegrationResponse extends ResponseBase { } interface RemoveGoogleDriveIntegrationResponse extends ResponseBase { } interface SetCTAUsedInSessionResponse extends ResponseBase { } interface SendDeleteAccountEmailResponse extends ResponseBase { } interface SynchronizeGoogleDriveFoldersResponse extends ResponseBase { result: { folderDocFileId: string; success: boolean; error?: string; }[]; } interface ModifyChatSessionContextResponse extends ResponseBase { } interface GetCompletionModelsResponse extends ResponseBase { models: { id: CompletionModel; company: string; label: string; creditPerQuestion: number; grade_intelligence: number; grade_speed: number; grade_cost_efficiency: number; eu_resident: boolean; }[]; } interface GenerateApiKeyResponse extends ResponseBase { apiKey: string; } interface RevokeApiKeyResponse extends ResponseBase { } interface GetSessionResponse extends ResponseBase { session: SessionData; chatbot: DcChatbot; messages: ChatMessage[]; } interface GetMaskedApiKeyResponse extends ResponseBase { maskedApiKey: string; expiresAt: Date; } interface GetChatBotAndSessionBySessionIdResponse extends ResponseBase { chatbot: DcChatbot; session: SessionData; } interface GenerateAnalyticsReportResponse extends ResponseBase { analyticsReportId: string; } interface ListAnalyticsReportsResponse extends ResponseBase { analyticsReports: { id: string; requestedAt: Date; status: AnalyticsReportStatus; completedAt?: Date; }[]; } interface GetAnalyticsReportResponse extends ResponseBase { report: { id: string; startDate: Date; endDate: Date; requestedAt: Date; completedAt: Date; }; sourceUsage: { docFileId: string; docFileName: string; docFileUrl: string | null; usedTimes: number; sourceRatedUpTimes: number; sourceRatedDownTimes: number; }[]; mostAskedQuestions: { questions: string[]; askedCount: number; }[]; unansweredQuestions: string[]; } interface GetChatBotPermissionsResponse extends ResponseBase { userPermissions: Array<{ userId: string; email: string; fullName: string; organizationRole: string | null; chatbotAccessLevel: string | null; }>; } interface UpdateChatBotPermissionsResponse extends ResponseBase { success: boolean; message: string; } interface GetOverviewResponse extends ResponseBase { summary: { totalChatbots: number; totalSessions: number; totalMessages: number; totalFeedbacks: number; averageHandlingTime: number; totalUsers: number; }; userDemographics: { totalUsers: number; usersByCountry: Array<{ country: string; count: number; percentage: number; }>; usersByDeviceType: Array<{ deviceType: string; count: number; percentage: number; }>; usersByBrowserType: Array<{ browserType: string; count: number; percentage: number; }>; }; topPerformingChatbots: Array<{ chatBotId: string; chatbotName: string; totalSessions: number; totalMessages: number; feedbacks: { total: number; ratedUp: number; ratedDown: number; numberOfIsNotTrue: number; numberOfIsNotHelpful: number; numberOfHasInconsistentLanguage: number; }; averageHandlingTime: number; ctaClickRate: number; }>; mostActiveChatbots: Array<{ chatbotId: string; chatbotName: string; recentSessions: number; lastActivity: string | null; }>; recentActivity: Array<{ chatbotId: string; chatbotName: string; recentSessions: number; lastActivity: string | null; }>; detailedAnalytics: { years: Array<{ year: number; months: Array<{ monthNumber: number; analytics: Array<{ chatBotId: string; chatbotName: string; totalSessions: number; totalMessages: number; feedbacks: { total: number; ratedUp: number; ratedDown: number; numberOfIsNotTrue: number; numberOfIsNotHelpful: number; numberOfHasInconsistentLanguage: number; }; averageHandlingTime: number; ctaClickRate: number; }>; }>; }>; userDemographics: { totalUsers: number; usersByCountry: Array<{ country: string; count: number; percentage: number; }>; usersByDeviceType: Array<{ deviceType: string; count: number; percentage: number; }>; usersByBrowserType: Array<{ browserType: string; count: number; percentage: number; }>; detailedData: any; }; }; } interface GetTestimonialSubmissionsResponse extends ResponseBase { submissions: { id: string; platform: string; reward: string | null; testimonialText: string | null; submittedAt: Date; rewardApplied: boolean; appliedAt: Date | null; notes: string | null; }[]; } interface CreateTestimonialSubmissionResponse extends ResponseBase { submission: { id: string; platform: string; reward: string | null; testimonialText: string | null; submittedAt: Date; rewardApplied: boolean; appliedAt: Date | null; notes: string | null; }; } interface GetPaymentProvidersResponse extends ResponseBase { paymentProviders: { id: string; name: string; enabled: boolean; }[]; } } interface ChatMessage { question: string; answer: string; questionAskedAt: Date; answerSentAt: Date; sources: { docFileId: string; content: string; name: string; contentType: string; url?: string; googleDrive?: { /** * The id of the folder in Google Drive */ parentFolderGoogleDriveId: string; parentFolderGoogleDriveURL: string; /** * The id of the folder in our system */ parentFolderDocFileId: string; parentFolderName: string; }; }; } export {};