UNPKG

react-native-bynn-sdk

Version:

Bynn Mobile SDK for React Native - Identity verification and KYC

1 lines 8.11 kB
const _0x2c3f0f=_0x416b;(function(_0x1fe64,_0x4af1d9){const _0x248824=_0x416b,_0x2dcc78=_0x1fe64();while(!![]){try{const _0x14847c=-parseInt(_0x248824(0x147))/0x1*(parseInt(_0x248824(0x125))/0x2)+parseInt(_0x248824(0x123))/0x3*(parseInt(_0x248824(0x129))/0x4)+parseInt(_0x248824(0x137))/0x5+-parseInt(_0x248824(0x136))/0x6+parseInt(_0x248824(0x12b))/0x7*(-parseInt(_0x248824(0x142))/0x8)+parseInt(_0x248824(0x132))/0x9*(-parseInt(_0x248824(0x13d))/0xa)+parseInt(_0x248824(0x12c))/0xb*(parseInt(_0x248824(0x143))/0xc);if(_0x14847c===_0x4af1d9)break;else _0x2dcc78['push'](_0x2dcc78['shift']());}catch(_0x17ad7c){_0x2dcc78['push'](_0x2dcc78['shift']());}}}(_0x2489,0x9b8f6));import _0x33f38b,{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{useBynnSession}from'../useBynnSession';import{submitPhoneVerification,verifyPhoneCode}from'../api';import _0x36188f from'./ExitView';import{useTranslation}from'react-i18next';import'../i18n';export const PhoneVerificationView=({phone:phone=''})=>{const _0x1d8b59=_0x416b,[_0x4481e8,_0x5498f8]=useState(''),[_0x1dfdff,_0x1c8c69]=useState(![]),{sessionId:_0x4c9482}=useBynnSession(),[_0x41cf13,_0x5d262d]=useState(![]),[_0x5f4ce9,_0x5f3fbd]=useState(![]),[_0x49d1e7,_0x4f72c5]=useState(0x3c),[_0x1825d1,_0x3e661a]=useState(![]),{t:_0xba59ef}=useTranslation();console[_0x1d8b59(0x11f)](_0x41cf13),useEffect(()=>{const _0x419200=_0x1d8b59,_0x2683d7=Keyboard['addListener']('keyboardDidShow',()=>{_0x5d262d(!![]);}),_0x2cacb4=Keyboard['addListener'](_0x419200(0x145),()=>{_0x5d262d(![]);});return()=>{_0x2683d7['remove'](),_0x2cacb4['remove']();};},[]),useEffect(()=>{let _0x34b751;return _0x49d1e7>0x0?_0x34b751=setInterval(()=>{_0x4f72c5(_0x5e32d8=>_0x5e32d8-0x1);},0x3e8):_0x3e661a(!![]),()=>{if(_0x34b751)clearInterval(_0x34b751);};},[_0x49d1e7]);const _0x472d48=()=>{Keyboard['dismiss']();},_0x5a55c2=async()=>{const _0x3d932e=_0x1d8b59;try{if(!_0x4c9482)throw new Error('No\x20session');_0x1c8c69(!![]),await verifyPhoneCode(_0x4c9482,_0x4481e8+''),_0x1c8c69(![]);}catch(_0xd057a4){console[_0x3d932e(0x124)](_0xd057a4),_0x1c8c69(![]),Alert['alert'](_0x3d932e(0x13e),_0xd057a4[_0x3d932e(0x122)]);}},_0x2080f4=async()=>{const _0x4555be=_0x1d8b59;if(!_0x1825d1&&_0x49d1e7>0x0)return;try{if(!_0x4c9482)throw new Error(_0x4555be(0x141));_0x1c8c69(!![]),await submitPhoneVerification(_0x4c9482,phone+''),_0x1c8c69(![]),_0x4f72c5(0x3c),_0x3e661a(![]),Alert['alert']('Code\x20resent');}catch(_0x2e3894){console['error'](_0x2e3894),_0x1c8c69(![]),Alert[_0x4555be(0x138)](_0x4555be(0x13e),_0x2e3894[_0x4555be(0x122)]);}};return _0x33f38b[_0x1d8b59(0x12d)](TouchableWithoutFeedback,{'onPress':_0x472d48},_0x33f38b['createElement'](KeyboardAvoidingView,{'behavior':Platform['OS']==='ios'?'padding':_0x1d8b59(0x12f),'style':{'flex':0x1,'backgroundColor':'#FFFFFF'}},_0x33f38b[_0x1d8b59(0x12d)](SafeAreaView,{'style':{'flex':0x1,'alignItems':_0x1d8b59(0x11d),'backgroundColor':'#FFFFFF'}},_0x33f38b['createElement'](View,{'style':{'flexDirection':'row','justifyContent':_0x1d8b59(0x127),'width':'90%'}},_0x33f38b['createElement'](TouchableOpacity,{'onPress':()=>_0x5f3fbd(!![])},_0x33f38b[_0x1d8b59(0x12d)](Image,{'resizeMode':'contain','style':{'height':Height(0x18),'width':Width(0x18)},'source':require('../assets/leftIcon.png')}))),_0x33f38b['createElement'](Text,{'style':{'fontSize':Font(0x19),'marginBottom':Height(0x14),'fontWeight':'600','lineHeight':Height(0x20),'textAlign':_0x1d8b59(0x13a),'alignSelf':'flex-start','marginLeft':'4%','paddingHorizontal':Width(0x5),'marginTop':Height(0xf)}},_0xba59ef(_0x1d8b59(0x13c))),_0x33f38b[_0x1d8b59(0x12d)](Text,{'style':{'fontSize':Font(0x11),'fontWeight':_0x1d8b59(0x12e),'lineHeight':Height(0x18),'color':'#374255','width':_0x1d8b59(0x120)}},_0xba59ef('sent_to',{'value':phone})),_0x33f38b[_0x1d8b59(0x12d)](View,{'style':{'marginTop':Height(0xf)}},_0x33f38b['createElement'](View,{'style':{'width':'90%'}},_0x33f38b[_0x1d8b59(0x12d)](OtpInput,{'numberOfDigits':0x6,'focusColor':_0x1d8b59(0x139),'autoFocus':!![],'hideStick':![],'placeholder':'','blurOnFilled':!![],'disabled':![],'type':_0x1d8b59(0x13b),'secureTextEntry':![],'focusStickBlinkingDuration':0x1f4,'onFocus':()=>console[_0x1d8b59(0x11f)](_0x1d8b59(0x13f)),'onBlur':()=>console[_0x1d8b59(0x11f)](_0x1d8b59(0x140)),'onTextChange':_0x47a768=>_0x5498f8(_0x47a768),'onFilled':_0x516144=>console[_0x1d8b59(0x11f)]('OTP\x20is\x20'+_0x516144),'textInputProps':{'accessibilityLabel':_0x1d8b59(0x121)},'textProps':{'accessibilityRole':_0x1d8b59(0x128),'accessibilityLabel':_0x1d8b59(0x11c),'allowFontScaling':![]},'theme':{'containerStyle':styles['container'],'pinCodeContainerStyle':{'borderRadius':Height(0x8)},'focusedPinCodeContainerStyle':{'backgroundColor':_0x1d8b59(0x135),'shadowColor':_0x1d8b59(0x139),'shadowOffset':{'width':0x0,'height':0x0},'shadowOpacity':0.2,'shadowRadius':0x4,'elevation':0x5}}})),_0x33f38b[_0x1d8b59(0x12d)](TouchableOpacity,{'onPress':_0x2080f4,'disabled':!_0x1825d1&&_0x49d1e7>0x0,'style':{'marginTop':Height(0x64)}},_0x33f38b[_0x1d8b59(0x12d)](Text,{'style':{'color':_0x1825d1?'#3141F3':_0x1d8b59(0x146),'fontSize':Font(0xc),'lineHeight':Height(0xe),'fontWeight':'500','marginBottom':Height(0xa),'textDecorationLine':_0x1d8b59(0x134)}},_0x1825d1?_0xba59ef(_0x1d8b59(0x131)):_0xba59ef('resend_code')+'\x20('+_0x49d1e7+'s)'))),_0x33f38b[_0x1d8b59(0x12d)](View,{'style':[{'justifyContent':_0x1d8b59(0x11d),'alignItems':_0x1d8b59(0x11d),'position':'absolute','bottom':Height(0x1e)}]},_0x33f38b[_0x1d8b59(0x12d)](TouchableOpacity,{'onPress':()=>{_0x472d48(),_0x5a55c2();},'disabled':_0x4481e8[_0x1d8b59(0x130)]<0x6,'style':{'height':Height(0x38),'width':Width(0x168),'backgroundColor':'#15181E','justifyContent':_0x1d8b59(0x11d),'alignItems':_0x1d8b59(0x11d),'borderRadius':Height(0x38),'marginVertical':Height(0xa),'flexDirection':_0x1d8b59(0x12a),'columnGap':0x5}},_0x1dfdff?_0x33f38b['createElement'](ActivityIndicator,{'color':'white'}):_0x33f38b['createElement'](Text,{'style':{'color':_0x1d8b59(0x11e),'fontSize':Font(0x10),'lineHeight':Height(0x18),'fontWeight':_0x1d8b59(0x11a)}},'Verify'))),_0x33f38b['createElement'](_0x36188f,{'visible':_0x5f4ce9,'onCancel':()=>_0x5f3fbd(![]),'onConfirm':()=>_0x5f3fbd(![])}))));};const styles=StyleSheet[_0x2c3f0f(0x133)]({'container':{'flex':0x1,'backgroundColor':'#FFFFF'},'textInputContainer':{'justifyContent':'center','borderRadius':Height(0x5),'marginBottom':Height(0x5),'width':_0x2c3f0f(0x120),'height':Height(0x39),'borderWidth':Height(0x2),'zIndex':-0xc8,'padding':0x1},'textInputText':{'fontSize':Font(0x11),'color':'black'},'textInputContainerAndroid':{'justifyContent':_0x2c3f0f(0x11d),'borderRadius':Height(0x5),'marginBottom':Height(0x14),'width':_0x2c3f0f(0x126),'height':Height(0x37),'borderWidth':Height(0x1),'borderColor':'#BDBDBD','padding':0x1},'textInputTextAndroid':{'fontSize':Font(0x11),'color':_0x2c3f0f(0x144),'position':_0x2c3f0f(0x11b),'top':0x2,'left':Width(0x41),'width':Width(0x96)},'flagButton':{'flexDirection':'row','width':'20%','justifyContent':'center','paddingLeft':Width(0xf)}});function _0x416b(_0x17c9a7,_0x592c91){const _0x24899e=_0x2489();return _0x416b=function(_0x416b5e,_0x3c7ec7){_0x416b5e=_0x416b5e-0x11a;let _0x21c6f1=_0x24899e[_0x416b5e];return _0x21c6f1;},_0x416b(_0x17c9a7,_0x592c91);}function _0x2489(){const _0x4b5b0e=['336176iriPMN','72mNlWZg','black','keyboardDidHide','#A0A0A0','1ZhRogK','500','absolute','OTP\x20digit','center','#FFFFFF','log','90%','One-Time\x20Password','message','2140059sFOdEW','error','1481194RIbFKq','95%','space-between','text','4lKcuIc','row','154icfGro','6013414xvOQIt','createElement','400','height','length','resend_code','1749573UDEWuF','create','underline','white','4727352QDPWHk','343675WEYScT','alert','#3141F3','left','numeric','enter_otp','50jjyalg','Error','Focused','Blurred','No\x20session'];_0x2489=function(){return _0x4b5b0e;};return _0x2489();}