mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-22 06:26:41 +02:00
refactor(packages): consolidate 2 subscription packages into @manacore/subscriptions
Merged shared-subscription-types + shared-subscription-ui into @manacore/subscriptions. Updated imports in 15 web apps. Package count: 49 → 47 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d70ab97a66
commit
1f3208384b
38 changed files with 115 additions and 211 deletions
93
packages/subscriptions/src/usage.ts
Normal file
93
packages/subscriptions/src/usage.ts
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
/**
|
||||
* Usage and cost tracking types
|
||||
*/
|
||||
|
||||
/**
|
||||
* Usage data for displaying user's mana consumption
|
||||
*/
|
||||
export interface UsageData {
|
||||
/** Total mana consumed all time */
|
||||
total: number;
|
||||
/** Mana consumed last week */
|
||||
lastWeek: number;
|
||||
/** Mana consumed last month */
|
||||
lastMonth: number;
|
||||
/** Current mana balance */
|
||||
currentMana: number;
|
||||
/** Maximum mana capacity */
|
||||
maxMana: number;
|
||||
/** Usage history */
|
||||
history?: UsageHistoryEntry[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Single usage history entry
|
||||
*/
|
||||
export interface UsageHistoryEntry {
|
||||
/** Date of usage (ISO string) */
|
||||
date: string;
|
||||
/** Amount consumed */
|
||||
amount: number;
|
||||
/** Action type (optional) */
|
||||
action?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cost item for displaying operation costs
|
||||
*/
|
||||
export interface CostItem {
|
||||
/** Action description */
|
||||
action: string;
|
||||
/** Translation key for action */
|
||||
actionKey?: string;
|
||||
/** Mana cost */
|
||||
cost: number;
|
||||
/** Icon name */
|
||||
icon: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* User's credit/mana balance
|
||||
*/
|
||||
export interface ManaBalance {
|
||||
/** Current mana amount */
|
||||
current: number;
|
||||
/** Maximum capacity */
|
||||
max: number;
|
||||
/** Last updated timestamp */
|
||||
lastUpdated: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Credit transaction record
|
||||
*/
|
||||
export interface CreditTransaction {
|
||||
/** Transaction ID */
|
||||
id: string;
|
||||
/** User ID */
|
||||
userId: string;
|
||||
/** Amount (positive = credit, negative = debit) */
|
||||
amount: number;
|
||||
/** Transaction type */
|
||||
type: 'purchase' | 'subscription' | 'usage' | 'gift' | 'refund' | 'bonus';
|
||||
/** Description */
|
||||
description: string;
|
||||
/** Timestamp */
|
||||
createdAt: string;
|
||||
/** Related operation ID (if applicable) */
|
||||
operationId?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pricing information for operations
|
||||
*/
|
||||
export interface OperationPricing {
|
||||
/** Operation key */
|
||||
operation: string;
|
||||
/** Base cost in mana */
|
||||
baseCost: number;
|
||||
/** Per-unit cost (e.g., per minute, per token) */
|
||||
perUnitCost?: number;
|
||||
/** Unit type */
|
||||
unitType?: 'minute' | 'token' | 'request';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue