@revrag-ai/embed-react-native 1.0.6 → 1.0.7

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 (91) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +13 -382
  3. package/android/CMakeLists.txt +15 -0
  4. package/android/build.gradle +77 -25
  5. package/android/cpp-adapter.cpp +8 -0
  6. package/android/generated/java/com/revragai/embedreactnative/NativeEmbedReactNativeSpec.java +37 -0
  7. package/android/generated/jni/CMakeLists.txt +49 -0
  8. package/android/generated/jni/RNEmbedReactNativeSpec-generated.cpp +32 -0
  9. package/android/generated/jni/RNEmbedReactNativeSpec.h +31 -0
  10. package/android/generated/jni/react/renderer/components/RNEmbedReactNativeSpec/RNEmbedReactNativeSpecJSI-generated.cpp +28 -0
  11. package/android/generated/jni/react/renderer/components/RNEmbedReactNativeSpec/RNEmbedReactNativeSpecJSI.h +67 -0
  12. package/android/gradle.properties +5 -5
  13. package/cpp/revrag-ai-embed-react-native.cpp +7 -0
  14. package/cpp/revrag-ai-embed-react-native.h +8 -0
  15. package/ios/EmbedReactNative.h +9 -0
  16. package/ios/{Onwid.mm → EmbedReactNative.mm} +4 -4
  17. package/ios/generated/RNEmbedReactNativeSpec/RNEmbedReactNativeSpec-generated.mm +29 -0
  18. package/ios/generated/RNEmbedReactNativeSpec/RNEmbedReactNativeSpec.h +50 -0
  19. package/ios/generated/RNEmbedReactNativeSpecJSI-generated.cpp +28 -0
  20. package/ios/generated/RNEmbedReactNativeSpecJSI.h +67 -0
  21. package/lib/commonjs/NativeEmbedReactNative.js +9 -0
  22. package/{dist/commonjs/onwidApi → lib/commonjs/api}/api.js +84 -13
  23. package/lib/commonjs/api/types/embed.api.types.js +2 -0
  24. package/{dist/module/component/audiowave.js → lib/commonjs/components/Embed/EmbedAudioWave.js} +21 -17
  25. package/{dist/module/component/OnwidButton.js → lib/commonjs/components/Embed/EmbedButton.js} +65 -61
  26. package/{dist/module/component/voice.js → lib/commonjs/components/Embed/EmbedVoice.js} +18 -14
  27. package/{dist/commonjs/style/onwidButton.style.js → lib/commonjs/components/styles/EmbedButton.style.js} +14 -9
  28. package/{dist/module/Event/onwid.js → lib/commonjs/events/embed.event.js} +14 -10
  29. package/{dist → lib}/commonjs/hooks/initialize.js +18 -12
  30. package/{dist/commonjs/hooks/initializelivekit.js → lib/commonjs/hooks/initialize.livekit.js} +8 -5
  31. package/lib/commonjs/hooks/types/voiceAgent.types.js +6 -0
  32. package/{dist/module/hooks/voiceAgent.js → lib/commonjs/hooks/voiceagent.js} +36 -31
  33. package/lib/commonjs/index.js +34 -0
  34. package/{dist/module/index.d.js → lib/commonjs/index.types.js} +7 -7
  35. package/lib/commonjs/store/store.key.js +46 -0
  36. package/{dist/module/utils/reanimatedHelpers.js → lib/commonjs/utils/reanimated.helper.js} +23 -17
  37. package/lib/module/NativeEmbedReactNative.js +5 -0
  38. package/{dist/module/onwidApi → lib/module/api}/api.js +67 -4
  39. package/lib/module/api/types/embed.api.types.js +2 -0
  40. package/{dist/commonjs/component/audiowave.js → lib/module/components/Embed/EmbedAudioWave.js} +2 -3
  41. package/{dist/commonjs/component/OnwidButton.js → lib/module/components/Embed/EmbedButton.js} +10 -11
  42. package/{dist/commonjs/component/voice.js → lib/module/components/Embed/EmbedVoice.js} +1 -1
  43. package/{dist/module/style/onwidButton.style.js → lib/module/components/styles/EmbedButton.style.js} +3 -3
  44. package/{dist/commonjs/Event/onwid.js → lib/module/events/embed.event.js} +6 -6
  45. package/{dist → lib}/module/hooks/initialize.js +3 -3
  46. package/{dist/module/hooks/initializelivekit.js → lib/module/hooks/initialize.livekit.js} +1 -1
  47. package/{dist/commonjs/hooks/voiceAgent.js → lib/module/hooks/voiceagent.js} +4 -4
  48. package/lib/module/index.js +7 -0
  49. package/{dist/commonjs/index.d.js → lib/module/index.types.js} +2 -1
  50. package/{dist/commonjs/utils/reanimatedHelpers.js → lib/module/utils/reanimated.helper.js} +14 -14
  51. package/lib/typescript/module/package.json +1 -0
  52. package/package.json +67 -33
  53. package/react-native.config.js +8 -14
  54. package/revrag-ai-embed-react-native.podspec +41 -0
  55. package/Onwid.podspec +0 -20
  56. package/dist/commonjs/NativeOnwid.js +0 -5
  57. package/dist/commonjs/button.json +0 -1
  58. package/dist/commonjs/index.js +0 -34
  59. package/dist/commonjs/onwidApi/api.types.js +0 -2
  60. package/dist/commonjs/utils/utils.js +0 -2
  61. package/dist/module/NativeOnwid.js +0 -5
  62. package/dist/module/button.json +0 -1
  63. package/dist/module/hooks/voiceAgent.types.js +0 -4
  64. package/dist/module/index.js +0 -34
  65. package/dist/module/onwidApi/api.types.js +0 -2
  66. package/dist/module/store.key.js +0 -38
  67. package/dist/module/utils/utils.js +0 -2
  68. package/dist/typescript/Event/onwid.d.ts +0 -14
  69. package/dist/typescript/NativeOnwid.d.ts +0 -7
  70. package/dist/typescript/component/OnwidButton.d.ts +0 -29
  71. package/dist/typescript/component/audiowave.d.ts +0 -7
  72. package/dist/typescript/component/voice.d.ts +0 -16
  73. package/dist/typescript/hooks/initialize.d.ts +0 -3
  74. package/dist/typescript/hooks/initialize.types.d.ts +0 -6
  75. package/dist/typescript/hooks/initializelivekit.d.ts +0 -4
  76. package/dist/typescript/hooks/voiceAgent.d.ts +0 -3
  77. package/dist/typescript/hooks/voiceAgent.types.d.ts +0 -17
  78. package/dist/typescript/index.d.ts +0 -27
  79. package/dist/typescript/onwidApi/api.d.ts +0 -54
  80. package/dist/typescript/onwidApi/api.types.d.ts +0 -22
  81. package/dist/typescript/store.key.d.ts +0 -4
  82. package/dist/typescript/style/onwidButton.style.d.ts +0 -99
  83. package/dist/typescript/utils/reanimatedHelpers.d.ts +0 -30
  84. package/dist/typescript/utils/utils.d.ts +0 -1
  85. package/ios/Onwid.h +0 -5
  86. package/scripts/verify-setup.js +0 -90
  87. /package/{dist/commonjs/hooks → lib/commonjs/hooks/types}/initialize.types.js +0 -0
  88. /package/{dist/module/hooks → lib/module/hooks/types}/initialize.types.js +0 -0
  89. /package/{dist/commonjs/hooks → lib/module/hooks/types}/voiceAgent.types.js +0 -0
  90. /package/{dist/commonjs → lib/module/store}/store.key.js +0 -0
  91. /package/{dist → lib/typescript}/commonjs/package.json +0 -0
@@ -1,5 +1,14 @@
1
1
  "use strict";
2
2
 
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useInitialize = useInitialize;
7
+ var _storeKey = require("../store/store.key.js");
8
+ var _api = require("../api/api.js");
9
+ var _initializeLivekit = _interopRequireDefault(require("./initialize.livekit.js"));
10
+ var _reactNative = require("react-native");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
3
12
  /**
4
13
  * Custom hook for initializing the OnWid SDK
5
14
  *
@@ -13,11 +22,8 @@
13
22
  * 2. Stores API key securely in keychain
14
23
  * 3. Registers the device with provided details
15
24
  */
16
- import { setAgentData } from '../store.key';
17
- import { APIService } from '../onwidApi/api';
18
- import registerAgent from './initializelivekit';
19
- import { PermissionsAndroid, Platform } from 'react-native';
20
- export function useInitialize({
25
+
26
+ function useInitialize({
21
27
  apiKey,
22
28
  onwidUrl,
23
29
  metadata
@@ -25,14 +31,14 @@ export function useInitialize({
25
31
  const checkPermissions = async () => {
26
32
  try {
27
33
  // Check for required permissions on Android
28
- if (Platform.OS === 'android') {
29
- const recordAudioPermission = PermissionsAndroid.PERMISSIONS.RECORD_AUDIO;
34
+ if (_reactNative.Platform.OS === 'android') {
35
+ const recordAudioPermission = _reactNative.PermissionsAndroid.PERMISSIONS.RECORD_AUDIO;
30
36
  if (!recordAudioPermission) {
31
37
  throw new Error('RECORD_AUDIO permission not available');
32
38
  }
33
39
  const permissions = [recordAudioPermission];
34
- const results = await Promise.all(permissions.map(permission => PermissionsAndroid.request(permission)));
35
- const allGranted = results.every(result => result === PermissionsAndroid.RESULTS.GRANTED);
40
+ const results = await Promise.all(permissions.map(permission => _reactNative.PermissionsAndroid.request(permission)));
41
+ const allGranted = results.every(result => result === _reactNative.PermissionsAndroid.RESULTS.GRANTED);
36
42
  if (!allGranted) {
37
43
  throw new Error('Required permissions not granted');
38
44
  }
@@ -61,19 +67,19 @@ export function useInitialize({
61
67
  const initialize = async () => {
62
68
  try {
63
69
  await checkPermissions();
64
- registerAgent();
70
+ (0, _initializeLivekit.default)();
65
71
 
66
72
  // Validate required parameters before proceeding
67
73
  validateInputs();
68
74
 
69
75
  // Store API key in keychain
70
- await setAgentData({
76
+ await (0, _storeKey.setAgentData)({
71
77
  apiKey,
72
78
  onwidUrl
73
79
  });
74
80
 
75
81
  // Get the APIService instance and initialize it
76
- const apiService = APIService.getInstance();
82
+ const apiService = _api.APIService.getInstance();
77
83
  await apiService.initialize();
78
84
  console.log('registerOnInitialize');
79
85
  // Register new device with provided details
@@ -1,5 +1,10 @@
1
1
  "use strict";
2
2
 
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _reactNative = require("@livekit/react-native");
3
8
  // This module imports the `registerGlobals` function from the LiveKit React Native library.
4
9
  // The `registerGlobals` function is used to register global settings and configurations
5
10
  // for the LiveKit service, which is essential for managing real-time audio and video
@@ -8,10 +13,8 @@
8
13
  // Finally, the `registerAgent` is exported as the default export of this module, making
9
14
  // it available for use in other modules that require the registration of LiveKit globals.
10
15
 
11
- import { registerGlobals } from '@livekit/react-native';
12
-
13
16
  // The registerAgent constant is an alias for the registerGlobals function,
14
17
  // which is used to set up global configurations for the LiveKit service.
15
- const registerAgent = registerGlobals;
16
- export default registerAgent;
17
- //# sourceMappingURL=initializelivekit.js.map
18
+ const registerAgent = _reactNative.registerGlobals;
19
+ var _default = exports.default = registerAgent;
20
+ //# sourceMappingURL=initialize.livekit.js.map
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=voiceAgent.types.js.map
@@ -1,10 +1,14 @@
1
1
  "use strict";
2
2
 
3
- import { ConnectionState, Room } from 'livekit-client';
4
- import { useEffect, useState } from 'react';
5
- import { EventKeys } from '../Event/onwid';
6
- import { APIService } from '../onwidApi/api';
7
- import { getAgentData } from '../store.key';
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useVoiceAgent = void 0;
7
+ var _livekitClient = require("livekit-client");
8
+ var _react = require("react");
9
+ var _embedEvent = require("../events/embed.event.js");
10
+ var _api = require("../api/api.js");
11
+ var _storeKey = require("../store/store.key.js");
8
12
  // Create a singleton instance of Room that persists across hook instances
9
13
  // This ensures we don't create multiple Room instances that could conflict
10
14
  let roomInstance = null;
@@ -21,7 +25,7 @@ const getRoomInstance = () => {
21
25
  if (!roomInstance) {
22
26
  console.log('Creating new Room instance');
23
27
  // Configure the room with the right options at creation time
24
- roomInstance = new Room({
28
+ roomInstance = new _livekitClient.Room({
25
29
  adaptiveStream: true,
26
30
  dynacast: true,
27
31
  // Using the most stable configuration for React Native
@@ -52,7 +56,7 @@ const resetRoomState = () => {
52
56
  console.log('isDisconnecting', isDisconnecting);
53
57
 
54
58
  // Only disconnect if currently connected
55
- if (roomInstance.state !== ConnectionState.Disconnected && !isDisconnecting) {
59
+ if (roomInstance.state !== _livekitClient.ConnectionState.Disconnected && !isDisconnecting) {
56
60
  isDisconnecting = true;
57
61
  roomInstance.disconnect().finally(() => {
58
62
  isDisconnecting = false;
@@ -67,17 +71,17 @@ const resetRoomState = () => {
67
71
  }
68
72
  }
69
73
  };
70
- export const useVoiceAgent = () => {
71
- const [isLoading, setIsLoading] = useState(false);
72
- const [error, setError] = useState(null);
73
- const [tokenDetails, setTokenDetails] = useState(null);
74
- const [isMicMuted, setIsMicMuted] = useState(false);
75
- const [connectionState, setConnectionState] = useState(() => {
74
+ const useVoiceAgent = () => {
75
+ const [isLoading, setIsLoading] = (0, _react.useState)(false);
76
+ const [error, setError] = (0, _react.useState)(null);
77
+ const [tokenDetails, setTokenDetails] = (0, _react.useState)(null);
78
+ const [isMicMuted, setIsMicMuted] = (0, _react.useState)(false);
79
+ const [connectionState, setConnectionState] = (0, _react.useState)(() => {
76
80
  // Initialize with the current room state if it exists
77
81
  const room = getRoomInstance();
78
- return room ? room.state : ConnectionState.Disconnected;
82
+ return room ? room.state : _livekitClient.ConnectionState.Disconnected;
79
83
  });
80
- const [stableConnection, setStableConnection] = useState(false);
84
+ const [stableConnection, setStableConnection] = (0, _react.useState)(false);
81
85
  console.log('ConnectionState_connected', connectionState
82
86
  // tokenDetails?.token
83
87
  );
@@ -92,7 +96,7 @@ export const useVoiceAgent = () => {
92
96
  setConnectionState(() => state);
93
97
 
94
98
  // Handle connection state changes
95
- if (state === ConnectionState.Connected) {
99
+ if (state === _livekitClient.ConnectionState.Connected) {
96
100
  // Reset connection attempts when connected successfully
97
101
  resetConnectionAttempts();
98
102
 
@@ -105,7 +109,7 @@ export const useVoiceAgent = () => {
105
109
  console.log('Connection marked as stable');
106
110
  setStableConnection(true);
107
111
  }, STABLE_CONNECTION_TIMEOUT);
108
- } else if (state === ConnectionState.Disconnected) {
112
+ } else if (state === _livekitClient.ConnectionState.Disconnected) {
109
113
  // Mark connection as unstable
110
114
  setStableConnection(false);
111
115
 
@@ -143,7 +147,7 @@ export const useVoiceAgent = () => {
143
147
  };
144
148
 
145
149
  // Initialize room and listeners
146
- useEffect(() => {
150
+ (0, _react.useEffect)(() => {
147
151
  const room = getRoomInstance();
148
152
  setupRoomListeners();
149
153
 
@@ -160,7 +164,7 @@ export const useVoiceAgent = () => {
160
164
  }, []);
161
165
 
162
166
  // Connect to LiveKit when token is set
163
- useEffect(() => {
167
+ (0, _react.useEffect)(() => {
164
168
  const room = getRoomInstance();
165
169
  if (!tokenDetails || isConnecting) return;
166
170
 
@@ -182,9 +186,9 @@ export const useVoiceAgent = () => {
182
186
  console.log(`Connecting to LiveKit room... (attempt ${connectionAttempts})`);
183
187
 
184
188
  // Only attempt to connect if we're disconnected
185
- if (room.state === ConnectionState.Disconnected) {
189
+ if (room.state === _livekitClient.ConnectionState.Disconnected) {
186
190
  // Update state before connection attempt
187
- setConnectionState(ConnectionState.Connecting);
191
+ setConnectionState(_livekitClient.ConnectionState.Connecting);
188
192
  await room.connect(tokenDetails.server_url, tokenDetails.token, {
189
193
  autoSubscribe: true // Ensure we subscribe to tracks automatically
190
194
  });
@@ -192,10 +196,10 @@ export const useVoiceAgent = () => {
192
196
  // Explicitly set to connected if connection was successful
193
197
  setConnectionState(room.state);
194
198
  console.log('Connected to LiveKit room');
195
- } else if (room.state === ConnectionState.Connected) {
199
+ } else if (room.state === _livekitClient.ConnectionState.Connected) {
196
200
  console.log('Room is already connected');
197
201
  // Ensure our state matches
198
- setConnectionState(ConnectionState.Connected);
202
+ setConnectionState(_livekitClient.ConnectionState.Connected);
199
203
  } else {
200
204
  console.log('Room is in transition state:', room.state);
201
205
  // Sync our state with the room's current state
@@ -223,7 +227,7 @@ export const useVoiceAgent = () => {
223
227
  }, [tokenDetails]);
224
228
 
225
229
  // Log connection status periodically for debugging
226
- useEffect(() => {
230
+ (0, _react.useEffect)(() => {
227
231
  const debugInterval = setInterval(() => {
228
232
  if (roomInstance) {
229
233
  const state = roomInstance.state;
@@ -248,12 +252,12 @@ export const useVoiceAgent = () => {
248
252
  // Reset connection attempts when starting fresh
249
253
  resetConnectionAttempts();
250
254
  setStableConnection(false);
251
- const userData = await getAgentData(EventKeys.USER_DATA);
255
+ const userData = await (0, _storeKey.getAgentData)(_embedEvent.EventKeys.USER_DATA);
252
256
  setIsLoading(true);
253
257
  setError(null);
254
258
  console.log('userData', userData);
255
259
  try {
256
- const apiService = APIService.getInstance();
260
+ const apiService = _api.APIService.getInstance();
257
261
  const response = await apiService.getTokenDetails({
258
262
  app_user_id: userData?.app_user_id,
259
263
  call_type: 'EMBEDDED'
@@ -262,7 +266,7 @@ export const useVoiceAgent = () => {
262
266
 
263
267
  // Only set token details if we're not already connected
264
268
  const room = getRoomInstance();
265
- if (room.state !== ConnectionState.Connected) {
269
+ if (room.state !== _livekitClient.ConnectionState.Connected) {
266
270
  setTokenDetails(response.data);
267
271
  } else {
268
272
  console.log('Room already connected, skipping token update');
@@ -290,13 +294,13 @@ export const useVoiceAgent = () => {
290
294
  resetConnectionAttempts();
291
295
  setStableConnection(false);
292
296
  const room = getRoomInstance();
293
- if (room.state !== ConnectionState.Disconnected) {
297
+ if (room.state !== _livekitClient.ConnectionState.Disconnected) {
294
298
  // Update state before disconnection
295
- setConnectionState(ConnectionState.Connecting);
299
+ setConnectionState(_livekitClient.ConnectionState.Connecting);
296
300
  await room.disconnect();
297
301
 
298
302
  // Update state after disconnection
299
- setConnectionState(ConnectionState.Disconnected);
303
+ setConnectionState(_livekitClient.ConnectionState.Disconnected);
300
304
  }
301
305
  } catch (err) {
302
306
  setError(err instanceof Error ? err.message : 'Failed to end call');
@@ -350,4 +354,5 @@ export const useVoiceAgent = () => {
350
354
  cleanup
351
355
  };
352
356
  };
353
- //# sourceMappingURL=voiceAgent.js.map
357
+ exports.useVoiceAgent = useVoiceAgent;
358
+ //# sourceMappingURL=voiceagent.js.map
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Embed", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _embedEvent.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "EmbedButton", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _EmbedButton.EmbedButton;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "EmbedEventKeys", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _embedEvent.EventKeys;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "useInitialize", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _initialize.useInitialize;
28
+ }
29
+ });
30
+ var _EmbedButton = require("./components/Embed/EmbedButton.js");
31
+ var _initialize = require("./hooks/initialize.js");
32
+ var _embedEvent = _interopRequireWildcard(require("./events/embed.event.js"));
33
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
34
+ //# sourceMappingURL=index.js.map
@@ -1,22 +1,22 @@
1
1
  "use strict";
2
2
 
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EventKeys = void 0;
7
+ /* eslint-disable */
3
8
  /**
4
9
  * @file index.d.ts
5
10
  * @description TypeScript declarations for the Onwid React Native library.
6
11
  */
7
-
8
12
  // Component declarations
9
-
10
13
  // Hook type declarations
11
-
12
14
  // Hook declarations
13
-
14
15
  // API type declarations
15
-
16
16
  // Event system declarations
17
- export let EventKeys = /*#__PURE__*/function (EventKeys) {
17
+ let EventKeys = exports.EventKeys = /*#__PURE__*/function (EventKeys) {
18
18
  EventKeys["USER_DATA"] = "user_data";
19
19
  EventKeys["SCREEN_STATE"] = "state_data";
20
20
  return EventKeys;
21
21
  }({});
22
- //# sourceMappingURL=index.d.js.map
22
+ //# sourceMappingURL=index.types.js.map
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.setAgentData = exports.getAgentData = exports.deleteFromDetail = void 0;
7
+ var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ const STORAGE_KEY = '@user_data';
10
+ const setAgentData = async (data, key = STORAGE_KEY) => {
11
+ try {
12
+ const jsonString = JSON.stringify(data);
13
+ await _asyncStorage.default.setItem(key, jsonString);
14
+ console.log('Data saved to storage successfully');
15
+ } catch (error) {
16
+ console.error('Storage save error:', error);
17
+ throw error; // Re-throw to allow caller to handle
18
+ }
19
+ };
20
+ exports.setAgentData = setAgentData;
21
+ const getAgentData = async (key = STORAGE_KEY) => {
22
+ try {
23
+ const jsonString = await _asyncStorage.default.getItem(key);
24
+ if (!jsonString) {
25
+ console.log('No data stored');
26
+ return null;
27
+ }
28
+ const data = JSON.parse(jsonString);
29
+ return data;
30
+ } catch (error) {
31
+ console.error('Storage fetch error:', error);
32
+ throw error; // Re-throw to allow caller to handle
33
+ }
34
+ };
35
+ exports.getAgentData = getAgentData;
36
+ const deleteFromDetail = async key => {
37
+ try {
38
+ await _asyncStorage.default.removeItem(key);
39
+ console.log('Storage data reset successfully');
40
+ } catch (error) {
41
+ console.error('Storage reset error:', error);
42
+ throw error; // Re-throw to allow caller to handle
43
+ }
44
+ };
45
+ exports.deleteFromDetail = deleteFromDetail;
46
+ //# sourceMappingURL=store.key.js.map
@@ -1,5 +1,11 @@
1
1
  "use strict";
2
2
 
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.checkReanimatedSetup = checkReanimatedSetup;
7
+ exports.getReanimatedAPI = getReanimatedAPI;
8
+ exports.showReanimatedSetupError = showReanimatedSetupError;
3
9
  /**
4
10
  * @file reanimatedHelpers.ts
5
11
  * @description Utility functions to handle react-native-reanimated configuration and provide fallbacks
@@ -10,7 +16,7 @@ let reanimatedAPI;
10
16
  /**
11
17
  * Safely loads react-native-reanimated and provides fallbacks if not available
12
18
  */
13
- export function getReanimatedAPI() {
19
+ function getReanimatedAPI() {
14
20
  if (reanimatedAPI) {
15
21
  return reanimatedAPI;
16
22
  }
@@ -67,7 +73,7 @@ export function getReanimatedAPI() {
67
73
  /**
68
74
  * Check if react-native-reanimated is properly configured
69
75
  */
70
- export function checkReanimatedSetup() {
76
+ function checkReanimatedSetup() {
71
77
  const api = getReanimatedAPI();
72
78
  return api.isAvailable;
73
79
  }
@@ -75,20 +81,20 @@ export function checkReanimatedSetup() {
75
81
  /**
76
82
  * Display a helpful error message if reanimated is not configured
77
83
  */
78
- export function showReanimatedSetupError() {
84
+ function showReanimatedSetupError() {
79
85
  console.error(`
80
- 🚨 React Native Reanimated Setup Required
81
-
82
- The OnwidButton component requires react-native-reanimated to be properly installed and configured.
83
-
84
- Quick Fix:
85
- 1. Install: npm install react-native-reanimated
86
- 2. Add to babel.config.js:
87
- plugins: ['react-native-reanimated/plugin']
88
- 3. Rebuild your app
89
-
90
- For detailed setup instructions, visit:
91
- https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started
92
- `);
86
+ 🚨 React Native Reanimated Setup Required
87
+
88
+ The OnwidButton component requires react-native-reanimated to be properly installed and configured.
89
+
90
+ Quick Fix:
91
+ 1. Install: npm install react-native-reanimated
92
+ 2. Add to babel.config.js:
93
+ plugins: ['react-native-reanimated/plugin']
94
+ 3. Rebuild your app
95
+
96
+ For detailed setup instructions, visit:
97
+ https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started
98
+ `);
93
99
  }
94
- //# sourceMappingURL=reanimatedHelpers.js.map
100
+ //# sourceMappingURL=reanimated.helper.js.map
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ import { TurboModuleRegistry } from 'react-native';
4
+ export default TurboModuleRegistry.getEnforcing('EmbedReactNative');
5
+ //# sourceMappingURL=NativeEmbedReactNative.js.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- import { getAgentData, setAgentData } from '../store.key';
3
+ import { getAgentData, setAgentData } from "../store/store.key.js";
4
4
 
5
5
  /**
6
6
  * APIService class that ensures proper initialization before API calls
@@ -89,9 +89,30 @@ export class APIService {
89
89
  };
90
90
  } catch (error) {
91
91
  console.log('registerOnInitialize error', error);
92
+
93
+ // Enhanced error handling for common iOS network issues
94
+ let errorMessage = 'Unknown error occurred';
95
+ if (error instanceof Error) {
96
+ errorMessage = error.message;
97
+
98
+ // iOS ATS related errors
99
+ if (error.message.includes('The resource could not be loaded') || error.message.includes('App Transport Security')) {
100
+ errorMessage = `Network request blocked by iOS App Transport Security. ` + `Please configure ATS exceptions in Info.plist for HTTP endpoints, ` + `or use HTTPS instead. Error: ${error.message}`;
101
+ }
102
+
103
+ // Network connectivity errors
104
+ if (error.message.includes('Network request failed') || error.message.includes('Failed to fetch')) {
105
+ errorMessage = `Network request failed. Please check your internet connection ` + `and ensure the API endpoint (${this.apiBaseUrl}) is accessible. ` + `Error: ${error.message}`;
106
+ }
107
+
108
+ // Timeout errors
109
+ if (error.message.includes('timeout')) {
110
+ errorMessage = `Request timeout. The API server may be slow to respond or unreachable. ` + `Error: ${error.message}`;
111
+ }
112
+ }
92
113
  return {
93
114
  success: false,
94
- error: error instanceof Error ? error.message : 'Unknown error occurred'
115
+ error: errorMessage
95
116
  };
96
117
  }
97
118
  }
@@ -124,9 +145,30 @@ export class APIService {
124
145
  };
125
146
  } catch (error) {
126
147
  console.log('updateUserData error', error);
148
+
149
+ // Enhanced error handling for common iOS network issues
150
+ let errorMessage = 'Unknown error occurred';
151
+ if (error instanceof Error) {
152
+ errorMessage = error.message;
153
+
154
+ // iOS ATS related errors
155
+ if (error.message.includes('The resource could not be loaded') || error.message.includes('App Transport Security')) {
156
+ errorMessage = `Network request blocked by iOS App Transport Security. ` + `Please configure ATS exceptions in Info.plist for HTTP endpoints, ` + `or use HTTPS instead. Error: ${error.message}`;
157
+ }
158
+
159
+ // Network connectivity errors
160
+ if (error.message.includes('Network request failed') || error.message.includes('Failed to fetch')) {
161
+ errorMessage = `Network request failed. Please check your internet connection ` + `and ensure the API endpoint (${this.apiBaseUrl}) is accessible. ` + `Error: ${error.message}`;
162
+ }
163
+
164
+ // Timeout errors
165
+ if (error.message.includes('timeout')) {
166
+ errorMessage = `Request timeout. The API server may be slow to respond or unreachable. ` + `Error: ${error.message}`;
167
+ }
168
+ }
127
169
  return {
128
170
  success: false,
129
- error: error instanceof Error ? error.message : 'Unknown error occurred'
171
+ error: errorMessage
130
172
  };
131
173
  }
132
174
  }
@@ -157,9 +199,30 @@ export class APIService {
157
199
  };
158
200
  } catch (error) {
159
201
  console.log('getTokenDetails error', error);
202
+
203
+ // Enhanced error handling for common iOS network issues
204
+ let errorMessage = 'Unknown error occurred';
205
+ if (error instanceof Error) {
206
+ errorMessage = error.message;
207
+
208
+ // iOS ATS related errors
209
+ if (error.message.includes('The resource could not be loaded') || error.message.includes('App Transport Security')) {
210
+ errorMessage = `Network request blocked by iOS App Transport Security. ` + `Please configure ATS exceptions in Info.plist for HTTP endpoints, ` + `or use HTTPS instead. Error: ${error.message}`;
211
+ }
212
+
213
+ // Network connectivity errors
214
+ if (error.message.includes('Network request failed') || error.message.includes('Failed to fetch')) {
215
+ errorMessage = `Network request failed. Please check your internet connection ` + `and ensure the API endpoint (${this.apiBaseUrl}) is accessible. ` + `Error: ${error.message}`;
216
+ }
217
+
218
+ // Timeout errors
219
+ if (error.message.includes('timeout')) {
220
+ errorMessage = `Request timeout. The API server may be slow to respond or unreachable. ` + `Error: ${error.message}`;
221
+ }
222
+ }
160
223
  return {
161
224
  success: false,
162
- error: error instanceof Error ? error.message : 'Unknown error occurred'
225
+ error: errorMessage
163
226
  };
164
227
  }
165
228
  }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=embed.api.types.js.map
@@ -102,8 +102,7 @@ export const WaveformVisualizer = ({
102
102
  }) => {
103
103
  const {
104
104
  animatedBars,
105
- currentHeights,
106
- isActive
105
+ currentHeights
107
106
  } = useReactNativeAudioWaveform(roomRef);
108
107
  console.log('animatedBars', animatedBars);
109
108
  return /*#__PURE__*/_jsx(View, {
@@ -150,4 +149,4 @@ export const WaveformVisualizer = ({
150
149
  })
151
150
  });
152
151
  };
153
- //# sourceMappingURL=audiowave.js.map
152
+ //# sourceMappingURL=EmbedAudioWave.js.map
@@ -11,12 +11,12 @@ import { useEffect, useMemo, useRef, useState } from 'react';
11
11
  import { Dimensions, Image, Text, TouchableOpacity, View } from 'react-native';
12
12
  import { Gesture, GestureDetector } from 'react-native-gesture-handler';
13
13
  import LinearGradient from 'react-native-linear-gradient';
14
- import Voice from '../component/voice';
15
- import { useVoiceAgent } from '../hooks/voiceAgent';
16
- import { getAgentData } from '../store.key';
17
- import { createOnwidButtonStyles } from '../style/onwidButton.style';
18
- import { getReanimatedAPI, showReanimatedSetupError } from '../utils/reanimatedHelpers';
19
- import { WaveformVisualizer } from './audiowave';
14
+ import { useVoiceAgent } from "../../hooks/voiceagent.js";
15
+ import { getAgentData } from "../../store/store.key.js";
16
+ import { createEmbedButtonStyles } from "../styles/EmbedButton.style.js";
17
+ import { getReanimatedAPI, showReanimatedSetupError } from "../../utils/reanimated.helper.js";
18
+ import Voice from "./EmbedVoice.js";
19
+ import { WaveformVisualizer } from "./EmbedAudioWave.js";
20
20
 
21
21
  // Get reanimated API with fallbacks
22
22
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -90,7 +90,7 @@ const defaultStyles = {
90
90
  * />
91
91
  * ```
92
92
  */
93
- export function OnwidButton() {
93
+ export function EmbedButton() {
94
94
  const {
95
95
  initializeVoiceAgent,
96
96
  tokenDetails,
@@ -108,7 +108,6 @@ export function OnwidButton() {
108
108
  const [callDuration, setCallDuration] = useState(0);
109
109
  const timerRef = useRef(null);
110
110
  const lottieRef = useRef(null);
111
- console.log('roomRef', roomRef.current?.localParticipant);
112
111
 
113
112
  // Animation values
114
113
  const isPressed = useSharedValue(false);
@@ -124,7 +123,7 @@ export function OnwidButton() {
124
123
  const buttonWidth = useSharedValue(BUTTON_WIDTH);
125
124
  const buttonScale = useSharedValue(1);
126
125
  // Styles
127
- const styles = createOnwidButtonStyles(defaultStyles);
126
+ const styles = createEmbedButtonStyles(defaultStyles);
128
127
  const [isAutoOpen, setIsAutoOpen] = useState(false);
129
128
  useEffect(() => {
130
129
  const autoOpenTimer = setTimeout(() => {
@@ -503,5 +502,5 @@ export function OnwidButton() {
503
502
  }
504
503
 
505
504
  // Export default for easier imports
506
- export default OnwidButton;
507
- //# sourceMappingURL=OnwidButton.js.map
505
+ export default EmbedButton;
506
+ //# sourceMappingURL=EmbedButton.js.map
@@ -124,4 +124,4 @@ const Voice = props => {
124
124
  });
125
125
  };
126
126
  export default Voice;
127
- //# sourceMappingURL=voice.js.map
127
+ //# sourceMappingURL=EmbedVoice.js.map
@@ -29,7 +29,7 @@ const dimensions = calculateDimensions();
29
29
  export const BUTTON_WIDTH = dimensions.BUTTON_WIDTH;
30
30
  export const EXPANDED_WIDTH = dimensions.EXPANDED_WIDTH;
31
31
  export const BUTTON_HEIGHT = dimensions.BUTTON_HEIGHT;
32
- export const createOnwidButtonStyles = customStyles => {
32
+ export const createEmbedButtonStyles = customStyles => {
33
33
  const {
34
34
  buttonWidth = BUTTON_WIDTH,
35
35
  buttonHeight = BUTTON_HEIGHT,
@@ -239,5 +239,5 @@ export const createOnwidButtonStyles = customStyles => {
239
239
  };
240
240
 
241
241
  // Default styles export with dynamic dimensions
242
- export const onwidButtonStyles = createOnwidButtonStyles();
243
- //# sourceMappingURL=onwidButton.style.js.map
242
+ export const onwidButtonStyles = createEmbedButtonStyles();
243
+ //# sourceMappingURL=EmbedButton.style.js.map