@paymanai/payman-ask-sdk 2.0.3 → 2.0.5
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 +6 -3
- package/dist/index.d.mts +27 -9
- package/dist/index.d.ts +27 -9
- package/dist/index.js +210 -122
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +212 -124
- package/dist/index.mjs.map +1 -1
- package/dist/index.native.js +3159 -380
- package/dist/index.native.js.map +1 -1
- package/dist/styles.css +137 -126
- package/dist/styles.css.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -123,12 +123,13 @@ type ChatConfig = {
|
|
|
123
123
|
* object — override width/collapse/page-size/persistKey.
|
|
124
124
|
*/
|
|
125
125
|
sessionHistory?: boolean | {
|
|
126
|
-
defaultWidth?: number; // default:
|
|
127
|
-
minWidth?: number; // default:
|
|
128
|
-
maxWidth?: number; // default:
|
|
126
|
+
defaultWidth?: number; // default: 260 px
|
|
127
|
+
minWidth?: number; // default: 220
|
|
128
|
+
maxWidth?: number; // default: 440
|
|
129
129
|
defaultCollapsed?: boolean; // desktop only; default: false
|
|
130
130
|
pageSize?: number; // default: 20
|
|
131
131
|
persistKey?: string; // default: `payman-chat-sidebar:${workflow.id}`
|
|
132
|
+
showNewSessionButton?: boolean; // default: false
|
|
132
133
|
};
|
|
133
134
|
};
|
|
134
135
|
|
|
@@ -157,6 +158,8 @@ Turn features on with booleans, and only reach for the full object form when you
|
|
|
157
158
|
|
|
158
159
|
Pass `ui.sessionHistory: true` and provide `workflow.id` + `session.owner.id`. `<PaymanChat/>` mounts a resizable, collapsible sidebar on desktop and a hamburger-triggered drawer on mobile. Clicking a row calls `loadSession(sessionId)` — which cancels any in-flight stream, clears the current chat, fetches the conversation history, and renders it with `isHistorical: true` (renderers skip the thinking/step UI for those rows).
|
|
159
160
|
|
|
161
|
+
To show a sidebar reset button, opt in with `ui.sessionHistory: { showNewSessionButton: true }`. It runs the same confirmable New Session flow as the chat input button.
|
|
162
|
+
|
|
160
163
|
Need custom chrome? Mount the sidebar yourself:
|
|
161
164
|
|
|
162
165
|
```tsx
|
package/dist/index.d.mts
CHANGED
|
@@ -40,11 +40,11 @@ type VoiceOptions = {
|
|
|
40
40
|
continuous?: boolean;
|
|
41
41
|
};
|
|
42
42
|
type SessionHistoryOptions = {
|
|
43
|
-
/** Desktop sidebar default width in px. Default:
|
|
43
|
+
/** Desktop sidebar default width in px. Default: 260 */
|
|
44
44
|
defaultWidth?: number;
|
|
45
|
-
/** Default:
|
|
45
|
+
/** Default: 220 */
|
|
46
46
|
minWidth?: number;
|
|
47
|
-
/** Default:
|
|
47
|
+
/** Default: 440 */
|
|
48
48
|
maxWidth?: number;
|
|
49
49
|
/** Desktop only. Default: false */
|
|
50
50
|
defaultCollapsed?: boolean;
|
|
@@ -52,9 +52,21 @@ type SessionHistoryOptions = {
|
|
|
52
52
|
pageSize?: number;
|
|
53
53
|
/** localStorage key for width + collapsed. Default: `payman-chat-sidebar:${workflow.id}` */
|
|
54
54
|
persistKey?: string;
|
|
55
|
+
/** Show a sidebar "New Session" button wired to the chat reset flow. Default: false */
|
|
56
|
+
showNewSessionButton?: boolean;
|
|
55
57
|
};
|
|
56
58
|
type ChatUIConfig = {
|
|
57
59
|
layout?: "centered" | "full-width";
|
|
60
|
+
/**
|
|
61
|
+
* Color scheme for the React Native chat surface.
|
|
62
|
+
* Web styling continues to follow Tailwind. Default: "light".
|
|
63
|
+
*/
|
|
64
|
+
theme?: "light" | "dark";
|
|
65
|
+
/**
|
|
66
|
+
* Accent / brand color used by the native chat UI (send button, hero,
|
|
67
|
+
* focused border, etc). Defaults to Payman teal `#00858d`.
|
|
68
|
+
*/
|
|
69
|
+
accent?: string;
|
|
58
70
|
agent?: {
|
|
59
71
|
/** Default: "Assistant" */
|
|
60
72
|
name?: string;
|
|
@@ -64,10 +76,17 @@ type ChatUIConfig = {
|
|
|
64
76
|
emptyState?: {
|
|
65
77
|
/** Default: "What can I help with?" */
|
|
66
78
|
text?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Small line above the main empty-state text (e.g. "Hi, Mike").
|
|
81
|
+
* Native only — web ignores this for now.
|
|
82
|
+
*/
|
|
83
|
+
eyebrow?: string;
|
|
67
84
|
/** Default: true */
|
|
68
85
|
icon?: boolean;
|
|
69
86
|
/** Custom React node rendered above the empty-state text */
|
|
70
87
|
content?: React__default.ReactNode;
|
|
88
|
+
/** Custom logo element rendered in the empty state (native only). Replaces the default HeroMark. */
|
|
89
|
+
logo?: React__default.ReactNode;
|
|
71
90
|
};
|
|
72
91
|
input?: {
|
|
73
92
|
/** Default: "Type your message..." */
|
|
@@ -226,11 +245,6 @@ type SessionHistorySidebarProps = {
|
|
|
226
245
|
/** Session id whose conversation history is currently being fetched.
|
|
227
246
|
* The matching row renders a small inline spinner next to its title. */
|
|
228
247
|
loadingSessionId?: string;
|
|
229
|
-
/**
|
|
230
|
-
* Session ids that currently have an in-flight workflow stream. Each
|
|
231
|
-
* matching row renders a subtle running mark on the right of its title.
|
|
232
|
-
*/
|
|
233
|
-
streamingSessionIds?: ReadonlySet<string>;
|
|
234
248
|
/**
|
|
235
249
|
* Session ids whose stream completed recently. Each matching row briefly
|
|
236
250
|
* renders a check mark on the right of its title — the parent is
|
|
@@ -241,11 +255,15 @@ type SessionHistorySidebarProps = {
|
|
|
241
255
|
optimisticActivity?: OptimisticSessionActivity | null;
|
|
242
256
|
/** Called when the user clicks a row. */
|
|
243
257
|
onSelectSession: (session: SessionSummary) => void;
|
|
258
|
+
/** Called by the optional sidebar "New Session" button. */
|
|
259
|
+
onNewSession?: () => void;
|
|
260
|
+
/** Disabled state for the optional sidebar "New Session" button. */
|
|
261
|
+
newSessionDisabled?: boolean;
|
|
244
262
|
/** Controlled mobile drawer open state. */
|
|
245
263
|
mobileOpen: boolean;
|
|
246
264
|
onMobileOpenChange: (open: boolean) => void;
|
|
247
265
|
};
|
|
248
|
-
declare function SessionHistorySidebar({ config, options, activeSessionId, loadingSessionId,
|
|
266
|
+
declare function SessionHistorySidebar({ config, options, activeSessionId, loadingSessionId, recentlyCompletedSessionIds, optimisticActivity, onSelectSession, onNewSession, newSessionDisabled, mobileOpen, onMobileOpenChange, }: SessionHistorySidebarProps): react_jsx_runtime.JSX.Element;
|
|
249
267
|
|
|
250
268
|
declare function ChatHeader({ sessionId, onCopySessionId, onNewSession, showResetSession, onToggleSidebar, children, className, }: ChatHeaderProps): react_jsx_runtime.JSX.Element;
|
|
251
269
|
|
package/dist/index.d.ts
CHANGED
|
@@ -40,11 +40,11 @@ type VoiceOptions = {
|
|
|
40
40
|
continuous?: boolean;
|
|
41
41
|
};
|
|
42
42
|
type SessionHistoryOptions = {
|
|
43
|
-
/** Desktop sidebar default width in px. Default:
|
|
43
|
+
/** Desktop sidebar default width in px. Default: 260 */
|
|
44
44
|
defaultWidth?: number;
|
|
45
|
-
/** Default:
|
|
45
|
+
/** Default: 220 */
|
|
46
46
|
minWidth?: number;
|
|
47
|
-
/** Default:
|
|
47
|
+
/** Default: 440 */
|
|
48
48
|
maxWidth?: number;
|
|
49
49
|
/** Desktop only. Default: false */
|
|
50
50
|
defaultCollapsed?: boolean;
|
|
@@ -52,9 +52,21 @@ type SessionHistoryOptions = {
|
|
|
52
52
|
pageSize?: number;
|
|
53
53
|
/** localStorage key for width + collapsed. Default: `payman-chat-sidebar:${workflow.id}` */
|
|
54
54
|
persistKey?: string;
|
|
55
|
+
/** Show a sidebar "New Session" button wired to the chat reset flow. Default: false */
|
|
56
|
+
showNewSessionButton?: boolean;
|
|
55
57
|
};
|
|
56
58
|
type ChatUIConfig = {
|
|
57
59
|
layout?: "centered" | "full-width";
|
|
60
|
+
/**
|
|
61
|
+
* Color scheme for the React Native chat surface.
|
|
62
|
+
* Web styling continues to follow Tailwind. Default: "light".
|
|
63
|
+
*/
|
|
64
|
+
theme?: "light" | "dark";
|
|
65
|
+
/**
|
|
66
|
+
* Accent / brand color used by the native chat UI (send button, hero,
|
|
67
|
+
* focused border, etc). Defaults to Payman teal `#00858d`.
|
|
68
|
+
*/
|
|
69
|
+
accent?: string;
|
|
58
70
|
agent?: {
|
|
59
71
|
/** Default: "Assistant" */
|
|
60
72
|
name?: string;
|
|
@@ -64,10 +76,17 @@ type ChatUIConfig = {
|
|
|
64
76
|
emptyState?: {
|
|
65
77
|
/** Default: "What can I help with?" */
|
|
66
78
|
text?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Small line above the main empty-state text (e.g. "Hi, Mike").
|
|
81
|
+
* Native only — web ignores this for now.
|
|
82
|
+
*/
|
|
83
|
+
eyebrow?: string;
|
|
67
84
|
/** Default: true */
|
|
68
85
|
icon?: boolean;
|
|
69
86
|
/** Custom React node rendered above the empty-state text */
|
|
70
87
|
content?: React__default.ReactNode;
|
|
88
|
+
/** Custom logo element rendered in the empty state (native only). Replaces the default HeroMark. */
|
|
89
|
+
logo?: React__default.ReactNode;
|
|
71
90
|
};
|
|
72
91
|
input?: {
|
|
73
92
|
/** Default: "Type your message..." */
|
|
@@ -226,11 +245,6 @@ type SessionHistorySidebarProps = {
|
|
|
226
245
|
/** Session id whose conversation history is currently being fetched.
|
|
227
246
|
* The matching row renders a small inline spinner next to its title. */
|
|
228
247
|
loadingSessionId?: string;
|
|
229
|
-
/**
|
|
230
|
-
* Session ids that currently have an in-flight workflow stream. Each
|
|
231
|
-
* matching row renders a subtle running mark on the right of its title.
|
|
232
|
-
*/
|
|
233
|
-
streamingSessionIds?: ReadonlySet<string>;
|
|
234
248
|
/**
|
|
235
249
|
* Session ids whose stream completed recently. Each matching row briefly
|
|
236
250
|
* renders a check mark on the right of its title — the parent is
|
|
@@ -241,11 +255,15 @@ type SessionHistorySidebarProps = {
|
|
|
241
255
|
optimisticActivity?: OptimisticSessionActivity | null;
|
|
242
256
|
/** Called when the user clicks a row. */
|
|
243
257
|
onSelectSession: (session: SessionSummary) => void;
|
|
258
|
+
/** Called by the optional sidebar "New Session" button. */
|
|
259
|
+
onNewSession?: () => void;
|
|
260
|
+
/** Disabled state for the optional sidebar "New Session" button. */
|
|
261
|
+
newSessionDisabled?: boolean;
|
|
244
262
|
/** Controlled mobile drawer open state. */
|
|
245
263
|
mobileOpen: boolean;
|
|
246
264
|
onMobileOpenChange: (open: boolean) => void;
|
|
247
265
|
};
|
|
248
|
-
declare function SessionHistorySidebar({ config, options, activeSessionId, loadingSessionId,
|
|
266
|
+
declare function SessionHistorySidebar({ config, options, activeSessionId, loadingSessionId, recentlyCompletedSessionIds, optimisticActivity, onSelectSession, onNewSession, newSessionDisabled, mobileOpen, onMobileOpenChange, }: SessionHistorySidebarProps): react_jsx_runtime.JSX.Element;
|
|
249
267
|
|
|
250
268
|
declare function ChatHeader({ sessionId, onCopySessionId, onNewSession, showResetSession, onToggleSidebar, children, className, }: ChatHeaderProps): react_jsx_runtime.JSX.Element;
|
|
251
269
|
|