mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-20 00:41:26 +02:00
The credit system was overengineered for the local-first architecture: - Productivity micro-credits (task/event/contact creation at 0.02 credits) made no sense since these operations happen locally in IndexedDB with zero server cost and were never enforced - Guild pool system (6 DB tables, spending limits, membership checks) had no active users - Gift system had 5 types (simple/personalized/split/first_come/riddle) when 2 suffice Now credits are only charged for operations that actually cost money: AI API calls and premium features (sync, exports). This makes the value proposition clear to users. Changes: - Remove 8 productivity operations + CreditCategory.PRODUCTIVITY from @mana/credits - Delete guild pool service, routes, schema (3 files); remove guild refs from 8 backend files - Simplify gifts to simple + personalized only; remove bcrypt/riddle/portions logic - Update all frontend pages (credits dashboard, gift create/redeem, public gift page) - Update shared-hono consumeCredits() to remove creditSource parameter - Update mana-credits CLAUDE.md Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
/**
|
|
* @mana/credits — Unified credit package
|
|
*
|
|
* Consolidates credit-operations + shared-credit-service + shared-credit-ui.
|
|
*
|
|
* Usage:
|
|
* - Operations/costs: import { CreditOperationType, CREDIT_COSTS } from '@mana/credits'
|
|
* - Service: import { createCreditService } from '@mana/credits'
|
|
* - Web UI: import { CreditBalance } from '@mana/credits/web'
|
|
* - Mobile UI: import { CreditBalance } from '@mana/credits/mobile'
|
|
*/
|
|
|
|
// === Operations (costs, types, metadata) ===
|
|
export {
|
|
CreditOperationType,
|
|
CreditCategory,
|
|
CREDIT_COSTS,
|
|
OPERATION_METADATA,
|
|
FREE_OPERATIONS,
|
|
getCreditCost,
|
|
getOperationMetadata,
|
|
getOperationsForApp,
|
|
getOperationsByCategory,
|
|
calculateBulkCost,
|
|
isFreeOperation,
|
|
isAiOperation,
|
|
formatCreditCost,
|
|
getPricingTable,
|
|
isFreeAction,
|
|
type OperationMetadata,
|
|
} from './operations';
|
|
|
|
// === Service (client-side credit management) ===
|
|
export { createCreditService, type CreditService } from './createCreditService';
|
|
export type {
|
|
CreditServiceConfig,
|
|
CreditBalance,
|
|
CreditCheckResponse,
|
|
CreditConsumptionResponse,
|
|
PricingResponse,
|
|
CreditUpdateCallback,
|
|
StandardOperationType,
|
|
} from './service-types';
|
|
export { DEFAULT_OPERATION_PRICING } from './service-types';
|