@paymanai/payman-ask-sdk 4.0.18 → 4.0.20

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,7 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import React__default from 'react';
3
3
  import { MessageDisplay, AgentStage, ChatCallbacks as ChatCallbacks$1, ChatConfig as ChatConfig$1, ActiveUserAction, UserNotification } from '@paymanai/payman-typescript-ask-sdk';
4
- export { APIConfig, ActiveUserAction, AgentStage, ChunkDisplay, JsonSchemaField, JsonSchemaOption, MessageDisplay, MessageRole, RequestedSchema, SessionParams, StreamProgress, StreamingStep, UseChatV2Return, UseVoiceReturn, UserActionKind, UserActionRequest, UserActionStaleError, UserActionState, UserActionStatus, UserActionSubAction, UserNotification, VerificationType, VoiceCallbacks, VoiceConfig, VoicePermissions, VoiceResult, VoiceState, cancelUserAction, resendUserAction, submitUserAction, useChatV2, useVoice } from '@paymanai/payman-typescript-ask-sdk';
4
+ export { APIConfig, ActiveUserAction, AgentStage, AttachmentUploadStatus, ChunkDisplay, ExecutionHistoryAttachment, ExecutionHistoryMessage, JsonSchemaField, JsonSchemaOption, MessageAttachment, MessageDisplay, MessageRole, RequestedSchema, SessionParams, StreamAttachmentPayload, StreamProgress, StreamingStep, TrackedAttachment, UseAttachmentUploadReturn, UseChatV2Return, UseVoiceReturn, UserActionKind, UserActionRequest, UserActionStaleError, UserActionState, UserActionStatus, UserActionSubAction, UserNotification, VerificationType, VoiceCallbacks, VoiceConfig, VoicePermissions, VoiceResult, VoiceState, buildSignedUrlEndpoint, cancelUserAction, mapExecutionHistoryPageToChatMessages, mapExecutionHistoryToChatMessages, resendUserAction, stripAttachmentsSuffixFromIntent, submitUserAction, uploadAttachment, uploadAttachments, useAttachmentUpload, useChatV2, useVoice } from '@paymanai/payman-typescript-ask-sdk';
5
+ import * as react_jsx_runtime from 'react/jsx-runtime';
5
6
  import { ClassValue } from 'clsx';
6
7
 
7
8
  declare const NEGATIVE_FEEDBACK_REASONS: readonly [{
@@ -73,6 +74,41 @@ type SlashCommandConfig = {
73
74
  /** Show only when at least one permission is present. */
74
75
  requiredAnyPermissions?: string[];
75
76
  };
77
+ type ChatAttachmentConfig = {
78
+ /** Show the attachment (+) menu button in the input bar. Default: true */
79
+ enabled?: boolean;
80
+ /** Show the "Upload image" option in the attachment menu. Default: true */
81
+ uploadImage?: boolean;
82
+ /** Show the "Attach file" option in the attachment menu. Default: true */
83
+ attachFile?: boolean;
84
+ /**
85
+ * Maximum combined image + document attachments per message/run.
86
+ * Omit for no limit.
87
+ */
88
+ maxCount?: number;
89
+ /**
90
+ * @deprecated Use `maxCount` — combined limit across images and files.
91
+ */
92
+ maxImages?: number;
93
+ /**
94
+ * @deprecated Use `maxCount` — combined limit across images and files.
95
+ */
96
+ maxDocuments?: number;
97
+ /** Maximum size in bytes for any single attachment. */
98
+ maxFileBytes?: number;
99
+ /** Maximum combined attachment size in bytes for one message/run. */
100
+ maxTotalBytes?: number;
101
+ /**
102
+ * Allowed image file extensions without a leading dot.
103
+ * Default: `png`, `jpg`, `jpeg`, `gif`, `webp`.
104
+ */
105
+ imageExtensions?: string[];
106
+ /**
107
+ * Allowed document file extensions without a leading dot.
108
+ * Default: `pdf`, `docx`, `xlsx`, `xls`.
109
+ */
110
+ documentExtensions?: string[];
111
+ };
76
112
  type ChatConfig = ChatConfig$1 & {
77
113
  /** Custom React component to render above the empty state text (e.g. logo, illustration). */
78
114
  emptyStateComponent?: React__default.ReactNode;
@@ -88,11 +124,25 @@ type ChatConfig = ChatConfig$1 & {
88
124
  showResetSession?: boolean;
89
125
  /** Show the Fast/Deep analysis mode toggle in the v2 input bar (default: true). */
90
126
  enableDeepModeToggle?: boolean;
91
- /** Show the v2 attachment (+) menu button in the input bar (default: true) */
127
+ /**
128
+ * Attachment picker settings for the v2 input bar.
129
+ * Prefer this over the legacy flat `showAttachment*` flags below.
130
+ */
131
+ attachments?: ChatAttachmentConfig;
132
+ /**
133
+ * @deprecated Use `attachments.enabled` instead.
134
+ * Show the v2 attachment (+) menu button in the input bar (default: true).
135
+ */
92
136
  showAttachmentButton?: boolean;
93
- /** Show the v2 "Upload image" attachment option (default: true) */
137
+ /**
138
+ * @deprecated Use `attachments.uploadImage` instead.
139
+ * Show the v2 "Upload image" attachment option (default: true).
140
+ */
94
141
  showUploadImageButton?: boolean;
95
- /** Show the v2 "Attach file" attachment option (default: true) */
142
+ /**
143
+ * @deprecated Use `attachments.attachFile` instead.
144
+ * Show the v2 "Attach file" attachment option (default: true).
145
+ */
96
146
  showAttachFileButton?: boolean;
97
147
  /** Configure which per-message actions are visible in the v2 UI */
98
148
  messageActions?: MessageActionsConfig;
@@ -117,26 +167,6 @@ type ChatConfig = ChatConfig$1 & {
117
167
  * the consumer hasn't wired one.
118
168
  */
119
169
  debug?: boolean;
120
- /**
121
- * Accent / brand colour used by the React Native chat surface (send button,
122
- * focused border, streaming indicator, etc.). Defaults to Payman teal `#00858d`.
123
- * Web styling continues to follow Tailwind and ignores this field.
124
- */
125
- accent?: string;
126
- /**
127
- * Colour scheme for the React Native chat surface (message text, bubbles,
128
- * markdown tables/code, borders). When omitted the SDK falls back to the
129
- * device's system scheme via `useColorScheme()`. Pass this from the host
130
- * app's theme context so the chat honours a manual light/dark override.
131
- * Web styling continues to follow Tailwind and ignores this field.
132
- */
133
- colorScheme?: "light" | "dark";
134
- /**
135
- * Bottom safe-area inset (px) for the React Native chat surface. Pass the
136
- * host app's `useSafeAreaInsets().bottom` so the input bar / voice bar clear
137
- * the home indicator. Defaults to a small platform fallback when omitted.
138
- */
139
- contentInsetBottom?: number;
140
170
  /**
141
171
  * UI version to render.
142
172
  * 1 = original component set
@@ -173,6 +203,16 @@ type ChatConfig = ChatConfig$1 & {
173
203
  /** Rendered size in pixels. Defaults to 18 to match the default SVG spinner. */
174
204
  size?: number;
175
205
  };
206
+ /**
207
+ * How the v2 PDF preview panel is laid out relative to the chat column.
208
+ * split — side-by-side flex layout with a wide default panel (~520px)
209
+ * sheet — full-height overlay that slides in from the right and covers
210
+ * the chat (for narrow agent side panels)
211
+ *
212
+ * Use `sheet` for narrow agent side panels (e.g. Agent Detail test chat).
213
+ * Use `split` (default) for full-width chat surfaces.
214
+ */
215
+ pdfPreviewMode?: "split" | "sheet";
176
216
  };
177
217
  type ChatCallbacks = ChatCallbacks$1 & {
178
218
  /** Called when the session is reset (via SDK reset button or ref.resetSession()) */
@@ -367,6 +407,8 @@ type MessageListV2Props = {
367
407
  * 1 = default, 2 = 2x faster, 0.5 = half speed, 0 = instant reveal.
368
408
  */
369
409
  typingSpeed?: number;
410
+ /** When a side panel (e.g. PDF preview) is open, disable sticky auto-scroll. */
411
+ sidePanelOpen?: boolean;
370
412
  };
371
413
  type MessageRowProps = {
372
414
  /** Message to display */
@@ -481,6 +523,16 @@ type ChatHeaderProps = {
481
523
  */
482
524
  declare const PaymanChat: React.ForwardRefExoticComponent<PaymanChatProps & React.RefAttributes<PaymanChatRef>>;
483
525
 
526
+ type PdfPreviewLayoutMode = "split" | "sheet";
527
+
528
+ type PdfSheetV2Props = {
529
+ src: string | null;
530
+ title: string;
531
+ onClose: () => void;
532
+ mode?: PdfPreviewLayoutMode;
533
+ };
534
+ declare function PdfSheetV2({ src, title, onClose, mode, }: PdfSheetV2Props): react_jsx_runtime.JSX.Element;
535
+
484
536
  interface PaymanChatContextValue {
485
537
  /**
486
538
  * Clear all messages and reset the chat
@@ -510,6 +562,14 @@ interface PaymanChatContextValue {
510
562
  * Check if currently waiting for response
511
563
  */
512
564
  isWaitingForResponse: boolean;
565
+ /**
566
+ * Open the PDF preview panel with the given URL and title.
567
+ * When called, the chat shifts left and the PDF panel slides in from the right.
568
+ * Pass `{ auto: true }` for stream auto-open; auto-open is suppressed after the user closes the sheet.
569
+ */
570
+ openPdfSheet: (href: string, title: string, options?: {
571
+ auto?: boolean;
572
+ }) => void;
513
573
  }
514
574
  declare const PaymanChatContext: React.Context<PaymanChatContextValue | undefined>;
515
575
  /**
@@ -560,4 +620,12 @@ interface ChatSessionContext {
560
620
  */
561
621
  declare function captureSentryError(error: Error | string, context: ChatSessionContext): void;
562
622
 
563
- export { type AgentMessageProps, type AssistantMessageActionsConfig, type ChatCallbacks, type ChatConfig, type ChatHeaderProps, type ChatInputProps, type ChatSessionContext, type MessageActionsConfig, type MessageListProps, type MessageListV2Props, type MessageRowProps, PaymanChat, PaymanChatContext, type PaymanChatContextValue, type PaymanChatProps, type PaymanChatRef, type SlashCommandConfig, type UserMessageActionsConfig, type UserMessageProps, captureSentryError, cn, formatDate, usePaymanChat };
623
+ /** Human-readable byte size for attachment limit hints. */
624
+ declare function formatAttachmentBytes(bytes: number): string;
625
+
626
+ /** True when a markdown link href points at a PDF (incl. Azure blob signed URLs). */
627
+ declare function isPdfUrl(href: string): boolean;
628
+ /** Title for the PDF preview sheet — prefers link text, then filename from URL. */
629
+ declare function getPdfTitleFromUrl(href: string, linkText?: string): string;
630
+
631
+ export { type AgentMessageProps, type AssistantMessageActionsConfig, type ChatAttachmentConfig, type ChatCallbacks, type ChatConfig, type ChatHeaderProps, type ChatInputProps, type ChatSessionContext, type MessageActionsConfig, type MessageListProps, type MessageListV2Props, type MessageRowProps, PaymanChat, PaymanChatContext, type PaymanChatContextValue, type PaymanChatProps, type PaymanChatRef, type PdfPreviewLayoutMode, PdfSheetV2, type PdfSheetV2Props, type SlashCommandConfig, type UserMessageActionsConfig, type UserMessageProps, captureSentryError, cn, formatAttachmentBytes, formatDate, getPdfTitleFromUrl, isPdfUrl, usePaymanChat };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import React__default from 'react';
3
3
  import { MessageDisplay, AgentStage, ChatCallbacks as ChatCallbacks$1, ChatConfig as ChatConfig$1, ActiveUserAction, UserNotification } from '@paymanai/payman-typescript-ask-sdk';
4
- export { APIConfig, ActiveUserAction, AgentStage, ChunkDisplay, JsonSchemaField, JsonSchemaOption, MessageDisplay, MessageRole, RequestedSchema, SessionParams, StreamProgress, StreamingStep, UseChatV2Return, UseVoiceReturn, UserActionKind, UserActionRequest, UserActionStaleError, UserActionState, UserActionStatus, UserActionSubAction, UserNotification, VerificationType, VoiceCallbacks, VoiceConfig, VoicePermissions, VoiceResult, VoiceState, cancelUserAction, resendUserAction, submitUserAction, useChatV2, useVoice } from '@paymanai/payman-typescript-ask-sdk';
4
+ export { APIConfig, ActiveUserAction, AgentStage, AttachmentUploadStatus, ChunkDisplay, ExecutionHistoryAttachment, ExecutionHistoryMessage, JsonSchemaField, JsonSchemaOption, MessageAttachment, MessageDisplay, MessageRole, RequestedSchema, SessionParams, StreamAttachmentPayload, StreamProgress, StreamingStep, TrackedAttachment, UseAttachmentUploadReturn, UseChatV2Return, UseVoiceReturn, UserActionKind, UserActionRequest, UserActionStaleError, UserActionState, UserActionStatus, UserActionSubAction, UserNotification, VerificationType, VoiceCallbacks, VoiceConfig, VoicePermissions, VoiceResult, VoiceState, buildSignedUrlEndpoint, cancelUserAction, mapExecutionHistoryPageToChatMessages, mapExecutionHistoryToChatMessages, resendUserAction, stripAttachmentsSuffixFromIntent, submitUserAction, uploadAttachment, uploadAttachments, useAttachmentUpload, useChatV2, useVoice } from '@paymanai/payman-typescript-ask-sdk';
5
+ import * as react_jsx_runtime from 'react/jsx-runtime';
5
6
  import { ClassValue } from 'clsx';
6
7
 
7
8
  declare const NEGATIVE_FEEDBACK_REASONS: readonly [{
@@ -73,6 +74,41 @@ type SlashCommandConfig = {
73
74
  /** Show only when at least one permission is present. */
74
75
  requiredAnyPermissions?: string[];
75
76
  };
77
+ type ChatAttachmentConfig = {
78
+ /** Show the attachment (+) menu button in the input bar. Default: true */
79
+ enabled?: boolean;
80
+ /** Show the "Upload image" option in the attachment menu. Default: true */
81
+ uploadImage?: boolean;
82
+ /** Show the "Attach file" option in the attachment menu. Default: true */
83
+ attachFile?: boolean;
84
+ /**
85
+ * Maximum combined image + document attachments per message/run.
86
+ * Omit for no limit.
87
+ */
88
+ maxCount?: number;
89
+ /**
90
+ * @deprecated Use `maxCount` — combined limit across images and files.
91
+ */
92
+ maxImages?: number;
93
+ /**
94
+ * @deprecated Use `maxCount` — combined limit across images and files.
95
+ */
96
+ maxDocuments?: number;
97
+ /** Maximum size in bytes for any single attachment. */
98
+ maxFileBytes?: number;
99
+ /** Maximum combined attachment size in bytes for one message/run. */
100
+ maxTotalBytes?: number;
101
+ /**
102
+ * Allowed image file extensions without a leading dot.
103
+ * Default: `png`, `jpg`, `jpeg`, `gif`, `webp`.
104
+ */
105
+ imageExtensions?: string[];
106
+ /**
107
+ * Allowed document file extensions without a leading dot.
108
+ * Default: `pdf`, `docx`, `xlsx`, `xls`.
109
+ */
110
+ documentExtensions?: string[];
111
+ };
76
112
  type ChatConfig = ChatConfig$1 & {
77
113
  /** Custom React component to render above the empty state text (e.g. logo, illustration). */
78
114
  emptyStateComponent?: React__default.ReactNode;
@@ -88,11 +124,25 @@ type ChatConfig = ChatConfig$1 & {
88
124
  showResetSession?: boolean;
89
125
  /** Show the Fast/Deep analysis mode toggle in the v2 input bar (default: true). */
90
126
  enableDeepModeToggle?: boolean;
91
- /** Show the v2 attachment (+) menu button in the input bar (default: true) */
127
+ /**
128
+ * Attachment picker settings for the v2 input bar.
129
+ * Prefer this over the legacy flat `showAttachment*` flags below.
130
+ */
131
+ attachments?: ChatAttachmentConfig;
132
+ /**
133
+ * @deprecated Use `attachments.enabled` instead.
134
+ * Show the v2 attachment (+) menu button in the input bar (default: true).
135
+ */
92
136
  showAttachmentButton?: boolean;
93
- /** Show the v2 "Upload image" attachment option (default: true) */
137
+ /**
138
+ * @deprecated Use `attachments.uploadImage` instead.
139
+ * Show the v2 "Upload image" attachment option (default: true).
140
+ */
94
141
  showUploadImageButton?: boolean;
95
- /** Show the v2 "Attach file" attachment option (default: true) */
142
+ /**
143
+ * @deprecated Use `attachments.attachFile` instead.
144
+ * Show the v2 "Attach file" attachment option (default: true).
145
+ */
96
146
  showAttachFileButton?: boolean;
97
147
  /** Configure which per-message actions are visible in the v2 UI */
98
148
  messageActions?: MessageActionsConfig;
@@ -117,26 +167,6 @@ type ChatConfig = ChatConfig$1 & {
117
167
  * the consumer hasn't wired one.
118
168
  */
119
169
  debug?: boolean;
120
- /**
121
- * Accent / brand colour used by the React Native chat surface (send button,
122
- * focused border, streaming indicator, etc.). Defaults to Payman teal `#00858d`.
123
- * Web styling continues to follow Tailwind and ignores this field.
124
- */
125
- accent?: string;
126
- /**
127
- * Colour scheme for the React Native chat surface (message text, bubbles,
128
- * markdown tables/code, borders). When omitted the SDK falls back to the
129
- * device's system scheme via `useColorScheme()`. Pass this from the host
130
- * app's theme context so the chat honours a manual light/dark override.
131
- * Web styling continues to follow Tailwind and ignores this field.
132
- */
133
- colorScheme?: "light" | "dark";
134
- /**
135
- * Bottom safe-area inset (px) for the React Native chat surface. Pass the
136
- * host app's `useSafeAreaInsets().bottom` so the input bar / voice bar clear
137
- * the home indicator. Defaults to a small platform fallback when omitted.
138
- */
139
- contentInsetBottom?: number;
140
170
  /**
141
171
  * UI version to render.
142
172
  * 1 = original component set
@@ -173,6 +203,16 @@ type ChatConfig = ChatConfig$1 & {
173
203
  /** Rendered size in pixels. Defaults to 18 to match the default SVG spinner. */
174
204
  size?: number;
175
205
  };
206
+ /**
207
+ * How the v2 PDF preview panel is laid out relative to the chat column.
208
+ * split — side-by-side flex layout with a wide default panel (~520px)
209
+ * sheet — full-height overlay that slides in from the right and covers
210
+ * the chat (for narrow agent side panels)
211
+ *
212
+ * Use `sheet` for narrow agent side panels (e.g. Agent Detail test chat).
213
+ * Use `split` (default) for full-width chat surfaces.
214
+ */
215
+ pdfPreviewMode?: "split" | "sheet";
176
216
  };
177
217
  type ChatCallbacks = ChatCallbacks$1 & {
178
218
  /** Called when the session is reset (via SDK reset button or ref.resetSession()) */
@@ -367,6 +407,8 @@ type MessageListV2Props = {
367
407
  * 1 = default, 2 = 2x faster, 0.5 = half speed, 0 = instant reveal.
368
408
  */
369
409
  typingSpeed?: number;
410
+ /** When a side panel (e.g. PDF preview) is open, disable sticky auto-scroll. */
411
+ sidePanelOpen?: boolean;
370
412
  };
371
413
  type MessageRowProps = {
372
414
  /** Message to display */
@@ -481,6 +523,16 @@ type ChatHeaderProps = {
481
523
  */
482
524
  declare const PaymanChat: React.ForwardRefExoticComponent<PaymanChatProps & React.RefAttributes<PaymanChatRef>>;
483
525
 
526
+ type PdfPreviewLayoutMode = "split" | "sheet";
527
+
528
+ type PdfSheetV2Props = {
529
+ src: string | null;
530
+ title: string;
531
+ onClose: () => void;
532
+ mode?: PdfPreviewLayoutMode;
533
+ };
534
+ declare function PdfSheetV2({ src, title, onClose, mode, }: PdfSheetV2Props): react_jsx_runtime.JSX.Element;
535
+
484
536
  interface PaymanChatContextValue {
485
537
  /**
486
538
  * Clear all messages and reset the chat
@@ -510,6 +562,14 @@ interface PaymanChatContextValue {
510
562
  * Check if currently waiting for response
511
563
  */
512
564
  isWaitingForResponse: boolean;
565
+ /**
566
+ * Open the PDF preview panel with the given URL and title.
567
+ * When called, the chat shifts left and the PDF panel slides in from the right.
568
+ * Pass `{ auto: true }` for stream auto-open; auto-open is suppressed after the user closes the sheet.
569
+ */
570
+ openPdfSheet: (href: string, title: string, options?: {
571
+ auto?: boolean;
572
+ }) => void;
513
573
  }
514
574
  declare const PaymanChatContext: React.Context<PaymanChatContextValue | undefined>;
515
575
  /**
@@ -560,4 +620,12 @@ interface ChatSessionContext {
560
620
  */
561
621
  declare function captureSentryError(error: Error | string, context: ChatSessionContext): void;
562
622
 
563
- export { type AgentMessageProps, type AssistantMessageActionsConfig, type ChatCallbacks, type ChatConfig, type ChatHeaderProps, type ChatInputProps, type ChatSessionContext, type MessageActionsConfig, type MessageListProps, type MessageListV2Props, type MessageRowProps, PaymanChat, PaymanChatContext, type PaymanChatContextValue, type PaymanChatProps, type PaymanChatRef, type SlashCommandConfig, type UserMessageActionsConfig, type UserMessageProps, captureSentryError, cn, formatDate, usePaymanChat };
623
+ /** Human-readable byte size for attachment limit hints. */
624
+ declare function formatAttachmentBytes(bytes: number): string;
625
+
626
+ /** True when a markdown link href points at a PDF (incl. Azure blob signed URLs). */
627
+ declare function isPdfUrl(href: string): boolean;
628
+ /** Title for the PDF preview sheet — prefers link text, then filename from URL. */
629
+ declare function getPdfTitleFromUrl(href: string, linkText?: string): string;
630
+
631
+ export { type AgentMessageProps, type AssistantMessageActionsConfig, type ChatAttachmentConfig, type ChatCallbacks, type ChatConfig, type ChatHeaderProps, type ChatInputProps, type ChatSessionContext, type MessageActionsConfig, type MessageListProps, type MessageListV2Props, type MessageRowProps, PaymanChat, PaymanChatContext, type PaymanChatContextValue, type PaymanChatProps, type PaymanChatRef, type PdfPreviewLayoutMode, PdfSheetV2, type PdfSheetV2Props, type SlashCommandConfig, type UserMessageActionsConfig, type UserMessageProps, captureSentryError, cn, formatAttachmentBytes, formatDate, getPdfTitleFromUrl, isPdfUrl, usePaymanChat };