Built motion from commit fa8c70b.|0.0.144
[motion.git] / server / config / integrations / index.js
index 8bac213..b8e4cf7 100644 (file)
@@ -1 +1 @@
-var _0xe4b5=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x56\x61\x72\x69\x61\x62\x6C\x65","\x2E\x2F\x7A\x65\x6E\x64\x65\x73\x6B","\x54\x72\x69\x67\x67\x65\x72\x20\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x76\x61\x72\x73\x65\x74","\x75\x6E\x69\x71\x75\x65\x69\x64","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x76\x61\x72\x69\x61\x62\x6C\x65","\x76\x61\x6C\x75\x65","\x6B\x65\x79\x73","\x68\x65\x61\x64","\x66\x69\x6E\x64\x49\x6E\x64\x65\x78","\x70\x75\x73\x68","\x6F\x6E","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x6D\x61\x6E\x61\x67\x65\x45\x76\x65\x6E\x74","\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x3A\x20\x6D\x61\x6E\x61\x67\x65\x45\x76\x65\x6E\x74","\x64\x61\x74\x61\x31","\x64\x61\x74\x61\x32","\x64\x61\x74\x61\x33","\x72\x65\x73\x75\x6C\x74","\x68\x61\x6E\x64\x6C\x65\x45\x76\x65\x6E\x74","\x7A\x65\x6E\x64\x65\x73\x6B","\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x20\x6E\x6F\x74\x20\x72\x65\x63\x6F\x67\x6E\x69\x7A\x65\x64\x3A\x20","\x73\x74\x61\x74\x65","\x6D\x61\x70","\x69\x6E\x64\x65\x78\x4F\x66","\x61\x63\x74\x69\x76\x65","\x69\x64","\x72\x65\x6D\x6F\x76\x65","\x41\x66\x74\x65\x72\x20\x75\x70\x64\x61\x74\x65\x2C\x20\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x73\x20\x61\x72\x65\x20","\x6C\x65\x6E\x67\x74\x68","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x41\x66\x74\x65\x72\x20\x63\x72\x65\x61\x74\x65\x2C\x20\x56\x61\x72\x69\x61\x62\x6C\x65\x73\x20\x61\x72\x65\x20","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x41\x66\x74\x65\x72\x20\x75\x70\x64\x61\x74\x65\x2C\x20\x56\x61\x72\x69\x61\x62\x6C\x65\x73\x20\x61\x72\x65\x20","\x41\x66\x74\x65\x72\x20\x64\x65\x73\x74\x72\x6F\x79\x2C\x20\x56\x61\x72\x69\x61\x62\x6C\x65\x73\x20\x61\x72\x65\x20","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x66\x69\x6E\x64","\x6D\x65\x72\x67\x65","\x75\x6E\x73\x68\x69\x66\x74","\x65\x78\x70\x6F\x72\x74\x73"];_0xe4b5[0];var _=require(_0xe4b5[1]);var IntegrationModel=require(_0xe4b5[3])[_0xe4b5[2]];var Variable=require(_0xe4b5[3])[_0xe4b5[4]];var Zendesk=require(_0xe4b5[5]);function Integration(_0x462dx6){console[_0xe4b5[7]](_0xe4b5[6]);var _0x462dx7= new Zendesk();var _0x462dx8=[];var _0x462dx9=[];var _0x462dxa={};_0x462dx6[_0xe4b5[17]](_0xe4b5[8],function(_0x462dxb){if(!_0x462dxa[_0xe4b5[10]](_0x462dxb[_0xe4b5[9]])){_0x462dxa[_0x462dxb[_0xe4b5[9]]]=[]};if(_0x462dxb[_0xe4b5[10]](_0xe4b5[11])&&_0x462dxb[_0xe4b5[10]](_0xe4b5[12])){var _0x462dxc=_[_0xe4b5[15]](_0x462dx9,{"\x6E\x61\x6D\x65":_[_0xe4b5[14]](_[_0xe4b5[13]](_0x462dxb[_0xe4b5[11]]))});if(_0x462dxc>=0){var _0x462dxd={name:_[_0xe4b5[14]](_[_0xe4b5[13]](_0x462dxb[_0xe4b5[11]])),value:_0x462dxb[_0xe4b5[12]]};_0x462dxa[_0x462dxb[_0xe4b5[9]]][_0xe4b5[16]](_0x462dxd)}}});Variable[_0xe4b5[19]]()[_0xe4b5[18]](function(_0x462dxe){_0x462dx9=_0x462dxe;synchVariables(_0x462dx9)});IntegrationModel[_0xe4b5[19]]({where:{active:1}})[_0xe4b5[18]](function(_0x462dxf){_0x462dx8=_0x462dxf;synchIntegrations(_0x462dx8)});this[_0xe4b5[20]]=function(_0x462dx10,_0x462dx11,_0x462dx12){console[_0xe4b5[7]](_0xe4b5[21]);if(integrationIsActive(_0x462dx10[_0xe4b5[22]],_0x462dx8)){switch(_0x462dx10[_0xe4b5[22]]){case _0xe4b5[27]:_0x462dx7[_0xe4b5[26]](_0x462dx10[_0xe4b5[23]],_0x462dx10[_0xe4b5[24]],_0x462dx12,_0x462dx11,_[_0xe4b5[25]](_0x462dxa,_0x462dx11[_0xe4b5[9]]));break;default:console[_0xe4b5[7]](_0xe4b5[28],_0x462dx10[_0xe4b5[22]])}}}}function integrationIsActive(_0x462dx14,_0x462dx15){var _0x462dx16=_[_0xe4b5[30]](_0x462dx15,_0xe4b5[29]);if(_[_0xe4b5[31]](_0x462dx16,_0x462dx14)>=0){return true};return false}function synchIntegrations(_0x462dx15){IntegrationModel[_0xe4b5[37]](function(_0x462dx11){if(_0x462dx11[_0xe4b5[32]]){updateCollection(_0x462dx15,_0x462dx11)}else {_[_0xe4b5[34]](_0x462dx15,{id:_0x462dx11[_0xe4b5[33]]})};console[_0xe4b5[7]](_0xe4b5[35],_0x462dx15[_0xe4b5[36]])})}function synchVariables(_0x462dx15){Variable[_0xe4b5[39]](function(_0x462dx11){updateCollection(_0x462dx15,_0x462dx11);console[_0xe4b5[7]](_0xe4b5[38],_0x462dx15[_0xe4b5[36]])});Variable[_0xe4b5[37]](function(_0x462dx11){updateCollection(_0x462dx15,_0x462dx11);console[_0xe4b5[7]](_0xe4b5[40],_0x462dx15[_0xe4b5[36]])});Variable[_0xe4b5[42]](function(_0x462dx11){_[_0xe4b5[34]](_0x462dx15,{id:_0x462dx11[_0xe4b5[33]]});console[_0xe4b5[7]](_0xe4b5[41],_0x462dx15[_0xe4b5[36]])})}function updateCollection(_0x462dx1a,_0x462dx11){var _0x462dx1b=_[_0xe4b5[43]](_0x462dx1a,{id:_0x462dx11[_0xe4b5[33]]});var _0x462dxc=_0x462dx1a[_0xe4b5[31]](_0x462dx1b);if(_0x462dx1b){_[_0xe4b5[44]](_0x462dx1a[_0x462dxc],_0x462dx11)}else {_0x462dx1a[_0xe4b5[45]](_0x462dx11)}}module[_0xe4b5[46]]=Integration
\ No newline at end of file
+var _0x7683=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x56\x61\x72\x69\x61\x62\x6C\x65","\x2E\x2F\x7A\x65\x6E\x64\x65\x73\x6B","\x2E\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65","\x2E\x2F\x6D\x6F\x74\x69\x6F\x6E\x62\x61\x72","\x54\x72\x69\x67\x67\x65\x72\x20\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x6D\x61\x6E\x61\x67\x65\x45\x76\x65\x6E\x74","\x64\x61\x74\x61\x31","\x64\x61\x74\x61\x32","\x64\x61\x74\x61\x33","\x68\x61\x6E\x64\x6C\x65\x45\x76\x65\x6E\x74","\x7A\x65\x6E\x64\x65\x73\x6B","\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65","\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x20\x6E\x6F\x74\x20\x72\x65\x63\x6F\x67\x6E\x69\x7A\x65\x64\x3A\x20","\x61\x63\x74\x69\x6F\x6E","\x6D\x6F\x74\x69\x6F\x6E\x62\x61\x72","\x73\x74\x61\x74\x65","\x6D\x61\x70","\x69\x6E\x64\x65\x78\x4F\x66","\x61\x63\x74\x69\x76\x65","\x69\x64","\x72\x65\x6D\x6F\x76\x65","\x41\x66\x74\x65\x72\x20\x75\x70\x64\x61\x74\x65\x2C\x20\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x73\x20\x61\x72\x65\x20","\x6C\x65\x6E\x67\x74\x68","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x66\x69\x6E\x64","\x6D\x65\x72\x67\x65","\x75\x6E\x73\x68\x69\x66\x74","\x65\x78\x70\x6F\x72\x74\x73"];_0x7683[0];var _=require(_0x7683[1]);var IntegrationModel=require(_0x7683[3])[_0x7683[2]];var Variable=require(_0x7683[3])[_0x7683[4]];var Zendesk=require(_0x7683[5]);var Salesforce=require(_0x7683[6]);var Motionbar=require(_0x7683[7]);var MAX_CALLS=200;function Integration(){console[_0x7683[9]](_0x7683[8]);var _0xf86bx9= new Zendesk();var _0xf86bxa= new Salesforce();var _0xf86bxb= new Motionbar();var _0xf86bxc=[];IntegrationModel[_0x7683[11]]({where:{active:1}})[_0x7683[10]](function(_0xf86bxd){_0xf86bxc= _0xf86bxd;synchIntegrations(_0xf86bxc)});this[_0x7683[12]]= function(_0xf86bxe,_0xf86bxf,_0xf86bx10,_0xf86bx11,_0xf86bx12){if(integrationIsActive(_0xf86bxe[_0x7683[13]],_0xf86bxc)){switch(_0xf86bxe[_0x7683[13]]){case _0x7683[17]:_0xf86bx9[_0x7683[16]](_0xf86bxe[_0x7683[14]],_0xf86bxe[_0x7683[15]],_0xf86bx10,_0xf86bx11,_0xf86bxf,_0xf86bx12);break;case _0x7683[18]:_0xf86bxa[_0x7683[16]](_0xf86bxe[_0x7683[14]],_0xf86bxe[_0x7683[15]],_0xf86bx10,_0xf86bx11,_0xf86bxf,_0xf86bx12);break;default:console[_0x7683[9]](_0x7683[19],_0xf86bxe[_0x7683[13]])}};if(_0xf86bxe[_0x7683[20]]=== _0x7683[21]){_0xf86bxb[_0x7683[16]](_0xf86bxe,_0xf86bx10,_0xf86bxf,_0xf86bx12)}}}function integrationIsActive(_0xf86bx14,_0xf86bx15){var _0xf86bx16=_[_0x7683[23]](_0xf86bx15,_0x7683[22]);if(_[_0x7683[24]](_0xf86bx16,_0xf86bx14)>= 0){return true};return false}function synchIntegrations(_0xf86bx15){IntegrationModel[_0x7683[30]](function(_0xf86bxf){if(_0xf86bxf[_0x7683[25]]){updateCollection(_0xf86bx15,_0xf86bxf)}else {_[_0x7683[27]](_0xf86bx15,{id:_0xf86bxf[_0x7683[26]]})};console[_0x7683[9]](_0x7683[28],_0xf86bx15[_0x7683[29]])})}function updateCollection(_0xf86bx19,_0xf86bxf){var _0xf86bx1a=_[_0x7683[31]](_0xf86bx19,{id:_0xf86bxf[_0x7683[26]]});var _0xf86bx1b=_0xf86bx19[_0x7683[24]](_0xf86bx1a);if(_0xf86bx1a){_[_0x7683[32]](_0xf86bx19[_0xf86bx1b],_0xf86bxf)}else {_0xf86bx19[_0x7683[33]](_0xf86bxf)}}module[_0x7683[34]]= Integration
\ No newline at end of file