managarten/packages/feedback/src/index.ts
Till JS ee5bb2871c feat(community): Phase 3.C — Identität (Avatar + Klarname-Toggle + Karma + Eulen-Profil)
Macht aus den Pseudonymen echte Charaktere ohne Klarnamen-Zwang.

Pixel-Identicon-Avatar (3.C.2):
- generateAvatarSvg(displayHash) — pure-function, deterministisch.
  5×5 left-mirrored Identicon mit HSL-Foreground/Background aus dem
  Hash. Inline-SVG, kein Storage, kein img-load-Flicker.
- <EulenAvatar> Component im Package, in ItemCard neben dem Pseudonym.

Klarname-Toggle (3.C.1):
- auth.users + community_show_real_name boolean (default off, opt-in).
- PATCH /api/v1/me/profile akzeptiert communityShowRealName.
- mana-analytics LEFT JOINs auth.users → bei opt-in liefert auth-
  required /public + /me/reacted Endpoints zusätzlich realName.
- Anonymous /api/v1/public/feedback/* zeigt realName NIE — auch nicht
  wenn opted-in. Public-Mirror bleibt für SEO + Privacy safe.
- Migration 008_community_identity.sql lokal + prod eingespielt.

Karma-System (3.C.3):
- auth.users + community_karma int. toggleReaction increment/decrement
  am Author-User (Self-Reactions zählen nicht — kein Self-Farming).
- KARMA_THRESHOLDS + tierFromKarma() im Package: Bronze (0-9) /
  Silver (10-49) / Gold (50-199) / Platin (200+).
- ItemCard zeigt Tier-Dot neben dem Pseudonym, Title-Tooltip mit
  Karma-Zahl. Floor-clamped at 0.

Eulen-Profil (3.C.4):
- GET /api/v1/public/feedback/eule/{hash} — alle public-Posts dieser
  Eule + aggregiertes Karma. SHA256-Format-Validation.
- /community/eule/[hash] Public-SSR-Route mit Avatar-Hero, Tier-Badge,
  Karma-Counter, Post-Liste. Author-Klick im ItemCard navigiert hin.
- publicFeedbackService.getEulenProfile() im Package.

PublicFeedbackItem erweitert um displayHash (public Pseudonym-ID,
SHA256 ist one-way → safe to expose) + karma + optional realName.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 15:15:16 +02:00

56 lines
1.5 KiB
TypeScript

/**
* @mana/feedback — Public-Community Feedback Hub
*
* Single source of truth for all user-facing feedback in Mana:
* - Anonymized by display-name pseudonym ("Wachsame Eule #4528")
* - Slack-style emoji reactions (👍 ❤️ 🚀 🤔 🎉) instead of binary votes
* - Public read endpoints under /api/v1/public/feedback (no auth)
* - Authenticated submit + react under /api/v1/feedback (Bearer)
*/
// Types
export {
type FeedbackCategory,
type FeedbackStatus,
type Feedback,
type FeedbackNotification,
type NotificationKind,
type KarmaTier,
type PublicFeedbackItem,
type ReactionEmoji,
REACTION_EMOJIS,
REACTION_LABELS,
FEEDBACK_CATEGORY_LABELS,
FEEDBACK_STATUS_CONFIG,
KARMA_THRESHOLDS,
KARMA_TIER_CONFIG,
tierFromKarma,
} from './feedback';
export {
type CreateFeedbackInput,
type FeedbackQueryParams,
type FeedbackResponse,
type FeedbackListResponse,
type PublicFeedListResponse,
type PublicItemResponse,
type EulenProfileResponse,
type ReactionResponse,
type AdminPatchInput,
type ReactInput,
} from './api';
// Services
export { createFeedbackService, type FeedbackService } from './createFeedbackService';
export {
createPublicFeedbackService,
type PublicFeedbackService,
} from './createPublicFeedbackService';
export type { FeedbackServiceConfig, PublicFeedbackServiceConfig } from './types';
// Avatar
export { generateAvatarSvg } from './avatar';
// UI Components
export { default as ReactionBar } from './ReactionBar.svelte';
export { default as EulenAvatar } from './EulenAvatar.svelte';