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

@namphuongtechnologi/np-chat-ui

v0.0.12

Published

NP-Chat UI — Tailwind components, layout shell for Nam Phuong Technologies

Downloads

791

Readme

@namphuongtechnologi/np-chat-ui

Đây là package dùng để nhúng chat vào app React khác.

Có UI đầy đủ (sidebar phòng, cửa sổ tin, panel phải) — copy vài bước là chạy.

| Package | Việc của nó | |---------|-------------| | np-chat-ui (package này) | UI + ChatApp | | np-chat-react | Provider + hooks (cài kèm) | | np-chat-core | Dependency nội bộ — không import trực tiếp khi nhúng |

Cài đặt

pnpm add @namphuongtechnologi/np-chat-ui @namphuongtechnologi/np-chat-react @namphuongtechnologi/np-chat-core
pnpm add axios @tanstack/react-query

(npm cũng được: npm i ...)

  • Cài cùng version cho cả 3 package @namphuongtechnologi/np-chat-*
  • Peer: react >= 18, react-dom >= 18

Nhúng vào app host (copy-paste)

1. Import CSS (một lần, ở entry)

import '@namphuongtechnologi/np-chat-ui/styles.css';

2. Trang chat

Library không tạo axios. Truyền axios instance đã có auth của app:

import { ChatQueryProvider, ChatProvider } from '@namphuongtechnologi/np-chat-react';
import { ChatApp } from '@namphuongtechnologi/np-chat-ui';
import '@namphuongtechnologi/np-chat-ui/styles.css';

// apiClient = axios của app host (baseURL + interceptor Authorization sẵn)
export function ChatPage() {
  return (
    <ChatQueryProvider>
      <ChatProvider
        config={{
          axios: apiClient,
          currentUser: {
            id: user.id,
            name: user.displayName,
            acsId: user.acsCommunicationId,
            avatarUrl: user.avatarUrl,
          },
          locale: 'vi',
          onError: (err) => console.error('[NP-Chat]', err),
        }}
      >
        {/* Cha phải có chiều cao rõ — ChatApp đã gắn class np-chat-root */}
        <div style={{ height: 'calc(100vh - 64px)' }}>
          <ChatApp layout="full" />
        </div>
      </ChatProvider>
    </ChatQueryProvider>
  );
}

Thứ tự bắt buộc:

ChatQueryProvider → ChatProvider → ChatApp

3. Route (host quyết path)

<Route path="/chats" element={<ChatPage />} />

Library tự sync ?roomId=không cần bridge useSearchParams.

Layout

<ChatApp layout="full" />                           {/* sidebar + chat + panel */}
<ChatApp layout="embedded" showRightPanel={false} /> {/* chỉ cửa sổ chat */}

ChatConfig

| Field | Bắt buộc | Mô tả | |-------|----------|--------| | axios | Có | Axios instance host (auth do host) | | currentUser.id | Có | User id backend | | currentUser.name | Có | Tên hiển thị | | currentUser.acsId | Khuyến nghị | Cần cho realtime ACS | | locale | Không | 'vi' | 'en' | | onError | Không | Callback lỗi | | onRoomChange | Không | Callback đổi phòng |

Host vs library

| Host làm | Library lo | |----------|------------| | Axios + auth interceptor | REST chat + ACS | | currentUser sau login | Sync ?roomId= | | Route /chats + menu | UI (ChatApp) | | Import styles.css | CSS prefix npc-, scope .np-chat-root |

Checklist

  • [ ] 3 package cùng version + import styles.css
  • [ ] Axios có baseURL + Authorization
  • [ ] currentUser.id / name đúng; có acsId nếu cần realtime
  • [ ] Wrapper có chiều cao (100% / calc(100vh - header))
  • [ ] Mở phòng → gửi tin → realtime OK

Lỗi thường gặp

| Triệu chứng | Kiểm tra | |-------------|----------| | 401 | Interceptor token trên axios host | | Sidebar trống | Token / chưa login | | Không realtime | Thiếu acsId hoặc join room không trả ACS token | | CSS vỡ / trắng | Thiếu styles.css hoặc thiếu chiều cao wrapper | | Peer TypeScript | Cài react, axios, @tanstack/react-query |

Tự build UI (không dùng ChatApp)

Dùng @namphuongtechnologi/np-chat-react (hooks). Chỉ import @namphuongtechnologi/np-chat-core khi cần domain / metadata thuần TS.