File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed
Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -29,18 +29,19 @@ const getClientParticipations = (): ABParticipations => {
2929
3030 return { } ;
3131} ;
32- const initABTesting = ( ) : void => {
33- const { serverSideABTests } = window . guardian . config ;
34-
35- const clientSideABTests = getClientParticipations ( ) ;
3632
37- const participations = {
38- ...clientSideABTests ,
39- ...serverSideABTests ,
33+ const getABTestParticipations = ( ) : ABParticipations => {
34+ return {
35+ ...getClientParticipations ( ) ,
36+ ...window . guardian . config . serverSideABTests ,
4037 } ;
38+ } ;
39+
40+ const initABTesting = ( ) : void => {
41+ const participations = getABTestParticipations ( ) ;
4142
4243 window . guardian . modules . abTests = {
43- getParticipations : ( ) => participations ,
44+ getParticipations : getABTestParticipations ,
4445 isUserInTest : ( testId : string ) => {
4546 return ! isUndefined ( participations [ testId ] ) ;
4647 } ,
@@ -50,4 +51,4 @@ const initABTesting = (): void => {
5051 } ;
5152} ;
5253
53- export { initABTesting } ;
54+ export { initABTesting , getABTestParticipations } ;
Original file line number Diff line number Diff line change 11import { isUndefined } from '@guardian/libs' ;
2+ import { getABTestParticipations } from '../../client/abTesting' ;
23
34export interface BetaABTestAPI {
45 getParticipations : ( ) => ABParticipations ;
@@ -55,8 +56,7 @@ export class BetaABTests implements BetaABTestAPI {
5556 if ( isServer ) {
5657 this . participations = serverSideABTests ;
5758 } else {
58- this . participations =
59- window . guardian . modules . abTests ?. getParticipations ( ) ?? { } ;
59+ this . participations = getABTestParticipations ( ) ;
6060 }
6161 }
6262
You can’t perform that action at this time.
0 commit comments