@paymanai/payman-ask-sdk 1.0.4 → 1.1.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.mts CHANGED
@@ -1,8 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import React__default from 'react';
4
+ import { UserActionResult, UserActionRequest } from '@paymanai/payman-typescript-ask-sdk';
5
+ export { StreamEvent, StreamOptions, UserActionRequest, UserActionResult, UserActionState, cancelUserAction, generateId, resendUserAction, streamWorkflowEvents, submitUserAction, useChat } from '@paymanai/payman-typescript-ask-sdk';
4
6
  import { ClassValue } from 'clsx';
5
- export { StreamEvent, StreamOptions, generateId, streamWorkflowEvents, useChat } from '@paymanai/payman-typescript-ask-sdk';
6
7
 
7
8
  type MessageRole = "user" | "assistant" | "system";
8
9
  type StreamProgress = "started" | "processing" | "completed" | "error";
@@ -40,6 +41,8 @@ type MessageDisplay = {
40
41
  steps?: StreamingStep[];
41
42
  isCancelled?: boolean;
42
43
  currentExecutingStepId?: string;
44
+ /** Result of user action (OTP approval/rejection) */
45
+ userActionResult?: UserActionResult;
43
46
  };
44
47
  type SessionParams = {
45
48
  id?: string;
@@ -65,6 +68,8 @@ type ChatConfig = {
65
68
  workflowVersion?: number;
66
69
  /** Stage/Environment */
67
70
  stage?: WorkflowStage;
71
+ /** Query param name for stage (default: 'stage'). Use e.g. 'workflowStage' if the API expects that name. */
72
+ stageQueryParam?: string;
68
73
  /** Session params */
69
74
  sessionParams?: SessionParams;
70
75
  /** Custom placeholder text */
@@ -127,6 +132,10 @@ type ChatCallbacks = {
127
132
  }) => void;
128
133
  /** Called when session ID changes */
129
134
  onSessionIdChange?: (sessionId: string) => void;
135
+ /** Called when a user action (e.g. OTP) is required */
136
+ onUserActionRequired?: (request: UserActionRequest) => void;
137
+ /** Called on user action events (SUCCESS, INVALID, EXPIRED, REJECTED, RESENT, FAILED) */
138
+ onUserActionEvent?: (eventType: string, message: string) => void;
130
139
  };
131
140
  type PaymanChatProps = {
132
141
  /** Chat configuration - includes API config */
@@ -229,6 +238,10 @@ type MessageRowProps = {
229
238
  showUserAvatar?: boolean;
230
239
  /** Show assistant avatar only (overrides showAvatars) */
231
240
  showAssistantAvatar?: boolean;
241
+ /** Layout style */
242
+ layout?: "centered" | "full-width";
243
+ /** Show timestamps on messages */
244
+ showTimestamps?: boolean;
232
245
  /** Show execution steps */
233
246
  showExecutionSteps?: boolean;
234
247
  /** Show streaming dot */
@@ -326,6 +339,30 @@ type ChatHeaderProps = {
326
339
  /** Custom class name */
327
340
  className?: string;
328
341
  };
342
+ type OtpInputProps = {
343
+ /** Current OTP value */
344
+ value: string;
345
+ /** Called with new OTP value */
346
+ onChange: (value: string) => void;
347
+ /** Number of digit boxes */
348
+ maxLength: number;
349
+ /** Disabled state */
350
+ disabled?: boolean;
351
+ };
352
+ type UserActionModalProps = {
353
+ /** Whether the modal is open */
354
+ isOpen: boolean;
355
+ /** User action request data from the stream */
356
+ userActionRequest: UserActionRequest | null;
357
+ /** Submit OTP */
358
+ onApprove: (otp: string) => Promise<void>;
359
+ /** Reject / cancel */
360
+ onReject: () => Promise<void>;
361
+ /** Resend OTP */
362
+ onResend: () => Promise<void>;
363
+ /** Increment to externally clear OTP field */
364
+ clearOtpTrigger: number;
365
+ };
329
366
 
330
367
  declare function PaymanChat({ config, callbacks, className, style, children, }: PaymanChatProps): react_jsx_runtime.JSX.Element;
331
368
 
@@ -385,4 +422,4 @@ declare function cn(...inputs: ClassValue[]): string;
385
422
  */
386
423
  declare function formatDate(timestamp: string | Date): string;
387
424
 
388
- export { type APIConfig, type AgentMessageProps, type ChatCallbacks, type ChatConfig, type ChatHeaderProps, type ChatInputProps, type ChunkDisplay, type MessageDisplay, type MessageListProps, type MessageRole, type MessageRowProps, PaymanChat, PaymanChatContext, type PaymanChatContextValue, type PaymanChatProps, type SessionParams, type StreamProgress, type StreamingMessageProps, type StreamingStep, type UserMessageProps, type WorkflowStage, cn, formatDate, usePaymanChat };
425
+ 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 SessionParams, type StreamProgress, type StreamingMessageProps, type StreamingStep, type UserActionModalProps, type UserMessageProps, type WorkflowStage, cn, formatDate, usePaymanChat };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import React__default from 'react';
4
+ import { UserActionResult, UserActionRequest } from '@paymanai/payman-typescript-ask-sdk';
5
+ export { StreamEvent, StreamOptions, UserActionRequest, UserActionResult, UserActionState, cancelUserAction, generateId, resendUserAction, streamWorkflowEvents, submitUserAction, useChat } from '@paymanai/payman-typescript-ask-sdk';
4
6
  import { ClassValue } from 'clsx';
5
- export { StreamEvent, StreamOptions, generateId, streamWorkflowEvents, useChat } from '@paymanai/payman-typescript-ask-sdk';
6
7
 
7
8
  type MessageRole = "user" | "assistant" | "system";
8
9
  type StreamProgress = "started" | "processing" | "completed" | "error";
@@ -40,6 +41,8 @@ type MessageDisplay = {
40
41
  steps?: StreamingStep[];
41
42
  isCancelled?: boolean;
42
43
  currentExecutingStepId?: string;
44
+ /** Result of user action (OTP approval/rejection) */
45
+ userActionResult?: UserActionResult;
43
46
  };
44
47
  type SessionParams = {
45
48
  id?: string;
@@ -65,6 +68,8 @@ type ChatConfig = {
65
68
  workflowVersion?: number;
66
69
  /** Stage/Environment */
67
70
  stage?: WorkflowStage;
71
+ /** Query param name for stage (default: 'stage'). Use e.g. 'workflowStage' if the API expects that name. */
72
+ stageQueryParam?: string;
68
73
  /** Session params */
69
74
  sessionParams?: SessionParams;
70
75
  /** Custom placeholder text */
@@ -127,6 +132,10 @@ type ChatCallbacks = {
127
132
  }) => void;
128
133
  /** Called when session ID changes */
129
134
  onSessionIdChange?: (sessionId: string) => void;
135
+ /** Called when a user action (e.g. OTP) is required */
136
+ onUserActionRequired?: (request: UserActionRequest) => void;
137
+ /** Called on user action events (SUCCESS, INVALID, EXPIRED, REJECTED, RESENT, FAILED) */
138
+ onUserActionEvent?: (eventType: string, message: string) => void;
130
139
  };
131
140
  type PaymanChatProps = {
132
141
  /** Chat configuration - includes API config */
@@ -229,6 +238,10 @@ type MessageRowProps = {
229
238
  showUserAvatar?: boolean;
230
239
  /** Show assistant avatar only (overrides showAvatars) */
231
240
  showAssistantAvatar?: boolean;
241
+ /** Layout style */
242
+ layout?: "centered" | "full-width";
243
+ /** Show timestamps on messages */
244
+ showTimestamps?: boolean;
232
245
  /** Show execution steps */
233
246
  showExecutionSteps?: boolean;
234
247
  /** Show streaming dot */
@@ -326,6 +339,30 @@ type ChatHeaderProps = {
326
339
  /** Custom class name */
327
340
  className?: string;
328
341
  };
342
+ type OtpInputProps = {
343
+ /** Current OTP value */
344
+ value: string;
345
+ /** Called with new OTP value */
346
+ onChange: (value: string) => void;
347
+ /** Number of digit boxes */
348
+ maxLength: number;
349
+ /** Disabled state */
350
+ disabled?: boolean;
351
+ };
352
+ type UserActionModalProps = {
353
+ /** Whether the modal is open */
354
+ isOpen: boolean;
355
+ /** User action request data from the stream */
356
+ userActionRequest: UserActionRequest | null;
357
+ /** Submit OTP */
358
+ onApprove: (otp: string) => Promise<void>;
359
+ /** Reject / cancel */
360
+ onReject: () => Promise<void>;
361
+ /** Resend OTP */
362
+ onResend: () => Promise<void>;
363
+ /** Increment to externally clear OTP field */
364
+ clearOtpTrigger: number;
365
+ };
329
366
 
330
367
  declare function PaymanChat({ config, callbacks, className, style, children, }: PaymanChatProps): react_jsx_runtime.JSX.Element;
331
368
 
@@ -385,4 +422,4 @@ declare function cn(...inputs: ClassValue[]): string;
385
422
  */
386
423
  declare function formatDate(timestamp: string | Date): string;
387
424
 
388
- export { type APIConfig, type AgentMessageProps, type ChatCallbacks, type ChatConfig, type ChatHeaderProps, type ChatInputProps, type ChunkDisplay, type MessageDisplay, type MessageListProps, type MessageRole, type MessageRowProps, PaymanChat, PaymanChatContext, type PaymanChatContextValue, type PaymanChatProps, type SessionParams, type StreamProgress, type StreamingMessageProps, type StreamingStep, type UserMessageProps, type WorkflowStage, cn, formatDate, usePaymanChat };
425
+ 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 SessionParams, type StreamProgress, type StreamingMessageProps, type StreamingStep, type UserActionModalProps, type UserMessageProps, type WorkflowStage, cn, formatDate, usePaymanChat };