var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _integrations=require("@sentry/integrations");

var _config=_interopRequireDefault(require("../config"));
var _package=_interopRequireDefault(require("../../package.json"));var

Analytics=function(){
function Analytics(){(0,_classCallCheck2.default)(this,Analytics);
this.errorFixer=null;
this.knowItAll=null;
}(0,_createClass2.default)(Analytics,[{key:"initialize",value:function initialize()

{
if(_config.default.isAnalyticsEnabled){


this.errorFixer=require('@sentry/node');

this.errorFixer.init({
dsn:'https://004caee3caa04c81a10f2ba31a945362@sentry.io/1795473',
release:"rnv@"+_package.default.version,
integrations:[new _integrations.RewriteFrames({
root:'/',
iteratee:function iteratee(frame){
if(frame.filename.includes('rnv/dist/')||frame.filename.includes('rnv/src')){
if(frame.filename.includes('rnv/dist/')){
frame.filename=frame.filename.split('rnv/dist/')[1];
}else{
frame.filename=frame.filename.split('rnv/src/')[1];
}
}else if(frame.filename.includes('/node_modules/')){
frame.filename="node_modules/"+frame.filename.split('/node_modules/')[1];
}
return frame;
}})]});





this.knowItAll=this.errorFixer;
}
}},{key:"captureException",value:function captureException(

e){
if(_config.default.isAnalyticsEnabled&&this.errorFixer){
if(e instanceof Error){
this.errorFixer.captureException(e);
}else{
this.errorFixer.captureException(new Error(e));
}
}
}},{key:"captureEvent",value:function captureEvent(

e){
if(_config.default.isAnalyticsEnabled&&this.knowItAll){
this.knowItAll.captureEvent(e);
}
}},{key:"teardown",value:function teardown()

{var _this=this;
return new Promise(function(resolve){
if(_config.default.isAnalyticsEnabled&&_this.errorFixer){
var client=_this.errorFixer.getCurrentHub().getClient();
if(client){
return client.close(2000).then(resolve);
}
return resolve();
}
return resolve();
});
}}]);return Analytics;}();var _default=


new Analytics();exports.default=_default;
//# sourceMappingURL=analytics.js.map