react-native-bynn-sdk
Version:
Bynn Mobile SDK for React Native - Identity verification and KYC
1 lines • 8.62 kB
JavaScript
function _0xd80a(){const _0x347972=['file://','container','path','rgba(0,0,0,0.5)','24DSOjQn','#fff','Capture\x20failed','absoluteFill','white','create','42621NTNaYv','872578RzQOhc','500','Error','current','textContainer','balanced','tip','1988692dCRTJm','Loading\x20camera...','8627470AEmlYN','600','center','Base64\x20image:','now','48ZjlJqs','contain','rgba(255,255,255,0.6)','black','progressText','absolute','bold','348370ljQsPv','granted','137404pewvxi','rgba(0,0,0,0.6)','readFile','134oZbWIp','createElement','progressOverlay','1098189CCBpfF','base64','log','Center\x20the\x20back\x20of\x20your\x20ID\x20below','rightOverlay','topOverlay','error','📸\x20Photo\x20captured:'];_0xd80a=function(){return _0x347972;};return _0xd80a();}const _0x267364=_0x1e04;(function(_0x42c8e5,_0x3bf76a){const _0x757559=_0x1e04,_0x44c833=_0x42c8e5();while(!![]){try{const _0x57757d=-parseInt(_0x757559(0x13a))/0x1+parseInt(_0x757559(0x13d))/0x2*(parseInt(_0x757559(0x152))/0x3)+-parseInt(_0x757559(0x12a))/0x4+parseInt(_0x757559(0x138))/0x5*(parseInt(_0x757559(0x14c))/0x6)+-parseInt(_0x757559(0x123))/0x7+-parseInt(_0x757559(0x131))/0x8*(parseInt(_0x757559(0x140))/0x9)+parseInt(_0x757559(0x12c))/0xa;if(_0x57757d===_0x3bf76a)break;else _0x44c833['push'](_0x44c833['shift']());}catch(_0x59dbcd){_0x44c833['push'](_0x44c833['shift']());}}}(_0xd80a,0x92f63));import _0x57480f,{useEffect,useRef,useState}from'react';import{View,Text,TouchableOpacity,Alert,StyleSheet,SafeAreaView,Image}from'react-native';import{Camera,useCameraDevice}from'react-native-vision-camera';import{Font,fullWidth,Height,Width}from'../utils/dimensions';import{useBynnSession}from'../useBynnSession';import{uploadMedia}from'../api';import _0x334083 from'./ExitView';function _0x1e04(_0x12cfd9,_0x3a1406){const _0xd80a5a=_0xd80a();return _0x1e04=function(_0x1e04c6,_0xa4b7ca){_0x1e04c6=_0x1e04c6-0x123;let _0x36319e=_0xd80a5a[_0x1e04c6];return _0x36319e;},_0x1e04(_0x12cfd9,_0x3a1406);}import{useTranslation}from'react-i18next';import'../i18n';import _0x20b473 from'react-native-fs';const DocumentCaptureBackView=()=>{const _0x12d005=_0x1e04,_0x52aec7=useRef(null),_0x290f9c=useCameraDevice('back'),[_0x3c958b,_0x143ea7]=useState(![]),[_0x415caa,_0x690083]=useState(![]),[_0x775cac,_0x2e72a9]=useState(null),[_0x42e46c,_0x1136a2]=useState(0x0),[_0x5b8f8d,_0x397afa]=useState(![]),[_0x10ad3c,_0x5d6b33]=useState(Date[_0x12d005(0x130)]()),[_0x20500d,_0x3efcc0]=useState(![]),{sessionId:_0x2f4e92}=useBynnSession(),{t:_0x577777}=useTranslation();useEffect(()=>{((async()=>{const _0x46c312=_0x1e04,_0x51a74e=await Camera['requestCameraPermission'](),_0x10aa56=await Camera['requestMicrophonePermission']();_0x143ea7(_0x51a74e===_0x46c312(0x139)&&_0x10aa56===_0x46c312(0x139));})());},[]),useEffect(()=>{let _0x355970;return _0x5b8f8d&&(_0x1136a2(0x0),_0x355970=setInterval(()=>{_0x1136a2(_0x50d7e2=>{if(_0x50d7e2>=0x64)return clearInterval(_0x355970),_0x397afa(![]),0x64;return _0x50d7e2+0x1;});},0x30)),()=>clearInterval(_0x355970);},[_0x5b8f8d]);const _0x20150d=()=>{_0x5d6b33(Date['now']());},_0xf0c648=async()=>{const _0x15bb27=_0x12d005;if(!_0x52aec7[_0x15bb27(0x126)]||!_0x3c958b)return;_0x20150d();try{const _0x36f5af=await _0x52aec7['current']['takePhoto']({'qualityPrioritization':_0x15bb27(0x128),'enableAutoRedEyeReduction':!![],'enableAutoStabilization':!![],'skipMetadata':![]}),_0x2dbefb=_0x15bb27(0x148)+_0x36f5af['path'];_0x397afa(!![]);const _0xee4a54=await _0x20b473[_0x15bb27(0x13c)](_0x36f5af[_0x15bb27(0x14a)],_0x15bb27(0x141));console[_0x15bb27(0x142)](_0x15bb27(0x12f),_0xee4a54),console['log'](_0x15bb27(0x147),_0x2dbefb);if(!_0x2f4e92)throw new Error('No\x20session');await uploadMedia(_0x2f4e92,_0xee4a54,'scan_id_document_back_screen'),_0x775cac&&console['log']('🎞\x20Video\x20URI:',_0x775cac);}catch(_0x3ec2f5){console[_0x15bb27(0x146)]('Capture\x20failed',_0x3ec2f5),Alert['alert'](_0x15bb27(0x125),_0x3ec2f5['message']||_0x15bb27(0x14e));}};if(!_0x290f9c)return _0x57480f['createElement'](View,{'style':styles['container']},_0x57480f[_0x12d005(0x13e)](Text,{'style':styles['tip']},_0x12d005(0x12b)));return _0x57480f[_0x12d005(0x13e)](SafeAreaView,{'style':styles[_0x12d005(0x149)]},_0x5b8f8d&&_0x57480f[_0x12d005(0x13e)](View,{'style':styles[_0x12d005(0x13f)]},_0x57480f[_0x12d005(0x13e)](Image,{'key':_0x10ad3c,'style':{'height':Height(0x12c),'width':Height(0x12c)},'source':require('../assets/img.gif')}),_0x57480f['createElement'](Text,{'style':styles[_0x12d005(0x135)]},_0x42e46c,'%')),_0x57480f[_0x12d005(0x13e)](TouchableOpacity,{'style':{'alignSelf':'flex-start','position':'absolute','top':Height(0x29),'zIndex':0x3e8,'padding':Width(0xf)},'onPress':()=>_0x3efcc0(!![])},_0x57480f[_0x12d005(0x13e)](Image,{'resizeMode':_0x12d005(0x132),'style':{'height':Height(0x18),'width':Width(0x18),'tintColor':_0x12d005(0x150)},'source':require('../assets/leftIcon.png')})),_0x57480f[_0x12d005(0x13e)](View,{'style':styles['tipBox']},_0x57480f[_0x12d005(0x13e)](Text,{'style':styles[_0x12d005(0x129)]},_0x12d005(0x143))),_0x57480f['createElement'](Camera,{'ref':_0x52aec7,'style':StyleSheet[_0x12d005(0x14f)],'device':_0x290f9c,'isActive':!![],'photo':!![]}),_0x57480f['createElement'](View,{'style':styles[_0x12d005(0x145)]}),_0x57480f[_0x12d005(0x13e)](View,{'style':styles['leftOverlay']}),_0x57480f[_0x12d005(0x13e)](View,{'style':styles[_0x12d005(0x144)]}),_0x57480f[_0x12d005(0x13e)](View,{'style':styles['bottomOverlay']}),_0x57480f['createElement'](View,{'style':styles['cutoutBorder']}),_0x57480f[_0x12d005(0x13e)](View,{'style':styles[_0x12d005(0x127)]},_0x57480f[_0x12d005(0x13e)](Text,{'style':styles['instructions']},_0x577777('take_photo_id_document_subtitle'))),_0x57480f['createElement'](View,{'style':styles['captureContainer']},_0x57480f[_0x12d005(0x13e)](TouchableOpacity,{'style':styles['captureBtn'],'onPress':_0xf0c648},_0x57480f[_0x12d005(0x13e)](Image,{'resizeMode':'contain','style':{'height':Height(0x18),'width':Width(0x18)},'source':require('../assets/camera.png')}))),_0x57480f[_0x12d005(0x13e)](_0x334083,{'visible':_0x20500d,'onCancel':()=>_0x3efcc0(![]),'onConfirm':()=>_0x3efcc0(![])}));},styles=StyleSheet[_0x267364(0x151)]({'container':{'flex':0x1,'backgroundColor':_0x267364(0x134),'alignItems':'center','justifyContent':'center'},'headerText':{'zIndex':0xa,'marginTop':Height(0x3c),'position':'absolute','top':0x0,'width':fullWidth,'color':'white','textAlign':'center','fontSize':Font(0x10),'fontWeight':_0x267364(0x124)},'tip':{'fontSize':0x10,'fontWeight':_0x267364(0x12d),'color':_0x267364(0x14d)},'permissionButton':{'backgroundColor':_0x267364(0x133),'marginTop':Height(0xf),'justifyContent':_0x267364(0x12e),'alignItems':_0x267364(0x12e),'height':Height(0x28),'width':Width(0x104),'alignSelf':'center','borderRadius':Height(0xa)},'tipBox':{'backgroundColor':_0x267364(0x133),'position':'absolute','zIndex':0x3e8,'top':Height(0x96),'justifyContent':_0x267364(0x12e),'alignItems':'center','height':Height(0x28),'width':Width(0x11d),'alignSelf':'center','borderRadius':Height(0xa)},'topOverlay':{'position':_0x267364(0x136),'top':0x0,'left':0x0,'right':0x0,'height':Height(0xfa),'backgroundColor':'rgba(0,0,0,0.6)','zIndex':0x1},'bottomOverlay':{'position':'absolute','bottom':0x0,'left':0x0,'right':0x0,'height':Height(0x15e),'backgroundColor':_0x267364(0x13b),'zIndex':0x1},'leftOverlay':{'position':'absolute','top':Height(0xfa),'bottom':Height(0x15e),'left':0x0,'width':(fullWidth-0x168)/0x2,'backgroundColor':_0x267364(0x13b),'zIndex':0x1},'rightOverlay':{'position':_0x267364(0x136),'top':Height(0xfa),'bottom':Height(0x15e),'right':0x0,'width':(fullWidth-0x168)/0x2,'backgroundColor':'rgba(0,0,0,0.6)','zIndex':0x1},'cutoutBorder':{'position':'absolute','top':Height(0xfa),'left':(fullWidth-0x168)/0x2,'width':Width(0x163),'height':Height(0xfd),'borderWidth':0x2,'borderColor':'#fff','borderRadius':0x8,'zIndex':0x2},'textContainer':{'zIndex':0xa,'position':_0x267364(0x136),'bottom':Height(0xe6),'left':Width(0x14),'right':Width(0x14),'alignItems':'center'},'instructions':{'color':'#ccc','fontSize':Font(0x10),'textAlign':_0x267364(0x12e)},'captureContainer':{'position':_0x267364(0x136),'bottom':Height(0x50),'alignSelf':_0x267364(0x12e),'zIndex':0xa},'captureBtn':{'backgroundColor':'#fff','padding':0x10,'borderRadius':0x32},'progressOverlay':{'position':_0x267364(0x136),'top':0x0,'bottom':0x0,'left':0x0,'right':0x0,'backgroundColor':_0x267364(0x14b),'justifyContent':'center','alignItems':'center','zIndex':0x270f},'progressText':{'position':'absolute','fontSize':Font(0x22),'fontWeight':_0x267364(0x137),'color':_0x267364(0x150)}});export default DocumentCaptureBackView;