mirror of
https://github.com/HeyPuter/puter.git
synced 2026-05-04 00:20:45 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user