var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.removeAccent=exports.logEventFb=exports.logEvent=exports.getMoney=exports.formatMoney=exports.formatDDMMYYY=exports.diffDays=exports.EnumTypeCar=exports.EnumTypeAsset=exports.EnumRelationshipOption2=exports.EnumRelationshipOption1=exports.EnumPurpose=exports.EnumMaritalStatus=exports.EnumGender=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _moment=_interopRequireDefault(require("moment"));var _reactNativeFbsdkNext=require("react-native-fbsdk-next");var _analytics=_interopRequireDefault(require("@react-native-firebase/analytics"));var formatMoney=exports.formatMoney=function formatMoney(x){try{x=x.toString().replace(/,/g,'').match(/^[-+]?[0-9]*?[0-9]+$/g).join('');return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g,',');}catch(e){return'';}};var getMoney=exports.getMoney=function getMoney(x){try{x=x.toString().replace(/,|\./g,'');return Number(x);}catch(e){return 0;}};var removeAccent=exports.removeAccent=function removeAccent(str){var _str;str=(_str=str)==null?void 0:_str.toLowerCase();str=str.replace(/A|Á|À|Ã|Ạ|Â|Ấ|Ầ|Ẫ|Ậ|Ă|Ắ|Ằ|Ẵ|Ặ/g,'A');str=str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g,'a');str=str.replace(/E|É|È|Ẽ|Ẹ|Ê|Ế|Ề|Ễ|Ệ/,'E');str=str.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g,'e');str=str.replace(/I|Í|Ì|Ĩ|Ị/g,'I');str=str.replace(/ì|í|ị|ỉ|ĩ/g,'i');str=str.replace(/O|Ó|Ò|Õ|Ọ|Ô|Ố|Ồ|Ỗ|Ộ|Ơ|Ớ|Ờ|Ỡ|Ợ/g,'O');str=str.replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g,'o');str=str.replace(/U|Ú|Ù|Ũ|Ụ|Ư|Ứ|Ừ|Ữ|Ự/g,'U');str=str.replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/g,'u');str=str.replace(/Y|Ý|Ỳ|Ỹ|Ỵ/g,'Y');str=str.replace(/ỳ|ý|ỵ|ỷ|ỹ/g,'y');str=str.replace(/Đ/g,'D');str=str.replace(/đ/g,'d');str=str.replace(/\u0300|\u0301|\u0303|\u0309|\u0323/g,'');str=str.replace(/\u02C6|\u0306|\u031B/g,'');return str;};var formatDDMMYYY=exports.formatDDMMYYY=function formatDDMMYYY(date){if(date){return(0,_moment.default)(date).format('DD/MM/YYYY');}return null;};var EnumGender=exports.EnumGender=[{id:0,name:'Nam'},{id:1,name:'Nữ'}];var EnumMaritalStatus=exports.EnumMaritalStatus=[{id:0,name:'Chưa kết hôn'},{id:1,name:'Đã kết hôn'}];var EnumPurpose=exports.EnumPurpose=[{id:3008,name:'Mua sắm trang thiết bị, vật dụng gia đình'}];var diffDays=exports.diffDays=function diffDays(fromDate,toDate){var oneDay=24*60*60*1000;var firstDate=new Date(fromDate);var secondDate=new Date(toDate);return Math.round(Math.abs((firstDate-secondDate)/oneDay));};var EnumTypeCar=exports.EnumTypeCar=[{id:1,name:'Xe con/xe bán tải'},{id:2,name:'Xe tải/ xe khách'}];var EnumTypeAsset=exports.EnumTypeAsset=[{id:1,name:'Cá nhân'},{id:2,name:'Doanh nghiệp'}];var EnumRelationshipOption1=exports.EnumRelationshipOption1=[{id:1,name:'Chồng/Vợ'},{id:2,name:'Mẹ'},{id:3,name:'Bố'},{id:4,name:'Anh/em trai'},{id:5,name:'Chị/em gái'},{id:13,name:'Con'}];var EnumRelationshipOption2=exports.EnumRelationshipOption2=[{id:6,name:'Đồng nghiệp'},{id:10,name:'Cô/Dì'},{id:9,name:'Chú'},{id:8,name:'Bác'},{id:15,name:'Bạn bè'}];var logEventFb=exports.logEventFb=function logEventFb(action){try{if(__DEV__)return;_reactNativeFbsdkNext.AppEventsLogger.logEvent(action);console.log("Logged action: "+action);}catch(error){console.error("Failed to log action: "+action,error);}};var logEvent=exports.logEvent=function _callee(eventName,params){var _t;return _regenerator.default.async(function(_context){while(1)switch(_context.prev=_context.next){case 0:_context.prev=0;if(!__DEV__){_context.next=1;break;}return _context.abrupt("return");case 1:_context.next=2;return _regenerator.default.awrap((0,_analytics.default)().logEvent(eventName,params));case 2:console.log("Logged event: "+eventName,params);_context.next=4;break;case 3:_context.prev=3;_t=_context["catch"](0);console.error("Failed to log event: "+eventName,_t);case 4:case"end":return _context.stop();}},null,null,[[0,3]],Promise);};
//# sourceMappingURL=index.js.map