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

@noorden/conversations-react

v0.1.0

Published

Inbox de conversas embarcável da Noorden Platform — headless hooks + componentes React estilizados.

Readme

@noorden/conversations-react

Inbox de conversas embarcável da Noorden Platform, no modelo Stream/Sendbird UIKit: headless hooks (toda a lógica) + componentes estilizados opcionais construídos sobre os hooks. Peer dep: react >= 18.

npm install @noorden/conversations-react

Auth: token efêmero (a API key NUNCA vai ao browser)

O kit se autentica com um token curto (rxct_…, TTL ~15 min) restrito às rotas de conversas/contatos de UM projeto. O seu servidor troca a API key pelo token:

// No SEU backend (ex.: rota /api/inbox-token), com @noorden/sdk:
import { Platform } from '@noorden/sdk';
const platform = new Platform({ apiKey: process.env.NOORDEN_API_KEY });
export async function GET() {
  const { token } = await platform.conversations.createInboxToken();
  return Response.json({ token });
}
// No browser:
import { InboxClient, InboxProvider, Inbox } from '@noorden/conversations-react';
import '@noorden/conversations-react/styles.css';

const client = new InboxClient({
  baseUrl: 'https://SUA-API',
  projectId: 'proj_…',
  getToken: async () => {
    const res = await fetch('/api/inbox-token'); // seu backend
    const { token } = await res.json();
    return token;
  },
});

export function SupportPage() {
  return (
    <InboxProvider client={client}>
      <div style={{ height: 640 }}>
        <Inbox senderName="Equipe de Suporte" />
      </div>
    </InboxProvider>
  );
}

O client cacheia o token e chama getToken de novo quando a API responde 401 (expirou) — renovação transparente. Revogar/rotacionar a API key emissora mata todos os tokens.

Contrato público (0.1.0, semver)

Headless hooks (não dependem dos componentes nem do CSS)

| hook | retorno | live | | ------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------- | | useConversations({ status?, controller?, channel?, connectionId?, contactId?, limit?, pollIntervalMs?, client? }) | { conversations, loading, error, refresh, loadMore, hasMore, loadingMore } | poll 10s | | useConversation(id, { pollIntervalMs?, client? }) | { conversation, loading, error, refresh } | poll 10s | | useMessages(id, { limit?, pollIntervalMs?, client? }) | { messages (cronológicas), loading, error, refresh, loadMore, hasMore, loadingMore } | poll 3s | | useSendMessage(id, { senderName?, client? }) | { send(text), sending, error } — envia como user (takeover) | — | | useContact(contactId, { pollIntervalMs?, enabled?, client? }) | { contact, loading, error, refresh } | poll 30s |

Regras dos hooks: poll nunca "pisca" o loading (mantém os dados anteriores); erro transitório não apaga a lista; pollIntervalMs: 0 desliga o poll; client explícito dispensa o <InboxProvider>.

Atualização ao vivo = polling (débito assumido). A API de conversations não expõe SSE para operador hoje; quando expuser, os hooks trocam o intervalo por stream sem mudar este contrato.

Componentes estilizados (opcionais, construídos SOBRE os hooks)

  • <Inbox title? filters? pollIntervalMs? contactPanel? senderName? onSelectConversation? client? /> — lista + thread + painel do contato (3 colunas).
  • <Thread conversationId pollIntervalMs? senderName? composer? client? /> — mensagens públicas em ordem cronológica + composer embutido.
  • <Composer conversationId senderName? placeholder? onSent? client? />
  • <ContactPanel conversationId client? />

CSS opcional em @noorden/conversations-react/styles.css — classes prefixadas (nrdc-*) e theming por CSS vars (--nrdc-primary, --nrdc-surface, …). Sem o CSS, os componentes renderizam markup semântico sem estilo (ou ignore os componentes e use só os hooks).

Notas

  • O thread mostra apenas mensagens visibility: 'public' (rascunhos de copiloto são fluxo do console).
  • Envio é sempre senderType: 'user' — numa conversa controlada por agente, isso faz o takeover (comportamento padrão da plataforma).
  • Janela de 24h fechada → o envio falha com conversation.window_closed (o erro aparece no composer).