bibot 1.0.57 → 1.0.60

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
+
1
2
  # bibot
2
3
 
3
- > Made with create-react-library
4
+ > CloudSec LLC BiBot plugin for easy integration into your application
4
5
 
5
6
  [![NPM](https://img.shields.io/npm/v/bibot.svg)](https://www.npmjs.com/package/bibot) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
6
7
 
@@ -10,7 +11,17 @@
10
11
  npm install --save bibot
11
12
  ```
12
13
 
13
- ## Usage
14
+ ### `BiBot` Component Props
15
+
16
+ - **`clientId`** (string): **Required**. Your client ID for using the BiBot services.
17
+ - **`client_session_id`** (string): Optional. An optional session ID for tracking client sessions. This is provided if you do not provide.
18
+ - **`redirect_notice`** (boolean): Optional. If set to `true`, the bot will handle redirect notices to 3rd party integration if you have any such as slack.
19
+ - **`test`** (boolean): Optional. If set to `true`, the bot will use the test endpoint for making requests. Useful for initial testing.
20
+ - **`internalUserOnly`** (object): **Required**. Contains information for internal user access.
21
+ - **`internalUseOnly`** (boolean): **Required**. Indicates if the bot is for internal use only.
22
+ - **`jwt`** (string): **Required if `internalUseOnly` is `true`**. The JSON Web Token for authorizing internal users. This must include sub, username, given_name and family_name.
23
+
24
+ ### Example with All Props
14
25
 
15
26
  ```tsx
16
27
  import { BiBot } from 'bibot'
@@ -18,7 +29,13 @@ import { BiBot } from 'bibot'
18
29
  function App() {
19
30
  return (
20
31
  <div className="App">
21
- <BiBot clientId='YOUR CLIENT ID HERE' />
32
+ <BiBot
33
+ clientId='YOUR CLIENT ID HERE'
34
+ client_session_id='YOUR SESSION ID HERE'
35
+ redirect_notice={true}
36
+ test={false}
37
+ internalUserOnly={{ internalUseOnly: true, jwt: 'YOUR JWT HERE' }}
38
+ />
22
39
  </div>
23
40
  );
24
41
  }
@@ -26,6 +43,63 @@ function App() {
26
43
  export default App;
27
44
  ```
28
45
 
46
+ ### Error Handling
47
+
48
+ If `internalUseOnly` is set to `true` but `jwt` is not provided, the component will throw an error:
49
+ ```
50
+ Error: Internal use only requires jwt. Please refer to documentation on https://www.npmjs.com/package/bibot
51
+ ```
52
+
53
+ ## Reporting Bugs
54
+
55
+ If you encounter any bugs or issues, please follow these steps to report them:
56
+
57
+ 1. **Search for existing issues**: Before creating a new issue, please check the [Issues](https://github.com/chrisdjin/bibot_plugin/issues) page to see if the problem has already been reported.
58
+
59
+ 2. **Create a new issue**: If your issue hasn't been reported yet, create a new issue with the following details:
60
+ - A clear and descriptive title.
61
+ - A detailed description of the problem, including steps to reproduce it.
62
+ - Any relevant screenshots or code snippets.
63
+ - Information about your environment (e.g., operating system, browser, Node.js version).
64
+
65
+ 3. **Provide additional context**: If possible, provide additional context that might help us understand the issue, such as error messages or logs.
66
+
67
+
68
+
69
+ ## Contributing
70
+
71
+ We welcome contributions from the community! To contribute, please follow these steps:
72
+
73
+ 1. **Fork the repository**: Fork the [bibot repository](https://github.com/chrisdjin/bibot_plugin.git) to your GitHub account.
74
+
75
+ 2. **Clone the repository**: Clone the forked repository to your local machine.
76
+ ```bash
77
+ git clone https://github.com/chrisdjin/bibot_plugin.git
78
+ ```
79
+
80
+ 3. **Create a new branch**: Create a new branch for your feature or bug fix.
81
+ ```bash
82
+ git checkout -b feature-or-bugfix-name
83
+ ```
84
+
85
+ 4. **Make your changes**: Make your changes to the codebase.
86
+
87
+ 5. **Commit your changes**: Commit your changes with a clear and descriptive commit message.
88
+ ```bash
89
+ git commit -m "Description of the feature or bug fix"
90
+ ```
91
+
92
+ 6. **Push your changes**: Push your changes to your forked repository.
93
+ ```bash
94
+ git push origin feature-or-bugfix-name
95
+ ```
96
+
97
+ 7. **Create a pull request**: Go to the original repository and create a pull request with a clear and detailed description of your changes.
98
+
99
+ 8. **Review process**: Your pull request will be reviewed by the maintainers. Please address any feedback or changes requested during the review process.
100
+
101
+ Thank you for your contributions!
102
+
29
103
  ## License
30
104
 
31
105
  ISC © [chrisdjin](https://github.com/chrisdjin)
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];
@@ -4461,13 +4464,33 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(bibotProps) {
4461
4464
  };
4462
4465
 
4463
4466
  var BiBot = function BiBot(bibotProps) {
4464
- return React.createElement(AppProvider, null, React.createElement(ChatBubbleBiBot, {
4465
- jwt: bibotProps.jwt,
4466
- clientId: bibotProps.clientId,
4467
- client_session_id: bibotProps.client_session_id,
4468
- redirect_notice: bibotProps.redirect_notice,
4469
- test: bibotProps.test
4470
- }));
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
+ }
4471
4494
  };
4472
4495
 
4473
4496
  exports.BiBot = BiBot;