React and Next.js
Install
Section titled “Install”@social-pulse-crm/bugfence-react is published through GitHub Packages. GitHub Packages npm installs require authentication. Do not commit the token.
Configure .npmrc:
@social-pulse-crm:registry=https://npm.pkg.github.com//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}Set GITHUB_TOKEN outside source control to a token with read:packages, then run:
npm install @social-pulse-crm/bugfence-reactSee GitHub’s npm registry authentication guide.
Add the provider
Section titled “Add the provider”import { BugFenceProvider, BugFenceErrorBoundary } from '@social-pulse-crm/bugfence-react';
export function App({ children }: { children: React.ReactNode }) { return ( <BugFenceProvider config={{ projectKey: process.env.NEXT_PUBLIC_BUGFENCE_KEY!, endpoint: process.env.NEXT_PUBLIC_BUGFENCE_ENDPOINT!, position: 'bottom-right', lazyWidget: true }} > <BugFenceErrorBoundary autoSubmitReport> {children} </BugFenceErrorBoundary> </BugFenceProvider> );}For Next.js App Router, place the provider in a client component ('use client') and include it from the root layout. The provider is safe to render during server-side rendering; initialization occurs in the browser.
Use the public project key in the browser. The endpoint must be the project’s report-ingestion URL. Never expose project secret keys, admin keys, or AI provider credentials.
Optional add-ons
Section titled “Optional add-ons”Forms and studio load when the widget mounts; recording annotations load when a screen recording starts. Leave their options unset for default loading. Set an option to false to disable that feature, or supply an asset URL to self-host it. See Add-ons.
For the builder, framework support and generated settings, use the SDK setup builder.