Built motion from commit c56b56e.|0.0.125
[motion.git] / server / config / integrations / index.js
index db46110..c841a68 100644 (file)
@@ -1 +1 @@
-var _0xf96f=["\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"];_0xf96f[0];var _=require(_0xf96f[1]);var IntegrationModel=require(_0xf96f[3])[_0xf96f[2]];var Variable=require(_0xf96f[3])[_0xf96f[4]];var Zendesk=require(_0xf96f[5]);function Integration(_0x2c43x6){console[_0xf96f[7]](_0xf96f[6]);var _0x2c43x7= new Zendesk();var _0x2c43x8=[];var _0x2c43x9=[];var _0x2c43xa={};_0x2c43x6[_0xf96f[17]](_0xf96f[8],function(_0x2c43xb){if(!_0x2c43xa[_0xf96f[10]](_0x2c43xb[_0xf96f[9]])){_0x2c43xa[_0x2c43xb[_0xf96f[9]]]=[]};if(_0x2c43xb[_0xf96f[10]](_0xf96f[11])&&_0x2c43xb[_0xf96f[10]](_0xf96f[12])){var _0x2c43xc=_[_0xf96f[15]](_0x2c43x9,{"\x6E\x61\x6D\x65":_[_0xf96f[14]](_[_0xf96f[13]](_0x2c43xb[_0xf96f[11]]))});if(_0x2c43xc>=0){var _0x2c43xd={name:_[_0xf96f[14]](_[_0xf96f[13]](_0x2c43xb[_0xf96f[11]])),value:_0x2c43xb[_0xf96f[12]]};_0x2c43xa[_0x2c43xb[_0xf96f[9]]][_0xf96f[16]](_0x2c43xd)}}});Variable[_0xf96f[19]]()[_0xf96f[18]](function(_0x2c43xe){_0x2c43x9=_0x2c43xe;synchVariables(_0x2c43x9)});IntegrationModel[_0xf96f[19]]({where:{active:1}})[_0xf96f[18]](function(_0x2c43xf){_0x2c43x8=_0x2c43xf;synchIntegrations(_0x2c43x8)});this[_0xf96f[20]]=function(_0x2c43x10,_0x2c43x11,_0x2c43x12){console[_0xf96f[7]](_0xf96f[21]);if(integrationIsActive(_0x2c43x10[_0xf96f[22]],_0x2c43x8)){switch(_0x2c43x10[_0xf96f[22]]){case _0xf96f[27]:_0x2c43x7[_0xf96f[26]](_0x2c43x10[_0xf96f[23]],_0x2c43x10[_0xf96f[24]],_0x2c43x12,_0x2c43x11,_[_0xf96f[25]](_0x2c43xa,_0x2c43x11[_0xf96f[9]]));break;default:console[_0xf96f[7]](_0xf96f[28],_0x2c43x10[_0xf96f[22]])}}}}function integrationIsActive(_0x2c43x14,_0x2c43x15){var _0x2c43x16=_[_0xf96f[30]](_0x2c43x15,_0xf96f[29]);if(_[_0xf96f[31]](_0x2c43x16,_0x2c43x14)>=0){return true};return false}function synchIntegrations(_0x2c43x15){IntegrationModel[_0xf96f[37]](function(_0x2c43x11){if(_0x2c43x11[_0xf96f[32]]){updateCollection(_0x2c43x15,_0x2c43x11)}else {_[_0xf96f[34]](_0x2c43x15,{id:_0x2c43x11[_0xf96f[33]]})};console[_0xf96f[7]](_0xf96f[35],_0x2c43x15[_0xf96f[36]])})}function synchVariables(_0x2c43x15){Variable[_0xf96f[39]](function(_0x2c43x11){updateCollection(_0x2c43x15,_0x2c43x11);console[_0xf96f[7]](_0xf96f[38],_0x2c43x15[_0xf96f[36]])});Variable[_0xf96f[37]](function(_0x2c43x11){updateCollection(_0x2c43x15,_0x2c43x11);console[_0xf96f[7]](_0xf96f[40],_0x2c43x15[_0xf96f[36]])});Variable[_0xf96f[42]](function(_0x2c43x11){_[_0xf96f[34]](_0x2c43x15,{id:_0x2c43x11[_0xf96f[33]]});console[_0xf96f[7]](_0xf96f[41],_0x2c43x15[_0xf96f[36]])})}function updateCollection(_0x2c43x1a,_0x2c43x11){var _0x2c43x1b=_[_0xf96f[43]](_0x2c43x1a,{id:_0x2c43x11[_0xf96f[33]]});var _0x2c43xc=_0x2c43x1a[_0xf96f[31]](_0x2c43x1b);if(_0x2c43x1b){_[_0xf96f[44]](_0x2c43x1a[_0x2c43xc],_0x2c43x11)}else {_0x2c43x1a[_0xf96f[45]](_0x2c43x11)}}module[_0xf96f[46]]=Integration
\ No newline at end of file
+var _0x991f=["\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","\x76\x61\x72\x73\x65\x74","\x76\x61\x72\x69\x61\x62\x6C\x65","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x76\x61\x6C\x75\x65","\x6E\x61\x6D\x65","\x6B\x65\x79\x73","\x68\x65\x61\x64","\x74\x6F\x4C\x6F\x77\x65\x72","\x66\x69\x6E\x64","\x75\x6E\x69\x71\x75\x65\x69\x64","\x70\x75\x73\x68","\x76\x61\x72\x69\x61\x62\x6C\x65\x73","\x6C\x65\x6E\x67\x74\x68","\x73\x68\x69\x66\x74","\x6F\x6E","\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","\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","\x6D\x65\x72\x67\x65","\x75\x6E\x73\x68\x69\x66\x74","\x65\x78\x70\x6F\x72\x74\x73"];_0x991f[0];var _=require(_0x991f[1]);var IntegrationModel=require(_0x991f[3])[_0x991f[2]];var Variable=require(_0x991f[3])[_0x991f[4]];var Zendesk=require(_0x991f[5]);var Salesforce=require(_0x991f[6]);var Motionbar=require(_0x991f[7]);var MAX_CALLS=200;function Integration(_0xa0bfx9){console[_0x991f[9]](_0x991f[8]);var _0xa0bfxa= new Zendesk();var _0xa0bfxb= new Salesforce();var _0xa0bfxc= new Motionbar();var _0xa0bfxd=[];var _0xa0bfxe=[];var _0xa0bfxf=[];_0xa0bfx9[_0x991f[24]](_0x991f[10],function(_0xa0bfx10){if(_0xa0bfx10[_0x991f[12]](_0x991f[11])&& _0xa0bfx10[_0x991f[12]](_0x991f[13])){var _0xa0bfx11=_[_0x991f[18]](_0xa0bfxe,function(_0xa0bfx12){return (_0xa0bfx12[_0x991f[14]]=== _[_0x991f[16]](_[_0x991f[15]](_0xa0bfx10[_0x991f[11]])))|| (_[_0x991f[17]](_0xa0bfx12[_0x991f[14]])=== _[_0x991f[16]](_[_0x991f[15]](_0xa0bfx10[_0x991f[11]])))});if(_0xa0bfx11){var _0xa0bfx13=_[_0x991f[18]](_0xa0bfxf,function(_0xa0bfx12){return _0xa0bfx12[_0x991f[19]]=== _0xa0bfx10[_0x991f[19]]});if(_0xa0bfx13){_0xa0bfx13[_0x991f[21]][_0x991f[20]]({name:_0xa0bfx11[_0x991f[14]],value:_0xa0bfx10[_0x991f[13]]})}else {if(_0xa0bfxf[_0x991f[22]]>= MAX_CALLS){_0xa0bfxf[_0x991f[23]]()};var _0xa0bfx14={uniqueid:_0xa0bfx10[_0x991f[19]],variables:[{name:_0xa0bfx11[_0x991f[14]],value:_0xa0bfx10[_0x991f[13]]}]};_0xa0bfxf[_0x991f[20]](_0xa0bfx14)}}}});Variable[_0x991f[26]]()[_0x991f[25]](function(_0xa0bfx15){_0xa0bfxe= _0xa0bfx15;synchVariables(_0xa0bfxe)});IntegrationModel[_0x991f[26]]({where:{active:1}})[_0x991f[25]](function(_0xa0bfx16){_0xa0bfxd= _0xa0bfx16;synchIntegrations(_0xa0bfxd)});this[_0x991f[27]]= function(_0xa0bfx17,_0xa0bfx18,_0xa0bfx19,_0xa0bfx1a){var _0xa0bfx13=_[_0x991f[18]](_0xa0bfxf,function(_0xa0bfx12){return _0xa0bfx12[_0x991f[19]]=== _0xa0bfx18[_0x991f[19]]});var _0xa0bfx15=_0xa0bfx13?_0xa0bfx13[_0x991f[21]]:[];if(integrationIsActive(_0xa0bfx17[_0x991f[28]],_0xa0bfxd)){switch(_0xa0bfx17[_0x991f[28]]){case _0x991f[32]:_0xa0bfxa[_0x991f[31]](_0xa0bfx17[_0x991f[29]],_0xa0bfx17[_0x991f[30]],_0xa0bfx19,_0xa0bfx1a,_0xa0bfx18,_0xa0bfx15);break;case _0x991f[33]:_0xa0bfxb[_0x991f[31]](_0xa0bfx17[_0x991f[29]],_0xa0bfx17[_0x991f[30]],_0xa0bfx19,_0xa0bfx1a,_0xa0bfx18,_0xa0bfx15);break;default:console[_0x991f[9]](_0x991f[34],_0xa0bfx17[_0x991f[28]])}};if(_0xa0bfx17[_0x991f[35]]=== _0x991f[36]){_0xa0bfxc[_0x991f[31]](_0xa0bfx17,_0xa0bfx19,_0xa0bfx18,_0xa0bfx15)}}}function integrationIsActive(_0xa0bfx1c,_0xa0bfx1d){var _0xa0bfx1e=_[_0x991f[38]](_0xa0bfx1d,_0x991f[37]);if(_[_0x991f[39]](_0xa0bfx1e,_0xa0bfx1c)>= 0){return true};return false}function synchIntegrations(_0xa0bfx1d){IntegrationModel[_0x991f[44]](function(_0xa0bfx18){if(_0xa0bfx18[_0x991f[40]]){updateCollection(_0xa0bfx1d,_0xa0bfx18)}else {_[_0x991f[42]](_0xa0bfx1d,{id:_0xa0bfx18[_0x991f[41]]})};console[_0x991f[9]](_0x991f[43],_0xa0bfx1d[_0x991f[22]])})}function synchVariables(_0xa0bfx1d){Variable[_0x991f[46]](function(_0xa0bfx18){updateCollection(_0xa0bfx1d,_0xa0bfx18);console[_0x991f[9]](_0x991f[45],_0xa0bfx1d[_0x991f[22]])});Variable[_0x991f[44]](function(_0xa0bfx18){updateCollection(_0xa0bfx1d,_0xa0bfx18);console[_0x991f[9]](_0x991f[47],_0xa0bfx1d[_0x991f[22]])});Variable[_0x991f[49]](function(_0xa0bfx18){_[_0x991f[42]](_0xa0bfx1d,{id:_0xa0bfx18[_0x991f[41]]});console[_0x991f[9]](_0x991f[48],_0xa0bfx1d[_0x991f[22]])})}function updateCollection(_0xa0bfx22,_0xa0bfx18){var _0xa0bfx23=_[_0x991f[18]](_0xa0bfx22,{id:_0xa0bfx18[_0x991f[41]]});var _0xa0bfx24=_0xa0bfx22[_0x991f[39]](_0xa0bfx23);if(_0xa0bfx23){_[_0x991f[50]](_0xa0bfx22[_0xa0bfx24],_0xa0bfx18)}else {_0xa0bfx22[_0x991f[51]](_0xa0bfx18)}}module[_0x991f[52]]= Integration
\ No newline at end of file