@spscommerce/max 0.11.2 → 0.13.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/lib/MaxPanel.d.ts CHANGED
@@ -3,7 +3,7 @@ import { FeatureFlagsTitles } from "./models/FeatureFlagsTitles";
3
3
  import { CurrentApp } from "./models/CurrentApp";
4
4
  import { CurrentUser } from "./models/CurrentUser";
5
5
  import type { AdditionalContextProvider } from "./models/AdditionalContext";
6
- export declare function MaxPanel({ token, currentUser, hideAgentPanel, isAgentPanelOpen, isInCustomerView, flags, env, currentApp, context, currentConversationId, locale, }: {
6
+ export declare function MaxPanel({ token, currentUser, hideAgentPanel, isAgentPanelOpen, isInCustomerView, flags, env, currentApp, context, currentConversationId, locale, trackEvent, }: {
7
7
  token: string | null;
8
8
  currentUser: CurrentUser | undefined;
9
9
  hideAgentPanel: () => void;
@@ -19,4 +19,5 @@ export declare function MaxPanel({ token, currentUser, hideAgentPanel, isAgentPa
19
19
  context: AdditionalContextProvider;
20
20
  currentConversationId?: string | null;
21
21
  locale?: string;
22
+ trackEvent?: (eventName: string, eventProperties?: Record<string, unknown>) => void;
22
23
  }): React.ReactNode;
@@ -8,9 +8,11 @@ export declare class AgentApiService {
8
8
  private readonly axios;
9
9
  private token;
10
10
  private socket;
11
+ private socketAwaitingApproval;
11
12
  constructor(env: string, token?: string | null);
12
13
  setToken(token?: string | null): void;
13
14
  getSocket(): WebSocket | null;
15
+ private detachSocket;
14
16
  fetchConversationMessages: (conversationId: string, options?: {
15
17
  cursor?: string;
16
18
  limit?: number;
@@ -20,5 +22,10 @@ export declare class AgentApiService {
20
22
  deleteConversation: (conversationId: string) => Promise<void>;
21
23
  postFeedback: (messageId: string, score: string, comment: string) => Promise<void>;
22
24
  fetchUsageStatus: (userId: string) => Promise<UsageStatus>;
23
- postChat(message: string, currentAppName: string, currentConversationId: string | null, agentContext: AdditionalContext, currentUrl: string, appInitiated: boolean, userTimezone: string | null): Promise<unknown>;
25
+ postChat(message: string, currentAppName: string, currentConversationId: string | null, agentContext: AdditionalContext, currentUrl: string, appInitiated: boolean, userTimezone: string | null): Promise<number>;
26
+ respondToApproval(decisions: Array<{
27
+ tool_call_id: string;
28
+ type: "approve" | "reject";
29
+ }>, conversationId: string | null): void;
30
+ private openSocket;
24
31
  }
@@ -1,9 +1,9 @@
1
1
  import * as React from "react";
2
- import { Chat } from "../models/Chat";
2
+ import { ChatMessage } from "../models/Chat";
3
3
  import { Message } from "../models/Conversation";
4
4
  interface AgentMessageProps {
5
5
  children: React.ReactNode;
6
- message?: Chat;
6
+ message?: ChatMessage;
7
7
  sendFeedback?: (messageId: string, score: string, comment: string) => void;
8
8
  fetchMessagePair?: (messageId: string) => Promise<Message | undefined>;
9
9
  handleSendMessage?: (message: string | undefined) => Promise<void>;
@@ -1,9 +1,10 @@
1
1
  import * as React from "react";
2
- export declare function AgentTextarea({ onSendMessage, setMessage, message, isMessageLoading, isReadOnly, conversationFrozen, }: {
2
+ export declare function AgentTextarea({ onSendMessage, setMessage, message, isMessageLoading, isReadOnly, conversationFrozen, onTrackEvent, }: {
3
3
  onSendMessage: (message: string, appInitiated: boolean, currentAppName?: string | undefined) => Promise<boolean>;
4
4
  setMessage: (message: string) => void;
5
5
  message: string;
6
6
  isMessageLoading: boolean;
7
7
  isReadOnly?: boolean;
8
8
  conversationFrozen?: boolean;
9
+ onTrackEvent?: (eventName: string, eventProperties?: Record<string, any>) => void;
9
10
  }): React.JSX.Element;
@@ -9,6 +9,7 @@ type MaxPanelHeaderActionsProps = {
9
9
  onToggleConversationList: () => void;
10
10
  onStartNewConversation: () => void;
11
11
  onClosePanel: () => void;
12
+ onTrackEvent?: (eventName: string, eventProperties?: Record<string, any>) => void;
12
13
  };
13
- export declare function MaxPanelHeaderActions({ isCompact, showConversationList, conversationToggleLabel, newConversationLabel, newConversationCompactTitle, closePanelLabel, onToggleConversationList, onStartNewConversation, onClosePanel, }: MaxPanelHeaderActionsProps): React.ReactNode;
14
+ export declare function MaxPanelHeaderActions({ isCompact, showConversationList, conversationToggleLabel, newConversationLabel, newConversationCompactTitle, closePanelLabel, onToggleConversationList, onStartNewConversation, onClosePanel, onTrackEvent, }: MaxPanelHeaderActionsProps): React.ReactNode;
14
15
  export {};
@@ -0,0 +1,13 @@
1
+ import * as React from "react";
2
+ import { ToolApprovalStatus } from "../models/Chat";
3
+ interface ToolApprovalPromptProps {
4
+ toolName: string;
5
+ toolInput?: Record<string, unknown>;
6
+ status: ToolApprovalStatus;
7
+ source: "live" | "history";
8
+ onApprove: () => void;
9
+ onReject: () => void;
10
+ onRetry?: () => void;
11
+ }
12
+ export declare function ToolApprovalPrompt({ toolName, toolInput, status, onApprove, onReject, onRetry, }: ToolApprovalPromptProps): React.JSX.Element;
13
+ export {};
@@ -1,2 +1,3 @@
1
1
  export { ConversationSwitchLoadingStatus, OlderMessagesLoadingStatus } from "./ChatLoadingStatus";
2
2
  export { MaxPanelHeaderActions } from "./MaxPanelHeaderActions";
3
+ export { ToolApprovalPrompt } from "./ToolApprovalPrompt";
@@ -23,7 +23,8 @@ export declare function useMaxChat(agentApi: AgentApiService, context: Additiona
23
23
  fetchConversationList: () => Promise<void>;
24
24
  sendFeedback: (messageId: string, score: string, comment: string) => Promise<void>;
25
25
  fetchMessagePair: (messageId: string) => Promise<Message | undefined>;
26
- retrySendMessage: () => Promise<void>;
26
+ retrySendMessage: (messageOverride?: string) => Promise<void>;
27
+ respondToToolApproval: (toolCallId: string, approved: boolean, conversationId?: string) => void;
27
28
  messageHasBeenSent: boolean;
28
29
  fetchUsageStatus: () => Promise<import("../models/UsageStatus").UserStatus | undefined>;
29
30
  doesUserHaveAgentPerms: () => boolean;