react-native-bynn-sdk
Version:
Bynn Mobile SDK for React Native - Identity verification and KYC
1 lines • 8.08 kB
JavaScript
const _0x149571=_0x12ba;(function(_0x3c2a18,_0x25b9e8){const _0x205f82=_0x12ba,_0x19233a=_0x3c2a18();while(!![]){try{const _0x5aa53b=parseInt(_0x205f82(0xc2))/0x1*(-parseInt(_0x205f82(0x9c))/0x2)+parseInt(_0x205f82(0x9b))/0x3*(-parseInt(_0x205f82(0xa1))/0x4)+-parseInt(_0x205f82(0xb0))/0x5+-parseInt(_0x205f82(0x9a))/0x6+-parseInt(_0x205f82(0xc4))/0x7*(parseInt(_0x205f82(0xa9))/0x8)+parseInt(_0x205f82(0xb3))/0x9+parseInt(_0x205f82(0xbf))/0xa;if(_0x5aa53b===_0x25b9e8)break;else _0x19233a['push'](_0x19233a['shift']());}catch(_0x3676a6){_0x19233a['push'](_0x19233a['shift']());}}}(_0x5f2f,0x57244));import _0x28d2d1,{useState,useEffect}from'react';import{View,StyleSheet,SafeAreaView,Text,TouchableOpacity,Platform,ActivityIndicator,Alert,Keyboard,KeyboardAvoidingView,TouchableWithoutFeedback,Image}from'react-native';import{Font,Height,Width}from'../utils/dimensions';import{OtpInput}from'react-native-otp-entry';import{submitEmailVerification,verifyEmailCode}from'../api';import{useBynnSession}from'../useBynnSession';import{useBynn}from'../BynnProvider';import _0x33d2d4 from'./ExitView';import{useTranslation}from'react-i18next';function _0x12ba(_0x596940,_0x3d89a5){const _0x5f2ffc=_0x5f2f();return _0x12ba=function(_0x12ba0c,_0x4acbc9){_0x12ba0c=_0x12ba0c-0x99;let _0x41177c=_0x5f2ffc[_0x12ba0c];return _0x41177c;},_0x12ba(_0x596940,_0x3d89a5);}function _0x5f2f(){const _0x5879dc=['Code\x20resent','create','flex-start','resend_code','enter_otp','#3141F3','8VGSyld','center','error','90%','contain','space-between','95%','2399840LRbcLY','log','20%','2949579funefv','alert','white','No\x20session','Verify','remove','500','#15181E','row','dismiss','400','padding','19024670AvflfW','createElement','height','15641XRahzg','#A0A0A0','4518017buZgBa','#FFFFF','1171188xyJWaZ','5286FYQZoU','38TzpsLW','text','#FFFFFF','message','One-Time\x20Password','580rytNLu','absolute'];_0x5f2f=function(){return _0x5879dc;};return _0x5f2f();}import'../i18n';export const EmailVerificationView=({email:email=''})=>{const _0x222a9f=_0x12ba,[_0x50db91,_0x4daa64]=useState(''),[_0xd3185b,_0x46a912]=useState(![]),{sessionId:_0x5c315a}=useBynnSession(),{setStep:_0x12bbcb}=useBynn(),[_0x2c5161,_0x204430]=useState(![]),[_0x444e4d,_0x353458]=useState(![]),[_0x479050,_0x81f830]=useState(0x3c),[_0x78c699,_0xc78566]=useState(![]),{t:_0x1d24ce}=useTranslation();useEffect(()=>{const _0xce66c2=Keyboard['addListener']('keyboardDidShow',()=>{_0x204430(!![]);}),_0x48e572=Keyboard['addListener']('keyboardDidHide',()=>{_0x204430(![]);});return()=>{const _0x2b5a15=_0x12ba;console['log'](_0x2c5161),_0xce66c2[_0x2b5a15(0xb8)](),_0x48e572[_0x2b5a15(0xb8)]();};},[]),useEffect(()=>{let _0x4a0144;return _0x479050>0x0&&!_0x78c699&&(_0x4a0144=setInterval(()=>{_0x81f830(_0x208624=>{if(_0x208624<=0x1)return _0xc78566(!![]),0x0;return _0x208624-0x1;});},0x3e8)),()=>{if(_0x4a0144)clearInterval(_0x4a0144);};},[_0x479050,_0x78c699]);const _0x3fa525=()=>{const _0x4cae45=_0x12ba;Keyboard[_0x4cae45(0xbc)]();},_0x3a5a4c=async()=>{const _0x452e4c=_0x12ba;try{if(!_0x5c315a)throw new Error('No\x20session');_0x46a912(!![]),await verifyEmailCode(_0x5c315a,_0x50db91+''),_0x46a912(![]),_0x12bbcb('proof_of_address');}catch(_0x5e5e53){console[_0x452e4c(0xab)](_0x5e5e53),_0x46a912(![]),Alert[_0x452e4c(0xb4)]('Error',_0x5e5e53['message']);}},_0x42124f=async()=>{const _0x151d21=_0x12ba;try{if(!_0x5c315a)throw new Error(_0x151d21(0xb6));_0x46a912(!![]),await submitEmailVerification(_0x5c315a,email+''),_0x46a912(![]),Alert['alert'](_0x151d21(0xa3)),_0xc78566(![]),_0x81f830(0x3c);}catch(_0x486449){console[_0x151d21(0xab)](_0x486449),_0x46a912(![]),Alert['alert']('Error',_0x486449[_0x151d21(0x9f)]);}};return _0x28d2d1['createElement'](TouchableWithoutFeedback,{'onPress':_0x3fa525},_0x28d2d1['createElement'](KeyboardAvoidingView,{'behavior':Platform['OS']==='ios'?_0x222a9f(0xbe):_0x222a9f(0xc1),'style':{'flex':0x1,'backgroundColor':_0x222a9f(0x9e)}},_0x28d2d1[_0x222a9f(0xc0)](SafeAreaView,{'style':{'flex':0x1,'alignItems':_0x222a9f(0xaa),'backgroundColor':_0x222a9f(0x9e)}},_0x28d2d1['createElement'](View,{'style':{'flexDirection':'row','justifyContent':_0x222a9f(0xae),'width':'90%'}},_0x28d2d1['createElement'](TouchableOpacity,{'onPress':()=>_0x353458(!![])},_0x28d2d1[_0x222a9f(0xc0)](Image,{'resizeMode':_0x222a9f(0xad),'style':{'height':Height(0x18),'width':Width(0x18)},'source':require('../assets/leftIcon.png')}))),_0x28d2d1[_0x222a9f(0xc0)](Text,{'style':{'fontSize':Font(0x19),'marginBottom':Height(0x14),'fontWeight':'600','lineHeight':Height(0x20),'textAlign':'left','alignSelf':_0x222a9f(0xa5),'marginLeft':'4%','paddingHorizontal':Width(0x5),'marginTop':Height(0xf)}},_0x1d24ce(_0x222a9f(0xa7))),_0x28d2d1[_0x222a9f(0xc0)](Text,{'style':{'fontSize':Font(0x11),'fontWeight':_0x222a9f(0xbd),'lineHeight':Height(0x18),'color':'#374255','width':_0x222a9f(0xac)}},_0x1d24ce('sent_to',{'value':email})),_0x28d2d1['createElement'](View,{'style':{'marginTop':Height(0xf)}},_0x28d2d1['createElement'](View,{'style':{'width':'90%'}},_0x28d2d1['createElement'](OtpInput,{'numberOfDigits':0x6,'focusColor':'#3141F3','autoFocus':!![],'hideStick':![],'placeholder':'','blurOnFilled':!![],'disabled':![],'type':'numeric','secureTextEntry':![],'focusStickBlinkingDuration':0x1f4,'onFocus':()=>console['log']('Focused'),'onBlur':()=>console['log']('Blurred'),'onTextChange':_0x3e7862=>_0x4daa64(_0x3e7862),'onFilled':_0x4033fd=>console[_0x222a9f(0xb1)]('OTP\x20is\x20'+_0x4033fd),'textInputProps':{'accessibilityLabel':_0x222a9f(0xa0)},'textProps':{'accessibilityRole':_0x222a9f(0x9d),'accessibilityLabel':'OTP\x20digit','allowFontScaling':![]},'theme':{'containerStyle':styles['container'],'pinCodeContainerStyle':{'borderRadius':Height(0x8)},'focusedPinCodeContainerStyle':{'backgroundColor':_0x222a9f(0xb5),'shadowColor':_0x222a9f(0xa8),'shadowOffset':{'width':0x0,'height':0x0},'shadowOpacity':0.2,'shadowRadius':0x4,'elevation':0x5}}})),_0x28d2d1['createElement'](TouchableOpacity,{'onPress':_0x42124f,'disabled':!_0x78c699&&_0x479050>0x0,'style':{'marginTop':Height(0x64)}},_0x28d2d1['createElement'](Text,{'style':{'color':_0x78c699?'#3141F3':_0x222a9f(0xc3),'fontSize':Font(0xc),'lineHeight':Height(0xe),'fontWeight':_0x222a9f(0xb9),'marginBottom':Height(0xa),'textDecorationLine':'underline'}},_0x78c699?_0x1d24ce('resend_code'):_0x1d24ce(_0x222a9f(0xa6))+'\x20('+_0x479050+'s)'))),_0x28d2d1[_0x222a9f(0xc0)](View,{'style':{'justifyContent':'center','alignItems':'center','position':_0x222a9f(0xa2),'bottom':Height(0x1e)}},_0x28d2d1['createElement'](TouchableOpacity,{'onPress':()=>{_0x3fa525(),_0x3a5a4c();},'disabled':_0x50db91['length']<0x6,'style':{'height':Height(0x38),'width':Width(0x168),'backgroundColor':_0x222a9f(0xba),'justifyContent':'center','alignItems':_0x222a9f(0xaa),'borderRadius':Height(0x38),'marginVertical':Height(0xa),'flexDirection':'row','columnGap':0x5}},_0xd3185b?_0x28d2d1['createElement'](ActivityIndicator,{'color':'white'}):_0x28d2d1['createElement'](Text,{'style':{'color':'#FFFFFF','fontSize':Font(0x10),'lineHeight':Height(0x18),'fontWeight':_0x222a9f(0xb9)}},_0x222a9f(0xb7)))),_0x28d2d1['createElement'](_0x33d2d4,{'visible':_0x444e4d,'onCancel':()=>_0x353458(![]),'onConfirm':()=>_0x353458(![])}))));};const styles=StyleSheet[_0x149571(0xa4)]({'container':{'flex':0x1,'backgroundColor':_0x149571(0x99)},'textInputContainer':{'justifyContent':_0x149571(0xaa),'borderRadius':Height(0x5),'marginBottom':Height(0x5),'width':_0x149571(0xac),'height':Height(0x39),'borderWidth':Height(0x2),'zIndex':-0xc8,'padding':0x1},'textInputText':{'fontSize':Font(0x11),'color':'black'},'textInputContainerAndroid':{'justifyContent':'center','borderRadius':Height(0x5),'marginBottom':Height(0x14),'width':_0x149571(0xaf),'height':Height(0x37),'borderWidth':Height(0x1),'borderColor':'#BDBDBD','padding':0x1},'textInputTextAndroid':{'fontSize':Font(0x11),'color':'black','position':_0x149571(0xa2),'top':0x2,'left':Width(0x41),'width':Width(0x96)},'flagButton':{'flexDirection':_0x149571(0xbb),'width':_0x149571(0xb2),'justifyContent':_0x149571(0xaa),'paddingLeft':Width(0xf)}});