bibot 1.0.56 → 1.0.58

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