feat(funnel): add dedicated high-converting app handoff section after results and on landing page

This commit is contained in:
2026-11-11 15:28:19 +05:30
parent 7799aed34b
commit 6c6d774d5b
3 changed files with 491 additions and 22 deletions
+89
View File
@@ -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(
<PostResultAppHandoff
tool={mockTool}
app={mockApp}
locale="en"
variant="post-result"
/>
);
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(
<PostResultAppHandoff
tool={mockTool}
app={null}
locale="en"
variant="post-result"
/>
);
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(
<PostResultAppHandoff
tool={mockTool}
app={mockApp}
locale="en"
hasDownloaded={true}
variant="post-result"
/>
);
expect(html).toContain('HD result saved!');
expect(html).toContain('50 CREDITS UNLOCKED');
});
});