Skip to content

feat: added web redirect#2087

Draft
RohitKushvaha01 wants to merge 5 commits intoAcode-Foundation:ajit/fix-fetch-auth-configfrom
RohitKushvaha01:ajit/fix-fetch-auth-config
Draft

feat: added web redirect#2087
RohitKushvaha01 wants to merge 5 commits intoAcode-Foundation:ajit/fix-fetch-auth-configfrom
RohitKushvaha01:ajit/fix-fetch-auth-config

Conversation

@RohitKushvaha01
Copy link
Copy Markdown
Member

No description provided.

@RohitKushvaha01 RohitKushvaha01 marked this pull request as draft May 6, 2026 13:50
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 6, 2026

Greptile Summary

This PR adds a web redirect flow for purchasing paid plugins when the native In-App Purchase (IAP) system is unavailable. Unauthenticated users are sent to the login page; authenticated users are sent to the plugin's web purchase page.

  • plugin.view.js gains a new openPluginWebsite async function (with try/catch) and an early-return Buttons branch that renders a browser-open button instead of the IAP buy button when !config.IAP_AVAILABLE && isPaid && !purchased && price.
  • extensions/index.js mirrors the same redirect logic inside the sidebar install handler, guarding on !remotePlugin.owned before redirecting.
  • plugin.js adds an import auth that is unused in that file.

Confidence Score: 5/5

The web-redirect logic is self-contained, guarded by try/catch, and consistent across both entry points; the only stray change is an unused import in plugin.js.

Both redirect paths are correctly gated on IAP availability, ownership status, and login state. No data-integrity or security concerns were found. The unused auth import in plugin.js is a cosmetic issue that does not affect runtime behavior.

No files require special attention.

Important Files Changed

Filename Overview
src/pages/plugin/plugin.js Only change is adding import auth from "lib/auth", which is unused — auth is never referenced in this file.
src/pages/plugin/plugin.view.js Adds id prop to Buttons, adds openPluginWebsite async function with try/catch, and renders a web-redirect buy button when !config.IAP_AVAILABLE. Logic is correct and consistent with how purchased is set upstream.
src/sidebarApps/extensions/index.js Adds auth import and an early-return web-redirect block for paid plugins when IAP is unavailable and the plugin is not yet owned. Logic mirrors the plugin detail page correctly.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User taps Buy button] --> B{config.IAP_AVAILABLE?}
    B -- Yes --> C[Native IAP flow]
    B -- No --> D[Call auth.getLoggedInUser]
    D --> E{User logged in?}
    E -- No --> F[Open login page in browser]
    E -- Yes --> G[Open plugin purchase page in browser]
    F --> H[User completes login on web]
    G --> I[User completes purchase on web]
Loading

Reviews (2): Last reviewed commit: "fix: check owned before launching webpag..." | Re-trigger Greptile

Comment thread src/pages/plugin/plugin.view.js
Comment thread src/sidebarApps/extensions/index.js
Comment thread src/pages/plugin/plugin.js Outdated
Comment thread src/pages/plugin/plugin.view.js
Comment thread src/pages/plugins/item.js Outdated
@bajrangCoder bajrangCoder self-assigned this May 7, 2026
@RohitKushvaha01
Copy link
Copy Markdown
Member Author

@greptileai

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants