Built motion from commit eae4cb9.|0.0.77
[motion.git] / server / config / integrations / index.js
1 var _0x842e=["\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"];_0x842e[0];var _=require(_0x842e[1]);var IntegrationModel=require(_0x842e[3])[_0x842e[2]];var Variable=require(_0x842e[3])[_0x842e[4]];var Zendesk=require(_0x842e[5]);function Integration(_0x5096x6){console[_0x842e[7]](_0x842e[6]);var _0x5096x7= new Zendesk();var _0x5096x8=[];var _0x5096x9=[];var _0x5096xa={};_0x5096x6[_0x842e[17]](_0x842e[8],function(_0x5096xb){if(!_0x5096xa[_0x842e[10]](_0x5096xb[_0x842e[9]])){_0x5096xa[_0x5096xb[_0x842e[9]]]=[]};if(_0x5096xb[_0x842e[10]](_0x842e[11])&&_0x5096xb[_0x842e[10]](_0x842e[12])){var _0x5096xc=_[_0x842e[15]](_0x5096x9,{"\x6E\x61\x6D\x65":_[_0x842e[14]](_[_0x842e[13]](_0x5096xb[_0x842e[11]]))});if(_0x5096xc>=0){var _0x5096xd={name:_[_0x842e[14]](_[_0x842e[13]](_0x5096xb[_0x842e[11]])),value:_0x5096xb[_0x842e[12]]};_0x5096xa[_0x5096xb[_0x842e[9]]][_0x842e[16]](_0x5096xd)}}});Variable[_0x842e[19]]()[_0x842e[18]](function(_0x5096xe){_0x5096x9=_0x5096xe;synchVariables(_0x5096x9)});IntegrationModel[_0x842e[19]]({where:{active:1}})[_0x842e[18]](function(_0x5096xf){_0x5096x8=_0x5096xf;synchIntegrations(_0x5096x8)});this[_0x842e[20]]=function(_0x5096x10,_0x5096x11,_0x5096x12){console[_0x842e[7]](_0x842e[21]);if(integrationIsActive(_0x5096x10[_0x842e[22]],_0x5096x8)){switch(_0x5096x10[_0x842e[22]]){case _0x842e[27]:_0x5096x7[_0x842e[26]](_0x5096x10[_0x842e[23]],_0x5096x10[_0x842e[24]],_0x5096x12,_0x5096x11,_[_0x842e[25]](_0x5096xa,_0x5096x11[_0x842e[9]]));break;default:console[_0x842e[7]](_0x842e[28],_0x5096x10[_0x842e[22]])}}}}function integrationIsActive(_0x5096x14,_0x5096x15){var _0x5096x16=_[_0x842e[30]](_0x5096x15,_0x842e[29]);if(_[_0x842e[31]](_0x5096x16,_0x5096x14)>=0){return true};return false}function synchIntegrations(_0x5096x15){IntegrationModel[_0x842e[37]](function(_0x5096x11){if(_0x5096x11[_0x842e[32]]){updateCollection(_0x5096x15,_0x5096x11)}else {_[_0x842e[34]](_0x5096x15,{id:_0x5096x11[_0x842e[33]]})};console[_0x842e[7]](_0x842e[35],_0x5096x15[_0x842e[36]])})}function synchVariables(_0x5096x15){Variable[_0x842e[39]](function(_0x5096x11){updateCollection(_0x5096x15,_0x5096x11);console[_0x842e[7]](_0x842e[38],_0x5096x15[_0x842e[36]])});Variable[_0x842e[37]](function(_0x5096x11){updateCollection(_0x5096x15,_0x5096x11);console[_0x842e[7]](_0x842e[40],_0x5096x15[_0x842e[36]])});Variable[_0x842e[42]](function(_0x5096x11){_[_0x842e[34]](_0x5096x15,{id:_0x5096x11[_0x842e[33]]});console[_0x842e[7]](_0x842e[41],_0x5096x15[_0x842e[36]])})}function updateCollection(_0x5096x1a,_0x5096x11){var _0x5096x1b=_[_0x842e[43]](_0x5096x1a,{id:_0x5096x11[_0x842e[33]]});var _0x5096xc=_0x5096x1a[_0x842e[31]](_0x5096x1b);if(_0x5096x1b){_[_0x842e[44]](_0x5096x1a[_0x5096xc],_0x5096x11)}else {_0x5096x1a[_0x842e[45]](_0x5096x11)}}module[_0x842e[46]]=Integration