@graineai/inapp-react-native 0.33.1 → 0.33.3

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.
@@ -11,6 +11,7 @@ export function GraineVoiceLauncher({ webView: WebView, autoStart = false, activ
11
11
  const activeRef = useRef(active);
12
12
  activeRef.current = active;
13
13
  const mountedIdleRef = useRef(!active);
14
+ const mountStampRef = useRef(Date.now());
14
15
  const [connected, setConnected] = useState(false);
15
16
  const [connecting, setConnecting] = useState(false);
16
17
  const [muted, setMutedState] = useState(false);
@@ -278,7 +279,6 @@ export function GraineVoiceLauncher({ webView: WebView, autoStart = false, activ
278
279
  }, [post]);
279
280
  if (!voiceAgentId)
280
281
  return _jsx(_Fragment, { children: children?.(api) });
281
- const mountStampRef = useRef(Date.now());
282
282
  const effectiveTransport = transport ?? (appearance?.audioTransport === "rtc" ? "rtc" : "ws");
283
283
  const src = `${client.opts.baseUrl.replace(/\/$/, "")}/embed/${voiceAgentId}` +
284
284
  `?mode=voice&branding=0&embed=1&transport=${effectiveTransport}` +
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useContext } from "react";
2
3
  import { Image, Modal, Pressable, ScrollView, Text, View, useColorScheme } from "react-native";
3
- import { useGraineAgent, useGraineWidget } from "./index.js";
4
+ import { Ctx, useGraineWidget } from "./index.js";
4
5
  import { resolveNativeAppearance, resolveWidgetPalette } from "./appearance.js";
5
6
  import { widgetSurface } from "../protocol.js";
6
7
  function tint(hex, alpha) {
@@ -57,7 +58,7 @@ function AnsweredLine({ answered, theme, accent, radius, onClear }) {
57
58
  }
58
59
  export function GraineWidget(props) {
59
60
  const { widget, answered, submit, dismiss } = useGraineWidget();
60
- const { appearance } = useGraineAgent();
61
+ const appearance = useContext(Ctx)?.appearance ?? null;
61
62
  const scheme = useColorScheme();
62
63
  const dash = resolveNativeAppearance(appearance, { accent: "#318CE7", heading: "" });
63
64
  const accent = props.accent ?? dash.accent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graineai/inapp-react-native",
3
- "version": "0.33.1",
3
+ "version": "0.33.3",
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",
@@ -32,18 +32,20 @@
32
32
  "scripts": {
33
33
  "build": "rm -rf dist && tsc -p tsconfig.build.json",
34
34
  "typecheck": "tsc -p tsconfig.build.json --noEmit",
35
- "test": "npm run build && node --test test/*.test.mjs",
36
- "prepublishOnly": "npm test && node scripts/verify-package-clean.mjs"
35
+ "test": "npm run build && node --test test/*.test.mjs && npm run test:render",
36
+ "prepublishOnly": "npm test && node scripts/verify-package-clean.mjs",
37
+ "test:render": "node --import ./test/harness/register.mjs --test test/render/render.test.mjs"
37
38
  },
38
39
  "peerDependencies": {
40
+ "@jambonz/client-sdk-react-native": "^0.1.4",
39
41
  "react": ">=17",
40
- "react-native": ">=0.68",
41
- "@jambonz/client-sdk-react-native": "^0.1.4"
42
+ "react-native": ">=0.68"
42
43
  },
43
44
  "devDependencies": {
44
45
  "@types/react": "^18.2.0",
45
46
  "react": "^18.2.0",
46
47
  "react-native": "^0.74.0",
48
+ "react-test-renderer": "^18.2.0",
47
49
  "typescript": "^5.4.0"
48
50
  },
49
51
  "keywords": [