npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-bug-reporter-pro

v1.0.3

Published

**_React Bug Reporter Pro_** is a lightweight React component library designed to streamline bug reporting by enabling users to simultaneously record all HTTP requests, screen activity, and audio. This approach enhances the detail and accuracy of bug repo

Downloads

230

Readme

REACT BUG REPORTER PRO

React Bug Reporter Pro is a lightweight React component library designed to streamline bug reporting by enabling users to simultaneously record all HTTP requests, screen activity, and audio. This approach enhances the detail and accuracy of bug reports. The library offers a flexible and robust solution for monitoring and controlling HTTP interactions and screen recordings, and it includes comprehensive type definitions to enhance the development experience for consumers.

Note: Due to compatibility limitations, mobile browsers are not supported.

Installation

Install the package using npm:

npm install react-bug-reporter-pro

Features

  • HTTP and Video Recording: Simultaneously capture all background HTTP requests and record screen activity.

  • Intuitive Interface: A simple and interactive user interface makes bug capturing straightforward and user-friendly.

  • Fully Customizable: Designed with flexibility and reusability in mind, this library can easily adapt to any style. For highly customized implementations, all core logic is encapsulated in two hooks, making it easy to create your own components using them.

  • Customizable Translations: Due to its customizable nature, the library includes built-in support for translations, allowing you to tailor it to fit your language and specific context.

  • Comprehensive Documentation: Clear and detailed JSDoc comments and type definitions are provided throughout the API, ensuring a smooth development experience right out of the box.

Usage

With the built in wrapper

import { ReactBugReporterProWrapper } from 'react-bug-reporter-pro'

const MyComponent: React.FC = () => {
    // ... any code here ...

    return (
        <Foo>
            // ...any jsx you might have here
            <ReactBugReporterProWrapper
                description={{
                    value: yourDescriptionState,
                    onValueChange: yourDescriptionStateSetter,
                }}
                allowDownloadFiles={true}
                audioEnabled={true}
            />
        </Foo>
    )
}

The code above provides everything you need to get started with the library. It allows you to download the recorded video and the HTTP request log file after the recording.

If you wish to upload the files to a server, you'll need to implement a bit more logic, such as:

import { ReactBugReporterProWrapper } from 'react-bug-reporter-pro'

const MyComponent: React.FC = () => {
    // ... any code here ...

    return (
        <Foo>
            // ...any other JSX code you might have here
            <ReactBugReporterProWrapper
                description={{
                    value: yourDescriptionState,
                    onValueChange: yourDescriptionStateSetter,
                }}
                allowDownloadFiles={true}
                audioEnabled={true}
                uploadFiles={{
                    uploadVideoCallback: (videoEncoded) => {
                        return fetch('your-service-url', {
                            method: 'POST',
                            body: videoEncoded,
                            headers: {
                                Authorization:
                                    'Bearer your-auth-token if required',
                            },
                        })
                    },
                    uploadRequestFileCallback: (httpLogFileEncoded) => {
                        return fetch('your-service-url', {
                            method: 'POST',
                            body: httpLogFileEncoded,
                            headers: {
                                Authorization:
                                    'Bearer your-auth-token if required',
                            },
                        })
                    },
                }}
                onFileUploaded={async ({
                    requestsFileUploadResult,
                    videoUploadResult,
                    error,
                }) => {
                    /*
                     * This callback receives the responses from the previous upload callbacks,
                     * allowing you to perform any required actions, such as sending a POST request
                     * to save the file URLs along with the description.
                     */

                    if (error) {
                        /*
                         * If an error occurs during any of the upload callbacks, the 'error' property
                         * will be available here for you to handle it accordingly. It is possible for one
                         * of the two upload callbacks to succeed while the other fails. In such a case,
                         * 'requestsFileUploadResult' and 'videoUploadResult' will still be accessible,
                         * allowing you to determine which upload failed and handle the successful one as needed.
                         */
                    }

                    try {
                        const data = {
                            description,
                            videoUrl: await videoUploadResult.json().url,
                            httpLogUrl:
                                await requestsFileUploadResult.json().url,
                        }

                        await fetch('my-server-url', {
                            method: 'POST',
                            body: JSON.stringify(data),
                            headers: {
                                'Content-Type': 'application/json',
                                Authorization:
                                    'Bearer your-auth-token if required',
                            },
                        })
                    } catch (error) {
                        console.log({ error })
                    }
                }}
            />
        </Foo>
    )
}

Using the hooks

If you want to develop your custom UI and use either the HTTP logger, the screen recorder, or both, you can utilize the useHttpRecorder and/or useScreenRecorder hooks. These hooks encapsulate all the logic found in the built-in wrapper, allowing you to implement functionality in an isolated manner.

useHttpRecorder

This hook allows you to record all background HTTP requests.

Using it will likely look like this:

import { useHttpRecorder } from 'react-bug-reporter-pro'

const myComponent: React.FC = () => {
    const {
        downloadFile,
        recording,
        startRecording,
        stopRecording,
        uploadFile,
    } = useHttpRecorder()

    const onStartRecording = () => {
        if (recording) return
        startRecording()
    }

    const onStopRecording = () => {
        stopRecorder('optional-file-name')
        downloadFile()
    }

    const onUploadFile = () => {
        try {
            await uploadFile((httpLogFile) => {
                /* Your upload logic goes here */
            })
        } catch (error) {
            //...error handling
        }
    }

    return //...any jsx here
}

useScreenRecorder

This hook enables you to record the screen. Its API is quite similar to that of the HTTP logger hook.

Using it will likely look like this:

import { useScreenRecorder } from 'react-bug-reporter-pro'

const myComponent: React.FC = () => {
    const {
        recording,
        localVideoUrl,
        startRecording,
        stopRecording,
        uploadFile,
        revokeUrl,
        downloadFile,
    } = useScreenRecorder()

    const onStartRecording = () => {
        if (recording) return;
        startRecording()
    }

    const onStopRecording = () => {
        stopRecorder('optional-file-name')
        downloadFile()
    }

    const onUploadFile = () => {
        try {
            await uploadFile((videoFileEncoded) => {
                /* Your upload logic goes here */
            })

            revokeUrl()
        } catch (error) {
            //...error handling
        }
    }

    return <video src={localVideoUrl}></video>
}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

This project is open source and available under the MIT License.

This software is and will always be completely free to use, even for commercial purposes. You don’t need to ask for any kind of permission to use it as you please. However, if you would like to support the project and contribute, donations in Bitcoin are accepted — any sats are welcome!

Bitcoin Donation Address: bc1qkk46335s70yr7suz50m4ryfplvrxwmpy325d92