@poolse/react 2.4.1 → 2.6.0
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/dist/index.cjs +30 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -4
- package/dist/index.d.ts +11 -4
- package/dist/index.js +30 -22
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -553,10 +553,17 @@ interface UseCalls {
|
|
|
553
553
|
error: Error | null;
|
|
554
554
|
/** Ring every other member of a conversation. */
|
|
555
555
|
call: (conversationId: string) => Promise<void>;
|
|
556
|
-
/**
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
556
|
+
/**
|
|
557
|
+
* Answer the inbound ring.
|
|
558
|
+
*
|
|
559
|
+
* Pass the call explicitly when it didn't arrive over the socket — a
|
|
560
|
+
* VoIP push can launch the app cold, in which case this hook has no
|
|
561
|
+
* `incoming` state and the push payload is the only source of truth.
|
|
562
|
+
*/
|
|
563
|
+
accept: (call?: IncomingCall) => Promise<void>;
|
|
564
|
+
/** Reject the inbound ring. Takes an explicit call for the same
|
|
565
|
+
* cold-launch reason as {@link accept}. */
|
|
566
|
+
decline: (call?: IncomingCall) => Promise<void>;
|
|
560
567
|
/** Hang up an outbound ring before it's answered. */
|
|
561
568
|
cancel: () => Promise<void>;
|
|
562
569
|
/** Drop back to idle — call after leaving the room, or to clear a
|
package/dist/index.d.ts
CHANGED
|
@@ -553,10 +553,17 @@ interface UseCalls {
|
|
|
553
553
|
error: Error | null;
|
|
554
554
|
/** Ring every other member of a conversation. */
|
|
555
555
|
call: (conversationId: string) => Promise<void>;
|
|
556
|
-
/**
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
556
|
+
/**
|
|
557
|
+
* Answer the inbound ring.
|
|
558
|
+
*
|
|
559
|
+
* Pass the call explicitly when it didn't arrive over the socket — a
|
|
560
|
+
* VoIP push can launch the app cold, in which case this hook has no
|
|
561
|
+
* `incoming` state and the push payload is the only source of truth.
|
|
562
|
+
*/
|
|
563
|
+
accept: (call?: IncomingCall) => Promise<void>;
|
|
564
|
+
/** Reject the inbound ring. Takes an explicit call for the same
|
|
565
|
+
* cold-launch reason as {@link accept}. */
|
|
566
|
+
decline: (call?: IncomingCall) => Promise<void>;
|
|
560
567
|
/** Hang up an outbound ring before it's answered. */
|
|
561
568
|
cancel: () => Promise<void>;
|
|
562
569
|
/** Drop back to idle — call after leaving the room, or to clear a
|
package/dist/index.js
CHANGED
|
@@ -1176,28 +1176,36 @@ function useCalls(userId, opts = {}) {
|
|
|
1176
1176
|
},
|
|
1177
1177
|
[calls]
|
|
1178
1178
|
);
|
|
1179
|
-
const accept = useCallback(
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1179
|
+
const accept = useCallback(
|
|
1180
|
+
async (call2) => {
|
|
1181
|
+
const target = call2 ?? incoming;
|
|
1182
|
+
if (!calls || !target) return;
|
|
1183
|
+
try {
|
|
1184
|
+
await calls.accept(target);
|
|
1185
|
+
setActiveConversationId(target.conversationId);
|
|
1186
|
+
setPhase("active");
|
|
1187
|
+
setIncoming(null);
|
|
1188
|
+
} catch (err) {
|
|
1189
|
+
setError(err instanceof Error ? err : new Error(String(err)));
|
|
1190
|
+
}
|
|
1191
|
+
},
|
|
1192
|
+
[calls, incoming]
|
|
1193
|
+
);
|
|
1194
|
+
const decline = useCallback(
|
|
1195
|
+
async (call2) => {
|
|
1196
|
+
const target = call2 ?? incoming;
|
|
1197
|
+
if (!calls || !target) return;
|
|
1198
|
+
try {
|
|
1199
|
+
await calls.decline(target);
|
|
1200
|
+
} catch (err) {
|
|
1201
|
+
setError(err instanceof Error ? err : new Error(String(err)));
|
|
1202
|
+
} finally {
|
|
1203
|
+
setIncoming(null);
|
|
1204
|
+
setPhase("idle");
|
|
1205
|
+
}
|
|
1206
|
+
},
|
|
1207
|
+
[calls, incoming]
|
|
1208
|
+
);
|
|
1201
1209
|
const cancel = useCallback(async () => {
|
|
1202
1210
|
if (!calls || !outgoing) return;
|
|
1203
1211
|
try {
|