add allowJoinUnmutedViaIntent to the bridge

This allows us to control to never start unmuted in spa but be able to
start unmuted in widget and component mode.
This commit is contained in:
Timo K.
2026-09-08 18:12:40 +02:00
parent 486ecbfda0
commit 273ee3b632
7 changed files with 79 additions and 23 deletions
+15
View File
@@ -54,6 +54,21 @@ describe("useComponentHostBridge", () => {
}),
).resolves.toBeUndefined();
expect(result.current.supportsReactions).toBe(true);
// Starting the user unmuted unasked is something a host has to opt into
expect(result.current.allowJoinUnmutedViaIntent).toBe(false);
});
test("lets the host allow joining unmuted on the intent", () => {
const { result, rerender } = renderHook(
({ supplied }: { supplied: ElementCallHostBridge }) =>
useComponentHostBridge(supplied, undefined, undefined),
{ initialProps: { supplied: {} } },
);
expect(result.current.allowJoinUnmutedViaIntent).toBe(false);
// Read through to whatever the host most recently said
rerender({ supplied: { allowJoinUnmutedViaIntent: true } });
expect(result.current.allowJoinUnmutedViaIntent).toBe(true);
});
test("only has a close when the host has one, since that is a signal", () => {