@graineai/inapp-react-native 0.27.0 → 0.27.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.
@@ -14,7 +14,10 @@ export interface GraineFabProps {
14
14
  size?: number;
15
15
  accent?: string;
16
16
  label?: string;
17
+ overlay?: ComponentType<{
18
+ children?: React.ReactNode;
19
+ }>;
17
20
  onOpen?: () => void;
18
21
  onClose?: () => void;
19
22
  }
20
- export declare function GraineFab({ webView, position, size, accent: accentProp, label, onOpen, onClose }: GraineFabProps): React.JSX.Element | null;
23
+ export declare function GraineFab({ webView, position, size, accent: accentProp, label, overlay, onOpen, onClose }: GraineFabProps): React.JSX.Element | null;
@@ -1,26 +1,16 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useCallback, useContext, useRef, useState } from "react";
3
- import { Image, Platform, Pressable, Text, View } from "react-native";
4
- let FullWindowOverlay = null;
5
- try {
6
- if (Platform.OS === "ios" && typeof require === "function") {
7
- FullWindowOverlay = require("react-native-screens")?.FullWindowOverlay ?? null;
8
- }
9
- }
10
- catch {
11
- FullWindowOverlay = null;
12
- }
13
- function AboveNativeScreens({ children }) {
14
- if (!FullWindowOverlay)
15
- return _jsx(_Fragment, { children: children });
16
- const Overlay = FullWindowOverlay;
17
- return _jsx(Overlay, { children: _jsx(View, { style: { flex: 1 }, pointerEvents: "box-none", children: children }) });
18
- }
3
+ import { Image, Pressable, Text, View } from "react-native";
19
4
  import { Ctx, useGraineAgent, useGraineClient } from "./index.js";
20
5
  import { GraineVoiceLauncher } from "./voice-launcher.js";
21
6
  import { GraineAgentBar } from "./ui.js";
22
7
  import { resolveNativeAppearance } from "./appearance.js";
23
8
  import { UNNAMED_TAP } from "../protocol.js";
9
+ function AboveNativeScreens({ overlay: Overlay, children, }) {
10
+ if (!Overlay)
11
+ return _jsx(_Fragment, { children: children });
12
+ return (_jsx(Overlay, { children: _jsx(View, { style: { flex: 1 }, pointerEvents: "box-none", children: children }) }));
13
+ }
24
14
  export const TAP_MAX_MOVE_PX = 12;
25
15
  export const TAP_MAX_MS = 400;
26
16
  export function GraineTouchCapture({ children, enabled = true, style }) {
@@ -63,7 +53,7 @@ export function GraineTouchCapture({ children, enabled = true, style }) {
63
53
  }, [client, ctx, enabled]);
64
54
  return (_jsx(View, { style: [{ flex: 1 }, style], onTouchStart: onTouchStart, onTouchEnd: onTouchEnd, children: children }));
65
55
  }
66
- export function GraineFab({ webView, position = "bottom-right", size = 56, accent: accentProp, label, onOpen, onClose }) {
56
+ export function GraineFab({ webView, position = "bottom-right", size = 56, accent: accentProp, label, overlay, onOpen, onClose }) {
67
57
  const { launcherVisible, launcherInset, appearance, error } = useGraineAgent();
68
58
  const [open, setOpen] = useState(false);
69
59
  const dashboard = resolveNativeAppearance(appearance, { accent: "#318CE7", heading: "Assistant", radius: 18 });
@@ -72,10 +62,10 @@ export function GraineFab({ webView, position = "bottom-right", size = 56, accen
72
62
  if (error || !launcherVisible)
73
63
  return null;
74
64
  if (open) {
75
- return (_jsx(AboveNativeScreens, { children: _jsx(GraineVoiceLauncher, { webView: webView, autoStart: true, onEnded: () => { setOpen(false); onClose?.(); }, children: () => _jsx(GraineAgentBar, { accent: accent, name: name }) }) }));
65
+ return (_jsx(AboveNativeScreens, { overlay: overlay, children: _jsx(GraineVoiceLauncher, { webView: webView, autoStart: true, onEnded: () => { setOpen(false); onClose?.(); }, children: () => _jsx(GraineAgentBar, { accent: accent, name: name }) }) }));
76
66
  }
77
67
  const side = position === "bottom-left" ? { left: launcherInset.right } : { right: launcherInset.right };
78
- return (_jsx(AboveNativeScreens, { children: _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: label ?? `Talk to ${name}`, onPress: () => { setOpen(true); onOpen?.(); }, style: ({ pressed }) => ({
68
+ return (_jsx(AboveNativeScreens, { overlay: overlay, children: _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: label ?? `Talk to ${name}`, onPress: () => { setOpen(true); onOpen?.(); }, style: ({ pressed }) => ({
79
69
  position: "absolute", bottom: launcherInset.bottom, ...side,
80
70
  width: size, height: size, borderRadius: size / 2, backgroundColor: accent,
81
71
  alignItems: "center", justifyContent: "center",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graineai/inapp-react-native",
3
- "version": "0.27.0",
3
+ "version": "0.27.1",
4
4
  "type": "module",
5
5
  "description": "Graine in-app agent for React Native — an agent that sees the screen your customer is on and can act on it.",
6
6
  "license": "MIT",