@sanctum-key/react-native-sdk 1.0.52 → 1.0.54

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 (132) hide show
  1. package/README.md +7 -2
  2. package/android/build/.transforms/3db9b15041d4285a820fc84462995ea1/results.bin +1 -0
  3. package/android/build/.transforms/3db9b15041d4285a820fc84462995ea1/transformed/classes/classes_dex/classes.dex +0 -0
  4. package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  5. package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  6. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
  7. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
  8. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
  9. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
  10. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
  11. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
  12. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
  13. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
  14. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
  15. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
  16. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
  17. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
  18. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
  19. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
  20. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
  21. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
  22. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
  23. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
  24. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
  25. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
  26. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
  27. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
  28. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
  29. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
  30. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
  31. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
  32. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
  33. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
  34. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
  35. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
  36. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
  37. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
  38. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +1 -1
  39. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
  40. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
  41. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
  42. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
  43. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
  44. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
  45. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
  46. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
  47. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
  48. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
  49. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
  50. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
  51. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
  52. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
  53. package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
  54. package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
  55. package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
  56. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  57. package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/SanctumKeySdkModule$BarcodeRegion.class +0 -0
  58. package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/SanctumKeySdkModule$Companion.class +0 -0
  59. package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$1$5$1.class → SanctumKeySdkModule$definition$1$6$1.class} +0 -0
  60. package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$1$5$2.class → SanctumKeySdkModule$definition$1$6$2.class} +0 -0
  61. package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunction$1.class → SanctumKeySdkModule$definition$lambda$16$$inlined$AsyncFunction$1.class} +0 -0
  62. package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunction$5.class → SanctumKeySdkModule$definition$lambda$16$$inlined$AsyncFunction$2.class} +0 -0
  63. package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunction$3.class → SanctumKeySdkModule$definition$lambda$16$$inlined$AsyncFunction$3.class} +0 -0
  64. package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunction$4.class → SanctumKeySdkModule$definition$lambda$16$$inlined$AsyncFunction$4.class} +0 -0
  65. package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunction$2.class → SanctumKeySdkModule$definition$lambda$16$$inlined$AsyncFunction$5.class} +0 -0
  66. package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunction$6.class → SanctumKeySdkModule$definition$lambda$16$$inlined$AsyncFunction$6.class} +0 -0
  67. package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$1.class → SanctumKeySdkModule$definition$lambda$16$$inlined$AsyncFunctionWithPromise$1.class} +0 -0
  68. package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$3.class → SanctumKeySdkModule$definition$lambda$16$$inlined$AsyncFunctionWithPromise$2.class} +0 -0
  69. package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/SanctumKeySdkModule$definition$lambda$16$$inlined$AsyncFunctionWithPromise$3.class +0 -0
  70. package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/SanctumKeySdkModule$definition$lambda$16$$inlined$AsyncFunctionWithPromise$4.class +0 -0
  71. package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$2.class → SanctumKeySdkModule$definition$lambda$16$$inlined$AsyncFunctionWithPromise$5.class} +0 -0
  72. package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/SanctumKeySdkModule$definition$lambda$16$$inlined$AsyncFunctionWithPromise$6.class +0 -0
  73. package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$4.class → SanctumKeySdkModule$definition$lambda$16$$inlined$AsyncFunctionWithPromise$7.class} +0 -0
  74. package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$5$$inlined$View$1.class → SanctumKeySdkModule$definition$lambda$16$$inlined$View$1.class} +0 -0
  75. package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$5$lambda$4$$inlined$Prop$1.class → SanctumKeySdkModule$definition$lambda$16$lambda$15$$inlined$Prop$1.class} +0 -0
  76. package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$5$lambda$4$$inlined$Prop$2.class → SanctumKeySdkModule$definition$lambda$16$lambda$15$$inlined$Prop$2.class} +0 -0
  77. package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/SanctumKeySdkModule.class +0 -0
  78. package/android/build.gradle +7 -0
  79. package/android/src/main/java/kyc/sanctumkey/com/SanctumKeySdkModule.kt +428 -1
  80. package/build/package.json +1 -1
  81. package/build/src/SanctumKeySdkModule.d.ts +1 -0
  82. package/build/src/SanctumKeySdkModule.d.ts.map +1 -1
  83. package/build/src/SanctumKeySdkModule.js.map +1 -1
  84. package/build/src/components/EnhancedCameraView.d.ts.map +1 -1
  85. package/build/src/components/EnhancedCameraView.js +50 -41
  86. package/build/src/components/EnhancedCameraView.js.map +1 -1
  87. package/build/src/components/EnhancedCameraView.web.d.ts +2 -0
  88. package/build/src/components/EnhancedCameraView.web.d.ts.map +1 -1
  89. package/build/src/components/EnhancedCameraView.web.js +11 -6
  90. package/build/src/components/EnhancedCameraView.web.js.map +1 -1
  91. package/build/src/components/KYCElements/IDCardCapture.d.ts.map +1 -1
  92. package/build/src/components/KYCElements/IDCardCapture.js +499 -78
  93. package/build/src/components/KYCElements/IDCardCapture.js.map +1 -1
  94. package/build/src/components/TemplateKYCExample.d.ts.map +1 -1
  95. package/build/src/components/TemplateKYCExample.js +17 -21
  96. package/build/src/components/TemplateKYCExample.js.map +1 -1
  97. package/build/src/components/TemplateKYCFlowRefactored.d.ts.map +1 -1
  98. package/build/src/components/TemplateKYCFlowRefactored.js +2 -10
  99. package/build/src/components/TemplateKYCFlowRefactored.js.map +1 -1
  100. package/build/src/components/WebBarcodeScanner.d.ts +2 -0
  101. package/build/src/components/WebBarcodeScanner.d.ts.map +1 -1
  102. package/build/src/components/WebBarcodeScanner.js +99 -85
  103. package/build/src/components/WebBarcodeScanner.js.map +1 -1
  104. package/build/src/hooks/useTemplateLoader.d.ts.map +1 -1
  105. package/build/src/hooks/useTemplateLoader.js +0 -2
  106. package/build/src/hooks/useTemplateLoader.js.map +1 -1
  107. package/build/src/modules/api/KYCService.d.ts +1 -0
  108. package/build/src/modules/api/KYCService.d.ts.map +1 -1
  109. package/build/src/modules/api/KYCService.js +1 -1
  110. package/build/src/modules/api/KYCService.js.map +1 -1
  111. package/build/src/modules/api/TemplateService.d.ts.map +1 -1
  112. package/build/src/modules/api/TemplateService.js +2 -1
  113. package/build/src/modules/api/TemplateService.js.map +1 -1
  114. package/build/src/modules/api/types.d.ts +35 -27
  115. package/build/src/modules/api/types.d.ts.map +1 -1
  116. package/build/src/modules/api/types.js.map +1 -1
  117. package/package.json +1 -1
  118. package/plugin/build/withVisionCamera.d.ts +1 -0
  119. package/plugin/build/withVisionCamera.js +13 -1
  120. package/plugin/src/withVisionCamera.js +18 -2
  121. package/plugin/src/withVisionCamera.ts +19 -2
  122. package/src/SanctumKeySdkModule.ts +1 -0
  123. package/src/components/EnhancedCameraView.tsx +52 -41
  124. package/src/components/EnhancedCameraView.web.tsx +15 -5
  125. package/src/components/KYCElements/IDCardCapture.tsx +552 -75
  126. package/src/components/TemplateKYCExample.tsx +23 -25
  127. package/src/components/TemplateKYCFlowRefactored.tsx +2 -8
  128. package/src/components/WebBarcodeScanner.tsx +147 -198
  129. package/src/hooks/useTemplateLoader.ts +0 -2
  130. package/src/modules/api/KYCService.ts +3 -3
  131. package/src/modules/api/TemplateService.ts +3 -2
  132. package/src/modules/api/types.ts +37 -29
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateKYCExample.d.ts","sourceRoot":"","sources":["../../../src/components/TemplateKYCExample.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAGnC,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAwCxE,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC9C,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,oBAAoB,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,UAAU,EACV,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,UAAU,EACV,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B;AAED,wBAAgB,kBAAkB,CAAC,EACjC,UAAU,EACV,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,GAAkB,EAClB,SAAS,EACT,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,WAAW,EACX,aAAa,EACb,cAAc,EACf,EAAE,uBAAuB,GAAG,GAAG,CAAC,OAAO,CA0FvC"}
@@ -43,41 +43,37 @@ export function TemplateKYCExample({ onComplete, onCancel, onError, language, AP
43
43
  console.log('KYC Template completed with raw data:', data);
44
44
  let finalPayload = data; // Fallback to raw data if mapping fails
45
45
  if ((data.status === 'success' || data.status === 'in_progress') && data.result) {
46
- // 1. Extract the dynamic root key (e.g., 'national_id', 'passport')
47
- const docKey = Object.keys(data.result)[0];
48
- if (docKey && data.result[docKey]) {
49
- const backendData = data.result[docKey].data;
50
- const personalInfo = backendData?.user_data?.personal_information || {};
51
- // Ensure we capture the session ID from whichever prop was provided
52
- const activeSessionId = kyc_session_id || existingSessionId || "";
53
- // 2. Strict mapping to your expected format
46
+ const backendData = data.result.data;
47
+ if (backendData) {
48
+ const personalInfo = backendData.user_data?.personal_information || {};
49
+ const activeSessionId = kyc_session_id || existingSessionId || backendData.session_id || "";
50
+ const docType = backendData.document_type || backendData.documentType;
54
51
  finalPayload = {
55
52
  data: {
56
- verification_id: backendData?.verification_id,
57
- verification_status: backendData?.verification_status,
53
+ document_type: docType,
54
+ verification_id: backendData.verification_id,
55
+ verification_status: backendData.verification_status,
58
56
  session_id: activeSessionId,
59
57
  user_data: {
60
58
  personal_information: {
61
- first_name: personalInfo.first_name || undefined,
59
+ first_name: personalInfo.first_name || personalInfo.given_name || undefined,
60
+ last_name: personalInfo.last_name || personalInfo.surname || undefined,
62
61
  given_name: personalInfo.given_name || undefined,
63
- last_name: personalInfo.last_name || undefined,
64
- surname: personalInfo.last_name || undefined, // fallback
62
+ surname: personalInfo.surname || undefined,
65
63
  address: personalInfo.address || undefined,
66
- city: personalInfo.city || undefined,
67
- postal_code: personalInfo.postal_code || undefined,
68
64
  expiry_date: personalInfo.expiry_date || undefined,
69
65
  issue_date: personalInfo.issue_date || undefined,
70
- date_of_birth: personalInfo.date_of_birth || undefined,
71
- birth_date: personalInfo.date_of_birth || undefined, // fallback
72
- country: personalInfo.country || undefined,
66
+ date_of_birth: personalInfo.date_of_birth || personalInfo.birth_date || undefined,
67
+ birth_date: personalInfo.birth_date || undefined,
73
68
  document_number: personalInfo.document_number || undefined,
74
69
  nationality: personalInfo.nationality || undefined,
70
+ sex: personalInfo.sex || undefined,
75
71
  }
76
72
  }
77
73
  }
78
74
  };
79
- sdkLogger.info("Wrapper formatted completion payload successfully", {
80
- verification_id: finalPayload.data.verification_id
75
+ sdkLogger.info("Wrapper formatteddddd completion payload successfully", {
76
+ data: finalPayload
81
77
  });
82
78
  }
83
79
  }
@@ -91,7 +87,7 @@ export function TemplateKYCExample({ onComplete, onCancel, onError, language, AP
91
87
  onCancel();
92
88
  };
93
89
  const handleError = (error) => {
94
- console.error('KYC Template error:', error);
90
+ sdkLogger.error('KYC Template error:', error);
95
91
  onError(error);
96
92
  };
97
93
  const templateToUse = templateId ? undefined : (template || advancedVerificationTemplate);
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateKYCExample.js","sourceRoot":"","sources":["../../../src/components/TemplateKYCExample.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAc,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC,CAAC,uBAAuB;AAEpE,MAAM,4BAA4B,GAAgB;IAChD,EAAE,EAAE,CAAC;IACL,IAAI,EAAE,EAAE,EAAE,EAAE,uBAAuB,EAAE,EAAE,EAAE,sBAAsB,EAAE;IACjE,WAAW,EAAE,EAAE,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E,YAAY,CAAC,CAChB,CAAC;AACJ,CAAC","sourcesContent":["import React, { JSX } from 'react';\nimport { View, SafeAreaView } from 'react-native';\nimport { TemplateKYCFlow } from './TemplateKYCFlowRefactored';\nimport { KYCTemplate, VerificationState } from '../types/KYC.types';\nimport { KycEnvironment, BackendEnvironment } from '../types/env.types';\nimport { sdkLogger } from '../utils/logger'; // 🚨 IMPORT SDK LOGGER\n\nconst advancedVerificationTemplate: KYCTemplate = {\n id: 1,\n name: { en: \"Advanced Verification\", fr: \"Vérification Avancée\" },\n description: { en: \"Extended identity verification flow\", fr: \"Processus de vérification d'identité étendu\" },\n version: \"1.1.0\",\n components: [\n {\n id: 5, type: \"location\" as const, order: 1,\n labels: { en: \"Enable your location\", fr: \"Activez votre localisation\" },\n instructions: { en: \"We need your GPS location for compliance purposes.\", fr: \"Nous avons besoin de votre localisation GPS pour des raisons réglementaires.\" },\n ui: { icon: \"location-icon.png\", themeColor: \"#2DBD60\", buttonText: { en: \"Enable Location\", fr: \"Activer la localisation\" } },\n config: { accuracy: \"high\", required: true } as const\n },\n {\n id: 6, type: \"country_selection\" as const, order: 2,\n labels: { en: \"Select your country\", fr: \"Sélectionnez votre pays\" },\n instructions: { en: \"Choose your country of residence.\", fr: \"Choisissez votre pays de résidence.\" },\n ui: { icon: \"country-icon.png\", themeColor: \"#2DBD60\", buttonText: { en: \"Confirm\", fr: \"Confirmer\" } },\n config: { allowed_countries: [\"CM\", \"NG\", \"CI\", \"KE\", \"GH\"], default_country: \"CM\", required: true } as const\n },\n {\n id: 1, type: \"id_card\" as const, order: 3, templateId: 1,\n labels: { front: { en: \"Upload front of ID card\", fr: \"Téléversez le recto de votre carte d'identité\" }, back: { en: \"Upload back of ID card\", fr: \"Téléversez le verso de votre carte d'identité\" }, },\n instructions: { front: { en: \"Take a clear photo of the front of your ID.\", fr: \"Prenez une photo nette du recto de votre pièce.\" }, back: { en: \"Take a clear photo of the back of your ID.\", fr: \"Prenez une photo nette du verso de votre pièce.\" }, },\n ui: { front: { icon: \"id-card-icon.png\", themeColor: \"#2DBD60\", buttonText: { en: \"Next\", fr: \"Suivant\" } }, back: { icon: \"id-card-icon.png\", themeColor: \"#2DBD60\", buttonText: { en: \"Next\", fr: \"Suivant\" } }, },\n config: { sides: [\"front\", \"back\"], allowed_formats: [\"jpg\", \"png\"], max_size_mb: 5, document_types: [\"drivers_licence\", \"passport\", \"drivers_licence\", \"national_id\"], } as const\n },\n {\n id: 3, type: \"selfie\" as const, order: 5, templateId: 1,\n labels: { en: \"Take selfies from different angles\", fr: \"Prenez des selfies sous différents angles\" },\n instructions: { en: \"Take selfies from front, left, and right angles.\", fr: \"Prenez des selfies de face, profil gauche et profil droit.\" },\n ui: { icon: \"selfie-icon.png\", themeColor: \"#2DBD60\", buttonText: { en: \"Next\", fr: \"Suivant\" } },\n config: { liveness_check: true, max_attempts: 3, orientations: [\"center\", \"left\", \"right\"] } as const\n },\n ]\n};\n\nexport interface TemplateKYCExampleProps {\n onComplete: (data: VerificationState) => void;\n onCancel: () => void;\n onError: (error: string) => void;\n language: string;\n API_KEY?: string;\n TEST_API_KEY?: string;\n templateId?: string;\n template?: KYCTemplate;\n env?: KycEnvironment;\n serverEnv?: BackendEnvironment;\n existingSessionId?: string;\n initialComponentIndex?: number;\n initialCountryResume?: { code: string; documentType: string; region?: string };\n referenceId?: string;\n onSessionSave?: (sessionId: string) => void;\n kyc_session_id?: string;\n}\n\nexport function TemplateKYCExample({\n onComplete,\n onCancel,\n onError,\n language,\n API_KEY,\n TEST_API_KEY,\n templateId,\n template,\n env = 'PRODUCTION',\n serverEnv,\n existingSessionId,\n initialComponentIndex,\n initialCountryResume,\n referenceId,\n onSessionSave,\n kyc_session_id\n}: TemplateKYCExampleProps): JSX.Element {\n\n const handleComplete = (data: VerificationState) => {\n console.log('KYC Template completed with raw data:', data);\n\n let finalPayload: any = data; // Fallback to raw data if mapping fails\n\n if ((data.status === 'success' || data.status === 'in_progress') && data.result) {\n // 1. Extract the dynamic root key (e.g., 'national_id', 'passport')\n const docKey = Object.keys(data.result)[0];\n \n if (docKey && data.result[docKey]) {\n const backendData = data.result[docKey].data;\n const personalInfo = backendData?.user_data?.personal_information || {};\n \n // Ensure we capture the session ID from whichever prop was provided\n const activeSessionId = kyc_session_id || existingSessionId || \"\";\n\n // 2. Strict mapping to your expected format\n finalPayload = {\n data: {\n verification_id: backendData?.verification_id,\n verification_status: backendData?.verification_status,\n session_id: activeSessionId,\n user_data: {\n personal_information: {\n first_name: personalInfo.first_name || undefined,\n given_name: personalInfo.given_name || undefined,\n last_name: personalInfo.last_name || undefined,\n surname: personalInfo.last_name || undefined, // fallback\n address: personalInfo.address || undefined,\n city: personalInfo.city || undefined,\n postal_code: personalInfo.postal_code || undefined,\n expiry_date: personalInfo.expiry_date || undefined,\n issue_date: personalInfo.issue_date || undefined,\n date_of_birth: personalInfo.date_of_birth || undefined,\n birth_date: personalInfo.date_of_birth || undefined, // fallback\n country: personalInfo.country || undefined,\n document_number: (personalInfo as any).document_number || undefined,\n nationality: (personalInfo as any).nationality || undefined,\n }\n }\n }\n };\n\n sdkLogger.info(\"Wrapper formatted completion payload successfully\", { \n verification_id: finalPayload.data.verification_id \n });\n }\n } else {\n sdkLogger.warn(\"Wrapper received completion without a success result object\", { status: data.status });\n }\n\n onComplete(finalPayload as any); \n };\n\n const handleCancel = () => {\n console.log('KYC Template flow cancelled');\n onCancel();\n };\n\n const handleError = (error: string) => {\n console.error('KYC Template error:', error);\n onError(error);\n };\n\n const templateToUse = templateId ? undefined : (template || advancedVerificationTemplate);\n\n return (\n <SafeAreaView style={{ flex: 1, paddingVertical: 25 }}>\n <View style={{ flex: 1 }}>\n <TemplateKYCFlow\n template={templateToUse}\n templateId={templateId}\n onComplete={handleComplete}\n onError={handleError}\n onCancel={handleCancel}\n language={language}\n API_KEY={API_KEY}\n TEST_API_KEY={TEST_API_KEY}\n env={env}\n serverEnv={serverEnv}\n existingSessionId={existingSessionId}\n initialComponentIndex={initialComponentIndex}\n initialCountryResume={initialCountryResume}\n referenceId={referenceId}\n onSessionSave={onSessionSave}\n kyc_session_id={kyc_session_id}\n />\n </View>\n </SafeAreaView>\n );\n}"]}
1
+ {"version":3,"file":"TemplateKYCExample.js","sourceRoot":"","sources":["../../../src/components/TemplateKYCExample.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAc,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC,CAAC,uBAAuB;AAEpE,MAAM,4BAA4B,GAAgB;IAChD,EAAE,EAAE,CAAC;IACL,IAAI,EAAE,EAAE,EAAE,EAAE,uBAAuB,EAAE,EAAE,EAAE,sBAAsB,EAAE;IACjE,WAAW,EAAE,EAAE,EAAE,EAAE,qCAAqC,EAAE,EAAE,EAAE,6CAA6C,EAAE;IAC7G,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE;QACV;YACE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,UAAmB,EAAE,KAAK,EAAE,CAAC;YAC1C,MAAM,EAAE,EAAE,EAAE,EAAE,sBAAsB,EAAE,EAAE,EAAE,4BAA4B,EAAE;YACxE,YAAY,EAAE,EAAE,EAAE,EAAE,oDAAoD,EAAE,EAAE,EAAE,8EAA8E,EAAE;YAC9J,EAAE,EAAE,EAAE,IAAI,EAAE,mBAAmB,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE,iBAAiB,EAAE,EAAE,EAAE,yBAAyB,EAAE,EAAE;YAC9H,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAW;SACtD;QACD;YACE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,mBAA4B,EAAE,KAAK,EAAE,CAAC;YACnD,MAAM,EAAE,EAAE,EAAE,E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C,CAAC,OAAO,CAAC,CACjB,YAAY,CAAC,CAAC,YAAY,CAAC,CAC3B,GAAG,CAAC,CAAC,GAAG,CAAC,CACT,SAAS,CAAC,CAAC,SAAS,CAAC,CACrB,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,CACrC,qBAAqB,CAAC,CAAC,qBAAqB,CAAC,CAC7C,oBAAoB,CAAC,CAAC,oBAAoB,CAAC,CAC3C,WAAW,CAAC,CAAC,WAAW,CAAC,CACzB,aAAa,CAAC,CAAC,aAAa,CAAC,CAC7B,cAAc,CAAC,CAAC,cAAc,CAAC,EAEnC;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,YAAY,CAAC,CAChB,CAAC;AACJ,CAAC","sourcesContent":["import React, { JSX } from 'react';\nimport { View, SafeAreaView } from 'react-native';\nimport { TemplateKYCFlow } from './TemplateKYCFlowRefactored';\nimport { KYCTemplate, VerificationState } from '../types/KYC.types';\nimport { KycEnvironment, BackendEnvironment } from '../types/env.types';\nimport { sdkLogger } from '../utils/logger'; // 🚨 IMPORT SDK LOGGER\n\nconst advancedVerificationTemplate: KYCTemplate = {\n id: 1,\n name: { en: \"Advanced Verification\", fr: \"Vérification Avancée\" },\n description: { en: \"Extended identity verification flow\", fr: \"Processus de vérification d'identité étendu\" },\n version: \"1.1.0\",\n components: [\n {\n id: 5, type: \"location\" as const, order: 1,\n labels: { en: \"Enable your location\", fr: \"Activez votre localisation\" },\n instructions: { en: \"We need your GPS location for compliance purposes.\", fr: \"Nous avons besoin de votre localisation GPS pour des raisons réglementaires.\" },\n ui: { icon: \"location-icon.png\", themeColor: \"#2DBD60\", buttonText: { en: \"Enable Location\", fr: \"Activer la localisation\" } },\n config: { accuracy: \"high\", required: true } as const\n },\n {\n id: 6, type: \"country_selection\" as const, order: 2,\n labels: { en: \"Select your country\", fr: \"Sélectionnez votre pays\" },\n instructions: { en: \"Choose your country of residence.\", fr: \"Choisissez votre pays de résidence.\" },\n ui: { icon: \"country-icon.png\", themeColor: \"#2DBD60\", buttonText: { en: \"Confirm\", fr: \"Confirmer\" } },\n config: { allowed_countries: [\"CM\", \"NG\", \"CI\", \"KE\", \"GH\"], default_country: \"CM\", required: true } as const\n },\n {\n id: 1, type: \"id_card\" as const, order: 3, templateId: 1,\n labels: { front: { en: \"Upload front of ID card\", fr: \"Téléversez le recto de votre carte d'identité\" }, back: { en: \"Upload back of ID card\", fr: \"Téléversez le verso de votre carte d'identité\" }, },\n instructions: { front: { en: \"Take a clear photo of the front of your ID.\", fr: \"Prenez une photo nette du recto de votre pièce.\" }, back: { en: \"Take a clear photo of the back of your ID.\", fr: \"Prenez une photo nette du verso de votre pièce.\" }, },\n ui: { front: { icon: \"id-card-icon.png\", themeColor: \"#2DBD60\", buttonText: { en: \"Next\", fr: \"Suivant\" } }, back: { icon: \"id-card-icon.png\", themeColor: \"#2DBD60\", buttonText: { en: \"Next\", fr: \"Suivant\" } }, },\n config: { sides: [\"front\", \"back\"], allowed_formats: [\"jpg\", \"png\"], max_size_mb: 5, document_types: [\"drivers_licence\", \"passport\", \"drivers_licence\", \"national_id\"], } as const\n },\n {\n id: 3, type: \"selfie\" as const, order: 5, templateId: 1,\n labels: { en: \"Take selfies from different angles\", fr: \"Prenez des selfies sous différents angles\" },\n instructions: { en: \"Take selfies from front, left, and right angles.\", fr: \"Prenez des selfies de face, profil gauche et profil droit.\" },\n ui: { icon: \"selfie-icon.png\", themeColor: \"#2DBD60\", buttonText: { en: \"Next\", fr: \"Suivant\" } },\n config: { liveness_check: true, max_attempts: 3, orientations: [\"center\", \"left\", \"right\"] } as const\n },\n ]\n};\n\nexport interface TemplateKYCExampleProps {\n onComplete: (data: VerificationState) => void;\n onCancel: () => void;\n onError: (error: string) => void;\n language: string;\n API_KEY?: string;\n TEST_API_KEY?: string;\n templateId?: string;\n template?: KYCTemplate;\n env?: KycEnvironment;\n serverEnv?: BackendEnvironment;\n existingSessionId?: string;\n initialComponentIndex?: number;\n initialCountryResume?: { code: string; documentType: string; region?: string };\n referenceId?: string;\n onSessionSave?: (sessionId: string) => void;\n kyc_session_id?: string;\n}\n\nexport function TemplateKYCExample({\n onComplete,\n onCancel,\n onError,\n language,\n API_KEY,\n TEST_API_KEY,\n templateId,\n template,\n env = 'PRODUCTION',\n serverEnv,\n existingSessionId,\n initialComponentIndex,\n initialCountryResume,\n referenceId,\n onSessionSave,\n kyc_session_id\n}: TemplateKYCExampleProps): JSX.Element {\n\n const handleComplete = (data: VerificationState) => {\n console.log('KYC Template completed with raw data:', data);\n\n let finalPayload: any = data; // Fallback to raw data if mapping fails\n\n if ((data.status === 'success' || data.status === 'in_progress') && data.result) {\n \n const backendData = data.result.data;\n\n if (backendData) {\n const personalInfo = backendData.user_data?.personal_information || {};\n const activeSessionId = kyc_session_id || existingSessionId || backendData.session_id || \"\";\n \n \n const docType = (backendData as any).document_type || (backendData as any).documentType;\n\n finalPayload = {\n data: {\n document_type: docType,\n verification_id: backendData.verification_id,\n verification_status: backendData.verification_status,\n session_id: activeSessionId,\n user_data: {\n personal_information: {\n first_name: personalInfo.first_name || personalInfo.given_name || undefined,\n last_name: personalInfo.last_name || personalInfo.surname || undefined,\n given_name: personalInfo.given_name || undefined,\n surname: personalInfo.surname || undefined, \n address: personalInfo.address || undefined,\n expiry_date: personalInfo.expiry_date || undefined,\n issue_date: personalInfo.issue_date || undefined,\n date_of_birth: personalInfo.date_of_birth || personalInfo.birth_date || undefined,\n birth_date: personalInfo.birth_date || undefined,\n document_number: personalInfo.document_number || undefined,\n nationality: personalInfo.nationality || undefined,\n sex: personalInfo.sex || undefined,\n }\n }\n }\n };\n\n sdkLogger.info(\"Wrapper formatteddddd completion payload successfully\", { \n data: finalPayload \n });\n }\n } else {\n sdkLogger.warn(\"Wrapper received completion without a success result object\", { status: data.status });\n }\n\n onComplete(finalPayload); \n};\n\n const handleCancel = () => {\n console.log('KYC Template flow cancelled');\n onCancel();\n };\n\n const handleError = (error: string) => {\n sdkLogger.error('KYC Template error:', error);\n onError(error);\n };\n\n const templateToUse = templateId ? undefined : (template || advancedVerificationTemplate);\n\n return (\n <SafeAreaView style={{ flex: 1, paddingVertical: 25 }}>\n <View style={{ flex: 1 }}>\n <TemplateKYCFlow\n template={templateToUse}\n templateId={templateId}\n onComplete={handleComplete}\n onError={handleError}\n onCancel={handleCancel}\n language={language}\n API_KEY={API_KEY}\n TEST_API_KEY={TEST_API_KEY}\n env={env}\n serverEnv={serverEnv}\n existingSessionId={existingSessionId}\n initialComponentIndex={initialComponentIndex}\n initialCountryResume={initialCountryResume}\n referenceId={referenceId}\n onSessionSave={onSessionSave}\n kyc_session_id={kyc_session_id}\n />\n </View>\n </SafeAreaView>\n );\n}"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateKYCFlowRefactored.d.ts","sourceRoot":"","sources":["../../../src/components/TemplateKYCFlowRefactored.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAkBpE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAIxE,UAAU,oBAAoB;IAC5B,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC/C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,qBAAqB,CAAC,EAAE,MAAM,CAAC;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AAC,YAAY,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAuJ1D,CAAC"}
@@ -75,11 +75,6 @@ export const TemplateKYCFlow = ({ template: providedTemplate, templateId, onComp
75
75
  ]);
76
76
  };
77
77
  const template = providedTemplate || loadedTemplate;
78
- useEffect(() => {
79
- if (template) {
80
- sdkLogger.info("Template loaded successfully", { componentCount: template.components.length });
81
- }
82
- }, [template]);
83
78
  if (templateId && isLoading && !template) {
84
79
  return (<View style={styles.loadingContainer}>
85
80
  <ActivityIndicator size="large" color="#2DBD60"/>
@@ -112,19 +107,16 @@ export const TemplateKYCFlow = ({ template: providedTemplate, templateId, onComp
112
107
  }} onError={(err) => {
113
108
  sdkLogger.error("KYC Flow Error", { error: err });
114
109
  sdkLogger.flush();
110
+ logger.log('Error', err);
115
111
  if (onError)
116
112
  onError(err);
117
- }} onCancel={OnCancel} initialLanguage={language}
118
- // 🚨 3. Pass the resolved active API key down to the provider!
119
- // The context/hooks will automatically use this key.
120
- apiKey={activeApiKey} testApiKey={TEST_API_KEY} env={env} existingSessionId={existingSessionId} initialComponentIndex={initialComponentIndex} initialCountryResume={initialCountryResume} referenceId={referenceId} onSessionSave={onSessionSave} kyc_session_id={kyc_session_id}>
113
+ }} onCancel={OnCancel} initialLanguage={language} apiKey={activeApiKey} testApiKey={TEST_API_KEY} env={env} existingSessionId={existingSessionId} initialComponentIndex={initialComponentIndex} initialCountryResume={initialCountryResume} referenceId={referenceId} onSessionSave={onSessionSave} kyc_session_id={kyc_session_id}>
121
114
  <TemplateKYCFlowContent onCancel={OnCancel}/>
122
115
  </TemplateKYCFlowProvider>);
123
116
  };
124
117
  const TemplateKYCFlowContent = ({ onCancel }) => {
125
118
  const { state, actions, currentComponent, progress } = useTemplateKYCFlowContext();
126
119
  const { t } = useI18n();
127
- console.log(`sessionnnn id: ${state.session.session_id}`);
128
120
  useEffect(() => {
129
121
  if (state.session?.session_id) {
130
122
  sdkLogger.setSessionId(state.session.session_id);
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateKYCFlowRefactored.js","sourceRoot":"","sources":["../../../src/components/TemplateKYCFlowRefactored.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE3I,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACjG,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAA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G,gBAAgB,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAE,SAAS,GAAG;IAC1G,WAAW,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,GAAG;IACjF,cAAc,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,GAAG;IACrH,WAAW,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,iBAAiB,EAAE,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC,GAAG;IACxH,eAAe,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,GAAG;CACrE,CAAC,CAAC","sourcesContent":["import React, { useEffect } from 'react';\nimport { View, Text, StyleSheet, SafeAreaView, TouchableOpacity, ActivityIndicator, Dimensions, ScrollView, Platform } from 'react-native';\nimport { KYCTemplate, VerificationState } from '../types/KYC.types';\nimport { TemplateKYCFlowProvider, useTemplateKYCFlowContext } from '../hooks/useTemplateKYCFlow';\nimport { useI18n } from '../hooks/useI18n';\nimport { showAlert } from '../utils/platformAlert';\nimport { IDCardCapture } from './KYCElements/IDCardCapture';\nimport { SelfieCaptureTemplate } from './KYCElements/SelfieCaptureTemplate';\nimport { FileUploadTemplate } from './KYCElements/FileUploadTemplate';\nimport { LocationCaptureTemplate } from './KYCElements/LocationCaptureTemplate';\nimport { CountrySelectionTemplate } from './KYCElements/CountrySelectionTemplate';\nimport { InitializationStep } from './KYCElements/InitializationStep';\nimport { ReviewSubmitTemplate } from './KYCElements/ReviewSubmitTemplate';\nimport { VerificationProgressTemplate } from './KYCElements/VerificationProgressTemplate';\nimport { useTemplateLoader } from '../hooks/useTemplateLoader';\nimport { WelcomeTemplate } from './KYCElements/WelcomeTemplate';\nimport { EmailVerificationTemplate } from './KYCElements/EmailVerificationTemplate';\nimport { PhoneVerificationTemplate } from './KYCElements/PhoneVerificationTemplate';\nimport { PersonalInformationTemplate } from './KYCElements/PersonalInformationTemplate';\nimport { AdditionalDocumentsTemplate } from './KYCElements/AdditionalDocumentsTemplate';\nimport { KycEnvironment, BackendEnvironment } from '../types/env.types';\nimport KYCConfig from '../config/KYCConfig';\nimport { logger, sdkLogger } from '../utils/logger'; \n\ninterface TemplateKYCFlowProps {\n template?: KYCTemplate; \n templateId?: string; \n onComplete?: (data: VerificationState) => void;\n onError?: (error: string) => void;\n language?: string;\n onCancel?: () => void;\n API_KEY?: string; \n TEST_API_KEY?: string;\n env?: KycEnvironment; \n serverEnv?: BackendEnvironment; \n existingSessionId?: string;\n initialComponentIndex?: number;\n initialCountryResume?: { code: string; documentType: string; region?: string };\n referenceId?: string;\n onSessionSave?: (sessionId: string) => void;\n kyc_session_id?: string;\n}\n\nexport const TemplateKYCFlow: React.FC<TemplateKYCFlowProps> = ({\n template: providedTemplate,\n templateId,\n onComplete,\n onError,\n language = 'fr',\n onCancel,\n API_KEY,\n TEST_API_KEY,\n env = 'PRODUCTION',\n serverEnv,\n existingSessionId,\n initialComponentIndex,\n initialCountryResume,\n referenceId,\n onSessionSave,\n kyc_session_id,\n}) => {\n const { t } = useI18n();\n const { template: loadedTemplate, isLoading, error, loadTemplate } = useTemplateLoader();\n\n // 🚨 1. Determine the active API key based on the environment\n const activeApiKey = env === 'PRODUCTION' ? API_KEY : (TEST_API_KEY || API_KEY);\n\n useEffect(() => {\n if (activeApiKey) {\n if (sdkLogger.setApiKey) sdkLogger.setApiKey(activeApiKey);\n }\n }, [env, serverEnv, existingSessionId, activeApiKey]);\n\n useEffect(() => {\n if (serverEnv !== undefined) {\n KYCConfig.setBackendEnvironment(serverEnv);\n }\n }, [serverEnv]);\n\n useEffect(() => {\n if (!providedTemplate && !templateId) {\n const errorMsg = 'Either template or templateId must be provided';\n logger.error(\"Template Loading Failed: Missing Props\", { errorMsg });\n onError?.(errorMsg);\n return;\n }\n\n if (templateId && !activeApiKey) {\n logger.log(`Fetching template ${templateId} via token authentication`);\n loadTemplate(templateId);\n } else if (templateId && activeApiKey) {\n logger.log(`Fetching template ${templateId} via API Key`);\n // 🚨 2. Use the resolved active key here\n loadTemplate(templateId, activeApiKey);\n }\n }, [templateId, activeApiKey, providedTemplate, loadTemplate, onError]);\n\n useEffect(() => {\n if (error) {\n sdkLogger.error(\"Template Fetch Error\", { error });\n onError?.(error);\n }\n }, [error, onError]);\n\n const OnCancel = () => {\n showAlert(\n t('kyc.cancelConfirmation.title'),\n t('kyc.cancelConfirmation.message'),\n [\n {\n text: t('kyc.cancelConfirmation.cancelButton'),\n style: 'cancel',\n },\n {\n text: t('kyc.cancelConfirmation.confirmButton'),\n onPress: () => {\n sdkLogger.warn(\"User confirmed flow cancellation\");\n sdkLogger.flush();\n onCancel?.();\n }\n },\n ]\n );\n };\n\n const template = providedTemplate || loadedTemplate;\n\n useEffect(() => {\n if (template) {\n sdkLogger.info(\"Template loaded successfully\", { componentCount: template.components.length });\n }\n }, [template]);\n\n if (templateId && isLoading && !template) {\n return (\n <View style={styles.loadingContainer}>\n <ActivityIndicator size=\"large\" color=\"#2DBD60\" />\n <Text style={styles.loadingText}>{t('common.loading') || 'Loading template...'}</Text>\n </View>\n );\n }\n\n if (templateId && error && !template) {\n return (\n <View style={styles.errorContainer}>\n <Text style={styles.errorText}>{error}</Text>\n <TouchableOpacity\n style={styles.retryButton}\n onPress={() => {\n sdkLogger.info(\"User retrying template fetch\");\n loadTemplate(templateId, activeApiKey);\n }}\n >\n <Text style={styles.retryButtonText}>{t('common.retry') || 'Retry'}</Text>\n </TouchableOpacity>\n </View>\n );\n }\n\n if (!template) {\n return (\n <View style={styles.errorContainer}>\n <Text style={styles.errorText}>\n {t('errors.unknownError') || 'Template not available'}\n </Text>\n </View>\n );\n }\n\n return (\n <TemplateKYCFlowProvider\n template={template}\n onComplete={(data) => {\n sdkLogger.info(\"KYC Flow Completed\", { referenceId: data?.result?.referenceId });\n sdkLogger.flush();\n if (onComplete) onComplete(data);\n }}\n onError={(err) => {\n sdkLogger.error(\"KYC Flow Error\", { error: err });\n sdkLogger.flush();\n if (onError) onError(err);\n }}\n onCancel={OnCancel}\n initialLanguage={language}\n // 🚨 3. Pass the resolved active API key down to the provider! \n // The context/hooks will automatically use this key.\n apiKey={activeApiKey}\n testApiKey={TEST_API_KEY} \n env={env}\n existingSessionId={existingSessionId}\n initialComponentIndex={initialComponentIndex}\n initialCountryResume={initialCountryResume}\n referenceId={referenceId}\n onSessionSave={onSessionSave}\n kyc_session_id={kyc_session_id}\n >\n <TemplateKYCFlowContent onCancel={OnCancel} />\n </TemplateKYCFlowProvider>\n );\n};\n\nconst TemplateKYCFlowContent: React.FC<{ onCancel?: () => void }> = ({ onCancel }) => {\n const { state, actions, currentComponent, progress } = useTemplateKYCFlowContext();\n const { t } = useI18n();\n\n console.log(`sessionnnn id: ${state.session.session_id}`)\n\n useEffect(() => {\n if (state.session?.session_id) {\n sdkLogger.setSessionId(state.session.session_id);\n }\n }, [state.session?.session_id]);\n\n useEffect(() => {\n if (currentComponent) {\n sdkLogger.info(`User navigated to step ${state.currentComponentIndex + 1}: ${currentComponent.type}`, {\n componentId: currentComponent.id,\n progress: `${progress}%`\n });\n }\n }, [currentComponent?.id, state.currentComponentIndex, progress]);\n\n const updateComponentData = (componentId: number, data: unknown) => {\n actions.updateComponentData(componentId, data);\n };\n\n if (!currentComponent) {\n return (\n <View style={styles.container}>\n <Text style={styles.errorText}>{t('errors.unknownError')}</Text>\n </View>\n );\n }\n\n const renderCurrentComponent = () => {\n const commonProps = {\n component: currentComponent,\n value: state.componentData[currentComponent.id],\n onValueChange: (data: unknown) => updateComponentData(currentComponent.id, data),\n error: state.errors[currentComponent.id],\n language: state.currentLanguage,\n };\n\n if (!state.session.isInitialized) {\n return <InitializationStep session={state.session} />\n }\n\n switch (currentComponent.type) {\n case 'welcome': return <WelcomeTemplate {...commonProps} />;\n case 'id_card': return <IDCardCapture {...commonProps} />;\n case 'selfie': return <SelfieCaptureTemplate {...commonProps} />;\n case 'file_upload': return <FileUploadTemplate {...commonProps} />;\n case 'location': return <LocationCaptureTemplate {...commonProps} />;\n case 'country_selection': return <CountrySelectionTemplate {...commonProps} />;\n case 'review_submit': return <ReviewSubmitTemplate {...commonProps} />;\n case 'email_verification': return <EmailVerificationTemplate {...commonProps} />;\n case 'phone_verification': return <PhoneVerificationTemplate {...commonProps} />;\n case 'personal_information': return <PersonalInformationTemplate {...commonProps} />;\n case 'additional_documents': return <AdditionalDocumentsTemplate {...commonProps} />;\n case 'verification_progress': return <VerificationProgressTemplate {...commonProps} />;\n default:\n sdkLogger.error(\"Attempted to render unsupported component type\", { type: currentComponent.type });\n return (\n <View style={styles.unsupportedContainer}>\n <Text style={styles.unsupportedText}>\n {t('errors.unknownError')}: {currentComponent.type}\n </Text>\n </View>\n );\n }\n };\n\n return (\n <View style={{ flex: 1, position: 'relative' }}>\n {state.isProcessing && (\n <View style={styles.processingContainer}>\n <Text style={styles.processingText}>{t('common.loading')}</Text>\n <ActivityIndicator size=\"large\" color=\"#fff\" />\n </View>\n )}\n\n <SafeAreaView style={styles.container}>\n {(state.showCustomStepper && state.session.isInitialized) ? (\n <View style={styles.header}>\n <Text style={styles.progressText}>\n {t('kyc.step', {\n current: (state.template.components.findIndex(c => c.id === currentComponent.id) + 1) || (state.currentComponentIndex + 1),\n total: state.template.components.length,\n })}\n </Text>\n \n <View style={styles.progressContainer}>\n <View style={styles.progressBar}>\n <View style={[styles.progressFill, { width: `${progress}%` }]} />\n </View>\n </View>\n\n <View style={{ position: 'absolute', right: 12, top: 12 }}>\n <TouchableOpacity onPress={onCancel} disabled={!onCancel} style={{ opacity: onCancel ? 1 : 0.5 }}>\n <Text style={{ fontSize: 20, fontWeight: 'bold', color: '#333' }}>{`X`}</Text>\n </TouchableOpacity>\n </View>\n </View>\n ) : null}\n\n <ScrollView\n style={styles.scrollView}\n contentContainerStyle={styles.content}\n showsVerticalScrollIndicator={Platform.OS === 'web'}\n bounces={false}\n >\n {renderCurrentComponent()}\n </ScrollView>\n\n {state.isProcessing && (\n <View style={styles.processingContainer}>\n <Text style={styles.processingText}>{t('common.loading')}</Text>\n <ActivityIndicator size=\"large\" color=\"#fff\" />\n </View>\n )}\n </SafeAreaView>\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: { flex: 1, backgroundColor: '#f5f5f5', },\n header: { backgroundColor: 'white', paddingVertical: 20, paddingHorizontal: 12, borderBottomWidth: 1, borderBottomColor: '#e0e0e0', marginHorizontal: 12, marginTop: 12, shadowColor: '#000', shadowOffset: { width: 0, height: 2 }, shadowOpacity: 0.15, shadowRadius: 1.84, elevation: 5, },\n title: { fontSize: 24, fontWeight: 'bold', color: '#333', marginBottom: 8, },\n description: { fontSize: 16, color: '#666', marginBottom: 20, },\n progressContainer: { },\n progressBar: { height: 8, backgroundColor: '#e0e0e0', borderRadius: 4, overflow: 'hidden', },\n progressFill: { height: '100%', backgroundColor: '#2DBD60', borderRadius: 4, },\n progressText: { fontSize: 14, color: 'black', fontWeight: '600', textAlign: 'left', marginBottom: 8, },\n stepInfo: { backgroundColor: '#f8f9fa', padding: 16, borderRadius: 8, borderLeftWidth: 4, borderLeftColor: '#2DBD60', },\n stepTitle: { fontSize: 18, fontWeight: '600', color: '#333', marginBottom: 8, },\n stepDescription: { fontSize: 14, color: '#666', lineHeight: 20, },\n scrollView: { flex: 1, },\n content: { flexGrow: 1, alignItems: 'center', paddingBottom: 20, },\n navigation: { flexDirection: 'row', justifyContent: 'space-between', padding: 20, backgroundColor: 'white', borderTopWidth: 1, borderTopColor: '#e0e0e0', },\n navButton: { paddingHorizontal: 24, paddingVertical: 12, borderRadius: 8, minWidth: 100, alignItems: 'center', },\n primaryButton: { backgroundColor: '#2DBD60', },\n navButtonText: { fontSize: 16, fontWeight: '600', color: 'white', },\n errorText: { color: '#dc2626', fontSize: 16, textAlign: 'center', margin: 20, },\n unsupportedContainer: { flex: 1, justifyContent: 'center', alignItems: 'center', padding: 20, },\n unsupportedText: { fontSize: 16, color: '#666', textAlign: 'center', },\n processingContainer: { position: 'absolute', flex: 1, width: Dimensions.get('window').width, height: Dimensions.get('window').height, backgroundColor: 'rgba(0, 0, 0, 0.5)', justifyContent: 'center', alignItems: 'center', zIndex: 10000000, },\n processingText: { fontSize: 16, color: '#fff', textAlign: 'center', fontWeight: 'bold', marginBottom: 10, },\n loadingContainer: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#f5f5f5', },\n loadingText: { marginTop: 16, fontSize: 16, color: '#666', textAlign: 'center', },\n errorContainer: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#f5f5f5', padding: 20, },\n retryButton: { marginTop: 20, paddingHorizontal: 24, paddingVertical: 12, backgroundColor: '#2DBD60', borderRadius: 8, },\n retryButtonText: { color: '#fff', fontSize: 16, fontWeight: '600', },\n});"]}
1
+ {"version":3,"file":"TemplateKYCFlowRefactored.js","sourceRoot":"","sources":["../../../src/components/TemplateKYCFlowRefactored.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE3I,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACjG,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,O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AE,QAAQ,GAAG;IAChP,cAAc,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,GAAG;IAC3G,gBAAgB,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAE,SAAS,GAAG;IAC1G,WAAW,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,GAAG;IACjF,cAAc,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,GAAG;IACrH,WAAW,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,iBAAiB,EAAE,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC,GAAG;IACxH,eAAe,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,GAAG;CACrE,CAAC,CAAC","sourcesContent":["import React, { useEffect } from 'react';\nimport { View, Text, StyleSheet, SafeAreaView, TouchableOpacity, ActivityIndicator, Dimensions, ScrollView, Platform } from 'react-native';\nimport { KYCTemplate, VerificationState } from '../types/KYC.types';\nimport { TemplateKYCFlowProvider, useTemplateKYCFlowContext } from '../hooks/useTemplateKYCFlow';\nimport { useI18n } from '../hooks/useI18n';\nimport { showAlert } from '../utils/platformAlert';\nimport { IDCardCapture } from './KYCElements/IDCardCapture';\nimport { SelfieCaptureTemplate } from './KYCElements/SelfieCaptureTemplate';\nimport { FileUploadTemplate } from './KYCElements/FileUploadTemplate';\nimport { LocationCaptureTemplate } from './KYCElements/LocationCaptureTemplate';\nimport { CountrySelectionTemplate } from './KYCElements/CountrySelectionTemplate';\nimport { InitializationStep } from './KYCElements/InitializationStep';\nimport { ReviewSubmitTemplate } from './KYCElements/ReviewSubmitTemplate';\nimport { VerificationProgressTemplate } from './KYCElements/VerificationProgressTemplate';\nimport { useTemplateLoader } from '../hooks/useTemplateLoader';\nimport { WelcomeTemplate } from './KYCElements/WelcomeTemplate';\nimport { EmailVerificationTemplate } from './KYCElements/EmailVerificationTemplate';\nimport { PhoneVerificationTemplate } from './KYCElements/PhoneVerificationTemplate';\nimport { PersonalInformationTemplate } from './KYCElements/PersonalInformationTemplate';\nimport { AdditionalDocumentsTemplate } from './KYCElements/AdditionalDocumentsTemplate';\nimport { KycEnvironment, BackendEnvironment } from '../types/env.types';\nimport KYCConfig from '../config/KYCConfig';\nimport { logger, sdkLogger } from '../utils/logger'; \n\ninterface TemplateKYCFlowProps {\n template?: KYCTemplate; \n templateId?: string; \n onComplete?: (data: VerificationState) => void;\n onError?: (error: string) => void;\n language?: string;\n onCancel?: () => void;\n API_KEY?: string; \n TEST_API_KEY?: string;\n env?: KycEnvironment; \n serverEnv?: BackendEnvironment; \n existingSessionId?: string;\n initialComponentIndex?: number;\n initialCountryResume?: { code: string; documentType: string; region?: string };\n referenceId?: string;\n onSessionSave?: (sessionId: string) => void;\n kyc_session_id?: string;\n}\n\nexport const TemplateKYCFlow: React.FC<TemplateKYCFlowProps> = ({\n template: providedTemplate,\n templateId,\n onComplete,\n onError,\n language = 'fr',\n onCancel,\n API_KEY,\n TEST_API_KEY,\n env = 'PRODUCTION',\n serverEnv,\n existingSessionId,\n initialComponentIndex,\n initialCountryResume,\n referenceId,\n onSessionSave,\n kyc_session_id,\n}) => {\n const { t } = useI18n();\n const { template: loadedTemplate, isLoading, error, loadTemplate } = useTemplateLoader();\n\n // 🚨 1. Determine the active API key based on the environment\n const activeApiKey = env === 'PRODUCTION' ? API_KEY : (TEST_API_KEY || API_KEY);\n\n useEffect(() => {\n if (activeApiKey) {\n if (sdkLogger.setApiKey) sdkLogger.setApiKey(activeApiKey);\n }\n }, [env, serverEnv, existingSessionId, activeApiKey]);\n\n useEffect(() => {\n if (serverEnv !== undefined) {\n KYCConfig.setBackendEnvironment(serverEnv);\n }\n }, [serverEnv]);\n\n useEffect(() => {\n if (!providedTemplate && !templateId) {\n const errorMsg = 'Either template or templateId must be provided';\n logger.error(\"Template Loading Failed: Missing Props\", { errorMsg });\n onError?.(errorMsg);\n return;\n }\n\n if (templateId && !activeApiKey) {\n logger.log(`Fetching template ${templateId} via token authentication`);\n loadTemplate(templateId);\n } else if (templateId && activeApiKey) {\n logger.log(`Fetching template ${templateId} via API Key`);\n // 🚨 2. Use the resolved active key here\n loadTemplate(templateId, activeApiKey);\n }\n }, [templateId, activeApiKey, providedTemplate, loadTemplate, onError]);\n\n useEffect(() => {\n if (error) {\n sdkLogger.error(\"Template Fetch Error\", { error });\n onError?.(error);\n }\n }, [error, onError]);\n\n const OnCancel = () => {\n showAlert(\n t('kyc.cancelConfirmation.title'),\n t('kyc.cancelConfirmation.message'),\n [\n {\n text: t('kyc.cancelConfirmation.cancelButton'),\n style: 'cancel',\n },\n {\n text: t('kyc.cancelConfirmation.confirmButton'),\n onPress: () => {\n sdkLogger.warn(\"User confirmed flow cancellation\");\n sdkLogger.flush();\n onCancel?.();\n }\n },\n ]\n );\n };\n\n const template = providedTemplate || loadedTemplate;\n\n \n\n if (templateId && isLoading && !template) {\n return (\n <View style={styles.loadingContainer}>\n <ActivityIndicator size=\"large\" color=\"#2DBD60\" />\n <Text style={styles.loadingText}>{t('common.loading') || 'Loading template...'}</Text>\n </View>\n );\n }\n\n if (templateId && error && !template) {\n return (\n <View style={styles.errorContainer}>\n <Text style={styles.errorText}>{error}</Text>\n <TouchableOpacity\n style={styles.retryButton}\n onPress={() => {\n sdkLogger.info(\"User retrying template fetch\");\n loadTemplate(templateId, activeApiKey);\n }}\n >\n <Text style={styles.retryButtonText}>{t('common.retry') || 'Retry'}</Text>\n </TouchableOpacity>\n </View>\n );\n }\n\n if (!template) {\n return (\n <View style={styles.errorContainer}>\n <Text style={styles.errorText}>\n {t('errors.unknownError') || 'Template not available'}\n </Text>\n </View>\n );\n }\n\n return (\n <TemplateKYCFlowProvider\n template={template}\n onComplete={(data) => {\n sdkLogger.info(\"KYC Flow Completed\", { referenceId: data?.result?.referenceId });\n sdkLogger.flush();\n if (onComplete) onComplete(data);\n }}\n onError={(err) => {\n sdkLogger.error(\"KYC Flow Error\", { error: err });\n sdkLogger.flush();\n logger.log('Error', err)\n if (onError) onError(err);\n }}\n onCancel={OnCancel}\n initialLanguage={language}\n apiKey={activeApiKey}\n testApiKey={TEST_API_KEY} \n env={env}\n existingSessionId={existingSessionId}\n initialComponentIndex={initialComponentIndex}\n initialCountryResume={initialCountryResume}\n referenceId={referenceId}\n onSessionSave={onSessionSave}\n kyc_session_id={kyc_session_id}\n >\n <TemplateKYCFlowContent onCancel={OnCancel} />\n </TemplateKYCFlowProvider>\n );\n};\n\nconst TemplateKYCFlowContent: React.FC<{ onCancel?: () => void }> = ({ onCancel }) => {\n const { state, actions, currentComponent, progress } = useTemplateKYCFlowContext();\n const { t } = useI18n();\n\n\n useEffect(() => {\n if (state.session?.session_id) {\n sdkLogger.setSessionId(state.session.session_id);\n }\n }, [state.session?.session_id]);\n\n useEffect(() => {\n if (currentComponent) {\n sdkLogger.info(`User navigated to step ${state.currentComponentIndex + 1}: ${currentComponent.type}`, {\n componentId: currentComponent.id,\n progress: `${progress}%`\n });\n }\n }, [currentComponent?.id, state.currentComponentIndex, progress]);\n\n const updateComponentData = (componentId: number, data: unknown) => {\n actions.updateComponentData(componentId, data);\n };\n\n if (!currentComponent) {\n return (\n <View style={styles.container}>\n <Text style={styles.errorText}>{t('errors.unknownError')}</Text>\n </View>\n );\n }\n\n const renderCurrentComponent = () => {\n const commonProps = {\n component: currentComponent,\n value: state.componentData[currentComponent.id],\n onValueChange: (data: unknown) => updateComponentData(currentComponent.id, data),\n error: state.errors[currentComponent.id],\n language: state.currentLanguage,\n };\n\n if (!state.session.isInitialized) {\n return <InitializationStep session={state.session} />\n }\n\n switch (currentComponent.type) {\n case 'welcome': return <WelcomeTemplate {...commonProps} />;\n case 'id_card': return <IDCardCapture {...commonProps} />;\n case 'selfie': return <SelfieCaptureTemplate {...commonProps} />;\n case 'file_upload': return <FileUploadTemplate {...commonProps} />;\n case 'location': return <LocationCaptureTemplate {...commonProps} />;\n case 'country_selection': return <CountrySelectionTemplate {...commonProps} />;\n case 'review_submit': return <ReviewSubmitTemplate {...commonProps} />;\n case 'email_verification': return <EmailVerificationTemplate {...commonProps} />;\n case 'phone_verification': return <PhoneVerificationTemplate {...commonProps} />;\n case 'personal_information': return <PersonalInformationTemplate {...commonProps} />;\n case 'additional_documents': return <AdditionalDocumentsTemplate {...commonProps} />;\n case 'verification_progress': return <VerificationProgressTemplate {...commonProps} />;\n default:\n sdkLogger.error(\"Attempted to render unsupported component type\", { type: currentComponent.type });\n return (\n <View style={styles.unsupportedContainer}>\n <Text style={styles.unsupportedText}>\n {t('errors.unknownError')}: {currentComponent.type}\n </Text>\n </View>\n );\n }\n };\n\n return (\n <View style={{ flex: 1, position: 'relative' }}>\n {state.isProcessing && (\n <View style={styles.processingContainer}>\n <Text style={styles.processingText}>{t('common.loading')}</Text>\n <ActivityIndicator size=\"large\" color=\"#fff\" />\n </View>\n )}\n\n <SafeAreaView style={styles.container}>\n {(state.showCustomStepper && state.session.isInitialized) ? (\n <View style={styles.header}>\n <Text style={styles.progressText}>\n {t('kyc.step', {\n current: (state.template.components.findIndex(c => c.id === currentComponent.id) + 1) || (state.currentComponentIndex + 1),\n total: state.template.components.length,\n })}\n </Text>\n \n <View style={styles.progressContainer}>\n <View style={styles.progressBar}>\n <View style={[styles.progressFill, { width: `${progress}%` }]} />\n </View>\n </View>\n\n <View style={{ position: 'absolute', right: 12, top: 12 }}>\n <TouchableOpacity onPress={onCancel} disabled={!onCancel} style={{ opacity: onCancel ? 1 : 0.5 }}>\n <Text style={{ fontSize: 20, fontWeight: 'bold', color: '#333' }}>{`X`}</Text>\n </TouchableOpacity>\n </View>\n </View>\n ) : null}\n\n <ScrollView\n style={styles.scrollView}\n contentContainerStyle={styles.content}\n showsVerticalScrollIndicator={Platform.OS === 'web'}\n bounces={false}\n >\n {renderCurrentComponent()}\n </ScrollView>\n\n {state.isProcessing && (\n <View style={styles.processingContainer}>\n <Text style={styles.processingText}>{t('common.loading')}</Text>\n <ActivityIndicator size=\"large\" color=\"#fff\" />\n </View>\n )}\n </SafeAreaView>\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: { flex: 1, backgroundColor: '#f5f5f5', },\n header: { backgroundColor: 'white', paddingVertical: 20, paddingHorizontal: 12, borderBottomWidth: 1, borderBottomColor: '#e0e0e0', marginHorizontal: 12, marginTop: 12, shadowColor: '#000', shadowOffset: { width: 0, height: 2 }, shadowOpacity: 0.15, shadowRadius: 1.84, elevation: 5, },\n title: { fontSize: 24, fontWeight: 'bold', color: '#333', marginBottom: 8, },\n description: { fontSize: 16, color: '#666', marginBottom: 20, },\n progressContainer: { },\n progressBar: { height: 8, backgroundColor: '#e0e0e0', borderRadius: 4, overflow: 'hidden', },\n progressFill: { height: '100%', backgroundColor: '#2DBD60', borderRadius: 4, },\n progressText: { fontSize: 14, color: 'black', fontWeight: '600', textAlign: 'left', marginBottom: 8, },\n stepInfo: { backgroundColor: '#f8f9fa', padding: 16, borderRadius: 8, borderLeftWidth: 4, borderLeftColor: '#2DBD60', },\n stepTitle: { fontSize: 18, fontWeight: '600', color: '#333', marginBottom: 8, },\n stepDescription: { fontSize: 14, color: '#666', lineHeight: 20, },\n scrollView: { flex: 1, },\n content: { flexGrow: 1, alignItems: 'center', paddingBottom: 20, },\n navigation: { flexDirection: 'row', justifyContent: 'space-between', padding: 20, backgroundColor: 'white', borderTopWidth: 1, borderTopColor: '#e0e0e0', },\n navButton: { paddingHorizontal: 24, paddingVertical: 12, borderRadius: 8, minWidth: 100, alignItems: 'center', },\n primaryButton: { backgroundColor: '#2DBD60', },\n navButtonText: { fontSize: 16, fontWeight: '600', color: 'white', },\n errorText: { color: '#dc2626', fontSize: 16, textAlign: 'center', margin: 20, },\n unsupportedContainer: { flex: 1, justifyContent: 'center', alignItems: 'center', padding: 20, },\n unsupportedText: { fontSize: 16, color: '#666', textAlign: 'center', },\n processingContainer: { position: 'absolute', flex: 1, width: Dimensions.get('window').width, height: Dimensions.get('window').height, backgroundColor: 'rgba(0, 0, 0, 0.5)', justifyContent: 'center', alignItems: 'center', zIndex: 10000000, },\n processingText: { fontSize: 16, color: '#fff', textAlign: 'center', fontWeight: 'bold', marginBottom: 10, },\n loadingContainer: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#f5f5f5', },\n loadingText: { marginTop: 16, fontSize: 16, color: '#666', textAlign: 'center', },\n errorContainer: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#f5f5f5', padding: 20, },\n retryButton: { marginTop: 20, paddingHorizontal: 24, paddingVertical: 12, backgroundColor: '#2DBD60', borderRadius: 8, },\n retryButtonText: { color: '#fff', fontSize: 16, fontWeight: '600', },\n});"]}
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
+ import type { CodeType } from 'react-native-vision-camera';
2
3
  interface WebBarcodeScannerProps {
3
4
  videoRef: React.RefObject<HTMLVideoElement | null>;
4
5
  active: boolean;
5
6
  onBarcodeScanned: (value: string) => void;
7
+ formats?: CodeType[];
6
8
  }
7
9
  export declare const WebBarcodeScanner: React.FC<WebBarcodeScannerProps>;
8
10
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"WebBarcodeScanner.d.ts","sourceRoot":"","sources":["../../../src/components/WebBarcodeScanner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAW9D,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IACnD,MAAM,EAAE,OAAO,CAAC;IAChB,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA+P9D,CAAC"}
1
+ {"version":3,"file":"WebBarcodeScanner.d.ts","sourceRoot":"","sources":["../../../src/components/WebBarcodeScanner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAW3D,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IACnD,MAAM,EAAE,OAAO,CAAC;IAChB,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;CACtB;AAwCD,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAoK9D,CAAC"}
@@ -1,18 +1,49 @@
1
1
  import { useCallback, useEffect, useRef } from 'react';
2
2
  import { MultiFormatReader, BarcodeFormat, DecodeHintType, HTMLCanvasElementLuminanceSource, BinaryBitmap, HybridBinarizer, GlobalHistogramBinarizer, } from '@zxing/library';
3
- export const WebBarcodeScanner = ({ videoRef, active, onBarcodeScanned, }) => {
3
+ const ROI_PROFILES = [
4
+ // Full frame catches barcodes before the user has centered them.
5
+ { width: 1, height: 1, contrast: 1 },
6
+ // Most ID barcodes sit in the wide center strip shown by the overlay.
7
+ { width: 0.98, height: 0.64, contrast: 1 },
8
+ // A tighter, contrast-enhanced pass helps very dense or low-contrast PDF417.
9
+ { width: 0.94, height: 0.46, contrast: 1.55 },
10
+ ];
11
+ const ROTATIONS = [180, 90, -90];
12
+ const DEFAULT_FORMATS = ['pdf-417'];
13
+ const ZXING_FORMATS = {
14
+ 'pdf-417': BarcodeFormat.PDF_417,
15
+ 'code-128': BarcodeFormat.CODE_128,
16
+ 'code-39': BarcodeFormat.CODE_39,
17
+ 'code-93': BarcodeFormat.CODE_93,
18
+ codabar: BarcodeFormat.CODABAR,
19
+ 'ean-13': BarcodeFormat.EAN_13,
20
+ 'ean-8': BarcodeFormat.EAN_8,
21
+ itf: BarcodeFormat.ITF,
22
+ 'itf-14': BarcodeFormat.ITF,
23
+ 'upc-a': BarcodeFormat.UPC_A,
24
+ 'upc-e': BarcodeFormat.UPC_E,
25
+ qr: BarcodeFormat.QR_CODE,
26
+ aztec: BarcodeFormat.AZTEC,
27
+ 'data-matrix': BarcodeFormat.DATA_MATRIX,
28
+ 'gs1-data-bar': BarcodeFormat.RSS_14,
29
+ 'gs1-data-bar-limited': BarcodeFormat.RSS_14,
30
+ 'gs1-data-bar-expanded': BarcodeFormat.RSS_EXPANDED,
31
+ };
32
+ export const WebBarcodeScanner = ({ videoRef, active, onBarcodeScanned, formats = DEFAULT_FORMATS, }) => {
4
33
  const readerRef = useRef(null);
5
34
  const canvasRef = useRef(null);
6
- const lastValueRef = useRef(null);
35
+ const rotationCanvasRef = useRef(null);
36
+ const lastValueRef = useRef({ value: null, emittedAt: 0 });
37
+ const attemptRef = useRef(0);
38
+ const timerRef = useRef(null);
7
39
  const stoppedRef = useRef(false);
8
40
  const callbackRef = useRef(onBarcodeScanned);
9
41
  useEffect(() => {
10
42
  callbackRef.current = onBarcodeScanned;
11
43
  }, [onBarcodeScanned]);
12
44
  const decodeBitmap = useCallback((canvas) => {
13
- if (!readerRef.current) {
45
+ if (!readerRef.current || canvas.width === 0 || canvas.height === 0)
14
46
  return null;
15
- }
16
47
  const source = new HTMLCanvasElementLuminanceSource(canvas);
17
48
  const attempts = [
18
49
  new BinaryBitmap(new HybridBinarizer(source)),
@@ -21,121 +52,101 @@ export const WebBarcodeScanner = ({ videoRef, active, onBarcodeScanned, }) => {
21
52
  for (const bitmap of attempts) {
22
53
  try {
23
54
  const result = readerRef.current.decodeWithState(bitmap);
24
- if (result?.getText()) {
25
- return result.getText();
26
- }
55
+ const text = result?.getText();
56
+ if (text)
57
+ return text;
27
58
  }
28
59
  catch {
29
- // continue
60
+ // Try the next binarization strategy/rotation.
30
61
  }
31
62
  }
32
63
  return null;
33
64
  }, []);
34
- const drawROI = useCallback((video, canvas) => {
35
- const ctx = canvas.getContext('2d', {
36
- willReadFrequently: true,
37
- });
38
- if (!ctx) {
65
+ const drawROI = useCallback((video, canvas, profile) => {
66
+ const ctx = canvas.getContext('2d', { willReadFrequently: true });
67
+ if (!ctx)
39
68
  return false;
69
+ const sourceWidth = Math.max(1, Math.floor(video.videoWidth * profile.width));
70
+ const sourceHeight = Math.max(1, Math.floor(video.videoHeight * profile.height));
71
+ const sourceX = Math.floor((video.videoWidth - sourceWidth) / 2);
72
+ const sourceY = Math.floor((video.videoHeight - sourceHeight) / 2);
73
+ // Nearest-neighbour enlargement gives ZXing more pixels per narrow module
74
+ // on sub-1080p browser streams without allocating an unbounded canvas.
75
+ const desiredScale = sourceWidth < 1600 ? Math.min(1.75, 1600 / sourceWidth) : 1;
76
+ const boundedScale = Math.min(desiredScale, 2800 / Math.max(sourceWidth, sourceHeight));
77
+ const outputWidth = Math.max(1, Math.floor(sourceWidth * boundedScale));
78
+ const outputHeight = Math.max(1, Math.floor(sourceHeight * boundedScale));
79
+ if (canvas.width !== outputWidth || canvas.height !== outputHeight) {
80
+ canvas.width = outputWidth;
81
+ canvas.height = outputHeight;
40
82
  }
41
- const roi = 0.8;
42
- const sw = Math.floor(video.videoWidth * roi);
43
- const sh = Math.floor(video.videoHeight * roi);
44
- const sx = Math.floor((video.videoWidth - sw) / 2);
45
- const sy = Math.floor((video.videoHeight - sh) / 2);
46
- if (canvas.width !== sw ||
47
- canvas.height !== sh) {
48
- canvas.width = sw;
49
- canvas.height = sh;
50
- }
51
- ctx.drawImage(video, sx, sy, sw, sh, 0, 0, sw, sh);
83
+ ctx.setTransform(1, 0, 0, 1, 0, 0);
84
+ ctx.clearRect(0, 0, outputWidth, outputHeight);
85
+ ctx.imageSmoothingEnabled = false;
86
+ ctx.filter = profile.contrast === 1 ? 'none' : `grayscale(1) contrast(${profile.contrast})`;
87
+ ctx.drawImage(video, sourceX, sourceY, sourceWidth, sourceHeight, 0, 0, outputWidth, outputHeight);
88
+ ctx.filter = 'none';
52
89
  return true;
53
90
  }, []);
54
- // Add a persistent rotation canvas ref at the top
55
- const rotationCanvasRef = useRef(null);
56
- // Update rotateCanvas to re-use the persistent canvas
57
91
  const rotateCanvas = useCallback((sourceCanvas, degrees) => {
58
- if (!rotationCanvasRef.current) {
92
+ if (!rotationCanvasRef.current)
59
93
  rotationCanvasRef.current = document.createElement('canvas');
60
- }
61
94
  const rotated = rotationCanvasRef.current;
62
- const ctx = rotated.getContext('2d');
95
+ const swapDimensions = Math.abs(degrees) === 90;
96
+ rotated.width = swapDimensions ? sourceCanvas.height : sourceCanvas.width;
97
+ rotated.height = swapDimensions ? sourceCanvas.width : sourceCanvas.height;
98
+ const ctx = rotated.getContext('2d', { willReadFrequently: true });
63
99
  if (!ctx)
64
100
  return null;
65
- const radians = (degrees * Math.PI) / 180;
66
- if (degrees === 90 || degrees === -90) {
67
- rotated.width = sourceCanvas.height;
68
- rotated.height = sourceCanvas.width;
69
- }
70
- else {
71
- rotated.width = sourceCanvas.width;
72
- rotated.height = sourceCanvas.height;
73
- }
101
+ ctx.setTransform(1, 0, 0, 1, 0, 0);
74
102
  ctx.clearRect(0, 0, rotated.width, rotated.height);
75
103
  ctx.translate(rotated.width / 2, rotated.height / 2);
76
- ctx.rotate(radians);
104
+ ctx.rotate((degrees * Math.PI) / 180);
77
105
  ctx.drawImage(sourceCanvas, -sourceCanvas.width / 2, -sourceCanvas.height / 2);
78
106
  return rotated;
79
107
  }, []);
80
108
  const tryDecode = useCallback(() => {
81
109
  const video = videoRef.current;
82
110
  const canvas = canvasRef.current;
83
- if (!video ||
84
- !canvas ||
85
- video.readyState < 2) {
111
+ if (!video || !canvas || video.readyState < 2 || video.videoWidth === 0 || video.videoHeight === 0)
86
112
  return null;
87
- }
88
- const ok = drawROI(video, canvas);
89
- if (!ok) {
113
+ const attempt = attemptRef.current++;
114
+ const profile = ROI_PROFILES[attempt % ROI_PROFILES.length];
115
+ if (!drawROI(video, canvas, profile))
90
116
  return null;
91
- }
92
- let value = decodeBitmap(canvas);
93
- if (value) {
94
- return value;
95
- }
96
- const rotations = [90, -90, 180];
97
- for (const rotation of rotations) {
98
- const rotated = rotateCanvas(canvas, rotation);
99
- if (!rotated) {
100
- continue;
101
- }
102
- value = decodeBitmap(rotated);
103
- if (value) {
104
- return value;
105
- }
106
- }
107
- return null;
108
- }, [
109
- videoRef,
110
- drawROI,
111
- decodeBitmap,
112
- rotateCanvas,
113
- ]);
117
+ const directValue = decodeBitmap(canvas);
118
+ if (directValue)
119
+ return directValue;
120
+ // Spread rotation work over successive frames to keep the UI responsive.
121
+ const rotation = ROTATIONS[attempt % ROTATIONS.length];
122
+ const rotated = rotateCanvas(canvas, rotation);
123
+ return rotated ? decodeBitmap(rotated) : null;
124
+ }, [decodeBitmap, drawROI, rotateCanvas, videoRef]);
114
125
  const tick = useCallback(() => {
115
126
  if (stoppedRef.current)
116
127
  return;
117
128
  const value = tryDecode();
118
- if (value && value !== lastValueRef.current) {
119
- lastValueRef.current = value;
120
- callbackRef.current(value);
121
- // If you want it to stop scanning on success, leave 'return;'
122
- // but ensure your parent component handles unmounting the scanner!
123
- return;
129
+ if (value) {
130
+ const now = Date.now();
131
+ const previous = lastValueRef.current;
132
+ if (value !== previous.value || now - previous.emittedAt > 1500) {
133
+ lastValueRef.current = { value, emittedAt: now };
134
+ callbackRef.current(value);
135
+ }
124
136
  }
125
- setTimeout(tick, 100);
137
+ timerRef.current = setTimeout(tick, 180);
126
138
  }, [tryDecode]);
127
139
  useEffect(() => {
128
- if (!active) {
140
+ if (!active)
129
141
  return;
130
- }
131
142
  stoppedRef.current = false;
132
- lastValueRef.current = null;
133
- if (!canvasRef.current) {
134
- canvasRef.current =
135
- document.createElement('canvas');
136
- }
143
+ attemptRef.current = 0;
144
+ lastValueRef.current = { value: null, emittedAt: 0 };
145
+ if (!canvasRef.current)
146
+ canvasRef.current = document.createElement('canvas');
147
+ const possibleFormats = Array.from(new Set(formats.map(format => ZXING_FORMATS[format]).filter((format) => format !== undefined)));
137
148
  const hints = new Map();
138
- hints.set(DecodeHintType.POSSIBLE_FORMATS, [BarcodeFormat.PDF_417]);
149
+ hints.set(DecodeHintType.POSSIBLE_FORMATS, possibleFormats.length > 0 ? possibleFormats : [BarcodeFormat.PDF_417]);
139
150
  hints.set(DecodeHintType.TRY_HARDER, true);
140
151
  const reader = new MultiFormatReader();
141
152
  reader.setHints(hints);
@@ -143,10 +154,13 @@ export const WebBarcodeScanner = ({ videoRef, active, onBarcodeScanned, }) => {
143
154
  tick();
144
155
  return () => {
145
156
  stoppedRef.current = true;
157
+ if (timerRef.current)
158
+ clearTimeout(timerRef.current);
159
+ timerRef.current = null;
146
160
  readerRef.current?.reset();
147
161
  readerRef.current = null;
148
162
  };
149
- }, [active, tick]);
163
+ }, [active, formats, tick]);
150
164
  return null;
151
165
  };
152
166
  //# sourceMappingURL=WebBarcodeScanner.js.map