Built motion from commit a81f050.|0.0.71
[motion.git] / server / config / integrations / index.js
1 var _0x9f83=["\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"];_0x9f83[0];var _=require(_0x9f83[1]);var IntegrationModel=require(_0x9f83[3])[_0x9f83[2]];var Variable=require(_0x9f83[3])[_0x9f83[4]];var Zendesk=require(_0x9f83[5]);function Integration(_0x13f0x6){console[_0x9f83[7]](_0x9f83[6]);var _0x13f0x7= new Zendesk();var _0x13f0x8=[];var _0x13f0x9=[];var _0x13f0xa={};_0x13f0x6[_0x9f83[17]](_0x9f83[8],function(_0x13f0xb){if(!_0x13f0xa[_0x9f83[10]](_0x13f0xb[_0x9f83[9]])){_0x13f0xa[_0x13f0xb[_0x9f83[9]]]=[]};if(_0x13f0xb[_0x9f83[10]](_0x9f83[11])&&_0x13f0xb[_0x9f83[10]](_0x9f83[12])){var _0x13f0xc=_[_0x9f83[15]](_0x13f0x9,{"\x6E\x61\x6D\x65":_[_0x9f83[14]](_[_0x9f83[13]](_0x13f0xb[_0x9f83[11]]))});if(_0x13f0xc>=0){var _0x13f0xd={name:_[_0x9f83[14]](_[_0x9f83[13]](_0x13f0xb[_0x9f83[11]])),value:_0x13f0xb[_0x9f83[12]]};_0x13f0xa[_0x13f0xb[_0x9f83[9]]][_0x9f83[16]](_0x13f0xd)}}});Variable[_0x9f83[19]]()[_0x9f83[18]](function(_0x13f0xe){_0x13f0x9=_0x13f0xe;synchVariables(_0x13f0x9)});IntegrationModel[_0x9f83[19]]({where:{active:1}})[_0x9f83[18]](function(_0x13f0xf){_0x13f0x8=_0x13f0xf;synchIntegrations(_0x13f0x8)});this[_0x9f83[20]]=function(_0x13f0x10,_0x13f0x11,_0x13f0x12){console[_0x9f83[7]](_0x9f83[21]);if(integrationIsActive(_0x13f0x10[_0x9f83[22]],_0x13f0x8)){switch(_0x13f0x10[_0x9f83[22]]){case _0x9f83[27]:_0x13f0x7[_0x9f83[26]](_0x13f0x10[_0x9f83[23]],_0x13f0x10[_0x9f83[24]],_0x13f0x12,_0x13f0x11,_[_0x9f83[25]](_0x13f0xa,_0x13f0x11[_0x9f83[9]]));break;default:console[_0x9f83[7]](_0x9f83[28],_0x13f0x10[_0x9f83[22]])}}}}function integrationIsActive(_0x13f0x14,_0x13f0x15){var _0x13f0x16=_[_0x9f83[30]](_0x13f0x15,_0x9f83[29]);if(_[_0x9f83[31]](_0x13f0x16,_0x13f0x14)>=0){return true};return false}function synchIntegrations(_0x13f0x15){IntegrationModel[_0x9f83[37]](function(_0x13f0x11){if(_0x13f0x11[_0x9f83[32]]){updateCollection(_0x13f0x15,_0x13f0x11)}else {_[_0x9f83[34]](_0x13f0x15,{id:_0x13f0x11[_0x9f83[33]]})};console[_0x9f83[7]](_0x9f83[35],_0x13f0x15[_0x9f83[36]])})}function synchVariables(_0x13f0x15){Variable[_0x9f83[39]](function(_0x13f0x11){updateCollection(_0x13f0x15,_0x13f0x11);console[_0x9f83[7]](_0x9f83[38],_0x13f0x15[_0x9f83[36]])});Variable[_0x9f83[37]](function(_0x13f0x11){updateCollection(_0x13f0x15,_0x13f0x11);console[_0x9f83[7]](_0x9f83[40],_0x13f0x15[_0x9f83[36]])});Variable[_0x9f83[42]](function(_0x13f0x11){_[_0x9f83[34]](_0x13f0x15,{id:_0x13f0x11[_0x9f83[33]]});console[_0x9f83[7]](_0x9f83[41],_0x13f0x15[_0x9f83[36]])})}function updateCollection(_0x13f0x1a,_0x13f0x11){var _0x13f0x1b=_[_0x9f83[43]](_0x13f0x1a,{id:_0x13f0x11[_0x9f83[33]]});var _0x13f0xc=_0x13f0x1a[_0x9f83[31]](_0x13f0x1b);if(_0x13f0x1b){_[_0x9f83[44]](_0x13f0x1a[_0x13f0xc],_0x13f0x11)}else {_0x13f0x1a[_0x9f83[45]](_0x13f0x11)}}module[_0x9f83[46]]=Integration