bibot 1.0.32 → 1.0.34

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -3495,33 +3495,17 @@ var AppProvider = function AppProvider(_ref) {
3495
3495
  };
3496
3496
 
3497
3497
  var getRemoteClientChatPredefinedQuestions = function getRemoteClientChatPredefinedQuestions(params) {
3498
- try {
3499
- return Promise.resolve(_catch(function () {
3500
- var path = "" + domain.inference + resources.predefinedQ;
3501
- return Promise.resolve(pluginAxiosInstance.get(path, {
3502
- params: params
3503
- })).then(function (response) {
3504
- console.log(response.data.predefined_questions);
3505
- return response.data.predefined_questions;
3506
- });
3507
- }, function () {
3508
- return [{
3509
- question: 'These are placeholders',
3510
- answer: ''
3511
- }, {
3512
- question: 'They will be removed in production',
3513
- answer: ''
3514
- }, {
3515
- question: 'This will be empty if there are no predefined questions',
3516
- answer: ''
3517
- }, {
3518
- question: 'So hide if there are no predefined questions',
3519
- answer: ''
3520
- }];
3521
- }));
3522
- } catch (e) {
3523
- return Promise.reject(e);
3524
- }
3498
+ return Promise.resolve(_catch(function () {
3499
+ var path = "" + domain.inference + resources.predefinedQ;
3500
+ return Promise.resolve(pluginAxiosInstance.get(path, {
3501
+ params: params
3502
+ })).then(function (response) {
3503
+ console.log(response.data.predefined_questions);
3504
+ return response.data.predefined_questions;
3505
+ });
3506
+ }, function () {
3507
+ return [];
3508
+ }));
3525
3509
  };
3526
3510
  var getRemoteClientChatBubbleConfig = function getRemoteClientChatBubbleConfig(params) {
3527
3511
  try {
@@ -3630,7 +3614,7 @@ var useBiBotChatBot = function useBiBotChatBot(_ref) {
3630
3614
  return Promise.resolve(askBiBot({
3631
3615
  client_id: clientId,
3632
3616
  q: input,
3633
- session_id: state.sessionId,
3617
+ session_id: client_session_id ? client_session_id : state.sessionId,
3634
3618
  chat_id: v4()
3635
3619
  })).then(function (response) {
3636
3620
  setMessages(function (messages) {
@@ -3683,7 +3667,8 @@ var useBiBotChatBot = function useBiBotChatBot(_ref) {
3683
3667
  return Promise.reject(e);
3684
3668
  }
3685
3669
  };
3686
- var clientId = _ref.clientId;
3670
+ var clientId = _ref.clientId,
3671
+ client_session_id = _ref.client_session_id;
3687
3672
  var _useState = React.useState([]),
3688
3673
  predefinedQuestions = _useState[0],
3689
3674
  setPredefinedQuestions = _useState[1];
@@ -4131,9 +4116,13 @@ var PredefinedQuestions = function PredefinedQuestions(_ref) {
4131
4116
  };
4132
4117
  var ChatBubbleBiBot = function ChatBubbleBiBot(_ref2) {
4133
4118
  var _chatBubbleConfig$col2, _chatBubbleConfig$col3;
4134
- var clientId = _ref2.clientId;
4119
+ var clientId = _ref2.clientId,
4120
+ client_session_id = _ref2.client_session_id,
4121
+ redirect_notice = _ref2.redirect_notice;
4135
4122
  var _useBiBotChatBot2 = useBiBotChatBot({
4136
- clientId: clientId
4123
+ clientId: clientId,
4124
+ client_session_id: client_session_id,
4125
+ redirect_notice: redirect_notice
4137
4126
  }),
4138
4127
  chatIsOpen = _useBiBotChatBot2.chatIsOpen,
4139
4128
  messages = _useBiBotChatBot2.messages,
@@ -4341,9 +4330,12 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(_ref2) {
4341
4330
  };
4342
4331
 
4343
4332
  var BiBot = function BiBot(_ref) {
4344
- var clientId = _ref.clientId;
4333
+ var clientId = _ref.clientId,
4334
+ client_session_id = _ref.client_session_id;
4345
4335
  return React.createElement(AppProvider, null, React.createElement(ChatBubbleBiBot, {
4346
- clientId: clientId
4336
+ clientId: clientId,
4337
+ client_session_id: client_session_id,
4338
+ redirect_notice: false
4347
4339
  }));
4348
4340
  };
4349
4341