@spscommerce/max 0.1.0 → 0.2.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
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
  import { FeatureFlagsTitles } from "./models/FeatureFlagsTitles";
3
3
  import { CurrentApp } from "./models/CurrentApp";
4
4
  import { CurrentUser } from "./models/CurrentUser";
5
- export declare function MaxPanel({ token, currentUser, hideAgentPanel, isAgentPanelOpen, isInCustomerView, flags, env, currentApp, context, currentConversationId, }: {
5
+ export declare function MaxPanel({ token, currentUser, hideAgentPanel, isAgentPanelOpen, isInCustomerView, flags, env, currentApp, context, currentConversationId, locale, }: {
6
6
  token: string | null;
7
7
  currentUser: CurrentUser | undefined;
8
8
  hideAgentPanel: () => void;
@@ -13,4 +13,5 @@ export declare function MaxPanel({ token, currentUser, hideAgentPanel, isAgentPa
13
13
  currentApp: CurrentApp;
14
14
  context: () => Record<any, any>;
15
15
  currentConversationId?: string | null;
16
+ locale?: string;
16
17
  }): React.ReactNode;
@@ -10,7 +10,10 @@ export declare class AgentApiService {
10
10
  constructor(env: string, token?: string | null);
11
11
  setToken(token?: string | null): void;
12
12
  getSocket(): WebSocket | null;
13
- fetchConversationMessages: (conversationId: string) => Promise<ConversationMessages>;
13
+ fetchConversationMessages: (conversationId: string, options?: {
14
+ cursor?: string;
15
+ limit?: number;
16
+ }) => Promise<ConversationMessages>;
14
17
  fetchConversationList: () => Promise<ConversationList>;
15
18
  renameConversation: (conversationId: string, newTitle: string) => Promise<void>;
16
19
  deleteConversation: (conversationId: string) => Promise<void>;
@@ -1,7 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { Chat } from "../models/Chat";
3
3
  import { Message } from "../models/Conversation";
4
- import "../max.scss";
5
4
  interface AgentMessageProps {
6
5
  children: React.ReactNode;
7
6
  message?: Chat;
@@ -1,4 +1,5 @@
1
1
  import * as React from "react";
2
- export declare const UserMessage: React.MemoExoticComponent<({ children }: {
2
+ export declare const UserMessage: React.MemoExoticComponent<({ children, isObo }: {
3
3
  children: React.ReactNode;
4
+ isObo?: boolean;
4
5
  }) => React.JSX.Element>;
@@ -3,6 +3,7 @@ import { AgentApiService } from "../api-service";
3
3
  import { CurrentUser } from "../models/CurrentUser";
4
4
  import { CurrentApp } from "../models/CurrentApp";
5
5
  import { FeatureFlagsTitles } from "../models/FeatureFlagsTitles";
6
+ import { UserStatus } from "../models/UsageStatus";
6
7
  export type AgentContextValue = {
7
8
  agentApiService: AgentApiService | null;
8
9
  showAgentPanel: () => void;
@@ -13,8 +14,8 @@ export type AgentContextValue = {
13
14
  updateCurrentConversationId: (conversationId: string | null) => void;
14
15
  lastSentUserMessage: string;
15
16
  updateLastSentUserMessage: (message: string) => void;
16
- usageStatus: "active" | "limited";
17
- updateUsageStatus: (status: "active" | "limited") => void;
17
+ usageStatus: UserStatus;
18
+ updateUsageStatus: (status: UserStatus) => void;
18
19
  userHasAgentPerms: boolean;
19
20
  updateUserHasAgentPerms: (value: boolean) => void;
20
21
  isInPreprod: boolean;
@@ -7,8 +7,9 @@ export declare function useMaxChat(agentApi: AgentApiService, context: () => Rec
7
7
  isAgentThinking: boolean;
8
8
  messages: Chat[];
9
9
  displayedMessages: Chat[];
10
- hasHiddenMessages: boolean;
11
- expandRenderWindow: () => void;
10
+ hasMoreMessages: boolean;
11
+ loadOlderMessages: () => Promise<void>;
12
+ isLoadingOlderMessages: boolean;
12
13
  streamingResponse: string | undefined;
13
14
  sendMessage: (message: string, isAppInitiated: boolean, currentAppName?: string) => Promise<void>;
14
15
  startNewConversation: () => void;
@@ -20,6 +21,6 @@ export declare function useMaxChat(agentApi: AgentApiService, context: () => Rec
20
21
  fetchMessagePair: (messageId: string) => Promise<Message | undefined>;
21
22
  retrySendMessage: () => Promise<void>;
22
23
  messageHasBeenSent: boolean;
23
- fetchUsageStatus: () => Promise<void>;
24
+ fetchUsageStatus: () => Promise<import("../models/UsageStatus").UserStatus | undefined>;
24
25
  doesUserHaveAgentPerms: () => boolean;
25
26
  };
package/lib/i18n.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import { type UseTranslationOptions } from "react-i18next";
2
+ declare const i18nMax: import("i18next").i18n;
3
+ export declare function useMaxLanguage(locale?: string, options?: UseTranslationOptions): import("react-i18next").UseTranslationResponse<"max-translations", undefined>;
4
+ export { i18nMax };