@getuserfeedback/react-native 3.0.44 → 3.0.45

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.
@@ -0,0 +1,13 @@
1
+ import { type ReactElement } from "react";
2
+ import { type CoreWebViewHostProps } from "./core-webview-host.js";
3
+ import { type NativeViewHostProjectionProps } from "./native-view-host-projection.js";
4
+ export type NativeRuntimeRootProps = {
5
+ coreUrl: string;
6
+ coreWebViewComponent?: CoreWebViewHostProps["webViewComponent"];
7
+ coreWebViewProps?: CoreWebViewHostProps["webViewProps"];
8
+ onError?: (error: Error) => void;
9
+ onInvalidMessage?: (error: Error, value: unknown) => void;
10
+ viewWebViewComponent?: NativeViewHostProjectionProps["webViewComponent"];
11
+ viewWebViewProps?: NativeViewHostProjectionProps["webViewProps"];
12
+ };
13
+ export declare function NativeRuntimeRoot({ coreUrl, coreWebViewComponent, coreWebViewProps, onError, onInvalidMessage, viewWebViewComponent, viewWebViewProps, }: NativeRuntimeRootProps): ReactElement;
@@ -0,0 +1,56 @@
1
+ import { createElement, Fragment, useCallback, useEffect, useRef, useState, } from "react";
2
+ import { CoreWebViewHost, } from "./core-webview-host.js";
3
+ import { NativeViewHostProjection, } from "./native-view-host-projection.js";
4
+ import { createNativeViewRecordController, } from "./native-view-record-controller.js";
5
+ export function NativeRuntimeRoot({ coreUrl, coreWebViewComponent, coreWebViewProps, onError, onInvalidMessage, viewWebViewComponent, viewWebViewProps, }) {
6
+ const [session, setSession] = useState(null);
7
+ const sessionRef = useRef(null);
8
+ const nextSessionKeyRef = useRef(0);
9
+ const onErrorRef = useRef(onError);
10
+ onErrorRef.current = onError;
11
+ const handleConnected = useCallback((coreConnection) => {
12
+ const previousSession = sessionRef.current;
13
+ previousSession === null || previousSession === void 0 ? void 0 : previousSession.controller.dispose();
14
+ const controller = createNativeViewRecordController({
15
+ coreConnection,
16
+ onError: (error) => { var _a; return (_a = onErrorRef.current) === null || _a === void 0 ? void 0 : _a.call(onErrorRef, error); },
17
+ });
18
+ const nextSession = {
19
+ controller,
20
+ key: nextSessionKeyRef.current + 1,
21
+ };
22
+ nextSessionKeyRef.current = nextSession.key;
23
+ sessionRef.current = nextSession;
24
+ setSession(nextSession);
25
+ }, []);
26
+ const handleDisconnected = useCallback(() => {
27
+ const currentSession = sessionRef.current;
28
+ if (!currentSession) {
29
+ return;
30
+ }
31
+ currentSession.controller.dispose();
32
+ sessionRef.current = null;
33
+ setSession(null);
34
+ }, []);
35
+ useEffect(() => () => {
36
+ const currentSession = sessionRef.current;
37
+ sessionRef.current = null;
38
+ currentSession === null || currentSession === void 0 ? void 0 : currentSession.controller.dispose();
39
+ }, []);
40
+ return createElement(Fragment, null, createElement(CoreWebViewHost, {
41
+ coreUrl,
42
+ onConnected: handleConnected,
43
+ onDisconnected: handleDisconnected,
44
+ onInvalidMessage,
45
+ webViewComponent: coreWebViewComponent,
46
+ webViewProps: coreWebViewProps,
47
+ }), session === null
48
+ ? null
49
+ : createElement(NativeViewHostProjection, {
50
+ controller: session.controller,
51
+ key: session.key,
52
+ onInvalidMessage,
53
+ webViewComponent: viewWebViewComponent,
54
+ webViewProps: viewWebViewProps,
55
+ }));
56
+ }
@@ -38,5 +38,5 @@ export function NativeViewHostProjection({ controller, onInvalidMessage, webView
38
38
  key: record.allocationId,
39
39
  })));
40
40
  }
41
- // TODO(migration): Compose CoreWebViewHost, a mount-stable NativeViewRecordController, and this projection behind one private native runtime root while the provider runtime remains active.
42
- // [from=private-native-view-rendering-proof] [to=private-native-runtime-composition] [scope=slice] [priority=high] [impact=high] [risk=high] [epic=runtime-neutral-view-host-orchestration] [epic_order=50]
41
+ // TODO(architecture): Prove command/bootstrap composition from the private native runtime root without switching provider ownership.
42
+ // [from=private-native-runtime-composition] [to=private-native-command-bootstrap-composition] [scope=slice] [principle=preserve-provider-runtime] [priority=high] [impact=high] [risk=high] [epic=runtime-neutral-view-host-orchestration] [epic_order=60]
package/dist/version.js CHANGED
@@ -3,4 +3,4 @@ const reactNativeSdkVersion = typeof __GX_REACT_NATIVE_SDK_VERSION__ === "string
3
3
  : "";
4
4
  // Build scripts patch this fallback to the package version for published artifacts.
5
5
  // Source-linked workspace usage keeps the local fallback.
6
- export const REACT_NATIVE_SDK_VERSION = reactNativeSdkVersion.length > 0 ? reactNativeSdkVersion : "3.0.44";
6
+ export const REACT_NATIVE_SDK_VERSION = reactNativeSdkVersion.length > 0 ? reactNativeSdkVersion : "3.0.45";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getuserfeedback/react-native",
3
- "version": "3.0.44",
3
+ "version": "3.0.45",
4
4
  "description": "getuserfeedback React Native SDK",
5
5
  "keywords": [
6
6
  "getuserfeedback",