diff --git a/src/components/IFrame.js b/src/components/IFrame.js index 129af4254c42..5f7f657b0c09 100644 --- a/src/components/IFrame.js +++ b/src/components/IFrame.js @@ -1,5 +1,8 @@ /* eslint-disable es/no-nullish-coalescing-operators */ import React, {useEffect, useState} from 'react'; +import {withOnyx} from 'react-native-onyx'; +import PropTypes from 'prop-types'; +import ONYXKEYS from '../ONYXKEYS'; function getNewDotURL(url) { const urlObj = new URL(url); @@ -50,6 +53,11 @@ function getOldDotURL(url) { const pathname = urlObj.pathname; const paths = pathname.slice(1).split('/'); + // TODO: temporary measure until linking config is adjusted + if (pathname.startsWith('/r')) { + return 'inbox'; + } + if (pathname === 'home') { return 'inbox'; } @@ -78,8 +86,19 @@ function getOldDotURL(url) { return pathname; } -export default function ReportScreen() { - const [oldDotURL, setOldDotURL] = useState('https://www.expensify.com.dev'); +const propTypes = { + // The session of the logged in person + session: PropTypes.shape({ + // The email of the logged in person + email: PropTypes.string, + + // The authToken of the logged in person + authToken: PropTypes.string, + }).isRequired, +}; + +function OldDotIFrame({session}) { + const [oldDotURL, setOldDotURL] = useState('https://staging.expensify.com'); useEffect(() => { setOldDotURL(`https://expensify.com.dev/${getOldDotURL(window.location.href)}`); @@ -92,6 +111,11 @@ export default function ReportScreen() { }); }, []); + useEffect(() => { + document.cookie = `authToken=${session.authToken}; domain=expensify.com.dev; path=/;`; + document.cookie = `email=${session.email}; domain=expensify.com.dev; path=/;`; + }, [session.authToken, session.email]); + return (