Trigger in-app upgrade flow for app env

Handle upgrade flow when running in the app environment by calling await puter.ui.requestUpgrade() in driverCall_. Added app-specific branches in two places where usage/insufficient-funds were previously handled only for web (which showed a web dialog). This ensures the in-app UI is used for upgrade requests and awaits the result.
This commit is contained in:
jelveh
2026-02-12 21:45:03 -08:00
parent b4c58c4f5c
commit f1a8fdb5c8
+4
View File
@@ -393,6 +393,8 @@ async function driverCall_ (
if ( lineObject?.error?.code === 'insufficient_funds' || lineObject?.metadata?.usage_limited === true ) {
if ( puter.env === 'web' ) {
showUsageLimitDialog('You have reached your usage limit for this account.<br>Please upgrade to continue.');
} else if ( puter.env === 'app' ) {
await puter.ui.requestUpgrade();
}
}
// Check for email confirmation required (e.g. AI calls)
@@ -484,6 +486,8 @@ async function driverCall_ (
if ( (isInsufficientFunds || isUsageLimited) && puter.env === 'web' ) {
showUsageLimitDialog('Your account has not enough funding to complete this request.<br>Please upgrade to continue.');
} else if ( (isInsufficientFunds || isUsageLimited) && puter.env === 'app' ) {
await puter.ui.requestUpgrade();
}
// Check for email confirmation required (e.g. AI calls) - web only