Built motion from commit 36b8e3b.|0.0.111
[motion.git] / server / config / integrations / index.js
index 8f17da8..8a40ecb 100644 (file)
@@ -1 +1 @@
-var _0x93f7=["\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"];_0x93f7[0];var _=require(_0x93f7[1]);var IntegrationModel=require(_0x93f7[3])[_0x93f7[2]];var Variable=require(_0x93f7[3])[_0x93f7[4]];var Zendesk=require(_0x93f7[5]);var Salesforce=require(_0x93f7[6]);var Motionbar=require(_0x93f7[7]);var MAX_CALLS=200;function Integration(_0x9e42x9){console[_0x93f7[9]](_0x93f7[8]);var _0x9e42xa= new Zendesk();var _0x9e42xb= new Salesforce();var _0x9e42xc= new Motionbar();var _0x9e42xd=[];var _0x9e42xe=[];var _0x9e42xf=[];_0x9e42x9[_0x93f7[24]](_0x93f7[10],function(_0x9e42x10){if(_0x9e42x10[_0x93f7[12]](_0x93f7[11])&&_0x9e42x10[_0x93f7[12]](_0x93f7[13])){var _0x9e42x11=_[_0x93f7[18]](_0x9e42xe,function(_0x9e42x12){return (_0x9e42x12[_0x93f7[14]]===_[_0x93f7[16]](_[_0x93f7[15]](_0x9e42x10[_0x93f7[11]])))||(_[_0x93f7[17]](_0x9e42x12[_0x93f7[14]])===_[_0x93f7[16]](_[_0x93f7[15]](_0x9e42x10[_0x93f7[11]])))});if(_0x9e42x11){var _0x9e42x13=_[_0x93f7[18]](_0x9e42xf,function(_0x9e42x12){return _0x9e42x12[_0x93f7[19]]===_0x9e42x10[_0x93f7[19]]});if(_0x9e42x13){_0x9e42x13[_0x93f7[21]][_0x93f7[20]]({name:_0x9e42x11[_0x93f7[14]],value:_0x9e42x10[_0x93f7[13]]})}else {if(_0x9e42xf[_0x93f7[22]]>=MAX_CALLS){_0x9e42xf[_0x93f7[23]]()};var _0x9e42x14={uniqueid:_0x9e42x10[_0x93f7[19]],variables:[{name:_0x9e42x11[_0x93f7[14]],value:_0x9e42x10[_0x93f7[13]]}]};_0x9e42xf[_0x93f7[20]](_0x9e42x14)}}}});Variable[_0x93f7[26]]()[_0x93f7[25]](function(_0x9e42x15){_0x9e42xe=_0x9e42x15;synchVariables(_0x9e42xe)});IntegrationModel[_0x93f7[26]]({where:{active:1}})[_0x93f7[25]](function(_0x9e42x16){_0x9e42xd=_0x9e42x16;synchIntegrations(_0x9e42xd)});this[_0x93f7[27]]=function(_0x9e42x17,_0x9e42x18,_0x9e42x19){var _0x9e42x13=_[_0x93f7[18]](_0x9e42xf,function(_0x9e42x12){return _0x9e42x12[_0x93f7[19]]===_0x9e42x18[_0x93f7[19]]});var _0x9e42x15=_0x9e42x13?_0x9e42x13[_0x93f7[21]]:[];if(integrationIsActive(_0x9e42x17[_0x93f7[28]],_0x9e42xd)){switch(_0x9e42x17[_0x93f7[28]]){case _0x93f7[32]:_0x9e42xa[_0x93f7[31]](_0x9e42x17[_0x93f7[29]],_0x9e42x17[_0x93f7[30]],_0x9e42x19,_0x9e42x18,_0x9e42x15,_0x9e42x18[_0x93f7[19]]);break;case _0x93f7[33]:_0x9e42xb[_0x93f7[31]](_0x9e42x17[_0x93f7[29]],_0x9e42x17[_0x93f7[30]],_0x9e42x19,_0x9e42x18,_0x9e42x15,_0x9e42x18[_0x93f7[19]]);break;default:console[_0x93f7[9]](_0x93f7[34],_0x9e42x17[_0x93f7[28]])}};if(_0x9e42x17[_0x93f7[35]]===_0x93f7[36]){_0x9e42xc[_0x93f7[31]](_0x9e42x17,_0x9e42x19,_0x9e42x18,_0x9e42x15,_0x9e42x18[_0x93f7[19]])}}}function integrationIsActive(_0x9e42x1b,_0x9e42x1c){var _0x9e42x1d=_[_0x93f7[38]](_0x9e42x1c,_0x93f7[37]);if(_[_0x93f7[39]](_0x9e42x1d,_0x9e42x1b)>=0){return true};return false}function synchIntegrations(_0x9e42x1c){IntegrationModel[_0x93f7[44]](function(_0x9e42x18){if(_0x9e42x18[_0x93f7[40]]){updateCollection(_0x9e42x1c,_0x9e42x18)}else {_[_0x93f7[42]](_0x9e42x1c,{id:_0x9e42x18[_0x93f7[41]]})};console[_0x93f7[9]](_0x93f7[43],_0x9e42x1c[_0x93f7[22]])})}function synchVariables(_0x9e42x1c){Variable[_0x93f7[46]](function(_0x9e42x18){updateCollection(_0x9e42x1c,_0x9e42x18);console[_0x93f7[9]](_0x93f7[45],_0x9e42x1c[_0x93f7[22]])});Variable[_0x93f7[44]](function(_0x9e42x18){updateCollection(_0x9e42x1c,_0x9e42x18);console[_0x93f7[9]](_0x93f7[47],_0x9e42x1c[_0x93f7[22]])});Variable[_0x93f7[49]](function(_0x9e42x18){_[_0x93f7[42]](_0x9e42x1c,{id:_0x9e42x18[_0x93f7[41]]});console[_0x93f7[9]](_0x93f7[48],_0x9e42x1c[_0x93f7[22]])})}function updateCollection(_0x9e42x21,_0x9e42x18){var _0x9e42x22=_[_0x93f7[18]](_0x9e42x21,{id:_0x9e42x18[_0x93f7[41]]});var _0x9e42x23=_0x9e42x21[_0x93f7[39]](_0x9e42x22);if(_0x9e42x22){_[_0x93f7[50]](_0x9e42x21[_0x9e42x23],_0x9e42x18)}else {_0x9e42x21[_0x93f7[51]](_0x9e42x18)}}module[_0x93f7[52]]=Integration
\ No newline at end of file
+var _0x2c58=["\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"];_0x2c58[0];var _=require(_0x2c58[1]);var IntegrationModel=require(_0x2c58[3])[_0x2c58[2]];var Variable=require(_0x2c58[3])[_0x2c58[4]];var Zendesk=require(_0x2c58[5]);var Salesforce=require(_0x2c58[6]);var Motionbar=require(_0x2c58[7]);var MAX_CALLS=200;function Integration(_0x25cax9){console[_0x2c58[9]](_0x2c58[8]);var _0x25caxa= new Zendesk();var _0x25caxb= new Salesforce();var _0x25caxc= new Motionbar();var _0x25caxd=[];var _0x25caxe=[];var _0x25caxf=[];_0x25cax9[_0x2c58[24]](_0x2c58[10],function(_0x25cax10){if(_0x25cax10[_0x2c58[12]](_0x2c58[11])&&_0x25cax10[_0x2c58[12]](_0x2c58[13])){var _0x25cax11=_[_0x2c58[18]](_0x25caxe,function(_0x25cax12){return (_0x25cax12[_0x2c58[14]]===_[_0x2c58[16]](_[_0x2c58[15]](_0x25cax10[_0x2c58[11]])))||(_[_0x2c58[17]](_0x25cax12[_0x2c58[14]])===_[_0x2c58[16]](_[_0x2c58[15]](_0x25cax10[_0x2c58[11]])))});if(_0x25cax11){var _0x25cax13=_[_0x2c58[18]](_0x25caxf,function(_0x25cax12){return _0x25cax12[_0x2c58[19]]===_0x25cax10[_0x2c58[19]]});if(_0x25cax13){_0x25cax13[_0x2c58[21]][_0x2c58[20]]({name:_0x25cax11[_0x2c58[14]],value:_0x25cax10[_0x2c58[13]]})}else {if(_0x25caxf[_0x2c58[22]]>=MAX_CALLS){_0x25caxf[_0x2c58[23]]()};var _0x25cax14={uniqueid:_0x25cax10[_0x2c58[19]],variables:[{name:_0x25cax11[_0x2c58[14]],value:_0x25cax10[_0x2c58[13]]}]};_0x25caxf[_0x2c58[20]](_0x25cax14)}}}});Variable[_0x2c58[26]]()[_0x2c58[25]](function(_0x25cax15){_0x25caxe=_0x25cax15;synchVariables(_0x25caxe)});IntegrationModel[_0x2c58[26]]({where:{active:1}})[_0x2c58[25]](function(_0x25cax16){_0x25caxd=_0x25cax16;synchIntegrations(_0x25caxd)});this[_0x2c58[27]]=function(_0x25cax17,_0x25cax18,_0x25cax19){var _0x25cax13=_[_0x2c58[18]](_0x25caxf,function(_0x25cax12){return _0x25cax12[_0x2c58[19]]===_0x25cax18[_0x2c58[19]]});var _0x25cax15=_0x25cax13?_0x25cax13[_0x2c58[21]]:[];if(integrationIsActive(_0x25cax17[_0x2c58[28]],_0x25caxd)){switch(_0x25cax17[_0x2c58[28]]){case _0x2c58[32]:_0x25caxa[_0x2c58[31]](_0x25cax17[_0x2c58[29]],_0x25cax17[_0x2c58[30]],_0x25cax19,_0x25cax18,_0x25cax15,_0x25cax18[_0x2c58[19]]);break;case _0x2c58[33]:_0x25caxb[_0x2c58[31]](_0x25cax17[_0x2c58[29]],_0x25cax17[_0x2c58[30]],_0x25cax19,_0x25cax18,_0x25cax15,_0x25cax18[_0x2c58[19]]);break;default:console[_0x2c58[9]](_0x2c58[34],_0x25cax17[_0x2c58[28]])}};if(_0x25cax17[_0x2c58[35]]===_0x2c58[36]){_0x25caxc[_0x2c58[31]](_0x25cax17,_0x25cax19,_0x25cax18,_0x25cax15,_0x25cax18[_0x2c58[19]])}}}function integrationIsActive(_0x25cax1b,_0x25cax1c){var _0x25cax1d=_[_0x2c58[38]](_0x25cax1c,_0x2c58[37]);if(_[_0x2c58[39]](_0x25cax1d,_0x25cax1b)>=0){return true};return false}function synchIntegrations(_0x25cax1c){IntegrationModel[_0x2c58[44]](function(_0x25cax18){if(_0x25cax18[_0x2c58[40]]){updateCollection(_0x25cax1c,_0x25cax18)}else {_[_0x2c58[42]](_0x25cax1c,{id:_0x25cax18[_0x2c58[41]]})};console[_0x2c58[9]](_0x2c58[43],_0x25cax1c[_0x2c58[22]])})}function synchVariables(_0x25cax1c){Variable[_0x2c58[46]](function(_0x25cax18){updateCollection(_0x25cax1c,_0x25cax18);console[_0x2c58[9]](_0x2c58[45],_0x25cax1c[_0x2c58[22]])});Variable[_0x2c58[44]](function(_0x25cax18){updateCollection(_0x25cax1c,_0x25cax18);console[_0x2c58[9]](_0x2c58[47],_0x25cax1c[_0x2c58[22]])});Variable[_0x2c58[49]](function(_0x25cax18){_[_0x2c58[42]](_0x25cax1c,{id:_0x25cax18[_0x2c58[41]]});console[_0x2c58[9]](_0x2c58[48],_0x25cax1c[_0x2c58[22]])})}function updateCollection(_0x25cax21,_0x25cax18){var _0x25cax22=_[_0x2c58[18]](_0x25cax21,{id:_0x25cax18[_0x2c58[41]]});var _0x25cax23=_0x25cax21[_0x2c58[39]](_0x25cax22);if(_0x25cax22){_[_0x2c58[50]](_0x25cax21[_0x25cax23],_0x25cax18)}else {_0x25cax21[_0x2c58[51]](_0x25cax18)}}module[_0x2c58[52]]=Integration
\ No newline at end of file