-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
47 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2017-2019 Tom Misawa Tom Misawa ([email protected],https://github.com/riversun) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
import $ from 'jquery'; | ||
|
||
/** | ||
* ChatClient | ||
* | ||
* MIT License | ||
* | ||
* @author Tom Misawa ([email protected],https://github.com/riversun) | ||
*/ | ||
export default class ChatClient { | ||
|
||
constructor(opts) { | ||
|
@@ -17,7 +24,7 @@ export default class ChatClient { | |
|
||
this.errorResponse = { | ||
output: [ | ||
{type: "text", value: "An error occurred."} | ||
{type: 'text', value: 'An error occurred.'} | ||
] | ||
}; | ||
if (opts.errorResponse) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,9 @@ import {isMobileDevice} from './chat-ux-util.js'; | |
/** | ||
* To show chatWindow/chatArea and start/end button for chat interface | ||
* | ||
* @author Tom Misawa ([email protected]) | ||
* MIT License | ||
* | ||
* @author Tom Misawa ([email protected],https://github.com/riversun) | ||
*/ | ||
export default class ChatFrame { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,9 +3,11 @@ import BotUI from 'botui'; | |
|
||
|
||
/** | ||
* Chat user interface powered by BotUI ( forked ver. on https://github.com/riversun/botui) | ||
* Chat user interface powered by BotUI (forked ver. on https://github.com/riversun/botui) | ||
* | ||
* MIT License | ||
* @author Tom Misawa ([email protected]) | ||
* | ||
* @author Tom Misawa ([email protected],https://github.com/riversun) | ||
*/ | ||
export default class ChatUI { | ||
|
||
|
@@ -21,7 +23,7 @@ export default class ChatUI { | |
this.botInfo.widget = { | ||
sendLabel: 'SEND', | ||
placeHolder: 'Please input text.' | ||
} | ||
}; | ||
} | ||
} | ||
|
||
|
@@ -171,7 +173,7 @@ export default class ChatUI { | |
delayMs += message.delayMs; | ||
} | ||
|
||
if (resType == "text") { | ||
if (resType == 'text') { | ||
|
||
if (outIdx == 0) { | ||
//In the case of the first message, | ||
|
@@ -191,32 +193,32 @@ export default class ChatUI { | |
}); | ||
} | ||
|
||
} else if (resType == "image") { | ||
} else if (resType == 'image') { | ||
|
||
const type = null; | ||
const contentValue = '![image](' + message.value + ')'; | ||
this.handleContent(outIdx, loadingIconMsgIdx, type, contentValue, delayMs); | ||
|
||
} else if (resType == "youtube") { | ||
} else if (resType == 'youtube') { | ||
|
||
const type = 'embed'; | ||
const youtubeId = message.value; | ||
const contentValue = `<iframe src="https://www.youtube.com/embed/${youtubeId}" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>`; | ||
this.handleContent(outIdx, loadingIconMsgIdx, type, contentValue, delayMs); | ||
|
||
} else if (resType == "embed") { | ||
} else if (resType == 'embed') { | ||
|
||
const type = 'embed'; | ||
const contentValue = message.value; | ||
this.handleContent(outIdx, loadingIconMsgIdx, type, contentValue, delayMs); | ||
|
||
} else if (resType == "html") { | ||
} else if (resType == 'html') { | ||
|
||
const type = 'html'; | ||
const contentValue = message.value; | ||
this.handleContent(outIdx, loadingIconMsgIdx, type, contentValue, delayMs); | ||
|
||
} else if (resType == "window" && (this.opts.parent && this.opts.parent.getRenderMode() === 'pc')) { | ||
} else if (resType == 'window' && (this.opts.parent && this.opts.parent.getRenderMode() === 'pc')) { | ||
|
||
let _delayMs = delayMs; | ||
|
||
|
@@ -248,7 +250,7 @@ export default class ChatUI { | |
} | ||
|
||
} | ||
} else if (resType == "window" && (this.opts.parent && this.opts.parent.getRenderMode() === 'mobile')) { | ||
} else if (resType == 'window' && (this.opts.parent && this.opts.parent.getRenderMode() === 'mobile')) { | ||
|
||
const type = 'html'; | ||
let contentValue = null; | ||
|
@@ -282,11 +284,11 @@ export default class ChatUI { | |
} | ||
|
||
|
||
} else if (resType == "option") { | ||
} else if (resType == 'option') { | ||
|
||
const opts = message.options; | ||
|
||
let aboutOption = ""; | ||
let aboutOption = ''; | ||
|
||
if (aboutOption.length > 0) { | ||
if (outIdx == 0) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ import './app.css'; | |
* | ||
* MIT License | ||
* | ||
* @author Tom Misawa ([email protected]) | ||
* @author Tom Misawa ([email protected],https://github.com/riversun) | ||
*/ | ||
export default class ChatUx { | ||
|
||
|