omikit-plugin 4.0.2 → 4.1.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 (63) hide show
  1. package/README.md +654 -37
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/com/omikitplugin/OmiLocalCameraView.kt +94 -0
  4. package/android/src/main/java/com/omikitplugin/OmiRemoteCameraView.kt +117 -0
  5. package/android/src/main/java/com/omikitplugin/OmikitPluginModule.kt +24 -17
  6. package/android/src/main/java/com/omikitplugin/OmikitPluginPackage.kt +11 -8
  7. package/ios/CallProcess/CallManager.swift +99 -29
  8. package/ios/Library/OmikitPlugin.m +18 -0
  9. package/ios/Library/OmikitPlugin.swift +233 -1
  10. package/ios/OmikitPlugin-Bridging-Header.h +1 -0
  11. package/ios/OmikitPlugin.xcodeproj/project.pbxproj +4 -4
  12. package/ios/VideoCall/OmiLocalCameraViewBridge.m +14 -0
  13. package/ios/VideoCall/OmiLocalCameraViewManager.swift +41 -0
  14. package/ios/VideoCall/OmiRemoteCameraViewBridge.m +14 -0
  15. package/ios/VideoCall/OmiRemoteCameraViewManager.swift +40 -0
  16. package/lib/commonjs/NativeOmikitPlugin.js +2 -1
  17. package/lib/commonjs/NativeOmikitPlugin.js.map +1 -1
  18. package/lib/commonjs/index.js.map +1 -1
  19. package/lib/commonjs/omi_audio_type.js +5 -7
  20. package/lib/commonjs/omi_audio_type.js.map +1 -1
  21. package/lib/commonjs/omi_call_state.js +5 -3
  22. package/lib/commonjs/omi_call_state.js.map +1 -1
  23. package/lib/commonjs/omi_local_camera.js +19 -17
  24. package/lib/commonjs/omi_local_camera.js.map +1 -1
  25. package/lib/commonjs/omi_remote_camera.js +20 -17
  26. package/lib/commonjs/omi_remote_camera.js.map +1 -1
  27. package/lib/commonjs/omi_start_call_status.js +5 -24
  28. package/lib/commonjs/omi_start_call_status.js.map +1 -1
  29. package/lib/commonjs/omikit.js +56 -3
  30. package/lib/commonjs/omikit.js.map +1 -1
  31. package/lib/commonjs/types/index.d.js.map +1 -1
  32. package/lib/module/NativeOmikitPlugin.js.map +1 -1
  33. package/lib/module/index.js.map +1 -1
  34. package/lib/module/omi_audio_type.js +4 -7
  35. package/lib/module/omi_audio_type.js.map +1 -1
  36. package/lib/module/omi_call_state.js +4 -3
  37. package/lib/module/omi_call_state.js.map +1 -1
  38. package/lib/module/omi_local_camera.js +19 -18
  39. package/lib/module/omi_local_camera.js.map +1 -1
  40. package/lib/module/omi_remote_camera.js +20 -18
  41. package/lib/module/omi_remote_camera.js.map +1 -1
  42. package/lib/module/omi_start_call_status.js +4 -24
  43. package/lib/module/omi_start_call_status.js.map +1 -1
  44. package/lib/module/omikit.js +49 -1
  45. package/lib/module/omikit.js.map +1 -1
  46. package/lib/module/types/index.d.js.map +1 -1
  47. package/omikit-plugin.podspec +1 -1
  48. package/package.json +2 -11
  49. package/react-native.config.js +14 -0
  50. package/src/NativeOmikitPlugin.ts +1 -0
  51. package/src/omi_call_state.tsx +1 -0
  52. package/src/omi_local_camera.tsx +15 -19
  53. package/src/omi_remote_camera.tsx +16 -19
  54. package/src/omikit.tsx +63 -0
  55. package/src/types/index.d.ts +344 -62
  56. package/android/src/main/java/com/omikitplugin/FLLocalCameraModule.kt +0 -34
  57. package/android/src/main/java/com/omikitplugin/FLLocalCameraView.kt +0 -44
  58. package/android/src/main/java/com/omikitplugin/FLRemoteCameraModule.kt +0 -37
  59. package/android/src/main/java/com/omikitplugin/FLRemoteCameraView.kt +0 -23
  60. package/ios/VideoCall/FLLocalCameraView.m +0 -17
  61. package/ios/VideoCall/FLLocalCameraView.swift +0 -44
  62. package/ios/VideoCall/FLRemoteCameraView.m +0 -18
  63. package/ios/VideoCall/FLRemoteCameraView.swift +0 -124
@@ -1,25 +1,21 @@
1
- import type { HostComponent } from 'react-native';
2
- import { NativeModules, requireNativeComponent, ViewProps } from 'react-native';
1
+ import { NativeModules, Platform, View } from 'react-native';
3
2
 
4
- // Safe lazy loading requireNativeComponent can throw in bridgeless mode
5
- // if the native view is not registered for Fabric
6
- let _localCameraView: HostComponent<ViewProps> | null = null;
7
- const getLocalCameraView = (): HostComponent<ViewProps> => {
8
- if (!_localCameraView) {
9
- _localCameraView = requireNativeComponent('FLLocalCameraView');
3
+ // Safe requireNativeComponentreturns fallback View if native config not available
4
+ let OmiLocalCameraViewNative: any = View;
5
+ try {
6
+ const { UIManager, requireNativeComponent } = require('react-native');
7
+ if (Platform.OS === 'android' || UIManager.getViewManagerConfig?.('OmiLocalCameraView')) {
8
+ OmiLocalCameraViewNative = requireNativeComponent('OmiLocalCameraView');
10
9
  }
11
- return _localCameraView;
12
- };
10
+ } catch (_) {
11
+ // Fallback to plain View — iOS Fabric uses native window rendering instead
12
+ }
13
13
 
14
- export const OmiLocalCameraView = new Proxy({} as HostComponent<ViewProps>, {
15
- get(_target, prop) {
16
- return (getLocalCameraView() as any)[prop];
17
- },
18
- });
14
+ export const OmiLocalCameraView = OmiLocalCameraViewNative;
19
15
 
20
- // Module name separated from ViewManager name to avoid name collision
21
- const FLLocalCamera = NativeModules.FLLocalCameraModule || NativeModules.FLLocalCameraView;
16
+ // Imperative refresh method
17
+ const OmiLocalCamera = NativeModules.OmiLocalCameraView;
22
18
  export function refreshLocalCamera(): Promise<boolean> {
23
- if (!FLLocalCamera) return Promise.resolve(false);
24
- return FLLocalCamera.refresh();
19
+ if (!OmiLocalCamera) return Promise.resolve(false);
20
+ return OmiLocalCamera.refresh();
25
21
  }
@@ -1,25 +1,22 @@
1
- import type { HostComponent } from 'react-native';
2
- import { NativeModules, requireNativeComponent, ViewProps } from 'react-native';
1
+ import { NativeModules, Platform, View } from 'react-native';
3
2
 
4
- // Safe lazy loading requireNativeComponent can throw in bridgeless mode
5
- // if the native view is not registered for Fabric
6
- let _remoteCameraView: HostComponent<ViewProps> | null = null;
7
- const getRemoteCameraView = (): HostComponent<ViewProps> => {
8
- if (!_remoteCameraView) {
9
- _remoteCameraView = requireNativeComponent('FLRemoteCameraView');
3
+ // Safe requireNativeComponentreturns fallback View if native config not available
4
+ let OmiRemoteCameraViewNative: any = View;
5
+ try {
6
+ const { UIManager, requireNativeComponent } = require('react-native');
7
+ // Only attempt on Android or Old Arch iOS where ViewManager config exists
8
+ if (Platform.OS === 'android' || UIManager.getViewManagerConfig?.('OmiRemoteCameraView')) {
9
+ OmiRemoteCameraViewNative = requireNativeComponent('OmiRemoteCameraView');
10
10
  }
11
- return _remoteCameraView;
12
- };
11
+ } catch (_) {
12
+ // Fallback to plain View — iOS Fabric uses native window rendering instead
13
+ }
13
14
 
14
- export const OmiRemoteCameraView = new Proxy({} as HostComponent<ViewProps>, {
15
- get(_target, prop) {
16
- return (getRemoteCameraView() as any)[prop];
17
- },
18
- });
15
+ export const OmiRemoteCameraView = OmiRemoteCameraViewNative;
19
16
 
20
- // Module name separated from ViewManager name to avoid name collision
21
- const FLRemoteCamera = NativeModules.FLRemoteCameraModule || NativeModules.FLRemoteCameraView;
17
+ // Imperative refresh method
18
+ const OmiRemoteCamera = NativeModules.OmiRemoteCameraView;
22
19
  export function refreshRemoteCamera(): Promise<boolean> {
23
- if (!FLRemoteCamera) return Promise.resolve(false);
24
- return FLRemoteCamera.refresh();
20
+ if (!OmiRemoteCamera) return Promise.resolve(false);
21
+ return OmiRemoteCamera.refresh();
25
22
  }
package/src/omikit.tsx CHANGED
@@ -185,6 +185,57 @@ export function switchOmiCamera(): Promise<boolean> {
185
185
  return OmikitPlugin.switchOmiCamera();
186
186
  }
187
187
 
188
+ /**
189
+ * Configure camera view style on iOS (Fabric mode — native window rendering).
190
+ * On Android, use style props on OmiLocalCameraView/OmiRemoteCameraView instead.
191
+ *
192
+ * @param config.target - "local" or "remote"
193
+ * @param config.x - X position
194
+ * @param config.y - Y position
195
+ * @param config.width - View width
196
+ * @param config.height - View height
197
+ * @param config.borderRadius - Corner radius
198
+ * @param config.borderWidth - Border width
199
+ * @param config.borderColor - Border color (hex: "#FF0000" or "#FF000080")
200
+ * @param config.backgroundColor - Background color (hex)
201
+ * @param config.opacity - View opacity (0.0 - 1.0)
202
+ * @param config.hidden - Show/hide the view
203
+ * @param config.scaleMode - Video scale: "fill" (aspect fill), "fit" (aspect fit), "stretch"
204
+ * @returns {Promise<boolean>}
205
+ */
206
+ export function setCameraConfig(config: {
207
+ target: 'local' | 'remote';
208
+ x?: number;
209
+ y?: number;
210
+ width?: number;
211
+ height?: number;
212
+ borderRadius?: number;
213
+ borderWidth?: number;
214
+ borderColor?: string;
215
+ backgroundColor?: string;
216
+ opacity?: number;
217
+ hidden?: boolean;
218
+ scaleMode?: 'fill' | 'fit' | 'stretch';
219
+ }): Promise<boolean> {
220
+ if (Platform.OS === 'ios') {
221
+ return OmikitPlugin.setCameraConfig(config);
222
+ }
223
+ return Promise.resolve(false);
224
+ }
225
+
226
+ /**
227
+ * Create video containers and add to window (iOS only).
228
+ * Call this when video call screen mounts and call is active.
229
+ * On Fabric, RCTViewManager.view() is not called, so containers must be created manually.
230
+ * @returns {Promise<boolean>}
231
+ */
232
+ export function setupVideoContainers(): Promise<boolean> {
233
+ if (Platform.OS === 'ios') {
234
+ return OmikitPlugin.setupVideoContainers();
235
+ }
236
+ return Promise.resolve(true);
237
+ }
238
+
188
239
  /**
189
240
  * Toggles the video stream on or off during a video call.
190
241
  * @returns {Promise<boolean>} A promise that resolves to `true` if the video is toggled successfully.
@@ -209,6 +260,18 @@ export function registerVideoEvent(): Promise<boolean> {
209
260
  return OmikitPlugin.registerVideoEvent();
210
261
  }
211
262
 
263
+ /**
264
+ * Setup video views by attaching native containers to React view tags.
265
+ * Required for New Architecture (Fabric) where ViewManager.view() is not called.
266
+ */
267
+ export function setupVideoViews(
268
+ remoteTag: number,
269
+ localTag: number
270
+ ): Promise<boolean> {
271
+ if (!OmikitPlugin.setupVideoViews) return Promise.resolve(false);
272
+ return OmikitPlugin.setupVideoViews(remoteTag, localTag);
273
+ }
274
+
212
275
  /**
213
276
  * Removes video call event listeners.
214
277
  * @returns {Promise<boolean>} A promise that resolves to `true` if the removal is successful.
@@ -1,20 +1,85 @@
1
1
  declare module 'omikit-plugin' {
2
- import { NativeEventEmitter } from 'react-native';
2
+ import type { NativeEventEmitter } from 'react-native';
3
+ import type { ComponentType } from 'react';
4
+ import type { ViewProps } from 'react-native';
3
5
 
4
6
  // ============================================
5
- // FUNCTIONS
7
+ // SERVICE & AUTHENTICATION
6
8
  // ============================================
7
9
 
8
- export function startServices(): Promise<any>;
10
+ /**
11
+ * Initialize SDK services. Call once on app launch (e.g., App.tsx or index.js).
12
+ * Sets up native audio system and event listeners.
13
+ * Do NOT call multiple times.
14
+ */
15
+ export function startServices(): Promise<boolean>;
16
+
17
+ /**
18
+ * Configure push notification settings.
19
+ * Call after startServices(), before or after login.
20
+ */
9
21
  export function configPushNotification(data: any): Promise<any>;
22
+
23
+ /**
24
+ * Get pending call data on cold start (app launched from push notification).
25
+ * Returns call info if there's a pending incoming call, null otherwise.
26
+ */
10
27
  export function getInitialCall(): Promise<any>;
11
- export function initCallWithUserPassword(data: any): Promise<boolean>;
12
- export function initCallWithApiKey(data: any): Promise<boolean>;
13
28
 
14
29
  /**
15
- * Starts a new call
16
- * @param data - Call configuration { phoneNumber: string, isVideo: boolean }
17
- * @returns Promise with call result { status: OmiStartCallStatus, message?: string, _id?: string }
30
+ * Login with SIP username/password credentials.
31
+ * @param data.userName - SIP username
32
+ * @param data.password - SIP password
33
+ * @param data.realm - SIP realm/domain
34
+ * @param data.host - SIP proxy server (optional, defaults to vh.omicrm.com)
35
+ * @param data.isVideo - Enable video capability (required true for video calls)
36
+ * @param data.fcmToken - Firebase token for push notifications
37
+ * @param data.projectId - OMICALL project ID (optional)
38
+ * @param data.isSkipDevices - true = Customer mode, false = Agent mode (default)
39
+ */
40
+ export function initCallWithUserPassword(data: {
41
+ userName: string;
42
+ password: string;
43
+ realm: string;
44
+ host?: string;
45
+ isVideo: boolean;
46
+ fcmToken: string;
47
+ projectId?: string;
48
+ isSkipDevices?: boolean;
49
+ }): Promise<boolean>;
50
+
51
+ /**
52
+ * Login with API key.
53
+ * @param data.fullName - Display name
54
+ * @param data.usrUuid - User UUID from OMICALL
55
+ * @param data.apiKey - API key from OMICALL dashboard
56
+ * @param data.isVideo - Enable video capability
57
+ * @param data.phone - Phone number
58
+ * @param data.fcmToken - Firebase token for push notifications
59
+ * @param data.projectId - OMICALL project ID (optional)
60
+ */
61
+ export function initCallWithApiKey(data: {
62
+ fullName: string;
63
+ usrUuid: string;
64
+ apiKey: string;
65
+ isVideo: boolean;
66
+ phone: string;
67
+ fcmToken: string;
68
+ projectId?: string;
69
+ }): Promise<boolean>;
70
+
71
+ /** Logout and unregister SIP */
72
+ export function logout(): Promise<boolean>;
73
+
74
+ // ============================================
75
+ // CALL CONTROL
76
+ // ============================================
77
+
78
+ /**
79
+ * Start an outgoing call.
80
+ * @param data.phoneNumber - Number to call
81
+ * @param data.isVideo - true for video call, false for audio
82
+ * @returns { status: OmiStartCallStatus, message?: string, _id?: string }
18
83
  */
19
84
  export function startCall(data: {
20
85
  phoneNumber: string;
@@ -25,73 +90,271 @@ declare module 'omikit-plugin' {
25
90
  _id?: string;
26
91
  }>;
27
92
 
28
- export function startCallWithUuid(data: any): Promise<boolean>;
93
+ /** Start call by user UUID */
94
+ export function startCallWithUuid(data: {
95
+ usrUuid: string;
96
+ isVideo: boolean;
97
+ }): Promise<boolean>;
98
+
99
+ /** Accept incoming call */
29
100
  export function joinCall(): Promise<any>;
101
+
102
+ /** End active call (sends SIP BYE) */
30
103
  export function endCall(): Promise<any>;
31
- export function toggleMute(): Promise<boolean>;
32
- export function toggleHold(): Promise<boolean>;
104
+
105
+ /** Reject call on this device only (sends 486 Busy) */
106
+ export function rejectCall(): Promise<boolean>;
107
+
108
+ /** Reject call and stop ringing on ALL devices (sends 603 Decline) */
109
+ export function dropCall(): Promise<boolean>;
110
+
111
+ /** Blind transfer active call to another number */
112
+ export function transferCall(data: { phoneNumber: string }): Promise<boolean>;
113
+
114
+ // ============================================
115
+ // MEDIA CONTROL
116
+ // ============================================
117
+
118
+ /** Toggle microphone mute. Returns new mute state or null */
119
+ export function toggleMute(): Promise<boolean | null>;
120
+
121
+ /** Toggle speakerphone. Returns new speaker state */
33
122
  export function toggleSpeaker(): Promise<boolean>;
34
- export function onHold(data: any): Promise<boolean>;
35
- export function sendDTMF(data: any): Promise<boolean>;
36
- export function switchOmiCamera(): Promise<boolean>;
123
+
124
+ /** Toggle call hold */
125
+ export function toggleHold(): Promise<void>;
126
+
127
+ /** Set hold state explicitly */
128
+ export function onHold(data: { holdStatus: boolean }): Promise<boolean>;
129
+
130
+ /** Send DTMF tone (0-9, *, #) */
131
+ export function sendDTMF(data: { character: string }): Promise<boolean>;
132
+
133
+ /** List available audio output devices */
134
+ export function getAudio(): Promise<any>;
135
+
136
+ /** Set audio output device */
137
+ export function setAudio(data: { portType: OmiAudioType | number }): Promise<void>;
138
+
139
+ /** Get current audio output device */
140
+ export function getCurrentAudio(): Promise<any>;
141
+
142
+ // ============================================
143
+ // VIDEO CONTROL
144
+ // ============================================
145
+
146
+ /**
147
+ * Toggle video stream on/off during a video call.
148
+ * When off, remote party sees a black/frozen frame.
149
+ */
37
150
  export function toggleOmiVideo(): Promise<boolean>;
38
- export function logout(): Promise<boolean>;
151
+
152
+ /** Switch between front and back camera */
153
+ export function switchOmiCamera(): Promise<boolean>;
154
+
155
+ /**
156
+ * Register for video event notifications (iOS only).
157
+ * Call before starting/receiving a video call.
158
+ * Not needed on Android.
159
+ */
39
160
  export function registerVideoEvent(): Promise<boolean>;
161
+
162
+ /**
163
+ * Unregister video event notifications (iOS only).
164
+ * Call when leaving video call screen.
165
+ */
40
166
  export function removeVideoEvent(): Promise<boolean>;
167
+
168
+ /**
169
+ * Connect remote video feed to native TextureView surface.
170
+ * Call when call is confirmed (OmiCallState.confirmed).
171
+ * On Android: connects SDK incoming video to TextureView.
172
+ * On iOS Old Arch: triggers prepareForVideoDisplay.
173
+ */
174
+ export function refreshRemoteCamera(): Promise<boolean>;
175
+
176
+ /**
177
+ * Connect local camera feed to native TextureView surface.
178
+ * Call when call is confirmed (OmiCallState.confirmed).
179
+ * On Android: connects SDK local camera to TextureView (300ms delay for camera init).
180
+ * On iOS Old Arch: triggers prepareForVideoDisplay.
181
+ */
182
+ export function refreshLocalCamera(): Promise<boolean>;
183
+
184
+ /**
185
+ * Create native video containers and add to UIWindow (iOS New Arch / Fabric only).
186
+ * On Fabric, RCTViewManager.view() is not called, so containers must be created manually.
187
+ * Call when call is confirmed, then use setCameraConfig() to adjust position/style.
188
+ * On Android, this is a no-op.
189
+ */
190
+ export function setupVideoContainers(): Promise<boolean>;
191
+
192
+ /**
193
+ * Configure native video container style (iOS New Arch / Fabric only).
194
+ * Controls position, size, appearance, and visibility of video containers on UIWindow.
195
+ * On Android, use React style props on OmiRemoteCameraView/OmiLocalCameraView instead.
196
+ *
197
+ * @param config.target - Which camera: 'local' or 'remote'
198
+ * @param config.x - X position on screen
199
+ * @param config.y - Y position on screen
200
+ * @param config.width - View width
201
+ * @param config.height - View height
202
+ * @param config.borderRadius - Corner radius
203
+ * @param config.borderWidth - Border width
204
+ * @param config.borderColor - Border color (hex: '#RRGGBB' or '#RRGGBBAA')
205
+ * @param config.backgroundColor - Background color (hex)
206
+ * @param config.opacity - View opacity (0.0 - 1.0)
207
+ * @param config.hidden - Show/hide the video container
208
+ * @param config.scaleMode - Video scaling: 'fill' (aspect fill), 'fit' (aspect fit), 'stretch'
209
+ */
210
+ export function setCameraConfig(config: {
211
+ target: 'local' | 'remote';
212
+ x?: number;
213
+ y?: number;
214
+ width?: number;
215
+ height?: number;
216
+ borderRadius?: number;
217
+ borderWidth?: number;
218
+ borderColor?: string;
219
+ backgroundColor?: string;
220
+ opacity?: number;
221
+ hidden?: boolean;
222
+ scaleMode?: 'fill' | 'fit' | 'stretch';
223
+ }): Promise<boolean>;
224
+
225
+ // ============================================
226
+ // VIDEO COMPONENTS
227
+ // ============================================
228
+
229
+ /**
230
+ * Remote camera view — displays the other party's video.
231
+ * Android: renders via native TextureView. Style with React props.
232
+ * iOS Old Arch: renders via RCTViewManager. Style with React props.
233
+ * iOS New Arch (Fabric): falls back to plain View (use setupVideoContainers instead).
234
+ */
235
+ export const OmiRemoteCameraView: ComponentType<ViewProps>;
236
+
237
+ /**
238
+ * Local camera view — displays your own camera preview (PiP).
239
+ * Same platform behavior as OmiRemoteCameraView.
240
+ */
241
+ export const OmiLocalCameraView: ComponentType<ViewProps>;
242
+
243
+ // ============================================
244
+ // USER & INFO
245
+ // ============================================
246
+
247
+ /** Get logged-in user details (extension, name, etc.) */
41
248
  export function getCurrentUser(): Promise<any>;
249
+
250
+ /** Get remote/guest user details during a call */
42
251
  export function getGuestUser(): Promise<any>;
43
- export function systemAlertWindow(): Promise<boolean>;
44
- export function openSystemAlertSetting(): Promise<void>;
45
- export function getAudio(): Promise<any>;
46
- export function setAudio(data: { portType: OmiAudioType | number }): Promise<void>;
47
- export function getCurrentAudio(): Promise<any>;
48
- export function transferCall(data: any): Promise<boolean>;
49
- export function rejectCall(): Promise<boolean>;
50
- export function dropCall(): Promise<boolean>;
51
- export function getKeepAliveStatus(): Promise<any>;
52
- export function triggerKeepAlivePing(): Promise<boolean>;
252
+
253
+ /** Look up user info by phone number */
254
+ export function getUserInfo(phone: string): Promise<any>;
255
+
256
+ // ============================================
257
+ // GETTER FUNCTIONS (v4.0.1+)
258
+ // ============================================
259
+
260
+ /** Get the current Firebase project ID */
261
+ export function getProjectId(): Promise<string | null>;
262
+
263
+ /** Get the current app ID */
264
+ export function getAppId(): Promise<string | null>;
265
+
266
+ /** Get the current device ID */
267
+ export function getDeviceId(): Promise<string | null>;
268
+
269
+ /** Get the FCM push token */
270
+ export function getFcmToken(): Promise<string | null>;
271
+
272
+ /** Get SIP registration info (format: user@realm) */
273
+ export function getSipInfo(): Promise<string | null>;
274
+
275
+ /** Get VoIP push token (iOS only, returns null on Android) */
276
+ export function getVoipToken(): Promise<string | null>;
277
+
278
+ // ============================================
279
+ // NOTIFICATION CONTROL
280
+ // ============================================
281
+
282
+ /** Hide system notification without unregistering SIP */
283
+ export function hideSystemNotificationSafely(): Promise<boolean>;
284
+
285
+ /** Hide notification only (no SIP changes) */
286
+ export function hideSystemNotificationOnly(): Promise<boolean>;
287
+
288
+ /** Hide notification and unregister SIP with reason */
289
+ export function hideSystemNotificationAndUnregister(reason: string): Promise<boolean>;
290
+
291
+ // ============================================
292
+ // PERMISSIONS (Android)
293
+ // ============================================
294
+
295
+ /** Check current permission status. Returns detailed permission info */
53
296
  export function checkPermissionStatus(): Promise<any>;
297
+
298
+ /**
299
+ * Check and request all required permissions.
300
+ * @param isVideo - true to also request camera permission
301
+ */
54
302
  export function checkAndRequestPermissions(isVideo?: boolean): Promise<boolean>;
303
+
304
+ /** Request SYSTEM_ALERT_WINDOW permission for overlay (Android) */
55
305
  export function requestSystemAlertWindowPermission(): Promise<boolean>;
306
+
307
+ /** Check if app can draw overlays (Android M+) */
308
+ export function systemAlertWindow(): Promise<boolean>;
309
+
310
+ /** Open system alert window settings page */
311
+ export function openSystemAlertSetting(): Promise<void>;
312
+
313
+ /**
314
+ * Request specific permissions by status codes.
315
+ * @param codes - Array of permission codes (450=mic, 451=camera, 452=overlay)
316
+ */
56
317
  export function requestPermissionsByCodes(codes: number[]): Promise<boolean>;
57
- export function hideSystemNotificationSafely(): Promise<boolean>;
58
- export function hideSystemNotificationOnly(): Promise<boolean>;
59
- export function hideSystemNotificationAndUnregister(reason: string): Promise<boolean>;
60
- export function checkCredentials(data: any): Promise<{
318
+
319
+ // ============================================
320
+ // ADVANCED FEATURES
321
+ // ============================================
322
+
323
+ /**
324
+ * Validate SIP credentials without establishing a connection.
325
+ * @returns { success, statusCode, message }
326
+ */
327
+ export function checkCredentials(data: {
328
+ userName: string;
329
+ password: string;
330
+ realm: string;
331
+ }): Promise<{
61
332
  success: boolean;
62
333
  statusCode?: number;
63
334
  message?: string;
64
335
  }>;
336
+
337
+ /**
338
+ * Register with full control over registration behavior.
339
+ * @returns { success, statusCode, message }
340
+ */
65
341
  export function registerWithOptions(data: any): Promise<{
66
342
  success: boolean;
67
343
  statusCode?: number;
68
344
  message?: string;
69
345
  }>;
70
346
 
71
- // User & Info
72
- export function getUserInfo(phone: string): Promise<any>;
347
+ /** Check current keep-alive status */
348
+ export function getKeepAliveStatus(): Promise<any>;
73
349
 
74
- // Getter Functions
75
- /** Get the current project ID */
76
- export function getProjectId(): Promise<string | null>;
77
- /** Get the current app ID */
78
- export function getAppId(): Promise<string | null>;
79
- /** Get the current device ID */
80
- export function getDeviceId(): Promise<string | null>;
81
- /** Get the FCM token (Android) or push token */
82
- export function getFcmToken(): Promise<string | null>;
83
- /** Get SIP registration info (format: user@realm) */
84
- export function getSipInfo(): Promise<string | null>;
85
- /** Get VoIP token (iOS only, returns null on Android) */
86
- export function getVoipToken(): Promise<string | null>;
350
+ /** Manually trigger a keep-alive ping */
351
+ export function triggerKeepAlivePing(): Promise<boolean>;
87
352
 
88
353
  // ============================================
89
354
  // ENUMS
90
355
  // ============================================
91
356
 
92
- /**
93
- * Call state enum for tracking call lifecycle
94
- */
357
+ /** Call state enum for tracking call lifecycle */
95
358
  export enum OmiCallState {
96
359
  unknown = 0,
97
360
  calling = 1,
@@ -101,43 +364,34 @@ declare module 'omikit-plugin' {
101
364
  confirmed = 5,
102
365
  disconnected = 6,
103
366
  hold = 7,
367
+ /** Call is being disconnected (BYE sent, waiting for response) */
368
+ disconnecting = 12,
104
369
  }
105
370
 
106
371
  /**
107
- * Status codes returned by startCall() function
108
- * Use these to handle different call initiation results
372
+ * Status codes returned by startCall().
373
+ * Check these to handle different call initiation results.
109
374
  */
110
375
  export enum OmiStartCallStatus {
111
- // Validation errors (0-3)
112
376
  invalidUuid = 0,
113
377
  invalidPhoneNumber = 1,
114
378
  samePhoneNumber = 2,
115
379
  maxRetry = 3,
116
-
117
- // Permission errors (4, 450-452)
118
380
  permissionDenied = 4,
119
381
  permissionMicrophone = 450,
120
382
  permissionCamera = 451,
121
383
  permissionOverlay = 452,
122
-
123
- // Call errors (5-7)
124
384
  couldNotFindEndpoint = 5,
125
385
  accountRegisterFailed = 6,
126
386
  startCallFailed = 7,
127
-
128
- // Success statuses (8, 407)
129
387
  startCallSuccess = 8,
130
388
  startCallSuccessIOS = 407,
131
-
132
- // Other errors (9+)
133
389
  haveAnotherCall = 9,
134
390
  accountTurnOffNumberInternal = 10,
135
391
  noNetwork = 11,
136
392
  }
137
393
 
138
- /**
139
- * Audio output types for setAudio()
140
- */
394
+ /** Audio output types for setAudio() */
141
395
  export enum OmiAudioType {
142
396
  receiver = 0,
143
397
  speaker = 1,
@@ -146,21 +400,49 @@ declare module 'omikit-plugin' {
146
400
  }
147
401
 
148
402
  // ============================================
149
- // CONSTANTS & EVENTS
403
+ // EVENTS
150
404
  // ============================================
151
405
 
406
+ /** Event name constants — use with omiEmitter.addListener() */
152
407
  export const OmiCallEvent: {
408
+ /** Call lifecycle changes. Payload: { status, callerNumber, isVideo, incoming, codeEndCall } */
153
409
  onCallStateChanged: string;
410
+ /** Speaker toggled. Payload: boolean */
154
411
  onSpeaker: string;
412
+ /** Microphone mute toggled. Payload: boolean */
155
413
  onMuted: string;
414
+ /** Hold state changed. Payload: boolean */
156
415
  onHold: string;
416
+ /** Remote video stream ready. Call refreshRemoteCamera() */
157
417
  onRemoteVideoReady: string;
418
+ /** User tapped missed call notification. Payload: { callerNumber } */
158
419
  onClickMissedCall: string;
420
+ /** Switchboard answered. Payload: { data } */
159
421
  onSwitchboardAnswer: string;
422
+ /** Call quality metrics. Payload: { quality: 0|1|2, stat: { mos, jitter, latency, packetLoss } } */
160
423
  onCallQuality: string;
424
+ /** Audio device changed. Payload: { data } */
161
425
  onAudioChange: string;
426
+ /** Permission request needed (Android). Payload: { permissions } */
162
427
  onRequestPermissionAndroid: string;
163
428
  };
164
429
 
430
+ /**
431
+ * Event emitter for listening to SDK events.
432
+ * iOS: NativeEventEmitter (receives from RCTEventEmitter).
433
+ * Android: DeviceEventEmitter.
434
+ *
435
+ * Usage:
436
+ * ```typescript
437
+ * const sub = omiEmitter.addListener(OmiCallEvent.onCallStateChanged, (data) => {
438
+ * console.log('Status:', data.status);
439
+ * });
440
+ * // Cleanup:
441
+ * sub.remove();
442
+ * ```
443
+ *
444
+ * Important: use subscription.remove() — NOT removeAllListeners()
445
+ * (removeAllListeners removes listeners from ALL screens).
446
+ */
165
447
  export const omiEmitter: NativeEventEmitter;
166
448
  }