bibot 1.0.31 → 1.0.33
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/dist/component/bibot.d.ts +3 -1
- package/dist/hooks/useBiBotChatBot.d.ts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +28 -19
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +28 -19
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
interface bubbleProps {
|
|
3
3
|
clientId: string;
|
|
4
|
+
client_session_id?: string;
|
|
5
|
+
redirect_notice?: boolean;
|
|
4
6
|
}
|
|
5
|
-
declare const ChatBubbleBiBot: ({ clientId }: bubbleProps) => React.JSX.Element;
|
|
7
|
+
declare const ChatBubbleBiBot: ({ clientId, client_session_id, redirect_notice }: bubbleProps) => React.JSX.Element;
|
|
6
8
|
export default ChatBubbleBiBot;
|
|
@@ -2,6 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import { predefinedQuestionsType } from '../services/plugin-api';
|
|
3
3
|
interface UseBiBotChatBotProps {
|
|
4
4
|
clientId: string;
|
|
5
|
+
client_session_id?: string;
|
|
6
|
+
redirect_notice?: boolean;
|
|
5
7
|
}
|
|
6
8
|
interface ChatBubbleConfigProps {
|
|
7
9
|
bgColor?: string;
|
|
@@ -9,7 +11,7 @@ interface ChatBubbleConfigProps {
|
|
|
9
11
|
title?: string;
|
|
10
12
|
logo_url?: string;
|
|
11
13
|
}
|
|
12
|
-
declare const useBiBotChatBot: ({ clientId }: UseBiBotChatBotProps) => {
|
|
14
|
+
declare const useBiBotChatBot: ({ clientId, client_session_id }: UseBiBotChatBotProps) => {
|
|
13
15
|
chatIsOpen: boolean;
|
|
14
16
|
messages: {
|
|
15
17
|
sender: 'user' | 'bot';
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import * as React from 'react';
|
|
|
2
2
|
import './styles.css';
|
|
3
3
|
interface Props {
|
|
4
4
|
clientId: string;
|
|
5
|
+
client_session_id?: string;
|
|
6
|
+
redirect_notice?: boolean;
|
|
5
7
|
}
|
|
6
|
-
export declare const BiBot: ({ clientId }: Props) => React.JSX.Element;
|
|
8
|
+
export declare const BiBot: ({ clientId, client_session_id }: Props) => React.JSX.Element;
|
|
7
9
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -3630,7 +3630,7 @@ var useBiBotChatBot = function useBiBotChatBot(_ref) {
|
|
|
3630
3630
|
return Promise.resolve(askBiBot({
|
|
3631
3631
|
client_id: clientId,
|
|
3632
3632
|
q: input,
|
|
3633
|
-
session_id: state.sessionId,
|
|
3633
|
+
session_id: client_session_id ? client_session_id : state.sessionId,
|
|
3634
3634
|
chat_id: v4()
|
|
3635
3635
|
})).then(function (response) {
|
|
3636
3636
|
setMessages(function (messages) {
|
|
@@ -3683,7 +3683,8 @@ var useBiBotChatBot = function useBiBotChatBot(_ref) {
|
|
|
3683
3683
|
return Promise.reject(e);
|
|
3684
3684
|
}
|
|
3685
3685
|
};
|
|
3686
|
-
var clientId = _ref.clientId
|
|
3686
|
+
var clientId = _ref.clientId,
|
|
3687
|
+
client_session_id = _ref.client_session_id;
|
|
3687
3688
|
var _useState = React.useState([]),
|
|
3688
3689
|
predefinedQuestions = _useState[0],
|
|
3689
3690
|
setPredefinedQuestions = _useState[1];
|
|
@@ -4082,7 +4083,8 @@ var PredefinedQuestions = function PredefinedQuestions(_ref) {
|
|
|
4082
4083
|
color: '#000',
|
|
4083
4084
|
backgroundColor: '#fff',
|
|
4084
4085
|
padding: 10,
|
|
4085
|
-
borderRadius: '6px'
|
|
4086
|
+
borderRadius: '6px',
|
|
4087
|
+
marginBottom: '20px'
|
|
4086
4088
|
}
|
|
4087
4089
|
}, React.createElement("div", {
|
|
4088
4090
|
style: {
|
|
@@ -4103,8 +4105,7 @@ var PredefinedQuestions = function PredefinedQuestions(_ref) {
|
|
|
4103
4105
|
}
|
|
4104
4106
|
}, "Welcome!"), React.createElement("p", {
|
|
4105
4107
|
style: {
|
|
4106
|
-
fontSize: '14px'
|
|
4107
|
-
fontWeight: 'bold'
|
|
4108
|
+
fontSize: '14px'
|
|
4108
4109
|
}
|
|
4109
4110
|
}, "Are you looking for answers to any of these questions? Click for an answer ")), questions.map(function (question, index) {
|
|
4110
4111
|
var _chatBubbleConfig$col;
|
|
@@ -4131,9 +4132,13 @@ var PredefinedQuestions = function PredefinedQuestions(_ref) {
|
|
|
4131
4132
|
};
|
|
4132
4133
|
var ChatBubbleBiBot = function ChatBubbleBiBot(_ref2) {
|
|
4133
4134
|
var _chatBubbleConfig$col2, _chatBubbleConfig$col3;
|
|
4134
|
-
var clientId = _ref2.clientId
|
|
4135
|
+
var clientId = _ref2.clientId,
|
|
4136
|
+
client_session_id = _ref2.client_session_id,
|
|
4137
|
+
redirect_notice = _ref2.redirect_notice;
|
|
4135
4138
|
var _useBiBotChatBot2 = useBiBotChatBot({
|
|
4136
|
-
clientId: clientId
|
|
4139
|
+
clientId: clientId,
|
|
4140
|
+
client_session_id: client_session_id,
|
|
4141
|
+
redirect_notice: redirect_notice
|
|
4137
4142
|
}),
|
|
4138
4143
|
chatIsOpen = _useBiBotChatBot2.chatIsOpen,
|
|
4139
4144
|
messages = _useBiBotChatBot2.messages,
|
|
@@ -4160,7 +4165,7 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(_ref2) {
|
|
|
4160
4165
|
}, chatIsOpen && React.createElement("div", {
|
|
4161
4166
|
className: styles['chat-window'],
|
|
4162
4167
|
style: {
|
|
4163
|
-
backgroundColor: '#
|
|
4168
|
+
backgroundColor: '#fff',
|
|
4164
4169
|
position: 'absolute',
|
|
4165
4170
|
bottom: '60px',
|
|
4166
4171
|
right: '25px',
|
|
@@ -4169,7 +4174,8 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(_ref2) {
|
|
|
4169
4174
|
borderRadius: 10,
|
|
4170
4175
|
display: 'flex',
|
|
4171
4176
|
flexDirection: 'column',
|
|
4172
|
-
justifyContent: 'space-between'
|
|
4177
|
+
justifyContent: 'space-between',
|
|
4178
|
+
border: "0.5px solid " + (chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.color)
|
|
4173
4179
|
}
|
|
4174
4180
|
}, React.createElement("div", {
|
|
4175
4181
|
className: styles['chat-header'],
|
|
@@ -4231,7 +4237,11 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(_ref2) {
|
|
|
4231
4237
|
flexGrow: 1,
|
|
4232
4238
|
flexDirection: 'column'
|
|
4233
4239
|
}
|
|
4234
|
-
},
|
|
4240
|
+
}, showPredefinedQuestions && predefinedQuestions && predefinedQuestions.length > 0 && React.createElement(PredefinedQuestions, {
|
|
4241
|
+
questions: predefinedQuestions.slice(0, 3),
|
|
4242
|
+
onSelect: handlePredefinedQuestionSelect,
|
|
4243
|
+
clientId: clientId
|
|
4244
|
+
}), messages.map(function (message, index) {
|
|
4235
4245
|
return message.sender === 'user' ? React.createElement("div", {
|
|
4236
4246
|
key: index,
|
|
4237
4247
|
className: "message " + message.sender,
|
|
@@ -4275,22 +4285,18 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(_ref2) {
|
|
|
4275
4285
|
marginLeft: '20px'
|
|
4276
4286
|
},
|
|
4277
4287
|
className: 'message'
|
|
4278
|
-
}, ' ', React.createElement(Loader, null)),
|
|
4279
|
-
questions: predefinedQuestions.slice(0, 3),
|
|
4280
|
-
onSelect: handlePredefinedQuestionSelect,
|
|
4281
|
-
clientId: clientId
|
|
4282
|
-
}), React.createElement("div", {
|
|
4288
|
+
}, ' ', React.createElement(Loader, null)), React.createElement("div", {
|
|
4283
4289
|
ref: messageEndRef
|
|
4284
4290
|
})), React.createElement("div", {
|
|
4285
4291
|
className: styles['input-area'],
|
|
4286
4292
|
style: {
|
|
4287
4293
|
display: 'flex',
|
|
4288
4294
|
alignItems: 'center',
|
|
4289
|
-
borderTop: '1px solid #
|
|
4295
|
+
borderTop: '1px solid #d7d7d7',
|
|
4290
4296
|
padding: 10,
|
|
4291
4297
|
borderBottomLeftRadius: 8,
|
|
4292
4298
|
borderBottomRightRadius: 8,
|
|
4293
|
-
backgroundColor: '#
|
|
4299
|
+
backgroundColor: '#fff'
|
|
4294
4300
|
}
|
|
4295
4301
|
}, React.createElement("input", {
|
|
4296
4302
|
style: {
|
|
@@ -4340,9 +4346,12 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(_ref2) {
|
|
|
4340
4346
|
};
|
|
4341
4347
|
|
|
4342
4348
|
var BiBot = function BiBot(_ref) {
|
|
4343
|
-
var clientId = _ref.clientId
|
|
4349
|
+
var clientId = _ref.clientId,
|
|
4350
|
+
client_session_id = _ref.client_session_id;
|
|
4344
4351
|
return React.createElement(AppProvider, null, React.createElement(ChatBubbleBiBot, {
|
|
4345
|
-
clientId: clientId
|
|
4352
|
+
clientId: clientId,
|
|
4353
|
+
client_session_id: client_session_id,
|
|
4354
|
+
redirect_notice: false
|
|
4346
4355
|
}));
|
|
4347
4356
|
};
|
|
4348
4357
|
|