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

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 (58) hide show
  1. package/lib/commonjs/camera/DocumentCapture.js +67 -26
  2. package/lib/commonjs/camera/DocumentCapture.js.map +1 -1
  3. package/lib/commonjs/i18n/strings/en.js +3 -2
  4. package/lib/commonjs/i18n/strings/en.js.map +1 -1
  5. package/lib/commonjs/i18n/strings/es.js +3 -2
  6. package/lib/commonjs/i18n/strings/es.js.map +1 -1
  7. package/lib/commonjs/steps/DocumentsOcrStep.js +121 -23
  8. package/lib/commonjs/steps/DocumentsOcrStep.js.map +1 -1
  9. package/lib/commonjs/steps/PhoneContactStep.js +10 -4
  10. package/lib/commonjs/steps/PhoneContactStep.js.map +1 -1
  11. package/lib/commonjs/steps/PhoneOtpStep.js +17 -6
  12. package/lib/commonjs/steps/PhoneOtpStep.js.map +1 -1
  13. package/lib/commonjs/ui/StepShell.js +122 -12
  14. package/lib/commonjs/ui/StepShell.js.map +1 -1
  15. package/lib/commonjs/ui/overlays/ProgressBar.js +8 -2
  16. package/lib/commonjs/ui/overlays/ProgressBar.js.map +1 -1
  17. package/lib/commonjs/utils/documentCrop.js +115 -0
  18. package/lib/commonjs/utils/documentCrop.js.map +1 -0
  19. package/lib/module/camera/DocumentCapture.js +67 -26
  20. package/lib/module/camera/DocumentCapture.js.map +1 -1
  21. package/lib/module/i18n/strings/en.js +3 -2
  22. package/lib/module/i18n/strings/en.js.map +1 -1
  23. package/lib/module/i18n/strings/es.js +3 -2
  24. package/lib/module/i18n/strings/es.js.map +1 -1
  25. package/lib/module/steps/DocumentsOcrStep.js +121 -23
  26. package/lib/module/steps/DocumentsOcrStep.js.map +1 -1
  27. package/lib/module/steps/PhoneContactStep.js +10 -4
  28. package/lib/module/steps/PhoneContactStep.js.map +1 -1
  29. package/lib/module/steps/PhoneOtpStep.js +17 -6
  30. package/lib/module/steps/PhoneOtpStep.js.map +1 -1
  31. package/lib/module/ui/StepShell.js +122 -13
  32. package/lib/module/ui/StepShell.js.map +1 -1
  33. package/lib/module/ui/overlays/ProgressBar.js +8 -1
  34. package/lib/module/ui/overlays/ProgressBar.js.map +1 -1
  35. package/lib/module/utils/documentCrop.js +109 -0
  36. package/lib/module/utils/documentCrop.js.map +1 -0
  37. package/lib/typescript/camera/DocumentCapture.d.ts +20 -8
  38. package/lib/typescript/camera/DocumentCapture.d.ts.map +1 -1
  39. package/lib/typescript/i18n/strings/en.d.ts.map +1 -1
  40. package/lib/typescript/i18n/strings/es.d.ts +1 -0
  41. package/lib/typescript/i18n/strings/es.d.ts.map +1 -1
  42. package/lib/typescript/steps/DocumentsOcrStep.d.ts +8 -6
  43. package/lib/typescript/steps/DocumentsOcrStep.d.ts.map +1 -1
  44. package/lib/typescript/ui/StepShell.d.ts.map +1 -1
  45. package/lib/typescript/ui/overlays/ProgressBar.d.ts +6 -0
  46. package/lib/typescript/ui/overlays/ProgressBar.d.ts.map +1 -1
  47. package/lib/typescript/utils/documentCrop.d.ts +62 -0
  48. package/lib/typescript/utils/documentCrop.d.ts.map +1 -0
  49. package/package.json +1 -1
  50. package/src/camera/DocumentCapture.tsx +66 -25
  51. package/src/i18n/strings/en.ts +3 -2
  52. package/src/i18n/strings/es.ts +3 -2
  53. package/src/steps/DocumentsOcrStep.tsx +145 -24
  54. package/src/steps/PhoneContactStep.tsx +9 -3
  55. package/src/steps/PhoneOtpStep.tsx +14 -4
  56. package/src/ui/StepShell.tsx +114 -12
  57. package/src/ui/overlays/ProgressBar.tsx +8 -1
  58. package/src/utils/documentCrop.ts +138 -0
@@ -8,9 +8,12 @@
8
8
  * so they read as a single visual family.
9
9
  */
10
10
 
11
- import { KeyboardAvoidingView, Platform, ScrollView, StyleSheet, Text, View } from 'react-native';
11
+ import { useRef } from 'react';
12
+ import { Animated, KeyboardAvoidingView, Platform, StyleSheet, Text, View } from 'react-native';
13
+ import Svg, { Defs, LinearGradient as SvgLinearGradient, Rect, Stop } from 'react-native-svg';
12
14
  import { useTheme, withAlpha } from './theme';
13
15
  import { BackButton } from './primitives/BackButton';
16
+ import { PROGRESS_BAR_HEIGHT } from './overlays/ProgressBar';
14
17
  import { useSafeAreaInsets } from '../utils/useSafeAreaInsets';
15
18
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
19
  export function StepShell({
@@ -26,23 +29,42 @@ export function StepShell({
26
29
  const theme = useTheme();
27
30
  const insets = useSafeAreaInsets();
28
31
  const showIconCircle = !theme.hideStepIcons && iconNode != null;
29
- const body = /*#__PURE__*/_jsxs(ScrollView, {
30
- style: styles.scroll
31
- // Add the device safe-area insets to the base padding so the header
32
- // (icon + title) clears the top camera / notch and the trailing CTA
33
- // clears the bottom navigation bar / gesture area on edge-to-edge
34
- // Android and on iOS devices with a home indicator.
32
+ const showBack = onBack != null;
33
+
34
+ // Drive the top-fade opacity from the scroll offset so the gradient is fully
35
+ // invisible at rest (scrollY = 0) — the header/icon reads crisp — and only
36
+ // ramps in as the content scrolls up under the fixed back strip (OSDKR-12).
37
+ const scrollY = useRef(new Animated.Value(0)).current;
38
+ const fadeOpacity = scrollY.interpolate({
39
+ inputRange: [0, FADE_RAMP_DISTANCE],
40
+ outputRange: [0, 1],
41
+ extrapolate: 'clamp'
42
+ });
43
+ const scroll = /*#__PURE__*/_jsxs(Animated.ScrollView, {
44
+ style: styles.scroll,
45
+ scrollEventThrottle: 16,
46
+ onScroll: Animated.event([{
47
+ nativeEvent: {
48
+ contentOffset: {
49
+ y: scrollY
50
+ }
51
+ }
52
+ }], {
53
+ useNativeDriver: true
54
+ })
55
+ // When the fixed back strip is present it already clears the status bar +
56
+ // progress bar, so the scroll body only needs its base top padding.
57
+ // Without it, add the device safe-area insets so the header (icon + title)
58
+ // clears the top camera / notch. The bottom inset always clears the
59
+ // navigation bar / gesture area on edge-to-edge Android and on iOS devices
60
+ // with a home indicator.
35
61
  ,
36
62
  contentContainerStyle: [styles.scrollBody, {
37
- paddingTop: BASE_PADDING_TOP + insets.top,
63
+ paddingTop: showBack ? BASE_PADDING_TOP : BASE_PADDING_TOP + insets.top,
38
64
  paddingBottom: BASE_PADDING_BOTTOM + insets.bottom
39
65
  }],
40
66
  keyboardShouldPersistTaps: "handled",
41
- children: [onBack ? /*#__PURE__*/_jsx(BackButton, {
42
- label: backLabel,
43
- onPress: onBack,
44
- disabled: backDisabled
45
- }) : null, /*#__PURE__*/_jsxs(View, {
67
+ children: [/*#__PURE__*/_jsxs(View, {
46
68
  style: styles.header,
47
69
  children: [showIconCircle ? /*#__PURE__*/_jsx(View, {
48
70
  style: [styles.iconCircle, {
@@ -68,6 +90,73 @@ export function StepShell({
68
90
  children: children
69
91
  })]
70
92
  });
93
+
94
+ // The back control lives in a fixed strip OUTSIDE the ScrollView so it stays
95
+ // pinned just below the (fixed) ProgressBar while the form scrolls behind it.
96
+ // `paddingTop` clears the status-bar / notch inset plus the progress bar's
97
+ // own height so "Atrás" never tucks under the bar (OSDKR-12).
98
+ const body = /*#__PURE__*/_jsxs(View, {
99
+ style: styles.flex,
100
+ children: [showBack ? /*#__PURE__*/_jsx(View, {
101
+ style: [styles.backStrip, {
102
+ paddingTop: insets.top + PROGRESS_BAR_HEIGHT
103
+ }],
104
+ children: /*#__PURE__*/_jsx(BackButton, {
105
+ label: backLabel,
106
+ onPress: onBack,
107
+ disabled: backDisabled
108
+ })
109
+ }) : null, /*#__PURE__*/_jsxs(View, {
110
+ style: styles.scrollWrap,
111
+ children: [scroll, /*#__PURE__*/_jsx(Animated.View, {
112
+ pointerEvents: "none",
113
+ style: [styles.topFade, {
114
+ height: TOP_FADE_HEIGHT,
115
+ opacity: fadeOpacity
116
+ }],
117
+ children: /*#__PURE__*/_jsxs(Svg, {
118
+ width: "100%",
119
+ height: "100%",
120
+ children: [/*#__PURE__*/_jsx(Defs, {
121
+ children: /*#__PURE__*/_jsxs(SvgLinearGradient, {
122
+ id: "stepTopFade",
123
+ x1: "0",
124
+ y1: "0",
125
+ x2: "0",
126
+ y2: "1",
127
+ children: [/*#__PURE__*/_jsx(Stop, {
128
+ offset: "0",
129
+ stopColor: theme.backgroundColor,
130
+ stopOpacity: 1
131
+ }), /*#__PURE__*/_jsx(Stop, {
132
+ offset: "0.35",
133
+ stopColor: theme.backgroundColor,
134
+ stopOpacity: 0.85
135
+ }), /*#__PURE__*/_jsx(Stop, {
136
+ offset: "0.6",
137
+ stopColor: theme.backgroundColor,
138
+ stopOpacity: 0.5
139
+ }), /*#__PURE__*/_jsx(Stop, {
140
+ offset: "0.82",
141
+ stopColor: theme.backgroundColor,
142
+ stopOpacity: 0.18
143
+ }), /*#__PURE__*/_jsx(Stop, {
144
+ offset: "1",
145
+ stopColor: theme.backgroundColor,
146
+ stopOpacity: 0
147
+ })]
148
+ })
149
+ }), /*#__PURE__*/_jsx(Rect, {
150
+ x: "0",
151
+ y: "0",
152
+ width: "100%",
153
+ height: "100%",
154
+ fill: "url(#stepTopFade)"
155
+ })]
156
+ })
157
+ })]
158
+ })]
159
+ });
71
160
  if (avoidKeyboard) {
72
161
  return /*#__PURE__*/_jsx(KeyboardAvoidingView, {
73
162
  style: styles.flex,
@@ -82,6 +171,14 @@ export function StepShell({
82
171
  // of these at render time (see `contentContainerStyle` above).
83
172
  const BASE_PADDING_TOP = 12;
84
173
  const BASE_PADDING_BOTTOM = 28;
174
+ // Height of the background-to-transparent gradient masking the ScrollView's
175
+ // top clip edge. Tall on purpose: a long band makes the dissolve a gradual
176
+ // transition rather than a visible line.
177
+ const TOP_FADE_HEIGHT = 120;
178
+ // Scroll distance (px) over which the fade ramps from invisible (at rest) to
179
+ // fully active. Decoupled from TOP_FADE_HEIGHT so the long gradient still kicks
180
+ // in promptly as the user starts scrolling.
181
+ const FADE_RAMP_DISTANCE = 36;
85
182
  const styles = StyleSheet.create({
86
183
  flex: {
87
184
  flex: 1
@@ -89,6 +186,18 @@ const styles = StyleSheet.create({
89
186
  scroll: {
90
187
  flex: 1
91
188
  },
189
+ scrollWrap: {
190
+ flex: 1
191
+ },
192
+ topFade: {
193
+ position: 'absolute',
194
+ top: 0,
195
+ left: 0,
196
+ right: 0
197
+ },
198
+ backStrip: {
199
+ paddingHorizontal: 18
200
+ },
92
201
  scrollBody: {
93
202
  paddingHorizontal: 18,
94
203
  paddingTop: BASE_PADDING_TOP,
@@ -1 +1 @@
1
- {"version":3,"names":["KeyboardAvoidingView","Platform","ScrollView","StyleSheet","Text","View","useTheme","withAlpha","BackButton","useSafeAreaInsets","jsx","_jsx","jsxs","_jsxs","StepShell","title","subtitle","iconNode","children","avoidKeyboard","onBack","backLabel","backDisabled","theme","insets","showIconCircle","hideStepIcons","body","style","styles","scroll","contentContainerStyle","scrollBody","paddingTop","BASE_PADDING_TOP","top","paddingBottom","BASE_PADDING_BOTTOM","bottom","keyboardShouldPersistTaps","label","onPress","disabled","header","iconCircle","backgroundColor","primaryColor","shadowColor","accessibilityElementsHidden","importantForAccessibility","color","textColor","textSecondaryColor","column","flex","behavior","OS","undefined","create","paddingHorizontal","alignItems","marginBottom","width","height","borderRadius","justifyContent","shadowOpacity","shadowRadius","shadowOffset","elevation","fontSize","fontWeight","letterSpacing","textAlign","marginTop","lineHeight","maxWidth","alignSelf","gap"],"sourceRoot":"../../../src","sources":["ui/StepShell.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SACEA,oBAAoB,EACpBC,QAAQ,EACRC,UAAU,EACVC,UAAU,EACVC,IAAI,EACJC,IAAI,QACC,cAAc;AACrB,SAASC,QAAQ,EAAEC,SAAS,QAAQ,SAAS;AAC7C,SAASC,UAAU,QAAQ,yBAAyB;AACpD,SAASC,iBAAiB,QAAQ,4BAA4B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAsB/D,OAAO,SAASC,SAASA,CAAC;EACxBC,KAAK;EACLC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,aAAa,GAAG,IAAI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,YAAY,EAAE,CAAC;IACfC,YAAY,EAAE;MAAEN,KAAK,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAE,CAAC;IACrCM,SAAS,EAAE;EACb,CAAC;EACDtD,KAAK,EAAE;IACLuD,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,KAAK;IACjBC,aAAa,EAAE,CAAC,GAAG;IACnBC,SAAS,EAAE;EACb,CAAC;EACDzD,QAAQ,EAAE;IACR0D,SAAS,EAAE,CAAC;IACZJ,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,KAAK;IACjBE,SAAS,EAAE,QAAQ;IACnBE,UAAU,EAAE,EAAE;IACdC,QAAQ,EAAE;EACZ,CAAC;EACDvB,MAAM,EAAE;IACNS,KAAK,EAAE,MAAM;IACbc,QAAQ,EAAE,GAAG;IACbC,SAAS,EAAE,QAAQ;IACnBC,GAAG,EAAE;EACP;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useRef","Animated","KeyboardAvoidingView","Platform","StyleSheet","Text","View","Svg","Defs","LinearGradient","SvgLinearGradient","Rect","Stop","useTheme","withAlpha","BackButton","PROGRESS_BAR_HEIGHT","useSafeAreaInsets","jsx","_jsx","jsxs","_jsxs","StepShell","title","subtitle","iconNode","children","avoidKeyboard","onBack","backLabel","backDisabled","theme","insets","showIconCircle","hideStepIcons","showBack","scrollY","Value","current","fadeOpacity","interpolate","inputRange","FADE_RAMP_DISTANCE","outputRange","extrapolate","scroll","ScrollView","style","styles","scrollEventThrottle","onScroll","event","nativeEvent","contentOffset","y","useNativeDriver","contentContainerStyle","scrollBody","paddingTop","BASE_PADDING_TOP","top","paddingBottom","BASE_PADDING_BOTTOM","bottom","keyboardShouldPersistTaps","header","iconCircle","backgroundColor","primaryColor","shadowColor","accessibilityElementsHidden","importantForAccessibility","color","textColor","textSecondaryColor","column","body","flex","backStrip","label","onPress","disabled","scrollWrap","pointerEvents","topFade","height","TOP_FADE_HEIGHT","opacity","width","id","x1","y1","x2","y2","offset","stopColor","stopOpacity","x","fill","behavior","OS","undefined","create","position","left","right","paddingHorizontal","alignItems","marginBottom","borderRadius","justifyContent","shadowOpacity","shadowRadius","shadowOffset","elevation","fontSize","fontWeight","letterSpacing","textAlign","marginTop","lineHeight","maxWidth","alignSelf","gap"],"sourceRoot":"../../../src","sources":["ui/StepShell.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,MAAM,QAAQ,OAAO;AAC9B,SACEC,QAAQ,EACRC,oBAAoB,EACpBC,QAAQ,EACRC,UAAU,EACVC,IAAI,EACJC,IAAI,QACC,cAAc;AACrB,OAAOC,GAAG,IACRC,IAAI,EACJC,cAAc,IAAIC,iBAAiB,EACnCC,IAAI,EACJC,IAAI,QACC,kBAAkB;AACzB,SAASC,QAAQ,EAAEC,SAAS,QAAQ,SAAS;AAC7C,SAASC,UAAU,QAAQ,yBAAyB;AACpD,SAASC,mBAAmB,QAAQ,wBAAwB;AAC5D,SAASC,iBAAiB,QAAQ,4BAA4B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAsB/D,OAAO,SAASC,SAASA,CAAC;EACxBC,KAAK;EACLC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,aAAa,GAAG,IAAI;EACpBC,MAAM;EACNC,SAAS,GAAG,OAAO;EACnBC,YAAY,GAAG;AACD,CAAC,EAAE;EACjB,MAAMC,KAAK,GAAGlB,QAAQ,CAAC,CAAC;EACxB,MAAMmB,MAAM,GAAGf,iBAAiB,CAAC,CAAC;EAElC,MAAMgB,cAAc,GAAG,CAACF,KAAK,CAACG,aAAa,IAAIT,QAAQ,IAAI,IAAI;EAC/D,MAAMU,QAAQ,GAAGP,MAAM,IAAI,IAAI;;EAE/B;EACA;EACA;EACA,MAAMQ,OAAO,GAAGpC,MAAM,CAAC,IAAIC,QAAQ,CAACoC,KAAK,CAAC,CAAC,CAAC,CAAC,CAACC,OAAO;EACrD,MAA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IAAE,CAAC;IACrC6B,SAAS,EAAE;EACb,CAAC;EACD3F,KAAK,EAAE;IACL4F,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,KAAK;IACjBC,aAAa,EAAE,CAAC,GAAG;IACnBC,SAAS,EAAE;EACb,CAAC;EACD9F,QAAQ,EAAE;IACR+F,SAAS,EAAE,CAAC;IACZJ,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,KAAK;IACjBE,SAAS,EAAE,QAAQ;IACnBE,UAAU,EAAE,EAAE;IACdC,QAAQ,EAAE;EACZ,CAAC;EACD9C,MAAM,EAAE;IACNa,KAAK,EAAE,MAAM;IACbiC,QAAQ,EAAE,GAAG;IACbC,SAAS,EAAE,QAAQ;IACnBC,GAAG,EAAE;EACP;AACF,CAAC,CAAC","ignoreList":[]}
@@ -12,7 +12,14 @@
12
12
  import { useEffect, useRef } from 'react';
13
13
  import { Animated, StyleSheet } from 'react-native';
14
14
  import { mixHex, useReducedMotion, useTheme } from '../theme';
15
+
16
+ /**
17
+ * Height of the progress track, in px. Exported so layout-aware chrome (e.g.
18
+ * `StepShell`'s fixed back-button strip) can sit flush below the bar without
19
+ * duplicating the magic number.
20
+ */
15
21
  import { jsx as _jsx } from "react/jsx-runtime";
22
+ export const PROGRESS_BAR_HEIGHT = 4;
16
23
  export function ProgressBar({
17
24
  value,
18
25
  hidden = false
@@ -79,7 +86,7 @@ export const PROGRESS_BAR = {
79
86
  };
80
87
  const styles = StyleSheet.create({
81
88
  track: {
82
- height: 4,
89
+ height: PROGRESS_BAR_HEIGHT,
83
90
  width: '100%',
84
91
  overflow: 'hidden'
85
92
  },
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useRef","Animated","StyleSheet","mixHex","useReducedMotion","useTheme","jsx","_jsx","ProgressBar","value","hidden","theme","reduceMotion","widthAnim","Value","current","opacityAnim","timing","toValue","duration","useNativeDriver","start","trackColor","borderColor","backgroundColor","View","accessibilityRole","accessibilityValue","now","Math","round","min","max","style","styles","track","opacity","children","bar","primaryColor","width","interpolate","inputRange","outputRange","STEP_INCREMENT_PCT","SOFT_CAP_PCT","PROGRESS_BAR","tick","complete","reset","create","height","overflow"],"sourceRoot":"../../../../src","sources":["ui/overlays/ProgressBar.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SAASC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AACnD,SAASC,MAAM,EAAEC,gBAAgB,EAAEC,QAAQ,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAS9D,OAAO,SAASC,WAAWA,CAAC;EAAEC,KAAK;EAAEC,MAAM,GAAG;AAAwB,CAAC,EAAE;EACvE,MAAMC,KAAK,GAAGN,QAAQ,CAAC,CAAC;EACxB,MAAMO,YAAY,GAAGR,gBAAgB,CAAC,CAAC;EACvC,MAAMS,SAAS,GAAGb,MAAM,CAAC,IAAIC,QAAQ,CAACa,KAAK,CAACL,KAAK,CAAC,CAAC,CAACM,OAAO;EAC3D,MAAMC,WAAW,GAAGhB,MAAM,CAAC,IAAIC,QAAQ,CAACa,KAAK,CAACJ,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAACK,OAAO;EAEtEhB,SAAS,CAAC,MAAM;IACdE,QAAQ,CAACgB,MAAM,CAACJ,SAAS,EAAE;MACzBK,OAAO,EAAET,KAAK;MACdU,QAAQ,EAAEP,YAAY,GAAG,CAAC,GAAG,GAAG;MAChCQ,eAAe,EAAE;IACnB,CAAC,CAAC,CAACC,KAAK,CAAC,CAAC;EACZ,CAAC,EAAE,CAACZ,KAAK,EAAEG,YAAY,EAAEC,SAAS,CAAC,CAAC;EAEpCd,SAAS,CAAC,MAAM;IACdE,QAAQ,CAACgB,MAAM,CAACD,WAAW,EAAE;MAC3BE,OAAO,EAAER,MAAM,GAAG,CAAC,GAAG,CAAC;MACvBS,QAAQ,EAAEP,YAAY,GAAG,CA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EACDC,KAAKA,CAAA,EAAW;IACd,OAAO,CAAC;EACV;AACF,CAAC;AAED,MAAMf,MAAM,GAAGhC,UAAU,CAACgD,MAAM,CAAC;EAC/Bf,KAAK,EAAE;IACLgB,MAAM,EAAE,CAAC;IACTX,KAAK,EAAE,MAAM;IACbY,QAAQ,EAAE;EACZ,CAAC;EACDd,GAAG,EAAE;IACHa,MAAM,EAAE;EACV;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useEffect","useRef","Animated","StyleSheet","mixHex","useReducedMotion","useTheme","jsx","_jsx","PROGRESS_BAR_HEIGHT","ProgressBar","value","hidden","theme","reduceMotion","widthAnim","Value","current","opacityAnim","timing","toValue","duration","useNativeDriver","start","trackColor","borderColor","backgroundColor","View","accessibilityRole","accessibilityValue","now","Math","round","min","max","style","styles","track","opacity","children","bar","primaryColor","width","interpolate","inputRange","outputRange","STEP_INCREMENT_PCT","SOFT_CAP_PCT","PROGRESS_BAR","tick","complete","reset","create","height","overflow"],"sourceRoot":"../../../../src","sources":["ui/overlays/ProgressBar.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SAASC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AACnD,SAASC,MAAM,EAAEC,gBAAgB,EAAEC,QAAQ,QAAQ,UAAU;;AAE7D;AACA;AACA;AACA;AACA;AAJA,SAAAC,GAAA,IAAAC,IAAA;AAKA,OAAO,MAAMC,mBAAmB,GAAG,CAAC;AASpC,OAAO,SAASC,WAAWA,CAAC;EAAEC,KAAK;EAAEC,MAAM,GAAG;AAAwB,CAAC,EAAE;EACvE,MAAMC,KAAK,GAAGP,QAAQ,CAAC,CAAC;EACxB,MAAMQ,YAAY,GAAGT,gBAAgB,CAAC,CAAC;EACvC,MAAMU,SAAS,GAAGd,MAAM,CAAC,IAAIC,QAAQ,CAACc,KAAK,CAACL,KAAK,CAAC,CAAC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,CACLC,MAAM,CAACI,GAAG,EACV;QACEd,eAAe,EAAEb,KAAK,CAAC4B,YAAY;QACnCC,KAAK,EAAE3B,SAAS,CAAC4B,WAAW,CAAC;UAC3BC,UAAU,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC;UACpBC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM;QAC5B,CAAC;MACH,CAAC;IACD,CACH;EAAC,CACW,CAAC;AAEpB;AAEA,MAAMC,kBAAkB,GAAG,EAAE;AAC7B,MAAMC,YAAY,GAAG,EAAE;;AAEvB;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,GAAG;EAC1BC,IAAIA,CAAChC,OAAe,EAAU;IAC5B,OAAOc,IAAI,CAACE,GAAG,CAACc,YAAY,EAAE9B,OAAO,GAAG6B,kBAAkB,CAAC;EAC7D,CAAC;EACDI,QAAQA,CAAA,EAAW;IACjB,OAAO,GAAG;EACZ,CAAC;EACDC,KAAKA,CAAA,EAAW;IACd,OAAO,CAAC;EACV;AACF,CAAC;AAED,MAAMf,MAAM,GAAGjC,UAAU,CAACiD,MAAM,CAAC;EAC/Bf,KAAK,EAAE;IACLgB,MAAM,EAAE5C,mBAAmB;IAC3BiC,KAAK,EAAE,MAAM;IACbY,QAAQ,EAAE;EACZ,CAAC;EACDd,GAAG,EAAE;IACHa,MAAM,EAAE;EACV;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * @fileoverview Geometry for the document capture guide + crop.
5
+ *
6
+ * Two pure helpers, shared between the camera overlay and the post-capture
7
+ * crop so the pixels we keep are *exactly* the rectangle the user framed:
8
+ *
9
+ * - `computeCutout` — the on-screen ID-1 guide rectangle (screen px).
10
+ * - `computeGuideCropRect` — maps that guide rectangle into the captured
11
+ * photo's pixel space, compensating for the camera preview's `cover` fit
12
+ * (the preview center-crops the sensor frame to the screen aspect ratio).
13
+ *
14
+ * This is a *geometric* crop to a fixed guide, NOT edge detection / OpenCV —
15
+ * we never inspect pixels. The backend's Document AI still runs OCR and its
16
+ * own face crop on top, so we keep a safety margin around the guide to avoid
17
+ * clipping the document (or the portrait the backend needs).
18
+ */
19
+
20
+ // ID-1 aspect ratios (width / height). Portrait ≈ 0.625 (held vertically),
21
+ // landscape ≈ 1.586 (the real ID-1 card ratio, 85.6 × 53.98 mm).
22
+ const PORTRAIT_ASPECT = 0.625;
23
+ const LANDSCAPE_ASPECT = 1.586;
24
+
25
+ // The guide is 85% of screen width, but never taller than 62% of screen height
26
+ // (portrait ID-1 on tall phones would otherwise overflow).
27
+ const CUTOUT_WIDTH_RATIO = 0.85;
28
+ const CUTOUT_MAX_HEIGHT_RATIO = 0.62;
29
+
30
+ /** Default crop margin: expand each side of the guide by this fraction of the
31
+ * guide size, so a document slightly overflowing the frame isn't clipped. */
32
+ export const DEFAULT_CROP_MARGIN = 0.07;
33
+
34
+ /**
35
+ * The on-screen guide rectangle, in screen pixels. Mirrors what the mask
36
+ * overlay draws so the crop matches the visible cutout exactly.
37
+ */
38
+ export function computeCutout(screenW, screenH, orientation) {
39
+ const aspectRatio = orientation === 'portrait' ? PORTRAIT_ASPECT : LANDSCAPE_ASPECT;
40
+ let width = screenW * CUTOUT_WIDTH_RATIO;
41
+ let height = width / aspectRatio;
42
+ const maxH = screenH * CUTOUT_MAX_HEIGHT_RATIO;
43
+ if (height > maxH) {
44
+ height = maxH;
45
+ width = height * aspectRatio;
46
+ }
47
+ return {
48
+ left: (screenW - width) / 2,
49
+ top: (screenH - height) / 2,
50
+ width,
51
+ height
52
+ };
53
+ }
54
+
55
+ /**
56
+ * Map the on-screen guide rectangle into the captured photo's pixel space.
57
+ *
58
+ * The preview renders the photo with `cover` fit: the sensor frame is scaled
59
+ * up until it fills the screen and the overflow is center-cropped. So a screen
60
+ * point `(sx, sy)` maps to photo pixel `((W_img - W_screen/s)/2 + sx/s, …)`,
61
+ * where `s = max(W_screen/W_img, H_screen/H_img)`.
62
+ *
63
+ * `imageW`/`imageH` MUST be the photo's *display* (orientation-normalized)
64
+ * dimensions — i.e. portrait when the device is portrait — not the raw sensor
65
+ * dimensions, which are often landscape with an EXIF rotation flag.
66
+ *
67
+ * The result is expanded by `margin` (fraction of the mapped guide) and
68
+ * clamped to the image bounds, then rounded to integers (the manipulator
69
+ * rejects fractional crop rects).
70
+ */
71
+ export function computeGuideCropRect(params) {
72
+ const {
73
+ screenW,
74
+ screenH,
75
+ imageW,
76
+ imageH,
77
+ cutout,
78
+ margin = DEFAULT_CROP_MARGIN
79
+ } = params;
80
+ const scale = Math.max(screenW / imageW, screenH / imageH);
81
+ // Image pixels hidden off each edge by the cover crop.
82
+ const offsetX = (imageW - screenW / scale) / 2;
83
+ const offsetY = (imageH - screenH / scale) / 2;
84
+ let x = offsetX + cutout.left / scale;
85
+ let y = offsetY + cutout.top / scale;
86
+ let width = cutout.width / scale;
87
+ let height = cutout.height / scale;
88
+
89
+ // Expand by the safety margin.
90
+ const mx = width * margin;
91
+ const my = height * margin;
92
+ x -= mx;
93
+ y -= my;
94
+ width += mx * 2;
95
+ height += my * 2;
96
+
97
+ // Clamp to image bounds.
98
+ x = Math.max(0, x);
99
+ y = Math.max(0, y);
100
+ width = Math.min(width, imageW - x);
101
+ height = Math.min(height, imageH - y);
102
+ return {
103
+ x: Math.round(x),
104
+ y: Math.round(y),
105
+ width: Math.round(width),
106
+ height: Math.round(height)
107
+ };
108
+ }
109
+ //# sourceMappingURL=documentCrop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["PORTRAIT_ASPECT","LANDSCAPE_ASPECT","CUTOUT_WIDTH_RATIO","CUTOUT_MAX_HEIGHT_RATIO","DEFAULT_CROP_MARGIN","computeCutout","screenW","screenH","orientation","aspectRatio","width","height","maxH","left","top","computeGuideCropRect","params","imageW","imageH","cutout","margin","scale","Math","max","offsetX","offsetY","x","y","mx","my","min","round"],"sourceRoot":"../../../src","sources":["utils/documentCrop.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;A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ePhoto()` with `qualityPrioritization: 'balanced'`; the file
6
6
  * URI is returned to the caller via `onCaptured`.
7
7
  *
8
- * Visual: dark scrim with a transparent rectangular cutout (ID-1 16:10 ratio
9
- * by default). The cutout is the visible-only guide — we do NOT crop the
10
- * image client-side because the server's OCR pipeline rejects soft crops.
11
- * The user is asked to fill the frame; the backend handles edge detection.
12
- *
13
- * No edge detection / OpenCV port (intentional MVP scope per the brief).
8
+ * Visual: dark scrim with a transparent rectangular cutout (ID-1 ratio). The
9
+ * cutout is both the visible guide AND the crop region: on capture we hand the
10
+ * caller the guide rectangle so the photo can be cropped to exactly what the
11
+ * user framed (OSDKR-2). This is a geometric crop to a fixed guide — NOT edge
12
+ * detection / OpenCV; we never inspect pixels. The backend's Document AI still
13
+ * runs OCR and its own face crop on top.
14
14
  */
15
15
  import { type PhotoFile } from 'react-native-vision-camera';
16
16
  import type { DocumentOrientation, DocumentSide } from '../types';
17
+ import { type CutoutRect } from '../utils/documentCrop';
18
+ /**
19
+ * Geometry of the on-screen guide at capture time, handed to `onCaptured` so
20
+ * the photo can be cropped to exactly what the user framed.
21
+ */
22
+ export interface CaptureGuide {
23
+ cutout: CutoutRect;
24
+ screenW: number;
25
+ screenH: number;
26
+ }
17
27
  export interface DocumentCaptureProps {
18
28
  side: DocumentSide;
19
29
  orientation: DocumentOrientation;
@@ -27,8 +37,10 @@ export interface DocumentCaptureProps {
27
37
  retryLabel: string;
28
38
  /** Localized "Cancel" / back label. */
29
39
  cancelLabel: string;
30
- onCaptured: (photo: PhotoFile, side: DocumentSide) => void;
40
+ /** Localized label shown over the camera while the shot is processed. */
41
+ processingLabel: string;
42
+ onCaptured: (photo: PhotoFile, side: DocumentSide, guide: CaptureGuide) => void | Promise<void>;
31
43
  onCancel: () => void;
32
44
  }
33
- export declare function DocumentCapture({ side, orientation, instructions, captureLabel, permissionDeniedLabel, retryLabel, cancelLabel, onCaptured, onCancel, }: DocumentCaptureProps): import("react").JSX.Element;
45
+ export declare function DocumentCapture({ side, orientation, instructions, captureLabel, permissionDeniedLabel, retryLabel, cancelLabel, processingLabel, onCaptured, onCancel, }: DocumentCaptureProps): import("react").JSX.Element;
34
46
  //# sourceMappingURL=DocumentCapture.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentCapture.d.ts","sourceRoot":"","sources":["../../../src/camera/DocumentCapture.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAYH,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAKlE,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,YAAY,CAAC;IACnB,WAAW,EAAE,mBAAmB,CAAC;IACjC,oDAAoD;IACpD,YAAY,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,YAAY,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,qBAAqB,EAAE,MAAM,CAAC;IAC9B,mCAAmC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;IAC3D,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACrB,UAAU,EACV,WAAW,EACX,UAAU,EACV,QAAQ,GACT,EAAE,oBAAoB,+BAkOtB"}
1
+ {"version":3,"file":"DocumentCapture.d.ts","sourceRoot":"","sources":["../../../src/camera/DocumentCapture.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAYH,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAIlE,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEvE;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,YAAY,CAAC;IACnB,WAAW,EAAE,mBAAmB,CAAC;IACjC,oDAAoD;IACpD,YAAY,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,YAAY,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,qBAAqB,EAAE,MAAM,CAAC;IAC9B,mCAAmC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,yEAAyE;IACzE,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,CACV,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,YAAY,KAChB,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACrB,UAAU,EACV,WAAW,EACX,eAAe,EACf,UAAU,EACV,QAAQ,GACT,EAAE,oBAAoB,+BAoPtB"}
@@ -1 +1 @@
1
- {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../../../src/i18n/strings/en.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEzC,eAAO,MAAM,EAAE,EAAE,YA4UhB,CAAC"}
1
+ {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../../../src/i18n/strings/en.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEzC,eAAO,MAAM,EAAE,EAAE,YA6UhB,CAAC"}
@@ -201,6 +201,7 @@ export declare const ES: {
201
201
  confirmBtn: string;
202
202
  confirmFront: string;
203
203
  confirmBack: string;
204
+ processing: string;
204
205
  initializing: string;
205
206
  uploadingFront: string;
206
207
  uploadingBack: string;
@@ -1 +1 @@
1
- {"version":3,"file":"es.d.ts","sourceRoot":"","sources":["../../../../src/i18n/strings/es.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyUd,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"es.d.ts","sourceRoot":"","sources":["../../../../src/i18n/strings/es.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0Ud,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,OAAO,EAAE,CAAC"}
@@ -5,13 +5,15 @@
5
5
  * intro → captureFront → reviewFront → captureBack → reviewBack →
6
6
  * POST /documents-init → PUT image/jpeg × 2 → POST /documents-verify → done.
7
7
  *
8
- * No edge detection / OpenCV port (intentional MVP scope per the brief). The
9
- * camera shows the ID-1 frame guide and the user fills it; the backend OCR
10
- * pipeline handles cropping.
8
+ * Crop: on capture we receive the on-screen guide rectangle and crop the photo
9
+ * to it (OSDKR-2) — a geometric crop to the visible ID-1 frame, NOT edge
10
+ * detection / OpenCV. This trims the camera background, improves OCR framing
11
+ * and shrinks the upload. The backend's Document AI still runs OCR + its own
12
+ * face crop on top, so we keep a safety margin around the guide.
11
13
  *
12
- * Compression: vision-camera writes a high-quality JPEG. We re-compress with
13
- * `expo-image-manipulator` before upload so we keep the payload under the
14
- * 5 MB ceiling Velion's storage layer expects.
14
+ * Compression: vision-camera writes a high-quality JPEG. After cropping we
15
+ * resize + re-compress with `expo-image-manipulator` before upload so we keep
16
+ * the payload under the 5 MB ceiling Velion's storage layer expects.
15
17
  */
16
18
  import type { StepDeps, StepModule } from './types';
17
19
  export declare class DocumentsOcrStep implements StepModule {
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentsOcrStep.d.ts","sourceRoot":"","sources":["../../../src/steps/DocumentsOcrStep.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAiCH,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAsBpD,qBAAa,gBAAiB,YAAW,UAAU;IAKrC,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJjC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,SAAS,CAAS;gBAEG,IAAI,EAAE,QAAQ;IAE3C,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IA0BpB,OAAO,IAAI,IAAI;CAIhB"}
1
+ {"version":3,"file":"DocumentsOcrStep.d.ts","sourceRoot":"","sources":["../../../src/steps/DocumentsOcrStep.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAkCH,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAsBpD,qBAAa,gBAAiB,YAAW,UAAU;IAKrC,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJjC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,SAAS,CAAS;gBAEG,IAAI,EAAE,QAAQ;IAE3C,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IA0BpB,OAAO,IAAI,IAAI;CAIhB"}
@@ -1 +1 @@
1
- {"version":3,"file":"StepShell.d.ts","sourceRoot":"","sources":["../../../src/ui/StepShell.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAavC,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,kFAAkF;IAClF,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC;;;;OAIG;IACH,MAAM,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IAClC,gFAAgF;IAChF,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,kFAAkF;IAClF,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACpC;AAED,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,aAAoB,EACpB,MAAM,EACN,SAAmB,EACnB,YAAoB,GACrB,EAAE,cAAc,+BAiEhB"}
1
+ {"version":3,"file":"StepShell.d.ts","sourceRoot":"","sources":["../../../src/ui/StepShell.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAqBvC,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,kFAAkF;IAClF,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC;;;;OAIG;IACH,MAAM,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IAClC,gFAAgF;IAChF,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,kFAAkF;IAClF,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACpC;AAED,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,aAAoB,EACpB,MAAM,EACN,SAAmB,EACnB,YAAoB,GACrB,EAAE,cAAc,+BA2IhB"}
@@ -6,6 +6,12 @@
6
6
  * Animated with `Animated.timing` (driver: native) so we don't pull in
7
7
  * Reanimated yet; respects `useReducedMotion()`.
8
8
  */
9
+ /**
10
+ * Height of the progress track, in px. Exported so layout-aware chrome (e.g.
11
+ * `StepShell`'s fixed back-button strip) can sit flush below the bar without
12
+ * duplicating the magic number.
13
+ */
14
+ export declare const PROGRESS_BAR_HEIGHT = 4;
9
15
  export interface ProgressBarProps {
10
16
  /** 0–100. Components compute the trickling logic externally and pass it in. */
11
17
  value: number;
@@ -1 +1 @@
1
- {"version":3,"file":"ProgressBar.d.ts","sourceRoot":"","sources":["../../../../src/ui/overlays/ProgressBar.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,MAAM,WAAW,gBAAgB;IAC/B,+EAA+E;IAC/E,KAAK,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,MAAc,EAAE,EAAE,gBAAgB,+BA+CtE;AAKD;;;;GAIG;AACH,eAAO,MAAM,YAAY;kBACT,MAAM,GAAG,MAAM;gBAGjB,MAAM;aAGT,MAAM;CAGhB,CAAC"}
1
+ {"version":3,"file":"ProgressBar.d.ts","sourceRoot":"","sources":["../../../../src/ui/overlays/ProgressBar.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC,MAAM,WAAW,gBAAgB;IAC/B,+EAA+E;IAC/E,KAAK,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,MAAc,EAAE,EAAE,gBAAgB,+BA+CtE;AAKD;;;;GAIG;AACH,eAAO,MAAM,YAAY;kBACT,MAAM,GAAG,MAAM;gBAGjB,MAAM;aAGT,MAAM;CAGhB,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @fileoverview Geometry for the document capture guide + crop.
3
+ *
4
+ * Two pure helpers, shared between the camera overlay and the post-capture
5
+ * crop so the pixels we keep are *exactly* the rectangle the user framed:
6
+ *
7
+ * - `computeCutout` — the on-screen ID-1 guide rectangle (screen px).
8
+ * - `computeGuideCropRect` — maps that guide rectangle into the captured
9
+ * photo's pixel space, compensating for the camera preview's `cover` fit
10
+ * (the preview center-crops the sensor frame to the screen aspect ratio).
11
+ *
12
+ * This is a *geometric* crop to a fixed guide, NOT edge detection / OpenCV —
13
+ * we never inspect pixels. The backend's Document AI still runs OCR and its
14
+ * own face crop on top, so we keep a safety margin around the guide to avoid
15
+ * clipping the document (or the portrait the backend needs).
16
+ */
17
+ import type { DocumentOrientation } from '../types';
18
+ export interface CutoutRect {
19
+ left: number;
20
+ top: number;
21
+ width: number;
22
+ height: number;
23
+ }
24
+ export interface PixelRect {
25
+ x: number;
26
+ y: number;
27
+ width: number;
28
+ height: number;
29
+ }
30
+ /** Default crop margin: expand each side of the guide by this fraction of the
31
+ * guide size, so a document slightly overflowing the frame isn't clipped. */
32
+ export declare const DEFAULT_CROP_MARGIN = 0.07;
33
+ /**
34
+ * The on-screen guide rectangle, in screen pixels. Mirrors what the mask
35
+ * overlay draws so the crop matches the visible cutout exactly.
36
+ */
37
+ export declare function computeCutout(screenW: number, screenH: number, orientation: DocumentOrientation): CutoutRect;
38
+ /**
39
+ * Map the on-screen guide rectangle into the captured photo's pixel space.
40
+ *
41
+ * The preview renders the photo with `cover` fit: the sensor frame is scaled
42
+ * up until it fills the screen and the overflow is center-cropped. So a screen
43
+ * point `(sx, sy)` maps to photo pixel `((W_img - W_screen/s)/2 + sx/s, …)`,
44
+ * where `s = max(W_screen/W_img, H_screen/H_img)`.
45
+ *
46
+ * `imageW`/`imageH` MUST be the photo's *display* (orientation-normalized)
47
+ * dimensions — i.e. portrait when the device is portrait — not the raw sensor
48
+ * dimensions, which are often landscape with an EXIF rotation flag.
49
+ *
50
+ * The result is expanded by `margin` (fraction of the mapped guide) and
51
+ * clamped to the image bounds, then rounded to integers (the manipulator
52
+ * rejects fractional crop rects).
53
+ */
54
+ export declare function computeGuideCropRect(params: {
55
+ screenW: number;
56
+ screenH: number;
57
+ imageW: number;
58
+ imageH: number;
59
+ cutout: CutoutRect;
60
+ margin?: number;
61
+ }): PixelRect;
62
+ //# sourceMappingURL=documentCrop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documentCrop.d.ts","sourceRoot":"","sources":["../../../src/utils/documentCrop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAS;IACxB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAYD;8EAC8E;AAC9E,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,mBAAmB,GAC/B,UAAU,CAiBZ;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,SAAS,CAwCZ"}
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.9",
3
+ "version": "1.0.0",
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",