@@ -69,9 +69,6 @@ export class GlFeatureGatePlusState extends LitElement {
6969 @query ( 'gl-button' )
7070 private readonly button ! : GlButton ;
7171
72- @property ( { type : Boolean } )
73- allowFeaturePreviewTrial ?: boolean ;
74-
7572 @property ( { type : Object } )
7673 featureInPreviewTrial ?: {
7774 [ key in Sources ] ?: { consumedDays : { startedOn : string ; expiresOn : string } [ ] ; isActive : boolean } ;
@@ -108,8 +105,9 @@ export class GlFeatureGatePlusState extends LitElement {
108105 const appearance = ( this . appearance ?? 'alert' ) === 'alert' ? 'alert' : nothing ;
109106 const promo = this . state ? getApplicablePromo ( this . state , 'gate' ) : undefined ;
110107 let consumedDaysCount = 0 ;
111- if ( this . source ?. source ) {
112- consumedDaysCount = this . featureInPreviewTrial ?. [ this . source . source ] ?. consumedDays ?. length ?? 0 ;
108+ const feature = this . source ?. source ;
109+ if ( feature ) {
110+ consumedDaysCount = this . featureInPreviewTrial ?. [ feature ] ?. consumedDays ?. length ?? 0 ;
113111 }
114112
115113 switch ( this . state ) {
@@ -133,8 +131,11 @@ export class GlFeatureGatePlusState extends LitElement {
133131 ` ;
134132
135133 case SubscriptionState . Community :
136- if ( this . allowFeaturePreviewTrial ) {
137- const daysLeft = proPreviewLengthInDays - consumedDaysCount ;
134+ if (
135+ feature &&
136+ this . featureInPreviewTrial ?. [ feature ] &&
137+ proPreviewLengthInDays - consumedDaysCount > 0
138+ ) {
138139 return html `
139140 < p class ="actions ">
140141 < gl-button class ="inline " href ="${ generateCommandLink ( Commands . PlusSignUp , this . source ) } "
@@ -150,9 +151,9 @@ export class GlFeatureGatePlusState extends LitElement {
150151 </ p >
151152
152153 < p >
153- Continuing gives you ${ pluralize ( 'day' , daysLeft ) } to preview
154- ${ this . featureWithArticleIfNeeded ? `${ this . featureWithArticleIfNeeded } on` : '' } private
155- repositories.< br />
154+ Continuing gives you ${ pluralize ( 'day' , proPreviewLengthInDays - consumedDaysCount ) } to
155+ preview ${ this . featureWithArticleIfNeeded ? `${ this . featureWithArticleIfNeeded } on` : '' }
156+ private repositories.< br />
156157 ${ appearance !== 'alert' ? html `< br /> ` : '' } For full access to Pro features
157158 < a href ="${ generateCommandLink ( Commands . PlusSignUp , this . source ) } "
158159 > start your free ${ proTrialLengthInDays } -day Pro trial</ a
0 commit comments