@openblah/react-native 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +8 -2
- package/dist/audio.d.ts +38 -0
- package/dist/audio.js +35 -0
- package/dist/audio.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/invite.d.ts +25 -0
- package/dist/invite.js +13 -0
- package/dist/invite.js.map +1 -0
- package/dist/key-sheet.d.ts +16 -0
- package/dist/key-sheet.js +37 -0
- package/dist/key-sheet.js.map +1 -0
- package/dist/mcp.d.ts +17 -0
- package/dist/mcp.js +25 -0
- package/dist/mcp.js.map +1 -0
- package/dist/native.d.ts +15 -0
- package/dist/native.js +32 -0
- package/dist/native.js.map +1 -0
- package/dist/room.d.ts +16 -0
- package/dist/room.js +58 -0
- package/dist/room.js.map +1 -0
- package/package.json +55 -3
- package/plugin/index.js +68 -0
- package/plugin/package.json +4 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Daniel Machado Kupfer
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @openblah/react-native
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React Native SDK for OpenBlah voice rooms. 0.x, unstable. Expo dev builds only, not Expo Go.
|
|
4
|
+
|
|
5
|
+
Same API as `@openblah/web`. Setup, audio behaviour and the example app: see [docs/react-native.md](../../docs/react-native.md).
|
|
6
|
+
|
|
7
|
+
## Ready component
|
|
8
|
+
|
|
9
|
+
`<OpenBlahRoom serverUrl token />` from `@openblah/react-native` is the whole call screen: join, mute, participants, agent state, consent, invite, agent control and tool approvals. Theme it with `theme`, reword it with `labels`, leave parts out with `hide` and build them yourself with the hooks. Same props in web and React Native. See [quickstart](../../docs/quickstart.md), [host integration](../../docs/host-integration.md), [API stability](../../docs/sdk-stability.md) and the [API reference](../../docs/api-reference/README.md).
|
package/dist/audio.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Audio session setup for calls. The session category is `playAndRecord` with
|
|
3
|
+
* Bluetooth, so a call keeps running with the screen locked and routes to AirPods.
|
|
4
|
+
* The native session object is injected so the logic is testable without a device.
|
|
5
|
+
*/
|
|
6
|
+
/** The part of `AudioSession` from `@livekit/react-native` that is used here. */
|
|
7
|
+
export interface AudioSessionLike {
|
|
8
|
+
configureAudio(config: {
|
|
9
|
+
android?: {
|
|
10
|
+
audioTypeOptions: unknown;
|
|
11
|
+
preferredOutputList?: string[];
|
|
12
|
+
};
|
|
13
|
+
ios?: {
|
|
14
|
+
defaultOutput?: "speaker" | "earpiece";
|
|
15
|
+
};
|
|
16
|
+
}): Promise<void>;
|
|
17
|
+
startAudioSession(): Promise<void>;
|
|
18
|
+
stopAudioSession(): Promise<void>;
|
|
19
|
+
setAppleAudioConfiguration(config: {
|
|
20
|
+
audioCategory?: string;
|
|
21
|
+
audioCategoryOptions?: string[];
|
|
22
|
+
audioMode?: string;
|
|
23
|
+
}): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
/** Apple audio configuration used for a voice call. */
|
|
26
|
+
export declare const CALL_APPLE_AUDIO: {
|
|
27
|
+
readonly audioCategory: "playAndRecord";
|
|
28
|
+
readonly audioCategoryOptions: readonly ["allowBluetooth", "allowBluetoothA2DP", "defaultToSpeaker"];
|
|
29
|
+
readonly audioMode: "voiceChat";
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Build the `beforeConnect` / `afterDisconnect` pair for `OpenBlahClient`.
|
|
33
|
+
* `platform` is `Platform.OS` from React Native.
|
|
34
|
+
*/
|
|
35
|
+
export declare function createCallAudio(session: AudioSessionLike, platform: string): {
|
|
36
|
+
start(): Promise<void>;
|
|
37
|
+
stop(): Promise<void>;
|
|
38
|
+
};
|
package/dist/audio.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Audio session setup for calls. The session category is `playAndRecord` with
|
|
3
|
+
* Bluetooth, so a call keeps running with the screen locked and routes to AirPods.
|
|
4
|
+
* The native session object is injected so the logic is testable without a device.
|
|
5
|
+
*/
|
|
6
|
+
/** Apple audio configuration used for a voice call. */
|
|
7
|
+
export const CALL_APPLE_AUDIO = {
|
|
8
|
+
audioCategory: "playAndRecord",
|
|
9
|
+
// allowBluetooth: hands-free profile (AirPods mic); allowBluetoothA2DP: high quality output;
|
|
10
|
+
// defaultToSpeaker: loudspeaker unless a headset or Bluetooth device is connected.
|
|
11
|
+
audioCategoryOptions: ["allowBluetooth", "allowBluetoothA2DP", "defaultToSpeaker"],
|
|
12
|
+
audioMode: "voiceChat",
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Build the `beforeConnect` / `afterDisconnect` pair for `OpenBlahClient`.
|
|
16
|
+
* `platform` is `Platform.OS` from React Native.
|
|
17
|
+
*/
|
|
18
|
+
export function createCallAudio(session, platform) {
|
|
19
|
+
return {
|
|
20
|
+
async start() {
|
|
21
|
+
if (platform === "ios") {
|
|
22
|
+
await session.setAppleAudioConfiguration({
|
|
23
|
+
audioCategory: CALL_APPLE_AUDIO.audioCategory,
|
|
24
|
+
audioCategoryOptions: [...CALL_APPLE_AUDIO.audioCategoryOptions],
|
|
25
|
+
audioMode: CALL_APPLE_AUDIO.audioMode,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
await session.startAudioSession();
|
|
29
|
+
},
|
|
30
|
+
async stop() {
|
|
31
|
+
await session.stopAudioSession();
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=audio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audio.js","sourceRoot":"","sources":["../src/audio.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiBH,uDAAuD;AACvD,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,aAAa,EAAE,eAAe;IAC9B,6FAA6F;IAC7F,mFAAmF;IACnF,oBAAoB,EAAE,CAAC,gBAAgB,EAAE,oBAAoB,EAAE,kBAAkB,CAAC;IAClF,SAAS,EAAE,WAAW;CACd,CAAC;AAEX;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,OAAyB,EAAE,QAAgB;IACzE,OAAO;QACL,KAAK,CAAC,KAAK;YACT,IAAI,QAAQ,KAAK,KAAK,EAAE,CAAC;gBACvB,MAAM,OAAO,CAAC,0BAA0B,CAAC;oBACvC,aAAa,EAAE,gBAAgB,CAAC,aAAa;oBAC7C,oBAAoB,EAAE,CAAC,GAAG,gBAAgB,CAAC,oBAAoB,CAAC;oBAChE,SAAS,EAAE,gBAAgB,CAAC,SAAS;iBACtC,CAAC,CAAC;YACL,CAAC;YACD,MAAM,OAAO,CAAC,iBAAiB,EAAE,CAAC;QACpC,CAAC;QACD,KAAK,CAAC,IAAI;YACR,MAAM,OAAO,CAAC,gBAAgB,EAAE,CAAC;QACnC,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @openblah/react-native: React Native SDK for OpenBlah voice rooms. 0.x, unstable.
|
|
3
|
+
* Same client and hooks as `@openblah/web`. Needs an Expo dev build, not Expo Go.
|
|
4
|
+
* @module @openblah/react-native
|
|
5
|
+
*/
|
|
6
|
+
export * from "@openblah/core";
|
|
7
|
+
export * from "@openblah/core/react";
|
|
8
|
+
export { registerOpenBlahGlobals, createOpenBlahClient } from "./native.js";
|
|
9
|
+
export { CALL_APPLE_AUDIO, createCallAudio, type AudioSessionLike } from "./audio.js";
|
|
10
|
+
export { shareInvite, type ShareInviteOptions, type ShareLike } from "./invite.js";
|
|
11
|
+
export { connectMcpInApp, type ConnectMcpInAppOptions } from "./mcp.js";
|
|
12
|
+
export { OpenBlahRoom, type OpenBlahRoomProps } from "./room.js";
|
|
13
|
+
export { OpenBlahAddKeySheet, type OpenBlahAddKeySheetProps } from "./key-sheet.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @openblah/react-native: React Native SDK for OpenBlah voice rooms. 0.x, unstable.
|
|
3
|
+
* Same client and hooks as `@openblah/web`. Needs an Expo dev build, not Expo Go.
|
|
4
|
+
* @module @openblah/react-native
|
|
5
|
+
*/
|
|
6
|
+
export * from "@openblah/core";
|
|
7
|
+
export * from "@openblah/core/react";
|
|
8
|
+
export { registerOpenBlahGlobals, createOpenBlahClient } from "./native.js";
|
|
9
|
+
export { CALL_APPLE_AUDIO, createCallAudio } from "./audio.js";
|
|
10
|
+
export { shareInvite } from "./invite.js";
|
|
11
|
+
export { connectMcpInApp } from "./mcp.js";
|
|
12
|
+
export { OpenBlahRoom } from "./room.js";
|
|
13
|
+
export { OpenBlahAddKeySheet } from "./key-sheet.js";
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAyB,MAAM,YAAY,CAAC;AACtF,OAAO,EAAE,WAAW,EAA2C,MAAM,aAAa,CAAC;AACnF,OAAO,EAAE,eAAe,EAA+B,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,YAAY,EAA0B,MAAM,WAAW,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAiC,MAAM,gBAAgB,CAAC"}
|
package/dist/invite.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { CreateInviteOptions, Invite, OpenBlahClient } from "@openblah/core";
|
|
2
|
+
/** The part of React Native's `Share` used. */
|
|
3
|
+
export interface ShareLike {
|
|
4
|
+
share(content: {
|
|
5
|
+
message: string;
|
|
6
|
+
url?: string;
|
|
7
|
+
}): Promise<{
|
|
8
|
+
action: string;
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
11
|
+
export interface ShareInviteOptions extends CreateInviteOptions {
|
|
12
|
+
/** Text before the link, e.g. "Join my call". Default: "Join my call:". */
|
|
13
|
+
message?: string;
|
|
14
|
+
/** Override the share sheet; mainly for tests. */
|
|
15
|
+
share?: ShareLike;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Mid-call invite for React Native: the host taps Invite, a link is created and the
|
|
19
|
+
* system share sheet opens. Resolves with the invite and whether the host actually
|
|
20
|
+
* shared it (false when the sheet was dismissed: consider revoking the link then).
|
|
21
|
+
*/
|
|
22
|
+
export declare function shareInvite(client: Pick<OpenBlahClient, "createInvite">, options?: ShareInviteOptions): Promise<{
|
|
23
|
+
invite: Invite;
|
|
24
|
+
shared: boolean;
|
|
25
|
+
}>;
|
package/dist/invite.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Share } from "react-native";
|
|
2
|
+
/**
|
|
3
|
+
* Mid-call invite for React Native: the host taps Invite, a link is created and the
|
|
4
|
+
* system share sheet opens. Resolves with the invite and whether the host actually
|
|
5
|
+
* shared it (false when the sheet was dismissed: consider revoking the link then).
|
|
6
|
+
*/
|
|
7
|
+
export async function shareInvite(client, options = {}) {
|
|
8
|
+
const { message = "Join my call:", share = Share, ...inviteOptions } = options;
|
|
9
|
+
const invite = await client.createInvite(inviteOptions);
|
|
10
|
+
const result = await share.share({ message: `${message} ${invite.url}`, url: invite.url });
|
|
11
|
+
return { invite, shared: result.action !== "dismissedAction" };
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=invite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invite.js","sourceRoot":"","sources":["../src/invite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAerC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAA4C,EAC5C,UAA8B,EAAE;IAEhC,MAAM,EAAE,OAAO,GAAG,eAAe,EAAE,KAAK,GAAG,KAAK,EAAE,GAAG,aAAa,EAAE,GAAG,OAAO,CAAC;IAC/E,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IACxD,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,IAAI,MAAM,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;IAC3F,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,KAAK,iBAAiB,EAAE,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type StyleProp, type ViewStyle } from "react-native";
|
|
2
|
+
import { type KeySheetTexts, type OpenBlahTheme, type UseAddKeySheetOptions } from "@openblah/core/react";
|
|
3
|
+
/** Props of the React Native `<OpenBlahAddKeySheet />`. Same as the web component. @public */
|
|
4
|
+
export interface OpenBlahAddKeySheetProps extends UseAddKeySheetOptions {
|
|
5
|
+
theme?: Partial<OpenBlahTheme>;
|
|
6
|
+
/** Partial texts, merged over the English ones. */
|
|
7
|
+
texts?: Partial<KeySheetTexts>;
|
|
8
|
+
style?: StyleProp<ViewStyle>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The add-your-own-key sheet: Gemini first (free key, with the free-tier warning), then OpenAI
|
|
12
|
+
* and Claude. The same flow as the web component and the standalone app. Put it in a `Modal`
|
|
13
|
+
* or a bottom sheet of your choice.
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export declare function OpenBlahAddKeySheet(props: OpenBlahAddKeySheetProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Pressable, ScrollView, Text, TextInput, View, } from "react-native";
|
|
3
|
+
import { defaultKeySheetTexts, resolveTheme, useAddKeySheet, } from "@openblah/core/react";
|
|
4
|
+
/**
|
|
5
|
+
* The add-your-own-key sheet: Gemini first (free key, with the free-tier warning), then OpenAI
|
|
6
|
+
* and Claude. The same flow as the web component and the standalone app. Put it in a `Modal`
|
|
7
|
+
* or a bottom sheet of your choice.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export function OpenBlahAddKeySheet(props) {
|
|
11
|
+
const t = resolveTheme(props.theme);
|
|
12
|
+
const x = { ...defaultKeySheetTexts, ...props.texts };
|
|
13
|
+
const s = useAddKeySheet(props);
|
|
14
|
+
const text = { color: t.text, fontSize: t.fontSize };
|
|
15
|
+
const muted = { color: t.mutedText, fontSize: t.fontSize };
|
|
16
|
+
const btn = (primary, disabled = false) => ({
|
|
17
|
+
backgroundColor: primary ? t.accent : t.surface,
|
|
18
|
+
borderRadius: t.radius,
|
|
19
|
+
paddingVertical: t.spacing,
|
|
20
|
+
paddingHorizontal: t.spacing * 2,
|
|
21
|
+
opacity: disabled ? 0.5 : 1,
|
|
22
|
+
});
|
|
23
|
+
return (_jsxs(ScrollView, { style: [
|
|
24
|
+
{ backgroundColor: t.background, borderRadius: t.radius, padding: t.spacing * 2 },
|
|
25
|
+
props.style,
|
|
26
|
+
], contentContainerStyle: { gap: t.spacing }, children: [_jsx(Text, { style: [text, { fontWeight: "700" }], children: x.title }), s.intro && _jsx(Text, { style: text, children: s.intro }), _jsx(Text, { style: muted, children: x.subscriptionNote }), _jsx(View, { style: { flexDirection: "row", flexWrap: "wrap", gap: t.spacing }, children: s.providers.map((p) => {
|
|
27
|
+
const on = s.selected?.id === p.id;
|
|
28
|
+
return (_jsx(Pressable, { accessibilityRole: "radio", accessibilityState: { selected: on }, onPress: () => s.select(p.id), style: btn(on), children: _jsxs(Text, { style: { color: on ? t.accentText : t.text, fontSize: t.fontSize }, children: [p.label, p.recommended ? " ★" : ""] }) }, p.id));
|
|
29
|
+
}) }), s.selected && _jsx(Text, { style: muted, children: s.selected.copy }), s.showFreeTierWarning && (_jsx(View, { style: { backgroundColor: t.warning, borderRadius: t.radius, padding: t.spacing }, children: _jsx(Text, { style: text, children: x.freeTierWarning }) })), s.selected?.id === "gemini" && (_jsx(Pressable, { accessibilityRole: "checkbox", accessibilityState: { checked: s.paidGemini }, onPress: () => s.setPaidGemini(!s.paidGemini), children: _jsxs(Text, { style: text, children: [s.paidGemini ? "☑" : "☐", " This is a paid Gemini key"] }) })), s.blocked && (_jsx(Text, { style: { color: t.danger, fontSize: t.fontSize }, children: x.sensitiveRefusal })), s.keyUrl && _jsx(Text, { style: { color: t.accent, fontSize: t.fontSize }, children: s.keyUrl }), s.fields.map((f) => (_jsxs(View, { style: { gap: t.spacing / 2 }, children: [_jsxs(Text, { style: text, children: [f, " key"] }), _jsx(TextInput, { secureTextEntry: true, autoCapitalize: "none", autoCorrect: false, value: s.values[f] ?? "", onChangeText: (v) => s.setValue(f, v), style: {
|
|
30
|
+
...text,
|
|
31
|
+
borderWidth: 1,
|
|
32
|
+
borderColor: t.border,
|
|
33
|
+
borderRadius: t.radius,
|
|
34
|
+
padding: t.spacing,
|
|
35
|
+
} })] }, f))), s.error && _jsx(Text, { style: { color: t.danger, fontSize: t.fontSize }, children: s.error }), _jsx(Pressable, { accessibilityRole: "button", disabled: !s.canSubmit, onPress: () => void s.submit().catch(() => { }), style: btn(true, !s.canSubmit), children: _jsx(Text, { style: { color: t.accentText, fontSize: t.fontSize }, children: s.busy ? "Saving…" : "Save key" }) })] }));
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=key-sheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key-sheet.js","sourceRoot":"","sources":["../src/key-sheet.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,SAAS,EACT,UAAU,EACV,IAAI,EACJ,SAAS,EACT,IAAI,GAGL,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,cAAc,GAIf,MAAM,sBAAsB,CAAC;AAU9B;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAA+B;IACjE,MAAM,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACpC,MAAM,CAAC,GAAG,EAAE,GAAG,oBAAoB,EAAE,GAAG,KAAK,CAAC,KAAK,EA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C,EACrC,KAAK,EAAE;4BACL,GAAG,IAAI;4BACP,WAAW,EAAE,CAAC;4BACd,WAAW,EAAE,CAAC,CAAC,MAAM;4BACrB,YAAY,EAAE,CAAC,CAAC,MAAM;4BACtB,OAAO,EAAE,CAAC,CAAC,OAAO;yBACnB,GACD,KAfO,CAAC,CAgBL,CACR,CAAC,EAED,CAAC,CAAC,KAAK,IAAI,KAAC,IAAI,IAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,YAAG,CAAC,CAAC,KAAK,GAAQ,EACpF,KAAC,SAAS,IACR,iBAAiB,EAAC,QAAQ,EAC1B,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,EACtB,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,EAC9C,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,YAE9B,KAAC,IAAI,IAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,YACvD,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,GAC3B,GACG,IACD,CACd,CAAC;AACJ,CAAC"}
|
package/dist/mcp.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ConnectMcpServerOptions, McpConnection, OpenBlahClient } from "@openblah/core";
|
|
2
|
+
export type ConnectMcpInAppOptions = Omit<ConnectMcpServerOptions, "openAuthorization" | "isCancelled"> & {
|
|
3
|
+
/**
|
|
4
|
+
* Show the consent page. Pass `(url) => WebBrowser.openAuthSessionAsync(url)` from
|
|
5
|
+
* `expo-web-browser` for an in-app sheet that also reports when it is dismissed.
|
|
6
|
+
* Default: open the system browser with `Linking.openURL`.
|
|
7
|
+
*/
|
|
8
|
+
openAuthSession?: (url: string) => Promise<{
|
|
9
|
+
type?: string;
|
|
10
|
+
} | unknown>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Connect an MCP server from a mobile app: opens the server's sign-in in an in-app
|
|
14
|
+
* sheet or the system browser, waits for the result and resolves when connected.
|
|
15
|
+
* With an auth-session opener, dismissing the sheet cancels (after one last check).
|
|
16
|
+
*/
|
|
17
|
+
export declare function connectMcpInApp(client: Pick<OpenBlahClient, "connectMcpServer">, url: string, options?: ConnectMcpInAppOptions): Promise<McpConnection>;
|
package/dist/mcp.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Linking } from "react-native";
|
|
2
|
+
/**
|
|
3
|
+
* Connect an MCP server from a mobile app: opens the server's sign-in in an in-app
|
|
4
|
+
* sheet or the system browser, waits for the result and resolves when connected.
|
|
5
|
+
* With an auth-session opener, dismissing the sheet cancels (after one last check).
|
|
6
|
+
*/
|
|
7
|
+
export async function connectMcpInApp(client, url, options = {}) {
|
|
8
|
+
const { openAuthSession, ...rest } = options;
|
|
9
|
+
let dismissed = false;
|
|
10
|
+
return client.connectMcpServer(url, {
|
|
11
|
+
...rest,
|
|
12
|
+
openAuthorization: (authorizationUrl) => {
|
|
13
|
+
if (!openAuthSession)
|
|
14
|
+
return Linking.openURL(authorizationUrl);
|
|
15
|
+
// Do not wait for the sheet: the poll sees the server-side result.
|
|
16
|
+
void Promise.resolve(openAuthSession(authorizationUrl)).then((r) => {
|
|
17
|
+
const type = r?.type;
|
|
18
|
+
if (type === "cancel" || type === "dismiss")
|
|
19
|
+
dismissed = true;
|
|
20
|
+
});
|
|
21
|
+
},
|
|
22
|
+
isCancelled: () => dismissed,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=mcp.js.map
|
package/dist/mcp.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAevC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAAgD,EAChD,GAAW,EACX,UAAkC,EAAE;IAEpC,MAAM,EAAE,eAAe,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IAC7C,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,OAAO,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE;QAClC,GAAG,IAAI;QACP,iBAAiB,EAAE,CAAC,gBAAgB,EAAE,EAAE;YACtC,IAAI,CAAC,eAAe;gBAAE,OAAO,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;YAC/D,mEAAmE;YACnE,KAAK,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;gBACjE,MAAM,IAAI,GAAI,CAAmC,EAAE,IAAI,CAAC;gBACxD,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,SAAS;oBAAE,SAAS,GAAG,IAAI,CAAC;YAChE,CAAC,CAAC,CAAC;QACL,CAAC;QACD,WAAW,EAAE,GAAG,EAAE,CAAC,SAAS;KAC7B,CAAC,CAAC;AACL,CAAC"}
|
package/dist/native.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { OpenBlahClient, type OpenBlahClientOptions } from "@openblah/core";
|
|
2
|
+
/**
|
|
3
|
+
* Register the WebRTC globals LiveKit needs. Call once, before anything else,
|
|
4
|
+
* in your app's entry file (`index.js`). Safe to call more than once.
|
|
5
|
+
*
|
|
6
|
+
* `autoConfigureAudioSession` is off: the OpenBlah client sets the Apple audio
|
|
7
|
+
* category (`playAndRecord` with Bluetooth) and starts the audio session itself
|
|
8
|
+
* around each call, so the choice is ours and not the library default.
|
|
9
|
+
*/
|
|
10
|
+
export declare function registerOpenBlahGlobals(): void;
|
|
11
|
+
/**
|
|
12
|
+
* Create an {@link OpenBlahClient} for React Native: same API as in `@openblah/web`,
|
|
13
|
+
* plus the native audio session (play and record, Bluetooth, survives screen lock).
|
|
14
|
+
*/
|
|
15
|
+
export declare function createOpenBlahClient(options?: Omit<OpenBlahClientOptions, "beforeConnect" | "afterDisconnect">): OpenBlahClient;
|
package/dist/native.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Platform } from "react-native";
|
|
2
|
+
import { AudioSession, registerGlobals } from "@livekit/react-native";
|
|
3
|
+
import { OpenBlahClient } from "@openblah/core";
|
|
4
|
+
import { createCallAudio } from "./audio.js";
|
|
5
|
+
let registered = false;
|
|
6
|
+
/**
|
|
7
|
+
* Register the WebRTC globals LiveKit needs. Call once, before anything else,
|
|
8
|
+
* in your app's entry file (`index.js`). Safe to call more than once.
|
|
9
|
+
*
|
|
10
|
+
* `autoConfigureAudioSession` is off: the OpenBlah client sets the Apple audio
|
|
11
|
+
* category (`playAndRecord` with Bluetooth) and starts the audio session itself
|
|
12
|
+
* around each call, so the choice is ours and not the library default.
|
|
13
|
+
*/
|
|
14
|
+
export function registerOpenBlahGlobals() {
|
|
15
|
+
if (registered)
|
|
16
|
+
return;
|
|
17
|
+
registered = true;
|
|
18
|
+
registerGlobals({ autoConfigureAudioSession: false });
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Create an {@link OpenBlahClient} for React Native: same API as in `@openblah/web`,
|
|
22
|
+
* plus the native audio session (play and record, Bluetooth, survives screen lock).
|
|
23
|
+
*/
|
|
24
|
+
export function createOpenBlahClient(options = {}) {
|
|
25
|
+
const audio = createCallAudio(AudioSession, Platform.OS);
|
|
26
|
+
return new OpenBlahClient({
|
|
27
|
+
...options,
|
|
28
|
+
beforeConnect: audio.start,
|
|
29
|
+
afterDisconnect: audio.stop,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native.js","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,cAAc,EAA8B,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAyB,MAAM,YAAY,CAAC;AAEpE,IAAI,UAAU,GAAG,KAAK,CAAC;AAEvB;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB;IACrC,IAAI,UAAU;QAAE,OAAO;IACvB,UAAU,GAAG,IAAI,CAAC;IAClB,eAAe,CAAC,EAAE,yBAAyB,EAAE,KAAK,EAAE,CAAC,CAAC;AACxD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAClC,UAA4E,EAAE;IAE9E,MAAM,KAAK,GAAG,eAAe,CAAC,YAA2C,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;IACxF,OAAO,IAAI,cAAc,CAAC;QACxB,GAAG,OAAO;QACV,aAAa,EAAE,KAAK,CAAC,KAAK;QAC1B,eAAe,EAAE,KAAK,CAAC,IAAI;KAC5B,CAAC,CAAC;AACL,CAAC"}
|
package/dist/room.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type StyleProp, type ViewStyle } from "react-native";
|
|
3
|
+
import { type OpenBlahRoomBaseProps } from "@openblah/core/react";
|
|
4
|
+
/** Props of the React Native `<OpenBlahRoom />`. Same as the web component, with `style` for a View. @public */
|
|
5
|
+
export interface OpenBlahRoomProps extends OpenBlahRoomBaseProps {
|
|
6
|
+
style?: StyleProp<ViewStyle>;
|
|
7
|
+
/** Extra content shown under the controls, for example your own transcript. */
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The ready-made call screen: join, mute, participants, agent state, consent, invite, agent
|
|
12
|
+
* control and tool approvals. Must be inside `<OpenBlahProvider>`. Same props and behaviour as
|
|
13
|
+
* the web component; the invite opens the system share sheet. Needs an Expo dev build.
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export declare function OpenBlahRoom(props: OpenBlahRoomProps): import("react").JSX.Element;
|
package/dist/room.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Pressable, StyleSheet, Text, View } from "react-native";
|
|
4
|
+
import { resolveLabels, resolveTheme, useRoomView, } from "@openblah/core/react";
|
|
5
|
+
import { shareInvite } from "./invite.js";
|
|
6
|
+
function Btn(props) {
|
|
7
|
+
const { t } = props;
|
|
8
|
+
return (_jsx(Pressable, { accessibilityRole: "button", disabled: props.disabled, onPress: props.onPress, style: {
|
|
9
|
+
backgroundColor: props.primary ? t.accent : t.surface,
|
|
10
|
+
borderRadius: t.radius,
|
|
11
|
+
paddingVertical: t.spacing,
|
|
12
|
+
paddingHorizontal: t.spacing * 2,
|
|
13
|
+
opacity: props.disabled ? 0.5 : 1,
|
|
14
|
+
}, children: _jsx(Text, { style: { color: props.primary ? t.accentText : t.text, fontSize: t.fontSize }, children: props.label }) }));
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The ready-made call screen: join, mute, participants, agent state, consent, invite, agent
|
|
18
|
+
* control and tool approvals. Must be inside `<OpenBlahProvider>`. Same props and behaviour as
|
|
19
|
+
* the web component; the invite opens the system share sheet. Needs an Expo dev build.
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export function OpenBlahRoom(props) {
|
|
23
|
+
const t = resolveTheme(props.theme);
|
|
24
|
+
const l = resolveLabels(props.labels);
|
|
25
|
+
const hidden = new Set(props.hide ?? []);
|
|
26
|
+
const v = useRoomView(props);
|
|
27
|
+
const [note, setNote] = useState(null);
|
|
28
|
+
const text = { color: t.text, fontSize: t.fontSize };
|
|
29
|
+
const row = { flexDirection: "row", flexWrap: "wrap", gap: t.spacing };
|
|
30
|
+
const card = (backgroundColor) => ({
|
|
31
|
+
backgroundColor,
|
|
32
|
+
borderRadius: t.radius,
|
|
33
|
+
padding: t.spacing,
|
|
34
|
+
gap: t.spacing,
|
|
35
|
+
});
|
|
36
|
+
return (_jsxs(View, { style: [
|
|
37
|
+
styles.root,
|
|
38
|
+
{
|
|
39
|
+
backgroundColor: t.background,
|
|
40
|
+
borderColor: t.border,
|
|
41
|
+
borderRadius: t.radius,
|
|
42
|
+
padding: t.spacing * 2,
|
|
43
|
+
gap: t.spacing,
|
|
44
|
+
},
|
|
45
|
+
props.style,
|
|
46
|
+
], children: [v.pause.paused && !hidden.has("pause") && (_jsx(View, { style: card(t.warning), children: _jsx(Text, { style: [text, styles.bold], children: l.aiPaused }) })), _jsx(View, { style: row, children: !v.connected ? (_jsx(Btn, { t: t, primary: true, disabled: v.joining, label: v.joining ? l.joining : l.join, onPress: () => void v.join() })) : (_jsxs(_Fragment, { children: [_jsx(Btn, { t: t, label: l.leave, onPress: () => void v.leave() }), !hidden.has("mute") && (_jsx(Btn, { t: t, primary: true, label: v.mute.muted ? l.unmute : l.mute, onPress: () => void v.mute.toggle() })), !hidden.has("pause") && (_jsx(Btn, { t: t, label: v.pause.paused ? l.resumeAi : l.pauseAi, onPress: () => void v.pause.toggle() })), !hidden.has("invite") && v.host.isHost && (_jsx(Btn, { t: t, label: l.invite, onPress: () => shareInvite(v.host)
|
|
47
|
+
.then(() => setNote(null))
|
|
48
|
+
.catch((e) => setNote(e.message)) }))] })) }), props.keyRequired && (_jsxs(View, { style: card(t.warning), children: [_jsx(Text, { style: text, children: props.keyRequired.reason === "trial_used" ? l.keyRequiredTrialUsed : l.keyRequired }), props.onAddKey && _jsx(Btn, { t: t, primary: true, label: l.addKey, onPress: props.onAddKey })] })), note && _jsx(Text, { style: { color: t.danger, fontSize: t.fontSize }, children: note }), v.error && _jsx(Text, { style: { color: t.danger, fontSize: t.fontSize }, children: v.error }), v.connected && !hidden.has("agentState") && (_jsxs(Text, { style: { color: t.mutedText, fontSize: t.fontSize }, children: [l.agentState, ": ", v.agentState] })), v.connected &&
|
|
49
|
+
!hidden.has("approvals") &&
|
|
50
|
+
v.approvals.pending.map((a) => (_jsxs(View, { style: card(t.surface), children: [_jsxs(Text, { style: [text, styles.bold], children: [l.confirmAction, " ", a.summary] }), _jsxs(View, { style: row, children: [_jsx(Btn, { t: t, primary: true, label: l.confirmYes, onPress: () => void v.approvals.approve(a.id) }), _jsx(Btn, { t: t, label: l.confirmNo, onPress: () => void v.approvals.decline(a.id) })] })] }, a.id))), v.connected && !hidden.has("consent") && v.consent.needed && v.consent.text && (_jsxs(View, { style: card(t.surface), children: [_jsx(Text, { style: text, children: v.consent.text }), _jsx(Btn, { t: t, primary: true, label: l.consentAccept, onPress: () => void v.consent.accept() })] })), v.connected && !hidden.has("agentControl") && v.control.state && (_jsxs(View, { style: { gap: t.spacing }, children: [v.control.state.awaitingConsent && (_jsx(View, { style: card(t.warning), children: _jsxs(Text, { style: text, children: [l.waitingForConsent, " ", v.control.state.missing.map((m) => m.displayName).join(", ")] }) })), _jsxs(View, { style: row, children: [!v.control.present && (_jsx(Btn, { t: t, label: v.control.state.canControl ? l.bringInAgent : l.askForAgent, onPress: () => void v.control.bringIn().catch(() => { }) })), v.control.present && v.control.state.canControl && (_jsx(Btn, { t: t, label: l.sendAgentOut, onPress: () => void v.control.sendOut() }))] }), v.control.requests.map((r) => (_jsxs(View, { style: card(t.surface), children: [_jsxs(Text, { style: text, children: [r.displayName, " ", l.requestsAgent] }), _jsxs(View, { style: row, children: [_jsx(Btn, { t: t, primary: true, label: l.approve, onPress: () => void v.control.approve(r.id) }), _jsx(Btn, { t: t, label: l.decline, onPress: () => void v.control.decline(r.id) })] })] }, r.id)))] })), v.connected &&
|
|
51
|
+
!hidden.has("participants") &&
|
|
52
|
+
v.participants.map((p) => (_jsxs(View, { style: row, children: [_jsxs(Text, { style: [text, p.isSpeaking ? styles.bold : null], children: [p.name, p.isLocal ? ` (${l.you})` : "", p.isAgent ? ` [${l.agent}]` : ` [${p.role}]`, p.isMuted ? ` · ${l.muted}` : "", p.isSpeaking ? ` · ${l.speaking}` : ""] }), v.host.isHost && !p.isLocal && !p.isAgent && (_jsx(Btn, { t: t, label: l.remove, onPress: () => void v.host.removeParticipant(p.identity) }))] }, p.identity))), v.connected && !hidden.has("endRoom") && v.host.isHost && (_jsx(Btn, { t: t, label: l.endRoom, onPress: () => void v.host.endRoom().then(() => v.leave()) })), props.children] }));
|
|
53
|
+
}
|
|
54
|
+
const styles = StyleSheet.create({
|
|
55
|
+
root: { borderWidth: 1 },
|
|
56
|
+
bold: { fontWeight: "700" },
|
|
57
|
+
});
|
|
58
|
+
//# sourceMappingURL=room.js.map
|
package/dist/room.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"room.js","sourceRoot":"","sources":["../src/room.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAkC,MAAM,cAAc,CAAC;AACjG,OAAO,EACL,aAAa,EACb,YAAY,EACZ,WAAW,GAGZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAS1C,SAAS,GAAG,CAAC,KAMZ;IACC,MAAM,EAAE,CAAC,EAAE,GAAG,KAAK,CAAC;IACpB,OAAO,CACL,KAAC,SAAS,IACR,iBAAiB,EAAC,QAAQ,EAC1B,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,KAAK,EAAE;YACL,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CA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,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,OAAO,IAAI,CAC5C,KAAC,GAAG,IACF,CAAC,EAAE,CAAC,EACJ,KAAK,EAAE,CAAC,CAAC,MAAM,EACf,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,QAAQ,CAAC,GACxD,CACH,KAdQ,CAAC,CAAC,QAAQ,CAed,CACR,CAAC,EAEH,CAAC,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,IAAI,CACzD,KAAC,GAAG,IAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,GAAI,CAC5F,EACA,KAAK,CAAC,QAAQ,IACV,CACR,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE;IACxB,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;CAC5B,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openblah/react-native",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "OpenBlah React Native SDK (0.x, unstable): LiveKit voice rooms with an AI agent, for Expo dev builds (not Expo Go).",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public",
|
|
8
|
+
"provenance": true
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"main": "dist/index.js",
|
|
12
|
+
"types": "dist/index.d.ts",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"plugin",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@config-plugins/react-native-webrtc": "^15.0.2",
|
|
20
|
+
"@livekit/react-native-expo-plugin": "^1.1.0",
|
|
21
|
+
"@openblah/core": "^0.1.0"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@expo/config-plugins": "^58.0.0",
|
|
25
|
+
"@livekit/react-native": "^3.1.0",
|
|
26
|
+
"@livekit/react-native-webrtc": "^150.1.1",
|
|
27
|
+
"@types/react": "^19.3.0",
|
|
28
|
+
"livekit-client": "^2.24.1",
|
|
29
|
+
"react": "^19.3.1",
|
|
30
|
+
"react-native": "^0.88.1"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"@livekit/react-native": "^3.1.0",
|
|
34
|
+
"@livekit/react-native-webrtc": "^150.1.0",
|
|
35
|
+
"expo": ">=56",
|
|
36
|
+
"livekit-client": "^2.24.1",
|
|
37
|
+
"react": ">=18",
|
|
38
|
+
"react-native": "*"
|
|
39
|
+
},
|
|
40
|
+
"peerDependenciesMeta": {
|
|
41
|
+
"expo": {
|
|
42
|
+
"optional": true
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "git+https://github.com/kupferco/openblah.git",
|
|
48
|
+
"directory": "packages/react-native"
|
|
49
|
+
},
|
|
50
|
+
"homepage": "https://github.com/kupferco/openblah#readme",
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/kupferco/openblah/issues"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
56
|
+
"build": "pnpm --filter @openblah/core build && tsc -p tsconfig.build.json"
|
|
57
|
+
}
|
|
6
58
|
}
|
package/plugin/index.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Expo config plugin for @openblah/react-native. Add it to `plugins` in app.json:
|
|
3
|
+
*
|
|
4
|
+
* "plugins": [["@openblah/react-native/plugin", { "microphonePermission": "..." }]]
|
|
5
|
+
*
|
|
6
|
+
* It applies the LiveKit and WebRTC plugins, then adds what a call needs to survive
|
|
7
|
+
* screen lock: the iOS `audio` background mode, the microphone usage text, and
|
|
8
|
+
* the Android audio permissions.
|
|
9
|
+
*/
|
|
10
|
+
const {
|
|
11
|
+
withPlugins,
|
|
12
|
+
withInfoPlist,
|
|
13
|
+
withAndroidManifest,
|
|
14
|
+
AndroidConfig,
|
|
15
|
+
createRunOncePlugin,
|
|
16
|
+
} = require("@expo/config-plugins");
|
|
17
|
+
|
|
18
|
+
const DEFAULT_MIC_TEXT = "Allow $(PRODUCT_NAME) to use the microphone for voice calls.";
|
|
19
|
+
const ANDROID_PERMISSIONS = [
|
|
20
|
+
"android.permission.RECORD_AUDIO",
|
|
21
|
+
"android.permission.MODIFY_AUDIO_SETTINGS",
|
|
22
|
+
"android.permission.BLUETOOTH",
|
|
23
|
+
"android.permission.BLUETOOTH_CONNECT",
|
|
24
|
+
"android.permission.INTERNET",
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
/** A required plugin may be a CommonJS function or an ES module with a default export. */
|
|
28
|
+
function interopDefault(mod) {
|
|
29
|
+
return mod && typeof mod === "object" && "default" in mod ? mod.default : mod;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Pure helper so it can be tested: add `audio` to UIBackgroundModes and the mic text. */
|
|
33
|
+
function applyIosInfoPlist(plist, microphonePermission) {
|
|
34
|
+
const modes = new Set(plist.UIBackgroundModes ?? []);
|
|
35
|
+
modes.add("audio");
|
|
36
|
+
plist.UIBackgroundModes = [...modes];
|
|
37
|
+
plist.NSMicrophoneUsageDescription = plist.NSMicrophoneUsageDescription ?? microphonePermission;
|
|
38
|
+
return plist;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function withOpenBlah(config, options = {}) {
|
|
42
|
+
const microphonePermission = options.microphonePermission ?? DEFAULT_MIC_TEXT;
|
|
43
|
+
return withPlugins(config, [
|
|
44
|
+
[
|
|
45
|
+
interopDefault(require("@livekit/react-native-expo-plugin/app.plugin.js")),
|
|
46
|
+
options.livekit ?? {},
|
|
47
|
+
],
|
|
48
|
+
[interopDefault(require("@config-plugins/react-native-webrtc")), { microphonePermission }],
|
|
49
|
+
(c) =>
|
|
50
|
+
withInfoPlist(c, (m) => {
|
|
51
|
+
applyIosInfoPlist(m.modResults, microphonePermission);
|
|
52
|
+
return m;
|
|
53
|
+
}),
|
|
54
|
+
(c) =>
|
|
55
|
+
withAndroidManifest(c, (m) => {
|
|
56
|
+
m.modResults = AndroidConfig.Permissions.ensurePermissions(
|
|
57
|
+
m.modResults,
|
|
58
|
+
ANDROID_PERMISSIONS,
|
|
59
|
+
);
|
|
60
|
+
return m;
|
|
61
|
+
}),
|
|
62
|
+
]);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
module.exports = createRunOncePlugin(withOpenBlah, "@openblah/react-native", "0.0.1");
|
|
66
|
+
module.exports.applyIosInfoPlist = applyIosInfoPlist;
|
|
67
|
+
module.exports.ANDROID_PERMISSIONS = ANDROID_PERMISSIONS;
|
|
68
|
+
module.exports.interopDefault = interopDefault;
|