@@ -54,24 +54,48 @@ export interface SubscriptionPreviewTrial {
5454 readonly expiresOn : string ;
5555}
5656
57- // Note: Pay attention to gitlens:plus:state in package.json when modifying this enum
57+ // NOTE: Pay attention to gitlens:plus:state in package.json when modifying this enum
58+ // NOTE: This is reported in telemetry so we should NOT change the values
5859export const enum SubscriptionState {
5960 /** Indicates a user who hasn't verified their email address yet */
6061 VerificationRequired = - 1 ,
6162 /** Indicates a Free user who hasn't yet started the preview trial */
6263 Free = 0 ,
6364 /** Indicates a Free user who is in preview trial */
64- FreeInPreviewTrial ,
65+ FreeInPreviewTrial = 1 ,
6566 /** Indicates a Free user who's preview has expired trial */
66- FreePreviewTrialExpired ,
67+ FreePreviewTrialExpired = 2 ,
6768 /** Indicates a Free+ user with a completed trial */
68- FreePlusInTrial ,
69+ FreePlusInTrial = 3 ,
6970 /** Indicates a Free+ user who's trial has expired and is not yet eligible for reactivation */
70- FreePlusTrialExpired ,
71+ FreePlusTrialExpired = 4 ,
7172 /** Indicated a Free+ user who's trial has expired and is eligible for reactivation */
72- FreePlusTrialReactivationEligible ,
73+ FreePlusTrialReactivationEligible = 5 ,
7374 /** Indicates a Paid user */
74- Paid ,
75+ Paid = 6 ,
76+ }
77+
78+ export function getSubscriptionStateString ( state : SubscriptionState | undefined ) : string {
79+ switch ( state ) {
80+ case SubscriptionState . VerificationRequired :
81+ return 'verification' ;
82+ case SubscriptionState . Free :
83+ return 'free' ;
84+ case SubscriptionState . FreeInPreviewTrial :
85+ return 'preview' ;
86+ case SubscriptionState . FreePreviewTrialExpired :
87+ return 'preview-expired' ;
88+ case SubscriptionState . FreePlusInTrial :
89+ return 'trial' ;
90+ case SubscriptionState . FreePlusTrialExpired :
91+ return 'trial-expired' ;
92+ case SubscriptionState . FreePlusTrialReactivationEligible :
93+ return 'trial-reactivation-eligible' ;
94+ case SubscriptionState . Paid :
95+ return 'paid' ;
96+ default :
97+ return 'unknown' ;
98+ }
7599}
76100
77101export function computeSubscriptionState ( subscription : Optional < Subscription , 'state' > ) : SubscriptionState {
0 commit comments