diff --git a/app/src/client/App.tsx b/app/src/client/App.tsx index 7f4496e..ee57ddd 100644 --- a/app/src/client/App.tsx +++ b/app/src/client/App.tsx @@ -57,7 +57,7 @@ export default function App({ children }: { children: ReactNode }) { useEffect(() => { if (user) { if (!user.isSignUpComplete) { - if (user.hasAcceptedTos && user.hasSubscribedToMarketingEmails) { + if (user.hasAcceptedTos) { updateCurrentUser({ isSignUpComplete: true, }); @@ -67,13 +67,13 @@ export default function App({ children }: { children: ReactNode }) { localStorage.getItem('hasAcceptedTos') === 'true'; const hasSubscribedToMarketingEmails = localStorage.getItem('hasSubscribedToMarketingEmails') === 'true'; - if (!hasAcceptedTos || !hasSubscribedToMarketingEmails) { + if (!hasAcceptedTos) { setShowTosAndMarketingEmailsModal(true); } else { updateCurrentUser({ isSignUpComplete: true, - hasAcceptedTos: true, - hasSubscribedToMarketingEmails: true, + hasAcceptedTos: hasAcceptedTos, + hasSubscribedToMarketingEmails: hasSubscribedToMarketingEmails, }); setShowTosAndMarketingEmailsModal(false); } diff --git a/app/src/client/auth/LoginSignupForm.tsx b/app/src/client/auth/LoginSignupForm.tsx index d7c4558..f83be99 100644 --- a/app/src/client/auth/LoginSignupForm.tsx +++ b/app/src/client/auth/LoginSignupForm.tsx @@ -45,7 +45,7 @@ const googleSignInUrl = `${config.apiUrl}/auth/google/login`; export const checkBoxErrMsg = { title: - 'To proceed, please ensure you have accepted the Terms & Conditions, Privacy Policy, and opted to receive marketing emails.', + "To proceed, please ensure you've accepted our Terms & Conditions and Privacy Policy.", description: '', }; @@ -88,10 +88,10 @@ export const LoginSignupForm = ({ } = hookForm; useEffect(() => { - if (tocChecked && marketingEmailsChecked) { + if (tocChecked) { setErrorMessage(null); } - }, [tocChecked, marketingEmailsChecked]); + }, [tocChecked]); const handleTocChange = (event: React.ChangeEvent) => { setTocChecked(event.target.checked); @@ -122,7 +122,7 @@ export const LoginSignupForm = ({ updateLocalStorage(); window.location.href = googleSignInUrl; } else { - if (tocChecked && marketingEmailsChecked) { + if (tocChecked) { updateLocalStorage(); window.location.href = googleSignInUrl; } else { diff --git a/app/src/client/components/AppNavBar.tsx b/app/src/client/components/AppNavBar.tsx index 98f0aed..a23bd73 100644 --- a/app/src/client/components/AppNavBar.tsx +++ b/app/src/client/components/AppNavBar.tsx @@ -10,12 +10,7 @@ import DropdownUser from './DropdownUser'; import { UserMenuItems } from '../components/UserMenuItems'; import FreeTrialButton from '../components/FreeTrialButton'; -export const navigation = [ - { name: 'Home', href: '/' }, - { name: 'Chat', href: '/chat' }, - // { name: 'Documentation', href: DOCS_URL }, - // { name: 'Blog', href: BLOG_URL }, -]; +import { navigation } from '../landing-page/contentSections'; const NavLogo = () => ( Capt’n.ai diff --git a/app/src/client/components/TosAndMarketingEmailsModal.tsx b/app/src/client/components/TosAndMarketingEmailsModal.tsx index 96d0da8..76f07d6 100644 --- a/app/src/client/components/TosAndMarketingEmailsModal.tsx +++ b/app/src/client/components/TosAndMarketingEmailsModal.tsx @@ -12,6 +12,9 @@ export type ErrorMessage = { description?: string; }; +export const notificationMsg = + 'Before accessing the application, please confirm your agreement to the Terms & Conditions and Privacy Policy.'; + const TosAndMarketingEmailsModal = () => { const history = useHistory(); const { isLoading, setSuccessMessage, setIsLoading } = @@ -22,10 +25,10 @@ const TosAndMarketingEmailsModal = () => { const [marketingEmailsChecked, setMarketingEmailsChecked] = useState(false); useEffect(() => { - if (tocChecked && marketingEmailsChecked) { + if (tocChecked) { setErrorMessage(null); } - }, [tocChecked, marketingEmailsChecked]); + }, [tocChecked]); const handleTocChange = (event: React.ChangeEvent) => { setTocChecked(event.target.checked); @@ -39,12 +42,14 @@ const TosAndMarketingEmailsModal = () => { const onClick = (event: React.MouseEvent) => { event.preventDefault(); - if (tocChecked && marketingEmailsChecked) { + if (tocChecked) { setErrorMessage(null); updateCurrentUser({ isSignUpComplete: true, hasAcceptedTos: tocChecked, - hasSubscribedToMarketingEmails: marketingEmailsChecked, + ...(marketingEmailsChecked && { + hasSubscribedToMarketingEmails: marketingEmailsChecked, + }), }); history.push('/chat'); } else { @@ -66,18 +71,14 @@ const TosAndMarketingEmailsModal = () => {

Almost there...

-

- Before accessing the application, please confirm your agreement to - the Terms & Conditions, Privacy Policy, and consent to receiving - marketing emails by checking the boxes below -

+

{notificationMsg}

{ + return location.pathname.startsWith('/chat'); + }, [location]); + + const navFontColor = isChatPage + ? 'text-captn-light-cream' + : 'text-captn-dark-blue'; + return ( <>
    Admin dashboard diff --git a/app/src/client/landing-page/contentSections.ts b/app/src/client/landing-page/contentSections.ts index 3677744..6564ba2 100644 --- a/app/src/client/landing-page/contentSections.ts +++ b/app/src/client/landing-page/contentSections.ts @@ -5,6 +5,7 @@ import avatarPlaceholder from '../static/avatar-placeholder.png'; export const navigation = [ { name: 'Home', href: '/' }, { name: 'Chat', href: '/chat' }, + { name: 'Pricing', href: '/pricing' }, // { name: 'Documentation', href: DOCS_URL }, // { name: 'Blog', href: BLOG_URL }, ]; diff --git a/app/src/client/tests/TosAndMarketingEmailsModal.test.tsx b/app/src/client/tests/TosAndMarketingEmailsModal.test.tsx index 7efe004..f379c44 100644 --- a/app/src/client/tests/TosAndMarketingEmailsModal.test.tsx +++ b/app/src/client/tests/TosAndMarketingEmailsModal.test.tsx @@ -4,7 +4,9 @@ import { fireEvent, screen } from '@testing-library/react'; import { createMemoryHistory } from 'history'; import { Router } from 'react-router-dom'; -import TosAndMarketingEmailsModal from '../components/TosAndMarketingEmailsModal'; +import TosAndMarketingEmailsModal, { + notificationMsg, +} from '../components/TosAndMarketingEmailsModal'; describe('TosAndMarketingEmailsModal', () => { test('renders TosAndMarketingEmailsModal component', async () => { @@ -55,9 +57,7 @@ describe('TosAndMarketingEmailsModal', () => { test('renders error message when save button is clicked and checkboxes are not checked', async () => { renderInContext(); fireEvent.click(screen.getByText('Save')); - const errorItems = await screen.findAllByText( - 'Before accessing the application, please confirm your agreement to the Terms & Conditions, Privacy Policy, and consent to receiving marketing emails by checking the boxes below' - ); + const errorItems = await screen.findAllByText(notificationMsg); expect(errorItems).toHaveLength(1); }); });