@droppii-org/chat-sdk
Version:
Droppii React Chat SDK
124 lines • 3.54 kB
TypeScript
import { FileMsgParamsByURL, ImageMsgParamsByURL, MessageType, Platform, SelfUserInfo, VideoMsgParamsByURL } from "@openim/wasm-client-sdk";
import { UploadFile } from "antd";
export declare enum DChatApplicationType {
OBEFE = "OBEFE"
}
export declare enum ConnectStatus {
Disconnected = 0,
Connected = 1,
Connecting = 2
}
export declare enum SyncStatus {
Loading = 0,
Success = 1,
Failed = 2
}
export declare enum CustomType {
CallingInvite = 200,
CallingAccept = 201,
CallingReject = 202,
CallingCancel = 203,
CallingHungup = 204
}
export declare enum CustomMessageType {
URL = 160
}
export type DChatMessageType = CustomMessageType | MessageType;
export interface ChatContextType {
user: SelfUserInfo | null;
connectStatus: ConnectStatus;
syncStatus: SyncStatus;
getSelfUserInfo: () => void;
updateConnectStatus: (status: ConnectStatus) => void;
updateSyncStatus: (status: SyncStatus) => void;
}
export interface ChatProviderProps {
children: React.ReactNode;
config: DChatInitAndLoginConfig | null;
}
export interface ExtendMessageInfo {
messageInfo?: {
type: "MESSAGE_INFO";
data: {
type: "rich_text";
content: string;
};
};
sessionId: string;
applicationType: DChatApplicationType;
}
export interface MessageFooterContextType {
onSendMessage: ({ plainText, richText, type, }: {
plainText: string;
richText: string;
type: "text" | "file";
}) => void;
listUploadFiles: UploadFile[];
setListUploadFiles: (files: UploadFile[] | ((prev: UploadFile[]) => UploadFile[])) => void;
}
export interface ImageMsgParamsByFile extends ImageMsgParamsByURL {
file: File;
}
export interface VideoMsgParamsByFile extends VideoMsgParamsByURL {
videoFile: File;
snapshotFile: File;
}
export interface FileMsgParamsByFile extends FileMsgParamsByURL {
file: File;
}
export interface ExtendConversationInfo {
applicationType?: "OBEFE";
sessionInfo?: {
type: "SESSION_INFO";
data: {
ownerId: string;
botId: string;
};
};
}
export interface ExtendPublicUserInfo {
userInfo?: {
type: "USER_INFO";
data: {
username?: string;
};
};
}
export interface DChatInitAndLoginConfig {
platformID: Platform;
apiAddr: string;
wsAddr: string;
accessToken: string;
userID: string;
applicationType: DChatApplicationType;
isCrm?: boolean;
/**
* Callback to refresh access token when 401 detected.
* Consumer app should call refresh token API and return new accessToken.
* If not provided, 401s will trigger authFailed event.
*/
onTokenRefresh?: () => Promise<string>;
/**
* Callback when authentication fails (e.g., refresh token expired).
* Consumer should handle logout and redirect.
*/
onAuthError?: (error: Error) => void;
}
export declare enum SessionStatus {
UNASSIGNED = "UNASSIGNED",
WAITING_PROCESS = "WAITING_PROCESS",
IN_PROCESS = "IN_PROCESS",
COMPLETED = "COMPLETED"
}
export declare enum SessionTag {
NONE = "NONE",
SLOW_PROCESSING = "SLOW_PROCESSING",
AWAITING_REPLY = "AWAITING_REPLY",
TEMPORARILY_PAUSED = "TEMPORARILY_PAUSED"
}
export declare enum BusinessNotificationType {
SESSION_STATE_UPDATED = "SESSION_STATE_UPDATED",
SESSION_CLOSED = "SESSION_CLOSED",
SESSION_CREATED = "SESSION_CREATED"
}
//# sourceMappingURL=chat.d.ts.map