From e2d540a958559756b4dac80a3a20ee63de967073 Mon Sep 17 00:00:00 2001 From: Till JS Date: Thu, 16 Apr 2026 14:33:35 +0200 Subject: [PATCH] refactor(settings): rewrite GeneralSection inline + delete @mana/subscriptions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GeneralSection: replace the GlobalSettingsSection wrapper (which rendered its own SettingsSection pill + SettingsCard, requiring title="" to suppress the inner header) with inline settings rows. Each setting is a label+control row with scoped CSS — no double-card, no wrapper hack. Delete packages/subscriptions/ — the package is dead after merging its SubscriptionPage into the Credits & Abo workbench app. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../settings/sections/GeneralSection.svelte | 250 +++++++++++++++++- packages/subscriptions/package.json | 29 -- .../subscriptions/src/BillingToggle.svelte | 116 -------- packages/subscriptions/src/CostCard.svelte | 117 -------- packages/subscriptions/src/ManaIcon.svelte | 16 -- packages/subscriptions/src/PackageCard.svelte | 127 --------- .../src/SubscriptionButton.svelte | 151 ----------- .../subscriptions/src/SubscriptionCard.svelte | 209 --------------- packages/subscriptions/src/UsageCard.svelte | 194 -------------- packages/subscriptions/src/data/appCosts.json | 28 -- .../src/data/defaultUsageData.json | 10 - .../src/data/subscriptionData.json | 195 -------------- packages/subscriptions/src/index.ts | 51 ---- .../src/pages/SubscriptionPage.svelte | 167 ------------ packages/subscriptions/src/plans.ts | 136 ---------- packages/subscriptions/src/revenueCat.ts | 99 ------- packages/subscriptions/src/usage.ts | 93 ------- packages/subscriptions/tsconfig.json | 14 - 18 files changed, 247 insertions(+), 1755 deletions(-) delete mode 100644 packages/subscriptions/package.json delete mode 100644 packages/subscriptions/src/BillingToggle.svelte delete mode 100644 packages/subscriptions/src/CostCard.svelte delete mode 100644 packages/subscriptions/src/ManaIcon.svelte delete mode 100644 packages/subscriptions/src/PackageCard.svelte delete mode 100644 packages/subscriptions/src/SubscriptionButton.svelte delete mode 100644 packages/subscriptions/src/SubscriptionCard.svelte delete mode 100644 packages/subscriptions/src/UsageCard.svelte delete mode 100644 packages/subscriptions/src/data/appCosts.json delete mode 100644 packages/subscriptions/src/data/defaultUsageData.json delete mode 100644 packages/subscriptions/src/data/subscriptionData.json delete mode 100644 packages/subscriptions/src/index.ts delete mode 100644 packages/subscriptions/src/pages/SubscriptionPage.svelte delete mode 100644 packages/subscriptions/src/plans.ts delete mode 100644 packages/subscriptions/src/revenueCat.ts delete mode 100644 packages/subscriptions/src/usage.ts delete mode 100644 packages/subscriptions/tsconfig.json diff --git a/apps/mana/apps/web/src/lib/components/settings/sections/GeneralSection.svelte b/apps/mana/apps/web/src/lib/components/settings/sections/GeneralSection.svelte index d87f8e149..863ad3f21 100644 --- a/apps/mana/apps/web/src/lib/components/settings/sections/GeneralSection.svelte +++ b/apps/mana/apps/web/src/lib/components/settings/sections/GeneralSection.svelte @@ -1,7 +1,7 @@ - + +
+
+
+

Anzeigesprache

+

Sprache der Benutzeroberfläche

+
+
+ {#each languages as lang} + + {/each} +
+
+ +
+
+

Farbschema

+

Akzentfarbe der Oberfläche

+
+
+ {#each colorSchemes as scheme} + + {/each} +
+
+ +
+
+

Farbmodus

+

Hell, Dunkel oder automatisch

+
+
+ {#each [{ id: 'light', label: 'Hell' }, { id: 'dark', label: 'Dunkel' }, { id: 'system', label: 'System' }] as mode} + + {/each} +
+
+ +
+
+

Wochenstart

+

Erster Tag der Woche in Kalendern

+
+
+ + +
+
+ +
+
+

Sounds

+

Sound-Effekte in allen Apps

+
+ +
+
+ + diff --git a/packages/subscriptions/package.json b/packages/subscriptions/package.json deleted file mode 100644 index 0aa80d4fb..000000000 --- a/packages/subscriptions/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "@mana/subscriptions", - "version": "1.0.0", - "private": true, - "description": "Unified subscription package — types and UI components", - "type": "module", - "svelte": "./src/index.ts", - "main": "./src/index.ts", - "types": "./src/index.ts", - "exports": { - ".": { - "svelte": "./src/index.ts", - "types": "./src/index.ts", - "default": "./src/index.ts" - } - }, - "scripts": { - "type-check": "svelte-check --tsconfig ./tsconfig.json" - }, - "devDependencies": { - "svelte": "^5.0.0", - "svelte-check": "^4.0.0", - "svelte-i18n": "^4.0.0", - "typescript": "^5.9.3" - }, - "peerDependencies": { - "svelte": "^5.0.0" - } -} diff --git a/packages/subscriptions/src/BillingToggle.svelte b/packages/subscriptions/src/BillingToggle.svelte deleted file mode 100644 index f3e103c4e..000000000 --- a/packages/subscriptions/src/BillingToggle.svelte +++ /dev/null @@ -1,116 +0,0 @@ - - -
- - - -
- - diff --git a/packages/subscriptions/src/CostCard.svelte b/packages/subscriptions/src/CostCard.svelte deleted file mode 100644 index 4e2f4f073..000000000 --- a/packages/subscriptions/src/CostCard.svelte +++ /dev/null @@ -1,117 +0,0 @@ - - -
-

{title}

- -
- {#each costs as item} -
-
- - - -

- {item.action} -

-
-

- {item.cost} - {manaLabel} -

-
- {/each} -
-
- - diff --git a/packages/subscriptions/src/ManaIcon.svelte b/packages/subscriptions/src/ManaIcon.svelte deleted file mode 100644 index ae5939bce..000000000 --- a/packages/subscriptions/src/ManaIcon.svelte +++ /dev/null @@ -1,16 +0,0 @@ - - - - - diff --git a/packages/subscriptions/src/PackageCard.svelte b/packages/subscriptions/src/PackageCard.svelte deleted file mode 100644 index db7ce263e..000000000 --- a/packages/subscriptions/src/PackageCard.svelte +++ /dev/null @@ -1,127 +0,0 @@ - - - - - diff --git a/packages/subscriptions/src/SubscriptionButton.svelte b/packages/subscriptions/src/SubscriptionButton.svelte deleted file mode 100644 index 908f6648b..000000000 --- a/packages/subscriptions/src/SubscriptionButton.svelte +++ /dev/null @@ -1,151 +0,0 @@ - - - - - diff --git a/packages/subscriptions/src/SubscriptionCard.svelte b/packages/subscriptions/src/SubscriptionCard.svelte deleted file mode 100644 index 2e55240fe..000000000 --- a/packages/subscriptions/src/SubscriptionCard.svelte +++ /dev/null @@ -1,209 +0,0 @@ - - - - - diff --git a/packages/subscriptions/src/UsageCard.svelte b/packages/subscriptions/src/UsageCard.svelte deleted file mode 100644 index 3a9a8c73d..000000000 --- a/packages/subscriptions/src/UsageCard.svelte +++ /dev/null @@ -1,194 +0,0 @@ - - -
- -
-
-
-

{title || yourManaLabel}

-
-
-
-

- {formattedCurrentMana} -

-
-
-
- - -
-
-
- - -
-

- {availablePercentage}% {availableLabel} -

-

- {formattedUsedMana} - {consumedLabel} -

-
- - - {#if currentPlan} -
-

- {currentPlanLabel}: {currentPlan} -

-
- {/if} -
-
- - diff --git a/packages/subscriptions/src/data/appCosts.json b/packages/subscriptions/src/data/appCosts.json deleted file mode 100644 index 1d5d20579..000000000 --- a/packages/subscriptions/src/data/appCosts.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "costs": [ - { - "action": "Pro Minute Aufnahme", - "actionKey": "subscription.cost_per_minute_recording", - "cost": 2, - "icon": "mic-outline" - }, - { - "action": "Frage an Memo stellen", - "actionKey": "subscription.cost_ask_memo_question", - "cost": 5, - "icon": "chatbubble-outline" - }, - { - "action": "Neue Memory erstellen", - "actionKey": "subscription.cost_create_memory", - "cost": 5, - "icon": "add-circle-outline" - }, - { - "action": "Memos kombinieren (pro Memo)", - "actionKey": "subscription.cost_combine_memos", - "cost": 5, - "icon": "copy-outline" - } - ] -} diff --git a/packages/subscriptions/src/data/defaultUsageData.json b/packages/subscriptions/src/data/defaultUsageData.json deleted file mode 100644 index 994b2c378..000000000 --- a/packages/subscriptions/src/data/defaultUsageData.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "usage": { - "total": 0, - "lastWeek": 0, - "lastMonth": 0, - "currentMana": 150, - "maxMana": 150, - "history": [] - } -} diff --git a/packages/subscriptions/src/data/subscriptionData.json b/packages/subscriptions/src/data/subscriptionData.json deleted file mode 100644 index cfb534d54..000000000 --- a/packages/subscriptions/src/data/subscriptionData.json +++ /dev/null @@ -1,195 +0,0 @@ -{ - "subscriptions": [ - { - "id": "free", - "name": "Mana Quelle Free", - "nameEn": "Mana Source Free", - "nameIt": "Mana Fonte Free", - "price": 0, - "priceUnit": "", - "monthlyMana": 50, - "canGiftMana": false, - "popular": false, - "billingCycle": "monthly", - "available": true - }, - { - "id": "Mana_Quelle_S_v1", - "name": "Mana Quelle S", - "nameEn": "Mana Source S", - "nameIt": "Mana Fonte S", - "price": 4.99, - "priceUnit": "/ Monat", - "monthlyMana": 500, - "canGiftMana": true, - "popular": false, - "billingCycle": "monthly", - "available": true - }, - { - "id": "Mana_Quelle_S_Yearly_v1", - "name": "Mana Quelle S", - "nameEn": "Mana Source S", - "nameIt": "Mana Fonte S", - "price": 47.9, - "priceUnit": "/ Jahr", - "priceBreakdown": "(entspricht 3,99€ / Monat, 20% Rabatt)", - "monthlyMana": 500, - "canGiftMana": true, - "popular": false, - "billingCycle": "yearly", - "monthlyEquivalent": 3.99, - "available": true - }, - { - "id": "Mana_Quelle_M_v1", - "name": "Mana Quelle M", - "nameEn": "Mana Source M", - "nameIt": "Mana Fonte M", - "price": 9.99, - "priceUnit": "/ Monat", - "monthlyMana": 1000, - "canGiftMana": true, - "popular": true, - "billingCycle": "monthly", - "available": true - }, - { - "id": "Mana_Quelle_M_Yearly_v1", - "name": "Mana Quelle M", - "nameEn": "Mana Source M", - "nameIt": "Mana Fonte M", - "price": 95.9, - "priceUnit": "/ Jahr", - "priceBreakdown": "(entspricht 7,99€ / Monat, 20% Rabatt)", - "monthlyMana": 1000, - "canGiftMana": true, - "popular": true, - "billingCycle": "yearly", - "monthlyEquivalent": 7.99, - "available": true - }, - { - "id": "Mana_Quelle_L_v1", - "name": "Mana Quelle L", - "nameEn": "Mana Source L", - "nameIt": "Mana Fonte L", - "price": 19.99, - "priceUnit": "/ Monat", - "monthlyMana": 2000, - "canGiftMana": true, - "popular": false, - "billingCycle": "monthly", - "available": true - }, - { - "id": "Mana_Quelle_L_Yearly_v1", - "name": "Mana Quelle L", - "nameEn": "Mana Source L", - "nameIt": "Mana Fonte L", - "price": 191.9, - "priceUnit": "/ Jahr", - "priceBreakdown": "(entspricht 15,99€ / Monat, 20% Rabatt)", - "monthlyMana": 2000, - "canGiftMana": true, - "popular": false, - "billingCycle": "yearly", - "monthlyEquivalent": 15.99, - "available": true - }, - { - "id": "Mana_Quelle_XL_v1", - "name": "Mana Quelle XL", - "nameEn": "Mana Source XL", - "nameIt": "Mana Fonte XL", - "price": 39.99, - "priceUnit": "/ Monat", - "monthlyMana": 4000, - "canGiftMana": true, - "popular": false, - "billingCycle": "monthly", - "available": true - }, - { - "id": "Mana_Quelle_XL_Yearly_v1", - "name": "Mana Quelle XL", - "nameEn": "Mana Source XL", - "nameIt": "Mana Fonte XL", - "price": 383.9, - "priceUnit": "/ Jahr", - "priceBreakdown": "(entspricht 31,99€ / Monat, 20% Rabatt)", - "monthlyMana": 4000, - "canGiftMana": true, - "popular": false, - "billingCycle": "yearly", - "monthlyEquivalent": 31.99, - "available": true - }, - { - "id": "Mana_Quelle_XXL_v1", - "name": "Mana Quelle XXL", - "nameEn": "Mana Source XXL", - "nameIt": "Mana Fonte XXL", - "price": 99.99, - "priceUnit": "/ Monat", - "monthlyMana": 10000, - "canGiftMana": true, - "popular": false, - "billingCycle": "monthly", - "available": true - }, - { - "id": "Mana_Quelle_XXL_Yearly_v1", - "name": "Mana Quelle XXL", - "nameEn": "Mana Source XXL", - "nameIt": "Mana Fonte XXL", - "price": 959.9, - "priceUnit": "/ Jahr", - "priceBreakdown": "(entspricht 79,99€ / Monat, 20% Rabatt)", - "monthlyMana": 10000, - "canGiftMana": true, - "popular": false, - "billingCycle": "yearly", - "monthlyEquivalent": 79.99, - "available": true - } - ], - "packages": [ - { - "id": "Mana_Potion_Small_v1", - "name": "Kleiner Mana Trank", - "nameEn": "Small Mana Potion", - "nameIt": "Piccola Pozione di Mana", - "manaAmount": 350, - "price": 4.9, - "popular": false - }, - { - "id": "Mana_Potion_Medium_v1", - "name": "Mittlerer Mana Trank", - "nameEn": "Medium Mana Potion", - "nameIt": "Media Pozione di Mana", - "manaAmount": 700, - "price": 9.8, - "popular": false - }, - { - "id": "Mana_Potion_Large_v1", - "name": "Großer Mana Trank", - "nameEn": "Large Mana Potion", - "nameIt": "Grande Pozione di Mana", - "manaAmount": 1400, - "price": 19.6, - "popular": false - }, - { - "id": "Mana_Potion_Giant_v2", - "name": "Riesiger Mana Trank", - "nameEn": "Giant Mana Potion", - "nameIt": "Pozione di Mana Gigante", - "manaAmount": 2800, - "price": 39.2, - "popular": false - } - ] -} diff --git a/packages/subscriptions/src/index.ts b/packages/subscriptions/src/index.ts deleted file mode 100644 index ba7d046bb..000000000 --- a/packages/subscriptions/src/index.ts +++ /dev/null @@ -1,51 +0,0 @@ -/** - * @mana/subscriptions — Unified subscription package - * - * Consolidates shared-subscription-types + shared-subscription-ui. - */ - -// === Types === -export { - type BillingCycle, - type PlanCategory, - type SubscriptionPlan, - type ManaPackage, - type ProductMapping, - type PackageMapping, - type FreeTierConfig, - DEFAULT_FREE_TIER, -} from './plans'; - -export { - type UsageData, - type UsageHistoryEntry, - type CostItem, - type ManaBalance, - type CreditTransaction, - type OperationPricing, -} from './usage'; - -export { - type RevenueCatSubscriptionPlan, - type RevenueCatManaPackage, - type SubscriptionServiceData, - type PurchaseResult, - type CustomerSubscriptionStatus, - type RestorePurchasesResult, - type RevenueCatOffering, -} from './revenueCat'; - -// === UI Components === -export { default as SubscriptionPage } from './pages/SubscriptionPage.svelte'; -export { default as SubscriptionCard } from './SubscriptionCard.svelte'; -export { default as PackageCard } from './PackageCard.svelte'; -export { default as BillingToggle } from './BillingToggle.svelte'; -export { default as UsageCard } from './UsageCard.svelte'; -export { default as CostCard } from './CostCard.svelte'; -export { default as SubscriptionButton } from './SubscriptionButton.svelte'; -export { default as ManaIcon } from './ManaIcon.svelte'; - -// === Default data === -export { default as defaultSubscriptionData } from './data/subscriptionData.json'; -export { default as defaultAppCosts } from './data/appCosts.json'; -export { default as defaultUsageData } from './data/defaultUsageData.json'; diff --git a/packages/subscriptions/src/pages/SubscriptionPage.svelte b/packages/subscriptions/src/pages/SubscriptionPage.svelte deleted file mode 100644 index ce2273b4b..000000000 --- a/packages/subscriptions/src/pages/SubscriptionPage.svelte +++ /dev/null @@ -1,167 +0,0 @@ - - -
- -
- (billingCycle = cycle)} {yearlyDiscount} /> -
- - -
-

{subscriptionsTitle}

-
- {#if subscriptions.find((p) => p.id === 'free')} - p.id === 'free')!} - onSelect={onSubscribe} - isCurrentPlan={isCurrentPlan('free')} - /> - {/if} - {#each getSubscriptionPlans() as plan} - - {/each} -
-
- - -
-

{packagesTitle}

-
- {#each packages as pkg} - - {/each} -
-
- - -
-
- Verbrauch & Kosten -
- - -
-
-
-
- - diff --git a/packages/subscriptions/src/plans.ts b/packages/subscriptions/src/plans.ts deleted file mode 100644 index d229a120a..000000000 --- a/packages/subscriptions/src/plans.ts +++ /dev/null @@ -1,136 +0,0 @@ -/** - * Subscription plan and package types - */ - -/** - * Billing cycle options - */ -export type BillingCycle = 'monthly' | 'yearly'; - -/** - * Subscription plan category - */ -export type PlanCategory = 'individual' | 'team' | 'enterprise'; - -/** - * Base subscription plan interface - */ -export interface SubscriptionPlan { - /** Unique identifier */ - id: string; - /** Display name (localized) */ - name: string; - /** English name */ - nameEn?: string; - /** German name */ - nameDe?: string; - /** Italian name */ - nameIt?: string; - /** Price in local currency */ - price: number; - /** Formatted price string (e.g., "5,99€") */ - priceString?: string; - /** Currency code (e.g., "EUR") */ - currencyCode?: string; - /** Price breakdown text */ - priceBreakdown?: string; - /** Monthly equivalent for yearly plans */ - monthlyEquivalent?: number; - /** Mana amount per month */ - monthlyMana: number; - /** Initial mana grant on signup */ - initialMana?: number; - /** Daily mana regeneration */ - dailyMana?: number; - /** Maximum mana capacity */ - maxMana?: number; - /** Whether user can gift mana */ - canGiftMana: boolean; - /** Mark as popular/recommended */ - popular?: boolean; - /** Billing frequency */ - billingCycle: BillingCycle; - /** Team subscription flag */ - isTeamSubscription?: boolean; - /** Enterprise subscription flag */ - isEnterpriseSubscription?: boolean; - /** Plan features list */ - features?: string[]; -} - -/** - * One-time mana package interface - */ -export interface ManaPackage { - /** Unique identifier */ - id: string; - /** Display name (localized) */ - name: string; - /** English name */ - nameEn?: string; - /** German name */ - nameDe?: string; - /** Italian name */ - nameIt?: string; - /** Mana amount */ - manaAmount: number; - /** Price in local currency */ - price: number; - /** Formatted price string */ - priceString?: string; - /** Currency code */ - currencyCode?: string; - /** Team package flag */ - isTeamPackage?: boolean; - /** Enterprise package flag */ - isEnterprisePackage?: boolean; - /** Mark as popular */ - popular?: boolean; -} - -/** - * Product mapping for RevenueCat - */ -export interface ProductMapping { - /** Internal subscription ID */ - subscriptionId: string; - /** App Store/Play Store product ID */ - productId: string; - /** Billing cycle */ - billingCycle: BillingCycle; - /** Category */ - category: PlanCategory; -} - -/** - * Package mapping for RevenueCat - */ -export interface PackageMapping { - /** Internal package ID */ - packageId: string; - /** App Store/Play Store product ID */ - productId: string; - /** Category */ - category: PlanCategory; -} - -/** - * Free tier configuration - */ -export interface FreeTierConfig { - /** Initial mana for free users */ - initialMana: number; - /** Daily mana regeneration */ - dailyMana: number; - /** Maximum mana capacity */ - maxMana: number; -} - -/** - * Default free tier configuration - */ -export const DEFAULT_FREE_TIER: FreeTierConfig = { - initialMana: 150, - dailyMana: 5, - maxMana: 150, -}; diff --git a/packages/subscriptions/src/revenueCat.ts b/packages/subscriptions/src/revenueCat.ts deleted file mode 100644 index 23691f768..000000000 --- a/packages/subscriptions/src/revenueCat.ts +++ /dev/null @@ -1,99 +0,0 @@ -/** - * RevenueCat integration types - */ - -import type { SubscriptionPlan, ManaPackage } from './plans'; - -/** - * RevenueCat-enhanced subscription plan - */ -export interface RevenueCatSubscriptionPlan extends SubscriptionPlan { - /** RevenueCat package object */ - revenueCatPackage?: unknown; - /** RevenueCat product object */ - revenueCatProduct?: unknown; - /** App Store/Play Store product ID */ - productId: string; -} - -/** - * RevenueCat-enhanced mana package - */ -export interface RevenueCatManaPackage extends ManaPackage { - /** RevenueCat package object */ - revenueCatPackage?: unknown; - /** RevenueCat product object */ - revenueCatProduct?: unknown; - /** App Store/Play Store product ID */ - productId: string; -} - -/** - * Subscription service data response - */ -export interface SubscriptionServiceData { - /** All available subscription plans */ - subscriptions: RevenueCatSubscriptionPlan[]; - /** All available one-time packages */ - packages: RevenueCatManaPackage[]; - /** Whether data is from RevenueCat or fallback */ - isFromRevenueCat: boolean; - /** Last update timestamp */ - lastUpdated: Date; -} - -/** - * Purchase result - */ -export interface PurchaseResult { - /** Whether purchase was successful */ - success: boolean; - /** Customer info from RevenueCat */ - customerInfo?: unknown; - /** Error message if failed */ - error?: string; -} - -/** - * Customer subscription status - */ -export interface CustomerSubscriptionStatus { - /** Whether user has active subscription */ - hasActiveSubscription: boolean; - /** Current plan ID */ - currentPlanId?: string; - /** Subscription expiration date */ - expirationDate?: Date; - /** Whether in grace period */ - isInGracePeriod?: boolean; - /** Whether subscription will renew */ - willRenew?: boolean; -} - -/** - * Restore purchases result - */ -export interface RestorePurchasesResult { - /** Whether restore was successful */ - success: boolean; - /** Restored subscription plan ID */ - restoredPlanId?: string; - /** Error message if failed */ - error?: string; -} - -/** - * Offering from RevenueCat - */ -export interface RevenueCatOffering { - /** Offering identifier */ - identifier: string; - /** Available packages in this offering */ - availablePackages: RevenueCatSubscriptionPlan[]; - /** Lifetime package (if available) */ - lifetime?: RevenueCatManaPackage; - /** Annual package */ - annual?: RevenueCatSubscriptionPlan; - /** Monthly package */ - monthly?: RevenueCatSubscriptionPlan; -} diff --git a/packages/subscriptions/src/usage.ts b/packages/subscriptions/src/usage.ts deleted file mode 100644 index 6e529bd74..000000000 --- a/packages/subscriptions/src/usage.ts +++ /dev/null @@ -1,93 +0,0 @@ -/** - * 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'; -} diff --git a/packages/subscriptions/tsconfig.json b/packages/subscriptions/tsconfig.json deleted file mode 100644 index 25d897f5c..000000000 --- a/packages/subscriptions/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2022", - "module": "ES2022", - "moduleResolution": "bundler", - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "resolveJsonModule": true, - "outDir": "dist", - "declaration": true - }, - "include": ["src/**/*.ts", "src/**/*.svelte"] -}