@betterbugs/web-sdk 0.0.1 β†’ 0.0.2

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/README.md CHANGED
@@ -1,146 +1,141 @@
1
1
  # BetterBugs Web SDK
2
2
 
3
- **Simplify bug reporting within your web apps with the BetterBugs Web SDK.**
3
+ Simplify bug reporting within your web apps with the BetterBugs Web SDK.
4
4
 
5
5
  The BetterBugs Web SDK allows you to include bug reporting capabilities in your application with minimal settings and effort.
6
6
 
7
7
  Now, you can enhance your apps with user-friendly and easy-to-implement issue reporting capabilities, such as media capturing, log tracking, getting the two-minute Rewind session video, and real-time hooks to help you and your team report, diagnose, and fix issues effectively.
8
8
 
9
- ---
9
+ ## Breaking it down
10
10
 
11
- ## πŸ” Breaking it down
11
+ Using the BetterBugs Web SDK, you can enhance your web apps with bug reporting features that allow you to capture useful data about the issues. Here's more on it.
12
12
 
13
- Using the BetterBugs Web SDK, you can enhance your web apps with bug reporting features that allow you to capture useful data about the issues. Here’s more on it.
14
-
15
- ---
16
-
17
- ## πŸš€ Key Features of the SDK
13
+ ## Key features of the SDK
18
14
 
19
15
  - **Seamless integration** β€” Quick installation and easy to use with a few lines of code.
20
- - **Configurable params** β€” Tweak settings for the parameters, such as `metaData`, `recordType`, `enableAnnotation`, and many others.
21
- - **Use Methods** β€” Control the SDK with programmatic methods, such as `show()`, `hide()`, `startRecording()`, and many others.
22
- - **Event hooks** β€” For deeper integration, listen for specific lifecycle events with hooks, such as:
23
- - after a screenshot is captured (`onScreenshot`)
24
- - a bug is submitted (`onBugSubmit`)
25
- - a recording starts (`onRecordingStop`)
26
- - and many others.
27
- - **Session Rewind (coming soon)** – Automatically records the last 2 minutes of a session to capture all user interactions.
28
- - **Floating widget customization** – Control the widget’s look and placement.
16
+ - **Configurable params** β€” Tweak settings for the parameters, such as metaData, recordType, enableAnnotation, and many others.
17
+ - **Use Methods** β€” Control the SDK with programmatic methods, such as show(), hide(), startRecording(), and many others.
18
+ - **Event hooks** β€” For deeper integration, listen for specific lifecycle events with hooks, such as after a screenshot is captured (screenshot), a bug is submitted (bugSubmit), or a recording starts (recordingStop), and many others.
19
+ - **Session Rewind (coming soon)** – Automatically records the last 2 minutes of a session to capture all user interactions. It's perfect for auto-capturing issues that just happened and helps trace actions that lead to the bug.
20
+ - **Floating widget customization** – Control the widget's look and placement.
29
21
 
30
- ---
22
+ ## Quick installation
31
23
 
32
- ## πŸ“¦ Quick Installation
24
+ To install the SDK, use the following command:
33
25
 
34
26
  ### NPM install
35
27
 
36
- ```bash
28
+ ```shell
37
29
  npm install @betterbugs/web-sdk
38
30
  ```
39
31
 
40
32
  ### Yarn install
41
33
 
42
- ```bash
34
+ ```shell
43
35
  yarn add @betterbugs/web-sdk
44
36
  ```
45
37
 
46
- ---
38
+ ## BetterBugs Web SDK initialization: Usage example
39
+
40
+ After installation, here's how to initialize the SDK instance in your web app:
47
41
 
48
- ## 🧩 BetterBugs Web SDK Initialization: Usage Example
42
+ ### TypeScript
49
43
 
50
- ```ts
44
+ ```typescript
51
45
  import { Betterbugs } from '@betterbugs/web-sdk';
52
46
 
53
- const bb = new Betterbugs({
47
+ new Betterbugs({
54
48
  apiKey: process.env.TEST_API_KEY || '',
55
- metaData: { userID: 124 },
56
- captureRewindOnScreenshot: true,
57
- recordType: 'recordVideo',
58
- position: {
59
- top: '10px',
60
- left: '20px',
61
- },
62
- mode: 'development',
63
- enableRewind: true,
64
- enableAnnotation: true,
65
- showActionButton: true,
49
+ mode: 'production',
66
50
  });
67
51
  ```
68
52
 
69
- ---
70
-
71
- ## βœ… Quick Overview of the Example Code
72
-
73
- 1. **Imports the Betterbugs SDK** β€” Pulls in Betterbugs from the `@betterbugs/web-sdk` package.
74
- 2. **Creates a new instance (`bb`)** β€” The configuration object sets options for:
75
- - `apiKey`: Get value from environment variable.
76
- - `metaData`: Custom user information (`userID: 124`).
77
- - `captureRewindOnScreenshot`: Enables rewind session event capture on screenshot.
78
- - `recordType`: Uses `recordVideo` for media recording.
79
- - `position`: Positions the widget.
80
- - `mode`: Development mode for debugging.
81
- - `enableRewind`: Enables rewind session video.
82
- - `enableAnnotation`: Enables annotations.
83
- - `showActionButton`: Displays floating action button.
84
-
85
- ---
86
-
87
- ## βš™οΈ Configurable Options
88
-
89
- | Option | Type | Description |
90
- | --------------------------- | ------------------------------------------------------------------ | ---------------------------------------------------------- |
91
- | `apiKey` | `string` | Project-specific API\* (required) |
92
- | `metaData` | `array<object>` | Custom metadata (e.g., `{ userId: 123 }`) |
93
- | `captureRewindOnScreenshot` | `boolean` | Attach rewind session to screenshots |
94
- | `recordType` | `"recordVideo" \| "domRecord"` | Recording type: media (`recordVideo`) or DOM (`domRecord`) |
95
- | `enableRewind` | `boolean` | Enable rewind session capturing |
96
- | `enableAnnotation` | `boolean` | Enable annotation tools |
97
- | `showActionButton` | `boolean` | Toggle visibility of floating action button |
98
- | `position` | `{ top?: string, left?: string, right?: string, bottom?: string }` | Widget position |
99
- | `mode` | `"development" \| "production"` | Mode of operation (debugging or live use) |
100
-
101
- ---
102
-
103
- ## πŸ§ͺ Programmatic Methods
104
-
105
- | Method | Description |
106
- | --------------------- | ------------------------------- |
107
- | `show()` | Show the floating widget |
108
- | `hide()` | Hide the floating widget |
109
- | `openWidget()` | Open the bug report widget |
110
- | `closeWidget()` | Close the bug report widget |
111
- | `updateMetadata()` | Update the attached metadata |
112
- | `captureScreenshot()` | Trigger screenshot capture |
113
- | `startRecording()` | Start session recording |
114
- | `stopRecording()` | Stop the ongoing recording |
115
- | `on()` | Register an event listener |
116
- | `off()` | Unregister an event listener |
117
- | `destroy()` | Destroy the BetterBugs instance |
118
-
119
- ---
120
-
121
- ## πŸ”„ Lifecycle Event Hooks
122
-
123
- | Event | Trigger Description |
124
- | -------------------- | ------------------------------------------ |
125
- | `onScreenshot` | Triggered after the screenshot is captured |
126
- | `onRecordingStart` | Triggered when the recording starts |
127
- | `onRecordingStop` | Triggered when the recording stops |
128
- | `onBugSubmit` | Triggered after a bug is submitted |
129
- | `onMetaDataUpdate` | Triggered when metadata is updated |
130
- | `onPositionUpdate` | Triggered when widget position changes |
131
- | `onWidgetOpen` | Triggered when the widget is opened |
132
- | `onWidgetClose` | Triggered when the widget is closed |
133
- | `onShowActionButton` | Triggered when the action button is shown |
134
- | `onHideActionButton` | Triggered when the action button is hidden |
135
- | `onSessionCreated` | Triggered when a new session is created |
136
-
137
- ---
138
-
139
- ## 🧱 Floating Widget Customization Options
140
-
141
- - **Positioning** β€” Define widget position using `{ top, left, right, bottom }`
142
- - **UI Customization** β€” Modify button styles, background, and primary colors (coming soon)
143
-
144
- ---
145
-
146
- > **Note**: Session Rewind and additional UI customization features are coming soon.
53
+ ## Quick overview of the example code
54
+
55
+ Here's what it does:
56
+
57
+ **1 - Imports the Betterbugs SDK** β€” Pulls in Betterbugs from the @betterbugs/web-sdk package.
58
+
59
+ **2 - Creates a new instance (bb)** β€” The configuration object sets options for:
60
+
61
+ - **apiKey**: Get value from environment variable (process.env.PROJECT_API_KEY).
62
+ - **metaData**: Custom user information (userID: 124) added to the object.
63
+ - **captureRewindOnScreenshot**: Allows rewind session event capturing when a screenshot is taken.
64
+ - **recordType**: Uses recordVideo type, for recording browser media.
65
+ - **position**: Positions the floating widget (top: 10px, left: 20px).
66
+ - **mode**: Running in development environment for additional debugging features.
67
+ - **enableRewind**: Enable rewind session event capturing
68
+ - **enableAnnotation**: Add annotations capability.
69
+ - **showActionButton**: Displays an interactive button for user actions.
70
+
71
+ ## Configurable Options: Customize SDK behavior
72
+
73
+ You can customize the SDK behavior with the following parameters:
74
+
75
+ | Option | Type | Description |
76
+ | ------------------------- | -------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
77
+ | apiKey | string | Project-specific API\* (required) |
78
+ | metaData | array<object> | Custom metadata to attach to reports (e.g., { userId: 123 }) |
79
+ | captureRewindOnScreenshot | boolen | Attach the last two minutes of the Rewind session video to screenshots. |
80
+ | recordType | "recordVideo" \| "domRecord" | The "recordVideo" type (recommended for SPAs) is the traditional media recording method for video and audio. The "domRecord" type (recommended for Multi Page Apps) is the DOM recording method and may not be as accurate as the "recordVideo" type. |
81
+ | disableScreenshot | boolean | Disable screenshot capturing |
82
+ | disableRecording | boolean | Disable screen recording |
83
+ | enableAnnotation | boolean | Enable annotation tools for screenshots and video recordings. |
84
+ | showActionButton | boolean | Display/Hide the floating action button. |
85
+ | position | { top? : string, left? : string, right? : string, bottom? : string } | Control the widget's screen position. |
86
+ | mode | "development" \| "production" | Set development or production mode.<br><br>The "development" mode can be set when the app is under development, and the "production" mode is for end-users, meaning the app's customers can report a bug in the live environment. |
87
+ | email | string | The user's email address who is reporting the bug. Works only in "production" mode. |
88
+ | theme | "dark" \| "light" | Set a dark or light theme |
89
+ | primaryColor | string | Set primary color (branding color) |
90
+ | primaryTextColor | string | Set the primary text color for the buttons. |
91
+ | actionButtonComponent | React.ReactNode \| string | Component for the action button (React component or HTML string accepted). |
92
+ | bugSuccessComponent | React.ReactNode \| string | Component visible when the bug is successfully created (React component or HTML string accepted). |
93
+ | maxRecordingMinutes | number | Set maximum recording length |
94
+
95
+ ## Programmatic Methods: Control SDK behavior
96
+
97
+ Available methods for controlling the BetterBugs SDK behavior;
98
+
99
+ | Method | Description |
100
+ | ------------------------ | ------------------------------------- |
101
+ | setEmail() | Update the email of the bug reporter. |
102
+ | changeTheme() | Update theme. |
103
+ | changePrimaryColor() | Update the primary color. |
104
+ | changePrimaryTextColor() | Update the primary text color. |
105
+ | show() | Show the floating widget |
106
+ | hide() | Hide the floating widget. |
107
+ | openWidget() | Open the bug report widget. |
108
+ | closeWidget() | Close the bug report widget. |
109
+ | updateMetadata() | Update the attached metadata. |
110
+ | captureScreenshot() | Trigger screenshot capture. |
111
+ | startRecording() | Start session recording. |
112
+ | stopRecording() | Stop the ongoing recording. |
113
+ | on() | Register an event listener. |
114
+ | off() | Unregister an event listener. |
115
+ | destroy() | Destroy the BetterBugs instance. |
116
+
117
+ ## Lifecycle Event Hooks: For deeper integrations
118
+
119
+ Available hooks to listen to the lifecycle events:
120
+
121
+ | Event | Trigger description |
122
+ | ---------------- | ------------------------------------------- |
123
+ | emailUpdate | Triggered when the email is updated. |
124
+ | screenshot | Triggered after the screenshot is captured. |
125
+ | recordingStart | Triggered when the recording starts. |
126
+ | recordingStop | Triggered when the recording stops. |
127
+ | bugSubmit | Triggered after the bug is submitted |
128
+ | metaDataUpdate | Triggered when the metadata is updated |
129
+ | positionUpdate | Triggered when the widget position changes. |
130
+ | widgetOpen | Triggered when the widget is opened. |
131
+ | widgetClose | Triggered when the widget is closed. |
132
+ | showActionButton | Triggered when the action button is shown. |
133
+ | hideActionButton | Triggered when the action button is hidden. |
134
+ | sessionCreated | Triggered when a new session is created. |
135
+
136
+ ## Floating widget customization options
137
+
138
+ The floating widget can be customized in various ways:
139
+
140
+ - **Positioning** β€” Define widget position using { top, left, right, bottom }.
141
+ - **UI Customization** β€” Modify button styles, background, and primary colors.