@sendbird/ai-agent-messenger-react-native 1.8.1 → 1.10.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/README.md +2 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +638 -6
- package/dist/index.js +3513 -2796
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { Action } from '@sendbird/uikit-message-template';
|
|
2
2
|
import { AIAgentChannelFilter } from '@sendbird/chat/aiAgent';
|
|
3
|
+
import { AIAgentGroupChannelListQuery } from '@sendbird/chat/aiAgent';
|
|
3
4
|
import { AIAgentModule } from '@sendbird/chat/aiAgent';
|
|
5
|
+
import { BaseChannel } from '@sendbird/chat';
|
|
4
6
|
import { BaseMessage } from '@sendbird/chat/message';
|
|
5
7
|
import type * as CommunityDocumentPicker from '@react-native-documents/picker';
|
|
6
8
|
import type * as CommunityImagePicker from 'react-native-image-picker';
|
|
7
9
|
import { ComponentType } from 'react';
|
|
10
|
+
import { ConnectionHandler } from '@sendbird/chat';
|
|
8
11
|
import { Context } from 'react';
|
|
9
12
|
import { Conversation as Conversation_2 } from '@sendbird/chat/aiAgent';
|
|
10
13
|
import { ConversationStatus } from '@sendbird/chat/aiAgent';
|
|
@@ -17,6 +20,9 @@ import { FlatList } from 'react-native';
|
|
|
17
20
|
import { FlatListProps } from 'react-native';
|
|
18
21
|
import { ForwardRefExoticComponent } from 'react';
|
|
19
22
|
import { GroupChannel } from '@sendbird/chat/groupChannel';
|
|
23
|
+
import { GroupChannelChangelogs } from '@sendbird/chat/aiAgent';
|
|
24
|
+
import { GroupChannelHandler } from '@sendbird/chat/groupChannel';
|
|
25
|
+
import { GroupChannelListOrder } from '@sendbird/chat/groupChannel';
|
|
20
26
|
import { GroupChannelModule } from '@sendbird/chat/groupChannel';
|
|
21
27
|
import { JSX } from 'react/jsx-runtime';
|
|
22
28
|
import { LayoutChangeEvent } from 'react-native';
|
|
@@ -262,7 +268,11 @@ declare interface AIAgentConfig {
|
|
|
262
268
|
declare interface AIAgentContextValue {
|
|
263
269
|
appId: string;
|
|
264
270
|
aiAgentId: string;
|
|
271
|
+
|
|
272
|
+
/** @internal Do not use directly. This is an internal SDK instance. */
|
|
273
|
+
_aiAgentSDK: AIAgentInterface;
|
|
265
274
|
chatSDK: SendbirdChatWith<[GroupChannelModule, AIAgentModule]>;
|
|
275
|
+
deskClient: DeskClientInterface;
|
|
266
276
|
|
|
267
277
|
language: string;
|
|
268
278
|
countryCode?: string;
|
|
@@ -374,6 +384,86 @@ declare interface AIAgentInfo {
|
|
|
374
384
|
isUserFeedbackCommentOptionEnabled: boolean;
|
|
375
385
|
}
|
|
376
386
|
|
|
387
|
+
/**
|
|
388
|
+
* Public interface for AIAgent SDK instance.
|
|
389
|
+
* This interface exposes the public API of the AIAgent class.
|
|
390
|
+
*/
|
|
391
|
+
declare interface AIAgentInterface {
|
|
392
|
+
/** Sendbird application ID */
|
|
393
|
+
readonly appId: string;
|
|
394
|
+
/** AI Agent ID */
|
|
395
|
+
readonly aiAgentId: string;
|
|
396
|
+
|
|
397
|
+
/** The underlying Sendbird Chat SDK instance */
|
|
398
|
+
readonly chatSDK: ChatSDKType;
|
|
399
|
+
/** The current authenticated session. `null` if not authenticated */
|
|
400
|
+
readonly session: AIAgentSession | null;
|
|
401
|
+
/** The Desk client. Available after authenticate(). */
|
|
402
|
+
readonly deskClient: DeskClientInterface;
|
|
403
|
+
// TODO: Change to `AIAgentConfig` (non-optional) once the context migration lands and all usages are updated
|
|
404
|
+
/** The AI Agent configuration */
|
|
405
|
+
config: AIAgentConfig | undefined;
|
|
406
|
+
/** The query parameters for AI Agent */
|
|
407
|
+
queryParams?: AIAgentQueryParams;
|
|
408
|
+
/** The adapter for detecting online/offline network state */
|
|
409
|
+
readonly networkStateAdapter: NetworkStateAdapter | undefined;
|
|
410
|
+
/** The logger instance */
|
|
411
|
+
readonly logger: Loggable;
|
|
412
|
+
/** The event dispatcher */
|
|
413
|
+
readonly dispatcher: Dispatcher;
|
|
414
|
+
/** The cache instance */
|
|
415
|
+
readonly cache: AIAgentCache;
|
|
416
|
+
/** The language setting */
|
|
417
|
+
language: string;
|
|
418
|
+
/** The country code setting */
|
|
419
|
+
countryCode?: string;
|
|
420
|
+
/** The context object for AI Agent */
|
|
421
|
+
context?: Record<string, string>;
|
|
422
|
+
|
|
423
|
+
/** @internal Agent version for conversation initialization */
|
|
424
|
+
agentVersion?: number;
|
|
425
|
+
|
|
426
|
+
/** @internal Stats trackers for performance monitoring */
|
|
427
|
+
readonly statsTrackers: {
|
|
428
|
+
initialRender: ConversationInitialRenderStatsTracker;
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
/** Authenticates with the AI Agent server and establishes a session */
|
|
432
|
+
authenticate: (sessionInfo: ManualSessionInfo | AnonymousSessionInfo) => Promise<MessengerSettingsResponse>;
|
|
433
|
+
/** Disconnects from the AI Agent server and clears the session */
|
|
434
|
+
deauthenticate: () => Promise<void>;
|
|
435
|
+
/** Creates a new conversation with the AI Agent */
|
|
436
|
+
createConversation: (params: ConversationCreateParams) => Promise<string>;
|
|
437
|
+
/** Searches for open conversations that match the specified context */
|
|
438
|
+
searchConversation: (params: SearchConversationParams) => Promise<string[]>;
|
|
439
|
+
/** Closes an open conversation */
|
|
440
|
+
closeConversation: (channelUrl: string) => Promise<void>;
|
|
441
|
+
/** Creates a collection for paginating through conversations */
|
|
442
|
+
createConversationListCollection: (params?: ConversationListCollectionParams) => ConversationListCollection;
|
|
443
|
+
/** Patches (merges) context data for the specified channel */
|
|
444
|
+
patchContext: (channelUrl: string, context: Record<string, string>) => Promise<ContextObject>;
|
|
445
|
+
/** Replaces the entire context data for the specified channel */
|
|
446
|
+
updateContext: (channelUrl: string, context: Record<string, string>) => Promise<ContextObject>;
|
|
447
|
+
/** Retrieves the context data for the specified channel */
|
|
448
|
+
getContextObject: (channelUrl: string) => Promise<ContextObject>;
|
|
449
|
+
|
|
450
|
+
/** @internal Refreshes the active channel by re-requesting messenger settings */
|
|
451
|
+
refreshActiveChannel: (options?: { useKnownActiveChannelUrl?: boolean }) => Promise<string>;
|
|
452
|
+
|
|
453
|
+
/** @internal Initializes a conversation on the channel if needed (AI Agent channel without conversation). */
|
|
454
|
+
initConversationIfNeeded: (channel: GroupChannel) => Promise<void>;
|
|
455
|
+
|
|
456
|
+
/** Disposes all resources held by this instance (WebSocket, desk auth, event handlers). */
|
|
457
|
+
dispose: () => void;
|
|
458
|
+
|
|
459
|
+
/** Registers a handler for messenger settings updates */
|
|
460
|
+
onMessengerSettingsUpdated: (handler: (params: MessengerSettingsUpdatedParams) => void) => () => void;
|
|
461
|
+
/** Registers a handler for active channel updates */
|
|
462
|
+
onActiveChannelUpdated: (handler: (params: ActiveChannelUpdatedParams) => void) => () => void;
|
|
463
|
+
/** Registers a handler for auth token refresh events */
|
|
464
|
+
onAuthTokenRefreshed: (handler: (params: AuthTokenRefreshedParams) => void) => () => void;
|
|
465
|
+
}
|
|
466
|
+
|
|
377
467
|
declare interface AIAgentMessengerSessionContextValue {
|
|
378
468
|
userSessionInfo?: UserSessionInfo | ManualSessionInfo | AnonymousSessionInfo;
|
|
379
469
|
|
|
@@ -500,6 +590,68 @@ declare interface AIAgentQueryParams {
|
|
|
500
590
|
conversationListParams?: ConversationListCollectionParams;
|
|
501
591
|
}
|
|
502
592
|
|
|
593
|
+
/**
|
|
594
|
+
* @description Represents an authenticated session state. Created after successful authentication.
|
|
595
|
+
*/
|
|
596
|
+
declare class AIAgentSession {
|
|
597
|
+
private readonly _sdkUser: User;
|
|
598
|
+
private readonly _userSession: UserSession;
|
|
599
|
+
private readonly _dispatcher: Dispatcher;
|
|
600
|
+
private _activeChannel: ActiveChannel;
|
|
601
|
+
|
|
602
|
+
constructor(params: AIAgentSessionParams) {
|
|
603
|
+
this._sdkUser = params.sdkUser;
|
|
604
|
+
this._userSession = params.userSession;
|
|
605
|
+
this._dispatcher = params.dispatcher;
|
|
606
|
+
this._activeChannel = params.activeChannel;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* The authenticated Sendbird user.
|
|
611
|
+
*/
|
|
612
|
+
get sdkUser(): User {
|
|
613
|
+
return this._sdkUser;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* The current user session containing userId and authToken.
|
|
618
|
+
*/
|
|
619
|
+
get userSession(): UserSession {
|
|
620
|
+
return this._userSession;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* The currently active channel.
|
|
625
|
+
*/
|
|
626
|
+
get activeChannel(): ActiveChannel {
|
|
627
|
+
return this._activeChannel;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* Updates the active channel and dispatches ActiveChannelUpdated event.
|
|
632
|
+
* @internal
|
|
633
|
+
*/
|
|
634
|
+
_updateActiveChannel = (channel: ActiveChannel): void => {
|
|
635
|
+
this._activeChannel = channel;
|
|
636
|
+
this._dispatcher.send(
|
|
637
|
+
DispatcherCommands.ActiveChannelUpdated({
|
|
638
|
+
channelUrl: channel.url,
|
|
639
|
+
status: channel.status,
|
|
640
|
+
conversationStatus: channel.conversationStatus,
|
|
641
|
+
}),
|
|
642
|
+
);
|
|
643
|
+
};
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* Updates the auth token when session is refreshed.
|
|
647
|
+
* @internal
|
|
648
|
+
*/
|
|
649
|
+
_updateAuthToken = (authToken: string): void => {
|
|
650
|
+
this._userSession.authToken = authToken;
|
|
651
|
+
this._dispatcher.send(DispatcherCommands.AuthTokenRefreshed());
|
|
652
|
+
};
|
|
653
|
+
}
|
|
654
|
+
|
|
503
655
|
/**
|
|
504
656
|
* AI Agent session handler.
|
|
505
657
|
* */
|
|
@@ -507,6 +659,13 @@ declare interface AIAgentSessionHandler extends SessionHandler {
|
|
|
507
659
|
onExternalAuthTokenExpired?: (data: ExternalAuthTokenExpiredData) => void;
|
|
508
660
|
}
|
|
509
661
|
|
|
662
|
+
declare interface AIAgentSessionParams {
|
|
663
|
+
sdkUser: User;
|
|
664
|
+
userSession: UserSession;
|
|
665
|
+
activeChannel: ActiveChannel;
|
|
666
|
+
dispatcher: Dispatcher;
|
|
667
|
+
}
|
|
668
|
+
|
|
510
669
|
declare interface AIAgentStatPayload {
|
|
511
670
|
key: string;
|
|
512
671
|
value?: string;
|
|
@@ -623,6 +782,8 @@ declare interface AttachmentRules {
|
|
|
623
782
|
getUploadSizeLimitInMB: (mimeType: string) => number;
|
|
624
783
|
}
|
|
625
784
|
|
|
785
|
+
declare interface AuthTokenRefreshedParams {}
|
|
786
|
+
|
|
626
787
|
declare abstract class BaseCommand {
|
|
627
788
|
abstract type: CommandType;
|
|
628
789
|
payload: any;
|
|
@@ -699,6 +860,8 @@ export declare interface BottomSheetTemplateProps {
|
|
|
699
860
|
declare interface CameraOptions {
|
|
700
861
|
}
|
|
701
862
|
|
|
863
|
+
declare type ChatSDKType = SendbirdChatWith<[GroupChannelModule, AIAgentModule]>;
|
|
864
|
+
|
|
702
865
|
declare interface CitationInfo {
|
|
703
866
|
embedding_id: number;
|
|
704
867
|
source_type: string;
|
|
@@ -716,6 +879,7 @@ declare interface CommandPayloads {
|
|
|
716
879
|
[CommandType.MessengerSettingsUpdated]: MessengerSettingsUpdatedParams;
|
|
717
880
|
[CommandType.ActiveChannelUpdated]: ActiveChannelUpdatedParams;
|
|
718
881
|
[CommandType.AnonymousSessionTokenExpired]: undefined;
|
|
882
|
+
[CommandType.AuthTokenRefreshed]: AuthTokenRefreshedParams;
|
|
719
883
|
}
|
|
720
884
|
|
|
721
885
|
declare enum CommandType {
|
|
@@ -723,6 +887,7 @@ declare enum CommandType {
|
|
|
723
887
|
MessengerSettingsUpdated = 'messenger.settings.updated',
|
|
724
888
|
ActiveChannelUpdated = 'active.channel.updated',
|
|
725
889
|
AnonymousSessionTokenExpired = 'anon.token.expired',
|
|
890
|
+
AuthTokenRefreshed = 'auth.token.refreshed',
|
|
726
891
|
}
|
|
727
892
|
|
|
728
893
|
declare type CommunityDocumentPickerModule = typeof CommunityDocumentPicker;
|
|
@@ -1018,6 +1183,385 @@ export declare const ConversationLayout: {
|
|
|
1018
1183
|
|
|
1019
1184
|
export declare const ConversationList: ({ children, ...props }: ConversationListContextProps) => JSX.Element;
|
|
1020
1185
|
|
|
1186
|
+
/**
|
|
1187
|
+
* A collection for managing AI agent group channels with real-time updates and pagination.
|
|
1188
|
+
* Automatically separates pinned and non-pinned channels, with pinned channels prioritized at the top.
|
|
1189
|
+
*/
|
|
1190
|
+
declare class ConversationListCollection {
|
|
1191
|
+
/** The filter configuration used for this collection */
|
|
1192
|
+
readonly filter?: AIAgentGroupChannelFilter;
|
|
1193
|
+
|
|
1194
|
+
private _sdk: ChatSDKType;
|
|
1195
|
+
private _pinnedChannels: GroupChannel[];
|
|
1196
|
+
private _channels: GroupChannel[];
|
|
1197
|
+
|
|
1198
|
+
private _isDisposed = false;
|
|
1199
|
+
private _handlerId = `handler-id-${Date.now()}`;
|
|
1200
|
+
private _order: GroupChannelListOrder = GroupChannelListOrder.LATEST_LAST_MESSAGE;
|
|
1201
|
+
|
|
1202
|
+
private _limit: number;
|
|
1203
|
+
private _query: AIAgentGroupChannelListQuery;
|
|
1204
|
+
|
|
1205
|
+
private _token: string;
|
|
1206
|
+
private _timestamp: number;
|
|
1207
|
+
private _isSyncing: boolean;
|
|
1208
|
+
|
|
1209
|
+
private _channelHandler: GroupChannelHandler;
|
|
1210
|
+
private _connectionHandler: ConnectionHandler;
|
|
1211
|
+
private _collectionEventHandler?: ConversationListCollectionEventHandler;
|
|
1212
|
+
private _throttledOnChannelChanged: ThrottledFunction<(channel: BaseChannel) => void>;
|
|
1213
|
+
|
|
1214
|
+
/**
|
|
1215
|
+
* Creates a new ConversationListCollection instance.
|
|
1216
|
+
* @param sdk - The Sendbird Chat SDK instance
|
|
1217
|
+
* @param params - Configuration parameters for the collection
|
|
1218
|
+
*/
|
|
1219
|
+
constructor(sdk: ChatSDKType, { filter, limit = 20 }: ConversationListCollectionParams) {
|
|
1220
|
+
this.filter = filter;
|
|
1221
|
+
|
|
1222
|
+
this._sdk = sdk;
|
|
1223
|
+
this._pinnedChannels = [];
|
|
1224
|
+
this._channels = [];
|
|
1225
|
+
|
|
1226
|
+
this._limit = limit;
|
|
1227
|
+
this._query = this._sdk.aiAgent.createMyGroupChannelListQuery({
|
|
1228
|
+
aiAgentChannelFilter: this.filter?.aiAgentChannelFilter,
|
|
1229
|
+
aiAgentConversationStatusFilter: this.filter?.aiAgentConversationStatusFilter,
|
|
1230
|
+
aiAgentIds: this.filter?.aiAgentIds,
|
|
1231
|
+
deskChannelFilter: this.filter?.deskChannelFilter,
|
|
1232
|
+
pinnedChannelUrls: this.filter?.pinnedChannelUrls,
|
|
1233
|
+
copilotConversationOnly: this.filter?.copilotConversationOnly,
|
|
1234
|
+
copilotSupportChannelUrl: this.filter?.copilotSupportChannelUrl,
|
|
1235
|
+
limit: this._limit,
|
|
1236
|
+
});
|
|
1237
|
+
|
|
1238
|
+
this._token = '';
|
|
1239
|
+
this._timestamp = Number.MAX_SAFE_INTEGER;
|
|
1240
|
+
this._isSyncing = false;
|
|
1241
|
+
|
|
1242
|
+
this._throttledOnChannelChanged = throttle(
|
|
1243
|
+
(channel: GroupChannel) => {
|
|
1244
|
+
if (this._query.belongsTo(channel)) {
|
|
1245
|
+
this._addChannelsToView([channel], false);
|
|
1246
|
+
} else {
|
|
1247
|
+
this._removeChannelsFromView([channel.url]);
|
|
1248
|
+
}
|
|
1249
|
+
},
|
|
1250
|
+
250,
|
|
1251
|
+
{ trailing: false, leading: true },
|
|
1252
|
+
);
|
|
1253
|
+
|
|
1254
|
+
this._channelHandler = new GroupChannelHandler({
|
|
1255
|
+
onChannelChanged: (channel) => {
|
|
1256
|
+
if (!channel.isGroupChannel()) return;
|
|
1257
|
+
this._throttledOnChannelChanged(channel);
|
|
1258
|
+
},
|
|
1259
|
+
onChannelDeleted: (channelUrl) => {
|
|
1260
|
+
this._removeChannelsFromView([channelUrl]);
|
|
1261
|
+
},
|
|
1262
|
+
});
|
|
1263
|
+
|
|
1264
|
+
this._connectionHandler = new ConnectionHandler({
|
|
1265
|
+
onReconnectSucceeded: () => {
|
|
1266
|
+
if (this._isDefaultChangelogSyncTimestampUpdated) this._syncChannelChangelogs();
|
|
1267
|
+
},
|
|
1268
|
+
});
|
|
1269
|
+
|
|
1270
|
+
this._sdk.addConnectionHandler(this._handlerId, this._connectionHandler);
|
|
1271
|
+
this._sdk.groupChannel.addGroupChannelHandler(this._handlerId, this._channelHandler);
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
/**
|
|
1275
|
+
* Checks if the default changelog sync timestamp has been updated.
|
|
1276
|
+
*/
|
|
1277
|
+
private get _isDefaultChangelogSyncTimestampUpdated() {
|
|
1278
|
+
return this._timestamp !== Number.MAX_SAFE_INTEGER;
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
/**
|
|
1282
|
+
* Sets the default changelog sync timestamp based on the first non-pinned channel.
|
|
1283
|
+
* @param channels - Array of channels to analyze
|
|
1284
|
+
*/
|
|
1285
|
+
private _setDefaultChangelogsSyncTimestamp(channels: GroupChannel[]) {
|
|
1286
|
+
const pinnedUrlsSet = new Set(this.filter?.pinnedChannelUrls ?? []);
|
|
1287
|
+
const firstChannel = channels.find((it) => {
|
|
1288
|
+
return !pinnedUrlsSet.has(it.url);
|
|
1289
|
+
});
|
|
1290
|
+
|
|
1291
|
+
let candidate: number;
|
|
1292
|
+
if (firstChannel) {
|
|
1293
|
+
candidate = firstChannel.lastMessage?.createdAt ?? firstChannel.createdAt;
|
|
1294
|
+
} else {
|
|
1295
|
+
candidate = this._query.lastResponseAt;
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
if (this._timestamp > candidate) {
|
|
1299
|
+
this._timestamp = candidate;
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
/**
|
|
1304
|
+
* Synchronizes channel changelogs to keep the collection up-to-date.
|
|
1305
|
+
* @returns Promise that resolves to an empty array
|
|
1306
|
+
*/
|
|
1307
|
+
private async _syncChannelChangelogs(): Promise<GroupChannel[]> {
|
|
1308
|
+
if (this._isDisposed) return [];
|
|
1309
|
+
if (this._isSyncing) return [];
|
|
1310
|
+
|
|
1311
|
+
try {
|
|
1312
|
+
this._isSyncing = true;
|
|
1313
|
+
let response: GroupChannelChangelogs;
|
|
1314
|
+
|
|
1315
|
+
if (this._token) {
|
|
1316
|
+
response = await this._sdk.aiAgent.getMyGroupChannelChangeLogsByToken(this._token, this.filter);
|
|
1317
|
+
} else {
|
|
1318
|
+
response = await this._sdk.aiAgent.getMyGroupChannelChangeLogsByTimestamp(this._timestamp, this.filter);
|
|
1319
|
+
}
|
|
1320
|
+
this._token = response.token;
|
|
1321
|
+
this._addChannelsToView(response.updatedChannels);
|
|
1322
|
+
this._removeChannelsFromView(response.deletedChannelUrls);
|
|
1323
|
+
|
|
1324
|
+
while (response.hasMore && !!response.token) {
|
|
1325
|
+
response = await this._sdk.aiAgent.getMyGroupChannelChangeLogsByToken(this._token, this.filter);
|
|
1326
|
+
this._token = response.token;
|
|
1327
|
+
this._addChannelsToView(response.updatedChannels);
|
|
1328
|
+
this._removeChannelsFromView(response.deletedChannelUrls);
|
|
1329
|
+
}
|
|
1330
|
+
} catch (error) {
|
|
1331
|
+
// Silently handle changelog sync errors to prevent disrupting the collection
|
|
1332
|
+
// The collection will continue to work with existing data
|
|
1333
|
+
} finally {
|
|
1334
|
+
this._isSyncing = false;
|
|
1335
|
+
}
|
|
1336
|
+
return [];
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
/**
|
|
1340
|
+
* Upserts pinned channels maintaining the order specified in pinnedChannelUrls.
|
|
1341
|
+
* @param channels - Pinned channels to upsert
|
|
1342
|
+
* @returns Object containing added, updated channels and unmatched URLs
|
|
1343
|
+
*/
|
|
1344
|
+
private _upsertPinnedChannelsToArray(channels: GroupChannel[]): {
|
|
1345
|
+
addedChannels: GroupChannel[];
|
|
1346
|
+
updatedChannels: GroupChannel[];
|
|
1347
|
+
unmatchedChannelUrls: string[];
|
|
1348
|
+
} {
|
|
1349
|
+
const pinnedUrls = this.filter?.pinnedChannelUrls ?? [];
|
|
1350
|
+
const pinnedIndexMap = new Map(pinnedUrls.map((url, index) => [url, index]));
|
|
1351
|
+
|
|
1352
|
+
const addedChannels: GroupChannel[] = [];
|
|
1353
|
+
const updatedChannels: GroupChannel[] = [];
|
|
1354
|
+
const unmatchedChannelUrls: string[] = [];
|
|
1355
|
+
|
|
1356
|
+
for (const channel of channels) {
|
|
1357
|
+
if (!this._query.belongsTo(channel)) {
|
|
1358
|
+
unmatchedChannelUrls.push(channel.url);
|
|
1359
|
+
continue;
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
const targetIndex = pinnedIndexMap.get(channel.url);
|
|
1363
|
+
if (targetIndex === undefined) continue;
|
|
1364
|
+
|
|
1365
|
+
const existingPosition = indexOfChannel(this._pinnedChannels, channel);
|
|
1366
|
+
const isExisting = existingPosition >= 0;
|
|
1367
|
+
|
|
1368
|
+
if (isExisting) {
|
|
1369
|
+
this._pinnedChannels.splice(existingPosition, 1);
|
|
1370
|
+
updatedChannels.push(channel);
|
|
1371
|
+
} else {
|
|
1372
|
+
addedChannels.push(channel);
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
const insertPosition = this._pinnedChannels.findIndex((existingChannel) => {
|
|
1376
|
+
const existingIndex = pinnedIndexMap.get(existingChannel.url) ?? Infinity;
|
|
1377
|
+
return existingIndex > targetIndex;
|
|
1378
|
+
});
|
|
1379
|
+
|
|
1380
|
+
const finalPosition = insertPosition === -1 ? this._pinnedChannels.length : insertPosition;
|
|
1381
|
+
this._pinnedChannels.splice(finalPosition, 0, channel);
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
return { addedChannels, updatedChannels, unmatchedChannelUrls };
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
/**
|
|
1388
|
+
* Upserts regular (non-pinned) channels with time-based sorting.
|
|
1389
|
+
* @param channels - Regular channels to upsert
|
|
1390
|
+
* @param forceAppend - Whether to force append channels at the end regardless of hasMore status
|
|
1391
|
+
* @returns Object containing added, updated channels and unmatched URLs
|
|
1392
|
+
*/
|
|
1393
|
+
private _upsertRegularChannelsToArray(
|
|
1394
|
+
channels: GroupChannel[],
|
|
1395
|
+
forceAppend = false,
|
|
1396
|
+
): { addedChannels: GroupChannel[]; updatedChannels: GroupChannel[]; unmatchedChannelUrls: string[] } {
|
|
1397
|
+
const unmatchedChannelUrls: string[] = [];
|
|
1398
|
+
|
|
1399
|
+
const addedChannels: GroupChannel[] = [];
|
|
1400
|
+
const updatedChannels: GroupChannel[] = [];
|
|
1401
|
+
|
|
1402
|
+
for (const channel of channels) {
|
|
1403
|
+
if (!this._query.belongsTo(channel)) {
|
|
1404
|
+
unmatchedChannelUrls.push(channel.url);
|
|
1405
|
+
continue;
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
const oldPosition = indexOfChannel(this._channels, channel);
|
|
1409
|
+
const isNewChannel = oldPosition < 0;
|
|
1410
|
+
const shouldRemoveBeforeInsert = !isNewChannel;
|
|
1411
|
+
|
|
1412
|
+
if (shouldRemoveBeforeInsert) {
|
|
1413
|
+
this._channels.splice(oldPosition, 1);
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
const insertionIndex = placeOfChannel(this._channels, channel, this._order).place;
|
|
1417
|
+
const isAtEnd = insertionIndex === this._channels.length;
|
|
1418
|
+
|
|
1419
|
+
if (isNewChannel) {
|
|
1420
|
+
if (isAtEnd) {
|
|
1421
|
+
if (forceAppend || !this.hasMore) {
|
|
1422
|
+
this._channels.push(channel);
|
|
1423
|
+
addedChannels.push(channel);
|
|
1424
|
+
}
|
|
1425
|
+
} else {
|
|
1426
|
+
this._channels.splice(insertionIndex, 0, channel);
|
|
1427
|
+
addedChannels.push(channel);
|
|
1428
|
+
}
|
|
1429
|
+
} else {
|
|
1430
|
+
this._channels.splice(insertionIndex, 0, channel);
|
|
1431
|
+
updatedChannels.push(channel);
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
return { addedChannels, updatedChannels, unmatchedChannelUrls };
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
/**
|
|
1439
|
+
* Adds or updates channels in the collection, separating pinned and non-pinned channels.
|
|
1440
|
+
* @param channels - Channels to add or update
|
|
1441
|
+
* @param forceAppend - Whether to force append channels at the end
|
|
1442
|
+
*/
|
|
1443
|
+
private _addChannelsToView(channels: GroupChannel[], forceAppend = false): void {
|
|
1444
|
+
const pinnedUrlsSet = new Set(this.filter?.pinnedChannelUrls ?? []);
|
|
1445
|
+
|
|
1446
|
+
const pinnedChannels: GroupChannel[] = [];
|
|
1447
|
+
const regularChannels: GroupChannel[] = [];
|
|
1448
|
+
|
|
1449
|
+
for (const channel of channels) {
|
|
1450
|
+
if (pinnedUrlsSet.has(channel.url)) {
|
|
1451
|
+
pinnedChannels.push(channel);
|
|
1452
|
+
} else {
|
|
1453
|
+
regularChannels.push(channel);
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
const pinnedResult = this._upsertPinnedChannelsToArray(pinnedChannels);
|
|
1458
|
+
const regularResult = this._upsertRegularChannelsToArray(regularChannels, forceAppend);
|
|
1459
|
+
|
|
1460
|
+
const addedChannels = pinnedResult.addedChannels.concat(regularResult.addedChannels);
|
|
1461
|
+
const updatedChannels = pinnedResult.updatedChannels.concat(regularResult.updatedChannels);
|
|
1462
|
+
const unmatchedChannelUrls = pinnedResult.unmatchedChannelUrls.concat(regularResult.unmatchedChannelUrls);
|
|
1463
|
+
|
|
1464
|
+
if (addedChannels.length > 0) this._collectionEventHandler?.onChannelsAdded?.({}, addedChannels);
|
|
1465
|
+
if (updatedChannels.length > 0) this._collectionEventHandler?.onChannelsUpdated?.({}, updatedChannels);
|
|
1466
|
+
if (unmatchedChannelUrls.length > 0) this._removeChannelsFromView(unmatchedChannelUrls);
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
/**
|
|
1470
|
+
* Removes channels from the collection by their URLs.
|
|
1471
|
+
* @param channelUrls - Array of channel URLs to remove
|
|
1472
|
+
*/
|
|
1473
|
+
private _removeChannelsFromView(channelUrls: string[]) {
|
|
1474
|
+
const pinnedUrlsSet = new Set(this.filter?.pinnedChannelUrls ?? []);
|
|
1475
|
+
const removedChannelUrls: string[] = [];
|
|
1476
|
+
|
|
1477
|
+
for (const channelUrl of channelUrls) {
|
|
1478
|
+
if (pinnedUrlsSet.has(channelUrl)) {
|
|
1479
|
+
const index = this._pinnedChannels.findIndex((channel) => channel.url === channelUrl);
|
|
1480
|
+
if (index >= 0) {
|
|
1481
|
+
removedChannelUrls.push(channelUrl);
|
|
1482
|
+
this._pinnedChannels.splice(index, 1);
|
|
1483
|
+
}
|
|
1484
|
+
} else {
|
|
1485
|
+
const index = this._channels.findIndex((channel) => channel.url === channelUrl);
|
|
1486
|
+
if (index >= 0) {
|
|
1487
|
+
removedChannelUrls.push(channelUrl);
|
|
1488
|
+
this._channels.splice(index, 1);
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
if (removedChannelUrls.length > 0) this._collectionEventHandler?.onChannelsDeleted?.({}, removedChannelUrls);
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
/**
|
|
1497
|
+
* Gets all channels in the collection.
|
|
1498
|
+
* Pinned channels are always returned first, followed by non-pinned channels.
|
|
1499
|
+
* @returns Array of GroupChannel objects
|
|
1500
|
+
*/
|
|
1501
|
+
public get channels(): GroupChannel[] {
|
|
1502
|
+
return this._isDisposed ? [] : [...this._pinnedChannels, ...this._channels];
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
/**
|
|
1506
|
+
* Indicates whether the collection has more channels to load.
|
|
1507
|
+
* @returns True if more channels can be loaded, false otherwise
|
|
1508
|
+
*/
|
|
1509
|
+
public get hasMore(): boolean {
|
|
1510
|
+
return this._isDisposed ? false : this._query.hasNext;
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
/**
|
|
1514
|
+
* Loads the next batch of channels from the server.
|
|
1515
|
+
* @returns Promise that resolves to an array of newly loaded channels
|
|
1516
|
+
*/
|
|
1517
|
+
public async loadMore(): Promise<GroupChannel[]> {
|
|
1518
|
+
if (this._isDisposed) return [];
|
|
1519
|
+
|
|
1520
|
+
if (this.hasMore) {
|
|
1521
|
+
const channels = await this._query.next();
|
|
1522
|
+
|
|
1523
|
+
this._setDefaultChangelogsSyncTimestamp(channels);
|
|
1524
|
+
this._addChannelsToView(channels, true);
|
|
1525
|
+
return channels;
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
return [];
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
/**
|
|
1532
|
+
* Sets the event handler for collection updates.
|
|
1533
|
+
* @param handler - Event handler for channel collection changes
|
|
1534
|
+
*/
|
|
1535
|
+
public setConversationListCollectionHandler(handler: ConversationListCollectionEventHandler): void {
|
|
1536
|
+
this._collectionEventHandler = handler;
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
/**
|
|
1540
|
+
* Disposes the collection and cleans up all resources.
|
|
1541
|
+
* Stops all event handlers and clears all channels.
|
|
1542
|
+
*/
|
|
1543
|
+
public dispose(): void {
|
|
1544
|
+
if (this._isDisposed) return;
|
|
1545
|
+
|
|
1546
|
+
this._isDisposed = true;
|
|
1547
|
+
this._throttledOnChannelChanged.cancel();
|
|
1548
|
+
this._collectionEventHandler = undefined;
|
|
1549
|
+
this._sdk.removeConnectionHandler(this._handlerId);
|
|
1550
|
+
this._sdk.groupChannel.removeGroupChannelHandler(this._handlerId);
|
|
1551
|
+
this._pinnedChannels.length = 0;
|
|
1552
|
+
this._channels.length = 0;
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
declare interface ConversationListCollectionEventHandler {
|
|
1557
|
+
/** Called when there are newly added {@link GroupChannel}s. */
|
|
1558
|
+
onChannelsAdded?: (context: ConversationListContext_2, channels: GroupChannel[]) => void;
|
|
1559
|
+
/** Called when there's an update in one or more of the {@link GroupChannel}s that `GroupChannelCollection` holds. */
|
|
1560
|
+
onChannelsUpdated?: (context: ConversationListContext_2, channels: GroupChannel[]) => void;
|
|
1561
|
+
/** Called when one or more of the {@link GroupChannel}s that `GroupChannelCollection` holds has been deleted. */
|
|
1562
|
+
onChannelsDeleted?: (context: ConversationListContext_2, channelUrls: string[]) => void;
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1021
1565
|
/**
|
|
1022
1566
|
* Parameters for creating a ConversationListCollection instance.
|
|
1023
1567
|
*/
|
|
@@ -1030,6 +1574,8 @@ declare interface ConversationListCollectionParams {
|
|
|
1030
1574
|
|
|
1031
1575
|
export declare const ConversationListContext: Context<ConversationListContextValue | null>;
|
|
1032
1576
|
|
|
1577
|
+
declare interface ConversationListContext_2 {}
|
|
1578
|
+
|
|
1033
1579
|
declare interface ConversationListContextProps extends PropsWithChildren {
|
|
1034
1580
|
conversationListLimit?: number;
|
|
1035
1581
|
conversationListFilter?: Partial<AIAgentGroupChannelFilter>;
|
|
@@ -1216,6 +1762,68 @@ export declare interface DateSeparatorProps extends ViewProps {
|
|
|
1216
1762
|
date?: Date | number;
|
|
1217
1763
|
}
|
|
1218
1764
|
|
|
1765
|
+
export declare interface DeskClientInterface {
|
|
1766
|
+
/** Gets a ticket by its ID. */
|
|
1767
|
+
getTicket(id: number): Promise<DeskTicketInterface>;
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
export declare interface DeskTicketAgent {
|
|
1771
|
+
/** The agent's user ID. */
|
|
1772
|
+
readonly userId: string;
|
|
1773
|
+
/** The agent's display name. */
|
|
1774
|
+
readonly name: string;
|
|
1775
|
+
/** The agent's profile image URL. */
|
|
1776
|
+
readonly profileUrl: string;
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
export declare interface DeskTicketInterface {
|
|
1780
|
+
/** The ticket ID. */
|
|
1781
|
+
readonly id: number;
|
|
1782
|
+
/** The ticket title. */
|
|
1783
|
+
readonly title: string | null;
|
|
1784
|
+
/** The ticket status. Corresponds to the Desk Ticket's `status2` value. */
|
|
1785
|
+
readonly status: DeskTicketStatus;
|
|
1786
|
+
/** The agent assigned to this ticket. */
|
|
1787
|
+
readonly agent: DeskTicketAgent | null;
|
|
1788
|
+
/** The ticket priority. */
|
|
1789
|
+
readonly priority: DeskTicketPriority;
|
|
1790
|
+
/** The ticket group. */
|
|
1791
|
+
readonly group: number;
|
|
1792
|
+
/** The first response time in seconds. Returns -1 if there is no response. */
|
|
1793
|
+
readonly firstResponseTime: number;
|
|
1794
|
+
/** The timestamp when the ticket was issued. */
|
|
1795
|
+
readonly issuedAt: string | null;
|
|
1796
|
+
/** Custom fields set on this ticket. */
|
|
1797
|
+
readonly customFields: Record<string, string>;
|
|
1798
|
+
/** Refreshes all the data of this ticket from the server. */
|
|
1799
|
+
refresh(): Promise<DeskTicketInterface>;
|
|
1800
|
+
}
|
|
1801
|
+
|
|
1802
|
+
export declare enum DeskTicketPriority {
|
|
1803
|
+
URGENT = 'URGENT',
|
|
1804
|
+
HIGH = 'HIGH',
|
|
1805
|
+
/** This is the default. */
|
|
1806
|
+
MEDIUM = 'MEDIUM',
|
|
1807
|
+
LOW = 'LOW',
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
export declare enum DeskTicketStatus {
|
|
1811
|
+
/** Ticket has been created, but the customer has not started chatting yet. */
|
|
1812
|
+
INITIALIZED = 'INITIALIZED',
|
|
1813
|
+
/** Ticket created via proactive chat. */
|
|
1814
|
+
PROACTIVE = 'PROACTIVE',
|
|
1815
|
+
/** No agent has been assigned yet. */
|
|
1816
|
+
PENDING = 'PENDING',
|
|
1817
|
+
/** An agent has been assigned and the ticket is being handled. */
|
|
1818
|
+
ACTIVE = 'ACTIVE',
|
|
1819
|
+
/** The ticket has been closed. */
|
|
1820
|
+
CLOSED = 'CLOSED',
|
|
1821
|
+
/** The ticket is in progress. */
|
|
1822
|
+
WORK_IN_PROGRESS = 'WORK_IN_PROGRESS',
|
|
1823
|
+
/** The assignment is in an idle state. */
|
|
1824
|
+
IDLE = 'IDLE',
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1219
1827
|
declare interface Dispatcher {
|
|
1220
1828
|
send(command: BaseCommand): Promise<void>;
|
|
1221
1829
|
subscribe<E extends CommandType>(eventType: E, callback: (payload: CommandPayloads[E]) => void | Promise<void>): void;
|
|
@@ -1490,6 +2098,7 @@ BaseMessageProps<{
|
|
|
1490
2098
|
nickname: string;
|
|
1491
2099
|
profileUrl?: string;
|
|
1492
2100
|
};
|
|
2101
|
+
thinkingMessage?: string;
|
|
1493
2102
|
|
|
1494
2103
|
// flags
|
|
1495
2104
|
suggestedRepliesVisible?: boolean;
|
|
@@ -1542,7 +2151,7 @@ export declare const IncomingMessageLayout: {
|
|
|
1542
2151
|
containerStyle?: ViewStyle;
|
|
1543
2152
|
}) => JSX.Element | null;
|
|
1544
2153
|
MessageBody: (props: IncomingMessageBodyProps) => JSX.Element;
|
|
1545
|
-
TypingIndicator: ({ customStyle, containerStyle }: IncomingMessageProps & {
|
|
2154
|
+
TypingIndicator: ({ thinkingMessage, customStyle, containerStyle }: IncomingMessageProps & {
|
|
1546
2155
|
containerStyle?: ViewStyle;
|
|
1547
2156
|
customStyle?: {
|
|
1548
2157
|
bubbleContentColor?: string;
|
|
@@ -1566,6 +2175,7 @@ export declare const IncomingMessageLayout: {
|
|
|
1566
2175
|
nickname: string;
|
|
1567
2176
|
profileUrl?: string;
|
|
1568
2177
|
};
|
|
2178
|
+
thinkingMessage?: string;
|
|
1569
2179
|
suggestedRepliesVisible?: boolean;
|
|
1570
2180
|
suggestedRepliesDirection?: "vertical" | "horizontal";
|
|
1571
2181
|
isBotMessage?: boolean;
|
|
@@ -1638,6 +2248,7 @@ export declare const IncomingMessageLayout: {
|
|
|
1638
2248
|
nickname: string;
|
|
1639
2249
|
profileUrl?: string;
|
|
1640
2250
|
};
|
|
2251
|
+
thinkingMessage?: string;
|
|
1641
2252
|
suggestedRepliesVisible?: boolean;
|
|
1642
2253
|
suggestedRepliesDirection?: "vertical" | "horizontal";
|
|
1643
2254
|
isBotMessage?: boolean;
|
|
@@ -1710,6 +2321,7 @@ export declare const IncomingMessageLayout: {
|
|
|
1710
2321
|
nickname: string;
|
|
1711
2322
|
profileUrl?: string;
|
|
1712
2323
|
};
|
|
2324
|
+
thinkingMessage?: string;
|
|
1713
2325
|
suggestedRepliesVisible?: boolean;
|
|
1714
2326
|
suggestedRepliesDirection?: "vertical" | "horizontal";
|
|
1715
2327
|
isBotMessage?: boolean;
|
|
@@ -1791,7 +2403,7 @@ export declare const IncomingMessageLayout: {
|
|
|
1791
2403
|
containerStyle?: ViewStyle;
|
|
1792
2404
|
}) => JSX.Element | null;
|
|
1793
2405
|
MessageBody: (props: IncomingMessageBodyProps) => JSX.Element;
|
|
1794
|
-
TypingIndicator: ({ customStyle, containerStyle }: IncomingMessageProps & {
|
|
2406
|
+
TypingIndicator: ({ thinkingMessage, customStyle, containerStyle }: IncomingMessageProps & {
|
|
1795
2407
|
containerStyle?: ViewStyle;
|
|
1796
2408
|
customStyle?: {
|
|
1797
2409
|
bubbleContentColor?: string;
|
|
@@ -1815,6 +2427,7 @@ export declare const IncomingMessageLayout: {
|
|
|
1815
2427
|
nickname: string;
|
|
1816
2428
|
profileUrl?: string;
|
|
1817
2429
|
};
|
|
2430
|
+
thinkingMessage?: string;
|
|
1818
2431
|
suggestedRepliesVisible?: boolean;
|
|
1819
2432
|
suggestedRepliesDirection?: "vertical" | "horizontal";
|
|
1820
2433
|
isBotMessage?: boolean;
|
|
@@ -1887,6 +2500,7 @@ export declare const IncomingMessageLayout: {
|
|
|
1887
2500
|
nickname: string;
|
|
1888
2501
|
profileUrl?: string;
|
|
1889
2502
|
};
|
|
2503
|
+
thinkingMessage?: string;
|
|
1890
2504
|
suggestedRepliesVisible?: boolean;
|
|
1891
2505
|
suggestedRepliesDirection?: "vertical" | "horizontal";
|
|
1892
2506
|
isBotMessage?: boolean;
|
|
@@ -1959,6 +2573,7 @@ export declare const IncomingMessageLayout: {
|
|
|
1959
2573
|
nickname: string;
|
|
1960
2574
|
profileUrl?: string;
|
|
1961
2575
|
};
|
|
2576
|
+
thinkingMessage?: string;
|
|
1962
2577
|
suggestedRepliesVisible?: boolean;
|
|
1963
2578
|
suggestedRepliesDirection?: "vertical" | "horizontal";
|
|
1964
2579
|
isBotMessage?: boolean;
|
|
@@ -2035,7 +2650,7 @@ export declare const IncomingMessageLayout: {
|
|
|
2035
2650
|
containerStyle?: ViewStyle;
|
|
2036
2651
|
}) => JSX.Element | null;
|
|
2037
2652
|
MessageBody: (props: IncomingMessageBodyProps) => JSX.Element;
|
|
2038
|
-
TypingIndicator: ({ customStyle, containerStyle }: IncomingMessageProps & {
|
|
2653
|
+
TypingIndicator: ({ thinkingMessage, customStyle, containerStyle }: IncomingMessageProps & {
|
|
2039
2654
|
containerStyle?: ViewStyle;
|
|
2040
2655
|
customStyle?: {
|
|
2041
2656
|
bubbleContentColor?: string;
|
|
@@ -2059,6 +2674,7 @@ export declare const IncomingMessageLayout: {
|
|
|
2059
2674
|
nickname: string;
|
|
2060
2675
|
profileUrl?: string;
|
|
2061
2676
|
};
|
|
2677
|
+
thinkingMessage?: string;
|
|
2062
2678
|
suggestedRepliesVisible?: boolean;
|
|
2063
2679
|
suggestedRepliesDirection?: "vertical" | "horizontal";
|
|
2064
2680
|
isBotMessage?: boolean;
|
|
@@ -2131,6 +2747,7 @@ export declare const IncomingMessageLayout: {
|
|
|
2131
2747
|
nickname: string;
|
|
2132
2748
|
profileUrl?: string;
|
|
2133
2749
|
};
|
|
2750
|
+
thinkingMessage?: string;
|
|
2134
2751
|
suggestedRepliesVisible?: boolean;
|
|
2135
2752
|
suggestedRepliesDirection?: "vertical" | "horizontal";
|
|
2136
2753
|
isBotMessage?: boolean;
|
|
@@ -2203,6 +2820,7 @@ export declare const IncomingMessageLayout: {
|
|
|
2203
2820
|
nickname: string;
|
|
2204
2821
|
profileUrl?: string;
|
|
2205
2822
|
};
|
|
2823
|
+
thinkingMessage?: string;
|
|
2206
2824
|
suggestedRepliesVisible?: boolean;
|
|
2207
2825
|
suggestedRepliesDirection?: "vertical" | "horizontal";
|
|
2208
2826
|
isBotMessage?: boolean;
|
|
@@ -2288,7 +2906,7 @@ export declare const IncomingMessageLayout: {
|
|
|
2288
2906
|
component: (props: IncomingMessageBodyProps) => JSX.Element;
|
|
2289
2907
|
}) => null;
|
|
2290
2908
|
TypingIndicator: (props: {
|
|
2291
|
-
component: ({ customStyle, containerStyle }: IncomingMessageProps & {
|
|
2909
|
+
component: ({ thinkingMessage, customStyle, containerStyle }: IncomingMessageProps & {
|
|
2292
2910
|
containerStyle?: ViewStyle;
|
|
2293
2911
|
customStyle?: {
|
|
2294
2912
|
bubbleContentColor?: string;
|
|
@@ -2318,6 +2936,7 @@ export declare const IncomingMessageLayout: {
|
|
|
2318
2936
|
nickname: string;
|
|
2319
2937
|
profileUrl?: string;
|
|
2320
2938
|
};
|
|
2939
|
+
thinkingMessage?: string;
|
|
2321
2940
|
suggestedRepliesVisible?: boolean;
|
|
2322
2941
|
suggestedRepliesDirection?: "vertical" | "horizontal";
|
|
2323
2942
|
isBotMessage?: boolean;
|
|
@@ -2390,6 +3009,7 @@ export declare const IncomingMessageLayout: {
|
|
|
2390
3009
|
nickname: string;
|
|
2391
3010
|
profileUrl?: string;
|
|
2392
3011
|
};
|
|
3012
|
+
thinkingMessage?: string;
|
|
2393
3013
|
suggestedRepliesVisible?: boolean;
|
|
2394
3014
|
suggestedRepliesDirection?: "vertical" | "horizontal";
|
|
2395
3015
|
isBotMessage?: boolean;
|
|
@@ -2462,6 +3082,7 @@ export declare const IncomingMessageLayout: {
|
|
|
2462
3082
|
nickname: string;
|
|
2463
3083
|
profileUrl?: string;
|
|
2464
3084
|
};
|
|
3085
|
+
thinkingMessage?: string;
|
|
2465
3086
|
suggestedRepliesVisible?: boolean;
|
|
2466
3087
|
suggestedRepliesDirection?: "vertical" | "horizontal";
|
|
2467
3088
|
isBotMessage?: boolean;
|
|
@@ -2577,6 +3198,7 @@ declare type InputState = {
|
|
|
2577
3198
|
| 'conversation_closed'
|
|
2578
3199
|
| 'suggested_replies'
|
|
2579
3200
|
| 'reconnecting'
|
|
3201
|
+
| 'handoff_pending'
|
|
2580
3202
|
| (string & {});
|
|
2581
3203
|
};
|
|
2582
3204
|
|
|
@@ -2767,6 +3389,8 @@ declare interface MessengerSettingsResponse {
|
|
|
2767
3389
|
supported_file_mime_types: string[];
|
|
2768
3390
|
max_attachment_count?: number;
|
|
2769
3391
|
};
|
|
3392
|
+
language: string | null;
|
|
3393
|
+
country: string | null;
|
|
2770
3394
|
}
|
|
2771
3395
|
|
|
2772
3396
|
declare interface MessengerSettingsUpdatedParams {
|
|
@@ -3216,6 +3840,11 @@ declare type TextField = {
|
|
|
3216
3840
|
};
|
|
3217
3841
|
};
|
|
3218
3842
|
|
|
3843
|
+
declare interface ThrottledFunction<T extends (...args: any[]) => any> {
|
|
3844
|
+
(...args: Parameters<T>): void;
|
|
3845
|
+
cancel: () => void;
|
|
3846
|
+
}
|
|
3847
|
+
|
|
3219
3848
|
declare interface TimerData {
|
|
3220
3849
|
startTime: number | null;
|
|
3221
3850
|
endTime: number | null;
|
|
@@ -3268,10 +3897,13 @@ export declare const useNativeAdapterContext: {
|
|
|
3268
3897
|
displayName: string;
|
|
3269
3898
|
};
|
|
3270
3899
|
|
|
3271
|
-
|
|
3900
|
+
/**
|
|
3901
|
+
* User session containing authentication credentials.
|
|
3902
|
+
*/
|
|
3903
|
+
declare interface UserSession {
|
|
3272
3904
|
userId: string;
|
|
3273
3905
|
authToken: string;
|
|
3274
|
-
}
|
|
3906
|
+
}
|
|
3275
3907
|
|
|
3276
3908
|
/**
|
|
3277
3909
|
* @deprecated Please use `ManualSessionInfo` or `AnonymousSessionInfo` instead.
|