@getuserfeedback/react-native 4.0.31 → 5.0.7
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/README.md +12 -150
- package/dist/client.d.ts +64 -0
- package/dist/client.js +1 -0
- package/dist/core-webview-host.d.ts +0 -1
- package/dist/core-webview-host.js +2 -12
- package/dist/native-core-command-channel.d.ts +1 -0
- package/dist/native-core-command-channel.js +20 -4
- package/dist/native-provider-client-controller.d.ts +11 -0
- package/dist/native-provider-client-controller.js +38 -0
- package/dist/native-provider-client.d.ts +3 -17
- package/dist/native-provider-command-controller.d.ts +19 -0
- package/dist/native-provider-command-controller.js +79 -0
- package/dist/native-provider-flow-registry.d.ts +7 -0
- package/dist/native-provider-flow-registry.js +70 -0
- package/dist/native-provider.d.ts +32 -0
- package/dist/native-provider.js +88 -0
- package/dist/native-runtime-root.d.ts +2 -4
- package/dist/native-runtime-root.js +6 -3
- package/dist/native-view-host-projection.d.ts +1 -2
- package/dist/native-view-host-projection.js +22 -6
- package/dist/native-view-presentation-surface.js +6 -1
- package/dist/native-view-record-controller.d.ts +9 -3
- package/dist/native-view-record-controller.js +276 -50
- package/dist/native-widget-corner-radii.d.ts +1 -2
- package/dist/native-widget-corner-radii.js +1 -1
- package/dist/provider-command-helpers.d.ts +1 -11
- package/dist/provider-command-helpers.js +1 -38
- package/dist/public-api.d.ts +2 -1
- package/dist/public-api.js +2 -1
- package/dist/runtime-endpoints.d.ts +2 -0
- package/dist/runtime-endpoints.js +2 -0
- package/dist/version.js +1 -1
- package/dist/view-orchestration-runtime.js +11 -43
- package/dist/view-webview-host-controller.d.ts +1 -0
- package/dist/view-webview-host-controller.js +1 -0
- package/dist/view-webview-host.d.ts +1 -1
- package/dist/view-webview-host.js +3 -7
- package/dist/webview-document-host.d.ts +2 -3
- package/dist/webview-document-host.js +21 -33
- package/package.json +3 -3
- package/dist/host-viewport.d.ts +0 -3
- package/dist/host-viewport.js +0 -69
- package/dist/index.d.ts +0 -91
- package/dist/index.js +0 -613
- package/dist/provider-command-transport.d.ts +0 -52
- package/dist/provider-command-transport.js +0 -150
- package/dist/provider-message-queue.d.ts +0 -11
- package/dist/provider-message-queue.js +0 -23
- package/dist/provider-pending-commands.d.ts +0 -34
- package/dist/provider-pending-commands.js +0 -58
- package/dist/provider-widget-border-radius.d.ts +0 -11
- package/dist/provider-widget-border-radius.js +0 -102
- package/dist/provider-widget-frame-appearance.d.ts +0 -17
- package/dist/provider-widget-frame-appearance.js +0 -43
- package/dist/provider-widget-host-lifecycle.d.ts +0 -46
- package/dist/provider-widget-host-lifecycle.js +0 -138
- package/dist/provider-widget-host-overlay.d.ts +0 -58
- package/dist/provider-widget-host-overlay.js +0 -616
- package/dist/use-native-direct-command-session-controller.d.ts +0 -2
- package/dist/use-native-direct-command-session-controller.js +0 -21
- package/dist/webview-bridge-script.d.ts +0 -16
- package/dist/webview-bridge-script.js +0 -283
- package/dist/widget-host-lifecycle-machine.d.ts +0 -35
- package/dist/widget-host-lifecycle-machine.js +0 -37
- package/dist/widget-host.d.ts +0 -38
- package/dist/widget-host.js +0 -327
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ComponentType, type ReactElement, type ReactNode } from "react";
|
|
2
|
+
import type { Client, ClientOptions } from "./client.js";
|
|
3
|
+
export type { Client, ClientOptions, FlowRun } from "./client.js";
|
|
4
|
+
/**
|
|
5
|
+
* Custom WebView implementation used by the native runtime.
|
|
6
|
+
*
|
|
7
|
+
* The component must forward every received prop and its ref to a compatible
|
|
8
|
+
* `react-native-webview` WebView instance. The forwarded ref must expose
|
|
9
|
+
* `injectJavaScript`.
|
|
10
|
+
*/
|
|
11
|
+
export type NativeWebViewComponent = ComponentType<Record<string, unknown>>;
|
|
12
|
+
/**
|
|
13
|
+
* Props for the React Native SDK provider.
|
|
14
|
+
*
|
|
15
|
+
* Mount the provider above every component that calls `useGetUserFeedback`.
|
|
16
|
+
*
|
|
17
|
+
* @see https://getuserfeedback.com/docs/get-started/react-native-sdk
|
|
18
|
+
*/
|
|
19
|
+
export type GetUserFeedbackProviderProps = {
|
|
20
|
+
/** Application content that can access the SDK client. */
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
/** Public API key and initialization options for this client. */
|
|
23
|
+
clientOptions: ClientOptions;
|
|
24
|
+
/** Stable instance identifier. Most apps should let the provider create one. */
|
|
25
|
+
instanceId?: string;
|
|
26
|
+
/** Receives runtime and command errors. */
|
|
27
|
+
onError?: (error: Error) => void;
|
|
28
|
+
/** Custom WebView implementation used by the Core runtime and projected flows. */
|
|
29
|
+
webViewComponent?: NativeWebViewComponent;
|
|
30
|
+
};
|
|
31
|
+
export declare function GetUserFeedbackProvider({ children, clientOptions, instanceId: instanceIdProp, onError, webViewComponent, }: GetUserFeedbackProviderProps): ReactElement;
|
|
32
|
+
export declare function useGetUserFeedback(): Client;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { parseInitOptions } from "@getuserfeedback/protocol";
|
|
2
|
+
import { createUniqueId, PRODUCTION_WIDGET_RUNTIME_ENDPOINTS, } from "@getuserfeedback/protocol/host";
|
|
3
|
+
import { createContext, createElement, Fragment, useCallback, useContext, useEffect, useRef, useState, } from "react";
|
|
4
|
+
import { createNativeProviderClientController } from "./native-provider-client-controller.js";
|
|
5
|
+
import { NativeProviderRuntime } from "./native-runtime-root.js";
|
|
6
|
+
const GetUserFeedbackContext = createContext(null);
|
|
7
|
+
const toClientOptionsKey = (value) => {
|
|
8
|
+
if (value === null || typeof value !== "object") {
|
|
9
|
+
return JSON.stringify(value);
|
|
10
|
+
}
|
|
11
|
+
if (Array.isArray(value)) {
|
|
12
|
+
return `[${value.map(toClientOptionsKey).join(",")}]`;
|
|
13
|
+
}
|
|
14
|
+
const record = value;
|
|
15
|
+
return `{${Object.keys(record)
|
|
16
|
+
.filter((key) => record[key] !== undefined)
|
|
17
|
+
.sort()
|
|
18
|
+
.map((key) => `${JSON.stringify(key)}:${toClientOptionsKey(record[key])}`)
|
|
19
|
+
.join(",")}}`;
|
|
20
|
+
};
|
|
21
|
+
export function GetUserFeedbackProvider({ children, clientOptions, instanceId: instanceIdProp, onError, webViewComponent, }) {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
const [instanceId] = useState(() => {
|
|
24
|
+
const normalizedInstanceId = instanceIdProp === null || instanceIdProp === void 0 ? void 0 : instanceIdProp.trim();
|
|
25
|
+
return normalizedInstanceId && normalizedInstanceId.length > 0
|
|
26
|
+
? normalizedInstanceId
|
|
27
|
+
: createUniqueId("rn");
|
|
28
|
+
});
|
|
29
|
+
const normalizedClientOptions = parseInitOptions(clientOptions);
|
|
30
|
+
const clientOptionsKey = toClientOptionsKey(normalizedClientOptions);
|
|
31
|
+
const coreUrl = (_b = (_a = normalizedClientOptions.runtimeEndpoints) === null || _a === void 0 ? void 0 : _a.coreUrl) !== null && _b !== void 0 ? _b : PRODUCTION_WIDGET_RUNTIME_ENDPOINTS.coreUrl;
|
|
32
|
+
const onErrorRef = useRef(onError);
|
|
33
|
+
onErrorRef.current = onError;
|
|
34
|
+
const reportError = useCallback((error) => {
|
|
35
|
+
var _a;
|
|
36
|
+
try {
|
|
37
|
+
(_a = onErrorRef.current) === null || _a === void 0 ? void 0 : _a.call(onErrorRef, error);
|
|
38
|
+
}
|
|
39
|
+
catch (_b) {
|
|
40
|
+
// Error observers cannot change runtime cleanup or command settlement.
|
|
41
|
+
}
|
|
42
|
+
}, []);
|
|
43
|
+
const controllerRef = useRef(null);
|
|
44
|
+
if (controllerRef.current === null) {
|
|
45
|
+
controllerRef.current = createNativeProviderClientController({
|
|
46
|
+
instanceId,
|
|
47
|
+
onError: reportError,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
const controller = controllerRef.current;
|
|
51
|
+
const lifecycleRevisionRef = useRef(0);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
lifecycleRevisionRef.current += 1;
|
|
54
|
+
const lifecycleRevision = lifecycleRevisionRef.current;
|
|
55
|
+
return () => {
|
|
56
|
+
queueMicrotask(() => {
|
|
57
|
+
if (lifecycleRevisionRef.current === lifecycleRevision) {
|
|
58
|
+
controller.dispose();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
}, [controller]);
|
|
63
|
+
const handleCommandSessionChange = useCallback((session) => {
|
|
64
|
+
if (session === null) {
|
|
65
|
+
controller.onSessionEnded();
|
|
66
|
+
}
|
|
67
|
+
}, [controller]);
|
|
68
|
+
const handleHandleInvalidated = useCallback((message) => controller.onHandleInvalidated(message), [controller]);
|
|
69
|
+
return createElement(GetUserFeedbackContext.Provider, { value: controller.client }, createElement(Fragment, null, children, createElement(NativeProviderRuntime, {
|
|
70
|
+
coreUrl,
|
|
71
|
+
coreWebViewComponent: webViewComponent,
|
|
72
|
+
directSessionController: controller.directSessionController,
|
|
73
|
+
initOptions: normalizedClientOptions,
|
|
74
|
+
instanceId,
|
|
75
|
+
key: clientOptionsKey,
|
|
76
|
+
onCommandSessionChange: handleCommandSessionChange,
|
|
77
|
+
onError: reportError,
|
|
78
|
+
onHandleInvalidated: handleHandleInvalidated,
|
|
79
|
+
viewWebViewComponent: webViewComponent,
|
|
80
|
+
})));
|
|
81
|
+
}
|
|
82
|
+
export function useGetUserFeedback() {
|
|
83
|
+
const client = useContext(GetUserFeedbackContext);
|
|
84
|
+
if (client === null) {
|
|
85
|
+
throw new Error("useGetUserFeedback must be used inside GetUserFeedbackProvider");
|
|
86
|
+
}
|
|
87
|
+
return client;
|
|
88
|
+
}
|
|
@@ -8,9 +8,8 @@ import { type NativeDirectCommandSession } from "./native-direct-command-session
|
|
|
8
8
|
import type { NativeDirectCommandSessionController } from "./native-direct-command-session-controller.js";
|
|
9
9
|
import { type NativeViewHostProjectionProps } from "./native-view-host-projection.js";
|
|
10
10
|
export type NativeRuntimeRootProps = {
|
|
11
|
-
coreUrl
|
|
11
|
+
coreUrl?: string;
|
|
12
12
|
coreWebViewComponent?: CoreWebViewHostProps["webViewComponent"];
|
|
13
|
-
coreWebViewProps?: CoreWebViewHostProps["webViewProps"];
|
|
14
13
|
startupCommands?: NativeRuntimeStartupCommands;
|
|
15
14
|
onCommandSessionChange?: (session: NativeCoreCommandSession | null) => void;
|
|
16
15
|
onError?: (error: Error) => void;
|
|
@@ -20,7 +19,6 @@ export type NativeRuntimeRootProps = {
|
|
|
20
19
|
startupCommandSettlementTimeoutMs?: number;
|
|
21
20
|
viewNativeViewComponent?: NativeViewHostProjectionProps["nativeViewComponent"];
|
|
22
21
|
viewWebViewComponent?: NativeViewHostProjectionProps["webViewComponent"];
|
|
23
|
-
viewWebViewProps?: NativeViewHostProjectionProps["webViewProps"];
|
|
24
22
|
};
|
|
25
23
|
type NativeRuntimeInitCommand = Omit<CoreCommandEnvelope, "command"> & {
|
|
26
24
|
command: Extract<CoreCommandEnvelope["command"], {
|
|
@@ -41,6 +39,6 @@ type NativeProviderRuntimeProps = Omit<NativeRuntimeRootProps, "onCommandSession
|
|
|
41
39
|
instanceId: string;
|
|
42
40
|
onCommandSessionChange?: (session: NativeDirectCommandSession | null) => void;
|
|
43
41
|
};
|
|
44
|
-
export declare function NativeRuntimeRoot({ coreUrl, coreWebViewComponent,
|
|
42
|
+
export declare function NativeRuntimeRoot({ coreUrl, coreWebViewComponent, onCommandSessionChange, onError, onHandleInvalidated, onInvalidMessage, onStartupTerminalError, startupCommandSettlementTimeoutMs, startupCommands, viewNativeViewComponent, viewWebViewComponent, }: NativeRuntimeRootProps): ReactElement;
|
|
45
43
|
export declare function NativeProviderRuntime({ directSessionController, initOptions, initialConfigureOptions, instanceId, onCommandSessionChange, onError, ...runtimeProps }: NativeProviderRuntimeProps): ReactElement;
|
|
46
44
|
export {};
|
|
@@ -18,6 +18,7 @@ import { createNativeDirectCommandSession, } from "./native-direct-command-sessi
|
|
|
18
18
|
import { NativeViewHostProjection, } from "./native-view-host-projection.js";
|
|
19
19
|
import { createNativeViewRecordController, } from "./native-view-record-controller.js";
|
|
20
20
|
import { createProviderCommandEnvelope, REACT_NATIVE_CLIENT_META, } from "./provider-command-helpers.js";
|
|
21
|
+
import { REACT_NATIVE_DEFAULT_CORE_URL } from "./runtime-endpoints.js";
|
|
21
22
|
const DEFAULT_STARTUP_COMMAND_SETTLEMENT_TIMEOUT_MS = 30000;
|
|
22
23
|
async function dispatchStartupCommands(input) {
|
|
23
24
|
for (const command of input.commands) {
|
|
@@ -26,7 +27,7 @@ async function dispatchStartupCommands(input) {
|
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
|
-
export function NativeRuntimeRoot({ coreUrl, coreWebViewComponent,
|
|
30
|
+
export function NativeRuntimeRoot({ coreUrl = REACT_NATIVE_DEFAULT_CORE_URL, coreWebViewComponent, onCommandSessionChange, onError, onHandleInvalidated, onInvalidMessage, onStartupTerminalError, startupCommandSettlementTimeoutMs = DEFAULT_STARTUP_COMMAND_SETTLEMENT_TIMEOUT_MS, startupCommands, viewNativeViewComponent, viewWebViewComponent, }) {
|
|
30
31
|
const [coreHostRevision, setCoreHostRevision] = useState(0);
|
|
31
32
|
const [session, setSession] = useState(null);
|
|
32
33
|
const sessionRef = useRef(null);
|
|
@@ -89,6 +90,10 @@ export function NativeRuntimeRoot({ coreUrl, coreWebViewComponent, coreWebViewPr
|
|
|
89
90
|
});
|
|
90
91
|
const commandChannelOwner = createNativeCoreCommandChannel({
|
|
91
92
|
coreConnection,
|
|
93
|
+
onSessionFailure: (error) => {
|
|
94
|
+
reportError(error);
|
|
95
|
+
coreConnection.disconnect();
|
|
96
|
+
},
|
|
92
97
|
onHandleInvalidated: (message) => {
|
|
93
98
|
var _a;
|
|
94
99
|
try {
|
|
@@ -210,7 +215,6 @@ export function NativeRuntimeRoot({ coreUrl, coreWebViewComponent, coreWebViewPr
|
|
|
210
215
|
onDisconnected: handleDisconnected,
|
|
211
216
|
onInvalidMessage,
|
|
212
217
|
webViewComponent: coreWebViewComponent,
|
|
213
|
-
webViewProps: coreWebViewProps,
|
|
214
218
|
}), session === null
|
|
215
219
|
? null
|
|
216
220
|
: createElement(NativeViewHostProjection, {
|
|
@@ -219,7 +223,6 @@ export function NativeRuntimeRoot({ coreUrl, coreWebViewComponent, coreWebViewPr
|
|
|
219
223
|
nativeViewComponent: viewNativeViewComponent,
|
|
220
224
|
onInvalidMessage,
|
|
221
225
|
webViewComponent: viewWebViewComponent,
|
|
222
|
-
webViewProps: viewWebViewProps,
|
|
223
226
|
}));
|
|
224
227
|
}
|
|
225
228
|
export function NativeProviderRuntime(_a) {
|
|
@@ -5,6 +5,5 @@ export type NativeViewHostProjectionProps = {
|
|
|
5
5
|
onInvalidMessage?: (error: Error, value: unknown) => void;
|
|
6
6
|
nativeViewComponent?: ComponentType<Record<string, unknown>>;
|
|
7
7
|
webViewComponent?: ComponentType<Record<string, unknown>>;
|
|
8
|
-
webViewProps?: Record<string, unknown>;
|
|
9
8
|
};
|
|
10
|
-
export declare function NativeViewHostProjection({ controller, nativeViewComponent, onInvalidMessage, webViewComponent,
|
|
9
|
+
export declare function NativeViewHostProjection({ controller, nativeViewComponent, onInvalidMessage, webViewComponent, }: NativeViewHostProjectionProps): ReactElement;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createElement, Fragment, useCallback, useEffect, useLayoutEffect,
|
|
1
|
+
import { createElement, Fragment, useCallback, useEffect, useLayoutEffect, useRef, useSyncExternalStore, } from "react";
|
|
2
2
|
import { NativeViewPresentationSurface } from "./native-view-presentation-surface.js";
|
|
3
3
|
import { ViewWebViewHost } from "./view-webview-host.js";
|
|
4
|
-
function NativeViewHostProjectionEntry({ controller, nativeViewComponent, onInvalidMessage, record, webViewComponent,
|
|
4
|
+
function NativeViewHostProjectionEntry({ controller, nativeViewComponent, onInvalidMessage, record, webViewComponent, }) {
|
|
5
5
|
var _a;
|
|
6
6
|
const detachConnectionRef = useRef(null);
|
|
7
7
|
const detachConnection = useCallback(() => {
|
|
@@ -18,7 +18,6 @@ function NativeViewHostProjectionEntry({ controller, nativeViewComponent, onInva
|
|
|
18
18
|
detachConnectionRef.current = controllerDetach;
|
|
19
19
|
}
|
|
20
20
|
}, [controller, record.allocationId]);
|
|
21
|
-
const presentedWebViewProps = useMemo(() => (Object.assign(Object.assign({}, webViewProps), { style: [webViewProps === null || webViewProps === void 0 ? void 0 : webViewProps.style, { flex: 1 }] })), [webViewProps]);
|
|
22
21
|
const layoutTransactionId = (_a = record.size) === null || _a === void 0 ? void 0 : _a.layoutTransactionId;
|
|
23
22
|
useLayoutEffect(() => {
|
|
24
23
|
if (!layoutTransactionId) {
|
|
@@ -37,19 +36,37 @@ function NativeViewHostProjectionEntry({ controller, nativeViewComponent, onInva
|
|
|
37
36
|
record.layoutReportRevision,
|
|
38
37
|
record.viewId,
|
|
39
38
|
]);
|
|
39
|
+
// Connection readiness is controller-private, so a readiness-only snapshot
|
|
40
|
+
// update may leave the presented record fields unchanged. The controller's
|
|
41
|
+
// occurrence latch makes this render-time check idempotent.
|
|
42
|
+
useLayoutEffect(() => {
|
|
43
|
+
if (!record.isActive || record.size === null) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
controller.acknowledgeViewPresentation({
|
|
47
|
+
allocationId: record.allocationId,
|
|
48
|
+
viewId: record.viewId,
|
|
49
|
+
});
|
|
50
|
+
});
|
|
40
51
|
useEffect(() => detachConnection, [detachConnection]);
|
|
41
52
|
return createElement(NativeViewPresentationSurface, { nativeViewComponent, record }, createElement(ViewWebViewHost, {
|
|
42
53
|
generation: record.generation,
|
|
54
|
+
onActivationRetryExhausted: (error) => {
|
|
55
|
+
controller.failViewAllocation({
|
|
56
|
+
allocationId: record.allocationId,
|
|
57
|
+
error,
|
|
58
|
+
viewId: record.viewId,
|
|
59
|
+
});
|
|
60
|
+
},
|
|
43
61
|
onConnected: handleConnected,
|
|
44
62
|
onDisconnected: detachConnection,
|
|
45
63
|
onInvalidMessage,
|
|
46
64
|
srcdoc: record.srcdoc,
|
|
47
65
|
viewId: record.viewId,
|
|
48
66
|
webViewComponent,
|
|
49
|
-
webViewProps: presentedWebViewProps,
|
|
50
67
|
}));
|
|
51
68
|
}
|
|
52
|
-
export function NativeViewHostProjection({ controller, nativeViewComponent, onInvalidMessage, webViewComponent,
|
|
69
|
+
export function NativeViewHostProjection({ controller, nativeViewComponent, onInvalidMessage, webViewComponent, }) {
|
|
53
70
|
const records = useSyncExternalStore(controller.subscribe, controller.getSnapshot, controller.getSnapshot);
|
|
54
71
|
return createElement(Fragment, null, records.map((record) => createElement(NativeViewHostProjectionEntry, {
|
|
55
72
|
controller,
|
|
@@ -57,7 +74,6 @@ export function NativeViewHostProjection({ controller, nativeViewComponent, onIn
|
|
|
57
74
|
onInvalidMessage,
|
|
58
75
|
record,
|
|
59
76
|
webViewComponent,
|
|
60
|
-
webViewProps,
|
|
61
77
|
key: record.allocationId,
|
|
62
78
|
})));
|
|
63
79
|
}
|
|
@@ -60,6 +60,9 @@ export function NativeViewPresentationSurface({ children, nativeViewComponent, r
|
|
|
60
60
|
? record.size.frameAppearance.resolvedBoxShadow
|
|
61
61
|
: undefined);
|
|
62
62
|
const nativeBoxShadow = toNativeWidgetSupportedBoxShadow(shadow, resolveNativeWidgetBoxShadowSupport());
|
|
63
|
+
const frameShadowStyle = nativeBoxShadow === undefined && shadow.kind === "resolved"
|
|
64
|
+
? shadow.fallbackStyle
|
|
65
|
+
: {};
|
|
63
66
|
const frameOverlayShadowStyle = nativeBoxShadow === undefined ? {} : { boxShadow: nativeBoxShadow };
|
|
64
67
|
const borderStyle = toNativeWidgetResolvedBorderStyle(((_f = (_e = record.size) === null || _e === void 0 ? void 0 : _e.frameAppearance) === null || _f === void 0 ? void 0 : _f.kind) === "page"
|
|
65
68
|
? record.size.frameAppearance.resolvedBorder
|
|
@@ -71,6 +74,8 @@ export function NativeViewPresentationSurface({ children, nativeViewComponent, r
|
|
|
71
74
|
borderTopRightRadius: cornerRadii.topRight,
|
|
72
75
|
};
|
|
73
76
|
return createElement(NativeView, {
|
|
77
|
+
accessibilityElementsHidden: !isPresented,
|
|
78
|
+
importantForAccessibility: isPresented ? "auto" : "no-hide-descendants",
|
|
74
79
|
pointerEvents: isPresented ? "box-none" : "none",
|
|
75
80
|
style: Object.assign(Object.assign(Object.assign({}, HOST_SURFACE_STYLE), (((_g = record.size) === null || _g === void 0 ? void 0 : _g.placement) === "docked-top"
|
|
76
81
|
? TOP_PLACEMENT_STYLE
|
|
@@ -81,7 +86,7 @@ export function NativeViewPresentationSurface({ children, nativeViewComponent, r
|
|
|
81
86
|
}, createElement(NativeView, {
|
|
82
87
|
pointerEvents: isPresented ? "auto" : "none",
|
|
83
88
|
style: hasMeasuredFrame
|
|
84
|
-
? Object.assign(Object.assign(Object.assign({}, MEASURED_VIEW_FRAME_STYLE), cornerRadiusStyle), { height: (_h = record.size) === null || _h === void 0 ? void 0 : _h.height, width: (_j = record.size) === null || _j === void 0 ? void 0 : _j.width }) : PREPARING_VIEW_FRAME_STYLE,
|
|
89
|
+
? Object.assign(Object.assign(Object.assign(Object.assign({}, MEASURED_VIEW_FRAME_STYLE), cornerRadiusStyle), frameShadowStyle), { height: (_h = record.size) === null || _h === void 0 ? void 0 : _h.height, width: (_j = record.size) === null || _j === void 0 ? void 0 : _j.width }) : PREPARING_VIEW_FRAME_STYLE,
|
|
85
90
|
testID: `gx-native-view-frame-${record.viewId}`,
|
|
86
91
|
}, createElement(NativeView, {
|
|
87
92
|
style: Object.assign(Object.assign({}, VIEW_FRAME_CONTENT_STYLE), cornerRadiusStyle),
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type OpenRequestMetadata } from "@getuserfeedback/protocol/internal/core-view-host-actions";
|
|
2
1
|
import { type EventViewSize } from "@getuserfeedback/protocol/internal/view-host-control-messages";
|
|
3
2
|
import type { CoreWebViewHostConnection } from "./core-webview-host-controller.js";
|
|
4
3
|
import type { ViewWebViewHostConnection } from "./view-webview-host-controller.js";
|
|
@@ -6,10 +5,8 @@ type NativeViewSizeReport = Omit<EventViewSize, "gen" | "t" | "viewId">;
|
|
|
6
5
|
export type NativeViewRecord = Readonly<{
|
|
7
6
|
allocationId: number;
|
|
8
7
|
generation: number;
|
|
9
|
-
instanceId: string;
|
|
10
8
|
isActive: boolean;
|
|
11
9
|
layoutReportRevision: number;
|
|
12
|
-
openRequest: Readonly<OpenRequestMetadata> | undefined;
|
|
13
10
|
size: NativeViewSizeReport | null;
|
|
14
11
|
srcdoc: string;
|
|
15
12
|
viewId: string;
|
|
@@ -25,6 +22,15 @@ export type NativeViewRecordController = {
|
|
|
25
22
|
layoutTransactionId: string;
|
|
26
23
|
viewId: string;
|
|
27
24
|
}): void;
|
|
25
|
+
acknowledgeViewPresentation(input: {
|
|
26
|
+
allocationId: number;
|
|
27
|
+
viewId: string;
|
|
28
|
+
}): void;
|
|
29
|
+
failViewAllocation(input: {
|
|
30
|
+
allocationId: number;
|
|
31
|
+
error: unknown;
|
|
32
|
+
viewId: string;
|
|
33
|
+
}): void;
|
|
28
34
|
dispose(): void;
|
|
29
35
|
getSnapshot(): readonly NativeViewRecord[];
|
|
30
36
|
subscribe(listener: () => void): () => void;
|