@@ -23,6 +23,25 @@ export const mockAuxiaResponseDismissible = {
2323 } ,
2424} ;
2525
26+ export const mockAuxiaResponseDismissibleV2 = {
27+ status : true ,
28+ data : {
29+ userTreatment : {
30+ treatmentId : 'auxia-treatment-001' ,
31+ treatmentTrackingId : 'tracking-001' ,
32+ surface : 'signin-gate' ,
33+ treatmentContent : JSON . stringify ( {
34+ title : 'A small step for great Journalism. Sign in.' ,
35+ subtitle : '' ,
36+ body : "It's free and only takes 30 seconds." ,
37+ first_cta_name : 'Create account' ,
38+ first_cta_link : 'https://profile.theguardian.com/register' ,
39+ second_cta_name : "I'll do it later" ,
40+ } ) ,
41+ } ,
42+ } ,
43+ } ;
44+
2645export const mockAuxiaResponseNonDismissible = {
2746 status : true ,
2847 data : {
@@ -46,6 +65,26 @@ export const mockAuxiaResponseNonDismissible = {
4665 } ,
4766} ;
4867
68+ export const mockAuxiaResponseNonDismissibleV2 = {
69+ status : true ,
70+ data : {
71+ userTreatment : {
72+ treatmentId : 'auxia-treatment-002' ,
73+ treatmentTrackingId : 'tracking-002' ,
74+ surface : 'signin-gate' ,
75+ treatmentContent : JSON . stringify ( {
76+ title : 'Sorry for the interruption. We believe in free, independent journalism for all. Sign in or register to keep reading.' ,
77+ subtitle :
78+ "Once you are signed in, we'll bring you back here shortly." ,
79+ body : '' ,
80+ first_cta_name : 'Create account' ,
81+ first_cta_link : 'https://profile.theguardian.com/register' ,
82+ second_cta_name : '' ,
83+ } ) ,
84+ } ,
85+ } ,
86+ } ;
87+
4988export const mockAuxiaResponseLegacy = {
5089 status : true ,
5190 data : {
@@ -77,14 +116,25 @@ export const getAuxiaMock = (payload: string): unknown => {
77116 const body = JSON . parse ( payload ) as Record < string , unknown > ;
78117
79118 const mocks = {
80- dismissable : mockAuxiaResponseDismissible ,
81- 'non-dismissable' : mockAuxiaResponseNonDismissible ,
82- legacy : mockAuxiaResponseLegacy ,
83- 'no-treatment' : mockAuxiaResponseNoTreatment ,
119+ v1 : {
120+ dismissable : mockAuxiaResponseDismissible ,
121+ 'non-dismissable' : mockAuxiaResponseNonDismissible ,
122+ legacy : mockAuxiaResponseLegacy ,
123+ 'no-treatment' : mockAuxiaResponseNoTreatment ,
124+ } ,
125+ v2 : {
126+ dismissable : mockAuxiaResponseDismissibleV2 ,
127+ 'non-dismissable' : mockAuxiaResponseNonDismissibleV2 ,
128+ legacy : mockAuxiaResponseLegacy ,
129+ 'no-treatment' : mockAuxiaResponseNoTreatment ,
130+ } ,
84131 } ;
85132
86- const key = body . sectionId as keyof typeof mocks ;
87- const mock : unknown = mocks [ key ] ;
133+ const key = body . sectionId as keyof ( typeof mocks ) [ keyof typeof mocks ] ;
134+ const version = ( body . articleIdentifier as string ) . includes ( 'v2' )
135+ ? 'v2'
136+ : 'v1' ;
137+ const mock : unknown = mocks [ version ] [ key ] ;
88138
89139 return mock ?? mockAuxiaResponseNoTreatment ;
90140} ;
0 commit comments