Built motion from commit dbc832960.|1.0.25
[motion.git] / server / config / integrations / salesforce.js
1 var _0xbf02=["\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","\x6D\x6F\x74\x69\x6F\x6E","\x2E\x2E\x2F\x6C\x6F\x67\x67\x65\x72\x2E\x6A\x73","\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","\x69\x6E\x66\x6F","\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","\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x54\x79\x70\x65","\x65\x6D\x62\x65\x64\x64\x65\x64","\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"];_0xbf02[0];var _=require(_0xbf02[1]);var util=require(_0xbf02[2]);var jsforce=require(_0xbf02[3]);var moment=require(_0xbf02[4]);var logger=require(_0xbf02[6])(_0xbf02[5]);var SalesforceConfiguration=require(_0xbf02[8])[_0xbf02[7]];var ReportIntegration=require(_0xbf02[8])[_0xbf02[9]];var VoiceQueue=require(_0xbf02[8])[_0xbf02[10]];var VoiceExtension=require(_0xbf02[8])[_0xbf02[11]];var Agent=require(_0xbf02[8])[_0xbf02[12]];function Salesforce(){logger[_0xbf02[14]](_0xbf02[13])}Salesforce[_0xbf02[16]][_0xbf02[15]]= function(_0xa8e5xc,_0xa8e5xd,_0xa8e5xe,_0xa8e5xf,_0xa8e5x10,_0xa8e5x11,_0xa8e5x12){var _0xa8e5x13={connection:undefined,configuration:undefined,agent:undefined,enduser:undefined,taskId:undefined,recordEnable:false,serverURL:undefined,agentName:undefined};if(!_0xa8e5xc||  !_0xa8e5xd){logger[_0xbf02[18]](_0xbf02[17]);return};SalesforceConfiguration[_0xbf02[21]]({where:{id:_0xa8e5xd,AccountId:_0xa8e5xc},include:[{all:true,include:[{all:true}]}]})[_0xbf02[20]](handleEntityNotFound())[_0xbf02[20]](handleConnection(_0xa8e5x13))[_0xbf02[20]](searchMotionAgent(_0xa8e5xe,_0xa8e5x10))[_0xbf02[20]](handleMotionAgent(_0xa8e5x13))[_0xbf02[20]](searchQueue(_0xa8e5x10))[_0xbf02[20]](handleQueueRecordings(_0xa8e5x13,_0xa8e5x10))[_0xbf02[20]](searchRoute(_0xa8e5x10))[_0xbf02[20]](handleOutboundRecordings(_0xa8e5x13,_0xa8e5x10))[_0xbf02[20]](searchAgent(_0xa8e5x13,_0xa8e5xe,_0xa8e5x10))[_0xbf02[20]](handleAgent(_0xa8e5x13,_0xa8e5xe,_0xa8e5x10))[_0xbf02[20]](searchAdmin(_0xa8e5x13))[_0xbf02[20]](handleAdmin(_0xa8e5x13))[_0xbf02[20]](searchContact(_0xa8e5x13,_0xa8e5xe,_0xa8e5x10,_0xa8e5xf))[_0xbf02[20]](handleContact(_0xa8e5x13,_0xa8e5xe,_0xa8e5x10,_0xa8e5xf))[_0xbf02[20]](searchLead(_0xa8e5x13,_0xa8e5xe,_0xa8e5x10,_0xa8e5xf))[_0xbf02[20]](handleLead(_0xa8e5x13,_0xa8e5xe,_0xa8e5x10,_0xa8e5xf))[_0xbf02[20]](leadCreation(_0xa8e5x13,_0xa8e5xe,_0xa8e5x10,_0xa8e5xf))[_0xbf02[20]](handleLeadCreation(_0xa8e5x13,_0xa8e5xe,_0xa8e5x10,_0xa8e5xf))[_0xbf02[20]](taskCreation(_0xa8e5x13,_0xa8e5x10,_0xa8e5x11))[_0xbf02[20]](handleTaskDisplay(_0xa8e5x13))[_0xbf02[20]](handleReportIntegration(_0xa8e5x13,_0xa8e5xe,_0xa8e5x10,_0xa8e5xc,_0xa8e5x12,_0xa8e5xf))[_0xbf02[20]](handleEnd(_0xa8e5x13))[_0xbf02[19]](handleError(_0xa8e5x13,_0xa8e5xe,_0xa8e5x10,_0xa8e5xc))};function handleEntityNotFound(){return function(_0xa8e5x15){if(!_0xa8e5x15){return null};return _0xa8e5x15}}function handleConnection(_0xa8e5x13){return function(_0xa8e5x17){_0xa8e5x13[_0xbf02[22]]=  new jsforce.Connection({oauth2:{loginUrl:_0xa8e5x17[_0xbf02[24]][_0xbf02[23]]?_0xa8e5x17[_0xbf02[24]][_0xbf02[23]]:_0xbf02[25],clientId:_0xa8e5x17[_0xbf02[24]][_0xbf02[26]],clientSecret:_0xa8e5x17[_0xbf02[24]][_0xbf02[27]]}});var _0xa8e5x18=_0xa8e5x17[_0xbf02[24]][_0xbf02[30]][_0xbf02[29]](_0xa8e5x17[_0xbf02[24]][_0xbf02[28]]);_0xa8e5x13[_0xbf02[31]]= _0xa8e5x17;_0xa8e5x13[_0xbf02[32]]= _0xa8e5x17[_0xbf02[24]][_0xbf02[33]];return _0xa8e5x13[_0xbf02[22]][_0xbf02[35]](_0xa8e5x17[_0xbf02[24]][_0xbf02[34]],_0xa8e5x18)}}function searchMotionAgent(_0xa8e5xe,_0xa8e5x10){return function(){var _0xa8e5x1a=getAgentSearchPropertyFromChannel(_0xa8e5xe);if(_0xa8e5x10[_0xbf02[36]](_0xa8e5x1a)){return Agent[_0xbf02[40]](_0xbf02[39])[_0xbf02[38]]({where:{name:getValueFromPropertyName(_0xa8e5x10,_0xa8e5x1a)},attributes:[_0xbf02[37]]})};return}}function handleMotionAgent(_0xa8e5x13){return function(_0xa8e5x1c){if(_0xa8e5x1c&& _0xa8e5x1c[_0xbf02[37]]){_0xa8e5x13[_0xbf02[41]]= _0xa8e5x1c[_0xbf02[37]]};return}}function searchQueue(_0xa8e5x10){return function(){if(_0xa8e5x10[_0xbf02[42]]){return VoiceQueue[_0xbf02[38]]({where:{name:_0xa8e5x10[_0xbf02[42]]},attributes:[_0xbf02[43],_0xbf02[44]]})}else {return}}}function handleQueueRecordings(_0xa8e5x13,_0xa8e5x10){return function(_0xa8e5x1f){if(_0xa8e5x10[_0xbf02[42]]){if(_0xa8e5x1f&& _0xa8e5x1f[_0xbf02[44]]){logger[_0xbf02[14]](_0xbf02[45],_0xa8e5x1f[_0xbf02[43]]);_0xa8e5x13[_0xbf02[46]]= true}else {_0xa8e5x13[_0xbf02[46]]= false;logger[_0xbf02[14]](_0xbf02[47])}};return}}function searchRoute(_0xa8e5x10){return function(){if(_0xa8e5x10[_0xbf02[48]]){return VoiceExtension[_0xbf02[38]]({where:{id:_0xa8e5x10[_0xbf02[48]]},attributes:[_0xbf02[49],_0xbf02[50]]})}else {return}}}function handleOutboundRecordings(_0xa8e5x13,_0xa8e5x10){return function(_0xa8e5x22){if(_0xa8e5x10[_0xbf02[48]]){if(_0xa8e5x22&& _0xa8e5x22[_0xbf02[50]]){logger[_0xbf02[14]](_0xbf02[51],_0xa8e5x22[_0xbf02[49]]);_0xa8e5x13[_0xbf02[46]]= true}else {_0xa8e5x13[_0xbf02[46]]= false;logger[_0xbf02[14]](_0xbf02[52])}};return}}function searchAgent(_0xa8e5x13,_0xa8e5xe,_0xa8e5x10){return function(){if(_0xa8e5x13[_0xbf02[41]]){logger[_0xbf02[14]](_0xbf02[53],_0xa8e5x13[_0xbf02[41]]);return _0xa8e5x13[_0xbf02[22]][_0xbf02[55]](_0xbf02[12])[_0xbf02[21]]({Name:_0xa8e5x13[_0xbf02[41]]},{Id:1,Username:1,Name:1})[_0xbf02[54]]()};return}}function getAgentSearchPropertyFromChannel(_0xa8e5xe){var _0xa8e5x25=_0xbf02[56];if(_0xa8e5xe){switch(_0xa8e5xe){case _0xbf02[58]:_0xa8e5x25= _0xbf02[57];break;default:_0xa8e5x25= _0xbf02[57];logger[_0xbf02[18]](_0xbf02[59],_0xa8e5xe)}};return _0xa8e5x25}function getValueFromPropertyName(_0xa8e5x10,_0xa8e5x25,_0xa8e5x13){if(_0xa8e5x25=== _0xbf02[60]){if(_0xa8e5x13&& _0xa8e5x13[_0xbf02[46]]&& _0xa8e5x13[_0xbf02[32]]){return util[_0xbf02[63]](_0xbf02[61],stripTrailingSlash(_0xa8e5x13[_0xbf02[32]]),_0xa8e5x10[_0xbf02[62]])}else {return null}}else {return _[_0xbf02[64]](_0xa8e5x10,_0xa8e5x25)}}function handleAgent(_0xa8e5x13,_0xa8e5xe,_0xa8e5x28){return function(_0xa8e5x10){if(_0xa8e5x10&& _0xa8e5x10[_0xbf02[65]]> 0){logger[_0xbf02[14]](_0xbf02[66],_0xa8e5x13[_0xbf02[41]]);_0xa8e5x13[_0xbf02[39]]= getMatchObject(_0xa8e5x10,_0xbf02[67],_0xa8e5x13[_0xbf02[41]]);return _0xa8e5x13[_0xbf02[39]]};return}}function getMatchObject(_0xa8e5x2a,_0xa8e5x25,_0xa8e5x2b){var _0xa8e5x2c=_[_0xbf02[21]](_0xa8e5x2a,{property:_0xa8e5x2b});if(_0xa8e5x2c){return _0xa8e5x2c};return _[_0xbf02[68]](_0xa8e5x2a)}function searchAdmin(_0xa8e5x13){return function(_0xa8e5x10){if(_0xa8e5x10){return};logger[_0xbf02[14]](_0xbf02[69]);return _0xa8e5x13[_0xbf02[22]][_0xbf02[70]]()}}function handleAdmin(_0xa8e5x13){return function(_0xa8e5x10){if(!_0xa8e5x10){return};if(_0xa8e5x10){logger[_0xbf02[14]](_0xbf02[71]);_0xa8e5x13[_0xbf02[39]]= {Id:_0xa8e5x10[_0xbf02[72]],Name:_0xa8e5x10[_0xbf02[73]],Username:_0xa8e5x10[_0xbf02[34]]}};return}}function searchContact(_0xa8e5x13,_0xa8e5xe,_0xa8e5x10,_0xa8e5xf){return function(){logger[_0xbf02[14]](_0xbf02[74],getValueFromPropertyName(_0xa8e5x10,getEndUserSearchPropertyFromChannel(_0xa8e5xe,_0xa8e5xf)));var _0xa8e5x30={};_0xa8e5x30[getEndUserSearchQueryFromChannel(_0xa8e5xe)]= getValueFromPropertyName(_0xa8e5x10,getEndUserSearchPropertyFromChannel(_0xa8e5xe,_0xa8e5xf));return _0xa8e5x13[_0xbf02[22]][_0xbf02[55]](_0xbf02[75])[_0xbf02[21]](_0xa8e5x30,{Id:1,Name:1})[_0xbf02[54]]()}}function getEndUserSearchQueryFromChannel(_0xa8e5xe){var _0xa8e5x25=_0xbf02[56];if(_0xa8e5xe){switch(_0xa8e5xe){case _0xbf02[58]:_0xa8e5x25= _0xbf02[76];break;default:_0xa8e5x25= _0xbf02[76];logger[_0xbf02[18]](_0xbf02[59],_0xa8e5xe)}};return _0xa8e5x25}function getEndUserSearchPropertyFromChannel(_0xa8e5xe,_0xa8e5xf){var _0xa8e5x25=_0xbf02[56];if(_0xa8e5xe){switch(_0xa8e5xe){case _0xbf02[58]:if(_0xa8e5xf=== _0xbf02[77]){_0xa8e5x25= _0xbf02[78]}else {if(_0xa8e5xf=== _0xbf02[42]){_0xa8e5x25= _0xbf02[79]}};break;default:_0xa8e5x25= _0xbf02[79];logger[_0xbf02[18]](_0xbf02[59],_0xa8e5xe)}};return _0xa8e5x25}function getEndUserNamePropertyFromChannel(_0xa8e5xe,_0xa8e5xf){var _0xa8e5x25=_0xbf02[56];if(_0xa8e5xe){switch(_0xa8e5xe){case _0xbf02[58]:if(_0xa8e5xf=== _0xbf02[77]){_0xa8e5x25= _0xbf02[80]}else {if(_0xa8e5xf=== _0xbf02[42]){_0xa8e5x25= _0xbf02[81]}};break;default:_0xa8e5x25= _0xbf02[81];logger[_0xbf02[18]](_0xbf02[59],_0xa8e5xe)}};return _0xa8e5x25}function handleContact(_0xa8e5x13,_0xa8e5xe,_0xa8e5x28,_0xa8e5xf){return function(_0xa8e5x10){if(_0xa8e5x10[_0xbf02[65]]> 0){logger[_0xbf02[14]](_0xbf02[82],getValueFromPropertyName(_0xa8e5x28,getEndUserSearchPropertyFromChannel(_0xa8e5xe,_0xa8e5xf)));_0xa8e5x13[_0xbf02[83]]= _0xa8e5x10[0];return _0xa8e5x13[_0xbf02[83]]};logger[_0xbf02[14]](_0xbf02[84],getValueFromPropertyName(_0xa8e5x28,getEndUserSearchPropertyFromChannel(_0xa8e5xe,_0xa8e5xf)));return}}function searchLead(_0xa8e5x13,_0xa8e5xe,_0xa8e5x28,_0xa8e5xf){return function(_0xa8e5x10){if(!_0xa8e5x10){logger[_0xbf02[14]](_0xbf02[85],getValueFromPropertyName(_0xa8e5x28,getEndUserSearchPropertyFromChannel(_0xa8e5xe,_0xa8e5xf)));var _0xa8e5x30={};_0xa8e5x30[getEndUserSearchQueryFromChannel(_0xa8e5xe)]= getValueFromPropertyName(_0xa8e5x28,getEndUserSearchPropertyFromChannel(_0xa8e5xe,_0xa8e5xf));return _0xa8e5x13[_0xbf02[22]][_0xbf02[55]](_0xbf02[86])[_0xbf02[21]](_0xa8e5x30,{Id:1,Name:1})[_0xbf02[54]]()};return}}function handleLead(_0xa8e5x13,_0xa8e5xe,_0xa8e5x28,_0xa8e5xf){return function(_0xa8e5x10){if(_0xa8e5x10&& _0xa8e5x10[_0xbf02[65]]> 0){logger[_0xbf02[14]](_0xbf02[87],getValueFromPropertyName(_0xa8e5x28,getEndUserSearchPropertyFromChannel(_0xa8e5xe,_0xa8e5xf)));_0xa8e5x13[_0xbf02[83]]= _0xa8e5x10[0];return _0xa8e5x13[_0xbf02[83]]};return}}function leadCreation(_0xa8e5x13,_0xa8e5xe,_0xa8e5x28,_0xa8e5xf){return function(_0xa8e5x10){if(_0xa8e5x10|| _0xa8e5x13[_0xbf02[83]]){return};logger[_0xbf02[14]](_0xbf02[88],getValueFromPropertyName(_0xa8e5x28,getEndUserSearchPropertyFromChannel(_0xa8e5xe,_0xa8e5xf)));return _0xa8e5x13[_0xbf02[22]][_0xbf02[55]](_0xbf02[86])[_0xbf02[89]](getJsonForEndUserCreation(_0xa8e5xe,_0xa8e5x28,_0xa8e5xf))}}function getJsonForEndUserCreation(_0xa8e5xe,_0xa8e5x10,_0xa8e5xf){var _0xa8e5x39={Company:_0xbf02[90]};switch(_0xa8e5xe){case _0xbf02[58]:if(_0xa8e5xf=== _0xbf02[42]){if(isValidName(_0xa8e5x10[_0xbf02[81]])){_0xa8e5x39[_0xbf02[91]]= getValueFromPropertyName(_0xa8e5x10,getEndUserNamePropertyFromChannel(_0xa8e5xe,_0xa8e5xf))}else {_0xa8e5x39[_0xbf02[91]]= util[_0xbf02[63]](_0xbf02[92],getValueFromPropertyName(_0xa8e5x10,getEndUserSearchPropertyFromChannel(_0xa8e5xe,_0xa8e5xf)))}}else {if(_0xa8e5xf=== _0xbf02[77]){if(isValidName(_0xa8e5x10[_0xbf02[80]])){_0xa8e5x39[_0xbf02[91]]= getValueFromPropertyName(_0xa8e5x10,getEndUserNamePropertyFromChannel(_0xa8e5xe,_0xa8e5xf))}else {_0xa8e5x39[_0xbf02[91]]= util[_0xbf02[63]](_0xbf02[92],getValueFromPropertyName(_0xa8e5x10,getEndUserSearchPropertyFromChannel(_0xa8e5xe,_0xa8e5xf)))}}};_0xa8e5x39[_0xbf02[76]]= getValueFromPropertyName(_0xa8e5x10,getEndUserSearchPropertyFromChannel(_0xa8e5xe,_0xa8e5xf));break;default:logger[_0xbf02[18]](_0xbf02[59],_0xa8e5xe)};return _0xa8e5x39}function isValidName(_0xa8e5x3b){return _0xa8e5x3b&& _0xa8e5x3b!== _0xbf02[93]}function handleLeadCreation(_0xa8e5x13,_0xa8e5xe,_0xa8e5x28,_0xa8e5xf){return function(_0xa8e5x10){if(!_0xa8e5x10){return};if(_0xa8e5x10&& _0xa8e5x10[_0xbf02[94]]){logger[_0xbf02[14]](_0xbf02[95],getValueFromPropertyName(_0xa8e5x28,getEndUserSearchPropertyFromChannel(_0xa8e5xe,_0xa8e5xf)));_0xa8e5x13[_0xbf02[83]]= {Id:_0xa8e5x10[_0xbf02[49]]}};return}}function taskCreation(_0xa8e5x13,_0xa8e5x28,_0xa8e5x11){return function(){var _0xa8e5x3e={WhoId:_0xa8e5x13[_0xbf02[83]][_0xbf02[96]],OwnerId:_0xa8e5x13[_0xbf02[39]][_0xbf02[96]],ActivityDate:moment[_0xbf02[97]](),IsReminderSet:false,IsRecurrence:false,Subject:createSubjectFromConfiguration(_0xa8e5x13,_0xa8e5x28,_0xa8e5x11),Description:createDescriptionFromConfiguration(_0xa8e5x13,_0xa8e5x28,_0xa8e5x11)};var _0xa8e5x3f=createCustomFieldsFromConfiguration(_0xa8e5x13,_0xa8e5x28,_0xa8e5x11);if(_0xa8e5x3f[_0xbf02[65]]> 0){_[_0xbf02[99]](_0xa8e5x3f,function(_0xa8e5x40){_0xa8e5x3e[_0xa8e5x40[_0xbf02[49]]]= _0xa8e5x40[_0xbf02[98]]})};return _0xa8e5x13[_0xbf02[22]][_0xbf02[55]](_0xbf02[100])[_0xbf02[89]](_0xa8e5x3e)}}function createSubjectFromConfiguration(_0xa8e5x13,_0xa8e5x28,_0xa8e5x11){var _0xa8e5x42=_0xbf02[56];var _0xa8e5x43=[];if(_0xa8e5x13[_0xbf02[31]][_0xbf02[101]][_0xbf02[65]]> 0){var _0xa8e5x44=_[_0xbf02[102]](_0xa8e5x13[_0xbf02[31]].Subject,[_0xbf02[49]]);_[_0xbf02[99]](_0xa8e5x44,function(_0xa8e5x45){if(_0xa8e5x45[_0xbf02[103]]=== _0xbf02[104]){_0xa8e5x43[_0xbf02[106]](_0xa8e5x45[_0xbf02[105]])}else {if(_0xa8e5x45[_0xbf02[103]]=== _0xbf02[107]&& _0xa8e5x45[_0xbf02[108]]){var _0xa8e5x46=getValueFromPropertyName(_0xa8e5x28,_0xa8e5x45[_0xbf02[108]],_0xa8e5x13);if(_0xa8e5x46){_0xa8e5x43[_0xbf02[106]](_0xa8e5x46.toString())}}else {if(_0xa8e5x45[_0xbf02[103]]=== _0xbf02[109]&& _0xa8e5x45[_0xbf02[110]]&& _0xa8e5x45[_0xbf02[110]][_0xbf02[43]]){_0xa8e5x11[_0xa8e5x45[_0xbf02[110]][_0xbf02[43]]]&& _0xa8e5x43[_0xbf02[106]](_0xa8e5x11[_0xa8e5x45[_0xbf02[110]][_0xbf02[43]]].toString())}}}});_0xa8e5x42= _0xa8e5x43[_0xbf02[112]](_0xbf02[111])};return _0xa8e5x42}function createDescriptionFromConfiguration(_0xa8e5x13,_0xa8e5x28,_0xa8e5x11){var _0xa8e5x48=_0xbf02[56];var _0xa8e5x43=[];if(_0xa8e5x13[_0xbf02[31]][_0xbf02[113]][_0xbf02[65]]> 0){var _0xa8e5x49=_[_0xbf02[102]](_0xa8e5x13[_0xbf02[31]].Description,[_0xbf02[49]]);_[_0xbf02[99]](_0xa8e5x49,function(_0xa8e5x45){if(_0xa8e5x45[_0xbf02[103]]=== _0xbf02[104]){_0xa8e5x43[_0xbf02[106]](_0xa8e5x45[_0xbf02[105]])}else {if(_0xa8e5x45[_0xbf02[103]]=== _0xbf02[114]){if(_0xa8e5x45[_0xbf02[115]]=== _0xbf02[104]&& _0xa8e5x45[_0xbf02[116]]){_0xa8e5x43[_0xbf02[106]](util[_0xbf02[63]](_0xbf02[117],_0xa8e5x45[_0xbf02[116]],_0xa8e5x45[_0xbf02[118]]))}else {if(_0xa8e5x45[_0xbf02[115]]=== _0xbf02[107]&& _0xa8e5x45[_0xbf02[108]]&& _0xa8e5x45[_0xbf02[116]]){var _0xa8e5x46=getValueFromPropertyName(_0xa8e5x28,_0xa8e5x45[_0xbf02[108]],_0xa8e5x13);if(_0xa8e5x46){_0xa8e5x43[_0xbf02[106]](util[_0xbf02[63]](_0xbf02[117],_0xa8e5x45[_0xbf02[116]],_0xa8e5x46.toString()))}}else {if(_0xa8e5x45[_0xbf02[115]]=== _0xbf02[109]&& _0xa8e5x45[_0xbf02[110]]&& _0xa8e5x45[_0xbf02[110]][_0xbf02[43]]&& _0xa8e5x45[_0xbf02[116]]){_0xa8e5x11[_0xa8e5x45[_0xbf02[110]][_0xbf02[43]]]&& _0xa8e5x43[_0xbf02[106]](util[_0xbf02[63]](_0xbf02[117],_0xa8e5x45[_0xbf02[116]],_0xa8e5x11[_0xa8e5x45[_0xbf02[110]][_0xbf02[43]]]))}}}}}});_0xa8e5x48= _0xa8e5x43[_0xbf02[112]](_0xbf02[119])};return _0xa8e5x48}function createCustomFieldsFromConfiguration(_0xa8e5x13,_0xa8e5x28,_0xa8e5x11){var _0xa8e5x4b=[];var _0xa8e5x4c=[];if(_0xa8e5x13[_0xbf02[31]][_0xbf02[120]][_0xbf02[65]]> 0){_0xa8e5x4b= _0xa8e5x13[_0xbf02[31]][_0xbf02[120]];_[_0xbf02[99]](_0xa8e5x4b,function(_0xa8e5x40){if(_0xa8e5x40[_0xbf02[103]]=== _0xbf02[104]&& _0xa8e5x40[_0xbf02[121]]){_0xa8e5x4c[_0xbf02[106]]({id:_0xa8e5x40[_0xbf02[121]],value:_0xa8e5x40[_0xbf02[105]]})}else {if(_0xa8e5x40[_0xbf02[103]]=== _0xbf02[107]&& _0xa8e5x40[_0xbf02[108]]&& _0xa8e5x40[_0xbf02[121]]){var _0xa8e5x46=getValueFromPropertyName(_0xa8e5x28,_0xa8e5x40[_0xbf02[108]],_0xa8e5x13);if(_0xa8e5x46){_0xa8e5x4c[_0xbf02[106]]({id:_0xa8e5x40[_0xbf02[121]],value:_0xa8e5x46.toString()})}}else {if(_0xa8e5x40[_0xbf02[103]]=== _0xbf02[109]&& _0xa8e5x40[_0xbf02[121]]&& _0xa8e5x40[_0xbf02[110]]&& _0xa8e5x40[_0xbf02[110]][_0xbf02[43]]){_0xa8e5x11[_0xa8e5x40[_0xbf02[110]][_0xbf02[43]]]&& _0xa8e5x4c[_0xbf02[106]]({id:_0xa8e5x40[_0xbf02[121]],value:_0xa8e5x11[_0xa8e5x40[_0xbf02[110]][_0xbf02[43]]].toString()})}}}})};return _0xa8e5x4c}function handleTaskDisplay(_0xa8e5x13){return function(_0xa8e5x10){if(_0xa8e5x10&& _0xa8e5x10[_0xbf02[94]]){logger[_0xbf02[14]](_0xbf02[122],_0xa8e5x10[_0xbf02[49]]);_0xa8e5x13[_0xbf02[123]]= _0xa8e5x10[_0xbf02[49]];return};return}}function handleReportIntegration(_0xa8e5x13,_0xa8e5xe,_0xa8e5x10,_0xa8e5xc,_0xa8e5x12,_0xa8e5xf){return function(){delete _0xa8e5x10[_0xbf02[49]];delete _0xa8e5x10[_0xbf02[124]];delete _0xa8e5x10[_0xbf02[125]];_0xa8e5x10[_0xbf02[126]]= _0xbf02[127];_0xa8e5x10[_0xbf02[128]]= _0xa8e5xe;_0xa8e5x10[_0xbf02[129]]= _0xbf02[94];_0xa8e5x10[_0xbf02[130]]= _0xa8e5x13[_0xbf02[123]];_0xa8e5x10[_0xbf02[131]]= _0xa8e5xc;_0xa8e5x10[_0xbf02[132]]= _0xa8e5xf;_0xa8e5x10[_0xbf02[133]]= util[_0xbf02[63]](_0xbf02[134],_0xa8e5x13[_0xbf02[22]][_0xbf02[135]],_0xa8e5x13[_0xbf02[123]]);_0xa8e5x10[_0xbf02[136]]= _0xa8e5x13[_0xbf02[31]][_0xbf02[24]][_0xbf02[136]]?_0xa8e5x13[_0xbf02[31]][_0xbf02[24]][_0xbf02[136]]:_0xbf02[137];_0xa8e5x12[_0xbf02[139]](_0xbf02[138],_0xa8e5x10);delete _0xa8e5x10[_0xbf02[136]];return ReportIntegration[_0xbf02[89]](_0xa8e5x10)}}function handleEnd(_0xa8e5x13,_0xa8e5x10,_0xa8e5xe){return function(){logger[_0xbf02[14]](util[_0xbf02[63]](_0xbf02[140],_0xa8e5x13[_0xbf02[123]],_0xa8e5x13[_0xbf02[39]].Id));_0xa8e5x13= undefined;return}}function handleError(_0xa8e5x13,_0xa8e5xe,_0xa8e5x10,_0xa8e5xc){return function(_0xa8e5x51){logger[_0xbf02[18]](_0xbf02[141]);logger[_0xbf02[18]](_0xbf02[142],_0xa8e5x51[_0xbf02[143]]);logger[_0xbf02[18]](_0xbf02[144],_0xa8e5x51[_0xbf02[145]]);_0xa8e5x13= undefined;delete _0xa8e5x10[_0xbf02[49]];delete _0xa8e5x10[_0xbf02[124]];delete _0xa8e5x10[_0xbf02[125]];_0xa8e5x10[_0xbf02[126]]= _0xbf02[127];_0xa8e5x10[_0xbf02[128]]= _0xa8e5xe;_0xa8e5x10[_0xbf02[129]]= _0xbf02[146];_0xa8e5x10[_0xbf02[131]]= _0xa8e5xc;ReportIntegration[_0xbf02[89]](_0xa8e5x10)[_0xbf02[20]](function(){return})[_0xbf02[19]](function(_0xa8e5x51){logger[_0xbf02[18]](_0xbf02[147]);return})}}function stripTrailingSlash(_0xa8e5x53){if(_0xa8e5x53[_0xbf02[148]](-1) === _0xbf02[149]){return _0xa8e5x53[_0xbf02[148]](0,_0xa8e5x53[_0xbf02[65]]- 1)};return _0xa8e5x53}module[_0xbf02[150]]= Salesforce