@sendbird/ai-agent-messenger-react 1.0.0-rc.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/LICENSE +35 -0
- package/README.md +34 -0
- package/dist/cjs/7sOpksia.cjs +1 -0
- package/dist/cjs/8n-lNFQi.cjs +1 -0
- package/dist/cjs/B-7iTaEa.cjs +1 -0
- package/dist/cjs/B3UTkiZj.cjs +1 -0
- package/dist/cjs/B93o4u0P.cjs +1 -0
- package/dist/cjs/BA7eP_0y.cjs +1 -0
- package/dist/cjs/BCgKHuFY.cjs +1 -0
- package/dist/cjs/BE_UkM2D.cjs +1 -0
- package/dist/cjs/BIQTp46D.cjs +1 -0
- package/dist/cjs/BdOKSPN6.cjs +1 -0
- package/dist/cjs/Bgi113yh.cjs +1 -0
- package/dist/cjs/Bj4NR2YK.cjs +1 -0
- package/dist/cjs/BlL9mJ1G.cjs +1 -0
- package/dist/cjs/BqEtwmXd.cjs +1 -0
- package/dist/cjs/Bt7i9B_X.cjs +1 -0
- package/dist/cjs/BvIqSXsB.cjs +1 -0
- package/dist/cjs/C1Vn3mTH.cjs +1 -0
- package/dist/cjs/CCMVMvEA.cjs +1 -0
- package/dist/cjs/CCeC8Z_c.cjs +1 -0
- package/dist/cjs/CI0UG_vg.cjs +1 -0
- package/dist/cjs/CIgdwS62.cjs +1 -0
- package/dist/cjs/CKKH64uB.cjs +1 -0
- package/dist/cjs/CMUqnGWo.cjs +1 -0
- package/dist/cjs/CYWHwsSv.cjs +1 -0
- package/dist/cjs/CYokBh9g.cjs +1 -0
- package/dist/cjs/CbUzmxPM.cjs +1 -0
- package/dist/cjs/Ck7-iOpx.cjs +1 -0
- package/dist/cjs/Co3cu15V.cjs +1 -0
- package/dist/cjs/Coz01rE5.cjs +1 -0
- package/dist/cjs/CrKG9A2m.cjs +1 -0
- package/dist/cjs/CsHNpYuX.cjs +1 -0
- package/dist/cjs/CtPGsbRN.cjs +1 -0
- package/dist/cjs/CxYRI5sv.cjs +1 -0
- package/dist/cjs/CyJk4evk.cjs +1 -0
- package/dist/cjs/D-9eFzYR.cjs +1 -0
- package/dist/cjs/D2OIGiV4.cjs +1 -0
- package/dist/cjs/D4zXKBh-.cjs +1 -0
- package/dist/cjs/DMo1MF5p.cjs +1 -0
- package/dist/cjs/DRna04x8.cjs +1 -0
- package/dist/cjs/DkhICmYA.cjs +1 -0
- package/dist/cjs/DowWpnG0.cjs +1 -0
- package/dist/cjs/DxL6Qc1e.cjs +1 -0
- package/dist/cjs/FdyX1U8o.cjs +1 -0
- package/dist/cjs/VJQajGKm.cjs +1 -0
- package/dist/cjs/VvpIczL4.cjs +1 -0
- package/dist/cjs/WCwJJYUZ.cjs +1 -0
- package/dist/cjs/dtQmhQL-.cjs +1 -0
- package/dist/cjs/jey3pckv.cjs +140 -0
- package/dist/cjs/na-hjKnS.cjs +1 -0
- package/dist/cjs/u4HvlMWl.cjs +1 -0
- package/dist/es/B2CtcWp3.js +5 -0
- package/dist/es/B6fvrWGq.js +5 -0
- package/dist/es/B6xd54zt.js +5 -0
- package/dist/es/B8c_rqvH.js +56 -0
- package/dist/es/B9V0T5ZP.js +56 -0
- package/dist/es/BAJ6LEKc.js +5 -0
- package/dist/es/BAr50pfO.js +5 -0
- package/dist/es/BFcXPuf5.js +5 -0
- package/dist/es/BLrqIqwk.js +6 -0
- package/dist/es/BOnlh2zd.js +5 -0
- package/dist/es/BQWJPfGp.js +56 -0
- package/dist/es/BSz49qaD.js +56 -0
- package/dist/es/BUYabNz7.js +5 -0
- package/dist/es/BcUGcaq2.js +5 -0
- package/dist/es/BgGVGNdg.js +5 -0
- package/dist/es/BnZcRFmS.js +5 -0
- package/dist/es/BsimU71m.js +5 -0
- package/dist/es/BuKsDakz.js +3304 -0
- package/dist/es/C0RFfifL.js +5 -0
- package/dist/es/CAIYsKDy.js +5 -0
- package/dist/es/CT2kv4lr.js +5 -0
- package/dist/es/Cc7XmLN1.js +5 -0
- package/dist/es/CrjNuryZ.js +5 -0
- package/dist/es/CuaBI7kd.js +5 -0
- package/dist/es/CvdSjw1c.js +5 -0
- package/dist/es/CvqfQEhO.js +5 -0
- package/dist/es/CxQFWLnW.js +5 -0
- package/dist/es/DAMSBm7t.js +6 -0
- package/dist/es/DH2PekOm.js +18 -0
- package/dist/es/DMruRpOm.js +5 -0
- package/dist/es/DP0MwObA.js +4 -0
- package/dist/es/DY2ULcTX.js +5 -0
- package/dist/es/DZJyDpNp.js +5 -0
- package/dist/es/D_eZyIAR.js +56 -0
- package/dist/es/D_q6g3Dd.js +5 -0
- package/dist/es/DcFCGVBm.js +5 -0
- package/dist/es/DfJKEre2.js +7 -0
- package/dist/es/DiXu6nm5.js +22 -0
- package/dist/es/DnKaqbmp.js +6 -0
- package/dist/es/DsGXnanX.js +5 -0
- package/dist/es/DvjrAXLD.js +56 -0
- package/dist/es/NmJl7zv3.js +5 -0
- package/dist/es/YRQ0vk5Q.js +56 -0
- package/dist/es/awO7aBCv.js +5 -0
- package/dist/es/dqwvRBog.js +5 -0
- package/dist/es/m2INcyV2.js +5 -0
- package/dist/es/nmdo2Fbj.js +5 -0
- package/dist/es/sl-YrKkN.js +56 -0
- package/dist/es/wBtIAuNm.js +5 -0
- package/dist/es/zI14HLvP.js +56 -0
- package/dist/index.cjs +1 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +837 -0
- package/dist/index.js +22 -0
- package/package.json +66 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,837 @@
|
|
|
1
|
+
import { AIAgentModule } from '@sendbird/chat/aiAgent';
|
|
2
|
+
import { ComponentType } from 'react';
|
|
3
|
+
import { Context } from 'react';
|
|
4
|
+
import { ConversationStatus } from '@sendbird/chat/aiAgent';
|
|
5
|
+
import { format } from 'date-fns';
|
|
6
|
+
import { GroupChannelModule } from '@sendbird/chat/groupChannel';
|
|
7
|
+
import { JSX } from 'react/jsx-runtime';
|
|
8
|
+
import { Locale } from 'date-fns';
|
|
9
|
+
import { LogLevel as LogLevel_2 } from '@sendbird/chat';
|
|
10
|
+
import { PropsWithChildren } from 'react';
|
|
11
|
+
import { ReactNode } from 'react';
|
|
12
|
+
import { SendbirdChatWith } from '@sendbird/chat';
|
|
13
|
+
import { SessionHandler } from '@sendbird/chat';
|
|
14
|
+
|
|
15
|
+
export declare interface ActionbookInfo {
|
|
16
|
+
key: string;
|
|
17
|
+
name: string;
|
|
18
|
+
step: string | null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export declare interface AgentClientHandlers {
|
|
22
|
+
onRegisterDeauthenticateHandler?: (deauthenticate: () => void) => void;
|
|
23
|
+
onMessageSend?: (message: string) => void;
|
|
24
|
+
onFunctionCallDetailClick?: (func: FunctionCallsInfo) => void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export declare interface AgentMessageTemplateInfo {
|
|
28
|
+
key: string;
|
|
29
|
+
message_template_key: 'text' | 'suggested_replies' | 'cta' | 'image' | 'carousel';
|
|
30
|
+
name: string;
|
|
31
|
+
request_context?: {
|
|
32
|
+
request: {
|
|
33
|
+
headers: Record<string, string>;
|
|
34
|
+
method: string;
|
|
35
|
+
query_params: Record<string, string>;
|
|
36
|
+
request_body: Record<string, string>;
|
|
37
|
+
url: string;
|
|
38
|
+
};
|
|
39
|
+
response?: {
|
|
40
|
+
content: string;
|
|
41
|
+
status: number;
|
|
42
|
+
};
|
|
43
|
+
error?: string;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export declare interface AgentPreviewConfigs {
|
|
48
|
+
welcomeMessages?: {
|
|
49
|
+
message: string;
|
|
50
|
+
suggestedReplies?: string[];
|
|
51
|
+
}[];
|
|
52
|
+
suggestedRepliesDirection?: 'horizontal' | 'vertical';
|
|
53
|
+
messageStackDirection?: 'top' | 'bottom';
|
|
54
|
+
appearance?: {
|
|
55
|
+
theme?: 'light' | 'dark';
|
|
56
|
+
primaryColor?: string;
|
|
57
|
+
botMessageBackgroundColor?: string;
|
|
58
|
+
};
|
|
59
|
+
bot?: {
|
|
60
|
+
profileUrl?: string;
|
|
61
|
+
nickname?: string;
|
|
62
|
+
specialNotice?: string;
|
|
63
|
+
specialNoticeEnabled?: boolean;
|
|
64
|
+
};
|
|
65
|
+
launcher?: {
|
|
66
|
+
type: LauncherImageType;
|
|
67
|
+
imageUrl: string;
|
|
68
|
+
};
|
|
69
|
+
forceCreateChannel?: boolean;
|
|
70
|
+
agentAttributes?: {
|
|
71
|
+
ai?: Record<string, unknown>;
|
|
72
|
+
safeguard?: Record<string, unknown>;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export declare function AgentProviderContainer({ rootElement, logLevel, language, userSessionInfo, children, ...props }: AIAgentProps): JSX.Element;
|
|
77
|
+
|
|
78
|
+
export declare function AgentUIProviderContainer({ appearance, rootElement, logger, language, stringSet, children, messageTemplate, }: Props): JSX.Element;
|
|
79
|
+
|
|
80
|
+
declare interface AIAgentContextValue {
|
|
81
|
+
appId: string;
|
|
82
|
+
aiAgentId: string;
|
|
83
|
+
chatSDK: SendbirdChatWith<[GroupChannelModule, AIAgentModule]>;
|
|
84
|
+
|
|
85
|
+
language: string;
|
|
86
|
+
countryCode?: string;
|
|
87
|
+
context?: Record<string, string>;
|
|
88
|
+
|
|
89
|
+
logger: Loggable;
|
|
90
|
+
dispatcher: Dispatcher;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
declare interface AIAgentInfo {
|
|
94
|
+
userId: string;
|
|
95
|
+
nickname: string;
|
|
96
|
+
profileUrl: string;
|
|
97
|
+
replyToFile: boolean;
|
|
98
|
+
showHandoffButton: boolean;
|
|
99
|
+
specialNotice: string;
|
|
100
|
+
specialNoticeEnabled: boolean;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export declare type AIAgentProps = PropsWithChildren<{
|
|
104
|
+
appId: string;
|
|
105
|
+
aiAgentId: string;
|
|
106
|
+
customApiHost?: string;
|
|
107
|
+
customWebSocketHost?: string;
|
|
108
|
+
rootElement?: HTMLElement;
|
|
109
|
+
/**
|
|
110
|
+
* @public
|
|
111
|
+
* @description Custom state management for the ai agent client.
|
|
112
|
+
* */
|
|
113
|
+
state?: {
|
|
114
|
+
opened?: boolean;
|
|
115
|
+
setOpened?: (value: boolean) => void;
|
|
116
|
+
expanded?: boolean;
|
|
117
|
+
setExpanded?: (value: boolean) => void;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* @public
|
|
121
|
+
* @description Custom User session information to be used in connecting to the agent.
|
|
122
|
+
* */
|
|
123
|
+
userSessionInfo?: UserSessionInfo;
|
|
124
|
+
/**
|
|
125
|
+
* @public
|
|
126
|
+
* @description Localization string set for the ai agent client.
|
|
127
|
+
* */
|
|
128
|
+
stringSet?: Partial<StringSet>;
|
|
129
|
+
/**
|
|
130
|
+
* @public
|
|
131
|
+
* @description dir of the widget.
|
|
132
|
+
* */
|
|
133
|
+
dir?: 'ltr' | 'rtl';
|
|
134
|
+
/**
|
|
135
|
+
* @public
|
|
136
|
+
* @description logLevel for the ai agent client.
|
|
137
|
+
* */
|
|
138
|
+
logLevel?: LogLevel_2;
|
|
139
|
+
/**
|
|
140
|
+
* @public
|
|
141
|
+
* @description Language for the ai agent client. Should follow the IETF BCP 47 format.
|
|
142
|
+
* For example, "ko-KR" for Korean in South Korea or "en-US" for English in the United States.
|
|
143
|
+
* */
|
|
144
|
+
language?: string;
|
|
145
|
+
/**
|
|
146
|
+
* @public
|
|
147
|
+
* @description Country code for the ai agent client. Should follow the ISO 3166 format.
|
|
148
|
+
* For example, "KR" for South Korea or "US" for the United States.
|
|
149
|
+
* */
|
|
150
|
+
countryCode?: string;
|
|
151
|
+
/**
|
|
152
|
+
* @public
|
|
153
|
+
* @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.
|
|
154
|
+
* */
|
|
155
|
+
context?: Record<string, string>;
|
|
156
|
+
/**
|
|
157
|
+
* @internal
|
|
158
|
+
* @description Preview configurations for the ai agent client.
|
|
159
|
+
* */
|
|
160
|
+
agentPreviewConfigs?: AgentPreviewConfigs;
|
|
161
|
+
/**
|
|
162
|
+
* @internal
|
|
163
|
+
* @description Event handlers for the ai agent client.
|
|
164
|
+
*/
|
|
165
|
+
handlers?: AgentClientHandlers;
|
|
166
|
+
/**
|
|
167
|
+
* @internal
|
|
168
|
+
* @description Whether to show the manual conversation close button in the header. (default: false)
|
|
169
|
+
*/
|
|
170
|
+
enableCloseConversationButton?: boolean;
|
|
171
|
+
/**
|
|
172
|
+
* @internal
|
|
173
|
+
* @description Whether to show the expand button in the header. (default: true)
|
|
174
|
+
* */
|
|
175
|
+
enableExpandButton?: boolean;
|
|
176
|
+
/**
|
|
177
|
+
* @internal
|
|
178
|
+
* @description Whether to automatically disconnect the WebSocket when the user is inactive in launcher mode.
|
|
179
|
+
* Set to false to keep the connection alive even during inactivity. (default: true)
|
|
180
|
+
*/
|
|
181
|
+
enableAutoDisconnectInLauncher?: boolean;
|
|
182
|
+
/**
|
|
183
|
+
* @internal
|
|
184
|
+
* @description Whether its for the dashboard actionbook tester or not.
|
|
185
|
+
* @note we're using this for the temporary usage for testing the dashboard actionbook tester.
|
|
186
|
+
* This will be removed in the future. DO NOT expose this flag to the public.
|
|
187
|
+
*/
|
|
188
|
+
_UNSAFE_INTERNAL_isActionbookTester?: boolean;
|
|
189
|
+
/**
|
|
190
|
+
* @internal DO NOT USE THIS
|
|
191
|
+
* */
|
|
192
|
+
messageTemplate?: {
|
|
193
|
+
__internalVariables?: InternalMessageTemplateVariables;
|
|
194
|
+
};
|
|
195
|
+
}>;
|
|
196
|
+
|
|
197
|
+
declare abstract class BaseCommand {
|
|
198
|
+
abstract type: CommandType;
|
|
199
|
+
payload: any;
|
|
200
|
+
|
|
201
|
+
constructor(payload: any = {}) {
|
|
202
|
+
this.payload = payload;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
toJSON(): string {
|
|
206
|
+
return JSON.stringify({ type: this.type, payload: this.payload });
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
declare type BaseMessageProps<T> = T & {
|
|
211
|
+
createdAt: number;
|
|
212
|
+
extendedMessagePayload?: Partial<ExtendedMessagePayload>;
|
|
213
|
+
groupType?: MessageGroupType;
|
|
214
|
+
maxBodyWidth?: number;
|
|
215
|
+
onClickMedia?: (params: {
|
|
216
|
+
url: string;
|
|
217
|
+
type: string;
|
|
218
|
+
}) => void;
|
|
219
|
+
children?: ReactNode;
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
declare interface CommandPayloads {
|
|
223
|
+
[CommandType.ConversationClose]: undefined;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export declare const Commands = {
|
|
227
|
+
CloseConversation: () => new CloseConversationCommand(),
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
declare enum CommandType {
|
|
231
|
+
ConversationClose = 'conv.close',
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export declare const Conversation: ({ children, onNavigateToConversationList, closedChannelUrl, onClearClosedChannelUrl, }: Props_4) => JSX.Element;
|
|
235
|
+
|
|
236
|
+
export declare const ConversationList: ({ children, onOpenConversationView }: Props_5) => JSX.Element;
|
|
237
|
+
|
|
238
|
+
declare type CSATSubmitParams = {
|
|
239
|
+
csatType: string;
|
|
240
|
+
csat?: number;
|
|
241
|
+
csatReason?: string;
|
|
242
|
+
isResolved?: boolean;
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
export declare enum CSATType {
|
|
246
|
+
AI_AGENT_CSAT_5 = "AI_AGENT_CSAT_5",
|
|
247
|
+
AI_AGENT_CSAT_5_WITH_CRE = "AI_AGENT_CSAT_5_WITH_CRE"
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
declare const _default: {
|
|
251
|
+
language: string;
|
|
252
|
+
dateLocale: Locale;
|
|
253
|
+
stringSet: {
|
|
254
|
+
CHANNEL_FROZEN: string;
|
|
255
|
+
PLACE_HOLDER__WRONG: string;
|
|
256
|
+
PLACE_HOLDER__NO_MESSAGES: string;
|
|
257
|
+
UNKNOWN__UNKNOWN_MESSAGE_TYPE: string;
|
|
258
|
+
HEADER_BUTTON__AGENT_HANDOFF: string;
|
|
259
|
+
MESSAGE_INPUT__PLACE_HOLDER: string;
|
|
260
|
+
MESSAGE_INPUT__PLACE_HOLDER__WAIT_AI_AGENT_RESPONSE: string;
|
|
261
|
+
MESSAGE_INPUT__PLACE_HOLDER__DISABLED: string;
|
|
262
|
+
BUTTON__CANCEL: string;
|
|
263
|
+
BUTTON__SAVE: string;
|
|
264
|
+
BUTTON__OK: string;
|
|
265
|
+
NO_NAME: string;
|
|
266
|
+
RETRY: string;
|
|
267
|
+
DATE_FORMAT__MESSAGE_LIST__DATE_SEPARATOR: string;
|
|
268
|
+
DATE_FORMAT__MESSAGE_TIMESTAMP: string;
|
|
269
|
+
FILE_UPLOAD_NOTIFICATION__COUNT_LIMIT: string;
|
|
270
|
+
FILE_UPLOAD_NOTIFICATION__SIZE_LIMIT: string;
|
|
271
|
+
FILE_VIEWER__UNSUPPORT: string;
|
|
272
|
+
CSAT_TITLE_UNSUBMITTED: string;
|
|
273
|
+
CSAT_TITLE_SUBMITTED: string;
|
|
274
|
+
CSAT_CRE_TITLE: string;
|
|
275
|
+
CSAT_CRE_SOLVED: string;
|
|
276
|
+
CSAT_CRE_NOT_SOLVED: string;
|
|
277
|
+
CSAT_REASON_PLACEHOLDER: string;
|
|
278
|
+
CSAT_RATING_TITLE: string;
|
|
279
|
+
CSAT5_RATING_SCORE_1: string;
|
|
280
|
+
CSAT5_RATING_SCORE_2: string;
|
|
281
|
+
CSAT5_RATING_SCORE_3: string;
|
|
282
|
+
CSAT5_RATING_SCORE_4: string;
|
|
283
|
+
CSAT5_RATING_SCORE_5: string;
|
|
284
|
+
CSAT_SUBMIT_LABEL: string;
|
|
285
|
+
CSAT_SUBMISSION_EXPIRED: string;
|
|
286
|
+
POWERED_BY: string;
|
|
287
|
+
CONVERSATION_CLOSED_FOOTER_LABEL: string;
|
|
288
|
+
START_NEW_CONVERSATION: string;
|
|
289
|
+
RETURN_TO_CONVERSATION: string;
|
|
290
|
+
CONVERSATION_LIST__HEADER_TITLE: string;
|
|
291
|
+
CONVERSATION_LIST__TOPICS_FALLBACK: string;
|
|
292
|
+
CONVERSATION_LIST__NO_CONVERSATIONS: string;
|
|
293
|
+
DATE_FORMAT__CONVERSATION_LIST__LIST_ITEM_TITLE: string;
|
|
294
|
+
DATE_FORMAT__CONVERSATION_LIST__LIST_ITEM_TITLE_CAPTION: string;
|
|
295
|
+
};
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
export declare const DefaultMessenger: ({ children, ...props }: AIAgentProps) => JSX.Element;
|
|
299
|
+
|
|
300
|
+
declare interface Dispatcher {
|
|
301
|
+
send(command: BaseCommand): Promise<void>;
|
|
302
|
+
subscribe<E extends CommandType>(eventType: E, callback: (payload: CommandPayloads[E]) => void | Promise<void>): void;
|
|
303
|
+
unsubscribe<E extends CommandType>(
|
|
304
|
+
eventType: E,
|
|
305
|
+
callback: (payload: CommandPayloads[E]) => void | Promise<void>,
|
|
306
|
+
): void;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
declare function ExtendedCTAButton({ extendedMessagePayload, onClickCTA, }: IncomingMessageProps): JSX.Element | null;
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* This component is a placeholder for the ExtendedMessageLogs component.
|
|
313
|
+
* Because message logs are only visible in the action book tester.
|
|
314
|
+
* @see @contexts/_UNSAFE_INTERNAL_DashboardActionbookTesterContext.tsx
|
|
315
|
+
*/
|
|
316
|
+
declare function ExtendedMessageLogs(_: IncomingMessageProps): JSX.Element;
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* For better understanding: https://sendbird.atlassian.net/wiki/spaces/AA/pages/3075014695/Extended+Message+Payload+Spec
|
|
320
|
+
*/
|
|
321
|
+
export declare interface ExtendedMessagePayload {
|
|
322
|
+
is_thinking: boolean;
|
|
323
|
+
cta_button: {
|
|
324
|
+
label: string;
|
|
325
|
+
url: string;
|
|
326
|
+
};
|
|
327
|
+
suggested_replies: string[];
|
|
328
|
+
message_template: MessageTemplateShape;
|
|
329
|
+
csat: {
|
|
330
|
+
type: CSATType;
|
|
331
|
+
visibility: boolean;
|
|
332
|
+
};
|
|
333
|
+
bot_message_type: 'generated' | 'canned' | 'thinking' | 'welcome' | 'resolution_feedback' | 'maintenance' | 'safeguard' | 'error';
|
|
334
|
+
groundedness: GroundednessInfo[];
|
|
335
|
+
manual: ActionbookInfo;
|
|
336
|
+
function_calls: FunctionCallsInfo[];
|
|
337
|
+
agent_message_templates: AgentMessageTemplateInfo[];
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
declare function ExtendedMessageTemplate(props: Props_3): JSX.Element;
|
|
341
|
+
|
|
342
|
+
declare function ExtendedSuggestedReplies({ extendedMessagePayload, onClickSuggestedReply, suggestedRepliesDirection, }: IncomingMessageProps): JSX.Element | null;
|
|
343
|
+
|
|
344
|
+
export declare const FixedMessenger: ({ children, ...props }: AIAgentProps) => JSX.Element;
|
|
345
|
+
|
|
346
|
+
export declare interface FunctionCallsInfo {
|
|
347
|
+
key: string;
|
|
348
|
+
name: string;
|
|
349
|
+
request: {
|
|
350
|
+
method: string;
|
|
351
|
+
url: string;
|
|
352
|
+
headers: Record<string, string>;
|
|
353
|
+
query_params?: Record<string, any>;
|
|
354
|
+
request_body: Record<string, any>;
|
|
355
|
+
};
|
|
356
|
+
response: {
|
|
357
|
+
status_code: number;
|
|
358
|
+
response_text: string;
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export declare interface GroundednessInfo {
|
|
363
|
+
id: number;
|
|
364
|
+
source_type: 'site' | 'file' | 'snippet' | 'sb_desk' | 'sb_salesforce' | 'sb_confluence' | 'sb_zendesk' | 'sb_sprinklr' | (string & {});
|
|
365
|
+
preview_title: string;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
declare type IncomingBaseMessageProps<T> = T & BaseMessageProps<{
|
|
369
|
+
sender: {
|
|
370
|
+
nickname: string;
|
|
371
|
+
profileUrl?: string;
|
|
372
|
+
};
|
|
373
|
+
suggestedRepliesVisible?: boolean;
|
|
374
|
+
suggestedRepliesDirection?: 'vertical' | 'horizontal';
|
|
375
|
+
isBotMessage?: boolean;
|
|
376
|
+
onGetCachedMessageTemplate?: (templateKey: string) => string | null;
|
|
377
|
+
onRequestMessageTemplate?: (templateKey: string) => Promise<string>;
|
|
378
|
+
onClickSuggestedReply?: (params: {
|
|
379
|
+
reply: string;
|
|
380
|
+
}) => void;
|
|
381
|
+
onClickCTA?: (params: {
|
|
382
|
+
url: string;
|
|
383
|
+
}) => void;
|
|
384
|
+
messageTemplateErrorFallback?: ReactNode;
|
|
385
|
+
messageTemplateLoadingFallback?: ReactNode;
|
|
386
|
+
}>;
|
|
387
|
+
|
|
388
|
+
declare function IncomingMessageBody(props: IncomingMessageProps): JSX.Element;
|
|
389
|
+
|
|
390
|
+
export declare const IncomingMessageLayout: {
|
|
391
|
+
(props: PropsWithChildren): ReactNode;
|
|
392
|
+
defaults: {
|
|
393
|
+
template: ComponentType<IncomingMessageProps>;
|
|
394
|
+
components: {
|
|
395
|
+
SenderName: typeof IncomingSenderName;
|
|
396
|
+
SenderAvatar: typeof IncomingSenderAvatar;
|
|
397
|
+
SentTime: typeof IncomingSentTime;
|
|
398
|
+
MessageBody: typeof IncomingMessageBody;
|
|
399
|
+
SuggestedReplies: typeof ExtendedSuggestedReplies;
|
|
400
|
+
MessageTemplate: typeof ExtendedMessageTemplate;
|
|
401
|
+
CTAButton: typeof ExtendedCTAButton;
|
|
402
|
+
MessageLogs: typeof ExtendedMessageLogs;
|
|
403
|
+
};
|
|
404
|
+
};
|
|
405
|
+
Template: ({ template, children }: {
|
|
406
|
+
template?: ComponentType<IncomingMessageProps> | undefined;
|
|
407
|
+
children?: ReactNode;
|
|
408
|
+
}) => JSX.Element;
|
|
409
|
+
Context: Context<LayoutContextValue< {
|
|
410
|
+
SenderName: typeof IncomingSenderName;
|
|
411
|
+
SenderAvatar: typeof IncomingSenderAvatar;
|
|
412
|
+
SentTime: typeof IncomingSentTime;
|
|
413
|
+
MessageBody: typeof IncomingMessageBody;
|
|
414
|
+
SuggestedReplies: typeof ExtendedSuggestedReplies;
|
|
415
|
+
MessageTemplate: typeof ExtendedMessageTemplate;
|
|
416
|
+
CTAButton: typeof ExtendedCTAButton;
|
|
417
|
+
MessageLogs: typeof ExtendedMessageLogs;
|
|
418
|
+
}, IncomingMessageProps>>;
|
|
419
|
+
useContext: () => LayoutContextValue< {
|
|
420
|
+
SenderName: typeof IncomingSenderName;
|
|
421
|
+
SenderAvatar: typeof IncomingSenderAvatar;
|
|
422
|
+
SentTime: typeof IncomingSentTime;
|
|
423
|
+
MessageBody: typeof IncomingMessageBody;
|
|
424
|
+
SuggestedReplies: typeof ExtendedSuggestedReplies;
|
|
425
|
+
MessageTemplate: typeof ExtendedMessageTemplate;
|
|
426
|
+
CTAButton: typeof ExtendedCTAButton;
|
|
427
|
+
MessageLogs: typeof ExtendedMessageLogs;
|
|
428
|
+
}, IncomingMessageProps>;
|
|
429
|
+
} & {
|
|
430
|
+
MessageTemplate: (props: {
|
|
431
|
+
component: typeof ExtendedMessageTemplate;
|
|
432
|
+
}) => null;
|
|
433
|
+
SenderName: (props: {
|
|
434
|
+
component: typeof IncomingSenderName;
|
|
435
|
+
}) => null;
|
|
436
|
+
SenderAvatar: (props: {
|
|
437
|
+
component: typeof IncomingSenderAvatar;
|
|
438
|
+
}) => null;
|
|
439
|
+
SentTime: (props: {
|
|
440
|
+
component: typeof IncomingSentTime;
|
|
441
|
+
}) => null;
|
|
442
|
+
MessageBody: (props: {
|
|
443
|
+
component: typeof IncomingMessageBody;
|
|
444
|
+
}) => null;
|
|
445
|
+
SuggestedReplies: (props: {
|
|
446
|
+
component: typeof ExtendedSuggestedReplies;
|
|
447
|
+
}) => null;
|
|
448
|
+
CTAButton: (props: {
|
|
449
|
+
component: typeof ExtendedCTAButton;
|
|
450
|
+
}) => null;
|
|
451
|
+
MessageLogs: (props: {
|
|
452
|
+
component: typeof ExtendedMessageLogs;
|
|
453
|
+
}) => null;
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
export declare type IncomingMessageProps<T extends IncomingMessageUnion['messageType'] = IncomingMessageUnion['messageType']> = PickMessageProps<IncomingMessageUnion, T>;
|
|
457
|
+
|
|
458
|
+
declare type IncomingMessageUnion = IncomingBaseMessageProps<{
|
|
459
|
+
messageType: 'user';
|
|
460
|
+
message: string;
|
|
461
|
+
}> | IncomingBaseMessageProps<{
|
|
462
|
+
messageType: 'file';
|
|
463
|
+
message: string;
|
|
464
|
+
file: {
|
|
465
|
+
type: string;
|
|
466
|
+
url: string;
|
|
467
|
+
name: string;
|
|
468
|
+
};
|
|
469
|
+
}>;
|
|
470
|
+
|
|
471
|
+
declare function IncomingSenderAvatar({ sender, isBotMessage }: Pick<IncomingMessageProps, 'sender' | 'isBotMessage'>): JSX.Element;
|
|
472
|
+
|
|
473
|
+
declare function IncomingSenderName({ sender }: Pick<IncomingMessageProps, 'sender'>): JSX.Element;
|
|
474
|
+
|
|
475
|
+
declare function IncomingSentTime({ createdAt }: Pick<IncomingMessageProps, 'createdAt'>): JSX.Element;
|
|
476
|
+
|
|
477
|
+
declare interface InternalMessageTemplateVariables {
|
|
478
|
+
carousel_padding_left?: number;
|
|
479
|
+
carousel_padding_right?: number;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
declare interface LanguageSet {
|
|
483
|
+
language: string;
|
|
484
|
+
stringSet: StringSet;
|
|
485
|
+
dateLocale: Locale;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
export declare function LauncherBase({ className, isOpened, onClick, type, imageUrl, dir, animated, backgroundColor, }: LauncherProps): JSX.Element;
|
|
489
|
+
|
|
490
|
+
declare type LauncherImageType = 'default_icon' | 'custom_image';
|
|
491
|
+
|
|
492
|
+
declare interface LauncherInfo {
|
|
493
|
+
type: LauncherImageType;
|
|
494
|
+
imageUrl: string;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
declare type LauncherProps = {
|
|
498
|
+
className?: string;
|
|
499
|
+
isOpened: boolean;
|
|
500
|
+
onClick?: () => void;
|
|
501
|
+
type: LauncherImageType;
|
|
502
|
+
imageUrl: string;
|
|
503
|
+
backgroundColor: string;
|
|
504
|
+
animated?: boolean;
|
|
505
|
+
dir?: 'ltr' | 'rtl';
|
|
506
|
+
};
|
|
507
|
+
|
|
508
|
+
declare interface LayoutContextValue<Components extends Record<string, ComponentType<Props>>, Props> {
|
|
509
|
+
Template: ComponentType<Props>;
|
|
510
|
+
updateTemplate: (template: ComponentType<Props>) => void;
|
|
511
|
+
components: Components;
|
|
512
|
+
updateComponent: (key: keyof Components, component: Components[keyof Components]) => void;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
declare interface LocalizationContextValue extends LanguageSet {
|
|
516
|
+
format: typeof format;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
declare interface Loggable {
|
|
520
|
+
verbose(...args: any[]): void;
|
|
521
|
+
debug(...args: any[]): void;
|
|
522
|
+
info(...args: any[]): void;
|
|
523
|
+
warn(...args: any[]): void;
|
|
524
|
+
error(...args: any[]): void;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
export declare enum LogLevel {
|
|
528
|
+
VERBOSE,
|
|
529
|
+
DEBUG,
|
|
530
|
+
INFO,
|
|
531
|
+
WARN,
|
|
532
|
+
ERROR,
|
|
533
|
+
NONE,
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* @description
|
|
538
|
+
* - single: The message is standalone (not grouped with adjacent messages).
|
|
539
|
+
* - top: The message is grouped and is the first (top) in that group.
|
|
540
|
+
* - middle: The message is grouped and sits between other messages in the group.
|
|
541
|
+
* - bottom: The message is grouped and is the last (bottom) in that group.
|
|
542
|
+
* */
|
|
543
|
+
declare type MessageGroupType = 'single' | 'top' | 'bottom' | 'middle';
|
|
544
|
+
|
|
545
|
+
export declare const MessageLogs: ({ actionbook, functionCalls, groundedness, agentMessageTemplates, onClickActionbook, onClickFunctionCall, onClickFunctionCallDetail, onClickGroundedness, onClickAgentMessageTemplate, bottomContent, renderCustomGroundednessIcon, style, }: Props_2) => JSX.Element;
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Information containing the key and variables of the message template to be rendered in the message
|
|
549
|
+
* message.extended_message_payload.message_template
|
|
550
|
+
* */
|
|
551
|
+
declare interface MessageTemplateShape extends MessageTemplateShapeAtom {
|
|
552
|
+
view_variables?: Record<string, MessageTemplateShapeAtom[]>;
|
|
553
|
+
fallback_message?: string;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
declare interface MessageTemplateShapeAtom {
|
|
557
|
+
type?: 'default';
|
|
558
|
+
key: string;
|
|
559
|
+
variables?: Record<string, any>;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
declare interface MessengerContextValue extends AIAgentContextValue {
|
|
563
|
+
rootElement: HTMLElement;
|
|
564
|
+
agentPreviewConfigs?: AgentPreviewConfigs;
|
|
565
|
+
handlers?: AgentClientHandlers;
|
|
566
|
+
state: {
|
|
567
|
+
opened: boolean;
|
|
568
|
+
setOpened: (value: boolean) => void;
|
|
569
|
+
expanded: boolean;
|
|
570
|
+
setExpanded: (value: boolean) => void;
|
|
571
|
+
};
|
|
572
|
+
dir?: 'ltr' | 'rtl';
|
|
573
|
+
enableCloseConversationButton: boolean;
|
|
574
|
+
enableExpandButton: boolean;
|
|
575
|
+
enableAutoDisconnectInLauncher: boolean;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
declare class MessengerDispatcher implements Dispatcher {
|
|
579
|
+
private subscribers: { [E in CommandType]?: ((payload: CommandPayloads[E]) => void | Promise<void>)[] } = {};
|
|
580
|
+
constructor(private logger: Loggable) {}
|
|
581
|
+
|
|
582
|
+
async send(command: BaseCommand): Promise<void> {
|
|
583
|
+
const deferred = createDeferred<void>();
|
|
584
|
+
|
|
585
|
+
const callbacks = this.subscribers[command.type];
|
|
586
|
+
if (callbacks) {
|
|
587
|
+
this.logger.debug(`messenger.dispatcher: dispatching command: ${command.type}`, command.payload);
|
|
588
|
+
|
|
589
|
+
const callbackPromises = callbacks.map((callback) => callback(command.payload));
|
|
590
|
+
await Promise.all(callbackPromises).catch((error) => {
|
|
591
|
+
this.logger.error(`messenger.dispatcher: error in callback for command: ${command.type}`, error);
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
deferred.resolve();
|
|
596
|
+
|
|
597
|
+
return deferred.promise;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
subscribe<E extends CommandType>(eventType: E, callback: (payload: CommandPayloads[E]) => void): void {
|
|
601
|
+
if (!this.subscribers[eventType]) {
|
|
602
|
+
this.subscribers[eventType] = [];
|
|
603
|
+
}
|
|
604
|
+
this.subscribers[eventType].push(callback);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
unsubscribe<E extends CommandType>(eventType: E, callback: (payload: CommandPayloads[E]) => void): void {
|
|
608
|
+
if (!this.subscribers[eventType]) {
|
|
609
|
+
return;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
this.subscribers[eventType] = this.subscribers[eventType].filter((cb) => cb !== callback);
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
export declare const messengerDispatcher: MessengerDispatcher;
|
|
617
|
+
|
|
618
|
+
declare interface MessengerSessionContextValue {
|
|
619
|
+
activeChannel?: {
|
|
620
|
+
url: string;
|
|
621
|
+
status: ConversationStatus;
|
|
622
|
+
};
|
|
623
|
+
refreshActiveChannel: () => Promise<string>;
|
|
624
|
+
connectionError?: Error;
|
|
625
|
+
userSession: {
|
|
626
|
+
userId: string;
|
|
627
|
+
authToken: string;
|
|
628
|
+
};
|
|
629
|
+
aiAgentInfo: AIAgentInfo;
|
|
630
|
+
launcherInfo: LauncherInfo;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
declare type OutgoingBaseMessageProps<T> = T & BaseMessageProps<{
|
|
634
|
+
sender: {
|
|
635
|
+
nickname: string;
|
|
636
|
+
profileUrl?: string;
|
|
637
|
+
};
|
|
638
|
+
sendingStatus: 'pending' | 'failed' | 'succeeded' | 'canceled' | 'scheduled';
|
|
639
|
+
}>;
|
|
640
|
+
|
|
641
|
+
declare function OutgoingMessageBody(props: OutgoingMessageProps): JSX.Element | null;
|
|
642
|
+
|
|
643
|
+
export declare const OutgoingMessageLayout: {
|
|
644
|
+
(props: PropsWithChildren): ReactNode;
|
|
645
|
+
defaults: {
|
|
646
|
+
template: ComponentType<OutgoingMessageProps>;
|
|
647
|
+
components: {
|
|
648
|
+
SendingStatus: typeof OutgoingSendingStatus;
|
|
649
|
+
SentTime: typeof OutgoingSentTime;
|
|
650
|
+
MessageBody: typeof OutgoingMessageBody;
|
|
651
|
+
};
|
|
652
|
+
};
|
|
653
|
+
Template: ({ template, children }: {
|
|
654
|
+
template?: ComponentType<OutgoingMessageProps> | undefined;
|
|
655
|
+
children?: ReactNode;
|
|
656
|
+
}) => JSX.Element;
|
|
657
|
+
Context: Context<LayoutContextValue< {
|
|
658
|
+
SendingStatus: typeof OutgoingSendingStatus;
|
|
659
|
+
SentTime: typeof OutgoingSentTime;
|
|
660
|
+
MessageBody: typeof OutgoingMessageBody;
|
|
661
|
+
}, OutgoingMessageProps>>;
|
|
662
|
+
useContext: () => LayoutContextValue< {
|
|
663
|
+
SendingStatus: typeof OutgoingSendingStatus;
|
|
664
|
+
SentTime: typeof OutgoingSentTime;
|
|
665
|
+
MessageBody: typeof OutgoingMessageBody;
|
|
666
|
+
}, OutgoingMessageProps>;
|
|
667
|
+
} & {
|
|
668
|
+
SentTime: (props: {
|
|
669
|
+
component: typeof OutgoingSentTime;
|
|
670
|
+
}) => null;
|
|
671
|
+
MessageBody: (props: {
|
|
672
|
+
component: typeof OutgoingMessageBody;
|
|
673
|
+
}) => null;
|
|
674
|
+
SendingStatus: (props: {
|
|
675
|
+
component: typeof OutgoingSendingStatus;
|
|
676
|
+
}) => null;
|
|
677
|
+
};
|
|
678
|
+
|
|
679
|
+
export declare type OutgoingMessageProps<T extends OutgoingMessageUnion['messageType'] = OutgoingMessageUnion['messageType']> = PickMessageProps<OutgoingMessageUnion, T>;
|
|
680
|
+
|
|
681
|
+
declare type OutgoingMessageUnion = OutgoingBaseMessageProps<{
|
|
682
|
+
messageType: 'user';
|
|
683
|
+
message: string;
|
|
684
|
+
}> | OutgoingBaseMessageProps<{
|
|
685
|
+
messageType: 'file';
|
|
686
|
+
message: string;
|
|
687
|
+
file: {
|
|
688
|
+
type: string;
|
|
689
|
+
url: string;
|
|
690
|
+
name: string;
|
|
691
|
+
};
|
|
692
|
+
metadata: {
|
|
693
|
+
aspectRatio: string;
|
|
694
|
+
localFile?: unknown;
|
|
695
|
+
};
|
|
696
|
+
}>;
|
|
697
|
+
|
|
698
|
+
declare function OutgoingSendingStatus({ sendingStatus }: OutgoingMessageProps): JSX.Element | null;
|
|
699
|
+
|
|
700
|
+
declare function OutgoingSentTime({ createdAt }: OutgoingMessageProps): JSX.Element;
|
|
701
|
+
|
|
702
|
+
declare type PickMessageProps<Union, T extends Union extends {
|
|
703
|
+
messageType: infer MT;
|
|
704
|
+
} ? MT : never = Union extends {
|
|
705
|
+
messageType: infer MT;
|
|
706
|
+
} ? MT : never> = Union extends {
|
|
707
|
+
messageType: T;
|
|
708
|
+
} ? Union : never;
|
|
709
|
+
|
|
710
|
+
declare type Props = {
|
|
711
|
+
children: ReactNode;
|
|
712
|
+
rootElement?: HTMLElement;
|
|
713
|
+
appearance?: AgentPreviewConfigs['appearance'];
|
|
714
|
+
logger?: Loggable;
|
|
715
|
+
stringSet?: Partial<StringSet>;
|
|
716
|
+
language?: string;
|
|
717
|
+
messageTemplate?: {
|
|
718
|
+
/** @internal DO NOT USE THIS **/
|
|
719
|
+
__internalVariables?: InternalMessageTemplateVariables;
|
|
720
|
+
};
|
|
721
|
+
};
|
|
722
|
+
|
|
723
|
+
declare type Props_2 = {
|
|
724
|
+
actionbook?: ActionbookInfo;
|
|
725
|
+
functionCalls?: FunctionCallsInfo[];
|
|
726
|
+
groundedness?: GroundednessInfo[];
|
|
727
|
+
agentMessageTemplates?: AgentMessageTemplateInfo[];
|
|
728
|
+
onClickActionbook?: (value: ActionbookInfo) => void;
|
|
729
|
+
onClickFunctionCall?: (value: FunctionCallsInfo) => void;
|
|
730
|
+
onClickFunctionCallDetail?: (value: FunctionCallsInfo) => void;
|
|
731
|
+
onClickGroundedness?: (value: GroundednessInfo) => void;
|
|
732
|
+
onClickAgentMessageTemplate?: (value: AgentMessageTemplateInfo) => void;
|
|
733
|
+
style?: {
|
|
734
|
+
iconColor?: string;
|
|
735
|
+
textColor?: string;
|
|
736
|
+
barColor?: string;
|
|
737
|
+
highlightColor?: string;
|
|
738
|
+
};
|
|
739
|
+
bottomContent?: ReactNode;
|
|
740
|
+
renderCustomGroundednessIcon?: (props: {
|
|
741
|
+
default: ReactNode;
|
|
742
|
+
sourceType: string;
|
|
743
|
+
}) => ReactNode;
|
|
744
|
+
};
|
|
745
|
+
|
|
746
|
+
declare type Props_3 = Pick<IncomingMessageProps, 'extendedMessagePayload' | 'onGetCachedMessageTemplate' | 'onRequestMessageTemplate' | 'messageTemplateErrorFallback' | 'messageTemplateLoadingFallback'>;
|
|
747
|
+
|
|
748
|
+
declare type Props_4 = PropsWithChildren<{
|
|
749
|
+
closedChannelUrl?: string;
|
|
750
|
+
onClearClosedChannelUrl?: () => void;
|
|
751
|
+
onNavigateToConversationList?: () => void;
|
|
752
|
+
}>;
|
|
753
|
+
|
|
754
|
+
declare type Props_5 = PropsWithChildren<{
|
|
755
|
+
onOpenConversationView?: (channelUrl: string, status: ConversationStatus) => void;
|
|
756
|
+
}>;
|
|
757
|
+
|
|
758
|
+
declare type StringSet = Record<keyof StringSetKey, string>;
|
|
759
|
+
|
|
760
|
+
declare type StringSetKey = typeof _default.stringSet;
|
|
761
|
+
|
|
762
|
+
declare function SystemAdminMessage(props: SystemMessageProps): JSX.Element | null;
|
|
763
|
+
|
|
764
|
+
declare type SystemBaseMessageProps<T> = T & BaseMessageProps<{}>;
|
|
765
|
+
|
|
766
|
+
export declare const SystemMessageLayout: {
|
|
767
|
+
(props: PropsWithChildren): ReactNode;
|
|
768
|
+
defaults: {
|
|
769
|
+
template: ComponentType<SystemMessageProps>;
|
|
770
|
+
components: {
|
|
771
|
+
AdminMessage: typeof SystemAdminMessage;
|
|
772
|
+
CSATMessage: (props: SystemMessageProps) => JSX.Element | null;
|
|
773
|
+
};
|
|
774
|
+
};
|
|
775
|
+
Template: ({ template, children }: {
|
|
776
|
+
template?: ComponentType<SystemMessageProps> | undefined;
|
|
777
|
+
children?: ReactNode;
|
|
778
|
+
}) => JSX.Element;
|
|
779
|
+
Context: Context<LayoutContextValue< {
|
|
780
|
+
AdminMessage: typeof SystemAdminMessage;
|
|
781
|
+
CSATMessage: (props: SystemMessageProps) => JSX.Element | null;
|
|
782
|
+
}, SystemMessageProps>>;
|
|
783
|
+
useContext: () => LayoutContextValue< {
|
|
784
|
+
AdminMessage: typeof SystemAdminMessage;
|
|
785
|
+
CSATMessage: (props: SystemMessageProps) => JSX.Element | null;
|
|
786
|
+
}, SystemMessageProps>;
|
|
787
|
+
} & {
|
|
788
|
+
AdminMessage: (props: {
|
|
789
|
+
component: typeof SystemAdminMessage;
|
|
790
|
+
}) => null;
|
|
791
|
+
CSATMessage: (props: {
|
|
792
|
+
component: (props: SystemMessageProps) => JSX.Element | null;
|
|
793
|
+
}) => null;
|
|
794
|
+
};
|
|
795
|
+
|
|
796
|
+
export declare type SystemMessageProps<T extends SystemMessageUnion['messageType'] = SystemMessageUnion['messageType']> = PickMessageProps<SystemMessageUnion, T>;
|
|
797
|
+
|
|
798
|
+
declare type SystemMessageUnion = SystemBaseMessageProps<{
|
|
799
|
+
messageType: 'admin';
|
|
800
|
+
message: string;
|
|
801
|
+
}> | SystemBaseMessageProps<{
|
|
802
|
+
messageType: 'admin.csat';
|
|
803
|
+
csat?: number;
|
|
804
|
+
csatReason?: string;
|
|
805
|
+
csatExpireAt?: number;
|
|
806
|
+
isResolvedWhenDeterminedByUser?: boolean;
|
|
807
|
+
onSubmitCSAT: (params: CSATSubmitParams) => void;
|
|
808
|
+
}>;
|
|
809
|
+
|
|
810
|
+
export declare const useLocalizationContext: {
|
|
811
|
+
(): LocalizationContextValue;
|
|
812
|
+
displayName: string;
|
|
813
|
+
};
|
|
814
|
+
|
|
815
|
+
export declare const useMessengerContext: {
|
|
816
|
+
(): MessengerContextValue;
|
|
817
|
+
displayName: string;
|
|
818
|
+
};
|
|
819
|
+
|
|
820
|
+
export declare const useMessengerSessionContext: {
|
|
821
|
+
(): MessengerSessionContextValue;
|
|
822
|
+
displayName: string;
|
|
823
|
+
};
|
|
824
|
+
|
|
825
|
+
declare interface UserSessionInfo {
|
|
826
|
+
userId: string;
|
|
827
|
+
authToken: string;
|
|
828
|
+
sessionHandler: SessionHandler;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
export { }
|
|
832
|
+
|
|
833
|
+
|
|
834
|
+
declare module 'styled-components' {
|
|
835
|
+
interface DefaultTheme extends AgentTheme {
|
|
836
|
+
}
|
|
837
|
+
}
|