257 lines
8.3 KiB
TypeScript
257 lines
8.3 KiB
TypeScript
import { SupportConversationRow, SupportSenderType } from '../models/support.model';
|
|
export declare function isStaffRole(role: string | undefined): boolean;
|
|
export type SupportAccessContext = {
|
|
userId?: string;
|
|
role?: string;
|
|
visitorToken?: string | null;
|
|
};
|
|
export declare function assertConversationAccess(conversationId: string, ctx: SupportAccessContext): Promise<SupportConversationRow>;
|
|
export declare function findCurrentConversation(ctx: SupportAccessContext): Promise<{
|
|
id: string;
|
|
userId: string | null;
|
|
visitorToken: string | null;
|
|
isAnonymous: boolean;
|
|
subject: string | null;
|
|
status: import("../models/support.model").SupportConversationStatus;
|
|
assignedTo: string | null;
|
|
lastMessageAt: string | null;
|
|
lastMessagePreview: string | null;
|
|
unreadUser: number;
|
|
unreadStaff: number;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
} | null>;
|
|
export declare function ensureCurrentConversation(ctx: SupportAccessContext): Promise<{
|
|
id: string;
|
|
userId: string | null;
|
|
visitorToken: string | null;
|
|
isAnonymous: boolean;
|
|
subject: string | null;
|
|
status: import("../models/support.model").SupportConversationStatus;
|
|
assignedTo: string | null;
|
|
lastMessageAt: string | null;
|
|
lastMessagePreview: string | null;
|
|
unreadUser: number;
|
|
unreadStaff: number;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
}>;
|
|
export declare function sendToCurrentConversation(ctx: SupportAccessContext, input: {
|
|
body?: string;
|
|
attachmentUrl?: string;
|
|
attachmentName?: string;
|
|
attachmentMime?: string;
|
|
}): Promise<{
|
|
id: string;
|
|
conversationId: string;
|
|
senderType: SupportSenderType;
|
|
senderUserId: string | null;
|
|
senderDisplayName: string | null;
|
|
body: string | null;
|
|
attachmentUrl: string | null;
|
|
attachmentName: string | null;
|
|
attachmentMime: string | null;
|
|
readAt: string | null;
|
|
editedAt: string | null;
|
|
deletedAt: string | null;
|
|
deleted: boolean;
|
|
createdAt: string;
|
|
canEdit: boolean;
|
|
canDelete: boolean;
|
|
editAvailableUntil: string | null;
|
|
deleteAvailableUntil: string | null;
|
|
}>;
|
|
export declare function listUserConversations(ctx: SupportAccessContext): Promise<{
|
|
id: string;
|
|
userId: string | null;
|
|
visitorToken: string | null;
|
|
isAnonymous: boolean;
|
|
subject: string | null;
|
|
status: import("../models/support.model").SupportConversationStatus;
|
|
assignedTo: string | null;
|
|
lastMessageAt: string | null;
|
|
lastMessagePreview: string | null;
|
|
unreadUser: number;
|
|
unreadStaff: number;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
}[]>;
|
|
export declare function getConversationMessages(conversationId: string, ctx: SupportAccessContext, after?: string): Promise<{
|
|
messages: {
|
|
id: string;
|
|
conversationId: string;
|
|
senderType: SupportSenderType;
|
|
senderUserId: string | null;
|
|
senderDisplayName: string | null;
|
|
body: string | null;
|
|
attachmentUrl: string | null;
|
|
attachmentName: string | null;
|
|
attachmentMime: string | null;
|
|
readAt: string | null;
|
|
editedAt: string | null;
|
|
deletedAt: string | null;
|
|
deleted: boolean;
|
|
createdAt: string;
|
|
canEdit: boolean;
|
|
canDelete: boolean;
|
|
editAvailableUntil: string | null;
|
|
deleteAvailableUntil: string | null;
|
|
}[];
|
|
typing: {
|
|
userTyping: boolean;
|
|
staffTyping: boolean;
|
|
};
|
|
policy: {
|
|
editWindowMinutes: number;
|
|
deleteWindowMinutes: number;
|
|
};
|
|
}>;
|
|
export declare function sendMessage(conversationId: string, ctx: SupportAccessContext, input: {
|
|
body?: string;
|
|
attachmentUrl?: string;
|
|
attachmentName?: string;
|
|
attachmentMime?: string;
|
|
}): Promise<{
|
|
id: string;
|
|
conversationId: string;
|
|
senderType: SupportSenderType;
|
|
senderUserId: string | null;
|
|
senderDisplayName: string | null;
|
|
body: string | null;
|
|
attachmentUrl: string | null;
|
|
attachmentName: string | null;
|
|
attachmentMime: string | null;
|
|
readAt: string | null;
|
|
editedAt: string | null;
|
|
deletedAt: string | null;
|
|
deleted: boolean;
|
|
createdAt: string;
|
|
canEdit: boolean;
|
|
canDelete: boolean;
|
|
editAvailableUntil: string | null;
|
|
deleteAvailableUntil: string | null;
|
|
}>;
|
|
export declare function editMessage(conversationId: string, messageId: string, ctx: SupportAccessContext, body: string): Promise<{
|
|
id: string;
|
|
conversationId: string;
|
|
senderType: SupportSenderType;
|
|
senderUserId: string | null;
|
|
senderDisplayName: string | null;
|
|
body: string | null;
|
|
attachmentUrl: string | null;
|
|
attachmentName: string | null;
|
|
attachmentMime: string | null;
|
|
readAt: string | null;
|
|
editedAt: string | null;
|
|
deletedAt: string | null;
|
|
deleted: boolean;
|
|
createdAt: string;
|
|
canEdit: boolean;
|
|
canDelete: boolean;
|
|
editAvailableUntil: string | null;
|
|
deleteAvailableUntil: string | null;
|
|
}>;
|
|
export declare function deleteMessage(conversationId: string, messageId: string, ctx: SupportAccessContext): Promise<{
|
|
id: string;
|
|
conversationId: string;
|
|
senderType: SupportSenderType;
|
|
senderUserId: string | null;
|
|
senderDisplayName: string | null;
|
|
body: string | null;
|
|
attachmentUrl: string | null;
|
|
attachmentName: string | null;
|
|
attachmentMime: string | null;
|
|
readAt: string | null;
|
|
editedAt: string | null;
|
|
deletedAt: string | null;
|
|
deleted: boolean;
|
|
createdAt: string;
|
|
canEdit: boolean;
|
|
canDelete: boolean;
|
|
editAvailableUntil: string | null;
|
|
deleteAvailableUntil: string | null;
|
|
}>;
|
|
export declare function setTyping(conversationId: string, ctx: SupportAccessContext, active: boolean): Promise<{
|
|
ok: boolean;
|
|
}>;
|
|
export declare function listAdminConversations(filters: {
|
|
status?: string;
|
|
assignedTo?: string | null;
|
|
search?: string;
|
|
page?: number;
|
|
pageSize?: number;
|
|
}): Promise<{
|
|
items: {
|
|
id: string;
|
|
userId: string | null;
|
|
visitorToken: string | null;
|
|
isAnonymous: boolean;
|
|
subject: string | null;
|
|
status: import("../models/support.model").SupportConversationStatus;
|
|
assignedTo: string | null;
|
|
lastMessageAt: string | null;
|
|
lastMessagePreview: string | null;
|
|
unreadUser: number;
|
|
unreadStaff: number;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
}[];
|
|
total: number;
|
|
page: number;
|
|
pageSize: number;
|
|
totalPages: number;
|
|
}>;
|
|
export declare function getAdminConversationDetail(conversationId: string): Promise<{
|
|
conversation: {
|
|
id: string;
|
|
userId: string | null;
|
|
visitorToken: string | null;
|
|
isAnonymous: boolean;
|
|
subject: string | null;
|
|
status: import("../models/support.model").SupportConversationStatus;
|
|
assignedTo: string | null;
|
|
lastMessageAt: string | null;
|
|
lastMessagePreview: string | null;
|
|
unreadUser: number;
|
|
unreadStaff: number;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
};
|
|
user: {
|
|
id: string;
|
|
email: string | null;
|
|
firstName: string | null;
|
|
lastName: string | null;
|
|
displayName: string | null;
|
|
role: string;
|
|
emailVerified: boolean;
|
|
isEnabled: boolean;
|
|
createdAt: string;
|
|
} | null;
|
|
}>;
|
|
export declare function updateAdminConversation(conversationId: string, staffUserId: string, patch: {
|
|
status?: string;
|
|
assignedTo?: string | null;
|
|
subject?: string;
|
|
}): Promise<{
|
|
id: string;
|
|
userId: string | null;
|
|
visitorToken: string | null;
|
|
isAnonymous: boolean;
|
|
subject: string | null;
|
|
status: import("../models/support.model").SupportConversationStatus;
|
|
assignedTo: string | null;
|
|
lastMessageAt: string | null;
|
|
lastMessagePreview: string | null;
|
|
unreadUser: number;
|
|
unreadStaff: number;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
}>;
|
|
export declare function getStaffUnreadCount(): Promise<number>;
|
|
export declare function resolveUploadPath(storedName: string): string;
|
|
export declare function ensureUploadDir(): string;
|
|
export declare function publicAttachmentUrl(storedName: string): string;
|
|
/** Links all anonymous visitor conversations to a newly registered or logged-in user. */
|
|
export declare function mergeVisitorSupportForUser(userId: string, visitorToken: string | null | undefined): Promise<number>;
|
|
//# sourceMappingURL=supportService.d.ts.map
|