@trustchex/react-native-sdk 1.478.7 → 1.481.1

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.
Files changed (61) hide show
  1. package/android/src/main/java/com/trustchex/reactnativesdk/camera/TrustchexCameraView.kt +57 -3
  2. package/ios/Camera/TrustchexCameraView.swift +20 -15
  3. package/lib/module/Screens/Static/ResultScreen.js +42 -6
  4. package/lib/module/Shared/Components/DiagnosticReportButton.js +64 -0
  5. package/lib/module/Shared/Components/IdentityDocumentCamera.js +132 -8
  6. package/lib/module/Shared/Components/NavigationManager.js +7 -9
  7. package/lib/module/Shared/EIDReader/eidReader.js +149 -29
  8. package/lib/module/Shared/Libs/MRZ_KNOWN_ISSUES.md +7 -0
  9. package/lib/module/Shared/Libs/diagnosticReport.js +133 -0
  10. package/lib/module/Shared/Libs/diagnostics.js +171 -0
  11. package/lib/module/Shared/Libs/mrzFrameAggregator.js +32 -5
  12. package/lib/module/Shared/Libs/native-device-info.utils.js +67 -0
  13. package/lib/module/Shared/Libs/sendDiagnosticReport.js +130 -0
  14. package/lib/module/Translation/Resources/en.js +5 -0
  15. package/lib/module/Translation/Resources/tr.js +5 -0
  16. package/lib/module/Trustchex.js +20 -4
  17. package/lib/module/version.js +1 -1
  18. package/lib/typescript/src/Screens/Static/ResultScreen.d.ts.map +1 -1
  19. package/lib/typescript/src/Shared/Components/DiagnosticReportButton.d.ts +20 -0
  20. package/lib/typescript/src/Shared/Components/DiagnosticReportButton.d.ts.map +1 -0
  21. package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.d.ts.map +1 -1
  22. package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.types.d.ts +10 -0
  23. package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.types.d.ts.map +1 -1
  24. package/lib/typescript/src/Shared/Components/NavigationManager.d.ts.map +1 -1
  25. package/lib/typescript/src/Shared/Components/TrustchexCamera.d.ts +10 -0
  26. package/lib/typescript/src/Shared/Components/TrustchexCamera.d.ts.map +1 -1
  27. package/lib/typescript/src/Shared/EIDReader/eidReader.d.ts.map +1 -1
  28. package/lib/typescript/src/Shared/Libs/diagnosticReport.d.ts +48 -0
  29. package/lib/typescript/src/Shared/Libs/diagnosticReport.d.ts.map +1 -0
  30. package/lib/typescript/src/Shared/Libs/diagnostics.d.ts +145 -0
  31. package/lib/typescript/src/Shared/Libs/diagnostics.d.ts.map +1 -0
  32. package/lib/typescript/src/Shared/Libs/mrzFrameAggregator.d.ts +33 -0
  33. package/lib/typescript/src/Shared/Libs/mrzFrameAggregator.d.ts.map +1 -1
  34. package/lib/typescript/src/Shared/Libs/native-device-info.utils.d.ts +33 -0
  35. package/lib/typescript/src/Shared/Libs/native-device-info.utils.d.ts.map +1 -1
  36. package/lib/typescript/src/Shared/Libs/sendDiagnosticReport.d.ts +30 -0
  37. package/lib/typescript/src/Shared/Libs/sendDiagnosticReport.d.ts.map +1 -0
  38. package/lib/typescript/src/Translation/Resources/en.d.ts +5 -0
  39. package/lib/typescript/src/Translation/Resources/en.d.ts.map +1 -1
  40. package/lib/typescript/src/Translation/Resources/tr.d.ts +5 -0
  41. package/lib/typescript/src/Translation/Resources/tr.d.ts.map +1 -1
  42. package/lib/typescript/src/Trustchex.d.ts.map +1 -1
  43. package/lib/typescript/src/version.d.ts +1 -1
  44. package/package.json +5 -1
  45. package/src/Screens/Static/ResultScreen.tsx +46 -1
  46. package/src/Shared/Components/DiagnosticReportButton.tsx +77 -0
  47. package/src/Shared/Components/IdentityDocumentCamera.tsx +145 -7
  48. package/src/Shared/Components/IdentityDocumentCamera.types.ts +6 -0
  49. package/src/Shared/Components/NavigationManager.tsx +7 -7
  50. package/src/Shared/Components/TrustchexCamera.tsx +6 -0
  51. package/src/Shared/EIDReader/eidReader.ts +166 -46
  52. package/src/Shared/Libs/MRZ_KNOWN_ISSUES.md +7 -0
  53. package/src/Shared/Libs/diagnosticReport.ts +206 -0
  54. package/src/Shared/Libs/diagnostics.ts +251 -0
  55. package/src/Shared/Libs/mrzFrameAggregator.ts +61 -3
  56. package/src/Shared/Libs/native-device-info.utils.ts +116 -0
  57. package/src/Shared/Libs/sendDiagnosticReport.ts +165 -0
  58. package/src/Translation/Resources/en.ts +6 -0
  59. package/src/Translation/Resources/tr.ts +6 -0
  60. package/src/Trustchex.tsx +26 -3
  61. package/src/version.ts +1 -1
package/src/Trustchex.tsx CHANGED
@@ -1,4 +1,10 @@
1
- import React, { useEffect, useState, useMemo, useRef } from 'react';
1
+ import React, {
2
+ useEffect,
3
+ useState,
4
+ useMemo,
5
+ useRef,
6
+ useCallback,
7
+ } from 'react';
2
8
  import { NavigationContainer } from '@react-navigation/native';
3
9
  import { createNativeStackNavigator } from '@react-navigation/native-stack';
4
10
  import { View, ActivityIndicator, StyleSheet } from 'react-native';
@@ -96,11 +102,27 @@ const Trustchex: React.FC<TrustchexProps> = ({
96
102
  // discarding those mutations and causing screens to see undefined values.
97
103
  const contextRef = useRef<AppContextType | null>(null);
98
104
 
105
+ // Wrap the demo-session setter so it ALSO mutates the persistent context
106
+ // object synchronously. The React state update is async, but the verification
107
+ // flow navigates to the next step in the same tick and advances thereafter by
108
+ // direct mutation (never re-rendering Trustchex). If isDemoSession lived only
109
+ // as a state-derived memo field, downstream screens (e.g. ResultScreen, which
110
+ // gates the diagnostics button on it) could read a stale `false`. Mutating the
111
+ // ref makes the flag travel with the object every screen holds.
112
+ const setIsDemoSessionAndPersist = useCallback((value: boolean) => {
113
+ if (contextRef.current) {
114
+ contextRef.current.isDemoSession = value;
115
+ }
116
+ setIsDemoSession(value);
117
+ }, []);
118
+
99
119
  const contextValue = useMemo(() => {
100
120
  const prev = contextRef.current;
101
121
 
102
122
  const value: AppContextType = {
103
- isDemoSession,
123
+ // Prefer a direct mutation carried on the persistent object over the
124
+ // (possibly not-yet-flushed) state, so the demo flag can't desync.
125
+ isDemoSession: prev?.isDemoSession || isDemoSession,
104
126
  baseUrl: baseUrl || '',
105
127
  locale,
106
128
  branding,
@@ -124,7 +146,7 @@ const Trustchex: React.FC<TrustchexProps> = ({
124
146
  onError,
125
147
  setSessionId,
126
148
  setBaseUrl,
127
- setIsDemoSession,
149
+ setIsDemoSession: setIsDemoSessionAndPersist,
128
150
  };
129
151
 
130
152
  // Update state-derived identificationInfo fields without replacing
@@ -146,6 +168,7 @@ const Trustchex: React.FC<TrustchexProps> = ({
146
168
  onCompleted,
147
169
  onError,
148
170
  isDemoSession,
171
+ setIsDemoSessionAndPersist,
149
172
  ]);
150
173
 
151
174
  // Initialize analytics when SDK mounts with valid session
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // This file is auto-generated. Do not edit manually.
2
2
  // Version is synced from package.json during build.
3
- export const SDK_VERSION = '1.478.7';
3
+ export const SDK_VERSION = '1.481.1';