mirror of
https://github.com/yusufipk/OpenFrame.git
synced 2026-09-11 09:36:08 +00:00
The trial now starts inside the product, at email verification, and Stripe grants none at all: checkout creates a subscription that bills immediately. Verifying an address is what buys the seven days, which is also the cheapest abuse control there is. An unexpired trial is treated as an entitlement the account already holds, so a Stripe sync can add access but never retracts a trial that has not run out. That matters most for the abandoned checkout: the resulting incomplete subscription carries no trial_end, and writing it through would have erased the days the account still had and locked it out. Unpaid accounts are bounded by what they can cost us rather than by what they can do: one workspace, one project, 3 GiB of direct uploads. YouTube imports, share links, guests, comments and approvals stay unlimited, because those are the parts worth trying and they cost nothing. isPaidTier() is the new seam; hasBillingAccess() answers a different question now that access no longer implies a card. Signup CTAs, the pricing card, the comparison pages, the terms and the refund policy all said the trial converts to a paid plan by itself. It no longer does, so they say what happens instead. Settings and a banner name both dates that matter: when the trial ends, and the fifteen days after that during which nothing is deleted. /admin/growth compares the two funnels on signup to paid within a fixed 30 day window, not trial to paid. Dropping the card requirement multiplies trials, so the old ratio can fall while more people actually pay, and reading it that way would retire the change for the wrong reason.
38 lines
1.7 KiB
TypeScript
38 lines
1.7 KiB
TypeScript
// What a cardless trial is allowed to consume.
|
|
//
|
|
// The trial exists to let somebody run one real review cycle before paying: upload
|
|
// a cut, share it, collect feedback, upload the revision. Everything that costs us
|
|
// nothing (YouTube and Vimeo embeds, share links, guests, comments, approvals) is
|
|
// therefore unlimited, and the caps sit only on the two things that do cost money
|
|
// or invite abuse: how much we store, and how many workspaces one unpaid account
|
|
// can hold open.
|
|
//
|
|
// These take a plain `isPaid` boolean rather than a user row so this module stays
|
|
// free of imports from `lib/billing.ts`, which imports the limits back.
|
|
|
|
/** One workspace, so an unpaid account cannot park a whole agency here. */
|
|
export const TRIAL_WORKSPACE_LIMIT = 1;
|
|
|
|
/**
|
|
* One project at a time. There is no archive flag on Project, so "active" means
|
|
* "exists": deleting a project frees the slot.
|
|
*/
|
|
export const TRIAL_PROJECT_LIMIT = 1;
|
|
|
|
/**
|
|
* 3 GiB of direct uploads. Enough for a first cut plus two revisions at a real
|
|
* bitrate, small enough that a farm of throwaway accounts is not worth running.
|
|
* Anyone who hits it can still work through YouTube imports, which cost nothing.
|
|
*/
|
|
export const TRIAL_STORAGE_LIMIT_BYTES = BigInt(3) * BigInt(1024) * BigInt(1024) * BigInt(1024);
|
|
|
|
// There is deliberately no separate per-file ceiling for trials. The default
|
|
// per-file limit is 5 GiB and the trial's total is 3 GiB, so the quota check
|
|
// already refuses anything bigger, and a second limit would only add a second
|
|
// way to be told no.
|
|
|
|
export function getStorageLimitBytes(isPaid: boolean, planLimitBytes: bigint): bigint {
|
|
if (isPaid) return planLimitBytes;
|
|
return planLimitBytes < TRIAL_STORAGE_LIMIT_BYTES ? planLimitBytes : TRIAL_STORAGE_LIMIT_BYTES;
|
|
}
|