-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient-sdk.js
1 lines (1 loc) · 4.71 KB
/
client-sdk.js
1
(function(_0x51da0c,_0x39c385){const _0x3bca16=_0x46f9,_0x1af53e=_0x51da0c();while(!![]){try{const _0x6e9afa=-parseInt(_0x3bca16(0xdc))/0x1+parseInt(_0x3bca16(0xd6))/0x2*(parseInt(_0x3bca16(0xe6))/0x3)+parseInt(_0x3bca16(0xcd))/0x4*(-parseInt(_0x3bca16(0xd2))/0x5)+-parseInt(_0x3bca16(0xe1))/0x6*(-parseInt(_0x3bca16(0xdb))/0x7)+parseInt(_0x3bca16(0xd8))/0x8+parseInt(_0x3bca16(0xf1))/0x9*(parseInt(_0x3bca16(0xf9))/0xa)+-parseInt(_0x3bca16(0xee))/0xb;if(_0x6e9afa===_0x39c385)break;else _0x1af53e['push'](_0x1af53e['shift']());}catch(_0x829b10){_0x1af53e['push'](_0x1af53e['shift']());}}}(_0x5b8e,0x20074));const _0xa6bfbc=(function(){let _0x1ba63d=!![];return function(_0x2d03a1,_0x584b82){const _0x1344ee=_0x1ba63d?function(){const _0x4fb826=_0x46f9;if(_0x584b82){const _0x34381c=_0x584b82[_0x4fb826(0xe0)](_0x2d03a1,arguments);return _0x584b82=null,_0x34381c;}}:function(){};return _0x1ba63d=![],_0x1344ee;};}()),_0x220139=_0xa6bfbc(this,function(){const _0x36971a=_0x46f9,_0xdaed52=function(){const _0x4a7c2a=_0x46f9;let _0x2a3be8;try{_0x2a3be8=Function(_0x4a7c2a(0xf5)+_0x4a7c2a(0xfb)+');')();}catch(_0xad35fe){_0x2a3be8=window;}return _0x2a3be8;},_0x5e4cc1=_0xdaed52(),_0x4706d4=_0x5e4cc1['console']=_0x5e4cc1['console']||{},_0x2cabcc=['log',_0x36971a(0xec),_0x36971a(0xde),_0x36971a(0xdd),'exception','table',_0x36971a(0xce)];for(let _0x944837=0x0;_0x944837<_0x2cabcc[_0x36971a(0xd1)];_0x944837++){const _0x4260d3=_0xa6bfbc[_0x36971a(0xfc)][_0x36971a(0xcc)][_0x36971a(0xd0)](_0xa6bfbc),_0x1e61fa=_0x2cabcc[_0x944837],_0x186867=_0x4706d4[_0x1e61fa]||_0x4260d3;_0x4260d3['__proto__']=_0xa6bfbc[_0x36971a(0xd0)](_0xa6bfbc),_0x4260d3[_0x36971a(0xd7)]=_0x186867['toString'][_0x36971a(0xd0)](_0x186867),_0x4706d4[_0x1e61fa]=_0x4260d3;}});_0x220139();function captureSankhyaEvent(_0x110094){return new Promise(async(_0x138dec,_0x22a152)=>{const _0x64be32=_0x46f9;try{if(typeof window===_0x64be32(0xd5))return _0x22a152(_0x64be32(0xeb));if(!_0x110094||!_0x110094?.['length'])return _0x22a152('API\x20key\x20missing.');if(checkIfEventAlreadyCaptured())return _0x22a152(_0x64be32(0xe2));const _0xd91573='https://sankhya-9kzfvqga.b4a.run/api/v1/event',_0x2479d2={'method':'POST','headers':{'Content-Type':_0x64be32(0xd4),'x-api-key':_0x110094},'body':JSON[_0x64be32(0xcb)]({'screenResolution':screen[_0x64be32(0xe9)]+'x'+screen['height'],'operatingSystem':getClientOperatingSystem()})},_0x3df9dd=await fetch(_0xd91573,_0x2479d2),_0x552d79=await _0x3df9dd[_0x64be32(0xfa)]();_0x552d79['success']?(updateEventCaptureStatus(),_0x138dec(_0x552d79)):_0x22a152(_0x552d79[_0x64be32(0xf8)]??_0x64be32(0xe4));}catch(_0x4be5b6){_0x22a152(_0x4be5b6['message']??_0x64be32(0xe4));}});}function getClientOperatingSystem(){const _0x5f0543=_0x46f9,_0x4eaef1=navigator['platform']??navigator[_0x5f0543(0xed)],_0x9576e=[{'name':_0x5f0543(0xe5),'value':'Android'},{'name':_0x5f0543(0xf7),'value':_0x5f0543(0xf2)},{'name':_0x5f0543(0xf3),'value':_0x5f0543(0xef)},{'name':_0x5f0543(0xdf),'value':'Linux'},{'name':_0x5f0543(0xd3),'value':_0x5f0543(0xf6)}];for(const _0x30747e of _0x9576e){if(_0x4eaef1[_0x5f0543(0xe8)](_0x30747e[_0x5f0543(0xda)]))return _0x30747e[_0x5f0543(0xd9)];}return _0x5f0543(0xf4);}function checkIfEventAlreadyCaptured(){const _0x3c0e89=_0x46f9,_0x56f030=sessionStorage['getItem'](_0x3c0e89(0xf0));return _0x56f030&&_0x56f030==='captured';}function updateEventCaptureStatus(){const _0x4df402=_0x46f9;sessionStorage[_0x4df402(0xea)](_0x4df402(0xf0),_0x4df402(0xe7));}function _0x46f9(_0x13d5a7,_0x1e1df0){const _0x39f2d8=_0x5b8e();return _0x46f9=function(_0x220139,_0xa6bfbc){_0x220139=_0x220139-0xcb;let _0x506963=_0x39f2d8[_0x220139];return _0x506963;},_0x46f9(_0x13d5a7,_0x1e1df0);}function getApiKeyFromQueryParam(){const _0x44b397=_0x46f9,_0x4817d3=document[_0x44b397(0xe3)]['src'],_0x29ef0f=new URL(_0x4817d3)[_0x44b397(0xfd)][_0x44b397(0xcf)]('key');return _0x29ef0f;}function _0x5b8e(){const _0x3e8330=['You\x20have\x20already\x20captured\x20an\x20event.','currentScript','Failed\x20to\x20capture\x20event.\x20Please\x20try\x20again\x20later.','Android','579ZrwdFy','captured','includes','width','setItem','You\x20can\x20use\x20Sankhya\x20only\x20on\x20client\x20side.','warn','userAgent','1139644QRwsey','Mac','sankhya-event-status','1773QvqOIn','iPhone','MacOS','Unknown','return\x20(function()\x20','Win','iOS','message','3420HVchpi','json','{}.constructor(\x22return\x20this\x22)(\x20)','constructor','searchParams','stringify','prototype','40NdxGDa','trace','get','bind','length','78805YeGFYQ','Windows','application/json','undefined','794ZUXLkm','toString','485376qxrnFd','name','value','203NsvXaK','66334OBBmNZ','error','info','Linux','apply','52566LqeWuP'];_0x5b8e=function(){return _0x3e8330;};return _0x5b8e();}((async()=>{try{await captureSankhyaEvent(getApiKeyFromQueryParam());}catch(_0x48a99f){}})());