@sendbird/ai-agent-messenger-react 1.41.0 → 1.43.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
@@ -65,8 +65,11 @@ declare interface ActiveChannelUpdatedParams {
65
65
  }
66
66
 
67
67
  export declare interface AgentClientHandlers extends AIAgentClientHandlers {
68
+ /** @internal */
68
69
  onMessageSend?: (message: string) => void;
70
+ /** @internal */
69
71
  onFunctionCallDetailClick?: (func: FunctionCallsInfo) => void;
72
+ /** @internal */
70
73
  onInitializeFailed?: (error: Error) => void;
71
74
  }
72
75
 
@@ -251,8 +254,7 @@ customApiHost?: string;
251
254
  * */
252
255
  agentPreviewConfigs?: AgentPreviewConfigs;
253
256
  /**
254
- * @internal
255
- * @description Event handlers for the ai agent client.
257
+ * @public
256
258
  */
257
259
  handlers?: AgentClientHandlers;
258
260
  /**
@@ -267,7 +269,8 @@ enableCloseConversationButton?: boolean;
267
269
  enableExpandButton?: boolean;
268
270
  /**
269
271
  * @internal
270
- * @description Whether to automatically disconnect the WebSocket when the user is inactive in launcher mode.
272
+ * @description Whether to automatically disconnect the WebSocket after the messenger stays closed for 60 seconds.
273
+ * The legacy name is kept for compatibility; this applies regardless of launcher rendering or customization.
271
274
  * Set to false to keep the connection alive even during inactivity. (default: true)
272
275
  */
273
276
  enableAutoDisconnectInLauncher?: boolean;
@@ -439,6 +442,10 @@ declare interface AIAgentClientHandlers {
439
442
  * should be efficient and non-blocking, as this may be called frequently.
440
443
  */
441
444
  onLiveMetric?: (metric: LiveMetric) => void;
445
+ /**
446
+ * Called when a displayable nudge message is received after `requestNudgeMessage`.
447
+ */
448
+ onNudgeMessageReceived?: (response: NudgeMessageResponse) => void;
442
449
  }
443
450
 
444
451
  declare type AIAgentCommonIconName =
@@ -1016,8 +1023,7 @@ export declare type AIAgentProps = PropsWithChildren<{
1016
1023
  * */
1017
1024
  agentPreviewConfigs?: AgentPreviewConfigs;
1018
1025
  /**
1019
- * @internal
1020
- * @description Event handlers for the ai agent client.
1026
+ * @public
1021
1027
  */
1022
1028
  handlers?: AgentClientHandlers;
1023
1029
  /**
@@ -1032,7 +1038,8 @@ export declare type AIAgentProps = PropsWithChildren<{
1032
1038
  enableExpandButton?: boolean;
1033
1039
  /**
1034
1040
  * @internal
1035
- * @description Whether to automatically disconnect the WebSocket when the user is inactive in launcher mode.
1041
+ * @description Whether to automatically disconnect the WebSocket after the messenger stays closed for 60 seconds.
1042
+ * The legacy name is kept for compatibility; this applies regardless of launcher rendering or customization.
1036
1043
  * Set to false to keep the connection alive even during inactivity. (default: true)
1037
1044
  */
1038
1045
  enableAutoDisconnectInLauncher?: boolean;
@@ -2892,6 +2899,10 @@ declare type CustomEvent_2 =
2892
2899
  | {
2893
2900
  type: 'user-action-requested';
2894
2901
  data: UserActionRequestedData;
2902
+ }
2903
+ | {
2904
+ type: 'external-handoff-changed';
2905
+ data: ExternalHandoffChangedData;
2895
2906
  };
2896
2907
  export { CustomEvent_2 as CustomEvent }
2897
2908
 
@@ -3105,6 +3116,8 @@ export declare interface ExtendedMessagePayload {
3105
3116
  // Whether this message is the last bubble in a multi-bubble turn.
3106
3117
  // Sent as `true` only on the last bubble; omitted (undefined) on non-last bubbles.
3107
3118
  // Only reliable once the server stream has completed (data.stream = false).
3119
+ // Not on the payload spec page yet — agreed in Slack:
3120
+ // https://sendbird.slack.com/archives/C0BLUB6G3RP/p1787219498878089
3108
3121
  is_last_in_turn?: boolean;
3109
3122
  cta_button: {
3110
3123
  label: string;
@@ -3187,13 +3200,36 @@ declare type ExternalAuthTokenExpiredData = {
3187
3200
  cpaKey: string;
3188
3201
  };
3189
3202
 
3203
+ /**
3204
+ * A change to the external-service handoff the server records as channel metadata.
3205
+ *
3206
+ * Both fields carry the current state, not only the one the server just changed, so the newest
3207
+ * event supersedes the previous one rather than merging into it. Live only: not replayed on load
3208
+ * or after a reconnect, and the same state can arrive more than once, so handle it idempotently.
3209
+ */
3210
+ export declare interface ExternalHandoffChangedData {
3211
+ /** The destination the server wrote, or `null` when this client has not seen the destination write. Server-defined and open-ended. */
3212
+ externalServiceType: string | null;
3213
+ /** Unix seconds, set once the external session ended. */
3214
+ endedAt: number | null;
3215
+ }
3216
+
3190
3217
  export declare interface FeedbackInfo {
3191
3218
  rating: 'good' | 'bad';
3192
3219
  comment?: string;
3193
3220
  }
3194
3221
 
3222
+ export declare interface FixedLauncherProps extends Pick<LauncherProps, 'opened' | 'setOpened' | 'entryPoint' | 'activeRoute'> {
3223
+ /** Configured launcher size, available for sizing or positioning your custom UI. */
3224
+ size?: number;
3225
+ /** Placement styles for the custom launcher. Apply them or use your own positioning. */
3226
+ style?: CSSProperties;
3227
+ }
3228
+
3195
3229
  export declare const FixedMessenger: ForwardRefExoticComponent<MessengerProps & RefAttributes<MessengerSessionRef>> & {
3196
3230
  Style: (props: FixedMessengerStyleProps) => null;
3231
+ Launcher: ({ component }: FixedMessengerLauncherProps) => null;
3232
+ NudgeMessage: ({ component }: FixedMessengerNudgeMessageProps) => null;
3197
3233
  Conversation: ({ component }: FixedMessengerConversationProps) => null;
3198
3234
  ConversationChildren: ({ children }: PropsWithChildren) => null;
3199
3235
  ConversationList: ({ component }: FixedMessengerConversationListProps) => null;
@@ -3208,6 +3244,10 @@ declare interface FixedMessengerConversationProps {
3208
3244
  component: ComponentType<ConversationProps>;
3209
3245
  }
3210
3246
 
3247
+ declare interface FixedMessengerLauncherProps {
3248
+ component: ComponentType<FixedLauncherProps>;
3249
+ }
3250
+
3211
3251
  export declare type FixedMessengerMargin = {
3212
3252
  top: number;
3213
3253
  bottom: number;
@@ -3215,6 +3255,10 @@ export declare type FixedMessengerMargin = {
3215
3255
  end: number;
3216
3256
  };
3217
3257
 
3258
+ declare interface FixedMessengerNudgeMessageProps {
3259
+ component: ComponentType<FixedNudgeMessageProps>;
3260
+ }
3261
+
3218
3262
  export declare type FixedMessengerPosition = `${PositionHorizontal}-${PositionVertical}`;
3219
3263
 
3220
3264
  declare interface FixedMessengerStyleProps {
@@ -3237,6 +3281,11 @@ declare interface FixedMessengerStyleProps {
3237
3281
  launcherSize?: number;
3238
3282
  }
3239
3283
 
3284
+ export declare interface FixedNudgeMessageProps extends Omit<NudgeMessageViewProps, 'nudgeMessageKey'> {
3285
+ /** Placement styles for the custom nudge message. Apply them or use your own positioning. */
3286
+ style?: CSSProperties;
3287
+ }
3288
+
3240
3289
  declare type ForegroundTaskScheduler = (start: () => void) => void | (() => void);
3241
3290
 
3242
3291
  declare interface Form {
@@ -5624,7 +5673,7 @@ declare interface LanguageSet extends Omit<AIAgentLanguageSet, 'strings'> {
5624
5673
  stringSet: StringSet;
5625
5674
  }
5626
5675
 
5627
- export declare function LauncherBase({ className, children, isOpened, onClick, 'aria-label': ariaLabel, 'aria-describedby': ariaDescribedBy, type, imageUrl, dir, animated, backgroundColor, size, hasUnread, }: LauncherProps): JSX.Element;
5676
+ export declare function LauncherBase({ className, children, isOpened, onClick, 'aria-label': ariaLabel, 'aria-describedby': ariaDescribedBy, type, imageUrl, dir, animated, backgroundColor, size, hasUnread, }: LauncherProps_2): JSX.Element;
5628
5677
 
5629
5678
  declare type LauncherImageType = 'default_icon' | 'custom_image';
5630
5679
 
@@ -5634,6 +5683,15 @@ declare interface LauncherInfo {
5634
5683
  }
5635
5684
 
5636
5685
  declare type LauncherProps = {
5686
+ opened: boolean;
5687
+ setOpened: (opened: boolean) => void;
5688
+ size?: number;
5689
+ className?: string;
5690
+ entryPoint?: LauncherRoute;
5691
+ activeRoute?: LauncherRoute;
5692
+ };
5693
+
5694
+ declare type LauncherProps_2 = {
5637
5695
  className?: string;
5638
5696
  children?: ReactNode;
5639
5697
  isOpened: boolean;
@@ -5649,6 +5707,8 @@ declare type LauncherProps = {
5649
5707
  hasUnread?: boolean;
5650
5708
  };
5651
5709
 
5710
+ export declare type LauncherRoute = 'Conversation' | 'ConversationList';
5711
+
5652
5712
  declare interface LayoutContextValue<Props, Components extends Record<string, ComponentType<any>>> {
5653
5713
  Template: ComponentType<Props>;
5654
5714
  updateTemplate: (template: ComponentType<Props>) => void;
@@ -6704,6 +6764,21 @@ export declare interface NudgeMessageResponse {
6704
6764
  callbackUserMessage?: string;
6705
6765
  }
6706
6766
 
6767
+ declare interface NudgeMessageState {
6768
+ /** The nudge to display; null while the messenger is opened or no nudge is active. */
6769
+ nudgeMessage: NudgeMessageResponse | null;
6770
+ /**
6771
+ * Counts nudges received and never falls back when one is cleared; each platform's renderer keys
6772
+ * the bubble on it to replay the entrance animation.
6773
+ */
6774
+ nudgeMessageKey: number;
6775
+ dismissNudgeMessage: () => void;
6776
+ /** Starts a new conversation from the nudge: creates a channel, opens the messenger, and sends the callback user message. */
6777
+ startNudgeConversation: () => Promise<void>;
6778
+ }
6779
+
6780
+ declare type NudgeMessageViewProps = NudgeMessageState;
6781
+
6707
6782
  declare type NumberField = {
6708
6783
  key: string;
6709
6784
  type: 'number';