react-native-bynn-sdk
Version:
Bynn Mobile SDK for React Native - Identity verification and KYC
1 lines • 9.53 kB
JavaScript
function _0x1bc0(){const _0x481b36=['launchCamera','didCancel','#FFFFFF','153680PLIuNr','Error','Camera\x20Permission','proof_of_address','Error\x20picking\x20image:','258NPzzsr','center','Camera\x20is\x20not\x20available\x20on\x20web','error','95%','base64','90%','Cancel','createElement','4445tODVpX','940491XyFZoV','30pJpPwm','now','#15181E','length','30xRwJQx','absolute','row','2323720hZOGgZ','400','left','flex-start','proof_of_address_description','progressOverlay','warn','launchImageLibrary','relative','27252577DhBuLg','20%','Permission\x20needed','upload_from_device','white','assets','4TLMWHM','Not\x20supported','contain','alert','2360781LFXZJE','bold','500','5545386pJJMwm','android','space-between','black'];_0x1bc0=function(){return _0x481b36;};return _0x1bc0();}const _0x1ee1e9=_0x4f84;(function(_0x276fab,_0x580372){const _0x37f660=_0x4f84,_0x1a09fc=_0x276fab();while(!![]){try{const _0x447cd7=parseInt(_0x37f660(0xf5))/0x1*(parseInt(_0x37f660(0xec))/0x2)+-parseInt(_0x37f660(0xf6))/0x3*(-parseInt(_0x37f660(0x10d))/0x4)+-parseInt(_0x37f660(0xe7))/0x5*(-parseInt(_0x37f660(0xf7))/0x6)+parseInt(_0x37f660(0x114))/0x7+parseInt(_0x37f660(0xfe))/0x8+-parseInt(_0x37f660(0x111))/0x9*(-parseInt(_0x37f660(0xfb))/0xa)+-parseInt(_0x37f660(0x107))/0xb;if(_0x447cd7===_0x580372)break;else _0x1a09fc['push'](_0x1a09fc['shift']());}catch(_0x546ca3){_0x1a09fc['push'](_0x1a09fc['shift']());}}}(_0x1bc0,0x69a19));import _0x189ecf,{useEffect,useState}from'react';import{StyleSheet,SafeAreaView,Text,TouchableOpacity,Platform,ActivityIndicator,Alert,Image,View,PermissionsAndroid}from'react-native';import{Font,fullWidth,Height,Width}from'../utils/dimensions';import{useBynnSession}from'../useBynnSession';import{submitAddressVerification}from'../api';function _0x4f84(_0x5acfa2,_0x59fbf9){const _0x1bc0dc=_0x1bc0();return _0x4f84=function(_0x4f84ab,_0x58a2f9){_0x4f84ab=_0x4f84ab-0xe4;let _0x5b7c96=_0x1bc0dc[_0x4f84ab];return _0x5b7c96;},_0x4f84(_0x5acfa2,_0x59fbf9);}import{useBynn}from'../BynnProvider';import*as _0x2c4032 from'react-native-image-picker';import _0x270abe from'./ExitView';import{useTranslation}from'react-i18next';import'../i18n';export const ProofOfAddressView=()=>{const _0x2ebedb=_0x4f84,[_0x4a0f32,_0xe50f7b]=useState(null),[_0xe1bac8,_0x26871d]=useState(null),[_0x2f1bc0,_0x310c34]=useState(![]),{sessionId:_0xc2d77e}=useBynnSession(),{setGlobalLoading:_0x3c229c,globalLoading:_0x53e991}=useBynn(),[_0x27594b,_0x1c1f4e]=useState(0x0),[_0x447bd3,_0x3b4a1d]=useState(![]),[_0x125d28,_0x1b0397]=useState(Date['now']()),[_0x1bea63,_0x1b5f81]=useState(![]),{t:_0x1e51ff}=useTranslation();useEffect(()=>{const _0x333d88=_0x4f84;_0x2f1bc0==!![]?(_0x1b0397(Date[_0x333d88(0xf8)]()),_0x283d66()):null;},[_0x2f1bc0]),useEffect(()=>{let _0x3de263;return _0x447bd3&&(_0x1c1f4e(0x0),_0x3de263=setInterval(()=>{_0x1c1f4e(_0xcfbb9d=>{if(_0xcfbb9d>=0x64)return clearInterval(_0x3de263),_0x3b4a1d(![]),0x64;return _0xcfbb9d+0x1;});},49.5)),()=>clearInterval(_0x3de263);},[_0x447bd3]);const _0x283d66=async()=>{const _0x28b6f0=_0x4f84;try{if(!_0xc2d77e)throw new Error('No\x20session');_0x3b4a1d(!![]),await submitAddressVerification(_0xc2d77e,_0xe1bac8?_0xe1bac8:''),_0x3c229c(!![]),_0x310c34(![]);}catch(_0x2482e0){console[_0x28b6f0(0xef)](_0x2482e0),_0x3b4a1d(![]),_0x3c229c(![]),_0x310c34(![]),Alert[_0x28b6f0(0x110)]('Error',_0x2482e0['message']),setTimeout(()=>{_0x3c229c(![]);},0x3e8);}},_0x10a01d=async()=>{const _0x3b05eb=_0x4f84;if(Platform['OS']===_0x3b05eb(0x115))try{const _0x26b95e=await PermissionsAndroid['request'](PermissionsAndroid['PERMISSIONS']['CAMERA'],{'title':_0x3b05eb(0xe9),'message':'App\x20needs\x20access\x20to\x20your\x20camera','buttonNeutral':'Ask\x20Me\x20Later','buttonNegative':_0x3b05eb(0xf3),'buttonPositive':'OK'});return _0x26b95e===PermissionsAndroid['RESULTS']['GRANTED'];}catch(_0x1b4f5e){return console[_0x3b05eb(0x104)](_0x1b4f5e),![];}return!![];},_0x34f1b4=async()=>{const _0x4304fd=_0x4f84;try{if(Platform['OS']!=='web'){const _0x3c7ed1=await _0x10a01d();if(!_0x3c7ed1){Alert['alert'](_0x4304fd(0x109),'Camera\x20permission\x20is\x20required\x20to\x20take\x20photos');return;}const _0x3ff2ee=await _0x2c4032[_0x4304fd(0xe4)]({'mediaType':'photo','quality':0.8,'includeBase64':!![]});!_0x3ff2ee['didCancel']&&_0x3ff2ee['assets']&&_0x3ff2ee[_0x4304fd(0x10c)][_0x4304fd(0xfa)]>0x0&&(_0xe50f7b(_0x3ff2ee['assets'][0x0]['uri']),setTimeout(()=>{const _0x3c6d48=_0x4304fd;_0x26871d(_0x3ff2ee[_0x3c6d48(0x10c)][0x0]['base64']),_0x310c34(!![]);},0x3e8));}else Alert[_0x4304fd(0x110)](_0x4304fd(0x10e),_0x4304fd(0xee));}catch(_0x46e02a){console['error']('Error\x20taking\x20photo:',_0x46e02a),Alert[_0x4304fd(0x110)](_0x4304fd(0xe8),'Failed\x20to\x20take\x20photo');}},_0x3d5723=async()=>{const _0x4cde35=_0x4f84;try{const _0xde31ad=await _0x2c4032[_0x4cde35(0x105)]({'mediaType':'photo','quality':0.8,'includeBase64':!![]});!_0xde31ad[_0x4cde35(0xe5)]&&_0xde31ad['assets']&&_0xde31ad['assets'][_0x4cde35(0xfa)]>0x0&&(_0xe50f7b(_0xde31ad[_0x4cde35(0x10c)][0x0]['uri']),setTimeout(()=>{const _0xb270d8=_0x4cde35;_0x26871d(_0xde31ad['assets'][0x0][_0xb270d8(0xf1)]),_0x310c34(!![]);},0x3e8));}catch(_0x4ca198){console[_0x4cde35(0xef)](_0x4cde35(0xeb),_0x4ca198),Alert[_0x4cde35(0x110)](_0x4cde35(0xe8),'Failed\x20to\x20pick\x20image');}};return _0x189ecf[_0x2ebedb(0xf4)](SafeAreaView,{'style':{'flex':0x1,'alignItems':_0x2ebedb(0xed),'backgroundColor':'#FFFFFF'}},!_0x447bd3&&_0x53e991&&_0x189ecf[_0x2ebedb(0xf4)](View,{'style':styles['progressOverlay']},_0x189ecf[_0x2ebedb(0xf4)](ActivityIndicator,{'size':'large','color':_0x2ebedb(0x10b)})),_0x447bd3&&_0x189ecf[_0x2ebedb(0xf4)](View,{'style':styles[_0x2ebedb(0x103)]},_0x189ecf[_0x2ebedb(0xf4)](Image,{'key':_0x125d28,'style':{'height':Height(0x12c),'width':Height(0x12c),'justifyContent':_0x2ebedb(0xed),'alignItems':_0x2ebedb(0xed),'position':_0x2ebedb(0x106)},'source':require('../assets/img.gif')}),_0x189ecf['createElement'](Text,{'style':{'position':'absolute','fontSize':Font(0x22),'fontWeight':_0x2ebedb(0x112),'color':_0x2ebedb(0x10b)}},_0x27594b,'%')),_0x189ecf[_0x2ebedb(0xf4)](View,{'style':{'flexDirection':'row','justifyContent':_0x2ebedb(0x116),'width':'90%'}},_0x189ecf[_0x2ebedb(0xf4)](TouchableOpacity,{'onPress':()=>_0x1b5f81(!![])},_0x189ecf['createElement'](Image,{'resizeMode':_0x2ebedb(0x10f),'style':{'height':Height(0x18),'width':Width(0x18)},'source':require('../assets/leftIcon.png')}))),_0x189ecf[_0x2ebedb(0xf4)](Text,{'style':{'fontSize':Font(0x19),'marginBottom':Height(0x14),'fontWeight':'600','lineHeight':Height(0x20),'textAlign':_0x2ebedb(0x100),'alignSelf':_0x2ebedb(0x101),'marginLeft':'4%','paddingHorizontal':Width(0x5),'marginTop':Height(0xf)}},_0x1e51ff(_0x2ebedb(0xea))),_0x189ecf['createElement'](Text,{'style':{'fontSize':Font(0x11),'fontWeight':_0x2ebedb(0xff),'lineHeight':Height(0x18),'color':'#374255','width':'90%'}},_0x1e51ff(_0x2ebedb(0x102))),_0x4a0f32?_0x189ecf[_0x2ebedb(0xf4)](View,{'style':{'marginTop':Height(0x14),'alignItems':_0x2ebedb(0xed)}},_0x189ecf['createElement'](Image,{'resizeMode':'contain','source':{'uri':_0x4a0f32},'style':{'width':0.9*fullWidth,'height':Height(0x190),'borderRadius':Height(0x0),'marginBottom':Height(0xa)}})):_0x189ecf[_0x2ebedb(0xf4)](View,null),_0x189ecf[_0x2ebedb(0xf4)](View,{'style':{'justifyContent':_0x2ebedb(0xed),'alignItems':_0x2ebedb(0xed),'position':_0x2ebedb(0xfc),'bottom':Height(0x1e)}},_0x189ecf['createElement'](TouchableOpacity,{'onPress':_0x34f1b4,'style':{'height':Height(0x38),'width':Width(0x168),'backgroundColor':_0x2ebedb(0xf9),'justifyContent':'center','alignItems':_0x2ebedb(0xed),'borderRadius':Height(0x38),'marginVertical':Height(0xa),'flexDirection':'row','columnGap':0x5}},_0x189ecf['createElement'](Text,{'style':{'color':_0x2ebedb(0xe6),'fontSize':Font(0x10),'lineHeight':Height(0x18),'fontWeight':_0x2ebedb(0x113)}},_0x1e51ff('take_photo'))),_0x189ecf['createElement'](TouchableOpacity,{'onPress':_0x3d5723,'style':{'height':Height(0x38),'width':Width(0x168),'borderColor':_0x2ebedb(0xf9),'borderWidth':0x1,'justifyContent':_0x2ebedb(0xed),'alignItems':_0x2ebedb(0xed),'borderRadius':Height(0x38),'marginVertical':Height(0xa),'flexDirection':_0x2ebedb(0xfd),'columnGap':0x5}},_0x189ecf[_0x2ebedb(0xf4)](Text,{'style':{'color':'#15181E','fontSize':Font(0x10),'lineHeight':Height(0x18),'fontWeight':'500'}},_0x1e51ff(_0x2ebedb(0x10a))))),_0x189ecf[_0x2ebedb(0xf4)](_0x270abe,{'visible':_0x1bea63,'onCancel':()=>_0x1b5f81(![]),'onConfirm':()=>_0x1b5f81(![])}));};const styles=StyleSheet['create']({'container':{'flex':0x1,'backgroundColor':'#FFFFF'},'textInputContainer':{'justifyContent':'center','borderRadius':Height(0x5),'marginBottom':Height(0x5),'width':_0x1ee1e9(0xf2),'height':Height(0x39),'borderWidth':Height(0x2),'zIndex':-0xc8,'padding':0x1},'textInputText':{'fontSize':Font(0x11),'color':_0x1ee1e9(0x117)},'textInputContainerAndroid':{'justifyContent':'center','borderRadius':Height(0x5),'marginBottom':Height(0x14),'width':_0x1ee1e9(0xf0),'height':Height(0x37),'borderWidth':Height(0x1),'borderColor':'#BDBDBD','padding':0x1},'textInputTextAndroid':{'fontSize':Font(0x11),'color':'black','position':'absolute','top':0x2,'left':Width(0x41),'width':Width(0x96)},'flagButton':{'flexDirection':_0x1ee1e9(0xfd),'width':_0x1ee1e9(0x108),'justifyContent':'center','paddingLeft':Width(0xf)},'progressOverlay':{'position':_0x1ee1e9(0xfc),'top':0x0,'bottom':0x0,'left':0x0,'right':0x0,'backgroundColor':'rgba(0,0,0,0.5)','justifyContent':_0x1ee1e9(0xed),'alignItems':_0x1ee1e9(0xed),'zIndex':0x270f}});