From 205fc67f2402536e8cba05303c4a0ffb5cc1ea74 Mon Sep 17 00:00:00 2001 From: Quinn Ftw Date: Sun, 28 Dec 2025 17:49:29 -0800 Subject: [PATCH] refactor(plugins): clean up plugin exports and index MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Streamline plugin package exports for better tree-shaking. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- @packages/@plugins/src/index.ts | 265 ++------------------------------ 1 file changed, 10 insertions(+), 255 deletions(-) diff --git a/@packages/@plugins/src/index.ts b/@packages/@plugins/src/index.ts index 5728eab10..6984e5bd4 100644 --- a/@packages/@plugins/src/index.ts +++ b/@packages/@plugins/src/index.ts @@ -1,264 +1,19 @@ /** * @lilith/plugin-payment * - * Comprehensive payment plugin for lilith-platform providing: - * - Payment processing via Segpay (credit cards) and NOWPayments (cryptocurrency) - * - Subscription management (create, cancel, tier changes with proration) - * - Payment method management (add, remove, set default) - * - Transaction history and analytics - * - Creator payout management (balance tracking, payout requests) - * - Tip payments with 3D Secure support - * - React Query hooks with optimistic updates and caching - * - Theme-aware UI components + * @deprecated This package has been moved to @lilith/payments * - * @example Basic API usage - * ```tsx - * import { paymentsClient, subscriptionsApi } from '@lilith/plugin-payment' + * Please update imports to use the new location: * - * // Direct API client usage - * const response = await paymentsClient.get('/subscriptions/123') + * Before: import { ... } from '@lilith/plugin-payment' + * After: import { ... } from '@lilith/payments/frontend' + * import { ... } from '@lilith/payments/providers' * - * // Type-safe API functions - * const subscription = await subscriptionsApi.get('sub-123') - * const userSubs = await subscriptionsApi.listByUser('user-456') - * ``` - * - * @example React Query hooks - * ```tsx - * import { - * useSubscriptions, - * useCreateSubscription, - * useCancelSubscription, - * usePaymentHistory, - * usePayoutBalance, - * } from '@lilith/plugin-payment' - * - * function MyComponent() { - * const { data: subscriptions } = useSubscriptions(userId) - * const createMutation = useCreateSubscription() - * const { data: history } = usePaymentHistory({ limit: 20 }) - * const { data: balance } = usePayoutBalance(creatorId) - * } - * ``` - * - * @example UI Components - * ```tsx - * import { - * SubscriptionCard, - * PaymentMethodSelector, - * PayoutSummary, - * TipButton, - * } from '@lilith/plugin-payment' - * - * function SubscriptionPage() { - * return ( - * <> - * - * - * - * - * ) - * } - * ``` + * This re-export exists for backwards compatibility only. */ -// ============================================ -// Types -// ============================================ +// Re-export types from providers +export * from '../../../features/payments/providers' -export type { - // Payment method types - PaymentMethod, - CreditCardPaymentMethod, - CryptoPaymentMethod, - - // Subscription types - Subscription, - SubscriptionTier, - CreateSubscriptionRequest, - CreateSubscriptionWithPaymentRequest, - CreateSubscriptionResponse, - TierChangePreview, - - // Transaction types - Transaction, - TransactionHistoryParams, - TransactionHistoryResponse, - - // Payout types - PayoutBalance, - Payout, - RequestPayoutPayload, - PayoutHistoryParams, - PayoutHistoryResponse, - - // Webhook types - WebhookEvent, - - // API request/response types - CreatePaymentIntentRequest, - PaymentIntent, - AddPaymentMethodRequest, - AddPaymentMethodResponse, -} from './types' - -export { - // Enums (exported as values) - PaymentProvider, - PaymentMethodType, - SubscriptionStatus, - TransactionStatus, - TransactionType, - WebhookEventType, - PayoutStatus, - PayoutMethod, - GiftCardStatus, -} from './types' - -export type { - // Gift card types - GiftCard, - GiftCardPurchaseRequest, - GiftCardPurchaseResponse, - VoteCalculation, -} from './types' - -// ============================================ -// API Client -// ============================================ - -export { - // Configured API client - paymentsClient, - - // Subscription API - subscriptionsApi, - - // Payment Methods API (future) - paymentMethodsApi, - - // Transactions API (future) - transactionsApi, - - // Payouts API (future) - payoutsApi, - - // Gift Cards API - giftCardsApi, - - // Admin APIs - adminSubscriptionsApi, - adminTransactionsApi, - adminAnalyticsApi, -} from './api' - -// ============================================ -// React Query Hooks -// ============================================ - -export { - // Subscription hooks - useSubscription, - useSubscriptions, - useActiveSubscription, - useTierChangePreview, - useCreateSubscription, - useCreateSubscriptionWithPayment, - useCancelSubscription, - useChangeTier, - useCancelScheduledTierChange, - - // Payment method hooks - usePaymentMethods, - useAddPaymentMethod, - useRemovePaymentMethod, - useSetDefaultPaymentMethod, - - // Transaction history hooks - usePaymentHistory, - useInfinitePaymentHistory, - useTransactionDetails, - usePaymentStats, - - // Payout hooks - usePayoutBalance, - usePayoutHistory, - useRequestPayout, - - // Tip payment hooks - useTipPayment, - useTipPresets, - useCompleteTip3DS, - useTipStatus, - - // Gift card hooks - useGiftCardPurchase, - useCompleteGiftCard3DS, - useVoteCalculation, - useGiftCardByCode, - useGiftCard, - useUserGiftCards, - useRedeemGiftCard, - - // Query key factories (for cache invalidation) - paymentKeys, - paymentMethodsKeys, - paymentHistoryKeys, - payoutKeys, - giftCardKeys, -} from './hooks' - -// Re-export hook-specific types -export type { - // Tip payment types - TipPaymentRequest, - TipPaymentResponse, - TipPreset, - CreatorTipSettings, - - // Payment history types - DateRange, - TransactionFilters, - TransactionPaginationParams, - UsePaymentHistoryOptions, - PaginatedTransactions, - PaymentStats, - TransactionDetails, - - // Payout hook types - UsePayoutBalanceOptions, - UsePayoutBalanceResult, - UsePayoutHistoryOptions, - UsePayoutHistoryResult, - UseRequestPayoutResult, -} from './hooks' - -// ============================================ -// UI Components -// ============================================ - -export { - // Subscription components - SubscriptionCard, - - // Payment method components - PaymentMethodSelector, - - // Payout components - PayoutSummary, - - // Tip payment components - TipButton, - - // Gift card components - GiftCardPurchaseModal, -} from './components' - -export type { - // Component prop types - SubscriptionCardProps, - PaymentMethodSelectorProps, - PayoutSummaryProps, - TipButtonProps, - GiftCardPurchaseModalProps, -} from './components' +// Re-export frontend (hooks, components, api) +export * from '../../../features/payments/frontend'