File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1833,17 +1833,17 @@ The scanner will attempt to request camera permissions automatically. Only
18331833available in Mein Blau and Mein O2.
18341834
18351835` ` ` ts
1836- openOcrScanner : ({regex: string}) => Promise < {scannedText: string | null }> ;
1836+ openOcrScanner : ({regex: string, timeout ?: number }) => Promise < {scannedText: string}> ;
18371837` ` `
18381838
18391839#### Parameters
18401840
18411841- ` regex` : Regular expression pattern to match the scanned text
1842+ - ` timeout` : Timeout in seconds before closing the scanner automatically if no text is scanned. Optional, default is 15 seconds.
18421843
18431844#### Response
18441845
1845- - ` scannedText` : The scanned text matching the regex pattern, or ` null ` if the
1846- user closed the scanner before any text was found
1846+ - ` scannedText` : The scanned text matching the regex pattern.
18471847
18481848#### Example
18491849
@@ -1864,9 +1864,11 @@ openOcrScanner({regex: '\\b(?:\\d{4}-\\d{4}-\\d{4}-\\d{4}|\\d{16})\\b'})
18641864
18651865#### Error cases
18661866
1867+ - ` 204 ` : User manually closed OCR scanner
18671868- ` 401 ` : Missing permissions (user rejected camera permissions)
18681869- ` 405 ` : Feature not supported in current brand (only available in Mein Blau
18691870 and Mein O2)
1871+ - ` 408 ` : Timeout reached without scanning any text
18701872- ` 500 ` : Internal error (e.g., unexpected error thrown by native scanner)
18711873
18721874## Error handling
Original file line number Diff line number Diff line change @@ -181,10 +181,12 @@ export const setBiometricsAuthenticationStatus = (params: {
181181 */
182182export const openOcrScanner = ( params : {
183183 regex : string ;
184- } ) : Promise < { scannedText : string | null } > =>
184+ timeout ?: number ;
185+ } ) : Promise < { scannedText : string } > =>
185186 postMessageToNativeApp ( {
186187 type : 'OPEN_OCR_SCANNER' ,
187188 payload : {
188189 regex : params . regex ,
190+ timeout : params . timeout ,
189191 } ,
190192 } ) ;
Original file line number Diff line number Diff line change @@ -497,7 +497,7 @@ export type ResponsesFromNativeApp = {
497497 OPEN_OCR_SCANNER : {
498498 type : 'OPEN_OCR_SCANNER' ;
499499 id : string ;
500- payload : { scannedText : string | null } ;
500+ payload : { scannedText : string } ;
501501 } ;
502502} ;
503503
You can’t perform that action at this time.
0 commit comments