Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
import { buildEnv } from "@cap/env";
export const STRIPE_DEVELOPER_CREDITS_PRODUCT_ID: Record<string, string> = {
development: "prod_U4mswfBp0bFc39",
production: "prod_REPLACE_BEFORE_PRODUCTION",
};
export const STRIPE_PLAN_IDS = {
development: {
yearly: "price_1Q3esrFJxA1XpeSsFwp486RN",
monthly: "price_1P9C1DFJxA1XpeSsTwwuddnq",
},
production: {
yearly: "price_1S2al7FJxA1XpeSsJCI5Z2UD",
monthly: "price_1S2akxFJxA1XpeSsfoAUUbpJ",
},
};
export const isValidStripePlanPriceId = (
priceId: string,
environment: keyof typeof STRIPE_PLAN_IDS,
): boolean => {
const envPlans = STRIPE_PLAN_IDS[environment];
return priceId === envPlans.yearly || priceId === envPlans.monthly;
};
export const STRIPE_SIGNED_BAA_PRICE_IDS: Record<string, string> = {
development: "price_1U5xKIFJxA1XpeSsdg4Q8H3Z",
production: "price_1U6C99FJxA1XpeSsUg1rXHo2",
};
export const SIGNED_BAA_PRICE_PER_MONTH = 99;
export const STRIPE_SAML_SSO_PRICE_ID = "price_1UBJpTFJxA1XpeSsQmAOhibr";
export const STRIPE_SAML_SSO_LEGACY_PRICE_ID = "price_1UBJQuFJxA1XpeSsnxL2KhP7";
export const STRIPE_SAML_SSO_PRODUCT_ID = "prod_VBgo5t1scWLUPy";
export const userIsPro = (
user?: {
stripeSubscriptionStatus?: string | null;
thirdPartyStripeSubscriptionId?: string | null;
} | null,
) => {
if (!buildEnv.NEXT_PUBLIC_IS_CAP) return true;
if (!user) return false;
const { stripeSubscriptionStatus, thirdPartyStripeSubscriptionId } = user;
// Check for third-party subscription first
if (thirdPartyStripeSubscriptionId) {
return true;
}
// Then check regular subscription status. past_due keeps Pro during
// Stripe's dunning window: the sub moves to canceled/unpaid when retries
// exhaust, which is when access actually drops.
return (
stripeSubscriptionStatus === "active" ||
stripeSubscriptionStatus === "trialing" ||
stripeSubscriptionStatus === "complete" ||
stripeSubscriptionStatus === "paid" ||
stripeSubscriptionStatus === "past_due"
);
};