+++ /dev/null
-"use strict";function config(e){e.html5Mode(!0)}function IndexController(e,o,n,s,t){function a(e){r.host=e.returnValue["/Motion/Host"]}function i(e){r.online&&e.number&&(r.phone=e.number,r.dial())}function c(e){switch(console.log(e),u){case"salesforce-lightning":sforce.opencti.screenPop({type:sforce.opencti.SCREENPOP_TYPE.SOBJECT,params:{recordId:e.recordId}});break;case"salesforce-classic":sforce.interaction.screenPop(e.recordId,!0);break;case"salesforce-desk":desk.interaction.screenPop(e.recordId.toString(),"object=case");break;default:console.log("unknown integration")}}function l(e,n){o.parent.postMessage({id:"salesforce-classic"===u?"scc_widget_SoftphoneIframe":null,tag:"salesforce-desk"===u?"iframe":null,className:"salesforce-lightning"===u?"openctiSoftPhone":null,uniqueid:n,options:{url:e}},"*")}var r=this,d=null,u=null,f={},p=null;r.phone="",r.inCall=!1,r.compose=function(e){r.phone=r.phone.concat(e)},r.remove=function(){r.phone=r.phone.substring(0,r.phone.length-1)},r.hangup=function(){l("http://localhost:9888/api/hangup",Date.now())},r.dial=function(){var e=Date.now();r.inCall?l("http://localhost:9888/api/answer",e):l("http://localhost:9888/api/originate/"+r.phone,e)},s.search().mode&&"lightning"===s.search().mode.toLowerCase()?(u="salesforce-lightning",d="js/salesforce/lightning.js"):s.search().type&&"desk"===s.search().type.toLowerCase()?(u="salesforce-desk",d="js/salesforce/interaction-desk.js"):(u="salesforce-classic",d="js/salesforce/interaction.js"),angular.element(document.createElement("base")).href=window.location.pathname,t.loadScript(d).then(function(){switch(console.log("Script loaded succesfully",u),u){case"salesforce-lightning":sforce.opencti.getCallCenterSettings({callback:a}),sforce.opencti.enableClickToDial(),sforce.opencti.onClickToDial({listener:i});break;case"salesforce-classic":sforce.interaction.cti.getCallCenterSettings(function(e){r.host=JSON.parse(e.result)["/Motion/Host"]}),sforce.interaction.cti.enableClickToDial(),sforce.interaction.cti.onClickToDial(i);break;case"salesforce-desk":r.host=s.search().host,desk.ready(function(e){desk.interaction.cti.enableClickToDial(),desk.interaction.cti.onClickToDial(i)});break;default:console.log("unknown integration")}}).catch(function(e){console.error(e)}),n(function(){var e=Date.now();f[e]=function(e){if(e.response&&e.response.status>=200&&e.response.status<300){var o=JSON.parse(e.response.message);console.log("message",o),r.id=o.id,r.name=o.name,r.fullname=o.fullname,r.accountcode=o.accountcode,r.online=!0,p||r.host&&r.id&&(console.log("host",r.host),console.log("id",r.id),(p=io(r.host,{query:{id:r.id},autoConnect:!1,transports:["websocket","polling"]})).on("trigger:salesforce:display",c),p.on("trigger:desk:display",c)),p&&p.disconnected&&p.connect()}else r.online=!1},l("http://localhost:9888/api/agent",e)},2e3),n(function(){var e=Date.now();f[e]=function(e){if(e.response&&e.response.status>=200&&e.response.status<300){var o=JSON.parse(e.response.message);console.log("checkStatus",o),console.log("inCall",_.isArray(o)&&_.find(o,{stateId:8})),r.inCall=_.isArray(o)&&_.find(o,{stateId:8})}else r.inCall=!1},l("http://localhost:9888/api/calls",e)},2e3),o.addEventListener("message",function(o){var n=o.data;f[n.uniqueid]&&(f[n.uniqueid](n),delete f[n.uniqueid],e.$apply())},!1)}config.$inject=["$locationProvider"],IndexController.$inject=["$scope","$window","$interval","$location","angularLoad"];var motion=angular.module("motion",["ngMaterial","angularLoad"]);motion.config(config),motion.controller("IndexController",IndexController);
\ No newline at end of file
--- /dev/null
+"use strict";function config(e){e.html5Mode(!0)}function IndexController(e,n,o,t,s){function i(e){r.host=e.returnValue["/Motion/Host"]}function a(e){r.online&&e.number&&(r.phone=e.number,r.dial())}function c(e){switch(d){case"salesforce-lightning":sforce.opencti.screenPop({type:sforce.opencti.SCREENPOP_TYPE.SOBJECT,params:{recordId:e.recordId}});break;case"salesforce-classic":sforce.interaction.screenPop(e.recordId,!0);break;case"salesforce-desk":desk.interaction.screenPop(e.recordId.toString(),"object=case");break;default:console.log("unknown integration")}}function l(e,o){n.parent.postMessage({id:"salesforce-classic"===d?"scc_widget_SoftphoneIframe":null,tag:"salesforce-desk"===d?"iframe":null,className:"salesforce-lightning"===d?"openctiSoftPhone":null,uniqueid:o,options:{url:e}},"*")}var r=this,u=null,d=null,f={},p={},h=null;r.phone="",r.inCall=!1,r.compose=function(e){r.phone=r.phone.concat(e)},r.remove=function(){r.phone=r.phone.substring(0,r.phone.length-1)},r.hangup=function(){var e=Date.now();r.phone="",l("http://localhost:9888/api/hangup",e)},r.dial=function(){var e=Date.now();l("http://localhost:9888/api/originate/"+r.phone,e),l("http://localhost:9888/api/answer",e)},t.search().mode&&"lightning"===t.search().mode.toLowerCase()?(d="salesforce-lightning",u="js/salesforce/lightning.js"):t.search().type&&"desk"===t.search().type.toLowerCase()?(d="salesforce-desk",u="js/salesforce/interaction-desk.js"):(d="salesforce-classic",u="js/salesforce/interaction.js"),angular.element(document.createElement("base")).href=window.location.pathname,s.loadScript(u).then(function(){switch(console.log("Script loaded succesfully",d),d){case"salesforce-lightning":sforce.opencti.getCallCenterSettings({callback:i}),sforce.opencti.enableClickToDial(),sforce.opencti.onClickToDial({listener:a});break;case"salesforce-classic":sforce.interaction.cti.getCallCenterSettings(function(e){r.host=JSON.parse(e.result)["/Motion/Host"]}),sforce.interaction.cti.enableClickToDial(),sforce.interaction.cti.onClickToDial(a);break;case"salesforce-desk":r.host=t.search().host,desk.ready(function(e){desk.interaction.cti.enableClickToDial(),desk.interaction.cti.onClickToDial(a)});break;default:console.log("unknown integration")}}).catch(function(e){console.error(e)}),o(function(){var e=Date.now();f[e]=function(e){if(e.response&&e.response.status>=200&&e.response.status<300){var n=JSON.parse(e.response.message);r.id=n.id,r.name=n.name,r.fullname=n.fullname,r.accountcode=n.accountcode,r.online=!0,h||r.host&&r.id&&(console.log("host",r.host),console.log("id",r.id),(h=io(r.host,{query:{id:r.id},autoConnect:!1,transports:["websocket","polling"]})).on("trigger:salesforce:display",c),h.on("trigger:desk:display",c)),h&&h.disconnected&&h.connect()}else r.online=!1},l("http://localhost:9888/api/agent",e)},2e3),o(function(){var e=Date.now();p[e]=function(e){if(e.response&&e.response.status>=200&&e.response.status<300){var n=JSON.parse(e.response.message);_.isArray(n)&&_.find(n,{stateId:8})?r.inCall=!0:r.inCall=!1}else r.inCall=!1},l("http://localhost:9888/api/calls",e)},2e3),n.addEventListener("message",function(n){var o=n.data;f[o.uniqueid]?(f[o.uniqueid](o),delete f[o.uniqueid]):p[o.uniqueid]&&(p[o.uniqueid](o),delete p[o.uniqueid]),e.$apply()},!1)}config.$inject=["$locationProvider"],IndexController.$inject=["$scope","$window","$interval","$location","angularLoad"];var motion=angular.module("motion",["ngMaterial","angularLoad"]);motion.config(config),motion.controller("IndexController",IndexController);
\ No newline at end of file
document.write("<base href='" + window.location.pathname + "' />");
</script>
- <script src="app.1674737f.js"></script>
+ <script src="app.bb6e91b1.js"></script>
</body>
</html>