@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.
Files changed (62) hide show
  1. package/.turbo/turbo-build.log +2 -12
  2. package/.turbo/turbo-check-types.log +1 -1
  3. package/.turbo/turbo-generate-version.log +1 -1
  4. package/.turbo/turbo-lint$colon$es.log +2 -2
  5. package/.turbo/turbo-lint$colon$prettier.log +1 -1
  6. package/CHANGELOG.md +95 -4
  7. package/README.md +42 -324
  8. package/dist/index.d.ts +2 -2
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +7 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/index.react-native.d.ts +2 -0
  13. package/dist/index.react-native.d.ts.map +1 -0
  14. package/dist/index.react-native.js +35 -0
  15. package/dist/index.react-native.js.map +1 -0
  16. package/dist/version.d.ts +2 -1
  17. package/dist/version.d.ts.map +1 -0
  18. package/dist/version.js +3 -0
  19. package/dist/version.js.map +1 -0
  20. package/package.json +13 -26
  21. package/src/index.react-native.ts +51 -0
  22. package/src/index.ts +25 -16
  23. package/src/version.ts +1 -1
  24. package/tsconfig.build.json +19 -0
  25. package/tsconfig.build.tsbuildinfo +1 -0
  26. package/tsconfig.json +5 -17
  27. package/dist/ElevenLabsProvider.d.ts +0 -30
  28. package/dist/ElevenLabsProvider.test.d.ts +0 -1
  29. package/dist/components/LiveKitRoomWrapper.d.ts +0 -23
  30. package/dist/components/MessageHandler.d.ts +0 -14
  31. package/dist/hooks/useConversationCallbacks.d.ts +0 -5
  32. package/dist/hooks/useConversationSession.d.ts +0 -33
  33. package/dist/hooks/useLiveKitRoom.d.ts +0 -12
  34. package/dist/hooks/useMessageSending.d.ts +0 -7
  35. package/dist/lib.js +0 -2
  36. package/dist/lib.js.map +0 -1
  37. package/dist/lib.modern.js +0 -2
  38. package/dist/lib.modern.js.map +0 -1
  39. package/dist/lib.module.js +0 -2
  40. package/dist/lib.module.js.map +0 -1
  41. package/dist/lib.umd.js +0 -2
  42. package/dist/lib.umd.js.map +0 -1
  43. package/dist/types.d.ts +0 -111
  44. package/dist/utils/constants.d.ts +0 -1
  45. package/dist/utils/overrides.d.ts +0 -2
  46. package/dist/utils/text-only.d.ts +0 -2
  47. package/dist/utils/tokenUtils.d.ts +0 -2
  48. package/jest.config.cjs +0 -263
  49. package/jest.rn-mock.js +0 -15
  50. package/src/ElevenLabsProvider.test.tsx +0 -257
  51. package/src/ElevenLabsProvider.tsx +0 -365
  52. package/src/components/LiveKitRoomWrapper.tsx +0 -94
  53. package/src/components/MessageHandler.tsx +0 -237
  54. package/src/hooks/useConversationCallbacks.ts +0 -15
  55. package/src/hooks/useConversationSession.ts +0 -130
  56. package/src/hooks/useLiveKitRoom.ts +0 -100
  57. package/src/hooks/useMessageSending.ts +0 -33
  58. package/src/types.ts +0 -170
  59. package/src/utils/constants.ts +0 -1
  60. package/src/utils/overrides.ts +0 -48
  61. package/src/utils/text-only.ts +0 -22
  62. 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.5.12",
3
+ "version": "1.0.0-rc.1",
4
4
  "description": "ElevenLabs React Native SDK for the Agents Platform",
5
- "main": "./dist/lib.js",
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
- "types": "./dist/index.d.ts",
13
- "import": "./dist/lib.modern.js",
14
- "require": "./dist/lib.js"
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/types": "0.6.1"
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
- "bundle": "microbundle --jsx React.createElement --jsxFragment React.Fragment --jsxImportSource react src/index.ts",
61
- "build": "BROWSERSLIST_ENV=modern node --run bundle",
62
- "dev": "BROWSERSLIST_ENV=modern node --run bundle -- --watch --no-compress",
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
- ElevenLabsProvider,
9
+ ConversationProvider,
10
+ useConversationControls,
11
+ useConversationStatus,
12
+ useConversationInput,
13
+ useConversationMode,
14
+ useConversationFeedback,
15
+ useRawConversation,
3
16
  useConversation,
4
- type Conversation,
5
- } from "./ElevenLabsProvider";
6
-
7
- export type {
8
- ConversationStatus,
9
- Mode,
10
- Role,
11
- Callbacks,
12
- ConversationOptions,
13
- ConversationConfig,
14
- ConversationEvent,
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.5.12";
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
+ }