@koredev/kore-web-sdk 10.2.1-rc.e88f49d → 10.3.0-rc.6a7ab2c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -71,7 +71,7 @@ include the following script in your html file and configure bot configurations
71
71
 
72
72
  ```js
73
73
 
74
- <script src="https://cdn.jsdelivr.net/npm/kore-web-sdk@10.2.1/dist/umd/kore-web-sdk-umd-chat.min.js"></script>
74
+ <script src="https://cdn.jsdelivr.net/npm/kore-web-sdk@10.3.0/dist/umd/kore-web-sdk-umd-chat.min.js"></script>
75
75
  <script>
76
76
  //chat window declaration
77
77
  var chatConfig=KoreChatSDK.chatConfig;
@@ -1 +1 @@
1
- var t={d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};t.d(e,{c:()=>a});var n=function(){function t(){}return t.prototype.appendPickerHTMLtoChatWindowFooter=function(t){this.hostInstance.chatEle.find(".kore-chat-footer .footerContainer").append(t)},t.prototype.installTextToSpeechTemplate=function(){var t=this,e=t.hostInstance.$;t.pickerHTML=e(t.getTextToSpeechTemplateString()),t.appendPickerHTMLtoChatWindowFooter(t.pickerHTML),t.bindEvents()},t.prototype.getTextToSpeechTemplateString=function(){return'<div class="sdkFooterIcon ttspeakerDiv ttsOff"> <button class="ttspeaker" title="Talk to speak"> <span class="ttsSpeakerEnable"></span> <span class="ttsSpeakerDisable"></span> <span style="display:none;"><audio id="ttspeaker" controls="" autoplay="" name="media"><source src="" type="audio/wav"></audio></span> </button> </div> '},t.prototype.bindEvents=function(){var t=this;(0,t.hostInstance.$)(t.pickerHTML).on("click",".ttspeaker",(function(e){t.OnSpeakerButtonClick&&t.OnSpeakerButtonClick()}))},t}();var o,s=(o=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},o(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});const a=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="BrowserTTS",e.speakWithWebAPI=function(t){if(!t)return!1;if("speechSynthesis"in window){window.speechSynthesis.cancel();var e=new SpeechSynthesisUtterance;e.text=t,window.speechSynthesis.speak(e)}else console.warn("KORE:Your browser doesn't support TTS(Speech Synthesiser)")},e}return s(e,t),e.prototype.onHostCreate=function(){var t=this;t.hostInstance.on("viewInit",(function(e){t.onInit()}))},e.prototype.onInit=function(){this.installTextToSpeechTemplate(),window.addEventListener("beforeunload",(function(t){"speechSynthesis"in window&&window.speechSynthesis.cancel()}))},e.prototype.OnSpeakerButtonClick=function(){var t=this,e=this,n=e.hostInstance.$,o=e.hostInstance;n(".ttspeakerDiv").hasClass("ttsOff")?(n(".ttspeakerDiv").removeClass("ttsOff"),o.on("afterRenderMessage",(function(n){var o=n.msgData;if("bot_response"===(null==o?void 0:o.type)&&!e.hostInstance.minimized&&!e.hostInstance.historyLoading){if(o.message[0]&&o.message[0].component&&"template"===o.message[0].component.type)t._txtToSpeak="";else try{t._txtToSpeak=o.message[0].component.payload.text?o.message[0].component.payload.text.replace(/\r?\n/g,". ."):"",t._txtToSpeak=e.hostInstance.helpers.checkMarkdowns(t._txtToSpeak),t._txtToSpeak=t._txtToSpeak.replace("___","<hr/>"),t._txtToSpeak=t._txtToSpeak.replace("---","<hr/>")}catch(e){t._txtToSpeak=""}o.message[0].component&&o.message[0].component.payload.speech_hint&&(t._txtToSpeak=o.message[0].component.payload.speech_hint),t._ttsConnection=e.speakWithWebAPI(t._txtToSpeak)}}))):(window.speechSynthesis.pause(),n(".ttspeakerDiv").addClass("ttsOff"))},e}(n);var p=e.c;export{p as BrowserTTS};
1
+ var t={d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};t.d(e,{c:()=>a});var n=function(){function t(){}return t.prototype.appendPickerHTMLtoChatWindowFooter=function(t){this.hostInstance.chatEle.find(".kore-chat-footer .footerContainer").append(t)},t.prototype.installTextToSpeechTemplate=function(){var t=this,e=t.hostInstance.$;t.pickerHTML=e(t.getTextToSpeechTemplateString()),t.appendPickerHTMLtoChatWindowFooter(t.pickerHTML),t.bindEvents()},t.prototype.getTextToSpeechTemplateString=function(){return'<div class="sdkFooterIcon ttspeakerDiv ttsOff"> <button class="ttspeaker" title="Talk to speak"> <span class="ttsSpeakerEnable"></span> <span class="ttsSpeakerDisable"></span> <span style="display:none;"><audio id="ttspeaker" controls="" autoplay="" name="media"><source src="" type="audio/wav"></audio></span> </button> </div> '},t.prototype.bindEvents=function(){var t=this;(0,t.hostInstance.$)(t.pickerHTML).on("click",".ttspeaker",(function(e){t.OnSpeakerButtonClick&&t.OnSpeakerButtonClick()}))},t}();var o,s=(o=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},o(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});const a=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="BrowserTTS",e.audioMsgs=[],e.audioPlaying=!1,e}return s(e,t),e.prototype.onHostCreate=function(){var t=this,e=t.hostInstance;e.on("viewInit",(function(e){t.onInit()})),e.on("onKeyDown",(function(e){e&&13==e.event.keyCode&&t.stop()})),e.on("beforeViewInit",(function(e){var n,o,s;null===(n=e.chatEle.find(".close-btn"))||void 0===n||n.on("click",(function(){t.stop()})),null===(o=e.chatEle.find(".reload-btn"))||void 0===o||o.on("click",(function(){t.stop()})),null===(s=e.chatEle.find(".minimize-btn"))||void 0===s||s.on("click",(function(){t.stop()}))}))},e.prototype.onInit=function(){var t=this;t.installTextToSpeechTemplate(),window.addEventListener("beforeunload",(function(e){t.stop()}))},e.prototype.OnSpeakerButtonClick=function(){var t=this,e=this,n=e.hostInstance.$,o=e.hostInstance;n(".ttspeakerDiv").hasClass("ttsOff")?(n(".ttspeakerDiv").removeClass("ttsOff"),o.on("afterRenderMessage",(function(n){var o=n.msgData;if("bot_response"===(null==o?void 0:o.type)&&!e.hostInstance.minimized&&!e.hostInstance.historyLoading){if(o.message[0]&&o.message[0].component&&"template"===o.message[0].component.type)t._txtToSpeak="";else try{t._txtToSpeak=o.message[0].component.payload.text?o.message[0].component.payload.text.replace(/\r?\n/g,". ."):"",t._txtToSpeak=e.hostInstance.helpers.checkMarkdowns(t._txtToSpeak),t._txtToSpeak=t._txtToSpeak.replace("___","<hr/>"),t._txtToSpeak=t._txtToSpeak.replace("---","<hr/>")}catch(e){t._txtToSpeak=""}o.message[0].component&&o.message[0].component.payload.speech_hint&&(t._txtToSpeak=o.message[0].component.payload.speech_hint),t.speakWithWebAPI(t._txtToSpeak)}}))):(window.speechSynthesis.pause(),n(".ttspeakerDiv").addClass("ttsOff"))},e.prototype.speakWithWebAPI=function(t){if(!t)return!1;"speechSynthesis"in window?(this.audioMsgs.push(t),this.playMessageSequence()):console.warn("KORE:Your browser doesn't support TTS(Speech Synthesiser)")},e.prototype.playMessageSequence=function(){var t=this;this.speechSyn||(this.speechSyn=new SpeechSynthesisUtterance),this.audioMsgs.length>0&&!this.audioPlaying&&(this.audioPlaying=!0,this.speechSyn.text=this.audioMsgs.shift(),window.speechSynthesis.speak(this.speechSyn),this.speechSyn.onend=function(){t.audioPlaying=!1,t.playMessageSequence()})},e.prototype.stop=function(){"speechSynthesis"in window&&(this.audioMsgs=[],this.audioPlaying=!1,window.speechSynthesis.cancel())},e}(n);var i=e.c;export{i as BrowserTTS};
@@ -6,10 +6,14 @@ import BaseTTS from "../BaseTTS";
6
6
  */
7
7
  declare class BrowserTTS extends BaseTTS {
8
8
  name: string;
9
- _ttsConnection: any;
9
+ speechSyn: any;
10
+ audioMsgs: any[];
11
+ audioPlaying: boolean;
10
12
  onHostCreate(): void;
11
13
  onInit(): void;
12
14
  OnSpeakerButtonClick(): void;
13
- speakWithWebAPI: (_txtToSpeak: string | undefined) => false | undefined;
15
+ speakWithWebAPI(_txtToSpeak: string | undefined): false | undefined;
16
+ playMessageSequence(): void;
17
+ stop(): void;
14
18
  }
15
19
  export default BrowserTTS;
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.BrowserTTSPluginSDK=t():e.BrowserTTSPluginSDK=t()}(self,(()=>(()=>{"use strict";var e={d:(t,o)=>{for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{BrowserTTS:()=>a});var o=function(){function e(){}return e.prototype.appendPickerHTMLtoChatWindowFooter=function(e){this.hostInstance.chatEle.find(".kore-chat-footer .footerContainer").append(e)},e.prototype.installTextToSpeechTemplate=function(){var e=this,t=e.hostInstance.$;e.pickerHTML=t(e.getTextToSpeechTemplateString()),e.appendPickerHTMLtoChatWindowFooter(e.pickerHTML),e.bindEvents()},e.prototype.getTextToSpeechTemplateString=function(){return'<div class="sdkFooterIcon ttspeakerDiv ttsOff"> <button class="ttspeaker" title="Talk to speak"> <span class="ttsSpeakerEnable"></span> <span class="ttsSpeakerDisable"></span> <span style="display:none;"><audio id="ttspeaker" controls="" autoplay="" name="media"><source src="" type="audio/wav"></audio></span> </button> </div> '},e.prototype.bindEvents=function(){var e=this;(0,e.hostInstance.$)(e.pickerHTML).on("click",".ttspeaker",(function(t){e.OnSpeakerButtonClick&&e.OnSpeakerButtonClick()}))},e}();var n,s=(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)});const a=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="BrowserTTS",t.speakWithWebAPI=function(e){if(!e)return!1;if("speechSynthesis"in window){window.speechSynthesis.cancel();var t=new SpeechSynthesisUtterance;t.text=e,window.speechSynthesis.speak(t)}else console.warn("KORE:Your browser doesn't support TTS(Speech Synthesiser)")},t}return s(t,e),t.prototype.onHostCreate=function(){var e=this;e.hostInstance.on("viewInit",(function(t){e.onInit()}))},t.prototype.onInit=function(){this.installTextToSpeechTemplate(),window.addEventListener("beforeunload",(function(e){"speechSynthesis"in window&&window.speechSynthesis.cancel()}))},t.prototype.OnSpeakerButtonClick=function(){var e=this,t=this,o=t.hostInstance.$,n=t.hostInstance;o(".ttspeakerDiv").hasClass("ttsOff")?(o(".ttspeakerDiv").removeClass("ttsOff"),n.on("afterRenderMessage",(function(o){var n=o.msgData;if("bot_response"===(null==n?void 0:n.type)&&!t.hostInstance.minimized&&!t.hostInstance.historyLoading){if(n.message[0]&&n.message[0].component&&"template"===n.message[0].component.type)e._txtToSpeak="";else try{e._txtToSpeak=n.message[0].component.payload.text?n.message[0].component.payload.text.replace(/\r?\n/g,". ."):"",e._txtToSpeak=t.hostInstance.helpers.checkMarkdowns(e._txtToSpeak),e._txtToSpeak=e._txtToSpeak.replace("___","<hr/>"),e._txtToSpeak=e._txtToSpeak.replace("---","<hr/>")}catch(t){e._txtToSpeak=""}n.message[0].component&&n.message[0].component.payload.speech_hint&&(e._txtToSpeak=n.message[0].component.payload.speech_hint),e._ttsConnection=t.speakWithWebAPI(e._txtToSpeak)}}))):(window.speechSynthesis.pause(),o(".ttspeakerDiv").addClass("ttsOff"))},t}(o);return t})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.BrowserTTSPluginSDK=t():e.BrowserTTSPluginSDK=t()}(self,(()=>(()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{BrowserTTS:()=>i});var n=function(){function e(){}return e.prototype.appendPickerHTMLtoChatWindowFooter=function(e){this.hostInstance.chatEle.find(".kore-chat-footer .footerContainer").append(e)},e.prototype.installTextToSpeechTemplate=function(){var e=this,t=e.hostInstance.$;e.pickerHTML=t(e.getTextToSpeechTemplateString()),e.appendPickerHTMLtoChatWindowFooter(e.pickerHTML),e.bindEvents()},e.prototype.getTextToSpeechTemplateString=function(){return'<div class="sdkFooterIcon ttspeakerDiv ttsOff"> <button class="ttspeaker" title="Talk to speak"> <span class="ttsSpeakerEnable"></span> <span class="ttsSpeakerDisable"></span> <span style="display:none;"><audio id="ttspeaker" controls="" autoplay="" name="media"><source src="" type="audio/wav"></audio></span> </button> </div> '},e.prototype.bindEvents=function(){var e=this;(0,e.hostInstance.$)(e.pickerHTML).on("click",".ttspeaker",(function(t){e.OnSpeakerButtonClick&&e.OnSpeakerButtonClick()}))},e}();var o,s=(o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},o(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});const i=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="BrowserTTS",t.audioMsgs=[],t.audioPlaying=!1,t}return s(t,e),t.prototype.onHostCreate=function(){var e=this,t=e.hostInstance;t.on("viewInit",(function(t){e.onInit()})),t.on("onKeyDown",(function(t){t&&13==t.event.keyCode&&e.stop()})),t.on("beforeViewInit",(function(t){var n,o,s;null===(n=t.chatEle.find(".close-btn"))||void 0===n||n.on("click",(function(){e.stop()})),null===(o=t.chatEle.find(".reload-btn"))||void 0===o||o.on("click",(function(){e.stop()})),null===(s=t.chatEle.find(".minimize-btn"))||void 0===s||s.on("click",(function(){e.stop()}))}))},t.prototype.onInit=function(){var e=this;e.installTextToSpeechTemplate(),window.addEventListener("beforeunload",(function(t){e.stop()}))},t.prototype.OnSpeakerButtonClick=function(){var e=this,t=this,n=t.hostInstance.$,o=t.hostInstance;n(".ttspeakerDiv").hasClass("ttsOff")?(n(".ttspeakerDiv").removeClass("ttsOff"),o.on("afterRenderMessage",(function(n){var o=n.msgData;if("bot_response"===(null==o?void 0:o.type)&&!t.hostInstance.minimized&&!t.hostInstance.historyLoading){if(o.message[0]&&o.message[0].component&&"template"===o.message[0].component.type)e._txtToSpeak="";else try{e._txtToSpeak=o.message[0].component.payload.text?o.message[0].component.payload.text.replace(/\r?\n/g,". ."):"",e._txtToSpeak=t.hostInstance.helpers.checkMarkdowns(e._txtToSpeak),e._txtToSpeak=e._txtToSpeak.replace("___","<hr/>"),e._txtToSpeak=e._txtToSpeak.replace("---","<hr/>")}catch(t){e._txtToSpeak=""}o.message[0].component&&o.message[0].component.payload.speech_hint&&(e._txtToSpeak=o.message[0].component.payload.speech_hint),e.speakWithWebAPI(e._txtToSpeak)}}))):(window.speechSynthesis.pause(),n(".ttspeakerDiv").addClass("ttsOff"))},t.prototype.speakWithWebAPI=function(e){if(!e)return!1;"speechSynthesis"in window?(this.audioMsgs.push(e),this.playMessageSequence()):console.warn("KORE:Your browser doesn't support TTS(Speech Synthesiser)")},t.prototype.playMessageSequence=function(){var e=this;this.speechSyn||(this.speechSyn=new SpeechSynthesisUtterance),this.audioMsgs.length>0&&!this.audioPlaying&&(this.audioPlaying=!0,this.speechSyn.text=this.audioMsgs.shift(),window.speechSynthesis.speak(this.speechSyn),this.speechSyn.onend=function(){e.audioPlaying=!1,e.playMessageSequence()})},t.prototype.stop=function(){"speechSynthesis"in window&&(this.audioMsgs=[],this.audioPlaying=!1,window.speechSynthesis.cancel())},t}(n);return t})()));
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@koredev/kore-web-sdk","version":"10.2.1-rc.e88f49d","description":"Kore.ai offers Bots SDKs as a set of platform-specific client libraries that provide a quick and convenient way to integrate Kore.ai Bots chat capability into custom applications","main":"dist/esm/exports.js","types":"dist/esm/exports.d.ts","module":"dist/esm/exports.js","repository":{"type":"git","url":"git@github.com:Koredotcom/web-kore-sdk.git#v2/10.2.1"},"author":"Rajasekhar Balla","license":"MIT","bugs":{"url":"https://github.com/Koredotcom/web-kore-sdk/issues"},"homepage":"https://github.com/Koredotcom/web-kore-sdk#readme","sideEffects":["**/*.css","**/*.scss","src/exports/exports.js"]}
1
+ {"name":"@koredev/kore-web-sdk","version":"10.3.0-rc.6a7ab2c","description":"Kore.ai offers Bots SDKs as a set of platform-specific client libraries that provide a quick and convenient way to integrate Kore.ai Bots chat capability into custom applications","main":"dist/esm/exports.js","types":"dist/esm/exports.d.ts","module":"dist/esm/exports.js","repository":{"type":"git","url":"git@github.com:Koredotcom/web-kore-sdk.git#v2/10.3.0"},"author":"Rajasekhar Balla","license":"MIT","bugs":{"url":"https://github.com/Koredotcom/web-kore-sdk/issues"},"homepage":"https://github.com/Koredotcom/web-kore-sdk#readme","sideEffects":["**/*.css","**/*.scss","src/exports/exports.js"]}