@equos/react 3.0.2-rc.0 → 3.0.2-rc.10
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/dist/client.d.ts +29 -0
- package/dist/client.js +43 -0
- package/dist/components/equos-camera-toggle.d.ts +4 -0
- package/dist/components/equos-camera-toggle.js +20 -0
- package/dist/components/equos-character-tile.d.ts +12 -0
- package/dist/components/equos-character-tile.js +82 -0
- package/dist/components/equos-conversation-renderer.d.ts +14 -0
- package/dist/components/equos-conversation-renderer.js +113 -0
- package/dist/components/equos-hangup-button.d.ts +5 -0
- package/dist/components/equos-hangup-button.js +9 -0
- package/dist/components/equos-mic-toggle.d.ts +4 -0
- package/dist/components/equos-mic-toggle.js +20 -0
- package/dist/components/equos-screenshare-toggle.d.ts +4 -0
- package/dist/components/equos-screenshare-toggle.js +20 -0
- package/dist/components/equos-video-tile.d.ts +7 -0
- package/dist/components/equos-video-tile.js +32 -0
- package/dist/components/index.d.ts +8 -0
- package/dist/components/index.js +24 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +19 -0
- package/dist/styles.css +745 -0
- package/dist/utils/copy.utils.d.ts +24 -0
- package/dist/utils/copy.utils.js +273 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/{src → utils}/index.js +1 -1
- package/package.json +10 -7
- package/dist/src/components/equos-conversation-renderer.d.ts +0 -5
- package/dist/src/components/equos-conversation-renderer.js +0 -8
- package/dist/src/index.d.ts +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- /package/dist/{src/components → components}/equos-logo.d.ts +0 -0
- /package/dist/{src/components → components}/equos-logo.js +0 -0
- /package/dist/{src/utils → utils}/cn.d.ts +0 -0
- /package/dist/{src/utils → utils}/cn.js +0 -0
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ConversationApi, HealthApi } from '@equos/core';
|
|
2
|
+
export interface EquosOptions {
|
|
3
|
+
/**
|
|
4
|
+
* API endpoint to use (default: https://api.equos.ai)
|
|
5
|
+
* Can leave blank to use the default endpoint.
|
|
6
|
+
*/
|
|
7
|
+
endpoint?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Main Equos SDK client
|
|
11
|
+
*/
|
|
12
|
+
export declare class EquosClient {
|
|
13
|
+
private readonly configuration;
|
|
14
|
+
private readonly basePath;
|
|
15
|
+
readonly health: HealthApi;
|
|
16
|
+
readonly conversations: ConversationApi;
|
|
17
|
+
private constructor();
|
|
18
|
+
/**
|
|
19
|
+
* Create a new Equos client instance
|
|
20
|
+
* @param apiKey - Your Equos API key
|
|
21
|
+
* @param options - Optional configuration
|
|
22
|
+
* @returns EquosClient instance
|
|
23
|
+
*/
|
|
24
|
+
static create(apiKey: string, options?: EquosOptions): EquosClient;
|
|
25
|
+
/**
|
|
26
|
+
* Get the base path being used by this client
|
|
27
|
+
*/
|
|
28
|
+
getBasePath(): string;
|
|
29
|
+
}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EquosClient = void 0;
|
|
4
|
+
const core_1 = require("@equos/core");
|
|
5
|
+
/**
|
|
6
|
+
* Main Equos SDK client
|
|
7
|
+
*/
|
|
8
|
+
class EquosClient {
|
|
9
|
+
configuration;
|
|
10
|
+
basePath;
|
|
11
|
+
// API instances
|
|
12
|
+
health;
|
|
13
|
+
conversations;
|
|
14
|
+
constructor(accessToken, options) {
|
|
15
|
+
const endpoint = options?.endpoint || 'https://api.equos.ai';
|
|
16
|
+
// Construct the base path
|
|
17
|
+
this.basePath = `${endpoint}`;
|
|
18
|
+
// Create configuration with access token
|
|
19
|
+
this.configuration = new core_1.Configuration({
|
|
20
|
+
basePath: this.basePath,
|
|
21
|
+
accessToken: accessToken,
|
|
22
|
+
});
|
|
23
|
+
// Initialize all API instances
|
|
24
|
+
this.health = new core_1.HealthApi(this.configuration);
|
|
25
|
+
this.conversations = new core_1.ConversationApi(this.configuration);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Create a new Equos client instance
|
|
29
|
+
* @param apiKey - Your Equos API key
|
|
30
|
+
* @param options - Optional configuration
|
|
31
|
+
* @returns EquosClient instance
|
|
32
|
+
*/
|
|
33
|
+
static create(apiKey, options) {
|
|
34
|
+
return new EquosClient(apiKey, options);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get the base path being used by this client
|
|
38
|
+
*/
|
|
39
|
+
getBasePath() {
|
|
40
|
+
return this.basePath;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.EquosClient = EquosClient;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EquosCameraToggle = EquosCameraToggle;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const components_react_1 = require("@livekit/components-react");
|
|
6
|
+
const livekit_client_1 = require("livekit-client");
|
|
7
|
+
const lucide_react_1 = require("lucide-react");
|
|
8
|
+
const cn_1 = require("../utils/cn");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
function EquosCameraToggle({ onToggle, className, }) {
|
|
11
|
+
const { toggle, enabled } = (0, components_react_1.useTrackToggle)({
|
|
12
|
+
source: livekit_client_1.Track.Source.Camera,
|
|
13
|
+
});
|
|
14
|
+
(0, react_1.useEffect)(() => {
|
|
15
|
+
onToggle(enabled);
|
|
16
|
+
}, [enabled]);
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)("button", { className: (0, cn_1.cn)('rounded-full p-3 border transition-colors shadow-xl cursor-pointer', enabled
|
|
18
|
+
? 'bg-white/60 border-white hover:bg-white/80 text-black'
|
|
19
|
+
: 'bg-white/20 border-white/60 hover:bg-white/40 text-[#141414]/50', className), type: "button", onClick: () => toggle(), children: enabled ? (0, jsx_runtime_1.jsx)(lucide_react_1.Video, { size: 20 }) : (0, jsx_runtime_1.jsx)(lucide_react_1.VideoOff, { size: 20 }) }));
|
|
20
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EquosLocale } from '../utils/copy.utils';
|
|
2
|
+
export declare function EquosCharacterTile({ identity, name, locale, className, startedAt, maxSeconds, recoveryTimeInSeconds, showTimeLeft, onShouldLeave, }: {
|
|
3
|
+
identity: string;
|
|
4
|
+
name: string;
|
|
5
|
+
locale?: EquosLocale;
|
|
6
|
+
className?: string;
|
|
7
|
+
startedAt: Date;
|
|
8
|
+
maxSeconds: number;
|
|
9
|
+
recoveryTimeInSeconds?: number;
|
|
10
|
+
showTimeLeft?: boolean;
|
|
11
|
+
onShouldLeave?: () => void | Promise<void>;
|
|
12
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EquosCharacterTile = EquosCharacterTile;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const components_react_1 = require("@livekit/components-react");
|
|
6
|
+
const cn_1 = require("../utils/cn");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const livekit_client_1 = require("livekit-client");
|
|
9
|
+
const copy_utils_1 = require("../utils/copy.utils");
|
|
10
|
+
function EquosCharacterTile({ identity, name, locale = copy_utils_1.EquosLocale.EN, className, startedAt, maxSeconds, recoveryTimeInSeconds = 3, showTimeLeft = true, onShouldLeave, }) {
|
|
11
|
+
const waitForCharacterToJoin = 20;
|
|
12
|
+
const [joined, setJoined] = (0, react_1.useState)(false);
|
|
13
|
+
const [leftTimeout, setLeftTimeout] = (0, react_1.useState)(null);
|
|
14
|
+
const [remainingTime, setRemainingTime] = (0, react_1.useState)(null);
|
|
15
|
+
const [duration, setDuration] = (0, react_1.useState)(0);
|
|
16
|
+
const participants = (0, components_react_1.useParticipants)();
|
|
17
|
+
const trackRef = (0, react_1.useMemo)(() => {
|
|
18
|
+
const participant = participants.find((p) => p.identity === identity);
|
|
19
|
+
if (!participant || !participant.trackPublications) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const publication = Array.from(participant.trackPublications.values()).find((pub) => pub.source === livekit_client_1.Track.Source.Camera);
|
|
23
|
+
if (!publication) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
participant,
|
|
28
|
+
publication,
|
|
29
|
+
source: livekit_client_1.Track.Source.Camera,
|
|
30
|
+
};
|
|
31
|
+
}, [identity, participants]);
|
|
32
|
+
const hasTroubleJoining = (0, react_1.useMemo)(() => {
|
|
33
|
+
return !joined && duration > waitForCharacterToJoin - 10;
|
|
34
|
+
}, [joined, duration]);
|
|
35
|
+
const joiningCopy = (0, react_1.useMemo)(() => {
|
|
36
|
+
return copy_utils_1.CopyUtils.joiningCopy(locale, name);
|
|
37
|
+
}, [name, locale]);
|
|
38
|
+
const notJoiningCopy = (0, react_1.useMemo)(() => {
|
|
39
|
+
return copy_utils_1.CopyUtils.notJoiningCopy(locale, name);
|
|
40
|
+
}, [name, locale]);
|
|
41
|
+
const endingConversationCopy = (0, react_1.useMemo)(() => {
|
|
42
|
+
return copy_utils_1.CopyUtils.endingConversationCopy(locale, Math.max(waitForCharacterToJoin - duration, 0));
|
|
43
|
+
}, [duration, locale, waitForCharacterToJoin]);
|
|
44
|
+
// Detect if we should leave the conversation because the character is not joining...
|
|
45
|
+
(0, react_1.useEffect)(() => {
|
|
46
|
+
if (!onShouldLeave)
|
|
47
|
+
return;
|
|
48
|
+
if (!joined && duration > waitForCharacterToJoin) {
|
|
49
|
+
onShouldLeave();
|
|
50
|
+
}
|
|
51
|
+
}, [joined, duration, waitForCharacterToJoin, onShouldLeave]);
|
|
52
|
+
(0, react_1.useEffect)(() => {
|
|
53
|
+
const i = setInterval(() => {
|
|
54
|
+
const elapsedTime = new Date().getTime() - startedAt.getTime();
|
|
55
|
+
const remainingSeconds = Math.round(Math.max(0, maxSeconds * 1000 - elapsedTime) / 1000);
|
|
56
|
+
setRemainingTime(copy_utils_1.CopyUtils.timeLeftCopy(locale, remainingSeconds));
|
|
57
|
+
setDuration((duration) => duration + 1);
|
|
58
|
+
}, 1000);
|
|
59
|
+
return () => clearInterval(i);
|
|
60
|
+
}, [startedAt, maxSeconds]);
|
|
61
|
+
(0, react_1.useEffect)(() => {
|
|
62
|
+
if (joined) {
|
|
63
|
+
if (!trackRef && !leftTimeout && onShouldLeave) {
|
|
64
|
+
setLeftTimeout(setTimeout(() => {
|
|
65
|
+
onShouldLeave?.();
|
|
66
|
+
}, recoveryTimeInSeconds * 1000));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
else if (trackRef) {
|
|
70
|
+
setJoined(true);
|
|
71
|
+
if (leftTimeout) {
|
|
72
|
+
clearTimeout(leftTimeout);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return () => {
|
|
76
|
+
if (leftTimeout) {
|
|
77
|
+
clearTimeout(leftTimeout);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}, [joined, trackRef]);
|
|
81
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)('relative w-full h-full overflow-hidden bg-black', className), children: [remainingTime && showTimeLeft && ((0, jsx_runtime_1.jsx)("span", { className: "absolute right-4 top-4 z-20 text-xs text-white rounded-full bg-black/10 py-1 px-2", children: remainingTime })), !joined && !hasTroubleJoining && ((0, jsx_runtime_1.jsx)("span", { className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-20 text-xs text-white", children: joiningCopy })), !joined && hasTroubleJoining && ((0, jsx_runtime_1.jsxs)("span", { className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-20 flex flex-col items-center", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-xs text-white", children: notJoiningCopy }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-white", children: endingConversationCopy })] })), trackRef && (0, jsx_runtime_1.jsx)(components_react_1.VideoTrack, { trackRef: trackRef, className: "w-full h-full" })] }));
|
|
82
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { EquosConversationWithCharacter } from '@equos/core';
|
|
2
|
+
import { EquosLocale } from '../utils/copy.utils';
|
|
3
|
+
export declare function EquosConversationRenderer({ conversation, accessToken, allowMic, allowCamera, allowScreenshare, allowHangUp, className, characterVideoClassName, locale, onHangUp, }: {
|
|
4
|
+
conversation?: EquosConversationWithCharacter | null;
|
|
5
|
+
accessToken?: string | null;
|
|
6
|
+
allowMic?: boolean;
|
|
7
|
+
allowCamera?: boolean;
|
|
8
|
+
allowScreenshare?: boolean;
|
|
9
|
+
className?: string;
|
|
10
|
+
characterVideoClassName?: string;
|
|
11
|
+
allowHangUp?: boolean;
|
|
12
|
+
locale?: EquosLocale;
|
|
13
|
+
onHangUp?: () => void | Promise<void>;
|
|
14
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EquosConversationRenderer = EquosConversationRenderer;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const cn_1 = require("../utils/cn");
|
|
6
|
+
const components_react_1 = require("@livekit/components-react");
|
|
7
|
+
const equos_mic_toggle_1 = require("./equos-mic-toggle");
|
|
8
|
+
const equos_camera_toggle_1 = require("./equos-camera-toggle");
|
|
9
|
+
const equos_screenshare_toggle_1 = require("./equos-screenshare-toggle");
|
|
10
|
+
const equos_hangup_button_1 = require("./equos-hangup-button");
|
|
11
|
+
const react_1 = require("react");
|
|
12
|
+
const livekit_client_1 = require("livekit-client");
|
|
13
|
+
const equos_video_tile_1 = require("./equos-video-tile");
|
|
14
|
+
const equos_character_tile_1 = require("./equos-character-tile");
|
|
15
|
+
const copy_utils_1 = require("../utils/copy.utils");
|
|
16
|
+
function EquosConversationRenderer({ conversation, accessToken, allowMic = true, allowCamera = true, allowScreenshare = false, allowHangUp = true, className, characterVideoClassName, locale = copy_utils_1.EquosLocale.EN, onHangUp, }) {
|
|
17
|
+
const [hangingUp, setHangingUp] = (0, react_1.useState)(false);
|
|
18
|
+
const [_, setMicEnabled] = (0, react_1.useState)(false);
|
|
19
|
+
const [cameraEnabled, setCameraEnabled] = (0, react_1.useState)(false);
|
|
20
|
+
const [screenshareEnabled, setScreenshareEnabled] = (0, react_1.useState)(false);
|
|
21
|
+
const containerRef = (0, react_1.useRef)(null);
|
|
22
|
+
const cameraTileRef = (0, react_1.useRef)(null);
|
|
23
|
+
const screenTileRef = (0, react_1.useRef)(null);
|
|
24
|
+
const [cameraTilePos, setCameraTilePos] = (0, react_1.useState)({
|
|
25
|
+
x: 8,
|
|
26
|
+
y: 8,
|
|
27
|
+
});
|
|
28
|
+
const [cameraTileDragOffset, setCameraTileDragOffset] = (0, react_1.useState)({
|
|
29
|
+
x: 0,
|
|
30
|
+
y: 0,
|
|
31
|
+
});
|
|
32
|
+
const [cameraTileDragging, setCameraTileDragging] = (0, react_1.useState)(false);
|
|
33
|
+
const [screenTilePos, setScreenTilePos] = (0, react_1.useState)({
|
|
34
|
+
x: 8,
|
|
35
|
+
y: 160,
|
|
36
|
+
});
|
|
37
|
+
const [screenTileDragOffset, setScreenTileDragOffset] = (0, react_1.useState)({
|
|
38
|
+
x: 0,
|
|
39
|
+
y: 0,
|
|
40
|
+
});
|
|
41
|
+
const [screenTileDragging, setScreenTileDragging] = (0, react_1.useState)(false);
|
|
42
|
+
const onCameraTileMouseDown = (e) => {
|
|
43
|
+
setCameraTileDragging(true);
|
|
44
|
+
setScreenTileDragging(false);
|
|
45
|
+
setCameraTileDragOffset({
|
|
46
|
+
x: e.clientX - cameraTilePos.x,
|
|
47
|
+
y: e.clientY - cameraTilePos.y,
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
const onScreenTileMouseDown = (e) => {
|
|
51
|
+
setScreenTileDragging(true);
|
|
52
|
+
setCameraTileDragging(false);
|
|
53
|
+
setScreenTileDragOffset({
|
|
54
|
+
x: e.clientX - screenTilePos.x,
|
|
55
|
+
y: e.clientY - screenTilePos.y,
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
const onMouseMove = (e) => {
|
|
59
|
+
if (cameraTileDragging || screenTileDragging) {
|
|
60
|
+
const containerRect = containerRef.current?.getBoundingClientRect();
|
|
61
|
+
if (screenTileDragging && containerRect) {
|
|
62
|
+
const newX = e.clientX - screenTileDragOffset.x;
|
|
63
|
+
const newY = e.clientY - screenTileDragOffset.y;
|
|
64
|
+
const screenRect = screenTileRef.current?.getBoundingClientRect();
|
|
65
|
+
if (screenRect) {
|
|
66
|
+
// Clamp to container bounds
|
|
67
|
+
const clampedX = Math.min(Math.max(newX, 0), containerRect.width - screenRect.width);
|
|
68
|
+
const clampedY = Math.min(Math.max(newY, 0), containerRect.height - screenRect.height);
|
|
69
|
+
setScreenTilePos({
|
|
70
|
+
x: clampedX,
|
|
71
|
+
y: clampedY,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (cameraTileDragging && containerRect) {
|
|
76
|
+
const newX = e.clientX - cameraTileDragOffset.x;
|
|
77
|
+
const newY = e.clientY - cameraTileDragOffset.y;
|
|
78
|
+
const cameraRect = cameraTileRef.current?.getBoundingClientRect();
|
|
79
|
+
if (cameraRect) {
|
|
80
|
+
// Clamp to container bounds
|
|
81
|
+
const clampedX = Math.min(Math.max(newX, 0), containerRect.width - cameraRect.width);
|
|
82
|
+
const clampedY = Math.min(Math.max(newY, 0), containerRect.height - cameraRect.height);
|
|
83
|
+
setCameraTilePos({
|
|
84
|
+
x: clampedX,
|
|
85
|
+
y: clampedY,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const onMouseUp = (e) => {
|
|
92
|
+
setCameraTileDragging(false);
|
|
93
|
+
setScreenTileDragging(false);
|
|
94
|
+
};
|
|
95
|
+
const handleHangUp = async () => {
|
|
96
|
+
setHangingUp(true);
|
|
97
|
+
try {
|
|
98
|
+
await onHangUp?.();
|
|
99
|
+
}
|
|
100
|
+
catch (error) { }
|
|
101
|
+
setHangingUp(false);
|
|
102
|
+
};
|
|
103
|
+
if (!conversation || !accessToken) {
|
|
104
|
+
return (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)('w-full h-full', className) });
|
|
105
|
+
}
|
|
106
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: containerRef, onMouseMove: onMouseMove, onMouseUp: onMouseUp, onMouseLeave: onMouseUp, className: (0, cn_1.cn)('relative w-full h-full', className), children: (0, jsx_runtime_1.jsxs)(components_react_1.LiveKitRoom, { serverUrl: conversation.serverUrl, token: accessToken, audio: allowMic, video: allowCamera, screen: false, className: "w-full h-full", children: [allowCamera && cameraEnabled && ((0, jsx_runtime_1.jsx)("div", { ref: cameraTileRef, onMouseDown: onCameraTileMouseDown, className: (0, cn_1.cn)('absolute z-50 select-none', cameraTileDragging ? 'cursor-grabbing' : 'cursor-grab'), style: {
|
|
107
|
+
top: cameraTilePos.y,
|
|
108
|
+
left: cameraTilePos.x,
|
|
109
|
+
}, children: (0, jsx_runtime_1.jsx)(equos_video_tile_1.EquosVideoTile, { identity: conversation.consumerIdentity, source: livekit_client_1.Track.Source.Camera }) })), allowScreenshare && screenshareEnabled && ((0, jsx_runtime_1.jsx)("div", { ref: screenTileRef, onMouseDown: onScreenTileMouseDown, className: (0, cn_1.cn)('absolute z-50', cameraTileDragging ? 'cursor-grabbing' : 'cursor-grab'), style: {
|
|
110
|
+
top: screenTilePos.y,
|
|
111
|
+
left: screenTilePos.x,
|
|
112
|
+
}, children: (0, jsx_runtime_1.jsx)(equos_video_tile_1.EquosVideoTile, { identity: conversation.consumerIdentity, source: livekit_client_1.Track.Source.ScreenShare }) })), (0, jsx_runtime_1.jsx)(equos_character_tile_1.EquosCharacterTile, { identity: conversation.character.livekitIdentity, name: conversation.character.name, locale: locale, startedAt: conversation.startedAt, maxSeconds: conversation.maxSeconds, recoveryTimeInSeconds: 3, onShouldLeave: handleHangUp, className: characterVideoClassName }), (0, jsx_runtime_1.jsx)(components_react_1.RoomAudioRenderer, {}), (0, jsx_runtime_1.jsxs)("div", { className: "absolute grid grid-cols-3 gap-2 max-w-full bottom-8 left-1/2 -translate-x-1/2", children: [(0, jsx_runtime_1.jsx)("div", { className: "justify-self-end flex items-center", children: allowMic && (0, jsx_runtime_1.jsx)(equos_mic_toggle_1.EquosMicToggle, { onToggle: setMicEnabled }) }), (0, jsx_runtime_1.jsx)("div", { children: allowHangUp && ((0, jsx_runtime_1.jsx)(equos_hangup_button_1.EquosHangupButton, { onHangup: handleHangUp, loading: hangingUp })) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [allowCamera && (0, jsx_runtime_1.jsx)(equos_camera_toggle_1.EquosCameraToggle, { onToggle: setCameraEnabled }), allowScreenshare && ((0, jsx_runtime_1.jsx)(equos_screenshare_toggle_1.EquosScreenshareToggle, { onToggle: setScreenshareEnabled }))] })] })] }) }));
|
|
113
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EquosHangupButton = EquosHangupButton;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const lucide_react_1 = require("lucide-react");
|
|
6
|
+
const cn_1 = require("../utils/cn");
|
|
7
|
+
function EquosHangupButton({ className, loading = false, onHangup, }) {
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)("button", { className: (0, cn_1.cn)('overflow-hidden', 'border shadow-glass backdrop-blur-xs rounded-full cursor-pointer text-white transition-colors p-4 bg-[#FF4133]/80 hover:bg-[#FF4133] border-[#FFCFCC] w-32 flex justify-center items-center', className), type: "button", onClick: onHangup, children: loading ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader, { size: 20, className: "animate-spin" })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.PhoneMissed, { size: 20 })) }));
|
|
9
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EquosMicToggle = EquosMicToggle;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const components_react_1 = require("@livekit/components-react");
|
|
6
|
+
const livekit_client_1 = require("livekit-client");
|
|
7
|
+
const lucide_react_1 = require("lucide-react");
|
|
8
|
+
const cn_1 = require("../utils/cn");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
function EquosMicToggle({ onToggle, className, }) {
|
|
11
|
+
const { toggle, enabled } = (0, components_react_1.useTrackToggle)({
|
|
12
|
+
source: livekit_client_1.Track.Source.Microphone,
|
|
13
|
+
});
|
|
14
|
+
(0, react_1.useEffect)(() => {
|
|
15
|
+
onToggle(enabled);
|
|
16
|
+
}, [enabled]);
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)("button", { className: (0, cn_1.cn)('rounded-full p-3 border transition-colors shadow-xl cursor-pointer', enabled
|
|
18
|
+
? 'bg-white/60 border-white hover:bg-white/80 text-black'
|
|
19
|
+
: 'bg-white/20 border-white/60 hover:bg-white/40 text-[#141414]/50', className), type: "button", onClick: () => toggle(), children: enabled ? (0, jsx_runtime_1.jsx)(lucide_react_1.Mic, { size: 20 }) : (0, jsx_runtime_1.jsx)(lucide_react_1.MicOff, { size: 20 }) }));
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EquosScreenshareToggle = EquosScreenshareToggle;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const components_react_1 = require("@livekit/components-react");
|
|
6
|
+
const livekit_client_1 = require("livekit-client");
|
|
7
|
+
const lucide_react_1 = require("lucide-react");
|
|
8
|
+
const cn_1 = require("../utils/cn");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
function EquosScreenshareToggle({ onToggle, className, }) {
|
|
11
|
+
const { toggle, enabled } = (0, components_react_1.useTrackToggle)({
|
|
12
|
+
source: livekit_client_1.Track.Source.ScreenShare,
|
|
13
|
+
});
|
|
14
|
+
(0, react_1.useEffect)(() => {
|
|
15
|
+
onToggle(enabled);
|
|
16
|
+
}, [enabled]);
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)("button", { className: (0, cn_1.cn)('rounded-full p-3 border transition-colors shadow-xl cursor-pointer', enabled
|
|
18
|
+
? 'bg-white/60 border-white hover:bg-white/80 text-black'
|
|
19
|
+
: 'bg-white/20 border-white/60 hover:bg-white/40 text-[#141414]/50', className), type: "button", onClick: () => toggle(), children: enabled ? (0, jsx_runtime_1.jsx)(lucide_react_1.ScreenShare, { size: 20 }) : (0, jsx_runtime_1.jsx)(lucide_react_1.ScreenShareOff, { size: 20 }) }));
|
|
20
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Track } from 'livekit-client';
|
|
2
|
+
export declare function EquosVideoTile({ identity, defaultToLocal, className, source, }: {
|
|
3
|
+
identity?: string | null;
|
|
4
|
+
defaultToLocal?: boolean;
|
|
5
|
+
className?: string;
|
|
6
|
+
source: Track.Source;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EquosVideoTile = EquosVideoTile;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const cn_1 = require("../utils/cn");
|
|
7
|
+
const lucide_react_1 = require("lucide-react");
|
|
8
|
+
const components_react_1 = require("@livekit/components-react");
|
|
9
|
+
const livekit_client_1 = require("livekit-client");
|
|
10
|
+
function EquosVideoTile({ identity, defaultToLocal = true, className, source = livekit_client_1.Track.Source.Camera, }) {
|
|
11
|
+
const [expanded, setExpanded] = (0, react_1.useState)(false);
|
|
12
|
+
const participants = (0, components_react_1.useParticipants)();
|
|
13
|
+
const trackRef = (0, react_1.useMemo)(() => {
|
|
14
|
+
const participant = participants.find((p) => p.identity === identity || (defaultToLocal && p.isLocal));
|
|
15
|
+
if (!participant || !participant.trackPublications) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const publication = Array.from(participant.trackPublications.values()).find((pub) => pub.source === source);
|
|
19
|
+
if (!publication) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
participant,
|
|
24
|
+
publication,
|
|
25
|
+
source,
|
|
26
|
+
};
|
|
27
|
+
}, [identity, source, participants]);
|
|
28
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)('relative border border-white/60 shadow-xl rounded-2xl bg-black aspect-video transition-all max-w-full overflow-hidden', expanded ? 'w-96' : 'w-64', className), children: [(0, jsx_runtime_1.jsx)("button", { className: "absolute top-2 right-2 text-white cursor-pointer p-2 z-10 hover:bg-black/10 rounded-full transition-colors", onClick: (e) => {
|
|
29
|
+
e.stopPropagation();
|
|
30
|
+
setExpanded(!expanded);
|
|
31
|
+
}, children: expanded ? (0, jsx_runtime_1.jsx)(lucide_react_1.Minimize2, { size: 12 }) : (0, jsx_runtime_1.jsx)(lucide_react_1.Maximize2, { size: 12 }) }), trackRef && (0, jsx_runtime_1.jsx)(components_react_1.VideoTrack, { trackRef: trackRef, className: "w-full h-full" })] }));
|
|
32
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './equos-logo';
|
|
2
|
+
export * from './equos-mic-toggle';
|
|
3
|
+
export * from './equos-camera-toggle';
|
|
4
|
+
export * from './equos-screenshare-toggle';
|
|
5
|
+
export * from './equos-hangup-button';
|
|
6
|
+
export * from './equos-video-tile';
|
|
7
|
+
export * from './equos-character-tile';
|
|
8
|
+
export * from './equos-conversation-renderer';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./equos-logo"), exports);
|
|
18
|
+
__exportStar(require("./equos-mic-toggle"), exports);
|
|
19
|
+
__exportStar(require("./equos-camera-toggle"), exports);
|
|
20
|
+
__exportStar(require("./equos-screenshare-toggle"), exports);
|
|
21
|
+
__exportStar(require("./equos-hangup-button"), exports);
|
|
22
|
+
__exportStar(require("./equos-video-tile"), exports);
|
|
23
|
+
__exportStar(require("./equos-character-tile"), exports);
|
|
24
|
+
__exportStar(require("./equos-conversation-renderer"), exports);
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./components"), exports);
|
|
18
|
+
__exportStar(require("./utils"), exports);
|
|
19
|
+
__exportStar(require("./client"), exports);
|