@trustchex/react-native-sdk 1.267.0 → 1.354.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.
Files changed (72) hide show
  1. package/lib/module/Screens/Dynamic/ContractAcceptanceScreen.js +8 -2
  2. package/lib/module/Screens/Dynamic/IdentityDocumentEIDScanningScreen.js +5 -1
  3. package/lib/module/Screens/Dynamic/IdentityDocumentScanningScreen.js +5 -1
  4. package/lib/module/Screens/Dynamic/LivenessDetectionScreen.js +29 -15
  5. package/lib/module/Screens/Static/OTPVerificationScreen.js +285 -0
  6. package/lib/module/Screens/Static/ResultScreen.js +90 -26
  7. package/lib/module/Screens/Static/VerificationSessionCheckScreen.js +48 -134
  8. package/lib/module/Shared/Components/DebugNavigationPanel.js +252 -0
  9. package/lib/module/Shared/Components/EIDScanner.js +142 -17
  10. package/lib/module/Shared/Components/FaceCamera.js +23 -11
  11. package/lib/module/Shared/Components/IdentityDocumentCamera.js +295 -44
  12. package/lib/module/Shared/Components/NavigationManager.js +19 -3
  13. package/lib/module/Shared/Config/camera-enhancement.config.js +58 -0
  14. package/lib/module/Shared/Contexts/AppContext.js +1 -0
  15. package/lib/module/Shared/Libs/camera.utils.js +221 -1
  16. package/lib/module/Shared/Libs/frame-enhancement.utils.js +133 -0
  17. package/lib/module/Shared/Libs/mrz.utils.js +98 -1
  18. package/lib/module/Translation/Resources/en.js +30 -0
  19. package/lib/module/Translation/Resources/tr.js +30 -0
  20. package/lib/module/Trustchex.js +49 -39
  21. package/lib/module/version.js +1 -1
  22. package/lib/typescript/src/Screens/Dynamic/ContractAcceptanceScreen.d.ts.map +1 -1
  23. package/lib/typescript/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.d.ts.map +1 -1
  24. package/lib/typescript/src/Screens/Dynamic/IdentityDocumentScanningScreen.d.ts.map +1 -1
  25. package/lib/typescript/src/Screens/Dynamic/LivenessDetectionScreen.d.ts.map +1 -1
  26. package/lib/typescript/src/Screens/Static/OTPVerificationScreen.d.ts +3 -0
  27. package/lib/typescript/src/Screens/Static/OTPVerificationScreen.d.ts.map +1 -0
  28. package/lib/typescript/src/Screens/Static/ResultScreen.d.ts.map +1 -1
  29. package/lib/typescript/src/Screens/Static/VerificationSessionCheckScreen.d.ts.map +1 -1
  30. package/lib/typescript/src/Shared/Components/DebugNavigationPanel.d.ts +3 -0
  31. package/lib/typescript/src/Shared/Components/DebugNavigationPanel.d.ts.map +1 -0
  32. package/lib/typescript/src/Shared/Components/EIDScanner.d.ts.map +1 -1
  33. package/lib/typescript/src/Shared/Components/FaceCamera.d.ts.map +1 -1
  34. package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.d.ts.map +1 -1
  35. package/lib/typescript/src/Shared/Components/NavigationManager.d.ts.map +1 -1
  36. package/lib/typescript/src/Shared/Config/camera-enhancement.config.d.ts +54 -0
  37. package/lib/typescript/src/Shared/Config/camera-enhancement.config.d.ts.map +1 -0
  38. package/lib/typescript/src/Shared/Contexts/AppContext.d.ts +2 -0
  39. package/lib/typescript/src/Shared/Contexts/AppContext.d.ts.map +1 -1
  40. package/lib/typescript/src/Shared/Libs/camera.utils.d.ts +65 -1
  41. package/lib/typescript/src/Shared/Libs/camera.utils.d.ts.map +1 -1
  42. package/lib/typescript/src/Shared/Libs/frame-enhancement.utils.d.ts +25 -0
  43. package/lib/typescript/src/Shared/Libs/frame-enhancement.utils.d.ts.map +1 -0
  44. package/lib/typescript/src/Shared/Libs/mrz.utils.d.ts.map +1 -1
  45. package/lib/typescript/src/Translation/Resources/en.d.ts +30 -0
  46. package/lib/typescript/src/Translation/Resources/en.d.ts.map +1 -1
  47. package/lib/typescript/src/Translation/Resources/tr.d.ts +30 -0
  48. package/lib/typescript/src/Translation/Resources/tr.d.ts.map +1 -1
  49. package/lib/typescript/src/Trustchex.d.ts.map +1 -1
  50. package/lib/typescript/src/version.d.ts +1 -1
  51. package/package.json +3 -3
  52. package/src/Screens/Dynamic/ContractAcceptanceScreen.tsx +6 -2
  53. package/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.tsx +3 -1
  54. package/src/Screens/Dynamic/IdentityDocumentScanningScreen.tsx +3 -1
  55. package/src/Screens/Dynamic/LivenessDetectionScreen.tsx +27 -17
  56. package/src/Screens/Static/OTPVerificationScreen.tsx +379 -0
  57. package/src/Screens/Static/ResultScreen.tsx +160 -101
  58. package/src/Screens/Static/VerificationSessionCheckScreen.tsx +51 -196
  59. package/src/Shared/Components/DebugNavigationPanel.tsx +262 -0
  60. package/src/Shared/Components/EIDScanner.tsx +144 -19
  61. package/src/Shared/Components/FaceCamera.tsx +38 -21
  62. package/src/Shared/Components/IdentityDocumentCamera.tsx +399 -101
  63. package/src/Shared/Components/NavigationManager.tsx +19 -3
  64. package/src/Shared/Config/camera-enhancement.config.ts +46 -0
  65. package/src/Shared/Contexts/AppContext.ts +3 -0
  66. package/src/Shared/Libs/camera.utils.ts +240 -1
  67. package/src/Shared/Libs/frame-enhancement.utils.ts +217 -0
  68. package/src/Shared/Libs/mrz.utils.ts +78 -1
  69. package/src/Translation/Resources/en.ts +30 -0
  70. package/src/Translation/Resources/tr.ts +30 -0
  71. package/src/Trustchex.tsx +58 -46
  72. package/src/version.ts +1 -1
@@ -15,6 +15,7 @@ import {
15
15
  Text,
16
16
  View,
17
17
  } from 'react-native';
18
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
18
19
  import AppContext from '../../Shared/Contexts/AppContext';
19
20
  import httpClient from '../../Shared/Libs/http-client';
20
21
  import RNFS from 'react-native-fs';
@@ -55,10 +56,41 @@ const ResultScreen = () => {
55
56
  const [shouldShowDemoData, setShouldShowDemoData] = useState(false);
56
57
  const [deviceIdentifier, setDeviceIdentifier] = useState<string>('');
57
58
  const { t } = useTranslation();
59
+ const insets = useSafeAreaInsets();
58
60
 
59
61
  // Track screen view and exit
60
62
  useScreenTracking('result_screen');
61
63
 
64
+ const formatDate = useCallback((dateStr?: string | null) => {
65
+ if (!dateStr) return '';
66
+
67
+ try {
68
+ // Check if it's YYMMDD format (6 digits)
69
+ if (dateStr.length === 6 && /^\d{6}$/.test(dateStr)) {
70
+ const yy = dateStr.substring(0, 2);
71
+ const mm = dateStr.substring(2, 4);
72
+ const dd = dateStr.substring(4, 6);
73
+
74
+ // Assume 19xx if YY >= 50, else 20xx
75
+ const year = parseInt(yy) >= 50 ? `19${yy}` : `20${yy}`;
76
+ return `${dd}/${mm}/${year}`;
77
+ }
78
+
79
+ // Otherwise try to parse as ISO 8601
80
+ const date = new Date(dateStr);
81
+ if (!isNaN(date.getTime())) {
82
+ const day = String(date.getDate()).padStart(2, '0');
83
+ const month = String(date.getMonth() + 1).padStart(2, '0');
84
+ const year = date.getFullYear();
85
+ return `${day}/${month}/${year}`;
86
+ }
87
+
88
+ return dateStr;
89
+ } catch {
90
+ return dateStr;
91
+ }
92
+ }, []);
93
+
62
94
  const apiUrl = useMemo(
63
95
  () => `${appContext.baseUrl}/api/app/mobile`,
64
96
  [appContext.baseUrl]
@@ -463,12 +495,12 @@ const ResultScreen = () => {
463
495
  setIsSubmitting(false);
464
496
 
465
497
  // Track successful verification completion as final funnel step
466
- trackFunnelStep('Verification Completed', 5, 5, 'nfc_scanning', true).catch(() => {});
498
+ trackFunnelStep('Verification Completed', 5, 5, 'nfc_scanning', true).catch(() => { });
467
499
  analyticsService.trackEvent(
468
500
  AnalyticsEventName.VERIFICATION_SUCCESS,
469
501
  AnalyticsEventCategory.VERIFICATION,
470
502
  { sessionId: appContext.identificationInfo.sessionId || '' }
471
- ).catch(() => {});
503
+ ).catch(() => { });
472
504
  } catch (error) {
473
505
  setIsSubmitting(false);
474
506
  setProgress(0);
@@ -482,7 +514,7 @@ const ResultScreen = () => {
482
514
  'result_screen',
483
515
  'critical',
484
516
  { recoverable: false, userAction: 'submit_verification' }
485
- ).catch(() => {});
517
+ ).catch(() => { });
486
518
  analyticsService.trackEvent(
487
519
  AnalyticsEventName.VERIFICATION_FAILED,
488
520
  AnalyticsEventCategory.VERIFICATION,
@@ -490,7 +522,7 @@ const ResultScreen = () => {
490
522
  sessionId: appContext.identificationInfo.sessionId || '',
491
523
  errorMessage,
492
524
  }
493
- ).catch(() => {});
525
+ ).catch(() => { });
494
526
 
495
527
  Alert.alert(t('general.error'), t('resultScreen.submissionFailed'));
496
528
  appContext.onError?.(t('resultScreen.submissionFailed'));
@@ -644,10 +676,10 @@ const ResultScreen = () => {
644
676
  {t('eidScannerScreen.birthDate')}:
645
677
  </Text>
646
678
  <Text style={styles.mrzInfoText}>
647
- {
679
+ {formatDate(
648
680
  appContext.identificationInfo.scannedDocument
649
681
  .mrzFields?.birthDate
650
- }
682
+ )}
651
683
  </Text>
652
684
  </View>
653
685
  <View style={styles.mrzInfoItem}>
@@ -666,24 +698,24 @@ const ResultScreen = () => {
666
698
  {t('eidScannerScreen.expirationDate')}:
667
699
  </Text>
668
700
  <Text style={styles.mrzInfoText}>
669
- {
701
+ {formatDate(
670
702
  appContext.identificationInfo.scannedDocument
671
703
  .mrzFields?.expirationDate
672
- }
704
+ )}
673
705
  </Text>
674
706
  </View>
675
- <View style={styles.mrzInfoItem}>
676
- <Text style={styles.mrzInfoLabel}>
677
- {t('eidScannerScreen.mrzText')}:
707
+ </View>
708
+
709
+ {appContext.identificationInfo.scannedDocument.mrzText && (
710
+ <View style={styles.mrzTextContainer}>
711
+ <Text style={styles.mrzTextLabel}>
712
+ {t('eidScannerScreen.mrzText')}
678
713
  </Text>
679
- <Text style={styles.mrzInfoText}>
680
- {
681
- appContext.identificationInfo.scannedDocument
682
- .mrzText
683
- }
714
+ <Text style={styles.mrzTextValue}>
715
+ {appContext.identificationInfo.scannedDocument.mrzText}
684
716
  </Text>
685
717
  </View>
686
- </View>
718
+ )}
687
719
 
688
720
  <Text style={styles.sectionText}>
689
721
  {t('resultScreen.demoImages')}
@@ -692,89 +724,84 @@ const ResultScreen = () => {
692
724
  <View style={styles.imageContainer}>
693
725
  {appContext.identificationInfo.scannedDocument
694
726
  .frontImage && (
695
- <View style={styles.imageItem}>
696
- <Image
697
- style={styles.image}
698
- source={{
699
- uri: `data:image/jpeg;base64,${
700
- appContext.identificationInfo.scannedDocument
727
+ <View style={styles.imageItem}>
728
+ <Image
729
+ style={styles.image}
730
+ source={{
731
+ uri: `data:image/jpeg;base64,${appContext.identificationInfo.scannedDocument
701
732
  .frontImage
702
- }`,
703
- }}
704
- />
705
- <Text style={styles.imageText}>
706
- {t('resultScreen.demoImageFront')}
707
- </Text>
708
- </View>
709
- )}
733
+ }`,
734
+ }}
735
+ />
736
+ <Text style={styles.imageText}>
737
+ {t('resultScreen.demoImageFront')}
738
+ </Text>
739
+ </View>
740
+ )}
710
741
  {appContext.identificationInfo.scannedDocument
711
742
  .backImage && (
712
- <View style={styles.imageItem}>
713
- <Image
714
- style={styles.image}
715
- source={{
716
- uri: `data:image/jpeg;base64,${
717
- appContext.identificationInfo.scannedDocument
743
+ <View style={styles.imageItem}>
744
+ <Image
745
+ style={styles.image}
746
+ source={{
747
+ uri: `data:image/jpeg;base64,${appContext.identificationInfo.scannedDocument
718
748
  .backImage
719
- }`,
720
- }}
721
- />
722
- <Text style={styles.imageText}>
723
- {t('resultScreen.demoImageBack')}
724
- </Text>
725
- </View>
726
- )}
749
+ }`,
750
+ }}
751
+ />
752
+ <Text style={styles.imageText}>
753
+ {t('resultScreen.demoImageBack')}
754
+ </Text>
755
+ </View>
756
+ )}
727
757
  {appContext.identificationInfo.scannedDocument
728
758
  .faceImage && (
729
- <View style={styles.imageItem}>
730
- <Image
731
- style={styles.image}
732
- source={{
733
- uri: `data:image/jpeg;base64,${
734
- appContext.identificationInfo.scannedDocument
759
+ <View style={styles.imageItem}>
760
+ <Image
761
+ style={styles.image}
762
+ source={{
763
+ uri: `data:image/jpeg;base64,${appContext.identificationInfo.scannedDocument
735
764
  .faceImage
736
- }`,
737
- }}
738
- />
739
- <Text style={styles.imageText}>
740
- {t('resultScreen.demoImageFace')}
741
- </Text>
742
- </View>
743
- )}
765
+ }`,
766
+ }}
767
+ />
768
+ <Text style={styles.imageText}>
769
+ {t('resultScreen.demoImageFace')}
770
+ </Text>
771
+ </View>
772
+ )}
744
773
  {appContext.identificationInfo.scannedDocument
745
774
  .secondaryFaceImage && (
746
- <View style={styles.imageItem}>
747
- <Image
748
- style={styles.image}
749
- source={{
750
- uri: `data:image/jpeg;base64,${
751
- appContext.identificationInfo.scannedDocument
775
+ <View style={styles.imageItem}>
776
+ <Image
777
+ style={styles.image}
778
+ source={{
779
+ uri: `data:image/jpeg;base64,${appContext.identificationInfo.scannedDocument
752
780
  .secondaryFaceImage
753
- }`,
754
- }}
755
- />
756
- <Text style={styles.imageText}>
757
- {t('resultScreen.demoImageSecondaryFace')}
758
- </Text>
759
- </View>
760
- )}
781
+ }`,
782
+ }}
783
+ />
784
+ <Text style={styles.imageText}>
785
+ {t('resultScreen.demoImageSecondaryFace')}
786
+ </Text>
787
+ </View>
788
+ )}
761
789
  {appContext.identificationInfo.scannedDocument
762
790
  .hologramImage && (
763
- <View style={styles.imageItem}>
764
- <Image
765
- style={styles.image}
766
- source={{
767
- uri: `data:image/jpeg;base64,${
768
- appContext.identificationInfo.scannedDocument
791
+ <View style={styles.imageItem}>
792
+ <Image
793
+ style={styles.image}
794
+ source={{
795
+ uri: `data:image/jpeg;base64,${appContext.identificationInfo.scannedDocument
769
796
  .hologramImage
770
- }`,
771
- }}
772
- />
773
- <Text style={styles.imageText}>
774
- {t('resultScreen.demoImageHologram')}
775
- </Text>
776
- </View>
777
- )}
797
+ }`,
798
+ }}
799
+ />
800
+ <Text style={styles.imageText}>
801
+ {t('resultScreen.demoImageHologram')}
802
+ </Text>
803
+ </View>
804
+ )}
778
805
  </View>
779
806
  </ScrollView>
780
807
  </>
@@ -815,7 +842,7 @@ const ResultScreen = () => {
815
842
  <Text style={styles.imageText}>
816
843
  {t(
817
844
  'resultScreen.demoInstruction_' +
818
- instruction.instruction.toLowerCase()
845
+ instruction.instruction.toLowerCase()
819
846
  )}
820
847
  </Text>
821
848
  </View>
@@ -826,15 +853,17 @@ const ResultScreen = () => {
826
853
  )}
827
854
  </View>
828
855
  </ScrollView>
829
- <StyledButton
830
- mode="contained"
831
- onPress={() => {
832
- appContext.onCompleted?.();
833
- navigationManagerRef.current?.reset();
834
- }}
835
- >
836
- {t('resultScreen.demoStartOver')}
837
- </StyledButton>
856
+ <View style={{ paddingBottom: insets.bottom }}>
857
+ <StyledButton
858
+ mode="contained"
859
+ onPress={() => {
860
+ appContext.onCompleted?.();
861
+ navigationManagerRef.current?.reset();
862
+ }}
863
+ >
864
+ {t('resultScreen.demoStartOver')}
865
+ </StyledButton>
866
+ </View>
838
867
  </>
839
868
  ) : (
840
869
  <>
@@ -866,9 +895,11 @@ const styles = StyleSheet.create({
866
895
  container: {
867
896
  flex: 1,
868
897
  display: 'flex',
869
- padding: 20,
898
+ paddingVertical: 20,
899
+ paddingHorizontal: 10,
870
900
  justifyContent: 'center',
871
901
  gap: 20,
902
+ backgroundColor: 'white',
872
903
  },
873
904
  sectionAnimation: {
874
905
  width: 192,
@@ -912,17 +943,19 @@ const styles = StyleSheet.create({
912
943
  width: 100,
913
944
  height: 100,
914
945
  objectFit: 'contain',
946
+ borderRadius: 8,
915
947
  },
916
948
  imageItem: {
917
949
  display: 'flex',
918
950
  flexDirection: 'column',
919
- gap: 10,
951
+ gap: 8,
920
952
  alignItems: 'center',
921
953
  },
922
954
  imageContainer: {
923
955
  display: 'flex',
924
956
  flexDirection: 'row',
925
957
  gap: 10,
958
+ paddingVertical: 8,
926
959
  },
927
960
  imageText: {
928
961
  fontSize: 10,
@@ -933,13 +966,18 @@ const styles = StyleSheet.create({
933
966
  mrzInfo: {
934
967
  flexDirection: 'column',
935
968
  width: '100%',
969
+ borderWidth: 1,
970
+ borderColor: '#D1D5DB',
971
+ borderRadius: 8,
972
+ overflow: 'hidden',
936
973
  },
937
974
  mrzInfoItem: {
938
975
  flexDirection: 'row',
939
976
  justifyContent: 'space-between',
940
- borderBottomColor: 'lightgray',
977
+ borderBottomColor: '#D1D5DB',
941
978
  borderBottomWidth: 1,
942
- paddingVertical: 5,
979
+ paddingVertical: 8,
980
+ paddingHorizontal: 12,
943
981
  },
944
982
  mrzInfoLabel: {
945
983
  color: 'black',
@@ -949,6 +987,27 @@ const styles = StyleSheet.create({
949
987
  mrzInfoText: {
950
988
  color: 'black',
951
989
  fontSize: 10,
990
+ fontFamily: Platform.OS === 'ios' ? 'Courier' : 'monospace',
991
+ },
992
+ mrzTextContainer: {
993
+ padding: 12,
994
+ backgroundColor: '#F3F4F6',
995
+ borderRadius: 8,
996
+ borderWidth: 1,
997
+ borderColor: '#D1D5DB',
998
+ },
999
+ mrzTextLabel: {
1000
+ fontSize: 12,
1001
+ fontWeight: '600',
1002
+ color: '#6B7280',
1003
+ marginBottom: 8,
1004
+ },
1005
+ mrzTextValue: {
1006
+ fontFamily: Platform.OS === 'ios' ? 'Courier' : 'monospace',
1007
+ fontSize: 10,
1008
+ letterSpacing: 1,
1009
+ lineHeight: 14,
1010
+ color: '#1F2937',
952
1011
  },
953
1012
  trustchexLogo: {
954
1013
  width: 150,