import React, { useState } from 'react'; import { XCircle, CheckCircle, Check, Download, RefreshCw, Smartphone } from 'lucide-react'; import type { VerificationResult, UserProfile } from '../../types'; interface PaymentSuccessModalProps { verificationResult: VerificationResult; onClose: () => void; loggedInUser: UserProfile | null; onDownloadInvoice: (paymentId: string, invoiceUrl?: string) => void; downloadingInvoice: boolean; } export const PaymentSuccessModal: React.FC = ({ verificationResult, onClose, loggedInUser, onDownloadInvoice, downloadingInvoice, }) => { const [desktopNotice, setDesktopNotice] = useState(false); // Handler to reliably launch the Acupedia Mobile App across platforms (Android, iOS, and Desktop) const handleOpenApp = (e: React.MouseEvent) => { e.preventDefault(); const userAgent = navigator.userAgent || ''; const isAndroid = /Android/i.test(userAgent); const isIOS = /iPhone|iPad|iPod/i.test(userAgent); if (isAndroid) { // Android Chrome requires an Intent URI format to launch apps by package and scheme reliably const intentUrl = 'intent://#Intent;scheme=acupedia;package=com.anonymous.acupedia;end'; window.location.href = intentUrl; // Fallback to custom URI schemes in case intent fails or Expo uses alternate scheme setTimeout(() => { window.location.href = 'acupedia://'; }, 500); setTimeout(() => { window.location.href = 'myapp://'; }, 1000); } else if (isIOS) { // iOS Safari and Chrome handle custom URI schemes directly window.location.href = 'acupedia://'; // Fallback in case Expo uses default 'myapp://' scheme setTimeout(() => { window.location.href = 'myapp://'; }, 500); } else { // On desktop browsers, try opening the registered custom scheme window.location.href = 'acupedia://'; // Show helpful desktop feedback informing the user how to access content on mobile setDesktopNotice(true); } }; return (
{/* Ambient Background Glow */}
{/* Close button */} {/* Glowing animated green checkmark */}

Thank You for Your Purchase!

Clinical Modules Unlocked Successfully

{/* Content: Mobile App Access Onboarding */}

Your subscription entitlements are active! Access your content inside the{' '} Acupedia Mobile App. Log in with:{' '} {loggedInUser?.email || 'your registered email'} .

{/* App download badges */}
{/* Details listing: ID, Invoice, Amount, Items */}
Invoice
{verificationResult.invoiceNumber} {verificationResult.invoiceNumber && ( )}
Payment ID {verificationResult.paymentId}
Amount Paid {verificationResult.currency === 'INR' ? `₹${verificationResult.amount}` : verificationResult.currency === 'EUR' ? `€${verificationResult.amount}` : `$${verificationResult.amount}`}
Unlocked Modules
{verificationResult.items?.map((itemName: string, idx: number) => ( {itemName} ))}
{/* Action buttons */}
{verificationResult.invoiceNumber && ( )} {/* Open in App Button */} Open in App {desktopNotice && (

📱 Attempted to launch Acupedia App. If you are on desktop, please open the Acupedia App on your mobile device to view your unlocked content.

)}
); };