@getuserfeedback/react-native 2.0.16 → 2.0.18

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
@@ -15,7 +15,7 @@ import { createContext, createElement, useCallback, useContext, useEffect, useMe
15
15
  import { useResolvedHostViewport } from "./host-viewport.js";
16
16
  import { toCommandSettlementError, toReactNativeOneShotCommand, } from "./provider-command-helpers.js";
17
17
  import { useProviderCommandTransport } from "./provider-command-transport.js";
18
- import { createProviderWidgetHostLifecycleController, HIDDEN_PROVIDER_WIDGET_HOST_VISIBILITY, } from "./provider-widget-host-lifecycle.js";
18
+ import { createProviderWidgetHostLifecycleController, HIDDEN_PROVIDER_WIDGET_HOST_VISIBILITY, toProviderWidgetHostSnapshot, } from "./provider-widget-host-lifecycle.js";
19
19
  import { ProviderWidgetHostOverlay, toProviderWidgetHostStyle, toProviderWidgetSheetHostLayoutPlan, } from "./provider-widget-host-overlay.js";
20
20
  import { REACT_NATIVE_SDK_VERSION } from "./version.js";
21
21
  import { WidgetHost, } from "./widget-host.js";
@@ -223,7 +223,7 @@ export function GetUserFeedbackProvider({ autoInit = true, children, commandTime
223
223
  const flowRunsRef = useRef(new Map());
224
224
  const flowRunControllerOptionsRef = useRef(null);
225
225
  const widgetHostLifecycle = widgetHostLifecycleRef.current;
226
- const { clearFlowHandleFromVisibility, getCurrentHostEpoch, isWidgetHostVisible: resolveIsWidgetHostVisible, markNotReady, markReady, syncHostSourceKey, toFlowStateVisibility, toReadyVisibility, } = widgetHostLifecycle;
226
+ const { clearFlowHandleFromVisibility, getCurrentHostEpoch, isWidgetHostVisible: resolveIsWidgetHostVisible, markNotReady, markReady, syncHostSourceKey, toHostSnapshotVisibility, toReadyVisibility, } = widgetHostLifecycle;
227
227
  const createCommandTimeoutError = useCallback((requestId) => new CommandSettlementTimeoutError(requestId), []);
228
228
  const transport = useProviderCommandTransport({
229
229
  commandTimeoutMs,
@@ -483,12 +483,16 @@ export function GetUserFeedbackProvider({ autoInit = true, children, commandTime
483
483
  setWidgetHostVisibility((visibility) => clearFlowHandleFromVisibility(visibility, flowHandleId));
484
484
  }, [clearFlowHandleFromVisibility]);
485
485
  const handleInstanceFlowStateChanged = useCallback((detail) => {
486
- const visibility = toFlowStateVisibility(detail, instanceId);
486
+ const snapshot = toProviderWidgetHostSnapshot(detail, instanceId);
487
+ if (!snapshot) {
488
+ return;
489
+ }
490
+ const visibility = toHostSnapshotVisibility(snapshot);
487
491
  if (!visibility) {
488
492
  return;
489
493
  }
490
494
  setWidgetHostVisibility(visibility);
491
- }, [instanceId, toFlowStateVisibility]);
495
+ }, [instanceId, toHostSnapshotVisibility]);
492
496
  const handleWebMessage = useCallback((message) => {
493
497
  if (message.kind === "hostEvent" &&
494
498
  message.event.name === "instance:handle:invalidated" &&
@@ -17,6 +17,15 @@ type ProviderWidgetHostFlowState = {
17
17
  instanceId: string;
18
18
  isLoading: boolean;
19
19
  isOpen: boolean;
20
+ width?: number;
21
+ };
22
+ type ProviderWidgetHostSnapshot = {
23
+ flowHandleId?: string;
24
+ height?: number;
25
+ isLoading: boolean;
26
+ isOpen: boolean;
27
+ shouldRender: boolean;
28
+ width?: number;
20
29
  };
21
30
  export declare const HIDDEN_PROVIDER_WIDGET_HOST_VISIBILITY: ProviderWidgetHostVisibility;
22
31
  export type ProviderWidgetHostLifecycleController = {
@@ -37,11 +46,12 @@ export type ProviderWidgetHostLifecycleController = {
37
46
  previousReady: ProviderWidgetHostReadyState | null;
38
47
  };
39
48
  syncHostSourceKey: (hostSourceKey: string) => boolean;
40
- toFlowStateVisibility: (detail: ProviderWidgetHostFlowState, instanceId: string) => ProviderWidgetHostVisibility | null;
49
+ toHostSnapshotVisibility: (snapshot: ProviderWidgetHostSnapshot) => ProviderWidgetHostVisibility | null;
41
50
  toReadyVisibility: (visibility: ProviderWidgetHostVisibility, event: {
42
51
  readySequence: number;
43
52
  sourceKey: string;
44
53
  }) => ProviderWidgetHostVisibility;
45
54
  };
55
+ export declare function toProviderWidgetHostSnapshot(detail: ProviderWidgetHostFlowState, instanceId: string): ProviderWidgetHostSnapshot | null;
46
56
  export declare function createProviderWidgetHostLifecycleController(initialHostSourceKey: string): ProviderWidgetHostLifecycleController;
47
57
  export {};
@@ -4,6 +4,20 @@ export const HIDDEN_PROVIDER_WIDGET_HOST_VISIBILITY = {
4
4
  readySequence: null,
5
5
  sourceKey: null,
6
6
  };
7
+ export function toProviderWidgetHostSnapshot(detail, instanceId) {
8
+ if (detail.instanceId !== instanceId) {
9
+ return null;
10
+ }
11
+ const snapshot = {
12
+ flowHandleId: detail.flowHandleId,
13
+ height: detail.height,
14
+ isLoading: detail.isLoading,
15
+ isOpen: detail.isOpen,
16
+ shouldRender: detail.isOpen || detail.isLoading,
17
+ width: detail.width,
18
+ };
19
+ return snapshot;
20
+ }
7
21
  export function createProviderWidgetHostLifecycleController(initialHostSourceKey) {
8
22
  let hostEpoch = 0;
9
23
  let hostSourceKey = initialHostSourceKey;
@@ -57,15 +71,15 @@ export function createProviderWidgetHostLifecycleController(initialHostSourceKey
57
71
  lastReady = null;
58
72
  return true;
59
73
  },
60
- toFlowStateVisibility: (detail, instanceId) => {
61
- if (detail.instanceId !== instanceId || lastReady === null) {
74
+ toHostSnapshotVisibility: (snapshot) => {
75
+ if (lastReady === null) {
62
76
  return null;
63
77
  }
64
78
  return {
65
- flowHeight: detail.height,
66
- flowHandleId: detail.flowHandleId,
79
+ flowHeight: snapshot.height,
80
+ flowHandleId: snapshot.flowHandleId,
67
81
  hostSourceVersion,
68
- isVisible: detail.isOpen || detail.isLoading,
82
+ isVisible: snapshot.shouldRender,
69
83
  readySequence: lastReady.readySequence,
70
84
  sourceKey: lastReady.sourceKey,
71
85
  };
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.16";
6
+ export const REACT_NATIVE_SDK_VERSION = reactNativeSdkVersion.length > 0 ? reactNativeSdkVersion : "2.0.18";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getuserfeedback/react-native",
3
- "version": "2.0.16",
3
+ "version": "2.0.18",
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.1.5",
48
- "@getuserfeedback/sdk": "^0.8.22",
47
+ "@getuserfeedback/protocol": "^3.1.6",
48
+ "@getuserfeedback/sdk": "^0.8.23",
49
49
  "robot3": "^1.2.0"
50
50
  },
51
51
  "peerDependencies": {