@getuserfeedback/react-native 2.0.5 → 2.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/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { assertNoSegmentExternalIdsInValueArgument, CommandSettlementTimeoutError, } from "@getuserfeedback/protocol/host";
|
|
12
|
+
import { assertNoSegmentExternalIdsInValueArgument, CommandSettlementTimeoutError, getWidgetLayoutPlanNowMs, } from "@getuserfeedback/protocol/host";
|
|
13
13
|
import { parseWebViewTransportNativeMessage } from "@getuserfeedback/protocol/webview-transport";
|
|
14
14
|
import { createContext, createElement, useCallback, useContext, useEffect, useMemo, useRef, useState, } from "react";
|
|
15
15
|
import { useResolvedHostViewport } from "./host-viewport.js";
|
|
@@ -17,7 +17,7 @@ import { toCommandFlowId, toCommandSettlementError, toRetryWithoutFlowHandle, }
|
|
|
17
17
|
import { useProviderCommandTransport } from "./provider-command-transport.js";
|
|
18
18
|
import { clearProviderFlowHandleCache, createProviderFlowHandleCache, deleteCachedProviderFlowHandleId, deleteCachedProviderFlowId, getCachedProviderFlowHandleId, snapshotProviderFlowCommand, writeSettledProviderFlowHandleId, } from "./provider-flow-handle-cache.js";
|
|
19
19
|
import { createProviderWidgetHostLifecycleController, HIDDEN_PROVIDER_WIDGET_HOST_VISIBILITY, } from "./provider-widget-host-lifecycle.js";
|
|
20
|
-
import { ProviderWidgetHostOverlay, toProviderWidgetHostStyle,
|
|
20
|
+
import { ProviderWidgetHostOverlay, toProviderWidgetHostStyle, toProviderWidgetSheetHostLayoutPlan, } from "./provider-widget-host-overlay.js";
|
|
21
21
|
import { REACT_NATIVE_SDK_VERSION } from "./version.js";
|
|
22
22
|
import { WidgetHost, } from "./widget-host.js";
|
|
23
23
|
export { REACT_NATIVE_SDK_VERSION } from "./version.js";
|
|
@@ -112,6 +112,7 @@ const toIdentifyCommandPayload = (identifyInput, traitsOrOptions, options) => {
|
|
|
112
112
|
};
|
|
113
113
|
};
|
|
114
114
|
export function GetUserFeedbackProvider({ autoInit = true, children, commandTimeoutMs = DEFAULT_COMMAND_TIMEOUT_MS, configureOptions, hostViewport, instanceId: instanceIdProp, initOptions, loaderUrl, onCommandError, onInvalidWebMessage, onWebMessage, source, webViewComponent, webViewProps, }) {
|
|
115
|
+
var _a;
|
|
115
116
|
const { View: NativeView } = useMemo(resolveReactNativeComponents, []);
|
|
116
117
|
const [instanceId] = useState(() => { var _a; return (_a = normalizeOptionalString(instanceIdProp)) !== null && _a !== void 0 ? _a : createUniqueId("rn"); });
|
|
117
118
|
const [widgetHostVisibility, setWidgetHostVisibility] = useState(HIDDEN_PROVIDER_WIDGET_HOST_VISIBILITY);
|
|
@@ -471,6 +472,7 @@ export function GetUserFeedbackProvider({ autoInit = true, children, commandTime
|
|
|
471
472
|
emitHostSignal: (name, data, options) => enqueueCommand(Object.assign({ kind: "emitHostSignal", name: resolveRequiredString("name", name) }, (data === undefined ? {} : { data })), options),
|
|
472
473
|
handleWebMessage,
|
|
473
474
|
}), [enqueueCommand, getNativeMessages, handleWebMessage, instanceId]);
|
|
475
|
+
const previousSheetHostLayoutUpdateRef = useRef(undefined);
|
|
474
476
|
useEffect(() => {
|
|
475
477
|
resetStartupQueuedKeyIfChanged(startupOptionsKey);
|
|
476
478
|
enqueueStartupCommands();
|
|
@@ -480,10 +482,36 @@ export function GetUserFeedbackProvider({ autoInit = true, children, commandTime
|
|
|
480
482
|
startupOptionsKey,
|
|
481
483
|
]);
|
|
482
484
|
const providerHostViewport = hostViewport !== null && hostViewport !== void 0 ? hostViewport : resolvedHostViewport;
|
|
483
|
-
const
|
|
484
|
-
|
|
485
|
+
const sheetHostLayoutPlan = toProviderWidgetSheetHostLayoutPlan({
|
|
486
|
+
previous: previousSheetHostLayoutUpdateRef.current,
|
|
487
|
+
viewport: providerHostViewport,
|
|
488
|
+
flowSize: {
|
|
489
|
+
height: widgetHostVisibility.flowHeight,
|
|
490
|
+
},
|
|
491
|
+
nowMs: getWidgetLayoutPlanNowMs(),
|
|
485
492
|
});
|
|
493
|
+
let sheetHostLayoutUpdate;
|
|
494
|
+
if (sheetHostLayoutPlan) {
|
|
495
|
+
switch (sheetHostLayoutPlan.kind) {
|
|
496
|
+
case "unchanged":
|
|
497
|
+
sheetHostLayoutUpdate =
|
|
498
|
+
(_a = previousSheetHostLayoutUpdateRef.current) !== null && _a !== void 0 ? _a : sheetHostLayoutPlan.update;
|
|
499
|
+
break;
|
|
500
|
+
case "instant":
|
|
501
|
+
sheetHostLayoutUpdate = sheetHostLayoutPlan.update;
|
|
502
|
+
break;
|
|
503
|
+
default: {
|
|
504
|
+
const unreachable = sheetHostLayoutPlan;
|
|
505
|
+
throw new Error(`Unsupported widget layout transition plan: ${JSON.stringify(unreachable)}`);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
486
509
|
const isWidgetHostVisible = resolveIsWidgetHostVisible(widgetHostVisibility, sheetHostLayoutUpdate !== undefined);
|
|
510
|
+
useEffect(() => {
|
|
511
|
+
previousSheetHostLayoutUpdateRef.current = isWidgetHostVisible
|
|
512
|
+
? sheetHostLayoutUpdate
|
|
513
|
+
: undefined;
|
|
514
|
+
}, [isWidgetHostVisible, sheetHostLayoutUpdate]);
|
|
487
515
|
const widgetHostViewport = providerHostViewport;
|
|
488
516
|
const composedWebViewStyle = toProviderWidgetHostStyle({
|
|
489
517
|
isVisible: isWidgetHostVisible,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type WidgetLayoutSizeUpdate } from "@getuserfeedback/protocol/host";
|
|
1
|
+
import { type WidgetLayoutSizeUpdate, type WidgetLayoutTransitionPlan } from "@getuserfeedback/protocol/host";
|
|
2
2
|
import { type ComponentType, type ReactElement, type ReactNode } from "react";
|
|
3
3
|
import type { WidgetHostProps } from "./widget-host.js";
|
|
4
4
|
type NativeViewComponent = ComponentType<Record<string, unknown>>;
|
|
@@ -8,6 +8,14 @@ export declare function toProviderWidgetSheetHostViewport(viewport: WidgetHostPr
|
|
|
8
8
|
export declare function toProviderWidgetSheetHostLayoutUpdate(viewport: WidgetHostProps["hostViewport"], flowSize?: {
|
|
9
9
|
height?: number;
|
|
10
10
|
}): WidgetLayoutSizeUpdate | undefined;
|
|
11
|
+
export declare function toProviderWidgetSheetHostLayoutPlan(input: {
|
|
12
|
+
flowSize?: {
|
|
13
|
+
height?: number;
|
|
14
|
+
};
|
|
15
|
+
nowMs: number;
|
|
16
|
+
previous?: WidgetLayoutSizeUpdate;
|
|
17
|
+
viewport: WidgetHostProps["hostViewport"];
|
|
18
|
+
}): WidgetLayoutTransitionPlan | undefined;
|
|
11
19
|
export declare function toProviderWidgetHostStyle({ isVisible, webViewStyle, }: {
|
|
12
20
|
isVisible: boolean;
|
|
13
21
|
webViewStyle: unknown;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toInstantWidgetLayoutSizeUpdate, } from "@getuserfeedback/protocol/host";
|
|
1
|
+
import { planWidgetLayoutTransition, toInstantWidgetLayoutSizeUpdate, } from "@getuserfeedback/protocol/host";
|
|
2
2
|
import { createElement, useCallback, useMemo, useRef, } from "react";
|
|
3
3
|
const HIDDEN_WIDGET_HOST_STYLE = {
|
|
4
4
|
bottom: 0,
|
|
@@ -129,6 +129,17 @@ export function toProviderWidgetSheetHostLayoutUpdate(viewport, flowSize) {
|
|
|
129
129
|
: Math.max(LOADER_FLOATING_CONTAINER_MIN_HEIGHT, Math.ceil(measuredHeight))),
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
|
+
export function toProviderWidgetSheetHostLayoutPlan(input) {
|
|
133
|
+
const next = toProviderWidgetSheetHostLayoutUpdate(input.viewport, input.flowSize);
|
|
134
|
+
if (!next) {
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
return planWidgetLayoutTransition({
|
|
138
|
+
previous: input.previous,
|
|
139
|
+
next,
|
|
140
|
+
nowMs: input.nowMs,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
132
143
|
function toVisibleWidgetHostPresentationStyle(style) {
|
|
133
144
|
if (style === undefined || style === null) {
|
|
134
145
|
return undefined;
|
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 : "2.0.
|
|
6
|
+
export const REACT_NATIVE_SDK_VERSION = reactNativeSdkVersion.length > 0 ? reactNativeSdkVersion : "2.0.7";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getuserfeedback/react-native",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
4
4
|
"description": "getuserfeedback React Native SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"getuserfeedback",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"lint": "ultracite check ."
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@getuserfeedback/protocol": "^3.0.
|
|
48
|
-
"@getuserfeedback/sdk": "^0.8.
|
|
47
|
+
"@getuserfeedback/protocol": "^3.0.11",
|
|
48
|
+
"@getuserfeedback/sdk": "^0.8.13",
|
|
49
49
|
"robot3": "^1.2.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|