JSPM

  • Created
  • Published
  • Downloads 487
  • Score
    100M100P100Q10358F
  • License MIT

A web sdk package for Betterbugs

Package Exports

  • @bb-test/web-sdk
  • @bb-test/web-sdk/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@bb-test/web-sdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

BetterBugs Web SDK

Simplify bug reporting within your web apps with the BetterBugs Web SDK.

The BetterBugs Web SDK allows you to include bug reporting capabilities in your application with minimal settings and effort.

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.


πŸ” Breaking it down

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.


πŸš€ Key Features of the SDK

  • Seamless integration β€” Quick installation and easy to use with a few lines of code.
  • Configurable params β€” Tweak settings for the parameters, such as metaData, recordType, enableAnnotation, and many others.
  • Use Methods β€” Control the SDK with programmatic methods, such as show(), hide(), startRecording(), and many others.
  • Event hooks β€” For deeper integration, listen for specific lifecycle events with hooks, such as:
    • after a screenshot is captured (onScreenshot)
    • a bug is submitted (onBugSubmit)
    • a recording starts (onRecordingStop)
    • and many others.
  • Session Rewind (coming soon) – Automatically records the last 2 minutes of a session to capture all user interactions.
  • Floating widget customization – Control the widget’s look and placement.

πŸ“¦ Quick Installation

NPM install

npm install @bb-test/web-sdk

Yarn install

yarn add @bb-test/web-sdk

🧩 BetterBugs Web SDK Initialization: Usage Example

import { Betterbugs } from '@bb-test/web-sdk';

const bb = new Betterbugs({
  apiKey: process.env.TEST_API_KEY || '',
  metaData: { userID: 124 },
  captureRewindOnScreenshot: true,
  recordType: 'recordVideo',
  position: {
    top: '10px',
    left: '20px',
  },
  mode: 'development',
  enableRewind: true,
  enableAnnotation: true,
  showActionButton: true,
});

βœ… Quick Overview of the Example Code

  1. Imports the Betterbugs SDK β€” Pulls in Betterbugs from the @bb-test/web-sdk package.
  2. Creates a new instance (bb) β€” The configuration object sets options for:
    • apiKey: Get value from environment variable.
    • metaData: Custom user information (userID: 124).
    • captureRewindOnScreenshot: Enables rewind session event capture on screenshot.
    • recordType: Uses recordVideo for media recording.
    • position: Positions the widget.
    • mode: Development mode for debugging.
    • enableRewind: Enables rewind session video.
    • enableAnnotation: Enables annotations.
    • showActionButton: Displays floating action button.

βš™οΈ Configurable Options

Option Type Description
apiKey string Project-specific API* (required)
metaData array<object> Custom metadata (e.g., { userId: 123 })
captureRewindOnScreenshot boolean Attach rewind session to screenshots
recordType "recordVideo" | "domRecord" Recording type: media (recordVideo) or DOM (domRecord)
enableRewind boolean Enable rewind session capturing
enableAnnotation boolean Enable annotation tools
showActionButton boolean Toggle visibility of floating action button
position { top?: string, left?: string, right?: string, bottom?: string } Widget position
mode "development" | "production" Mode of operation (debugging or live use)

πŸ§ͺ Programmatic Methods

Method Description
show() Show the floating widget
hide() Hide the floating widget
openWidget() Open the bug report widget
closeWidget() Close the bug report widget
updateMetadata() Update the attached metadata
captureScreenshot() Trigger screenshot capture
startRecording() Start session recording
stopRecording() Stop the ongoing recording
on() Register an event listener
off() Unregister an event listener
destroy() Destroy the BetterBugs instance

πŸ”„ Lifecycle Event Hooks

Event Trigger Description
onScreenshot Triggered after the screenshot is captured
onRecordingStart Triggered when the recording starts
onRecordingStop Triggered when the recording stops
onBugSubmit Triggered after a bug is submitted
onMetaDataUpdate Triggered when metadata is updated
onPositionUpdate Triggered when widget position changes
onWidgetOpen Triggered when the widget is opened
onWidgetClose Triggered when the widget is closed
onShowActionButton Triggered when the action button is shown
onHideActionButton Triggered when the action button is hidden
onSessionCreated Triggered when a new session is created

🧱 Floating Widget Customization Options

  • Positioning β€” Define widget position using { top, left, right, bottom }
  • UI Customization β€” Modify button styles, background, and primary colors (coming soon)

Note: Session Rewind and additional UI customization features are coming soon.