@@ -54,24 +54,48 @@ export interface SubscriptionPreviewTrial {
54
54
readonly expiresOn : string ;
55
55
}
56
56
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
58
59
export const enum SubscriptionState {
59
60
/** Indicates a user who hasn't verified their email address yet */
60
61
VerificationRequired = - 1 ,
61
62
/** Indicates a Free user who hasn't yet started the preview trial */
62
63
Free = 0 ,
63
64
/** Indicates a Free user who is in preview trial */
64
- FreeInPreviewTrial ,
65
+ FreeInPreviewTrial = 1 ,
65
66
/** Indicates a Free user who's preview has expired trial */
66
- FreePreviewTrialExpired ,
67
+ FreePreviewTrialExpired = 2 ,
67
68
/** Indicates a Free+ user with a completed trial */
68
- FreePlusInTrial ,
69
+ FreePlusInTrial = 3 ,
69
70
/** Indicates a Free+ user who's trial has expired and is not yet eligible for reactivation */
70
- FreePlusTrialExpired ,
71
+ FreePlusTrialExpired = 4 ,
71
72
/** Indicated a Free+ user who's trial has expired and is eligible for reactivation */
72
- FreePlusTrialReactivationEligible ,
73
+ FreePlusTrialReactivationEligible = 5 ,
73
74
/** 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
+ }
75
99
}
76
100
77
101
export function computeSubscriptionState ( subscription : Optional < Subscription , 'state' > ) : SubscriptionState {
0 commit comments