@velion-la/onboarding-sdk-react-native 1.0.0-beta.5 → 1.0.0-beta.7

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 (182) hide show
  1. package/README.md +85 -0
  2. package/lib/commonjs/core/VelionOnboarding.js +296 -15
  3. package/lib/commonjs/core/VelionOnboarding.js.map +1 -1
  4. package/lib/commonjs/core/retryStepCopy.js +43 -0
  5. package/lib/commonjs/core/retryStepCopy.js.map +1 -0
  6. package/lib/commonjs/core/routingCommands.js +62 -0
  7. package/lib/commonjs/core/routingCommands.js.map +1 -0
  8. package/lib/commonjs/core/sessionStateMapper.js +63 -0
  9. package/lib/commonjs/core/sessionStateMapper.js.map +1 -1
  10. package/lib/commonjs/i18n/strings/en.js +28 -0
  11. package/lib/commonjs/i18n/strings/en.js.map +1 -1
  12. package/lib/commonjs/i18n/strings/es.js +28 -0
  13. package/lib/commonjs/i18n/strings/es.js.map +1 -1
  14. package/lib/commonjs/index.js.map +1 -1
  15. package/lib/commonjs/steps/AddressInfoStep.js +30 -18
  16. package/lib/commonjs/steps/AddressInfoStep.js.map +1 -1
  17. package/lib/commonjs/steps/DocumentsOcrStep.js +4 -0
  18. package/lib/commonjs/steps/DocumentsOcrStep.js.map +1 -1
  19. package/lib/commonjs/steps/EmailContactStep.js +5 -0
  20. package/lib/commonjs/steps/EmailContactStep.js.map +1 -1
  21. package/lib/commonjs/steps/EmailOtpStep.js +5 -0
  22. package/lib/commonjs/steps/EmailOtpStep.js.map +1 -1
  23. package/lib/commonjs/steps/FaceMatchStep.js +16 -13
  24. package/lib/commonjs/steps/FaceMatchStep.js.map +1 -1
  25. package/lib/commonjs/steps/HumanBasicInfoStep.js +12 -4
  26. package/lib/commonjs/steps/HumanBasicInfoStep.js.map +1 -1
  27. package/lib/commonjs/steps/HumanExtendedInfoStep.js +15 -8
  28. package/lib/commonjs/steps/HumanExtendedInfoStep.js.map +1 -1
  29. package/lib/commonjs/steps/LegalBasicInfoStep.js +13 -6
  30. package/lib/commonjs/steps/LegalBasicInfoStep.js.map +1 -1
  31. package/lib/commonjs/steps/LegalExtendedInfoStep.js +9 -2
  32. package/lib/commonjs/steps/LegalExtendedInfoStep.js.map +1 -1
  33. package/lib/commonjs/steps/PhoneContactStep.js +5 -0
  34. package/lib/commonjs/steps/PhoneContactStep.js.map +1 -1
  35. package/lib/commonjs/steps/PhoneOtpStep.js +5 -0
  36. package/lib/commonjs/steps/PhoneOtpStep.js.map +1 -1
  37. package/lib/commonjs/steps/SwornDeclarationStep.js +16 -6
  38. package/lib/commonjs/steps/SwornDeclarationStep.js.map +1 -1
  39. package/lib/commonjs/steps/TaxInfoStep.js +10 -3
  40. package/lib/commonjs/steps/TaxInfoStep.js.map +1 -1
  41. package/lib/commonjs/steps/TermsAndConditionsStep.js +7 -0
  42. package/lib/commonjs/steps/TermsAndConditionsStep.js.map +1 -1
  43. package/lib/commonjs/steps/_shared.js +21 -0
  44. package/lib/commonjs/steps/_shared.js.map +1 -1
  45. package/lib/commonjs/types/index.js +36 -1
  46. package/lib/commonjs/types/index.js.map +1 -1
  47. package/lib/commonjs/ui/StepShell.js +10 -2
  48. package/lib/commonjs/ui/StepShell.js.map +1 -1
  49. package/lib/commonjs/ui/VelionOnboardingScreen.js +25 -5
  50. package/lib/commonjs/ui/VelionOnboardingScreen.js.map +1 -1
  51. package/lib/commonjs/ui/icons/StepIcon.js.map +1 -1
  52. package/lib/commonjs/ui/primitives/BackButton.js +75 -0
  53. package/lib/commonjs/ui/primitives/BackButton.js.map +1 -0
  54. package/lib/commonjs/ui/primitives/index.js +7 -0
  55. package/lib/commonjs/ui/primitives/index.js.map +1 -1
  56. package/lib/module/core/VelionOnboarding.js +297 -16
  57. package/lib/module/core/VelionOnboarding.js.map +1 -1
  58. package/lib/module/core/retryStepCopy.js +39 -0
  59. package/lib/module/core/retryStepCopy.js.map +1 -0
  60. package/lib/module/core/routingCommands.js +57 -0
  61. package/lib/module/core/routingCommands.js.map +1 -0
  62. package/lib/module/core/sessionStateMapper.js +61 -0
  63. package/lib/module/core/sessionStateMapper.js.map +1 -1
  64. package/lib/module/i18n/strings/en.js +28 -0
  65. package/lib/module/i18n/strings/en.js.map +1 -1
  66. package/lib/module/i18n/strings/es.js +28 -0
  67. package/lib/module/i18n/strings/es.js.map +1 -1
  68. package/lib/module/index.js.map +1 -1
  69. package/lib/module/steps/AddressInfoStep.js +31 -19
  70. package/lib/module/steps/AddressInfoStep.js.map +1 -1
  71. package/lib/module/steps/DocumentsOcrStep.js +4 -0
  72. package/lib/module/steps/DocumentsOcrStep.js.map +1 -1
  73. package/lib/module/steps/EmailContactStep.js +5 -0
  74. package/lib/module/steps/EmailContactStep.js.map +1 -1
  75. package/lib/module/steps/EmailOtpStep.js +5 -0
  76. package/lib/module/steps/EmailOtpStep.js.map +1 -1
  77. package/lib/module/steps/FaceMatchStep.js +16 -13
  78. package/lib/module/steps/FaceMatchStep.js.map +1 -1
  79. package/lib/module/steps/HumanBasicInfoStep.js +12 -4
  80. package/lib/module/steps/HumanBasicInfoStep.js.map +1 -1
  81. package/lib/module/steps/HumanExtendedInfoStep.js +16 -9
  82. package/lib/module/steps/HumanExtendedInfoStep.js.map +1 -1
  83. package/lib/module/steps/LegalBasicInfoStep.js +14 -7
  84. package/lib/module/steps/LegalBasicInfoStep.js.map +1 -1
  85. package/lib/module/steps/LegalExtendedInfoStep.js +10 -3
  86. package/lib/module/steps/LegalExtendedInfoStep.js.map +1 -1
  87. package/lib/module/steps/PhoneContactStep.js +5 -0
  88. package/lib/module/steps/PhoneContactStep.js.map +1 -1
  89. package/lib/module/steps/PhoneOtpStep.js +5 -0
  90. package/lib/module/steps/PhoneOtpStep.js.map +1 -1
  91. package/lib/module/steps/SwornDeclarationStep.js +18 -6
  92. package/lib/module/steps/SwornDeclarationStep.js.map +1 -1
  93. package/lib/module/steps/TaxInfoStep.js +11 -4
  94. package/lib/module/steps/TaxInfoStep.js.map +1 -1
  95. package/lib/module/steps/TermsAndConditionsStep.js +7 -0
  96. package/lib/module/steps/TermsAndConditionsStep.js.map +1 -1
  97. package/lib/module/steps/_shared.js +19 -0
  98. package/lib/module/steps/_shared.js.map +1 -1
  99. package/lib/module/types/index.js +38 -1
  100. package/lib/module/types/index.js.map +1 -1
  101. package/lib/module/ui/StepShell.js +10 -2
  102. package/lib/module/ui/StepShell.js.map +1 -1
  103. package/lib/module/ui/VelionOnboardingScreen.js +25 -5
  104. package/lib/module/ui/VelionOnboardingScreen.js.map +1 -1
  105. package/lib/module/ui/icons/StepIcon.js.map +1 -1
  106. package/lib/module/ui/primitives/BackButton.js +71 -0
  107. package/lib/module/ui/primitives/BackButton.js.map +1 -0
  108. package/lib/module/ui/primitives/index.js +1 -0
  109. package/lib/module/ui/primitives/index.js.map +1 -1
  110. package/lib/typescript/core/VelionOnboarding.d.ts +56 -2
  111. package/lib/typescript/core/VelionOnboarding.d.ts.map +1 -1
  112. package/lib/typescript/core/retryStepCopy.d.ts +27 -0
  113. package/lib/typescript/core/retryStepCopy.d.ts.map +1 -0
  114. package/lib/typescript/core/routingCommands.d.ts +39 -0
  115. package/lib/typescript/core/routingCommands.d.ts.map +1 -0
  116. package/lib/typescript/core/sessionStateMapper.d.ts +20 -1
  117. package/lib/typescript/core/sessionStateMapper.d.ts.map +1 -1
  118. package/lib/typescript/i18n/strings/en.d.ts.map +1 -1
  119. package/lib/typescript/i18n/strings/es.d.ts +25 -0
  120. package/lib/typescript/i18n/strings/es.d.ts.map +1 -1
  121. package/lib/typescript/index.d.ts +1 -1
  122. package/lib/typescript/index.d.ts.map +1 -1
  123. package/lib/typescript/steps/AddressInfoStep.d.ts.map +1 -1
  124. package/lib/typescript/steps/DocumentsOcrStep.d.ts.map +1 -1
  125. package/lib/typescript/steps/EmailContactStep.d.ts.map +1 -1
  126. package/lib/typescript/steps/EmailOtpStep.d.ts.map +1 -1
  127. package/lib/typescript/steps/FaceMatchStep.d.ts.map +1 -1
  128. package/lib/typescript/steps/HumanBasicInfoStep.d.ts.map +1 -1
  129. package/lib/typescript/steps/HumanExtendedInfoStep.d.ts.map +1 -1
  130. package/lib/typescript/steps/LegalBasicInfoStep.d.ts.map +1 -1
  131. package/lib/typescript/steps/LegalExtendedInfoStep.d.ts.map +1 -1
  132. package/lib/typescript/steps/PhoneContactStep.d.ts.map +1 -1
  133. package/lib/typescript/steps/PhoneOtpStep.d.ts.map +1 -1
  134. package/lib/typescript/steps/SwornDeclarationStep.d.ts.map +1 -1
  135. package/lib/typescript/steps/TaxInfoStep.d.ts.map +1 -1
  136. package/lib/typescript/steps/TermsAndConditionsStep.d.ts.map +1 -1
  137. package/lib/typescript/steps/_shared.d.ts +11 -0
  138. package/lib/typescript/steps/_shared.d.ts.map +1 -1
  139. package/lib/typescript/steps/types.d.ts +15 -0
  140. package/lib/typescript/steps/types.d.ts.map +1 -1
  141. package/lib/typescript/types/index.d.ts +127 -5
  142. package/lib/typescript/types/index.d.ts.map +1 -1
  143. package/lib/typescript/ui/StepShell.d.ts +11 -1
  144. package/lib/typescript/ui/StepShell.d.ts.map +1 -1
  145. package/lib/typescript/ui/VelionOnboardingScreen.d.ts +9 -2
  146. package/lib/typescript/ui/VelionOnboardingScreen.d.ts.map +1 -1
  147. package/lib/typescript/ui/icons/StepIcon.d.ts +1 -1
  148. package/lib/typescript/ui/icons/StepIcon.d.ts.map +1 -1
  149. package/lib/typescript/ui/primitives/BackButton.d.ts +20 -0
  150. package/lib/typescript/ui/primitives/BackButton.d.ts.map +1 -0
  151. package/lib/typescript/ui/primitives/index.d.ts +1 -0
  152. package/lib/typescript/ui/primitives/index.d.ts.map +1 -1
  153. package/package.json +1 -1
  154. package/src/core/VelionOnboarding.ts +315 -16
  155. package/src/core/retryStepCopy.ts +54 -0
  156. package/src/core/routingCommands.ts +63 -0
  157. package/src/core/sessionStateMapper.ts +65 -0
  158. package/src/i18n/strings/en.ts +33 -0
  159. package/src/i18n/strings/es.ts +33 -0
  160. package/src/index.ts +2 -0
  161. package/src/steps/AddressInfoStep.tsx +38 -20
  162. package/src/steps/DocumentsOcrStep.tsx +5 -0
  163. package/src/steps/EmailContactStep.tsx +6 -0
  164. package/src/steps/EmailOtpStep.tsx +6 -0
  165. package/src/steps/FaceMatchStep.tsx +18 -19
  166. package/src/steps/HumanBasicInfoStep.tsx +16 -4
  167. package/src/steps/HumanExtendedInfoStep.tsx +18 -9
  168. package/src/steps/LegalBasicInfoStep.tsx +16 -7
  169. package/src/steps/LegalExtendedInfoStep.tsx +16 -3
  170. package/src/steps/PhoneContactStep.tsx +6 -0
  171. package/src/steps/PhoneOtpStep.tsx +6 -0
  172. package/src/steps/SwornDeclarationStep.tsx +23 -6
  173. package/src/steps/TaxInfoStep.tsx +15 -4
  174. package/src/steps/TermsAndConditionsStep.tsx +8 -0
  175. package/src/steps/_shared.ts +25 -0
  176. package/src/steps/types.ts +15 -0
  177. package/src/types/index.ts +131 -3
  178. package/src/ui/StepShell.tsx +17 -0
  179. package/src/ui/VelionOnboardingScreen.tsx +36 -2
  180. package/src/ui/icons/StepIcon.tsx +2 -1
  181. package/src/ui/primitives/BackButton.tsx +65 -0
  182. package/src/ui/primitives/index.ts +1 -0
@@ -11,6 +11,7 @@ export const EN: StringsTable = {
11
11
  retry: 'Try again',
12
12
  confirm: 'Confirm',
13
13
  required: 'Required',
14
+ back: 'Back',
14
15
  submissionTitle: 'Something went wrong',
15
16
  submissionFallback:
16
17
  'Sorry, there was an error processing your information. Please try again — your data was not lost.',
@@ -287,4 +288,36 @@ export const EN: StringsTable = {
287
288
  rejectedBody: 'This session could not be completed.',
288
289
  declineHeadline: 'We could not continue',
289
290
  },
291
+ // Retry dialog shown when the backend asks the SDK to re-present a failed step
292
+ // (ROUTING_COMMAND / RETRY_STEP). Copy is derived from the step, not the
293
+ // backend `reason` (which is a diagnostic string).
294
+ retryStep: {
295
+ retry: 'Try again',
296
+ cancel: 'Cancel',
297
+ defaultTitle: "Let's retry this step",
298
+ defaultMessage:
299
+ 'We could not verify this step. Try again to continue, or cancel to leave.',
300
+ steps: {
301
+ LIVENESS_MATCH: {
302
+ title: "Let's redo the liveness check",
303
+ message:
304
+ 'We need a slightly better capture to verify your liveness check. Try again in a well-lit area, follow the on-screen instructions, and keep your face clearly visible.',
305
+ },
306
+ DOCUMENTS_OCR: {
307
+ title: "Let's recapture your document",
308
+ message:
309
+ 'We could not read the document clearly. Try again in good light, keeping it flat and in focus, without glare or cut-off edges.',
310
+ },
311
+ HUMAN_BASIC_INFO: {
312
+ title: 'Review your personal details',
313
+ message:
314
+ 'We could not validate your personal details. Try again and make sure they match your ID document.',
315
+ },
316
+ TAX_INFO: {
317
+ title: 'Review your tax information',
318
+ message:
319
+ 'We could not validate your tax information. Try again and review the details you entered.',
320
+ },
321
+ },
322
+ },
290
323
  };
@@ -14,6 +14,7 @@ export const ES = {
14
14
  retry: 'Reintentar',
15
15
  confirm: 'Confirmar',
16
16
  required: 'Requerido',
17
+ back: 'Atrás',
17
18
  submissionTitle: 'Hubo un problema',
18
19
  submissionFallback:
19
20
  'Disculpá, hubo un error procesando tu información. Volvé a intentar — tus datos no se perdieron.',
@@ -287,6 +288,38 @@ export const ES = {
287
288
  rejectedBody: 'No se pudo completar esta sesión.',
288
289
  declineHeadline: 'No pudimos continuar',
289
290
  },
291
+ // Retry dialog shown when the backend asks the SDK to re-present a failed step
292
+ // (ROUTING_COMMAND / RETRY_STEP). Copy is derived from the step, not the
293
+ // backend `reason` (which is a diagnostic string).
294
+ retryStep: {
295
+ retry: 'Reintentar',
296
+ cancel: 'Cancelar',
297
+ defaultTitle: 'Reintentemos este paso',
298
+ defaultMessage:
299
+ 'No pudimos verificar este paso. Reintentá para continuar o cancelá para salir.',
300
+ steps: {
301
+ LIVENESS_MATCH: {
302
+ title: 'Repitamos la prueba de vida',
303
+ message:
304
+ 'Necesitamos una captura un poco mejor para verificar tu prueba de vida. Reintentá en un lugar bien iluminado, seguí las instrucciones en pantalla y mantené el rostro bien visible.',
305
+ },
306
+ DOCUMENTS_OCR: {
307
+ title: 'Volvamos a capturar tu documento',
308
+ message:
309
+ 'No pudimos leer el documento con claridad. Reintentá con buena luz, manteniéndolo plano y enfocado, sin reflejos ni bordes cortados.',
310
+ },
311
+ HUMAN_BASIC_INFO: {
312
+ title: 'Revisá tus datos personales',
313
+ message:
314
+ 'No pudimos validar tus datos personales. Reintentá revisando que coincidan con tu documento de identidad.',
315
+ },
316
+ TAX_INFO: {
317
+ title: 'Revisá tu información impositiva',
318
+ message:
319
+ 'No pudimos validar tu información impositiva. Reintentá revisando los datos ingresados.',
320
+ },
321
+ },
322
+ },
290
323
  };
291
324
 
292
325
  export type StringsTable = typeof ES;
package/src/index.ts CHANGED
@@ -95,6 +95,7 @@ export type {
95
95
  OnboardingStepStatus,
96
96
  OnboardingType,
97
97
  OnboardingResult,
98
+ OnboardingExit,
98
99
  OnboardingSessionEvent,
99
100
  OnboardingDtoResponse,
100
101
  SessionState,
@@ -105,6 +106,7 @@ export type {
105
106
  VelionFinalResultStatusCopy,
106
107
  VelionSessionDeclinedReasonTexts,
107
108
  VelionSessionDeclinedReasonMessages,
109
+ VelionRetryStepTexts,
108
110
  VelionCallbacks,
109
111
  // Step configs
110
112
  HumanBasicInfoStepConfig,
@@ -42,7 +42,7 @@ import {
42
42
  } from '../utils/googleMapsPreflight';
43
43
  import { log } from '../utils/log';
44
44
  import type { StepDeps, StepModule } from './types';
45
- import { toSubmissionError } from './_shared';
45
+ import { prefillString, toSubmissionError } from './_shared';
46
46
 
47
47
  const ADDRESS_TYPE_HOME = 'HOME';
48
48
 
@@ -64,6 +64,8 @@ export class AddressInfoStep implements StepModule {
64
64
  locale={this.deps.locale}
65
65
  stepConfig={this.deps.stepConfig as AddressInfoStepConfig | undefined}
66
66
  googleMapsApiKey={this.deps.googleMapsApiKey}
67
+ prefill={this.deps.stepResult}
68
+ onBack={this.deps.onBack}
67
69
  onComplete={() => {
68
70
  if (this.destroyed) return;
69
71
  this.deps.ui.setNode(null);
@@ -91,6 +93,8 @@ interface ViewProps {
91
93
  locale: string;
92
94
  stepConfig: AddressInfoStepConfig | undefined;
93
95
  googleMapsApiKey: string | undefined;
96
+ prefill?: Record<string, unknown> | undefined;
97
+ onBack?: (() => void) | undefined;
94
98
  onComplete: () => void;
95
99
  onCancel: (err: SdkError) => void;
96
100
  }
@@ -183,6 +187,8 @@ function AssistedAddressFlow({
183
187
  sessionId,
184
188
  locale,
185
189
  stepConfig,
190
+ prefill,
191
+ onBack,
186
192
  onComplete,
187
193
  onCancel,
188
194
  onMapRenderFailure,
@@ -212,6 +218,8 @@ function AssistedAddressFlow({
212
218
  title={t.address_info.introTitle}
213
219
  subtitle={t.address_info.introLine1}
214
220
  iconNode={<HomeHeartIcon />}
221
+ onBack={onBack}
222
+ backLabel={t.common.back}
215
223
  >
216
224
  <Text style={[styles.introBody, { color: theme.textSecondaryColor }]}>
217
225
  {t.address_info.introLine2}
@@ -260,6 +268,7 @@ function AssistedAddressFlow({
260
268
  locale={locale}
261
269
  parsed={parsed}
262
270
  addressType={stepConfig?.address_type?.id ?? ADDRESS_TYPE_HOME}
271
+ prefill={prefill}
263
272
  onComplete={onComplete}
264
273
  onCancel={onCancel}
265
274
  onBack={() => setPhase('map')}
@@ -273,6 +282,7 @@ interface DetailsFormProps {
273
282
  locale: string;
274
283
  parsed: ParsedAddressFields & { latitude: number; longitude: number };
275
284
  addressType: string;
285
+ prefill?: Record<string, unknown> | undefined;
276
286
  onComplete: () => void;
277
287
  onCancel: (err: SdkError) => void;
278
288
  onBack: () => void;
@@ -284,15 +294,18 @@ function AddressDetailsForm({
284
294
  locale,
285
295
  parsed,
286
296
  addressType,
297
+ prefill,
287
298
  onComplete,
288
299
  onCancel,
289
300
  onBack,
290
301
  }: DetailsFormProps) {
291
302
  const t = getStrings(locale);
292
303
  const theme = useTheme();
293
- const [floor, setFloor] = useState('');
294
- const [apartment, setApartment] = useState('');
295
- const [details, setDetails] = useState('');
304
+ const [floor, setFloor] = useState(() => prefillString(prefill, 'floor'));
305
+ const [apartment, setApartment] = useState(() =>
306
+ prefillString(prefill, 'apartment'),
307
+ );
308
+ const [details, setDetails] = useState(() => prefillString(prefill, 'details'));
296
309
  const [bannerError, setBannerError] = useState<string | null>(null);
297
310
  const [submitting, setSubmitting] = useState(false);
298
311
  const [retry, setRetry] = useState<{ message: string } | null>(null);
@@ -435,25 +448,13 @@ type FieldKey =
435
448
 
436
449
  type ManualForm = Record<FieldKey, string>;
437
450
 
438
- const INITIAL_MANUAL: ManualForm = {
439
- country: '',
440
- state: '',
441
- city: '',
442
- district: '',
443
- neighborhood: '',
444
- street: '',
445
- number: '',
446
- zip_code: '',
447
- floor: '',
448
- apartment: '',
449
- details: '',
450
- };
451
-
452
451
  function ManualAddressForm({
453
452
  api,
454
453
  sessionId,
455
454
  locale,
456
455
  stepConfig,
456
+ prefill,
457
+ onBack,
457
458
  onComplete,
458
459
  onCancel,
459
460
  }: ViewProps) {
@@ -480,8 +481,22 @@ function ManualAddressForm({
480
481
  );
481
482
 
482
483
  const [form, setForm] = useState<ManualForm>(() => {
483
- const base = { ...INITIAL_MANUAL };
484
- if (allowedCodes && allowedCodes.length === 1) {
484
+ // Seed from prefill first (reverse navigation re-opened this step), then
485
+ // fall back to a single allowed country. Prefill takes precedence.
486
+ const base: ManualForm = {
487
+ country: prefillString(prefill, 'country'),
488
+ state: prefillString(prefill, 'state'),
489
+ city: prefillString(prefill, 'city'),
490
+ district: prefillString(prefill, 'district'),
491
+ neighborhood: prefillString(prefill, 'neighborhood'),
492
+ street: prefillString(prefill, 'street'),
493
+ number: prefillString(prefill, 'number'),
494
+ zip_code: prefillString(prefill, 'zip_code'),
495
+ floor: prefillString(prefill, 'floor'),
496
+ apartment: prefillString(prefill, 'apartment'),
497
+ details: prefillString(prefill, 'details'),
498
+ };
499
+ if (!base.country && allowedCodes && allowedCodes.length === 1) {
485
500
  base.country = allowedCodes[0] ?? '';
486
501
  }
487
502
  return base;
@@ -584,6 +599,9 @@ function ManualAddressForm({
584
599
  title={t.address_info.title}
585
600
  subtitle={t.address_info.subtitle}
586
601
  iconNode={<HomeHeartIcon />}
602
+ onBack={onBack}
603
+ backLabel={t.common.back}
604
+ backDisabled={submitting}
587
605
  >
588
606
  <CountrySelect
589
607
  label={t.address_info.country}
@@ -84,6 +84,7 @@ export class DocumentsOcrStep implements StepModule {
84
84
  sessionId={this.deps.sessionId}
85
85
  locale={this.deps.locale}
86
86
  stepConfig={this.deps.stepConfig as DocumentsOcrStepConfig | undefined}
87
+ onBack={this.deps.onBack}
87
88
  onComplete={() => {
88
89
  if (this.destroyed) return;
89
90
  this.deps.ui.setNode(null);
@@ -110,6 +111,7 @@ interface ViewProps {
110
111
  sessionId: string;
111
112
  locale: string;
112
113
  stepConfig: DocumentsOcrStepConfig | undefined;
114
+ onBack?: (() => void) | undefined;
113
115
  onComplete: () => void;
114
116
  onCancel: (err: SdkError) => void;
115
117
  }
@@ -119,6 +121,7 @@ function DocumentsOcrView({
119
121
  sessionId,
120
122
  locale,
121
123
  stepConfig,
124
+ onBack,
122
125
  onComplete,
123
126
  onCancel,
124
127
  }: ViewProps) {
@@ -315,6 +318,8 @@ function DocumentsOcrView({
315
318
  title={t.documents_ocr.introTitle}
316
319
  subtitle={t.documents_ocr.introSubtitle}
317
320
  iconNode={<StepIcon name="badge" />}
321
+ onBack={onBack}
322
+ backLabel={t.common.back}
318
323
  >
319
324
  <ScrollView style={styles.tipsScroll} contentContainerStyle={styles.tipsList}>
320
325
  {t.documents_ocr.introTips.map((tip, idx) => (
@@ -39,6 +39,7 @@ export class EmailContactStep implements StepModule {
39
39
  api={this.deps.api}
40
40
  sessionId={this.deps.sessionId}
41
41
  locale={this.deps.locale}
42
+ onBack={this.deps.onBack}
42
43
  onComplete={() => {
43
44
  if (this.destroyed) return;
44
45
  this.deps.ui.setNode(null);
@@ -64,6 +65,7 @@ interface ViewProps {
64
65
  api: ApiCaller;
65
66
  sessionId: string;
66
67
  locale: string;
68
+ onBack?: (() => void) | undefined;
67
69
  onComplete: () => void;
68
70
  onCancel: (err: SdkError) => void;
69
71
  }
@@ -72,6 +74,7 @@ function EmailContactView({
72
74
  api,
73
75
  sessionId,
74
76
  locale,
77
+ onBack,
75
78
  onComplete,
76
79
  onCancel,
77
80
  }: ViewProps) {
@@ -133,6 +136,9 @@ function EmailContactView({
133
136
  title={t.email_contact.title}
134
137
  subtitle={t.email_contact.hint}
135
138
  iconNode={<StepIcon name="mail-outline" />}
139
+ onBack={onBack}
140
+ backLabel={t.common.back}
141
+ backDisabled={submitting}
136
142
  >
137
143
  <Input
138
144
  label={t.email_contact.label}
@@ -42,6 +42,7 @@ export class EmailOtpStep implements StepModule {
42
42
  api={this.deps.api}
43
43
  sessionId={this.deps.sessionId}
44
44
  locale={this.deps.locale}
45
+ onBack={this.deps.onBack}
45
46
  onComplete={() => {
46
47
  if (this.destroyed) return;
47
48
  this.deps.ui.setNode(null);
@@ -67,6 +68,7 @@ interface ViewProps {
67
68
  api: ApiCaller;
68
69
  sessionId: string;
69
70
  locale: string;
71
+ onBack?: (() => void) | undefined;
70
72
  onComplete: () => void;
71
73
  onCancel: (err: SdkError) => void;
72
74
  }
@@ -75,6 +77,7 @@ function EmailOtpView({
75
77
  api,
76
78
  sessionId,
77
79
  locale,
80
+ onBack,
78
81
  onComplete,
79
82
  onCancel,
80
83
  }: ViewProps) {
@@ -170,6 +173,9 @@ function EmailOtpView({
170
173
  title={t.email_otp.title}
171
174
  subtitle={t.email_otp.emailHint}
172
175
  iconNode={<StepIcon name="mail-outline" />}
176
+ onBack={stage === 'request' ? onBack : undefined}
177
+ backLabel={t.common.back}
178
+ backDisabled={busy !== null}
173
179
  >
174
180
  <Input
175
181
  label={t.email_otp.emailLabel}
@@ -21,6 +21,7 @@ import {
21
21
  type SdkError,
22
22
  } from '../types';
23
23
  import { getStrings } from '../i18n';
24
+ import { isTerminalSessionStatusFromDto } from '../core/sessionStateMapper';
24
25
  import { useTheme } from '../ui/theme';
25
26
  import { log } from '../utils/log';
26
27
  import type { StepDeps, StepModule } from './types';
@@ -68,17 +69,13 @@ export class FaceMatchStep implements StepModule {
68
69
  },
69
70
  );
70
71
  const status = (dto.status ?? '').toUpperCase();
71
- if (status === 'REJECTED') {
72
- this.rejectStep({
73
- code: SdkErrorCode.API_ERROR,
74
- message:
75
- this.deps.locale === 'en'
76
- ? 'Session was rejected during face match.'
77
- : 'La sesión fue rechazada durante la verificación facial.',
78
- });
79
- return;
80
- }
81
- if (status === 'APPROVED' || status === 'MANUAL_REVIEW') {
72
+ // Any terminal session status (APPROVED / MANUAL_REVIEW / DECLINED /
73
+ // REJECTED) hands control back to the orchestrator, which finalizes via
74
+ // its SSE terminal/decline path — showing the proper result or decline
75
+ // screen. We resolve (not reject) even on DECLINED so a genuine
76
+ // face-match business failure surfaces the decline copy, not a generic
77
+ // error.
78
+ if (isTerminalSessionStatusFromDto(status)) {
82
79
  this.resolveStep();
83
80
  return;
84
81
  }
@@ -88,15 +85,17 @@ export class FaceMatchStep implements StepModule {
88
85
  this.resolveStep();
89
86
  return;
90
87
  }
88
+ // FACE_MATCH = FAILED while the session is still IN_PROGRESS is NOT
89
+ // fatal: per VON-26 the orchestrator re-marks an auto-backend step
90
+ // IN_PROGRESS and re-dispatches the command on a transient failure
91
+ // (Rekognition / RENAPER error, selfie not ready yet), bounded by
92
+ // maxRetries. A genuine business failure hard-fails the session, which
93
+ // we catch via the terminal-status check above. So on a transient
94
+ // FAILED we keep polling instead of erroring the whole flow.
91
95
  if (stepStatus === 'FAILED') {
92
- this.rejectStep({
93
- code: SdkErrorCode.API_ERROR,
94
- message:
95
- this.deps.locale === 'en'
96
- ? 'Face match step failed.'
97
- : 'La verificación facial no pudo completarse.',
98
- });
99
- return;
96
+ log.info(
97
+ '[FaceMatch] step FAILED while session IN_PROGRESS — backend may be retrying (VON-26), continuing to poll',
98
+ );
100
99
  }
101
100
  } catch (err) {
102
101
  if (this.destroyed) return;
@@ -36,6 +36,7 @@ import { resolveDocumentOptionsFromStepConfig } from '../utils/stepConfig';
36
36
  import { normalizePersonNameSegment } from '../utils/personNameNormalize';
37
37
  import type { ApiCaller } from '../transport/api';
38
38
  import type { StepDeps, StepModule } from './types';
39
+ import { prefillString } from './_shared';
39
40
 
40
41
  interface FormState {
41
42
  first_name: string;
@@ -61,6 +62,8 @@ export class HumanBasicInfoStep implements StepModule {
61
62
  sessionId={this.deps.sessionId}
62
63
  locale={this.deps.locale}
63
64
  stepConfig={this.deps.stepConfig as HumanBasicInfoStepConfig | undefined}
65
+ prefill={this.deps.stepResult}
66
+ onBack={this.deps.onBack}
64
67
  onComplete={() => {
65
68
  if (this.destroyed) return;
66
69
  this.deps.ui.setNode(null);
@@ -87,6 +90,8 @@ interface ViewProps {
87
90
  sessionId: string;
88
91
  locale: string;
89
92
  stepConfig: HumanBasicInfoStepConfig | undefined;
93
+ prefill?: Record<string, unknown> | undefined;
94
+ onBack?: (() => void) | undefined;
90
95
  onComplete: () => void;
91
96
  onCancel: (err: SdkError) => void;
92
97
  }
@@ -96,6 +101,8 @@ function HumanBasicInfoView({
96
101
  sessionId,
97
102
  locale,
98
103
  stepConfig,
104
+ prefill,
105
+ onBack,
99
106
  onComplete,
100
107
  onCancel,
101
108
  }: ViewProps) {
@@ -107,10 +114,12 @@ function HumanBasicInfoView({
107
114
  }, [stepConfig, locale]);
108
115
 
109
116
  const [form, setForm] = useState<FormState>(() => ({
110
- first_name: '',
111
- last_name: '',
112
- identification_type: documentOptions[0]?.value ?? '',
113
- identification_id: '',
117
+ first_name: prefillString(prefill, 'first_name'),
118
+ last_name: prefillString(prefill, 'last_name'),
119
+ identification_type:
120
+ prefillString(prefill, 'identification_type') ||
121
+ (documentOptions[0]?.value ?? ''),
122
+ identification_id: prefillString(prefill, 'identification_id'),
114
123
  }));
115
124
  const [bannerError, setBannerError] = useState<string | null>(null);
116
125
  const [submitting, setSubmitting] = useState(false);
@@ -199,6 +208,9 @@ function HumanBasicInfoView({
199
208
  title={t.human_basic_info.title}
200
209
  subtitle={t.human_basic_info.subtitle}
201
210
  iconNode={<StepIcon name="badge" />}
211
+ onBack={onBack}
212
+ backLabel={t.common.back}
213
+ backDisabled={submitting}
202
214
  >
203
215
  <Input
204
216
  label={t.human_basic_info.givenNames}
@@ -32,7 +32,7 @@ import { StepIcon } from '../ui/icons/StepIcon';
32
32
  import { getStrings } from '../i18n';
33
33
  import type { ApiCaller } from '../transport/api';
34
34
  import type { StepDeps, StepModule } from './types';
35
- import { toSubmissionError } from './_shared';
35
+ import { prefillString, prefillStringOrNull, toSubmissionError } from './_shared';
36
36
 
37
37
  export class HumanExtendedInfoStep implements StepModule {
38
38
  private resolveStep!: () => void;
@@ -53,6 +53,8 @@ export class HumanExtendedInfoStep implements StepModule {
53
53
  stepConfig={
54
54
  this.deps.stepConfig as HumanExtendedInfoStepConfig | undefined
55
55
  }
56
+ prefill={this.deps.stepResult}
57
+ onBack={this.deps.onBack}
56
58
  onComplete={() => {
57
59
  if (this.destroyed) return;
58
60
  this.deps.ui.setNode(null);
@@ -105,6 +107,8 @@ interface ViewProps {
105
107
  sessionId: string;
106
108
  locale: string;
107
109
  stepConfig: HumanExtendedInfoStepConfig | undefined;
110
+ prefill?: Record<string, unknown> | undefined;
111
+ onBack?: (() => void) | undefined;
108
112
  onComplete: () => void;
109
113
  onCancel: (err: SdkError) => void;
110
114
  }
@@ -114,6 +118,8 @@ function HumanExtendedInfoView({
114
118
  sessionId,
115
119
  locale,
116
120
  stepConfig,
121
+ prefill,
122
+ onBack,
117
123
  onComplete,
118
124
  onCancel,
119
125
  }: ViewProps) {
@@ -145,14 +151,14 @@ function HumanExtendedInfoView({
145
151
  [f?.civil_status?.options, stepConfig?.civil_status_options],
146
152
  );
147
153
 
148
- const [form, setForm] = useState<FormState>({
149
- gender: '',
150
- civil_status: '',
151
- birth_date: null,
152
- birth_country: null,
153
- citizenship: null,
154
- residence_country: null,
155
- });
154
+ const [form, setForm] = useState<FormState>(() => ({
155
+ gender: prefillString(prefill, 'gender'),
156
+ civil_status: prefillString(prefill, 'civil_status'),
157
+ birth_date: prefillStringOrNull(prefill, 'birth_date'),
158
+ birth_country: prefillStringOrNull(prefill, 'birth_country'),
159
+ citizenship: prefillStringOrNull(prefill, 'citizenship'),
160
+ residence_country: prefillStringOrNull(prefill, 'residence_country'),
161
+ }));
156
162
  const [errors, setErrors] = useState<Partial<Record<keyof FormState, string>>>({});
157
163
  const [bannerError, setBannerError] = useState<string | null>(null);
158
164
  const [submitting, setSubmitting] = useState(false);
@@ -270,6 +276,9 @@ function HumanExtendedInfoView({
270
276
  title={t.human_extended_info.title}
271
277
  subtitle={t.human_extended_info.subtitle}
272
278
  iconNode={<StepIcon name="person" />}
279
+ onBack={onBack}
280
+ backLabel={t.common.back}
281
+ backDisabled={submitting}
273
282
  >
274
283
  {showGender ? (
275
284
  <Select
@@ -23,7 +23,7 @@ import { required, useInlineValidation } from '../ui/forms';
23
23
  import { getStrings } from '../i18n';
24
24
  import type { ApiCaller } from '../transport/api';
25
25
  import type { StepDeps, StepModule } from './types';
26
- import { toSubmissionError } from './_shared';
26
+ import { prefillString, toSubmissionError } from './_shared';
27
27
 
28
28
  export class LegalBasicInfoStep implements StepModule {
29
29
  private resolveStep!: () => void;
@@ -41,6 +41,8 @@ export class LegalBasicInfoStep implements StepModule {
41
41
  api={this.deps.api}
42
42
  sessionId={this.deps.sessionId}
43
43
  locale={this.deps.locale}
44
+ prefill={this.deps.stepResult}
45
+ onBack={this.deps.onBack}
44
46
  onComplete={() => {
45
47
  if (this.destroyed) return;
46
48
  this.deps.ui.setNode(null);
@@ -73,6 +75,8 @@ interface ViewProps {
73
75
  api: ApiCaller;
74
76
  sessionId: string;
75
77
  locale: string;
78
+ prefill?: Record<string, unknown> | undefined;
79
+ onBack?: (() => void) | undefined;
76
80
  onComplete: () => void;
77
81
  onCancel: (err: SdkError) => void;
78
82
  }
@@ -81,16 +85,18 @@ function LegalBasicInfoView({
81
85
  api,
82
86
  sessionId,
83
87
  locale,
88
+ prefill,
89
+ onBack,
84
90
  onComplete,
85
91
  onCancel,
86
92
  }: ViewProps) {
87
93
  const t = getStrings(locale);
88
- const [form, setForm] = useState<FormState>({
89
- legal_name: '',
90
- legal_form: '',
91
- identification_type: '',
92
- identification_id: '',
93
- });
94
+ const [form, setForm] = useState<FormState>(() => ({
95
+ legal_name: prefillString(prefill, 'legal_name'),
96
+ legal_form: prefillString(prefill, 'legal_form'),
97
+ identification_type: prefillString(prefill, 'identification_type'),
98
+ identification_id: prefillString(prefill, 'identification_id'),
99
+ }));
94
100
  const [bannerError, setBannerError] = useState<string | null>(null);
95
101
  const [submitting, setSubmitting] = useState(false);
96
102
  const [retry, setRetry] = useState<{ message: string } | null>(null);
@@ -156,6 +162,9 @@ function LegalBasicInfoView({
156
162
  title={t.legal_basic_info.title}
157
163
  subtitle={t.legal_basic_info.subtitle}
158
164
  iconNode={<StepIcon name="business" />}
165
+ onBack={onBack}
166
+ backLabel={t.common.back}
167
+ backDisabled={submitting}
159
168
  >
160
169
  <Input
161
170
  label={t.legal_basic_info.legalName}
@@ -23,7 +23,7 @@ import { StepIcon } from '../ui/icons/StepIcon';
23
23
  import { getStrings } from '../i18n';
24
24
  import type { ApiCaller } from '../transport/api';
25
25
  import type { StepDeps, StepModule } from './types';
26
- import { toSubmissionError } from './_shared';
26
+ import { prefillStringOrNull, toSubmissionError } from './_shared';
27
27
 
28
28
  export class LegalExtendedInfoStep implements StepModule {
29
29
  private resolveStep!: () => void;
@@ -41,6 +41,8 @@ export class LegalExtendedInfoStep implements StepModule {
41
41
  api={this.deps.api}
42
42
  sessionId={this.deps.sessionId}
43
43
  locale={this.deps.locale}
44
+ prefill={this.deps.stepResult}
45
+ onBack={this.deps.onBack}
44
46
  onComplete={() => {
45
47
  if (this.destroyed) return;
46
48
  this.deps.ui.setNode(null);
@@ -66,6 +68,8 @@ interface ViewProps {
66
68
  api: ApiCaller;
67
69
  sessionId: string;
68
70
  locale: string;
71
+ prefill?: Record<string, unknown> | undefined;
72
+ onBack?: (() => void) | undefined;
69
73
  onComplete: () => void;
70
74
  onCancel: (err: SdkError) => void;
71
75
  }
@@ -74,12 +78,18 @@ function LegalExtendedInfoView({
74
78
  api,
75
79
  sessionId,
76
80
  locale,
81
+ prefill,
82
+ onBack,
77
83
  onComplete,
78
84
  onCancel,
79
85
  }: ViewProps) {
80
86
  const t = getStrings(locale);
81
- const [date, setDate] = useState<string | null>(null);
82
- const [country, setCountry] = useState<string | null>(null);
87
+ const [date, setDate] = useState<string | null>(() =>
88
+ prefillStringOrNull(prefill, 'incorporation_date'),
89
+ );
90
+ const [country, setCountry] = useState<string | null>(() =>
91
+ prefillStringOrNull(prefill, 'incorporation_country'),
92
+ );
83
93
  const [errors, setErrors] = useState<{ date?: string | undefined; country?: string | undefined }>({});
84
94
  const [bannerError, setBannerError] = useState<string | null>(null);
85
95
  const [submitting, setSubmitting] = useState(false);
@@ -132,6 +142,9 @@ function LegalExtendedInfoView({
132
142
  title={t.legal_extended_info.title}
133
143
  subtitle={t.legal_extended_info.subtitle}
134
144
  iconNode={<StepIcon name="business-center" />}
145
+ onBack={onBack}
146
+ backLabel={t.common.back}
147
+ backDisabled={submitting}
135
148
  >
136
149
  <DatePicker
137
150
  label={t.legal_extended_info.incorporationDate}