@@ -21,8 +21,9 @@ import {
21
21
window ,
22
22
} from 'vscode' ;
23
23
import { getPlatform } from '@env/platform' ;
24
- import type { CoreColors } from '../../../constants' ;
25
- import { Commands } from '../../../constants' ;
24
+ import type { OpenWalkthroughCommandArgs } from '../../../commands/walkthroughs' ;
25
+ import type { CoreColors , TelemetrySources } from '../../../constants' ;
26
+ import { Commands , urls } from '../../../constants' ;
26
27
import type { Container } from '../../../container' ;
27
28
import { AccountValidationError } from '../../../errors' ;
28
29
import type { RepositoriesChangeEvent } from '../../../git/gitProviderService' ;
@@ -40,7 +41,6 @@ import { Logger } from '../../../system/logger';
40
41
import { getLogScope , setLogScopeExit } from '../../../system/logger.scope' ;
41
42
import { flatten } from '../../../system/object' ;
42
43
import { pluralize } from '../../../system/string' ;
43
- import { openWalkthrough } from '../../../system/utils' ;
44
44
import { satisfies } from '../../../system/version' ;
45
45
import type { GKCheckInResponse } from '../checkin' ;
46
46
import { getSubscriptionFromCheckIn } from '../checkin' ;
@@ -209,22 +209,46 @@ export class SubscriptionService implements Disposable {
209
209
}
210
210
211
211
@debug ( )
212
- async learnAboutPreviewOrTrial ( ) {
212
+ async learnAboutPro ( source : TelemetrySources , detail ?: string ) : Promise < void > {
213
213
const subscription = await this . getSubscription ( ) ;
214
- if ( subscription . state === SubscriptionState . FreeInPreviewTrial ) {
215
- void openWalkthrough (
216
- this . container . context . extension . id ,
217
- 'gitlens.welcome' ,
218
- 'gitlens.welcome.preview' ,
219
- false ,
220
- ) ;
221
- } else if ( subscription . state === SubscriptionState . FreePlusInTrial ) {
222
- void openWalkthrough (
223
- this . container . context . extension . id ,
224
- 'gitlens.welcome' ,
225
- 'gitlens.welcome.trial' ,
226
- false ,
227
- ) ;
214
+ switch ( subscription . state ) {
215
+ case SubscriptionState . Free :
216
+ case SubscriptionState . FreeInPreviewTrial :
217
+ case SubscriptionState . FreePreviewTrialExpired :
218
+ void executeCommand < OpenWalkthroughCommandArgs > ( Commands . OpenWalkthrough , {
219
+ step : 'pro-features' ,
220
+ source : source ,
221
+ detail : detail ,
222
+ } ) ;
223
+ break ;
224
+ case SubscriptionState . FreePlusInTrial :
225
+ void executeCommand < OpenWalkthroughCommandArgs > ( Commands . OpenWalkthrough , {
226
+ step : 'pro-trial' ,
227
+ source : source ,
228
+ detail : detail ,
229
+ } ) ;
230
+ break ;
231
+ case SubscriptionState . FreePlusTrialExpired :
232
+ void executeCommand < OpenWalkthroughCommandArgs > ( Commands . OpenWalkthrough , {
233
+ step : 'pro-upgrade' ,
234
+ source : source ,
235
+ detail : detail ,
236
+ } ) ;
237
+ break ;
238
+ case SubscriptionState . FreePlusTrialReactivationEligible :
239
+ void executeCommand < OpenWalkthroughCommandArgs > ( Commands . OpenWalkthrough , {
240
+ step : 'pro-reactivate' ,
241
+ source : source ,
242
+ detail : detail ,
243
+ } ) ;
244
+ break ;
245
+ case SubscriptionState . Paid :
246
+ void executeCommand < OpenWalkthroughCommandArgs > ( Commands . OpenWalkthrough , {
247
+ step : 'pro-paid' ,
248
+ source : source ,
249
+ detail : detail ,
250
+ } ) ;
251
+ break ;
228
252
}
229
253
}
230
254
@@ -245,19 +269,33 @@ export class SubscriptionService implements Disposable {
245
269
} = this . _subscription ;
246
270
247
271
if ( account ?. verified === false ) {
248
- const confirm : MessageItem = { title : 'Resend Verification' } ;
249
- const cancel : MessageItem = { title : 'Cancel' , isCloseAffordance : true } ;
272
+ const days = getSubscriptionTimeRemaining ( this . _subscription , 'days' ) ?? 7 ;
273
+
274
+ const verify : MessageItem = { title : 'Resend Email' } ;
275
+ const learn : MessageItem = { title : 'See Pro Features' } ;
276
+ const confirm : MessageItem = { title : 'Continue' , isCloseAffordance : true } ;
250
277
const result = await window . showInformationMessage (
251
- `You must verify your email before you can access ${ effective . name } .` ,
278
+ `Welcome to your ${
279
+ effective . name
280
+ } Trial.\n\nYou must first verify your email. Once verified, you will have full access to Pro features for ${
281
+ days < 1 ? '<1 more day' : pluralize ( 'day' , days , { infix : ' more ' } )
282
+ } .`,
283
+ {
284
+ modal : true ,
285
+ detail : 'Your trial also includes access to our DevEx platform, unleashing powerful Git visualization & productivity capabilities everywhere you work: IDE, desktop, browser, and terminal.' ,
286
+ } ,
287
+ verify ,
288
+ learn ,
252
289
confirm ,
253
- cancel ,
254
290
) ;
255
291
256
- if ( result === confirm ) {
292
+ if ( result === verify ) {
257
293
void this . resendVerification ( ) ;
294
+ } else if ( result === learn ) {
295
+ void this . learnAboutPro ( 'prompt' , 'trial-started-verify-email' ) ;
258
296
}
259
297
} else if ( isSubscriptionPaid ( this . _subscription ) ) {
260
- const learn : MessageItem = { title : 'Learn More ' } ;
298
+ const learn : MessageItem = { title : 'See Pro Features ' } ;
261
299
const confirm : MessageItem = { title : 'Continue' , isCloseAffordance : true } ;
262
300
const result = await window . showInformationMessage (
263
301
`You are now on the ${ actual . name } plan and have full access to Pro features.` ,
@@ -270,12 +308,12 @@ export class SubscriptionService implements Disposable {
270
308
) ;
271
309
272
310
if ( result === learn ) {
273
- void env . openExternal ( Uri . parse ( 'https://www.gitkraken.com/suite' ) ) ;
311
+ void this . learnAboutPro ( 'prompt' , 'upgraded' ) ;
274
312
}
275
313
} else if ( isSubscriptionTrial ( this . _subscription ) ) {
276
314
const days = getSubscriptionTimeRemaining ( this . _subscription , 'days' ) ?? 0 ;
277
315
278
- const learn : MessageItem = { title : 'Learn More ' } ;
316
+ const learn : MessageItem = { title : 'See Pro Features ' } ;
279
317
const confirm : MessageItem = { title : 'Continue' , isCloseAffordance : true } ;
280
318
const result = await window . showInformationMessage (
281
319
`Welcome to your ${ effective . name } Trial.\n\nYou now have full access to Pro features for ${
@@ -290,11 +328,11 @@ export class SubscriptionService implements Disposable {
290
328
) ;
291
329
292
330
if ( result === learn ) {
293
- void this . learnAboutPreviewOrTrial ( ) ;
331
+ void this . learnAboutPro ( 'prompt' , 'trial-started' ) ;
294
332
}
295
333
} else {
296
334
const upgrade : MessageItem = { title : 'Upgrade to Pro' } ;
297
- const learn : MessageItem = { title : 'Learn More ' } ;
335
+ const learn : MessageItem = { title : 'See Pro Features ' } ;
298
336
const confirm : MessageItem = { title : 'Continue' , isCloseAffordance : true } ;
299
337
const result = await window . showInformationMessage (
300
338
`You are now on the ${ actual . name } plan.` ,
@@ -307,10 +345,10 @@ export class SubscriptionService implements Disposable {
307
345
confirm ,
308
346
) ;
309
347
310
- if ( result === learn ) {
311
- void env . openExternal ( Uri . parse ( 'https://www.gitkraken.com/suite' ) ) ;
312
- } else if ( result === upgrade ) {
348
+ if ( result === upgrade ) {
313
349
void this . purchase ( ) ;
350
+ } else if ( result === learn ) {
351
+ void this . learnAboutPro ( 'prompt' , 'trial-ended' ) ;
314
352
}
315
353
}
316
354
}
@@ -536,8 +574,8 @@ export class SubscriptionService implements Disposable {
536
574
537
575
if ( ! silent ) {
538
576
setTimeout ( async ( ) => {
539
- const confirm : MessageItem = { title : 'OK ' } ;
540
- const learn : MessageItem = { title : 'Learn More ' } ;
577
+ const confirm : MessageItem = { title : 'Continue ' } ;
578
+ const learn : MessageItem = { title : 'See Pro Features ' } ;
541
579
const result = await window . showInformationMessage (
542
580
`You can now preview local Pro features for ${
543
581
days < 1 ? '1 day' : pluralize ( 'day' , days )
@@ -547,7 +585,7 @@ export class SubscriptionService implements Disposable {
547
585
) ;
548
586
549
587
if ( result === learn ) {
550
- void this . learnAboutPreviewOrTrial ( ) ;
588
+ void this . learnAboutPro ( 'notification' , 'preview-started' ) ;
551
589
}
552
590
} , 1 ) ;
553
591
}
@@ -1172,14 +1210,15 @@ export class SubscriptionService implements Disposable {
1172
1210
this . _statusBarSubscription . tooltip = new MarkdownString (
1173
1211
`${
1174
1212
isReactivatedTrial
1175
- ? `[See what's new](https://help.gitkraken.com/gitlens/gitlens-release-notes-current/) with
1176
- ${ pluralize ( 'day' , remaining ?? 0 , {
1177
- infix : ' more ' ,
1178
- } ) }
1179
- in your **${ effective . name } ** trial.`
1213
+ ? `[See what's new](https://help.gitkraken.com/gitlens/gitlens-release-notes-current/) with ${ pluralize (
1214
+ 'day' ,
1215
+ remaining ?? 0 ,
1216
+ { infix : ' more ' } ,
1217
+ ) } in your **${ effective . name } ** trial.`
1180
1218
: `You have ${ pluralize ( 'day' , remaining ?? 0 ) } remaining in your **${ effective . name } ** trial.`
1181
- } Once your trial ends, you'll need a paid plan for full access to Pro features.\n\nTry our
1182
- [other developer tools](https://www.gitkraken.com/suite) also included in your trial.` ,
1219
+ } Once your trial ends, you'll need a paid plan for full access to [Pro features](command:gitlens.openWalkthrough?{"source": "trial-indicator" }).\n\nYour trial also includes access to our [DevEx platform](${
1220
+ urls . platform
1221
+ } ), unleashing powerful Git visualization & productivity capabilities everywhere you work: IDE, desktop, browser, and terminal.`,
1183
1222
true ,
1184
1223
) ;
1185
1224
}
0 commit comments