MCPcopy Create free account
hub / github.com/CapSoftware/Cap / userIsPro

Function userIsPro

packages/utils/src/constants/plans.ts:19–43  ·  view source on GitHub ↗
(
	user?: {
		stripeSubscriptionStatus?: string | null;
		thirdPartyStripeSubscriptionId?: string | null;
	} | null,
)

Source from the content-addressed store, hash-verified

17};
18
19export 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};

Callers 15

requireOwnerProMethod · 0.90
Http.tsFile · 0.90
importFromLoomFunction · 0.90
importFromLoomCsvFunction · 0.90
loadEditableVideoFunction · 0.90
createSpaceFunction · 0.90
updateSpaceFunction · 0.90
updateDomainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected