1(self.webpackChunkaichiense=self.webpackChunkaichiense||[]).push([["src_mobile_screens_me_WithdrawScreen_js"],{916469:function(e,t,n){"use strict";n.r(t),n.d(t,{ActionTypes:function(){return f.ActionTypes},Actions:function(){return _},reducer:function(){return h},INITIAL_STATE:function(){return E}});var o,r=n("629232"),i=n("171697"),a=n("926690"),c=n("246695"),s=n("600291"),l=n.n(s),u=n("244223"),d=n("44020"),f=n("989251"),p=n("15484"),y=n("452627"),A=n("214136"),_={loadScreenViewAsync:function(){return function(e){e({type:f.ActionTypes.LOAD_SCREEN_VIEW_ASYNC}),y.default.loadWithdrawView(function(t){e(_.loadScreenViewSuccess(t))},function(t){e(_.loadScreenViewFailure(t))})}},loadScreenViewSuccess:function(e){return{type:f.ActionTypes.LOAD_SCREEN_VIEW_SUCCESS,parentType:f.ActionTypes.LOAD_SCREEN_VIEW_ASYNC,postReducer:loadScreenViewSuccessPostReducer,data:e}},loadScreenViewFailure:function(e){return{type:f.ActionTypes.LOAD_SCREEN_VIEW_FAILURE,parentType:f.ActionTypes.LOAD_SCREEN_VIEW_ASYNC,error:e}},verifyCodeAsync:function(e){return function(t){t({type:f.ActionTypes.VERIFY_CODE_ASYNC,vo:e}),y.default.verifyCode(e,function(n){t(_.verifyCodeSuccess(n,e))},function(e){t(_.verifyCodeFailure(e))})}},verifyCodeSuccess:function(e,t){return{type:f.ActionTypes.VERIFY_CODE_SUCCESS,parentType:f.ActionTypes.VERIFY_CODE_ASYNC,data:e,vo:t}},verifyCodeFailure:function(e){return{type:f.ActionTypes.VERIFY_CODE_FAILURE,parentType:f.ActionTypes.VERIFY_CODE_ASYNC,error:e}},sendVerifyCodeAsync:function(e){return function(t){t({type:f.ActionTypes.SEND_VERIFY_CODE_ASYNC,vo:e}),y.default.sendVerifyCode(e,function(e){t(_.sendVerifyCodeSuccess(e))},function(e){t(_.sendVerifyCodeFailure(e))})}},sendVerifyCodeSuccess:function(e){return{type:f.ActionTypes.SEND_VERIFY_CODE_SUCCESS,parentType:f.ActionTypes.SEND_VERIFY_CODE_ASYNC,postReducer:sendVerifyCodeSuccessPostReducer,data:e}},sendVerifyCodeFailure:function(e){return{type:f.ActionTypes.SEND_VERIFY_CODE_FAILURE,parentType:f.ActionTypes.SEND_VERIFY_CODE_ASYNC,error:e}},setState:function(e){return{type:f.ActionTypes.SET_STATE,vo:e}},saveWithdrawalAsync:function(e){return function(t){t({type:f.ActionTypes.SAVE_WITHDRAWAL_ASYNC,vo:e}),y.default.saveWithdrawal(e,function(e){t(_.saveWithdrawalSuccess(e))},function(e){t(_.saveWithdrawalFailure(e))})}},saveWithdrawalSuccess:function(e){return{type:f.ActionTypes.SAVE_WITHDRAWAL_SUCCESS,parentType:f.ActionTypes.SAVE_WITHDRAWAL_ASYNC,data:e}},saveWithdrawalFailure:function(e){return{type:f.ActionTypes.SAVE_WITHDRAWAL_FAILURE,parentType:f.ActionTypes.SAVE_WITHDRAWAL_ASYNC,error:e}}},E={bankAccounts:null,balance:0,availableBalance:0,baseCurrency:null,amountApplied:null,countDownStarted:null,isOpen:!1,countDown:null,showCodeFailureMsg:!1,bankAccountId:null,verificationCode:null},loadScreenViewSuccessPostReducer=function(e,t){var n,o,r=t.data,c=r.bankAccount;if(!c)return(0,a._)((0,i._)({},e),{balance:r.amounts.balance,availableBalance:r.amounts.availableBalance,baseCurrency:r.amounts.baseCurrency,bankAccounts:r.bankAccounts,bankAccountId:null===(o=r.bankAccounts)||void 0===o?void 0:null===(n=o[0])||void 0===n?void 0:n.id});var s=l.clone(e.bankAccounts||[]),u=s.findIndex(function(e){return e.id===c.id});return u>-1?s[u]=c:s.push(c),(0,a._)((0,i._)({},e),{bankAccounts:s})},sendVerifyCodeSuccessPostReducer=function(e){return(0,a._)((0,i._)({},e),{countDownStarted:!0,showCodeFailureMsg:!1})},S=(0,c.createReducer)(E,(o={},(0,r._)(o,f.ActionTypes.LOAD_SCREEN_VIEW_ASYNC,A.default.actionReducer),(0,r._)(o,f.ActionTypes.LOAD_SCREEN_VIEW_SUCCESS,A.default.successReducer),(0,r._)(o,f.ActionTypes.LOAD_SCREEN_VIEW_FAILURE,A.default.failureReducer),(0,r._)(o,f.ActionTypes.VERIFY_CODE_ASYNC,A.default.actionReducer),(0,r._)(o,f.ActionTypes.VERIFY_CODE_SUCCESS,A.default.successReducer),(0,r._)(o,f.ActionTypes.VERIFY_CODE_FAILURE,A.default.failureReducer),(0,r._)(o,f.ActionTypes.SEND_VERIFY_CODE_ASYNC,A.default.actionReducer),(0,r._)(o,f.ActionTypes.SEND_VERIFY_CODE_SUCCESS,A.default.successReducer),(0,r._)(o,f.ActionTypes.SEND_VERIFY_CODE_FAILURE,A.default.failureReducer),(0,r._)(o,f.ActionTypes.SAVE_WITHDRAWAL_ASYNC,A.default.actionReducer),(0,r._)(o,f.ActionTypes.SAVE_WITHDRAWAL_SUCCESS,A.default.successReducer),(0,r._)(o,f.ActionTypes.SAVE_WITHDRAWAL_FAILURE,A.default.failureReducer),(0,r._)(o,f.ActionTypes.SET_STATE,function(e,t){var n=t.vo;return(0,i._)({},e,n)}),(0,r._)(o,p.ActionTypes.SAVE_BANK_ACCOUNT_SUCCESS,loadScreenViewSuccessPostReducer),(0,r._)(o,p.ActionTypes.DELETE_BANK_ACCOUNT_SUCCESS,function(e,t){for(var n,o=t.vo,r=e.bankAccounts,c=e.bankAccountId,s=l.clone(r),u=s.length-1;u>=0;)s[u].id===o.id&&s.splice(u,1),u-=1;return c===o.id?(0,a._)((0,i._)({},e),{bankAccounts:s,bankAccountId:null==s?void 0:null===(n=s[0])||void 0===n?void 0:n.id}):(0,a._)((0,i._)({},e),{bankAccounts:s})}),o)),h=new d.default(u.default.screens.me.withdraw,S)},126504:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return N}});var o=n("212939"),r=n("831113"),i=n("975471"),a=n("629232"),c=n("157934"),s=n("16171"),l=n("972768"),u=n("709580"),d=n("250490"),f=n.n(d),p=n("261692"),y=n("862605"),A=n("47314"),_=n("480861"),E=n("772281"),S=n("927103"),h=n("600291"),C=n.n(h),m=n("509002"),g=n("327769"),T=n("224289"),w=n("580142"),b=n("244223"),I=n("916469"),v=n("206726");n("184950"),n("266373");var R=n("297562"),V=b.default.screens.me.withdraw,D=null,W=function(e){(0,l._)(WithdrawScreen,e);var t=(0,u._)(WithdrawScreen);function WithdrawScreen(e){var n;return(0,r._)(this,WithdrawScreen),n=t.call(this,e),(0,a._)((0,o._)(n),"_handleImmediateWithDrawal",function(){var e=n.props.localState,t=e.bankAccounts,o=e.bankAccountId,r=e.amountApplied,i=e.availableBalance,a=e.countDownStarted;return(null==t?void 0:t.length)?o?Number(r)>i?n.displayError({message:n.props.t("InsufficientFunds")}):void(!a&&n.props.sendVerifyCodeAsync(),n._toggleModal()):n.displayError({message:n.props.t("noSelectBankAccounts")}):n.displayError({message:n.props.t("noBankAccounts")})}),(0,a._)((0,o._)(n),"_toggleModal",function(){var e=n.props.localState.isOpen;n.props.setState({isOpen:!e,showCodeFailureMsg:!1,verificationCode:null,countDown:null})}),(0,a._)((0,o._)(n),"_handleChangeAmount",function(e){n.props.setState({amountApplied:e})}),(0,a._)((0,o._)(n),"_handleChangeAmountEnd",function(e){var t=e.nativeEvent.text;t=(t=(t=(t=(t=t.replace(/[^\d.]/g,"")).replace(/^\./g,"")).replace(/\.{2,}/g,".")).replace(".","$#$").replace(/\./g,"").replace("$#$",".")).replace(/^(\-)*(\d+)\.(\d\d).*$/,"$1$2.$3");var o=n.props.localState.availableBalance;Number(t)>o&&(t=o),n.props.setState({amountApplied:t?Number(t):null})}),(0,a._)((0,o._)(n),"_handleCountDown",function(e){if(!e||isNaN(parseInt(e))){n.props.setState({countDownStarted:!1});return}n.props.setState({countDown:e}),D=setTimeout(function(){return n._handleCountDown(--e)},1e3)}),(0,a._)((0,o._)(n),"_handleSendVerifyCodeAsyncDone",function(){n._handleCountDown(60)}),(0,a._)((0,o._)(n),"_handlVerifyCodeAsyncDone",function(){var e=n.props.localState,t=e.baseCurrency,o=e.amountApplied,r=e.bankAccountId;n.props.saveWithdrawalAsync({transactionType:0,transactionData:JSON.stringify({currencyCode:t.code,amountApplied:o,bankAccountId:r})})}),(0,a._)((0,o._)(n),"_handleVerifyCodeAsyncActionError",function(){n.props.setState({showCodeFailureMsg:!0})}),(0,a._)((0,o._)(n),"_handlSaveWithdrawalAsyncDone",function(){w.NavigationService.navigateToPage((0,o._)(n),b.default.screens.me.myWallet)}),(0,a._)((0,o._)(n),"_handleAsyncActionError",function(e){n.displayError(e.error)}),(0,a._)((0,o._)(n),"_onPressBack",function(){w.NavigationService.navigateByAction((0,o._)(n),R.default.BACK)}),n}return(0,i._)(WithdrawScreen,[{key:"routeName",get:function(){return V}},{key:"reducer",get:function(){return I.reducer}},{key:"actionHandlers",get:function(){var e;return e={},(0,a._)(e,I.ActionTypes.LOAD_SCREEN_VIEW_ASYNC,{done:null}),(0,a._)(e,I.ActionTypes.SEND_VERIFY_CODE_ASYNC,{done:this._handleSendVerifyCodeAsyncDone,error:this._handleAsyncActionError}),(0,a._)(e,I.ActionTypes.VERIFY_CODE_ASYNC,{done:this._handlVerifyCodeAsyncDone,error:this._handleVerifyCodeAsyncActionError}),(0,a._)(e,I.ActionTypes.SAVE_WITHDRAWAL_ASYNC,{done:this._handlSaveWithdrawalAsyncDone,error:this._handleAsyncActionError}),e}},{key:"componentDidMount",value:function(){(0,c._)((0,s._)(WithdrawScreen.prototype),"componentDidMount",this).call(this),this.props.loadScreenViewAsync()}},{key:"componentWillUnmount",value:function(){(0,c._)((0,s._)(WithdrawScreen.prototype),"componentWillUnmount",this).call(this),D&&clearTimeout(D)}},{key:"renderScreen",value:function(){var e=this;if(!this.isActionDone(I.ActionTypes.LOAD_SCREEN_VIEW_ASYNC))return f.createElement(T.default,{title:this.props.t("withdraw")});var t=this.props.localState,n=t.availableBalance,o=t.baseCurrency,r=t.bankAccounts,i=t.bankAccountId,a=t.amountApplied,c=t.isOpen,s=o?o.symbol:"";return f.createElement(y.View,{style:this.props.style||{flex:1}}
1,f.createElement(S.Container,null,f.createElement(m.default,{style:[k.headerColor]},f.createElement(S.Left,{style:[k.flex1]},f.createElement(S.Button,{transparent:!0,onPress:this._onPressBack},f.createElement(v.default,{name:"ios-arrow-back",style:{fontSize:30,color:"#777"}}))),f.createElement(S.Body,{style:[k.flex3,k.alignItemsCenter]},f.createElement(S.Title,{style:[k.headerTitle]},this.props.t("withdraw"))),f.createElement(S.Right,{style:[k.flex1]})),f.createElement(S.Content,{style:[k.backgroundColor]},f.createElement(y.View,{style:{backgroundColor:"#fff",paddingLeft:10,paddingVertical:10}},f.createElement(y.Text,{style:{color:"#333",fontSize:12,fontWeight:"300"}},this.props.t("title1"),f.createElement(y.Text,{style:{color:"#ffab06",fontSize:10,fontWeight:"300"}},this.props.t("title2"))),f.createElement(y.View,{style:{borderBottomWidth:1,borderBottomColor:"#f7f7f7",flexDirection:"row",alignItems:"center",marginTop:10,marginRight:10}},f.createElement(y.Text,{style:{color:"#333",fontSize:20,fontWeight:"800"}},s),f.createElement(y.TextInput,{style:{flex:1,paddingHorizontal:5,fontSize:20},onChangeText:this._handleChangeAmount,onBlur:this._handleChangeAmountEnd,onSubmitEditing:this._handleChangeAmountEnd,value:C.toString(a),keyboardType:"numeric"}),f.createElement(S.Button,{disabled:n<=0,style:{backgroundColor:n<=0?"#808080":"#40BA30",borderRadius:4,paddingHorizontal:15,height:25},onPress:function(){e.props.setState({amountApplied:n})}},f.createElement(y.Text,{style:{color:"#fff",fontSize:10,fontWeight:"300"},ellipsizeMode:"tail",numberOfLines:1},this.props.t("allWithdraw")))),f.createElement(y.Text,{style:{color:"#b3b3b3",fontSize:11,fontWeight:"300",marginTop:10}},this.props.t("note",{symbol:s,balance:n}))),f.createElement(y.View,{style:{padding:10,flexDirection:"row",justifyContent:"space-between",alignItems:"center"}},f.createElement(y.Text,{style:{color:"#a5a5a5",fontSize:11,fontWeight:"300"}},this.props.t("selectBankAccount")),f.createElement(y.TouchableOpacity,{onPress:function(){w.NavigationService.navigateToPage(e,b.default.screens.me.bankAccounts)}},f.createElement(y.View,{style:{flexDirection:"row",alignItems:"center"}},f.createElement(y.Text,{style:{color:"#a5a5a5",fontSize:11,fontWeight:"300",marginRight:5}},this.props.t("bankAccountManagement")),f.createElement(v.default,{name:"ios-arrow-forward",style:[k.backIcon,{paddingLeft:3}]})))),f.createElement(_.RadioGroup,{size:15,color:"#f96269",highlightColor:"#fff",onSelect:function(t,n){return e.props.setState({bankAccountId:n})},selectedIndex:r.findIndex(function(e){return e.id===i}),style:{width:"100%",overflow:"hidden"}},r&&r.map(function(e,t){var n=e.id,o=e.data.description;return f.createElement(_.RadioButton,{key:t,value:n,style:{padding:10,backgroundColor:"#fff",borderBottomWidth:1,borderBottomColor:"#f7f7f7",width:"100%",overflow:"hidden"}},f.createElement(y.View,{style:{marginTop:-1,minWidth:"min(900px, 95vw)",justifyContent:"center",alignItems:"center"}},f.createElement(y.Text,{numberOfLines:2,ellipsizeMode:"tail",style:{color:"#333",fontSize:13,fontWeight:"300",width:"100%"}},o)))})),f.createElement(S.Button,{full:!0,disabled:!(a>0),style:{marginTop:30,marginHorizontal:10,backgroundColor:a>0?"#f96269":"#808080",borderRadius:30},onPress:this._handleImmediateWithDrawal},f.createElement(y.Text,{style:{fontSize:13,color:"#fff",fontWeight:"bold"}},this.props.t("immediateWithdrawal"))),f.createElement(E.default,{isVisible:c,backdropOpacity:.4,avoidKeyboard:!0,style:{alignItems:"center",justifyContent:"center",zIndex:100},onBackButtonPress:function(){},onBackdropPress:function(){}},this.renderModal()))))}},{key:"renderModal",value:function(){var e=this,t=this.props.localState,n=t.showCodeFailureMsg,o=t.countDownStarted,r=t.countDown,i=t.verificationCode,a=y.Dimensions.get("window").width;return f.createElement(y.View,{style:{width:.9*a,paddingLeft:20,paddingRight:20,paddingTop:4,paddingBottom:20,flexDirection:"column",borderRadius:10,backgroundColor:"#fff"}},f.createElement(y.View,{style:{zIndex:1,flexDirection:"row",alignItems:"center"}},f.createElement(y.View,{style:{flex:1}}),f.createElement(S.Button,{transparent:!0,onPress:this._toggleModal},f.createElement(v.default,{name:"ios-close",style:{fontSize:46,color:"#999999",marginRight:0}}))),f.createElement(y.View,{style:{flexDirection:"column",alignItems:"center",marginTop:-30}},f.createElement(y.Text,{style:{fontSize:18,fontWeight:"bold"}},this.props.t("immediateWithdrawal"))),f.createElement(y.View,{style:{flexDirection:"column",alignItems:"center",marginTop:20}},f.createElement(y.Text,{style:{fontSize:16,fontWeight:"800"}},this.props.t("userEmail",{userEmail:this.props.user.email}))),n&&f.createElement(y.View,{style:{flexDirection:"column",alignItems:"center",marginTop:5}},f.createElement(y.Text,{style:{fontSize:15,color:"red"}},this.props.t("showCodeFailureMsg"))),f.createElement(y.View,{style:{flexDirection:"row",alignItems:"center",marginTop:20}},f.createElement(y.TextInput,{style:{flex:1,borderWidth:1,borderRadius:5,fontSize:30,borderColor:"#f7fafc",paddingVertical:1,paddingHorizontal:10,height:40,borderRightWidth:0,borderTopRightRadius:0,borderBottomRightRadius:0},onChangeText:function(t){return e.props.setState({verificationCode:t})},value:i,maxLength:6,letterSpacing:8,textAlignVertical:"center"}),f.createElement(S.Button,{disabled:o,style:{width:"45%",height:40,backgroundColor:"#f7fafc",borderTopLeftRadius:0,borderBottomLeftRadius:0,borderRadius:5,alignItems:"center",justifyContent:"center"},transparent:!0,onPress:this.props.sendVerifyCodeAsync},o?f.createElement(y.Text,{style:{color:"#A9A9A9"}},this.props.t("countDown",{countDown:r})):f.createElement(y.Text,{style:{color:"#2196f3"}},this.props.t("getCode")))),f.createElement(y.View,{style:{flexDirection:"row",justifyContent:"space-around",marginTop:40}},f.createElement(S.Button,{style:{width:"30%",height:30,backgroundColor:"#999999",borderRadius:4,alignItems:"center",justifyContent:"center",alignSelf:"flex-start"},transparent:!0,onPress:this._toggleModal},f.createElement(y.Text,{style:{color:"#fff"}},this.props.t("cancel"))),f.createElement(S.Button,{style:{width:"30%",height:30,backgroundColor:"#11cdef",borderRadius:4,alignItems:"center",justifyContent:"center",alignSelf:"flex-end"},transparent:!0,onPress:function(){(null==i?void 0:i.length)!==6?e.props.setState({showCodeFailureMsg:!0}):(e.props.setState({showCodeFailureMsg:!1}),e.props.verifyCodeAsync({verificationCode:i}))}},f.createElement(y.Text,{style:{color:"#fff"}},this.props.t("determine")))))}}]),WithdrawScreen}(g.default),k=y.StyleSheet.create({centerAlign:{justifyContent:"center",alignItems:"center"},backgroundColor:{backgroundColor:"#f7f7f7"},headerColor:{backgroundColor:"#fff"},headerTitle:{color:"#111"},flex1:{flex:1},flex3:{flex:3},alignItemsCenter:{alignItems:"center"},backIcon:{fontSize:13,color:"#a5a5a5"}}),N=(0,p.connect)(function(e){return{localState:e.screens[I.reducer.key]?e.screens[I.reducer.key]:I.INITIAL_STATE,userId:e.session.userId,user:e.session.user}},function(e){return{loadScreenViewAsync:function(){return e(I.Actions.loadScreenViewAsync())},verifyCodeAsync:function(t){return e(I.Actions.verifyCodeAsync(t))},sendVerifyCodeAsync:function(){return e(I.Actions.sendVerifyCodeAsync())},saveWithdrawalAsync:function(t){return e(I.Actions.saveWithdrawalAsync(t))},setState:function(t){return e(I.Actions.setState(t))}}})((0,A.withTranslation)(V)(W))}}]); 2//# sourceMappingURL=src_mobile_screens_me_WithdrawScreen_js.f500a4a1.chunk.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.