@trustchex/react-native-sdk 1.175.6 → 1.178.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.
|
@@ -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;
|
|
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
|
-
|
|
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":"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,
|
|
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
|
@@ -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;
|
|
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
|
-
|
|
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, () => ({
|