@velion-la/onboarding-sdk-react-native 1.0.0-beta.10

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 (614) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/LICENSE +12 -0
  3. package/README.md +888 -0
  4. package/app.plugin.js +101 -0
  5. package/lib/commonjs/camera/AddressSearchBar.js +304 -0
  6. package/lib/commonjs/camera/AddressSearchBar.js.map +1 -0
  7. package/lib/commonjs/camera/DocumentCapture.js +513 -0
  8. package/lib/commonjs/camera/DocumentCapture.js.map +1 -0
  9. package/lib/commonjs/camera/LivenessCamera.js +628 -0
  10. package/lib/commonjs/camera/LivenessCamera.js.map +1 -0
  11. package/lib/commonjs/camera/MapAddressPicker.js +331 -0
  12. package/lib/commonjs/camera/MapAddressPicker.js.map +1 -0
  13. package/lib/commonjs/core/VelionOnboarding.js +1113 -0
  14. package/lib/commonjs/core/VelionOnboarding.js.map +1 -0
  15. package/lib/commonjs/core/retryStepCopy.js +43 -0
  16. package/lib/commonjs/core/retryStepCopy.js.map +1 -0
  17. package/lib/commonjs/core/routingCommands.js +62 -0
  18. package/lib/commonjs/core/routingCommands.js.map +1 -0
  19. package/lib/commonjs/core/sessionDeclinedCopy.js +56 -0
  20. package/lib/commonjs/core/sessionDeclinedCopy.js.map +1 -0
  21. package/lib/commonjs/core/sessionStateMapper.js +200 -0
  22. package/lib/commonjs/core/sessionStateMapper.js.map +1 -0
  23. package/lib/commonjs/core/sseReasonMessages.js +450 -0
  24. package/lib/commonjs/core/sseReasonMessages.js.map +1 -0
  25. package/lib/commonjs/data/iso3166Alpha2Codes.json +1 -0
  26. package/lib/commonjs/data/iso3166CountryNames.json +251 -0
  27. package/lib/commonjs/i18n/index.js +30 -0
  28. package/lib/commonjs/i18n/index.js.map +1 -0
  29. package/lib/commonjs/i18n/strings/en.js +301 -0
  30. package/lib/commonjs/i18n/strings/en.js.map +1 -0
  31. package/lib/commonjs/i18n/strings/es.js +306 -0
  32. package/lib/commonjs/i18n/strings/es.js.map +1 -0
  33. package/lib/commonjs/index.js +225 -0
  34. package/lib/commonjs/index.js.map +1 -0
  35. package/lib/commonjs/package.json +1 -0
  36. package/lib/commonjs/steps/AddressInfoStep.js +662 -0
  37. package/lib/commonjs/steps/AddressInfoStep.js.map +1 -0
  38. package/lib/commonjs/steps/DocumentsOcrStep.js +405 -0
  39. package/lib/commonjs/steps/DocumentsOcrStep.js.map +1 -0
  40. package/lib/commonjs/steps/EconomicActivityStep.js +214 -0
  41. package/lib/commonjs/steps/EconomicActivityStep.js.map +1 -0
  42. package/lib/commonjs/steps/EmailContactStep.js +150 -0
  43. package/lib/commonjs/steps/EmailContactStep.js.map +1 -0
  44. package/lib/commonjs/steps/EmailOtpStep.js +225 -0
  45. package/lib/commonjs/steps/EmailOtpStep.js.map +1 -0
  46. package/lib/commonjs/steps/FaceMatchStep.js +169 -0
  47. package/lib/commonjs/steps/FaceMatchStep.js.map +1 -0
  48. package/lib/commonjs/steps/FingerprintStep.js +92 -0
  49. package/lib/commonjs/steps/FingerprintStep.js.map +1 -0
  50. package/lib/commonjs/steps/HumanBasicInfoStep.js +251 -0
  51. package/lib/commonjs/steps/HumanBasicInfoStep.js.map +1 -0
  52. package/lib/commonjs/steps/HumanExtendedInfoStep.js +275 -0
  53. package/lib/commonjs/steps/HumanExtendedInfoStep.js.map +1 -0
  54. package/lib/commonjs/steps/LegalBasicInfoStep.js +195 -0
  55. package/lib/commonjs/steps/LegalBasicInfoStep.js.map +1 -0
  56. package/lib/commonjs/steps/LegalExtendedInfoStep.js +173 -0
  57. package/lib/commonjs/steps/LegalExtendedInfoStep.js.map +1 -0
  58. package/lib/commonjs/steps/LivenessMatchStep.js +1184 -0
  59. package/lib/commonjs/steps/LivenessMatchStep.js.map +1 -0
  60. package/lib/commonjs/steps/PhoneContactStep.js +151 -0
  61. package/lib/commonjs/steps/PhoneContactStep.js.map +1 -0
  62. package/lib/commonjs/steps/PhoneOtpStep.js +224 -0
  63. package/lib/commonjs/steps/PhoneOtpStep.js.map +1 -0
  64. package/lib/commonjs/steps/SwornDeclarationStep.js +206 -0
  65. package/lib/commonjs/steps/SwornDeclarationStep.js.map +1 -0
  66. package/lib/commonjs/steps/TaxInfoStep.js +251 -0
  67. package/lib/commonjs/steps/TaxInfoStep.js.map +1 -0
  68. package/lib/commonjs/steps/TermsAndConditionsStep.js +245 -0
  69. package/lib/commonjs/steps/TermsAndConditionsStep.js.map +1 -0
  70. package/lib/commonjs/steps/_shared.js +61 -0
  71. package/lib/commonjs/steps/_shared.js.map +1 -0
  72. package/lib/commonjs/steps/types.js +6 -0
  73. package/lib/commonjs/steps/types.js.map +1 -0
  74. package/lib/commonjs/transport/api.js +176 -0
  75. package/lib/commonjs/transport/api.js.map +1 -0
  76. package/lib/commonjs/transport/irisWebSocket.js +121 -0
  77. package/lib/commonjs/transport/irisWebSocket.js.map +1 -0
  78. package/lib/commonjs/transport/secureUrl.js +50 -0
  79. package/lib/commonjs/transport/secureUrl.js.map +1 -0
  80. package/lib/commonjs/transport/sse.js +248 -0
  81. package/lib/commonjs/transport/sse.js.map +1 -0
  82. package/lib/commonjs/types/index.js +458 -0
  83. package/lib/commonjs/types/index.js.map +1 -0
  84. package/lib/commonjs/ui/MapFallbackBoundary.js +42 -0
  85. package/lib/commonjs/ui/MapFallbackBoundary.js.map +1 -0
  86. package/lib/commonjs/ui/StepShell.js +251 -0
  87. package/lib/commonjs/ui/StepShell.js.map +1 -0
  88. package/lib/commonjs/ui/VelionOnboardingScreen.js +276 -0
  89. package/lib/commonjs/ui/VelionOnboardingScreen.js.map +1 -0
  90. package/lib/commonjs/ui/forms/index.js +38 -0
  91. package/lib/commonjs/ui/forms/index.js.map +1 -0
  92. package/lib/commonjs/ui/forms/useInlineValidation.js +88 -0
  93. package/lib/commonjs/ui/forms/useInlineValidation.js.map +1 -0
  94. package/lib/commonjs/ui/forms/validators.js +34 -0
  95. package/lib/commonjs/ui/forms/validators.js.map +1 -0
  96. package/lib/commonjs/ui/icons/HomeHeartIcon.js +38 -0
  97. package/lib/commonjs/ui/icons/HomeHeartIcon.js.map +1 -0
  98. package/lib/commonjs/ui/icons/StepIcon.js +59 -0
  99. package/lib/commonjs/ui/icons/StepIcon.js.map +1 -0
  100. package/lib/commonjs/ui/overlays/AnalyzingOverlay.js +284 -0
  101. package/lib/commonjs/ui/overlays/AnalyzingOverlay.js.map +1 -0
  102. package/lib/commonjs/ui/overlays/LoadingOverlay.js +108 -0
  103. package/lib/commonjs/ui/overlays/LoadingOverlay.js.map +1 -0
  104. package/lib/commonjs/ui/overlays/ProgressBar.js +101 -0
  105. package/lib/commonjs/ui/overlays/ProgressBar.js.map +1 -0
  106. package/lib/commonjs/ui/overlays/RetryDialog.js +125 -0
  107. package/lib/commonjs/ui/overlays/RetryDialog.js.map +1 -0
  108. package/lib/commonjs/ui/overlays/index.js +33 -0
  109. package/lib/commonjs/ui/overlays/index.js.map +1 -0
  110. package/lib/commonjs/ui/primitives/BackButton.js +75 -0
  111. package/lib/commonjs/ui/primitives/BackButton.js.map +1 -0
  112. package/lib/commonjs/ui/primitives/Banner.js +81 -0
  113. package/lib/commonjs/ui/primitives/Banner.js.map +1 -0
  114. package/lib/commonjs/ui/primitives/Button.js +142 -0
  115. package/lib/commonjs/ui/primitives/Button.js.map +1 -0
  116. package/lib/commonjs/ui/primitives/Card.js +50 -0
  117. package/lib/commonjs/ui/primitives/Card.js.map +1 -0
  118. package/lib/commonjs/ui/primitives/Checkbox.js +139 -0
  119. package/lib/commonjs/ui/primitives/Checkbox.js.map +1 -0
  120. package/lib/commonjs/ui/primitives/CountrySelect.js +288 -0
  121. package/lib/commonjs/ui/primitives/CountrySelect.js.map +1 -0
  122. package/lib/commonjs/ui/primitives/DatePicker.js +245 -0
  123. package/lib/commonjs/ui/primitives/DatePicker.js.map +1 -0
  124. package/lib/commonjs/ui/primitives/Input.js +101 -0
  125. package/lib/commonjs/ui/primitives/Input.js.map +1 -0
  126. package/lib/commonjs/ui/primitives/SearchableSingleSelectList.js +162 -0
  127. package/lib/commonjs/ui/primitives/SearchableSingleSelectList.js.map +1 -0
  128. package/lib/commonjs/ui/primitives/Select.js +209 -0
  129. package/lib/commonjs/ui/primitives/Select.js.map +1 -0
  130. package/lib/commonjs/ui/primitives/Spinner.js +25 -0
  131. package/lib/commonjs/ui/primitives/Spinner.js.map +1 -0
  132. package/lib/commonjs/ui/primitives/index.js +89 -0
  133. package/lib/commonjs/ui/primitives/index.js.map +1 -0
  134. package/lib/commonjs/ui/primitives/searchableSingleSelectFilter.js +31 -0
  135. package/lib/commonjs/ui/primitives/searchableSingleSelectFilter.js.map +1 -0
  136. package/lib/commonjs/ui/theme/ThemeProvider.js +74 -0
  137. package/lib/commonjs/ui/theme/ThemeProvider.js.map +1 -0
  138. package/lib/commonjs/ui/theme/index.js +68 -0
  139. package/lib/commonjs/ui/theme/index.js.map +1 -0
  140. package/lib/commonjs/ui/theme/tokens.js +154 -0
  141. package/lib/commonjs/ui/theme/tokens.js.map +1 -0
  142. package/lib/commonjs/utils/EventEmitter.js +144 -0
  143. package/lib/commonjs/utils/EventEmitter.js.map +1 -0
  144. package/lib/commonjs/utils/base64.js +53 -0
  145. package/lib/commonjs/utils/base64.js.map +1 -0
  146. package/lib/commonjs/utils/deviceFingerprint.js +132 -0
  147. package/lib/commonjs/utils/deviceFingerprint.js.map +1 -0
  148. package/lib/commonjs/utils/documentTypeOptions.js +35 -0
  149. package/lib/commonjs/utils/documentTypeOptions.js.map +1 -0
  150. package/lib/commonjs/utils/googleMapsPreflight.js +88 -0
  151. package/lib/commonjs/utils/googleMapsPreflight.js.map +1 -0
  152. package/lib/commonjs/utils/hmac.js +58 -0
  153. package/lib/commonjs/utils/hmac.js.map +1 -0
  154. package/lib/commonjs/utils/iso3166Countries.js +98 -0
  155. package/lib/commonjs/utils/iso3166Countries.js.map +1 -0
  156. package/lib/commonjs/utils/jpegFromUri.js +44 -0
  157. package/lib/commonjs/utils/jpegFromUri.js.map +1 -0
  158. package/lib/commonjs/utils/keepAwake.js +58 -0
  159. package/lib/commonjs/utils/keepAwake.js.map +1 -0
  160. package/lib/commonjs/utils/log.js +42 -0
  161. package/lib/commonjs/utils/log.js.map +1 -0
  162. package/lib/commonjs/utils/osGeocoder.js +70 -0
  163. package/lib/commonjs/utils/osGeocoder.js.map +1 -0
  164. package/lib/commonjs/utils/parseGoogleAddressComponents.js +74 -0
  165. package/lib/commonjs/utils/parseGoogleAddressComponents.js.map +1 -0
  166. package/lib/commonjs/utils/personNameNormalize.js +24 -0
  167. package/lib/commonjs/utils/personNameNormalize.js.map +1 -0
  168. package/lib/commonjs/utils/sdkError.js +34 -0
  169. package/lib/commonjs/utils/sdkError.js.map +1 -0
  170. package/lib/commonjs/utils/sdkVersion.js +13 -0
  171. package/lib/commonjs/utils/sdkVersion.js.map +1 -0
  172. package/lib/commonjs/utils/stepConfig.js +65 -0
  173. package/lib/commonjs/utils/stepConfig.js.map +1 -0
  174. package/lib/commonjs/utils/taxInfoConfig.js +19 -0
  175. package/lib/commonjs/utils/taxInfoConfig.js.map +1 -0
  176. package/lib/commonjs/utils/useSafeAreaInsets.js +41 -0
  177. package/lib/commonjs/utils/useSafeAreaInsets.js.map +1 -0
  178. package/lib/commonjs/utils/velionExtra.js +48 -0
  179. package/lib/commonjs/utils/velionExtra.js.map +1 -0
  180. package/lib/module/camera/AddressSearchBar.js +299 -0
  181. package/lib/module/camera/AddressSearchBar.js.map +1 -0
  182. package/lib/module/camera/DocumentCapture.js +508 -0
  183. package/lib/module/camera/DocumentCapture.js.map +1 -0
  184. package/lib/module/camera/LivenessCamera.js +623 -0
  185. package/lib/module/camera/LivenessCamera.js.map +1 -0
  186. package/lib/module/camera/MapAddressPicker.js +326 -0
  187. package/lib/module/camera/MapAddressPicker.js.map +1 -0
  188. package/lib/module/core/VelionOnboarding.js +1109 -0
  189. package/lib/module/core/VelionOnboarding.js.map +1 -0
  190. package/lib/module/core/retryStepCopy.js +39 -0
  191. package/lib/module/core/retryStepCopy.js.map +1 -0
  192. package/lib/module/core/routingCommands.js +57 -0
  193. package/lib/module/core/routingCommands.js.map +1 -0
  194. package/lib/module/core/sessionDeclinedCopy.js +52 -0
  195. package/lib/module/core/sessionDeclinedCopy.js.map +1 -0
  196. package/lib/module/core/sessionStateMapper.js +189 -0
  197. package/lib/module/core/sessionStateMapper.js.map +1 -0
  198. package/lib/module/core/sseReasonMessages.js +446 -0
  199. package/lib/module/core/sseReasonMessages.js.map +1 -0
  200. package/lib/module/data/iso3166Alpha2Codes.json +1 -0
  201. package/lib/module/data/iso3166CountryNames.json +251 -0
  202. package/lib/module/i18n/index.js +25 -0
  203. package/lib/module/i18n/index.js.map +1 -0
  204. package/lib/module/i18n/strings/en.js +297 -0
  205. package/lib/module/i18n/strings/en.js.map +1 -0
  206. package/lib/module/i18n/strings/es.js +302 -0
  207. package/lib/module/i18n/strings/es.js.map +1 -0
  208. package/lib/module/index.js +36 -0
  209. package/lib/module/index.js.map +1 -0
  210. package/lib/module/steps/AddressInfoStep.js +658 -0
  211. package/lib/module/steps/AddressInfoStep.js.map +1 -0
  212. package/lib/module/steps/DocumentsOcrStep.js +399 -0
  213. package/lib/module/steps/DocumentsOcrStep.js.map +1 -0
  214. package/lib/module/steps/EconomicActivityStep.js +209 -0
  215. package/lib/module/steps/EconomicActivityStep.js.map +1 -0
  216. package/lib/module/steps/EmailContactStep.js +145 -0
  217. package/lib/module/steps/EmailContactStep.js.map +1 -0
  218. package/lib/module/steps/EmailOtpStep.js +220 -0
  219. package/lib/module/steps/EmailOtpStep.js.map +1 -0
  220. package/lib/module/steps/FaceMatchStep.js +164 -0
  221. package/lib/module/steps/FaceMatchStep.js.map +1 -0
  222. package/lib/module/steps/FingerprintStep.js +87 -0
  223. package/lib/module/steps/FingerprintStep.js.map +1 -0
  224. package/lib/module/steps/HumanBasicInfoStep.js +246 -0
  225. package/lib/module/steps/HumanBasicInfoStep.js.map +1 -0
  226. package/lib/module/steps/HumanExtendedInfoStep.js +270 -0
  227. package/lib/module/steps/HumanExtendedInfoStep.js.map +1 -0
  228. package/lib/module/steps/LegalBasicInfoStep.js +190 -0
  229. package/lib/module/steps/LegalBasicInfoStep.js.map +1 -0
  230. package/lib/module/steps/LegalExtendedInfoStep.js +168 -0
  231. package/lib/module/steps/LegalExtendedInfoStep.js.map +1 -0
  232. package/lib/module/steps/LivenessMatchStep.js +1177 -0
  233. package/lib/module/steps/LivenessMatchStep.js.map +1 -0
  234. package/lib/module/steps/PhoneContactStep.js +146 -0
  235. package/lib/module/steps/PhoneContactStep.js.map +1 -0
  236. package/lib/module/steps/PhoneOtpStep.js +219 -0
  237. package/lib/module/steps/PhoneOtpStep.js.map +1 -0
  238. package/lib/module/steps/SwornDeclarationStep.js +203 -0
  239. package/lib/module/steps/SwornDeclarationStep.js.map +1 -0
  240. package/lib/module/steps/TaxInfoStep.js +246 -0
  241. package/lib/module/steps/TaxInfoStep.js.map +1 -0
  242. package/lib/module/steps/TermsAndConditionsStep.js +240 -0
  243. package/lib/module/steps/TermsAndConditionsStep.js.map +1 -0
  244. package/lib/module/steps/_shared.js +52 -0
  245. package/lib/module/steps/_shared.js.map +1 -0
  246. package/lib/module/steps/types.js +4 -0
  247. package/lib/module/steps/types.js.map +1 -0
  248. package/lib/module/transport/api.js +173 -0
  249. package/lib/module/transport/api.js.map +1 -0
  250. package/lib/module/transport/irisWebSocket.js +115 -0
  251. package/lib/module/transport/irisWebSocket.js.map +1 -0
  252. package/lib/module/transport/secureUrl.js +45 -0
  253. package/lib/module/transport/secureUrl.js.map +1 -0
  254. package/lib/module/transport/sse.js +242 -0
  255. package/lib/module/transport/sse.js.map +1 -0
  256. package/lib/module/types/index.js +532 -0
  257. package/lib/module/types/index.js.map +1 -0
  258. package/lib/module/ui/MapFallbackBoundary.js +37 -0
  259. package/lib/module/ui/MapFallbackBoundary.js.map +1 -0
  260. package/lib/module/ui/StepShell.js +246 -0
  261. package/lib/module/ui/StepShell.js.map +1 -0
  262. package/lib/module/ui/VelionOnboardingScreen.js +273 -0
  263. package/lib/module/ui/VelionOnboardingScreen.js.map +1 -0
  264. package/lib/module/ui/forms/index.js +5 -0
  265. package/lib/module/ui/forms/index.js.map +1 -0
  266. package/lib/module/ui/forms/useInlineValidation.js +84 -0
  267. package/lib/module/ui/forms/useInlineValidation.js.map +1 -0
  268. package/lib/module/ui/forms/validators.js +27 -0
  269. package/lib/module/ui/forms/validators.js.map +1 -0
  270. package/lib/module/ui/icons/HomeHeartIcon.js +33 -0
  271. package/lib/module/ui/icons/HomeHeartIcon.js.map +1 -0
  272. package/lib/module/ui/icons/StepIcon.js +55 -0
  273. package/lib/module/ui/icons/StepIcon.js.map +1 -0
  274. package/lib/module/ui/overlays/AnalyzingOverlay.js +279 -0
  275. package/lib/module/ui/overlays/AnalyzingOverlay.js.map +1 -0
  276. package/lib/module/ui/overlays/LoadingOverlay.js +104 -0
  277. package/lib/module/ui/overlays/LoadingOverlay.js.map +1 -0
  278. package/lib/module/ui/overlays/ProgressBar.js +97 -0
  279. package/lib/module/ui/overlays/ProgressBar.js.map +1 -0
  280. package/lib/module/ui/overlays/RetryDialog.js +121 -0
  281. package/lib/module/ui/overlays/RetryDialog.js.map +1 -0
  282. package/lib/module/ui/overlays/index.js +6 -0
  283. package/lib/module/ui/overlays/index.js.map +1 -0
  284. package/lib/module/ui/primitives/BackButton.js +71 -0
  285. package/lib/module/ui/primitives/BackButton.js.map +1 -0
  286. package/lib/module/ui/primitives/Banner.js +77 -0
  287. package/lib/module/ui/primitives/Banner.js.map +1 -0
  288. package/lib/module/ui/primitives/Button.js +138 -0
  289. package/lib/module/ui/primitives/Button.js.map +1 -0
  290. package/lib/module/ui/primitives/Card.js +46 -0
  291. package/lib/module/ui/primitives/Card.js.map +1 -0
  292. package/lib/module/ui/primitives/Checkbox.js +136 -0
  293. package/lib/module/ui/primitives/Checkbox.js.map +1 -0
  294. package/lib/module/ui/primitives/CountrySelect.js +284 -0
  295. package/lib/module/ui/primitives/CountrySelect.js.map +1 -0
  296. package/lib/module/ui/primitives/DatePicker.js +241 -0
  297. package/lib/module/ui/primitives/DatePicker.js.map +1 -0
  298. package/lib/module/ui/primitives/Input.js +97 -0
  299. package/lib/module/ui/primitives/Input.js.map +1 -0
  300. package/lib/module/ui/primitives/SearchableSingleSelectList.js +153 -0
  301. package/lib/module/ui/primitives/SearchableSingleSelectList.js.map +1 -0
  302. package/lib/module/ui/primitives/Select.js +205 -0
  303. package/lib/module/ui/primitives/Select.js.map +1 -0
  304. package/lib/module/ui/primitives/Spinner.js +21 -0
  305. package/lib/module/ui/primitives/Spinner.js.map +1 -0
  306. package/lib/module/ui/primitives/index.js +14 -0
  307. package/lib/module/ui/primitives/index.js.map +1 -0
  308. package/lib/module/ui/primitives/searchableSingleSelectFilter.js +27 -0
  309. package/lib/module/ui/primitives/searchableSingleSelectFilter.js.map +1 -0
  310. package/lib/module/ui/theme/ThemeProvider.js +67 -0
  311. package/lib/module/ui/theme/ThemeProvider.js.map +1 -0
  312. package/lib/module/ui/theme/index.js +5 -0
  313. package/lib/module/ui/theme/index.js.map +1 -0
  314. package/lib/module/ui/theme/tokens.js +145 -0
  315. package/lib/module/ui/theme/tokens.js.map +1 -0
  316. package/lib/module/utils/EventEmitter.js +139 -0
  317. package/lib/module/utils/EventEmitter.js.map +1 -0
  318. package/lib/module/utils/base64.js +47 -0
  319. package/lib/module/utils/base64.js.map +1 -0
  320. package/lib/module/utils/deviceFingerprint.js +129 -0
  321. package/lib/module/utils/deviceFingerprint.js.map +1 -0
  322. package/lib/module/utils/documentTypeOptions.js +31 -0
  323. package/lib/module/utils/documentTypeOptions.js.map +1 -0
  324. package/lib/module/utils/googleMapsPreflight.js +84 -0
  325. package/lib/module/utils/googleMapsPreflight.js.map +1 -0
  326. package/lib/module/utils/hmac.js +53 -0
  327. package/lib/module/utils/hmac.js.map +1 -0
  328. package/lib/module/utils/iso3166Countries.js +92 -0
  329. package/lib/module/utils/iso3166Countries.js.map +1 -0
  330. package/lib/module/utils/jpegFromUri.js +40 -0
  331. package/lib/module/utils/jpegFromUri.js.map +1 -0
  332. package/lib/module/utils/keepAwake.js +53 -0
  333. package/lib/module/utils/keepAwake.js.map +1 -0
  334. package/lib/module/utils/log.js +37 -0
  335. package/lib/module/utils/log.js.map +1 -0
  336. package/lib/module/utils/osGeocoder.js +65 -0
  337. package/lib/module/utils/osGeocoder.js.map +1 -0
  338. package/lib/module/utils/parseGoogleAddressComponents.js +69 -0
  339. package/lib/module/utils/parseGoogleAddressComponents.js.map +1 -0
  340. package/lib/module/utils/personNameNormalize.js +20 -0
  341. package/lib/module/utils/personNameNormalize.js.map +1 -0
  342. package/lib/module/utils/sdkError.js +29 -0
  343. package/lib/module/utils/sdkError.js.map +1 -0
  344. package/lib/module/utils/sdkVersion.js +9 -0
  345. package/lib/module/utils/sdkVersion.js.map +1 -0
  346. package/lib/module/utils/stepConfig.js +59 -0
  347. package/lib/module/utils/stepConfig.js.map +1 -0
  348. package/lib/module/utils/taxInfoConfig.js +15 -0
  349. package/lib/module/utils/taxInfoConfig.js.map +1 -0
  350. package/lib/module/utils/useSafeAreaInsets.js +37 -0
  351. package/lib/module/utils/useSafeAreaInsets.js.map +1 -0
  352. package/lib/module/utils/velionExtra.js +44 -0
  353. package/lib/module/utils/velionExtra.js.map +1 -0
  354. package/lib/typescript/camera/AddressSearchBar.d.ts +37 -0
  355. package/lib/typescript/camera/AddressSearchBar.d.ts.map +1 -0
  356. package/lib/typescript/camera/DocumentCapture.d.ts +34 -0
  357. package/lib/typescript/camera/DocumentCapture.d.ts.map +1 -0
  358. package/lib/typescript/camera/LivenessCamera.d.ts +67 -0
  359. package/lib/typescript/camera/LivenessCamera.d.ts.map +1 -0
  360. package/lib/typescript/camera/MapAddressPicker.d.ts +57 -0
  361. package/lib/typescript/camera/MapAddressPicker.d.ts.map +1 -0
  362. package/lib/typescript/core/VelionOnboarding.d.ts +169 -0
  363. package/lib/typescript/core/VelionOnboarding.d.ts.map +1 -0
  364. package/lib/typescript/core/retryStepCopy.d.ts +27 -0
  365. package/lib/typescript/core/retryStepCopy.d.ts.map +1 -0
  366. package/lib/typescript/core/routingCommands.d.ts +39 -0
  367. package/lib/typescript/core/routingCommands.d.ts.map +1 -0
  368. package/lib/typescript/core/sessionDeclinedCopy.d.ts +16 -0
  369. package/lib/typescript/core/sessionDeclinedCopy.d.ts.map +1 -0
  370. package/lib/typescript/core/sessionStateMapper.d.ts +52 -0
  371. package/lib/typescript/core/sessionStateMapper.d.ts.map +1 -0
  372. package/lib/typescript/core/sseReasonMessages.d.ts +20 -0
  373. package/lib/typescript/core/sseReasonMessages.d.ts.map +1 -0
  374. package/lib/typescript/i18n/index.d.ts +13 -0
  375. package/lib/typescript/i18n/index.d.ts.map +1 -0
  376. package/lib/typescript/i18n/strings/en.d.ts +3 -0
  377. package/lib/typescript/i18n/strings/en.d.ts.map +1 -0
  378. package/lib/typescript/i18n/strings/es.d.ts +297 -0
  379. package/lib/typescript/i18n/strings/es.d.ts.map +1 -0
  380. package/lib/typescript/index.d.ts +26 -0
  381. package/lib/typescript/index.d.ts.map +1 -0
  382. package/lib/typescript/steps/AddressInfoStep.d.ts +26 -0
  383. package/lib/typescript/steps/AddressInfoStep.d.ts.map +1 -0
  384. package/lib/typescript/steps/DocumentsOcrStep.d.ts +26 -0
  385. package/lib/typescript/steps/DocumentsOcrStep.d.ts.map +1 -0
  386. package/lib/typescript/steps/EconomicActivityStep.d.ts +29 -0
  387. package/lib/typescript/steps/EconomicActivityStep.d.ts.map +1 -0
  388. package/lib/typescript/steps/EmailContactStep.d.ts +15 -0
  389. package/lib/typescript/steps/EmailContactStep.d.ts.map +1 -0
  390. package/lib/typescript/steps/EmailOtpStep.d.ts +21 -0
  391. package/lib/typescript/steps/EmailOtpStep.d.ts.map +1 -0
  392. package/lib/typescript/steps/FaceMatchStep.d.ts +27 -0
  393. package/lib/typescript/steps/FaceMatchStep.d.ts.map +1 -0
  394. package/lib/typescript/steps/FingerprintStep.d.ts +25 -0
  395. package/lib/typescript/steps/FingerprintStep.d.ts.map +1 -0
  396. package/lib/typescript/steps/HumanBasicInfoStep.d.ts +25 -0
  397. package/lib/typescript/steps/HumanBasicInfoStep.d.ts.map +1 -0
  398. package/lib/typescript/steps/HumanExtendedInfoStep.d.ts +23 -0
  399. package/lib/typescript/steps/HumanExtendedInfoStep.d.ts.map +1 -0
  400. package/lib/typescript/steps/LegalBasicInfoStep.d.ts +17 -0
  401. package/lib/typescript/steps/LegalBasicInfoStep.d.ts.map +1 -0
  402. package/lib/typescript/steps/LegalExtendedInfoStep.d.ts +17 -0
  403. package/lib/typescript/steps/LegalExtendedInfoStep.d.ts.map +1 -0
  404. package/lib/typescript/steps/LivenessMatchStep.d.ts +26 -0
  405. package/lib/typescript/steps/LivenessMatchStep.d.ts.map +1 -0
  406. package/lib/typescript/steps/PhoneContactStep.d.ts +15 -0
  407. package/lib/typescript/steps/PhoneContactStep.d.ts.map +1 -0
  408. package/lib/typescript/steps/PhoneOtpStep.d.ts +19 -0
  409. package/lib/typescript/steps/PhoneOtpStep.d.ts.map +1 -0
  410. package/lib/typescript/steps/SwornDeclarationStep.d.ts +20 -0
  411. package/lib/typescript/steps/SwornDeclarationStep.d.ts.map +1 -0
  412. package/lib/typescript/steps/TaxInfoStep.d.ts +19 -0
  413. package/lib/typescript/steps/TaxInfoStep.d.ts.map +1 -0
  414. package/lib/typescript/steps/TermsAndConditionsStep.d.ts +21 -0
  415. package/lib/typescript/steps/TermsAndConditionsStep.d.ts.map +1 -0
  416. package/lib/typescript/steps/_shared.d.ts +22 -0
  417. package/lib/typescript/steps/_shared.d.ts.map +1 -0
  418. package/lib/typescript/steps/types.d.ts +89 -0
  419. package/lib/typescript/steps/types.d.ts.map +1 -0
  420. package/lib/typescript/transport/api.d.ts +35 -0
  421. package/lib/typescript/transport/api.d.ts.map +1 -0
  422. package/lib/typescript/transport/irisWebSocket.d.ts +72 -0
  423. package/lib/typescript/transport/irisWebSocket.d.ts.map +1 -0
  424. package/lib/typescript/transport/secureUrl.d.ts +14 -0
  425. package/lib/typescript/transport/secureUrl.d.ts.map +1 -0
  426. package/lib/typescript/transport/sse.d.ts +54 -0
  427. package/lib/typescript/transport/sse.d.ts.map +1 -0
  428. package/lib/typescript/types/index.d.ts +1219 -0
  429. package/lib/typescript/types/index.d.ts.map +1 -0
  430. package/lib/typescript/ui/MapFallbackBoundary.d.ts +28 -0
  431. package/lib/typescript/ui/MapFallbackBoundary.d.ts.map +1 -0
  432. package/lib/typescript/ui/StepShell.d.ts +29 -0
  433. package/lib/typescript/ui/StepShell.d.ts.map +1 -0
  434. package/lib/typescript/ui/VelionOnboardingScreen.d.ts +26 -0
  435. package/lib/typescript/ui/VelionOnboardingScreen.d.ts.map +1 -0
  436. package/lib/typescript/ui/forms/index.d.ts +3 -0
  437. package/lib/typescript/ui/forms/index.d.ts.map +1 -0
  438. package/lib/typescript/ui/forms/useInlineValidation.d.ts +30 -0
  439. package/lib/typescript/ui/forms/useInlineValidation.d.ts.map +1 -0
  440. package/lib/typescript/ui/forms/validators.d.ts +11 -0
  441. package/lib/typescript/ui/forms/validators.d.ts.map +1 -0
  442. package/lib/typescript/ui/icons/HomeHeartIcon.d.ts +14 -0
  443. package/lib/typescript/ui/icons/HomeHeartIcon.d.ts.map +1 -0
  444. package/lib/typescript/ui/icons/StepIcon.d.ts +26 -0
  445. package/lib/typescript/ui/icons/StepIcon.d.ts.map +1 -0
  446. package/lib/typescript/ui/overlays/AnalyzingOverlay.d.ts +24 -0
  447. package/lib/typescript/ui/overlays/AnalyzingOverlay.d.ts.map +1 -0
  448. package/lib/typescript/ui/overlays/LoadingOverlay.d.ts +19 -0
  449. package/lib/typescript/ui/overlays/LoadingOverlay.d.ts.map +1 -0
  450. package/lib/typescript/ui/overlays/ProgressBar.d.ts +32 -0
  451. package/lib/typescript/ui/overlays/ProgressBar.d.ts.map +1 -0
  452. package/lib/typescript/ui/overlays/RetryDialog.d.ts +17 -0
  453. package/lib/typescript/ui/overlays/RetryDialog.d.ts.map +1 -0
  454. package/lib/typescript/ui/overlays/index.d.ts +4 -0
  455. package/lib/typescript/ui/overlays/index.d.ts.map +1 -0
  456. package/lib/typescript/ui/primitives/BackButton.d.ts +20 -0
  457. package/lib/typescript/ui/primitives/BackButton.d.ts.map +1 -0
  458. package/lib/typescript/ui/primitives/Banner.d.ts +11 -0
  459. package/lib/typescript/ui/primitives/Banner.d.ts.map +1 -0
  460. package/lib/typescript/ui/primitives/Button.d.ts +27 -0
  461. package/lib/typescript/ui/primitives/Button.d.ts.map +1 -0
  462. package/lib/typescript/ui/primitives/Card.d.ts +10 -0
  463. package/lib/typescript/ui/primitives/Card.d.ts.map +1 -0
  464. package/lib/typescript/ui/primitives/Checkbox.d.ts +25 -0
  465. package/lib/typescript/ui/primitives/Checkbox.d.ts.map +1 -0
  466. package/lib/typescript/ui/primitives/CountrySelect.d.ts +31 -0
  467. package/lib/typescript/ui/primitives/CountrySelect.d.ts.map +1 -0
  468. package/lib/typescript/ui/primitives/DatePicker.d.ts +42 -0
  469. package/lib/typescript/ui/primitives/DatePicker.d.ts.map +1 -0
  470. package/lib/typescript/ui/primitives/Input.d.ts +17 -0
  471. package/lib/typescript/ui/primitives/Input.d.ts.map +1 -0
  472. package/lib/typescript/ui/primitives/SearchableSingleSelectList.d.ts +33 -0
  473. package/lib/typescript/ui/primitives/SearchableSingleSelectList.d.ts.map +1 -0
  474. package/lib/typescript/ui/primitives/Select.d.ts +26 -0
  475. package/lib/typescript/ui/primitives/Select.d.ts.map +1 -0
  476. package/lib/typescript/ui/primitives/Spinner.d.ts +10 -0
  477. package/lib/typescript/ui/primitives/Spinner.d.ts.map +1 -0
  478. package/lib/typescript/ui/primitives/index.d.ts +12 -0
  479. package/lib/typescript/ui/primitives/index.d.ts.map +1 -0
  480. package/lib/typescript/ui/primitives/searchableSingleSelectFilter.d.ts +25 -0
  481. package/lib/typescript/ui/primitives/searchableSingleSelectFilter.d.ts.map +1 -0
  482. package/lib/typescript/ui/theme/ThemeProvider.d.ts +23 -0
  483. package/lib/typescript/ui/theme/ThemeProvider.d.ts.map +1 -0
  484. package/lib/typescript/ui/theme/index.d.ts +3 -0
  485. package/lib/typescript/ui/theme/index.d.ts.map +1 -0
  486. package/lib/typescript/ui/theme/tokens.d.ts +42 -0
  487. package/lib/typescript/ui/theme/tokens.d.ts.map +1 -0
  488. package/lib/typescript/utils/EventEmitter.d.ts +98 -0
  489. package/lib/typescript/utils/EventEmitter.d.ts.map +1 -0
  490. package/lib/typescript/utils/base64.d.ts +19 -0
  491. package/lib/typescript/utils/base64.d.ts.map +1 -0
  492. package/lib/typescript/utils/deviceFingerprint.d.ts +42 -0
  493. package/lib/typescript/utils/deviceFingerprint.d.ts.map +1 -0
  494. package/lib/typescript/utils/documentTypeOptions.d.ts +13 -0
  495. package/lib/typescript/utils/documentTypeOptions.d.ts.map +1 -0
  496. package/lib/typescript/utils/googleMapsPreflight.d.ts +52 -0
  497. package/lib/typescript/utils/googleMapsPreflight.d.ts.map +1 -0
  498. package/lib/typescript/utils/hmac.d.ts +39 -0
  499. package/lib/typescript/utils/hmac.d.ts.map +1 -0
  500. package/lib/typescript/utils/iso3166Countries.d.ts +27 -0
  501. package/lib/typescript/utils/iso3166Countries.d.ts.map +1 -0
  502. package/lib/typescript/utils/jpegFromUri.d.ts +29 -0
  503. package/lib/typescript/utils/jpegFromUri.d.ts.map +1 -0
  504. package/lib/typescript/utils/keepAwake.d.ts +16 -0
  505. package/lib/typescript/utils/keepAwake.d.ts.map +1 -0
  506. package/lib/typescript/utils/log.d.ts +18 -0
  507. package/lib/typescript/utils/log.d.ts.map +1 -0
  508. package/lib/typescript/utils/osGeocoder.d.ts +38 -0
  509. package/lib/typescript/utils/osGeocoder.d.ts.map +1 -0
  510. package/lib/typescript/utils/parseGoogleAddressComponents.d.ts +43 -0
  511. package/lib/typescript/utils/parseGoogleAddressComponents.d.ts.map +1 -0
  512. package/lib/typescript/utils/personNameNormalize.d.ts +10 -0
  513. package/lib/typescript/utils/personNameNormalize.d.ts.map +1 -0
  514. package/lib/typescript/utils/sdkError.d.ts +14 -0
  515. package/lib/typescript/utils/sdkError.d.ts.map +1 -0
  516. package/lib/typescript/utils/sdkVersion.d.ts +7 -0
  517. package/lib/typescript/utils/sdkVersion.d.ts.map +1 -0
  518. package/lib/typescript/utils/stepConfig.d.ts +8 -0
  519. package/lib/typescript/utils/stepConfig.d.ts.map +1 -0
  520. package/lib/typescript/utils/taxInfoConfig.d.ts +7 -0
  521. package/lib/typescript/utils/taxInfoConfig.d.ts.map +1 -0
  522. package/lib/typescript/utils/useSafeAreaInsets.d.ts +26 -0
  523. package/lib/typescript/utils/useSafeAreaInsets.d.ts.map +1 -0
  524. package/lib/typescript/utils/velionExtra.d.ts +24 -0
  525. package/lib/typescript/utils/velionExtra.d.ts.map +1 -0
  526. package/package.json +107 -0
  527. package/src/camera/AddressSearchBar.tsx +363 -0
  528. package/src/camera/DocumentCapture.tsx +514 -0
  529. package/src/camera/LivenessCamera.tsx +706 -0
  530. package/src/camera/MapAddressPicker.tsx +391 -0
  531. package/src/core/VelionOnboarding.ts +1291 -0
  532. package/src/core/retryStepCopy.ts +54 -0
  533. package/src/core/routingCommands.ts +63 -0
  534. package/src/core/sessionDeclinedCopy.ts +76 -0
  535. package/src/core/sessionStateMapper.ts +232 -0
  536. package/src/core/sseReasonMessages.ts +531 -0
  537. package/src/data/iso3166Alpha2Codes.json +1 -0
  538. package/src/data/iso3166CountryNames.json +251 -0
  539. package/src/i18n/index.ts +26 -0
  540. package/src/i18n/strings/en.ts +335 -0
  541. package/src/i18n/strings/es.ts +337 -0
  542. package/src/index.ts +146 -0
  543. package/src/steps/AddressInfoStep.tsx +744 -0
  544. package/src/steps/DocumentsOcrStep.tsx +481 -0
  545. package/src/steps/EconomicActivityStep.tsx +230 -0
  546. package/src/steps/EmailContactStep.tsx +165 -0
  547. package/src/steps/EmailOtpStep.tsx +256 -0
  548. package/src/steps/FaceMatchStep.tsx +176 -0
  549. package/src/steps/FingerprintStep.tsx +99 -0
  550. package/src/steps/HumanBasicInfoStep.tsx +286 -0
  551. package/src/steps/HumanExtendedInfoStep.tsx +362 -0
  552. package/src/steps/LegalBasicInfoStep.tsx +214 -0
  553. package/src/steps/LegalExtendedInfoStep.tsx +184 -0
  554. package/src/steps/LivenessMatchStep.tsx +1351 -0
  555. package/src/steps/PhoneContactStep.tsx +166 -0
  556. package/src/steps/PhoneOtpStep.tsx +255 -0
  557. package/src/steps/SwornDeclarationStep.tsx +237 -0
  558. package/src/steps/TaxInfoStep.tsx +288 -0
  559. package/src/steps/TermsAndConditionsStep.tsx +269 -0
  560. package/src/steps/_shared.ts +69 -0
  561. package/src/steps/types.ts +93 -0
  562. package/src/transport/api.ts +257 -0
  563. package/src/transport/irisWebSocket.ts +186 -0
  564. package/src/transport/secureUrl.ts +47 -0
  565. package/src/transport/sse.ts +310 -0
  566. package/src/types/index.ts +1421 -0
  567. package/src/ui/MapFallbackBoundary.tsx +46 -0
  568. package/src/ui/StepShell.tsx +273 -0
  569. package/src/ui/VelionOnboardingScreen.tsx +297 -0
  570. package/src/ui/forms/index.ts +12 -0
  571. package/src/ui/forms/useInlineValidation.ts +115 -0
  572. package/src/ui/forms/validators.ts +29 -0
  573. package/src/ui/icons/HomeHeartIcon.tsx +34 -0
  574. package/src/ui/icons/StepIcon.tsx +78 -0
  575. package/src/ui/overlays/AnalyzingOverlay.tsx +323 -0
  576. package/src/ui/overlays/LoadingOverlay.tsx +115 -0
  577. package/src/ui/overlays/ProgressBar.tsx +106 -0
  578. package/src/ui/overlays/RetryDialog.tsx +128 -0
  579. package/src/ui/overlays/index.ts +3 -0
  580. package/src/ui/primitives/BackButton.tsx +65 -0
  581. package/src/ui/primitives/Banner.tsx +81 -0
  582. package/src/ui/primitives/Button.tsx +164 -0
  583. package/src/ui/primitives/Card.tsx +55 -0
  584. package/src/ui/primitives/Checkbox.tsx +153 -0
  585. package/src/ui/primitives/CountrySelect.tsx +356 -0
  586. package/src/ui/primitives/DatePicker.tsx +266 -0
  587. package/src/ui/primitives/Input.tsx +110 -0
  588. package/src/ui/primitives/SearchableSingleSelectList.tsx +195 -0
  589. package/src/ui/primitives/Select.tsx +259 -0
  590. package/src/ui/primitives/Spinner.tsx +17 -0
  591. package/src/ui/primitives/index.ts +16 -0
  592. package/src/ui/primitives/searchableSingleSelectFilter.ts +38 -0
  593. package/src/ui/theme/ThemeProvider.tsx +102 -0
  594. package/src/ui/theme/index.ts +17 -0
  595. package/src/ui/theme/tokens.ts +159 -0
  596. package/src/utils/EventEmitter.ts +155 -0
  597. package/src/utils/base64.ts +44 -0
  598. package/src/utils/deviceFingerprint.ts +184 -0
  599. package/src/utils/documentTypeOptions.ts +31 -0
  600. package/src/utils/googleMapsPreflight.ts +89 -0
  601. package/src/utils/hmac.ts +61 -0
  602. package/src/utils/iso3166Countries.ts +111 -0
  603. package/src/utils/jpegFromUri.ts +42 -0
  604. package/src/utils/keepAwake.ts +62 -0
  605. package/src/utils/log.ts +37 -0
  606. package/src/utils/osGeocoder.ts +75 -0
  607. package/src/utils/parseGoogleAddressComponents.ts +123 -0
  608. package/src/utils/personNameNormalize.ts +17 -0
  609. package/src/utils/sdkError.ts +40 -0
  610. package/src/utils/sdkVersion.ts +6 -0
  611. package/src/utils/stepConfig.ts +75 -0
  612. package/src/utils/taxInfoConfig.ts +14 -0
  613. package/src/utils/useSafeAreaInsets.ts +37 -0
  614. package/src/utils/velionExtra.ts +46 -0
@@ -0,0 +1,286 @@
1
+ /**
2
+ * HUMAN_BASIC_INFO step — natural-person identification data.
3
+ *
4
+ * - Form: first_name, last_name, identification_type (select from
5
+ * stepConfig.accepted_country_documents), identification_id.
6
+ * - Names are NFC-normalized (`normalizePersonNameSegment`) before submit.
7
+ * - On submit failure: surface a `<RetryDialog>` so the user can retry
8
+ * without losing their inputs.
9
+ *
10
+ * The orchestrator's view bridge (`StepUiHandle.setNode`) is how this module
11
+ * mounts its UI into `<VelionOnboardingScreen>`. Loading and retry overlays
12
+ * live alongside the form via the orchestrator's `setLoading` and the
13
+ * step-local retry dialog node.
14
+ */
15
+
16
+ import { useCallback, useEffect, useMemo, useState } from 'react';
17
+ import { View } from 'react-native';
18
+ import {
19
+ SdkErrorCode,
20
+ type HumanBasicInfoPayload,
21
+ type HumanBasicInfoStepConfig,
22
+ type SdkError,
23
+ } from '../types';
24
+ import { Banner } from '../ui/primitives/Banner';
25
+ import { Button } from '../ui/primitives/Button';
26
+ import { Input } from '../ui/primitives/Input';
27
+ import { Select, type SelectOption } from '../ui/primitives/Select';
28
+ import { LoadingOverlay } from '../ui/overlays/LoadingOverlay';
29
+ import { RetryDialog } from '../ui/overlays/RetryDialog';
30
+ import { StepShell } from '../ui/StepShell';
31
+ import { StepIcon } from '../ui/icons/StepIcon';
32
+ import { useInlineValidation, required } from '../ui/forms';
33
+ import { getStrings, type StringsTable } from '../i18n';
34
+ import { resolveDocumentTypeOptions } from '../utils/documentTypeOptions';
35
+ import { resolveDocumentOptionsFromStepConfig } from '../utils/stepConfig';
36
+ import { normalizePersonNameSegment } from '../utils/personNameNormalize';
37
+ import type { ApiCaller } from '../transport/api';
38
+ import type { StepDeps, StepModule } from './types';
39
+ import { prefillString } from './_shared';
40
+
41
+ interface FormState {
42
+ first_name: string;
43
+ last_name: string;
44
+ identification_type: string;
45
+ identification_id: string;
46
+ }
47
+
48
+ export class HumanBasicInfoStep implements StepModule {
49
+ private resolveStep!: () => void;
50
+ private rejectStep!: (err: SdkError) => void;
51
+ private destroyed = false;
52
+
53
+ constructor(private readonly deps: StepDeps) {}
54
+
55
+ run(): Promise<void> {
56
+ return new Promise((resolve, reject) => {
57
+ this.resolveStep = resolve;
58
+ this.rejectStep = reject;
59
+ this.deps.ui.setNode(
60
+ <HumanBasicInfoView
61
+ api={this.deps.api}
62
+ sessionId={this.deps.sessionId}
63
+ locale={this.deps.locale}
64
+ stepConfig={this.deps.stepConfig as HumanBasicInfoStepConfig | undefined}
65
+ prefill={this.deps.stepResult}
66
+ onBack={this.deps.onBack}
67
+ onComplete={() => {
68
+ if (this.destroyed) return;
69
+ this.deps.ui.setNode(null);
70
+ this.resolveStep();
71
+ }}
72
+ onCancel={(err) => {
73
+ if (this.destroyed) return;
74
+ this.deps.ui.setNode(null);
75
+ this.rejectStep(err);
76
+ }}
77
+ />,
78
+ );
79
+ });
80
+ }
81
+
82
+ destroy(): void {
83
+ this.destroyed = true;
84
+ this.deps.ui.setNode(null);
85
+ }
86
+ }
87
+
88
+ interface ViewProps {
89
+ api: ApiCaller;
90
+ sessionId: string;
91
+ locale: string;
92
+ stepConfig: HumanBasicInfoStepConfig | undefined;
93
+ prefill?: Record<string, unknown> | undefined;
94
+ onBack?: (() => void) | undefined;
95
+ onComplete: () => void;
96
+ onCancel: (err: SdkError) => void;
97
+ }
98
+
99
+ function HumanBasicInfoView({
100
+ api,
101
+ sessionId,
102
+ locale,
103
+ stepConfig,
104
+ prefill,
105
+ onBack,
106
+ onComplete,
107
+ onCancel,
108
+ }: ViewProps) {
109
+ const t = getStrings(locale);
110
+ const documentOptions = useMemo<SelectOption[]>(() => {
111
+ const fromConfig = resolveDocumentOptionsFromStepConfig(stepConfig);
112
+ if (fromConfig && fromConfig.length > 0) return fromConfig;
113
+ return resolveDocumentTypeOptions(locale);
114
+ }, [stepConfig, locale]);
115
+
116
+ const [form, setForm] = useState<FormState>(() => ({
117
+ first_name: prefillString(prefill, 'first_name'),
118
+ last_name: prefillString(prefill, 'last_name'),
119
+ identification_type:
120
+ prefillString(prefill, 'identification_type') ||
121
+ (documentOptions[0]?.value ?? ''),
122
+ identification_id: prefillString(prefill, 'identification_id'),
123
+ }));
124
+ const [bannerError, setBannerError] = useState<string | null>(null);
125
+ const [submitting, setSubmitting] = useState(false);
126
+ const [retry, setRetry] = useState<{ message: string } | null>(null);
127
+
128
+ // Default the select to the first option once it becomes available, so the
129
+ // payload always has a non-empty `identification_type` even if the user
130
+ // submits without touching the dropdown.
131
+ useEffect(() => {
132
+ if (!form.identification_type && documentOptions[0]) {
133
+ setForm((f) => ({ ...f, identification_type: documentOptions[0]!.value }));
134
+ }
135
+ }, [documentOptions, form.identification_type]);
136
+
137
+ const setField = useCallback(
138
+ <K extends keyof FormState>(key: K, value: FormState[K]) => {
139
+ setForm((f) => ({ ...f, [key]: value }));
140
+ },
141
+ [],
142
+ );
143
+
144
+ const validation = useInlineValidation<keyof FormState>(
145
+ [
146
+ { name: 'first_name', validate: required(t.human_basic_info.nameRequired) },
147
+ { name: 'last_name', validate: required(t.human_basic_info.nameRequired) },
148
+ { name: 'identification_type', validate: required(t.human_basic_info.idTypeRequired) },
149
+ { name: 'identification_id', validate: required(t.human_basic_info.idNumberRequired) },
150
+ ],
151
+ (name, value) => setField(name, value),
152
+ );
153
+
154
+ const handleSubmit = useCallback(async () => {
155
+ setBannerError(null);
156
+ if (!validation.validateAll(form)) {
157
+ return;
158
+ }
159
+ const first_name = normalizePersonNameSegment(form.first_name);
160
+ const last_name = normalizePersonNameSegment(form.last_name);
161
+ if (!first_name || !last_name) {
162
+ setBannerError(t.human_basic_info.nameRequired);
163
+ return;
164
+ }
165
+
166
+ const payload: HumanBasicInfoPayload = {
167
+ first_name,
168
+ last_name,
169
+ identification_type: form.identification_type.trim(),
170
+ identification_id: form.identification_id.trim(),
171
+ };
172
+
173
+ setSubmitting(true);
174
+ try {
175
+ await api.post(`/sessions/${sessionId}/basic-info/human`, payload);
176
+ setSubmitting(false);
177
+ onComplete();
178
+ } catch (err) {
179
+ setSubmitting(false);
180
+ const sdkErr = toSdkError(err, t);
181
+ setBannerError(sdkErr.message);
182
+ setRetry({ message: sdkErr.message });
183
+ }
184
+ }, [api, form, onComplete, sessionId, t, validation]);
185
+
186
+ if (retry) {
187
+ return (
188
+ <RetryDialog
189
+ title={t.common.submissionTitle}
190
+ message={retry.message || t.common.submissionFallback}
191
+ retryLabel={t.common.retry}
192
+ cancelLabel={t.common.cancel}
193
+ onRetry={() => setRetry(null)}
194
+ onCancel={() => {
195
+ setRetry(null);
196
+ onCancel({
197
+ code: SdkErrorCode.API_ERROR,
198
+ message: retry.message,
199
+ });
200
+ }}
201
+ />
202
+ );
203
+ }
204
+
205
+ return (
206
+ <View style={{ flex: 1 }}>
207
+ <StepShell
208
+ title={t.human_basic_info.title}
209
+ subtitle={t.human_basic_info.subtitle}
210
+ iconNode={<StepIcon name="badge" />}
211
+ onBack={onBack}
212
+ backLabel={t.common.back}
213
+ backDisabled={submitting}
214
+ >
215
+ <Input
216
+ label={t.human_basic_info.givenNames}
217
+ required
218
+ autoCapitalize="words"
219
+ autoComplete="name-given"
220
+ textContentType="givenName"
221
+ autoCorrect={false}
222
+ value={form.first_name}
223
+ {...validation.bind('first_name', form.first_name)}
224
+ />
225
+ <Input
226
+ label={t.human_basic_info.familyNames}
227
+ required
228
+ autoCapitalize="words"
229
+ autoComplete="name-family"
230
+ textContentType="familyName"
231
+ autoCorrect={false}
232
+ value={form.last_name}
233
+ {...validation.bind('last_name', form.last_name)}
234
+ />
235
+ <Select
236
+ label={t.human_basic_info.idType}
237
+ required
238
+ options={documentOptions}
239
+ value={form.identification_type || null}
240
+ onChange={(v) => {
241
+ setField('identification_type', v);
242
+ validation.setFieldError('identification_type', null);
243
+ }}
244
+ errorMessage={validation.errors.identification_type ?? null}
245
+ />
246
+ <Input
247
+ label={t.human_basic_info.idNumber}
248
+ required
249
+ keyboardType="default"
250
+ autoCapitalize="characters"
251
+ autoCorrect={false}
252
+ value={form.identification_id}
253
+ {...validation.bind('identification_id', form.identification_id)}
254
+ />
255
+ {bannerError ? <Banner message={bannerError} /> : null}
256
+ <Button
257
+ label={t.common.continue}
258
+ onPress={handleSubmit}
259
+ loading={submitting}
260
+ disabled={submitting}
261
+ />
262
+ </StepShell>
263
+ {submitting ? <LoadingOverlay message={t.common.submitting} /> : null}
264
+ </View>
265
+ );
266
+ }
267
+
268
+ function toSdkError(err: unknown, t: StringsTable): SdkError {
269
+ if (
270
+ err != null &&
271
+ typeof err === 'object' &&
272
+ 'code' in err &&
273
+ typeof (err as SdkError).code === 'string' &&
274
+ 'message' in err &&
275
+ typeof (err as SdkError).message === 'string'
276
+ ) {
277
+ return err as SdkError;
278
+ }
279
+ const message =
280
+ err instanceof Error ? err.message : t.common.submissionFallback;
281
+ return {
282
+ code: SdkErrorCode.API_ERROR,
283
+ message: message || t.common.submissionFallback,
284
+ cause: err,
285
+ };
286
+ }
@@ -0,0 +1,362 @@
1
+ /**
2
+ * HUMAN_EXTENDED_INFO — POST /sessions/:id/extended-info/human.
3
+ *
4
+ * Mirrors `HumanExtendedInfoModule.ts`. Each field's visibility and required
5
+ * state is read from `stepConfig.fields.<field>.{visible,required}`. Values
6
+ * default to `visible: true, required: true` when undefined (web parity).
7
+ *
8
+ * `gender` and `civil_status` options come from
9
+ * `stepConfig.fields.<field>.options` first, then `stepConfig.gender_options`
10
+ * / `civil_status_options` as a fallback. `birth_country` / `citizenship` /
11
+ * `residence_country` are 2-letter ISO codes resolved through `<CountrySelect>`.
12
+ */
13
+
14
+ import { useCallback, useMemo, useState } from 'react';
15
+ import { View } from 'react-native';
16
+ import {
17
+ SdkErrorCode,
18
+ type HumanExtendedInfoPayload,
19
+ type HumanExtendedInfoStepConfig,
20
+ type SdkError,
21
+ type StepFieldOption,
22
+ } from '../types';
23
+ import { Banner } from '../ui/primitives/Banner';
24
+ import { Button } from '../ui/primitives/Button';
25
+ import { Select, type SelectOption } from '../ui/primitives/Select';
26
+ import { DatePicker } from '../ui/primitives/DatePicker';
27
+ import { CountrySelect } from '../ui/primitives/CountrySelect';
28
+ import { LoadingOverlay } from '../ui/overlays/LoadingOverlay';
29
+ import { RetryDialog } from '../ui/overlays/RetryDialog';
30
+ import { StepShell } from '../ui/StepShell';
31
+ import { StepIcon } from '../ui/icons/StepIcon';
32
+ import { getStrings } from '../i18n';
33
+ import type { ApiCaller } from '../transport/api';
34
+ import type { StepDeps, StepModule } from './types';
35
+ import { prefillString, prefillStringOrNull, toSubmissionError } from './_shared';
36
+
37
+ export class HumanExtendedInfoStep implements StepModule {
38
+ private resolveStep!: () => void;
39
+ private rejectStep!: (err: SdkError) => void;
40
+ private destroyed = false;
41
+
42
+ constructor(private readonly deps: StepDeps) {}
43
+
44
+ run(): Promise<void> {
45
+ return new Promise((resolve, reject) => {
46
+ this.resolveStep = resolve;
47
+ this.rejectStep = reject;
48
+ this.deps.ui.setNode(
49
+ <HumanExtendedInfoView
50
+ api={this.deps.api}
51
+ sessionId={this.deps.sessionId}
52
+ locale={this.deps.locale}
53
+ stepConfig={
54
+ this.deps.stepConfig as HumanExtendedInfoStepConfig | undefined
55
+ }
56
+ prefill={this.deps.stepResult}
57
+ onBack={this.deps.onBack}
58
+ onComplete={() => {
59
+ if (this.destroyed) return;
60
+ this.deps.ui.setNode(null);
61
+ this.resolveStep();
62
+ }}
63
+ onCancel={(err) => {
64
+ if (this.destroyed) return;
65
+ this.deps.ui.setNode(null);
66
+ this.rejectStep(err);
67
+ }}
68
+ />,
69
+ );
70
+ });
71
+ }
72
+
73
+ destroy(): void {
74
+ this.destroyed = true;
75
+ this.deps.ui.setNode(null);
76
+ }
77
+ }
78
+
79
+ function resolveSelectOptions(
80
+ fromField: StepFieldOption[] | undefined,
81
+ fromTopLevel: StepFieldOption[] | undefined,
82
+ ): SelectOption[] {
83
+ const raw = Array.isArray(fromField) && fromField.length > 0 ? fromField : fromTopLevel;
84
+ if (!Array.isArray(raw)) return [];
85
+ return raw
86
+ .map((opt) => {
87
+ const value = typeof opt?.id === 'string' ? opt.id.trim() : '';
88
+ if (!value) return null;
89
+ const display =
90
+ typeof opt.display_value === 'string' ? opt.display_value.trim() : '';
91
+ return { value, label: display || value };
92
+ })
93
+ .filter((opt): opt is SelectOption => opt !== null);
94
+ }
95
+
96
+ interface FormState {
97
+ gender: string;
98
+ civil_status: string;
99
+ birth_date: string | null;
100
+ birth_country: string | null;
101
+ citizenship: string | null;
102
+ residence_country: string | null;
103
+ }
104
+
105
+ interface ViewProps {
106
+ api: ApiCaller;
107
+ sessionId: string;
108
+ locale: string;
109
+ stepConfig: HumanExtendedInfoStepConfig | undefined;
110
+ prefill?: Record<string, unknown> | undefined;
111
+ onBack?: (() => void) | undefined;
112
+ onComplete: () => void;
113
+ onCancel: (err: SdkError) => void;
114
+ }
115
+
116
+ function HumanExtendedInfoView({
117
+ api,
118
+ sessionId,
119
+ locale,
120
+ stepConfig,
121
+ prefill,
122
+ onBack,
123
+ onComplete,
124
+ onCancel,
125
+ }: ViewProps) {
126
+ const t = getStrings(locale);
127
+ const f = stepConfig?.fields;
128
+ const showGender = f?.gender?.visible !== false;
129
+ const reqGender = f?.gender?.required !== false;
130
+ const showCivil = f?.civil_status?.visible !== false;
131
+ const reqCivil = f?.civil_status?.required !== false;
132
+ const showBirthDate = f?.birth_date?.visible !== false;
133
+ const reqBirthDate = f?.birth_date?.required !== false;
134
+ const showBirthCountry = f?.birth_country?.visible !== false;
135
+ const reqBirthCountry = f?.birth_country?.required !== false;
136
+ const showCitizenship = f?.citizenship?.visible !== false;
137
+ const reqCitizenship = f?.citizenship?.required !== false;
138
+ const showResidence = f?.residence_country?.visible !== false;
139
+ const reqResidence = f?.residence_country?.required !== false;
140
+
141
+ const genderOptions = useMemo(
142
+ () => resolveSelectOptions(f?.gender?.options, stepConfig?.gender_options),
143
+ [f?.gender?.options, stepConfig?.gender_options],
144
+ );
145
+ const civilOptions = useMemo(
146
+ () =>
147
+ resolveSelectOptions(
148
+ f?.civil_status?.options,
149
+ stepConfig?.civil_status_options,
150
+ ),
151
+ [f?.civil_status?.options, stepConfig?.civil_status_options],
152
+ );
153
+
154
+ const [form, setForm] = useState<FormState>(() => ({
155
+ gender: prefillString(prefill, 'gender'),
156
+ civil_status: prefillString(prefill, 'civil_status'),
157
+ birth_date: prefillStringOrNull(prefill, 'birth_date'),
158
+ birth_country: prefillStringOrNull(prefill, 'birth_country'),
159
+ citizenship: prefillStringOrNull(prefill, 'citizenship'),
160
+ residence_country: prefillStringOrNull(prefill, 'residence_country'),
161
+ }));
162
+ const [errors, setErrors] = useState<Partial<Record<keyof FormState, string>>>({});
163
+ const [bannerError, setBannerError] = useState<string | null>(null);
164
+ const [submitting, setSubmitting] = useState(false);
165
+ const [retry, setRetry] = useState<{ message: string } | null>(null);
166
+
167
+ const updateField = useCallback(
168
+ <K extends keyof FormState>(key: K, value: FormState[K]) => {
169
+ setForm((prev) => ({ ...prev, [key]: value }));
170
+ setErrors((prev) => {
171
+ if (!(key in prev)) return prev;
172
+ const next = { ...prev };
173
+ delete next[key];
174
+ return next;
175
+ });
176
+ },
177
+ [],
178
+ );
179
+
180
+ const validateAll = useCallback((): boolean => {
181
+ const next: Partial<Record<keyof FormState, string>> = {};
182
+ if (showGender && reqGender && !form.gender)
183
+ next.gender = t.human_extended_info.requiredGender;
184
+ if (showCivil && reqCivil && !form.civil_status)
185
+ next.civil_status = t.human_extended_info.requiredCivil;
186
+ if (showBirthDate && reqBirthDate && !form.birth_date)
187
+ next.birth_date = t.human_extended_info.requiredBirthDate;
188
+ if (showBirthCountry && reqBirthCountry && !form.birth_country)
189
+ next.birth_country = t.human_extended_info.requiredCountry;
190
+ if (showCitizenship && reqCitizenship && !form.citizenship)
191
+ next.citizenship = t.human_extended_info.requiredCountry;
192
+ if (showResidence && reqResidence && !form.residence_country)
193
+ next.residence_country = t.human_extended_info.requiredCountry;
194
+ setErrors(next);
195
+ return Object.keys(next).length === 0;
196
+ }, [
197
+ form,
198
+ reqBirthCountry,
199
+ reqBirthDate,
200
+ reqCitizenship,
201
+ reqCivil,
202
+ reqGender,
203
+ reqResidence,
204
+ showBirthCountry,
205
+ showBirthDate,
206
+ showCitizenship,
207
+ showCivil,
208
+ showGender,
209
+ showResidence,
210
+ t.human_extended_info.requiredBirthDate,
211
+ t.human_extended_info.requiredCivil,
212
+ t.human_extended_info.requiredCountry,
213
+ t.human_extended_info.requiredGender,
214
+ ]);
215
+
216
+ const handleSubmit = useCallback(async () => {
217
+ setBannerError(null);
218
+ if (!validateAll()) return;
219
+ const payload: HumanExtendedInfoPayload = {
220
+ ...(showGender && form.gender && { gender: form.gender }),
221
+ ...(showCivil && form.civil_status && { civil_status: form.civil_status }),
222
+ ...(showBirthDate && form.birth_date && { birth_date: form.birth_date }),
223
+ ...(showBirthCountry && form.birth_country && {
224
+ birth_country: form.birth_country,
225
+ }),
226
+ ...(showCitizenship && form.citizenship && { citizenship: form.citizenship }),
227
+ ...(showResidence && form.residence_country && {
228
+ residence_country: form.residence_country,
229
+ }),
230
+ };
231
+ setSubmitting(true);
232
+ try {
233
+ await api.post(`/sessions/${sessionId}/extended-info/human`, payload);
234
+ setSubmitting(false);
235
+ onComplete();
236
+ } catch (err) {
237
+ setSubmitting(false);
238
+ const sdkErr = toSubmissionError(err, t);
239
+ setBannerError(sdkErr.message);
240
+ setRetry({ message: sdkErr.message });
241
+ }
242
+ }, [
243
+ api,
244
+ form,
245
+ onComplete,
246
+ sessionId,
247
+ showBirthCountry,
248
+ showBirthDate,
249
+ showCitizenship,
250
+ showCivil,
251
+ showGender,
252
+ showResidence,
253
+ t,
254
+ validateAll,
255
+ ]);
256
+
257
+ if (retry) {
258
+ return (
259
+ <RetryDialog
260
+ title={t.common.submissionTitle}
261
+ message={retry.message || t.common.submissionFallback}
262
+ retryLabel={t.common.retry}
263
+ cancelLabel={t.common.cancel}
264
+ onRetry={() => setRetry(null)}
265
+ onCancel={() => {
266
+ setRetry(null);
267
+ onCancel({ code: SdkErrorCode.API_ERROR, message: retry.message });
268
+ }}
269
+ />
270
+ );
271
+ }
272
+
273
+ return (
274
+ <View style={{ flex: 1 }}>
275
+ <StepShell
276
+ title={t.human_extended_info.title}
277
+ subtitle={t.human_extended_info.subtitle}
278
+ iconNode={<StepIcon name="person" />}
279
+ onBack={onBack}
280
+ backLabel={t.common.back}
281
+ backDisabled={submitting}
282
+ >
283
+ {showGender ? (
284
+ <Select
285
+ label={t.human_extended_info.gender}
286
+ required={reqGender}
287
+ options={genderOptions}
288
+ value={form.gender || null}
289
+ onChange={(v) => updateField('gender', v)}
290
+ errorMessage={errors.gender ?? null}
291
+ />
292
+ ) : null}
293
+ {showCivil ? (
294
+ <Select
295
+ label={t.human_extended_info.civilStatus}
296
+ required={reqCivil}
297
+ options={civilOptions}
298
+ value={form.civil_status || null}
299
+ onChange={(v) => updateField('civil_status', v)}
300
+ errorMessage={errors.civil_status ?? null}
301
+ />
302
+ ) : null}
303
+ {showBirthDate ? (
304
+ <DatePicker
305
+ label={t.human_extended_info.birthDate}
306
+ required={reqBirthDate}
307
+ value={form.birth_date}
308
+ onChange={(v) => updateField('birth_date', v)}
309
+ errorMessage={errors.birth_date ?? null}
310
+ monthLabels={t.months}
311
+ maxYear={new Date().getFullYear()}
312
+ minYear={1900}
313
+ />
314
+ ) : null}
315
+ {showBirthCountry ? (
316
+ <CountrySelect
317
+ label={t.human_extended_info.birthCountry}
318
+ required={reqBirthCountry}
319
+ value={form.birth_country}
320
+ onChange={(v) => updateField('birth_country', v)}
321
+ locale={locale}
322
+ placeholder={t.human_extended_info.countrySearch}
323
+ searchPlaceholder={t.human_extended_info.countrySearch}
324
+ errorMessage={errors.birth_country ?? null}
325
+ />
326
+ ) : null}
327
+ {showCitizenship ? (
328
+ <CountrySelect
329
+ label={t.human_extended_info.citizenship}
330
+ required={reqCitizenship}
331
+ value={form.citizenship}
332
+ onChange={(v) => updateField('citizenship', v)}
333
+ locale={locale}
334
+ placeholder={t.human_extended_info.countrySearch}
335
+ searchPlaceholder={t.human_extended_info.countrySearch}
336
+ errorMessage={errors.citizenship ?? null}
337
+ />
338
+ ) : null}
339
+ {showResidence ? (
340
+ <CountrySelect
341
+ label={t.human_extended_info.residenceCountry}
342
+ required={reqResidence}
343
+ value={form.residence_country}
344
+ onChange={(v) => updateField('residence_country', v)}
345
+ locale={locale}
346
+ placeholder={t.human_extended_info.countrySearch}
347
+ searchPlaceholder={t.human_extended_info.countrySearch}
348
+ errorMessage={errors.residence_country ?? null}
349
+ />
350
+ ) : null}
351
+ {bannerError ? <Banner message={bannerError} /> : null}
352
+ <Button
353
+ label={t.common.continue}
354
+ onPress={handleSubmit}
355
+ loading={submitting}
356
+ disabled={submitting}
357
+ />
358
+ </StepShell>
359
+ {submitting ? <LoadingOverlay message={t.common.submitting} /> : null}
360
+ </View>
361
+ );
362
+ }