Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 3x 19x 6x 6x 3x | // Terms version enforcement for guards and signup form.
// IMPORTANT: Keep in sync with apps/api/src/lib/terms.ts
// Set to null to disable enforcement. Set to "v1.0" when terms are finalized.
export const CURRENT_TERMS_VERSION: string | null = "v1.0-rc";
/** Parse major version number from "v1.0" → 1 */
export function getMajorVersion(version: string): number {
return parseInt(version.replace("v", "").split(".")[0], 10);
}
/** Returns true if user needs to accept current terms */
export function needsTermsAcceptance(
userTermsVersion: string | null,
): boolean {
Iif (!CURRENT_TERMS_VERSION) return false;
if (!userTermsVersion) return true;
return (
getMajorVersion(userTermsVersion) <
getMajorVersion(CURRENT_TERMS_VERSION)
);
}
|