@sendbird/ai-agent-messenger-react 1.21.3 → 1.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ import { AIAgentGroupChannelListQuery } from '@sendbird/chat/aiAgent';
4
4
  import { AIAgentModule } from '@sendbird/chat/aiAgent';
5
5
  import { BaseChannel } from '@sendbird/chat';
6
6
  import { BaseMessage } from '@sendbird/chat/message';
7
+ import type { CollectionEventSource } from '@sendbird/chat';
7
8
  import { ComponentType } from 'react';
8
9
  import { ConnectionHandler } from '@sendbird/chat';
9
10
  import { Context } from 'react';
@@ -188,6 +189,7 @@ rootElement?: HTMLElement;
188
189
  theme?: {
189
190
  palette?: Partial<PaletteShape>;
190
191
  typography?: Partial<{ [K in keyof TypographyShape]: Partial<TypographyShape[K]>; }>;
192
+ colors?: ColorSetInput;
191
193
  };
192
194
  /**
193
195
  * @public
@@ -286,7 +288,7 @@ __internalVariables?: InternalMessageTemplateVariables;
286
288
  children?: ReactNode | undefined;
287
289
  } & RefAttributes<MessengerSessionRef>>;
288
290
 
289
- export declare function AgentUIProviderContainer({ appearance, rootElement, logger, language, stringSet, children, messageTemplate, theme, }: Props): JSX.Element;
291
+ export declare function AgentUIProviderContainer({ appearance, rootElement, logger, language, languageCode, stringSet, children, messageTemplate, theme, }: Props): JSX.Element;
290
292
 
291
293
  declare abstract class AIAgentBaseStats {
292
294
  protected timers: Map<string, TimerData> = new Map();
@@ -485,6 +487,7 @@ declare interface AIAgentConversationContextValue {
485
487
  messages: BaseMessage[];
486
488
  newMessages: BaseMessage[];
487
489
  initialized: boolean;
490
+ subscribeMessageEvents: (listener: (event: ConversationMessageEvent) => void) => () => void;
488
491
  loadPrevious: () => Promise<void>;
489
492
  loadNext: () => Promise<void>;
490
493
  sendUserMessage: (params: UserMessageCreateParams) => Promise<UserMessage>;
@@ -760,6 +763,7 @@ export declare type AIAgentProps = PropsWithChildren<{
760
763
  typography?: Partial<{
761
764
  [K in keyof TypographyShape]: Partial<TypographyShape[K]>;
762
765
  }>;
766
+ colors?: ColorSetInput;
763
767
  };
764
768
  /**
765
769
  * @public
@@ -974,14 +978,61 @@ declare interface AIAgentStringSet {
974
978
  a11y_message_list: string;
975
979
  a11y_scroll_to_bottom: string;
976
980
  a11y_scroll_to_new_messages: string;
981
+ /** @deprecated Use a11y_menu instead. */
977
982
  a11y_open_conversation_list: string;
983
+ a11y_open_conversation: string;
984
+ a11y_open_conversations: string;
985
+ a11y_close_conversation: string;
986
+ a11y_close_conversations: string;
987
+ a11y_menu: string;
988
+ a11y_message_input: string;
989
+ a11y_send_message: string;
990
+ a11y_attach_file: string;
991
+ a11y_close_messenger: string;
992
+ a11y_expand_messenger: string;
993
+ a11y_collapse_messenger: string;
994
+ a11y_connect_agent: string;
995
+ a11y_message_sender_you: string;
996
+ a11y_suggested_reply: string;
997
+ a11y_typing_indicator: string;
998
+ a11y_code_block_placeholder: string;
999
+ a11y_typing_format: (name: string) => string;
1000
+ a11y_message_failed: string;
1001
+ a11y_new_messages_received: (count: number) => string;
1002
+ a11y_new_messages_received_from_sender: (sender: string, count: number) => string;
1003
+ a11y_agent_connected: (name: string) => string;
1004
+ a11y_conversation_closed: string;
1005
+ a11y_file_image: (name: string) => string;
1006
+ a11y_file_video: (name: string) => string;
1007
+ a11y_file_document: (name: string) => string;
1008
+ a11y_screen_conversation: string;
1009
+ a11y_screen_conversation_with_agent: (name: string) => string;
1010
+ a11y_screen_conversation_list_no_count: string;
1011
+ a11y_csat_displayed: string;
1012
+ a11y_empty_conversation: string;
1013
+ a11y_input_disabled: string;
1014
+ a11y_file_size_exceeded: (maxSizeMB: number) => string;
1015
+ a11y_csat_form_error: string;
1016
+ a11y_hint_send_message: string;
1017
+ a11y_hint_open_conversation: string;
1018
+ a11y_hint_open_conversations: string;
1019
+ a11y_hint_close_conversation: string;
1020
+ a11y_hint_open_menu: string;
1021
+ a11y_hint_connect_to_agent: string;
1022
+ a11y_hint_attach_file: string;
1023
+ a11y_hint_view_new_messages: string;
1024
+ a11y_hint_open_file: string;
1025
+ a11y_hint_open_image: string;
1026
+ a11y_hint_send_reply: string;
978
1027
  };
979
1028
 
980
1029
  conversation_list: {
981
1030
  header_title: string;
982
1031
  ended: string;
1032
+ system_message: string;
983
1033
  footer_title: string;
984
1034
  multiple_files_count: (count: number) => string;
1035
+ a11y_conversation_item: (agent: string, status: string, time: string, count: number) => string;
985
1036
  };
986
1037
 
987
1038
  date_format: {
@@ -1003,6 +1054,8 @@ declare interface AIAgentStringSet {
1003
1054
  question: string;
1004
1055
  submit_label: string;
1005
1056
  submission_expired: string;
1057
+ a11y_rating_label: (score: number, label: string) => string;
1058
+ a11y_hint_select_rating: string;
1006
1059
  };
1007
1060
 
1008
1061
  form: {
@@ -1107,6 +1160,55 @@ declare interface CloseConversationCommandParams {
1107
1160
  channelUrl: string;
1108
1161
  }
1109
1162
 
1163
+ /**
1164
+ * Output type — the resolved shape of theme.colors.
1165
+ * All values are plain strings. This is what components consume.
1166
+ */
1167
+ declare interface ColorSet {
1168
+ base: {
1169
+ primary: string;
1170
+ primaryContrastContent: string;
1171
+ background: string;
1172
+ headerBackground: string;
1173
+ modalContentBackground: string;
1174
+ };
1175
+ messageInput: {
1176
+ text: string;
1177
+ placeholderText: string;
1178
+ background: string;
1179
+ };
1180
+ messageIncoming: {
1181
+ text: string;
1182
+ background: string;
1183
+ };
1184
+ messageOutgoing: {
1185
+ text: string;
1186
+ background: string;
1187
+ };
1188
+ csat: {
1189
+ background: string;
1190
+ };
1191
+ }
1192
+
1193
+ /**
1194
+ * Input type — what users pass via the colors prop.
1195
+ * Each string field is replaced with ColorValue for light/dark support.
1196
+ * All fields are optional (partial override).
1197
+ */
1198
+ declare type ColorSetInput = {
1199
+ [K in keyof ColorSet]?: {
1200
+ [P in keyof ColorSet[K]]?: ColorValue;
1201
+ };
1202
+ };
1203
+
1204
+ /**
1205
+ * A color value that can be:
1206
+ * - A single hex string (applied to both light and dark themes)
1207
+ * - An object with optional light/dark hex strings (theme-specific).
1208
+ * When only one side is provided, the other falls back to the auto-generated value.
1209
+ */
1210
+ declare type ColorValue = HexColor | { light?: HexColor; dark?: HexColor };
1211
+
1110
1212
  declare interface CommandPayloads {
1111
1213
  [CommandType.ConversationClose]: undefined | CloseConversationCommandParams;
1112
1214
  [CommandType.MessengerSettingsUpdated]: MessengerSettingsUpdatedParams;
@@ -1137,7 +1239,7 @@ declare interface ContextObject {
1137
1239
  context: Record<string, string>;
1138
1240
  }
1139
1241
 
1140
- export declare const Conversation: ({ children, onNavigateToConversationList, channelUrl, onClearChannelUrl, shouldMarkAsRead, style, closedChannelUrl, onClearClosedChannelUrl, }: Props_3) => JSX.Element;
1242
+ export declare const Conversation: ({ children, onNavigateToConversationList, channelUrl, onClearChannelUrl, shouldMarkAsRead, announcementsEnabled, style, closedChannelUrl, onClearClosedChannelUrl, }: Props_3) => JSX.Element;
1141
1243
 
1142
1244
  export declare const ConversationContext: Context<ConversationContextValue | null>;
1143
1245
 
@@ -1387,7 +1489,7 @@ declare class ConversationInitialRenderStatsTracker {
1387
1489
  export declare const ConversationLayout: {
1388
1490
  (props: PropsWithChildren): ReactNode;
1389
1491
  defaults: {
1390
- template: ComponentType<unknown>;
1492
+ template: ComponentType<ConversationLayoutTemplateProps>;
1391
1493
  components: {
1392
1494
  Header: () => ReactNode;
1393
1495
  Body: () => JSX.Element;
@@ -1395,15 +1497,15 @@ export declare const ConversationLayout: {
1395
1497
  };
1396
1498
  };
1397
1499
  Template: ({ template, children }: {
1398
- template?: ComponentType<unknown> | undefined;
1500
+ template?: ComponentType<ConversationLayoutTemplateProps> | undefined;
1399
1501
  children?: ReactNode;
1400
1502
  }) => JSX.Element;
1401
- Context: Context<LayoutContextValue<unknown, {
1503
+ Context: Context<LayoutContextValue<ConversationLayoutTemplateProps, {
1402
1504
  Header: () => ReactNode;
1403
1505
  Body: () => JSX.Element;
1404
1506
  Footer: () => JSX.Element;
1405
1507
  }>>;
1406
- useContext: () => LayoutContextValue<unknown, {
1508
+ useContext: () => LayoutContextValue<ConversationLayoutTemplateProps, {
1407
1509
  Header: () => ReactNode;
1408
1510
  Body: () => JSX.Element;
1409
1511
  Footer: () => JSX.Element;
@@ -1420,6 +1522,9 @@ export declare const ConversationLayout: {
1420
1522
  }) => null;
1421
1523
  };
1422
1524
 
1525
+ declare interface ConversationLayoutTemplateProps {
1526
+ }
1527
+
1423
1528
  export declare const ConversationList: ({ conversationListLimit, conversationListFilter, children, onOpenConversationView, style, }: Props_4) => JSX.Element;
1424
1529
 
1425
1530
  /**
@@ -1939,6 +2044,25 @@ export declare const ConversationListLayout: {
1939
2044
  }) => null;
1940
2045
  };
1941
2046
 
2047
+ declare type ConversationMessageEvent = ConversationMessageEventPayload & { id: number };
2048
+
2049
+ declare type ConversationMessageEventPayload =
2050
+ | {
2051
+ kind: 'messagesAdded';
2052
+ source: CollectionEventSource;
2053
+ messages: BaseMessage[];
2054
+ }
2055
+ | {
2056
+ kind: 'messagesUpdated';
2057
+ source: CollectionEventSource;
2058
+ messages: BaseMessage[];
2059
+ }
2060
+ | {
2061
+ kind: 'initialized';
2062
+ source: 'cache' | 'api';
2063
+ messages: BaseMessage[];
2064
+ };
2065
+
1942
2066
  declare interface ConversationScrollContextValue {
1943
2067
  ref: RefObject<HTMLDivElement | null> | ((element: HTMLDivElement | null) => void);
1944
2068
  state: {
@@ -2273,6 +2397,13 @@ export declare interface GroundednessInfo {
2273
2397
  preview_title: string;
2274
2398
  }
2275
2399
 
2400
+ /**
2401
+ * Hex color string type. Enforces '#' prefix at compile time.
2402
+ * Only validates the prefix — does not guarantee valid hex digits or length.
2403
+ * Invalid values (e.g. '#zzz') will produce undefined rendering behavior.
2404
+ */
2405
+ declare type HexColor = `#${string}`;
2406
+
2276
2407
  /**
2277
2408
  * frequently used icons are imported statically, and others are imported dynamically.
2278
2409
  * */
@@ -3464,7 +3595,7 @@ declare interface LanguageSet extends Omit<AIAgentLanguageSet, 'strings'> {
3464
3595
  stringSet: StringSet;
3465
3596
  }
3466
3597
 
3467
- export declare function LauncherBase({ className, isOpened, onClick, type, imageUrl, dir, animated, backgroundColor, size, }: LauncherProps): JSX.Element;
3598
+ export declare function LauncherBase({ className, children, isOpened, onClick, ariaLabel, 'aria-label': ariaLabelProp, 'aria-describedby': ariaDescribedBy, type, imageUrl, dir, animated, backgroundColor, size, }: LauncherProps): JSX.Element;
3468
3599
 
3469
3600
  declare type LauncherImageType = 'default_icon' | 'custom_image';
3470
3601
 
@@ -3475,8 +3606,12 @@ declare interface LauncherInfo {
3475
3606
 
3476
3607
  declare type LauncherProps = {
3477
3608
  className?: string;
3609
+ children?: ReactNode;
3478
3610
  isOpened: boolean;
3479
3611
  onClick?: () => void;
3612
+ ariaLabel?: string;
3613
+ 'aria-label'?: string;
3614
+ 'aria-describedby'?: string;
3480
3615
  type: LauncherImageType;
3481
3616
  imageUrl: string;
3482
3617
  backgroundColor: string;
@@ -3494,6 +3629,7 @@ declare interface LayoutContextValue<Props, Components extends Record<string, Co
3494
3629
 
3495
3630
  declare interface LocalizationContextValue extends LanguageSet {
3496
3631
  format: typeof format;
3632
+ defaultStringSet: StringSet;
3497
3633
  }
3498
3634
 
3499
3635
  declare interface Loggable {
@@ -4039,11 +4175,14 @@ declare type Props = {
4039
4175
  logger?: Loggable;
4040
4176
  stringSet?: Partial<StringSet>;
4041
4177
  language?: string;
4178
+ /** @internal DO NOT USE THIS **/
4179
+ languageCode?: string;
4042
4180
  theme?: {
4043
4181
  palette?: Partial<PaletteShape>;
4044
4182
  typography?: Partial<{
4045
4183
  [K in keyof TypographyShape]: Partial<TypographyShape[K]>;
4046
4184
  }>;
4185
+ colors?: ColorSetInput;
4047
4186
  };
4048
4187
  /** @internal DO NOT USE THIS **/
4049
4188
  messageTemplate?: {
@@ -4080,6 +4219,7 @@ declare type Props_3 = PropsWithChildren<{
4080
4219
  onClearChannelUrl?: () => void;
4081
4220
  onNavigateToConversationList?: () => void;
4082
4221
  shouldMarkAsRead?: boolean;
4222
+ announcementsEnabled?: boolean;
4083
4223
  /** Custom styles for the conversation container. */
4084
4224
  style?: CSSProperties;
4085
4225
  /** @deprecated Please use `channelUrl` instead. **/
@@ -4222,6 +4362,7 @@ declare type StringSet = {
4222
4362
  CONVERSATION_LIST__HEADER_TITLE: string;
4223
4363
  CONVERSATION_LIST__NO_CONVERSATIONS: string;
4224
4364
  CONVERSATION_LIST__ENDED: string;
4365
+ CONVERSATION_LIST__SYSTEM_MESSAGE: string;
4225
4366
  CONVERSATION_LIST__MULTIPLE_FILES_COUNT: (count: number) => string;
4226
4367
  CITATION_SOURCE_TITLE: string;
4227
4368
  FORM_PLACEHOLDER: string;
@@ -4250,12 +4391,65 @@ declare type StringSet = {
4250
4391
  A11Y_MESSAGE_LIST: string;
4251
4392
  A11Y_SCROLL_TO_BOTTOM: string;
4252
4393
  A11Y_SCROLL_TO_NEW_MESSAGES: string;
4394
+ /** @deprecated Use A11Y_MENU instead. */
4253
4395
  A11Y_OPEN_CONVERSATION_LIST: string;
4396
+ A11Y_OPEN_CONVERSATION: string;
4397
+ A11Y_OPEN_CONVERSATIONS: string;
4398
+ A11Y_CLOSE_CONVERSATION: string;
4399
+ A11Y_CLOSE_CONVERSATIONS: string;
4400
+ A11Y_MENU: string;
4401
+ A11Y_MESSAGE_INPUT: string;
4402
+ A11Y_SEND_MESSAGE: string;
4254
4403
  A11Y_IMAGE_VIEWER_CLOSE: string;
4255
4404
  A11Y_IMAGE_VIEWER_PREVIOUS: string;
4256
4405
  A11Y_IMAGE_VIEWER_NEXT: string;
4257
4406
  A11Y_IMAGE_VIEWER_DOWNLOAD: string;
4258
4407
  A11Y_ATTACH_FILE: string;
4408
+ A11Y_MESSAGE_SENDER_YOU: string;
4409
+ A11Y_SUGGESTED_REPLY: string;
4410
+ A11Y_TYPING_INDICATOR: string;
4411
+ A11Y_CODE_BLOCK_PLACEHOLDER: string;
4412
+ A11Y_CSAT_RATING_LABEL: (score: number, label: string) => string;
4413
+ A11Y_FILE_UPLOAD_OPTIONS: string;
4414
+ A11Y_FAILED_MESSAGE_OPTIONS: string;
4415
+ A11Y_FEEDBACK_OPTIONS: string;
4416
+ A11Y_TYPING_FORMAT: (name: string) => string;
4417
+ A11Y_MESSAGE_FAILED: string;
4418
+ A11Y_NEW_MESSAGES_RECEIVED: (count: number) => string;
4419
+ A11Y_NEW_MESSAGES_RECEIVED_FROM_SENDER: (sender: string, count: number) => string;
4420
+ A11Y_AGENT_CONNECTED: (name: string) => string;
4421
+ A11Y_CONVERSATION_CLOSED: string;
4422
+ A11Y_FILE_IMAGE: (name: string) => string;
4423
+ A11Y_FILE_VIDEO: (name: string) => string;
4424
+ A11Y_FILE_DOCUMENT: (name: string) => string;
4425
+ A11Y_FILE_SELECTED?: (label: string) => string;
4426
+ A11Y_FILE_REMOVE_BUTTON: (name: string) => string;
4427
+ A11Y_SCREEN_CONVERSATION: string;
4428
+ A11Y_SCREEN_CONVERSATION_WITH_AGENT: (name: string) => string;
4429
+ A11Y_SCREEN_CONVERSATION_LIST_NO_COUNT: string;
4430
+ A11Y_CSAT_DISPLAYED: string;
4431
+ A11Y_EMPTY_CONVERSATION: string;
4432
+ A11Y_INPUT_DISABLED: string;
4433
+ A11Y_FILE_SIZE_EXCEEDED: (maxSizeMB: number) => string;
4434
+ A11Y_CSAT_FORM_ERROR: string;
4435
+ A11Y_CONVERSATION_ITEM: (agent: string, status: string, time: string, count: number) => string;
4436
+ A11Y_RATING_LABEL: (score: number, label: string) => string;
4437
+ A11Y_CONNECT_AGENT: string;
4438
+ A11Y_CLOSE_MESSENGER: string;
4439
+ A11Y_EXPAND_MESSENGER: string;
4440
+ A11Y_COLLAPSE_MESSENGER: string;
4441
+ A11Y_HINT_SEND_MESSAGE: string;
4442
+ A11Y_HINT_OPEN_CONVERSATION: string;
4443
+ A11Y_HINT_OPEN_CONVERSATIONS: string;
4444
+ A11Y_HINT_CLOSE_CONVERSATION: string;
4445
+ A11Y_HINT_OPEN_MENU: string;
4446
+ A11Y_HINT_CONNECT_TO_AGENT: string;
4447
+ A11Y_HINT_ATTACH_FILE: string;
4448
+ A11Y_HINT_VIEW_NEW_MESSAGES: string;
4449
+ A11Y_HINT_OPEN_FILE: string;
4450
+ A11Y_HINT_OPEN_IMAGE: string;
4451
+ A11Y_HINT_SEND_REPLY: string;
4452
+ A11Y_HINT_SELECT_RATING: string;
4259
4453
  SCROLL_TO_NEW_MESSAGES_LABEL: (messages: BaseMessage[]) => string;
4260
4454
  HANDOFF_CONFIRM__TITLE: string;
4261
4455
  HANDOFF_CONFIRM__DESCRIPTION: string;