From b9bb819492335571852126bab334759a3f83d666 Mon Sep 17 00:00:00 2001 From: Daniele Cinti Date: Thu, 17 Aug 2017 14:29:25 +0200 Subject: [PATCH] Built xcally-motion-dialpad from commit 9260cae.|1.0.64 --- app.3c9602d0.js | 1 - app.53e7bbee.js | 1 + index.html | 2 +- js/salesforce/interaction-desk.js | 1 + 4 files changed, 3 insertions(+), 2 deletions(-) delete mode 100644 app.3c9602d0.js create mode 100644 app.53e7bbee.js create mode 100644 js/salesforce/interaction-desk.js diff --git a/app.3c9602d0.js b/app.3c9602d0.js deleted file mode 100644 index 614c258..0000000 --- a/app.3c9602d0.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";function config(n){n.html5Mode(!0)}function IndexController(n,e,o,t,i){function l(n){sforce.opencti.screenPop({type:sforce.opencti.SCREENPOP_TYPE.SOBJECT,params:{recordId:n.recordId}})}function a(n,o){console.log(e.parent),e.parent.postMessage({id:s.lightning?null:"scc_widget_SoftphoneIframe",className:s.lightning?"openctiSoftPhone":null,uniqueid:o,options:{url:n}},"*")}var c,s=this;console.log("$location",t.search()),s.phone="",s.inCall=!1,s.lightning=t.search().mode&&"lightning"===t.search().mode.toLowerCase(),s.callbacks={},s.compose=function(n){s.phone=s.phone.concat(n)},s.remove=function(){s.phone=s.phone.substring(0,s.phone.length-1)},s.hangup=function(){var n=Date.now();s.callbacks[n]=function(){s.inCall=!1},a("http://localhost:9888/api/hangup",n)},s.dial=function(){var n=Date.now();s.callbacks[n]=function(){s.inCall=!0},a("http://localhost:9888/api/originate/"+s.phone,n)},s.keepalive=function(){var n=Date.now();s.callbacks[n]=function(n){if(n.response&&n.response.status>=200&&n.response.status<300){var e=JSON.parse(n.response.message);s.id=e.id,s.displayName=e.displayName,s.internal=e.internal,s.online=!0,c||s.host&&s.id&&(c=io(s.host,{query:{id:s.id},autoConnect:!1,transports:["websocket","polling"]})).on("trigger:salesforce:display",l),c&&c.disconnected&&c.connect()}else s.online=!1},a("http://localhost:9888/api/agent",n)},s.checkStatus=function(){var n=Date.now();s.callbacks[n]=function(n){if(n.response&&n.response.status>=200&&n.response.status<300){var e=JSON.parse(n.response.message);s.inCall=!!e.length}else s.inCall=!1},a("http://localhost:9888/api/calls",n)},angular.element(document.createElement("base")).href=window.location.pathname,i.loadScript(s.lightning?"js/salesforce/lightning.js":"js/salesforce/interaction.js").then(function(){console.log("Script loaded succesfully"),s.lightning?sforce.opencti.getCallCenterSettings({callback:function(n){s.host=n.returnValue["/Motion/Host"]}}):sforce.interaction.cti.getCallCenterSettings({callback:function(n){s.host=n.returnValue["/Motion/Host"]}}),s.lightning?sforce.opencti.enableClickToDial({callback:function(n){console.log("enableClickToDial")}}):sforce.interaction.cti.enableClickToDial({callback:function(n){console.log("enableClickToDial")}}),s.lightning?sforce.opencti.onClickToDial({listener:function(n){s.online&&n.number&&(s.phone=n.number,s.dial())}}):sforce.interaction.cti.onClickToDial({listener:function(n){s.online&&n.number&&(s.phone=n.number,s.dial())}})}).catch(function(n){console.error(n)}),o(s.keepalive,2e3),o(s.checkStatus,2e3),e.addEventListener("message",function(e){var o=e.data;s.callbacks[o.uniqueid]&&(s.callbacks[o.uniqueid](o),delete s.callbacks[o.uniqueid],n.$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 diff --git a/app.53e7bbee.js b/app.53e7bbee.js new file mode 100644 index 0000000..38d62d7 --- /dev/null +++ b/app.53e7bbee.js @@ -0,0 +1 @@ +"use strict";function config(e){e.html5Mode(!0)}function IndexController(e,n,o,i,a){function l(e){sforce.opencti.screenPop({type:sforce.opencti.SCREENPOP_TYPE.SOBJECT,params:{recordId:e.recordId}})}function t(e,o){n.parent.postMessage({id:s.lightning?null:"scc_widget_SoftphoneIframe",className:s.lightning?"openctiSoftPhone":null,uniqueid:o,options:{url:e}},"*")}var c,s=this;console.log("$location",i.search()),s.phone="",s.inCall=!1,s.version=null,s.uriVersion=null,i.search().mode&&"lightning"===i.search().mode.toLowerCase()?(s.version="salesforce-lightning",s.uriVersion="js/salesforce/lightning.js"):i.search().type&&"desk"===i.search().type.toLowerCase()?(s.version="salesforce-desk",s.uriVersion="js/salesforce/interaction-desk.js"):(s.version="salesforce-classic",s.uriVersion="js/salesforce/interaction.js"),s.callbacks={},s.compose=function(e){s.phone=s.phone.concat(e)},s.remove=function(){s.phone=s.phone.substring(0,s.phone.length-1)},s.hangup=function(){var e=Date.now();s.callbacks[e]=function(){s.inCall=!1},t("http://localhost:9888/api/hangup",e)},s.dial=function(){var e=Date.now();s.callbacks[e]=function(){s.inCall=!0},t("http://localhost:9888/api/originate/"+s.phone,e)},s.keepalive=function(){var e=Date.now();s.callbacks[e]=function(e){if(e.response&&e.response.status>=200&&e.response.status<300){var n=JSON.parse(e.response.message);s.id=n.id,s.displayName=n.displayName,s.internal=n.internal,s.online=!0,c||s.host&&s.id&&(c=io(s.host,{query:{id:s.id},autoConnect:!1,transports:["websocket","polling"]})).on("trigger:salesforce:display",l),c&&c.disconnected&&c.connect()}else s.online=!1},t("http://localhost:9888/api/agent",e)},s.checkStatus=function(){var e=Date.now();s.callbacks[e]=function(e){if(e.response&&e.response.status>=200&&e.response.status<300){var n=JSON.parse(e.response.message);s.inCall=!!n.length}else s.inCall=!1},t("http://localhost:9888/api/calls",e)},angular.element(document.createElement("base")).href=window.location.pathname,a.loadScript(s.uriVersion).then(function(){switch(console.log("Script loaded succesfully",s.version),s.version){case"salesforce-lightning":sforce.opencti.getCallCenterSettings({callback:function(e){s.host=e.returnValue["/Motion/Host"]}}),sforce.opencti.enableClickToDial({callback:function(e){console.log("enableClickToDial")}}),sforce.opencti.onClickToDial({listener:function(e){s.online&&e.number&&(s.phone=e.number,s.dial())}});break;case"salesforce-classic":sforce.interaction.cti.getCallCenterSettings({callback:function(e){s.host=e.returnValue["/Motion/Host"]}}),sforce.interaction.cti.enableClickToDial({callback:function(e){console.log("enableClickToDial")}}),sforce.interaction.cti.onClickToDial({listener:function(e){s.online&&e.number&&(s.phone=e.number,s.dial())}});break;case"salesforce-desk":s.host=i.search().host,sforce.interaction.cti.enableClickToDial({callback:function(e){console.log("enableClickToDial")}}),sforce.interaction.cti.onClickToDial({listener:function(e){s.online&&e.number&&(s.phone=e.number,s.dial())}})}}).catch(function(e){console.error(e)}),o(s.keepalive,2e3),o(s.checkStatus,2e3),n.addEventListener("message",function(n){var o=n.data;s.callbacks[o.uniqueid]&&(s.callbacks[o.uniqueid](o),delete s.callbacks[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 diff --git a/index.html b/index.html index 509a9ec..738019b 100644 --- a/index.html +++ b/index.html @@ -56,7 +56,7 @@ document.write(""); - + diff --git a/js/salesforce/interaction-desk.js b/js/salesforce/interaction-desk.js new file mode 100644 index 0000000..77fc080 --- /dev/null +++ b/js/salesforce/interaction-desk.js @@ -0,0 +1 @@ +!function(e,n){function t(){a=!0,n.removeEventListener("DOMContentLoaded",t),e.removeEventListener("load",t),d()}function o(){r=!0,c.onload=null,d()}function d(){var e;if(a&&r)for(;e=s.readyQueue.shift();)e()}var a=!1,r=!1,i=e.desk,s=e.desk={};s.VERSION="0.1.0",s.readyQueue=[];var c=n.createElement("script");c.async=!0,c.src="//ajax.deskapi.com/libs/desk/opencti/"+s.VERSION+"/deskcti.min.js";var u=n.getElementsByTagName("script")[0];u.parentNode.insertBefore(c,u),s.ready=function(e){s.readyQueue.push(e),d()},s.noConflict=function(){return e.desk=i,s},n.addEventListener("DOMContentLoaded",t,!1),e.addEventListener("load",t,!1),c.onload=o}(window,document); -- 1.7.1