File tree Expand file tree Collapse file tree 5 files changed +43
-13
lines changed Expand file tree Collapse file tree 5 files changed +43
-13
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " qa_bot" ,
3
- "version" : " 0.1.0 " ,
3
+ "version" : " 0.1.1 " ,
4
4
"private" : true ,
5
5
"homepage" : " ." ,
6
6
"dependencies" : {
Original file line number Diff line number Diff line change
1
+ .rcb-toggle-button .rcb-button-show {
2
+ background-size : 72% ;
3
+ background-position : center;
4
+ background-repeat : no-repeat;
5
+ background-color : rgb (26 , 91 , 110 );
6
+ }
1
7
.rcb-chat-window {
2
8
width : 550px !important ;
3
- max-width : calc (100% - 2.5 rem );
9
+ max-width : calc (100% );
4
10
5
11
.rcb-bot-avatar {
6
12
background-size : contain;
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ const handleQuery = async (params) => {
10
10
try {
11
11
const requestOptions = {
12
12
method : 'POST' ,
13
- headers : {
13
+ headers : {
14
14
'Content-Type' : 'application/json' ,
15
15
'X-API-KEY' : apiKey
16
16
} ,
@@ -55,16 +55,15 @@ const MyChatBot = (props) => {
55
55
return 'loop'
56
56
}
57
57
}
58
-
59
58
}
60
59
return (
61
- < ChatBot
60
+ < ChatBot
62
61
options = { {
63
- theme : {
62
+ theme : {
64
63
primaryColor : '#1a5b6e' ,
65
64
secondaryColor : '#107180' ,
66
65
fontFamily : 'Arial, sans-serif' ,
67
- embedded : props . embedded ,
66
+ embedded : props . embedded ,
68
67
} ,
69
68
header : {
70
69
title : 'ACCESS Q&A Bot' ,
@@ -75,11 +74,11 @@ const MyChatBot = (props) => {
75
74
disabledPlaceholderText : 'Please log in to ask questions.' ,
76
75
disabled : props . disabled
77
76
} ,
78
- chatHistory : { storageKey : "qa_bot" } ,
79
- botBubble : {
77
+ chatHistory : { disabled : true } ,
78
+ botBubble : {
80
79
simStream : true ,
81
80
dangerouslySetInnerHtml : true
82
- } ,
81
+ } ,
83
82
isOpen : false ,
84
83
chatButton : {
85
84
icon : 'https://support.access-ci.org/themes/contrib/asp-theme/images/icons/ACCESS-arrrow.svg' ,
@@ -110,7 +109,7 @@ const MyChatBot = (props) => {
110
109
function App ( props ) {
111
110
return (
112
111
< div className = "access-qa-bot" >
113
- < MyChatBot embedded = { props . embedded } welcome = { props . welcome } prompt = { props . prompt } disabled = { props . disabled } />
112
+ < MyChatBot embedded = { props . embedded } welcome = { props . welcome } prompt = { props . prompt } disabled = { props . disabled } />
114
113
</ div >
115
114
) ;
116
115
}
Original file line number Diff line number Diff line change @@ -37,6 +37,31 @@ embeddedQABots.forEach(embeddedQABot => {
37
37
embeddedQABot . appendChild ( embeddedDomNode ) ;
38
38
} ) ;
39
39
40
+ // attach login event to the disabled chatbot input
41
+ const loginHandler = ( ) => {
42
+ if ( disabled ) {
43
+ const loginUrl = '/login?destination=' + window . location . pathname ;
44
+ window . location = loginUrl ;
45
+ }
46
+ }
47
+ const addCustomEventListener = ( selector , event , handler ) => {
48
+ let rootElement = document . querySelector ( 'body' ) ;
49
+ rootElement . addEventListener ( event , function ( evt ) {
50
+ var targetElement = evt . target ;
51
+ while ( targetElement != null ) {
52
+ if ( targetElement . matches ( selector ) ) {
53
+ handler ( evt ) ;
54
+ return ;
55
+ }
56
+ targetElement = targetElement . parentElement ;
57
+ }
58
+ } ,
59
+ true
60
+ ) ;
61
+ }
62
+ //adding the Event Listeners to all the chatbot instances
63
+ addCustomEventListener ( '.rcb-chat-input' , 'click' , loginHandler ) ;
64
+
40
65
// If you want to start measuring performance in your app, pass a function
41
66
// to log results (for example: reportWebVitals(console.log))
42
67
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
You can’t perform that action at this time.
0 commit comments