@getuserfeedback/react-native 2.0.20 → 2.0.23

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
@@ -226,7 +226,7 @@ export function GetUserFeedbackProvider({ autoInit = true, children, commandTime
226
226
  const flowRunsRef = useRef(new Map());
227
227
  const flowRunControllerOptionsRef = useRef(null);
228
228
  const widgetHostLifecycle = widgetHostLifecycleRef.current;
229
- const { clearFlowHandleFromVisibility, getCurrentHostEpoch, isWidgetHostVisible: resolveIsWidgetHostVisible, markNotReady, markReady, syncHostSourceKey, toHostSnapshotVisibility, toReadyVisibility, } = widgetHostLifecycle;
229
+ const { clearFlowHandleFromVisibility, getCurrentHostEpoch, isWidgetHostVisible: resolveIsWidgetHostVisible, markNotReady, markReady, replaceViewHostSnapshots, syncHostSourceKey, toHostSnapshotVisibility, toReadyVisibility, } = widgetHostLifecycle;
230
230
  const createCommandTimeoutError = useCallback((requestId) => new CommandSettlementTimeoutError(requestId), []);
231
231
  const transport = useProviderCommandTransport({
232
232
  commandTimeoutMs,
@@ -502,6 +502,10 @@ export function GetUserFeedbackProvider({ autoInit = true, children, commandTime
502
502
  message.event.detail.handleKind === "flow") {
503
503
  handleFlowHandleInvalidated(message.event.detail.handleId);
504
504
  }
505
+ if (message.kind === "hostEvent" &&
506
+ message.event.name === "instance:view-host:snapshots-changed") {
507
+ replaceViewHostSnapshots(message.event.detail, instanceId);
508
+ }
505
509
  if (message.kind === "hostEvent" &&
506
510
  message.event.name === "instance:flow:state-changed:instance") {
507
511
  handleInstanceFlowStateChanged(message.event.detail);
@@ -545,9 +549,11 @@ export function GetUserFeedbackProvider({ autoInit = true, children, commandTime
545
549
  resetFlowRuns,
546
550
  getCurrentHostEpoch,
547
551
  getPendingCommand,
548
- handleInstanceFlowStateChanged,
549
552
  handleFlowHandleInvalidated,
553
+ handleInstanceFlowStateChanged,
554
+ instanceId,
550
555
  onWebMessage,
556
+ replaceViewHostSnapshots,
551
557
  removeNativeMessageId,
552
558
  takePendingCommand,
553
559
  ]);
@@ -1,4 +1,4 @@
1
- import { type WidgetLayoutTransitionPolicy } from "@getuserfeedback/protocol/host";
1
+ import { type InstanceViewHostSnapshotsChangedDetail, type ViewHostSnapshot, type WidgetLayoutTransitionPolicy } from "@getuserfeedback/protocol/host";
2
2
  type ProviderWidgetHostReadyState = {
3
3
  hostEpoch: number;
4
4
  readySequence: number;
@@ -37,6 +37,7 @@ export declare const HIDDEN_PROVIDER_WIDGET_HOST_VISIBILITY: ProviderWidgetHostV
37
37
  export type ProviderWidgetHostLifecycleController = {
38
38
  clearFlowHandleFromVisibility: (visibility: ProviderWidgetHostVisibility, flowHandleId: string) => ProviderWidgetHostVisibility;
39
39
  getCurrentHostEpoch: () => number | null;
40
+ getViewHostSnapshots: () => readonly ViewHostSnapshot[];
40
41
  isWidgetHostVisible: (visibility: ProviderWidgetHostVisibility, hasSheetHostViewport: boolean) => boolean;
41
42
  markNotReady: () => {
42
43
  wasReady: boolean;
@@ -51,6 +52,7 @@ export type ProviderWidgetHostLifecycleController = {
51
52
  didResetHostEpoch: boolean;
52
53
  previousReady: ProviderWidgetHostReadyState | null;
53
54
  };
55
+ replaceViewHostSnapshots: (detail: InstanceViewHostSnapshotsChangedDetail, instanceId: string) => boolean;
54
56
  syncHostSourceKey: (hostSourceKey: string) => boolean;
55
57
  toHostSnapshotVisibility: (snapshot: ProviderWidgetHostSnapshot) => ProviderWidgetHostVisibility | null;
56
58
  toReadyVisibility: (visibility: ProviderWidgetHostVisibility, event: {
@@ -1,4 +1,4 @@
1
- import { resolveInstanceFlowStateShouldRender, } from "@getuserfeedback/protocol/host";
1
+ import { cloneViewHostSnapshots, resolveInstanceFlowStateShouldRender, } from "@getuserfeedback/protocol/host";
2
2
  export const HIDDEN_PROVIDER_WIDGET_HOST_VISIBILITY = {
3
3
  hostSourceVersion: null,
4
4
  isVisible: false,
@@ -26,10 +26,12 @@ export function createProviderWidgetHostLifecycleController(initialHostSourceKey
26
26
  let hostSourceVersion = 0;
27
27
  let lastReady = null;
28
28
  let transitionPolicySequence = 0;
29
+ let viewHostSnapshots = [];
29
30
  return {
30
31
  clearFlowHandleFromVisibility: (visibility, flowHandleId) => visibility.flowHandleId === flowHandleId
31
32
  ? Object.assign(Object.assign({}, visibility), { flowHandleId: undefined }) : visibility,
32
33
  getCurrentHostEpoch: () => { var _a; return (_a = lastReady === null || lastReady === void 0 ? void 0 : lastReady.hostEpoch) !== null && _a !== void 0 ? _a : null; },
34
+ getViewHostSnapshots: () => cloneViewHostSnapshots(viewHostSnapshots),
33
35
  isWidgetHostVisible: (visibility, hasSheetHostViewport) => visibility.isVisible &&
34
36
  hasSheetHostViewport &&
35
37
  visibility.hostSourceVersion === hostSourceVersion &&
@@ -41,6 +43,7 @@ export function createProviderWidgetHostLifecycleController(initialHostSourceKey
41
43
  hostEpoch += 1;
42
44
  }
43
45
  lastReady = null;
46
+ viewHostSnapshots = [];
44
47
  return { wasReady };
45
48
  },
46
49
  markReady: (event, { hasDeliveredPendingCommands }) => {
@@ -57,6 +60,7 @@ export function createProviderWidgetHostLifecycleController(initialHostSourceKey
57
60
  const didResetHostEpoch = previousReady !== null || hasDeliveredPendingCommands;
58
61
  if (didResetHostEpoch) {
59
62
  hostEpoch += 1;
63
+ viewHostSnapshots = [];
60
64
  }
61
65
  lastReady = Object.assign(Object.assign({}, event), { hostEpoch });
62
66
  return {
@@ -65,6 +69,13 @@ export function createProviderWidgetHostLifecycleController(initialHostSourceKey
65
69
  previousReady,
66
70
  };
67
71
  },
72
+ replaceViewHostSnapshots: (detail, instanceId) => {
73
+ if (detail.instanceId !== instanceId || lastReady === null) {
74
+ return false;
75
+ }
76
+ viewHostSnapshots = cloneViewHostSnapshots(detail.snapshots);
77
+ return true;
78
+ },
68
79
  syncHostSourceKey: (nextHostSourceKey) => {
69
80
  if (hostSourceKey === nextHostSourceKey) {
70
81
  return false;
@@ -72,6 +83,7 @@ export function createProviderWidgetHostLifecycleController(initialHostSourceKey
72
83
  hostSourceKey = nextHostSourceKey;
73
84
  hostSourceVersion += 1;
74
85
  lastReady = null;
86
+ viewHostSnapshots = [];
75
87
  return true;
76
88
  },
77
89
  toHostSnapshotVisibility: (snapshot) => {
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.20";
6
+ export const REACT_NATIVE_SDK_VERSION = reactNativeSdkVersion.length > 0 ? reactNativeSdkVersion : "2.0.23";
@@ -3,6 +3,7 @@ const VIEW_SIZE_FLUSH_EVENT = "gx:view-size:flush";
3
3
  const HOST_VIEWPORT_VERSION_KEY = "__getuserfeedback_host_viewport_version";
4
4
  const HOST_EVENT_NAMES = [
5
5
  "instance:flow:state-changed:instance",
6
+ "instance:view-host:snapshots-changed",
6
7
  "instance:command:settled",
7
8
  "instance:handle:invalidated",
8
9
  "instance:command:unsupported",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getuserfeedback/react-native",
3
- "version": "2.0.20",
3
+ "version": "2.0.23",
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.8",
48
- "@getuserfeedback/sdk": "^0.8.25",
47
+ "@getuserfeedback/protocol": "^3.3.0",
48
+ "@getuserfeedback/sdk": "^0.8.28",
49
49
  "robot3": "^1.2.0"
50
50
  },
51
51
  "peerDependencies": {