@deck-io/feedback
v0.2.0
Published
Embeddable Deck feedback widgets for React apps. Collect in-product feedback into a Deck account via a publishable key.
Maintainers
Readme
@deck-io/feedback
Embeddable React feedback widgets that send submissions into a Deck account.
Standalone package (not part of the Deck monorepo). Publish from this directory.
Install (customers)
pnpm add @deck-io/feedback
# or
npm install @deck-io/feedback
# or
yarn add @deck-io/feedbackPeer dependencies: react and react-dom (>=18).
Quick start
import { DeckProvider, FeedbackDialog, ThumbsFeedback } from "@deck-io/feedback";
function App() {
return (
<DeckProvider
publishableKey={process.env.NEXT_PUBLIC_DECK_PUBLISHABLE_KEY!}
user={{ id: currentUser.id, email: currentUser.email, name: currentUser.name }}
>
<ProductUi />
</DeckProvider>
);
}user.id must be the stable user identifier from your application. Deck uses it
to link repeated widget submissions to the same canonical contact. Include
email and name when available so Deck can match existing CRM/contact records.
URL metadata
By default, the SDK sends only origin + pathname as submission URL metadata.
Query strings and hash fragments are excluded.
<DeckProvider publishableKey={pk} user={{ id: user.id }} urlCapture="path">
{children}
</DeckProvider>Server-side (Node / Next.js)
For Route Handlers, Server Actions, Express routes, or background workers, use the dedicated server entry — no React required:
import { createDeckFeedbackClient } from "@deck-io/feedback/server";
const deck = createDeckFeedbackClient({
publishableKey: process.env.DECK_PUBLISHABLE_KEY!,
});
await deck.submit({
user: { id: session.userId, email: session.email },
submission: {
widgetId: "wgt_...",
sentiment: "negative",
message: "Checkout API timeout",
context: { endpoint: "/api/checkout" },
},
meta: {
url: request.headers.get("referer") ?? undefined,
userAgent: request.headers.get("user-agent") ?? undefined,
},
});Store the publishable key in a server-only env var (DECK_PUBLISHABLE_KEY), not NEXT_PUBLIC_*, when submitting from the server.
For low-level control, import submitFeedback directly from @deck-io/feedback/server and pass meta explicitly.
Develop / publish (maintainers)
cd ~/Desktop/Deck/deck-feedback
npm install
npm run verify:publish
npm publish --access publicCustomer example app
cd examples/customer-app
npm install
npm run devUses a local file:../.. install of this package (same layout as node_modules/@deck-io/feedback). After publish, change the dependency to @deck-io/feedback from npm.
