From 6c6d774d5b276113b53d28cc0342ab6d0b041bb1 Mon Sep 17 00:00:00 2001 From: vshnosngh Date: Wed, 11 Nov 2026 15:28:19 +0530 Subject: [PATCH] feat(funnel): add dedicated high-converting app handoff section after results and on landing page --- src/components/tools/DynamicToolWorkspace.tsx | 56 +-- src/components/tools/PostResultAppHandoff.tsx | 368 ++++++++++++++++++ tests/appHandoff.test.tsx | 89 +++++ 3 files changed, 491 insertions(+), 22 deletions(-) create mode 100644 src/components/tools/PostResultAppHandoff.tsx create mode 100644 tests/appHandoff.test.tsx diff --git a/src/components/tools/DynamicToolWorkspace.tsx b/src/components/tools/DynamicToolWorkspace.tsx index c8e1faa..79f3858 100644 --- a/src/components/tools/DynamicToolWorkspace.tsx +++ b/src/components/tools/DynamicToolWorkspace.tsx @@ -30,6 +30,7 @@ import { ThumbnailsSection } from './ThumbnailsSection'; import { AlternatingFeaturesSection } from './AlternatingFeaturesSection'; import { ProcessingOverlay } from './ProcessingOverlay'; import { ImageCropper } from './ImageCropper'; +import { PostResultAppHandoff } from './PostResultAppHandoff'; import { AnimatedShinyText } from '@/components/magicui/animated-shiny-text'; import { BorderBeam } from '@/components/magicui/border-beam'; @@ -92,6 +93,7 @@ export function DynamicToolWorkspace({ const [comparisonBeforeUrl, setComparisonBeforeUrl] = useState(null); const [errorMessage, setErrorMessage] = useState(''); const [remainingTries, setRemainingTries] = useState(tool.tryIt?.limits?.perDay || 5); + const [hasDownloadedResult, setHasDownloadedResult] = useState(false); const fileInputRef = useRef(null); const secondaryFileInputRef = useRef(null); @@ -307,6 +309,17 @@ export function DynamicToolWorkspace({ } }; + const handleDownloadResult = () => { + setHasDownloadedResult(true); + if (!resultUrl) return; + const link = document.createElement('a'); + link.href = resultUrl; + link.download = `${tool.slug}-result.png`; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + }; + const handleResetStudio = () => { setPrimaryFile(null); setPrimaryPreview(null); @@ -314,6 +327,7 @@ export function DynamicToolWorkspace({ setSecondaryPreview(null); setResultUrl(null); setComparisonBeforeUrl(null); + setHasDownloadedResult(false); setStatus('idle'); setErrorMessage(''); if (fileInputRef.current) fileInputRef.current.value = ''; @@ -446,16 +460,25 @@ export function DynamicToolWorkspace({ - Download Result (HD PNG) - + + + {/* POST-RESULT DEDICATED APP INSTALLATION & HANDOFF FUNNEL */} + ) : ( /* PRE-EDIT WORKSPACE (Interactive Editing by Page Type) */ @@ -1084,25 +1107,14 @@ export function DynamicToolWorkspace({ )} {/* ================= NATIVE APP HANDOFF CTA ================= */} -
+
-
-
-

- Need Batch Processing or 4K Lossless Export? -

-

- Open {toolName} in {homeApp ? resolveLocalised(homeApp.name, locale) : 'our native apps'} with GPU acceleration and RAW format export. -

-
- - - Explore Mobile Apps Suite - -
+
diff --git a/src/components/tools/PostResultAppHandoff.tsx b/src/components/tools/PostResultAppHandoff.tsx new file mode 100644 index 0000000..f5a6327 --- /dev/null +++ b/src/components/tools/PostResultAppHandoff.tsx @@ -0,0 +1,368 @@ +'use client'; + +import React, { useState, useEffect } from 'react'; +import QRCode from 'qrcode'; +import { + Smartphone, + Sparkles, + Copy, + Check, + ExternalLink, + ShieldCheck, + Zap, + Star, + Layers, + CheckCircle2, + Gift, + ArrowRight +} from 'lucide-react'; +import { ToolItem, AppItem, resolveLocalised } from '@/types'; + +interface PostResultAppHandoffProps { + tool: ToolItem; + app?: AppItem | null; + locale?: string; + hasDownloaded?: boolean; + variant?: 'post-result' | 'landing'; +} + +export function PostResultAppHandoff({ + tool, + app, + locale = 'en', + hasDownloaded = false, + variant = 'post-result', +}: PostResultAppHandoffProps) { + const [qrDataUrl, setQrDataUrl] = useState(''); + const [copiedPromo, setCopiedPromo] = useState(false); + const [copiedLink, setCopiedLink] = useState(false); + const [origin, setOrigin] = useState(''); + + useEffect(() => { + if (typeof window !== 'undefined') { + setOrigin(window.location.origin); + } + }, []); + + // Standard fallback app profile if none provided + const appData: AppItem = app || { + id: 'portrait-app', + slug: 'portrait-app', + status: 'published', + name: { en: 'Portrait Studio AI', hi: 'पोर्ट्रेट स्टूडियो एआई' }, + tagline: { en: 'Natural professional portrait retouching in your pocket', hi: 'आपकी जेब में प्राकृतिक पेशेवर पोर्ट्रेट संपादन' }, + description: { en: 'The all-in-one portrait perfection suite.', hi: 'सर्वश्रेष्ठ पोर्ट्रेट संपादन ऐप।' }, + stores: { + android: { + packageId: 'com.creinnovations.portraitpro', + url: 'https://play.google.com/store/apps/details?id=com.creinnovations.portraitpro', + }, + ios: { + appId: '1672384910', + url: 'https://apps.apple.com/app/id1672384910', + }, + }, + tools: [tool.id], + rating: { + value: 4.8, + count: 28400, + source: 'App Store & Google Play', + }, + welcomeBonus: { + code: 'TRYWEB50', + title: '50 Free Pro Credits', + description: 'Install through this link to claim 50 free HD export credits.', + }, + features: [ + 'Unlimited 4K batch processing for full galleries', + 'Lossless RAW & Ultra-HD PNG export without compression', + 'Instant offline on-device GPU inference', + 'Exclusive pro retouching & neural enhancement styles', + ], + }; + + const appName = resolveLocalised(appData.name, locale); + const appTagline = resolveLocalised(appData.tagline, locale); + const bonusCode = appData.welcomeBonus?.code || 'TRYWEB50'; + + const baseHost = origin || 'http://localhost:3000'; + const targetUrl = `${baseHost}/go/${tool.slug}/${appData.slug}?promo=${bonusCode}&src=${variant}`; + const iosUrl = appData.stores?.ios?.url || `/go/${tool.slug}/${appData.slug}?promo=${bonusCode}&src=ios`; + const androidUrl = appData.stores?.android?.url || `/go/${tool.slug}/${appData.slug}?promo=${bonusCode}&src=android`; + + // Generate dynamic QR Code for instant phone handoff + useEffect(() => { + QRCode.toDataURL(targetUrl, { + width: 240, + margin: 1, + color: { + dark: '#0f172a', + light: '#ffffff', + }, + }) + .then((url) => setQrDataUrl(url)) + .catch((err) => console.error('Failed to generate QR code:', err)); + }, [targetUrl]); + + const handleCopyPromo = (e: React.MouseEvent) => { + e.stopPropagation(); + navigator.clipboard.writeText(bonusCode); + setCopiedPromo(true); + setTimeout(() => setCopiedPromo(false), 2200); + }; + + const handleCopyLink = (e: React.MouseEvent) => { + e.stopPropagation(); + navigator.clipboard.writeText(targetUrl); + setCopiedLink(true); + setTimeout(() => setCopiedLink(false), 2200); + }; + + return ( +
+ {/* Post-Download Celebratory Toast (if user clicked download) */} + {hasDownloaded && ( +
+
+ + + HD result saved! Need to edit more photos? Get {appName} for unlimited 4K batch processing. + +
+ + 50 CREDITS UNLOCKED + +
+ )} + + {/* Primary Conversion Header */} +
+
+ {/* Rating & Bonus Pill */} +
+
+ + {appData.rating?.value || 4.8} +
+ | + Official Mobile App + | + 50 Free Bonus Credits +
+ +

+ {variant === 'post-result' + ? `Love this result? Take it further in ${appName}` + : `Experience ${tool.name ? resolveLocalised(tool.name, locale) : 'Photo Tools'} in ${appName}`} +

+

+ The web studio is limited to 5 single-photo tries daily. Install our native mobile app to process full photo galleries in 4K lossless resolution with zero wait times. +

+
+ + {/* Voucher Code Box */} +
+
+
+ + Welcome Voucher +
+ + {bonusCode} + +
+ +
+
+ + {/* Main Grid: Features vs Installation Options */} +
+ + {/* Left Column: Why Upgrade to App (Perks List) */} +
+ + Why creators use the mobile app: + + +
+ +
+
+
+ +
+
+ Unlimited 4K Batch Runs +
+
+

+ Edit 50+ photos at once with zero web limits or queues. +

+
+ +
+
+
+ +
+
+ Lossless RAW Quality +
+
+

+ Retain original camera sensor megapixels and skin textures. +

+
+ +
+
+
+ +
+
+ Instant On-Device GPU +
+
+

+ Hardware neural acceleration for sub-second offline edits. +

+
+ +
+
+
+ +
+
+ 100% Private & Ad-Free +
+
+

+ No telemetry, no watermarks, and zero cloud photo storage. +

+
+ +
+ + {/* Direct Store Download Action Buttons */} +
+ + Direct store download links: + + +
+ {/* Apple App Store Official Badge Button */} + + +
+ Download on the + App Store +
+ +
+ + {/* Google Play Official Badge Button */} + + +
+ GET IT ON + Google Play +
+ +
+ + {/* Copy Direct Link */} + +
+
+
+ + {/* Right Column: Scan with Camera QR Code Card */} +
+
+ +
+ + Scan with Phone Camera +
+ + {/* QR Code Canvas/Image */} +
+ {qrDataUrl ? ( + // eslint-disable-next-line @next/next/no-img-element + {`Scan + ) : ( +
+ Generating QR... +
+ )} +
+ +
+

+ Instantly opens App Store or Google Play with promo code {bonusCode} applied. +

+ + Works on iOS 15+ and Android 9+ + +
+ +
+
+ +
+ +
+ ); +} diff --git a/tests/appHandoff.test.tsx b/tests/appHandoff.test.tsx new file mode 100644 index 0000000..9bed2ad --- /dev/null +++ b/tests/appHandoff.test.tsx @@ -0,0 +1,89 @@ +import { describe, it, expect } from 'vitest'; +import React from 'react'; +import { renderToString } from 'react-dom/server'; +import { PostResultAppHandoff } from '@/components/tools/PostResultAppHandoff'; +import { ToolItem, AppItem } from '@/types'; + +const mockTool: ToolItem = { + id: 'face.blemish.remove', + slug: 'blemish-remover', + status: 'published', + homeApp: 'portrait-app', + category: 'portrait-retouch', + name: { en: 'Blemish Remover', hi: 'ब्लेमिश रिमूवर' }, + summary: { en: 'Remove blemishes naturally', hi: 'दाग-धब्बे हटाएं' }, + tryIt: { + enabled: true, + endpointRef: { id: 'test-endpoint' }, + limits: { perDay: 5, maxMB: 12, maxPixels: 4000000, formats: ['jpg'] }, + }, +}; + +const mockApp: AppItem = { + id: 'portrait-app', + slug: 'portrait-app', + status: 'published', + name: { en: 'Portrait Studio AI', hi: 'पोर्ट्रेट स्टूडियो एआई' }, + tagline: { en: 'Professional portrait retouching', hi: 'पेशेवर पोर्ट्रेट संपादन' }, + description: { en: 'All in one suite', hi: 'ऑल इन वन' }, + stores: { + android: { packageId: 'com.cre.portrait', url: 'https://play.google.com/store/apps/details?id=com.cre.portrait' }, + ios: { appId: '12345', url: 'https://apps.apple.com/app/id12345' }, + }, + tools: ['face.blemish.remove'], + rating: { value: 4.9, count: 32000, source: 'App Store & Google Play' }, + welcomeBonus: { code: 'VIP50', title: '50 Bonus Credits', description: '50 Free HD runs' }, + features: ['Batch processing', '4K export'], +}; + +describe('PostResultAppHandoff (Post-Result App Conversion)', () => { + it('renders app name, rating, store buttons, and voucher code', () => { + const html = renderToString( + + ); + + expect(html).toContain('Portrait Studio AI'); + expect(html).toContain('App Store'); + expect(html).toContain('Google Play'); + expect(html).toContain('VIP50'); + expect(html).toContain('4.9'); + expect(html).toContain('Unlimited 4K Batch Runs'); + expect(html).toContain('Scan with Phone Camera'); + }); + + it('renders fallback app information gracefully when app prop is null', () => { + const html = renderToString( + + ); + + expect(html).toContain('Portrait Studio AI'); + expect(html).toContain('App Store'); + expect(html).toContain('Google Play'); + expect(html).toContain('TRYWEB50'); + }); + + it('displays post-download celebratory toast when hasDownloaded is true', () => { + const html = renderToString( + + ); + + expect(html).toContain('HD result saved!'); + expect(html).toContain('50 CREDITS UNLOCKED'); + }); +});