@getuserfeedback/react-native 3.0.2 → 3.0.4

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.
@@ -1,4 +1,5 @@
1
- import { areViewHostSnapshotsEqual, cloneViewHostSnapshots, } from "@getuserfeedback/protocol/host";
1
+ import { areViewHostSnapshotsEqual, } from "@getuserfeedback/protocol/host";
2
+ import { createActiveViewSnapshotListController } from "./view-orchestration-runtime.js";
2
3
  export const HIDDEN_PROVIDER_WIDGET_HOST_VISIBILITY = {
3
4
  hostSourceVersion: null,
4
5
  isVisible: false,
@@ -11,7 +12,7 @@ export function createProviderWidgetHostLifecycleController(initialHostSourceKey
11
12
  let hostSourceVersion = 0;
12
13
  let lastReady = null;
13
14
  let transitionPolicySequence = 0;
14
- let viewHostSnapshots = [];
15
+ const viewHostSnapshots = createActiveViewSnapshotListController();
15
16
  let selectedViewHostSnapshot;
16
17
  const toVisibility = (snapshot) => {
17
18
  if (lastReady === null) {
@@ -37,7 +38,7 @@ export function createProviderWidgetHostLifecycleController(initialHostSourceKey
37
38
  clearFlowHandleFromVisibility: (visibility, flowHandleId) => visibility.flowHandleId === flowHandleId
38
39
  ? Object.assign(Object.assign({}, visibility), { flowHandleId: undefined }) : visibility,
39
40
  getCurrentHostEpoch: () => { var _a; return (_a = lastReady === null || lastReady === void 0 ? void 0 : lastReady.hostEpoch) !== null && _a !== void 0 ? _a : null; },
40
- getViewHostSnapshots: () => cloneViewHostSnapshots(viewHostSnapshots),
41
+ getViewHostSnapshots: () => viewHostSnapshots.getSnapshots(),
41
42
  isWidgetHostVisible: (visibility, hasSheetHostViewport) => visibility.isVisible &&
42
43
  hasSheetHostViewport &&
43
44
  visibility.hostSourceVersion === hostSourceVersion &&
@@ -49,7 +50,7 @@ export function createProviderWidgetHostLifecycleController(initialHostSourceKey
49
50
  hostEpoch += 1;
50
51
  }
51
52
  lastReady = null;
52
- viewHostSnapshots = [];
53
+ viewHostSnapshots.clear();
53
54
  selectedViewHostSnapshot = undefined;
54
55
  return { wasReady };
55
56
  },
@@ -67,7 +68,7 @@ export function createProviderWidgetHostLifecycleController(initialHostSourceKey
67
68
  const didResetHostEpoch = previousReady !== null || hasDeliveredPendingCommands;
68
69
  if (didResetHostEpoch) {
69
70
  hostEpoch += 1;
70
- viewHostSnapshots = [];
71
+ viewHostSnapshots.clear();
71
72
  selectedViewHostSnapshot = undefined;
72
73
  }
73
74
  lastReady = Object.assign(Object.assign({}, event), { hostEpoch });
@@ -81,8 +82,8 @@ export function createProviderWidgetHostLifecycleController(initialHostSourceKey
81
82
  if (detail.instanceId !== instanceId || lastReady === null) {
82
83
  return null;
83
84
  }
84
- viewHostSnapshots = cloneViewHostSnapshots(detail.snapshots);
85
- const nextSelectedSnapshot = viewHostSnapshots[0];
85
+ viewHostSnapshots.replace(detail.snapshots);
86
+ const nextSelectedSnapshot = viewHostSnapshots.getSnapshots()[0];
86
87
  if (areViewHostSnapshotsEqual(selectedViewHostSnapshot, nextSelectedSnapshot)) {
87
88
  return null;
88
89
  }
@@ -103,7 +104,7 @@ export function createProviderWidgetHostLifecycleController(initialHostSourceKey
103
104
  hostSourceKey = nextHostSourceKey;
104
105
  hostSourceVersion += 1;
105
106
  lastReady = null;
106
- viewHostSnapshots = [];
107
+ viewHostSnapshots.clear();
107
108
  selectedViewHostSnapshot = undefined;
108
109
  return true;
109
110
  },
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 : "3.0.2";
6
+ export const REACT_NATIVE_SDK_VERSION = reactNativeSdkVersion.length > 0 ? reactNativeSdkVersion : "3.0.4";
@@ -1,3 +1,37 @@
1
+ // ../view-orchestration/src/active-view-snapshot-list.ts
2
+ import {
3
+ areViewHostSnapshotsEqual,
4
+ cloneViewHostSnapshots
5
+ } from "@getuserfeedback/protocol/host";
6
+ function areActiveViewSnapshotListsEqual(a, b) {
7
+ return a.length === b.length && a.every((left, index) => {
8
+ const right = b[index];
9
+ return areViewHostSnapshotsEqual(left, right);
10
+ });
11
+ }
12
+ function createActiveViewSnapshotListController() {
13
+ let initialized = false;
14
+ let current = [];
15
+ return {
16
+ clear: () => {
17
+ if (!initialized && current.length === 0) {
18
+ return false;
19
+ }
20
+ initialized = false;
21
+ current = [];
22
+ return true;
23
+ },
24
+ getSnapshots: () => cloneViewHostSnapshots(current),
25
+ replace: (snapshots) => {
26
+ if (initialized && areActiveViewSnapshotListsEqual(current, snapshots)) {
27
+ return false;
28
+ }
29
+ initialized = true;
30
+ current = cloneViewHostSnapshots(snapshots);
31
+ return true;
32
+ }
33
+ };
34
+ }
1
35
  // ../view-orchestration/src/view-activation-machine.ts
2
36
  import { createMachine, interpret, state, transition } from "robot3";
3
37
  var VIEW_ACTIVATION_STATES = {
@@ -46,9 +80,13 @@ function readViewActivationState(value) {
46
80
  return value;
47
81
  }
48
82
  // src/view-orchestration-runtime.ts
83
+ function createActiveViewSnapshotListController2() {
84
+ return createActiveViewSnapshotListController();
85
+ }
49
86
  function createViewActivationController2() {
50
87
  return createViewActivationController();
51
88
  }
52
89
  export {
53
- createViewActivationController2 as createViewActivationController
90
+ createViewActivationController2 as createViewActivationController,
91
+ createActiveViewSnapshotListController2 as createActiveViewSnapshotListController
54
92
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getuserfeedback/react-native",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
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.4.2",
48
- "@getuserfeedback/sdk": "^0.8.33",
47
+ "@getuserfeedback/protocol": "^3.4.3",
48
+ "@getuserfeedback/sdk": "^0.8.34",
49
49
  "robot3": "^1.2.0"
50
50
  },
51
51
  "peerDependencies": {