@sendbird/ai-agent-messenger-react 1.36.0 → 1.37.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
@@ -776,6 +776,8 @@ declare interface AIAgentInterface {
776
776
  updateContext: (channelUrl: string, context: Record<string, string>) => Promise<ContextObject>;
777
777
  /** Retrieves the context data for the specified channel */
778
778
  getContextObject: (channelUrl: string) => Promise<ContextObject>;
779
+ /** Requests a nudge message to be shown above the launcher. Fire-and-forget: the result is only broadcast to onNudgeMessageReceived subscribers */
780
+ requestNudgeMessage: (params: RequestNudgeMessageParams) => Promise<void>;
779
781
  /** Clears memories saved for the current user */
780
782
  clearUserMemories: (params?: ClearUserMemoriesParams) => Promise<void>;
781
783
 
@@ -786,7 +788,7 @@ declare interface AIAgentInterface {
786
788
  setUserMemoryState: (params: SetUserMemoryStateParams) => Promise<MemoryInfo>;
787
789
 
788
790
  /** @internal Initializes a conversation on the channel if needed (AI Agent channel without conversation). */
789
- initConversationIfNeeded: (channel: ChatSDKGroupChannel) => Promise<void>;
791
+ initConversationIfNeeded: (channel: ChatSDKGroupChannel, params?: { initialUserMessage?: string }) => Promise<void>;
790
792
 
791
793
  /** @internal Live metric handler; bridged from {@link AIAgentClientHandlers.onLiveMetric}. */
792
794
  onLiveMetric?: LiveMetricDispatch;
@@ -797,6 +799,8 @@ declare interface AIAgentInterface {
797
799
  /** Disposes all resources held by this instance (WebSocket, desk auth, event handlers). */
798
800
  dispose: () => void;
799
801
 
802
+ /** Registers a handler for nudge message responses */
803
+ onNudgeMessageReceived: (handler: (response: NudgeMessageResponse) => void) => () => void;
800
804
  /** Registers a handler for messenger settings updates */
801
805
  onMessengerSettingsUpdated: (handler: (params: MessengerSettingsUpdatedParams) => void) => () => void;
802
806
  /** Registers a handler for active channel updates */
@@ -857,6 +861,8 @@ declare interface AIAgentMessengerSessionRef {
857
861
  /** Patches the context of a specific conversation by aiAgentId and channelUrl. */
858
862
  (aiAgentId: string, channelUrl: string, context: Record<string, string>): Promise<ContextObject>;
859
863
  };
864
+ /** Requests a nudge message to be shown above the launcher. Fire-and-forget: the response is not exposed. */
865
+ requestNudgeMessage: (params: RequestNudgeMessageParams) => Promise<void>;
860
866
  }
861
867
 
862
868
  export declare type AIAgentProps = PropsWithChildren<{
@@ -1163,6 +1169,7 @@ declare interface AIAgentStringSet {
1163
1169
  a11y_send_message: string;
1164
1170
  a11y_attach_file: string;
1165
1171
  a11y_close_messenger: string;
1172
+ a11y_dismiss_nudge_message: string;
1166
1173
  a11y_expand_messenger: string;
1167
1174
  a11y_collapse_messenger: string;
1168
1175
  a11y_connect_agent: string;
@@ -1540,6 +1547,9 @@ declare interface ColorSet {
1540
1547
  csat: {
1541
1548
  background: string;
1542
1549
  };
1550
+ conversation: {
1551
+ headerProfileSkeleton: string;
1552
+ };
1543
1553
  memoryDialog: {
1544
1554
  titleText: string;
1545
1555
  markdownBodyText: string;
@@ -1578,6 +1588,7 @@ declare interface CommandPayloads {
1578
1588
  [CommandType.ActiveChannelUpdated]: ActiveChannelUpdatedParams;
1579
1589
  [CommandType.AnonymousSessionTokenExpired]: undefined;
1580
1590
  [CommandType.AuthTokenRefreshed]: AuthTokenRefreshedParams;
1591
+ [CommandType.NudgeMessageReceived]: NudgeMessageResponse;
1581
1592
  }
1582
1593
 
1583
1594
  export declare const Commands = {
@@ -1586,6 +1597,7 @@ export declare const Commands = {
1586
1597
  ActiveChannelUpdated: (params: ActiveChannelUpdatedParams) => new ActiveChannelUpdatedCommand(params),
1587
1598
  AnonymousSessionTokenExpired: () => new AnonymousSessionTokenExpiredCommand(),
1588
1599
  AuthTokenRefreshed: () => new AuthTokenRefreshedCommand(),
1600
+ NudgeMessageReceived: (response: NudgeMessageResponse) => new NudgeMessageReceivedCommand(response),
1589
1601
  };
1590
1602
 
1591
1603
  declare enum CommandType {
@@ -1594,6 +1606,7 @@ declare enum CommandType {
1594
1606
  ActiveChannelUpdated = 'active.channel.updated',
1595
1607
  AnonymousSessionTokenExpired = 'anon.token.expired',
1596
1608
  AuthTokenRefreshed = 'auth.token.refreshed',
1609
+ NudgeMessageReceived = 'nudge.message.received',
1597
1610
  }
1598
1611
 
1599
1612
  export declare interface ConnectionDelayDialogProps {
@@ -1639,7 +1652,7 @@ declare interface ContextObject {
1639
1652
  context: Record<string, string>;
1640
1653
  }
1641
1654
 
1642
- export declare const Conversation: ({ children, onNavigateToConversationList, channelUrl, onClearChannelUrl, shouldMarkAsRead, shouldInitializeConversation, announcementsEnabled, conversationStatsEnabled, initialFocusTarget, style, closedChannelUrl, onClearClosedChannelUrl, }: ConversationProps) => JSX.Element;
1655
+ export declare const Conversation: ({ children, onNavigateToConversationList, channelUrl, onClearChannelUrl, shouldMarkAsRead, shouldInitializeConversation, initialUserMessage, announcementsEnabled, conversationStatsEnabled, initialFocusTarget, style, closedChannelUrl, onClearClosedChannelUrl, }: ConversationProps) => JSX.Element;
1643
1656
 
1644
1657
  export declare const ConversationContext: Context<ConversationContextValue | null>;
1645
1658
 
@@ -1651,6 +1664,7 @@ declare interface ConversationContextProps {
1651
1664
  conversationStatsEnabled?: boolean;
1652
1665
  /** @internal */
1653
1666
  shouldInitializeConversation?: boolean;
1667
+ initialUserMessage?: string;
1654
1668
  }
1655
1669
 
1656
1670
  export declare const ConversationContextProvider: ({ children, ...props }: PropsWithChildren<ConversationContextProps>) => JSX.Element;
@@ -2709,6 +2723,12 @@ export declare type ConversationProps = PropsWithChildren<{
2709
2723
  shouldMarkAsRead?: boolean;
2710
2724
  /** @internal */
2711
2725
  shouldInitializeConversation?: boolean;
2726
+ /**
2727
+ * Message to send as the first user message when the conversation is initialized
2728
+ * on the server (e.g., the callback user message of a clicked nudge message).
2729
+ * Applied only when the channel has no conversation yet.
2730
+ */
2731
+ initialUserMessage?: string;
2712
2732
  announcementsEnabled?: boolean;
2713
2733
  /** @default true */
2714
2734
  conversationStatsEnabled?: boolean;
@@ -5840,6 +5860,13 @@ declare interface NetworkStateAdapter {
5840
5860
  subscribe: (callback: (isOnline: boolean) => void) => () => void;
5841
5861
  }
5842
5862
 
5863
+ export declare interface NudgeMessageResponse {
5864
+ /** Message to display above the launcher. */
5865
+ message: string;
5866
+ /** Message to send as the first user message when the nudge is clicked. */
5867
+ callbackUserMessage?: string;
5868
+ }
5869
+
5843
5870
  declare type NumberField = {
5844
5871
  key: string;
5845
5872
  type: 'number';
@@ -6421,6 +6448,13 @@ declare class RenderedContentUnusableStatsTracker extends StatsTrackerBase {
6421
6448
  }
6422
6449
  }
6423
6450
 
6451
+ export declare interface RequestNudgeMessageParams {
6452
+ /** Event key that triggers the nudge message. */
6453
+ key: string;
6454
+ /** Additional context for the server to generate the message. */
6455
+ context?: Record<string, string>;
6456
+ }
6457
+
6424
6458
  declare interface ResolvedHandlers extends AgentClientHandlers {
6425
6459
  onClickLink: (params: {
6426
6460
  url: string;
@@ -7075,6 +7109,7 @@ export declare type StringSet = {
7075
7109
  A11Y_CONVERSATION_ITEM: (agent: string, status: string, time: string, count: number) => string;
7076
7110
  A11Y_CONNECT_AGENT: string;
7077
7111
  A11Y_CLOSE_MESSENGER: string;
7112
+ A11Y_DISMISS_NUDGE_MESSAGE: string;
7078
7113
  A11Y_EXPAND_MESSENGER: string;
7079
7114
  A11Y_COLLAPSE_MESSENGER: string;
7080
7115
  A11Y_HINT_SEND_MESSAGE: string;