@quantabit/feedback-sdk
v1.0.2
Published
QuantaBit Feedback SDK - User feedback, ratings, and issue reporting components
Maintainers
Readme
@quantabit/feedback-sdk
QuantaBit Unified Feedback System SDK - Multi-platform unified feedback management
Features
- 🌍 Multi-platform Support - Unified management of user feedback from different platforms/apps
- 🏷️ Smart Categorization - Classify and manage by platform, app, domain, and other dimensions
- 💬 Conversational Feedback - Supports user and management agent conversation replies
- ⭐ Satisfaction Rating - Quick collection of user satisfaction scores
- 🌐 Multi-Language Support - Built-in Chinese/English/Japanese/Korean language packs
- ⚛️ React Components - Ready-to-use UI components
- 🔧 Flexible Configuration - Supports custom API URL and authentication methods
Installation
npm install @quantabit/feedback-sdk
# or
yarn add @quantabit/feedback-sdkQuick Start
1. Configure SDK
Initialize the SDK at application startup:
import { configureFeedbackApi } from "@quantabit/feedback-sdk";
configureFeedbackApi({
// QuantaBit Feedback Service API URL
baseUrl: "https://api.qbitwallet.io/api/v1",
// Platform identifier (to distinguish feedback from different platforms)
platform: "your-app-name",
// App ID (multiple apps under the same platform)
appId: "web",
appName: "Your App Name",
// Default language
language: "en",
// Token getter function
getToken: () => localStorage.getItem("token"),
});2. Using React Components
import { FeedbackForm, QuickFeedbackWidget } from "@quantabit/feedback-sdk";
function App() {
return (
<div>
{/* Full feedback form */}
<FeedbackForm onSubmitSuccess={() => console.log("Submitted")} />
{/* Quick satisfaction rating */}
<QuickFeedbackWidget />
</div>
);
}3. Using API Directly
import { feedbackApi } from "@quantabit/feedback-sdk";
// Submit feedback
await feedbackApi.submitFeedback({
type: "bug",
title: "Login button not responding",
content: "After clicking the login button, nothing happens...",
contact: "[email protected]",
});
// Submit quick feedback (satisfaction rating)
await feedbackApi.submitQuickFeedback({
score: 5,
comment: "Great service!",
});
// Get my feedback list
const { items, total } = await feedbackApi.getMyFeedback({
page: 1,
pageSize: 10,
});API Reference
configureFeedbackApi(config)
Configure SDK global settings.
| Param | Type | Required | Description |
| -------- | -------- | -------- | ---------------------------------------------- |
| baseUrl | string | Yes | QuantaBit feedback service API URL |
| platform | string | Yes | Platform identifier (e.g. anyaffair, xwin) |
| appId | string | No | App ID |
| appName | string | No | App name |
| language | string | No | Default language (zh, en, ja, ko) |
| getToken | function | No | Auth token getter function |
| headers | object | No | Custom request headers |
feedbackApi
submitFeedback(data)
Submit detailed feedback.
await feedbackApi.submitFeedback({
type: 'bug' | 'feature' | 'improvement' | 'question' | 'complaint' | 'praise' | 'other',
title: string,
content: string,
contact?: string,
attachments?: string[],
extraData?: object,
});submitQuickFeedback(data)
Submit quick feedback (satisfaction rating).
await feedbackApi.submitQuickFeedback({
score: 1 | 2 | 3 | 4 | 5,
comment?: string,
context?: object,
});getMyFeedback(params)
Get current user's feedback list.
const result = await feedbackApi.getMyFeedback({
platform?: string,
status?: 'pending' | 'processing' | 'resolved' | 'closed',
page?: number,
pageSize?: number,
});
// result: { items: Feedback[], total: number, page: number, page_size: number }getFeedbackDetail(id)
Get feedback detail and reply list.
const { feedback, replies } = await feedbackApi.getFeedbackDetail(feedbackId);replyFeedback(id, content, attachments)
Reply to feedback.
await feedbackApi.replyFeedback(
feedbackId,
"Thank you for your feedback...",
[],
);React Hooks
useFeedbackForm()
Manage feedback form state.
const { form, setField, submit, reset, loading, error } = useFeedbackForm();useMyFeedback(params)
Get and manage user's feedback list.
const { feedbacks, loading, error, refresh, loadMore, hasMore } = useMyFeedback(
{ platform: "anyaffair" },
);useQuickFeedback()
Quick feedback rating state management.
const { score, setScore, comment, setComment, submit, loading, submitted } =
useQuickFeedback();Internationalization
The SDK has built-in multi-language support:
import { setLanguage, t } from "@quantabit/feedback-sdk";
// Set language
setLanguage("en");
// Get translated text
const label = t("sendFeedback"); // "Send Feedback"Supported languages:
zh- Simplified Chineseen- Englishja- Japaneseko- Korean
Feedback Types
| Type | Description | Icon | | ----------- | ---------------------- | ---- | | bug | Bug report | 🐛 | | feature | Feature request | 💡 | | improvement | Improvement suggestion | ✨ | | question | Question / Inquiry | ❓ | | complaint | Complaint | 😤 | | praise | Praise | 👍 | | other | Other | 📝 |
Multi-Platform Architecture
QuantaBit feedback system uses a unified management architecture:
┌─────────────────────────────────┐
│ QuantaBit Feedback Center │
│ (Unified Storage & Management) │
└─────────────────────────────────┘
▲ ▲ ▲
│ │ │
┌────────────────────┼─────┼─────┼────────────────────┐
▼ ▼ ▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ AnyAffair │ │ XWin │ │ DreamLadder │
│ platform: │ │ platform: │ │ platform: │
│ 'anyaffair' │ │ 'xwin' │ │ 'dreamladder' │
└─────────────────┘ └─────────────────┘ └─────────────────┘Each platform's feedback carries platform, appId, domain, and other identifiers for easy filtering and analysis in the management backend.
License
MIT
🌐 Brand & Links
- Official Mainnet: QuantaBit Chain
- Developer Platform: Developer Platform
- Open Platform: Open Platform
- Payment Platform: Pay Platform
- Feedback: Feedback
