Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes/issue#388 #393

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Fixes/issue#388 #393

wants to merge 2 commits into from

Conversation

VishalRpR
Copy link

@VishalRpR VishalRpR commented Dec 7, 2024

Description

When user subscribes, on the success page, call the same function as when they click "Open App" in their dashboard, so the app has the updated JWT

Related Issue

#388

Changes Made

Abstracted the Successpage as client side conponent and called the funtion for open App when user reaches success page on dashboard

Screenshots

Screenshot from 2024-12-07 13-12-14

Checklist

  • I have tagged the issue in this PR.
  • I have attached necessary screenshots.
  • I have provided a short description of the PR.
  • I ran yarn build and build is successful
  • My code follows the style guidelines of this project.
  • I have added necessary documentation (if applicable)

Important

Abstracts success page into SuccessCard component and updates JWT on subscription success by calling openApp.

  • Behavior:
    • Abstracts success page into SuccessCard component in success-card.tsx.
    • Calls openApp function on subscription success to update JWT.
  • Functions:
    • openApp in SuccessCard constructs callback URL and navigates using router.push().
    • Handles errors with toast.error() if URL is unsafe or navigation fails.
  • Data Fetching:
    • getUserAndSubscription used in DashboardSuccess to fetch query params for app opening.

This description was created by Ellipsis for 19576d2. It will automatically update as commits are pushed.

Copy link

vercel bot commented Dec 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
pear-landing-page ❌ Failed (Inspect) Dec 9, 2024 11:59am
pear-landing-page-dev ❌ Failed (Inspect) Dec 9, 2024 11:59am
pear-landing-page-main ❌ Failed (Inspect) Dec 9, 2024 11:59am

Copy link

vercel bot commented Dec 7, 2024

@VishalRpR is attempting to deploy a commit to the PearAI Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Changes requested. Reviewed everything up to 19576d2 in 1 minute and 36 seconds

More details
  • Looked at 120 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. components/dashboard/success-card.tsx:22
  • Draft comment:
    Ensure openAppQueryParams is a string before concatenating it with DEFAULT_OPEN_APP_CALLBACK. If it's a URLSearchParams, convert it to a string first.
  • Reason this comment was not posted:
    Comment did not seem useful.
2. components/dashboard/success-card.tsx:27
  • Draft comment:
    Ensure isAllowedUrl function is robust and correctly identifies unsafe URLs. Review its implementation if necessary.
  • Reason this comment was not posted:
    Comment did not seem useful.

Workflow ID: wflow_vtnLJ3OmtN4jHJw3


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

components/dashboard/success-card.tsx Show resolved Hide resolved
import { isAllowedUrl } from "@/lib/utils";
import { toast } from "sonner";

const DEFAULT_OPEN_APP_CALLBACK = "pearai://pearai.pearai/auth";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This constant is duplicated. Consider defining it in a shared constants file and importing it where needed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's reuse existing variable

Copy link
Contributor

@Fryingpannn Fryingpannn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes you made seems to only call this callback open functionality for subscription upgrades. We want this for when the user purchases a subscription, not just for upgrades.

import { isAllowedUrl } from "@/lib/utils";
import { toast } from "sonner";

const DEFAULT_OPEN_APP_CALLBACK = "pearai://pearai.pearai/auth";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's reuse existing variable

@VishalRpR
Copy link
Author

@Fryingpannn looking into it!

@VishalRpR
Copy link
Author

Screenshot from 2024-12-09 17-12-24
Reusing the existing variables along with the functionality on pricing/success page as well

@VishalRpR
Copy link
Author

@nang-dev

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.

2 participants