refactor(plugins): clean up plugin exports and index
Streamline plugin package exports for better tree-shaking. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
a0a391159a
commit
205fc67f24
1 changed files with 10 additions and 255 deletions
|
|
@ -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 (
|
||||
* <>
|
||||
* <SubscriptionCard subscriptionId="sub-123" />
|
||||
* <PaymentMethodSelector userId="user-456" />
|
||||
* <TipButton creatorId="creator-789" />
|
||||
* </>
|
||||
* )
|
||||
* }
|
||||
* ```
|
||||
* 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'
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue