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

@asteby/metacore-support-ui

v1.2.1

Published

Metacore support thread: SupportThread component and useSupportThread hook (transport injected by the host), built on metacore-ui and metacore-inbox

Readme

@asteby/metacore-support-ui

SupportThread: the support-case thread of the unified support flow. It lists person, agent and AI messages, shows the case status, renders attachments (thumbnail, viewer with download, expired-link notice) and has a composer for text and attachments. It does not know the instance, the Hub or any URL: the host injects the transport.

It is a composition, not new UI: the thread and composer come from @asteby/metacore-inbox and everything else (badge, alert, dialog, button) from @asteby/metacore-ui/primitives. Strings live in @asteby/metacore-i18n under supportThread.* (es/en) and follow the host language; colors are the theme tokens, so light/dark follows the host.

pnpm add @asteby/metacore-support-ui @asteby/metacore-sdk @asteby/metacore-inbox @asteby/metacore-ui @asteby/metacore-i18n

Tailwind v4 must scan the packages like the other metacore UI packages:

@source "../node_modules/@asteby/metacore-support-ui/dist/**/*.{js,mjs}";
@source "../node_modules/@asteby/metacore-inbox/dist/**/*.{js,mjs}";

Usage

import { createSupportApi } from '@asteby/metacore-sdk/support'
import { SupportThread } from '@asteby/metacore-support-ui'

// The host owns fetch/auth/realtime. Nothing about endpoints is baked into the component.
// The transport returns { data, headers }: headers must expose X-Next-Cursor (keyset pagination).
const api = createSupportApi(async (req) => {
  const res = await hostFetch(req.path, { method: req.method, query: req.query, body: req.body, signal: req.signal })
  return { data: await res.json(), headers: res.headers } // rejects with the `{error:{code}}` body on non-2xx
}, {
  basePath: '/api/support',
  events: (folio, onEvent) => hostRealtime.subscribe(`support:${folio}`, onEvent), // optional
})

<SupportThread
  api={api}
  folio="OPS-000123"
  authorName="Ana"
  uploadAttachment={(file) => hostUpload(file)} // returns { name, url, content_type, size, expires_at? }
  // Reopen uses api.reopen (POST /cases/:folio/reopen); pass onReopen only to override it.
/>

api needs getCase, sendMessage and subscribe; listMessages enables "Load earlier messages" (messages_older_cursor of the case, then X-Next-Cursor of each page) and reopen enables reopening. Any stand-in works in tests or demos (see src/support-thread.test.tsx).

API errors ({error:{code,message}}, read with supportErrorCode) map to UI: support_disabled, forbidden/unauthorized and not_found show a final message without retry; rate_limited is retryable; on send, rate_limited, case_resolved (the composer gives way to the resolved notice), case_closed, body_too_long, too_many_attachments and invalid_attachment show a notice above the composer and keep the message as not sent.

States: loading, error with retry, empty (the composer stays), open, resolved (solution plus optional reopen) and closed (no messages accepted). A failed send keeps the message in the thread marked as not sent, with a retry button that reuses the same idempotency key. Attachments whose link expired (expired or a past expires_at) are never linked: they show an "attachment expired" notice and the viewer explains instead of offering a dead download.

Contract types and how to sync them

The wire types of the support contract (SupportCallbackEvent, SupportMessageRequest, ...) are generated, never copied by hand, from the golden fixtures of the kernel (metacore-kernel/support/contract/testdata):

node scripts/gen-support-types.mjs --src <path-to>/support/contract/testdata          # regenerates packages/sdk/src/generated/support-contract.ts
node scripts/gen-support-types.mjs --src <path-to>/support/contract/testdata --check  # fails if it drifted (CI)
SUPPORT_CONTRACT_TESTDATA=<path> node --test scripts/gen-support-types.test.mjs       # also checks the committed file

Types are inferred from the fixtures: a field missing in any fixture of its family is optional, and enum-like fields become the observed values plus string (receivers must tolerate unknown values). Run the script whenever the kernel fixtures change and commit the diff; the header of the generated file carries a hash of the fixtures it came from.