UNPKG

react-native-bynn-sdk

Version:

Bynn Mobile SDK for React Native - Identity verification and KYC

1 lines 9.31 kB
const _0x470d36=_0x5b62;(function(_0x5de5ed,_0x6354df){const _0x24a185=_0x5b62,_0x45d27a=_0x5de5ed();while(!![]){try{const _0x45293e=parseInt(_0x24a185(0xfa))/0x1*(parseInt(_0x24a185(0x11f))/0x2)+-parseInt(_0x24a185(0x10b))/0x3+parseInt(_0x24a185(0x126))/0x4*(-parseInt(_0x24a185(0x115))/0x5)+parseInt(_0x24a185(0x109))/0x6*(parseInt(_0x24a185(0x117))/0x7)+parseInt(_0x24a185(0x12b))/0x8*(-parseInt(_0x24a185(0x116))/0x9)+-parseInt(_0x24a185(0x125))/0xa*(parseInt(_0x24a185(0x107))/0xb)+parseInt(_0x24a185(0x10f))/0xc*(parseInt(_0x24a185(0xfe))/0xd);if(_0x45293e===_0x6354df)break;else _0x45d27a['push'](_0x45d27a['shift']());}catch(_0x1426e9){_0x45d27a['push'](_0x45d27a['shift']());}}}(_0x42f2,0x704b2));import _0x197ab9,{useEffect,useRef,useState}from'react';function _0x42f2(){const _0x240f06=['rgba(255,255,255,0.6)','create','path','70279jOPZRI','bottomOverlay','377418WhuSMz','granted','1260441gVObaM','log','scan_id_document_front_screen','flex-start','2940CQFHfy','No\x20session','container','white','alert','Center\x20the\x20front\x20of\x20your\x20ID\x20beloww','5ghGpPd','1525833DiiuyM','63mNLRrK','rightOverlay','tip','#fff','current','tipBox','createElement','captureBtn','274cgDYiT','600','Capture\x20failed','black','error','topOverlay','1330vZzxHD','1846232SbOdtq','🎞\x20Video\x20URI:','contain','📸\x20Photo\x20captured:','permissionButton','8InqIXG','center','6053gOAZGD','captureContainer','rgba(0,0,0,0.5)','progressOverlay','51233MZbvlD','absolute','grant_camera_access','Base64\x20image:','absoluteFill','bold'];_0x42f2=function(){return _0x240f06;};return _0x42f2();}import{View,Text,TouchableOpacity,Alert,StyleSheet,SafeAreaView,Image}from'react-native';import{Camera,useCameraDevice}from'react-native-vision-camera';function _0x5b62(_0x48b52d,_0x14cbde){const _0x42f2cb=_0x42f2();return _0x5b62=function(_0x5b622b,_0x3c262f){_0x5b622b=_0x5b622b-0xf9;let _0x1d90df=_0x42f2cb[_0x5b622b];return _0x1d90df;},_0x5b62(_0x48b52d,_0x14cbde);}import{Font,fullWidth,Height,Width}from'../utils/dimensions';import{useBynnSession}from'../useBynnSession';import{uploadMedia}from'../api';import _0x3167ea from'./ExitView';import{useTranslation}from'react-i18next';import'../i18n';import _0x3b209d from'react-native-fs';const DocumentCaptureFrontView=()=>{const _0x398836=_0x5b62,_0x4c15de=useRef(null),_0x476c4b=useCameraDevice('back'),[_0x3fcd8c,_0x2b569e]=useState(![]),[_0x271211,_0x2a504e]=useState(![]),[_0x18e706,_0x270c17]=useState(null),[_0x9ac095,_0x51e9a4]=useState(0x0),[_0x579076,_0x4a51d9]=useState(![]),[_0x3c9249,_0x343ef4]=useState(Date['now']()),[_0x165cb2,_0x54153b]=useState(![]),{sessionId:_0x53af5c}=useBynnSession(),{t:_0x24db72}=useTranslation();useEffect(()=>{((async()=>{const _0x308654=_0x5b62,_0x155b85=await Camera['requestCameraPermission'](),_0x4e781a=await Camera['requestMicrophonePermission']();_0x2b569e(_0x155b85==='granted'&&_0x4e781a===_0x308654(0x10a));})());},[]),useEffect(()=>{let _0x2ce878;return _0x579076&&(_0x51e9a4(0x0),_0x2ce878=setInterval(()=>{_0x51e9a4(_0x27b81e=>{if(_0x27b81e>=0x64)return clearInterval(_0x2ce878),_0x4a51d9(![]),0x64;return _0x27b81e+0x1;});},0x30)),()=>clearInterval(_0x2ce878);},[_0x579076]);const _0x496c0b=()=>{_0x343ef4(Date['now']());},_0x46e793=async()=>{const _0x361ec2=_0x5b62;if(!_0x4c15de[_0x361ec2(0x11b)]||!_0x3fcd8c)return;_0x496c0b();try{const _0x347c23=await _0x4c15de['current']['takePhoto']({'qualityPrioritization':'balanced','enableAutoRedEyeReduction':!![],'enableAutoStabilization':!![],'skipMetadata':![]}),_0x3a8139=await _0x3b209d['readFile'](_0x347c23[_0x361ec2(0x106)],'base64');console['log'](_0x361ec2(0x101),_0x3a8139);const _0x796bb8=''+_0x347c23['path'];_0x4a51d9(!![]),console[_0x361ec2(0x10c)](_0x361ec2(0x129),_0x796bb8);if(!_0x53af5c)throw new Error(_0x361ec2(0x110));await uploadMedia(_0x53af5c,_0x3a8139,_0x361ec2(0x10d)),_0x18e706&&console['log'](_0x361ec2(0x127),_0x18e706);}catch(_0x4dab0){console[_0x361ec2(0x123)](_0x361ec2(0x121),_0x4dab0),Alert[_0x361ec2(0x113)]('Error',_0x4dab0['message']||_0x361ec2(0x121));}};if(!_0x476c4b)return _0x197ab9['createElement'](View,{'style':styles[_0x398836(0x111)]},_0x197ab9[_0x398836(0x11d)](Text,{'style':styles[_0x398836(0x119)]},'Loading\x20camera...'));if(!_0x3fcd8c)return _0x197ab9[_0x398836(0x11d)](SafeAreaView,{'style':styles['container']},_0x197ab9['createElement'](Text,{'style':styles['tip']},_0x24db72('camera_access_required')),_0x197ab9[_0x398836(0x11d)](TouchableOpacity,{'onPress':async()=>{const _0x22de0b=_0x398836,_0x111ad6=await Camera['requestCameraPermission'](),_0x599e34=await Camera['requestMicrophonePermission']();_0x2b569e(_0x111ad6===_0x22de0b(0x10a)&&_0x599e34==='granted');},'style':styles[_0x398836(0x12a)]},_0x197ab9['createElement'](Text,{'style':styles[_0x398836(0x119)]},_0x24db72(_0x398836(0x100)))));return _0x197ab9['createElement'](SafeAreaView,{'style':styles['container']},_0x579076&&_0x197ab9['createElement'](View,{'style':styles[_0x398836(0xfd)]},_0x197ab9['createElement'](Image,{'key':_0x3c9249,'style':{'height':Height(0x12c),'width':Height(0x12c)},'source':require('../assets/img.gif')}),_0x197ab9[_0x398836(0x11d)](Text,{'style':styles['progressText']},_0x9ac095,'%')),_0x197ab9['createElement'](TouchableOpacity,{'style':{'alignSelf':_0x398836(0x10e),'position':_0x398836(0xff),'top':Height(0x29),'zIndex':0x3e8,'padding':Width(0xf)},'onPress':()=>_0x54153b(!![])},_0x197ab9['createElement'](Image,{'resizeMode':_0x398836(0x128),'style':{'height':Height(0x18),'width':Width(0x18),'tintColor':'white'},'source':require('../assets/leftIcon.png')})),_0x197ab9['createElement'](View,{'style':styles[_0x398836(0x11c)]},_0x197ab9['createElement'](Text,{'style':styles['tip']},_0x398836(0x114))),_0x197ab9['createElement'](Camera,{'ref':_0x4c15de,'style':StyleSheet[_0x398836(0x102)],'device':_0x476c4b,'isActive':!![],'photo':!![]}),_0x197ab9[_0x398836(0x11d)](View,{'style':styles[_0x398836(0x124)]}),_0x197ab9['createElement'](View,{'style':styles['leftOverlay']}),_0x197ab9[_0x398836(0x11d)](View,{'style':styles[_0x398836(0x118)]}),_0x197ab9['createElement'](View,{'style':styles[_0x398836(0x108)]}),_0x197ab9[_0x398836(0x11d)](View,{'style':styles['cutoutBorder']}),_0x197ab9['createElement'](View,{'style':styles['textContainer']},_0x197ab9['createElement'](Text,{'style':styles['instructions']},_0x24db72('take_photo_id_document_subtitle'))),_0x197ab9[_0x398836(0x11d)](View,{'style':styles[_0x398836(0xfb)]},_0x197ab9[_0x398836(0x11d)](TouchableOpacity,{'style':styles[_0x398836(0x11e)],'onPress':_0x46e793},_0x197ab9[_0x398836(0x11d)](Image,{'resizeMode':_0x398836(0x128),'style':{'height':Height(0x18),'width':Width(0x18)},'source':require('../assets/camera.png')}))),_0x197ab9['createElement'](_0x3167ea,{'visible':_0x165cb2,'onCancel':()=>_0x54153b(![]),'onConfirm':()=>_0x54153b(![])}));},styles=StyleSheet[_0x470d36(0x105)]({'container':{'flex':0x1,'backgroundColor':_0x470d36(0x122),'alignItems':'center','justifyContent':'center'},'headerText':{'zIndex':0xa,'marginTop':Height(0x3c),'position':_0x470d36(0xff),'top':0x0,'width':fullWidth,'color':_0x470d36(0x112),'textAlign':_0x470d36(0xf9),'fontSize':Font(0x10),'fontWeight':'500'},'tip':{'fontSize':0x10,'fontWeight':_0x470d36(0x120),'color':'#fff'},'permissionButton':{'backgroundColor':_0x470d36(0x104),'marginTop':Height(0xf),'justifyContent':'center','alignItems':'center','height':Height(0x28),'width':Width(0x104),'alignSelf':'center','borderRadius':Height(0xa)},'tipBox':{'backgroundColor':'rgba(255,255,255,0.6)','position':'absolute','zIndex':0x3e8,'top':Height(0x96),'justifyContent':_0x470d36(0xf9),'alignItems':'center','height':Height(0x28),'width':Width(0x11d),'alignSelf':'center','borderRadius':Height(0xa)},'topOverlay':{'position':'absolute','top':0x0,'left':0x0,'right':0x0,'height':Height(0xfa),'backgroundColor':'rgba(0,0,0,0.6)','zIndex':0x1},'bottomOverlay':{'position':_0x470d36(0xff),'bottom':0x0,'left':0x0,'right':0x0,'height':Height(0x15e),'backgroundColor':'rgba(0,0,0,0.6)','zIndex':0x1},'leftOverlay':{'position':_0x470d36(0xff),'top':Height(0xfa),'bottom':Height(0x15e),'left':0x0,'width':(fullWidth-0x168)/0x2,'backgroundColor':'rgba(0,0,0,0.6)','zIndex':0x1},'rightOverlay':{'position':'absolute','top':Height(0xfa),'bottom':Height(0x15e),'right':0x0,'width':(fullWidth-0x168)/0x2,'backgroundColor':'rgba(0,0,0,0.6)','zIndex':0x1},'cutoutBorder':{'position':_0x470d36(0xff),'top':Height(0xfa),'left':(fullWidth-0x168)/0x2,'width':Width(0x163),'height':Height(0xfd),'borderWidth':0x2,'borderColor':_0x470d36(0x11a),'borderRadius':0x8,'zIndex':0x2},'textContainer':{'zIndex':0xa,'position':'absolute','bottom':Height(0xe6),'left':Width(0x14),'right':Width(0x14),'alignItems':'center'},'instructions':{'color':'#ccc','fontSize':Font(0x10),'textAlign':_0x470d36(0xf9)},'captureContainer':{'position':'absolute','bottom':Height(0x50),'alignSelf':'center','zIndex':0xa},'captureBtn':{'backgroundColor':_0x470d36(0x11a),'padding':0x10,'borderRadius':0x32},'progressOverlay':{'position':_0x470d36(0xff),'top':0x0,'bottom':0x0,'left':0x0,'right':0x0,'backgroundColor':_0x470d36(0xfc),'justifyContent':_0x470d36(0xf9),'alignItems':'center','zIndex':0x270f},'progressText':{'position':'absolute','fontSize':Font(0x22),'fontWeight':_0x470d36(0x103),'color':'white'}});export default DocumentCaptureFrontView;