@poolse/native 3.9.0 → 3.10.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/CHANGELOG.md +64 -0
- package/README.md +129 -9
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/dev/poolse/callcore/CallCoreRuntime.kt +83 -6
- package/android/src/main/java/dev/poolse/callcore/Ports.kt +28 -1
- package/android/src/main/java/dev/poolse/callcore/android/AndroidRingSurface.kt +3 -3
- package/android/src/main/java/dev/poolse/callcore/android/CallCore.kt +155 -10
- package/android/src/main/java/dev/poolse/callcore/android/CallHttpClient.kt +7 -1
- package/android/src/main/java/dev/poolse/callcore/android/CallMessagingService.kt +21 -1
- package/android/src/main/java/dev/poolse/callcore/android/CallVideo.kt +32 -0
- package/android/src/main/java/dev/poolse/callcore/android/EscalationNotification.kt +475 -0
- package/android/src/main/java/dev/poolse/callcore/android/IncomingCallActivity.kt +9 -4
- package/android/src/main/java/dev/poolse/callcore/android/MeetingNotification.kt +127 -0
- package/android/src/main/java/dev/poolse/callcore/android/PoolseIncomingCall.kt +9 -0
- package/android/src/main/java/dev/poolse/callcore/android/RingBundle.kt +9 -0
- package/android/src/main/java/expo/modules/poolsecalls/PoolseCallsModule.kt +48 -2
- package/android/src/main/livekit/java/dev/poolse/callcore/livekit/LiveKitMediaPort.kt +121 -6
- package/android/src/test/java/dev/poolse/callcore/android/CallHttpClientTest.kt +15 -0
- package/dist/index.cjs +108 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +241 -23
- package/dist/index.d.ts +241 -23
- package/dist/index.js +98 -1
- package/dist/index.js.map +1 -1
- package/ios/Core/CallCoreRuntime.swift +79 -5
- package/ios/Core/CallHttpClient.swift +9 -2
- package/ios/Core/Ports.swift +31 -2
- package/ios/Core/SnapshotEncoding.swift +22 -3
- package/ios/Module/PoolseCallsModule.swift +48 -1
- package/ios/Platform/CallCore.swift +100 -1
- package/ios/Platform/CallKitController.swift +1 -1
- package/ios/Platform/EscalationNotifications.swift +195 -0
- package/ios/Platform/LiveKitMediaPort.swift +127 -3
- package/ios/Platform/MessageNotifications.swift +60 -1
- package/ios/Platform/VoipPush.swift +11 -2
- package/package.json +1 -1
- package/src/index.ts +354 -23
package/dist/index.d.ts
CHANGED
|
@@ -20,12 +20,19 @@ interface Snapshot {
|
|
|
20
20
|
kind?: 'call' | 'room';
|
|
21
21
|
media: 'audio' | 'video';
|
|
22
22
|
phase: 'ringing_in' | 'ringing_out' | 'connecting' | 'active' | 'reconnecting' | 'ended';
|
|
23
|
-
reason?: 'left' | 'finished' | 'declined_all' | 'busy_all' | 'no_answer' | 'cancelled' | 'connection_lost' | 'failed'
|
|
23
|
+
reason?: 'left' | 'finished' | 'declined_all' | 'busy_all' | 'no_answer' | 'cancelled' | 'connection_lost' | 'failed'
|
|
24
|
+
/**
|
|
25
|
+
* You took this call on another of your devices (`moveCallHere`
|
|
26
|
+
* there): it goes on without this one. Say "Moved to your other
|
|
27
|
+
* device", not "Call ended". Absent before 3.10.
|
|
28
|
+
*/
|
|
29
|
+
| 'moved';
|
|
24
30
|
/**
|
|
25
31
|
* REMOTE people only; `userId` is the LiveKit identity. poolse's
|
|
26
32
|
* transcript assistant (`poolse:…`, kind agent) and the recorder
|
|
27
33
|
* (LiveKit Egress, `EG_…`) are never listed — nor counted when the core
|
|
28
|
-
* ends a call left alone. Phone (SIP) participants are listed.
|
|
34
|
+
* ends a call left alone. Phone (SIP) participants are listed. Agents
|
|
35
|
+
* invited into the call are listed with `isAgent` (last), never counted.
|
|
29
36
|
*/
|
|
30
37
|
participants: Array<{
|
|
31
38
|
userId: string;
|
|
@@ -45,6 +52,16 @@ interface Snapshot {
|
|
|
45
52
|
* Absent before 0.11.0.
|
|
46
53
|
*/
|
|
47
54
|
connectionQuality?: ConnectionQuality;
|
|
55
|
+
/**
|
|
56
|
+
* An agent in the call (server docs/AGENTS_IN_CALLS.md): show it with
|
|
57
|
+
* the Agent badge, named `agentLabel` — never as a person, never with
|
|
58
|
+
* a camera placeholder. Absent for people and before 3.10.
|
|
59
|
+
*/
|
|
60
|
+
isAgent?: boolean;
|
|
61
|
+
/** "Scout", or "Jasir's agent" for one attending on someone's behalf. */
|
|
62
|
+
agentLabel?: string | null;
|
|
63
|
+
/** `notetaker` (silent) | `assistant` (answers when named) | `delegate`. */
|
|
64
|
+
agentMode?: 'notetaker' | 'assistant' | 'delegate' | null;
|
|
48
65
|
}>;
|
|
49
66
|
/** The kind of output playing now — the short answer to "where is the audio". */
|
|
50
67
|
audioRoute: AudioOutputKind;
|
|
@@ -115,6 +132,38 @@ interface Snapshot {
|
|
|
115
132
|
recording?: CallRecordingState | null;
|
|
116
133
|
/** The live transcript's state, the same way (`transcript:*` on the socket). Absent before 3.9. */
|
|
117
134
|
transcription?: CallTranscriptionState | null;
|
|
135
|
+
/**
|
|
136
|
+
* `meeting`: a scheduled meeting rang this device as it started (the
|
|
137
|
+
* push's `ring_type`), so the ring reads "Weekly sync is starting" and
|
|
138
|
+
* the call screen should name the meeting. `call` otherwise. Absent
|
|
139
|
+
* before 3.10.
|
|
140
|
+
*/
|
|
141
|
+
ringType?: 'call' | 'meeting';
|
|
142
|
+
/** The meeting's title for a `meeting` ring; null otherwise. Absent before 3.10. */
|
|
143
|
+
meetingTitle?: string | null;
|
|
144
|
+
/** Noise suppression on the microphone (on by default; `setNoiseSuppression`). Absent before 3.10. */
|
|
145
|
+
noiseSuppression?: boolean;
|
|
146
|
+
/** Background blur on the camera (`setBackgroundBlur`). Absent before 3.10. */
|
|
147
|
+
backgroundBlur?: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* This call was taken over by your other device (`moveCallHere`
|
|
150
|
+
* there); the end that follows has `reason: 'moved'`. Absent before 3.10.
|
|
151
|
+
*/
|
|
152
|
+
movedElsewhere?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* The breakout room the call's media is in (`moveToRoom`,
|
|
155
|
+
* MEETINGS.md §5); null in the call's main room. `roomId` is the
|
|
156
|
+
* split's `<split id>.<n>`. Absent before 3.11.
|
|
157
|
+
*/
|
|
158
|
+
breakout?: {
|
|
159
|
+
roomId: string;
|
|
160
|
+
name: string | null;
|
|
161
|
+
} | null;
|
|
162
|
+
/**
|
|
163
|
+
* Your own identity in the media room — your poolse user id — once
|
|
164
|
+
* connected; what `callData.getSelfId()` answers. Absent before 3.11.
|
|
165
|
+
*/
|
|
166
|
+
selfIdentity?: string | null;
|
|
118
167
|
}
|
|
119
168
|
/** The CallSummary's `recording` object, as the server sent it (docs/CALL_CONTRACT.md §4.2). */
|
|
120
169
|
interface CallRecordingState {
|
|
@@ -156,6 +205,10 @@ interface WaitingCall {
|
|
|
156
205
|
serverId?: string | null;
|
|
157
206
|
/** That workspace's name ("Ana · Acme"). Absent before 3.8. */
|
|
158
207
|
workspaceName?: string | null;
|
|
208
|
+
/** `meeting` when a scheduled meeting is starting rather than a person calling. Absent before 3.10. */
|
|
209
|
+
ringType?: 'call' | 'meeting';
|
|
210
|
+
/** The meeting's title for a `meeting` ring. Absent before 3.10. */
|
|
211
|
+
meetingTitle?: string | null;
|
|
159
212
|
}
|
|
160
213
|
/** One place call audio can play. */
|
|
161
214
|
interface AudioOutput {
|
|
@@ -262,33 +315,46 @@ interface CallServer {
|
|
|
262
315
|
name?: string;
|
|
263
316
|
}
|
|
264
317
|
/**
|
|
265
|
-
* What the user tapped on a missed-call notification: the
|
|
266
|
-
* itself (`open` the conversation)
|
|
267
|
-
* — place a call on the conversation with `media`)
|
|
318
|
+
* What the user tapped on a missed-call or meeting notification: the
|
|
319
|
+
* notification itself (`open` the conversation), a missed call's Call
|
|
320
|
+
* back (`call_back` — place a call on the conversation with `media`), or
|
|
321
|
+
* a starting meeting's Join (`join_meeting` — join the room `callId` in
|
|
322
|
+
* the conversation, e.g. `poolse.rooms.start(conversationId, media)`,
|
|
323
|
+
* which joins what is live).
|
|
268
324
|
*/
|
|
269
325
|
interface CallAction {
|
|
270
|
-
type: 'open' | 'call_back';
|
|
326
|
+
type: 'open' | 'call_back' | 'join_meeting';
|
|
271
327
|
conversationId: string;
|
|
272
328
|
callId: string | null;
|
|
273
329
|
media: 'audio' | 'video';
|
|
274
330
|
/** The server (workspace) it belongs to — open that one. Absent before 3.8. */
|
|
275
331
|
serverId?: string | null;
|
|
332
|
+
/** A meeting notice's scheduled meeting; null for missed calls. Absent before 3.10. */
|
|
333
|
+
scheduledMeetingId?: string | null;
|
|
276
334
|
}
|
|
277
335
|
/**
|
|
278
|
-
* A Reply or Mark as read the user did from a chat notification
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
336
|
+
* A Reply or Mark as read the user did from a chat notification — or an
|
|
337
|
+
* answer to an agent's question (`escalation`: Approve / Decline / Answer
|
|
338
|
+
* on an `agent_escalation` push) — after the native core sent it (or gave
|
|
339
|
+
* up). The server has already posted the reply and marked the
|
|
340
|
+
* conversation read, or passed the answer to the agent in the call; use
|
|
341
|
+
* this to refresh what the app shows without waiting for the socket, or
|
|
342
|
+
* to tell the user it did not go out.
|
|
283
343
|
*/
|
|
284
344
|
interface NotificationActionResult {
|
|
285
|
-
action: 'reply' | 'mark_read';
|
|
345
|
+
action: 'reply' | 'mark_read' | 'escalation';
|
|
346
|
+
/** The conversation (for `escalation`: the call's; `""` when the push had none). */
|
|
286
347
|
conversationId: string;
|
|
348
|
+
/** `escalation` only: which question, and how it was answered. Absent before 3.10. */
|
|
349
|
+
escalationId?: string;
|
|
350
|
+
decision?: 'approve' | 'decline' | 'answer';
|
|
351
|
+
/** `escalation` only: the call the agent is in. */
|
|
352
|
+
callId?: string | null;
|
|
287
353
|
/** The server (workspace) the conversation is on. Absent before 3.8. */
|
|
288
354
|
serverId?: string;
|
|
289
355
|
/** Whether the server accepted it. */
|
|
290
356
|
ok: boolean;
|
|
291
|
-
/** Reply
|
|
357
|
+
/** Reply (and an escalation's `answer`): what the user typed. */
|
|
292
358
|
text?: string;
|
|
293
359
|
/** Reply only: the idempotency id sent with it — the message's id once posted. */
|
|
294
360
|
clientId?: string;
|
|
@@ -299,7 +365,8 @@ interface NotificationActionResult {
|
|
|
299
365
|
* `device_signed_out`, `user_blocked`, `forbidden`, `not_found`,
|
|
300
366
|
* `mau_cap_exceeded`, `validation_failed`, `rate_limited`), or
|
|
301
367
|
* `network`, `no_grant` (the push carried no reply grant),
|
|
302
|
-
* `not_configured` (never `configure`d), `http_<status>`.
|
|
368
|
+
* `not_configured` (never `configure`d), `http_<status>`. An
|
|
369
|
+
* escalation: `not_pending`, `expired`, `invalid_token`, `no_token`.
|
|
303
370
|
*/
|
|
304
371
|
error?: string;
|
|
305
372
|
/** The HTTP status when the server answered with an error. */
|
|
@@ -351,6 +418,25 @@ declare function onCallState(cb: (snapshot: Snapshot | null) => void): Unsubscri
|
|
|
351
418
|
declare function place(conversationId: string, options: PlaceOptions): Promise<void>;
|
|
352
419
|
/** `serverId`: the server the session token is for — leave it out for the default one. */
|
|
353
420
|
declare function join(callId: string, conversationId: string | null, sessionToken: string, serverId?: string): Promise<void>;
|
|
421
|
+
/** What {@link moveCallHere} needs besides the call id. */
|
|
422
|
+
interface MoveCallOptions {
|
|
423
|
+
conversationId: string;
|
|
424
|
+
/** The user's session token on the call's server. */
|
|
425
|
+
sessionToken: string;
|
|
426
|
+
/** The call's server (an `addServer` id); leave it out for the default one. */
|
|
427
|
+
serverId?: string;
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* "Move call to this device" (CL11): take a call you are on elsewhere
|
|
431
|
+
* — your desktop, your other phone — over to this one without hanging
|
|
432
|
+
* up. This device joins the same call; the server lets one device per
|
|
433
|
+
* person carry it (CALL_CONTRACT.md §9), so the other one is let go and
|
|
434
|
+
* its snapshot ends with `reason: 'moved'`. Offer it from the Join
|
|
435
|
+
* banner when `liveCalls` says you are already in the call.
|
|
436
|
+
*
|
|
437
|
+
* The camera follows the call's media on this device; mute starts off.
|
|
438
|
+
*/
|
|
439
|
+
declare function moveCallHere(callId: string, options: MoveCallOptions): Promise<void>;
|
|
354
440
|
interface StartRoomResult {
|
|
355
441
|
/** The room's call id — what the Join banner and `call:*` events carry. */
|
|
356
442
|
callId: string;
|
|
@@ -419,6 +505,33 @@ declare const screenShareSupported: () => boolean;
|
|
|
419
505
|
*/
|
|
420
506
|
declare const startScreenShare: () => Promise<boolean>;
|
|
421
507
|
declare const stopScreenShare: () => void;
|
|
508
|
+
/**
|
|
509
|
+
* Whether noise suppression can be switched. On by default on both
|
|
510
|
+
* platforms; the snapshot's `noiseSuppression` says what is in effect.
|
|
511
|
+
*/
|
|
512
|
+
declare const noiseSuppressionSupported: () => boolean;
|
|
513
|
+
/**
|
|
514
|
+
* Noise suppression on or off, for this and later calls (until the app
|
|
515
|
+
* restarts). Android: WebRTC's noise suppression on the microphone
|
|
516
|
+
* (echo cancellation stays on; the mic track is republished, a short
|
|
517
|
+
* gap). iOS: Apple's voice processing does echo cancellation and noise
|
|
518
|
+
* suppression as one, so off bypasses both — offer "off" for
|
|
519
|
+
* headphones only. Returns false when the build can't.
|
|
520
|
+
*/
|
|
521
|
+
declare const setNoiseSuppression: (on: boolean) => boolean;
|
|
522
|
+
/**
|
|
523
|
+
* Whether this build can blur the background behind you. iOS 15+: yes
|
|
524
|
+
* (Vision person segmentation). Android: not yet — it needs an ML Kit
|
|
525
|
+
* segmentation model, planned as a later addition. Hide the toggle when
|
|
526
|
+
* false.
|
|
527
|
+
*/
|
|
528
|
+
declare const backgroundBlurSupported: () => boolean;
|
|
529
|
+
/**
|
|
530
|
+
* Blur the background on your camera, kept across camera flips and
|
|
531
|
+
* calls. A no-op returning false where unsupported. Background
|
|
532
|
+
* pictures (replacement) are not offered on native yet.
|
|
533
|
+
*/
|
|
534
|
+
declare const setBackgroundBlur: (on: boolean) => boolean;
|
|
422
535
|
/** Route call audio to the loudspeaker (`true`) or back to earpiece / headset (`false`). */
|
|
423
536
|
declare const setSpeaker: (on: boolean) => void;
|
|
424
537
|
/**
|
|
@@ -471,18 +584,22 @@ declare const openFullScreenIntentSettings: () => void;
|
|
|
471
584
|
*/
|
|
472
585
|
declare function setShowOnLockscreen(enabled: boolean): void;
|
|
473
586
|
/**
|
|
474
|
-
*
|
|
475
|
-
*
|
|
476
|
-
* way. The native core posts that notification itself from the push,
|
|
477
|
-
* so it works with the app closed.
|
|
587
|
+
* The notification action the app was LAUNCHED with, once — read it on
|
|
588
|
+
* mount. `null` when the app opened any other way.
|
|
478
589
|
*
|
|
479
|
-
*
|
|
480
|
-
*
|
|
481
|
-
*
|
|
590
|
+
* Android: missed calls and meeting notices (`starting` with Join, and
|
|
591
|
+
* the brief; server docs/MEETINGS.md §11.3), both posted by the native
|
|
592
|
+
* core from the push so they work with the app closed.
|
|
593
|
+
*
|
|
594
|
+
* iOS: meeting notices (the alert push's category `poolse_meeting`, Join
|
|
595
|
+
* `poolse_meeting_join`), whose tap and Join arrive here as `open` /
|
|
596
|
+
* `join_meeting`. Missed calls there are an ordinary alert push (to the
|
|
597
|
+
* token you register with `kind: 'alert'`); read its taps with your
|
|
598
|
+
* notification library — its `type` is `call_missed`, the category
|
|
482
599
|
* `poolse_missed_call`, the Call back action `call_back`.
|
|
483
600
|
*/
|
|
484
601
|
declare function takeCallAction(): CallAction | null;
|
|
485
|
-
/**
|
|
602
|
+
/** A missed-call (Android) or meeting notification (both) tapped while the app is running. */
|
|
486
603
|
declare function onCallAction(cb: (action: CallAction) => void): Unsubscribe;
|
|
487
604
|
/**
|
|
488
605
|
* Tell the core which conversation is on screen (`null` when none, and
|
|
@@ -517,6 +634,13 @@ declare function conversationOfNotification(data: Record<string, unknown> | unde
|
|
|
517
634
|
declare function onNotificationAction(cb: (result: NotificationActionResult) => void): Unsubscribe;
|
|
518
635
|
/** `onNotificationAction`, replies only. */
|
|
519
636
|
declare function onNotificationReply(cb: (result: NotificationActionResult) => void): Unsubscribe;
|
|
637
|
+
/**
|
|
638
|
+
* `onNotificationAction`, agent escalations only (AG16): Approve / Decline
|
|
639
|
+
* / Answer on an `agent_escalation` push, answered natively from the lock
|
|
640
|
+
* screen. Feed `ok` ones to `poolse.escalations.list()` (or let
|
|
641
|
+
* `agent:escalation` do it) so an open card updates.
|
|
642
|
+
*/
|
|
643
|
+
declare function onEscalationAction(cb: (result: NotificationActionResult) => void): Unsubscribe;
|
|
520
644
|
/**
|
|
521
645
|
* The notification actions that finished while no `onNotificationAction`
|
|
522
646
|
* listener was attached (usually: the app was not running), oldest
|
|
@@ -548,6 +672,100 @@ declare function isInPictureInPicture(): boolean;
|
|
|
548
672
|
declare function pictureInPictureSupported(): boolean;
|
|
549
673
|
/** Fires when the floating window opens (`true`) and closes (`false`). */
|
|
550
674
|
declare function onPictureInPicture(cb: (active: boolean) => void): Unsubscribe;
|
|
675
|
+
/**
|
|
676
|
+
* The most one data-channel message may carry, in bytes — the same cap
|
|
677
|
+
* as the web SDK's `CALL_DATA_MAX_BYTES`, under LiveKit's ~15 KiB packet.
|
|
678
|
+
*/
|
|
679
|
+
declare const CALL_DATA_MAX_BYTES = 14000;
|
|
680
|
+
/** One message from someone in the call's room. */
|
|
681
|
+
interface CallDataMessage {
|
|
682
|
+
topic: string;
|
|
683
|
+
/** The bytes, base64. */
|
|
684
|
+
payload: string;
|
|
685
|
+
/** The bytes as UTF-8 text; null when they are not text. */
|
|
686
|
+
text: string | null;
|
|
687
|
+
/** Who sent it (their poolse user id); null when the server did. */
|
|
688
|
+
fromIdentity: string | null;
|
|
689
|
+
fromName: string | null;
|
|
690
|
+
}
|
|
691
|
+
interface PublishDataOptions {
|
|
692
|
+
/** Default true. `false` for what is stale a moment later (a moving pointer). */
|
|
693
|
+
reliable?: boolean;
|
|
694
|
+
/** `data` is base64 bytes rather than text. */
|
|
695
|
+
base64?: boolean;
|
|
696
|
+
/** Only these people (poolse user ids); everyone in the room when left out. */
|
|
697
|
+
to?: string[];
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* Send `data` under `topic` to everyone in the call's room over LiveKit's
|
|
701
|
+
* data channel, through the SFU, never stored (CL4, CL6). Web, desktop
|
|
702
|
+
* and phones share topics and formats: `poolse.reaction`,
|
|
703
|
+
* `poolse.annotate` (see {@link callData} for JSON). Resolves false with
|
|
704
|
+
* no call connected, over {@link CALL_DATA_MAX_BYTES}, or on a build
|
|
705
|
+
* without it.
|
|
706
|
+
*/
|
|
707
|
+
declare function publishData(topic: string, data: string, options?: PublishDataOptions): Promise<boolean>;
|
|
708
|
+
/** Every data-channel message others send in the call's room (yours are not echoed). */
|
|
709
|
+
declare function onCallData(cb: (message: CallDataMessage) => void): Unsubscribe;
|
|
710
|
+
type DataListener = (message: unknown, from: {
|
|
711
|
+
userId: string | null;
|
|
712
|
+
name: string | null;
|
|
713
|
+
}) => void;
|
|
714
|
+
/**
|
|
715
|
+
* The native call's data channel in the shape @poolse/sdk's
|
|
716
|
+
* `CallDataChannel` takes — JSON messages by topic — so the SDK's
|
|
717
|
+
* `CallReactions` and `ScreenAnnotations` (and @poolse/react's
|
|
718
|
+
* `useCallReactions` / `useScreenAnnotations`) run on phones exactly as
|
|
719
|
+
* on the web and desktop, and interoperate with them:
|
|
720
|
+
*
|
|
721
|
+
* import { callData } from '@poolse/native';
|
|
722
|
+
* const { reactions, send } = useCallReactions(callData);
|
|
723
|
+
* const { state } = useScreenAnnotations(callData, sharerUserId);
|
|
724
|
+
* <AnnotationOverlay state={state} />
|
|
725
|
+
*
|
|
726
|
+
* One process-wide object; it follows whichever call is live.
|
|
727
|
+
*/
|
|
728
|
+
declare const callData: {
|
|
729
|
+
getSelfId(): string | null;
|
|
730
|
+
sendData(topic: string, message: unknown, opts?: {
|
|
731
|
+
reliable?: boolean;
|
|
732
|
+
to?: string[];
|
|
733
|
+
}): Promise<boolean>;
|
|
734
|
+
onData(topic: string, fn: DataListener): Unsubscribe;
|
|
735
|
+
};
|
|
736
|
+
/**
|
|
737
|
+
* What {@link moveToRoom} takes: the session bundle `POST
|
|
738
|
+
* /v1/breakouts/:room/join` or `POST /v1/calls/:id/breakouts/return`
|
|
739
|
+
* answers with (@poolse/sdk's `meetingsLive.breakouts.join` /
|
|
740
|
+
* `returnToMain`), or its JSON text.
|
|
741
|
+
*/
|
|
742
|
+
interface RoomSessionBundle {
|
|
743
|
+
call: {
|
|
744
|
+
id: string;
|
|
745
|
+
};
|
|
746
|
+
livekit: {
|
|
747
|
+
url: string;
|
|
748
|
+
token: string;
|
|
749
|
+
};
|
|
750
|
+
control_token: string;
|
|
751
|
+
breakout?: {
|
|
752
|
+
room_id: string;
|
|
753
|
+
name: string | null;
|
|
754
|
+
} | null;
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* Breakout rooms (MEETINGS.md §5): move the call you are on into another
|
|
758
|
+
* of its rooms — your breakout room, or back to the main room — without
|
|
759
|
+
* hanging up. CallKit / the Android call service keep the call; only
|
|
760
|
+
* the media swaps rooms, mute and camera as they were, and
|
|
761
|
+
* `snapshot.breakout` says where you are. If the new room can't be
|
|
762
|
+
* joined, the media goes back to the room it came from.
|
|
763
|
+
*
|
|
764
|
+
* Resolves false with no call connected (or still connecting), for
|
|
765
|
+
* another call's session, or on a build without it. @poolse/react-native's
|
|
766
|
+
* `useNativeBreakouts` does this for you as the split opens and closes.
|
|
767
|
+
*/
|
|
768
|
+
declare function moveToRoom(session: RoomSessionBundle | string): Promise<boolean>;
|
|
551
769
|
interface CallVideoViewProps extends ViewProps {
|
|
552
770
|
/** Remote participant's userId (LiveKit identity). Omit with local=true for self view. */
|
|
553
771
|
participantId?: string;
|
|
@@ -576,4 +794,4 @@ interface CallVideoViewProps extends ViewProps {
|
|
|
576
794
|
*/
|
|
577
795
|
declare function CallVideoView(props: CallVideoViewProps): ReactElement | null;
|
|
578
796
|
|
|
579
|
-
export { type AudioOutput, type AudioOutputKind, type CallAction, type CallRecordingState, type CallServer, type CallTranscriptionState, CallVideoView, type CallVideoViewProps, type ConfigureOptions, type ConnectionQuality, DEFAULT_SERVER_ID, type IncomingCallOptions, type NotificationActionResult, type PlaceOptions, type RingIntoCallOptions, type Snapshot, type StartRoomResult, type Unsubscribe, type VoipToken, type WaitingCall, addServer, answer, answerWaiting, canUseFullScreenIntent, configure, conversationOfNotification, decline, declineWaiting, getCallState, getVoipToken, hangUp, isInPictureInPicture, join, listServers, nativeCallsAvailable, onCallAction, onCallFinished, onCallState, onCanPublishChange, onNotificationAction, onNotificationReply, onPictureInPicture, onRingEnded, onVoipToken, openFullScreenIntentSettings, pictureInPictureSupported, place, removeServer, republish, ringIntoCall, screenShareSupported, serverOfNotification, setActiveConversation, setAudioOutput, setCamera, setMuted, setPictureInPictureEnabled, setShowOnLockscreen, setSpeaker, shouldPresentMessage, startRoom, startScreenShare, stopScreenShare, switchCamera, takeCallAction, takeNotificationActions };
|
|
797
|
+
export { type AudioOutput, type AudioOutputKind, CALL_DATA_MAX_BYTES, type CallAction, type CallDataMessage, type CallRecordingState, type CallServer, type CallTranscriptionState, CallVideoView, type CallVideoViewProps, type ConfigureOptions, type ConnectionQuality, DEFAULT_SERVER_ID, type IncomingCallOptions, type MoveCallOptions, type NotificationActionResult, type PlaceOptions, type PublishDataOptions, type RingIntoCallOptions, type RoomSessionBundle, type Snapshot, type StartRoomResult, type Unsubscribe, type VoipToken, type WaitingCall, addServer, answer, answerWaiting, backgroundBlurSupported, callData, canUseFullScreenIntent, configure, conversationOfNotification, decline, declineWaiting, getCallState, getVoipToken, hangUp, isInPictureInPicture, join, listServers, moveCallHere, moveToRoom, nativeCallsAvailable, noiseSuppressionSupported, onCallAction, onCallData, onCallFinished, onCallState, onCanPublishChange, onEscalationAction, onNotificationAction, onNotificationReply, onPictureInPicture, onRingEnded, onVoipToken, openFullScreenIntentSettings, pictureInPictureSupported, place, publishData, removeServer, republish, ringIntoCall, screenShareSupported, serverOfNotification, setActiveConversation, setAudioOutput, setBackgroundBlur, setCamera, setMuted, setNoiseSuppression, setPictureInPictureEnabled, setShowOnLockscreen, setSpeaker, shouldPresentMessage, startRoom, startScreenShare, stopScreenShare, switchCamera, takeCallAction, takeNotificationActions };
|
package/dist/index.js
CHANGED
|
@@ -61,6 +61,9 @@ function place(conversationId, options) {
|
|
|
61
61
|
function join(callId, conversationId, sessionToken, serverId) {
|
|
62
62
|
return native?.join(callId, conversationId, sessionToken, serverId ?? null) ?? Promise.resolve();
|
|
63
63
|
}
|
|
64
|
+
function moveCallHere(callId, options) {
|
|
65
|
+
return join(callId, options.conversationId, options.sessionToken, options.serverId);
|
|
66
|
+
}
|
|
64
67
|
async function startRoom(conversationId, options) {
|
|
65
68
|
if (!native) throw new Error("The native call core is not in this build.");
|
|
66
69
|
const origin = originOf(options.serverId);
|
|
@@ -113,6 +116,10 @@ var switchCamera = () => native?.switchCamera();
|
|
|
113
116
|
var screenShareSupported = () => native?.screenShareSupported?.() ?? false;
|
|
114
117
|
var startScreenShare = async () => await native?.startScreenShare?.() ?? false;
|
|
115
118
|
var stopScreenShare = () => native?.stopScreenShare?.();
|
|
119
|
+
var noiseSuppressionSupported = () => native?.noiseSuppressionSupported?.() ?? false;
|
|
120
|
+
var setNoiseSuppression = (on) => native?.setNoiseSuppression?.(on) ?? false;
|
|
121
|
+
var backgroundBlurSupported = () => native?.backgroundBlurSupported?.() ?? false;
|
|
122
|
+
var setBackgroundBlur = (on) => native?.setBackgroundBlur?.(on) ?? false;
|
|
116
123
|
var setSpeaker = (on) => native?.setSpeaker(on);
|
|
117
124
|
function setAudioOutput(id) {
|
|
118
125
|
if (native?.setAudioOutput) native.setAudioOutput(id);
|
|
@@ -185,6 +192,11 @@ function onNotificationReply(cb) {
|
|
|
185
192
|
if (result.action === "reply") cb(result);
|
|
186
193
|
});
|
|
187
194
|
}
|
|
195
|
+
function onEscalationAction(cb) {
|
|
196
|
+
return onNotificationAction((result) => {
|
|
197
|
+
if (result.action === "escalation") cb(result);
|
|
198
|
+
});
|
|
199
|
+
}
|
|
188
200
|
function takeNotificationActions() {
|
|
189
201
|
return native?.takeNotificationActions?.() ?? [];
|
|
190
202
|
}
|
|
@@ -210,6 +222,91 @@ function onPictureInPicture(cb) {
|
|
|
210
222
|
const sub = native.addListener("onPictureInPicture", (payload) => cb(payload.active));
|
|
211
223
|
return () => sub.remove();
|
|
212
224
|
}
|
|
225
|
+
var CALL_DATA_MAX_BYTES = 14e3;
|
|
226
|
+
function utf8Length(s) {
|
|
227
|
+
let n = 0;
|
|
228
|
+
for (let i = 0; i < s.length; i++) {
|
|
229
|
+
const c = s.charCodeAt(i);
|
|
230
|
+
if (c < 128) n += 1;
|
|
231
|
+
else if (c < 2048) n += 2;
|
|
232
|
+
else if (c >= 55296 && c <= 56319 && i + 1 < s.length) {
|
|
233
|
+
n += 4;
|
|
234
|
+
i++;
|
|
235
|
+
} else n += 3;
|
|
236
|
+
}
|
|
237
|
+
return n;
|
|
238
|
+
}
|
|
239
|
+
async function publishData(topic, data, options = {}) {
|
|
240
|
+
if (!native?.publishData || !topic) return false;
|
|
241
|
+
const size = options.base64 ? Math.floor(data.length * 3 / 4) : utf8Length(data);
|
|
242
|
+
if (size > CALL_DATA_MAX_BYTES) return false;
|
|
243
|
+
try {
|
|
244
|
+
return await native.publishData(topic, data, {
|
|
245
|
+
reliable: options.reliable ?? true,
|
|
246
|
+
base64: options.base64 ?? false,
|
|
247
|
+
...options.to ? { to: options.to } : {}
|
|
248
|
+
});
|
|
249
|
+
} catch {
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
function onCallData(cb) {
|
|
254
|
+
if (!native?.publishData) return () => void 0;
|
|
255
|
+
const sub = native.addListener("onCallData", cb);
|
|
256
|
+
return () => sub.remove();
|
|
257
|
+
}
|
|
258
|
+
var dataListeners = /* @__PURE__ */ new Map();
|
|
259
|
+
var dataSub = null;
|
|
260
|
+
var callData = {
|
|
261
|
+
getSelfId() {
|
|
262
|
+
return getCallState()?.selfIdentity ?? null;
|
|
263
|
+
},
|
|
264
|
+
sendData(topic, message, opts = {}) {
|
|
265
|
+
let text;
|
|
266
|
+
try {
|
|
267
|
+
text = JSON.stringify(message);
|
|
268
|
+
} catch {
|
|
269
|
+
return Promise.resolve(false);
|
|
270
|
+
}
|
|
271
|
+
return publishData(topic, text, opts);
|
|
272
|
+
},
|
|
273
|
+
onData(topic, fn) {
|
|
274
|
+
let set = dataListeners.get(topic);
|
|
275
|
+
if (!set) {
|
|
276
|
+
set = /* @__PURE__ */ new Set();
|
|
277
|
+
dataListeners.set(topic, set);
|
|
278
|
+
}
|
|
279
|
+
set.add(fn);
|
|
280
|
+
dataSub ??= onCallData((m) => {
|
|
281
|
+
const listeners = dataListeners.get(m.topic);
|
|
282
|
+
if (!listeners?.size || m.text == null) return;
|
|
283
|
+
let parsed;
|
|
284
|
+
try {
|
|
285
|
+
parsed = JSON.parse(m.text);
|
|
286
|
+
} catch {
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
const from = { userId: m.fromIdentity, name: m.fromName };
|
|
290
|
+
for (const l of [...listeners]) l(parsed, from);
|
|
291
|
+
});
|
|
292
|
+
return () => {
|
|
293
|
+
set.delete(fn);
|
|
294
|
+
if (set.size === 0) dataListeners.delete(topic);
|
|
295
|
+
if (dataListeners.size === 0 && dataSub) {
|
|
296
|
+
dataSub();
|
|
297
|
+
dataSub = null;
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
async function moveToRoom(session) {
|
|
303
|
+
if (!native?.moveToRoom) return false;
|
|
304
|
+
try {
|
|
305
|
+
return await native.moveToRoom(typeof session === "string" ? session : JSON.stringify(session));
|
|
306
|
+
} catch {
|
|
307
|
+
return false;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
213
310
|
var nativeVideo;
|
|
214
311
|
function nativeVideoView() {
|
|
215
312
|
if (nativeVideo !== void 0) return nativeVideo;
|
|
@@ -240,6 +337,6 @@ function CallVideoView(props) {
|
|
|
240
337
|
return createElement(Native, props);
|
|
241
338
|
}
|
|
242
339
|
|
|
243
|
-
export { CallVideoView, DEFAULT_SERVER_ID, addServer, answer, answerWaiting, canUseFullScreenIntent, configure, conversationOfNotification, decline, declineWaiting, getCallState, getVoipToken, hangUp, isInPictureInPicture, join, listServers, nativeCallsAvailable, onCallAction, onCallFinished, onCallState, onCanPublishChange, onNotificationAction, onNotificationReply, onPictureInPicture, onRingEnded, onVoipToken, openFullScreenIntentSettings, pictureInPictureSupported, place, removeServer, republish, ringIntoCall, screenShareSupported, serverOfNotification, setActiveConversation, setAudioOutput, setCamera, setMuted, setPictureInPictureEnabled, setShowOnLockscreen, setSpeaker, shouldPresentMessage, startRoom, startScreenShare, stopScreenShare, switchCamera, takeCallAction, takeNotificationActions };
|
|
340
|
+
export { CALL_DATA_MAX_BYTES, CallVideoView, DEFAULT_SERVER_ID, addServer, answer, answerWaiting, backgroundBlurSupported, callData, canUseFullScreenIntent, configure, conversationOfNotification, decline, declineWaiting, getCallState, getVoipToken, hangUp, isInPictureInPicture, join, listServers, moveCallHere, moveToRoom, nativeCallsAvailable, noiseSuppressionSupported, onCallAction, onCallData, onCallFinished, onCallState, onCanPublishChange, onEscalationAction, onNotificationAction, onNotificationReply, onPictureInPicture, onRingEnded, onVoipToken, openFullScreenIntentSettings, pictureInPictureSupported, place, publishData, removeServer, republish, ringIntoCall, screenShareSupported, serverOfNotification, setActiveConversation, setAudioOutput, setBackgroundBlur, setCamera, setMuted, setNoiseSuppression, setPictureInPictureEnabled, setShowOnLockscreen, setSpeaker, shouldPresentMessage, startRoom, startScreenShare, stopScreenShare, switchCamera, takeCallAction, takeNotificationActions };
|
|
244
341
|
//# sourceMappingURL=index.js.map
|
|
245
342
|
//# sourceMappingURL=index.js.map
|