@@ -14,10 +14,7 @@ import { KeyStretchExperiment } from '../experiments/key-stretch-experiment';
1414import { UrlQueryData } from '../../lib/model-data' ;
1515import { ReachRouterWindow } from '../../lib/window' ;
1616import { SensitiveDataClient } from '../../lib/sensitive-data-client' ;
17- import { initializeNimbus , NimbusContextT } from '../../lib/nimbus' ;
18- import { parseAcceptLanguage } from '../../../../../libs/shared/l10n/src' ;
1917import { getUniqueUserId } from '../../lib/cache' ;
20- import { searchParams } from '../../lib/utilities' ;
2118
2219// TODO, move some values from AppContext to SettingsContext after
2320// using container components, FXA-8107
@@ -29,42 +26,13 @@ export interface AppContextValue {
2926 account ?: Account ;
3027 session ?: Session ;
3128 uniqueUserId ?: string ; // used for experiments
32- experiments ?: Promise < any > ; // external response; not adding types
3329}
3430
3531export interface SettingsContextValue {
3632 alertBarInfo ?: AlertBarInfo ;
3733 navigatorLanguages ?: readonly string [ ] ;
3834}
3935
40- /**
41- * Fetches nimbus experiments from the Cirrus container via content-server.
42- *
43- * N.B: external response; not adding types
44- *
45- * @param uniqueUserId the ID that is used to retrieve the experiments for that client.
46- * @returns a promise to the fetch JSON reponse.
47- */
48- function fetchNimbusExperiments ( uniqueUserId : string ) : Promise < any > {
49- // We reuse parseAcceptLanguage with navigator.languages because
50- // that is the same as getting the headers directly as stated on MDN.
51- // See: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/languages
52- const [ locale ] = parseAcceptLanguage ( navigator . languages . join ( ', ' ) ) ;
53- let [ language , region ] = locale . split ( '-' ) ;
54- if ( region ) {
55- region = region . toLowerCase ( ) ;
56- }
57-
58- const nimbusPreview = config . nimbusPreview
59- ? config . nimbusPreview
60- : searchParams ( window . location . search ) . nimbusPreview === 'true' ;
61-
62- return initializeNimbus ( uniqueUserId , nimbusPreview , {
63- language,
64- region,
65- } as NimbusContextT ) ;
66- }
67-
6836export function initializeAppContext ( ) {
6937 readConfigMeta ( ( name : string ) => {
7038 return document . head . querySelector ( name ) ;
@@ -81,7 +49,6 @@ export function initializeAppContext() {
8149 const session = new Session ( authClient , apolloClient ) ;
8250 const sensitiveDataClient = new SensitiveDataClient ( ) ;
8351 const uniqueUserId = getUniqueUserId ( ) ;
84- const experiments = fetchNimbusExperiments ( uniqueUserId ) ;
8552
8653 const context : AppContextValue = {
8754 authClient,
@@ -91,7 +58,6 @@ export function initializeAppContext() {
9158 session,
9259 sensitiveDataClient,
9360 uniqueUserId,
94- experiments,
9561 } ;
9662
9763 return context ;
0 commit comments