npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@reqdesk/sdk-react

v1.6.0

Published

Shared React provider, views, hooks, and query options for the Reqdesk SDK

Downloads

554

Readme

@reqdesk/sdk-react

React provider, views, hooks, and TanStack Query options for the Reqdesk SDK. This is the package that powers @reqdesk/widget's React entry and the Reqdesk browser extension's side panel — so anything you can build with the widget you can also build directly on this package, with your own chrome around it.

If you want the floating bubble, install @reqdesk/widget. If you want to drop ticket submission into your own layout — your own header, your own routing, your own state — install this.

Install

npm install @reqdesk/sdk-react @reqdesk/sdk-core @tanstack/react-query
# or
bun add @reqdesk/sdk-react @reqdesk/sdk-core @tanstack/react-query

Peer deps: react ^18 || ^19, react-dom ^18 || ^19, @tanstack/react-query ^5.

Quick start

import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { ReqdeskProvider, SubmitTicketView, MyTicketsView } from '@reqdesk/sdk-react'

const queryClient = new QueryClient()

export function SupportPage() {
  return (
    <QueryClientProvider client={queryClient}>
      <ReqdeskProvider
        apiKey="rqd_pk_…"
        apiUrl="https://api.reqdesk.support"
        language="en"
      >
        <SubmitTicketView />
        <MyTicketsView />
      </ReqdeskProvider>
    </QueryClientProvider>
  )
}

ReqdeskProvider owns the API client, the auth state machine, theme tokens, i18n, and the host adapter — every other export reads from this context.

Provider

import { ReqdeskProvider, useReqdeskContext } from '@reqdesk/sdk-react'
import type { ReqdeskProviderProps, ReqdeskContextValue } from '@reqdesk/sdk-react'

Props worth knowing:

| Prop | Type | Notes | |------|------|-------| | apiKey | string | Project-scoped (rqd_pk_…) or workspace-scoped (rqd_ws_…) | | apiUrl | string | Defaults to window.location.origin — set when embedding cross-origin | | language | 'en' \| 'ar' | Drives copy + dir | | theme | ThemeConfig | primaryColor, mode, borderRadius, logo, brandName | | customer | CustomerConfig | Pre-fill email, name, userHash, userHashTimestamp, refreshIdentity | | auth | OidcAuthConfig | Optional Keycloak — when set, the SDK exposes a sign-in flow via oidc-spa | | actions | ReactMenuActionInput[] | Custom menu entries (imperative onClick or declarative trigger) | | display | { mode, side, width, height } | Controls sheet vs popover surfaces | | initialPreferences | Partial<WidgetPreferences> | Defaults + reset target | | userPreferences | WidgetPreferences \| null | Host-stored prefs that override defaults | | onPreferencesChange | (next) => void | Round-trip preferences through your API | | hostAdapter | HostAdapter | Override the runtime seam (used by the extension to inject chrome.*) |

Views

Drop these into any layout:

import {
  SubmitTicketView,   // title, description, priority, attachments, tags
  MyTicketsView,      // history list with status + reply count
  TicketDetailView,   // full thread + reply composer
  TrackTicketView,    // anonymous lookup by tracking token
} from '@reqdesk/sdk-react'

Every view is a self-contained, accessible component. They share the provider's auth state, so a logged-in (signed or SSO) user sees their own tickets without ever typing an email.

Hook + query options

import {
  useReqdesk,
  reqdeskTicketDetailOptions,
  reqdeskMyTicketsOptions,
  reqdeskUserOptions,
  reqdeskTrackTicketOptions,
  reqdeskCategoriesOptions,
} from '@reqdesk/sdk-react'

function MyHeader() {
  const { isOpen, open, close, preferences, setPreferences } = useReqdesk()
  // …
}

// Build your own list against the same query key:
const { data } = useQuery(reqdeskMyTicketsOptions({ apiClient, email }))

The query options are factories returning canonical queryOptions(...) shapes — composable with TanStack Query's useQuery, useSuspenseQuery, prefetchQuery, and the persister plugins. Reuse the same keys to share cache with the widget.

Host adapter

The host adapter is the seam between the React surface and the platform that surrounds it. The web defaults to noopHostAdapter; the extension injects chrome.*-backed handlers for screenshots, screen recording, page-metadata harvest, and connection picking.

import { HostAdapterProvider, type HostAdapter } from '@reqdesk/sdk-react'

const adapter: HostAdapter = {
  capturePageMetadata: async () => ({ url, title, viewport, … }),
  captureScreenshot: async (scope) => ({ dataUrl, scope, capturedAt }),
  recordScreen: async (opts) => ({ start, stop, … }),
  resolveProject: async () => ({ projectId, source: 'auto-detect' }),
  // …
}

<HostAdapterProvider adapter={adapter}>
  <ReqdeskProvider …><SubmitTicketView /></ReqdeskProvider>
</HostAdapterProvider>

Build your own when your host has capabilities the web doesn't — Tauri windows, Electron desktopCapturer, native shells.

Ledger primitives

The SDK exports the Reqdesk Ledger design-system primitives so the surfaces you build against this package look and feel exactly like the rest of Reqdesk:

import { LedgerEyebrow, LedgerDivider, LedgerInput, LedgerIconButton } from '@reqdesk/sdk-react'

Each primitive ships with sensible light + prefers-color-scheme: dark fallbacks, so they look right even if you skip the provider.

Versioning

@reqdesk/sdk-react is published in lockstep with @reqdesk/widget — the widget's React entry just re-exports from here, plus the FAB and shadow DOM. Bump together; never run a widget against a mismatched core.

License

See LICENSE in the monorepo root.