{"version":3,"sources":["services/chat/profile-watch/main.es6.js"],"names":["create","ladyId","parseInt","timeoutId","watchExternalProfile","bus","removeListener","clearTimeout","emit","watchCurrentPlatformProfile","jquery","ajax","url","location","host","replace","xhrFields","withCredentials","type","sync","setTimeout","config","phantom","timeout"],"mappings":";;;;YAIgBA,M,GAAAA,M;;;;;;;;;;;;;;AAAT,aAASA,MAAT,CAAgBC,MAAhB,EAAwB;AAC3BA,iBAASC,SAASD,MAAT,CAAT;AACA,YAAG,CAACA,MAAJ,EAAW;AACP;AACH;;AAED,YAAIE,YAAY,IAAhB;;AAEA,iBAASC,oBAAT,GAA+B;AAC3BC,0BAAIC,cAAJ,CAAmB,iCAAnB,EAAsDF,oBAAtD;AACAG,yBAAaJ,SAAb;AACAE,0BAAIG,IAAJ,CAAS,0BAAT,EAAqCP,SAAS,IAA9C;AACH;;AAED,iBAASQ,2BAAT,GAAsC;AAClCC,6BAAOC,IAAP,CAAY;AACRC,iCAAeC,SAASC,IAAT,CAAcC,OAAd,CAAsB,sCAAtB,EAA8D,EAA9D,CAAf,uBAAkGd,MAD1F;AAERe,2BAAW;AACPC,qCAAiB;AADV,iBAFH;AAKRC,sBAAM;AALE,aAAZ;AAQH;;AAEDb,sBAAIc,IAAJ,CAAS,iCAAT,EAA4Cf,oBAA5C;;AAEAD,oBAAYiB,WAAW,YAAU;AAC7Bf,0BAAIC,cAAJ,CAAmB,iCAAnB,EAAsDF,oBAAtD;AACAK;AACAF,yBAAaJ,SAAb;AACH,SAJW,EAITkB,iBAAOC,OAAP,CAAeC,OAJN,CAAZ;AAMH","file":"services/chat/profile-watch/main.js","sourceRoot":"/source/","sourcesContent":["import jquery from 'jquery';\r\nimport bus from 'bus';\r\nimport config from 'config';\r\n\r\nexport function create(ladyId) {\r\n ladyId = parseInt(ladyId);\r\n if(!ladyId){\r\n return;\r\n }\r\n\r\n let timeoutId = null;\r\n\r\n function watchExternalProfile(){\r\n bus.removeListener('event.chat.integrated.available', watchExternalProfile);\r\n clearTimeout(timeoutId);\r\n bus.emit('command.cp.phantom.watch', ladyId + '04');\r\n }\r\n\r\n function watchCurrentPlatformProfile(){\r\n jquery.ajax({\r\n url: `//chat.${location.host.replace(/^(chat|www|support|admin|se|es|fr)\\./, '')}/profile-watch/${ladyId}`,\r\n xhrFields: {\r\n withCredentials: true\r\n },\r\n type: \"GET\"\r\n });\r\n\r\n }\r\n\r\n bus.sync('event.chat.integrated.available', watchExternalProfile);\r\n\r\n timeoutId = setTimeout(function(){\r\n bus.removeListener('event.chat.integrated.available', watchExternalProfile);\r\n watchCurrentPlatformProfile();\r\n clearTimeout(timeoutId);\r\n }, config.phantom.timeout);\r\n\r\n}"]}