(
user?: {
stripeSubscriptionStatus?: string | null;
thirdPartyStripeSubscriptionId?: string | null;
} | null,
)
| 17 | }; |
| 18 | |
| 19 | export const userIsPro = ( |
| 20 | user?: { |
| 21 | stripeSubscriptionStatus?: string | null; |
| 22 | thirdPartyStripeSubscriptionId?: string | null; |
| 23 | } | null, |
| 24 | ) => { |
| 25 | if (!buildEnv.NEXT_PUBLIC_IS_CAP) return true; |
| 26 | |
| 27 | if (!user) return false; |
| 28 | |
| 29 | const { stripeSubscriptionStatus, thirdPartyStripeSubscriptionId } = user; |
| 30 | |
| 31 | // Check for third-party subscription first |
| 32 | if (thirdPartyStripeSubscriptionId) { |
| 33 | return true; |
| 34 | } |
| 35 | |
| 36 | // Then check regular subscription status |
| 37 | return ( |
| 38 | stripeSubscriptionStatus === "active" || |
| 39 | stripeSubscriptionStatus === "trialing" || |
| 40 | stripeSubscriptionStatus === "complete" || |
| 41 | stripeSubscriptionStatus === "paid" |
| 42 | ); |
| 43 | }; |
no outgoing calls
no test coverage detected