fix(app): review fixes — billing-unknown pre-check, free-user top-ups, pro out-of-credits copy
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -26,16 +26,12 @@ import { getMockPlantByImage } from '../services/backend/mockCatalog';
|
||||
import { consumeSharedImageUri, SHARE_INTENT_KEY } from '../utils/shareHandoff';
|
||||
import { OutOfCreditsSheet } from '../components/OutOfCreditsSheet';
|
||||
|
||||
const HEALTH_CHECK_CREDIT_COST = 2;
|
||||
const DEMO_SCAN_LIMIT = 5;
|
||||
|
||||
const getBillingCopy = (language: 'de' | 'en' | 'es') => {
|
||||
if (language === 'de') {
|
||||
return {
|
||||
creditsLabel: 'Credits',
|
||||
noCreditsTitle: 'Keine Credits mehr',
|
||||
noCreditsMessage: 'Du hast keine Credits mehr fuer KI-Scans. Upgrade oder Top-up im Profil.',
|
||||
healthNoCreditsMessage: `Du brauchst ${HEALTH_CHECK_CREDIT_COST} Credits fuer den Health-Check.`,
|
||||
managePlan: 'Plan verwalten',
|
||||
dismiss: 'Schliessen',
|
||||
genericErrorTitle: 'Fehler',
|
||||
@@ -68,9 +64,6 @@ const getBillingCopy = (language: 'de' | 'en' | 'es') => {
|
||||
if (language === 'es') {
|
||||
return {
|
||||
creditsLabel: 'Creditos',
|
||||
noCreditsTitle: 'Sin creditos',
|
||||
noCreditsMessage: 'No tienes creditos para escaneos AI. Actualiza o compra top-up en Perfil.',
|
||||
healthNoCreditsMessage: `Necesitas ${HEALTH_CHECK_CREDIT_COST} creditos para el health-check.`,
|
||||
managePlan: 'Gestionar plan',
|
||||
dismiss: 'Cerrar',
|
||||
genericErrorTitle: 'Error',
|
||||
@@ -102,9 +95,6 @@ const getBillingCopy = (language: 'de' | 'en' | 'es') => {
|
||||
|
||||
return {
|
||||
creditsLabel: 'Credits',
|
||||
noCreditsTitle: 'No credits left',
|
||||
noCreditsMessage: 'You have no AI scan credits left. Upgrade or buy a top-up in Profile.',
|
||||
healthNoCreditsMessage: `You need ${HEALTH_CHECK_CREDIT_COST} credits for the health check.`,
|
||||
managePlan: 'Manage plan',
|
||||
dismiss: 'Close',
|
||||
genericErrorTitle: 'Error',
|
||||
@@ -286,8 +276,11 @@ export default function ScannerScreen() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Only pre-block when the billing summary is actually known; if it's null
|
||||
// (fetch failed / still loading) let the request proceed — the server 402
|
||||
// path opens the sheet as the safety net.
|
||||
const requiredCredits = isHealthMode ? 2 : 1;
|
||||
if (!isDemoMode && availableCredits < requiredCredits) {
|
||||
if (!isDemoMode && billingSummary && availableCredits < requiredCredits) {
|
||||
posthog.capture('out_of_credits_shown', { trigger: 'pre_check', scan_type: isHealthMode ? 'health_check' : 'identification' });
|
||||
setOutOfCreditsVisible(true);
|
||||
return;
|
||||
@@ -862,6 +855,7 @@ export default function ScannerScreen() {
|
||||
visible={outOfCreditsVisible}
|
||||
language={language}
|
||||
colors={colors}
|
||||
isPro={hasActiveEntitlement}
|
||||
renewsAtIso={billingSummary?.credits.cycleEndsAt}
|
||||
onSeePlans={() => {
|
||||
setOutOfCreditsVisible(false);
|
||||
|
||||
Reference in New Issue
Block a user