Skip to content

Commit

Permalink
Merge pull request #39483 from shubham1206agra/rename-flow
Browse files Browse the repository at this point in the history
[NoQA] Renaming money request to expense
  • Loading branch information
mountiny authored Apr 17, 2024
2 parents c647c30 + 5ce1479 commit b35d357
Show file tree
Hide file tree
Showing 69 changed files with 410 additions and 446 deletions.
10 changes: 3 additions & 7 deletions .well-known/apple-app-site-association
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@
"/": "/iou/*",
"comment": "I Owe You reports"
},
{
"/": "/request/*",
"comment": "Money request"
},
{
"/": "/enable-payments/*",
"comment": "Payments setup"
Expand All @@ -54,11 +50,11 @@
},
{
"/": "/split/*",
"comment": "Split Bill"
"comment": "Split Expense"
},
{
"/": "/request/*",
"comment": "Request Money"
"comment": "Submit Expense"
},
{
"/": "/new/*",
Expand All @@ -82,7 +78,7 @@
},
{
"/": "/send/*",
"comment": "Send money"
"comment": "Pay someone"
},
{
"/": "/money2020/*",
Expand Down
4 changes: 2 additions & 2 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1363,7 +1363,7 @@ const CONST = {
},

KYC_WALL_SOURCE: {
REPORT: 'REPORT', // The user attempted to pay a money request
REPORT: 'REPORT', // The user attempted to pay an expense
ENABLE_WALLET: 'ENABLE_WALLET', // The user clicked on the `Enable wallet` button on the Wallet page
TRANSFER_BALANCE: 'TRANSFER_BALANCE', // The user attempted to transfer their wallet balance to their bank account or debit card
},
Expand Down Expand Up @@ -1399,7 +1399,7 @@ const CONST = {
},

IOU: {
// This is the transactionID used when going through the create money request flow so that it mimics a real transaction (like the edit flow)
// This is the transactionID used when going through the create expense flow so that it mimics a real transaction (like the edit flow)
OPTIMISTIC_TRANSACTION_ID: '1',
// Note: These payment types are used when building IOU reportAction message values in the server and should
// not be changed.
Expand Down
4 changes: 2 additions & 2 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const ONYXKEYS = {
/** The NVP with the last payment method used per policy */
NVP_LAST_PAYMENT_METHOD: 'nvp_private_lastPaymentMethod',

/** This NVP holds to most recent waypoints that a person has used when creating a distance request */
/** This NVP holds to most recent waypoints that a person has used when creating a distance expense */
NVP_RECENT_WAYPOINTS: 'expensify_recentWaypoints',

/** This NVP will be `true` if the user has ever dismissed the engagement modal on either OldDot or NewDot. If it becomes true it should stay true forever. */
Expand Down Expand Up @@ -345,7 +345,7 @@ const ONYXKEYS = {
PRIVATE_NOTES_DRAFT: 'privateNotesDraft_',
NEXT_STEP: 'reportNextStep_',

// Manual request tab selector
// Manual expense tab selector
SELECTED_TAB: 'selectedTab_',

/** This is deprecated, but needed for a migration, so we still need to include it here so that it will be initialized in Onyx.init */
Expand Down
2 changes: 1 addition & 1 deletion src/components/ConfirmedRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type ConfirmedRoutePropsOnyxProps = {
};

type ConfirmedRouteProps = ConfirmedRoutePropsOnyxProps & {
/** Transaction that stores the distance request data */
/** Transaction that stores the distance expense data */
transaction: OnyxEntry<Transaction>;
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/DistanceEReceipt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import ScrollView from './ScrollView';
import Text from './Text';

type DistanceEReceiptProps = {
/** The transaction for the distance request */
/** The transaction for the distance expense */
transaction: Transaction;
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/DistanceRequest/DistanceRequestFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type DistanceRequestFooterOnyxProps = {
};

type DistanceRequestFooterProps = DistanceRequestFooterOnyxProps & {
/** The waypoints for the distance request */
/** The waypoints for the distance expense */
waypoints?: WaypointCollection;

/** Function to call when the user wants to add a new waypoint */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {TranslationPaths} from '@src/languages/types';
import type {WaypointCollection} from '@src/types/onyx/Transaction';

type DistanceRequestProps = {
/** The waypoints for the distance request */
/** The waypoints for the distance expense */
waypoints?: WaypointCollection;

/** The index of the item */
Expand Down
2 changes: 1 addition & 1 deletion src/components/HoldBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function HoldBanner() {
return (
<View style={[styles.dFlex, styles.flexRow, styles.alignItemsCenter, styles.pb3, styles.ph5, styles.borderBottom]}>
<TextPill>{translate('iou.hold')}</TextPill>
<Text style={[styles.textLabel, styles.pl3, styles.mw100, styles.flexShrink1]}>{translate('iou.requestOnHold')}</Text>
<Text style={[styles.textLabel, styles.pl3, styles.mw100, styles.flexShrink1]}>{translate('iou.expenseOnHold')}</Text>
</View>
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/MoneyReportHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type MoneyReportHeaderProps = MoneyReportHeaderOnyxProps & {
/** The report currently being looked at */
report: OnyxTypes.Report;

/** The policy tied to the money request report */
/** The policy tied to the expense report */
policy: OnyxEntry<OnyxTypes.Policy>;

/** Array of report actions for the report */
Expand Down Expand Up @@ -288,7 +288,7 @@ function MoneyReportHeader({session, policy, chatReport, nextStep, report: money
danger
/>
<ConfirmModal
title={translate('iou.deleteRequest')}
title={translate('iou.deleteExpense')}
isVisible={isDeleteRequestModalVisible}
onConfirm={deleteTransaction}
onCancel={() => setIsDeleteRequestModalVisible(false)}
Expand Down
6 changes: 3 additions & 3 deletions src/components/MoneyRequestConfirmationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -342,12 +342,12 @@ function MoneyRequestConfirmationList({
if (isSplitBill && iouAmount === 0) {
text = translate('iou.split');
} else if ((!!receiptPath && isTypeRequest) || isDistanceRequestWithPendingRoute) {
text = translate('iou.request');
text = translate('iou.expense');
if (iouAmount !== 0) {
text = translate('iou.requestAmount', {amount: formattedAmount});
text = translate('iou.submitAmount', {amount: formattedAmount});
}
} else {
const translationKey = isSplitBill ? 'iou.splitAmount' : 'iou.requestAmount';
const translationKey = isSplitBill ? 'iou.splitAmount' : 'iou.submitAmount';
text = translate(translationKey, {amount: formattedAmount});
}
return [
Expand Down
8 changes: 4 additions & 4 deletions src/components/MoneyRequestHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function MoneyRequestHeader({session, parentReport, report, parentReportAction,
const isOnHold = TransactionUtils.isOnHold(transaction);
const {isSmallScreenWidth, windowWidth} = useWindowDimensions();

// Only the requestor can take delete the request, admins can only edit it.
// Only the requestor can take delete the expense, admins can only edit it.
const isActionOwner = typeof parentReportAction?.actorAccountID === 'number' && typeof session?.accountID === 'number' && parentReportAction.actorAccountID === session?.accountID;
const isPolicyAdmin = policy?.role === CONST.POLICY.ROLE.ADMIN;
const isApprover = ReportUtils.isMoneyRequestReport(moneyRequestReport) && (session?.accountID ?? null) === moneyRequestReport?.managerID;
Expand Down Expand Up @@ -118,14 +118,14 @@ function MoneyRequestHeader({session, parentReport, report, parentReportAction,
if (isOnHold && (isHoldCreator || (!isRequestIOU && canModifyStatus))) {
threeDotsMenuItems.push({
icon: Expensicons.Stopwatch,
text: translate('iou.unholdRequest'),
text: translate('iou.unholdExpense'),
onSelected: () => changeMoneyRequestStatus(),
});
}
if (!isOnHold && (isRequestIOU || canModifyStatus)) {
threeDotsMenuItems.push({
icon: Expensicons.Stopwatch,
text: translate('iou.holdRequest'),
text: translate('iou.holdExpense'),
onSelected: () => changeMoneyRequestStatus(),
});
}
Expand Down Expand Up @@ -196,7 +196,7 @@ function MoneyRequestHeader({session, parentReport, report, parentReportAction,
{isOnHold && <HoldBanner />}
</View>
<ConfirmModal
title={translate('iou.deleteRequest')}
title={translate('iou.deleteExpense')}
isVisible={isDeleteModalVisible}
onConfirm={deleteTransaction}
onCancel={() => setIsDeleteModalVisible(false)}
Expand Down
30 changes: 15 additions & 15 deletions src/components/MoneyTemporaryForRefactorRequestConfirmationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ type MoneyRequestConfirmationListOnyxProps = {
/** The session of the logged in user */
session: OnyxEntry<OnyxTypes.Session>;

/** Unit and rate used for if the money request is a distance request */
/** Unit and rate used for if the expense is a distance expense */
mileageRate: OnyxEntry<DefaultMileageRate>;
};

type MoneyRequestConfirmationListProps = MoneyRequestConfirmationListOnyxProps & {
/** Callback to inform parent modal of success */
onConfirm?: (selectedParticipants: Participant[]) => void;

/** Callback to parent modal to send money */
/** Callback to parent modal to pay someone */
onSendMoney?: (paymentMethod: PaymentMethodType | undefined) => void;

/** Callback to inform a participant is selected */
Expand Down Expand Up @@ -112,7 +112,7 @@ type MoneyRequestConfirmationListProps = MoneyRequestConfirmationListOnyxProps &
/** Selected participants from MoneyRequestModal with login / accountID */
selectedParticipants: Participant[];

/** Payee of the money request with login */
/** Payee of the expense with login */
payeePersonalDetails?: OnyxTypes.PersonalDetails;

/** Can the participants be modified or not */
Expand All @@ -139,16 +139,16 @@ type MoneyRequestConfirmationListProps = MoneyRequestConfirmationListOnyxProps &
/** List styles for OptionsSelector */
listStyles?: StyleProp<ViewStyle>;

/** Transaction that represents the money request */
/** Transaction that represents the expense */
transaction?: OnyxEntry<OnyxTypes.Transaction>;

/** Whether the money request is a distance request */
/** Whether the expense is a distance expense */
isDistanceRequest?: boolean;

/** Whether the money request is a scan request */
/** Whether the expense is a scan expense */
isScanRequest?: boolean;

/** Whether we're editing a split bill */
/** Whether we're editing a split expense */
isEditingSplitBill?: boolean;

/** Whether we should show the amount, date, and merchant fields. */
Expand Down Expand Up @@ -236,7 +236,7 @@ function MoneyTemporaryForRefactorRequestConfirmationList({
// A flag and a toggler for showing the rest of the form fields
const [shouldExpandFields, toggleShouldExpandFields] = useReducer((state) => !state, false);

// Do not hide fields in case of send money request
// Do not hide fields in case of paying someone
const shouldShowAllFields = isDistanceRequest || shouldExpandFields || !shouldShowSmartScanFields || isTypeSend || isEditingSplitBill;

const shouldShowDate = (shouldShowSmartScanFields || isDistanceRequest) && !isTypeSend;
Expand Down Expand Up @@ -354,7 +354,7 @@ function MoneyTemporaryForRefactorRequestConfirmationList({
[iouAmount, iouCurrencyCode],
);

// If completing a split bill fails, set didConfirm to false to allow the user to edit the fields again
// If completing a split expense fails, set didConfirm to false to allow the user to edit the fields again
if (isEditingSplitBill && didConfirm) {
setDidConfirm(false);
}
Expand All @@ -364,14 +364,14 @@ function MoneyTemporaryForRefactorRequestConfirmationList({
if (isTypeTrackExpense) {
text = translate('iou.trackExpense');
} else if (isTypeSplit && iouAmount === 0) {
text = translate('iou.split');
text = translate('iou.splitExpense');
} else if ((receiptPath && isTypeRequest) || isDistanceRequestWithPendingRoute) {
text = translate('iou.request');
text = translate('iou.submitExpense');
if (iouAmount !== 0) {
text = translate('iou.requestAmount', {amount: formattedAmount});
text = translate('iou.submitAmount', {amount: formattedAmount});
}
} else {
const translationKey = isTypeSplit ? 'iou.splitAmount' : 'iou.requestAmount';
const translationKey = isTypeSplit ? 'iou.splitAmount' : 'iou.submitAmount';
text = translate(translationKey, {amount: formattedAmount});
}
return [
Expand Down Expand Up @@ -552,7 +552,7 @@ function MoneyTemporaryForRefactorRequestConfirmationList({
Log.info(`[IOU] Sending money via: ${paymentMethod}`);
onSendMoney?.(paymentMethod);
} else {
// validate the amount for distance requests
// validate the amount for distance expenses
const decimals = CurrencyUtils.getCurrencyDecimals(iouCurrencyCode);
if (isDistanceRequest && !isDistanceRequestWithPendingRoute && !MoneyRequestUtils.validateAmount(String(iouAmount), decimals)) {
setFormError('common.error.invalidAmount');
Expand Down Expand Up @@ -907,7 +907,7 @@ function MoneyTemporaryForRefactorRequestConfirmationList({
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
source={resolvedThumbnail || resolvedReceiptImage || ''}
// AuthToken is required when retrieving the image from the server
// but we don't need it to load the blob:// or file:// image when starting a money request / split bill
// but we don't need it to load the blob:// or file:// image when starting an expense/split
// So if we have a thumbnail, it means we're retrieving the image from the server
isAuthTokenRequired={!!receiptThumbnail}
fileExtension={fileExtension}
Expand Down
6 changes: 2 additions & 4 deletions src/components/ReportActionItem/MoneyRequestAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type MoneyRequestActionProps = MoneyRequestActionOnyxProps & {
/** The ID of the associated chatReport */
chatReportID: string;

/** The ID of the associated request report */
/** The ID of the associated expense report */
requestReportID: string;

/** The ID of the current report */
Expand Down Expand Up @@ -114,10 +114,8 @@ function MoneyRequestAction({
let message: TranslationPaths;
if (isReversedTransaction) {
message = 'parentReportAction.reversedTransaction';
} else if (isTrackExpenseAction) {
message = 'parentReportAction.deletedExpense';
} else {
message = 'parentReportAction.deletedRequest';
message = 'parentReportAction.deletedExpense';
}
return <RenderHTML html={`<comment>${translate(message)}</comment>`} />;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function MoneyRequestPreviewContent({
/*
Show the merchant for IOUs and expenses only if:
- the merchant is not empty, is custom, or is not related to scanning smartscan;
- the request is not a distance request with a pending route and amount = 0 - in this case,
- the expense is not a distance expense with a pending route and amount = 0 - in this case,
the merchant says: "Route pending...", which is already shown in the amount field;
*/
const shouldShowMerchant =
Expand Down
4 changes: 2 additions & 2 deletions src/components/ReportActionItem/MoneyRequestPreview/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type MoneyRequestPreviewProps = MoneyRequestPreviewOnyxProps & {
/** Extra styles to pass to View wrapper */
containerStyles?: StyleProp<ViewStyle>;

/** True if this is this IOU is a split instead of a 1:1 request */
/** True if this IOU has a type of split */
isBillSplit: boolean;

/** Whether this IOU is a track expense */
Expand All @@ -62,7 +62,7 @@ type MoneyRequestPreviewProps = MoneyRequestPreviewOnyxProps & {
/** True if the IOU Preview card is hovered */
isHovered?: boolean;

/** Whether or not an IOU report contains money requests in a different currency
/** Whether or not an IOU report contains expenses in a different currency
* that are either created or cancelled offline, and thus haven't been converted to the report's currency yet
*/
shouldShowPendingConversionMessage?: boolean;
Expand Down
4 changes: 2 additions & 2 deletions src/components/ReportActionItem/MoneyRequestView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function MoneyRequestView({
? transaction && TransactionUtils.getDefaultTaxName(taxRates, transaction)
: transactionTaxCode && TransactionUtils.getTaxName(taxRates?.taxes, transactionTaxCode));

// Flags for allowing or disallowing editing a money request
// Flags for allowing or disallowing editing an expense
const isSettled = ReportUtils.isSettled(moneyRequestReport?.reportID);
const isCancelled = moneyRequestReport && moneyRequestReport.isCancelledIOU;

Expand Down Expand Up @@ -220,7 +220,7 @@ function MoneyRequestView({

const getErrorForField = useCallback(
(field: ViolationField, data?: OnyxTypes.TransactionViolation['data']) => {
// Checks applied when creating a new money request
// Checks applied when creating a new expense
// NOTE: receipt field can return multiple violations, so we need to handle it separately
const fieldChecks: Partial<Record<ViolationField, {isError: boolean; translationPath: TranslationPaths}>> = {
amount: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/ReportActionItem/ReportActionItemImages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type ReportActionItemImagesProps = {

/**
* This component displays a row of images in a report action item like a card, such
* as report previews or money request previews which contain receipt images. The maximum of images
* as report previews or expense previews which contain receipt images. The maximum of images
* shown in this row is dictated by the size prop, which, if not passed, is just the number of images.
* Otherwise, if size is passed and the number of images is over size, we show a small overlay on the
* last image of how many additional images there are. If passed, total prop can be used to change how this
Expand Down
12 changes: 6 additions & 6 deletions src/components/ReportActionItem/ReportPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import type {PaymentMethodType} from '@src/types/onyx/OriginalMessage';
import ReportActionItemImages from './ReportActionItemImages';

type ReportPreviewOnyxProps = {
/** The policy tied to the money request report */
/** The policy tied to the expense report */
policy: OnyxEntry<Policy>;

/** ChatReport associated with iouReport */
Expand Down Expand Up @@ -216,11 +216,11 @@ function ReportPreview({
const shouldShowRBR = !iouSettled && hasErrors;

/*
Show subtitle if at least one of the money requests is not being smart scanned, and either:
- There is more than one money request – in this case, the "X requests, Y scanning" subtitle is shown;
- There is only one money request, it has a receipt and is not being smart scanned – in this case, the request merchant or description is shown;
Show subtitle if at least one of the expenses is not being smart scanned, and either:
- There is more than one expense – in this case, the "X expenses, Y scanning" subtitle is shown;
- There is only one expense, it has a receipt and is not being smart scanned – in this case, the expense merchant or description is shown;
* There is an edge case when there is only one distance request with a pending route and amount = 0.
* There is an edge case when there is only one distance expense with a pending route and amount = 0.
In this case, we don't want to show the merchant or description because it says: "Pending route...", which is already displayed in the amount field.
*/
const shouldShowSingleRequestMerchantOrDescription =
Expand All @@ -237,7 +237,7 @@ function ReportPreview({
}
return {
isSupportTextHtml: false,
supportText: translate('iou.requestCount', {
supportText: translate('iou.expenseCount', {
count: numberOfRequests - numberOfScanningReceipts - numberOfPendingRequests,
scanningReceipts: numberOfScanningReceipts,
pendingReceipts: numberOfPendingRequests,
Expand Down
Loading

0 comments on commit b35d357

Please sign in to comment.