@paymanai/payman-ask-sdk 2.0.2 → 2.0.4
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 +10 -9
- package/dist/index.d.ts +10 -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 +163 -65
- 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,6 +52,8 @@ 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";
|
|
@@ -226,11 +228,6 @@ type SessionHistorySidebarProps = {
|
|
|
226
228
|
/** Session id whose conversation history is currently being fetched.
|
|
227
229
|
* The matching row renders a small inline spinner next to its title. */
|
|
228
230
|
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
231
|
/**
|
|
235
232
|
* Session ids whose stream completed recently. Each matching row briefly
|
|
236
233
|
* renders a check mark on the right of its title — the parent is
|
|
@@ -241,11 +238,15 @@ type SessionHistorySidebarProps = {
|
|
|
241
238
|
optimisticActivity?: OptimisticSessionActivity | null;
|
|
242
239
|
/** Called when the user clicks a row. */
|
|
243
240
|
onSelectSession: (session: SessionSummary) => void;
|
|
241
|
+
/** Called by the optional sidebar "New Session" button. */
|
|
242
|
+
onNewSession?: () => void;
|
|
243
|
+
/** Disabled state for the optional sidebar "New Session" button. */
|
|
244
|
+
newSessionDisabled?: boolean;
|
|
244
245
|
/** Controlled mobile drawer open state. */
|
|
245
246
|
mobileOpen: boolean;
|
|
246
247
|
onMobileOpenChange: (open: boolean) => void;
|
|
247
248
|
};
|
|
248
|
-
declare function SessionHistorySidebar({ config, options, activeSessionId, loadingSessionId,
|
|
249
|
+
declare function SessionHistorySidebar({ config, options, activeSessionId, loadingSessionId, recentlyCompletedSessionIds, optimisticActivity, onSelectSession, onNewSession, newSessionDisabled, mobileOpen, onMobileOpenChange, }: SessionHistorySidebarProps): react_jsx_runtime.JSX.Element;
|
|
249
250
|
|
|
250
251
|
declare function ChatHeader({ sessionId, onCopySessionId, onNewSession, showResetSession, onToggleSidebar, children, className, }: ChatHeaderProps): react_jsx_runtime.JSX.Element;
|
|
251
252
|
|
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,6 +52,8 @@ 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";
|
|
@@ -226,11 +228,6 @@ type SessionHistorySidebarProps = {
|
|
|
226
228
|
/** Session id whose conversation history is currently being fetched.
|
|
227
229
|
* The matching row renders a small inline spinner next to its title. */
|
|
228
230
|
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
231
|
/**
|
|
235
232
|
* Session ids whose stream completed recently. Each matching row briefly
|
|
236
233
|
* renders a check mark on the right of its title — the parent is
|
|
@@ -241,11 +238,15 @@ type SessionHistorySidebarProps = {
|
|
|
241
238
|
optimisticActivity?: OptimisticSessionActivity | null;
|
|
242
239
|
/** Called when the user clicks a row. */
|
|
243
240
|
onSelectSession: (session: SessionSummary) => void;
|
|
241
|
+
/** Called by the optional sidebar "New Session" button. */
|
|
242
|
+
onNewSession?: () => void;
|
|
243
|
+
/** Disabled state for the optional sidebar "New Session" button. */
|
|
244
|
+
newSessionDisabled?: boolean;
|
|
244
245
|
/** Controlled mobile drawer open state. */
|
|
245
246
|
mobileOpen: boolean;
|
|
246
247
|
onMobileOpenChange: (open: boolean) => void;
|
|
247
248
|
};
|
|
248
|
-
declare function SessionHistorySidebar({ config, options, activeSessionId, loadingSessionId,
|
|
249
|
+
declare function SessionHistorySidebar({ config, options, activeSessionId, loadingSessionId, recentlyCompletedSessionIds, optimisticActivity, onSelectSession, onNewSession, newSessionDisabled, mobileOpen, onMobileOpenChange, }: SessionHistorySidebarProps): react_jsx_runtime.JSX.Element;
|
|
249
250
|
|
|
250
251
|
declare function ChatHeader({ sessionId, onCopySessionId, onNewSession, showResetSession, onToggleSidebar, children, className, }: ChatHeaderProps): react_jsx_runtime.JSX.Element;
|
|
251
252
|
|