@ringg/react-native 0.0.1-alpha.9 → 0.3.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 +237 -197
- package/dist/index.d.mts +1355 -0
- package/dist/index.d.ts +1355 -0
- package/dist/index.js +5765 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +5705 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +35 -65
- package/LICENSE +0 -21
- package/app.plugin.js +0 -51
- package/lib/module/adapters/index.js +0 -4
- package/lib/module/adapters/index.js.map +0 -1
- package/lib/module/adapters/livekit-rn-adapter.js +0 -216
- package/lib/module/adapters/livekit-rn-adapter.js.map +0 -1
- package/lib/module/components/RinggWidget.js +0 -554
- package/lib/module/components/RinggWidget.js.map +0 -1
- package/lib/module/components/steps/ButtonsStep.js +0 -146
- package/lib/module/components/steps/ButtonsStep.js.map +0 -1
- package/lib/module/components/steps/CalendarStep.js +0 -190
- package/lib/module/components/steps/CalendarStep.js.map +0 -1
- package/lib/module/components/steps/ConfirmationStep.js +0 -175
- package/lib/module/components/steps/ConfirmationStep.js.map +0 -1
- package/lib/module/components/steps/FormStep.js +0 -346
- package/lib/module/components/steps/FormStep.js.map +0 -1
- package/lib/module/components/steps/InteractiveFlow.js +0 -249
- package/lib/module/components/steps/InteractiveFlow.js.map +0 -1
- package/lib/module/components/ui/ActionButton.js +0 -92
- package/lib/module/components/ui/ActionButton.js.map +0 -1
- package/lib/module/components/ui/CallControls.js +0 -168
- package/lib/module/components/ui/CallControls.js.map +0 -1
- package/lib/module/components/ui/FeedbackScreen.js +0 -180
- package/lib/module/components/ui/FeedbackScreen.js.map +0 -1
- package/lib/module/components/ui/Icons.js +0 -294
- package/lib/module/components/ui/Icons.js.map +0 -1
- package/lib/module/components/ui/MessageBubble.js +0 -80
- package/lib/module/components/ui/MessageBubble.js.map +0 -1
- package/lib/module/components/ui/TabSelector.js +0 -80
- package/lib/module/components/ui/TabSelector.js.map +0 -1
- package/lib/module/components/ui/WidgetHeader.js +0 -168
- package/lib/module/components/ui/WidgetHeader.js.map +0 -1
- package/lib/module/context/RinggProvider.js +0 -134
- package/lib/module/context/RinggProvider.js.map +0 -1
- package/lib/module/context/index.js +0 -4
- package/lib/module/context/index.js.map +0 -1
- package/lib/module/globals.d.js +0 -2
- package/lib/module/globals.d.js.map +0 -1
- package/lib/module/hooks/index.js +0 -10
- package/lib/module/hooks/index.js.map +0 -1
- package/lib/module/hooks/useRinggCall.js +0 -259
- package/lib/module/hooks/useRinggCall.js.map +0 -1
- package/lib/module/hooks/useRinggChat.js +0 -141
- package/lib/module/hooks/useRinggChat.js.map +0 -1
- package/lib/module/hooks/useRinggComponents.js +0 -236
- package/lib/module/hooks/useRinggComponents.js.map +0 -1
- package/lib/module/hooks/useRinggFeedback.js +0 -66
- package/lib/module/hooks/useRinggFeedback.js.map +0 -1
- package/lib/module/hooks/useRinggTheme.js +0 -39
- package/lib/module/hooks/useRinggTheme.js.map +0 -1
- package/lib/module/hooks/useRinggTranscripts.js +0 -70
- package/lib/module/hooks/useRinggTranscripts.js.map +0 -1
- package/lib/module/hooks/useRinggWidgetState.js +0 -51
- package/lib/module/hooks/useRinggWidgetState.js.map +0 -1
- package/lib/module/index.js +0 -56
- package/lib/module/index.js.map +0 -1
- package/lib/module/package.json +0 -1
- package/lib/typescript/adapters/index.d.ts +0 -2
- package/lib/typescript/adapters/index.d.ts.map +0 -1
- package/lib/typescript/adapters/livekit-rn-adapter.d.ts +0 -38
- package/lib/typescript/adapters/livekit-rn-adapter.d.ts.map +0 -1
- package/lib/typescript/components/RinggWidget.d.ts +0 -44
- package/lib/typescript/components/RinggWidget.d.ts.map +0 -1
- package/lib/typescript/components/steps/ButtonsStep.d.ts +0 -17
- package/lib/typescript/components/steps/ButtonsStep.d.ts.map +0 -1
- package/lib/typescript/components/steps/CalendarStep.d.ts +0 -16
- package/lib/typescript/components/steps/CalendarStep.d.ts.map +0 -1
- package/lib/typescript/components/steps/ConfirmationStep.d.ts +0 -16
- package/lib/typescript/components/steps/ConfirmationStep.d.ts.map +0 -1
- package/lib/typescript/components/steps/FormStep.d.ts +0 -17
- package/lib/typescript/components/steps/FormStep.d.ts.map +0 -1
- package/lib/typescript/components/steps/InteractiveFlow.d.ts +0 -23
- package/lib/typescript/components/steps/InteractiveFlow.d.ts.map +0 -1
- package/lib/typescript/components/ui/ActionButton.d.ts +0 -22
- package/lib/typescript/components/ui/ActionButton.d.ts.map +0 -1
- package/lib/typescript/components/ui/CallControls.d.ts +0 -22
- package/lib/typescript/components/ui/CallControls.d.ts.map +0 -1
- package/lib/typescript/components/ui/FeedbackScreen.d.ts +0 -24
- package/lib/typescript/components/ui/FeedbackScreen.d.ts.map +0 -1
- package/lib/typescript/components/ui/Icons.d.ts +0 -28
- package/lib/typescript/components/ui/Icons.d.ts.map +0 -1
- package/lib/typescript/components/ui/MessageBubble.d.ts +0 -17
- package/lib/typescript/components/ui/MessageBubble.d.ts.map +0 -1
- package/lib/typescript/components/ui/TabSelector.d.ts +0 -21
- package/lib/typescript/components/ui/TabSelector.d.ts.map +0 -1
- package/lib/typescript/components/ui/WidgetHeader.d.ts +0 -20
- package/lib/typescript/components/ui/WidgetHeader.d.ts.map +0 -1
- package/lib/typescript/context/RinggProvider.d.ts +0 -53
- package/lib/typescript/context/RinggProvider.d.ts.map +0 -1
- package/lib/typescript/context/index.d.ts +0 -3
- package/lib/typescript/context/index.d.ts.map +0 -1
- package/lib/typescript/hooks/index.d.ts +0 -15
- package/lib/typescript/hooks/index.d.ts.map +0 -1
- package/lib/typescript/hooks/useRinggCall.d.ts +0 -41
- package/lib/typescript/hooks/useRinggCall.d.ts.map +0 -1
- package/lib/typescript/hooks/useRinggChat.d.ts +0 -29
- package/lib/typescript/hooks/useRinggChat.d.ts.map +0 -1
- package/lib/typescript/hooks/useRinggComponents.d.ts +0 -52
- package/lib/typescript/hooks/useRinggComponents.d.ts.map +0 -1
- package/lib/typescript/hooks/useRinggFeedback.d.ts +0 -23
- package/lib/typescript/hooks/useRinggFeedback.d.ts.map +0 -1
- package/lib/typescript/hooks/useRinggTheme.d.ts +0 -40
- package/lib/typescript/hooks/useRinggTheme.d.ts.map +0 -1
- package/lib/typescript/hooks/useRinggTranscripts.d.ts +0 -30
- package/lib/typescript/hooks/useRinggTranscripts.d.ts.map +0 -1
- package/lib/typescript/hooks/useRinggWidgetState.d.ts +0 -38
- package/lib/typescript/hooks/useRinggWidgetState.d.ts.map +0 -1
- package/lib/typescript/index.d.ts +0 -44
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/package.json +0 -1
package/package.json
CHANGED
|
@@ -1,80 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ringg/react-native",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"private": false,
|
|
5
|
-
"license": "MIT",
|
|
3
|
+
"version": "0.3.0",
|
|
6
4
|
"description": "Ringg AI widget for React Native — drop-in component and headless hooks for voice/text AI agents",
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"ringg",
|
|
11
|
-
"react-native",
|
|
12
|
-
"ai-agent",
|
|
13
|
-
"voice-agent",
|
|
14
|
-
"widget",
|
|
15
|
-
"conversational-ai",
|
|
16
|
-
"headless",
|
|
17
|
-
"expo"
|
|
18
|
-
],
|
|
19
|
-
"engines": {
|
|
20
|
-
"node": ">=18"
|
|
21
|
-
},
|
|
22
|
-
"sideEffects": false,
|
|
23
|
-
"main": "./lib/module/index.js",
|
|
24
|
-
"types": "./lib/typescript/index.d.ts",
|
|
25
|
-
"react-native": "./lib/module/index.js",
|
|
26
|
-
"exports": {
|
|
27
|
-
".": {
|
|
28
|
-
"types": "./lib/typescript/index.d.ts",
|
|
29
|
-
"default": "./lib/module/index.js"
|
|
30
|
-
},
|
|
31
|
-
"./app.plugin.js": "./app.plugin.js",
|
|
32
|
-
"./app.plugin": "./app.plugin.js",
|
|
33
|
-
"./package.json": "./package.json"
|
|
34
|
-
},
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
35
8
|
"files": [
|
|
36
|
-
"
|
|
37
|
-
"app.plugin.js",
|
|
38
|
-
"LICENSE",
|
|
39
|
-
"README.md"
|
|
9
|
+
"dist"
|
|
40
10
|
],
|
|
41
11
|
"peerDependencies": {
|
|
42
|
-
"react": ">=
|
|
43
|
-
"react-native": ">=
|
|
12
|
+
"@livekit/react-native": ">=2.12.0",
|
|
13
|
+
"@livekit/react-native-webrtc": ">=144.1.2",
|
|
14
|
+
"livekit-client": ">=2.19.0",
|
|
15
|
+
"react": ">=18",
|
|
16
|
+
"react-native": ">=0.73",
|
|
17
|
+
"react-native-svg": ">=15.0.0"
|
|
44
18
|
},
|
|
45
19
|
"dependencies": {
|
|
46
|
-
"
|
|
47
|
-
"@livekit/react-native-expo-plugin": ">=1.0.0",
|
|
48
|
-
"@config-plugins/react-native-webrtc": ">=9.0.0",
|
|
49
|
-
"livekit-client": ">=2.0.0",
|
|
50
|
-
"@ringg/core": "0.0.1-alpha.9"
|
|
20
|
+
"lucide-react-native": "^1.31.0"
|
|
51
21
|
},
|
|
52
22
|
"devDependencies": {
|
|
53
|
-
"@
|
|
54
|
-
"react": "^
|
|
55
|
-
"react
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"react-native
|
|
59
|
-
"
|
|
23
|
+
"@livekit/react-native": "^2.12.0",
|
|
24
|
+
"@livekit/react-native-webrtc": "^144.1.2",
|
|
25
|
+
"@types/react": "^19.2.17",
|
|
26
|
+
"livekit-client": "^2.11.4",
|
|
27
|
+
"react": "19.2.8",
|
|
28
|
+
"react-native": "0.87.0",
|
|
29
|
+
"react-native-svg": "^15.15.5",
|
|
30
|
+
"react-test-renderer": "19.2.8",
|
|
31
|
+
"tsup": "^8.5.1",
|
|
32
|
+
"@ringg/core": "0.3.0"
|
|
33
|
+
},
|
|
34
|
+
"module": "./dist/index.mjs",
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"types": "./dist/index.d.ts",
|
|
38
|
+
"import": "./dist/index.mjs",
|
|
39
|
+
"require": "./dist/index.js"
|
|
40
|
+
}
|
|
60
41
|
},
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"output": "lib",
|
|
64
|
-
"targets": [
|
|
65
|
-
[
|
|
66
|
-
"module",
|
|
67
|
-
{
|
|
68
|
-
"esm": true
|
|
69
|
-
}
|
|
70
|
-
],
|
|
71
|
-
"typescript"
|
|
72
|
-
]
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
73
44
|
},
|
|
74
45
|
"scripts": {
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"lint": "eslint src
|
|
78
|
-
"release": "pnpm build && pnpm publish --access public --no-git-checks --tag alpha"
|
|
46
|
+
"build": "tsc -p tsconfig.json --noEmit && tsup",
|
|
47
|
+
"test": "vitest run --passWithNoTests",
|
|
48
|
+
"lint": "eslint src"
|
|
79
49
|
}
|
|
80
50
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Ringg AI
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/app.plugin.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Expo config plugin for @ringg/react-native.
|
|
3
|
-
*
|
|
4
|
-
* Automatically configures the native project for voice calls:
|
|
5
|
-
* - Microphone permission (iOS + Android)
|
|
6
|
-
* - Audio background mode (iOS) — keeps calls alive when backgrounded
|
|
7
|
-
* - WebRTC build settings (bitcode disabled, network permissions)
|
|
8
|
-
* - LiveKit native lifecycle (auto-linked via expo-module.config.json)
|
|
9
|
-
*
|
|
10
|
-
* Usage in app.json:
|
|
11
|
-
* { "plugins": ["@ringg/react-native"] }
|
|
12
|
-
*
|
|
13
|
-
* Or with options:
|
|
14
|
-
* { "plugins": [["@ringg/react-native", { "enableCamera": true }]] }
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const { createRunOncePlugin, withInfoPlist } = require("expo/config-plugins");
|
|
18
|
-
const pkg = require("./package.json");
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @param {import('expo/config-plugins').ExpoConfig} config
|
|
22
|
-
* @param {{ enableCamera?: boolean, microphonePermission?: string }} [props]
|
|
23
|
-
*/
|
|
24
|
-
function withRingg(config, props = {}) {
|
|
25
|
-
const { enableCamera = false, microphonePermission } = props;
|
|
26
|
-
|
|
27
|
-
// 1. WebRTC native setup: permissions, bitcode, Android manifest
|
|
28
|
-
const webrtcPlugin = require("@config-plugins/react-native-webrtc");
|
|
29
|
-
const withWebRTC = webrtcPlugin.default || webrtcPlugin;
|
|
30
|
-
config = withWebRTC(config, {
|
|
31
|
-
cameraPermission: enableCamera ? "This app uses the camera for video calls." : false,
|
|
32
|
-
microphonePermission: microphonePermission || "This app uses the microphone for voice calls with the AI agent.",
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
// 2. iOS background audio — keeps voice calls alive when app is backgrounded
|
|
36
|
-
config = withInfoPlist(config, (cfg) => {
|
|
37
|
-
const modes = cfg.modResults.UIBackgroundModes || [];
|
|
38
|
-
if (!modes.includes("audio")) {
|
|
39
|
-
cfg.modResults.UIBackgroundModes = [...modes, "audio"];
|
|
40
|
-
}
|
|
41
|
-
return cfg;
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
// LiveKit native lifecycle (iOS AppDelegate subscriber, Android audio config)
|
|
45
|
-
// is auto-linked by Expo via @livekit/react-native-expo-plugin's
|
|
46
|
-
// expo-module.config.json — no manual plugin call needed.
|
|
47
|
-
|
|
48
|
-
return config;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
module.exports = createRunOncePlugin(withRingg, pkg.name, pkg.version);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["LiveKitRNAdapter"],"sourceRoot":"../../../src","sources":["adapters/index.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,yBAAsB","ignoreList":[]}
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* React Native implementation of the LiveKitAdapter interface.
|
|
5
|
-
*
|
|
6
|
-
* Wraps `livekit-client` (which @livekit/react-native patches for RN compatibility)
|
|
7
|
-
* to provide the same abstract interface that @ringg/core expects.
|
|
8
|
-
*
|
|
9
|
-
* Automatically calls `registerGlobals()` on first use — consumers don't need to
|
|
10
|
-
* call it themselves.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { Platform } from "react-native";
|
|
14
|
-
import { Room, RoomEvent, LocalParticipant } from "livekit-client";
|
|
15
|
-
import { isAgentIdentity } from "@ringg/core";
|
|
16
|
-
/**
|
|
17
|
-
* Ensures WebRTC globals and polyfills are registered exactly once.
|
|
18
|
-
* Called lazily before the first room connection — not at module scope —
|
|
19
|
-
* so the native module has time to load.
|
|
20
|
-
*/
|
|
21
|
-
let _globalsRegistered = false;
|
|
22
|
-
function ensureGlobals() {
|
|
23
|
-
if (_globalsRegistered || Platform.OS === "web") return;
|
|
24
|
-
try {
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
26
|
-
const {
|
|
27
|
-
registerGlobals
|
|
28
|
-
} = require("@livekit/react-native");
|
|
29
|
-
registerGlobals();
|
|
30
|
-
_globalsRegistered = true;
|
|
31
|
-
} catch {
|
|
32
|
-
// @livekit/react-native not available (e.g. SSR or test env) — skip
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
export class LiveKitRNAdapter {
|
|
36
|
-
cleanupFns = [];
|
|
37
|
-
constructor(roomOptions) {
|
|
38
|
-
ensureGlobals();
|
|
39
|
-
this.room = new Room({
|
|
40
|
-
dynacast: true,
|
|
41
|
-
adaptiveStream: true,
|
|
42
|
-
...roomOptions
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/** Expose the underlying Room for advanced usage or LiveKit hooks. */
|
|
47
|
-
getRoom() {
|
|
48
|
-
return this.room;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// ─── Connection ─────────────────────────────────────────────────────────
|
|
52
|
-
|
|
53
|
-
getConnectionState() {
|
|
54
|
-
switch (this.room.state) {
|
|
55
|
-
case "connected":
|
|
56
|
-
return "connected";
|
|
57
|
-
case "reconnecting":
|
|
58
|
-
return "reconnecting";
|
|
59
|
-
case "disconnected":
|
|
60
|
-
return "disconnected";
|
|
61
|
-
default:
|
|
62
|
-
return "disconnected";
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
async connect(url, token) {
|
|
66
|
-
await this.room.connect(url, token);
|
|
67
|
-
}
|
|
68
|
-
disconnect() {
|
|
69
|
-
try {
|
|
70
|
-
this.room.disconnect();
|
|
71
|
-
} catch (err) {
|
|
72
|
-
// Suppress "cannot send signal request before connected" errors —
|
|
73
|
-
// this happens when disconnect() races with a reconnection attempt
|
|
74
|
-
// and the room tries to send a leave signal while not fully connected.
|
|
75
|
-
// Suppress "cannot send signal request before connected" — races with reconnection
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// ─── Microphone ─────────────────────────────────────────────────────────
|
|
80
|
-
|
|
81
|
-
async setMicrophoneEnabled(enabled) {
|
|
82
|
-
await this.room.localParticipant.setMicrophoneEnabled(enabled);
|
|
83
|
-
}
|
|
84
|
-
isMicrophoneEnabled() {
|
|
85
|
-
return this.room.localParticipant.isMicrophoneEnabled;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// ─── RPC ────────────────────────────────────────────────────────────────
|
|
89
|
-
|
|
90
|
-
registerRpcMethod(method, handler) {
|
|
91
|
-
this.room.registerRpcMethod(method, async data => {
|
|
92
|
-
return handler({
|
|
93
|
-
method,
|
|
94
|
-
payload: data.payload,
|
|
95
|
-
callerIdentity: data.callerIdentity
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
unregisterRpcMethod(method) {
|
|
100
|
-
this.room.unregisterRpcMethod(method);
|
|
101
|
-
}
|
|
102
|
-
async performRpc(destinationIdentity, method, payload) {
|
|
103
|
-
return this.room.localParticipant.performRpc({
|
|
104
|
-
destinationIdentity,
|
|
105
|
-
method,
|
|
106
|
-
payload
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// ─── Text Streams ───────────────────────────────────────────────────────
|
|
111
|
-
|
|
112
|
-
registerTextStreamHandler(topic, handler) {
|
|
113
|
-
this.room.registerTextStreamHandler(topic, async (reader, participantInfo) => {
|
|
114
|
-
try {
|
|
115
|
-
const message = await reader.readAll();
|
|
116
|
-
handler({
|
|
117
|
-
message,
|
|
118
|
-
participantIdentity: participantInfo.identity ?? ""
|
|
119
|
-
});
|
|
120
|
-
} catch (err) {
|
|
121
|
-
console.error("[LiveKitRNAdapter] Error reading text stream:", err);
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
unregisterTextStreamHandler(topic) {
|
|
126
|
-
this.room.unregisterTextStreamHandler(topic);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// ─── Event Subscriptions ────────────────────────────────────────────────
|
|
130
|
-
|
|
131
|
-
onConnectionStateChange(handler) {
|
|
132
|
-
const mapState = () => this.getConnectionState();
|
|
133
|
-
const onConnected = () => handler(mapState());
|
|
134
|
-
const onDisconnected = () => handler("disconnected");
|
|
135
|
-
const onReconnecting = () => handler("reconnecting");
|
|
136
|
-
const onReconnected = () => handler(mapState());
|
|
137
|
-
this.room.on(RoomEvent.Connected, onConnected);
|
|
138
|
-
this.room.on(RoomEvent.Disconnected, onDisconnected);
|
|
139
|
-
this.room.on(RoomEvent.Reconnecting, onReconnecting);
|
|
140
|
-
this.room.on(RoomEvent.Reconnected, onReconnected);
|
|
141
|
-
const unsub = () => {
|
|
142
|
-
this.room.off(RoomEvent.Connected, onConnected);
|
|
143
|
-
this.room.off(RoomEvent.Disconnected, onDisconnected);
|
|
144
|
-
this.room.off(RoomEvent.Reconnecting, onReconnecting);
|
|
145
|
-
this.room.off(RoomEvent.Reconnected, onReconnected);
|
|
146
|
-
};
|
|
147
|
-
this.cleanupFns.push(unsub);
|
|
148
|
-
return unsub;
|
|
149
|
-
}
|
|
150
|
-
onParticipantDisconnected(handler) {
|
|
151
|
-
const onDisconnect = participant => {
|
|
152
|
-
handler(participant.identity);
|
|
153
|
-
};
|
|
154
|
-
this.room.on(RoomEvent.ParticipantDisconnected, onDisconnect);
|
|
155
|
-
const unsub = () => {
|
|
156
|
-
this.room.off(RoomEvent.ParticipantDisconnected, onDisconnect);
|
|
157
|
-
};
|
|
158
|
-
this.cleanupFns.push(unsub);
|
|
159
|
-
return unsub;
|
|
160
|
-
}
|
|
161
|
-
onDisconnected(handler) {
|
|
162
|
-
this.room.on(RoomEvent.Disconnected, handler);
|
|
163
|
-
const unsub = () => {
|
|
164
|
-
this.room.off(RoomEvent.Disconnected, handler);
|
|
165
|
-
};
|
|
166
|
-
this.cleanupFns.push(unsub);
|
|
167
|
-
return unsub;
|
|
168
|
-
}
|
|
169
|
-
onTranscription(handler) {
|
|
170
|
-
const onSegments = (segments, participant) => {
|
|
171
|
-
if (!participant) return;
|
|
172
|
-
for (const seg of segments) {
|
|
173
|
-
handler({
|
|
174
|
-
id: seg.id,
|
|
175
|
-
text: seg.text,
|
|
176
|
-
isFinal: seg.final,
|
|
177
|
-
participantIdentity: participant.identity,
|
|
178
|
-
isAgent: !(participant instanceof LocalParticipant)
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
this.room.on(RoomEvent.TranscriptionReceived, onSegments);
|
|
183
|
-
const unsub = () => {
|
|
184
|
-
this.room.off(RoomEvent.TranscriptionReceived, onSegments);
|
|
185
|
-
};
|
|
186
|
-
this.cleanupFns.push(unsub);
|
|
187
|
-
return unsub;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// ─── Participant Queries ────────────────────────────────────────────────
|
|
191
|
-
|
|
192
|
-
getAgentIdentity() {
|
|
193
|
-
for (const [, participant] of this.room.remoteParticipants) {
|
|
194
|
-
if (isAgentIdentity(participant.identity)) {
|
|
195
|
-
return participant.identity;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
return null;
|
|
199
|
-
}
|
|
200
|
-
getLocalIdentity() {
|
|
201
|
-
return this.room.localParticipant.identity;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// ─── Cleanup ────────────────────────────────────────────────────────────
|
|
205
|
-
|
|
206
|
-
dispose() {
|
|
207
|
-
this.cleanupFns.forEach(fn => fn());
|
|
208
|
-
this.cleanupFns = [];
|
|
209
|
-
try {
|
|
210
|
-
this.room.disconnect();
|
|
211
|
-
} catch {
|
|
212
|
-
// Safe to ignore — room may already be disconnected
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
//# sourceMappingURL=livekit-rn-adapter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","Room","RoomEvent","LocalParticipant","isAgentIdentity","_globalsRegistered","ensureGlobals","OS","registerGlobals","require","LiveKitRNAdapter","cleanupFns","constructor","roomOptions","room","dynacast","adaptiveStream","getRoom","getConnectionState","state","connect","url","token","disconnect","err","setMicrophoneEnabled","enabled","localParticipant","isMicrophoneEnabled","registerRpcMethod","method","handler","data","payload","callerIdentity","unregisterRpcMethod","performRpc","destinationIdentity","registerTextStreamHandler","topic","reader","participantInfo","message","readAll","participantIdentity","identity","console","error","unregisterTextStreamHandler","onConnectionStateChange","mapState","onConnected","onDisconnected","onReconnecting","onReconnected","on","Connected","Disconnected","Reconnecting","Reconnected","unsub","off","push","onParticipantDisconnected","onDisconnect","participant","ParticipantDisconnected","onTranscription","onSegments","segments","seg","id","text","isFinal","final","isAgent","TranscriptionReceived","getAgentIdentity","remoteParticipants","getLocalIdentity","dispose","forEach","fn"],"sourceRoot":"../../../src","sources":["adapters/livekit-rn-adapter.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,IAAI,EAAEC,SAAS,EAAyHC,gBAAgB,QAAe,gBAAgB;AAGhM,SAASC,eAAe,QAAQ,aAAa;AAI7C;AACA;AACA;AACA;AACA;AACA,IAAIC,kBAAkB,GAAG,KAAK;AAC9B,SAASC,aAAaA,CAAA,EAAS;EAC7B,IAAID,kBAAkB,IAAIL,QAAQ,CAACO,EAAE,KAAK,KAAK,EAAE;EACjD,IAAI;IACF;IACA,MAAM;MAAEC;IAAgB,CAAC,GAAGC,OAAO,CA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