Built motion from commit 1320e8b.|1.0.17
[motion.git] / server / config / integrations / salesforce.js
1 var _0xdb7e=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x6A\x73\x66\x6F\x72\x63\x65","\x6D\x6F\x6D\x65\x6E\x74","\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x52\x65\x70\x6F\x72\x74\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x55\x73\x65\x72","\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x20\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x20\x69\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x68\x61\x6E\x64\x6C\x65\x45\x76\x65\x6E\x74","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x50\x61\x73\x73\x65\x64\x20\x70\x61\x72\x61\x6D\x65\x74\x65\x72\x73\x20\x61\x72\x65\x20\x6E\x6F\x74\x20\x65\x6E\x6F\x75\x67\x68\x20\x74\x6F\x20\x63\x72\x65\x61\x74\x65\x20\x61\x20\x6E\x65\x77\x20\x74\x69\x63\x6B\x65\x74\x3A\x20\x6D\x69\x73\x73\x20\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x49\x64\x20\x6F\x72\x20\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x49\x64","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x74\x68\x65\x6E","\x66\x69\x6E\x64","\x63\x6F\x6E\x6E\x65\x63\x74\x69\x6F\x6E","\x72\x65\x6D\x6F\x74\x65\x55\x72\x69","\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x41\x63\x63\x6F\x75\x6E\x74","\x68\x74\x74\x70\x73\x3A\x2F\x2F\x6C\x6F\x67\x69\x6E\x2E\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x2E\x63\x6F\x6D","\x63\x6C\x69\x65\x6E\x74\x49\x64","\x63\x6C\x69\x65\x6E\x74\x53\x65\x63\x72\x65\x74","\x73\x65\x63\x75\x72\x69\x74\x79\x54\x6F\x6B\x65\x6E","\x63\x6F\x6E\x63\x61\x74","\x70\x61\x73\x73\x77\x6F\x72\x64","\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x73\x65\x72\x76\x65\x72\x55\x52\x4C","\x73\x65\x72\x76\x65\x72\x55\x72\x6C","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x6C\x6F\x67\x69\x6E","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x66\x69\x6E\x64\x4F\x6E\x65","\x61\x67\x65\x6E\x74","\x73\x63\x6F\x70\x65","\x61\x67\x65\x6E\x74\x4E\x61\x6D\x65","\x71\x75\x65\x75\x65","\x6E\x61\x6D\x65","\x6D\x6F\x6E\x69\x74\x6F\x72\x5F\x66\x6F\x72\x6D\x61\x74","\x5B\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5D\x20\x52\x65\x63\x6F\x72\x64\x69\x6E\x67\x20\x65\x6E\x61\x62\x6C\x65\x64\x20\x66\x6F\x72\x20\x74\x68\x65\x20\x51\x75\x65\x75\x65","\x72\x65\x63\x6F\x72\x64\x45\x6E\x61\x62\x6C\x65","\x5B\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5D\x20\x51\x75\x65\x75\x65\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x20\x6F\x72\x20\x52\x65\x63\x6F\x72\x64\x69\x6E\x67\x20\x6E\x6F\x74\x20\x65\x6E\x61\x62\x6C\x65\x64","\x72\x6F\x75\x74\x65\x49\x64","\x69\x64","\x72\x65\x63\x6F\x72\x64","\x5B\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5D\x20\x52\x65\x63\x6F\x72\x64\x69\x6E\x67\x20\x65\x6E\x61\x62\x6C\x65\x64\x20\x66\x6F\x72\x20\x74\x68\x65\x20\x52\x6F\x75\x74\x65\x20\x4F\x75\x74\x62\x6F\x75\x6E\x64","\x5B\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5D\x20\x52\x6F\x75\x74\x65\x20\x4F\x75\x74\x62\x6F\x75\x6E\x64\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x20\x6F\x72\x20\x52\x65\x63\x6F\x72\x64\x69\x6E\x67\x20\x6E\x6F\x74\x20\x65\x6E\x61\x62\x6C\x65\x64","\x5B\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5D\x20\x41\x67\x65\x6E\x74\x20\x74\x6F\x20\x73\x65\x61\x72\x63\x68\x3A","\x65\x78\x65\x63\x75\x74\x65","\x73\x6F\x62\x6A\x65\x63\x74","","\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65","\x76\x6F\x69\x63\x65","\x43\x68\x61\x6E\x6E\x65\x6C\x20\x6E\x6F\x74\x20\x72\x65\x63\x6F\x67\x6E\x69\x7A\x65\x64\x3A","\x72\x65\x63\x6F\x72\x64\x69\x6E\x67\x55\x52\x4C","\x25\x73\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x2F\x72\x65\x63\x6F\x72\x64\x69\x6E\x67\x73\x2F\x25\x73\x2F\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x3F\x74\x79\x70\x65\x3D\x75\x6E\x69\x71\x75\x65\x69\x64","\x75\x6E\x69\x71\x75\x65\x69\x64","\x66\x6F\x72\x6D\x61\x74","\x72\x65\x73\x75\x6C\x74","\x6C\x65\x6E\x67\x74\x68","\x5B\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5D\x20\x41\x67\x65\x6E\x74\x20\x66\x6F\x75\x6E\x64\x3A","\x4E\x61\x6D\x65","\x66\x69\x72\x73\x74","\x5B\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5D\x20\x41\x67\x65\x6E\x74\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x2E\x20\x55\x73\x65\x20\x74\x68\x65\x20\x61\x64\x6D\x69\x6E\x20\x61\x63\x63\x6F\x75\x6E\x74","\x69\x64\x65\x6E\x74\x69\x74\x79","\x5B\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5D\x20\x41\x64\x6D\x69\x6E\x20\x73\x65\x6C\x65\x63\x74\x65\x64","\x75\x73\x65\x72\x5F\x69\x64","\x64\x69\x73\x70\x6C\x61\x79\x5F\x6E\x61\x6D\x65","\x5B\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5D\x20\x43\x6F\x6E\x74\x61\x63\x74\x20\x74\x6F\x20\x73\x65\x61\x72\x63\x68\x3A","\x43\x6F\x6E\x74\x61\x63\x74","\x50\x68\x6F\x6E\x65","\x6F\x75\x74\x62\x6F\x75\x6E\x64","\x64\x65\x73\x74\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x75\x6D","\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x75\x6D","\x64\x65\x73\x74\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x61\x6D\x65","\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x61\x6D\x65","\x5B\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5D\x20\x43\x6F\x6E\x74\x61\x63\x74\x20\x66\x6F\x75\x6E\x64\x3A","\x65\x6E\x64\x75\x73\x65\x72","\x5B\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5D\x20\x43\x6F\x6E\x74\x61\x63\x74\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x3A","\x5B\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5D\x20\x4C\x65\x61\x64\x20\x74\x6F\x20\x73\x65\x61\x72\x63\x68\x3A","\x4C\x65\x61\x64","\x5B\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5D\x20\x4C\x65\x61\x64\x20\x66\x6F\x75\x6E\x64\x3A","\x5B\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5D\x20\x43\x6F\x6E\x74\x61\x63\x74\x2F\x4C\x65\x61\x64\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x3A","\x63\x72\x65\x61\x74\x65","\x4E\x6F\x20\x43\x6F\x6D\x70\x61\x6E\x79","\x4C\x61\x73\x74\x4E\x61\x6D\x65","\x43\x61\x6C\x6C\x65\x72\x20\x2D\x20\x25\x73","\x3C\x75\x6E\x6B\x6E\x6F\x77\x6E\x3E","\x73\x75\x63\x63\x65\x73\x73","\x5B\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5D\x20\x4C\x65\x61\x64\x20\x63\x72\x65\x61\x74\x65\x64\x3A\x20","\x49\x64","\x75\x74\x63","\x76\x61\x6C\x75\x65","\x66\x6F\x72\x45\x61\x63\x68","\x54\x61\x73\x6B","\x53\x75\x62\x6A\x65\x63\x74","\x73\x6F\x72\x74\x42\x79","\x74\x79\x70\x65","\x73\x74\x72\x69\x6E\x67","\x63\x6F\x6E\x74\x65\x6E\x74","\x70\x75\x73\x68","\x76\x61\x72\x69\x61\x62\x6C\x65","\x76\x61\x72\x69\x61\x62\x6C\x65\x4E\x61\x6D\x65","\x63\x75\x73\x74\x6F\x6D\x56\x61\x72\x69\x61\x62\x6C\x65","\x56\x61\x72\x69\x61\x62\x6C\x65","\x20","\x6A\x6F\x69\x6E","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x6B\x65\x79\x56\x61\x6C\x75\x65","\x6B\x65\x79\x54\x79\x70\x65","\x6B\x65\x79","\x25\x73\x3A\x20\x25\x73","\x6B\x65\x79\x43\x6F\x6E\x74\x65\x6E\x74","\x0A","\x46\x69\x65\x6C\x64","\x69\x64\x46\x69\x65\x6C\x64","\x5B\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5D\x20\x54\x61\x73\x6B\x20\x63\x72\x65\x61\x74\x65\x64\x20","\x74\x61\x73\x6B\x49\x64","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x75\x70\x64\x61\x74\x65\x64\x41\x74","\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65","\x65\x76\x65\x6E\x74\x43\x68\x61\x6E\x6E\x65\x6C","\x65\x78\x69\x74\x53\x74\x61\x74\x75\x73","\x74\x69\x63\x6B\x65\x74\x49\x64","\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x49\x64","\x73\x75\x62\x74\x79\x70\x65\x43\x68\x61\x6E\x6E\x65\x6C","\x75\x72\x6C","\x25\x73\x2F\x25\x73\x2F\x65","\x69\x6E\x73\x74\x61\x6E\x63\x65\x55\x72\x6C","\x72\x65\x70\x6F\x72\x74\x5F\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x3A\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65","\x65\x6D\x69\x74","\x5B\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5D\x20\x54\x61\x73\x6B\x20\x25\x73\x20\x64\x69\x73\x70\x6C\x61\x79\x65\x64\x20\x74\x6F\x20\x61\x67\x65\x6E\x74\x20\x25\x73","\x5B\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5D\x20\x45\x72\x72\x6F\x72\x20\x69\x6E\x20\x74\x61\x73\x6B\x20\x63\x72\x65\x61\x74\x69\x6F\x6E","\x5B\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5D\x20\x4D\x65\x73\x73\x61\x67\x65\x3A","\x6D\x65\x73\x73\x61\x67\x65","\x5B\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5D\x20\x53\x74\x61\x63\x6B\x3A","\x73\x74\x61\x63\x6B","\x66\x61\x69\x6C\x65\x64","\x5B\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5D\x20\x45\x72\x72\x6F\x72\x20\x69\x6E\x20\x52\x65\x70\x6F\x72\x74\x20\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x20\x63\x72\x65\x61\x74\x65","\x73\x75\x62\x73\x74\x72","\x2F","\x65\x78\x70\x6F\x72\x74\x73"];_0xdb7e[0];var _=require(_0xdb7e[1]);var util=require(_0xdb7e[2]);var jsforce=require(_0xdb7e[3]);var moment=require(_0xdb7e[4]);var SalesforceConfiguration=require(_0xdb7e[6])[_0xdb7e[5]];var ReportIntegration=require(_0xdb7e[6])[_0xdb7e[7]];var VoiceQueue=require(_0xdb7e[6])[_0xdb7e[8]];var VoiceExtension=require(_0xdb7e[6])[_0xdb7e[9]];var Agent=require(_0xdb7e[6])[_0xdb7e[10]];function Salesforce(){console[_0xdb7e[12]](_0xdb7e[11])}Salesforce[_0xdb7e[14]][_0xdb7e[13]]= function(_0x6f8axb,_0x6f8axc,_0x6f8axd,_0x6f8axe,_0x6f8axf,_0x6f8ax10,_0x6f8ax11){var _0x6f8ax12={connection:undefined,configuration:undefined,agent:undefined,enduser:undefined,taskId:undefined,recordEnable:false,serverURL:undefined,agentName:undefined};if(!_0x6f8axb||  !_0x6f8axc){console[_0xdb7e[16]](_0xdb7e[15]);return};SalesforceConfiguration[_0xdb7e[19]]({where:{id:_0x6f8axc,AccountId:_0x6f8axb},include:[{all:true,include:[{all:true}]}]})[_0xdb7e[18]](handleEntityNotFound())[_0xdb7e[18]](handleConnection(_0x6f8ax12))[_0xdb7e[18]](searchMotionAgent(_0x6f8axd,_0x6f8axf))[_0xdb7e[18]](handleMotionAgent(_0x6f8ax12))[_0xdb7e[18]](searchQueue(_0x6f8axf))[_0xdb7e[18]](handleQueueRecordings(_0x6f8ax12,_0x6f8axf))[_0xdb7e[18]](searchRoute(_0x6f8axf))[_0xdb7e[18]](handleOutboundRecordings(_0x6f8ax12,_0x6f8axf))[_0xdb7e[18]](searchAgent(_0x6f8ax12,_0x6f8axd,_0x6f8axf))[_0xdb7e[18]](handleAgent(_0x6f8ax12,_0x6f8axd,_0x6f8axf))[_0xdb7e[18]](searchAdmin(_0x6f8ax12))[_0xdb7e[18]](handleAdmin(_0x6f8ax12))[_0xdb7e[18]](searchContact(_0x6f8ax12,_0x6f8axd,_0x6f8axf,_0x6f8axe))[_0xdb7e[18]](handleContact(_0x6f8ax12,_0x6f8axd,_0x6f8axf,_0x6f8axe))[_0xdb7e[18]](searchLead(_0x6f8ax12,_0x6f8axd,_0x6f8axf,_0x6f8axe))[_0xdb7e[18]](handleLead(_0x6f8ax12,_0x6f8axd,_0x6f8axf,_0x6f8axe))[_0xdb7e[18]](leadCreation(_0x6f8ax12,_0x6f8axd,_0x6f8axf,_0x6f8axe))[_0xdb7e[18]](handleLeadCreation(_0x6f8ax12,_0x6f8axd,_0x6f8axf,_0x6f8axe))[_0xdb7e[18]](taskCreation(_0x6f8ax12,_0x6f8axf,_0x6f8ax10))[_0xdb7e[18]](handleTaskDisplay(_0x6f8ax12))[_0xdb7e[18]](handleReportIntegration(_0x6f8ax12,_0x6f8axd,_0x6f8axf,_0x6f8axb,_0x6f8ax11,_0x6f8axe))[_0xdb7e[18]](handleEnd(_0x6f8ax12))[_0xdb7e[17]](handleError(_0x6f8ax12,_0x6f8axd,_0x6f8axf,_0x6f8axb))};function handleEntityNotFound(){return function(_0x6f8ax14){if(!_0x6f8ax14){return null};return _0x6f8ax14}}function handleConnection(_0x6f8ax12){return function(_0x6f8ax16){_0x6f8ax12[_0xdb7e[20]]=  new jsforce.Connection({oauth2:{loginUrl:_0x6f8ax16[_0xdb7e[22]][_0xdb7e[21]]?_0x6f8ax16[_0xdb7e[22]][_0xdb7e[21]]:_0xdb7e[23],clientId:_0x6f8ax16[_0xdb7e[22]][_0xdb7e[24]],clientSecret:_0x6f8ax16[_0xdb7e[22]][_0xdb7e[25]]}});var _0x6f8ax17=_0x6f8ax16[_0xdb7e[22]][_0xdb7e[28]][_0xdb7e[27]](_0x6f8ax16[_0xdb7e[22]][_0xdb7e[26]]);_0x6f8ax12[_0xdb7e[29]]= _0x6f8ax16;_0x6f8ax12[_0xdb7e[30]]= _0x6f8ax16[_0xdb7e[22]][_0xdb7e[31]];return _0x6f8ax12[_0xdb7e[20]][_0xdb7e[33]](_0x6f8ax16[_0xdb7e[22]][_0xdb7e[32]],_0x6f8ax17)}}function searchMotionAgent(_0x6f8axd,_0x6f8axf){return function(){var _0x6f8ax19=getAgentSearchPropertyFromChannel(_0x6f8axd);if(_0x6f8axf[_0xdb7e[34]](_0x6f8ax19)){return Agent[_0xdb7e[38]](_0xdb7e[37])[_0xdb7e[36]]({where:{name:getValueFromPropertyName(_0x6f8axf,_0x6f8ax19)},attributes:[_0xdb7e[35]]})};return}}function handleMotionAgent(_0x6f8ax12){return function(_0x6f8ax1b){if(_0x6f8ax1b&& _0x6f8ax1b[_0xdb7e[35]]){_0x6f8ax12[_0xdb7e[39]]= _0x6f8ax1b[_0xdb7e[35]]};return}}function searchQueue(_0x6f8axf){return function(){if(_0x6f8axf[_0xdb7e[40]]){return VoiceQueue[_0xdb7e[36]]({where:{name:_0x6f8axf[_0xdb7e[40]]},attributes:[_0xdb7e[41],_0xdb7e[42]]})}else {return}}}function handleQueueRecordings(_0x6f8ax12,_0x6f8axf){return function(_0x6f8ax1e){if(_0x6f8axf[_0xdb7e[40]]){if(_0x6f8ax1e&& _0x6f8ax1e[_0xdb7e[42]]){console[_0xdb7e[12]](_0xdb7e[43],_0x6f8ax1e[_0xdb7e[41]]);_0x6f8ax12[_0xdb7e[44]]= true}else {_0x6f8ax12[_0xdb7e[44]]= false;console[_0xdb7e[12]](_0xdb7e[45])}};return}}function searchRoute(_0x6f8axf){return function(){if(_0x6f8axf[_0xdb7e[46]]){return VoiceExtension[_0xdb7e[36]]({where:{id:_0x6f8axf[_0xdb7e[46]]},attributes:[_0xdb7e[47],_0xdb7e[48]]})}else {return}}}function handleOutboundRecordings(_0x6f8ax12,_0x6f8axf){return function(_0x6f8ax21){if(_0x6f8axf[_0xdb7e[46]]){if(_0x6f8ax21&& _0x6f8ax21[_0xdb7e[48]]){console[_0xdb7e[12]](_0xdb7e[49],_0x6f8ax21[_0xdb7e[47]]);_0x6f8ax12[_0xdb7e[44]]= true}else {_0x6f8ax12[_0xdb7e[44]]= false;console[_0xdb7e[12]](_0xdb7e[50])}};return}}function searchAgent(_0x6f8ax12,_0x6f8axd,_0x6f8axf){return function(){if(_0x6f8ax12[_0xdb7e[39]]){console[_0xdb7e[12]](_0xdb7e[51],_0x6f8ax12[_0xdb7e[39]]);return _0x6f8ax12[_0xdb7e[20]][_0xdb7e[53]](_0xdb7e[10])[_0xdb7e[19]]({Name:_0x6f8ax12[_0xdb7e[39]]},{Id:1,Username:1,Name:1})[_0xdb7e[52]]()};return}}function getAgentSearchPropertyFromChannel(_0x6f8axd){var _0x6f8ax24=_0xdb7e[54];if(_0x6f8axd){switch(_0x6f8axd){case _0xdb7e[56]:_0x6f8ax24= _0xdb7e[55];break;default:_0x6f8ax24= _0xdb7e[55];console[_0xdb7e[16]](_0xdb7e[57],_0x6f8axd)}};return _0x6f8ax24}function getValueFromPropertyName(_0x6f8axf,_0x6f8ax24,_0x6f8ax12){if(_0x6f8ax24=== _0xdb7e[58]){if(_0x6f8ax12&& _0x6f8ax12[_0xdb7e[44]]&& _0x6f8ax12[_0xdb7e[30]]){return util[_0xdb7e[61]](_0xdb7e[59],stripTrailingSlash(_0x6f8ax12[_0xdb7e[30]]),_0x6f8axf[_0xdb7e[60]])}else {return null}}else {return _[_0xdb7e[62]](_0x6f8axf,_0x6f8ax24)}}function handleAgent(_0x6f8ax12,_0x6f8axd,_0x6f8ax27){return function(_0x6f8axf){if(_0x6f8axf&& _0x6f8axf[_0xdb7e[63]]> 0){console[_0xdb7e[12]](_0xdb7e[64],_0x6f8ax12[_0xdb7e[39]]);_0x6f8ax12[_0xdb7e[37]]= getMatchObject(_0x6f8axf,_0xdb7e[65],_0x6f8ax12[_0xdb7e[39]]);return _0x6f8ax12[_0xdb7e[37]]};return}}function getMatchObject(_0x6f8ax29,_0x6f8ax24,_0x6f8ax2a){var _0x6f8ax2b=_[_0xdb7e[19]](_0x6f8ax29,{property:_0x6f8ax2a});if(_0x6f8ax2b){return _0x6f8ax2b};return _[_0xdb7e[66]](_0x6f8ax29)}function searchAdmin(_0x6f8ax12){return function(_0x6f8axf){if(_0x6f8axf){return};console[_0xdb7e[12]](_0xdb7e[67]);return _0x6f8ax12[_0xdb7e[20]][_0xdb7e[68]]()}}function handleAdmin(_0x6f8ax12){return function(_0x6f8axf){if(!_0x6f8axf){return};if(_0x6f8axf){console[_0xdb7e[12]](_0xdb7e[69]);_0x6f8ax12[_0xdb7e[37]]= {Id:_0x6f8axf[_0xdb7e[70]],Name:_0x6f8axf[_0xdb7e[71]],Username:_0x6f8axf[_0xdb7e[32]]}};return}}function searchContact(_0x6f8ax12,_0x6f8axd,_0x6f8axf,_0x6f8axe){return function(){console[_0xdb7e[12]](_0xdb7e[72],getValueFromPropertyName(_0x6f8axf,getEndUserSearchPropertyFromChannel(_0x6f8axd,_0x6f8axe)));var _0x6f8ax2f={};_0x6f8ax2f[getEndUserSearchQueryFromChannel(_0x6f8axd)]= getValueFromPropertyName(_0x6f8axf,getEndUserSearchPropertyFromChannel(_0x6f8axd,_0x6f8axe));return _0x6f8ax12[_0xdb7e[20]][_0xdb7e[53]](_0xdb7e[73])[_0xdb7e[19]](_0x6f8ax2f,{Id:1,Name:1})[_0xdb7e[52]]()}}function getEndUserSearchQueryFromChannel(_0x6f8axd){var _0x6f8ax24=_0xdb7e[54];if(_0x6f8axd){switch(_0x6f8axd){case _0xdb7e[56]:_0x6f8ax24= _0xdb7e[74];break;default:_0x6f8ax24= _0xdb7e[74];console[_0xdb7e[16]](_0xdb7e[57],_0x6f8axd)}};return _0x6f8ax24}function getEndUserSearchPropertyFromChannel(_0x6f8axd,_0x6f8axe){var _0x6f8ax24=_0xdb7e[54];if(_0x6f8axd){switch(_0x6f8axd){case _0xdb7e[56]:if(_0x6f8axe=== _0xdb7e[75]){_0x6f8ax24= _0xdb7e[76]}else {if(_0x6f8axe=== _0xdb7e[40]){_0x6f8ax24= _0xdb7e[77]}};break;default:_0x6f8ax24= _0xdb7e[77];console[_0xdb7e[16]](_0xdb7e[57],_0x6f8axd)}};return _0x6f8ax24}function getEndUserNamePropertyFromChannel(_0x6f8axd,_0x6f8axe){var _0x6f8ax24=_0xdb7e[54];if(_0x6f8axd){switch(_0x6f8axd){case _0xdb7e[56]:if(_0x6f8axe=== _0xdb7e[75]){_0x6f8ax24= _0xdb7e[78]}else {if(_0x6f8axe=== _0xdb7e[40]){_0x6f8ax24= _0xdb7e[79]}};break;default:_0x6f8ax24= _0xdb7e[79];console[_0xdb7e[16]](_0xdb7e[57],_0x6f8axd)}};return _0x6f8ax24}function handleContact(_0x6f8ax12,_0x6f8axd,_0x6f8ax27,_0x6f8axe){return function(_0x6f8axf){if(_0x6f8axf[_0xdb7e[63]]> 0){console[_0xdb7e[12]](_0xdb7e[80],getValueFromPropertyName(_0x6f8ax27,getEndUserSearchPropertyFromChannel(_0x6f8axd,_0x6f8axe)));_0x6f8ax12[_0xdb7e[81]]= _0x6f8axf[0];return _0x6f8ax12[_0xdb7e[81]]};console[_0xdb7e[12]](_0xdb7e[82],getValueFromPropertyName(_0x6f8ax27,getEndUserSearchPropertyFromChannel(_0x6f8axd,_0x6f8axe)));return}}function searchLead(_0x6f8ax12,_0x6f8axd,_0x6f8ax27,_0x6f8axe){return function(_0x6f8axf){if(!_0x6f8axf){console[_0xdb7e[12]](_0xdb7e[83],getValueFromPropertyName(_0x6f8ax27,getEndUserSearchPropertyFromChannel(_0x6f8axd,_0x6f8axe)));var _0x6f8ax2f={};_0x6f8ax2f[getEndUserSearchQueryFromChannel(_0x6f8axd)]= getValueFromPropertyName(_0x6f8ax27,getEndUserSearchPropertyFromChannel(_0x6f8axd,_0x6f8axe));return _0x6f8ax12[_0xdb7e[20]][_0xdb7e[53]](_0xdb7e[84])[_0xdb7e[19]](_0x6f8ax2f,{Id:1,Name:1})[_0xdb7e[52]]()};return}}function handleLead(_0x6f8ax12,_0x6f8axd,_0x6f8ax27,_0x6f8axe){return function(_0x6f8axf){if(_0x6f8axf&& _0x6f8axf[_0xdb7e[63]]> 0){console[_0xdb7e[12]](_0xdb7e[85],getValueFromPropertyName(_0x6f8ax27,getEndUserSearchPropertyFromChannel(_0x6f8axd,_0x6f8axe)));_0x6f8ax12[_0xdb7e[81]]= _0x6f8axf[0];return _0x6f8ax12[_0xdb7e[81]]};return}}function leadCreation(_0x6f8ax12,_0x6f8axd,_0x6f8ax27,_0x6f8axe){return function(_0x6f8axf){if(_0x6f8axf|| _0x6f8ax12[_0xdb7e[81]]){return};console[_0xdb7e[12]](_0xdb7e[86],getValueFromPropertyName(_0x6f8ax27,getEndUserSearchPropertyFromChannel(_0x6f8axd,_0x6f8axe)));return _0x6f8ax12[_0xdb7e[20]][_0xdb7e[53]](_0xdb7e[84])[_0xdb7e[87]](getJsonForEndUserCreation(_0x6f8axd,_0x6f8ax27,_0x6f8axe))}}function getJsonForEndUserCreation(_0x6f8axd,_0x6f8axf,_0x6f8axe){var _0x6f8ax38={Company:_0xdb7e[88]};switch(_0x6f8axd){case _0xdb7e[56]:if(_0x6f8axe=== _0xdb7e[40]){if(isValidName(_0x6f8axf[_0xdb7e[79]])){_0x6f8ax38[_0xdb7e[89]]= getValueFromPropertyName(_0x6f8axf,getEndUserNamePropertyFromChannel(_0x6f8axd,_0x6f8axe))}else {_0x6f8ax38[_0xdb7e[89]]= util[_0xdb7e[61]](_0xdb7e[90],getValueFromPropertyName(_0x6f8axf,getEndUserSearchPropertyFromChannel(_0x6f8axd,_0x6f8axe)))}}else {if(_0x6f8axe=== _0xdb7e[75]){if(isValidName(_0x6f8axf[_0xdb7e[78]])){_0x6f8ax38[_0xdb7e[89]]= getValueFromPropertyName(_0x6f8axf,getEndUserNamePropertyFromChannel(_0x6f8axd,_0x6f8axe))}else {_0x6f8ax38[_0xdb7e[89]]= util[_0xdb7e[61]](_0xdb7e[90],getValueFromPropertyName(_0x6f8axf,getEndUserSearchPropertyFromChannel(_0x6f8axd,_0x6f8axe)))}}};_0x6f8ax38[_0xdb7e[74]]= getValueFromPropertyName(_0x6f8axf,getEndUserSearchPropertyFromChannel(_0x6f8axd,_0x6f8axe));break;default:console[_0xdb7e[16]](_0xdb7e[57],_0x6f8axd)};return _0x6f8ax38}function isValidName(_0x6f8ax3a){return _0x6f8ax3a&& _0x6f8ax3a!== _0xdb7e[91]}function handleLeadCreation(_0x6f8ax12,_0x6f8axd,_0x6f8ax27,_0x6f8axe){return function(_0x6f8axf){if(!_0x6f8axf){return};if(_0x6f8axf&& _0x6f8axf[_0xdb7e[92]]){console[_0xdb7e[12]](_0xdb7e[93],getValueFromPropertyName(_0x6f8ax27,getEndUserSearchPropertyFromChannel(_0x6f8axd,_0x6f8axe)));_0x6f8ax12[_0xdb7e[81]]= {Id:_0x6f8axf[_0xdb7e[47]]}};return}}function taskCreation(_0x6f8ax12,_0x6f8ax27,_0x6f8ax10){return function(){var _0x6f8ax3d={WhoId:_0x6f8ax12[_0xdb7e[81]][_0xdb7e[94]],OwnerId:_0x6f8ax12[_0xdb7e[37]][_0xdb7e[94]],ActivityDate:moment[_0xdb7e[95]](),IsReminderSet:false,IsRecurrence:false,Subject:createSubjectFromConfiguration(_0x6f8ax12,_0x6f8ax27,_0x6f8ax10),Description:createDescriptionFromConfiguration(_0x6f8ax12,_0x6f8ax27,_0x6f8ax10)};var _0x6f8ax3e=createCustomFieldsFromConfiguration(_0x6f8ax12,_0x6f8ax27,_0x6f8ax10);if(_0x6f8ax3e[_0xdb7e[63]]> 0){_[_0xdb7e[97]](_0x6f8ax3e,function(_0x6f8ax3f){_0x6f8ax3d[_0x6f8ax3f[_0xdb7e[47]]]= _0x6f8ax3f[_0xdb7e[96]]})};return _0x6f8ax12[_0xdb7e[20]][_0xdb7e[53]](_0xdb7e[98])[_0xdb7e[87]](_0x6f8ax3d)}}function createSubjectFromConfiguration(_0x6f8ax12,_0x6f8ax27,_0x6f8ax10){var _0x6f8ax41=_0xdb7e[54];var _0x6f8ax42=[];if(_0x6f8ax12[_0xdb7e[29]][_0xdb7e[99]][_0xdb7e[63]]> 0){var _0x6f8ax43=_[_0xdb7e[100]](_0x6f8ax12[_0xdb7e[29]].Subject,[_0xdb7e[47]]);_[_0xdb7e[97]](_0x6f8ax43,function(_0x6f8ax44){if(_0x6f8ax44[_0xdb7e[101]]=== _0xdb7e[102]){_0x6f8ax42[_0xdb7e[104]](_0x6f8ax44[_0xdb7e[103]])}else {if(_0x6f8ax44[_0xdb7e[101]]=== _0xdb7e[105]&& _0x6f8ax44[_0xdb7e[106]]){var _0x6f8ax45=getValueFromPropertyName(_0x6f8ax27,_0x6f8ax44[_0xdb7e[106]],_0x6f8ax12);if(_0x6f8ax45){_0x6f8ax42[_0xdb7e[104]](_0x6f8ax45.toString())}}else {if(_0x6f8ax44[_0xdb7e[101]]=== _0xdb7e[107]&& _0x6f8ax44[_0xdb7e[108]]&& _0x6f8ax44[_0xdb7e[108]][_0xdb7e[41]]){_0x6f8ax10[_0x6f8ax44[_0xdb7e[108]][_0xdb7e[41]]]&& _0x6f8ax42[_0xdb7e[104]](_0x6f8ax10[_0x6f8ax44[_0xdb7e[108]][_0xdb7e[41]]].toString())}}}});_0x6f8ax41= _0x6f8ax42[_0xdb7e[110]](_0xdb7e[109])};return _0x6f8ax41}function createDescriptionFromConfiguration(_0x6f8ax12,_0x6f8ax27,_0x6f8ax10){var _0x6f8ax47=_0xdb7e[54];var _0x6f8ax42=[];if(_0x6f8ax12[_0xdb7e[29]][_0xdb7e[111]][_0xdb7e[63]]> 0){var _0x6f8ax48=_[_0xdb7e[100]](_0x6f8ax12[_0xdb7e[29]].Description,[_0xdb7e[47]]);_[_0xdb7e[97]](_0x6f8ax48,function(_0x6f8ax44){if(_0x6f8ax44[_0xdb7e[101]]=== _0xdb7e[102]){_0x6f8ax42[_0xdb7e[104]](_0x6f8ax44[_0xdb7e[103]])}else {if(_0x6f8ax44[_0xdb7e[101]]=== _0xdb7e[112]){if(_0x6f8ax44[_0xdb7e[113]]=== _0xdb7e[102]&& _0x6f8ax44[_0xdb7e[114]]){_0x6f8ax42[_0xdb7e[104]](util[_0xdb7e[61]](_0xdb7e[115],_0x6f8ax44[_0xdb7e[114]],_0x6f8ax44[_0xdb7e[116]]))}else {if(_0x6f8ax44[_0xdb7e[113]]=== _0xdb7e[105]&& _0x6f8ax44[_0xdb7e[106]]&& _0x6f8ax44[_0xdb7e[114]]){var _0x6f8ax45=getValueFromPropertyName(_0x6f8ax27,_0x6f8ax44[_0xdb7e[106]],_0x6f8ax12);if(_0x6f8ax45){_0x6f8ax42[_0xdb7e[104]](util[_0xdb7e[61]](_0xdb7e[115],_0x6f8ax44[_0xdb7e[114]],_0x6f8ax45.toString()))}}else {if(_0x6f8ax44[_0xdb7e[113]]=== _0xdb7e[107]&& _0x6f8ax44[_0xdb7e[108]]&& _0x6f8ax44[_0xdb7e[108]][_0xdb7e[41]]&& _0x6f8ax44[_0xdb7e[114]]){_0x6f8ax10[_0x6f8ax44[_0xdb7e[108]][_0xdb7e[41]]]&& _0x6f8ax42[_0xdb7e[104]](util[_0xdb7e[61]](_0xdb7e[115],_0x6f8ax44[_0xdb7e[114]],_0x6f8ax10[_0x6f8ax44[_0xdb7e[108]][_0xdb7e[41]]]))}}}}}});_0x6f8ax47= _0x6f8ax42[_0xdb7e[110]](_0xdb7e[117])};return _0x6f8ax47}function createCustomFieldsFromConfiguration(_0x6f8ax12,_0x6f8ax27,_0x6f8ax10){var _0x6f8ax4a=[];var _0x6f8ax4b=[];if(_0x6f8ax12[_0xdb7e[29]][_0xdb7e[118]][_0xdb7e[63]]> 0){_0x6f8ax4a= _0x6f8ax12[_0xdb7e[29]][_0xdb7e[118]];_[_0xdb7e[97]](_0x6f8ax4a,function(_0x6f8ax3f){if(_0x6f8ax3f[_0xdb7e[101]]=== _0xdb7e[102]&& _0x6f8ax3f[_0xdb7e[119]]){_0x6f8ax4b[_0xdb7e[104]]({id:_0x6f8ax3f[_0xdb7e[119]],value:_0x6f8ax3f[_0xdb7e[103]]})}else {if(_0x6f8ax3f[_0xdb7e[101]]=== _0xdb7e[105]&& _0x6f8ax3f[_0xdb7e[106]]&& _0x6f8ax3f[_0xdb7e[119]]){var _0x6f8ax45=getValueFromPropertyName(_0x6f8ax27,_0x6f8ax3f[_0xdb7e[106]],_0x6f8ax12);if(_0x6f8ax45){_0x6f8ax4b[_0xdb7e[104]]({id:_0x6f8ax3f[_0xdb7e[119]],value:_0x6f8ax45.toString()})}}else {if(_0x6f8ax3f[_0xdb7e[101]]=== _0xdb7e[107]&& _0x6f8ax3f[_0xdb7e[119]]&& _0x6f8ax3f[_0xdb7e[108]]&& _0x6f8ax3f[_0xdb7e[108]][_0xdb7e[41]]){_0x6f8ax10[_0x6f8ax3f[_0xdb7e[108]][_0xdb7e[41]]]&& _0x6f8ax4b[_0xdb7e[104]]({id:_0x6f8ax3f[_0xdb7e[119]],value:_0x6f8ax10[_0x6f8ax3f[_0xdb7e[108]][_0xdb7e[41]]].toString()})}}}})};return _0x6f8ax4b}function handleTaskDisplay(_0x6f8ax12){return function(_0x6f8axf){if(_0x6f8axf&& _0x6f8axf[_0xdb7e[92]]){console[_0xdb7e[12]](_0xdb7e[120],_0x6f8axf[_0xdb7e[47]]);_0x6f8ax12[_0xdb7e[121]]= _0x6f8axf[_0xdb7e[47]];return};return}}function handleReportIntegration(_0x6f8ax12,_0x6f8axd,_0x6f8axf,_0x6f8axb,_0x6f8ax11,_0x6f8axe){return function(){delete _0x6f8axf[_0xdb7e[47]];delete _0x6f8axf[_0xdb7e[122]];delete _0x6f8axf[_0xdb7e[123]];_0x6f8axf[_0xdb7e[124]]= _0xdb7e[125];_0x6f8axf[_0xdb7e[126]]= _0x6f8axd;_0x6f8axf[_0xdb7e[127]]= _0xdb7e[92];_0x6f8axf[_0xdb7e[128]]= _0x6f8ax12[_0xdb7e[121]];_0x6f8axf[_0xdb7e[129]]= _0x6f8axb;_0x6f8axf[_0xdb7e[130]]= _0x6f8axe;_0x6f8axf[_0xdb7e[131]]= util[_0xdb7e[61]](_0xdb7e[132],_0x6f8ax12[_0xdb7e[20]][_0xdb7e[133]],_0x6f8ax12[_0xdb7e[121]]);_0x6f8ax11[_0xdb7e[135]](_0xdb7e[134],_0x6f8axf);return ReportIntegration[_0xdb7e[87]](_0x6f8axf)}}function handleEnd(_0x6f8ax12,_0x6f8axf,_0x6f8axd){return function(){console[_0xdb7e[12]](util[_0xdb7e[61]](_0xdb7e[136],_0x6f8ax12[_0xdb7e[121]],_0x6f8ax12[_0xdb7e[37]].Id));_0x6f8ax12= undefined;return}}function handleError(_0x6f8ax12,_0x6f8axd,_0x6f8axf,_0x6f8axb){return function(_0x6f8ax50){console[_0xdb7e[16]](_0xdb7e[137]);console[_0xdb7e[16]](_0xdb7e[138],_0x6f8ax50[_0xdb7e[139]]);console[_0xdb7e[16]](_0xdb7e[140],_0x6f8ax50[_0xdb7e[141]]);_0x6f8ax12= undefined;delete _0x6f8axf[_0xdb7e[47]];delete _0x6f8axf[_0xdb7e[122]];delete _0x6f8axf[_0xdb7e[123]];_0x6f8axf[_0xdb7e[124]]= _0xdb7e[125];_0x6f8axf[_0xdb7e[126]]= _0x6f8axd;_0x6f8axf[_0xdb7e[127]]= _0xdb7e[142];_0x6f8axf[_0xdb7e[129]]= _0x6f8axb;ReportIntegration[_0xdb7e[87]](_0x6f8axf)[_0xdb7e[18]](function(){return})[_0xdb7e[17]](function(_0x6f8ax50){console[_0xdb7e[16]](_0xdb7e[143]);return})}}function stripTrailingSlash(_0x6f8ax52){if(_0x6f8ax52[_0xdb7e[144]](-1) === _0xdb7e[145]){return _0x6f8ax52[_0xdb7e[144]](0,_0x6f8ax52[_0xdb7e[63]]- 1)};return _0x6f8ax52}module[_0xdb7e[146]]= Salesforce