@adr-center/pulse-support
v0.2.1
Published
ADR Pulse support reporting SDK and embeddable widget
Readme
ADR Pulse Support SDK
Install the public package and initialize it once in the host application:
npm install @adr-center/pulse-supportimport { PulseSupport } from "@adr-center/pulse-support";
PulseSupport.init({
apiUrl: "https://adr-pulse-52uewqsrka-ey.a.run.app",
productKey: "ods-hub",
environment: "production",
appVersion: "2.6.0",
getAuthToken: () => firebaseUser.getIdToken(),
}).installButton();For a public or server-rendered application, its backend exchanges the private
integration key for a short-lived reporter token at POST /api/v1/support/token.
The integration key must never be included in browser code.
The same client can open the dialog from an existing application button:
const support = PulseSupport.init(config);
document.querySelector("#report-problem")?.addEventListener("click", () => {
support.open({ type: "bug" });
});React applications can import PulseSupportButton from
@adr-center/pulse-support/react. The returned report reference and
per-report status token are saved in local storage so the application can call
client.getReport(reference) without exposing internal notes.
Show a person's requests
listReports() uses the current Firebase or short-lived reporter token and
returns only requests created by that reporter for the configured product.
Use status: "open" for a compact "My open requests" screen:
const openRequests = await support.listReports({ status: "open" });When the support team asks for more information, the reporter can answer from
the connected product. A request in waiting returns to investigating after
the reply is accepted:
await support.reply(reportId, "The problem also happens in a private window.");Notify when something changes
The watcher polls no more often than every 15 seconds and invokes the callback only after a known request changes. The host product remains in control of the notification UI:
const stopWatching = support.watchReports({
intervalMs: 60_000,
onChange: (report, previous) => {
if (report.status === "resolved" && previous?.status !== "resolved") {
showToast(`${report.title} has been resolved`);
} else {
showToast(`New support update: ${report.title}`);
}
},
});
// Call when the signed-in session or application is disposed.
stopWatching();Reporter-visible updates are deliberately separate from internal investigation notes. The SDK never returns internal notes, diagnostics, ownership, or other people's requests.
The widget collects only the report text, optional files, and safe application context. Browser diagnostics are included only after the reporter selects the consent checkbox. Form values, credentials, tokens, and case content are never collected automatically.
