@sendbird/ai-agent-messenger-react 1.2.6 → 1.3.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.
@@ -3,7 +3,7 @@ import { useCallback as p } from "react";
3
3
  import s from "dompurify";
4
4
  import h, { RuleType as x } from "markdown-to-jsx";
5
5
  import g from "styled-components";
6
- import { A as b, c as i } from "./xCNV_S78.js";
6
+ import { A as b, c as i } from "./3qBdtnlJ.js";
7
7
  const m = (d, o, n, t) => o.type === x.textStrikethroughed ? /* @__PURE__ */ r.createElement("span", { key: t.key }, `~~${n(o.children, t)}~~`) : d(), z = ({ className: d, children: o, style: n, onClickImage: t }) => {
8
8
  const a = p(
9
9
  (e) => /* @__PURE__ */ r.createElement("img", { ...e, onClick: () => e.src && (t == null ? void 0 : t(e.src)) }),
@@ -1,5 +1,5 @@
1
1
  import * as a from "react";
2
- import { L as o } from "./xCNV_S78.js";
2
+ import { L as o } from "./3qBdtnlJ.js";
3
3
  const m = ({ iconSize: e = 48, className: r }) => /* @__PURE__ */ a.createElement(o, { size: e, className: r });
4
4
  export {
5
5
  m as default
@@ -1,5 +1,5 @@
1
1
  import * as o from "react";
2
- import { P as r } from "./xCNV_S78.js";
2
+ import { P as r } from "./3qBdtnlJ.js";
3
3
  const c = ({ label: e = "No channels", ...a }) => /* @__PURE__ */ o.createElement(r, { icon: "chat", label: e, ...a });
4
4
  export {
5
5
  c as default
@@ -1,5 +1,5 @@
1
1
  import * as a from "react";
2
- import { P as o } from "./xCNV_S78.js";
2
+ import { P as o } from "./3qBdtnlJ.js";
3
3
  const t = ({ label: e = "No messages", ...s }) => /* @__PURE__ */ a.createElement(o, { icon: "message", label: e, ...s });
4
4
  export {
5
5
  t as default
@@ -1,6 +1,6 @@
1
1
  import * as t from "react";
2
2
  import n from "styled-components";
3
- import { P as a, I as l, a as c, c as s } from "./xCNV_S78.js";
3
+ import { P as a, I as l, a as c, c as s } from "./3qBdtnlJ.js";
4
4
  const d = ({ label: r = "Something went wrong", action: e, ...o }) => /* @__PURE__ */ t.createElement(a, { icon: "error", label: r, ...o }, e && /* @__PURE__ */ t.createElement(i, { onClick: e.onClick, label: e.label ?? "Retry" })), i = ({ label: r, onClick: e }) => /* @__PURE__ */ t.createElement(m, { tabIndex: 0, onClick: e }, /* @__PURE__ */ t.createElement(l, { type: "refresh", size: 20 }), /* @__PURE__ */ t.createElement(c, { variant: "button", color: s.color.primary.main }, r)), m = n.button`all:unset;display:flex;cursor:pointer;gap:4px;align-items:center;justify-content:center;`;
5
5
  export {
6
6
  d as default
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./cjs/Cu22Ciyx.cjs");require("react");exports.AgentProviderContainer=e.AgentProviderContainer;exports.AgentUIProviderContainer=e.AgentUIProviderContainer;exports.AttachmentMode=e.AttachmentMode;exports.CSATType=e.CSATType;exports.Commands=e.Commands;exports.Conversation=e.Conversation;exports.ConversationLayout=e.ConversationLayout;exports.ConversationList=e.ConversationList;exports.ConversationListItemLayout=e.ConversationListItemLayout;exports.ConversationListLayout=e.ConversationListLayout;exports.DefaultMessenger=e.DefaultMessenger;exports.FixedMessenger=e.FixedMessenger;exports.IncomingMessageLayout=e.IncomingMessageLayout;exports.LauncherBase=e.LauncherBase;exports.LogLevel=e.LogLevel;exports.MessageLogs=e.MessageLogs;exports.OutgoingMessageLayout=e.OutgoingMessageLayout;exports.SystemMessageLayout=e.SystemMessageLayout;exports.messengerDispatcher=e.messengerDispatcher;exports.useLocalizationContext=e.useLocalizationContext;exports.useMessengerContext=e.useMessengerContext;exports.useMessengerSessionContext=e.useMessengerSessionContext;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./cjs/rl6FrW6Y.cjs");require("react");exports.AgentProviderContainer=e.AgentProviderContainer;exports.AgentUIProviderContainer=e.AgentUIProviderContainer;exports.AnonymousSessionInfo=e.AnonymousSessionInfo;exports.CSATType=e.CSATType;exports.Commands=e.Commands;exports.Conversation=e.Conversation;exports.ConversationContext=e.ConversationContext;exports.ConversationContextProvider=e.ConversationContextProvider;exports.ConversationLayout=e.ConversationLayout;exports.ConversationList=e.ConversationList;exports.ConversationListContext=e.ConversationListContext;exports.ConversationListContextProvider=e.ConversationListContextProvider;exports.ConversationListItemLayout=e.ConversationListItemLayout;exports.ConversationListLayout=e.ConversationListLayout;exports.DefaultMessenger=e.DefaultMessenger;exports.FixedMessenger=e.FixedMessenger;exports.IncomingMessageLayout=e.IncomingMessageLayout;exports.LauncherBase=e.LauncherBase;exports.LogLevel=e.LogLevel;exports.ManualSessionInfo=e.ManualSessionInfo;exports.MessageLogs=e.MessageLogs;exports.OutgoingMessageLayout=e.OutgoingMessageLayout;exports.SystemMessageLayout=e.SystemMessageLayout;exports.messengerDispatcher=e.messengerDispatcher;exports.useConversationContext=e.useConversationContext;exports.useConversationListContext=e.useConversationListContext;exports.useLocalizationContext=e.useLocalizationContext;exports.useMessengerContext=e.useMessengerContext;exports.useMessengerSessionContext=e.useMessengerSessionContext;
package/dist/index.d.ts CHANGED
@@ -1,11 +1,17 @@
1
1
  import { Action } from '@sendbird/uikit-message-template';
2
2
  import { AIAgentChannelFilter } from '@sendbird/chat/aiAgent';
3
3
  import { AIAgentModule } from '@sendbird/chat/aiAgent';
4
+ import { BaseMessage } from '@sendbird/chat/message';
4
5
  import { ComponentType } from 'react';
5
6
  import { Context } from 'react';
7
+ import { Conversation as Conversation_2 } from '@sendbird/chat/aiAgent';
6
8
  import { ConversationStatus } from '@sendbird/chat/aiAgent';
7
9
  import { CSSProperties } from 'react';
10
+ import { DependencyList } from 'react';
8
11
  import { DeskChannelFilter } from '@sendbird/chat/aiAgent';
12
+ import { Dispatch } from 'react';
13
+ import { FileMessage } from '@sendbird/chat/message';
14
+ import { FileMessageCreateParams } from '@sendbird/chat/message';
9
15
  import { format } from 'date-fns';
10
16
  import { ForwardRefExoticComponent } from 'react';
11
17
  import { GroupChannel } from '@sendbird/chat/groupChannel';
@@ -16,8 +22,13 @@ import { LogLevel as LogLevel_2 } from '@sendbird/chat';
16
22
  import { PropsWithChildren } from 'react';
17
23
  import { ReactNode } from 'react';
18
24
  import { RefAttributes } from 'react';
25
+ import { RefObject } from 'react';
19
26
  import { SendbirdChatWith } from '@sendbird/chat';
27
+ import { SendbirdError } from '@sendbird/chat';
20
28
  import { SessionHandler } from '@sendbird/chat';
29
+ import { SetStateAction } from 'react';
30
+ import { UserMessage } from '@sendbird/chat/message';
31
+ import { UserMessageCreateParams } from '@sendbird/chat/message';
21
32
 
22
33
  export declare interface ActionbookInfo {
23
34
  key: string;
@@ -26,9 +37,9 @@ export declare interface ActionbookInfo {
26
37
  }
27
38
 
28
39
  export declare interface AgentClientHandlers {
29
- onRegisterDeauthenticateHandler?: (deauthenticate: () => void) => void;
30
40
  onMessageSend?: (message: string) => void;
31
41
  onFunctionCallDetailClick?: (func: FunctionCallsInfo) => void;
42
+ onCustomEvent?: (event: CustomEvent_2) => void;
32
43
  }
33
44
 
34
45
  export declare interface AgentMessageTemplateInfo {
@@ -116,7 +127,7 @@ typography?: Partial<{ [K in keyof TypographyShape]: Partial<TypographyShape[K]>
116
127
  * @public
117
128
  * @description Custom User session information to be used in connecting to the agent.
118
129
  * */
119
- userSessionInfo?: UserSessionInfo;
130
+ userSessionInfo?: ManualSessionInfo | AnonymousSessionInfo | UserSessionInfo;
120
131
  /**
121
132
  * @public
122
133
  * @description Localization string set for the ai agent client.
@@ -196,6 +207,11 @@ children?: ReactNode | undefined;
196
207
 
197
208
  export declare function AgentUIProviderContainer({ appearance, rootElement, logger, language, stringSet, children, messageTemplate, theme, }: Props): JSX.Element;
198
209
 
210
+ declare interface AIAgentCache {
211
+ template: MessageTemplateCache;
212
+ messenger: MessengerSessionCache;
213
+ }
214
+
199
215
  declare interface AIAgentContextValue {
200
216
  appId: string;
201
217
  aiAgentId: string;
@@ -207,6 +223,36 @@ declare interface AIAgentContextValue {
207
223
 
208
224
  logger: Loggable;
209
225
  dispatcher: Dispatcher;
226
+
227
+ cache: AIAgentCache;
228
+ }
229
+
230
+ declare interface AIAgentConversationContextValue {
231
+ conversation: Conversation_2 | undefined;
232
+
233
+ channelSource: {
234
+ channel: GroupChannel | undefined;
235
+ error: SendbirdError | undefined;
236
+ refetch: () => Promise<void>;
237
+ };
238
+
239
+ messageSource: {
240
+ messages: BaseMessage[];
241
+ initialized: boolean;
242
+ loadPrevious: () => Promise<void>;
243
+ loadNext: () => Promise<void>;
244
+ sendUserMessage: (params: UserMessageCreateParams) => Promise<UserMessage>;
245
+ sendFileMessage: (params: FileMessageCreateParams) => Promise<FileMessage>;
246
+ };
247
+ }
248
+
249
+ declare interface AIAgentConversationListContextValue {
250
+ listSource: {
251
+ initialized: boolean;
252
+ error: SendbirdError | undefined;
253
+ channels: GroupChannel[];
254
+ loadMore: () => Promise<void>;
255
+ };
210
256
  }
211
257
 
212
258
  declare interface AIAgentGroupChannelFilter {
@@ -247,6 +293,36 @@ declare interface AIAgentInfo {
247
293
  specialNoticeEnabled: boolean;
248
294
  }
249
295
 
296
+ declare interface AIAgentMessengerSessionContextValue {
297
+ userSessionInfo?: UserSessionInfo | ManualSessionInfo | AnonymousSessionInfo;
298
+
299
+ userSession: null | UserSession;
300
+ aiAgentInfo: null | AIAgentInfo;
301
+ launcherInfo: null | LauncherInfo;
302
+ attachmentMode: AttachmentMode;
303
+
304
+ connectionError?: Error;
305
+
306
+ activeChannel?: { url: string; status: ConversationStatus };
307
+ setActiveChannel: (param: { url: string; status: ConversationStatus }) => void;
308
+
309
+ createConversation: (params: ConversationCreateParams) => Promise<string>;
310
+ refreshActiveChannel: () => Promise<string>;
311
+
312
+ authenticate: () => Promise<MessengerSettingsResponse>;
313
+ deauthenticate: () => Promise<void>;
314
+ }
315
+
316
+ declare interface AIAgentMessengerSessionRef {
317
+ activeChannel?: { url: string; status: ConversationStatus };
318
+ chatSDK: AIAgentContextValue['chatSDK'];
319
+ authenticate: () => Promise<MessengerSettingsResponse>;
320
+ deauthenticate: () => Promise<void>;
321
+ updateContext: (context: Record<string, string>) => Promise<ContextObject>;
322
+ patchContext: (context: Record<string, string>) => Promise<ContextObject>;
323
+ getContextObject: () => Promise<ContextObject>;
324
+ }
325
+
250
326
  export declare type AIAgentProps = PropsWithChildren<{
251
327
  appId: string;
252
328
  aiAgentId: string;
@@ -284,7 +360,7 @@ export declare type AIAgentProps = PropsWithChildren<{
284
360
  * @public
285
361
  * @description Custom User session information to be used in connecting to the agent.
286
362
  * */
287
- userSessionInfo?: UserSessionInfo;
363
+ userSessionInfo?: ManualSessionInfo | AnonymousSessionInfo | UserSessionInfo;
288
364
  /**
289
365
  * @public
290
366
  * @description Localization string set for the ai agent client.
@@ -360,10 +436,18 @@ export declare type AIAgentProps = PropsWithChildren<{
360
436
  };
361
437
  }>;
362
438
 
363
- export declare enum AttachmentMode {
364
- OFF = "off",
365
- ALWAYS = "always",
366
- HANDED_OFF_ONLY = "handed_off_only"
439
+ declare type AnonUserSessionData = { userId: string; authToken: string; expireAt: number };
440
+
441
+ export declare class AnonymousSessionInfo {
442
+ userId?: never;
443
+ authToken?: never;
444
+ sessionHandler?: never;
445
+ }
446
+
447
+ declare enum AttachmentMode {
448
+ OFF = 'off',
449
+ ALWAYS = 'always',
450
+ HANDED_OFF_ONLY = 'handed_off_only',
367
451
  }
368
452
 
369
453
  declare abstract class BaseCommand {
@@ -427,6 +511,22 @@ declare interface ContextObject {
427
511
 
428
512
  export declare const Conversation: ({ children, onNavigateToConversationList, closedChannelUrl, onClearClosedChannelUrl, }: Props_4) => JSX.Element;
429
513
 
514
+ export declare const ConversationContext: Context<ConversationContextValue | null>;
515
+
516
+ declare interface ConversationContextProps {
517
+ onNavigateToConversationList?: () => void;
518
+ closedChannelUrl?: string;
519
+ onClearClosedChannelUrl?: () => void;
520
+ }
521
+
522
+ export declare const ConversationContextProvider: ({ closedChannelUrl, onClearClosedChannelUrl, onNavigateToConversationList, children, }: PropsWithChildren<ConversationContextProps>) => JSX.Element;
523
+
524
+ declare interface ConversationContextValue extends AIAgentConversationContextValue {
525
+ scrollSource: ReturnType<typeof useMessageListScroll>;
526
+ goToActiveConversation: () => Promise<void>;
527
+ onNavigateToConversationList?: () => void;
528
+ }
529
+
430
530
  declare interface ConversationCreateParams {
431
531
  aiAgentId: string;
432
532
  language?: string;
@@ -472,6 +572,19 @@ export declare const ConversationLayout: {
472
572
 
473
573
  export declare const ConversationList: ({ conversationListFilter, children, onOpenConversationView }: Props_5) => JSX.Element;
474
574
 
575
+ export declare const ConversationListContext: Context<ConversationListContextValue | null>;
576
+
577
+ declare interface ConversationListContextProps {
578
+ conversationListFilter?: Partial<AIAgentGroupChannelFilter>;
579
+ onOpenConversationView?: (channelUrl: string, status: ConversationStatus) => void;
580
+ }
581
+
582
+ export declare function ConversationListContextProvider({ conversationListFilter, onOpenConversationView, children, }: PropsWithChildren<ConversationListContextProps>): JSX.Element;
583
+
584
+ declare interface ConversationListContextValue extends AIAgentConversationListContextValue {
585
+ onOpenConversationView: (channelUrl: string, status: ConversationStatus) => void;
586
+ }
587
+
475
588
  export declare const ConversationListItemLayout: {
476
589
  (props: PropsWithChildren): ReactNode;
477
590
  defaults: {
@@ -543,6 +656,18 @@ export declare enum CSATType {
543
656
  HELPDESK_CSAT_5 = "HELPDESK_CSAT_5"
544
657
  }
545
658
 
659
+ declare type CustomEvent_2 = {
660
+ type: 'message-sent-pending' | 'message-sent-succeeded';
661
+ data: {
662
+ message: BaseMessage;
663
+ };
664
+ } | {
665
+ type: 'bot-message-received';
666
+ data: {
667
+ message: BaseMessage;
668
+ };
669
+ };
670
+
546
671
  declare const _default: {
547
672
  language: string;
548
673
  dateLocale: Locale;
@@ -609,7 +734,7 @@ theme?: {
609
734
  palette?: Partial<PaletteShape>;
610
735
  typography?: Partial<{ [K in keyof TypographyShape]: Partial<TypographyShape[K]>; }>;
611
736
  };
612
- userSessionInfo?: UserSessionInfo;
737
+ userSessionInfo?: ManualSessionInfo | AnonymousSessionInfo | UserSessionInfo;
613
738
  stringSet?: Partial<StringSet>;
614
739
  dir?: "ltr" | "rtl";
615
740
  logLevel?: LogLevel_2;
@@ -695,7 +820,7 @@ theme?: {
695
820
  palette?: Partial<PaletteShape>;
696
821
  typography?: Partial<{ [K in keyof TypographyShape]: Partial<TypographyShape[K]>; }>;
697
822
  };
698
- userSessionInfo?: UserSessionInfo;
823
+ userSessionInfo?: ManualSessionInfo | AnonymousSessionInfo | UserSessionInfo;
699
824
  stringSet?: Partial<StringSet>;
700
825
  dir?: "ltr" | "rtl";
701
826
  logLevel?: LogLevel_2;
@@ -779,6 +904,7 @@ declare type IncomingBaseMessageProps<T> = T & BaseMessageProps<{
779
904
  suggestedRepliesDirection?: 'vertical' | 'horizontal';
780
905
  isBotMessage?: boolean;
781
906
  isTyping?: boolean;
907
+ isStreaming?: boolean;
782
908
  onGetCachedMessageTemplate?: (templateKey: string) => string | null;
783
909
  onRequestMessageTemplate?: (templateKey: string) => Promise<string>;
784
910
  onHandleTemplateInternalAction?: (action: Action) => void;
@@ -965,6 +1091,24 @@ export declare enum LogLevel {
965
1091
  NONE,
966
1092
  }
967
1093
 
1094
+ export declare class ManualSessionInfo {
1095
+ userId: string;
1096
+ authToken: string;
1097
+ sessionHandler: SessionHandler;
1098
+
1099
+ constructor({ userId, authToken, sessionHandler }: ManualSessionInfoParams) {
1100
+ this.userId = userId;
1101
+ this.authToken = authToken;
1102
+ this.sessionHandler = sessionHandler;
1103
+ }
1104
+ }
1105
+
1106
+ declare interface ManualSessionInfoParams {
1107
+ userId: string;
1108
+ authToken: string;
1109
+ sessionHandler: SessionHandler;
1110
+ }
1111
+
968
1112
  /**
969
1113
  * @description
970
1114
  * - single: The message is standalone (not grouped with adjacent messages).
@@ -976,6 +1120,14 @@ declare type MessageGroupType = 'single' | 'top' | 'bottom' | 'middle';
976
1120
 
977
1121
  export declare const MessageLogs: ({ actionbook, functionCalls, groundedness, agentMessageTemplates, onClickActionbook, onClickFunctionCall, onClickFunctionCallDetail, onClickGroundedness, onClickAgentMessageTemplate, bottomContent, renderCustomGroundednessIcon, style, }: Props_2) => JSX.Element;
978
1122
 
1123
+ declare interface MessageTemplateCache {
1124
+ set(key: string, value: string): void;
1125
+ get(key: string): string | null;
1126
+ setCachedToken(token: string): void;
1127
+ getCachedToken(): string | null;
1128
+ clear(): void;
1129
+ }
1130
+
979
1131
  /**
980
1132
  * Information containing the key and variables of the message template to be rendered in the message
981
1133
  * message.extended_message_payload.message_template
@@ -1051,33 +1203,66 @@ declare class MessengerDispatcher implements Dispatcher {
1051
1203
 
1052
1204
  export declare const messengerDispatcher: MessengerDispatcher;
1053
1205
 
1054
- declare interface MessengerSessionContextValue {
1055
- activeChannel?: {
1056
- url: string;
1057
- status: ConversationStatus;
1058
- };
1059
- refreshActiveChannel: () => Promise<string>;
1060
- createConversation: (params: ConversationCreateParams) => Promise<string>;
1061
- connectionError?: Error;
1062
- userSession: {
1063
- userId: string;
1064
- authToken: string;
1065
- };
1066
- aiAgentInfo: AIAgentInfo;
1067
- launcherInfo: LauncherInfo;
1068
- attachmentMode: AttachmentMode;
1206
+ declare interface MessengerSessionCache {
1207
+ getSettings(userId: string): MessengerSettingsData | null;
1208
+ setSettings(userId: string, value: MessengerSettingsData): void;
1209
+ getAnonUser(): AnonUserSessionData | null;
1210
+ setAnonUser(value: AnonUserSessionData): void;
1211
+ clear(userId: string): void;
1069
1212
  }
1070
1213
 
1071
- export declare interface MessengerSessionRef {
1072
- activeChannel?: {
1073
- url: string;
1074
- status: ConversationStatus;
1214
+ declare interface MessengerSessionContextValue extends AIAgentMessengerSessionContextValue {
1215
+ userSession: NonNullable<AIAgentMessengerSessionContextValue['userSession']>;
1216
+ aiAgentInfo: NonNullable<AIAgentMessengerSessionContextValue['aiAgentInfo']>;
1217
+ launcherInfo: NonNullable<AIAgentMessengerSessionContextValue['launcherInfo']>;
1218
+ }
1219
+
1220
+ export declare interface MessengerSessionRef extends AIAgentMessengerSessionRef {
1221
+ }
1222
+
1223
+ declare type MessengerSettingsData = { knownActiveChannelUrl: string };
1224
+
1225
+ declare interface MessengerSettingsResponse {
1226
+ active_channel: {
1227
+ channel_url: string;
1228
+ attachment_mode: 'always' | 'handed_off_only' | 'off';
1229
+ };
1230
+ bot: {
1231
+ bot_userid: string;
1232
+ reply_to_file: boolean;
1233
+ bot_profile_url: string;
1234
+ bot_nickname: string;
1235
+ special_notice: string;
1236
+ is_special_notice_enabled: boolean;
1237
+ show_handoff_button: boolean;
1238
+ };
1239
+ appearance: {
1240
+ selected_theme: 'light' | 'dark';
1241
+ themes: {
1242
+ light: {
1243
+ primary_color: string;
1244
+ bot_message_bg_color: string;
1245
+ primary_contrast_color: string;
1246
+ bot_message_bg_contrast_color: string;
1247
+ };
1248
+ dark: {
1249
+ primary_color: string;
1250
+ bot_message_bg_color: string;
1251
+ primary_contrast_color: string;
1252
+ bot_message_bg_contrast_color: string;
1253
+ };
1254
+ };
1255
+ };
1256
+ launcher: {
1257
+ image_type: LauncherImageType;
1258
+ image_url: string;
1259
+ auto_open: boolean;
1260
+ };
1261
+ auto_created_user?: {
1262
+ user_id: string;
1263
+ session_token: string;
1264
+ expire_at: number;
1075
1265
  };
1076
- chatSDK: AIAgentContextValue['chatSDK'];
1077
- deauthenticate: () => Promise<void>;
1078
- updateContext: (context: Record<string, string>) => Promise<ContextObject>;
1079
- patchContext: (context: Record<string, string>) => Promise<ContextObject>;
1080
- getContextObject: () => Promise<ContextObject>;
1081
1266
  }
1082
1267
 
1083
1268
  declare type OutgoingBaseMessageProps<T> = T & BaseMessageProps<{
@@ -1204,6 +1389,11 @@ export declare type PositionHorizontal = 'start' | 'end';
1204
1389
 
1205
1390
  export declare type PositionVertical = 'top' | 'bottom';
1206
1391
 
1392
+ /**
1393
+ * You can pass the resolve function to scrollPubSub, if you want to catch when the scroll is finished.
1394
+ * */
1395
+ declare type PromiseResolver = () => void;
1396
+
1207
1397
  declare type Props = {
1208
1398
  children: ReactNode;
1209
1399
  rootElement?: HTMLElement;
@@ -1260,6 +1450,26 @@ declare type Props_5 = PropsWithChildren<{
1260
1450
  onOpenConversationView?: (channelUrl: string, status: ConversationStatus) => void;
1261
1451
  }>;
1262
1452
 
1453
+ declare type PubSub<T> = {
1454
+ publish: (data: T) => void;
1455
+ subscribe: (subscriber: (data: T) => void) => () => void;
1456
+ };
1457
+
1458
+ declare type ScrollTopicUnion = {
1459
+ type: 'scrollToBottom';
1460
+ data?: {
1461
+ animated?: boolean;
1462
+ resolve?: PromiseResolver;
1463
+ };
1464
+ } | {
1465
+ type: 'scroll';
1466
+ data?: {
1467
+ top?: number;
1468
+ animated?: boolean;
1469
+ resolve?: PromiseResolver;
1470
+ };
1471
+ };
1472
+
1263
1473
  declare type StringSet = Record<keyof StringSetKey, string>;
1264
1474
 
1265
1475
  declare type StringSetKey = typeof _default.stringSet;
@@ -1341,11 +1551,30 @@ declare interface TypographyVariant {
1341
1551
  lineHeight?: number | string;
1342
1552
  }
1343
1553
 
1554
+ export declare const useConversationContext: {
1555
+ (): ConversationContextValue;
1556
+ displayName: string;
1557
+ };
1558
+
1559
+ export declare const useConversationListContext: {
1560
+ (): ConversationListContextValue;
1561
+ displayName: string;
1562
+ };
1563
+
1344
1564
  export declare const useLocalizationContext: {
1345
1565
  (): LocalizationContextValue;
1346
1566
  displayName: string;
1347
1567
  };
1348
1568
 
1569
+ declare function useMessageListScroll(behavior: 'smooth' | 'auto', deps?: DependencyList): {
1570
+ scrollRef: RefObject<HTMLDivElement | null>;
1571
+ scrollPubSub: PubSub<ScrollTopicUnion>;
1572
+ isScrollBottomReached: boolean;
1573
+ setIsScrollBottomReached: Dispatch<SetStateAction<boolean>>;
1574
+ scrollDistanceFromBottomRef: RefObject<number>;
1575
+ scrollPositionRef: RefObject<number>;
1576
+ };
1577
+
1349
1578
  export declare const useMessengerContext: {
1350
1579
  (): MessengerContextValue;
1351
1580
  displayName: string;
@@ -1356,6 +1585,14 @@ export declare const useMessengerSessionContext: {
1356
1585
  displayName: string;
1357
1586
  };
1358
1587
 
1588
+ declare type UserSession = {
1589
+ userId: string;
1590
+ authToken: string;
1591
+ };
1592
+
1593
+ /**
1594
+ * @deprecated Please use `ManualSessionInfo` or `AnonymousSessionInfo` instead.
1595
+ * */
1359
1596
  declare interface UserSessionInfo {
1360
1597
  userId: string;
1361
1598
  authToken: string;
package/dist/index.js CHANGED
@@ -1,26 +1,33 @@
1
- import { b as o, d as t, q as n, i, C as r, k as g, l as L, n as u, j as C, o as m, D as M, F as v, h as y, g as d, p as c, M as p, O as x, S as h, m as l, f as A, u as S, e as f } from "./es/xCNV_S78.js";
1
+ import { b as o, d as n, y as t, i, C as r, k as C, n as g, o as u, l as v, q as L, s as x, t as m, j as y, r as M, D as d, F as S, h as f, g as l, w as p, x as I, M as c, O as A, S as P, m as h, p as D, v as F, f as O, u as T, e as b } from "./es/3qBdtnlJ.js";
2
2
  import "react";
3
3
  export {
4
4
  o as AgentProviderContainer,
5
- t as AgentUIProviderContainer,
6
- n as AttachmentMode,
5
+ n as AgentUIProviderContainer,
6
+ t as AnonymousSessionInfo,
7
7
  i as CSATType,
8
8
  r as Commands,
9
- g as Conversation,
10
- L as ConversationLayout,
11
- u as ConversationList,
12
- C as ConversationListItemLayout,
13
- m as ConversationListLayout,
14
- M as DefaultMessenger,
15
- v as FixedMessenger,
16
- y as IncomingMessageLayout,
17
- d as LauncherBase,
18
- c as LogLevel,
19
- p as MessageLogs,
20
- x as OutgoingMessageLayout,
21
- h as SystemMessageLayout,
22
- l as messengerDispatcher,
23
- A as useLocalizationContext,
24
- S as useMessengerContext,
25
- f as useMessengerSessionContext
9
+ C as Conversation,
10
+ g as ConversationContext,
11
+ u as ConversationContextProvider,
12
+ v as ConversationLayout,
13
+ L as ConversationList,
14
+ x as ConversationListContext,
15
+ m as ConversationListContextProvider,
16
+ y as ConversationListItemLayout,
17
+ M as ConversationListLayout,
18
+ d as DefaultMessenger,
19
+ S as FixedMessenger,
20
+ f as IncomingMessageLayout,
21
+ l as LauncherBase,
22
+ p as LogLevel,
23
+ I as ManualSessionInfo,
24
+ c as MessageLogs,
25
+ A as OutgoingMessageLayout,
26
+ P as SystemMessageLayout,
27
+ h as messengerDispatcher,
28
+ D as useConversationContext,
29
+ F as useConversationListContext,
30
+ O as useLocalizationContext,
31
+ T as useMessengerContext,
32
+ b as useMessengerSessionContext
26
33
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendbird/ai-agent-messenger-react",
3
- "version": "1.2.6",
3
+ "version": "1.3.0",
4
4
  "description": "Sendbird AI Agent Messenger for React",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -45,7 +45,7 @@
45
45
  "react-dom": "^19.0.0",
46
46
  "strip-json-comments": "^5.0.1",
47
47
  "styled-components": "^6.1.15",
48
- "@sendbird/ai-agent-core": "1.2.6",
48
+ "@sendbird/ai-agent-core": "1.3.0",
49
49
  "@sendbird/vite-tools": "0.0.1"
50
50
  },
51
51
  "msw": {