Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor request call page to use Form #10402

Merged
merged 15 commits into from
Aug 19, 2022
4 changes: 1 addition & 3 deletions src/ONYXKEYS.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,6 @@ export default {
// Set when we are loading payment methods
IS_LOADING_PAYMENT_METHODS: 'isLoadingPaymentMethods',

// Stores values for the request call form
REQUEST_CALL_FORM: 'requestCallForm',

// The number of minutes a user has to wait for a call.
INBOX_CALL_USER_WAIT_TIME: 'inboxCallUserWaitTime',

Expand Down Expand Up @@ -180,5 +177,6 @@ export default {
// List of Form ids
FORMS: {
ADD_DEBIT_CARD_FORM: 'addDebitCardForm',
REQUEST_CALL_FORM: 'requestCallForm',
},
};
3 changes: 1 addition & 2 deletions src/components/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ class Form extends React.Component {
return;
}

// Set loading state and call submit handler
FormActions.setIsLoading(this.props.formID, true);
// Call submit handler
this.props.onSubmit(this.inputValues);
}

Expand Down
6 changes: 5 additions & 1 deletion src/components/Section.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,24 @@ const propTypes = {

/** Contents to display inside the section */
children: PropTypes.node,

/** Customize the Section container */
containerStyles: PropTypes.arrayOf(PropTypes.object),
};

const defaultProps = {
menuItems: null,
children: null,
icon: null,
IconComponent: null,
containerStyles: [],
};

const Section = (props) => {
const IconComponent = props.IconComponent;
return (
<>
<View style={styles.pageWrapper}>
<View style={[styles.pageWrapper, ...props.containerStyles]}>
<View style={[styles.flexRow, styles.alignItemsCenter, styles.w100]}>
<View style={[styles.flexShrink1]}>
<Text style={[styles.h1]}>{props.title}</Text>
Expand Down
9 changes: 6 additions & 3 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -909,10 +909,9 @@ export default {
title: 'Request a call',
subtitle: 'Need help?',
description: 'Our team is ready to help each step of the way. Enter your name and phone number, and we\'ll give you a call back asap.',
extension: 'Extension (Optional)',
phoneNumberExtension: 'Extension (Optional)',
callMe: 'Call me',
growlMessageOnSave: 'Call requested.',
growlMessageEmptyName: 'Please provide both a first and last name so our guides know how to address you!',
callButton: 'Call',
callButtonTooltip: 'Get live help from our team',
blockedFromConcierge: 'Due to previous interactions with our staff, a call cannot be scheduled at this time.',
Expand All @@ -925,7 +924,11 @@ export default {
guides: 'Please note that our Guides are typically available from Sunday at 5pm CT to Friday at 5pm CT.',
},
error: {
phoneExtension: 'Please enter a valid phone extension number',
phoneNumberExtension: 'Please enter a valid phone extension number',
firstName: 'Please provide your first name so our guides know how to address you!',
lastName: 'Please provide your last name so our guides know how to address you!',
firstNameLength: 'First name shouldn\'t be longer than 50 characters',
lastNameLength: 'Last name shouldn\'t be longer than 50 characters',
},
},
requestCallConfirmationScreen: {
Expand Down
9 changes: 6 additions & 3 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -911,10 +911,9 @@ export default {
title: 'Llámame por teléfono',
subtitle: '¿Necesitas ayuda?',
description: 'Nuestro equipo está listo para ayudarte en cada paso. Ingresa tu nombre y número de teléfono y te llamaremos lo antes posible.',
extension: 'Extensión (Opcional)',
phoneNumberExtension: 'Extensión (Opcional)',
callMe: 'Llámame',
growlMessageOnSave: 'Llamada solicitada.',
growlMessageEmptyName: 'Por favor ingresa tu nombre completo',
callButton: 'Llamar',
callButtonTooltip: 'Recibe ayuda telefónica de nuestro equipo',
blockedFromConcierge: 'Debido a sus interacciones pasadas con nuestro equipo, la llamada no puede ser agendada en este momento.',
Expand All @@ -927,7 +926,11 @@ export default {
guides: 'Tenga en cuenta que nuestras guías suelen estar disponibles desde el domingo a las 5pm CT hasta el viernes a las 5pm CT.',
},
error: {
phoneExtension: 'Por favor, introduzca una extensión telefónica válida',
phoneNumberExtension: 'Por favor, introduzca una extensión telefónica válida',
firstName: 'Por favor ingresa tu nombre!',
lastName: 'Por favor ingresa tu apellido!',
firstNameLength: 'El nombre no debe tener más de 50 caracteres',
lastNameLength: 'El apellido no debe tener más de 50 caracteres',
},
},
requestCallConfirmationScreen: {
Expand Down
16 changes: 8 additions & 8 deletions src/libs/actions/Inbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ function requestCall({
}) {
const optimisticData = [{
onyxMethod: CONST.ONYX.METHOD.MERGE,
key: ONYXKEYS.REQUEST_CALL_FORM,
key: ONYXKEYS.FORMS.REQUEST_CALL_FORM,
value: {
loading: true,
isLoading: true,
},
}];

const successData = [
{
onyxMethod: CONST.ONYX.METHOD.MERGE,
key: ONYXKEYS.REQUEST_CALL_FORM,
key: ONYXKEYS.FORMS.REQUEST_CALL_FORM,
value: {
loading: false,
isLoading: false,
error: '',
didRequestCallSucceed: true,
},
Expand All @@ -39,9 +39,9 @@ function requestCall({

const failureData = [{
onyxMethod: CONST.ONYX.METHOD.MERGE,
key: ONYXKEYS.REQUEST_CALL_FORM,
key: ONYXKEYS.FORMS.REQUEST_CALL_FORM,
value: {
loading: false,
isLoading: false,
},
}];

Expand All @@ -63,7 +63,7 @@ function openRequestCallPage() {
// Reset the error message in case we had one set from a previous failed attempt at requesting a call.
const optimisticData = [{
onyxMethod: CONST.ONYX.METHOD.MERGE,
key: ONYXKEYS.REQUEST_CALL_FORM,
key: ONYXKEYS.FORMS.REQUEST_CALL_FORM,
value: {
error: '',
},
Expand All @@ -72,7 +72,7 @@ function openRequestCallPage() {
}

function clearDidRequestCallSucceed() {
Onyx.merge(ONYXKEYS.REQUEST_CALL_FORM, {didRequestCallSucceed: false});
Onyx.merge(ONYXKEYS.FORMS.REQUEST_CALL_FORM, {didRequestCallSucceed: false});
}

export {
Expand Down
Loading