|
6 | 6 | } from '../lib/contributions';
|
7 | 7 | import { getDailyArticleCount, getToday } from '../lib/dailyArticleCount';
|
8 | 8 | import type { EditionId } from '../lib/edition';
|
| 9 | +import { isUserLoggedInOktaRefactor } from '../lib/identity'; |
9 | 10 | import { parseCheckoutCompleteCookieData } from '../lib/parser/parseCheckoutOutCookieData';
|
10 | 11 | import { constructQuery } from '../lib/querystring';
|
11 | 12 | import { useAB } from '../lib/useAB';
|
@@ -650,12 +651,6 @@ const SignInGateSelectorAuxia = ({
|
650 | 651 | This function if the Auxia prototype for the SignInGateSelector component.
|
651 | 652 | */
|
652 | 653 |
|
653 |
| - const authStatus = useAuthStatus(); |
654 |
| - |
655 |
| - const isSignedIn = |
656 |
| - authStatus.kind === 'SignedInWithOkta' || |
657 |
| - authStatus.kind === 'SignedInWithCookies'; |
658 |
| - |
659 | 654 | const [isGateDismissed, setIsGateDismissed] = useState<boolean | undefined>(
|
660 | 655 | undefined,
|
661 | 656 | );
|
@@ -689,11 +684,13 @@ const SignInGateSelectorAuxia = ({
|
689 | 684 |
|
690 | 685 | useOnce(() => {
|
691 | 686 | void (async () => {
|
| 687 | + // Only make a request to Auxia if user is signed out. This means signed-in users will never receive an Auxia treatment, and therefore never see a sign-in gate |
| 688 | + const isSignedIn = await isUserLoggedInOktaRefactor(); |
| 689 | + |
692 | 690 | // Although the component is returning null if we are in preview or it's a paid content
|
693 | 691 | // We need to guard against the API possibly being called before the component returns.
|
694 | 692 | // That is because it would count as a content delivery for them, above all if they return a treatment
|
695 | 693 | // without the subsequent Log Treatment notification, which would cause confusion.
|
696 |
| - |
697 | 694 | if (!isSignedIn && !isPreview && !isPaidContent) {
|
698 | 695 | const data = await buildAuxiaGateDisplayData(
|
699 | 696 | contributionsServiceUrl,
|
@@ -730,15 +727,15 @@ const SignInGateSelectorAuxia = ({
|
730 | 727 | })().catch((error) => {
|
731 | 728 | console.error('Error fetching Auxia display data:', error);
|
732 | 729 | });
|
733 |
| - }, [abTest, isSignedIn, isPaidContent, isPreview]); |
| 730 | + }, [abTest, isPaidContent, isPreview]); |
734 | 731 |
|
735 | 732 | // We are not showing the gate if we are in preview, it's a paid contents
|
736 | 733 | // or the user is signed in or if for some reasons we could not determine the
|
737 | 734 | // pageViewId
|
738 | 735 |
|
739 | 736 | // According to the reacts rules we can only put this check after all the hooks.
|
740 | 737 |
|
741 |
| - if (isPreview || isPaidContent || isSignedIn || isUndefined(pageViewId)) { |
| 738 | + if (isPreview || isPaidContent || isUndefined(pageViewId)) { |
742 | 739 | return null;
|
743 | 740 | }
|
744 | 741 |
|
|
0 commit comments