diff --git a/src/ROUTES.js b/src/ROUTES.js index 4adf292a87b1..943c18b40c2b 100644 --- a/src/ROUTES.js +++ b/src/ROUTES.js @@ -80,7 +80,8 @@ export default { getWorkspacePeopleRoute: policyID => `workspace/${policyID}/people`, getWorkspaceInviteRoute: policyID => `workspace/${policyID}/invite`, WORKSPACE_INVITE: 'workspace/:policyID/invite', - REQUEST_CALL: 'request-call', + getRequestCallRoute: taskID => `request-call/${taskID}`, + REQUEST_CALL: 'request-call/:taskID', getWorkspaceEditorRoute: policyID => `workspace/${policyID}/edit`, WORKSPACE_EDITOR: 'workspace/:policyID/edit', VALIDATE_CODE_URL: (accountID, validateCode, exitTo = '') => { diff --git a/src/components/HeaderWithCloseButton.js b/src/components/HeaderWithCloseButton.js index a56dac010ba0..24479b48554b 100755 --- a/src/components/HeaderWithCloseButton.js +++ b/src/components/HeaderWithCloseButton.js @@ -9,6 +9,7 @@ import Icon from './Icon'; import {Close, Download, BackArrow} from './Icon/Expensicons'; import compose from '../libs/compose'; import withLocalize, {withLocalizePropTypes} from './withLocalize'; +import InboxCallButton from './InboxCallButton'; const propTypes = { /** Title of the Header */ @@ -32,6 +33,12 @@ const propTypes = { /** Whether we should show a download button */ shouldShowDownloadButton: PropTypes.bool, + /** Whether we should show a inbox call button */ + shouldShowInboxCallButton: PropTypes.bool, + + /** The task ID to associate with the call button, if we show it */ + inboxCallTaskID: PropTypes.string, + ...withLocalizePropTypes, }; @@ -43,6 +50,8 @@ const defaultProps = { shouldShowBackButton: false, shouldShowBorderBottom: false, shouldShowDownloadButton: false, + shouldShowInboxCallButton: false, + inboxCallTaskID: '', }; const HeaderWithCloseButton = props => ( @@ -77,6 +86,8 @@ const HeaderWithCloseButton = props => ( ) } + {props.shouldShowInboxCallButton && } + ( + + { + Navigation.navigate(ROUTES.getRequestCallRoute(props.taskID)); + }} + style={[styles.button, styles.buttonSmall]} + > + + + + + + + {props.translate('requestCallPage.needHelp')} + + + + + +); + +InboxCallButton.propTypes = propTypes; +InboxCallButton.defaultProps = defaultProps; +InboxCallButton.displayName = 'InboxCallButton'; +export default compose(withLocalize)(InboxCallButton); diff --git a/src/components/VideoChatButtonAndMenu.js b/src/components/VideoChatButtonAndMenu.js index 437bcd957311..b39867c56d56 100755 --- a/src/components/VideoChatButtonAndMenu.js +++ b/src/components/VideoChatButtonAndMenu.js @@ -99,7 +99,7 @@ class VideoChatButtonAndMenu extends Component { onPress={() => { // If this is the Concierge chat, we'll open the modal for requesting a setup call instead if (this.props.isConcierge) { - Navigation.navigate(ROUTES.REQUEST_CALL); + Navigation.navigate(ROUTES.getRequestCallRoute('NewExpensifyConciergeDM')); return; } this.toggleVideoChatMenu(); diff --git a/src/languages/en.js b/src/languages/en.js index fdad96761be6..839565f32353 100755 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -618,5 +618,7 @@ export default { growlMessageInvalidPhone: 'That doesn’t look like a valid phone number. Try again with the country code.\ne.g. +15005550006', growlMessageEmptyName: 'Please provide both a first and last name so our Guides know how to address you!', growlMessageNoPersonalPolicy: 'I wasn’t able to find a personal policy to associate this Guides call with, please check your connection and try again.', + needHelp: 'Help', + needHelpTooltip: 'Get live help from our team', }, }; diff --git a/src/languages/es.js b/src/languages/es.js index 6438f8946c8f..8b8062c4986a 100644 --- a/src/languages/es.js +++ b/src/languages/es.js @@ -620,5 +620,7 @@ export default { growlMessageInvalidPhone: 'El teléfono no es valido. Intentalo de nuevo agregando el código de país. P. ej.: +15005550006', growlMessageEmptyName: 'Por favor ingresa tu nombre completo', growlMessageNoPersonalPolicy: 'No he podido encontrar una póliza personal con la que asociar esta llamada a las Guías, compruebe su conexión e inténtelo de nuevo.', + needHelp: 'Ayuda', + needHelpTooltip: 'Recibe ayuda telefónica de nuestro equipo', }, }; diff --git a/src/libs/actions/Inbox.js b/src/libs/actions/Inbox.js index 0a7554a8c3f2..4623bb260ed7 100644 --- a/src/libs/actions/Inbox.js +++ b/src/libs/actions/Inbox.js @@ -1,14 +1,14 @@ import {Inbox_CallUser} from '../API'; -function requestConciergeDMCall(policyID, firstName, lastName, phoneNumber) { +function requestInboxCall(taskID, policyID, firstName, lastName, phoneNumber) { return Inbox_CallUser({ policyID, firstName, lastName, phoneNumber, - taskID: 'NewExpensifyConciergeDM', + taskID, }); } // eslint-disable-next-line import/prefer-default-export -export {requestConciergeDMCall}; +export {requestInboxCall}; diff --git a/src/pages/RequestCallPage.js b/src/pages/RequestCallPage.js index 3d5a1e195057..f6d4064edcea 100644 --- a/src/pages/RequestCallPage.js +++ b/src/pages/RequestCallPage.js @@ -16,7 +16,7 @@ import Button from '../components/Button'; import FixedFooter from '../components/FixedFooter'; import CONST from '../CONST'; import Growl from '../libs/Growl'; -import {requestConciergeDMCall} from '../libs/actions/Inbox'; +import {requestInboxCall} from '../libs/actions/Inbox'; import {fetchOrCreateChatReport} from '../libs/actions/Report'; import personalDetailsPropType from './personalDetailsPropType'; import ExpensiTextInput from '../components/ExpensiTextInput'; @@ -52,6 +52,14 @@ const propTypes = { /** The type of the policy */ type: PropTypes.string, }).isRequired, + + /** Route object from navigation */ + route: PropTypes.shape({ + params: PropTypes.shape({ + /** The task ID to request the call for */ + taskID: PropTypes.string, + }), + }).isRequired, }; class RequestCallPage extends Component { @@ -83,7 +91,7 @@ class RequestCallPage extends Component { Growl.error(this.props.translate('requestCallPage.growlMessageNoPersonalPolicy'), 3000); return; } - requestConciergeDMCall(personalPolicy.id, this.state.firstName, this.state.lastName, this.state.phoneNumber) + requestInboxCall(this.props.route.params.taskID, personalPolicy.id, this.state.firstName, this.state.lastName, this.state.phoneNumber) .then((result) => { this.setState({isLoading: false}); if (result.jsonCode === 200) { diff --git a/src/pages/workspace/WorkspaceCardPage.js b/src/pages/workspace/WorkspaceCardPage.js index fd734172821c..27eaff65988f 100644 --- a/src/pages/workspace/WorkspaceCardPage.js +++ b/src/pages/workspace/WorkspaceCardPage.js @@ -110,6 +110,8 @@ const WorkspaceCardPage = ({ onCloseButtonPress={() => Navigation.dismissModal()} onBackButtonPress={() => Navigation.goBack()} shouldShowBackButton={isSmallScreenWidth} + shouldShowInboxCallButton + inboxCallTaskID="WorkspaceCompanyCards" />