@elevenlabs/react-native 0.5.12 → 1.0.0-rc.1
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/.turbo/turbo-build.log +2 -12
- package/.turbo/turbo-check-types.log +1 -1
- package/.turbo/turbo-generate-version.log +1 -1
- package/.turbo/turbo-lint$colon$es.log +2 -2
- package/.turbo/turbo-lint$colon$prettier.log +1 -1
- package/CHANGELOG.md +95 -4
- package/README.md +42 -324
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/index.react-native.d.ts +2 -0
- package/dist/index.react-native.d.ts.map +1 -0
- package/dist/index.react-native.js +35 -0
- package/dist/index.react-native.js.map +1 -0
- package/dist/version.d.ts +2 -1
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +3 -0
- package/dist/version.js.map +1 -0
- package/package.json +13 -26
- package/src/index.react-native.ts +51 -0
- package/src/index.ts +25 -16
- package/src/version.ts +1 -1
- package/tsconfig.build.json +19 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +5 -17
- package/dist/ElevenLabsProvider.d.ts +0 -30
- package/dist/ElevenLabsProvider.test.d.ts +0 -1
- package/dist/components/LiveKitRoomWrapper.d.ts +0 -23
- package/dist/components/MessageHandler.d.ts +0 -14
- package/dist/hooks/useConversationCallbacks.d.ts +0 -5
- package/dist/hooks/useConversationSession.d.ts +0 -33
- package/dist/hooks/useLiveKitRoom.d.ts +0 -12
- package/dist/hooks/useMessageSending.d.ts +0 -7
- package/dist/lib.js +0 -2
- package/dist/lib.js.map +0 -1
- package/dist/lib.modern.js +0 -2
- package/dist/lib.modern.js.map +0 -1
- package/dist/lib.module.js +0 -2
- package/dist/lib.module.js.map +0 -1
- package/dist/lib.umd.js +0 -2
- package/dist/lib.umd.js.map +0 -1
- package/dist/types.d.ts +0 -111
- package/dist/utils/constants.d.ts +0 -1
- package/dist/utils/overrides.d.ts +0 -2
- package/dist/utils/text-only.d.ts +0 -2
- package/dist/utils/tokenUtils.d.ts +0 -2
- package/jest.config.cjs +0 -263
- package/jest.rn-mock.js +0 -15
- package/src/ElevenLabsProvider.test.tsx +0 -257
- package/src/ElevenLabsProvider.tsx +0 -365
- package/src/components/LiveKitRoomWrapper.tsx +0 -94
- package/src/components/MessageHandler.tsx +0 -237
- package/src/hooks/useConversationCallbacks.ts +0 -15
- package/src/hooks/useConversationSession.ts +0 -130
- package/src/hooks/useLiveKitRoom.ts +0 -100
- package/src/hooks/useMessageSending.ts +0 -33
- package/src/types.ts +0 -170
- package/src/utils/constants.ts +0 -1
- package/src/utils/overrides.ts +0 -48
- package/src/utils/text-only.ts +0 -22
- package/src/utils/tokenUtils.ts +0 -52
package/package.json
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elevenlabs/react-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-rc.1",
|
|
4
4
|
"description": "ElevenLabs React Native SDK for the Agents Platform",
|
|
5
|
-
"
|
|
6
|
-
"module": "./dist/lib.module.js",
|
|
7
|
-
"source": "src/index.ts",
|
|
8
|
-
"unpkg": "./dist/lib.umd.js",
|
|
9
|
-
"types": "./dist/index.d.ts",
|
|
5
|
+
"type": "module",
|
|
10
6
|
"exports": {
|
|
11
7
|
".": {
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
8
|
+
"browser": "./dist/index.js",
|
|
9
|
+
"react-native": "./dist/index.react-native.js",
|
|
10
|
+
"default": "./dist/index.js"
|
|
15
11
|
}
|
|
16
12
|
},
|
|
17
13
|
"keywords": [
|
|
@@ -27,24 +23,16 @@
|
|
|
27
23
|
"peerDependencies": {
|
|
28
24
|
"@livekit/react-native": "^2.9.2",
|
|
29
25
|
"@livekit/react-native-webrtc": "^137.0.2",
|
|
30
|
-
"livekit-client": "^2.15.4",
|
|
31
26
|
"react": ">=17.0.0",
|
|
32
27
|
"react-native": ">=0.70.0"
|
|
33
28
|
},
|
|
34
29
|
"dependencies": {
|
|
35
|
-
"@elevenlabs/
|
|
30
|
+
"@elevenlabs/client": "1.0.0-rc.1",
|
|
31
|
+
"@elevenlabs/react": "1.0.0-rc.1"
|
|
36
32
|
},
|
|
37
33
|
"devDependencies": {
|
|
38
|
-
"@testing-library/jest-native": "^5.4.3",
|
|
39
|
-
"@testing-library/react-native": "^13.2.0",
|
|
40
|
-
"@types/jest": "^29.5.12",
|
|
41
34
|
"@types/react": "^19.1.1",
|
|
42
|
-
"@types/react-native": "^0.73.0",
|
|
43
35
|
"eslint": "^9.8.0",
|
|
44
|
-
"jest": "^29.7.0",
|
|
45
|
-
"microbundle": "^0.15.1",
|
|
46
|
-
"react-test-renderer": "19.1.0",
|
|
47
|
-
"ts-jest": "^29.2.5",
|
|
48
36
|
"typescript": "^5.5.4"
|
|
49
37
|
},
|
|
50
38
|
"repository": {
|
|
@@ -53,17 +41,16 @@
|
|
|
53
41
|
"directory": "packages/react-native"
|
|
54
42
|
},
|
|
55
43
|
"publishConfig": {
|
|
56
|
-
"access": "public"
|
|
44
|
+
"access": "public",
|
|
45
|
+
"tag": "next"
|
|
57
46
|
},
|
|
58
47
|
"scripts": {
|
|
59
48
|
"generate-version": "printf \"// This file is auto-generated during build\\nexport const PACKAGE_VERSION = \\\"%s\\\";\\n\" \"$npm_package_version\" > src/version.ts",
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"clean": "rm -rf ./dist",
|
|
49
|
+
"build": "tsc --build tsconfig.build.json",
|
|
50
|
+
"dev": "tsc --build tsconfig.build.json --watch",
|
|
51
|
+
"clean": "tsc --build tsconfig.build.json --clean && rm -rf ./dist",
|
|
64
52
|
"check-types": "tsc --noEmit --skipLibCheck",
|
|
65
53
|
"lint:es": "pnpm exec eslint .",
|
|
66
|
-
"lint:prettier": "prettier 'src/**/*.ts' --check"
|
|
67
|
-
"test": "jest"
|
|
54
|
+
"lint:prettier": "prettier 'src/**/*.ts' --check"
|
|
68
55
|
}
|
|
69
56
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
registerGlobals,
|
|
3
|
+
AudioSession,
|
|
4
|
+
AndroidAudioTypePresets,
|
|
5
|
+
} from "@livekit/react-native";
|
|
6
|
+
import type { Options } from "@elevenlabs/client";
|
|
7
|
+
import {
|
|
8
|
+
setSetupStrategy,
|
|
9
|
+
webSessionSetup,
|
|
10
|
+
type VoiceSessionSetupResult,
|
|
11
|
+
} from "@elevenlabs/client/internal";
|
|
12
|
+
|
|
13
|
+
// Polyfill WebRTC globals needed by livekit-client in React Native
|
|
14
|
+
registerGlobals();
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* React Native voice session setup strategy.
|
|
18
|
+
*
|
|
19
|
+
* 1. Configures and starts the native AudioSession
|
|
20
|
+
* 2. Delegates connection + input/output setup to the web strategy
|
|
21
|
+
* 3. Wraps detach to stop the native AudioSession on cleanup
|
|
22
|
+
*/
|
|
23
|
+
async function reactNativeSessionSetup(
|
|
24
|
+
options: Options
|
|
25
|
+
): Promise<VoiceSessionSetupResult> {
|
|
26
|
+
await AudioSession.configureAudio({
|
|
27
|
+
android: {
|
|
28
|
+
preferredOutputList: ["speaker"],
|
|
29
|
+
audioTypeOptions: AndroidAudioTypePresets.communication,
|
|
30
|
+
},
|
|
31
|
+
ios: {
|
|
32
|
+
defaultOutput: "speaker",
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
await AudioSession.startAudioSession();
|
|
36
|
+
|
|
37
|
+
const result = await webSessionSetup(options);
|
|
38
|
+
|
|
39
|
+
const originalDetach = result.detach;
|
|
40
|
+
return {
|
|
41
|
+
...result,
|
|
42
|
+
detach: () => {
|
|
43
|
+
originalDetach();
|
|
44
|
+
AudioSession.stopAudioSession();
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
setSetupStrategy(reactNativeSessionSetup);
|
|
50
|
+
|
|
51
|
+
export * from "./index";
|
package/src/index.ts
CHANGED
|
@@ -1,18 +1,27 @@
|
|
|
1
|
+
import { setSourceInfo } from "@elevenlabs/client/internal";
|
|
2
|
+
import { PACKAGE_VERSION } from "./version";
|
|
3
|
+
|
|
4
|
+
// Identify as react_native_sdk
|
|
5
|
+
setSourceInfo({ name: "react_native_sdk", version: PACKAGE_VERSION });
|
|
6
|
+
|
|
7
|
+
// Conversation context API
|
|
1
8
|
export {
|
|
2
|
-
|
|
9
|
+
ConversationProvider,
|
|
10
|
+
useConversationControls,
|
|
11
|
+
useConversationStatus,
|
|
12
|
+
useConversationInput,
|
|
13
|
+
useConversationMode,
|
|
14
|
+
useConversationFeedback,
|
|
15
|
+
useRawConversation,
|
|
3
16
|
useConversation,
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
AudioAlignmentEvent,
|
|
16
|
-
AudioEventWithAlignment,
|
|
17
|
-
AudioSessionConfig,
|
|
18
|
-
} from "./types";
|
|
17
|
+
type UseConversationOptions,
|
|
18
|
+
type ConversationControlsValue,
|
|
19
|
+
type ConversationInputValue,
|
|
20
|
+
type ConversationStatus,
|
|
21
|
+
type ConversationStatusValue,
|
|
22
|
+
type ConversationModeValue,
|
|
23
|
+
type ConversationFeedbackValue,
|
|
24
|
+
type ConversationProviderProps,
|
|
25
|
+
type HookOptions,
|
|
26
|
+
type HookCallbacks,
|
|
27
|
+
} from "@elevenlabs/react";
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// This file is auto-generated during build
|
|
2
|
-
export const PACKAGE_VERSION = "0.
|
|
2
|
+
export const PACKAGE_VERSION = "1.0.0-rc.1";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"composite": true,
|
|
4
|
+
"strict": true,
|
|
5
|
+
"outDir": "./dist",
|
|
6
|
+
"rootDir": "./src",
|
|
7
|
+
"declaration": true,
|
|
8
|
+
"declarationMap": true,
|
|
9
|
+
"sourceMap": true,
|
|
10
|
+
"target": "ES2022",
|
|
11
|
+
"lib": ["ES2022", "DOM"],
|
|
12
|
+
"module": "ES2022",
|
|
13
|
+
"moduleResolution": "bundler",
|
|
14
|
+
"jsx": "react-jsx",
|
|
15
|
+
"skipLibCheck": true
|
|
16
|
+
},
|
|
17
|
+
"include": ["src/**/*.ts", "src/**/*.tsx"],
|
|
18
|
+
"exclude": ["src/**/*.test.ts", "src/**/*.test.tsx", "src/**/__tests__/**"]
|
|
19
|
+
}
|