@paymanai/payman-ask-sdk 1.2.22 → 1.2.24

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 CHANGED
@@ -117,6 +117,32 @@ function MyApp() {
117
117
  | `sessionParams` | `SessionParams` | | User session info |
118
118
  | `autoGenerateSessionId` | `boolean` | | Auto-generate session ID |
119
119
  | `hasAskPermission` | `boolean` | | Show/hide input (default: true) |
120
+ | `uiVersion` | `1 \| 2` | | Render original UI or v2 UI |
121
+ | `showResetSession` | `boolean` | | Show a New Session button in the input bar with a confirmation modal before reset (default: false) |
122
+ | `showAttachmentButton` | `boolean` | | Show/hide the v2 attachment (+) menu button (default: true) |
123
+ | `showUploadImageButton` | `boolean` | | Show/hide the v2 Upload image option (default: true) |
124
+ | `showAttachFileButton` | `boolean` | | Show/hide the v2 Attach file option (default: true) |
125
+ | `enableVoice` | `boolean` | | Show/hide the voice input button in the composer (default: false) |
126
+ | `voiceLang` | `string` | | Speech recognition language (default: `en-US`) |
127
+ | `voiceInterimResults` | `boolean` | | Enable interim voice transcription updates (default: true) |
128
+ | `voiceContinuous` | `boolean` | | Keep listening continuously while recording (default: true) |
129
+ | `messageActions` | `MessageActionsConfig` | | Configure visible actions for `userMessageActions` and `assistantMessageActions` in the v2 UI |
130
+
131
+ `messageActions` shape:
132
+
133
+ ```ts
134
+ messageActions: {
135
+ userMessageActions?: {
136
+ copy?: boolean;
137
+ edit?: boolean;
138
+ retry?: boolean;
139
+ };
140
+ assistantMessageActions?: {
141
+ copy?: boolean;
142
+ trace?: boolean;
143
+ };
144
+ }
145
+ ```
120
146
 
121
147
  ### `APIConfig`
122
148
 
@@ -137,6 +163,9 @@ function MyApp() {
137
163
  | `onStreamStart` | `() => void` | Stream started |
138
164
  | `onStreamComplete` | `(message: MessageDisplay) => void` | Stream completed |
139
165
  | `onExecutionTraceClick` | `(data: unknown) => void` | Trace button clicked |
166
+ | `onResetSession` | `() => void` | New Session/reset button clicked |
167
+ | `onUploadImageClick` | `() => void` | v2 Upload image option clicked |
168
+ | `onAttachFileClick` | `() => void` | v2 Attach file option clicked |
140
169
 
141
170
  ### Context API: `usePaymanChat()`
142
171
 
@@ -155,6 +184,7 @@ function MyApp() {
155
184
  - **[CONTEXT_API.md](./CONTEXT_API.md)** - Context API reference
156
185
  - **[ENDPOINTS.md](./ENDPOINTS.md)** - API endpoints guide
157
186
  - **[CHANGELOG.md](./CHANGELOG.md)** - Version history
187
+ - **[docs/](./docs/README.md)** - V2 streaming events, styling, and CSS class reference (`uiVersion: 2`)
158
188
 
159
189
  ## Theming: Shimmer (active step text)
160
190
 
package/dist/index.d.mts CHANGED
@@ -1,133 +1,30 @@
1
1
  import * as React from 'react';
2
2
  import React__default from 'react';
3
- import { UserActionResult, UserActionRequest } from '@paymanai/payman-typescript-ask-sdk';
4
- export { StreamEvent, StreamOptions, UseVoiceReturn, UserActionRequest, UserActionResult, UserActionState, VoiceCallbacks, VoiceConfig, VoicePermissions, VoiceState, cancelUserAction, generateId, resendUserAction, streamWorkflowEvents, submitUserAction, useChat, useVoice } from '@paymanai/payman-typescript-ask-sdk';
3
+ import { MessageDisplay, WorkflowStage, ChatCallbacks as ChatCallbacks$1, ChatConfig as ChatConfig$1, StreamProgress, StreamingStep, UserActionRequest } from '@paymanai/payman-typescript-ask-sdk';
4
+ export { APIConfig, ChunkDisplay, MessageDisplay, MessageRole, SessionParams, StreamEvent, StreamOptions, StreamProgress, StreamingStep, UseChatReturn, UseChatV2Return, UseVoiceReturn, UserActionRequest, UserActionResult, UserActionState, UserActionType, V2EventProcessorState, VoiceCallbacks, VoiceConfig, VoicePermissions, VoiceResult, VoiceState, WorkflowStage, buildFormattedThinking, cancelUserAction, createInitialV2State, generateId, processStreamEventV2, resendUserAction, streamWorkflowEvents, submitUserAction, useChat, useChatV2, useVoice } from '@paymanai/payman-typescript-ask-sdk';
5
5
  import { ClassValue } from 'clsx';
6
6
 
7
- type MessageRole = "user" | "assistant" | "system";
8
- type StreamProgress = "started" | "processing" | "completed" | "error";
9
- type WorkflowStage = "DEV" | "SANDBOX" | "PROD" | "ARCHIVED";
10
- type StreamingStep = {
11
- id: string;
12
- eventType: string;
13
- message: string;
14
- status: "in_progress" | "completed" | "error" | "pending";
15
- timestamp: number;
16
- elapsedMs?: number;
17
- thinkingText?: string;
18
- isThinking?: boolean;
7
+ type UserMessageActionsConfig = {
8
+ /** Show copy action on user messages (default: true) */
9
+ copy?: boolean;
10
+ /** Show edit action on user messages (default: false) */
11
+ edit?: boolean;
12
+ /** Show retry/resend action on user messages (default: false) */
13
+ retry?: boolean;
19
14
  };
20
- type ChunkDisplay = {
21
- id?: string;
22
- text?: string;
23
- similarityScore?: number;
24
- rrfScore?: number;
15
+ type AssistantMessageActionsConfig = {
16
+ /** Show copy action on assistant messages (default: true) */
17
+ copy?: boolean;
18
+ /** Show trace action on assistant messages (default: true, still requires callback) */
19
+ trace?: boolean;
25
20
  };
26
- type MessageDisplay = {
27
- id: string;
28
- sessionId?: string;
29
- role: MessageRole;
30
- content: string;
31
- timestamp: string;
32
- isError?: boolean;
33
- /** "WORKFLOW_FAILED" and "STREAM_NOT_STARTED" show the friendly fallback; HTTP 409 conflicts render the backend message from the error payload. */
34
- errorDetails?: string;
35
- chunks?: ChunkDisplay[];
36
- tracingData?: unknown;
37
- executionId?: string;
38
- isStreaming?: boolean;
39
- streamingContent?: string;
40
- currentWorker?: string;
41
- currentMessage?: string;
42
- streamProgress?: StreamProgress;
43
- steps?: StreamingStep[];
44
- isCancelled?: boolean;
45
- currentExecutingStepId?: string;
46
- /** Result of user action (OTP approval/rejection) */
47
- userActionResult?: UserActionResult;
48
- /** Current thinking block text (live, resets per block) */
49
- activeThinkingText?: string;
50
- /** All thinking accumulated across blocks (for post-stream display) */
51
- allThinkingText?: string;
52
- /** True while RAG image URLs are being resolved after the final response is shown */
53
- isResolvingImages?: boolean;
21
+ type MessageActionsConfig = {
22
+ userMessageActions?: UserMessageActionsConfig;
23
+ assistantMessageActions?: AssistantMessageActionsConfig;
54
24
  };
55
- type SessionParams = {
56
- id?: string;
57
- name?: string;
58
- attributes?: Record<string, string>;
59
- };
60
- type APIConfig = {
61
- /** Base API URL */
62
- baseUrl: string;
63
- /** Auth token */
64
- authToken?: string;
65
- /** Custom headers */
66
- headers?: Record<string, string>;
67
- /** API endpoint for streaming (default: /api/workflows/ask/stream) */
68
- streamEndpoint?: string;
69
- /** API endpoint for resolving RAG image URLs (default: /api/playground/ask/resolve-image-urls) */
70
- resolveImagesEndpoint?: string;
71
- };
72
- type ChatConfig = {
73
- /** API configuration - required for the library to make calls */
74
- api: APIConfig;
75
- /** Workflow name */
76
- workflowName: string;
77
- /** User ID for chatStore and activeStreamStore — required for context store messages management */
78
- userId?: string;
79
- /** Workflow version */
80
- workflowVersion?: number;
81
- /** Stage/Environment */
82
- stage?: WorkflowStage;
83
- /** Query param name for stage (default: 'stage'). Use e.g. 'workflowStage' if the API expects that name. */
84
- stageQueryParam?: string;
85
- /** Session params */
86
- sessionParams?: SessionParams;
87
- /** Custom placeholder text */
88
- placeholder?: string;
89
- /** Empty state text */
90
- emptyStateText?: string;
91
- /** Show icon in empty state */
92
- showEmptyStateIcon?: boolean;
25
+ type ChatConfig = ChatConfig$1 & {
93
26
  /** Custom React component to render above the empty state text (e.g. logo, illustration). */
94
27
  emptyStateComponent?: React__default.ReactNode;
95
- /** Show agent name */
96
- showAgentName?: boolean;
97
- /** Agent name */
98
- agentName?: string;
99
- /** Show avatars for user and assistant messages */
100
- showAvatars?: boolean;
101
- /** Show user avatar only (overrides showAvatars for user messages) */
102
- showUserAvatar?: boolean;
103
- /** Show assistant avatar only (overrides showAvatars for assistant messages) */
104
- showAssistantAvatar?: boolean;
105
- /** Show execution steps section with "Completed in X.Xs" */
106
- showExecutionSteps?: boolean;
107
- /** Show animated dot indicator during streaming */
108
- showStreamingDot?: boolean;
109
- /** Custom text format for streaming steps button. Use {count} for step count. Default: "View progress ({count} steps)" */
110
- streamingStepsText?: string;
111
- /** Custom text format for completed steps button. Use {count} for step count, {time} for elapsed time. Default: "Completed in {time}s ({count} steps)" */
112
- completedStepsText?: string;
113
- /** Input style variant: "rounded" (yaak style) or "flat" (paygent-central style). Default: "rounded" */
114
- inputStyle?: "rounded" | "flat";
115
- /** Layout style: "centered" (durango style) or "full-width" (default). Default: "full-width" */
116
- layout?: "centered" | "full-width";
117
- /** Show timestamps on messages */
118
- showTimestamps?: boolean;
119
- /** Enable animations */
120
- animated?: boolean;
121
- /** Disable input */
122
- disableInput?: boolean;
123
- /** Has permission to ask */
124
- hasAskPermission?: boolean;
125
- /** Auto-generate session ID */
126
- autoGenerateSessionId?: boolean;
127
- /** Disable the entire chat and show disabled state */
128
- isChatDisabled?: boolean;
129
- /** Custom component to render when chat is disabled. If not provided, default disabled UI will be shown */
130
- disabledComponent?: React__default.ReactNode;
131
28
  /** Enable voice input (default: true) */
132
29
  enableVoice?: boolean;
133
30
  /** Voice language (default: "en-US") */
@@ -138,36 +35,30 @@ type ChatConfig = {
138
35
  voiceContinuous?: boolean;
139
36
  /** Show a "New Session" reset button inside the input bar (default: false) */
140
37
  showResetSession?: boolean;
38
+ /** Show the v2 attachment (+) menu button in the input bar (default: true) */
39
+ showAttachmentButton?: boolean;
40
+ /** Show the v2 "Upload image" attachment option (default: true) */
41
+ showUploadImageButton?: boolean;
42
+ /** Show the v2 "Attach file" attachment option (default: true) */
43
+ showAttachFileButton?: boolean;
44
+ /** Configure which per-message actions are visible in the v2 UI */
45
+ messageActions?: MessageActionsConfig;
46
+ /** Sentry DSN for error monitoring. */
47
+ sentryDsn?: string;
141
48
  /**
142
- * Sentry DSN for error monitoring.
143
- * The library will initialise Sentry with this DSN if Sentry has not already
144
- * been initialised by the host application.
49
+ * UI version to render.
50
+ * 1 = original component set
51
+ * 2 = redesigned chat UI (ChatGPT-style with thinking blocks, inline verification, etc.) — default
145
52
  */
146
- sentryDsn?: string;
53
+ uiVersion?: 1 | 2;
147
54
  };
148
- type ChatCallbacks = {
149
- /** Called when a message is sent (before API call) */
150
- onMessageSent?: (message: string) => void;
151
- /** Called when streaming starts */
152
- onStreamStart?: () => void;
153
- /** Called when streaming completes */
154
- onStreamComplete?: (message: MessageDisplay) => void;
155
- /** Called when an error occurs */
156
- onError?: (error: Error) => void;
157
- /** Called when execution trace is clicked - provides data instead of UI */
158
- onExecutionTraceClick?: (data: {
159
- message: MessageDisplay;
160
- tracingData?: unknown;
161
- executionId?: string;
162
- }) => void;
163
- /** Called when session ID changes */
164
- onSessionIdChange?: (sessionId: string) => void;
55
+ type ChatCallbacks = ChatCallbacks$1 & {
165
56
  /** Called when the session is reset (via SDK reset button or ref.resetSession()) */
166
57
  onResetSession?: () => void;
167
- /** Called when a user action (e.g. OTP) is required */
168
- onUserActionRequired?: (request: UserActionRequest) => void;
169
- /** Called on user action events (SUCCESS, INVALID, EXPIRED, REJECTED, RESENT, FAILED) */
170
- onUserActionEvent?: (eventType: string, message: string) => void;
58
+ /** Called when the v2 "Upload image" attachment option is clicked */
59
+ onUploadImageClick?: () => void;
60
+ /** Called when the v2 "Attach file" attachment option is clicked */
61
+ onAttachFileClick?: () => void;
171
62
  };
172
63
  type PaymanChatRef = {
173
64
  /** Clear all messages and reset the session (clears both stores + generates new session ID) */
@@ -246,6 +137,16 @@ type ChatInputProps = {
246
137
  showResetSession?: boolean;
247
138
  /** Handler called when the reset session button is clicked */
248
139
  onResetSession?: () => void;
140
+ /** Show the attachment (+) menu button */
141
+ showAttachmentButton?: boolean;
142
+ /** Show the "Upload image" attachment option */
143
+ showUploadImageButton?: boolean;
144
+ /** Show the "Attach file" attachment option */
145
+ showAttachFileButton?: boolean;
146
+ /** Handler called when the "Upload image" option is clicked */
147
+ onUploadImageClick?: () => void;
148
+ /** Handler called when the "Attach file" option is clicked */
149
+ onAttachFileClick?: () => void;
249
150
  /** React Native: called when the text input is focused (e.g. to scroll messages above the keyboard). */
250
151
  onInputFocus?: () => void;
251
152
  };
@@ -300,16 +201,50 @@ type MessageListProps = {
300
201
  isLoadingMoreMessages?: boolean;
301
202
  /** Whether there are more messages to load */
302
203
  hasMoreMessages?: boolean;
303
- /**
304
- * React Native: while true, keep scrolling to the end as layout updates (waiting for assistant reply).
305
- */
204
+ /** React Native: while true, keep scrolling to the end as layout updates. */
306
205
  isWaitingForResponse?: boolean;
307
- /**
308
- * React Native: ref to register a no-arg function that scrolls the message list to the end.
309
- * Used so the parent can scroll when the input is focused and the keyboard opens.
310
- */
206
+ /** React Native: ref to register a no-arg function that scrolls the message list to the end. */
311
207
  scrollToEndHandleRef?: React__default.MutableRefObject<(() => void) | null>;
312
208
  };
209
+ type MessageListV2Props = {
210
+ /** Messages to display */
211
+ messages: MessageDisplay[];
212
+ /** Whether an assistant response is currently streaming */
213
+ isStreaming?: boolean;
214
+ /** Edit a user message */
215
+ onEditUserMessage?: (messageId: string) => void;
216
+ /** Retry a user message */
217
+ onRetryUserMessage?: (messageId: string) => void;
218
+ /** Open a markdown image */
219
+ onImageClick?: (src: string, alt: string) => void;
220
+ /** Execution trace click handler */
221
+ onExecutionTraceClick?: (data: {
222
+ message: MessageDisplay;
223
+ tracingData?: unknown;
224
+ executionId?: string;
225
+ }) => void;
226
+ /** Which message actions are visible */
227
+ messageActions?: MessageActionsConfig;
228
+ /** Disable retry/resend actions while the chat is busy */
229
+ retryDisabled?: boolean;
230
+ /** Current user action card */
231
+ userAction?: {
232
+ messageId: string;
233
+ action: {
234
+ type: string;
235
+ message: string;
236
+ amount?: string;
237
+ payeeName?: string;
238
+ };
239
+ status: "pending" | "verifying" | "approved" | "rejected" | "error";
240
+ } | null;
241
+ /** Approve a user action */
242
+ onApproveAction?: (messageId: string, otp: string) => Promise<void>;
243
+ /** Reject a user action */
244
+ onRejectAction?: (messageId: string) => Promise<void>;
245
+ /** Resend a user action */
246
+ onResendAction?: (messageId: string) => Promise<void>;
247
+ };
313
248
  type MessageRowProps = {
314
249
  /** Message to display */
315
250
  message: MessageDisplay;
@@ -517,4 +452,4 @@ declare function cn(...inputs: ClassValue[]): string;
517
452
  */
518
453
  declare function formatDate(timestamp: string | Date): string;
519
454
 
520
- export { type APIConfig, type AgentMessageProps, type ChatCallbacks, type ChatConfig, type ChatHeaderProps, type ChatInputProps, type ChunkDisplay, type MessageDisplay, type MessageListProps, type MessageRole, type MessageRowProps, type OtpInputProps, PaymanChat, PaymanChatContext, type PaymanChatContextValue, type PaymanChatProps, type PaymanChatRef, type SessionParams, type StreamProgress, type StreamingMessageProps, type StreamingStep, type UserActionModalProps, type UserMessageProps, type WorkflowStage, cn, formatDate, usePaymanChat };
455
+ export { type AgentMessageProps, type AssistantMessageActionsConfig, type ChatCallbacks, type ChatConfig, type ChatHeaderProps, type ChatInputProps, type MessageActionsConfig, type MessageListProps, type MessageListV2Props, type MessageRowProps, type OtpInputProps, PaymanChat, PaymanChatContext, type PaymanChatContextValue, type PaymanChatProps, type PaymanChatRef, type StreamingMessageProps, type UserActionModalProps, type UserMessageActionsConfig, type UserMessageProps, cn, formatDate, usePaymanChat };
package/dist/index.d.ts CHANGED
@@ -1,133 +1,30 @@
1
1
  import * as React from 'react';
2
2
  import React__default from 'react';
3
- import { UserActionResult, UserActionRequest } from '@paymanai/payman-typescript-ask-sdk';
4
- export { StreamEvent, StreamOptions, UseVoiceReturn, UserActionRequest, UserActionResult, UserActionState, VoiceCallbacks, VoiceConfig, VoicePermissions, VoiceState, cancelUserAction, generateId, resendUserAction, streamWorkflowEvents, submitUserAction, useChat, useVoice } from '@paymanai/payman-typescript-ask-sdk';
3
+ import { MessageDisplay, WorkflowStage, ChatCallbacks as ChatCallbacks$1, ChatConfig as ChatConfig$1, StreamProgress, StreamingStep, UserActionRequest } from '@paymanai/payman-typescript-ask-sdk';
4
+ export { APIConfig, ChunkDisplay, MessageDisplay, MessageRole, SessionParams, StreamEvent, StreamOptions, StreamProgress, StreamingStep, UseChatReturn, UseChatV2Return, UseVoiceReturn, UserActionRequest, UserActionResult, UserActionState, UserActionType, V2EventProcessorState, VoiceCallbacks, VoiceConfig, VoicePermissions, VoiceResult, VoiceState, WorkflowStage, buildFormattedThinking, cancelUserAction, createInitialV2State, generateId, processStreamEventV2, resendUserAction, streamWorkflowEvents, submitUserAction, useChat, useChatV2, useVoice } from '@paymanai/payman-typescript-ask-sdk';
5
5
  import { ClassValue } from 'clsx';
6
6
 
7
- type MessageRole = "user" | "assistant" | "system";
8
- type StreamProgress = "started" | "processing" | "completed" | "error";
9
- type WorkflowStage = "DEV" | "SANDBOX" | "PROD" | "ARCHIVED";
10
- type StreamingStep = {
11
- id: string;
12
- eventType: string;
13
- message: string;
14
- status: "in_progress" | "completed" | "error" | "pending";
15
- timestamp: number;
16
- elapsedMs?: number;
17
- thinkingText?: string;
18
- isThinking?: boolean;
7
+ type UserMessageActionsConfig = {
8
+ /** Show copy action on user messages (default: true) */
9
+ copy?: boolean;
10
+ /** Show edit action on user messages (default: false) */
11
+ edit?: boolean;
12
+ /** Show retry/resend action on user messages (default: false) */
13
+ retry?: boolean;
19
14
  };
20
- type ChunkDisplay = {
21
- id?: string;
22
- text?: string;
23
- similarityScore?: number;
24
- rrfScore?: number;
15
+ type AssistantMessageActionsConfig = {
16
+ /** Show copy action on assistant messages (default: true) */
17
+ copy?: boolean;
18
+ /** Show trace action on assistant messages (default: true, still requires callback) */
19
+ trace?: boolean;
25
20
  };
26
- type MessageDisplay = {
27
- id: string;
28
- sessionId?: string;
29
- role: MessageRole;
30
- content: string;
31
- timestamp: string;
32
- isError?: boolean;
33
- /** "WORKFLOW_FAILED" and "STREAM_NOT_STARTED" show the friendly fallback; HTTP 409 conflicts render the backend message from the error payload. */
34
- errorDetails?: string;
35
- chunks?: ChunkDisplay[];
36
- tracingData?: unknown;
37
- executionId?: string;
38
- isStreaming?: boolean;
39
- streamingContent?: string;
40
- currentWorker?: string;
41
- currentMessage?: string;
42
- streamProgress?: StreamProgress;
43
- steps?: StreamingStep[];
44
- isCancelled?: boolean;
45
- currentExecutingStepId?: string;
46
- /** Result of user action (OTP approval/rejection) */
47
- userActionResult?: UserActionResult;
48
- /** Current thinking block text (live, resets per block) */
49
- activeThinkingText?: string;
50
- /** All thinking accumulated across blocks (for post-stream display) */
51
- allThinkingText?: string;
52
- /** True while RAG image URLs are being resolved after the final response is shown */
53
- isResolvingImages?: boolean;
21
+ type MessageActionsConfig = {
22
+ userMessageActions?: UserMessageActionsConfig;
23
+ assistantMessageActions?: AssistantMessageActionsConfig;
54
24
  };
55
- type SessionParams = {
56
- id?: string;
57
- name?: string;
58
- attributes?: Record<string, string>;
59
- };
60
- type APIConfig = {
61
- /** Base API URL */
62
- baseUrl: string;
63
- /** Auth token */
64
- authToken?: string;
65
- /** Custom headers */
66
- headers?: Record<string, string>;
67
- /** API endpoint for streaming (default: /api/workflows/ask/stream) */
68
- streamEndpoint?: string;
69
- /** API endpoint for resolving RAG image URLs (default: /api/playground/ask/resolve-image-urls) */
70
- resolveImagesEndpoint?: string;
71
- };
72
- type ChatConfig = {
73
- /** API configuration - required for the library to make calls */
74
- api: APIConfig;
75
- /** Workflow name */
76
- workflowName: string;
77
- /** User ID for chatStore and activeStreamStore — required for context store messages management */
78
- userId?: string;
79
- /** Workflow version */
80
- workflowVersion?: number;
81
- /** Stage/Environment */
82
- stage?: WorkflowStage;
83
- /** Query param name for stage (default: 'stage'). Use e.g. 'workflowStage' if the API expects that name. */
84
- stageQueryParam?: string;
85
- /** Session params */
86
- sessionParams?: SessionParams;
87
- /** Custom placeholder text */
88
- placeholder?: string;
89
- /** Empty state text */
90
- emptyStateText?: string;
91
- /** Show icon in empty state */
92
- showEmptyStateIcon?: boolean;
25
+ type ChatConfig = ChatConfig$1 & {
93
26
  /** Custom React component to render above the empty state text (e.g. logo, illustration). */
94
27
  emptyStateComponent?: React__default.ReactNode;
95
- /** Show agent name */
96
- showAgentName?: boolean;
97
- /** Agent name */
98
- agentName?: string;
99
- /** Show avatars for user and assistant messages */
100
- showAvatars?: boolean;
101
- /** Show user avatar only (overrides showAvatars for user messages) */
102
- showUserAvatar?: boolean;
103
- /** Show assistant avatar only (overrides showAvatars for assistant messages) */
104
- showAssistantAvatar?: boolean;
105
- /** Show execution steps section with "Completed in X.Xs" */
106
- showExecutionSteps?: boolean;
107
- /** Show animated dot indicator during streaming */
108
- showStreamingDot?: boolean;
109
- /** Custom text format for streaming steps button. Use {count} for step count. Default: "View progress ({count} steps)" */
110
- streamingStepsText?: string;
111
- /** Custom text format for completed steps button. Use {count} for step count, {time} for elapsed time. Default: "Completed in {time}s ({count} steps)" */
112
- completedStepsText?: string;
113
- /** Input style variant: "rounded" (yaak style) or "flat" (paygent-central style). Default: "rounded" */
114
- inputStyle?: "rounded" | "flat";
115
- /** Layout style: "centered" (durango style) or "full-width" (default). Default: "full-width" */
116
- layout?: "centered" | "full-width";
117
- /** Show timestamps on messages */
118
- showTimestamps?: boolean;
119
- /** Enable animations */
120
- animated?: boolean;
121
- /** Disable input */
122
- disableInput?: boolean;
123
- /** Has permission to ask */
124
- hasAskPermission?: boolean;
125
- /** Auto-generate session ID */
126
- autoGenerateSessionId?: boolean;
127
- /** Disable the entire chat and show disabled state */
128
- isChatDisabled?: boolean;
129
- /** Custom component to render when chat is disabled. If not provided, default disabled UI will be shown */
130
- disabledComponent?: React__default.ReactNode;
131
28
  /** Enable voice input (default: true) */
132
29
  enableVoice?: boolean;
133
30
  /** Voice language (default: "en-US") */
@@ -138,36 +35,30 @@ type ChatConfig = {
138
35
  voiceContinuous?: boolean;
139
36
  /** Show a "New Session" reset button inside the input bar (default: false) */
140
37
  showResetSession?: boolean;
38
+ /** Show the v2 attachment (+) menu button in the input bar (default: true) */
39
+ showAttachmentButton?: boolean;
40
+ /** Show the v2 "Upload image" attachment option (default: true) */
41
+ showUploadImageButton?: boolean;
42
+ /** Show the v2 "Attach file" attachment option (default: true) */
43
+ showAttachFileButton?: boolean;
44
+ /** Configure which per-message actions are visible in the v2 UI */
45
+ messageActions?: MessageActionsConfig;
46
+ /** Sentry DSN for error monitoring. */
47
+ sentryDsn?: string;
141
48
  /**
142
- * Sentry DSN for error monitoring.
143
- * The library will initialise Sentry with this DSN if Sentry has not already
144
- * been initialised by the host application.
49
+ * UI version to render.
50
+ * 1 = original component set
51
+ * 2 = redesigned chat UI (ChatGPT-style with thinking blocks, inline verification, etc.) — default
145
52
  */
146
- sentryDsn?: string;
53
+ uiVersion?: 1 | 2;
147
54
  };
148
- type ChatCallbacks = {
149
- /** Called when a message is sent (before API call) */
150
- onMessageSent?: (message: string) => void;
151
- /** Called when streaming starts */
152
- onStreamStart?: () => void;
153
- /** Called when streaming completes */
154
- onStreamComplete?: (message: MessageDisplay) => void;
155
- /** Called when an error occurs */
156
- onError?: (error: Error) => void;
157
- /** Called when execution trace is clicked - provides data instead of UI */
158
- onExecutionTraceClick?: (data: {
159
- message: MessageDisplay;
160
- tracingData?: unknown;
161
- executionId?: string;
162
- }) => void;
163
- /** Called when session ID changes */
164
- onSessionIdChange?: (sessionId: string) => void;
55
+ type ChatCallbacks = ChatCallbacks$1 & {
165
56
  /** Called when the session is reset (via SDK reset button or ref.resetSession()) */
166
57
  onResetSession?: () => void;
167
- /** Called when a user action (e.g. OTP) is required */
168
- onUserActionRequired?: (request: UserActionRequest) => void;
169
- /** Called on user action events (SUCCESS, INVALID, EXPIRED, REJECTED, RESENT, FAILED) */
170
- onUserActionEvent?: (eventType: string, message: string) => void;
58
+ /** Called when the v2 "Upload image" attachment option is clicked */
59
+ onUploadImageClick?: () => void;
60
+ /** Called when the v2 "Attach file" attachment option is clicked */
61
+ onAttachFileClick?: () => void;
171
62
  };
172
63
  type PaymanChatRef = {
173
64
  /** Clear all messages and reset the session (clears both stores + generates new session ID) */
@@ -246,6 +137,16 @@ type ChatInputProps = {
246
137
  showResetSession?: boolean;
247
138
  /** Handler called when the reset session button is clicked */
248
139
  onResetSession?: () => void;
140
+ /** Show the attachment (+) menu button */
141
+ showAttachmentButton?: boolean;
142
+ /** Show the "Upload image" attachment option */
143
+ showUploadImageButton?: boolean;
144
+ /** Show the "Attach file" attachment option */
145
+ showAttachFileButton?: boolean;
146
+ /** Handler called when the "Upload image" option is clicked */
147
+ onUploadImageClick?: () => void;
148
+ /** Handler called when the "Attach file" option is clicked */
149
+ onAttachFileClick?: () => void;
249
150
  /** React Native: called when the text input is focused (e.g. to scroll messages above the keyboard). */
250
151
  onInputFocus?: () => void;
251
152
  };
@@ -300,16 +201,50 @@ type MessageListProps = {
300
201
  isLoadingMoreMessages?: boolean;
301
202
  /** Whether there are more messages to load */
302
203
  hasMoreMessages?: boolean;
303
- /**
304
- * React Native: while true, keep scrolling to the end as layout updates (waiting for assistant reply).
305
- */
204
+ /** React Native: while true, keep scrolling to the end as layout updates. */
306
205
  isWaitingForResponse?: boolean;
307
- /**
308
- * React Native: ref to register a no-arg function that scrolls the message list to the end.
309
- * Used so the parent can scroll when the input is focused and the keyboard opens.
310
- */
206
+ /** React Native: ref to register a no-arg function that scrolls the message list to the end. */
311
207
  scrollToEndHandleRef?: React__default.MutableRefObject<(() => void) | null>;
312
208
  };
209
+ type MessageListV2Props = {
210
+ /** Messages to display */
211
+ messages: MessageDisplay[];
212
+ /** Whether an assistant response is currently streaming */
213
+ isStreaming?: boolean;
214
+ /** Edit a user message */
215
+ onEditUserMessage?: (messageId: string) => void;
216
+ /** Retry a user message */
217
+ onRetryUserMessage?: (messageId: string) => void;
218
+ /** Open a markdown image */
219
+ onImageClick?: (src: string, alt: string) => void;
220
+ /** Execution trace click handler */
221
+ onExecutionTraceClick?: (data: {
222
+ message: MessageDisplay;
223
+ tracingData?: unknown;
224
+ executionId?: string;
225
+ }) => void;
226
+ /** Which message actions are visible */
227
+ messageActions?: MessageActionsConfig;
228
+ /** Disable retry/resend actions while the chat is busy */
229
+ retryDisabled?: boolean;
230
+ /** Current user action card */
231
+ userAction?: {
232
+ messageId: string;
233
+ action: {
234
+ type: string;
235
+ message: string;
236
+ amount?: string;
237
+ payeeName?: string;
238
+ };
239
+ status: "pending" | "verifying" | "approved" | "rejected" | "error";
240
+ } | null;
241
+ /** Approve a user action */
242
+ onApproveAction?: (messageId: string, otp: string) => Promise<void>;
243
+ /** Reject a user action */
244
+ onRejectAction?: (messageId: string) => Promise<void>;
245
+ /** Resend a user action */
246
+ onResendAction?: (messageId: string) => Promise<void>;
247
+ };
313
248
  type MessageRowProps = {
314
249
  /** Message to display */
315
250
  message: MessageDisplay;
@@ -517,4 +452,4 @@ declare function cn(...inputs: ClassValue[]): string;
517
452
  */
518
453
  declare function formatDate(timestamp: string | Date): string;
519
454
 
520
- export { type APIConfig, type AgentMessageProps, type ChatCallbacks, type ChatConfig, type ChatHeaderProps, type ChatInputProps, type ChunkDisplay, type MessageDisplay, type MessageListProps, type MessageRole, type MessageRowProps, type OtpInputProps, PaymanChat, PaymanChatContext, type PaymanChatContextValue, type PaymanChatProps, type PaymanChatRef, type SessionParams, type StreamProgress, type StreamingMessageProps, type StreamingStep, type UserActionModalProps, type UserMessageProps, type WorkflowStage, cn, formatDate, usePaymanChat };
455
+ export { type AgentMessageProps, type AssistantMessageActionsConfig, type ChatCallbacks, type ChatConfig, type ChatHeaderProps, type ChatInputProps, type MessageActionsConfig, type MessageListProps, type MessageListV2Props, type MessageRowProps, type OtpInputProps, PaymanChat, PaymanChatContext, type PaymanChatContextValue, type PaymanChatProps, type PaymanChatRef, type StreamingMessageProps, type UserActionModalProps, type UserMessageActionsConfig, type UserMessageProps, cn, formatDate, usePaymanChat };