@@ -23,7 +23,7 @@ import { registerResources } from './resources';
23
23
import { GitExtension } from './typings/git' ;
24
24
import { pid } from 'process' ;
25
25
import { startListening } from './atlclients/negotiate' ;
26
- import { FeatureFlagClient } from './util/featureFlags' ;
26
+ import { Experiments , FeatureFlagClient } from './util/featureFlags' ;
27
27
28
28
const AnalyticDelay = 5000 ;
29
29
@@ -32,7 +32,6 @@ export async function activate(context: ExtensionContext) {
32
32
const atlascode = extensions . getExtension ( 'atlassian.atlascode' ) ! ;
33
33
const atlascodeVersion = atlascode . packageJSON . version ;
34
34
const previousVersion = context . globalState . get < string > ( GlobalStateVersionKey ) ;
35
-
36
35
registerResources ( context ) ;
37
36
38
37
Configuration . configure ( context ) ;
@@ -42,7 +41,7 @@ export async function activate(context: ExtensionContext) {
42
41
context . globalState . update ( 'rulingPid' , pid ) ;
43
42
44
43
try {
45
- Container . initialize ( context , configuration . get < IConfig > ( ) , atlascodeVersion ) ;
44
+ await Container . initialize ( context , configuration . get < IConfig > ( ) , atlascodeVersion ) ;
46
45
47
46
registerCommands ( context ) ;
48
47
activateCodebucket ( context ) ;
@@ -63,11 +62,13 @@ export async function activate(context: ExtensionContext) {
63
62
Container . clientManager . requestSite ( site ) ;
64
63
} ) ;
65
64
66
- if ( previousVersion === undefined && window . state . focused ) {
67
- commands . executeCommand ( Commands . ShowOnboardingPage ) ; //This is shown to users who have never opened our extension before
65
+ // new user for auth exp
66
+ if ( previousVersion === undefined ) {
67
+ initializeNewAuthExperiment ( ) ;
68
68
} else {
69
69
showWelcomePage ( atlascodeVersion , previousVersion ) ;
70
70
}
71
+
71
72
const delay = Math . floor ( Math . random ( ) * Math . floor ( AnalyticDelay ) ) ;
72
73
setTimeout ( ( ) => {
73
74
sendAnalytics ( atlascodeVersion , context . globalState ) ;
@@ -165,6 +166,35 @@ async function sendAnalytics(version: string, globalState: Memento) {
165
166
} ) ;
166
167
}
167
168
169
+ function initializeNewAuthExperiment ( ) {
170
+ let onboardingFlow = FeatureFlagClient . checkExperimentValue ( Experiments . NewAuthUI ) ;
171
+ Logger . debug ( `Onboarding Experiment flow: ${ onboardingFlow } ` ) ;
172
+ if ( ! onboardingFlow ) {
173
+ onboardingFlow = 'control' ;
174
+ }
175
+
176
+ switch ( onboardingFlow ) {
177
+ case 'settings' : {
178
+ commands . executeCommand ( Commands . ShowConfigPage ) ;
179
+ break ;
180
+ }
181
+ case 'legacy' : {
182
+ commands . executeCommand ( Commands . ShowOnboardingPage ) ;
183
+ break ;
184
+ }
185
+ case 'new' : {
186
+ commands . executeCommand ( Commands . ShowOnboardingPage ) ;
187
+ break ;
188
+ }
189
+ default : {
190
+ // control
191
+ if ( window . state . focused ) {
192
+ commands . executeCommand ( Commands . ShowOnboardingPage ) ;
193
+ }
194
+ break ;
195
+ }
196
+ }
197
+ }
168
198
// this method is called when your extension is deactivated
169
199
export function deactivate ( ) {
170
200
FeatureFlagClient . dispose ( ) ;
0 commit comments