fix(core): fix subscribe link for pro plan (#6627)

This commit is contained in:
EYHN 2024-04-19 06:36:38 +00:00
parent 9d412d22cb
commit 4085cc6728
No known key found for this signature in database
GPG Key ID: 46C9E26A75AB276C
2 changed files with 9 additions and 1 deletions

View File

@ -46,6 +46,11 @@ export class Subscription extends Entity {
? subscriptions.some(sub => sub.plan === SubscriptionPlan.Pro)
: null
);
pro$ = this.subscription$.map(subscriptions =>
subscriptions
? subscriptions.find(sub => sub.plan === SubscriptionPlan.Pro)
: null
);
isSelfHosted$ = this.subscription$.map(subscriptions =>
subscriptions
? subscriptions.some(sub => sub.plan === SubscriptionPlan.SelfHosted)

View File

@ -46,7 +46,10 @@ export const Component = () => {
}
setMessage('Checking subscription status...');
await subscriptionService.subscription.waitForRevalidation(signal);
const subscribed = !!subscriptionService.subscription.ai$.value;
const subscribed =
plan?.toLowerCase() === 'ai'
? !!subscriptionService.subscription.ai$.value
: !!subscriptionService.subscription.pro$.value;
if (!subscribed) {
setMessage('Creating checkout...');
try {