fix: add badge for disabled workflow actions and templates in trial mode (#19675)
* add badge for trial mode * fix tooltip issue * fix typo * add inactive team plan badge * change to one salesforce request * clean up * fix type error --------- Co-authored-by: CarinaWolli <[email protected]> Co-authored-by: Bailey Pumfleet <[email protected]>
This commit is contained in:
10 files changed
+61
-33
No files matched your search
@@ -1,3 +1,5 @@
|
||||
import type Stripe from "stripe";
|
||||
|
||||
export interface BillingService {
|
||||
checkoutSessionIsPaid(paymentId: string): Promise<boolean>;
|
||||
handleSubscriptionCancel(subscriptionId: string): Promise<void>;
|
||||
@@ -7,5 +9,5 @@ export interface BillingService {
|
||||
subscriptionItemId: string;
|
||||
membershipCount: number;
|
||||
}): Promise<void>;
|
||||
checkIfTeamHasActivePlan(subscriptionId: string): Promise<boolean>;
|
||||
getSubscriptionStatus(subscriptionId: string): Promise<Stripe.Subscription.Status | null>;
|
||||
}
|
||||
@@ -30,10 +30,10 @@ export class StripeBillingService implements BillingService {
|
||||
const checkoutSession = await this.stripe.checkout.sessions.retrieve(paymentId);
|
||||
return checkoutSession.payment_status === "paid";
|
||||
}
|
||||
async checkIfTeamHasActivePlan(subscriptionId: string) {
|
||||
async getSubscriptionStatus(subscriptionId: string) {
|
||||
const subscription = await this.stripe.subscriptions.retrieve(subscriptionId);
|
||||
if (!subscription || !subscription.status) return false;
|
||||
if (!subscription || !subscription.status) return null;
|
||||
|
||||
return subscription.status === "active" || subscription.status === "past_due";
|
||||
return subscription.status;
|
||||
}
|
||||
}
|
||||
@@ -161,10 +161,10 @@ export class InternalTeamBilling implements TeamBilling {
|
||||
paymentRequired: false,
|
||||
};
|
||||
}
|
||||
/** Used to check if the current team plan is active */
|
||||
async checkIfTeamHasActivePlan() {
|
||||
/** Returns the subscription status (active, past_due, trialing, ...) */
|
||||
async getSubscriptionStatus() {
|
||||
const { subscriptionId } = this.team.metadata;
|
||||
if (!subscriptionId) return false;
|
||||
return await billing.checkIfTeamHasActivePlan(subscriptionId);
|
||||
if (!subscriptionId) return null;
|
||||
return await billing.getSubscriptionStatus(subscriptionId);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user