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

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 (99) hide show
  1. package/lib/commonjs/camera/DocumentCapture.js +11 -3
  2. package/lib/commonjs/camera/DocumentCapture.js.map +1 -1
  3. package/lib/commonjs/camera/LivenessCamera.js +18 -3
  4. package/lib/commonjs/camera/LivenessCamera.js.map +1 -1
  5. package/lib/commonjs/camera/MapAddressPicker.js +12 -22
  6. package/lib/commonjs/camera/MapAddressPicker.js.map +1 -1
  7. package/lib/commonjs/core/VelionOnboarding.js +3 -0
  8. package/lib/commonjs/core/VelionOnboarding.js.map +1 -1
  9. package/lib/commonjs/i18n/strings/en.js +11 -0
  10. package/lib/commonjs/i18n/strings/en.js.map +1 -1
  11. package/lib/commonjs/i18n/strings/es.js +11 -0
  12. package/lib/commonjs/i18n/strings/es.js.map +1 -1
  13. package/lib/commonjs/index.js +12 -0
  14. package/lib/commonjs/index.js.map +1 -1
  15. package/lib/commonjs/steps/EconomicActivityStep.js +214 -0
  16. package/lib/commonjs/steps/EconomicActivityStep.js.map +1 -0
  17. package/lib/commonjs/types/index.js +16 -0
  18. package/lib/commonjs/types/index.js.map +1 -1
  19. package/lib/commonjs/ui/StepShell.js +19 -4
  20. package/lib/commonjs/ui/StepShell.js.map +1 -1
  21. package/lib/commonjs/ui/VelionOnboardingScreen.js +52 -13
  22. package/lib/commonjs/ui/VelionOnboardingScreen.js.map +1 -1
  23. package/lib/commonjs/ui/primitives/SearchableSingleSelectList.js +162 -0
  24. package/lib/commonjs/ui/primitives/SearchableSingleSelectList.js.map +1 -0
  25. package/lib/commonjs/ui/primitives/index.js +13 -0
  26. package/lib/commonjs/ui/primitives/index.js.map +1 -1
  27. package/lib/commonjs/ui/primitives/searchableSingleSelectFilter.js +31 -0
  28. package/lib/commonjs/ui/primitives/searchableSingleSelectFilter.js.map +1 -0
  29. package/lib/commonjs/utils/useSafeAreaInsets.js +41 -0
  30. package/lib/commonjs/utils/useSafeAreaInsets.js.map +1 -0
  31. package/lib/module/camera/DocumentCapture.js +11 -3
  32. package/lib/module/camera/DocumentCapture.js.map +1 -1
  33. package/lib/module/camera/LivenessCamera.js +18 -3
  34. package/lib/module/camera/LivenessCamera.js.map +1 -1
  35. package/lib/module/camera/MapAddressPicker.js +12 -23
  36. package/lib/module/camera/MapAddressPicker.js.map +1 -1
  37. package/lib/module/core/VelionOnboarding.js +3 -0
  38. package/lib/module/core/VelionOnboarding.js.map +1 -1
  39. package/lib/module/i18n/strings/en.js +11 -0
  40. package/lib/module/i18n/strings/en.js.map +1 -1
  41. package/lib/module/i18n/strings/es.js +11 -0
  42. package/lib/module/i18n/strings/es.js.map +1 -1
  43. package/lib/module/index.js +1 -1
  44. package/lib/module/index.js.map +1 -1
  45. package/lib/module/steps/EconomicActivityStep.js +209 -0
  46. package/lib/module/steps/EconomicActivityStep.js.map +1 -0
  47. package/lib/module/types/index.js +19 -0
  48. package/lib/module/types/index.js.map +1 -1
  49. package/lib/module/ui/StepShell.js +19 -4
  50. package/lib/module/ui/StepShell.js.map +1 -1
  51. package/lib/module/ui/VelionOnboardingScreen.js +55 -14
  52. package/lib/module/ui/VelionOnboardingScreen.js.map +1 -1
  53. package/lib/module/ui/primitives/SearchableSingleSelectList.js +153 -0
  54. package/lib/module/ui/primitives/SearchableSingleSelectList.js.map +1 -0
  55. package/lib/module/ui/primitives/index.js +1 -0
  56. package/lib/module/ui/primitives/index.js.map +1 -1
  57. package/lib/module/ui/primitives/searchableSingleSelectFilter.js +27 -0
  58. package/lib/module/ui/primitives/searchableSingleSelectFilter.js.map +1 -0
  59. package/lib/module/utils/useSafeAreaInsets.js +37 -0
  60. package/lib/module/utils/useSafeAreaInsets.js.map +1 -0
  61. package/lib/typescript/camera/DocumentCapture.d.ts.map +1 -1
  62. package/lib/typescript/camera/LivenessCamera.d.ts.map +1 -1
  63. package/lib/typescript/camera/MapAddressPicker.d.ts.map +1 -1
  64. package/lib/typescript/core/VelionOnboarding.d.ts.map +1 -1
  65. package/lib/typescript/i18n/strings/en.d.ts.map +1 -1
  66. package/lib/typescript/i18n/strings/es.d.ts +11 -0
  67. package/lib/typescript/i18n/strings/es.d.ts.map +1 -1
  68. package/lib/typescript/index.d.ts +2 -2
  69. package/lib/typescript/index.d.ts.map +1 -1
  70. package/lib/typescript/steps/EconomicActivityStep.d.ts +29 -0
  71. package/lib/typescript/steps/EconomicActivityStep.d.ts.map +1 -0
  72. package/lib/typescript/types/index.d.ts +31 -1
  73. package/lib/typescript/types/index.d.ts.map +1 -1
  74. package/lib/typescript/ui/StepShell.d.ts.map +1 -1
  75. package/lib/typescript/ui/VelionOnboardingScreen.d.ts.map +1 -1
  76. package/lib/typescript/ui/primitives/SearchableSingleSelectList.d.ts +33 -0
  77. package/lib/typescript/ui/primitives/SearchableSingleSelectList.d.ts.map +1 -0
  78. package/lib/typescript/ui/primitives/index.d.ts +1 -0
  79. package/lib/typescript/ui/primitives/index.d.ts.map +1 -1
  80. package/lib/typescript/ui/primitives/searchableSingleSelectFilter.d.ts +25 -0
  81. package/lib/typescript/ui/primitives/searchableSingleSelectFilter.d.ts.map +1 -0
  82. package/lib/typescript/utils/useSafeAreaInsets.d.ts +26 -0
  83. package/lib/typescript/utils/useSafeAreaInsets.d.ts.map +1 -0
  84. package/package.json +2 -1
  85. package/src/camera/DocumentCapture.tsx +12 -3
  86. package/src/camera/LivenessCamera.tsx +10 -3
  87. package/src/camera/MapAddressPicker.tsx +12 -18
  88. package/src/core/VelionOnboarding.ts +3 -0
  89. package/src/i18n/strings/en.ts +12 -0
  90. package/src/i18n/strings/es.ts +12 -0
  91. package/src/index.ts +7 -0
  92. package/src/steps/EconomicActivityStep.tsx +230 -0
  93. package/src/types/index.ts +34 -0
  94. package/src/ui/StepShell.tsx +20 -3
  95. package/src/ui/VelionOnboardingScreen.tsx +53 -13
  96. package/src/ui/primitives/SearchableSingleSelectList.tsx +195 -0
  97. package/src/ui/primitives/index.ts +6 -0
  98. package/src/ui/primitives/searchableSingleSelectFilter.ts +38 -0
  99. package/src/utils/useSafeAreaInsets.ts +37 -0
@@ -0,0 +1,33 @@
1
+ /**
2
+ * SearchableSingleSelectList — inline searchable list with single selection.
3
+ *
4
+ * Unlike {@link CountrySelect} (a modal combobox), this primitive renders the
5
+ * search field and the option list *inline*, filling the space it's given. The
6
+ * search bar stays fixed at the top while only the `FlatList` scrolls, so it
7
+ * virtualizes large lists without extra work and the keyboard never hides it.
8
+ *
9
+ * Selection semantics:
10
+ * - Exactly one option is selected, identified by its `id`.
11
+ * - A radio indicator + highlight mark the active row.
12
+ * - Search matches `label` OR `sublabel`, case-insensitive, contains.
13
+ *
14
+ * The host is expected to wrap this with its own fixed header (title/subtitle)
15
+ * above and a fixed footer (e.g. a "Continue" button) below, giving the
16
+ * primitive `flex: 1` so the list takes the remaining height.
17
+ */
18
+ import { type StyleProp, type ViewStyle } from 'react-native';
19
+ import { type SearchableListOption } from './searchableSingleSelectFilter';
20
+ export { filterSearchableOptions, type SearchableListOption, } from './searchableSingleSelectFilter';
21
+ export interface SearchableSingleSelectListProps {
22
+ items: ReadonlyArray<SearchableListOption>;
23
+ /** Currently-selected `id`, or `null` when nothing is selected. */
24
+ value: string | null;
25
+ onChange: (id: string) => void;
26
+ searchPlaceholder?: string | undefined;
27
+ /** Shown when the query matches no item. */
28
+ emptyText?: string | undefined;
29
+ disabled?: boolean | undefined;
30
+ style?: StyleProp<ViewStyle> | undefined;
31
+ }
32
+ export declare function SearchableSingleSelectList({ items, value, onChange, searchPlaceholder, emptyText, disabled, style, }: SearchableSingleSelectListProps): import("react").JSX.Element;
33
+ //# sourceMappingURL=SearchableSingleSelectList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SearchableSingleSelectList.d.ts","sourceRoot":"","sources":["../../../../src/ui/primitives/SearchableSingleSelectList.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAOL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAEtB,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,uBAAuB,EACvB,KAAK,oBAAoB,GAC1B,MAAM,gCAAgC,CAAC;AAExC,MAAM,WAAW,+BAA+B;IAC9C,KAAK,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;IAC3C,mEAAmE;IACnE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;CAC1C;AAED,wBAAgB,0BAA0B,CAAC,EACzC,KAAK,EACL,KAAK,EACL,QAAQ,EACR,iBAAiB,EACjB,SAAS,EACT,QAAgB,EAChB,KAAK,GACN,EAAE,+BAA+B,+BAyFjC"}
@@ -8,4 +8,5 @@ export { Spinner, type SpinnerProps } from './Spinner';
8
8
  export { Checkbox, type CheckboxProps } from './Checkbox';
9
9
  export { DatePicker, type DatePickerProps } from './DatePicker';
10
10
  export { CountrySelect, type CountrySelectProps } from './CountrySelect';
11
+ export { SearchableSingleSelectList, filterSearchableOptions, type SearchableSingleSelectListProps, type SearchableListOption, } from './SearchableSingleSelectList';
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ui/primitives/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ui/primitives/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,EACvB,KAAK,+BAA+B,EACpC,KAAK,oBAAoB,GAC1B,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Pure search logic for {@link SearchableSingleSelectList}, kept in a JSX-free
3
+ * `.ts` module so it can be unit-tested in the `node` test environment without
4
+ * pulling React Native into the import graph.
5
+ */
6
+ /** One selectable row. `id` is the value the list reports on selection. */
7
+ export interface SearchableListOption {
8
+ id: string;
9
+ label: string;
10
+ /** Optional secondary line rendered under the label; also matched by search. */
11
+ sublabel?: string | undefined;
12
+ /**
13
+ * Extra search terms folded into matching but never rendered — e.g. an
14
+ * internal activity code the user can search by without it cluttering the row.
15
+ */
16
+ keywords?: string | undefined;
17
+ }
18
+ /**
19
+ * Filters options by a free-text query: case-insensitive `contains` over the
20
+ * `label`, the (rendered) `sublabel`, and the (hidden) `keywords`. An
21
+ * empty/whitespace query returns the list unchanged (a fresh array — the input
22
+ * is never mutated).
23
+ */
24
+ export declare function filterSearchableOptions(items: ReadonlyArray<SearchableListOption>, query: string): SearchableListOption[];
25
+ //# sourceMappingURL=searchableSingleSelectFilter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"searchableSingleSelectFilter.d.ts","sourceRoot":"","sources":["../../../../src/ui/primitives/searchableSingleSelectFilter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,2EAA2E;AAC3E,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,gFAAgF;IAChF,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,aAAa,CAAC,oBAAoB,CAAC,EAC1C,KAAK,EAAE,MAAM,GACZ,oBAAoB,EAAE,CASxB"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @fileoverview Shared safe-area inset hook with a dynamic, fail-safe loader.
3
+ *
4
+ * `react-native-safe-area-context` is a transitive peer of Expo SDK 54+ (and is
5
+ * declared as a peerDependency of this SDK), but we never import it statically:
6
+ * hosts that strip optional native deps, or render the SDK outside a
7
+ * `SafeAreaProvider`, must still get a usable layout. So the hook is loaded with
8
+ * a `require` inside a try/catch and falls back to zero insets.
9
+ *
10
+ * The `require` result is deterministic for the lifetime of the bundle (the
11
+ * module is either installed or not), so the conditional hook call below does
12
+ * not change across renders — it does not violate the rules of hooks. Callers
13
+ * MUST still invoke this hook unconditionally (before any early return).
14
+ *
15
+ * Insets are applied to UI chrome (headers, CTAs, camera controls) — never to
16
+ * the full-bleed `<Camera>` / `<MapView>` preview, which must keep covering the
17
+ * whole screen so OCR / liveness framing is not cropped.
18
+ */
19
+ export interface EdgeInsets {
20
+ top: number;
21
+ bottom: number;
22
+ left: number;
23
+ right: number;
24
+ }
25
+ export declare function useSafeAreaInsets(): EdgeInsets;
26
+ //# sourceMappingURL=useSafeAreaInsets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSafeAreaInsets.d.ts","sourceRoot":"","sources":["../../../src/utils/useSafeAreaInsets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAID,wBAAgB,iBAAiB,IAAI,UAAU,CAQ9C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velion-la/onboarding-sdk-react-native",
3
- "version": "1.0.0-beta.7",
3
+ "version": "1.0.0-beta.9",
4
4
  "description": "Native React Native SDK for the Velion Onboarding (KYC) flow: ID document OCR, passive + active liveness, device fingerprint, OTP verification, address picker, and personal / legal information forms.",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "module": "./lib/module/index.js",
@@ -74,6 +74,7 @@
74
74
  "react": ">=19.0.0",
75
75
  "react-native": ">=0.81.0",
76
76
  "react-native-maps": ">=1.20.0",
77
+ "react-native-safe-area-context": ">=4.0.0",
77
78
  "react-native-svg": ">=15.0.0",
78
79
  "react-native-vision-camera": ">=4.6.0"
79
80
  },
@@ -32,6 +32,7 @@ import {
32
32
  import type { DocumentOrientation, DocumentSide } from '../types';
33
33
  import { useTheme, withAlpha } from '../ui/theme';
34
34
  import { Button } from '../ui/primitives/Button';
35
+ import { useSafeAreaInsets } from '../utils/useSafeAreaInsets';
35
36
 
36
37
  export interface DocumentCaptureProps {
37
38
  side: DocumentSide;
@@ -62,6 +63,7 @@ export function DocumentCapture({
62
63
  onCancel,
63
64
  }: DocumentCaptureProps) {
64
65
  const theme = useTheme();
66
+ const insets = useSafeAreaInsets();
65
67
  const cameraRef = useRef<Camera>(null);
66
68
  // Cross-platform back-camera selection.
67
69
  //
@@ -249,15 +251,22 @@ export function DocumentCapture({
249
251
  ]}
250
252
  />
251
253
  ) : null}
252
- <View style={styles.topBar}>
254
+ {/* The <Camera> above stays full-bleed (absoluteFill) so OCR framing is
255
+ never cropped; only the chrome below is offset by the safe-area
256
+ insets so the ✕ clears the top notch and the shutter clears the
257
+ bottom navigation bar / gesture area. */}
258
+ <View style={[styles.topBar, { top: insets.top + 12 }]}>
253
259
  <Pressable onPress={onCancel} style={styles.iconBtn} accessibilityLabel={cancelLabel}>
254
260
  <Text style={styles.iconBtnText}>✕</Text>
255
261
  </Pressable>
256
262
  </View>
257
- <View style={styles.instructions} pointerEvents="none">
263
+ <View
264
+ style={[styles.instructions, { top: insets.top + 60 }]}
265
+ pointerEvents="none"
266
+ >
258
267
  <Text style={styles.instructionsText}>{instructions}</Text>
259
268
  </View>
260
- <View style={styles.bottomBar}>
269
+ <View style={[styles.bottomBar, { bottom: insets.bottom + 32 }]}>
261
270
  {error ? <Text style={styles.errorText}>{error}</Text> : null}
262
271
  <Pressable
263
272
  accessibilityRole="button"
@@ -42,6 +42,7 @@ import {
42
42
  } from 'react-native-vision-camera';
43
43
  import { Button } from '../ui/primitives/Button';
44
44
  import { useTheme, withAlpha } from '../ui/theme';
45
+ import { useSafeAreaInsets } from '../utils/useSafeAreaInsets';
45
46
 
46
47
  export interface LivenessCameraHandle {
47
48
  takeFrame: () => Promise<PhotoFile | null>;
@@ -95,6 +96,7 @@ export interface LivenessCameraProps {
95
96
  export const LivenessCamera = forwardRef<LivenessCameraHandle, LivenessCameraProps>(
96
97
  function LivenessCamera(props, ref) {
97
98
  const theme = useTheme();
99
+ const insets = useSafeAreaInsets();
98
100
  const cameraRef = useRef<Camera>(null);
99
101
  const device = useCameraDevice('front');
100
102
  // Pick a 720p / 30-fps format so the recorded mp4 stays a few MB instead
@@ -301,7 +303,7 @@ export const LivenessCamera = forwardRef<LivenessCameraHandle, LivenessCameraPro
301
303
  />
302
304
  ) : null}
303
305
  {props.statusText ? (
304
- <View style={styles.statusPill}>
306
+ <View style={[styles.statusPill, { top: insets.top + 130 }]}>
305
307
  <ActivityIndicator color="#FFFFFF" size="small" />
306
308
  <Text style={styles.statusText}>{props.statusText}</Text>
307
309
  </View>
@@ -310,6 +312,7 @@ export const LivenessCamera = forwardRef<LivenessCameraHandle, LivenessCameraPro
310
312
  <View
311
313
  style={[
312
314
  styles.toast,
315
+ { bottom: insets.bottom + 100 },
313
316
  {
314
317
  backgroundColor:
315
318
  props.toast.kind === 'success'
@@ -347,6 +350,8 @@ interface ProgressBarProps {
347
350
  * so the user can tell the system is still listening.
348
351
  */
349
352
  function ProgressBar({ progress, color }: ProgressBarProps) {
353
+ const insets = useSafeAreaInsets();
354
+ const trackBottom = insets.bottom + 60;
350
355
  const clamped = Math.max(0, Math.min(1, progress));
351
356
  const isIndeterminate = clamped < 0.05;
352
357
 
@@ -376,7 +381,7 @@ function ProgressBar({ progress, color }: ProgressBarProps) {
376
381
  outputRange: ['-30%', '100%'],
377
382
  });
378
383
  return (
379
- <View style={styles.progressTrack}>
384
+ <View style={[styles.progressTrack, { bottom: trackBottom }]}>
380
385
  <Animated.View
381
386
  style={[
382
387
  styles.progressShimmer,
@@ -388,7 +393,7 @@ function ProgressBar({ progress, color }: ProgressBarProps) {
388
393
  }
389
394
 
390
395
  return (
391
- <View style={styles.progressTrack}>
396
+ <View style={[styles.progressTrack, { bottom: trackBottom }]}>
392
397
  <View
393
398
  style={[
394
399
  styles.progressBar,
@@ -421,6 +426,7 @@ interface ChallengeBannerProps {
421
426
  * line / icon if needed without changing the call site.
422
427
  */
423
428
  function ChallengeBanner({ text, tint: _tint }: ChallengeBannerProps) {
429
+ const insets = useSafeAreaInsets();
424
430
  const opacity = useRef(new Animated.Value(0)).current;
425
431
  const scale = useRef(new Animated.Value(0.85)).current;
426
432
 
@@ -451,6 +457,7 @@ function ChallengeBanner({ text, tint: _tint }: ChallengeBannerProps) {
451
457
  pointerEvents="none"
452
458
  style={[
453
459
  styles.challengeBanner,
460
+ { top: insets.top + 76 },
454
461
  {
455
462
  opacity,
456
463
  transform: [{ scale }],
@@ -47,21 +47,9 @@ import {
47
47
  type ParsedAddressFields,
48
48
  } from '../utils/parseGoogleAddressComponents';
49
49
  import { log } from '../utils/log';
50
+ import { useSafeAreaInsets } from '../utils/useSafeAreaInsets';
50
51
  import { AddressSearchBar, type AddressSuggestion } from './AddressSearchBar';
51
52
 
52
- // `react-native-safe-area-context` is a transitive peer of Expo SDK 54+, but
53
- // not a direct dep of this SDK. Load it dynamically with a safe fallback so
54
- // hosts that strip optional deps still get reasonable inset values.
55
- function useSafeAreaInsets(): { top: number; bottom: number; left: number; right: number } {
56
- try {
57
- // eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
58
- const mod = require('react-native-safe-area-context');
59
- return mod.useSafeAreaInsets();
60
- } catch {
61
- return { top: 0, bottom: 0, left: 0, right: 0 };
62
- }
63
- }
64
-
65
53
  const floatingShadow = {
66
54
  shadowColor: '#000',
67
55
  shadowOffset: { width: 0, height: 2 },
@@ -148,6 +136,15 @@ export function MapAddressPicker(
148
136
  props: MapAddressPickerProps,
149
137
  ) {
150
138
  const theme = useTheme();
139
+ // Hooks must run unconditionally — call this before the `!modules.MapView`
140
+ // early return below.
141
+ const insets = useSafeAreaInsets();
142
+ const topInset = Math.max(insets.top, Platform.OS === 'ios' ? 44 : 16);
143
+ const bottomInset = Math.max(insets.bottom, 16);
144
+ // Lift the floating "Next" button a notch above the safe-area inset so it
145
+ // doesn't sit flush against the iOS home indicator / Android gesture bar,
146
+ // which made it look clipped by the screen edge.
147
+ const buttonBottom = bottomInset + 12;
151
148
  const modules = useRef<NativeModules>(loadNativeModules()).current;
152
149
 
153
150
  const [coord, setCoord] = useState<{ latitude: number; longitude: number } | null>(
@@ -274,9 +271,6 @@ export function MapAddressPicker(
274
271
  }
275
272
 
276
273
  const { MapView, Marker, PROVIDER_GOOGLE } = modules;
277
- const insets = useSafeAreaInsets();
278
- const topInset = Math.max(insets.top, Platform.OS === 'ios' ? 44 : 16);
279
- const bottomInset = Math.max(insets.bottom, 16);
280
274
 
281
275
  return (
282
276
  <View style={styles.root}>
@@ -333,7 +327,7 @@ export function MapAddressPicker(
333
327
  {/* Floating banners stack above the bottom button. */}
334
328
  <View
335
329
  pointerEvents="box-none"
336
- style={[styles.floatNotes, { bottom: bottomInset + 76 }]}
330
+ style={[styles.floatNotes, { bottom: buttonBottom + 76 }]}
337
331
  >
338
332
  {permissionDenied ? (
339
333
  <Banner variant="warning" message={props.locationDenied} />
@@ -349,7 +343,7 @@ export function MapAddressPicker(
349
343
  disabled={
350
344
  !parsed || !isAddressSelectionComplete(parsed, props.requiredFields)
351
345
  }
352
- style={[styles.floatBottom, { bottom: bottomInset }, floatingShadow]}
346
+ style={[styles.floatBottom, { bottom: buttonBottom }, floatingShadow]}
353
347
  />
354
348
  </View>
355
349
  );
@@ -42,6 +42,7 @@ import { EmailOtpStep } from '../steps/EmailOtpStep';
42
42
  import { PhoneOtpStep } from '../steps/PhoneOtpStep';
43
43
  import { TaxInfoStep } from '../steps/TaxInfoStep';
44
44
  import { SwornDeclarationStep } from '../steps/SwornDeclarationStep';
45
+ import { EconomicActivityStep } from '../steps/EconomicActivityStep';
45
46
  import { TermsAndConditionsStep } from '../steps/TermsAndConditionsStep';
46
47
  import { LegalBasicInfoStep } from '../steps/LegalBasicInfoStep';
47
48
  import { HumanExtendedInfoStep } from '../steps/HumanExtendedInfoStep';
@@ -690,6 +691,8 @@ export class VelionOnboarding {
690
691
  return new TaxInfoStep(deps);
691
692
  case 'SWORN_DECLARATION':
692
693
  return new SwornDeclarationStep(deps);
694
+ case 'ECONOMIC_ACTIVITY_DECLARATION':
695
+ return new EconomicActivityStep(deps);
693
696
  case 'TERMS_AND_CONDITIONS':
694
697
  return new TermsAndConditionsStep(deps);
695
698
  case 'LEGAL_BASIC_INFO':
@@ -104,6 +104,13 @@ export const EN: StringsTable = {
104
104
  none: 'None of the above',
105
105
  noneDescription: 'I do not fall under any of these regulations.',
106
106
  },
107
+ economic_activity: {
108
+ title: 'Economic activity',
109
+ subtitle: 'Search and select your main economic activity.',
110
+ searchPlaceholder: 'Search by name or code',
111
+ empty: 'No activities match your search.',
112
+ required: 'Select an activity to continue.',
113
+ },
107
114
  terms_and_conditions: {
108
115
  title: 'Terms and conditions',
109
116
  subtitle: 'Review each item and confirm your acceptance to continue.',
@@ -318,6 +325,11 @@ export const EN: StringsTable = {
318
325
  message:
319
326
  'We could not validate your tax information. Try again and review the details you entered.',
320
327
  },
328
+ ECONOMIC_ACTIVITY_DECLARATION: {
329
+ title: 'Review your economic activity',
330
+ message:
331
+ 'We could not validate the selected activity. Try again and pick an activity from the list.',
332
+ },
321
333
  },
322
334
  },
323
335
  };
@@ -107,6 +107,13 @@ export const ES = {
107
107
  none: 'Ninguna de las anteriores',
108
108
  noneDescription: 'No aplico a ninguna de estas normas.',
109
109
  },
110
+ economic_activity: {
111
+ title: 'Actividad económica',
112
+ subtitle: 'Buscá y seleccioná tu actividad económica principal.',
113
+ searchPlaceholder: 'Buscar por nombre o código',
114
+ empty: 'No encontramos actividades para tu búsqueda.',
115
+ required: 'Seleccioná una actividad para continuar.',
116
+ },
110
117
  terms_and_conditions: {
111
118
  title: 'Términos y condiciones',
112
119
  subtitle: 'Revisá cada punto y marcá que aceptás para continuar.',
@@ -318,6 +325,11 @@ export const ES = {
318
325
  message:
319
326
  'No pudimos validar tu información impositiva. Reintentá revisando los datos ingresados.',
320
327
  },
328
+ ECONOMIC_ACTIVITY_DECLARATION: {
329
+ title: 'Revisá tu actividad económica',
330
+ message:
331
+ 'No pudimos validar la actividad seleccionada. Reintentá eligiendo una actividad de la lista.',
332
+ },
321
333
  },
322
334
  },
323
335
  };
package/src/index.ts CHANGED
@@ -54,6 +54,8 @@ export {
54
54
  Checkbox,
55
55
  DatePicker,
56
56
  CountrySelect,
57
+ SearchableSingleSelectList,
58
+ filterSearchableOptions,
57
59
  type ButtonProps,
58
60
  type ButtonVariant,
59
61
  type InputProps,
@@ -65,6 +67,8 @@ export {
65
67
  type CheckboxProps,
66
68
  type DatePickerProps,
67
69
  type CountrySelectProps,
70
+ type SearchableSingleSelectListProps,
71
+ type SearchableListOption,
68
72
  } from './ui/primitives';
69
73
  export {
70
74
  LoadingOverlay,
@@ -114,6 +118,8 @@ export type {
114
118
  TaxInfoStepConfig,
115
119
  AddressInfoStepConfig,
116
120
  SwornDeclarationStepConfig,
121
+ EconomicActivityStepConfig,
122
+ EconomicActivityItem,
117
123
  DocumentsOcrStepConfig,
118
124
  TermsAndConditionsStepConfig,
119
125
  // Payloads
@@ -123,6 +129,7 @@ export type {
123
129
  LegalExtendedInfoPayload,
124
130
  AddressInfoPayload,
125
131
  SwornDeclarationPayload,
132
+ EconomicActivitySelectionPayload,
126
133
  EmailContactPayload,
127
134
  PhoneContactPayload,
128
135
  TaxInfoPayload,
@@ -0,0 +1,230 @@
1
+ /**
2
+ * ECONOMIC_ACTIVITY_DECLARATION — POST /sessions/:id/economic-activity { code }.
3
+ *
4
+ * The session exposes the selectable activities in `current_step.config.items`
5
+ * (`{ code, display_name }`). The user picks exactly one from a searchable list
6
+ * and the SDK submits its `code`.
7
+ *
8
+ * Submission is fire-and-forget on the backend: the POST returns 200 immediately
9
+ * and the Worker validates the `code` asynchronously. An invalid selection is
10
+ * reported back over SSE as `RETRY_STEP` (handled generically by the orchestrator,
11
+ * which re-mounts this step cleanly) or `SESSION_DECLINED` once retries are
12
+ * exhausted — it never surfaces as an HTTP error here. The local `RetryDialog`
13
+ * below therefore only covers transport failures of the POST itself.
14
+ *
15
+ * UI (per OSDKR-10): no combobox/Picker — fixed header + search bar, an inline
16
+ * virtualized `FlatList` (via `SearchableSingleSelectList`), single selection,
17
+ * and a fixed "Continue" button disabled until something is selected.
18
+ */
19
+
20
+ import { useCallback, useMemo, useState } from 'react';
21
+ import { KeyboardAvoidingView, Platform, StyleSheet, Text, View } from 'react-native';
22
+ import {
23
+ SdkErrorCode,
24
+ type EconomicActivitySelectionPayload,
25
+ type EconomicActivityStepConfig,
26
+ type SdkError,
27
+ } from '../types';
28
+ import { Banner } from '../ui/primitives/Banner';
29
+ import { BackButton } from '../ui/primitives/BackButton';
30
+ import { Button } from '../ui/primitives/Button';
31
+ import {
32
+ SearchableSingleSelectList,
33
+ type SearchableListOption,
34
+ } from '../ui/primitives/SearchableSingleSelectList';
35
+ import { LoadingOverlay } from '../ui/overlays/LoadingOverlay';
36
+ import { RetryDialog } from '../ui/overlays/RetryDialog';
37
+ import { useTheme } from '../ui/theme';
38
+ import { getStrings } from '../i18n';
39
+ import type { ApiCaller } from '../transport/api';
40
+ import { prefillStringOrNull, toSubmissionError } from './_shared';
41
+ import type { StepDeps, StepModule } from './types';
42
+
43
+ export class EconomicActivityStep implements StepModule {
44
+ private resolveStep!: () => void;
45
+ private rejectStep!: (err: SdkError) => void;
46
+ private destroyed = false;
47
+
48
+ constructor(private readonly deps: StepDeps) {}
49
+
50
+ run(): Promise<void> {
51
+ return new Promise((resolve, reject) => {
52
+ this.resolveStep = resolve;
53
+ this.rejectStep = reject;
54
+ this.deps.ui.setNode(
55
+ <EconomicActivityView
56
+ api={this.deps.api}
57
+ sessionId={this.deps.sessionId}
58
+ locale={this.deps.locale}
59
+ stepConfig={this.deps.stepConfig as EconomicActivityStepConfig | undefined}
60
+ prefill={this.deps.stepResult}
61
+ onBack={this.deps.onBack}
62
+ onComplete={() => {
63
+ if (this.destroyed) return;
64
+ this.deps.ui.setNode(null);
65
+ this.resolveStep();
66
+ }}
67
+ onCancel={(err) => {
68
+ if (this.destroyed) return;
69
+ this.deps.ui.setNode(null);
70
+ this.rejectStep(err);
71
+ }}
72
+ />,
73
+ );
74
+ });
75
+ }
76
+
77
+ destroy(): void {
78
+ this.destroyed = true;
79
+ this.deps.ui.setNode(null);
80
+ }
81
+ }
82
+
83
+ interface ViewProps {
84
+ api: ApiCaller;
85
+ sessionId: string;
86
+ locale: string;
87
+ stepConfig: EconomicActivityStepConfig | undefined;
88
+ prefill?: Record<string, unknown> | undefined;
89
+ onBack?: (() => void) | undefined;
90
+ onComplete: () => void;
91
+ onCancel: (err: SdkError) => void;
92
+ }
93
+
94
+ function EconomicActivityView({
95
+ api,
96
+ sessionId,
97
+ locale,
98
+ stepConfig,
99
+ prefill,
100
+ onBack,
101
+ onComplete,
102
+ onCancel,
103
+ }: ViewProps) {
104
+ const t = getStrings(locale);
105
+ const theme = useTheme();
106
+
107
+ const options = useMemo<SearchableListOption[]>(() => {
108
+ const items = stepConfig?.items ?? [];
109
+ return items
110
+ .filter((it) => typeof it?.code === 'string' && it.code.length > 0)
111
+ .map((it) => ({
112
+ id: it.code,
113
+ label: it.display_name ?? it.code,
114
+ // The code is internal — searchable but not rendered on the row.
115
+ keywords: it.code,
116
+ }));
117
+ }, [stepConfig]);
118
+
119
+ const [selected, setSelected] = useState<string | null>(() =>
120
+ prefillStringOrNull(prefill, 'selected_code'),
121
+ );
122
+ const [bannerError, setBannerError] = useState<string | null>(null);
123
+ const [submitting, setSubmitting] = useState(false);
124
+ const [retry, setRetry] = useState<{ message: string } | null>(null);
125
+
126
+ const handleSubmit = useCallback(async () => {
127
+ if (!selected) return;
128
+ setBannerError(null);
129
+ const payload: EconomicActivitySelectionPayload = { code: selected };
130
+ setSubmitting(true);
131
+ try {
132
+ await api.post(`/sessions/${sessionId}/economic-activity`, payload);
133
+ setSubmitting(false);
134
+ onComplete();
135
+ } catch (err) {
136
+ setSubmitting(false);
137
+ const sdkErr = toSubmissionError(err, t);
138
+ setBannerError(sdkErr.message);
139
+ setRetry({ message: sdkErr.message });
140
+ }
141
+ }, [api, onComplete, selected, sessionId, t]);
142
+
143
+ if (retry) {
144
+ return (
145
+ <RetryDialog
146
+ title={t.common.submissionTitle}
147
+ message={retry.message || t.common.submissionFallback}
148
+ retryLabel={t.common.retry}
149
+ cancelLabel={t.common.cancel}
150
+ onRetry={() => setRetry(null)}
151
+ onCancel={() => {
152
+ setRetry(null);
153
+ onCancel({ code: SdkErrorCode.API_ERROR, message: retry.message });
154
+ }}
155
+ />
156
+ );
157
+ }
158
+
159
+ return (
160
+ <KeyboardAvoidingView
161
+ style={[styles.flex, { backgroundColor: theme.backgroundColor }]}
162
+ behavior={Platform.OS === 'ios' ? 'padding' : undefined}
163
+ >
164
+ <View style={styles.body}>
165
+ {onBack ? (
166
+ <BackButton label={t.common.back} onPress={onBack} disabled={submitting} />
167
+ ) : null}
168
+ <View style={styles.header}>
169
+ <Text style={[styles.title, { color: theme.textColor }]}>
170
+ {t.economic_activity.title}
171
+ </Text>
172
+ <Text style={[styles.subtitle, { color: theme.textSecondaryColor }]}>
173
+ {t.economic_activity.subtitle}
174
+ </Text>
175
+ </View>
176
+ <SearchableSingleSelectList
177
+ items={options}
178
+ value={selected}
179
+ onChange={setSelected}
180
+ searchPlaceholder={t.economic_activity.searchPlaceholder}
181
+ emptyText={t.economic_activity.empty}
182
+ disabled={submitting}
183
+ style={styles.list}
184
+ />
185
+ {bannerError ? <Banner message={bannerError} /> : null}
186
+ <View style={styles.footer}>
187
+ <Button
188
+ label={t.common.continue}
189
+ onPress={handleSubmit}
190
+ loading={submitting}
191
+ disabled={submitting || !selected}
192
+ />
193
+ </View>
194
+ </View>
195
+ {submitting ? <LoadingOverlay message={t.common.submitting} /> : null}
196
+ </KeyboardAvoidingView>
197
+ );
198
+ }
199
+
200
+ const styles = StyleSheet.create({
201
+ flex: {
202
+ flex: 1,
203
+ },
204
+ body: {
205
+ flex: 1,
206
+ paddingHorizontal: 18,
207
+ paddingTop: 12,
208
+ paddingBottom: 16,
209
+ },
210
+ header: {
211
+ marginBottom: 12,
212
+ },
213
+ title: {
214
+ fontSize: 20,
215
+ fontWeight: '700',
216
+ letterSpacing: -0.3,
217
+ },
218
+ subtitle: {
219
+ marginTop: 6,
220
+ fontSize: 14,
221
+ fontWeight: '400',
222
+ lineHeight: 20,
223
+ },
224
+ list: {
225
+ flex: 1,
226
+ },
227
+ footer: {
228
+ marginTop: 12,
229
+ },
230
+ });