1+ import type { TemplateResult } from 'lit' ;
12import { css , html , LitElement , nothing } from 'lit' ;
23import { customElement , property , query } from 'lit/decorators.js' ;
34import { urls } from '../../../../../constants' ;
@@ -90,6 +91,9 @@ export class GlFeatureGatePlusState extends LitElement {
9091 @property ( { attribute : false , type : Number } )
9192 state ?: SubscriptionState ;
9293
94+ @property ( { type : String } )
95+ webroot ?: string ;
96+
9397 protected override firstUpdated ( ) {
9498 if ( this . appearance === 'alert' ) {
9599 queueMicrotask ( ( ) => this . button . focus ( ) ) ;
@@ -111,8 +115,6 @@ export class GlFeatureGatePlusState extends LitElement {
111115 consumedDaysCount = this . featureInPreviewTrial ?. [ feature ] ?. consumedDays ?. length ?? 0 ;
112116 }
113117
114- const feature = this . source ?. source || '' ;
115-
116118 switch ( this . state ) {
117119 case SubscriptionState . VerificationRequired :
118120 return html `
@@ -142,21 +144,7 @@ export class GlFeatureGatePlusState extends LitElement {
142144 proPreviewLengthInDays - consumedDaysCount > 0
143145 ) {
144146 return html `
145- < gl-button appearance ="${ appearance } " href ="${ this . featurePreviewTrialCommandLink } "
146- > Continue</ gl-button
147- >
148- < p >
149- Continuing gives you ${ pluralize ( 'day' , proPreviewLengthInDays - consumedDaysCount ) } to
150- preview ${ this . featureWithArticleIfNeeded ? `${ this . featureWithArticleIfNeeded } on` : '' }
151- privately-hosted repositories.< br />
152- ${ appearance !== 'alert' ? html `< br /> ` : '' } For full access to all GitLens Pro features,
153- < a href ="${ generateCommandLink ( Commands . PlusSignUp , this . source ) } "
154- > start your free ${ proTrialLengthInDays } -day Pro trial</ a
155- >
156- - no credit card required. Or
157- < a href ="${ generateCommandLink ( Commands . PlusLogin , this . source ) } " title ="Sign In "> sign in</ a
158- > .
159- </ p >
147+ ${ this . getFeaturePreviewModalFor ( feature , proPreviewLengthInDays - consumedDaysCount ) }
160148 ` ;
161149 }
162150
@@ -206,6 +194,80 @@ export class GlFeatureGatePlusState extends LitElement {
206194 private renderPromo ( promo : Promo | undefined ) {
207195 return html `< gl-promo .promo =${ promo } > </ gl-promo > ` ;
208196 }
197+
198+ private getFeaturePreviewModalFor ( feature : Sources , daysLeft : number ) {
199+ const appearance = ( this . appearance ?? 'alert' ) === 'alert' ? 'alert' : nothing ;
200+ let partial : TemplateResult < 1 > | undefined ;
201+ switch ( feature ) {
202+ case 'graph' :
203+ switch ( daysLeft ) {
204+ case 2 :
205+ partial = html `< p > Try Commit Search</ p >
206+ < p >
207+ Search for commits in your repo by author, commit message, SHA, file, change, or type.
208+ Turn on the commit filter to show only commits that match your query.
209+ </ p >
210+ < p >
211+ < img
212+ src ="${ this . webroot ?? '' } /media/graph-commit-search.webp "
213+ style ="width:100% "
214+ alt ="Graph Commit Search "
215+ />
216+ </ p > ` ;
217+ break ;
218+ case 1 :
219+ partial = html `
220+ < p > Try the Graph Minimap</ p >
221+ < p >
222+ Visualize the amount of changes to a repository over time, and inspect specific points
223+ in the history to locate branches, stashes, tags and pull requests.
224+ </ p >
225+ < p >
226+ < img
227+ src ="${ this . webroot ?? '' } /media/graph-minimap.webp "
228+ style ="width:100% "
229+ alt ="Graph Minimap "
230+ />
231+ </ p >
232+ ` ;
233+ break ;
234+ }
235+ return html `
236+ ${ partial }
237+ < gl-button appearance ="${ appearance } " href ="${ this . featurePreviewTrialCommandLink } "
238+ > Continue</ gl-button
239+ >
240+ < p >
241+ Continuing gives you ${ pluralize ( 'day' , daysLeft ) } to preview
242+ ${ this . featureWithArticleIfNeeded ? `${ this . featureWithArticleIfNeeded } on` : '' }
243+ privately-hosted repositories.< br />
244+ ${ appearance !== 'alert' ? html `< br /> ` : '' } For full access to all GitLens Pro features,
245+ < a href ="${ generateCommandLink ( Commands . PlusSignUp , this . source ) } "
246+ > start your free ${ proTrialLengthInDays } -day Pro trial</ a
247+ >
248+ - no credit card required. Or
249+ < a href ="${ generateCommandLink ( Commands . PlusLogin , this . source ) } " title ="Sign In "> sign in</ a > .
250+ </ p >
251+ ` ;
252+ default :
253+ return html `
254+ < gl-button appearance ="${ appearance } " href ="${ this . featurePreviewTrialCommandLink } "
255+ > Continue</ gl-button
256+ >
257+ < p >
258+ Continuing gives you ${ pluralize ( 'day' , daysLeft ) } to preview
259+ ${ this . featureWithArticleIfNeeded ? `${ this . featureWithArticleIfNeeded } on` : '' }
260+ privately-hosted repositories.< br />
261+ ${ appearance !== 'alert' ? html `< br /> ` : '' } For full access to all GitLens Pro features,
262+ < a href ="${ generateCommandLink ( Commands . PlusSignUp , this . source ) } "
263+ > start your free ${ proTrialLengthInDays } -day Pro trial</ a
264+ >
265+ - no credit card required. Or
266+ < a href ="${ generateCommandLink ( Commands . PlusLogin , this . source ) } " title ="Sign In "> sign in</ a > .
267+ </ p >
268+ ` ;
269+ }
270+ }
209271}
210272
211273function generateCommandLink ( command : Commands , source : Source | undefined ) {
0 commit comments