@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,1421 @@
1
+ /**
2
+ * @fileoverview Public TypeScript contracts for the Velion Onboarding SDK.
3
+ *
4
+ * Design principle: All types exported from this file constitute the public API.
5
+ * Internal implementation types should live alongside their respective modules.
6
+ */
7
+
8
+ // ─────────────────────────────────────────────────────────────────────────────
9
+ // STEP & FLOW TYPES
10
+ // ─────────────────────────────────────────────────────────────────────────────
11
+
12
+ /**
13
+ * The complete set of onboarding steps the backend can require.
14
+ * The SDK dynamically receives the active subset for each session.
15
+ *
16
+ * @remarks
17
+ * - `DEVICE_FINGERPRINT`: Silently collects device entropy via FingerprintJS.
18
+ * - `DOCUMENTS_OCR`: Renders a UI for ID document image capture and upload.
19
+ * - `LIVENESS_MATCH`: Drives the Velion Iris active-liveness flow over WebSocket (HUMAN only).
20
+ * - `EMAIL_OTP` / `PHONE_OTP`: Contact verification via one-time passwords.
21
+ * - `HUMAN_BASIC_INFO`: Natural-person identification data (HUMAN only).
22
+ * - `LEGAL_BASIC_INFO`: Legal-entity identification data (LEGAL only).
23
+ * - `EMAIL_CONTACT` / `PHONE_CONTACT`: contact collection without OTP.
24
+ * - `TAX_INFO`, `HUMAN_EXTENDED_INFO`, `LEGAL_EXTENDED_INFO`, `ADDRESS_INFO`, `SWORN_DECLARATION`: form steps.
25
+ * - `ECONOMIC_ACTIVITY_DECLARATION`: pick exactly one economic activity from a searchable list.
26
+ * - `TERMS_AND_CONDITIONS`: accept configured T&C items.
27
+ * - `FACE_MATCH`: server-side face comparison after liveness (no user input; SDK waits).
28
+ */
29
+ export type OnboardingStep =
30
+ | 'DEVICE_FINGERPRINT'
31
+ | 'HUMAN_BASIC_INFO'
32
+ | 'LEGAL_BASIC_INFO'
33
+ | 'EMAIL_OTP'
34
+ | 'EMAIL_CONTACT'
35
+ | 'PHONE_OTP'
36
+ | 'PHONE_CONTACT'
37
+ | 'TAX_INFO'
38
+ | 'HUMAN_EXTENDED_INFO'
39
+ | 'LEGAL_EXTENDED_INFO'
40
+ | 'ADDRESS_INFO'
41
+ | 'SWORN_DECLARATION'
42
+ | 'ECONOMIC_ACTIVITY_DECLARATION'
43
+ | 'DOCUMENTS_OCR'
44
+ | 'LIVENESS_MATCH'
45
+ | 'FACE_MATCH'
46
+ | 'TERMS_AND_CONDITIONS';
47
+
48
+ /**
49
+ * Status of an individual onboarding step (matches backend OnboardingStepStatus).
50
+ */
51
+ export type OnboardingStepStatus =
52
+ | 'PENDING'
53
+ | 'IN_PROGRESS'
54
+ | 'COMPLETED'
55
+ | 'SKIPPED'
56
+ | 'FAILED';
57
+
58
+ /**
59
+ * Type of onboarding session (matches backend OnboardingType).
60
+ * Constrains which steps are valid: HUMAN allows biometric steps, LEGAL uses entity data.
61
+ */
62
+ export type OnboardingType = 'HUMAN' | 'LEGAL';
63
+
64
+ /** Which face of the ID document is being captured. */
65
+ export type DocumentSide = 'FRONT' | 'BACK';
66
+
67
+ /**
68
+ * How the user can provide document images in the DOCUMENTS_OCR step.
69
+ * - `'camera'`: Only "Take photo" (opens camera on supported devices).
70
+ * - `'file'`: Only "Choose file" (file picker).
71
+ * - `'both'`: Both options; implementer can style via theme.
72
+ *
73
+ * @default 'both'
74
+ */
75
+ export type DocumentCaptureMode = 'camera' | 'file' | 'both';
76
+
77
+ /**
78
+ * Orientation of the document capture cutout / crop frame.
79
+ * - `'landscape'`: Horizontal card (default — standard ID-1 cards).
80
+ * - `'portrait'`: Vertical card (e.g. some passports, residence permits).
81
+ *
82
+ * @default 'landscape'
83
+ */
84
+ export type DocumentOrientation = 'landscape' | 'portrait';
85
+
86
+ /** Generic visible/required field toggle used by workflow step configs. */
87
+ export interface StepFieldRule {
88
+ visible: boolean;
89
+ required: boolean;
90
+ }
91
+
92
+ /** Select option used by configurable step fields (e.g. HUMAN_EXTENDED_INFO gender/civil_status). */
93
+ export interface StepFieldOption {
94
+ id: string;
95
+ display_value?: string;
96
+ }
97
+
98
+ /** Field rule with optional selectable options. */
99
+ export interface StepFieldRuleWithOptions extends StepFieldRule {
100
+ options?: StepFieldOption[];
101
+ }
102
+
103
+ /** STEP config for HUMAN_BASIC_INFO. */
104
+ export interface HumanBasicInfoStepConfig {
105
+ accepted_country_documents?: Array<{
106
+ country_code: string;
107
+ document_types: Array<{ id: string; display_value?: string }>;
108
+ }>;
109
+ }
110
+
111
+ /**
112
+ * One selectable option row from TAX_INFO `accepted_tax_information` (backend GET session).
113
+ * Prefer `code` as the value sent in POST tax-info; `id` is supported for older payloads.
114
+ */
115
+ export interface TaxInfoConfigOptionRow {
116
+ code?: string;
117
+ id?: string;
118
+ display_value?: string;
119
+ tax_code?: string;
120
+ }
121
+
122
+ /** One country block in TAX_INFO step config (GET session `current_step.config`). */
123
+ export interface TaxInfoAcceptedCountryRow {
124
+ country_code: string;
125
+ identification_types?: TaxInfoConfigOptionRow[];
126
+ /** Options for the "Categoría fiscal" / taxpayer category select. */
127
+ taxpayer_categories?: TaxInfoConfigOptionRow[];
128
+ }
129
+
130
+ /** STEP config for TAX_INFO. */
131
+ export interface TaxInfoStepConfig {
132
+ /** Identification types + taxpayer categories per country. */
133
+ accepted_tax_information?: TaxInfoAcceptedCountryRow[];
134
+ }
135
+
136
+ /** STEP config for HUMAN_EXTENDED_INFO. */
137
+ export interface HumanExtendedInfoStepConfig {
138
+ /** Optional top-level lists sent by backend for select fields. */
139
+ gender_options?: StepFieldOption[];
140
+ civil_status_options?: StepFieldOption[];
141
+ fields?: Partial<
142
+ Record<
143
+ 'gender' | 'civil_status' | 'birth_date' | 'birth_country' | 'citizenship' | 'residence_country',
144
+ StepFieldRuleWithOptions
145
+ >
146
+ >;
147
+ }
148
+
149
+ /** STEP config for ADDRESS_INFO. */
150
+ export interface AddressInfoStepConfig {
151
+ address_type?: { id?: string; display_value?: string };
152
+ fields?: Partial<
153
+ Record<
154
+ 'state' | 'city' | 'district' | 'neighborhood' | 'postal_code' | 'street' | 'number',
155
+ StepFieldRule
156
+ >
157
+ >;
158
+ /**
159
+ * Optional ISO 3166-1 alpha-2 allowlist for the country selector. Only
160
+ * consumed by the manual-entry form (when the SDK is configured without a
161
+ * Google Maps key). When unset, every country is offered.
162
+ */
163
+ country_allow?: string[];
164
+ }
165
+
166
+ /** STEP config for SWORN_DECLARATION. */
167
+ export interface SwornDeclarationStepConfig {
168
+ ask_pep?: boolean;
169
+ ask_obligated_subject?: boolean;
170
+ ask_fatca?: boolean;
171
+ ask_ocde?: boolean;
172
+ on_declared_pep?: string;
173
+ on_declared_obligated_subject?: string;
174
+ on_declared_fatca?: string;
175
+ on_declared_ocde?: string;
176
+ }
177
+
178
+ /**
179
+ * A single selectable economic activity presented in the
180
+ * `ECONOMIC_ACTIVITY_DECLARATION` step. Mirrors the backend `EconomicActivityItem`
181
+ * (`code` + `display_name`); `code` is unique within the list and is what the SDK
182
+ * submits. There is no global catalog — each workflow declares its own list.
183
+ */
184
+ export interface EconomicActivityItem {
185
+ /** Machine-readable activity code (e.g. an AFIP/CLAE code) — unique within the list. */
186
+ code: string;
187
+ /** Human-readable label shown to the user. */
188
+ display_name: string;
189
+ }
190
+
191
+ /** STEP config for ECONOMIC_ACTIVITY_DECLARATION (`current_step.config`). */
192
+ export interface EconomicActivityStepConfig {
193
+ /** Selectable activities; always non-empty when the step is active. */
194
+ items?: EconomicActivityItem[];
195
+ }
196
+
197
+ /** STEP config for DOCUMENTS_OCR. */
198
+ export interface DocumentsOcrStepConfig {
199
+ country_allow?: string[];
200
+ capture_methods?: {
201
+ camera_scan?: boolean;
202
+ upload?: boolean;
203
+ };
204
+ /** Crop frame orientation for document camera capture. */
205
+ document_orientation?: DocumentOrientation;
206
+ /** [RN: ignored] Mirror preview in document camera. La cámara back de vision-camera no espeja y enviar JPEG espejado rompe Iris/OCR. */
207
+ mirror_document_video?: boolean;
208
+ }
209
+
210
+ /** STEP config for TERMS_AND_CONDITIONS. */
211
+ export interface TermsAndConditionsStepConfig {
212
+ terms?: Array<{ title?: string; url?: string }>;
213
+ }
214
+
215
+ /** Generic per-step runtime config map carried by session state and SSE. */
216
+ export type StepConfigMap = Partial<Record<OnboardingStep, Record<string, unknown>>>;
217
+
218
+ /**
219
+ * Request body for POST /sessions/:sessionId/documents-init.
220
+ * Allowed values are defined by the backend; the SDK currently sends a fixed type until
221
+ * the session exposes selectable document types.
222
+ */
223
+ export interface DocumentsInitRequest {
224
+ document_type: string;
225
+ }
226
+
227
+ /**
228
+ * Response from POST /sessions/:sessionId/documents-init.
229
+ * Backend returns signed upload URLs so the SDK can PUT each document side
230
+ * directly to storage (e.g. GCS) without routing bytes through the backend.
231
+ */
232
+ export interface DocumentsInitResponse {
233
+ /** Pre-signed URL to upload the front side. Use PUT with body = image, Content-Type: image/jpeg. */
234
+ front_side_upload_url: string;
235
+ /** Pre-signed URL to upload the back side. Use PUT with body = image, Content-Type: image/jpeg. */
236
+ back_side_upload_url: string;
237
+ /** Optional max file size in bytes; client may validate before uploading. */
238
+ max_file_size_bytes?: number;
239
+ }
240
+
241
+ // ─────────────────────────────────────────────────────────────────────────────
242
+ // ERROR TYPES
243
+ // ─────────────────────────────────────────────────────────────────────────────
244
+
245
+ /**
246
+ * Granular error codes for camera/hardware failures.
247
+ * Allows consumers to display localized, actionable messages to end-users.
248
+ */
249
+ export enum CameraErrorCode {
250
+ /** User explicitly denied camera access in the browser permission dialog. */
251
+ PERMISSION_DENIED = 'CAMERA_PERMISSION_DENIED',
252
+ /** No camera device was detected on the system. */
253
+ DEVICE_NOT_FOUND = 'CAMERA_DEVICE_NOT_FOUND',
254
+ /**
255
+ * The camera could not be opened for reading (often in use by another app,
256
+ * or blocked at the OS level). Maps to `NotReadableError` / `TrackStartError`.
257
+ */
258
+ DEVICE_NOT_READABLE = 'CAMERA_DEVICE_NOT_READABLE',
259
+ /**
260
+ * The page is served over HTTP (not HTTPS) in a production environment.
261
+ * `getUserMedia` is blocked by the browser's Secure Context policy.
262
+ */
263
+ INSECURE_CONTEXT = 'CAMERA_INSECURE_CONTEXT',
264
+ /**
265
+ * Browser policy blocked camera (e.g. cross-origin iframe without permission,
266
+ * or `Permissions-Policy` / Feature-Policy denying camera). Maps to `SecurityError`
267
+ * from `getUserMedia` — distinct from {@link INSECURE_CONTEXT} (non-HTTPS).
268
+ */
269
+ POLICY_BLOCKED = 'CAMERA_POLICY_BLOCKED',
270
+ /** The browser or WebView does not support the `getUserMedia` API. */
271
+ NOT_SUPPORTED = 'CAMERA_NOT_SUPPORTED',
272
+ /**
273
+ * Camera access is blocked by a WebView policy (common in in-app browsers
274
+ * on iOS/Android that restrict hardware access).
275
+ */
276
+ WEBVIEW_BLOCKED = 'CAMERA_WEBVIEW_BLOCKED',
277
+ /** The requested video constraints (resolution, facing mode) are not satisfiable. */
278
+ CONSTRAINT_ERROR = 'CAMERA_CONSTRAINT_ERROR',
279
+ /** An unclassified camera error occurred. Check `cause` for details. */
280
+ UNKNOWN = 'CAMERA_UNKNOWN_ERROR',
281
+ }
282
+
283
+ /**
284
+ * Top-level SDK error codes covering all failure scenarios in the onboarding flow.
285
+ */
286
+ export enum SdkErrorCode {
287
+ // ── Session ──────────────────────────────────────────────────────────────
288
+ /** The sessionToken was rejected by the backend (401/403). */
289
+ SESSION_INVALID = 'SESSION_INVALID',
290
+ /** The sessionToken has expired (typically a 401 after initial validation). */
291
+ SESSION_EXPIRED = 'SESSION_EXPIRED',
292
+ /** Could not fetch the initial session state from the backend. */
293
+ SESSION_FETCH_FAILED = 'SESSION_FETCH_FAILED',
294
+ /** Backend sent SESSION_DECLINED over SSE; session ended before completion. */
295
+ SESSION_DECLINED = 'SESSION_DECLINED',
296
+
297
+ // ── Modules ──────────────────────────────────────────────────────────────
298
+ /** FingerprintJS failed to generate the visitor ID. */
299
+ FINGERPRINT_FAILED = 'FINGERPRINT_FAILED',
300
+ /** One or more document images failed to upload successfully. */
301
+ DOCUMENT_UPLOAD_FAILED = 'DOCUMENT_UPLOAD_FAILED',
302
+ /** The liveness check did not pass or returned an unexpected result. */
303
+ LIVENESS_FAILED = 'LIVENESS_FAILED',
304
+ /** The Liveness module failed to initialize (e.g., could not create the Iris session). */
305
+ LIVENESS_INIT_FAILED = 'LIVENESS_INIT_FAILED',
306
+
307
+ // ── Camera ───────────────────────────────────────────────────────────────
308
+ /**
309
+ * A camera-related error occurred. Inspect `cameraCode` for the specific reason.
310
+ * @see CameraErrorCode
311
+ */
312
+ CAMERA_ERROR = 'CAMERA_ERROR',
313
+
314
+ // ── Network & API ────────────────────────────────────────────────────────
315
+ /** A network-level failure (no internet, CORS, DNS). */
316
+ NETWORK_ERROR = 'NETWORK_ERROR',
317
+ /** The backend returned a non-2xx HTTP status. */
318
+ API_ERROR = 'API_ERROR',
319
+
320
+ // ── Configuration ────────────────────────────────────────────────────────
321
+ /** The `containerId` provided in the config does not exist in the DOM. */
322
+ CONTAINER_NOT_FOUND = 'CONTAINER_NOT_FOUND',
323
+ /** `start()` was called on an SDK instance that is already running. */
324
+ ALREADY_STARTED = 'ALREADY_STARTED',
325
+ /** `start()` was called after `destroy()`. The instance is no longer usable. */
326
+ INSTANCE_DESTROYED = 'INSTANCE_DESTROYED',
327
+
328
+ /**
329
+ * The page is running inside an iframe and embedding was not explicitly allowed.
330
+ * Configure Content-Security-Policy: frame-ancestors or X-Frame-Options on the
331
+ * page that hosts the SDK, or set allowEmbedded: true if embedding is intentional.
332
+ */
333
+ INSECURE_EMBED = 'INSECURE_EMBED',
334
+
335
+ /**
336
+ * The CDN-served manifest could not be downloaded or its Ed25519 signature did
337
+ * not verify against the loader's embedded public key. The loader refuses to
338
+ * mount the iframe to prevent execution of tampered/unsigned bundles.
339
+ */
340
+ INTEGRITY_FAILED = 'INTEGRITY_FAILED',
341
+
342
+ UNKNOWN = 'UNKNOWN',
343
+ }
344
+
345
+ /**
346
+ * A structured, machine-readable error object emitted by the SDK.
347
+ *
348
+ * @example
349
+ * ```typescript
350
+ * const sdk = new VelionOnboarding({
351
+ * onError: (err) => {
352
+ * if (err.code === SdkErrorCode.CAMERA_ERROR &&
353
+ * err.cameraCode === CameraErrorCode.PERMISSION_DENIED) {
354
+ * showCameraPermissionDialog();
355
+ * }
356
+ * }
357
+ * });
358
+ * ```
359
+ */
360
+ export interface SdkError {
361
+ /** Primary SDK-level error classification. */
362
+ readonly code: SdkErrorCode;
363
+ /** Human-readable English description for developer logging. */
364
+ readonly message: string;
365
+ /** Present when `code === SdkErrorCode.SESSION_DECLINED` (SSE `reason`). */
366
+ readonly declineReason?: string;
367
+ /** Present when `code === SdkErrorCode.SESSION_DECLINED` (SSE `step_code`). */
368
+ readonly stepCode?: string;
369
+ /**
370
+ * Localized headline resolved by the SDK for SESSION_DECLINED.
371
+ * Useful when hosts hide the built-in final result screen but still want
372
+ * the same user-facing text in custom UI.
373
+ */
374
+ readonly declineTitle?: string;
375
+ /**
376
+ * Localized body message resolved by the SDK for SESSION_DECLINED.
377
+ * Mirrors the text shown in the built-in final result screen.
378
+ */
379
+ readonly declineMessage?: string;
380
+ /** Present when `code === SdkErrorCode.CAMERA_ERROR`. Provides camera-specific detail. */
381
+ readonly cameraCode?: CameraErrorCode;
382
+ /** HTTP status code when the error originated from an API call. */
383
+ readonly httpStatus?: number;
384
+ /**
385
+ * The original caught value for debugging.
386
+ * Not guaranteed to be an `Error` instance — could be a DOMException or string.
387
+ */
388
+ readonly cause?: unknown;
389
+ }
390
+
391
+ // ─────────────────────────────────────────────────────────────────────────────
392
+ // THEMING
393
+ // ─────────────────────────────────────────────────────────────────────────────
394
+
395
+ /**
396
+ * White-labeling theme configuration.
397
+ * Each property maps to a CSS custom property injected on the SDK container,
398
+ * making all SDK UI elements styleable via `--vl-*` variables.
399
+ *
400
+ * @example
401
+ * ```typescript
402
+ * const theme: VelionTheme = {
403
+ * primaryColor: '#0052CC', // → --vl-primary-color
404
+ * borderRadius: '12px', // → --vl-border-radius
405
+ * fontFamily: 'Inter, sans-serif'// → --vl-font-family
406
+ * };
407
+ * ```
408
+ */
409
+ export interface VelionTheme {
410
+ /** Primary brand color. Used for buttons, progress indicators, and accents. */
411
+ primaryColor?: string;
412
+ /** Secondary color. Used for hover states and secondary actions. */
413
+ secondaryColor?: string;
414
+ /** Background color of the SDK container. */
415
+ backgroundColor?: string;
416
+ /** Main body text color. */
417
+ textColor?: string;
418
+ /** Secondary text color for subtitles, captions, and de-emphasized copy. */
419
+ textSecondaryColor?: string;
420
+ /** Border radius for cards, buttons, and inputs. */
421
+ borderRadius?: string;
422
+ /** Font family string. Must be available in the host page's CSS context. */
423
+ fontFamily?: string;
424
+ /** Color used for error states and destructive actions. */
425
+ errorColor?: string;
426
+ /** Color used for success confirmations. */
427
+ successColor?: string;
428
+ /** Color used for warnings and informational alerts. */
429
+ warningColor?: string;
430
+ /** Border color for input fields and separators. */
431
+ borderColor?: string;
432
+ /** Box shadow definition for elevated elements (cards, modals). */
433
+ cardShadow?: string;
434
+ /**
435
+ * When true, the SDK omits the round colored icon next to each step's
436
+ * title — only the title + subtitle are rendered. Useful for hosts that
437
+ * prefer a denser, all-text layout.
438
+ *
439
+ * @default false
440
+ */
441
+ hideStepIcons?: boolean;
442
+ /**
443
+ * When true, the sticky top progress bar is hidden across the whole flow.
444
+ * Equivalent to setting `VelionConfig.showProgressBar = false` — both
445
+ * paths are honored, so hosts can pick either depending on whether they
446
+ * model the choice as configuration (lifecycle) or theming (visual).
447
+ *
448
+ * @default false
449
+ */
450
+ hideProgressBar?: boolean;
451
+ }
452
+
453
+ /**
454
+ * Optional title and body for one terminal verdict on the final result screen.
455
+ */
456
+ export interface VelionFinalResultStatusCopy {
457
+ title?: string;
458
+ message?: string;
459
+ }
460
+
461
+ /**
462
+ * Configurable copy for the built-in final result screen (`showFinalResultScreen`).
463
+ * Omitted fields fall back to SDK defaults for the active `locale`.
464
+ */
465
+ export interface VelionFinalResultScreenTexts {
466
+ approved?: VelionFinalResultStatusCopy;
467
+ manualReview?: VelionFinalResultStatusCopy;
468
+ rejected?: VelionFinalResultStatusCopy;
469
+ /** Copy when {@link OnboardingResult.status} is `DECLINED`. */
470
+ declined?: VelionFinalResultStatusCopy;
471
+ /** Primary button label (e.g. "Entendido" / "Got it"). */
472
+ dismissLabel?: string;
473
+ }
474
+
475
+ /**
476
+ * Localized title/body for one `reason` on the SESSION_DECLINED screen.
477
+ * Keys match backend `reason` (e.g. `TAX_INFO_FAILED`).
478
+ */
479
+ export interface VelionSessionDeclinedReasonMessages {
480
+ en?: VelionFinalResultStatusCopy;
481
+ es?: VelionFinalResultStatusCopy;
482
+ }
483
+
484
+ /**
485
+ * Per-reason overrides for the built-in SESSION_DECLINED screen (`showFinalResultScreen` not false).
486
+ * Unspecified reasons fall back to SDK defaults when available, then generic copy.
487
+ */
488
+ export type VelionSessionDeclinedReasonTexts = Record<
489
+ string,
490
+ VelionSessionDeclinedReasonMessages
491
+ >;
492
+
493
+ /**
494
+ * Per-step overrides for the retry dialog shown when the backend emits a
495
+ * `ROUTING_COMMAND / RETRY_STEP` (the step failed but the retry quota is not
496
+ * exhausted). Keyed by step code (e.g. `LIVENESS_MATCH`, `DOCUMENTS_OCR`).
497
+ * Unspecified steps fall back to SDK per-step defaults, then generic copy.
498
+ *
499
+ * Note: the SDK intentionally ignores the backend `reason` for this dialog —
500
+ * it is a diagnostic string (e.g. `"STEP_FAILED_RETRY_ALLOWED (attempt 1/3)"`),
501
+ * not user-facing localized copy. The copy is derived from the step instead.
502
+ */
503
+ export type VelionRetryStepTexts = Record<
504
+ string,
505
+ VelionSessionDeclinedReasonMessages
506
+ >;
507
+
508
+ // ─────────────────────────────────────────────────────────────────────────────
509
+ // CALLBACKS
510
+ // ─────────────────────────────────────────────────────────────────────────────
511
+
512
+ /**
513
+ * The complete set of lifecycle callbacks the host application can subscribe to.
514
+ * All callbacks are optional. The SDK is still functional without any of them,
515
+ * but `onError` and `onSuccess` are strongly recommended for production.
516
+ */
517
+ export interface VelionCallbacks {
518
+ /**
519
+ * Fires when the entire onboarding flow has been completed successfully
520
+ * and the backend has confirmed the session as resolved.
521
+ *
522
+ * @param result - Final onboarding verdict from the backend.
523
+ */
524
+ onSuccess?: (result: OnboardingResult) => void;
525
+
526
+ /**
527
+ * Fires when an unrecoverable error terminates the onboarding flow.
528
+ * Any terminal failure (camera error, document capture failure, upload failure,
529
+ * liveness failure, API error, etc.) is delivered here so the host can notify the user.
530
+ * After this callback, the SDK instance is in an error state.
531
+ * Call `sdk.destroy()` and re-instantiate to retry.
532
+ *
533
+ * @param error - Structured error with a machine-readable code (e.g. CAMERA_ERROR, DOCUMENT_UPLOAD_FAILED).
534
+ */
535
+ onError?: (error: SdkError) => void;
536
+
537
+ /**
538
+ * Fires each time the active step changes during the flow.
539
+ * Useful for updating a custom step indicator in the host UI.
540
+ *
541
+ * The required step list is resolved dynamically by the backend, so the SDK
542
+ * does not know the total step count up front. Callers that need a progress
543
+ * indicator should rely on the SDK's built-in progress bar (or the trickling
544
+ * counter in `stepIndex`).
545
+ *
546
+ * @param step - The step that just became active.
547
+ * @param stepIndex - Zero-based index of the current step.
548
+ */
549
+ onStepChange?: (step: OnboardingStep, stepIndex: number) => void;
550
+
551
+ /**
552
+ * Fires immediately after a step succeeds, before advancing to the next one.
553
+ * Useful for analytics or triggering intermediate UI transitions.
554
+ *
555
+ * @param step - The step that was just completed.
556
+ */
557
+ onStepComplete?: (step: OnboardingStep) => void;
558
+
559
+ /**
560
+ * Fires for each SSE event from GET /sessions/:sessionId/events
561
+ * (e.g. STEP_UPDATED, SESSION_APPROVED).
562
+ */
563
+ onSessionEvent?: (event: OnboardingSessionEvent) => void;
564
+
565
+ /**
566
+ * Called when the user taps the dismiss control on the final result screen
567
+ * (only when the final result screen is shown). `onSuccess` has already run.
568
+ */
569
+ onFinalResultScreenDismiss?: () => void;
570
+
571
+ /**
572
+ * Fires when the user leaves the flow without a verdict — either by tapping
573
+ * "back" on the first reversible step (`BACK_EXIT`) or "Cancel" on the retry
574
+ * dialog after a `RETRY_STEP` (`RETRY_CANCELLED`). The SDK has already torn
575
+ * down its UI; the host should dismiss the SDK screen and return the user to
576
+ * the previous context. Neither `onSuccess` nor `onError` fires in this case.
577
+ *
578
+ * @param exit - Why the flow ended and, when available, the step exited from.
579
+ */
580
+ onExit?: (exit: OnboardingExit) => void;
581
+
582
+ /**
583
+ * Fires when the LIVENESS_MATCH step successfully uploaded the recorded
584
+ * session video to the onboarding storage (GCS PUT returned 200). Best-effort:
585
+ * if the upload failed or the session had no `video_upload` URL, the
586
+ * callback is not invoked — liveness still completes normally.
587
+ *
588
+ * @param ref - URL and metadata of the uploaded video.
589
+ */
590
+ onLivenessVideoUploaded?: (ref: LivenessVideoRef) => void;
591
+ }
592
+
593
+ // ─────────────────────────────────────────────────────────────────────────────
594
+ // MAIN CONFIGURATION
595
+ // ─────────────────────────────────────────────────────────────────────────────
596
+
597
+ /**
598
+ * Root configuration object for the `VelionOnboarding` class.
599
+ *
600
+ * @example
601
+ * ```typescript
602
+ * const sdk = new VelionOnboarding({
603
+ * containerId: 'velion-root',
604
+ * sessionId: 'ses_abc123',
605
+ * sessionToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',
606
+ * apiUrl: 'https://api.velion.la/v1',
607
+ * theme: { primaryColor: '#0052CC' },
608
+ * onSuccess: (result) => console.log('Done!', result),
609
+ * onError: (err) => console.error('SDK Error:', err),
610
+ * });
611
+ *
612
+ * await sdk.start();
613
+ * ```
614
+ */
615
+ export interface VelionConfig extends VelionCallbacks {
616
+ /**
617
+ * The `id` of an existing DOM element where the SDK will render its UI.
618
+ * The element **must** be present in the document at the time `start()` is called.
619
+ *
620
+ * @example `'velion-kyc-container'`
621
+ */
622
+ containerId: string;
623
+
624
+ /**
625
+ * The unique session identifier generated by your backend for this
626
+ * onboarding session. Used to scope all API calls.
627
+ *
628
+ * @example `'ses_9f8d7c6b5a4e3f2d'`
629
+ */
630
+ sessionId: string;
631
+
632
+ /**
633
+ * A short-lived, opaque authorization token (e.g. HS256 JWT) issued by your
634
+ * backend when creating the session. Sent as `Authorization: Bearer <sessionToken>`
635
+ * on every SDK request. Required for all endpoints behind the gateway.
636
+ *
637
+ * **Security note:** This token is held in memory only (never in localStorage
638
+ * or cookies) and is automatically discarded on `destroy()`.
639
+ */
640
+ sessionToken: string;
641
+
642
+ /**
643
+ * ISO-8601 expiry timestamp of the sessionToken. If provided, the SDK may
644
+ * check expiration before requests and emit SESSION_EXPIRED without a round-trip.
645
+ * When the backend returns 401/403, the SDK emits SESSION_EXPIRED anyway.
646
+ */
647
+ expiresAt?: string;
648
+
649
+ /**
650
+ * Base URL of the Velion onboarding edge. Must **not** include a trailing slash.
651
+ * SDK paths are relative to this (e.g. GET `/sessions/{sessionId}`).
652
+ *
653
+ * Defaults to the public production edge `https://sdk.velion.la/onboarding`.
654
+ * Override only for staging or self-hosted environments.
655
+ */
656
+ apiUrl?: string;
657
+
658
+ /**
659
+ * Optional white-labeling theme. If omitted, SDK renders with Velion defaults.
660
+ */
661
+ theme?: VelionTheme;
662
+
663
+ /**
664
+ * Global visual mode for SDK overlays and controls.
665
+ * - `'light'`: Light translucent surfaces.
666
+ * - `'dark'`: Dark translucent surfaces.
667
+ *
668
+ * @default 'light'
669
+ */
670
+ colorMode?: 'light' | 'dark';
671
+
672
+ /**
673
+ * BCP 47 locale tag for SDK UI copy (labels, instructions, error messages).
674
+ *
675
+ * @default 'es'
676
+ */
677
+ locale?: string;
678
+
679
+ /**
680
+ * When `true`, after the backend returns a terminal verdict the SDK shows a
681
+ * full-screen summary (APPROVED, MANUAL_REVIEW, REJECTED) inside the container,
682
+ * styled with `theme` and `colorMode`. `onSuccess` still fires with the result.
683
+ *
684
+ * @default true
685
+ */
686
+ showFinalResultScreen?: boolean;
687
+
688
+ /**
689
+ * When `true` (default), the SDK renders a thin progress bar at the top of
690
+ * the container that advances as the user moves through steps. Disable for
691
+ * embedded experiences that already provide their own progress UI.
692
+ *
693
+ * @default true
694
+ */
695
+ showProgressBar?: boolean;
696
+
697
+ /**
698
+ * Overrides for default titles, messages, and dismiss button on the final result screen.
699
+ * Only used when the final result screen is shown (`showFinalResultScreen` is not `false`).
700
+ */
701
+ finalResultScreenTexts?: VelionFinalResultScreenTexts;
702
+
703
+ /**
704
+ * Optional copy for SESSION_DECLINED SSE screens, keyed by backend `reason`.
705
+ * Merged with SDK defaults (e.g. `TAX_INFO_FAILED`) for `locale` `en` / `es`.
706
+ */
707
+ sessionDeclinedReasonTexts?: VelionSessionDeclinedReasonTexts;
708
+
709
+ /**
710
+ * Optional copy for the retry dialog (`ROUTING_COMMAND / RETRY_STEP`), keyed by
711
+ * step code (e.g. `LIVENESS_MATCH`). Merged with SDK per-step defaults for
712
+ * `locale` `en` / `es`; unspecified steps fall back to generic retry copy.
713
+ */
714
+ retryStepTexts?: VelionRetryStepTexts;
715
+
716
+ /**
717
+ * When `true` (default), shows the Velion preparation screen (face icon, tips,
718
+ * "Start verification") before connecting to Iris. When `false`, skips it and
719
+ * starts the camera + Iris session immediately on step entry.
720
+ *
721
+ * @default true
722
+ */
723
+ livenessShowIntro?: boolean;
724
+
725
+ /**
726
+ * When `false`, hides the "Atrás" / "Back" button on the liveness preparation
727
+ * screen. The button is only present in the intro; once the camera capture
728
+ * begins the user must complete the Iris challenges to leave the step.
729
+ *
730
+ * @default true
731
+ */
732
+ livenessShowBackButton?: boolean;
733
+
734
+ /**
735
+ * If true, allows the SDK to run when the page is inside an iframe.
736
+ * Only set to true if you have configured Content-Security-Policy: frame-ancestors
737
+ * or X-Frame-Options on the HTTP response of the page that hosts the SDK.
738
+ * If false (default) and the page is embedded in an iframe, the SDK emits
739
+ * INSECURE_EMBED and does not start.
740
+ *
741
+ * @default false
742
+ */
743
+ allowEmbedded?: boolean;
744
+
745
+ /**
746
+ * Internal — set by the Velion CDN entry (`cdn-main.ts`) to the `event.origin`
747
+ * captured from the loader's first VELION_INIT message. The SDK validates it
748
+ * against `allowed_parent_origins` returned by the backend and refuses to start
749
+ * if the origin is not in the customer's registered allowlist.
750
+ *
751
+ * Direct integrators (running VelionOnboarding without the loader iframe)
752
+ * should leave this unset.
753
+ *
754
+ * @internal
755
+ */
756
+ iframeParentOrigin?: string;
757
+
758
+ /**
759
+ * Fingerprint Pro API endpoint (custom subdomain). Used by the DEVICE_FINGERPRINT
760
+ * step to load and identify visitors. Only set this when using a custom Fingerprint
761
+ * subdomain or proxy; otherwise the default Velion endpoint is used.
762
+ *
763
+ * @default 'https://fp.velion.la'
764
+ */
765
+ fingerprintEndpoint?: string;
766
+
767
+ /**
768
+ * Override the public Fingerprint Pro API key used by the DEVICE_FINGERPRINT step.
769
+ * Useful if the integrator has its own Fingerprint workspace and bundle-ID
770
+ * authorisation. When omitted, the SDK uses Velion's shared public key.
771
+ */
772
+ fingerprintApiKey?: string;
773
+
774
+ /**
775
+ * Hard ceiling for the Fingerprint identify call (ms). The native SDK has its
776
+ * own internal timeout which on iOS occasionally hangs past the documented
777
+ * limit; the SDK races against this value to guarantee a clean failure path.
778
+ *
779
+ * @default 15000
780
+ */
781
+ fingerprintTimeoutMs?: number;
782
+
783
+ /**
784
+ * Google Maps Platform API key (Maps JavaScript API + Places). Required for the
785
+ * {@code ADDRESS_INFO} step to show the map, search, and geocoding. Omit only if
786
+ * your flow never reaches that step.
787
+ */
788
+ googleMapsApiKey?: string;
789
+
790
+ /**
791
+ * Optional calibration tag forwarded to Iris for the LIVENESS_MATCH step.
792
+ * When the Iris worker is running with `CALIBRATION_BACKEND=fs|gcs`, every
793
+ * frame of this session is mirrored to the dataset bucket with the tag in
794
+ * `metadata.json`, so we can build labeled training sets for the spoof /
795
+ * liveness models. Does NOT affect the score.
796
+ *
797
+ * Suggested values (must match the worker's known labels — see
798
+ * `iris-worker` README): `REAL_GOOD_LIGHT`, `REAL_BAD_LIGHT`, `REAL_BACKLIT`,
799
+ * `REAL_BUSY_BG`, `REAL_NEUTRAL_BG`, `REAL_GLASSES`, `REAL_OUTDOOR`,
800
+ * `FAKE_PHONE_PHOTO`, `FAKE_PHONE_VIDEO`, `FAKE_TABLET_VIDEO`,
801
+ * `FAKE_MONITOR_VIDEO`, `FAKE_PRINT`, `FAKE_MASK`, `UNKNOWN`, `EDGE_CASE`.
802
+ *
803
+ * Leave undefined for normal user-facing sessions.
804
+ */
805
+ livenessCalibrationLabel?: string;
806
+
807
+ /**
808
+ * When true, the SDK enables verbose `console.info` logging at runtime even in
809
+ * production builds. Useful when reproducing customer issues. Independent of the
810
+ * build-time `__DEBUG__` flag, which already gates dev-server logs.
811
+ *
812
+ * @default false
813
+ */
814
+ debug?: boolean;
815
+ }
816
+
817
+ // ─────────────────────────────────────────────────────────────────────────────
818
+ // BACKEND RESPONSE SHAPES
819
+ // ─────────────────────────────────────────────────────────────────────────────
820
+
821
+ /**
822
+ * Backend step DTO (OnboardingStepDto). GET session returns an array of these.
823
+ */
824
+ export interface OnboardingStepDto {
825
+ code: string;
826
+ name?: string;
827
+ description?: string;
828
+ order?: number;
829
+ status?: string;
830
+ required?: boolean;
831
+ /** Step-specific payload (e.g. OCR fields, fingerprint, T&amp;C items). */
832
+ result?: Record<string, unknown>;
833
+ /**
834
+ * Whether the user may navigate back into this step after completing it.
835
+ * Resolved by the backend (step-type default merged with the workflow
836
+ * override) and surfaced as a first-class flag so the SDK can decide whether
837
+ * to render the "back" (chevron) control. The SDK never hardcodes the
838
+ * reversibility list — it obeys this flag verbatim.
839
+ */
840
+ reversible?: boolean;
841
+ }
842
+
843
+ /**
844
+ * Backend session/onboarding DTO (OnboardingDto). Returned by GET /sessions/:sessionId.
845
+ * The SDK maps this to SessionState for the step machine.
846
+ */
847
+ export interface OnboardingDtoResponse {
848
+ id?: string;
849
+ related_id?: string;
850
+ onboarding_type?: string;
851
+ status?: string;
852
+ current_step?: {
853
+ code?: string;
854
+ status?: string;
855
+ config?: Record<string, unknown>;
856
+ /** When `true`, the SDK renders the "back" control for this step. */
857
+ reversible?: boolean;
858
+ /**
859
+ * Previously-captured data for the current step (present after a reverse
860
+ * navigation re-opens a completed step). Used as prefill so the form
861
+ * re-renders with the user's earlier answers.
862
+ */
863
+ result?: Record<string, unknown>;
864
+ };
865
+ steps?: OnboardingStepDto[];
866
+ created_at?: string;
867
+ updated_at?: string;
868
+ completed_at?: string;
869
+ metadata?: Record<string, unknown>;
870
+ /**
871
+ * Whether the user can navigate back from `current_step`. Computed server-side
872
+ * from the workflow graph: `true` when there is a previous reversible step to
873
+ * re-open, OR when the current step is the first reversible step (back exits
874
+ * the flow via `BACK_EXIT`). The SDK uses **this** — not a step's intrinsic
875
+ * `reversible` flag — to decide whether to render the "back" control.
876
+ */
877
+ can_go_back?: boolean;
878
+ /**
879
+ * Origins (scheme + host + port) authorized by the customer to embed the SDK.
880
+ * The iframe validates `event.origin` of the loader's first VELION_INIT against
881
+ * this list and aborts with INSECURE_EMBED otherwise. Backend must also enforce
882
+ * server-side via the `Origin` header on every API call.
883
+ */
884
+ allowed_parent_origins?: string[];
885
+ }
886
+
887
+ /**
888
+ * Session state used by the SDK step machine. Derived from GET /sessions/:sessionId
889
+ * (OnboardingDto): steps sorted by order → requiredSteps, first non-completed index → currentStepIndex.
890
+ */
891
+ export interface SessionState {
892
+ /** Current runnable step reported by backend session state. */
893
+ currentStep?: OnboardingStep;
894
+ /** Step-specific config for `currentStep` from GET /sessions/:id `current_step.config`. */
895
+ currentStepConfig?: Record<string, unknown>;
896
+ /**
897
+ * Whether the SDK should render the "back" control on `currentStep`. Sourced
898
+ * from GET `can_go_back` (workflow-graph computed). When absent (e.g. reached
899
+ * via SSE), the orchestrator derives it from {@link stepReversibility}.
900
+ */
901
+ canGoBack?: boolean;
902
+ /**
903
+ * Per-step reversibility in workflow order, cached at session load so the
904
+ * orchestrator can derive `can_go_back` for steps reached via SSE (which does
905
+ * not carry the flag): a step can go back when any earlier step is reversible
906
+ * or the step itself is the first reversible one (back exits).
907
+ */
908
+ stepReversibility?: Array<{ code: OnboardingStep; reversible: boolean }>;
909
+ /**
910
+ * Previously-captured data for `currentStep`, used as form prefill after a
911
+ * reverse navigation re-opens a completed step. Sourced from GET
912
+ * `current_step.result`.
913
+ */
914
+ currentStepResult?: Record<string, unknown>;
915
+ /** Cached configs discovered from GET session and SSE `step_config`. */
916
+ stepConfigs?: StepConfigMap;
917
+ /** Session type (HUMAN or LEGAL). Constrains which steps are applicable. */
918
+ onboardingType?: OnboardingType;
919
+ /** Arbitrary session metadata the backend may attach. */
920
+ metadata?: Record<string, unknown>;
921
+ /**
922
+ * Customer-registered allowlist of origins authorized to embed the SDK.
923
+ * When provided, the SDK validates the loader's parent origin against this list.
924
+ */
925
+ allowedParentOrigins?: string[];
926
+ }
927
+
928
+ /**
929
+ * Emitted when the user leaves the onboarding flow without a backend verdict.
930
+ *
931
+ * Triggers:
932
+ * - `BACK_EXIT`: the user tapped "back" on the first reversible step, where
933
+ * there is no earlier step to return to, so the backend instructs the SDK to
934
+ * exit.
935
+ * - `RETRY_CANCELLED`: the user tapped "Cancel" on the retry dialog shown after
936
+ * a `ROUTING_COMMAND / RETRY_STEP`. The backend session stays `IN_PROGRESS`
937
+ * (there is no cancellation endpoint); the host may re-open it later via
938
+ * `GET /sessions/:id`.
939
+ *
940
+ * This is neither success nor error — the host should dismiss the SDK screen and
941
+ * return the user to wherever they came from. See {@link VelionCallbacks.onExit}.
942
+ */
943
+ export interface OnboardingExit {
944
+ /** Why the flow ended without a verdict. */
945
+ reason: 'BACK_EXIT' | 'RETRY_CANCELLED';
946
+ /** The step the user exited from (SSE `step_code`), when the backend provides it. */
947
+ step?: OnboardingStep;
948
+ }
949
+
950
+ /**
951
+ * A single T&amp;C line item (matches backend TermsAndConditionsItemDto / domain record).
952
+ */
953
+ export interface TermsAndConditionsItem {
954
+ id: string;
955
+ description: string;
956
+ /** Optional URL to the full document. */
957
+ link?: string;
958
+ }
959
+
960
+ /**
961
+ * Response from session creation (POST from your backend). Use sessionId and
962
+ * sessionToken when instantiating VelionOnboarding; pass expiresAt for optional
963
+ * client-side expiration checks.
964
+ */
965
+ export interface SessionCreationResponse {
966
+ session_id: string;
967
+ session_token: string;
968
+ expires_at: string;
969
+ status?: string;
970
+ }
971
+
972
+ /**
973
+ * Shape of the final result returned by `GET /sessions/:sessionId/result`
974
+ * once all steps are complete.
975
+ */
976
+ export interface OnboardingResult {
977
+ /** The session ID that was completed. Matches `VelionConfig.sessionId`. */
978
+ sessionId: string;
979
+ /** ISO 8601 timestamp of when the backend finalized the session. */
980
+ completedAt: string;
981
+ /**
982
+ * The final KYC verdict.
983
+ * - `APPROVED`: All checks passed automatically.
984
+ * - `MANUAL_REVIEW`: Flagged for human review (common in AML flows). Backend `IN_REVIEW` maps here.
985
+ * - `REJECTED`: Automatically rejected (fraud signals, liveness failure, etc.).
986
+ * - `DECLINED`: Session ended in a declined state (matches GET session `status: DECLINED`).
987
+ */
988
+ status: 'APPROVED' | 'MANUAL_REVIEW' | 'REJECTED' | 'DECLINED';
989
+ /** An optional tracking reference for support and audit trails. */
990
+ referenceId?: string;
991
+ /**
992
+ * When the terminal outcome came from SSE, optional backend `reason` (e.g.
993
+ * `LIVENESS_SCORE_IN_REVIEW_RANGE` on SESSION_MANUAL_REVIEW) for localized final-screen copy.
994
+ */
995
+ terminalReason?: string;
996
+ }
997
+
998
+ /**
999
+ * Response from `POST /sessions/:sessionId/liveness-init`.
1000
+ * The backend returns the Iris session details the SDK needs to open the WebSocket
1001
+ * and stream frames. Credentials are not used: Iris owns the session lifecycle.
1002
+ */
1003
+ export interface LivenessSessionResponse {
1004
+ /** Iris session identifier. */
1005
+ liveness_session_id?: string;
1006
+ /** Full WebSocket URL the SDK must connect to (e.g. wss://iris.host/ws/iris/{id}). */
1007
+ websocket_url?: string;
1008
+ /** ISO-8601 expiry of the Iris session. */
1009
+ expires_at?: string;
1010
+ /** Effective Iris challenge identifiers in order (TURN_LEFT, SMILE, …). */
1011
+ challenges?: string[];
1012
+ /** Optional JWT for the WebSocket handshake when Iris auth is enabled. */
1013
+ connection_token?: string;
1014
+ /**
1015
+ * Optional base64 HMAC-SHA256 key. When present, the SDK signs every JPEG
1016
+ * frame in a JSON envelope (canonical line: `sessionId\nframeId\nts\nsha256hex(jpeg)`).
1017
+ */
1018
+ frame_integrity_key_base64?: string;
1019
+ /**
1020
+ * Signed PUT URL the SDK uses to upload the locally-recorded liveness video
1021
+ * directly to the onboarding GCS bucket. `null` when video recording is
1022
+ * disabled or the signing failed — the SDK should skip the upload silently
1023
+ * (liveness still works without the video; only the back-office loses the
1024
+ * playback evidence).
1025
+ */
1026
+ video_upload?: VideoUpload | null;
1027
+ }
1028
+
1029
+ /**
1030
+ * Signed-upload payload returned by `POST /liveness-init`. Mirrors the backend
1031
+ * `LivenessInitResponseDto.VideoUpload`. The SDK PUTs the recorded mp4 bytes
1032
+ * to `upload_url` (Content-Type matching `video/mp4`) before calling
1033
+ * `POST /liveness-verify` with the resulting metadata.
1034
+ */
1035
+ export interface VideoUpload {
1036
+ /** Absolute https://storage.googleapis.com/... URL with V4 signature params. */
1037
+ upload_url: string;
1038
+ /** ISO-8601 instant after which GCS rejects the signature. */
1039
+ expires_at: string;
1040
+ /** HTTP method to use. Always `"PUT"` today; future-proofing. */
1041
+ method: 'PUT' | string;
1042
+ }
1043
+
1044
+ /**
1045
+ * Optional body of `POST /liveness-verify`. The SDK only includes it when the
1046
+ * recorded video uploaded successfully (HTTP 200 from GCS). When omitted, the
1047
+ * backend completes liveness based on the Iris score only.
1048
+ */
1049
+ export interface LivenessVerifyVideoMeta {
1050
+ /** MIME type that was sent in the PUT `Content-Type` header. */
1051
+ content_type: string;
1052
+ /** Recorded video duration in milliseconds, or `null` if vision-camera did not report it. */
1053
+ duration_ms: number | null;
1054
+ }
1055
+
1056
+ /**
1057
+ * Payload delivered to the optional `onLivenessVideoUploaded` callback after a
1058
+ * successful upload of the liveness video. Best-effort: the callback only
1059
+ * fires when the GCS PUT returned 200.
1060
+ */
1061
+ export interface LivenessVideoRef {
1062
+ /** Signed `upload_url` the SDK PUT the video to (without the signature query). */
1063
+ upload_url: string;
1064
+ /** MIME type used in the PUT. */
1065
+ content_type: string;
1066
+ /** Recorded video duration in milliseconds, or `null` when unknown. */
1067
+ duration_ms: number | null;
1068
+ /** Recorded file size in bytes, or `null` when unknown. */
1069
+ size_bytes: number | null;
1070
+ }
1071
+
1072
+ /**
1073
+ * Payload for POST /sessions/:sessionId/basic-info/human (HUMAN_BASIC_INFO step).
1074
+ * Matches backend SubmitHumanBasicInfoRequestDto (snake_case in JSON).
1075
+ */
1076
+ export interface HumanBasicInfoPayload {
1077
+ first_name: string;
1078
+ middle_name?: string;
1079
+ last_name: string;
1080
+ second_last_name?: string;
1081
+ identification_type: string;
1082
+ identification_id: string;
1083
+ }
1084
+
1085
+ /**
1086
+ * Payload for POST /sessions/:sessionId/basic-info/legal (LEGAL_BASIC_INFO step).
1087
+ * Matches backend SubmitLegalBasicInfoRequestDto (snake_case in JSON).
1088
+ */
1089
+ export interface LegalBasicInfoPayload {
1090
+ legal_name: string;
1091
+ legal_form: string;
1092
+ identification_type: string;
1093
+ identification_id: string;
1094
+ }
1095
+
1096
+ /**
1097
+ * Single selectable option for tax category or fiscal identifier type (TAX_INFO step).
1098
+ * `id` is submitted to the API; `description` is the user-visible label.
1099
+ */
1100
+ export interface TaxInfoOption {
1101
+ id: string;
1102
+ description: string;
1103
+ }
1104
+
1105
+ /**
1106
+ * Resolved selectable lists for the TAX_INFO step UI (from `accepted_tax_information` only; no SDK defaults).
1107
+ */
1108
+ export interface TaxInfoConfig {
1109
+ /**
1110
+ * Fiscal regime / category options (e.g. Monotributo). The chosen `id` is sent as `taxpayer_type`.
1111
+ */
1112
+ taxpayerCategories: TaxInfoOption[];
1113
+ /**
1114
+ * Tax identification scheme options (e.g. CUIT). The chosen `id` is sent as `taxpayer_id_type`.
1115
+ */
1116
+ fiscalIdentifierTypes: TaxInfoOption[];
1117
+ }
1118
+
1119
+ /** POST /sessions/:id/tax-info — SubmitTaxInfoRequestDto. */
1120
+ export interface TaxInfoPayload {
1121
+ /** Selected fiscal category value (`code` from step config `taxpayer_categories`). */
1122
+ taxpayer_type: string;
1123
+ /** Selected fiscal identifier kind id (e.g. `CUIT` from step config `identification_types`). */
1124
+ taxpayer_id_type: string;
1125
+ /** Tax identification number for the chosen type. */
1126
+ taxpayer_id: string;
1127
+ }
1128
+
1129
+ /** POST /sessions/:id/extended-info/human — SubmitHumanExtendedInfoRequestDto. */
1130
+ export interface HumanExtendedInfoPayload {
1131
+ gender?: string;
1132
+ civil_status?: string;
1133
+ birth_date?: string;
1134
+ birth_country?: string;
1135
+ citizenship?: string;
1136
+ residence_country?: string;
1137
+ }
1138
+
1139
+ /** POST /sessions/:id/extended-info/legal — SubmitLegalExtendedInfoRequestDto. */
1140
+ export interface LegalExtendedInfoPayload {
1141
+ incorporation_date: string;
1142
+ incorporation_country: string;
1143
+ }
1144
+
1145
+ /** POST /sessions/:id/address-info — SubmitAddressInfoRequestDto. */
1146
+ export interface AddressInfoPayload {
1147
+ type: string;
1148
+ country: string;
1149
+ state: string;
1150
+ city: string;
1151
+ district?: string;
1152
+ neighborhood?: string;
1153
+ street: string;
1154
+ number: string;
1155
+ floor?: string;
1156
+ apartment?: string;
1157
+ details?: string;
1158
+ zip_code: string;
1159
+ latitude?: number;
1160
+ longitude?: number;
1161
+ }
1162
+
1163
+ /** POST /sessions/:id/sworn-declaration — SubmitSwornDeclarationRequestDto. */
1164
+ export interface SwornDeclarationPayload {
1165
+ is_pep: boolean;
1166
+ is_ssoo: boolean;
1167
+ is_fatca: boolean;
1168
+ is_ocde: boolean;
1169
+ }
1170
+
1171
+ /**
1172
+ * POST /sessions/:id/economic-activity — EconomicActivitySelectionDto.
1173
+ *
1174
+ * Fire-and-forget on the backend: the POST returns 200 immediately and the Worker
1175
+ * validates `code` asynchronously against the configured items. An invalid code is
1176
+ * reported back over SSE as `RETRY_STEP` (or `SESSION_DECLINED` once retries are
1177
+ * exhausted), not as an HTTP error.
1178
+ */
1179
+ export interface EconomicActivitySelectionPayload {
1180
+ /** `code` of the selected EconomicActivityItem. */
1181
+ code: string;
1182
+ }
1183
+
1184
+ /** POST /sessions/:id/contact/email — SubmitEmailContactRequestDto. */
1185
+ export interface EmailContactPayload {
1186
+ email: string;
1187
+ }
1188
+
1189
+ /** POST /sessions/:id/contact/phone — SubmitPhoneContactRequestDto. */
1190
+ export interface PhoneContactPayload {
1191
+ phone: string;
1192
+ }
1193
+
1194
+ /** POST /sessions/:id/terms-and-conditions — SubmitTermsAndConditionsRequestDto. */
1195
+ export interface TermsAndConditionsAcceptancePayload {
1196
+ item_id: string;
1197
+ accepted: boolean;
1198
+ }
1199
+
1200
+ export interface TermsAndConditionsSubmitPayload {
1201
+ acceptances: TermsAndConditionsAcceptancePayload[];
1202
+ }
1203
+
1204
+ /**
1205
+ * SSE event payload (OnboardingSessionEvent). Matches the backend record
1206
+ * la.velion.onboarding.api...sdk.OnboardingSessionEventDto (snake_case in JSON).
1207
+ *
1208
+ * Received on GET /public/sdk/sessions/:sessionId/events. The backend sends
1209
+ * ServerSentEvent with id = event_id (epoch millis) for Last-Event-ID replay.
1210
+ *
1211
+ * Event types (event_type):
1212
+ * - STEP_UPDATED — a workflow step changed status (step_code, step_status)
1213
+ * - ROUTING_COMMAND — next/previous/retry/terminate instruction
1214
+ * (action: NEXT_STEP | PREVIOUS_STEP | RETRY_STEP | TERMINATE)
1215
+ * - SESSION_APPROVED — all checks passed; session_status = APPROVED
1216
+ * - SESSION_MANUAL_REVIEW — manual review required; session_status = MANUAL_REVIEW
1217
+ * - SESSION_DECLINED — session ended with decline (step_code, session_status DECLINED, reason)
1218
+ *
1219
+ * Reverse navigation ("back") arrives as a STEP_UPDATED (the re-opened step
1220
+ * moves to IN_PROGRESS) followed by a ROUTING_COMMAND with action PREVIOUS_STEP
1221
+ * carrying `step_config` and `step_result` (prefill) for the re-opened step.
1222
+ *
1223
+ * Tapping "back" on the first interactive (reversible) step instead yields a
1224
+ * ROUTING_COMMAND with action BACK_EXIT (`step_code` = the step exited from):
1225
+ * there is no earlier reversible step, so the SDK leaves the flow and returns
1226
+ * control to the host (see {@link VelionCallbacks.onExit}).
1227
+ */
1228
+ export interface OnboardingSessionEvent {
1229
+ /** Onboarding session identifier (Long in backend). */
1230
+ session_id?: number;
1231
+ /** Discriminator: STEP_UPDATED | ROUTING_COMMAND | SESSION_APPROVED | SESSION_MANUAL_REVIEW | SESSION_DECLINED */
1232
+ event_type?: string;
1233
+ /** Present for STEP_UPDATED or ROUTING_COMMAND (next step code). */
1234
+ step_code?: string;
1235
+ /** Present for STEP_UPDATED; e.g. COMPLETED. */
1236
+ step_status?: string;
1237
+ /** Present for terminal events; e.g. APPROVED | MANUAL_REVIEW | REJECTED. */
1238
+ session_status?: string;
1239
+ /**
1240
+ * For ROUTING_COMMAND: NEXT_STEP | PREVIOUS_STEP | RETRY_STEP (render step_code),
1241
+ * BACK_EXIT (user backed out of the first reversible step — leave the flow),
1242
+ * or TERMINATE (end flow).
1243
+ */
1244
+ action?: string;
1245
+ /** For SESSION_DECLINED / SESSION_MANUAL_REVIEW or ROUTING_COMMAND TERMINATE; e.g. UNREADABLE_DOCUMENT. */
1246
+ reason?: string;
1247
+ /** Step-specific config sent with ROUTING_COMMAND NEXT_STEP / PREVIOUS_STEP. */
1248
+ step_config?: Record<string, unknown>;
1249
+ /**
1250
+ * Previously-captured data for the re-opened step, sent with ROUTING_COMMAND
1251
+ * PREVIOUS_STEP. The SDK uses it to prefill the step's form on reverse
1252
+ * navigation.
1253
+ */
1254
+ step_result?: Record<string, unknown>;
1255
+ /**
1256
+ * Whether the user can navigate back from the step this command routes to.
1257
+ * Optional: when the backend includes it on a ROUTING_COMMAND the SDK uses it
1258
+ * to decide the "back" control verbatim; otherwise the SDK derives it from the
1259
+ * step reversibility map cached at session load.
1260
+ */
1261
+ can_go_back?: boolean;
1262
+ /** Epoch millis; used as SSE id for Last-Event-ID on reconnect. */
1263
+ event_id?: number;
1264
+ }
1265
+
1266
+ // ─────────────────────────────────────────────────────────────────────────────
1267
+ // BACKEND COMMANDS (Listen & Obey)
1268
+ // ─────────────────────────────────────────────────────────────────────────────
1269
+
1270
+ /**
1271
+ * Backend command: advance to a specific step. The SDK must render that step's
1272
+ * screen without evaluating business rules locally.
1273
+ */
1274
+ export interface BackendCommandGoToStep {
1275
+ action: 'GO_TO_STEP';
1276
+ stepCode: OnboardingStep;
1277
+ }
1278
+
1279
+ /**
1280
+ * Backend command: show an error message to the user. The SDK displays the
1281
+ * message and does not advance (backend owns the decision).
1282
+ */
1283
+ export interface BackendCommandShowError {
1284
+ action: 'SHOW_ERROR';
1285
+ message: string;
1286
+ }
1287
+
1288
+ /**
1289
+ * Backend command: flow is complete. SDK should fetch final result and fire onSuccess.
1290
+ */
1291
+ export interface BackendCommandFlowComplete {
1292
+ action: 'FLOW_COMPLETE';
1293
+ }
1294
+
1295
+ /**
1296
+ * Backend command: retry the current step (e.g. after transient failure).
1297
+ */
1298
+ export interface BackendCommandRetry {
1299
+ action: 'RETRY';
1300
+ }
1301
+
1302
+ /**
1303
+ * Strict command payload the backend may return in a synchronous HTTP response
1304
+ * or send via SSE. The SDK never makes routing decisions; it only obeys these commands.
1305
+ */
1306
+ export type BackendCommand =
1307
+ | BackendCommandGoToStep
1308
+ | BackendCommandShowError
1309
+ | BackendCommandFlowComplete
1310
+ | BackendCommandRetry;
1311
+
1312
+ /**
1313
+ * Raw response body that may contain a backend command (e.g. POST submit response).
1314
+ */
1315
+ export interface BackendCommandResponse {
1316
+ action?: string;
1317
+ stepCode?: string;
1318
+ message?: string;
1319
+ }
1320
+
1321
+ // ─────────────────────────────────────────────────────────────────────────────
1322
+ // INTERNAL STATE MACHINE TYPES (exported for module authors)
1323
+ // ─────────────────────────────────────────────────────────────────────────────
1324
+
1325
+ /**
1326
+ * All possible states of the SDK's internal lifecycle.
1327
+ * Transitions are strictly unidirectional (no going back to IDLE once started).
1328
+ *
1329
+ * @internal
1330
+ */
1331
+ export type SdkStatus =
1332
+ | 'IDLE' // Instantiated, not yet started
1333
+ | 'INITIALIZING' // Fetching session state from backend
1334
+ | 'RUNNING' // Orchestrating steps
1335
+ | 'STEP_PROCESSING'// A module is actively running
1336
+ | 'COMPLETED' // All steps done, onSuccess fired
1337
+ | 'EXITED' // User left the flow via back on the first step, onExit fired
1338
+ | 'ERROR' // Unrecoverable error, onError fired
1339
+ | 'DESTROYED'; // destroy() was called, instance is a no-op
1340
+
1341
+ /**
1342
+ * Internal event bus event names. Typed via `SdkEventMap`.
1343
+ * @internal
1344
+ */
1345
+ export type SdkEventName =
1346
+ | 'step:change'
1347
+ | 'step:complete'
1348
+ | 'session:loaded'
1349
+ | 'flow:complete'
1350
+ | 'flow:exit'
1351
+ | 'error'
1352
+ | 'status:change';
1353
+
1354
+ /**
1355
+ * Maps each internal event name to its payload type.
1356
+ * Used by the `TypedEventEmitter` for compile-time safety.
1357
+ * @internal
1358
+ */
1359
+ export interface SdkEventMap extends Record<string, unknown> {
1360
+ 'step:change': { step: OnboardingStep; index: number };
1361
+ 'step:complete': { step: OnboardingStep };
1362
+ 'session:loaded': SessionState;
1363
+ 'flow:complete': OnboardingResult;
1364
+ 'flow:exit': OnboardingExit;
1365
+ 'error': SdkError;
1366
+ 'status:change': SdkStatus;
1367
+ }
1368
+
1369
+ // ─────────────────────────────────────────────────────────────────────────────
1370
+ // LOADER ↔ CDN APP POSTMESSAGE PROTOCOL (Sumsub-style)
1371
+ // ─────────────────────────────────────────────────────────────────────────────
1372
+
1373
+ /** Message type: parent (loader) sends config to iframe (CDN app). */
1374
+ export const VELION_MSG_INIT = 'VELION_INIT' as const;
1375
+
1376
+ /** Message types: iframe (CDN app) sends to parent (loader). */
1377
+ export const VELION_MSG_READY = 'VELION_READY' as const;
1378
+ export const VELION_MSG_SUCCESS = 'VELION_SUCCESS' as const;
1379
+ export const VELION_MSG_ERROR = 'VELION_ERROR' as const;
1380
+ export const VELION_MSG_STEP_CHANGE = 'VELION_STEP_CHANGE' as const;
1381
+ export const VELION_MSG_STEP_COMPLETE = 'VELION_STEP_COMPLETE' as const;
1382
+ export const VELION_MSG_TOKEN_EXPIRED = 'VELION_TOKEN_EXPIRED' as const;
1383
+
1384
+ /** Message type: parent sends new token to iframe after VELION_TOKEN_EXPIRED. */
1385
+ export const VELION_MSG_TOKEN = 'VELION_TOKEN' as const;
1386
+
1387
+ export type VelionMessageType =
1388
+ | typeof VELION_MSG_INIT
1389
+ | typeof VELION_MSG_READY
1390
+ | typeof VELION_MSG_SUCCESS
1391
+ | typeof VELION_MSG_ERROR
1392
+ | typeof VELION_MSG_STEP_CHANGE
1393
+ | typeof VELION_MSG_STEP_COMPLETE
1394
+ | typeof VELION_MSG_TOKEN_EXPIRED
1395
+ | typeof VELION_MSG_TOKEN;
1396
+
1397
+ /** Envelope for all loader ↔ iframe messages. Both sides must validate origin. */
1398
+ export interface VelionMessage<T = unknown> {
1399
+ type: VelionMessageType;
1400
+ payload: T;
1401
+ }
1402
+
1403
+ /** Payload for VELION_INIT: full config (iframe runs with containerId overwritten to root id). */
1404
+ export type VelionInitPayload = VelionConfig;
1405
+
1406
+ /** Payload for VELION_STEP_CHANGE. */
1407
+ export interface VelionStepChangePayload {
1408
+ step: OnboardingStep;
1409
+ stepIndex: number;
1410
+ }
1411
+
1412
+ /** Payload for VELION_STEP_COMPLETE. */
1413
+ export interface VelionStepCompletePayload {
1414
+ step: OnboardingStep;
1415
+ }
1416
+
1417
+ /** Payload for VELION_TOKEN (token refresh response from parent to iframe). */
1418
+ export interface VelionTokenPayload {
1419
+ sessionToken: string;
1420
+ expiresAt?: string;
1421
+ }