@opiniom/types
v0.6.0
Published
TypeScript type definitions for the OpinioM chat SDK — Message, Conversation, User, and client types
Downloads
49
Maintainers
Readme
@opiniom/types
TypeScript type definitions for the OpinioM chat SDK.
This package is automatically installed as a dependency of @opiniom/core and @opiniom/react. Install it directly only if you need to reference types without importing the full SDK.
Install
npm install @opiniom/typesUsage
import type {
User,
Message,
Conversation,
Attachment,
Reaction,
PresenceState,
ClientState,
WidgetConfig,
InitOptions,
OpinioMClient,
SDKEvents,
SendMessageInput,
CreateConversationInput,
} from "@opiniom/types";Types
User
interface User {
id: string;
name: string | null;
email: string | null;
avatar_url: string | null;
}Message
interface Message {
id: string;
client_id: string | null;
conversation_id: string;
sender_id: string;
sender: Pick<User, "id" | "name" | "avatar_url">;
content: string;
is_edited: boolean;
is_deleted: boolean;
created_at: string;
updated_at: string;
attachments?: Attachment[];
status?: "pending" | "sent" | "failed";
}Conversation
interface Conversation {
id: string;
type: "direct" | "group" | "channel" | "support";
title: string | null;
project_id: string;
created_by: string | null;
is_archived: boolean;
created_at: string;
updated_at: string;
members?: ConversationMember[];
}Attachment
interface Attachment {
id: string;
message_id: string;
file_name: string;
file_size: number;
mime_type: string;
url: string;
created_at: string;
}PresenceState
interface PresenceState {
user_id: string;
status: "online" | "away" | "offline";
last_seen_at: string;
}ClientState
type ClientState =
| "idle"
| "authenticating"
| "connecting"
| "connected"
| "degraded"
| "reconnecting"
| "disconnected"
| "destroyed";SendMessageInput
interface SendMessageInput {
content: string;
client_id?: string;
attachments?: AttachmentInput[];
}CreateConversationInput
interface CreateConversationInput {
type: "direct" | "group" | "channel" | "support";
title?: string;
member_ids?: string[];
}WidgetConfig
interface WidgetConfig {
colors: WidgetColors;
typography: WidgetTypography;
layout: WidgetLayout;
content: WidgetContent;
}OpinioMClient
Full client interface — see @opiniom/core for the complete API reference.
Related Packages
| Package | Description | |---|---| | @opiniom/core | Framework-agnostic core client | | @opiniom/react | React provider, hooks, and components | | @opiniom/web | Lit-based web component widget |
License
MIT
