/** * PaymentMethodSelector Usage Examples * * This file demonstrates how to use the PaymentMethodSelector component * in different scenarios. */ import { useState } from 'react' import { PaymentMethodSelector } from './PaymentMethodSelector' /** * Example 1: Basic usage with both card and crypto options */ export function BasicPaymentMethodSelector() { const [selectedMethodId, setSelectedMethodId] = useState() return ( { console.log(`Add new ${type} payment method`) // Open modal to add payment method }} /> ) } /** * Example 2: Card-only selector */ export function CardOnlySelector() { const [selectedMethodId, setSelectedMethodId] = useState() return ( { console.log(`Add new ${type} payment method`) }} allowedTypes={['card']} /> ) } /** * Example 3: Crypto-only selector */ export function CryptoOnlySelector() { const [selectedMethodId, setSelectedMethodId] = useState() return ( { console.log(`Add new ${type} payment method`) }} allowedTypes={['crypto']} /> ) } /** * Example 4: Disabled state */ export function DisabledSelector() { const [selectedMethodId, setSelectedMethodId] = useState('pm-123') return ( { console.log(`Add new ${type} payment method`) }} disabled={true} /> ) } /** * Example 5: Integration with subscription purchase flow */ export function SubscriptionPaymentFlow() { const [selectedMethodId, setSelectedMethodId] = useState() const [showAddModal, setShowAddModal] = useState<'card' | 'crypto' | null>(null) const handlePurchase = async () => { if (!selectedMethodId) { alert('Please select a payment method') return } // Process subscription purchase with selected payment method console.log('Processing subscription with method:', selectedMethodId) } return (

Subscribe to Premium

Select a payment method to continue

setShowAddModal(type)} /> {showAddModal && (
Add {showAddModal} modal would open here
)}
) } /** * Example 6: Integration with booking deposit payment */ export function BookingDepositPayment({ bookingId }: { bookingId: string }) { const [selectedMethodId, setSelectedMethodId] = useState() const [isProcessing, setIsProcessing] = useState(false) const handlePayDeposit = async () => { if (!selectedMethodId) return setIsProcessing(true) try { // Process booking deposit payment console.log('Processing deposit for booking:', bookingId, 'with method:', selectedMethodId) // await api.createPaymentIntent({ ... }) } finally { setIsProcessing(false) } } return (

Pay Booking Deposit

{ console.log(`Redirect to add ${type} payment method`) }} disabled={isProcessing} />
) }