@@ -27,14 +27,14 @@ export const freePlanDashboardPerUserPerTeamLimit = 1
2727export const initialTrialLength = { days : 14 }
2828export const legacyCutoff = new Date ( process . env . LEGACY_CUTOFF || Date . now ( ) )
2929
30- export function isTimeEligibleForDiscount ( team : { createdAt : string } ) {
31- if (
32- differenceInDays ( Date . now ( ) , new Date ( team . createdAt ) ) < newTeamDiscountDays
33- ) {
34- return true
35- }
36-
37- return false
30+ export function isTimeEligibleForDiscount ( team : {
31+ createdAt : string
32+ trial : boolean
33+ } ) {
34+ return (
35+ differenceInDays ( Date . now ( ) , new Date ( team . createdAt ) ) <
36+ newTeamDiscountDays && team . trial
37+ )
3838}
3939
4040export function teamIsReadonly (
@@ -45,11 +45,7 @@ export function teamIsReadonly(
4545 return remainingTrialInfo ( team ) . remaining < 1
4646 }
4747
48- if ( subscription . status === 'inactive' ) {
49- return true
50- }
51-
52- return false
48+ return subscription . status === 'inactive'
5349}
5450
5551export function remainingTrialInfo ( team : SerializedTeam ) {
@@ -64,6 +60,14 @@ export function remainingTrialInfo(team: SerializedTeam) {
6460 const today = new Date ( )
6561 today . setUTCHours ( 0 , 0 , 0 , 0 )
6662
63+ if ( ! team . trial ) {
64+ return {
65+ remaining : 0 ,
66+ max : initialTrialLength . days ,
67+ end : endDate ,
68+ }
69+ }
70+
6771 return {
6872 remaining : Math . max ( 0 , differenceInDays ( endDate , today ) ) ,
6973 max : initialTrialLength . days ,
0 commit comments