diff --git a/src/CONST.ts b/src/CONST.ts index 7399cc166d68..489871078d35 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -885,8 +885,6 @@ const CONST = { QA: 'qa@expensify.com', QA_TRAVIS: 'qa+travisreceipts@expensify.com', RECEIPTS: 'receipts@expensify.com', - SAASTR: 'saastr@expensify.com', - SBE: 'sbe@expensify.com', STUDENT_AMBASSADOR: 'studentambassadors@expensify.com', SVFG: 'svfg@expensify.com', }, diff --git a/src/Expensify.js b/src/Expensify.js index 60ab9f756dff..1086bd32cff9 100644 --- a/src/Expensify.js +++ b/src/Expensify.js @@ -30,7 +30,6 @@ import KeyboardShortcutsModal from './components/KeyboardShortcutsModal'; import AppleAuthWrapper from './components/SignInButtons/AppleAuthWrapper'; import EmojiPicker from './components/EmojiPicker/EmojiPicker'; import * as EmojiPickerAction from './libs/actions/EmojiPickerAction'; -import * as DemoActions from './libs/actions/DemoActions'; import DownloadAppModal from './components/DownloadAppModal'; import DeeplinkWrapper from './components/DeeplinkWrapper'; @@ -168,13 +167,11 @@ function Expensify(props) { // If the app is opened from a deep link, get the reportID (if exists) from the deep link and navigate to the chat report Linking.getInitialURL().then((url) => { - DemoActions.runDemoByURL(url); Report.openReportFromDeepLink(url, isAuthenticated); }); // Open chat report from a deep link (only mobile native) Linking.addEventListener('url', (state) => { - DemoActions.runDemoByURL(state.url); Report.openReportFromDeepLink(state.url, isAuthenticated); }); diff --git a/src/languages/en.ts b/src/languages/en.ts index c5d9d153f608..d797e8adfa93 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1755,14 +1755,4 @@ export default { selectSuggestedAddress: 'Please select a suggested address', }, }, - demos: { - saastr: { - signInWelcome: 'Welcome to SaaStr! Hop in to start networking now.', - heroBody: 'Use New Expensify for event updates, networking, social chatter, and to get paid back for lunch!', - }, - sbe: { - signInWelcome: 'Welcome to Small Business Expo! Get paid back for your ride.', - heroBody: 'Use New Expensify for event updates, networking, social chatter, and to get paid back for your ride to or from the show!', - }, - }, } as const; diff --git a/src/languages/es.ts b/src/languages/es.ts index 32b2732b5c97..3c5d98b724d2 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -2247,15 +2247,4 @@ export default { selectSuggestedAddress: 'Por favor, selecciona una dirección sugerida', }, }, - demos: { - saastr: { - signInWelcome: '¡Bienvenido a SaaStr! Entra y empieza a establecer contactos.', - heroBody: 'Utiliza New Expensify para estar al día de los eventos, establecer contactos, charlar en las redes sociales, ¡y para que te devuelvan el dinero de la comida!', - }, - sbe: { - signInWelcome: '¡Bienvenido a Small Business Expo! Recupera el dinero de tu viaje.', - heroBody: - 'Utiliza New Expensify para estar al día de los eventos, establecer contactos, charlar en las redes sociales y para que te paguen el viaje de ida y vuelta a la conferencia.', - }, - }, }; diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.js b/src/libs/Navigation/AppNavigator/AuthScreens.js index e10e51b307e4..34dc089a621f 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.js +++ b/src/libs/Navigation/AppNavigator/AuthScreens.js @@ -106,16 +106,6 @@ const propTypes = { /** The last Onyx update ID was applied to the client */ lastUpdateIDAppliedToClient: PropTypes.number, - /** Information about any currently running demos */ - demoInfo: PropTypes.shape({ - saastr: PropTypes.shape({ - isBeginningDemo: PropTypes.bool, - }), - sbe: PropTypes.shape({ - isBeginningDemo: PropTypes.bool, - }), - }), - ...windowDimensionsPropTypes, }; @@ -126,7 +116,6 @@ const defaultProps = { }, lastOpenedPublicRoomID: null, lastUpdateIDAppliedToClient: null, - demoInfo: {}, }; class AuthScreens extends React.Component { @@ -163,12 +152,6 @@ class AuthScreens extends React.Component { App.setUpPoliciesAndNavigate(this.props.session, !this.props.isSmallScreenWidth); App.redirectThirdPartyDesktopSignIn(); - // Check if we should be running any demos immediately after signing in. - if (lodashGet(this.props.demoInfo, 'saastr.isBeginningDemo', false)) { - Navigation.navigate(ROUTES.SAASTR, CONST.NAVIGATION.TYPE.FORCED_UP); - } else if (lodashGet(this.props.demoInfo, 'sbe.isBeginningDemo', false)) { - Navigation.navigate(ROUTES.SBE, CONST.NAVIGATION.TYPE.FORCED_UP); - } if (this.props.lastOpenedPublicRoomID) { // Re-open the last opened public room if the user logged in from a public room link Report.openLastOpenedPublicRoom(this.props.lastOpenedPublicRoomID); @@ -344,8 +327,5 @@ export default compose( lastUpdateIDAppliedToClient: { key: ONYXKEYS.ONYX_UPDATES_LAST_UPDATE_ID_APPLIED_TO_CLIENT, }, - demoInfo: { - key: ONYXKEYS.DEMO_INFO, - }, }), )(AuthScreens); diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index c95bf505879d..8b84555ca2a9 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -126,12 +126,6 @@ function getPolicyName(report, returnEmptyIfNotFound = false, policy = undefined // since they can also be accessed by people who aren't in the workspace const policyName = lodashGet(finalPolicy, 'name') || report.policyName || report.oldPolicyName || noPolicyFound; - // The SBE and SAASTR policies have the user name in its name, however, we do not want to show that - if (lodashGet(finalPolicy, 'owner') === CONST.EMAIL.SBE || lodashGet(finalPolicy, 'owner') === CONST.EMAIL.SAASTR) { - const policyNameParts = policyName.split(' '); - if (!Str.isValidEmail(policyNameParts[0])) return policyName; - return policyNameParts.length > 1 ? policyNameParts.slice(1).join(' ') : policyName; - } return policyName; } diff --git a/src/libs/actions/DemoActions.js b/src/libs/actions/DemoActions.js deleted file mode 100644 index 4ba9f6ee33a0..000000000000 --- a/src/libs/actions/DemoActions.js +++ /dev/null @@ -1,108 +0,0 @@ -import Onyx from 'react-native-onyx'; -import _ from 'underscore'; -import lodashGet from 'lodash/get'; -import CONST from '../../CONST'; -import * as API from '../API'; -import * as ReportUtils from '../ReportUtils'; -import Navigation from '../Navigation/Navigation'; -import ROUTES from '../../ROUTES'; -import ONYXKEYS from '../../ONYXKEYS'; -import * as Localize from '../Localize'; - -/** - * @param {String} workspaceOwnerEmail email of the workspace owner - * @param {String} apiCommand - */ -function createDemoWorkspaceAndNavigate(workspaceOwnerEmail, apiCommand) { - // Try to navigate to existing demo workspace expense chat if it exists in Onyx - const demoWorkspaceChatReportID = ReportUtils.getPolicyExpenseChatReportIDByOwner(workspaceOwnerEmail); - if (demoWorkspaceChatReportID) { - // We must call goBack() to remove the demo route from nav history - Navigation.goBack(); - Navigation.navigate(ROUTES.getReportRoute(demoWorkspaceChatReportID)); - return; - } - - // We use makeRequestWithSideEffects here because we need to get the workspace chat report ID to navigate to it after it's created - // eslint-disable-next-line rulesdir/no-api-side-effects-method - API.makeRequestWithSideEffects(apiCommand).then((response) => { - // Get report updates from Onyx response data - const reportUpdate = _.find(response.onyxData, ({key}) => key === ONYXKEYS.COLLECTION.REPORT); - if (!reportUpdate) { - // If there's no related onyx data, navigate the user home so they're not stuck. - Navigation.goBack(); - Navigation.navigate(ROUTES.HOME); - return; - } - - // Get the policy expense chat update - const policyExpenseChatReport = _.find(reportUpdate.value, ({chatType}) => chatType === CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT); - if (!policyExpenseChatReport) { - // If there's no related onyx data, navigate the user home so they're not stuck. - Navigation.goBack(); - Navigation.navigate(ROUTES.HOME); - return; - } - - // Navigate to the new policy expense chat report - // Note: We must call goBack() to remove the demo route from history - Navigation.goBack(); - Navigation.navigate(ROUTES.getReportRoute(policyExpenseChatReport.reportID)); - }); -} - -function runSbeDemo() { - createDemoWorkspaceAndNavigate(CONST.EMAIL.SBE, 'CreateSbeDemoWorkspace'); -} - -function runSaastrDemo() { - createDemoWorkspaceAndNavigate(CONST.EMAIL.SAASTR, 'CreateSaastrDemoWorkspace'); -} - -/** - * Runs code for specific demos, based on the provided URL - * - * @param {String} url - URL user is navigating to via deep link (or regular link in web) - */ -function runDemoByURL(url = '') { - const cleanUrl = (url || '').toLowerCase(); - - if (cleanUrl.endsWith(ROUTES.SAASTR)) { - Onyx.set(ONYXKEYS.DEMO_INFO, { - saastr: { - isBeginningDemo: true, - }, - }); - } else if (cleanUrl.endsWith(ROUTES.SBE)) { - Onyx.set(ONYXKEYS.DEMO_INFO, { - sbe: { - isBeginningDemo: true, - }, - }); - } else { - // No demo is being run, so clear out demo info - Onyx.set(ONYXKEYS.DEMO_INFO, null); - } -} - -/** - * @param {Object} demoInfo - * @returns {Object} - */ -function getCustomTextForDemo(demoInfo = {}) { - if (lodashGet(demoInfo, 'saastr.isBeginningDemo')) { - return { - customHeadline: Localize.translateLocal('demos.saastr.signInWelcome'), - customHeroBody: Localize.translateLocal('demos.saastr.heroBody'), - }; - } - if (lodashGet(demoInfo, 'sbe.isBeginningDemo')) { - return { - customHeadline: Localize.translateLocal('demos.sbe.signInWelcome'), - customHeroBody: Localize.translateLocal('demos.sbe.heroBody'), - }; - } - return {}; -} - -export {runSaastrDemo, runSbeDemo, runDemoByURL, getCustomTextForDemo}; diff --git a/src/pages/DemoSetupPage.js b/src/pages/DemoSetupPage.js index 0f7578760c16..5d4b99a0daf9 100644 --- a/src/pages/DemoSetupPage.js +++ b/src/pages/DemoSetupPage.js @@ -2,9 +2,8 @@ import React from 'react'; import PropTypes from 'prop-types'; import {useFocusEffect} from '@react-navigation/native'; import FullScreenLoadingIndicator from '../components/FullscreenLoadingIndicator'; -import CONST from '../CONST'; -import * as DemoActions from '../libs/actions/DemoActions'; import Navigation from '../libs/Navigation/Navigation'; +import ROUTES from '../ROUTES'; const propTypes = { /** Navigation route context info provided by react navigation */ @@ -15,22 +14,14 @@ const propTypes = { }; /* - * This is a "utility page", that does this: - * - Looks at the current route - * - Determines if there's a demo command we need to call - * - If not, routes back to home + * This is a "utility page", that used to call specific actions depending on the + * route that led the user here. Now, it's just used to route the user home so we + * don't show them a "Hmm... It's not here" message (which looks broken). */ -function DemoSetupPage(props) { +function DemoSetupPage() { useFocusEffect(() => { Navigation.isNavigationReady().then(() => { - // Depending on the route that the user hit to get here, run a specific demo flow - if (props.route.name === CONST.DEMO_PAGES.SAASTR) { - DemoActions.runSaastrDemo(); - } else if (props.route.name === CONST.DEMO_PAGES.SBE) { - DemoActions.runSbeDemo(); - } else { - Navigation.goBack(); - } + Navigation.goBack(ROUTES.HOME); }); }); diff --git a/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js b/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js index a75a03f7a517..cb77a832705c 100644 --- a/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js +++ b/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js @@ -67,16 +67,6 @@ const propTypes = { /** Forwarded ref to FloatingActionButtonAndPopover */ innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]), - - /** Information about any currently running demos */ - demoInfo: PropTypes.shape({ - saastr: PropTypes.shape({ - isBeginningDemo: PropTypes.bool, - }), - sbe: PropTypes.shape({ - isBeginningDemo: PropTypes.bool, - }), - }), }; const defaultProps = { onHideCreateMenu: () => {}, @@ -86,7 +76,6 @@ const defaultProps = { isLoading: false, innerRef: null, shouldShowDownloadAppBanner: true, - demoInfo: {}, }; /** @@ -173,9 +162,6 @@ function FloatingActionButtonAndPopover(props) { if (props.shouldShowDownloadAppBanner && Browser.isMobile()) { return; } - if (lodashGet(props.demoInfo, 'saastr.isBeginningDemo', false) || lodashGet(props.demoInfo, 'sbe.isBeginningDemo', false)) { - return; - } Welcome.show({routes, showCreateMenu}); }, [props.shouldShowDownloadAppBanner, props.navigation, showCreateMenu, props.demoInfo]); @@ -308,9 +294,6 @@ export default compose( shouldShowDownloadAppBanner: { key: ONYXKEYS.SHOW_DOWNLOAD_APP_BANNER, }, - demoInfo: { - key: ONYXKEYS.DEMO_INFO, - }, }), )( forwardRef((props, ref) => ( diff --git a/src/pages/signin/SignInPage.js b/src/pages/signin/SignInPage.js index 75ee4de65a5c..3e27e6cd253a 100644 --- a/src/pages/signin/SignInPage.js +++ b/src/pages/signin/SignInPage.js @@ -19,7 +19,6 @@ import * as StyleUtils from '../../styles/StyleUtils'; import useLocalize from '../../hooks/useLocalize'; import useWindowDimensions from '../../hooks/useWindowDimensions'; import Log from '../../libs/Log'; -import * as DemoActions from '../../libs/actions/DemoActions'; const propTypes = { /** The details about the account that the user is signing in with */ @@ -49,23 +48,12 @@ const propTypes = { /** Whether or not the sign in page is being rendered in the RHP modal */ isInModal: PropTypes.bool, - - /** Information about any currently running demos */ - demoInfo: PropTypes.shape({ - saastr: PropTypes.shape({ - isBeginningDemo: PropTypes.bool, - }), - sbe: PropTypes.shape({ - isBeginningDemo: PropTypes.bool, - }), - }), }; const defaultProps = { account: {}, credentials: {}, isInModal: false, - demoInfo: {}, }; /** @@ -93,7 +81,7 @@ function getRenderOptions({hasLogin, hasValidateCode, hasAccount, isPrimaryLogin }; } -function SignInPage({credentials, account, isInModal, demoInfo}) { +function SignInPage({credentials, account, isInModal}) { const {translate, formatPhoneNumber} = useLocalize(); const {isSmallScreenWidth} = useWindowDimensions(); const shouldShowSmallScreen = isSmallScreenWidth || isInModal; @@ -118,8 +106,7 @@ function SignInPage({credentials, account, isInModal, demoInfo}) { let welcomeHeader = ''; let welcomeText = ''; - const {customHeadline, customHeroBody} = DemoActions.getCustomTextForDemo(demoInfo); - const headerText = customHeadline || translate('login.hero.header'); + const headerText = translate('login.hero.header'); if (shouldShowLoginForm) { welcomeHeader = isSmallScreenWidth ? headerText : translate('welcomeText.getStarted'); welcomeText = isSmallScreenWidth ? translate('welcomeText.getStarted') : ''; @@ -167,8 +154,6 @@ function SignInPage({credentials, account, isInModal, demoInfo}) { shouldShowWelcomeText={shouldShowWelcomeText} ref={signInPageLayoutRef} isInModal={isInModal} - customHeadline={customHeadline} - customHeroBody={customHeroBody} > {/* LoginForm must use the isVisible prop. This keeps it mounted, but visually hidden so that password managers can access the values. Conditionally rendering this component will break this feature. */} @@ -192,5 +177,4 @@ SignInPage.displayName = 'SignInPage'; export default withOnyx({ account: {key: ONYXKEYS.ACCOUNT}, credentials: {key: ONYXKEYS.CREDENTIALS}, - demoInfo: {key: ONYXKEYS.DEMO_INFO}, })(SignInPage);