Install on React

Replace bw_pk_… with your project's public key from the dashboard's Install page. The key only identifies the project; there is no secret in the page.

// npm i @backwire/widget
import { useEffect } from "react";
import { init } from "@backwire/widget";

export function FeedbackWidget() {
  useEffect(() => {
    let handle: { destroy(): void } | null = null;
    init({ pk: "bw_pk_…" }).then((h) => (handle = h));
    return () => handle?.destroy();
  }, []);
  return null;
}

Content-Security-Policy

script-src  'self' https://cdn.backwire.io https://challenges.cloudflare.com;
connect-src 'self' https://api.backwire.io;
frame-src   https://challenges.cloudflare.com;

No style-src 'unsafe-inline' is needed: the widget styles itself inside a closed shadow root with constructable stylesheets.

Single-page apps

Route changes made with pushState are detected automatically. From code: window.backwire.open(), window.backwire.close(), window.backwire.identify({ email }) for signed-in users.