mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-15 21:59:40 +02:00
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>
93 lines
1.9 KiB
TypeScript
93 lines
1.9 KiB
TypeScript
/**
|
|
* 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';
|
|
}
|