@getuserfeedback/react-native 4.0.29 → 5.0.6
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 +32 -35
- 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
|
@@ -15,6 +15,7 @@ export declare const createViewWebViewHostController: (input: {
|
|
|
15
15
|
generation: number;
|
|
16
16
|
onConnected: (connection: ViewWebViewHostConnection) => void;
|
|
17
17
|
onDisconnected?: () => void;
|
|
18
|
+
onActivationRetryExhausted?: (error: Error) => void;
|
|
18
19
|
activationRetryIntervalMs?: number;
|
|
19
20
|
activationRetryTimeoutMs?: number;
|
|
20
21
|
}) => ViewWebViewHostController;
|
|
@@ -25,6 +25,7 @@ export const createViewWebViewHostController = (input) => {
|
|
|
25
25
|
});
|
|
26
26
|
},
|
|
27
27
|
onDisconnected: input.onDisconnected,
|
|
28
|
+
onActivationRetryExhausted: input.onActivationRetryExhausted,
|
|
28
29
|
activationRetryIntervalMs: input.activationRetryIntervalMs,
|
|
29
30
|
activationRetryTimeoutMs: input.activationRetryTimeoutMs,
|
|
30
31
|
});
|
|
@@ -6,8 +6,8 @@ export type ViewWebViewHostProps = {
|
|
|
6
6
|
srcdoc: string;
|
|
7
7
|
onConnected: (connection: ViewWebViewHostConnection) => void;
|
|
8
8
|
onDisconnected?: () => void;
|
|
9
|
+
onActivationRetryExhausted?: (error: Error) => void;
|
|
9
10
|
onInvalidMessage?: (error: Error, value: unknown) => void;
|
|
10
11
|
webViewComponent?: ComponentType<Record<string, unknown>>;
|
|
11
|
-
webViewProps?: Record<string, unknown>;
|
|
12
12
|
};
|
|
13
13
|
export declare function ViewWebViewHost(props: ViewWebViewHostProps): ReactElement;
|
|
@@ -3,7 +3,7 @@ import { buildViewWebViewBridgeScript, parseViewWebViewBridgeMessage, toExternal
|
|
|
3
3
|
import { createViewWebViewHostController, } from "./view-webview-host-controller.js";
|
|
4
4
|
import { WebViewDocumentHost } from "./webview-document-host.js";
|
|
5
5
|
let nextBridgeId = 0;
|
|
6
|
-
function ViewWebViewHostDocument({ generation, onConnected, onDisconnected, onInvalidMessage, srcdoc, viewId, webViewComponent,
|
|
6
|
+
function ViewWebViewHostDocument({ generation, onConnected, onDisconnected, onActivationRetryExhausted, onInvalidMessage, srcdoc, viewId, webViewComponent, }) {
|
|
7
7
|
const bridgeIdRef = useRef(null);
|
|
8
8
|
if (bridgeIdRef.current === null) {
|
|
9
9
|
nextBridgeId += 1;
|
|
@@ -27,23 +27,19 @@ function ViewWebViewHostDocument({ generation, onConnected, onDisconnected, onIn
|
|
|
27
27
|
var _a;
|
|
28
28
|
(_a = onDisconnectedRef.current) === null || _a === void 0 ? void 0 : _a.call(onDisconnectedRef);
|
|
29
29
|
},
|
|
30
|
+
onActivationRetryExhausted,
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
33
|
const controller = controllerRef.current;
|
|
33
34
|
const buildDocumentStartScript = useMemo(() => () => buildViewWebViewBridgeScript({ bridgeId, phase: "documentStart" }), [bridgeId]);
|
|
34
35
|
const source = useMemo(() => toExternalViewSource({ bridgeId, srcdoc }), [bridgeId, srcdoc]);
|
|
35
|
-
const resolvedWebViewProps = useMemo(() => {
|
|
36
|
-
var _a;
|
|
37
|
-
return (Object.assign(Object.assign({}, webViewProps), { originWhitelist: (_a = webViewProps === null || webViewProps === void 0 ? void 0 : webViewProps.originWhitelist) !== null && _a !== void 0 ? _a : ["*"] }));
|
|
38
|
-
}, [webViewProps]);
|
|
39
36
|
return createElement((WebViewDocumentHost), {
|
|
40
|
-
bridgeId,
|
|
41
37
|
buildDocumentStartScript,
|
|
42
38
|
controller,
|
|
43
39
|
parseMessage: parseViewWebViewBridgeMessage,
|
|
44
40
|
source,
|
|
45
41
|
webViewComponent,
|
|
46
|
-
|
|
42
|
+
webViewRole: "view",
|
|
47
43
|
onInvalidMessage,
|
|
48
44
|
});
|
|
49
45
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { type ComponentType, type ReactElement } from "react";
|
|
2
2
|
import type { WebViewBridgeMessageIdentity, WebViewHostController } from "./webview-host-controller.js";
|
|
3
3
|
export type WebViewDocumentHostProps<TMessage extends WebViewBridgeMessageIdentity> = {
|
|
4
|
-
bridgeId: string;
|
|
5
4
|
buildDocumentStartScript: () => string;
|
|
6
5
|
controller: WebViewHostController<TMessage>;
|
|
7
6
|
parseMessage: (value: unknown) => TMessage;
|
|
8
7
|
source: Record<string, unknown>;
|
|
9
8
|
webViewComponent?: ComponentType<Record<string, unknown>>;
|
|
10
|
-
|
|
9
|
+
webViewRole: "core" | "view";
|
|
11
10
|
onInvalidMessage?: (error: Error, value: unknown) => void;
|
|
12
11
|
};
|
|
13
|
-
export declare function WebViewDocumentHost<TMessage extends WebViewBridgeMessageIdentity>({
|
|
12
|
+
export declare function WebViewDocumentHost<TMessage extends WebViewBridgeMessageIdentity>({ buildDocumentStartScript, controller, parseMessage, source, webViewComponent, webViewRole, onInvalidMessage, }: WebViewDocumentHostProps<TMessage>): ReactElement;
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { createElement, useCallback, useEffect, useMemo, useRef, } from "react";
|
|
2
|
+
const CORE_WEBVIEW_STYLE = {
|
|
3
|
+
height: 1,
|
|
4
|
+
left: -10000,
|
|
5
|
+
opacity: 0,
|
|
6
|
+
position: "absolute",
|
|
7
|
+
top: 0,
|
|
8
|
+
width: 1,
|
|
9
|
+
};
|
|
10
|
+
const VIEW_WEBVIEW_STYLE = { flex: 1 };
|
|
2
11
|
const resolveWebViewComponent = () => {
|
|
3
12
|
var _a;
|
|
4
13
|
const webViewModule = require("react-native-webview");
|
|
@@ -19,46 +28,32 @@ const toMessageData = (value) => {
|
|
|
19
28
|
return value;
|
|
20
29
|
}
|
|
21
30
|
};
|
|
22
|
-
|
|
23
|
-
const toInjectionScript = (value) => typeof value === "string" && value.length > 0 ? value : undefined;
|
|
24
|
-
const toTruthyInjectionScript = (value) => {
|
|
25
|
-
const script = toInjectionScript(value);
|
|
26
|
-
return script ? `${script}\ntrue;` : undefined;
|
|
27
|
-
};
|
|
28
|
-
const composeInjectionScripts = (bridgeScript, callerScript) => {
|
|
29
|
-
const script = toInjectionScript(callerScript);
|
|
30
|
-
return script ? `${bridgeScript}\n${script}\ntrue;` : bridgeScript;
|
|
31
|
-
};
|
|
32
|
-
const isBridgeMessageCandidate = (value, bridgeId) => typeof value === "object" &&
|
|
33
|
-
value !== null &&
|
|
34
|
-
"bridgeId" in value &&
|
|
35
|
-
value.bridgeId === bridgeId;
|
|
36
|
-
export function WebViewDocumentHost({ bridgeId, buildDocumentStartScript, controller, parseMessage, source, webViewComponent, webViewProps, onInvalidMessage, }) {
|
|
31
|
+
export function WebViewDocumentHost({ buildDocumentStartScript, controller, parseMessage, source, webViewComponent, webViewRole, onInvalidMessage, }) {
|
|
37
32
|
const WebView = webViewComponent !== null && webViewComponent !== void 0 ? webViewComponent : resolveWebViewComponent();
|
|
38
33
|
const onInvalidMessageRef = useRef(onInvalidMessage);
|
|
39
34
|
onInvalidMessageRef.current = onInvalidMessage;
|
|
40
35
|
const documentStartBridgeScript = useMemo(() => buildDocumentStartScript(), [buildDocumentStartScript]);
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
const webViewHandleRef = useRef(null);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
const currentHandle = webViewHandleRef.current;
|
|
39
|
+
if (currentHandle) {
|
|
40
|
+
controller.attach(currentHandle);
|
|
41
|
+
}
|
|
42
|
+
return () => {
|
|
43
|
+
controller.detach();
|
|
44
|
+
};
|
|
46
45
|
}, [controller]);
|
|
47
46
|
const setWebViewRef = useCallback((handle) => {
|
|
48
47
|
if (!handle || typeof handle.injectJavaScript !== "function") {
|
|
48
|
+
webViewHandleRef.current = null;
|
|
49
49
|
controller.detach();
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
|
+
webViewHandleRef.current = handle;
|
|
52
53
|
controller.attach(handle);
|
|
53
54
|
}, [controller]);
|
|
54
|
-
const handleLoadStart = useCallback((
|
|
55
|
-
|
|
56
|
-
callerOnLoadStart === null || callerOnLoadStart === void 0 ? void 0 : callerOnLoadStart(event);
|
|
57
|
-
}, [callerOnLoadStart, controller]);
|
|
58
|
-
const handleLoad = useCallback((event) => {
|
|
59
|
-
controller.completeLoad();
|
|
60
|
-
callerOnLoad === null || callerOnLoad === void 0 ? void 0 : callerOnLoad(event);
|
|
61
|
-
}, [callerOnLoad, controller]);
|
|
55
|
+
const handleLoadStart = useCallback(() => controller.beginLoad(), [controller]);
|
|
56
|
+
const handleLoad = useCallback(() => controller.completeLoad(), [controller]);
|
|
62
57
|
const handleMessage = useCallback((event) => {
|
|
63
58
|
var _a, _b;
|
|
64
59
|
const value = toMessageData((_a = event.nativeEvent) === null || _a === void 0 ? void 0 : _a.data);
|
|
@@ -67,14 +62,16 @@ export function WebViewDocumentHost({ bridgeId, buildDocumentStartScript, contro
|
|
|
67
62
|
message = parseMessage(value);
|
|
68
63
|
}
|
|
69
64
|
catch (error) {
|
|
70
|
-
|
|
71
|
-
(_b = onInvalidMessageRef.current) === null || _b === void 0 ? void 0 : _b.call(onInvalidMessageRef, error instanceof Error ? error : new Error(String(error)), value);
|
|
72
|
-
}
|
|
73
|
-
callerOnMessage === null || callerOnMessage === void 0 ? void 0 : callerOnMessage(event);
|
|
65
|
+
(_b = onInvalidMessageRef.current) === null || _b === void 0 ? void 0 : _b.call(onInvalidMessageRef, error instanceof Error ? error : new Error(String(error)), value);
|
|
74
66
|
return;
|
|
75
67
|
}
|
|
76
68
|
controller.handleMessage(message);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
69
|
+
}, [controller, parseMessage]);
|
|
70
|
+
return createElement(WebView, Object.assign(Object.assign({}, (webViewRole === "core"
|
|
71
|
+
? {
|
|
72
|
+
containerStyle: CORE_WEBVIEW_STYLE,
|
|
73
|
+
pointerEvents: "none",
|
|
74
|
+
style: CORE_WEBVIEW_STYLE,
|
|
75
|
+
}
|
|
76
|
+
: { originWhitelist: ["*"], style: VIEW_WEBVIEW_STYLE })), { injectedJavaScriptBeforeContentLoaded: documentStartBridgeScript, onLoad: handleLoad, onLoadStart: handleLoadStart, onMessage: handleMessage, ref: setWebViewRef, source }));
|
|
80
77
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getuserfeedback/react-native",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.6",
|
|
4
4
|
"description": "getuserfeedback React Native SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"getuserfeedback",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"lint": "biome check ."
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@getuserfeedback/protocol": "^3.
|
|
48
|
-
"@getuserfeedback/sdk": "^0.12.
|
|
47
|
+
"@getuserfeedback/protocol": "^3.31.0",
|
|
48
|
+
"@getuserfeedback/sdk": "^0.12.35",
|
|
49
49
|
"robot3": "^1.2.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
package/dist/host-viewport.d.ts
DELETED
package/dist/host-viewport.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { useEffect, useMemo, useState } from "react";
|
|
2
|
-
function isHostViewport(value) {
|
|
3
|
-
return (typeof value === "object" &&
|
|
4
|
-
value !== null &&
|
|
5
|
-
"width" in value &&
|
|
6
|
-
typeof value.width === "number" &&
|
|
7
|
-
Number.isFinite(value.width) &&
|
|
8
|
-
value.width > 0 &&
|
|
9
|
-
"height" in value &&
|
|
10
|
-
typeof value.height === "number" &&
|
|
11
|
-
Number.isFinite(value.height) &&
|
|
12
|
-
value.height > 0);
|
|
13
|
-
}
|
|
14
|
-
function toHostViewport(value) {
|
|
15
|
-
return isHostViewport(value)
|
|
16
|
-
? {
|
|
17
|
-
height: value.height,
|
|
18
|
-
width: value.width,
|
|
19
|
-
}
|
|
20
|
-
: undefined;
|
|
21
|
-
}
|
|
22
|
-
function resolveReactNativeDimensions() {
|
|
23
|
-
var _a;
|
|
24
|
-
try {
|
|
25
|
-
const reactNativeModule = require("react-native");
|
|
26
|
-
return (_a = reactNativeModule.Dimensions) !== null && _a !== void 0 ? _a : null;
|
|
27
|
-
}
|
|
28
|
-
catch (_b) {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
function readWindowViewport(dimensions) {
|
|
33
|
-
if (!dimensions) {
|
|
34
|
-
return undefined;
|
|
35
|
-
}
|
|
36
|
-
return toHostViewport(dimensions.get("window"));
|
|
37
|
-
}
|
|
38
|
-
function useReactNativeWindowViewport(enabled) {
|
|
39
|
-
const dimensions = useMemo(() => (enabled ? resolveReactNativeDimensions() : null), [enabled]);
|
|
40
|
-
const [viewport, setViewport] = useState(() => readWindowViewport(dimensions));
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
if (!enabled) {
|
|
43
|
-
setViewport(undefined);
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
setViewport(readWindowViewport(dimensions));
|
|
47
|
-
if (!(dimensions === null || dimensions === void 0 ? void 0 : dimensions.addEventListener)) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
const handleChange = (event) => {
|
|
51
|
-
var _a;
|
|
52
|
-
setViewport((_a = toHostViewport(event.window)) !== null && _a !== void 0 ? _a : readWindowViewport(dimensions));
|
|
53
|
-
};
|
|
54
|
-
const subscription = dimensions.addEventListener("change", handleChange);
|
|
55
|
-
return () => {
|
|
56
|
-
var _a;
|
|
57
|
-
if (subscription === null || subscription === void 0 ? void 0 : subscription.remove) {
|
|
58
|
-
subscription.remove();
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
(_a = dimensions.removeEventListener) === null || _a === void 0 ? void 0 : _a.call(dimensions, "change", handleChange);
|
|
62
|
-
};
|
|
63
|
-
}, [dimensions, enabled]);
|
|
64
|
-
return viewport !== null && viewport !== void 0 ? viewport : readWindowViewport(dimensions);
|
|
65
|
-
}
|
|
66
|
-
export function useResolvedHostViewport(explicitHostViewport) {
|
|
67
|
-
const measuredHostViewport = useReactNativeWindowViewport(explicitHostViewport === undefined);
|
|
68
|
-
return explicitHostViewport !== null && explicitHostViewport !== void 0 ? explicitHostViewport : measuredHostViewport;
|
|
69
|
-
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import type { AppEventExternalId, AppEventJsonValue, PublicCommandPayload } from "@getuserfeedback/protocol";
|
|
2
|
-
import type { WebViewCommandEnvelope, WebViewTransportNativeMessage, WebViewTransportWebMessage } from "@getuserfeedback/protocol/webview-transport";
|
|
3
|
-
import type { ConfigureOptions, InitOptions } from "@getuserfeedback/sdk";
|
|
4
|
-
import { type ReactElement, type ReactNode } from "react";
|
|
5
|
-
import { type CommandSettledEvent, type CommandSettledSuccessDetail } from "./provider-command-helpers.js";
|
|
6
|
-
import { WidgetHost, type WidgetHostProps, type WidgetHostSource } from "./widget-host.js";
|
|
7
|
-
export { REACT_NATIVE_SDK_VERSION } from "./version.js";
|
|
8
|
-
export { buildNativeMessageInjectionScript, buildWebViewBridgeScript, } from "./webview-bridge-script.js";
|
|
9
|
-
export { WidgetHost, type WidgetHostProps, type WidgetHostSource };
|
|
10
|
-
export type ReactNativeWidgetCommandEnvelope = WebViewCommandEnvelope;
|
|
11
|
-
export type ReactNativeWidgetCommand = ReactNativeWidgetCommandEnvelope["command"];
|
|
12
|
-
export type ReactNativeWidgetNativeMessage = WebViewTransportNativeMessage;
|
|
13
|
-
export type ReactNativeWidgetWebMessage = WebViewTransportWebMessage;
|
|
14
|
-
type IdentifyTraits = Record<string, unknown>;
|
|
15
|
-
type TrackProperties = Record<string, AppEventJsonValue>;
|
|
16
|
-
type OpenCommand = Extract<PublicCommandPayload, {
|
|
17
|
-
kind: "open";
|
|
18
|
-
}>;
|
|
19
|
-
type PrerenderCommand = Extract<PublicCommandPayload, {
|
|
20
|
-
kind: "prerender";
|
|
21
|
-
}>;
|
|
22
|
-
type IdentifyOptions = {
|
|
23
|
-
externalIds?: AppEventExternalId[];
|
|
24
|
-
};
|
|
25
|
-
type TrackOptions = {
|
|
26
|
-
externalIds?: AppEventExternalId[];
|
|
27
|
-
};
|
|
28
|
-
export type OpenFlowOptions = Pick<OpenCommand, "hideCloseButton" | "metadata">;
|
|
29
|
-
export type PrerenderFlowOptions = Pick<PrerenderCommand, "hideCloseButton">;
|
|
30
|
-
type HostContext = Extract<PublicCommandPayload, {
|
|
31
|
-
kind: "updateHostContext";
|
|
32
|
-
}>["context"];
|
|
33
|
-
export interface ReactNativeCommandResult {
|
|
34
|
-
envelope: ReactNativeWidgetCommandEnvelope;
|
|
35
|
-
message: ReactNativeWidgetNativeMessage;
|
|
36
|
-
settlement?: CommandSettledEvent["detail"];
|
|
37
|
-
settlementResult?: CommandSettledSuccessDetail["result"];
|
|
38
|
-
}
|
|
39
|
-
export interface ReactNativeCommandOptions {
|
|
40
|
-
idempotencyKey?: string;
|
|
41
|
-
}
|
|
42
|
-
export interface ReactNativeFlowRun {
|
|
43
|
-
readonly flowId: string;
|
|
44
|
-
open: (options?: OpenFlowOptions) => Promise<void>;
|
|
45
|
-
prefetch: () => Promise<void>;
|
|
46
|
-
prerender: (options?: PrerenderFlowOptions) => Promise<void>;
|
|
47
|
-
close: () => Promise<void>;
|
|
48
|
-
}
|
|
49
|
-
export interface ReactNativeGetUserFeedbackClient {
|
|
50
|
-
readonly instanceId: string;
|
|
51
|
-
readonly nativeMessages: readonly ReactNativeWidgetNativeMessage[];
|
|
52
|
-
enqueueCommand: (command: ReactNativeWidgetCommand, options?: ReactNativeCommandOptions) => Promise<ReactNativeCommandResult>;
|
|
53
|
-
configure: (opts: ConfigureOptions, options?: ReactNativeCommandOptions) => Promise<ReactNativeCommandResult>;
|
|
54
|
-
identify: {
|
|
55
|
-
(userId: string, traits?: IdentifyTraits, options?: IdentifyOptions): Promise<ReactNativeCommandResult>;
|
|
56
|
-
(traits: IdentifyTraits, placeholder: undefined, options?: IdentifyOptions): Promise<ReactNativeCommandResult>;
|
|
57
|
-
(traits: IdentifyTraits, options?: IdentifyOptions): Promise<ReactNativeCommandResult>;
|
|
58
|
-
};
|
|
59
|
-
track: (eventName: string, properties?: TrackProperties, options?: TrackOptions) => Promise<ReactNativeCommandResult>;
|
|
60
|
-
flow: (flowId: string) => ReactNativeFlowRun;
|
|
61
|
-
close: () => Promise<ReactNativeCommandResult>;
|
|
62
|
-
reset: (options?: ReactNativeCommandOptions) => Promise<ReactNativeCommandResult>;
|
|
63
|
-
updateHostContext: (context: HostContext, options?: ReactNativeCommandOptions) => Promise<ReactNativeCommandResult>;
|
|
64
|
-
emitHostSignal: (name: string, data?: unknown, options?: ReactNativeCommandOptions) => Promise<ReactNativeCommandResult>;
|
|
65
|
-
handleWebMessage: (message: ReactNativeWidgetWebMessage) => void;
|
|
66
|
-
}
|
|
67
|
-
interface GetUserFeedbackProviderBaseProps {
|
|
68
|
-
children?: ReactNode;
|
|
69
|
-
initOptions: InitOptions;
|
|
70
|
-
configureOptions?: ConfigureOptions;
|
|
71
|
-
instanceId?: string;
|
|
72
|
-
onWebMessage?: (message: WebViewTransportWebMessage) => void;
|
|
73
|
-
onInvalidWebMessage?: (error: Error, rawMessage: unknown) => void;
|
|
74
|
-
onCommandError?: (error: Error) => void;
|
|
75
|
-
autoInit?: boolean;
|
|
76
|
-
commandTimeoutMs?: number;
|
|
77
|
-
hostViewport?: WidgetHostProps["hostViewport"];
|
|
78
|
-
webViewComponent?: WidgetHostProps["webViewComponent"];
|
|
79
|
-
webViewProps?: WidgetHostProps["webViewProps"];
|
|
80
|
-
}
|
|
81
|
-
export type GetUserFeedbackProviderProps = GetUserFeedbackProviderBaseProps & ({
|
|
82
|
-
loaderUrl: string;
|
|
83
|
-
source?: WidgetHostSource;
|
|
84
|
-
} | {
|
|
85
|
-
loaderUrl?: string;
|
|
86
|
-
source: WidgetHostSource;
|
|
87
|
-
});
|
|
88
|
-
export type GetUserFeedbackNativeContextValue = ReactNativeGetUserFeedbackClient;
|
|
89
|
-
export declare function GetUserFeedbackProvider({ autoInit, children, commandTimeoutMs, configureOptions, hostViewport, instanceId: instanceIdProp, initOptions, loaderUrl, onCommandError, onInvalidWebMessage, onWebMessage, source, webViewComponent, webViewProps, }: GetUserFeedbackProviderProps): ReactElement;
|
|
90
|
-
export declare function useGetUserFeedbackNative(): GetUserFeedbackNativeContextValue;
|
|
91
|
-
export declare const useGetUserFeedback: typeof useGetUserFeedbackNative;
|