@sendbird/ai-agent-messenger-react 1.2.7 → 1.3.1
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/cjs/{BZQfpGF3.cjs → BCIx4Qv_.cjs} +1 -1
- package/dist/cjs/{GZl6LE-p.cjs → Cb__vcY_.cjs} +1 -1
- package/dist/cjs/ChFlUdD0.cjs +207 -0
- package/dist/cjs/{D8KSxdhT.cjs → CrVpYSzZ.cjs} +1 -1
- package/dist/cjs/{MsdK6ffU.cjs → DyfwCarh.cjs} +1 -1
- package/dist/cjs/{6Ljq47GZ.cjs → pxYCwAlg.cjs} +1 -1
- package/dist/es/{BV3rSe2G.js → BuMtQ0m7.js} +1 -1
- package/dist/es/{BKhgSuql.js → CKTGU2qP.js} +1 -1
- package/dist/es/{7464aa--.js → CV59hwzK.js} +1 -1
- package/dist/es/{D4Vk_6v3.js → CwdCJ7xG.js} +1 -1
- package/dist/es/D43pgxiz.js +4103 -0
- package/dist/es/{BUIIulLp.js → DOAkPSN5.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +301 -34
- package/dist/index.js +27 -20
- package/package.json +4 -4
- package/dist/cjs/DdCvhwdF.cjs +0 -207
- package/dist/es/BaBU5Xlk.js +0 -4163
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./cjs/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./cjs/ChFlUdD0.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.
|
|
@@ -150,6 +161,11 @@ countryCode?: string;
|
|
|
150
161
|
* */
|
|
151
162
|
context?: Record<string, string>;
|
|
152
163
|
/**
|
|
164
|
+
* @public
|
|
165
|
+
* @description AIAgent global default query parameters.
|
|
166
|
+
* */
|
|
167
|
+
queryParams?: AIAgentQueryParams;
|
|
168
|
+
/**
|
|
153
169
|
* @internal
|
|
154
170
|
* @description Preview configurations for the ai agent client.
|
|
155
171
|
* */
|
|
@@ -196,6 +212,11 @@ children?: ReactNode | undefined;
|
|
|
196
212
|
|
|
197
213
|
export declare function AgentUIProviderContainer({ appearance, rootElement, logger, language, stringSet, children, messageTemplate, theme, }: Props): JSX.Element;
|
|
198
214
|
|
|
215
|
+
declare interface AIAgentCache {
|
|
216
|
+
template: MessageTemplateCache;
|
|
217
|
+
messenger: MessengerSessionCache;
|
|
218
|
+
}
|
|
219
|
+
|
|
199
220
|
declare interface AIAgentContextValue {
|
|
200
221
|
appId: string;
|
|
201
222
|
aiAgentId: string;
|
|
@@ -207,6 +228,38 @@ declare interface AIAgentContextValue {
|
|
|
207
228
|
|
|
208
229
|
logger: Loggable;
|
|
209
230
|
dispatcher: Dispatcher;
|
|
231
|
+
|
|
232
|
+
cache: AIAgentCache;
|
|
233
|
+
|
|
234
|
+
queryParams?: AIAgentQueryParams;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
declare interface AIAgentConversationContextValue {
|
|
238
|
+
conversation: Conversation_2 | undefined;
|
|
239
|
+
|
|
240
|
+
channelSource: {
|
|
241
|
+
channel: GroupChannel | undefined;
|
|
242
|
+
error: SendbirdError | undefined;
|
|
243
|
+
refetch: () => Promise<void>;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
messageSource: {
|
|
247
|
+
messages: BaseMessage[];
|
|
248
|
+
initialized: boolean;
|
|
249
|
+
loadPrevious: () => Promise<void>;
|
|
250
|
+
loadNext: () => Promise<void>;
|
|
251
|
+
sendUserMessage: (params: UserMessageCreateParams) => Promise<UserMessage>;
|
|
252
|
+
sendFileMessage: (params: FileMessageCreateParams) => Promise<FileMessage>;
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
declare interface AIAgentConversationListContextValue {
|
|
257
|
+
listSource: {
|
|
258
|
+
initialized: boolean;
|
|
259
|
+
error: SendbirdError | undefined;
|
|
260
|
+
channels: GroupChannel[];
|
|
261
|
+
loadMore: () => Promise<void>;
|
|
262
|
+
};
|
|
210
263
|
}
|
|
211
264
|
|
|
212
265
|
declare interface AIAgentGroupChannelFilter {
|
|
@@ -247,6 +300,36 @@ declare interface AIAgentInfo {
|
|
|
247
300
|
specialNoticeEnabled: boolean;
|
|
248
301
|
}
|
|
249
302
|
|
|
303
|
+
declare interface AIAgentMessengerSessionContextValue {
|
|
304
|
+
userSessionInfo?: UserSessionInfo | ManualSessionInfo | AnonymousSessionInfo;
|
|
305
|
+
|
|
306
|
+
userSession: null | UserSession;
|
|
307
|
+
aiAgentInfo: null | AIAgentInfo;
|
|
308
|
+
launcherInfo: null | LauncherInfo;
|
|
309
|
+
attachmentMode: AttachmentMode;
|
|
310
|
+
|
|
311
|
+
connectionError?: Error;
|
|
312
|
+
|
|
313
|
+
activeChannel?: { url: string; status: ConversationStatus };
|
|
314
|
+
setActiveChannel: (param: { url: string; status: ConversationStatus }) => void;
|
|
315
|
+
|
|
316
|
+
createConversation: (params: ConversationCreateParams) => Promise<string>;
|
|
317
|
+
refreshActiveChannel: () => Promise<string>;
|
|
318
|
+
|
|
319
|
+
authenticate: () => Promise<MessengerSettingsResponse>;
|
|
320
|
+
deauthenticate: () => Promise<void>;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
declare interface AIAgentMessengerSessionRef {
|
|
324
|
+
activeChannel?: { url: string; status: ConversationStatus };
|
|
325
|
+
chatSDK: AIAgentContextValue['chatSDK'];
|
|
326
|
+
authenticate: () => Promise<MessengerSettingsResponse>;
|
|
327
|
+
deauthenticate: () => Promise<void>;
|
|
328
|
+
updateContext: (context: Record<string, string>) => Promise<ContextObject>;
|
|
329
|
+
patchContext: (context: Record<string, string>) => Promise<ContextObject>;
|
|
330
|
+
getContextObject: () => Promise<ContextObject>;
|
|
331
|
+
}
|
|
332
|
+
|
|
250
333
|
export declare type AIAgentProps = PropsWithChildren<{
|
|
251
334
|
appId: string;
|
|
252
335
|
aiAgentId: string;
|
|
@@ -284,7 +367,7 @@ export declare type AIAgentProps = PropsWithChildren<{
|
|
|
284
367
|
* @public
|
|
285
368
|
* @description Custom User session information to be used in connecting to the agent.
|
|
286
369
|
* */
|
|
287
|
-
userSessionInfo?: UserSessionInfo;
|
|
370
|
+
userSessionInfo?: ManualSessionInfo | AnonymousSessionInfo | UserSessionInfo;
|
|
288
371
|
/**
|
|
289
372
|
* @public
|
|
290
373
|
* @description Localization string set for the ai agent client.
|
|
@@ -317,6 +400,11 @@ export declare type AIAgentProps = PropsWithChildren<{
|
|
|
317
400
|
* @description Context object for the AI agent client. This is injected when the messenger is first loaded and can provide additional context that may influence how the AI responds to user conversations.
|
|
318
401
|
* */
|
|
319
402
|
context?: Record<string, string>;
|
|
403
|
+
/**
|
|
404
|
+
* @public
|
|
405
|
+
* @description AIAgent global default query parameters.
|
|
406
|
+
* */
|
|
407
|
+
queryParams?: AIAgentQueryParams;
|
|
320
408
|
/**
|
|
321
409
|
* @internal
|
|
322
410
|
* @description Preview configurations for the ai agent client.
|
|
@@ -360,10 +448,22 @@ export declare type AIAgentProps = PropsWithChildren<{
|
|
|
360
448
|
};
|
|
361
449
|
}>;
|
|
362
450
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
451
|
+
declare interface AIAgentQueryParams {
|
|
452
|
+
conversationListParams?: ConversationListCollectionParams;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
declare type AnonUserSessionData = { userId: string; authToken: string; expireAt: number };
|
|
456
|
+
|
|
457
|
+
export declare class AnonymousSessionInfo {
|
|
458
|
+
userId?: never;
|
|
459
|
+
authToken?: never;
|
|
460
|
+
sessionHandler?: never;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
declare enum AttachmentMode {
|
|
464
|
+
OFF = 'off',
|
|
465
|
+
ALWAYS = 'always',
|
|
466
|
+
HANDED_OFF_ONLY = 'handed_off_only',
|
|
367
467
|
}
|
|
368
468
|
|
|
369
469
|
declare abstract class BaseCommand {
|
|
@@ -427,6 +527,22 @@ declare interface ContextObject {
|
|
|
427
527
|
|
|
428
528
|
export declare const Conversation: ({ children, onNavigateToConversationList, closedChannelUrl, onClearClosedChannelUrl, }: Props_4) => JSX.Element;
|
|
429
529
|
|
|
530
|
+
export declare const ConversationContext: Context<ConversationContextValue | null>;
|
|
531
|
+
|
|
532
|
+
declare interface ConversationContextProps {
|
|
533
|
+
onNavigateToConversationList?: () => void;
|
|
534
|
+
closedChannelUrl?: string;
|
|
535
|
+
onClearClosedChannelUrl?: () => void;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
export declare const ConversationContextProvider: ({ closedChannelUrl, onClearClosedChannelUrl, onNavigateToConversationList, children, }: PropsWithChildren<ConversationContextProps>) => JSX.Element;
|
|
539
|
+
|
|
540
|
+
declare interface ConversationContextValue extends AIAgentConversationContextValue {
|
|
541
|
+
scrollSource: ReturnType<typeof useMessageListScroll>;
|
|
542
|
+
goToActiveConversation: () => Promise<void>;
|
|
543
|
+
onNavigateToConversationList?: () => void;
|
|
544
|
+
}
|
|
545
|
+
|
|
430
546
|
declare interface ConversationCreateParams {
|
|
431
547
|
aiAgentId: string;
|
|
432
548
|
language?: string;
|
|
@@ -470,7 +586,31 @@ export declare const ConversationLayout: {
|
|
|
470
586
|
}) => null;
|
|
471
587
|
};
|
|
472
588
|
|
|
473
|
-
export declare const ConversationList: ({ conversationListFilter, children, onOpenConversationView }: Props_5) => JSX.Element;
|
|
589
|
+
export declare const ConversationList: ({ conversationListLimit, conversationListFilter, children, onOpenConversationView, }: Props_5) => JSX.Element;
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* Parameters for creating a ConversationListCollection instance.
|
|
593
|
+
*/
|
|
594
|
+
declare interface ConversationListCollectionParams {
|
|
595
|
+
/** Filter options for AI agent group channels */
|
|
596
|
+
filter?: AIAgentGroupChannelFilter;
|
|
597
|
+
/** Maximum number of channels to load per request (default: 20) */
|
|
598
|
+
limit?: number;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
export declare const ConversationListContext: Context<ConversationListContextValue | null>;
|
|
602
|
+
|
|
603
|
+
declare interface ConversationListContextProps {
|
|
604
|
+
conversationListLimit?: number;
|
|
605
|
+
conversationListFilter?: Partial<AIAgentGroupChannelFilter>;
|
|
606
|
+
onOpenConversationView?: (channelUrl: string, status: ConversationStatus) => void;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
export declare function ConversationListContextProvider({ conversationListLimit, conversationListFilter, onOpenConversationView, children, }: PropsWithChildren<ConversationListContextProps>): JSX.Element;
|
|
610
|
+
|
|
611
|
+
declare interface ConversationListContextValue extends AIAgentConversationListContextValue {
|
|
612
|
+
onOpenConversationView: (channelUrl: string, status: ConversationStatus) => void;
|
|
613
|
+
}
|
|
474
614
|
|
|
475
615
|
export declare const ConversationListItemLayout: {
|
|
476
616
|
(props: PropsWithChildren): ReactNode;
|
|
@@ -543,6 +683,18 @@ export declare enum CSATType {
|
|
|
543
683
|
HELPDESK_CSAT_5 = "HELPDESK_CSAT_5"
|
|
544
684
|
}
|
|
545
685
|
|
|
686
|
+
declare type CustomEvent_2 = {
|
|
687
|
+
type: 'message-sent-pending' | 'message-sent-succeeded';
|
|
688
|
+
data: {
|
|
689
|
+
message: BaseMessage;
|
|
690
|
+
};
|
|
691
|
+
} | {
|
|
692
|
+
type: 'bot-message-received';
|
|
693
|
+
data: {
|
|
694
|
+
message: BaseMessage;
|
|
695
|
+
};
|
|
696
|
+
};
|
|
697
|
+
|
|
546
698
|
declare const _default: {
|
|
547
699
|
language: string;
|
|
548
700
|
dateLocale: Locale;
|
|
@@ -609,13 +761,14 @@ theme?: {
|
|
|
609
761
|
palette?: Partial<PaletteShape>;
|
|
610
762
|
typography?: Partial<{ [K in keyof TypographyShape]: Partial<TypographyShape[K]>; }>;
|
|
611
763
|
};
|
|
612
|
-
userSessionInfo?: UserSessionInfo;
|
|
764
|
+
userSessionInfo?: ManualSessionInfo | AnonymousSessionInfo | UserSessionInfo;
|
|
613
765
|
stringSet?: Partial<StringSet>;
|
|
614
766
|
dir?: "ltr" | "rtl";
|
|
615
767
|
logLevel?: LogLevel_2;
|
|
616
768
|
language?: string;
|
|
617
769
|
countryCode?: string;
|
|
618
770
|
context?: Record<string, string>;
|
|
771
|
+
queryParams?: AIAgentQueryParams;
|
|
619
772
|
agentPreviewConfigs?: AgentPreviewConfigs;
|
|
620
773
|
handlers?: AgentClientHandlers;
|
|
621
774
|
enableCloseConversationButton?: boolean;
|
|
@@ -695,13 +848,14 @@ theme?: {
|
|
|
695
848
|
palette?: Partial<PaletteShape>;
|
|
696
849
|
typography?: Partial<{ [K in keyof TypographyShape]: Partial<TypographyShape[K]>; }>;
|
|
697
850
|
};
|
|
698
|
-
userSessionInfo?: UserSessionInfo;
|
|
851
|
+
userSessionInfo?: ManualSessionInfo | AnonymousSessionInfo | UserSessionInfo;
|
|
699
852
|
stringSet?: Partial<StringSet>;
|
|
700
853
|
dir?: "ltr" | "rtl";
|
|
701
854
|
logLevel?: LogLevel_2;
|
|
702
855
|
language?: string;
|
|
703
856
|
countryCode?: string;
|
|
704
857
|
context?: Record<string, string>;
|
|
858
|
+
queryParams?: AIAgentQueryParams;
|
|
705
859
|
agentPreviewConfigs?: AgentPreviewConfigs;
|
|
706
860
|
handlers?: AgentClientHandlers;
|
|
707
861
|
enableCloseConversationButton?: boolean;
|
|
@@ -779,6 +933,7 @@ declare type IncomingBaseMessageProps<T> = T & BaseMessageProps<{
|
|
|
779
933
|
suggestedRepliesDirection?: 'vertical' | 'horizontal';
|
|
780
934
|
isBotMessage?: boolean;
|
|
781
935
|
isTyping?: boolean;
|
|
936
|
+
isStreaming?: boolean;
|
|
782
937
|
onGetCachedMessageTemplate?: (templateKey: string) => string | null;
|
|
783
938
|
onRequestMessageTemplate?: (templateKey: string) => Promise<string>;
|
|
784
939
|
onHandleTemplateInternalAction?: (action: Action) => void;
|
|
@@ -965,6 +1120,24 @@ export declare enum LogLevel {
|
|
|
965
1120
|
NONE,
|
|
966
1121
|
}
|
|
967
1122
|
|
|
1123
|
+
export declare class ManualSessionInfo {
|
|
1124
|
+
userId: string;
|
|
1125
|
+
authToken: string;
|
|
1126
|
+
sessionHandler: SessionHandler;
|
|
1127
|
+
|
|
1128
|
+
constructor({ userId, authToken, sessionHandler }: ManualSessionInfoParams) {
|
|
1129
|
+
this.userId = userId;
|
|
1130
|
+
this.authToken = authToken;
|
|
1131
|
+
this.sessionHandler = sessionHandler;
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
declare interface ManualSessionInfoParams {
|
|
1136
|
+
userId: string;
|
|
1137
|
+
authToken: string;
|
|
1138
|
+
sessionHandler: SessionHandler;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
968
1141
|
/**
|
|
969
1142
|
* @description
|
|
970
1143
|
* - single: The message is standalone (not grouped with adjacent messages).
|
|
@@ -976,6 +1149,14 @@ declare type MessageGroupType = 'single' | 'top' | 'bottom' | 'middle';
|
|
|
976
1149
|
|
|
977
1150
|
export declare const MessageLogs: ({ actionbook, functionCalls, groundedness, agentMessageTemplates, onClickActionbook, onClickFunctionCall, onClickFunctionCallDetail, onClickGroundedness, onClickAgentMessageTemplate, bottomContent, renderCustomGroundednessIcon, style, }: Props_2) => JSX.Element;
|
|
978
1151
|
|
|
1152
|
+
declare interface MessageTemplateCache {
|
|
1153
|
+
set(key: string, value: string): void;
|
|
1154
|
+
get(key: string): string | null;
|
|
1155
|
+
setCachedToken(token: string): void;
|
|
1156
|
+
getCachedToken(): string | null;
|
|
1157
|
+
clear(): void;
|
|
1158
|
+
}
|
|
1159
|
+
|
|
979
1160
|
/**
|
|
980
1161
|
* Information containing the key and variables of the message template to be rendered in the message
|
|
981
1162
|
* message.extended_message_payload.message_template
|
|
@@ -1051,33 +1232,66 @@ declare class MessengerDispatcher implements Dispatcher {
|
|
|
1051
1232
|
|
|
1052
1233
|
export declare const messengerDispatcher: MessengerDispatcher;
|
|
1053
1234
|
|
|
1054
|
-
declare interface
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
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;
|
|
1235
|
+
declare interface MessengerSessionCache {
|
|
1236
|
+
getSettings(userId: string): MessengerSettingsData | null;
|
|
1237
|
+
setSettings(userId: string, value: MessengerSettingsData): void;
|
|
1238
|
+
getAnonUser(): AnonUserSessionData | null;
|
|
1239
|
+
setAnonUser(value: AnonUserSessionData): void;
|
|
1240
|
+
clear(userId: string): void;
|
|
1069
1241
|
}
|
|
1070
1242
|
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1243
|
+
declare interface MessengerSessionContextValue extends AIAgentMessengerSessionContextValue {
|
|
1244
|
+
userSession: NonNullable<AIAgentMessengerSessionContextValue['userSession']>;
|
|
1245
|
+
aiAgentInfo: NonNullable<AIAgentMessengerSessionContextValue['aiAgentInfo']>;
|
|
1246
|
+
launcherInfo: NonNullable<AIAgentMessengerSessionContextValue['launcherInfo']>;
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
export declare interface MessengerSessionRef extends AIAgentMessengerSessionRef {
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
declare type MessengerSettingsData = { knownActiveChannelUrl: string };
|
|
1253
|
+
|
|
1254
|
+
declare interface MessengerSettingsResponse {
|
|
1255
|
+
active_channel: {
|
|
1256
|
+
channel_url: string;
|
|
1257
|
+
attachment_mode: 'always' | 'handed_off_only' | 'off';
|
|
1258
|
+
};
|
|
1259
|
+
bot: {
|
|
1260
|
+
bot_userid: string;
|
|
1261
|
+
reply_to_file: boolean;
|
|
1262
|
+
bot_profile_url: string;
|
|
1263
|
+
bot_nickname: string;
|
|
1264
|
+
special_notice: string;
|
|
1265
|
+
is_special_notice_enabled: boolean;
|
|
1266
|
+
show_handoff_button: boolean;
|
|
1267
|
+
};
|
|
1268
|
+
appearance: {
|
|
1269
|
+
selected_theme: 'light' | 'dark';
|
|
1270
|
+
themes: {
|
|
1271
|
+
light: {
|
|
1272
|
+
primary_color: string;
|
|
1273
|
+
bot_message_bg_color: string;
|
|
1274
|
+
primary_contrast_color: string;
|
|
1275
|
+
bot_message_bg_contrast_color: string;
|
|
1276
|
+
};
|
|
1277
|
+
dark: {
|
|
1278
|
+
primary_color: string;
|
|
1279
|
+
bot_message_bg_color: string;
|
|
1280
|
+
primary_contrast_color: string;
|
|
1281
|
+
bot_message_bg_contrast_color: string;
|
|
1282
|
+
};
|
|
1283
|
+
};
|
|
1284
|
+
};
|
|
1285
|
+
launcher: {
|
|
1286
|
+
image_type: LauncherImageType;
|
|
1287
|
+
image_url: string;
|
|
1288
|
+
auto_open: boolean;
|
|
1289
|
+
};
|
|
1290
|
+
auto_created_user?: {
|
|
1291
|
+
user_id: string;
|
|
1292
|
+
session_token: string;
|
|
1293
|
+
expire_at: number;
|
|
1075
1294
|
};
|
|
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
1295
|
}
|
|
1082
1296
|
|
|
1083
1297
|
declare type OutgoingBaseMessageProps<T> = T & BaseMessageProps<{
|
|
@@ -1204,6 +1418,11 @@ export declare type PositionHorizontal = 'start' | 'end';
|
|
|
1204
1418
|
|
|
1205
1419
|
export declare type PositionVertical = 'top' | 'bottom';
|
|
1206
1420
|
|
|
1421
|
+
/**
|
|
1422
|
+
* You can pass the resolve function to scrollPubSub, if you want to catch when the scroll is finished.
|
|
1423
|
+
* */
|
|
1424
|
+
declare type PromiseResolver = () => void;
|
|
1425
|
+
|
|
1207
1426
|
declare type Props = {
|
|
1208
1427
|
children: ReactNode;
|
|
1209
1428
|
rootElement?: HTMLElement;
|
|
@@ -1256,10 +1475,31 @@ declare type Props_4 = PropsWithChildren<{
|
|
|
1256
1475
|
}>;
|
|
1257
1476
|
|
|
1258
1477
|
declare type Props_5 = PropsWithChildren<{
|
|
1478
|
+
conversationListLimit?: number;
|
|
1259
1479
|
conversationListFilter?: Partial<AIAgentGroupChannelFilter>;
|
|
1260
1480
|
onOpenConversationView?: (channelUrl: string, status: ConversationStatus) => void;
|
|
1261
1481
|
}>;
|
|
1262
1482
|
|
|
1483
|
+
declare type PubSub<T> = {
|
|
1484
|
+
publish: (data: T) => void;
|
|
1485
|
+
subscribe: (subscriber: (data: T) => void) => () => void;
|
|
1486
|
+
};
|
|
1487
|
+
|
|
1488
|
+
declare type ScrollTopicUnion = {
|
|
1489
|
+
type: 'scrollToBottom';
|
|
1490
|
+
data?: {
|
|
1491
|
+
animated?: boolean;
|
|
1492
|
+
resolve?: PromiseResolver;
|
|
1493
|
+
};
|
|
1494
|
+
} | {
|
|
1495
|
+
type: 'scroll';
|
|
1496
|
+
data?: {
|
|
1497
|
+
top?: number;
|
|
1498
|
+
animated?: boolean;
|
|
1499
|
+
resolve?: PromiseResolver;
|
|
1500
|
+
};
|
|
1501
|
+
};
|
|
1502
|
+
|
|
1263
1503
|
declare type StringSet = Record<keyof StringSetKey, string>;
|
|
1264
1504
|
|
|
1265
1505
|
declare type StringSetKey = typeof _default.stringSet;
|
|
@@ -1341,11 +1581,30 @@ declare interface TypographyVariant {
|
|
|
1341
1581
|
lineHeight?: number | string;
|
|
1342
1582
|
}
|
|
1343
1583
|
|
|
1584
|
+
export declare const useConversationContext: {
|
|
1585
|
+
(): ConversationContextValue;
|
|
1586
|
+
displayName: string;
|
|
1587
|
+
};
|
|
1588
|
+
|
|
1589
|
+
export declare const useConversationListContext: {
|
|
1590
|
+
(): ConversationListContextValue;
|
|
1591
|
+
displayName: string;
|
|
1592
|
+
};
|
|
1593
|
+
|
|
1344
1594
|
export declare const useLocalizationContext: {
|
|
1345
1595
|
(): LocalizationContextValue;
|
|
1346
1596
|
displayName: string;
|
|
1347
1597
|
};
|
|
1348
1598
|
|
|
1599
|
+
declare function useMessageListScroll(behavior: 'smooth' | 'auto', deps?: DependencyList): {
|
|
1600
|
+
scrollRef: RefObject<HTMLDivElement | null>;
|
|
1601
|
+
scrollPubSub: PubSub<ScrollTopicUnion>;
|
|
1602
|
+
isScrollBottomReached: boolean;
|
|
1603
|
+
setIsScrollBottomReached: Dispatch<SetStateAction<boolean>>;
|
|
1604
|
+
scrollDistanceFromBottomRef: RefObject<number>;
|
|
1605
|
+
scrollPositionRef: RefObject<number>;
|
|
1606
|
+
};
|
|
1607
|
+
|
|
1349
1608
|
export declare const useMessengerContext: {
|
|
1350
1609
|
(): MessengerContextValue;
|
|
1351
1610
|
displayName: string;
|
|
@@ -1356,6 +1615,14 @@ export declare const useMessengerSessionContext: {
|
|
|
1356
1615
|
displayName: string;
|
|
1357
1616
|
};
|
|
1358
1617
|
|
|
1618
|
+
declare type UserSession = {
|
|
1619
|
+
userId: string;
|
|
1620
|
+
authToken: string;
|
|
1621
|
+
};
|
|
1622
|
+
|
|
1623
|
+
/**
|
|
1624
|
+
* @deprecated Please use `ManualSessionInfo` or `AnonymousSessionInfo` instead.
|
|
1625
|
+
* */
|
|
1359
1626
|
declare interface UserSessionInfo {
|
|
1360
1627
|
userId: string;
|
|
1361
1628
|
authToken: string;
|
package/dist/index.js
CHANGED
|
@@ -1,26 +1,33 @@
|
|
|
1
|
-
import { b as o, d as
|
|
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/D43pgxiz.js";
|
|
2
2
|
import "react";
|
|
3
3
|
export {
|
|
4
4
|
o as AgentProviderContainer,
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
n as AgentUIProviderContainer,
|
|
6
|
+
t as AnonymousSessionInfo,
|
|
7
7
|
i as CSATType,
|
|
8
8
|
r as Commands,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
u as
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
y as
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Sendbird AI Agent Messenger for React",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
"styled-components": ">=5.0.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@monaco-editor/react": "^4.7.0",
|
|
39
38
|
"@sendbird/chat": "^4.19.5",
|
|
40
39
|
"@types/react": "^19.0.2",
|
|
41
40
|
"@types/react-dom": "^19.0.2",
|
|
@@ -45,8 +44,9 @@
|
|
|
45
44
|
"react-dom": "^19.0.0",
|
|
46
45
|
"strip-json-comments": "^5.0.1",
|
|
47
46
|
"styled-components": "^6.1.15",
|
|
48
|
-
"@sendbird/ai-agent-core": "1.
|
|
49
|
-
"@sendbird/vite-tools": "0.0.1"
|
|
47
|
+
"@sendbird/ai-agent-core": "1.3.1",
|
|
48
|
+
"@sendbird/vite-tools": "0.0.1",
|
|
49
|
+
"@sendbird/config-editor": "0.1.0"
|
|
50
50
|
},
|
|
51
51
|
"msw": {
|
|
52
52
|
"workerDirectory": [
|