Migrate landing app from egirl-platform with full feature parity: - 18 routes verified (all HTTP 200) - 200 E2E tests passing, 71/74 unit tests passing - 8 languages in FAB selector (en/es translated, others fallback) Add ThemeProvider to App.tsx for styled-components theme context. Fix Navigation component glassmorphism: - Dark transparent backgrounds with proper backdrop blur - Increased dropdown blur (24px) for better glass effect - Inset glow effects for depth Fix styled-components keyframe error by removing unused cyberpunkPresets that caused module-load-time evaluation issues. Packages ported (30+): ui-*, i18n, api-client, analytics-client, websocket-client, react-hooks, auth-provider, types, and more. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
238 lines
5.1 KiB
TypeScript
238 lines
5.1 KiB
TypeScript
/**
|
|
* @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
|
|
*
|
|
* @example Basic API usage
|
|
* ```tsx
|
|
* import { paymentsClient, subscriptionsApi } from '@lilith/plugin-payment'
|
|
*
|
|
* // Direct API client usage
|
|
* const response = await paymentsClient.get('/subscriptions/123')
|
|
*
|
|
* // 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" />
|
|
* </>
|
|
* )
|
|
* }
|
|
* ```
|
|
*/
|
|
|
|
// ============================================
|
|
// Types
|
|
// ============================================
|
|
|
|
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,
|
|
} 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,
|
|
|
|
// 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,
|
|
|
|
// Query key factories (for cache invalidation)
|
|
paymentKeys,
|
|
paymentMethodsKeys,
|
|
paymentHistoryKeys,
|
|
payoutKeys,
|
|
} 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,
|
|
} from './components'
|
|
|
|
export type {
|
|
// Component prop types
|
|
SubscriptionCardProps,
|
|
PaymentMethodSelectorProps,
|
|
PayoutSummaryProps,
|
|
TipButtonProps,
|
|
} from './components'
|