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-core

v1.4.2

Published

Core types, API client, storage, auth, i18n, theme, and metadata for the Reqdesk SDK

Readme

@reqdesk/sdk-core

Framework-agnostic core for the Reqdesk SDK. Ships the typed API client, storage backend, OIDC auth contract, theme primitives, i18n catalogue, and client-metadata collectors that every higher-level package (@reqdesk/widget, @reqdesk/sdk-react, the browser extension) consumes.

If you only need to talk to the Reqdesk API from your own UI — without the FAB, shadow DOM, or React surface — this is the package to install.

Install

npm install @reqdesk/sdk-core
# or
bun add @reqdesk/sdk-core
# or
pnpm add @reqdesk/sdk-core

Zero peer dependencies. Pure ESM/CJS dual-build, fully tree-shakeable (sideEffects: false).

What ships

Typed API client

import { createApiClient } from '@reqdesk/sdk-core'

const api = createApiClient({
  apiUrl: 'https://api.reqdesk.support',
  apiKey: 'rqd_pk_…',          // project-scoped or workspace-scoped
  getAuthToken: async () => oidcUser?.accessToken,  // optional
})

const { data } = await api.submitTicket({
  title: 'Login flow regression',
  description: 'Repro on Safari 17.4',
  email: '[email protected]',
  priority: 'high',
})

const { data: tickets } = await api.listMyTickets({ email: '[email protected]' })

The client is built on ofetch, transparently maps snake_case wire payloads to camelCase, attaches the API key + signed-identity headers when present, and surfaces WidgetError on every failure path (no unknown-typed throws).

Storage backend

import { createLocalStorageBackend, type StorageBackend } from '@reqdesk/sdk-core'

const storage: StorageBackend = createLocalStorageBackend('reqdesk:v1:')
storage.set('preferred-language', 'ar')
const lang = storage.get('preferred-language')

StorageBackend is the seam every consumer uses for prefs, draft tickets, and identity. Provide your own implementation (in-memory, encrypted, IndexedDB) when you need it.

Theme primitives

import { themeToVars, themeToStyle, hexToHsl, DEFAULT_THEME } from '@reqdesk/sdk-core'

const vars = themeToVars({ primaryColor: '#42b983', mode: 'dark' })
// → CSS custom-property map: '--rqd-primary', '--rqd-bg', '--rqd-text', …

Centralised brand-token mapping. The widget shadow DOM, the React provider, and the extension all funnel through these helpers so a single theme config produces a consistent, contrast-aware surface across every host.

i18n

import { getTranslations, t, en, ar } from '@reqdesk/sdk-core'

const tr = getTranslations('ar')          // bilingual catalogue, RTL-aware
const label = t(tr, 'submit.title')       // with merged overrides

English and Arabic are bundled. Hosts can pass Record<string, string> overrides at init.

Client metadata

import {
  collectMinimalMetadata,
  collectDiagnosticMetadata,
  collectAllMetadata,
} from '@reqdesk/sdk-core'

const meta = await collectAllMetadata()
// → { url, userAgent, viewport, locale, timezone, …diagnostic fields }

Three privacy-tiered collectors that tickets attach automatically. The diagnostic tier is opt-in and gated by getMetadataPreferences() so end users own the disclosure.

Authentication contract

import type { AuthProvider, AuthState, OidcAuthConfig } from '@reqdesk/sdk-core'

Implement AuthProvider to plug any OIDC stack into the SDK. @reqdesk/widget ships an oidc-spa-backed implementation; the extension ships a chrome.identity-backed one. Both satisfy the same contract so views (SubmitTicketView, MyTicketsView, …) work unchanged.

Used by

Versioning

Patch releases for bug fixes, minor for additive APIs, major for breaking signatures. The @reqdesk/widget minor track follows @reqdesk/sdk-core minors so the widget never lags behind a new core capability.

License

See LICENSE in the monorepo root.