Skip to content

Commit

Permalink
Merge branch 'main' into ab/media-card-pills
Browse files Browse the repository at this point in the history
  • Loading branch information
abeddow91 authored Jan 28, 2025
2 parents 1106115 + fd05fa2 commit 334e0f6
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions dotcom-rendering/src/components/SignInGateSelector.importable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,19 @@ interface ShowSignInGateAuxiaProps {
host: string;
}

interface SDCProxyData {
shouldShowSignInGate: boolean;
interface AuxiaAPIResponseDataUserTreatment {
treatmentId: string;
treatmentTrackingId: string;
rank: string;
contentLanguageCode: string;
treatmentContent: string;
treatmentType: string;
surface: string;
}

interface SDCAuxiaProxyResponseData {
responseId: string;
userTreatment?: AuxiaAPIResponseDataUserTreatment;
}

/*
Expand All @@ -446,7 +457,7 @@ const dismissGateAuxia = (

const fetchAuxiaDisplayDataFromProxy = async (
contributionsServiceUrl: string,
): Promise<SDCProxyData> => {
): Promise<SDCAuxiaProxyResponseData> => {
const url = `${contributionsServiceUrl}/auxia`;
const headers = {
'Content-Type': 'application/json',
Expand All @@ -460,7 +471,7 @@ const fetchAuxiaDisplayDataFromProxy = async (

const response = await fetch(url, params);

const data = (await response.json()) as SDCProxyData;
const data = (await response.json()) as SDCAuxiaProxyResponseData;

return Promise.resolve(data);
};
Expand Down Expand Up @@ -512,7 +523,9 @@ const SignInGateSelectorAuxia = ({
const data = await fetchAuxiaDisplayDataFromProxy(
contributionsServiceUrl,
);
setShouldShowSignInGateUsingAuxiaAnswer(data.shouldShowSignInGate);
setShouldShowSignInGateUsingAuxiaAnswer(
data.userTreatment !== undefined,
);
})().catch((error) => {
console.error('Error fetching Auxia display data:', error);
});
Expand Down

0 comments on commit 334e0f6

Please sign in to comment.