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

@funhub-ugc/comment-sdk

v0.1.19

Published

Funhub UGC discussion comment SDK for React / Next.js projects and Funhub low-code material integration.

Downloads

1,800

Readme

@funhub-ugc/comment-sdk

Funhub UGC discussion comment SDK for React / Next.js projects and Funhub low-code material integration.

What It Provides

  • DiscussionCommentWidget: a ready-to-use discussion comment widget for detail pages
  • detailDiscussionMaterial: a low-code material definition for Funhub platform editors
  • Built-in comment list, composer, reply flow, like flow, and login redirect handling
  • Route-based ugcId auto resolution for pages like /video/{id}

Install

pnpm add @funhub-ugc/comment-sdk

Required peer dependencies:

  • react >= 18
  • react-dom >= 18
  • next >= 13.4
  • next-intl >= 4.7.0
  • @tanstack/query-core >= 5
  • @tanstack/react-query >= 5

Exports

import { DiscussionCommentWidget } from "@funhub-ugc/comment-sdk/components";
import { detailDiscussionMaterial } from "@funhub-ugc/comment-sdk/materials";

Component Usage

"use client";

import { DiscussionCommentWidget } from "@funhub-ugc/comment-sdk/components";

export function VideoComments() {
  return <DiscussionCommentWidget />;
}

You can also pass an explicit ugcId during preview or custom runtime rendering:

<DiscussionCommentWidget ugcId="866fb23655eafcfa" />

ugcId Resolution Rules

The widget resolves ugcId in this order:

  1. Explicit ugcId prop
  2. Current route /video/{id} match
  3. Locally stored preview ugcId

This means ugcId is optional for real published detail pages as long as the route contains a valid video id.

Runtime Environment

The SDK reads these environment variables at runtime:

  • NEXT_PUBLIC_COMMENT_SDK_UGC_API_BASE_URL: browser-side UGC API base URL
  • COMMENT_SDK_UGC_API_BASE_URL: server-side or proxy target UGC API base URL
  • NEXT_PUBLIC_COMMENT_SDK_LOGIN_URL: login page URL used when auth is required

Recommended production pattern:

  • Browser requests go through your app's same-origin proxy
  • Your app proxy forwards to the actual UGC backend

Example Next.js route proxy:

// app/api/ugc/[...path]/route.ts

Then point the browser-side SDK base URL to /api/ugc.

Low-Code Material Usage

The package also exposes a Funhub low-code material:

  • Material type: detail-discussion
  • Material name: 详情页-讨论区

In editor mode:

  • ugcId is only used for drag-and-drop preview
  • Published pages should rely on route matching instead of requiring manual ugcId input

Styling Notes

The widget uses utility classes generated in the published package output. If your host app uses Tailwind CSS tree-shaking, make sure its content config scans the installed SDK package files as well.

Example:

// tailwind.config.ts
import { createRequire } from "node:module";
import { dirname, join } from "node:path";

const require = createRequire(import.meta.url);
const commentSdkRoot = dirname(
  require.resolve("@funhub-ugc/comment-sdk/package.json")
);

export default {
  content: [
    "./app/**/*.{js,ts,jsx,tsx,mdx}",
    "./src/**/*.{js,ts,jsx,tsx,mdx}",
    join(commentSdkRoot, "dist/**/*.{js,mjs}")
  ]
};

Local Development

The package contains a local playground:

pnpm --filter @funhub-ugc/comment-sdk playground:dev

Default local preview port:

  • 3301

Changelog

See CHANGELOG.md.