bibot 1.0.56 → 1.0.58

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/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import * as React from 'react';
2
2
  import './styles.css';
3
3
  import { BiBotProps } from './types/coreInterfaces';
4
- export declare const BiBot: (bibotProps: BiBotProps) => React.JSX.Element;
4
+ export declare const BiBot: React.FC<BiBotProps>;
package/dist/index.js CHANGED
@@ -3727,10 +3727,13 @@ var useBiBotChatBot = function useBiBotChatBot(bibotProps) {
3727
3727
  var _useContext = React.useContext(AppContext),
3728
3728
  state = _useContext.state,
3729
3729
  dispatch = _useContext.dispatch;
3730
- var baseURL = bibotProps !== null && bibotProps !== void 0 && bibotProps.test ? endpoints.getInferenceURL(bibotProps === null || bibotProps === void 0 ? void 0 : bibotProps.test) : endpoints.getInferenceURL(false);
3731
- var pluginAxiosInstance = createPluginAxiosInstance(baseURL, {}, {
3732
- Authorization: bibotProps.jwt
3733
- });
3730
+ var baseURL = endpoints.getInferenceURL(!!(bibotProps !== null && bibotProps !== void 0 && bibotProps.test));
3731
+ if (bibotProps.internalUserOnly.internalUseOnly && !bibotProps.internalUserOnly.jwt) {
3732
+ throw new Error('Internal use only requires jwt. Please refer to documentation on https://www.npmjs.com/package/bibot');
3733
+ }
3734
+ var pluginAxiosInstance = bibotProps.internalUserOnly.internalUseOnly ? createPluginAxiosInstance(baseURL, {}, {
3735
+ Authorization: bibotProps.internalUserOnly.jwt
3736
+ }) : createPluginAxiosInstance(baseURL, {}, {});
3734
3737
  var _useState = React.useState(true),
3735
3738
  showPredefinedQuestions = _useState[0],
3736
3739
  setShowPredefinedQuestions = _useState[1];
@@ -3827,12 +3830,12 @@ function SendMessageIcon(_ref) {
3827
3830
  return React__default.createElement("svg", {
3828
3831
  xmlns: 'http://www.w3.org/2000/svg',
3829
3832
  className: 'icon icon-tabler icon-tabler-send-2',
3830
- width: '24',
3831
- height: '24',
3833
+ width: '36',
3834
+ height: '36',
3832
3835
  viewBox: '0 0 24 24',
3833
3836
  strokeWidth: '1.5',
3834
3837
  stroke: color,
3835
- fill: 'none',
3838
+ fill: '#d7d7d7',
3836
3839
  strokeLinecap: 'round',
3837
3840
  strokeLinejoin: 'round'
3838
3841
  }, React__default.createElement("path", {
@@ -4129,16 +4132,7 @@ var PredefinedQuestions = function PredefinedQuestions(_ref) {
4129
4132
  flexDirection: 'column',
4130
4133
  textAlign: 'center'
4131
4134
  }
4132
- }, React.createElement(Avatar, {
4133
- borderColor: chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.color,
4134
- width: '40px',
4135
- height: '40px',
4136
- source: chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.logo_url
4137
- }), React.createElement("h5", {
4138
- style: {
4139
- marginBlock: '0.5px'
4140
- }
4141
- }, chatBubbleConfig !== null && chatBubbleConfig !== void 0 && chatBubbleConfig.knownUser ? "Hello " + chatBubbleConfig.knownUser : 'Welcome!'), React.createElement("p", {
4135
+ }, React.createElement("p", {
4142
4136
  style: {
4143
4137
  fontSize: '14px'
4144
4138
  }
@@ -4147,13 +4141,13 @@ var PredefinedQuestions = function PredefinedQuestions(_ref) {
4147
4141
  return React.createElement("div", {
4148
4142
  key: index,
4149
4143
  style: {
4150
- backgroundColor: 'transparent',
4151
- border: "0.5px solid " + (chatBubbleConfig ? (_chatBubbleConfig$col = chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.color) != null ? _chatBubbleConfig$col : '#dedede' : '#000'),
4144
+ backgroundColor: '#fafafa',
4145
+ border: "0.3px solid " + (chatBubbleConfig ? (_chatBubbleConfig$col = chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.color) != null ? _chatBubbleConfig$col : '#dedede' : '#000'),
4152
4146
  fontSize: '16px',
4153
4147
  margin: '7px',
4154
4148
  textAlign: 'start',
4155
- padding: '10px',
4156
- borderRadius: '6px',
4149
+ padding: '14px',
4150
+ borderRadius: '50px',
4157
4151
  cursor: 'pointer'
4158
4152
  },
4159
4153
  onClick: function onClick() {
@@ -4181,13 +4175,13 @@ var AiFollowUps = function AiFollowUps(_ref) {
4181
4175
  return React.createElement("div", {
4182
4176
  key: index,
4183
4177
  style: {
4184
- backgroundColor: 'transparent',
4185
- border: "0.5px solid " + (chatBubbleConfig ? (_chatBubbleConfig$col = chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.color) != null ? _chatBubbleConfig$col : '#dedede' : '#000'),
4178
+ backgroundColor: '#fafafa',
4179
+ border: "0.3px solid " + (chatBubbleConfig ? (_chatBubbleConfig$col = chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.color) != null ? _chatBubbleConfig$col : '#dedede' : '#000'),
4186
4180
  fontSize: '16px',
4187
4181
  margin: '7px',
4188
4182
  textAlign: 'start',
4189
- padding: '10px',
4190
- borderRadius: '6px',
4183
+ padding: '14px',
4184
+ borderRadius: '50px',
4191
4185
  cursor: 'pointer'
4192
4186
  },
4193
4187
  onClick: function onClick() {
@@ -4237,7 +4231,7 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(bibotProps) {
4237
4231
  display: 'flex',
4238
4232
  flexDirection: 'column',
4239
4233
  justifyContent: 'space-between',
4240
- border: "0.5px solid " + (chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.color)
4234
+ boxShadow: '0 4px 8px 0 rgba(0, 0, 0, 0.2)'
4241
4235
  }
4242
4236
  }, React.createElement("div", {
4243
4237
  className: styles['chat-header'],
@@ -4250,7 +4244,7 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(bibotProps) {
4250
4244
  alignItems: 'center',
4251
4245
  justifyContent: 'flex-start',
4252
4246
  paddingInline: 15,
4253
- paddingBlock: 10
4247
+ paddingBlock: 25
4254
4248
  }
4255
4249
  }, React.createElement("div", {
4256
4250
  style: {
@@ -4260,10 +4254,10 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(bibotProps) {
4260
4254
  fontWeight: 'bold'
4261
4255
  }
4262
4256
  }, React.createElement(Avatar, {
4263
- borderColor: isLoading ? '#fff' : chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.color,
4257
+ borderColor: 'transparent',
4264
4258
  indicator: isOnline ? 'green' : '#dedede',
4265
- width: '40px',
4266
- height: '40px',
4259
+ width: '70px',
4260
+ height: '70px',
4267
4261
  source: chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.logo_url
4268
4262
  })), React.createElement("div", {
4269
4263
  style: {
@@ -4281,13 +4275,11 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(bibotProps) {
4281
4275
  }
4282
4276
  }, chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.title), isLoading ? React.createElement("span", {
4283
4277
  style: {
4284
- fontSize: '12px',
4285
- lineHeight: '0.9'
4278
+ fontSize: '12px'
4286
4279
  }
4287
4280
  }, "Typing...") : React.createElement("span", {
4288
4281
  style: {
4289
- fontSize: '12px',
4290
- lineHeight: '0.9'
4282
+ fontSize: '12px'
4291
4283
  }
4292
4284
  }, isOnline ? 'Online' : 'Offline'))), React.createElement("div", {
4293
4285
  className: styles['message-list'],
@@ -4321,14 +4313,24 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(bibotProps) {
4321
4313
  }, message.text) : React.createElement("div", {
4322
4314
  key: index,
4323
4315
  style: {
4324
- display: 'flex'
4316
+ display: 'flex',
4317
+ flexDirection: 'column'
4318
+ }
4319
+ }, React.createElement("div", {
4320
+ style: {
4321
+ display: 'flex',
4322
+ alignItems: 'center'
4325
4323
  }
4326
- }, React.createElement(Avatar, {
4327
- borderColor: isLoading ? '#fff' : chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.color,
4324
+ }, " ", React.createElement(Avatar, {
4325
+ borderColor: '#fff',
4328
4326
  width: '20px',
4329
4327
  height: '20px',
4330
4328
  source: chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.logo_url
4331
- }), React.createElement("div", {
4329
+ }), React.createElement("small", {
4330
+ style: {
4331
+ marginLeft: 10
4332
+ }
4333
+ }, " ", chatBubbleConfig.title, " ")), React.createElement("div", {
4332
4334
  className: "message " + message.sender,
4333
4335
  style: {
4334
4336
  marginBottom: 10,
@@ -4339,7 +4341,8 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(bibotProps) {
4339
4341
  fontSize: '15px',
4340
4342
  backgroundColor: '#f0f0f0',
4341
4343
  color: '#000',
4342
- textAlign: 'left'
4344
+ textAlign: 'left',
4345
+ marginTop: 5
4343
4346
  }
4344
4347
  }, message.text));
4345
4348
  }), aiFollowUpQs && !isLoading && React.createElement(AiFollowUps, {
@@ -4360,8 +4363,6 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(bibotProps) {
4360
4363
  alignItems: 'center',
4361
4364
  borderTop: '1px solid #d7d7d7',
4362
4365
  padding: 10,
4363
- borderBottomLeftRadius: 10,
4364
- borderBottomRightRadius: 10,
4365
4366
  backgroundColor: '#fff'
4366
4367
  }
4367
4368
  }, React.createElement("input", {
@@ -4379,12 +4380,12 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(bibotProps) {
4379
4380
  value: userInput,
4380
4381
  onChange: handleUserInput,
4381
4382
  onKeyDown: handleKeyPress,
4382
- placeholder: 'Ask a question'
4383
+ placeholder: 'Type your message here'
4383
4384
  }), React.createElement("button", {
4384
4385
  disabled: isLoading != null ? isLoading : true,
4385
4386
  style: {
4386
4387
  backgroundColor: 'transparent',
4387
- color: isLoading ? '#dedede' : chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.color,
4388
+ color: '#dedede',
4388
4389
  border: 'none',
4389
4390
  cursor: 'pointer'
4390
4391
  },
@@ -4392,8 +4393,37 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(bibotProps) {
4392
4393
  return sendInputInquiry();
4393
4394
  }
4394
4395
  }, React.createElement(SendMessageIcon, {
4395
- color: isLoading ? '#fff' : chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.color
4396
- })))), React.createElement("div", {
4396
+ color: '#fff'
4397
+ }))), React.createElement("div", {
4398
+ style: {
4399
+ backgroundColor: '#f9f9f9',
4400
+ minHeight: 45,
4401
+ display: 'flex',
4402
+ flexDirection: 'column',
4403
+ alignItems: 'center',
4404
+ justifyContent: 'center',
4405
+ borderTop: '1px solid #f9f9f9',
4406
+ borderBottomLeftRadius: 10,
4407
+ borderBottomRightRadius: 10
4408
+ }
4409
+ }, React.createElement("a", {
4410
+ href: 'https://bibot.app',
4411
+ target: '_blank',
4412
+ style: {
4413
+ textDecoration: 'none'
4414
+ }
4415
+ }, " ", React.createElement("small", {
4416
+ style: {
4417
+ color: '#9ba6b2',
4418
+ fontSize: 10,
4419
+ marginBlock: 5
4420
+ }
4421
+ }, "Powered by ", React.createElement("span", {
4422
+ style: {
4423
+ fontWeight: 'bold',
4424
+ color: '#1f4760'
4425
+ }
4426
+ }, "BIBOT"))))), React.createElement("div", {
4397
4427
  style: {
4398
4428
  display: 'flex',
4399
4429
  alignItems: 'center',
@@ -4411,7 +4441,8 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(bibotProps) {
4411
4441
  borderTopRightRadius: 30,
4412
4442
  borderTopLeftRadius: 10,
4413
4443
  borderBottomLeftRadius: 10,
4414
- marginBottom: 50
4444
+ marginBottom: 60,
4445
+ boxShadow: '0 4px 8px 0 rgba(0, 0, 0, 0.2)'
4415
4446
  }
4416
4447
  }, greeting), React.createElement("button", {
4417
4448
  onClick: toggleChat,
@@ -4433,13 +4464,33 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(bibotProps) {
4433
4464
  };
4434
4465
 
4435
4466
  var BiBot = function BiBot(bibotProps) {
4436
- return React.createElement(AppProvider, null, React.createElement(ChatBubbleBiBot, {
4437
- jwt: bibotProps.jwt,
4438
- clientId: bibotProps.clientId,
4439
- client_session_id: bibotProps.client_session_id,
4440
- redirect_notice: bibotProps.redirect_notice,
4441
- test: bibotProps.test
4442
- }));
4467
+ var clientId = bibotProps.clientId,
4468
+ client_session_id = bibotProps.client_session_id,
4469
+ redirect_notice = bibotProps.redirect_notice,
4470
+ test = bibotProps.test,
4471
+ internalUserOnly = bibotProps.internalUserOnly;
4472
+ if (internalUserOnly.internalUseOnly) {
4473
+ return React.createElement(AppProvider, null, React.createElement(ChatBubbleBiBot, {
4474
+ clientId: clientId,
4475
+ client_session_id: client_session_id,
4476
+ redirect_notice: redirect_notice,
4477
+ test: test,
4478
+ internalUserOnly: {
4479
+ internalUseOnly: true,
4480
+ jwt: internalUserOnly.jwt
4481
+ }
4482
+ }));
4483
+ } else {
4484
+ return React.createElement(AppProvider, null, React.createElement(ChatBubbleBiBot, {
4485
+ clientId: clientId,
4486
+ client_session_id: client_session_id,
4487
+ redirect_notice: redirect_notice,
4488
+ test: test,
4489
+ internalUserOnly: {
4490
+ internalUseOnly: false
4491
+ }
4492
+ }));
4493
+ }
4443
4494
  };
4444
4495
 
4445
4496
  exports.BiBot = BiBot;