Repository navigation
Show the upgrade in Builder from the Upgrade dialog - #189
Merged
Merged
Conversation
The Upgrade button in the "Upgrade your Puter plan" dialog now asks puter.js to show the upgrade first: in a frame over the page on the web, or the desktop's upgrade window inside Puter. Where puter.js has neither (localhost, for one), the button still opens Puter's upgrade page in a new tab, as before. A payment made in the frame is checked for as soon as the frame closes, so the success dialog and 'Upgrade Completed' no longer wait for the tab to regain focus.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
The Upgrade button in the "Upgrade your Puter plan" dialog used to always open Puter's upgrade page in a new tab. It now asks puter.js to show the upgrade first, and only opens the page when puter.js has nothing to show.
puter.ui.requestUpgrade()shows the upgrade in a frame over Builder.If the frame can't open, puter.js opens the upgrade page itself.
After the upgrade
A payment made in the frame is checked for as soon as the frame closes, so the success dialog and
Upgrade Completedno longer wait for the tab to regain focus. The plan is read up to five times, two seconds apart, in case it isn't on the account yet. If it still isn't, the click stays pending and the existing focus check picks it up.Not changed
Testing
scripts/test-upgrade-pending.mjsnow covers the new path against the real code fromui.js: the frame, the desktop, each case where the link is followed instead, a plan that lands late, and a frame closed without paying.npm testpasses.