@skippr/live-agent-sdk 0.33.0 → 0.35.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/README.md +53 -25
- package/dist/esm/lib-exports.js +1047 -293
- package/dist/skippr-sdk.css +1 -1
- package/dist/skippr-sdk.js +144 -144
- package/dist/types/components/LiveAgent.d.ts +1 -1
- package/dist/types/components/MeetingControls.d.ts +5 -1
- package/dist/types/components/ModuleSelector.d.ts +1 -0
- package/dist/types/components/StartSessionPrompt.d.ts +10 -2
- package/dist/types/context/LiveAgentContext.d.ts +35 -1
- package/dist/types/hooks/useAvailableModules.d.ts +13 -0
- package/dist/types/hooks/useLiveAgent.d.ts +1 -0
- package/dist/types/hooks/useSession.d.ts +26 -4
- package/dist/types/lib/react-compat.d.ts +26 -0
- package/dist/types/lib-exports.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import { type AgentControls } from '../context/LiveAgentContext';
|
|
3
3
|
interface LiveAgentBaseProps {
|
|
4
|
-
agentId
|
|
4
|
+
agentId?: string | undefined;
|
|
5
5
|
authToken?: string | undefined;
|
|
6
6
|
appKey?: string | undefined;
|
|
7
7
|
userToken?: string | undefined;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
interface MeetingControlsProps {
|
|
2
2
|
onHangUp: () => void;
|
|
3
|
+
onPause?: () => void;
|
|
4
|
+
onResume?: () => void;
|
|
5
|
+
isPaused?: boolean;
|
|
6
|
+
isPausing?: boolean;
|
|
3
7
|
showScreenShareToggle?: boolean;
|
|
4
8
|
}
|
|
5
|
-
export declare function MeetingControls({ onHangUp, showScreenShareToggle }: MeetingControlsProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function MeetingControls({ onHangUp, onPause, onResume, isPaused, isPausing, showScreenShareToggle, }: MeetingControlsProps): import("react/jsx-runtime").JSX.Element;
|
|
6
10
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ModuleSelector(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
import type { AgentControls } from '../context/LiveAgentContext';
|
|
1
2
|
interface StartSessionPromptProps {
|
|
2
|
-
onStartSession: (
|
|
3
|
+
onStartSession: (opts: {
|
|
4
|
+
agentId: string;
|
|
5
|
+
agentControls?: AgentControls;
|
|
6
|
+
}) => void;
|
|
7
|
+
agentId: string | null;
|
|
8
|
+
agentControls?: AgentControls | undefined;
|
|
3
9
|
isStarting?: boolean;
|
|
4
10
|
error?: string;
|
|
5
11
|
label?: string;
|
|
12
|
+
canResume?: boolean;
|
|
13
|
+
onResume?: () => void;
|
|
6
14
|
}
|
|
7
|
-
export declare function StartSessionPrompt({ onStartSession, isStarting, error, label, }: StartSessionPromptProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function StartSessionPrompt({ onStartSession, agentId, agentControls, isStarting, error, label, canResume, onResume, }: StartSessionPromptProps): import("react/jsx-runtime").JSX.Element;
|
|
8
16
|
export {};
|
|
@@ -1,15 +1,39 @@
|
|
|
1
|
+
import type { Message } from '../types';
|
|
1
2
|
export type SidebarTab = 'chat' | 'agenda';
|
|
2
3
|
export type CaptureMode = 'screenshare' | 'auto';
|
|
3
4
|
export interface AgentControls {
|
|
4
5
|
highlight?: boolean;
|
|
5
6
|
}
|
|
7
|
+
export interface Module {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
description: string | null;
|
|
11
|
+
type: string;
|
|
12
|
+
priority: number;
|
|
13
|
+
controls: AgentControls;
|
|
14
|
+
}
|
|
15
|
+
export interface ResumableSession {
|
|
16
|
+
id: string;
|
|
17
|
+
agentId: string;
|
|
18
|
+
}
|
|
6
19
|
export interface LiveAgentPublicValue {
|
|
7
20
|
isConnected: boolean;
|
|
8
21
|
isStarting: boolean;
|
|
22
|
+
isDisconnecting: boolean;
|
|
23
|
+
isPausing: boolean;
|
|
9
24
|
error: string;
|
|
10
25
|
errorCode: number | null;
|
|
11
|
-
|
|
26
|
+
agentId: string | null;
|
|
27
|
+
startSession: (opts: {
|
|
28
|
+
agentId: string;
|
|
29
|
+
agentControls?: AgentControls;
|
|
30
|
+
}) => Promise<void>;
|
|
31
|
+
pauseSession: () => Promise<void>;
|
|
32
|
+
resumeSession: () => Promise<void>;
|
|
12
33
|
disconnect: () => Promise<void>;
|
|
34
|
+
isPaused: boolean;
|
|
35
|
+
resumableSession: ResumableSession | null;
|
|
36
|
+
resumableSessions: ResumableSession[];
|
|
13
37
|
isPanelOpen: boolean;
|
|
14
38
|
openPanel: () => void;
|
|
15
39
|
closePanel: () => void;
|
|
@@ -33,6 +57,13 @@ export interface LiveAgentPublicValue {
|
|
|
33
57
|
autoFocusChat: boolean;
|
|
34
58
|
captureMode: CaptureMode;
|
|
35
59
|
agentControls?: AgentControls | undefined;
|
|
60
|
+
hasModuleSelector: boolean;
|
|
61
|
+
availableModules: Module[];
|
|
62
|
+
activeModule: Module | null;
|
|
63
|
+
isLoadingModules: boolean;
|
|
64
|
+
modulesError: string | null;
|
|
65
|
+
refetchModules: () => Promise<void>;
|
|
66
|
+
selectModule: (id: string) => void;
|
|
36
67
|
}
|
|
37
68
|
export interface LiveAgentContextValue extends LiveAgentPublicValue {
|
|
38
69
|
connection: {
|
|
@@ -40,5 +71,8 @@ export interface LiveAgentContextValue extends LiveAgentPublicValue {
|
|
|
40
71
|
token: string;
|
|
41
72
|
} | null;
|
|
42
73
|
shouldConnect: boolean;
|
|
74
|
+
historyMessages: Message[];
|
|
75
|
+
phasesSnapshot: unknown[];
|
|
76
|
+
setPhasesSnapshot: (phases: unknown[]) => void;
|
|
43
77
|
}
|
|
44
78
|
export declare const LiveAgentContext: import("react").Context<LiveAgentContextValue | null>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Module } from '../context/LiveAgentContext';
|
|
2
|
+
interface UseAvailableModulesParams {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
bearerToken: string | null;
|
|
5
|
+
}
|
|
6
|
+
interface UseAvailableModulesResult {
|
|
7
|
+
modules: Module[];
|
|
8
|
+
isLoading: boolean;
|
|
9
|
+
error: string | null;
|
|
10
|
+
refetch: () => Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export declare function useAvailableModules({ enabled, bearerToken, }: UseAvailableModulesParams): UseAvailableModulesResult;
|
|
13
|
+
export {};
|
|
@@ -1,24 +1,46 @@
|
|
|
1
1
|
import type { AgentControls, CaptureMode } from '../context/LiveAgentContext';
|
|
2
|
+
import type { Message } from '../types';
|
|
2
3
|
interface LiveKitConnection {
|
|
3
4
|
livekitUrl: string;
|
|
4
5
|
token: string;
|
|
5
6
|
}
|
|
6
7
|
interface UseSessionParams {
|
|
7
|
-
agentId: string;
|
|
8
8
|
captureMode?: CaptureMode | undefined;
|
|
9
|
-
agentControls?: AgentControls | undefined;
|
|
10
9
|
authToken?: string | undefined;
|
|
11
10
|
appKey?: string | undefined;
|
|
12
11
|
userToken?: string | undefined;
|
|
12
|
+
onStart?: () => void;
|
|
13
|
+
onStartError?: () => void;
|
|
14
|
+
onDisconnect?: () => void;
|
|
15
|
+
}
|
|
16
|
+
export interface StartSessionOptions {
|
|
17
|
+
agentId: string;
|
|
18
|
+
agentControls?: AgentControls;
|
|
19
|
+
}
|
|
20
|
+
export interface ResumableSession {
|
|
21
|
+
id: string;
|
|
22
|
+
agentId: string;
|
|
13
23
|
}
|
|
14
|
-
export declare function useSession({
|
|
24
|
+
export declare function useSession({ captureMode, authToken, appKey, userToken, onStart, onStartError, onDisconnect, }: UseSessionParams): {
|
|
15
25
|
connection: LiveKitConnection | null;
|
|
16
26
|
shouldConnect: boolean;
|
|
17
27
|
isStarting: boolean;
|
|
28
|
+
isDisconnecting: boolean;
|
|
18
29
|
error: string;
|
|
19
30
|
errorCode: number | null;
|
|
20
|
-
startSession: () => Promise<void>;
|
|
31
|
+
startSession: ({ agentId, agentControls }: StartSessionOptions) => Promise<void>;
|
|
32
|
+
pauseSession: () => Promise<void>;
|
|
33
|
+
resumeSession: ({ sessionId: resumeId, agentControls, }: {
|
|
34
|
+
sessionId: string;
|
|
35
|
+
agentControls?: AgentControls | undefined;
|
|
36
|
+
}) => Promise<void>;
|
|
21
37
|
disconnect: () => Promise<void>;
|
|
38
|
+
isPaused: boolean;
|
|
39
|
+
isPausing: boolean;
|
|
40
|
+
resumableSessions: ResumableSession[];
|
|
41
|
+
historyMessages: Message[];
|
|
42
|
+
refetchResumable: () => Promise<void>;
|
|
22
43
|
pendingScreenStream: MediaStream | null;
|
|
44
|
+
bearerToken: string | null;
|
|
23
45
|
};
|
|
24
46
|
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* React 18 / 19 compatibility layer. The SDK declares `react: "^18 || ^19"`, so
|
|
4
|
+
* it must run on whichever React the host provides. React 19-only APIs that
|
|
5
|
+
* have a behaviourally identical 18 equivalent are mapped here; APIs with no 18
|
|
6
|
+
* equivalent (the Actions hooks, suspending `use(promise)`, Server Components)
|
|
7
|
+
* must be guarded with an explicit runtime check, never silently shimmed.
|
|
8
|
+
*
|
|
9
|
+
* Always consume these helpers instead of importing the raw API from `react` —
|
|
10
|
+
* the Biome `noRestrictedImports` rule enforces it.
|
|
11
|
+
*/
|
|
12
|
+
type UseContextHook = <T>(context: React.Context<T>) => T;
|
|
13
|
+
/**
|
|
14
|
+
* Picks the hook used to read a context. React 19's `use(context)` is identical
|
|
15
|
+
* to `useContext(context)` for context reads, so we prefer the native `use`
|
|
16
|
+
* when present and fall back to `useContext` on React 18, where `use` is
|
|
17
|
+
* `undefined`. Pure and exported so the version branching is unit-testable.
|
|
18
|
+
*/
|
|
19
|
+
export declare function selectContextHook(use: UseContextHook | undefined, useContext: UseContextHook): UseContextHook;
|
|
20
|
+
/**
|
|
21
|
+
* Reads a context value, version-agnostic. React's identity is fixed for the
|
|
22
|
+
* process, so resolving the hook once at module load keeps the call order
|
|
23
|
+
* stable across renders.
|
|
24
|
+
*/
|
|
25
|
+
export declare const useContextValue: UseContextHook;
|
|
26
|
+
export {};
|