@sendbird/ai-agent-messenger-react 1.28.0 → 1.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,12 +1,10 @@
1
1
  import { Action } from '@sendbird/uikit-message-template';
2
2
  import type { AIAgentChannelFilter } from '@sendbird/chat/aiAgent';
3
- import type { AIAgentGroupChannelListQuery } from '@sendbird/chat/aiAgent';
4
3
  import type { AIAgentModule } from '@sendbird/chat/aiAgent';
5
- import type { BaseChannel } from '@sendbird/chat';
4
+ import type { BaseChannelCollectionEventHandler } from '@sendbird/chat/groupChannel';
6
5
  import type { BaseMessage } from '@sendbird/chat/message';
7
6
  import type { CollectionEventSource } from '@sendbird/chat';
8
7
  import { ComponentType } from 'react';
9
- import type { ConnectionHandler } from '@sendbird/chat';
10
8
  import { Context } from 'react';
11
9
  import type { Conversation as Conversation_2 } from '@sendbird/chat/aiAgent';
12
10
  import type { ConversationStatus } from '@sendbird/chat/aiAgent';
@@ -17,9 +15,6 @@ import type { FileMessageCreateParams } from '@sendbird/chat/message';
17
15
  import { format } from 'date-fns';
18
16
  import { ForwardRefExoticComponent } from 'react';
19
17
  import type { GroupChannel } from '@sendbird/chat/groupChannel';
20
- import type { GroupChannelChangelogs } from '@sendbird/chat/aiAgent';
21
- import type { GroupChannelHandler } from '@sendbird/chat/groupChannel';
22
- import type { GroupChannelListOrder } from '@sendbird/chat/groupChannel';
23
18
  import type { GroupChannelModule } from '@sendbird/chat/groupChannel';
24
19
  import { JSX } from 'react/jsx-runtime';
25
20
  import type { Locale } from 'date-fns';
@@ -528,6 +523,15 @@ declare interface AIAgentConfig_2 {
528
523
  downloadEnabled: boolean;
529
524
  };
530
525
  };
526
+ launcher: {
527
+ /**
528
+ * Whether to show a red-dot badge on the launcher when there are unread
529
+ * messages in AI agent channels. The count is fetched once on connect and
530
+ * again after each successful reconnect (not in real time).
531
+ * @default false
532
+ * */
533
+ unreadBadgeEnabled: boolean;
534
+ };
531
535
  }
532
536
 
533
537
  declare interface AIAgentContextValue {
@@ -727,7 +731,7 @@ declare interface AIAgentInterface {
727
731
  /** Closes an open conversation */
728
732
  closeConversation: (channelUrl: string) => Promise<void>;
729
733
  /** Creates a collection for paginating through conversations */
730
- createConversationListCollection: (params?: ConversationListCollectionParams) => ConversationListCollection;
734
+ createConversationListCollection: (params?: ConversationListCollectionParams) => ConversationListCollectionInterface;
731
735
  /** Patches (merges) context data for the specified channel */
732
736
  patchContext: (channelUrl: string, context: Record<string, string>) => Promise<ContextObject>;
733
737
  /** Replaces the entire context data for the specified channel */
@@ -1119,6 +1123,7 @@ declare interface AIAgentStringSet {
1119
1123
  a11y_conversation_closed: string;
1120
1124
  a11y_file_image: (name: string) => string;
1121
1125
  a11y_file_video: (name: string) => string;
1126
+ a11y_file_pdf: (name: string) => string;
1122
1127
  a11y_file_document: (name: string) => string;
1123
1128
  a11y_received_file_image: string;
1124
1129
  a11y_received_file_video: string;
@@ -1309,20 +1314,29 @@ declare type CachedMessengerSettings = Omit<MessengerSettingsResponse, 'memory'>
1309
1314
  memory?: MessengerSettingsResponse['memory'];
1310
1315
  };
1311
1316
 
1312
- declare type ChatSDKAIAgentChannelFilter = AIAgentChannelFilter;
1317
+ export declare type ChallengeActionParams = {
1318
+ key: string;
1319
+ requestId: string;
1320
+ action: 'submit' | 'cancel';
1321
+ data?: Record<string, unknown>;
1322
+ };
1313
1323
 
1314
- declare type ChatSDKAIAgentGroupChannelListQuery = AIAgentGroupChannelListQuery;
1324
+ export declare interface ChallengeInfo {
1325
+ key: string;
1326
+ request_id: string;
1327
+ status: 'pending' | 'succeeded' | 'failed' | 'canceled' | (string & {});
1328
+ }
1329
+
1330
+ declare type ChatSDKAIAgentChannelFilter = AIAgentChannelFilter;
1315
1331
 
1316
1332
  declare type ChatSDKAIAgentModule = AIAgentModule;
1317
1333
 
1318
- declare type ChatSDKBaseChannel = BaseChannel;
1334
+ declare type ChatSDKBaseChannelCollectionEventHandler = BaseChannelCollectionEventHandler;
1319
1335
 
1320
1336
  declare type ChatSDKBaseMessage = BaseMessage;
1321
1337
 
1322
1338
  declare type ChatSDKCollectionEventSource = CollectionEventSource;
1323
1339
 
1324
- declare type ChatSDKConnectionHandler = ConnectionHandler;
1325
-
1326
1340
  declare type ChatSDKConversation = Conversation_2;
1327
1341
 
1328
1342
  declare type ChatSDKConversationStatus = ConversationStatus;
@@ -1335,12 +1349,6 @@ declare type ChatSDKFileMessageCreateParams = FileMessageCreateParams;
1335
1349
 
1336
1350
  declare type ChatSDKGroupChannel = GroupChannel;
1337
1351
 
1338
- declare type ChatSDKGroupChannelChangelogs = GroupChannelChangelogs;
1339
-
1340
- declare type ChatSDKGroupChannelHandler = GroupChannelHandler;
1341
-
1342
- declare type ChatSDKGroupChannelListOrder = GroupChannelListOrder;
1343
-
1344
1352
  declare type ChatSDKGroupChannelModule = GroupChannelModule;
1345
1353
 
1346
1354
  declare type ChatSDKLogLevel = LogLevel_2;
@@ -1798,382 +1806,15 @@ declare interface ConversationLayoutTemplateProps {
1798
1806
  export declare const ConversationList: ({ conversationListLimit, conversationListFilter, children, onOpenConversationView, announcementsEnabled, style, }: Props_4) => JSX.Element;
1799
1807
 
1800
1808
  /**
1801
- * A collection for managing AI agent group channels with real-time updates and pagination.
1802
- * Automatically separates pinned and non-pinned channels, with pinned channels prioritized at the top.
1809
+ * Public interface for ConversationListCollection.
1810
+ * Exposes only the public contract without leaking internal BaseChannelCollection generics.
1803
1811
  */
1804
- declare class ConversationListCollection {
1805
- /** The filter configuration used for this collection */
1806
- readonly filter?: AIAgentGroupChannelFilter;
1807
-
1808
- private _sdk: ChatSDKType;
1809
- private _pinnedChannels: ChatSDKGroupChannel[];
1810
- private _channels: ChatSDKGroupChannel[];
1811
-
1812
- private _isDisposed = false;
1813
- private _handlerId = `handler-id-${Date.now()}`;
1814
- private _order: ChatSDKGroupChannelListOrder = GroupChannelListOrder.LATEST_LAST_MESSAGE;
1815
-
1816
- private _limit: number;
1817
- private _query: ChatSDKAIAgentGroupChannelListQuery;
1818
-
1819
- private _token: string;
1820
- private _timestamp: number;
1821
- private _isSyncing: boolean;
1822
-
1823
- private _channelHandler: ChatSDKGroupChannelHandler;
1824
- private _connectionHandler: ChatSDKConnectionHandler;
1825
- private _collectionEventHandler?: ConversationListCollectionEventHandler;
1826
- private _throttledOnChannelChanged: ThrottledFunction<(channel: ChatSDKBaseChannel) => void>;
1827
-
1828
- /**
1829
- * Creates a new ConversationListCollection instance.
1830
- * @param sdk - The Sendbird Chat SDK instance
1831
- * @param params - Configuration parameters for the collection
1832
- */
1833
- constructor(sdk: ChatSDKType, { filter, limit = 20 }: ConversationListCollectionParams) {
1834
- this.filter = filter;
1835
-
1836
- this._sdk = sdk;
1837
- this._pinnedChannels = [];
1838
- this._channels = [];
1839
-
1840
- this._limit = limit;
1841
- this._query = this._sdk.aiAgent.createMyGroupChannelListQuery({
1842
- aiAgentChannelFilter: this.filter?.aiAgentChannelFilter,
1843
- aiAgentConversationStatusFilter: this.filter?.aiAgentConversationStatusFilter,
1844
- aiAgentIds: this.filter?.aiAgentIds,
1845
- deskChannelFilter: this.filter?.deskChannelFilter,
1846
- pinnedChannelUrls: this.filter?.pinnedChannelUrls,
1847
- copilotConversationOnly: this.filter?.copilotConversationOnly,
1848
- copilotSupportChannelUrl: this.filter?.copilotSupportChannelUrl,
1849
- limit: this._limit,
1850
- });
1851
-
1852
- this._token = '';
1853
- this._timestamp = Number.MAX_SAFE_INTEGER;
1854
- this._isSyncing = false;
1855
-
1856
- this._throttledOnChannelChanged = throttle(
1857
- (channel: ChatSDKGroupChannel) => {
1858
- if (this._query.belongsTo(channel)) {
1859
- this._addChannelsToView([channel], false);
1860
- } else {
1861
- this._removeChannelsFromView([channel.url]);
1862
- }
1863
- },
1864
- 250,
1865
- { trailing: false, leading: true },
1866
- );
1867
-
1868
- this._channelHandler = new GroupChannelHandler({
1869
- onChannelChanged: (channel) => {
1870
- if (!channel.isGroupChannel()) return;
1871
- this._throttledOnChannelChanged(channel);
1872
- },
1873
- onChannelDeleted: (channelUrl) => {
1874
- this._removeChannelsFromView([channelUrl]);
1875
- },
1876
- });
1877
-
1878
- this._connectionHandler = new ConnectionHandler({
1879
- onReconnectSucceeded: () => {
1880
- if (this._isDefaultChangelogSyncTimestampUpdated) this._syncChannelChangelogs();
1881
- },
1882
- });
1883
-
1884
- this._sdk.addConnectionHandler(this._handlerId, this._connectionHandler);
1885
- this._sdk.groupChannel.addGroupChannelHandler(this._handlerId, this._channelHandler);
1886
- }
1887
-
1888
- /**
1889
- * Checks if the default changelog sync timestamp has been updated.
1890
- */
1891
- private get _isDefaultChangelogSyncTimestampUpdated() {
1892
- return this._timestamp !== Number.MAX_SAFE_INTEGER;
1893
- }
1894
-
1895
- /**
1896
- * Sets the default changelog sync timestamp based on the first non-pinned channel.
1897
- * @param channels - Array of channels to analyze
1898
- */
1899
- private _setDefaultChangelogsSyncTimestamp(channels: ChatSDKGroupChannel[]) {
1900
- const pinnedUrlsSet = new Set(this.filter?.pinnedChannelUrls ?? []);
1901
- const firstChannel = channels.find((it) => {
1902
- return !pinnedUrlsSet.has(it.url);
1903
- });
1904
-
1905
- let candidate: number;
1906
- if (firstChannel) {
1907
- candidate = firstChannel.lastMessage?.createdAt ?? firstChannel.createdAt;
1908
- } else {
1909
- candidate = this._query.lastResponseAt;
1910
- }
1911
-
1912
- if (this._timestamp > candidate) {
1913
- this._timestamp = candidate;
1914
- }
1915
- }
1916
-
1917
- /**
1918
- * Synchronizes channel changelogs to keep the collection up-to-date.
1919
- * @returns Promise that resolves to an empty array
1920
- */
1921
- private async _syncChannelChangelogs(): Promise<ChatSDKGroupChannel[]> {
1922
- if (this._isDisposed) return [];
1923
- if (this._isSyncing) return [];
1924
-
1925
- try {
1926
- this._isSyncing = true;
1927
- let response: ChatSDKGroupChannelChangelogs;
1928
-
1929
- if (this._token) {
1930
- response = await this._sdk.aiAgent.getMyGroupChannelChangeLogsByToken(this._token, this.filter);
1931
- } else {
1932
- response = await this._sdk.aiAgent.getMyGroupChannelChangeLogsByTimestamp(this._timestamp, this.filter);
1933
- }
1934
- this._token = response.token;
1935
- this._addChannelsToView(response.updatedChannels);
1936
- this._removeChannelsFromView(response.deletedChannelUrls);
1937
-
1938
- while (response.hasMore && !!response.token) {
1939
- response = await this._sdk.aiAgent.getMyGroupChannelChangeLogsByToken(this._token, this.filter);
1940
- this._token = response.token;
1941
- this._addChannelsToView(response.updatedChannels);
1942
- this._removeChannelsFromView(response.deletedChannelUrls);
1943
- }
1944
- } catch (error) {
1945
- // Silently handle changelog sync errors to prevent disrupting the collection
1946
- // The collection will continue to work with existing data
1947
- } finally {
1948
- this._isSyncing = false;
1949
- }
1950
- return [];
1951
- }
1952
-
1953
- /**
1954
- * Upserts pinned channels maintaining the order specified in pinnedChannelUrls.
1955
- * @param channels - Pinned channels to upsert
1956
- * @returns Object containing added, updated channels and unmatched URLs
1957
- */
1958
- private _upsertPinnedChannelsToArray(channels: ChatSDKGroupChannel[]): {
1959
- addedChannels: ChatSDKGroupChannel[];
1960
- updatedChannels: ChatSDKGroupChannel[];
1961
- unmatchedChannelUrls: string[];
1962
- } {
1963
- const pinnedUrls = this.filter?.pinnedChannelUrls ?? [];
1964
- const pinnedIndexMap = new Map(pinnedUrls.map((url, index) => [url, index]));
1965
-
1966
- const addedChannels: ChatSDKGroupChannel[] = [];
1967
- const updatedChannels: ChatSDKGroupChannel[] = [];
1968
- const unmatchedChannelUrls: string[] = [];
1969
-
1970
- for (const channel of channels) {
1971
- if (!this._query.belongsTo(channel)) {
1972
- unmatchedChannelUrls.push(channel.url);
1973
- continue;
1974
- }
1975
-
1976
- const targetIndex = pinnedIndexMap.get(channel.url);
1977
- if (targetIndex === undefined) continue;
1978
-
1979
- const existingPosition = indexOfChannel(this._pinnedChannels, channel);
1980
- const isExisting = existingPosition >= 0;
1981
-
1982
- if (isExisting) {
1983
- this._pinnedChannels.splice(existingPosition, 1);
1984
- updatedChannels.push(channel);
1985
- } else {
1986
- addedChannels.push(channel);
1987
- }
1988
-
1989
- const insertPosition = this._pinnedChannels.findIndex((existingChannel) => {
1990
- const existingIndex = pinnedIndexMap.get(existingChannel.url) ?? Infinity;
1991
- return existingIndex > targetIndex;
1992
- });
1993
-
1994
- const finalPosition = insertPosition === -1 ? this._pinnedChannels.length : insertPosition;
1995
- this._pinnedChannels.splice(finalPosition, 0, channel);
1996
- }
1997
-
1998
- return { addedChannels, updatedChannels, unmatchedChannelUrls };
1999
- }
2000
-
2001
- /**
2002
- * Upserts regular (non-pinned) channels with time-based sorting.
2003
- * @param channels - Regular channels to upsert
2004
- * @param forceAppend - Whether to force append channels at the end regardless of hasMore status
2005
- * @returns Object containing added, updated channels and unmatched URLs
2006
- */
2007
- private _upsertRegularChannelsToArray(
2008
- channels: ChatSDKGroupChannel[],
2009
- forceAppend = false,
2010
- ): { addedChannels: ChatSDKGroupChannel[]; updatedChannels: ChatSDKGroupChannel[]; unmatchedChannelUrls: string[] } {
2011
- const unmatchedChannelUrls: string[] = [];
2012
-
2013
- const addedChannels: ChatSDKGroupChannel[] = [];
2014
- const updatedChannels: ChatSDKGroupChannel[] = [];
2015
-
2016
- for (const channel of channels) {
2017
- if (!this._query.belongsTo(channel)) {
2018
- unmatchedChannelUrls.push(channel.url);
2019
- continue;
2020
- }
2021
-
2022
- const oldPosition = indexOfChannel(this._channels, channel);
2023
- const isNewChannel = oldPosition < 0;
2024
- const shouldRemoveBeforeInsert = !isNewChannel;
2025
-
2026
- if (shouldRemoveBeforeInsert) {
2027
- this._channels.splice(oldPosition, 1);
2028
- }
2029
-
2030
- const insertionIndex = placeOfChannel(this._channels, channel, this._order).place;
2031
- const isAtEnd = insertionIndex === this._channels.length;
2032
-
2033
- if (isNewChannel) {
2034
- if (isAtEnd) {
2035
- if (forceAppend || !this.hasMore) {
2036
- this._channels.push(channel);
2037
- addedChannels.push(channel);
2038
- }
2039
- } else {
2040
- this._channels.splice(insertionIndex, 0, channel);
2041
- addedChannels.push(channel);
2042
- }
2043
- } else {
2044
- this._channels.splice(insertionIndex, 0, channel);
2045
- updatedChannels.push(channel);
2046
- }
2047
- }
2048
-
2049
- return { addedChannels, updatedChannels, unmatchedChannelUrls };
2050
- }
2051
-
2052
- /**
2053
- * Adds or updates channels in the collection, separating pinned and non-pinned channels.
2054
- * @param channels - Channels to add or update
2055
- * @param forceAppend - Whether to force append channels at the end
2056
- */
2057
- private _addChannelsToView(channels: ChatSDKGroupChannel[], forceAppend = false): void {
2058
- const pinnedUrlsSet = new Set(this.filter?.pinnedChannelUrls ?? []);
2059
-
2060
- const pinnedChannels: ChatSDKGroupChannel[] = [];
2061
- const regularChannels: ChatSDKGroupChannel[] = [];
2062
-
2063
- for (const channel of channels) {
2064
- if (pinnedUrlsSet.has(channel.url)) {
2065
- pinnedChannels.push(channel);
2066
- } else {
2067
- regularChannels.push(channel);
2068
- }
2069
- }
2070
-
2071
- const pinnedResult = this._upsertPinnedChannelsToArray(pinnedChannels);
2072
- const regularResult = this._upsertRegularChannelsToArray(regularChannels, forceAppend);
2073
-
2074
- const addedChannels = pinnedResult.addedChannels.concat(regularResult.addedChannels);
2075
- const updatedChannels = pinnedResult.updatedChannels.concat(regularResult.updatedChannels);
2076
- const unmatchedChannelUrls = pinnedResult.unmatchedChannelUrls.concat(regularResult.unmatchedChannelUrls);
2077
-
2078
- if (addedChannels.length > 0) this._collectionEventHandler?.onChannelsAdded?.({}, addedChannels);
2079
- if (updatedChannels.length > 0) this._collectionEventHandler?.onChannelsUpdated?.({}, updatedChannels);
2080
- if (unmatchedChannelUrls.length > 0) this._removeChannelsFromView(unmatchedChannelUrls);
2081
- }
2082
-
2083
- /**
2084
- * Removes channels from the collection by their URLs.
2085
- * @param channelUrls - Array of channel URLs to remove
2086
- */
2087
- private _removeChannelsFromView(channelUrls: string[]) {
2088
- const pinnedUrlsSet = new Set(this.filter?.pinnedChannelUrls ?? []);
2089
- const removedChannelUrls: string[] = [];
2090
-
2091
- for (const channelUrl of channelUrls) {
2092
- if (pinnedUrlsSet.has(channelUrl)) {
2093
- const index = this._pinnedChannels.findIndex((channel) => channel.url === channelUrl);
2094
- if (index >= 0) {
2095
- removedChannelUrls.push(channelUrl);
2096
- this._pinnedChannels.splice(index, 1);
2097
- }
2098
- } else {
2099
- const index = this._channels.findIndex((channel) => channel.url === channelUrl);
2100
- if (index >= 0) {
2101
- removedChannelUrls.push(channelUrl);
2102
- this._channels.splice(index, 1);
2103
- }
2104
- }
2105
- }
2106
-
2107
- if (removedChannelUrls.length > 0) this._collectionEventHandler?.onChannelsDeleted?.({}, removedChannelUrls);
2108
- }
2109
-
2110
- /**
2111
- * Gets all channels in the collection.
2112
- * Pinned channels are always returned first, followed by non-pinned channels.
2113
- * @returns Array of GroupChannel objects
2114
- */
2115
- public get channels(): ChatSDKGroupChannel[] {
2116
- return this._isDisposed ? [] : [...this._pinnedChannels, ...this._channels];
2117
- }
2118
-
2119
- /**
2120
- * Indicates whether the collection has more channels to load.
2121
- * @returns True if more channels can be loaded, false otherwise
2122
- */
2123
- public get hasMore(): boolean {
2124
- return this._isDisposed ? false : this._query.hasNext;
2125
- }
2126
-
2127
- /**
2128
- * Loads the next batch of channels from the server.
2129
- * @returns Promise that resolves to an array of newly loaded channels
2130
- */
2131
- public async loadMore(): Promise<ChatSDKGroupChannel[]> {
2132
- if (this._isDisposed) return [];
2133
-
2134
- if (this.hasMore) {
2135
- const channels = await this._query.next();
2136
-
2137
- this._setDefaultChangelogsSyncTimestamp(channels);
2138
- this._addChannelsToView(channels, true);
2139
- return channels;
2140
- }
2141
-
2142
- return [];
2143
- }
2144
-
2145
- /**
2146
- * Sets the event handler for collection updates.
2147
- * @param handler - Event handler for channel collection changes
2148
- */
2149
- public setConversationListCollectionHandler(handler: ConversationListCollectionEventHandler): void {
2150
- this._collectionEventHandler = handler;
2151
- }
2152
-
2153
- /**
2154
- * Disposes the collection and cleans up all resources.
2155
- * Stops all event handlers and clears all channels.
2156
- */
2157
- public dispose(): void {
2158
- if (this._isDisposed) return;
2159
-
2160
- this._isDisposed = true;
2161
- this._throttledOnChannelChanged.cancel();
2162
- this._collectionEventHandler = undefined;
2163
- this._sdk.removeConnectionHandler(this._handlerId);
2164
- this._sdk.groupChannel.removeGroupChannelHandler(this._handlerId);
2165
- this._pinnedChannels.length = 0;
2166
- this._channels.length = 0;
2167
- }
2168
- }
2169
-
2170
- declare interface ConversationListCollectionEventHandler {
2171
- /** Called when there are newly added {@link GroupChannel}s. */
2172
- onChannelsAdded?: (context: ConversationListContext_2, channels: ChatSDKGroupChannel[]) => void;
2173
- /** Called when there's an update in one or more of the {@link GroupChannel}s that `GroupChannelCollection` holds. */
2174
- onChannelsUpdated?: (context: ConversationListContext_2, channels: ChatSDKGroupChannel[]) => void;
2175
- /** Called when one or more of the {@link GroupChannel}s that `GroupChannelCollection` holds has been deleted. */
2176
- onChannelsDeleted?: (context: ConversationListContext_2, channelUrls: string[]) => void;
1812
+ declare interface ConversationListCollectionInterface {
1813
+ readonly channels: ChatSDKGroupChannel[];
1814
+ readonly hasMore: boolean;
1815
+ loadMore(): Promise<ChatSDKGroupChannel[]>;
1816
+ setConversationListCollectionHandler(handler: ChatSDKBaseChannelCollectionEventHandler): void;
1817
+ dispose(): void;
2177
1818
  }
2178
1819
 
2179
1820
  /**
@@ -2188,8 +1829,6 @@ declare interface ConversationListCollectionParams {
2188
1829
 
2189
1830
  export declare const ConversationListContext: Context<ConversationListContextValue | null>;
2190
1831
 
2191
- declare interface ConversationListContext_2 {}
2192
-
2193
1832
  declare interface ConversationListContextProps {
2194
1833
  conversationListLimit?: number;
2195
1834
  conversationListFilter?: Partial<AIAgentGroupChannelFilter>;
@@ -2575,6 +2214,7 @@ export declare interface ExtendedMessagePayload {
2575
2214
  | 'safeguard'
2576
2215
  | 'error';
2577
2216
  citations?: CitationInfo[];
2217
+ challenge?: ChallengeInfo;
2578
2218
  feedback?: FeedbackInfo;
2579
2219
  form?: Form;
2580
2220
  steward?: Steward;
@@ -2721,6 +2361,7 @@ BaseMessageProps<{
2721
2361
  onFeedbackUpdate?: (params: { rating: 'good' | 'bad'; comment?: string } | null) => void;
2722
2362
  onSubmitForm?: (params: { key: string; data: Record<string, FormFieldValue> }) => Promise<void>;
2723
2363
  onCancelForm?: (params: { key: string }) => Promise<void>;
2364
+ onSendChallengeAction?: <T = object>(params: ChallengeActionParams) => Promise<T>;
2724
2365
  onStreamAnimationStart?: () => void;
2725
2366
  onStreamAnimationProgress?: () => void;
2726
2367
  onStreamAnimationComplete?: () => void;
@@ -2811,6 +2452,7 @@ export declare const IncomingMessageLayout: {
2811
2452
  onCancelForm?: (params: {
2812
2453
  key: string;
2813
2454
  }) => Promise<void>;
2455
+ onSendChallengeAction?: <T = object>(params: ChallengeActionParams) => Promise<T>;
2814
2456
  onStreamAnimationStart?: () => void;
2815
2457
  onStreamAnimationProgress?: () => void;
2816
2458
  onStreamAnimationComplete?: () => void;
@@ -2888,6 +2530,7 @@ export declare const IncomingMessageLayout: {
2888
2530
  onCancelForm?: (params: {
2889
2531
  key: string;
2890
2532
  }) => Promise<void>;
2533
+ onSendChallengeAction?: <T = object>(params: ChallengeActionParams) => Promise<T>;
2891
2534
  onStreamAnimationStart?: () => void;
2892
2535
  onStreamAnimationProgress?: () => void;
2893
2536
  onStreamAnimationComplete?: () => void;
@@ -2965,6 +2608,7 @@ export declare const IncomingMessageLayout: {
2965
2608
  onCancelForm?: (params: {
2966
2609
  key: string;
2967
2610
  }) => Promise<void>;
2611
+ onSendChallengeAction?: <T = object>(params: ChallengeActionParams) => Promise<T>;
2968
2612
  onStreamAnimationStart?: () => void;
2969
2613
  onStreamAnimationProgress?: () => void;
2970
2614
  onStreamAnimationComplete?: () => void;
@@ -2997,145 +2641,606 @@ export declare const IncomingMessageLayout: {
2997
2641
  }) => void;
2998
2642
  children?: ReactNode;
2999
2643
  })) => ReactNode;
3000
- CTAButton: ({ extendedMessagePayload, onClickCTA, }: IncomingMessageProps) => ReactNode;
3001
- Citation: ({ extendedMessagePayload, onClickCitation, }: IncomingMessageProps) => ReactNode;
3002
- Form: (props: IncomingMessageProps) => ReactNode;
3003
- Feedback: ({ isBotMessage, isConversationClosed, isStreaming, isFeedbackEnabled, isFeedbackCommentEnabled, extendedMessagePayload, onFeedbackUpdate, }: IncomingMessageProps) => ReactNode;
3004
- MessageLogs: (_: IncomingMessageProps) => ReactNode;
3005
- };
3006
- };
3007
- Template: ({ template, children }: {
3008
- template?: ComponentType<IncomingMessageTemplateProps> | undefined;
3009
- children?: ReactNode;
3010
- }) => JSX.Element;
3011
- Context: Context<LayoutContextValue<IncomingMessageTemplateProps, {
3012
- SenderName: ({ sender }: Pick<IncomingMessageProps, "sender">) => ReactNode;
3013
- SenderAvatar: ({ sender, isBotMessage, }: Pick<IncomingMessageProps, "sender" | "isBotMessage">) => ReactNode;
3014
- SentTime: ({ createdAt }: Pick<IncomingMessageProps, "createdAt">) => ReactNode;
3015
- MessageBody: (props: IncomingMessageBodyProps) => ReactNode;
3016
- TextMessageBody: typeof IncomingTextBody;
3017
- MediaMessageBody: typeof IncomingMediaBody;
3018
- FileMessageBody: typeof IncomingFileBody;
3019
- MultipleFilesMessageBody: ({ files, children, onClickMedia, onClickMediaFiles, }: IncomingMessageBodyProps<"multipleFiles">) => JSX.Element;
3020
- TypingIndicator: ({ thinkingMessage, customStyle }: IncomingMessageProps & {
3021
- customStyle?: {
3022
- bubbleContentColor?: string;
3023
- bubbleBackgroundColor?: string;
3024
- };
3025
- }) => ReactNode;
3026
- SuggestedReplies: ({ extendedMessagePayload, onClickSuggestedReply, suggestedRepliesDirection, }: IncomingMessageProps) => ReactNode;
3027
- MessageTemplate: (props: {
3028
- onGetCachedMessageTemplate?: ((templateKey: string) => string | null) | undefined;
3029
- onRequestMessageTemplate?: ((templateKey: string) => Promise<string>) | undefined;
3030
- onHandleTemplateInternalAction?: ((action: Action) => void) | undefined;
3031
- messageTemplateErrorFallback?: ReactNode;
3032
- messageTemplateLoadingFallback?: ReactNode;
3033
- extendedMessagePayload?: Partial<ExtendedMessagePayload> | undefined;
3034
- }) => ReactNode;
3035
- CustomMessageTemplate: (_: ({
3036
- messageType: "user";
3037
- message: string;
3038
- } & {
3039
- sender: {
3040
- nickname: string;
3041
- profileUrl?: string;
3042
- };
3043
- thinkingMessage?: string;
3044
- suggestedRepliesVisible?: boolean;
3045
- suggestedRepliesDirection?: "vertical" | "horizontal";
3046
- isBotMessage?: boolean;
3047
- isTyping?: boolean;
3048
- isStreaming?: boolean;
3049
- isHandedOff?: boolean;
3050
- isConversationClosed?: boolean;
3051
- isFeedbackEnabled?: boolean;
3052
- isFeedbackCommentEnabled?: boolean;
3053
- isSenderAvatarVisible?: boolean;
3054
- markdownImageRenderMode?: MarkdownImageRenderMode;
3055
- onGetCachedMessageTemplate?: (templateKey: string) => string | null;
3056
- onRequestMessageTemplate?: (templateKey: string) => Promise<string>;
3057
- onHandleTemplateInternalAction?: (action: Action) => void;
3058
- onClickSuggestedReply?: (params: {
3059
- reply: string;
3060
- }) => void;
3061
- onClickCTA?: (params: {
3062
- url: string;
3063
- }) => void;
3064
- onClickCitation?: (citation: CitationInfo) => void;
3065
- onFeedbackUpdate?: (params: {
3066
- rating: "good" | "bad";
3067
- comment?: string;
3068
- } | null) => void;
3069
- onSubmitForm?: (params: {
3070
- key: string;
3071
- data: Record<string, FormFieldValue>;
3072
- }) => Promise<void>;
3073
- onCancelForm?: (params: {
3074
- key: string;
3075
- }) => Promise<void>;
3076
- onStreamAnimationStart?: () => void;
3077
- onStreamAnimationProgress?: () => void;
3078
- onStreamAnimationComplete?: () => void;
3079
- messageTemplateErrorFallback?: ReactNode;
3080
- messageTemplateLoadingFallback?: ReactNode;
3081
- } & {
3082
- data?: string;
3083
- createdAt?: number;
3084
- extendedMessagePayload?: Partial<ExtendedMessagePayload>;
3085
- groupType?: MessageGroupType;
3086
- maxBodyWidth?: number;
3087
- onClickMedia?: (params: {
3088
- url: string;
3089
- type: string;
3090
- }) => void;
3091
- onClickMediaFiles?: (params: {
3092
- files: Array<{
3093
- url: string;
3094
- type: string;
3095
- name?: string;
3096
- }>;
3097
- index: number;
3098
- }) => void;
3099
- onClickFile?: (params: {
3100
- url: string;
3101
- type: string;
3102
- }) => void;
3103
- onClickLink?: (params: {
3104
- url: string;
3105
- }) => void;
3106
- children?: ReactNode;
3107
- }) | ({
3108
- messageType: "file";
3109
- message: string;
3110
- file: {
3111
- type: string;
3112
- url: string;
3113
- name: string;
3114
- };
3115
- } & {
3116
- sender: {
3117
- nickname: string;
3118
- profileUrl?: string;
3119
- };
3120
- thinkingMessage?: string;
3121
- suggestedRepliesVisible?: boolean;
3122
- suggestedRepliesDirection?: "vertical" | "horizontal";
3123
- isBotMessage?: boolean;
3124
- isTyping?: boolean;
3125
- isStreaming?: boolean;
3126
- isHandedOff?: boolean;
3127
- isConversationClosed?: boolean;
3128
- isFeedbackEnabled?: boolean;
3129
- isFeedbackCommentEnabled?: boolean;
3130
- isSenderAvatarVisible?: boolean;
3131
- markdownImageRenderMode?: MarkdownImageRenderMode;
3132
- onGetCachedMessageTemplate?: (templateKey: string) => string | null;
3133
- onRequestMessageTemplate?: (templateKey: string) => Promise<string>;
3134
- onHandleTemplateInternalAction?: (action: Action) => void;
3135
- onClickSuggestedReply?: (params: {
3136
- reply: string;
3137
- }) => void;
3138
- onClickCTA?: (params: {
2644
+ Challenge: (_: ({
2645
+ messageType: "user";
2646
+ message: string;
2647
+ } & {
2648
+ sender: {
2649
+ nickname: string;
2650
+ profileUrl?: string;
2651
+ };
2652
+ thinkingMessage?: string;
2653
+ suggestedRepliesVisible?: boolean;
2654
+ suggestedRepliesDirection?: "vertical" | "horizontal";
2655
+ isBotMessage?: boolean;
2656
+ isTyping?: boolean;
2657
+ isStreaming?: boolean;
2658
+ isHandedOff?: boolean;
2659
+ isConversationClosed?: boolean;
2660
+ isFeedbackEnabled?: boolean;
2661
+ isFeedbackCommentEnabled?: boolean;
2662
+ isSenderAvatarVisible?: boolean;
2663
+ markdownImageRenderMode?: MarkdownImageRenderMode;
2664
+ onGetCachedMessageTemplate?: (templateKey: string) => string | null;
2665
+ onRequestMessageTemplate?: (templateKey: string) => Promise<string>;
2666
+ onHandleTemplateInternalAction?: (action: Action) => void;
2667
+ onClickSuggestedReply?: (params: {
2668
+ reply: string;
2669
+ }) => void;
2670
+ onClickCTA?: (params: {
2671
+ url: string;
2672
+ }) => void;
2673
+ onClickCitation?: (citation: CitationInfo) => void;
2674
+ onFeedbackUpdate?: (params: {
2675
+ rating: "good" | "bad";
2676
+ comment?: string;
2677
+ } | null) => void;
2678
+ onSubmitForm?: (params: {
2679
+ key: string;
2680
+ data: Record<string, FormFieldValue>;
2681
+ }) => Promise<void>;
2682
+ onCancelForm?: (params: {
2683
+ key: string;
2684
+ }) => Promise<void>;
2685
+ onSendChallengeAction?: <T = object>(params: ChallengeActionParams) => Promise<T>;
2686
+ onStreamAnimationStart?: () => void;
2687
+ onStreamAnimationProgress?: () => void;
2688
+ onStreamAnimationComplete?: () => void;
2689
+ messageTemplateErrorFallback?: ReactNode;
2690
+ messageTemplateLoadingFallback?: ReactNode;
2691
+ } & {
2692
+ data?: string;
2693
+ createdAt?: number;
2694
+ extendedMessagePayload?: Partial<ExtendedMessagePayload>;
2695
+ groupType?: MessageGroupType;
2696
+ maxBodyWidth?: number;
2697
+ onClickMedia?: (params: {
2698
+ url: string;
2699
+ type: string;
2700
+ }) => void;
2701
+ onClickMediaFiles?: (params: {
2702
+ files: Array<{
2703
+ url: string;
2704
+ type: string;
2705
+ name?: string;
2706
+ }>;
2707
+ index: number;
2708
+ }) => void;
2709
+ onClickFile?: (params: {
2710
+ url: string;
2711
+ type: string;
2712
+ }) => void;
2713
+ onClickLink?: (params: {
2714
+ url: string;
2715
+ }) => void;
2716
+ children?: ReactNode;
2717
+ }) | ({
2718
+ messageType: "file";
2719
+ message: string;
2720
+ file: {
2721
+ type: string;
2722
+ url: string;
2723
+ name: string;
2724
+ };
2725
+ } & {
2726
+ sender: {
2727
+ nickname: string;
2728
+ profileUrl?: string;
2729
+ };
2730
+ thinkingMessage?: string;
2731
+ suggestedRepliesVisible?: boolean;
2732
+ suggestedRepliesDirection?: "vertical" | "horizontal";
2733
+ isBotMessage?: boolean;
2734
+ isTyping?: boolean;
2735
+ isStreaming?: boolean;
2736
+ isHandedOff?: boolean;
2737
+ isConversationClosed?: boolean;
2738
+ isFeedbackEnabled?: boolean;
2739
+ isFeedbackCommentEnabled?: boolean;
2740
+ isSenderAvatarVisible?: boolean;
2741
+ markdownImageRenderMode?: MarkdownImageRenderMode;
2742
+ onGetCachedMessageTemplate?: (templateKey: string) => string | null;
2743
+ onRequestMessageTemplate?: (templateKey: string) => Promise<string>;
2744
+ onHandleTemplateInternalAction?: (action: Action) => void;
2745
+ onClickSuggestedReply?: (params: {
2746
+ reply: string;
2747
+ }) => void;
2748
+ onClickCTA?: (params: {
2749
+ url: string;
2750
+ }) => void;
2751
+ onClickCitation?: (citation: CitationInfo) => void;
2752
+ onFeedbackUpdate?: (params: {
2753
+ rating: "good" | "bad";
2754
+ comment?: string;
2755
+ } | null) => void;
2756
+ onSubmitForm?: (params: {
2757
+ key: string;
2758
+ data: Record<string, FormFieldValue>;
2759
+ }) => Promise<void>;
2760
+ onCancelForm?: (params: {
2761
+ key: string;
2762
+ }) => Promise<void>;
2763
+ onSendChallengeAction?: <T = object>(params: ChallengeActionParams) => Promise<T>;
2764
+ onStreamAnimationStart?: () => void;
2765
+ onStreamAnimationProgress?: () => void;
2766
+ onStreamAnimationComplete?: () => void;
2767
+ messageTemplateErrorFallback?: ReactNode;
2768
+ messageTemplateLoadingFallback?: ReactNode;
2769
+ } & {
2770
+ data?: string;
2771
+ createdAt?: number;
2772
+ extendedMessagePayload?: Partial<ExtendedMessagePayload>;
2773
+ groupType?: MessageGroupType;
2774
+ maxBodyWidth?: number;
2775
+ onClickMedia?: (params: {
2776
+ url: string;
2777
+ type: string;
2778
+ }) => void;
2779
+ onClickMediaFiles?: (params: {
2780
+ files: Array<{
2781
+ url: string;
2782
+ type: string;
2783
+ name?: string;
2784
+ }>;
2785
+ index: number;
2786
+ }) => void;
2787
+ onClickFile?: (params: {
2788
+ url: string;
2789
+ type: string;
2790
+ }) => void;
2791
+ onClickLink?: (params: {
2792
+ url: string;
2793
+ }) => void;
2794
+ children?: ReactNode;
2795
+ }) | ({
2796
+ messageType: "multipleFiles";
2797
+ message: string;
2798
+ files: {
2799
+ type: string;
2800
+ url: string;
2801
+ name: string;
2802
+ }[];
2803
+ } & {
2804
+ sender: {
2805
+ nickname: string;
2806
+ profileUrl?: string;
2807
+ };
2808
+ thinkingMessage?: string;
2809
+ suggestedRepliesVisible?: boolean;
2810
+ suggestedRepliesDirection?: "vertical" | "horizontal";
2811
+ isBotMessage?: boolean;
2812
+ isTyping?: boolean;
2813
+ isStreaming?: boolean;
2814
+ isHandedOff?: boolean;
2815
+ isConversationClosed?: boolean;
2816
+ isFeedbackEnabled?: boolean;
2817
+ isFeedbackCommentEnabled?: boolean;
2818
+ isSenderAvatarVisible?: boolean;
2819
+ markdownImageRenderMode?: MarkdownImageRenderMode;
2820
+ onGetCachedMessageTemplate?: (templateKey: string) => string | null;
2821
+ onRequestMessageTemplate?: (templateKey: string) => Promise<string>;
2822
+ onHandleTemplateInternalAction?: (action: Action) => void;
2823
+ onClickSuggestedReply?: (params: {
2824
+ reply: string;
2825
+ }) => void;
2826
+ onClickCTA?: (params: {
2827
+ url: string;
2828
+ }) => void;
2829
+ onClickCitation?: (citation: CitationInfo) => void;
2830
+ onFeedbackUpdate?: (params: {
2831
+ rating: "good" | "bad";
2832
+ comment?: string;
2833
+ } | null) => void;
2834
+ onSubmitForm?: (params: {
2835
+ key: string;
2836
+ data: Record<string, FormFieldValue>;
2837
+ }) => Promise<void>;
2838
+ onCancelForm?: (params: {
2839
+ key: string;
2840
+ }) => Promise<void>;
2841
+ onSendChallengeAction?: <T = object>(params: ChallengeActionParams) => Promise<T>;
2842
+ onStreamAnimationStart?: () => void;
2843
+ onStreamAnimationProgress?: () => void;
2844
+ onStreamAnimationComplete?: () => void;
2845
+ messageTemplateErrorFallback?: ReactNode;
2846
+ messageTemplateLoadingFallback?: ReactNode;
2847
+ } & {
2848
+ data?: string;
2849
+ createdAt?: number;
2850
+ extendedMessagePayload?: Partial<ExtendedMessagePayload>;
2851
+ groupType?: MessageGroupType;
2852
+ maxBodyWidth?: number;
2853
+ onClickMedia?: (params: {
2854
+ url: string;
2855
+ type: string;
2856
+ }) => void;
2857
+ onClickMediaFiles?: (params: {
2858
+ files: Array<{
2859
+ url: string;
2860
+ type: string;
2861
+ name?: string;
2862
+ }>;
2863
+ index: number;
2864
+ }) => void;
2865
+ onClickFile?: (params: {
2866
+ url: string;
2867
+ type: string;
2868
+ }) => void;
2869
+ onClickLink?: (params: {
2870
+ url: string;
2871
+ }) => void;
2872
+ children?: ReactNode;
2873
+ })) => ReactNode;
2874
+ CTAButton: ({ extendedMessagePayload, onClickCTA, }: IncomingMessageProps) => ReactNode;
2875
+ Citation: ({ extendedMessagePayload, onClickCitation, }: IncomingMessageProps) => ReactNode;
2876
+ Form: (props: IncomingMessageProps) => ReactNode;
2877
+ Feedback: ({ isBotMessage, isConversationClosed, isStreaming, isFeedbackEnabled, isFeedbackCommentEnabled, extendedMessagePayload, onFeedbackUpdate, }: IncomingMessageProps) => ReactNode;
2878
+ MessageLogs: (_: IncomingMessageProps) => ReactNode;
2879
+ };
2880
+ };
2881
+ Template: ({ template, children }: {
2882
+ template?: ComponentType<IncomingMessageTemplateProps> | undefined;
2883
+ children?: ReactNode;
2884
+ }) => JSX.Element;
2885
+ Context: Context<LayoutContextValue<IncomingMessageTemplateProps, {
2886
+ SenderName: ({ sender }: Pick<IncomingMessageProps, "sender">) => ReactNode;
2887
+ SenderAvatar: ({ sender, isBotMessage, }: Pick<IncomingMessageProps, "sender" | "isBotMessage">) => ReactNode;
2888
+ SentTime: ({ createdAt }: Pick<IncomingMessageProps, "createdAt">) => ReactNode;
2889
+ MessageBody: (props: IncomingMessageBodyProps) => ReactNode;
2890
+ TextMessageBody: typeof IncomingTextBody;
2891
+ MediaMessageBody: typeof IncomingMediaBody;
2892
+ FileMessageBody: typeof IncomingFileBody;
2893
+ MultipleFilesMessageBody: ({ files, children, onClickMedia, onClickMediaFiles, }: IncomingMessageBodyProps<"multipleFiles">) => JSX.Element;
2894
+ TypingIndicator: ({ thinkingMessage, customStyle }: IncomingMessageProps & {
2895
+ customStyle?: {
2896
+ bubbleContentColor?: string;
2897
+ bubbleBackgroundColor?: string;
2898
+ };
2899
+ }) => ReactNode;
2900
+ SuggestedReplies: ({ extendedMessagePayload, onClickSuggestedReply, suggestedRepliesDirection, }: IncomingMessageProps) => ReactNode;
2901
+ MessageTemplate: (props: {
2902
+ onGetCachedMessageTemplate?: ((templateKey: string) => string | null) | undefined;
2903
+ onRequestMessageTemplate?: ((templateKey: string) => Promise<string>) | undefined;
2904
+ onHandleTemplateInternalAction?: ((action: Action) => void) | undefined;
2905
+ messageTemplateErrorFallback?: ReactNode;
2906
+ messageTemplateLoadingFallback?: ReactNode;
2907
+ extendedMessagePayload?: Partial<ExtendedMessagePayload> | undefined;
2908
+ }) => ReactNode;
2909
+ CustomMessageTemplate: (_: ({
2910
+ messageType: "user";
2911
+ message: string;
2912
+ } & {
2913
+ sender: {
2914
+ nickname: string;
2915
+ profileUrl?: string;
2916
+ };
2917
+ thinkingMessage?: string;
2918
+ suggestedRepliesVisible?: boolean;
2919
+ suggestedRepliesDirection?: "vertical" | "horizontal";
2920
+ isBotMessage?: boolean;
2921
+ isTyping?: boolean;
2922
+ isStreaming?: boolean;
2923
+ isHandedOff?: boolean;
2924
+ isConversationClosed?: boolean;
2925
+ isFeedbackEnabled?: boolean;
2926
+ isFeedbackCommentEnabled?: boolean;
2927
+ isSenderAvatarVisible?: boolean;
2928
+ markdownImageRenderMode?: MarkdownImageRenderMode;
2929
+ onGetCachedMessageTemplate?: (templateKey: string) => string | null;
2930
+ onRequestMessageTemplate?: (templateKey: string) => Promise<string>;
2931
+ onHandleTemplateInternalAction?: (action: Action) => void;
2932
+ onClickSuggestedReply?: (params: {
2933
+ reply: string;
2934
+ }) => void;
2935
+ onClickCTA?: (params: {
2936
+ url: string;
2937
+ }) => void;
2938
+ onClickCitation?: (citation: CitationInfo) => void;
2939
+ onFeedbackUpdate?: (params: {
2940
+ rating: "good" | "bad";
2941
+ comment?: string;
2942
+ } | null) => void;
2943
+ onSubmitForm?: (params: {
2944
+ key: string;
2945
+ data: Record<string, FormFieldValue>;
2946
+ }) => Promise<void>;
2947
+ onCancelForm?: (params: {
2948
+ key: string;
2949
+ }) => Promise<void>;
2950
+ onSendChallengeAction?: <T = object>(params: ChallengeActionParams) => Promise<T>;
2951
+ onStreamAnimationStart?: () => void;
2952
+ onStreamAnimationProgress?: () => void;
2953
+ onStreamAnimationComplete?: () => void;
2954
+ messageTemplateErrorFallback?: ReactNode;
2955
+ messageTemplateLoadingFallback?: ReactNode;
2956
+ } & {
2957
+ data?: string;
2958
+ createdAt?: number;
2959
+ extendedMessagePayload?: Partial<ExtendedMessagePayload>;
2960
+ groupType?: MessageGroupType;
2961
+ maxBodyWidth?: number;
2962
+ onClickMedia?: (params: {
2963
+ url: string;
2964
+ type: string;
2965
+ }) => void;
2966
+ onClickMediaFiles?: (params: {
2967
+ files: Array<{
2968
+ url: string;
2969
+ type: string;
2970
+ name?: string;
2971
+ }>;
2972
+ index: number;
2973
+ }) => void;
2974
+ onClickFile?: (params: {
2975
+ url: string;
2976
+ type: string;
2977
+ }) => void;
2978
+ onClickLink?: (params: {
2979
+ url: string;
2980
+ }) => void;
2981
+ children?: ReactNode;
2982
+ }) | ({
2983
+ messageType: "file";
2984
+ message: string;
2985
+ file: {
2986
+ type: string;
2987
+ url: string;
2988
+ name: string;
2989
+ };
2990
+ } & {
2991
+ sender: {
2992
+ nickname: string;
2993
+ profileUrl?: string;
2994
+ };
2995
+ thinkingMessage?: string;
2996
+ suggestedRepliesVisible?: boolean;
2997
+ suggestedRepliesDirection?: "vertical" | "horizontal";
2998
+ isBotMessage?: boolean;
2999
+ isTyping?: boolean;
3000
+ isStreaming?: boolean;
3001
+ isHandedOff?: boolean;
3002
+ isConversationClosed?: boolean;
3003
+ isFeedbackEnabled?: boolean;
3004
+ isFeedbackCommentEnabled?: boolean;
3005
+ isSenderAvatarVisible?: boolean;
3006
+ markdownImageRenderMode?: MarkdownImageRenderMode;
3007
+ onGetCachedMessageTemplate?: (templateKey: string) => string | null;
3008
+ onRequestMessageTemplate?: (templateKey: string) => Promise<string>;
3009
+ onHandleTemplateInternalAction?: (action: Action) => void;
3010
+ onClickSuggestedReply?: (params: {
3011
+ reply: string;
3012
+ }) => void;
3013
+ onClickCTA?: (params: {
3014
+ url: string;
3015
+ }) => void;
3016
+ onClickCitation?: (citation: CitationInfo) => void;
3017
+ onFeedbackUpdate?: (params: {
3018
+ rating: "good" | "bad";
3019
+ comment?: string;
3020
+ } | null) => void;
3021
+ onSubmitForm?: (params: {
3022
+ key: string;
3023
+ data: Record<string, FormFieldValue>;
3024
+ }) => Promise<void>;
3025
+ onCancelForm?: (params: {
3026
+ key: string;
3027
+ }) => Promise<void>;
3028
+ onSendChallengeAction?: <T = object>(params: ChallengeActionParams) => Promise<T>;
3029
+ onStreamAnimationStart?: () => void;
3030
+ onStreamAnimationProgress?: () => void;
3031
+ onStreamAnimationComplete?: () => void;
3032
+ messageTemplateErrorFallback?: ReactNode;
3033
+ messageTemplateLoadingFallback?: ReactNode;
3034
+ } & {
3035
+ data?: string;
3036
+ createdAt?: number;
3037
+ extendedMessagePayload?: Partial<ExtendedMessagePayload>;
3038
+ groupType?: MessageGroupType;
3039
+ maxBodyWidth?: number;
3040
+ onClickMedia?: (params: {
3041
+ url: string;
3042
+ type: string;
3043
+ }) => void;
3044
+ onClickMediaFiles?: (params: {
3045
+ files: Array<{
3046
+ url: string;
3047
+ type: string;
3048
+ name?: string;
3049
+ }>;
3050
+ index: number;
3051
+ }) => void;
3052
+ onClickFile?: (params: {
3053
+ url: string;
3054
+ type: string;
3055
+ }) => void;
3056
+ onClickLink?: (params: {
3057
+ url: string;
3058
+ }) => void;
3059
+ children?: ReactNode;
3060
+ }) | ({
3061
+ messageType: "multipleFiles";
3062
+ message: string;
3063
+ files: {
3064
+ type: string;
3065
+ url: string;
3066
+ name: string;
3067
+ }[];
3068
+ } & {
3069
+ sender: {
3070
+ nickname: string;
3071
+ profileUrl?: string;
3072
+ };
3073
+ thinkingMessage?: string;
3074
+ suggestedRepliesVisible?: boolean;
3075
+ suggestedRepliesDirection?: "vertical" | "horizontal";
3076
+ isBotMessage?: boolean;
3077
+ isTyping?: boolean;
3078
+ isStreaming?: boolean;
3079
+ isHandedOff?: boolean;
3080
+ isConversationClosed?: boolean;
3081
+ isFeedbackEnabled?: boolean;
3082
+ isFeedbackCommentEnabled?: boolean;
3083
+ isSenderAvatarVisible?: boolean;
3084
+ markdownImageRenderMode?: MarkdownImageRenderMode;
3085
+ onGetCachedMessageTemplate?: (templateKey: string) => string | null;
3086
+ onRequestMessageTemplate?: (templateKey: string) => Promise<string>;
3087
+ onHandleTemplateInternalAction?: (action: Action) => void;
3088
+ onClickSuggestedReply?: (params: {
3089
+ reply: string;
3090
+ }) => void;
3091
+ onClickCTA?: (params: {
3092
+ url: string;
3093
+ }) => void;
3094
+ onClickCitation?: (citation: CitationInfo) => void;
3095
+ onFeedbackUpdate?: (params: {
3096
+ rating: "good" | "bad";
3097
+ comment?: string;
3098
+ } | null) => void;
3099
+ onSubmitForm?: (params: {
3100
+ key: string;
3101
+ data: Record<string, FormFieldValue>;
3102
+ }) => Promise<void>;
3103
+ onCancelForm?: (params: {
3104
+ key: string;
3105
+ }) => Promise<void>;
3106
+ onSendChallengeAction?: <T = object>(params: ChallengeActionParams) => Promise<T>;
3107
+ onStreamAnimationStart?: () => void;
3108
+ onStreamAnimationProgress?: () => void;
3109
+ onStreamAnimationComplete?: () => void;
3110
+ messageTemplateErrorFallback?: ReactNode;
3111
+ messageTemplateLoadingFallback?: ReactNode;
3112
+ } & {
3113
+ data?: string;
3114
+ createdAt?: number;
3115
+ extendedMessagePayload?: Partial<ExtendedMessagePayload>;
3116
+ groupType?: MessageGroupType;
3117
+ maxBodyWidth?: number;
3118
+ onClickMedia?: (params: {
3119
+ url: string;
3120
+ type: string;
3121
+ }) => void;
3122
+ onClickMediaFiles?: (params: {
3123
+ files: Array<{
3124
+ url: string;
3125
+ type: string;
3126
+ name?: string;
3127
+ }>;
3128
+ index: number;
3129
+ }) => void;
3130
+ onClickFile?: (params: {
3131
+ url: string;
3132
+ type: string;
3133
+ }) => void;
3134
+ onClickLink?: (params: {
3135
+ url: string;
3136
+ }) => void;
3137
+ children?: ReactNode;
3138
+ })) => ReactNode;
3139
+ Challenge: (_: ({
3140
+ messageType: "user";
3141
+ message: string;
3142
+ } & {
3143
+ sender: {
3144
+ nickname: string;
3145
+ profileUrl?: string;
3146
+ };
3147
+ thinkingMessage?: string;
3148
+ suggestedRepliesVisible?: boolean;
3149
+ suggestedRepliesDirection?: "vertical" | "horizontal";
3150
+ isBotMessage?: boolean;
3151
+ isTyping?: boolean;
3152
+ isStreaming?: boolean;
3153
+ isHandedOff?: boolean;
3154
+ isConversationClosed?: boolean;
3155
+ isFeedbackEnabled?: boolean;
3156
+ isFeedbackCommentEnabled?: boolean;
3157
+ isSenderAvatarVisible?: boolean;
3158
+ markdownImageRenderMode?: MarkdownImageRenderMode;
3159
+ onGetCachedMessageTemplate?: (templateKey: string) => string | null;
3160
+ onRequestMessageTemplate?: (templateKey: string) => Promise<string>;
3161
+ onHandleTemplateInternalAction?: (action: Action) => void;
3162
+ onClickSuggestedReply?: (params: {
3163
+ reply: string;
3164
+ }) => void;
3165
+ onClickCTA?: (params: {
3166
+ url: string;
3167
+ }) => void;
3168
+ onClickCitation?: (citation: CitationInfo) => void;
3169
+ onFeedbackUpdate?: (params: {
3170
+ rating: "good" | "bad";
3171
+ comment?: string;
3172
+ } | null) => void;
3173
+ onSubmitForm?: (params: {
3174
+ key: string;
3175
+ data: Record<string, FormFieldValue>;
3176
+ }) => Promise<void>;
3177
+ onCancelForm?: (params: {
3178
+ key: string;
3179
+ }) => Promise<void>;
3180
+ onSendChallengeAction?: <T = object>(params: ChallengeActionParams) => Promise<T>;
3181
+ onStreamAnimationStart?: () => void;
3182
+ onStreamAnimationProgress?: () => void;
3183
+ onStreamAnimationComplete?: () => void;
3184
+ messageTemplateErrorFallback?: ReactNode;
3185
+ messageTemplateLoadingFallback?: ReactNode;
3186
+ } & {
3187
+ data?: string;
3188
+ createdAt?: number;
3189
+ extendedMessagePayload?: Partial<ExtendedMessagePayload>;
3190
+ groupType?: MessageGroupType;
3191
+ maxBodyWidth?: number;
3192
+ onClickMedia?: (params: {
3193
+ url: string;
3194
+ type: string;
3195
+ }) => void;
3196
+ onClickMediaFiles?: (params: {
3197
+ files: Array<{
3198
+ url: string;
3199
+ type: string;
3200
+ name?: string;
3201
+ }>;
3202
+ index: number;
3203
+ }) => void;
3204
+ onClickFile?: (params: {
3205
+ url: string;
3206
+ type: string;
3207
+ }) => void;
3208
+ onClickLink?: (params: {
3209
+ url: string;
3210
+ }) => void;
3211
+ children?: ReactNode;
3212
+ }) | ({
3213
+ messageType: "file";
3214
+ message: string;
3215
+ file: {
3216
+ type: string;
3217
+ url: string;
3218
+ name: string;
3219
+ };
3220
+ } & {
3221
+ sender: {
3222
+ nickname: string;
3223
+ profileUrl?: string;
3224
+ };
3225
+ thinkingMessage?: string;
3226
+ suggestedRepliesVisible?: boolean;
3227
+ suggestedRepliesDirection?: "vertical" | "horizontal";
3228
+ isBotMessage?: boolean;
3229
+ isTyping?: boolean;
3230
+ isStreaming?: boolean;
3231
+ isHandedOff?: boolean;
3232
+ isConversationClosed?: boolean;
3233
+ isFeedbackEnabled?: boolean;
3234
+ isFeedbackCommentEnabled?: boolean;
3235
+ isSenderAvatarVisible?: boolean;
3236
+ markdownImageRenderMode?: MarkdownImageRenderMode;
3237
+ onGetCachedMessageTemplate?: (templateKey: string) => string | null;
3238
+ onRequestMessageTemplate?: (templateKey: string) => Promise<string>;
3239
+ onHandleTemplateInternalAction?: (action: Action) => void;
3240
+ onClickSuggestedReply?: (params: {
3241
+ reply: string;
3242
+ }) => void;
3243
+ onClickCTA?: (params: {
3139
3244
  url: string;
3140
3245
  }) => void;
3141
3246
  onClickCitation?: (citation: CitationInfo) => void;
@@ -3150,6 +3255,7 @@ export declare const IncomingMessageLayout: {
3150
3255
  onCancelForm?: (params: {
3151
3256
  key: string;
3152
3257
  }) => Promise<void>;
3258
+ onSendChallengeAction?: <T = object>(params: ChallengeActionParams) => Promise<T>;
3153
3259
  onStreamAnimationStart?: () => void;
3154
3260
  onStreamAnimationProgress?: () => void;
3155
3261
  onStreamAnimationComplete?: () => void;
@@ -3227,6 +3333,7 @@ export declare const IncomingMessageLayout: {
3227
3333
  onCancelForm?: (params: {
3228
3334
  key: string;
3229
3335
  }) => Promise<void>;
3336
+ onSendChallengeAction?: <T = object>(params: ChallengeActionParams) => Promise<T>;
3230
3337
  onStreamAnimationStart?: () => void;
3231
3338
  onStreamAnimationProgress?: () => void;
3232
3339
  onStreamAnimationComplete?: () => void;
@@ -3330,6 +3437,237 @@ export declare const IncomingMessageLayout: {
3330
3437
  onCancelForm?: (params: {
3331
3438
  key: string;
3332
3439
  }) => Promise<void>;
3440
+ onSendChallengeAction?: <T = object>(params: ChallengeActionParams) => Promise<T>;
3441
+ onStreamAnimationStart?: () => void;
3442
+ onStreamAnimationProgress?: () => void;
3443
+ onStreamAnimationComplete?: () => void;
3444
+ messageTemplateErrorFallback?: ReactNode;
3445
+ messageTemplateLoadingFallback?: ReactNode;
3446
+ } & {
3447
+ data?: string;
3448
+ createdAt?: number;
3449
+ extendedMessagePayload?: Partial<ExtendedMessagePayload>;
3450
+ groupType?: MessageGroupType;
3451
+ maxBodyWidth?: number;
3452
+ onClickMedia?: (params: {
3453
+ url: string;
3454
+ type: string;
3455
+ }) => void;
3456
+ onClickMediaFiles?: (params: {
3457
+ files: Array<{
3458
+ url: string;
3459
+ type: string;
3460
+ name?: string;
3461
+ }>;
3462
+ index: number;
3463
+ }) => void;
3464
+ onClickFile?: (params: {
3465
+ url: string;
3466
+ type: string;
3467
+ }) => void;
3468
+ onClickLink?: (params: {
3469
+ url: string;
3470
+ }) => void;
3471
+ children?: ReactNode;
3472
+ }) | ({
3473
+ messageType: "file";
3474
+ message: string;
3475
+ file: {
3476
+ type: string;
3477
+ url: string;
3478
+ name: string;
3479
+ };
3480
+ } & {
3481
+ sender: {
3482
+ nickname: string;
3483
+ profileUrl?: string;
3484
+ };
3485
+ thinkingMessage?: string;
3486
+ suggestedRepliesVisible?: boolean;
3487
+ suggestedRepliesDirection?: "vertical" | "horizontal";
3488
+ isBotMessage?: boolean;
3489
+ isTyping?: boolean;
3490
+ isStreaming?: boolean;
3491
+ isHandedOff?: boolean;
3492
+ isConversationClosed?: boolean;
3493
+ isFeedbackEnabled?: boolean;
3494
+ isFeedbackCommentEnabled?: boolean;
3495
+ isSenderAvatarVisible?: boolean;
3496
+ markdownImageRenderMode?: MarkdownImageRenderMode;
3497
+ onGetCachedMessageTemplate?: (templateKey: string) => string | null;
3498
+ onRequestMessageTemplate?: (templateKey: string) => Promise<string>;
3499
+ onHandleTemplateInternalAction?: (action: Action) => void;
3500
+ onClickSuggestedReply?: (params: {
3501
+ reply: string;
3502
+ }) => void;
3503
+ onClickCTA?: (params: {
3504
+ url: string;
3505
+ }) => void;
3506
+ onClickCitation?: (citation: CitationInfo) => void;
3507
+ onFeedbackUpdate?: (params: {
3508
+ rating: "good" | "bad";
3509
+ comment?: string;
3510
+ } | null) => void;
3511
+ onSubmitForm?: (params: {
3512
+ key: string;
3513
+ data: Record<string, FormFieldValue>;
3514
+ }) => Promise<void>;
3515
+ onCancelForm?: (params: {
3516
+ key: string;
3517
+ }) => Promise<void>;
3518
+ onSendChallengeAction?: <T = object>(params: ChallengeActionParams) => Promise<T>;
3519
+ onStreamAnimationStart?: () => void;
3520
+ onStreamAnimationProgress?: () => void;
3521
+ onStreamAnimationComplete?: () => void;
3522
+ messageTemplateErrorFallback?: ReactNode;
3523
+ messageTemplateLoadingFallback?: ReactNode;
3524
+ } & {
3525
+ data?: string;
3526
+ createdAt?: number;
3527
+ extendedMessagePayload?: Partial<ExtendedMessagePayload>;
3528
+ groupType?: MessageGroupType;
3529
+ maxBodyWidth?: number;
3530
+ onClickMedia?: (params: {
3531
+ url: string;
3532
+ type: string;
3533
+ }) => void;
3534
+ onClickMediaFiles?: (params: {
3535
+ files: Array<{
3536
+ url: string;
3537
+ type: string;
3538
+ name?: string;
3539
+ }>;
3540
+ index: number;
3541
+ }) => void;
3542
+ onClickFile?: (params: {
3543
+ url: string;
3544
+ type: string;
3545
+ }) => void;
3546
+ onClickLink?: (params: {
3547
+ url: string;
3548
+ }) => void;
3549
+ children?: ReactNode;
3550
+ }) | ({
3551
+ messageType: "multipleFiles";
3552
+ message: string;
3553
+ files: {
3554
+ type: string;
3555
+ url: string;
3556
+ name: string;
3557
+ }[];
3558
+ } & {
3559
+ sender: {
3560
+ nickname: string;
3561
+ profileUrl?: string;
3562
+ };
3563
+ thinkingMessage?: string;
3564
+ suggestedRepliesVisible?: boolean;
3565
+ suggestedRepliesDirection?: "vertical" | "horizontal";
3566
+ isBotMessage?: boolean;
3567
+ isTyping?: boolean;
3568
+ isStreaming?: boolean;
3569
+ isHandedOff?: boolean;
3570
+ isConversationClosed?: boolean;
3571
+ isFeedbackEnabled?: boolean;
3572
+ isFeedbackCommentEnabled?: boolean;
3573
+ isSenderAvatarVisible?: boolean;
3574
+ markdownImageRenderMode?: MarkdownImageRenderMode;
3575
+ onGetCachedMessageTemplate?: (templateKey: string) => string | null;
3576
+ onRequestMessageTemplate?: (templateKey: string) => Promise<string>;
3577
+ onHandleTemplateInternalAction?: (action: Action) => void;
3578
+ onClickSuggestedReply?: (params: {
3579
+ reply: string;
3580
+ }) => void;
3581
+ onClickCTA?: (params: {
3582
+ url: string;
3583
+ }) => void;
3584
+ onClickCitation?: (citation: CitationInfo) => void;
3585
+ onFeedbackUpdate?: (params: {
3586
+ rating: "good" | "bad";
3587
+ comment?: string;
3588
+ } | null) => void;
3589
+ onSubmitForm?: (params: {
3590
+ key: string;
3591
+ data: Record<string, FormFieldValue>;
3592
+ }) => Promise<void>;
3593
+ onCancelForm?: (params: {
3594
+ key: string;
3595
+ }) => Promise<void>;
3596
+ onSendChallengeAction?: <T = object>(params: ChallengeActionParams) => Promise<T>;
3597
+ onStreamAnimationStart?: () => void;
3598
+ onStreamAnimationProgress?: () => void;
3599
+ onStreamAnimationComplete?: () => void;
3600
+ messageTemplateErrorFallback?: ReactNode;
3601
+ messageTemplateLoadingFallback?: ReactNode;
3602
+ } & {
3603
+ data?: string;
3604
+ createdAt?: number;
3605
+ extendedMessagePayload?: Partial<ExtendedMessagePayload>;
3606
+ groupType?: MessageGroupType;
3607
+ maxBodyWidth?: number;
3608
+ onClickMedia?: (params: {
3609
+ url: string;
3610
+ type: string;
3611
+ }) => void;
3612
+ onClickMediaFiles?: (params: {
3613
+ files: Array<{
3614
+ url: string;
3615
+ type: string;
3616
+ name?: string;
3617
+ }>;
3618
+ index: number;
3619
+ }) => void;
3620
+ onClickFile?: (params: {
3621
+ url: string;
3622
+ type: string;
3623
+ }) => void;
3624
+ onClickLink?: (params: {
3625
+ url: string;
3626
+ }) => void;
3627
+ children?: ReactNode;
3628
+ })) => ReactNode;
3629
+ Challenge: (_: ({
3630
+ messageType: "user";
3631
+ message: string;
3632
+ } & {
3633
+ sender: {
3634
+ nickname: string;
3635
+ profileUrl?: string;
3636
+ };
3637
+ thinkingMessage?: string;
3638
+ suggestedRepliesVisible?: boolean;
3639
+ suggestedRepliesDirection?: "vertical" | "horizontal";
3640
+ isBotMessage?: boolean;
3641
+ isTyping?: boolean;
3642
+ isStreaming?: boolean;
3643
+ isHandedOff?: boolean;
3644
+ isConversationClosed?: boolean;
3645
+ isFeedbackEnabled?: boolean;
3646
+ isFeedbackCommentEnabled?: boolean;
3647
+ isSenderAvatarVisible?: boolean;
3648
+ markdownImageRenderMode?: MarkdownImageRenderMode;
3649
+ onGetCachedMessageTemplate?: (templateKey: string) => string | null;
3650
+ onRequestMessageTemplate?: (templateKey: string) => Promise<string>;
3651
+ onHandleTemplateInternalAction?: (action: Action) => void;
3652
+ onClickSuggestedReply?: (params: {
3653
+ reply: string;
3654
+ }) => void;
3655
+ onClickCTA?: (params: {
3656
+ url: string;
3657
+ }) => void;
3658
+ onClickCitation?: (citation: CitationInfo) => void;
3659
+ onFeedbackUpdate?: (params: {
3660
+ rating: "good" | "bad";
3661
+ comment?: string;
3662
+ } | null) => void;
3663
+ onSubmitForm?: (params: {
3664
+ key: string;
3665
+ data: Record<string, FormFieldValue>;
3666
+ }) => Promise<void>;
3667
+ onCancelForm?: (params: {
3668
+ key: string;
3669
+ }) => Promise<void>;
3670
+ onSendChallengeAction?: <T = object>(params: ChallengeActionParams) => Promise<T>;
3333
3671
  onStreamAnimationStart?: () => void;
3334
3672
  onStreamAnimationProgress?: () => void;
3335
3673
  onStreamAnimationComplete?: () => void;
@@ -3407,6 +3745,7 @@ export declare const IncomingMessageLayout: {
3407
3745
  onCancelForm?: (params: {
3408
3746
  key: string;
3409
3747
  }) => Promise<void>;
3748
+ onSendChallengeAction?: <T = object>(params: ChallengeActionParams) => Promise<T>;
3410
3749
  onStreamAnimationStart?: () => void;
3411
3750
  onStreamAnimationProgress?: () => void;
3412
3751
  onStreamAnimationComplete?: () => void;
@@ -3484,6 +3823,7 @@ export declare const IncomingMessageLayout: {
3484
3823
  onCancelForm?: (params: {
3485
3824
  key: string;
3486
3825
  }) => Promise<void>;
3826
+ onSendChallengeAction?: <T = object>(params: ChallengeActionParams) => Promise<T>;
3487
3827
  onStreamAnimationStart?: () => void;
3488
3828
  onStreamAnimationProgress?: () => void;
3489
3829
  onStreamAnimationComplete?: () => void;
@@ -3610,6 +3950,239 @@ export declare const IncomingMessageLayout: {
3610
3950
  onCancelForm?: (params: {
3611
3951
  key: string;
3612
3952
  }) => Promise<void>;
3953
+ onSendChallengeAction?: <T = object>(params: ChallengeActionParams) => Promise<T>;
3954
+ onStreamAnimationStart?: () => void;
3955
+ onStreamAnimationProgress?: () => void;
3956
+ onStreamAnimationComplete?: () => void;
3957
+ messageTemplateErrorFallback?: ReactNode;
3958
+ messageTemplateLoadingFallback?: ReactNode;
3959
+ } & {
3960
+ data?: string;
3961
+ createdAt?: number;
3962
+ extendedMessagePayload?: Partial<ExtendedMessagePayload>;
3963
+ groupType?: MessageGroupType;
3964
+ maxBodyWidth?: number;
3965
+ onClickMedia?: (params: {
3966
+ url: string;
3967
+ type: string;
3968
+ }) => void;
3969
+ onClickMediaFiles?: (params: {
3970
+ files: Array<{
3971
+ url: string;
3972
+ type: string;
3973
+ name?: string;
3974
+ }>;
3975
+ index: number;
3976
+ }) => void;
3977
+ onClickFile?: (params: {
3978
+ url: string;
3979
+ type: string;
3980
+ }) => void;
3981
+ onClickLink?: (params: {
3982
+ url: string;
3983
+ }) => void;
3984
+ children?: ReactNode;
3985
+ }) | ({
3986
+ messageType: "file";
3987
+ message: string;
3988
+ file: {
3989
+ type: string;
3990
+ url: string;
3991
+ name: string;
3992
+ };
3993
+ } & {
3994
+ sender: {
3995
+ nickname: string;
3996
+ profileUrl?: string;
3997
+ };
3998
+ thinkingMessage?: string;
3999
+ suggestedRepliesVisible?: boolean;
4000
+ suggestedRepliesDirection?: "vertical" | "horizontal";
4001
+ isBotMessage?: boolean;
4002
+ isTyping?: boolean;
4003
+ isStreaming?: boolean;
4004
+ isHandedOff?: boolean;
4005
+ isConversationClosed?: boolean;
4006
+ isFeedbackEnabled?: boolean;
4007
+ isFeedbackCommentEnabled?: boolean;
4008
+ isSenderAvatarVisible?: boolean;
4009
+ markdownImageRenderMode?: MarkdownImageRenderMode;
4010
+ onGetCachedMessageTemplate?: (templateKey: string) => string | null;
4011
+ onRequestMessageTemplate?: (templateKey: string) => Promise<string>;
4012
+ onHandleTemplateInternalAction?: (action: Action) => void;
4013
+ onClickSuggestedReply?: (params: {
4014
+ reply: string;
4015
+ }) => void;
4016
+ onClickCTA?: (params: {
4017
+ url: string;
4018
+ }) => void;
4019
+ onClickCitation?: (citation: CitationInfo) => void;
4020
+ onFeedbackUpdate?: (params: {
4021
+ rating: "good" | "bad";
4022
+ comment?: string;
4023
+ } | null) => void;
4024
+ onSubmitForm?: (params: {
4025
+ key: string;
4026
+ data: Record<string, FormFieldValue>;
4027
+ }) => Promise<void>;
4028
+ onCancelForm?: (params: {
4029
+ key: string;
4030
+ }) => Promise<void>;
4031
+ onSendChallengeAction?: <T = object>(params: ChallengeActionParams) => Promise<T>;
4032
+ onStreamAnimationStart?: () => void;
4033
+ onStreamAnimationProgress?: () => void;
4034
+ onStreamAnimationComplete?: () => void;
4035
+ messageTemplateErrorFallback?: ReactNode;
4036
+ messageTemplateLoadingFallback?: ReactNode;
4037
+ } & {
4038
+ data?: string;
4039
+ createdAt?: number;
4040
+ extendedMessagePayload?: Partial<ExtendedMessagePayload>;
4041
+ groupType?: MessageGroupType;
4042
+ maxBodyWidth?: number;
4043
+ onClickMedia?: (params: {
4044
+ url: string;
4045
+ type: string;
4046
+ }) => void;
4047
+ onClickMediaFiles?: (params: {
4048
+ files: Array<{
4049
+ url: string;
4050
+ type: string;
4051
+ name?: string;
4052
+ }>;
4053
+ index: number;
4054
+ }) => void;
4055
+ onClickFile?: (params: {
4056
+ url: string;
4057
+ type: string;
4058
+ }) => void;
4059
+ onClickLink?: (params: {
4060
+ url: string;
4061
+ }) => void;
4062
+ children?: ReactNode;
4063
+ }) | ({
4064
+ messageType: "multipleFiles";
4065
+ message: string;
4066
+ files: {
4067
+ type: string;
4068
+ url: string;
4069
+ name: string;
4070
+ }[];
4071
+ } & {
4072
+ sender: {
4073
+ nickname: string;
4074
+ profileUrl?: string;
4075
+ };
4076
+ thinkingMessage?: string;
4077
+ suggestedRepliesVisible?: boolean;
4078
+ suggestedRepliesDirection?: "vertical" | "horizontal";
4079
+ isBotMessage?: boolean;
4080
+ isTyping?: boolean;
4081
+ isStreaming?: boolean;
4082
+ isHandedOff?: boolean;
4083
+ isConversationClosed?: boolean;
4084
+ isFeedbackEnabled?: boolean;
4085
+ isFeedbackCommentEnabled?: boolean;
4086
+ isSenderAvatarVisible?: boolean;
4087
+ markdownImageRenderMode?: MarkdownImageRenderMode;
4088
+ onGetCachedMessageTemplate?: (templateKey: string) => string | null;
4089
+ onRequestMessageTemplate?: (templateKey: string) => Promise<string>;
4090
+ onHandleTemplateInternalAction?: (action: Action) => void;
4091
+ onClickSuggestedReply?: (params: {
4092
+ reply: string;
4093
+ }) => void;
4094
+ onClickCTA?: (params: {
4095
+ url: string;
4096
+ }) => void;
4097
+ onClickCitation?: (citation: CitationInfo) => void;
4098
+ onFeedbackUpdate?: (params: {
4099
+ rating: "good" | "bad";
4100
+ comment?: string;
4101
+ } | null) => void;
4102
+ onSubmitForm?: (params: {
4103
+ key: string;
4104
+ data: Record<string, FormFieldValue>;
4105
+ }) => Promise<void>;
4106
+ onCancelForm?: (params: {
4107
+ key: string;
4108
+ }) => Promise<void>;
4109
+ onSendChallengeAction?: <T = object>(params: ChallengeActionParams) => Promise<T>;
4110
+ onStreamAnimationStart?: () => void;
4111
+ onStreamAnimationProgress?: () => void;
4112
+ onStreamAnimationComplete?: () => void;
4113
+ messageTemplateErrorFallback?: ReactNode;
4114
+ messageTemplateLoadingFallback?: ReactNode;
4115
+ } & {
4116
+ data?: string;
4117
+ createdAt?: number;
4118
+ extendedMessagePayload?: Partial<ExtendedMessagePayload>;
4119
+ groupType?: MessageGroupType;
4120
+ maxBodyWidth?: number;
4121
+ onClickMedia?: (params: {
4122
+ url: string;
4123
+ type: string;
4124
+ }) => void;
4125
+ onClickMediaFiles?: (params: {
4126
+ files: Array<{
4127
+ url: string;
4128
+ type: string;
4129
+ name?: string;
4130
+ }>;
4131
+ index: number;
4132
+ }) => void;
4133
+ onClickFile?: (params: {
4134
+ url: string;
4135
+ type: string;
4136
+ }) => void;
4137
+ onClickLink?: (params: {
4138
+ url: string;
4139
+ }) => void;
4140
+ children?: ReactNode;
4141
+ })) => ReactNode;
4142
+ }) => null;
4143
+ Challenge: (props: {
4144
+ component: (_: ({
4145
+ messageType: "user";
4146
+ message: string;
4147
+ } & {
4148
+ sender: {
4149
+ nickname: string;
4150
+ profileUrl?: string;
4151
+ };
4152
+ thinkingMessage?: string;
4153
+ suggestedRepliesVisible?: boolean;
4154
+ suggestedRepliesDirection?: "vertical" | "horizontal";
4155
+ isBotMessage?: boolean;
4156
+ isTyping?: boolean;
4157
+ isStreaming?: boolean;
4158
+ isHandedOff?: boolean;
4159
+ isConversationClosed?: boolean;
4160
+ isFeedbackEnabled?: boolean;
4161
+ isFeedbackCommentEnabled?: boolean;
4162
+ isSenderAvatarVisible?: boolean;
4163
+ markdownImageRenderMode?: MarkdownImageRenderMode;
4164
+ onGetCachedMessageTemplate?: (templateKey: string) => string | null;
4165
+ onRequestMessageTemplate?: (templateKey: string) => Promise<string>;
4166
+ onHandleTemplateInternalAction?: (action: Action) => void;
4167
+ onClickSuggestedReply?: (params: {
4168
+ reply: string;
4169
+ }) => void;
4170
+ onClickCTA?: (params: {
4171
+ url: string;
4172
+ }) => void;
4173
+ onClickCitation?: (citation: CitationInfo) => void;
4174
+ onFeedbackUpdate?: (params: {
4175
+ rating: "good" | "bad";
4176
+ comment?: string;
4177
+ } | null) => void;
4178
+ onSubmitForm?: (params: {
4179
+ key: string;
4180
+ data: Record<string, FormFieldValue>;
4181
+ }) => Promise<void>;
4182
+ onCancelForm?: (params: {
4183
+ key: string;
4184
+ }) => Promise<void>;
4185
+ onSendChallengeAction?: <T = object>(params: ChallengeActionParams) => Promise<T>;
3613
4186
  onStreamAnimationStart?: () => void;
3614
4187
  onStreamAnimationProgress?: () => void;
3615
4188
  onStreamAnimationComplete?: () => void;
@@ -3687,6 +4260,7 @@ export declare const IncomingMessageLayout: {
3687
4260
  onCancelForm?: (params: {
3688
4261
  key: string;
3689
4262
  }) => Promise<void>;
4263
+ onSendChallengeAction?: <T = object>(params: ChallengeActionParams) => Promise<T>;
3690
4264
  onStreamAnimationStart?: () => void;
3691
4265
  onStreamAnimationProgress?: () => void;
3692
4266
  onStreamAnimationComplete?: () => void;
@@ -3764,6 +4338,7 @@ export declare const IncomingMessageLayout: {
3764
4338
  onCancelForm?: (params: {
3765
4339
  key: string;
3766
4340
  }) => Promise<void>;
4341
+ onSendChallengeAction?: <T = object>(params: ChallengeActionParams) => Promise<T>;
3767
4342
  onStreamAnimationStart?: () => void;
3768
4343
  onStreamAnimationProgress?: () => void;
3769
4344
  onStreamAnimationComplete?: () => void;
@@ -3873,7 +4448,7 @@ declare interface LanguageSet extends Omit<AIAgentLanguageSet, 'strings'> {
3873
4448
  stringSet: StringSet;
3874
4449
  }
3875
4450
 
3876
- export declare function LauncherBase({ className, children, isOpened, onClick, 'aria-label': ariaLabel, 'aria-describedby': ariaDescribedBy, type, imageUrl, dir, animated, backgroundColor, size, }: LauncherProps): JSX.Element;
4451
+ export declare function LauncherBase({ className, children, isOpened, onClick, 'aria-label': ariaLabel, 'aria-describedby': ariaDescribedBy, type, imageUrl, dir, animated, backgroundColor, size, hasUnread, }: LauncherProps): JSX.Element;
3877
4452
 
3878
4453
  declare type LauncherImageType = 'default_icon' | 'custom_image';
3879
4454
 
@@ -3895,6 +4470,7 @@ declare type LauncherProps = {
3895
4470
  animated?: boolean;
3896
4471
  dir?: 'ltr' | 'rtl';
3897
4472
  size?: number;
4473
+ hasUnread?: boolean;
3898
4474
  };
3899
4475
 
3900
4476
  declare interface LayoutContextValue<Props, Components extends Record<string, ComponentType<any>>> {
@@ -4746,6 +5322,7 @@ declare type StringSet = {
4746
5322
  A11Y_CONVERSATION_CLOSED: string;
4747
5323
  A11Y_FILE_IMAGE: (name: string) => string;
4748
5324
  A11Y_FILE_VIDEO: (name: string) => string;
5325
+ A11Y_FILE_PDF: (name: string) => string;
4749
5326
  A11Y_FILE_DOCUMENT: (name: string) => string;
4750
5327
  A11Y_RECEIVED_FILE_IMAGE: string;
4751
5328
  A11Y_RECEIVED_FILE_VIDEO: string;
@@ -4887,11 +5464,6 @@ declare type TextField = {
4887
5464
  };
4888
5465
  };
4889
5466
 
4890
- declare interface ThrottledFunction<T extends (...args: any[]) => any> {
4891
- (...args: Parameters<T>): void;
4892
- cancel: () => void;
4893
- }
4894
-
4895
5467
  declare interface TimerData {
4896
5468
  startTime: number | null;
4897
5469
  endTime: number | null;