@skippr/live-agent-sdk 0.36.0 → 0.37.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.
@@ -4,6 +4,7 @@ interface LiveAgentBaseProps {
4
4
  agentId?: string | undefined;
5
5
  authToken?: string | undefined;
6
6
  appKey?: string | undefined;
7
+ getUserToken?: (() => Promise<string>) | undefined;
7
8
  userToken?: string | undefined;
8
9
  position?: 'left' | 'right' | undefined;
9
10
  variant?: 'floating' | 'sidebar' | undefined;
@@ -59,7 +59,7 @@ export interface LiveAgentPublicValue {
59
59
  authError: string;
60
60
  requestOtp: (email: string) => Promise<boolean>;
61
61
  verifyOtp: (email: string, code: string) => Promise<void>;
62
- logoutAuth: () => void;
62
+ logoutAuth: () => Promise<void>;
63
63
  isAuthSubmitting: boolean;
64
64
  sidebarTab: SidebarTab;
65
65
  setSidebarTab: (tab: SidebarTab) => void;
@@ -75,6 +75,8 @@ export interface LiveAgentPublicValue {
75
75
  selectModule: (id: string) => void;
76
76
  }
77
77
  export interface LiveAgentContextValue extends LiveAgentPublicValue {
78
+ usesHostAuth: boolean;
79
+ authFailed: boolean;
78
80
  connection: {
79
81
  livekitUrl: string;
80
82
  token: string;
@@ -7,7 +7,7 @@ export declare function useAuth({ appKey }: UseAuthParams): {
7
7
  authToken: string | null;
8
8
  requestOtp: (email: string) => Promise<boolean>;
9
9
  verifyOtp: (email: string, code: string) => Promise<void>;
10
- logout: () => void;
10
+ logout: () => Promise<void>;
11
11
  error: string;
12
12
  isSubmitting: boolean;
13
13
  };
@@ -1,7 +1,9 @@
1
1
  import type { Module } from '../context/LiveAgentContext';
2
+ import type { AuthedFetch } from './useSession';
2
3
  interface UseAvailableModulesParams {
3
4
  enabled: boolean;
4
5
  bearerToken: string | null;
6
+ authedFetch: AuthedFetch;
5
7
  }
6
8
  interface UseAvailableModulesResult {
7
9
  modules: Module[];
@@ -9,5 +11,5 @@ interface UseAvailableModulesResult {
9
11
  error: string | null;
10
12
  refetch: () => Promise<void>;
11
13
  }
12
- export declare function useAvailableModules({ enabled, bearerToken, }: UseAvailableModulesParams): UseAvailableModulesResult;
14
+ export declare function useAvailableModules({ enabled, bearerToken, authedFetch, }: UseAvailableModulesParams): UseAvailableModulesResult;
13
15
  export {};
@@ -1,5 +1,6 @@
1
1
  import type { AgentControls, CaptureMode } from '../context/LiveAgentContext';
2
2
  import type { Message } from '../types';
3
+ export type AuthedFetch = (input: string, init?: RequestInit) => Promise<Response>;
3
4
  interface LiveKitConnection {
4
5
  livekitUrl: string;
5
6
  token: string;
@@ -8,6 +9,7 @@ interface UseSessionParams {
8
9
  captureMode?: CaptureMode | undefined;
9
10
  authToken?: string | undefined;
10
11
  appKey?: string | undefined;
12
+ getUserToken?: (() => Promise<string>) | undefined;
11
13
  userToken?: string | undefined;
12
14
  onStart?: () => void;
13
15
  onStartError?: () => void;
@@ -18,7 +20,7 @@ export interface StartSessionOptions {
18
20
  agentControls?: AgentControls | undefined;
19
21
  existingSessionId?: string | undefined;
20
22
  }
21
- export declare function useSession({ captureMode, authToken, appKey, userToken, onStart, onStartError, onDisconnect, }: UseSessionParams): {
23
+ export declare function useSession({ captureMode, authToken, appKey, getUserToken, userToken, onStart, onStartError, onDisconnect, }: UseSessionParams): {
22
24
  connection: LiveKitConnection | null;
23
25
  shouldConnect: boolean;
24
26
  isStarting: boolean;
@@ -33,5 +35,7 @@ export declare function useSession({ captureMode, authToken, appKey, userToken,
33
35
  historyMessages: Message[];
34
36
  pendingScreenStream: MediaStream | null;
35
37
  bearerToken: string | null;
38
+ authedFetch: AuthedFetch;
39
+ authFailed: boolean;
36
40
  };
37
41
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skippr/live-agent-sdk",
3
- "version": "0.36.0",
3
+ "version": "0.37.0",
4
4
  "type": "module",
5
5
  "main": "dist/esm/lib-exports.js",
6
6
  "module": "dist/esm/lib-exports.js",