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

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