Deck Docs

API reference

Exports, types, and low-level options for @deck-io/feedback and @deck-io/feedback/server.

API reference

Package: @deck-io/feedback (current: 0.2.0+)

Entries

Import pathRuntimeDescription
@deck-io/feedbackBrowser / ReactProvider, built-in UI, hooks, client submit
@deck-io/feedback/serverNode / servercreateDeckFeedbackClient, server-safe submit (no React)

Client entry (@deck-io/feedback)

Components and hooks

ExportKindDescription
DeckProviderComponentAuth, user, theme, URL capture, submit context
useDeckFeedbackHookRaw context (submitFeedback, user, apiUrl, …)
useSubmitFeedbackHookHeadless submit + loading/error state
FeedbackDialogComponentControlled feedback modal
ThumbsFeedbackComponentThumbs control → dialog flow
submitFeedbackFunctionLow-level client (works without React when you pass key + user)
FEEDBACK_SENTIMENTSConst["negative", "neutral", "positive"]
DEFAULT_WIDGET_API_URLConstProduction widget ingest URL
SDK_VERSIONConstPackage version string (e.g. "0.2.0")

Theming helpers

ExportDescription
DECK_FEEDBACK_CSS_VARSMap of token names → CSS custom properties
DECK_FEEDBACK_DEFAULT_THEMESBuilt-in light/dark token sets
themeTokensToCssVarsConvert token object to React CSS properties
resolveColorSchemeResolve light | dark | system
getDeckFeedbackBaseStylesheetBase CSS string for built-in widgets

Client types

TypeDescription
DeckUser{ id: string; email?: string; name?: string }
DeckFeedbackUrlCapture"path" | "full" | "none"
FeedbackSentiment"positive" | "neutral" | "negative"
FeedbackContextRecord<string, string | number | boolean | null | undefined>
FeedbackSubmissionFull ingest payload shape
FeedbackSubmissionMetaurl?, userAgent?, sdkVersion?, occurredAt?, source?
FeedbackSubmitResponseFeedbackSubmitResult | FeedbackSubmitError
FeedbackSubmitResult{ ok: true; submissionId?: string }
FeedbackSubmitError{ ok: false; error: string; status?: number }
DeckProviderPropsProvider props
FeedbackDialogPropsDialog props
ThumbsFeedbackPropsThumbs props
DeckFeedbackContextValueContext value
SubmitFeedbackInputHeadless hook input
SubmitFeedbackOptionsLow-level submitFeedback options
DeckFeedbackColorScheme"light" | "dark" | "system"
DeckFeedbackThemeTokensTheme token overrides

Server entry (@deck-io/feedback/server)

Import this path from Route Handlers, Server Actions, Express/Fastify routes, or workers. It does not load React.

ExportKindDescription
createDeckFeedbackClientFunctionReusable server client; defaults meta.source to "server"
submitFeedbackFunctionSame low-level submit as the client entry
DEFAULT_WIDGET_API_URLConstProduction widget ingest URL
SDK_VERSIONConstPackage version string

Server types

TypeDescription
CreateDeckFeedbackClientOptions{ publishableKey: string; apiUrl?: string }
DeckFeedbackClient{ submit(input): Promise<FeedbackSubmitResponse> }
DeckFeedbackClientSubmitInput{ user; submission; meta? }
SubmitFeedbackOptionsLow-level options (includes optional meta override)
DeckUser, FeedbackSentiment, FeedbackContext, FeedbackSubmission, FeedbackSubmissionMeta, FeedbackSubmitResult, FeedbackSubmitError, FeedbackSubmitResponseShared payload / response types

createDeckFeedbackClient

import { createDeckFeedbackClient } from "@deck-io/feedback/server";

const deck = createDeckFeedbackClient({
  publishableKey: process.env.DECK_PUBLISHABLE_KEY!,
  // apiUrl?: optional override
});

await deck.submit({
  user: { id: "user_1", email: "a@b.com" },
  submission: {
    widgetId: "wgt_...",
    sentiment: "negative",
    message: "Checkout failed",
    context: { endpoint: "/api/checkout" },
  },
  meta: {
    url: request.headers.get("referer") ?? undefined,
  },
});

Behavior:

  • Sets urlCapture to "none" (no browser inference)
  • Merges meta with default { source: "server" } (your fields win on conflict)

Full guide: Server-side submit.


Low-level submitFeedback options

Available from both @deck-io/feedback and @deck-io/feedback/server:

type SubmitFeedbackOptions = {
  publishableKey: string;
  apiUrl?: string;
  urlCapture?: DeckFeedbackUrlCapture; // default "path" (use "none" on the server)
  user: DeckUser;
  submission: {
    widgetId: string;
    sentiment: FeedbackSentiment;
    message?: string;
    context?: FeedbackContext;
  };
  /** Override auto-generated metadata (url, userAgent, occurredAt, source). */
  meta?: Partial<FeedbackSubmissionMeta>;
};

Client-side validation errors

Returned as { ok: false, error: string } without a network call when:

Conditionerror
Missing publishable keyMissing publishable key
Missing user.iduser.id is required
Missing widgetIdwidgetId is required
Missing sentimentsentiment is required

Network and API failures return { ok: false, error, status? } with a message from the response body when available.

Default ingest URL

DEFAULT_WIDGET_API_URL points at Deck production widget feedback ingest
(https://api.getdeck.io/api/v1/widgets/feedback).

Override with apiUrl on the provider, server client, or low-level options only when Deck directs you to.

Next

Troubleshooting