diff --git a/protocol-designer/src/pages/Landing/__tests__/Landing.test.tsx b/protocol-designer/src/pages/Landing/__tests__/Landing.test.tsx index 315496d755e..4ca8430796f 100644 --- a/protocol-designer/src/pages/Landing/__tests__/Landing.test.tsx +++ b/protocol-designer/src/pages/Landing/__tests__/Landing.test.tsx @@ -8,6 +8,7 @@ import { getFileMetadata } from '../../../file-data/selectors' import { toggleNewProtocolModal } from '../../../navigation/actions' import { useKitchen } from '../../../organisms/Kitchen/hooks' import { useAnnouncements } from '../../../organisms/AnnouncementModal/announcements' +import { getHasOptedIn } from '../../../analytics/selectors' import { Landing } from '../index' vi.mock('../../../load-file/actions') @@ -15,6 +16,7 @@ vi.mock('../../../file-data/selectors') vi.mock('../../../navigation/actions') vi.mock('../../../organisms/AnnouncementModal/announcements') vi.mock('../../../organisms/Kitchen/hooks') +vi.mock('../../../analytics/selectors') const mockMakeSnackbar = vi.fn() const mockEatToast = vi.fn() @@ -33,6 +35,7 @@ const render = () => { describe('Landing', () => { beforeEach(() => { + vi.mocked(getHasOptedIn).mockReturnValue(false) vi.mocked(getFileMetadata).mockReturnValue({}) vi.mocked(loadProtocolFile).mockReturnValue(vi.fn()) vi.mocked(useAnnouncements).mockReturnValue({} as any) diff --git a/protocol-designer/src/pages/Landing/index.tsx b/protocol-designer/src/pages/Landing/index.tsx index 91760ba9364..315787cd9ea 100644 --- a/protocol-designer/src/pages/Landing/index.tsx +++ b/protocol-designer/src/pages/Landing/index.tsx @@ -23,6 +23,7 @@ import { actions as loadFileActions } from '../../load-file' import { getFileMetadata } from '../../file-data/selectors' import { toggleNewProtocolModal } from '../../navigation/actions' import { useKitchen } from '../../organisms/Kitchen/hooks' +import { getHasOptedIn } from '../../analytics/selectors' import { useAnnouncements } from '../../organisms/AnnouncementModal/announcements' import { getLocalStorageItem, localStorageAnnouncementKey } from '../../persist' import welcomeImage from '../../assets/images/welcome_page.png' @@ -37,17 +38,17 @@ export function Landing(): JSX.Element { const [showAnnouncementModal, setShowAnnouncementModal] = useState( false ) + const hasOptedIn = useSelector(getHasOptedIn) const { bakeToast, eatToast } = useKitchen() const announcements = useAnnouncements() const lastAnnouncement = announcements[announcements.length - 1] const announcementKey = lastAnnouncement ? lastAnnouncement.announcementKey : null - const showGateModal = - process.env.NODE_ENV === 'production' || process.env.OT_PD_SHOW_GATE + const userHasNotSeenAnnouncement = getLocalStorageItem(localStorageAnnouncementKey) !== announcementKey && - !showGateModal + hasOptedIn != null useEffect(() => { if (userHasNotSeenAnnouncement) {