@trustchex/react-native-sdk 1.175.6 → 1.205.0

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.
@@ -103,6 +103,9 @@ const ContractAcceptanceScreen = () => {
103
103
  if (!consent.contractIds.includes(acceptedContractId)) {
104
104
  consent.contractIds.push(acceptedContractId);
105
105
  consent.deviceInfo = await generateHumanReadableIdentifier();
106
+
107
+ // Update the context with the new device info
108
+ appContext.identificationInfo.consent = consent;
106
109
  }
107
110
  navigationManagerRef.current?.navigateToNextStep();
108
111
  },
@@ -71,6 +71,11 @@ const ResultScreen = () => {
71
71
  }
72
72
  }, []);
73
73
  const submitIdentificationConsent = useCallback(async (identificationId, sessionKey) => {
74
+ // Ensure device info is always populated before sending consent
75
+ if (!appContext.identificationInfo.consent.deviceInfo) {
76
+ console.log('Device info not set, generating now...');
77
+ appContext.identificationInfo.consent.deviceInfo = await NativeDeviceInfo.generateHumanReadableIdentifier();
78
+ }
74
79
  const {
75
80
  encryptedData,
76
81
  nonce
@@ -32,13 +32,11 @@ const NavigationManager = /*#__PURE__*/forwardRef(({
32
32
  };
33
33
  React.useEffect(() => {
34
34
  const handleFocus = () => {
35
- // Reset navigation state when screen comes into focus
36
35
  isNavigating = false;
37
36
  };
38
37
  navigation.addListener('focus', handleFocus);
39
38
  return () => {
40
39
  navigation.removeListener('focus', handleFocus);
41
- // Reset state on cleanup
42
40
  isNavigating = false;
43
41
  };
44
42
  }, [navigation]);
@@ -66,14 +64,10 @@ const NavigationManager = /*#__PURE__*/forwardRef(({
66
64
  }, [appContext, routes.VERIFICATION_SESSION_CHECK, routes.DYNAMIC_ROUTES.CONTRACT_ACCEPTANCE, routes.DYNAMIC_ROUTES.IDENTITY_DOCUMENT_EID_SCAN, routes.DYNAMIC_ROUTES.IDENTITY_DOCUMENT_SCAN, routes.DYNAMIC_ROUTES.LIVENESS_CHECK, routes.RESULT]);
67
65
  const goToNextRoute = useCallback(() => {
68
66
  const currentTime = Date.now();
69
- const minTimeBetweenNavigation = 1000; // 1 second minimum between navigations
70
-
71
- // Simple protection: prevent rapid consecutive calls
67
+ const minTimeBetweenNavigation = 1000;
72
68
  if (isNavigating || currentTime - lastNavigationTime < minTimeBetweenNavigation) {
73
69
  return;
74
70
  }
75
-
76
- // Set protection flags
77
71
  isNavigating = true;
78
72
  lastNavigationTime = currentTime;
79
73
  try {
@@ -85,18 +79,14 @@ const NavigationManager = /*#__PURE__*/forwardRef(({
85
79
  }
86
80
  }));
87
81
  } catch (error) {
88
- // Reset flags on error
89
82
  isNavigating = false;
90
83
  throw error;
91
84
  }
92
-
93
- // Reset flags after navigation
94
85
  setTimeout(() => {
95
86
  isNavigating = false;
96
87
  }, 1000);
97
88
  }, [getNextRoute, appContext.workflowSteps, appContext.currentWorkflowStep, navigation]);
98
89
  const goToNextRouteWithAlert = useCallback(() => {
99
- // Prevent multiple alerts if already navigating
100
90
  if (isNavigating) {
101
91
  return;
102
92
  }
@@ -109,7 +99,6 @@ const NavigationManager = /*#__PURE__*/forwardRef(({
109
99
  }]);
110
100
  }, [goToNextRoute, t]);
111
101
  const reset = useCallback(() => {
112
- // Prevent rapid successive reset calls
113
102
  if (isNavigating) {
114
103
  return;
115
104
  }
@@ -117,6 +106,7 @@ const NavigationManager = /*#__PURE__*/forwardRef(({
117
106
  try {
118
107
  appContext.currentWorkflowStep = undefined;
119
108
  appContext.workflowSteps = undefined;
109
+ appContext.isDemoSession = false;
120
110
  appContext.identificationInfo = {
121
111
  sessionId: '',
122
112
  identificationId: '',
@@ -142,25 +132,16 @@ const NavigationManager = /*#__PURE__*/forwardRef(({
142
132
  isNavigating = false;
143
133
  throw error;
144
134
  }
145
-
146
- // Reset flag after operation
147
135
  setTimeout(() => {
148
136
  isNavigating = false;
149
137
  }, 1000);
150
138
  }, [appContext, navigation, routes.VERIFICATION_SESSION_CHECK]);
151
-
152
- // Use usePreventRemove instead of beforeRemove listener to prevent the warning
153
- // This prevents users from natively going back multiple screens
154
139
  usePreventRemove(true, ({
155
140
  data
156
141
  }) => {
157
- // Only allow RESET actions to proceed
158
142
  if (data.action.type === 'RESET') {
159
- return;
143
+ navigation.dispatch(data.action);
160
144
  }
161
-
162
- // Silently prevent all other navigation attempts
163
- // No dialog shown to user - navigation is simply blocked
164
145
  });
165
146
  useImperativeHandle(ref, () => ({
166
147
  navigateToNextStep: goToNextRoute,
@@ -1 +1 @@
1
- {"version":3,"file":"ContractAcceptanceScreen.d.ts","sourceRoot":"","sources":["../../../../../src/Screens/Dynamic/ContractAcceptanceScreen.tsx"],"names":[],"mappings":"AAkBA,QAAA,MAAM,wBAAwB,+CAsH7B,CAAC;AA4BF,eAAe,wBAAwB,CAAC"}
1
+ {"version":3,"file":"ContractAcceptanceScreen.d.ts","sourceRoot":"","sources":["../../../../../src/Screens/Dynamic/ContractAcceptanceScreen.tsx"],"names":[],"mappings":"AAkBA,QAAA,MAAM,wBAAwB,+CAyH7B,CAAC;AA4BF,eAAe,wBAAwB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ResultScreen.d.ts","sourceRoot":"","sources":["../../../../../src/Screens/Static/ResultScreen.tsx"],"names":[],"mappings":"AAiCA,QAAA,MAAM,YAAY,+CAquBjB,CAAC;AAsGF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"ResultScreen.d.ts","sourceRoot":"","sources":["../../../../../src/Screens/Static/ResultScreen.tsx"],"names":[],"mappings":"AAiCA,QAAA,MAAM,YAAY,+CA4uBjB,CAAC;AAsGF,eAAe,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"NavigationManager.d.ts","sourceRoot":"","sources":["../../../../../src/Shared/Components/NavigationManager.tsx"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;AAiBf,MAAM,MAAM,oBAAoB,GAAG;IACjC,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,QAAA,MAAM,iBAAiB,wFAmOtB,CAAC;AAWF,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"NavigationManager.d.ts","sourceRoot":"","sources":["../../../../../src/Shared/Components/NavigationManager.tsx"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;AAiBf,MAAM,MAAM,oBAAoB,GAAG;IACjC,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,QAAA,MAAM,iBAAiB,wFAqNtB,CAAC;AAWF,eAAe,iBAAiB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trustchex/react-native-sdk",
3
- "version": "1.175.6",
3
+ "version": "1.205.0",
4
4
  "description": "Trustchex mobile app react native SDK for android or ios devices",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -19,7 +19,8 @@
19
19
  },
20
20
  "repository": {
21
21
  "type": "git",
22
- "url": "git+https://github.com/trustchex/trustchex.git"
22
+ "url": "git+https://github.com/trustchex/trustchex.git",
23
+ "directory": "react-native-sdk"
23
24
  },
24
25
  "license": "SEE LICENSE IN LICENSE",
25
26
  "author": "Trustchex <support@trustchex.com> (https://trustchex.com)",
@@ -69,7 +70,6 @@
69
70
  "@eslint/compat": "^1.2.7",
70
71
  "@eslint/eslintrc": "^3.3.0",
71
72
  "@eslint/js": "^9.22.0",
72
- "@evilmartians/lefthook": "^1.5.0",
73
73
  "@react-native-community/cli": "15.0.0-alpha.2",
74
74
  "@react-native-community/image-editor": "^4.3.0",
75
75
  "@react-native/babel-preset": "0.79.5",
@@ -123,6 +123,9 @@ const ContractAcceptanceScreen = () => {
123
123
  if (!consent.contractIds.includes(acceptedContractId)) {
124
124
  consent.contractIds.push(acceptedContractId);
125
125
  consent.deviceInfo = await generateHumanReadableIdentifier();
126
+
127
+ // Update the context with the new device info
128
+ appContext.identificationInfo.consent = consent;
126
129
  }
127
130
 
128
131
  navigationManagerRef.current?.navigateToNextStep();
@@ -109,6 +109,13 @@ const ResultScreen = () => {
109
109
 
110
110
  const submitIdentificationConsent = useCallback(
111
111
  async (identificationId: string, sessionKey: string) => {
112
+ // Ensure device info is always populated before sending consent
113
+ if (!appContext.identificationInfo.consent.deviceInfo) {
114
+ console.log('Device info not set, generating now...');
115
+ appContext.identificationInfo.consent.deviceInfo =
116
+ await NativeDeviceInfo.generateHumanReadableIdentifier();
117
+ }
118
+
112
119
  const { encryptedData, nonce } = encryptWithAes(
113
120
  JSON.stringify(appContext.identificationInfo.consent),
114
121
  sessionKey
@@ -48,7 +48,6 @@ const NavigationManager = forwardRef(
48
48
 
49
49
  React.useEffect(() => {
50
50
  const handleFocus = () => {
51
- // Reset navigation state when screen comes into focus
52
51
  isNavigating = false;
53
52
  };
54
53
 
@@ -56,7 +55,6 @@ const NavigationManager = forwardRef(
56
55
 
57
56
  return () => {
58
57
  navigation.removeListener('focus', handleFocus);
59
- // Reset state on cleanup
60
58
  isNavigating = false;
61
59
  };
62
60
  }, [navigation]);
@@ -116,9 +114,8 @@ const NavigationManager = forwardRef(
116
114
 
117
115
  const goToNextRoute = useCallback(() => {
118
116
  const currentTime = Date.now();
119
- const minTimeBetweenNavigation = 1000; // 1 second minimum between navigations
117
+ const minTimeBetweenNavigation = 1000;
120
118
 
121
- // Simple protection: prevent rapid consecutive calls
122
119
  if (
123
120
  isNavigating ||
124
121
  currentTime - lastNavigationTime < minTimeBetweenNavigation
@@ -126,7 +123,6 @@ const NavigationManager = forwardRef(
126
123
  return;
127
124
  }
128
125
 
129
- // Set protection flags
130
126
  isNavigating = true;
131
127
  lastNavigationTime = currentTime;
132
128
 
@@ -145,12 +141,10 @@ const NavigationManager = forwardRef(
145
141
  })
146
142
  );
147
143
  } catch (error) {
148
- // Reset flags on error
149
144
  isNavigating = false;
150
145
  throw error;
151
146
  }
152
147
 
153
- // Reset flags after navigation
154
148
  setTimeout(() => {
155
149
  isNavigating = false;
156
150
  }, 1000);
@@ -162,7 +156,6 @@ const NavigationManager = forwardRef(
162
156
  ]);
163
157
 
164
158
  const goToNextRouteWithAlert = useCallback(() => {
165
- // Prevent multiple alerts if already navigating
166
159
  if (isNavigating) {
167
160
  return;
168
161
  }
@@ -184,7 +177,6 @@ const NavigationManager = forwardRef(
184
177
  }, [goToNextRoute, t]);
185
178
 
186
179
  const reset = useCallback(() => {
187
- // Prevent rapid successive reset calls
188
180
  if (isNavigating) {
189
181
  return;
190
182
  }
@@ -194,6 +186,7 @@ const NavigationManager = forwardRef(
194
186
  try {
195
187
  appContext.currentWorkflowStep = undefined;
196
188
  appContext.workflowSteps = undefined;
189
+ appContext.isDemoSession = false;
197
190
  appContext.identificationInfo = {
198
191
  sessionId: '',
199
192
  identificationId: '',
@@ -221,22 +214,15 @@ const NavigationManager = forwardRef(
221
214
  throw error;
222
215
  }
223
216
 
224
- // Reset flag after operation
225
217
  setTimeout(() => {
226
218
  isNavigating = false;
227
219
  }, 1000);
228
220
  }, [appContext, navigation, routes.VERIFICATION_SESSION_CHECK]);
229
221
 
230
- // Use usePreventRemove instead of beforeRemove listener to prevent the warning
231
- // This prevents users from natively going back multiple screens
232
222
  usePreventRemove(true, ({ data }) => {
233
- // Only allow RESET actions to proceed
234
223
  if (data.action.type === 'RESET') {
235
- return;
224
+ navigation.dispatch(data.action);
236
225
  }
237
-
238
- // Silently prevent all other navigation attempts
239
- // No dialog shown to user - navigation is simply blocked
240
226
  });
241
227
 
242
228
  useImperativeHandle(ref, () => ({