From 9918425c48ae370c47e2825d83fa3ae6c2bfafa4 Mon Sep 17 00:00:00 2001 From: Someshwar Tripathi Date: Wed, 3 Jul 2024 00:08:41 +0530 Subject: [PATCH 01/97] Update fallback receipt logic --- .../SelectionList/Search/TransactionListItemRow.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/SelectionList/Search/TransactionListItemRow.tsx b/src/components/SelectionList/Search/TransactionListItemRow.tsx index 0adc7ee21fd1..1772f76ed88a 100644 --- a/src/components/SelectionList/Search/TransactionListItemRow.tsx +++ b/src/components/SelectionList/Search/TransactionListItemRow.tsx @@ -12,6 +12,7 @@ import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import * as CurrencyUtils from '@libs/CurrencyUtils'; +import * as ReportUtils from '@libs/ReportUtils'; import DateUtils from '@libs/DateUtils'; import * as TransactionUtils from '@libs/TransactionUtils'; import tryResolveUrlFromApiRoot from '@libs/tryResolveUrlFromApiRoot'; @@ -66,6 +67,8 @@ function ReceiptCell({transactionItem}: TransactionCellProps) { const styles = useThemeStyles(); const StyleUtils = useStyleUtils(); + const canModifyReceipt = !ReportUtils.isReportApproved(transactionItem.reportID) && !ReportUtils.isSettled(transactionItem.reportID); + return ( Date: Mon, 15 Jul 2024 08:20:06 +0530 Subject: [PATCH 02/97] Prettier fix --- .../SelectionList/Search/TransactionListItemRow.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/SelectionList/Search/TransactionListItemRow.tsx b/src/components/SelectionList/Search/TransactionListItemRow.tsx index 00e555198554..0e4e1393610b 100644 --- a/src/components/SelectionList/Search/TransactionListItemRow.tsx +++ b/src/components/SelectionList/Search/TransactionListItemRow.tsx @@ -14,8 +14,8 @@ import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import * as CurrencyUtils from '@libs/CurrencyUtils'; -import * as ReportUtils from '@libs/ReportUtils'; import DateUtils from '@libs/DateUtils'; +import * as ReportUtils from '@libs/ReportUtils'; import StringUtils from '@libs/StringUtils'; import * as TransactionUtils from '@libs/TransactionUtils'; import tryResolveUrlFromApiRoot from '@libs/tryResolveUrlFromApiRoot'; @@ -78,7 +78,7 @@ function ReceiptCell({transactionItem}: TransactionCellProps) { const backgroundStyles = transactionItem.isSelected ? StyleUtils.getBackgroundColorStyle(theme.buttonHoveredBG) : StyleUtils.getBackgroundColorStyle(theme.border); const canModifyReceipt = !ReportUtils.isReportApproved(transactionItem.reportID) && !ReportUtils.isSettled(transactionItem.reportID); - + return ( Date: Tue, 16 Jul 2024 01:02:55 +0530 Subject: [PATCH 03/97] Update isClosedReport to accept reportID as param --- src/libs/ReportUtils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index f7dca71fd15f..f2be823a1fab 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -1286,7 +1286,8 @@ function isArchivedRoomWithID(reportID?: string) { /** * Whether the provided report is a closed report */ -function isClosedReport(report: OnyxEntry): boolean { +function isClosedReport(reportOrID: OnyxInputOrEntry | string): boolean { + const report = typeof reportOrID === 'string' ? ReportConnection.getAllReports()?.[`${ONYXKEYS.COLLECTION.REPORT}${reportOrID}`] ?? null : reportOrID; return report?.statusNum === CONST.REPORT.STATUS_NUM.CLOSED; } From 5abb0e3d0095db22a42eada369f909d7aaca6c97 Mon Sep 17 00:00:00 2001 From: Someshwar Tripathi Date: Tue, 16 Jul 2024 01:04:06 +0530 Subject: [PATCH 04/97] Update canModifyReceipt --- src/components/SelectionList/Search/TransactionListItemRow.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/SelectionList/Search/TransactionListItemRow.tsx b/src/components/SelectionList/Search/TransactionListItemRow.tsx index 0e4e1393610b..2c245b761173 100644 --- a/src/components/SelectionList/Search/TransactionListItemRow.tsx +++ b/src/components/SelectionList/Search/TransactionListItemRow.tsx @@ -77,7 +77,7 @@ function ReceiptCell({transactionItem}: TransactionCellProps) { const StyleUtils = useStyleUtils(); const backgroundStyles = transactionItem.isSelected ? StyleUtils.getBackgroundColorStyle(theme.buttonHoveredBG) : StyleUtils.getBackgroundColorStyle(theme.border); - const canModifyReceipt = !ReportUtils.isReportApproved(transactionItem.reportID) && !ReportUtils.isSettled(transactionItem.reportID); + const canModifyReceipt = !ReportUtils.isReportApproved(transactionItem.reportID) && !ReportUtils.isSettled(transactionItem.reportID) && !ReportUtils.isClosedReport(transactionItem.reportID); return ( Date: Thu, 25 Jul 2024 11:57:16 +0800 Subject: [PATCH 05/97] clears routes when successfully created/updated transaction --- src/libs/actions/IOU.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 30f0ccfae328..925877bbdf01 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -710,6 +710,7 @@ function buildOnyxDataForMoneyRequest( value: { pendingAction: null, pendingFields: clearedPendingFields, + routes: null, }, }, @@ -1459,6 +1460,7 @@ function buildOnyxDataForTrackExpense( value: { pendingAction: null, pendingFields: clearedPendingFields, + routes: null, }, }, ); @@ -2753,6 +2755,7 @@ function getUpdateMoneyRequestParams( pendingFields: clearedPendingFields, isLoading: false, errorFields: null, + routes: null, }, }); @@ -2964,6 +2967,7 @@ function getUpdateTrackExpenseParams( pendingFields: clearedPendingFields, isLoading: false, errorFields: null, + routes: null, }, }); From 9591dbb32089fcfe301e75361b28359a9c773324 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Thu, 25 Jul 2024 12:57:51 +0800 Subject: [PATCH 06/97] remove pending --- src/components/ReportActionItem/MoneyRequestView.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx index 6d9b8f75fcc9..bd3a838b895a 100644 --- a/src/components/ReportActionItem/MoneyRequestView.tsx +++ b/src/components/ReportActionItem/MoneyRequestView.tsx @@ -324,7 +324,7 @@ function MoneyRequestView({ Date: Thu, 25 Jul 2024 12:58:11 +0800 Subject: [PATCH 07/97] get distance in meters --- src/components/MoneyRequestConfirmationList.tsx | 12 +++--------- .../ReportActionItem/MoneyRequestView.tsx | 2 +- src/libs/TransactionUtils.ts | 14 +++++++++++--- src/libs/actions/IOU.ts | 2 +- .../request/step/IOURequestStepDistanceRate.tsx | 2 +- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/components/MoneyRequestConfirmationList.tsx b/src/components/MoneyRequestConfirmationList.tsx index 7d1ac66408ba..6b0a6c5cc0c5 100755 --- a/src/components/MoneyRequestConfirmationList.tsx +++ b/src/components/MoneyRequestConfirmationList.tsx @@ -256,13 +256,7 @@ function MoneyRequestConfirmationList({ const isMovingTransactionFromTrackExpense = IOUUtils.isMovingTransactionFromTrackExpense(action); - const distance = useMemo(() => { - const value = TransactionUtils.getDistance(transaction); - if (canUseP2PDistanceRequests && isMovingTransactionFromTrackExpense && unit && !TransactionUtils.isFetchingWaypointsFromServer(transaction)) { - return DistanceRequestUtils.convertToDistanceInMeters(value, unit); - } - return value; - }, [isMovingTransactionFromTrackExpense, unit, transaction, canUseP2PDistanceRequests]); + const distance = TransactionUtils.getDistanceInMeters(transaction, unit); const prevDistance = usePrevious(distance); const shouldCalculateDistanceAmount = isDistanceRequest && (iouAmount === 0 || prevRate !== rate || prevDistance !== distance); @@ -359,7 +353,7 @@ function MoneyRequestConfirmationList({ if (isDistanceRequest) { const customUnitRate = getCustomUnitRate(policy, customUnitRateID); taxCode = customUnitRate?.attributes?.taxRateExternalID ?? ''; - taxableAmount = DistanceRequestUtils.getTaxableAmount(policy, customUnitRateID, TransactionUtils.getDistance(transaction)); + taxableAmount = DistanceRequestUtils.getTaxableAmount(policy, customUnitRateID, distance); } else { taxableAmount = transaction?.amount ?? 0; taxCode = transaction?.taxCode ?? TransactionUtils.getDefaultTaxCode(policy, transaction) ?? ''; @@ -368,7 +362,7 @@ function MoneyRequestConfirmationList({ const taxAmount = TransactionUtils.calculateTaxAmount(taxPercentage, taxableAmount, currency); const taxAmountInSmallestCurrencyUnits = CurrencyUtils.convertToBackendAmount(Number.parseFloat(taxAmount.toString())); IOU.setMoneyRequestTaxAmount(transaction?.transactionID ?? '', taxAmountInSmallestCurrencyUnits); - }, [policy, shouldShowTax, previousTransactionAmount, previousTransactionCurrency, transaction, isDistanceRequest, customUnitRateID, currency]); + }, [policy, shouldShowTax, previousTransactionAmount, previousTransactionCurrency, transaction, isDistanceRequest, customUnitRateID, currency, distance]); // If completing a split expense fails, set didConfirm to false to allow the user to edit the fields again if (isEditingSplitBill && didConfirm) { diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx index bd3a838b895a..41eae377dee6 100644 --- a/src/components/ReportActionItem/MoneyRequestView.tsx +++ b/src/components/ReportActionItem/MoneyRequestView.tsx @@ -222,7 +222,7 @@ function MoneyRequestView({ const {unit} = mileageRate; const rate = transaction?.comment?.customUnit?.defaultP2PRate ?? mileageRate.rate; - const distance = DistanceRequestUtils.convertToDistanceInMeters(TransactionUtils.getDistance(transaction), unit); + const distance = TransactionUtils.getDistanceInMeters(transaction, unit); const rateToDisplay = DistanceRequestUtils.getRateForDisplay(unit, rate, currency, translate, toLocaleDigit, isOffline); const distanceToDisplay = DistanceRequestUtils.getDistanceForDisplay(hasRoute, distance, unit, rate, translate); let merchantTitle = isEmptyMerchant ? '' : transactionMerchant; diff --git a/src/libs/TransactionUtils.ts b/src/libs/TransactionUtils.ts index c044702b2fc0..8102692a030e 100644 --- a/src/libs/TransactionUtils.ts +++ b/src/libs/TransactionUtils.ts @@ -6,6 +6,7 @@ import type {ValueOf} from 'type-fest'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type {Beta, OnyxInputOrEntry, Policy, RecentWaypoint, ReviewDuplicates, TaxRate, TaxRates, Transaction, TransactionViolation, TransactionViolations} from '@src/types/onyx'; +import {Unit} from '@src/types/onyx/Policy'; import type {Comment, Receipt, TransactionChanges, TransactionPendingFieldsKey, Waypoint, WaypointCollection} from '@src/types/onyx/Transaction'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import type {IOURequestType} from './actions/IOU'; @@ -13,6 +14,7 @@ import type {TransactionMergeParams} from './API/parameters'; import {isCorporateCard, isExpensifyCard} from './CardUtils'; import {getCurrencyDecimals} from './CurrencyUtils'; import DateUtils from './DateUtils'; +import DistanceRequestUtils from './DistanceRequestUtils'; import * as Localize from './Localize'; import * as NumberUtils from './NumberUtils'; import Permissions from './Permissions'; @@ -383,8 +385,14 @@ function getMerchant(transaction: OnyxInputOrEntry): string { return transaction?.modifiedMerchant ? transaction.modifiedMerchant : transaction?.merchant ?? ''; } -function getDistance(transaction: OnyxInputOrEntry): number { - return transaction?.comment?.customUnit?.quantity ?? 0; +function getDistanceInMeters(transaction: OnyxInputOrEntry, unit: Unit | undefined) { + if (transaction?.routes?.route0?.distance) { + return transaction.routes.route0.distance; + } + if (transaction?.comment?.customUnit?.quantity && unit) { + return DistanceRequestUtils.convertToDistanceInMeters(transaction.comment.customUnit.quantity, unit); + } + return 0; } /** @@ -998,7 +1006,7 @@ export { getTaxAmount, getTaxCode, getCurrency, - getDistance, + getDistanceInMeters, getCardID, getOriginalCurrency, getOriginalAmount, diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 925877bbdf01..ee50f33c71af 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -2492,7 +2492,7 @@ function calculateAmountForUpdatedWaypoint( ? DistanceRequestUtils.getRateForP2P(policyCurrency) : mileageRates?.[customUnitRateID] ?? DistanceRequestUtils.getDefaultMileageRate(policy); const {unit, rate} = mileageRate; - const distance = TransactionUtils.getDistance(transaction); + const distance = TransactionUtils.getDistanceInMeters(transaction, unit); const amount = DistanceRequestUtils.getDistanceRequestAmount(distance, unit, rate ?? 0); updatedAmount = ReportUtils.isExpenseReport(iouReport) ? -amount : amount; updatedMerchant = DistanceRequestUtils.getDistanceMerchant(true, distance, unit, rate, transaction?.currency ?? CONST.CURRENCY.USD, Localize.translateLocal, (digit) => diff --git a/src/pages/iou/request/step/IOURequestStepDistanceRate.tsx b/src/pages/iou/request/step/IOURequestStepDistanceRate.tsx index 4f70d3e4fee9..a55d491ea834 100644 --- a/src/pages/iou/request/step/IOURequestStepDistanceRate.tsx +++ b/src/pages/iou/request/step/IOURequestStepDistanceRate.tsx @@ -79,7 +79,7 @@ function IOURequestStepDistanceRate({ if (shouldShowTax) { const policyCustomUnitRate = getCustomUnitRate(policy, customUnitRateID); const taxRateExternalID = policyCustomUnitRate?.attributes?.taxRateExternalID ?? '-1'; - const taxableAmount = DistanceRequestUtils.getTaxableAmount(policy, customUnitRateID, TransactionUtils.getDistance(transaction)); + const taxableAmount = DistanceRequestUtils.getTaxableAmount(policy, customUnitRateID, TransactionUtils.getDistanceInMeters(transaction, unit)); const taxPercentage = TransactionUtils.getTaxValue(policy, transaction, taxRateExternalID) ?? ''; const taxAmount = CurrencyUtils.convertToBackendAmount(TransactionUtils.calculateTaxAmount(taxPercentage, taxableAmount, rates[customUnitRateID].currency ?? CONST.CURRENCY.USD)); IOU.setMoneyRequestTaxAmount(transactionID, taxAmount); From 94eda7b1c0bebb0d6f6a79dbf4c1e08997329327 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Thu, 25 Jul 2024 15:41:13 +0800 Subject: [PATCH 08/97] restructure the file to avoid cyclic deps --- .../TransactionUtils/getDistanceInMeters.ts | 15 ++++++++ .../index.ts} | 37 +++++++------------ 2 files changed, 28 insertions(+), 24 deletions(-) create mode 100644 src/libs/TransactionUtils/getDistanceInMeters.ts rename src/libs/{TransactionUtils.ts => TransactionUtils/index.ts} (97%) diff --git a/src/libs/TransactionUtils/getDistanceInMeters.ts b/src/libs/TransactionUtils/getDistanceInMeters.ts new file mode 100644 index 000000000000..1e39078905e6 --- /dev/null +++ b/src/libs/TransactionUtils/getDistanceInMeters.ts @@ -0,0 +1,15 @@ +import DistanceRequestUtils from '@libs/DistanceRequestUtils'; +import type {OnyxInputOrEntry, Transaction} from '@src/types/onyx'; +import type {Unit} from '@src/types/onyx/Policy'; + +function getDistanceInMeters(transaction: OnyxInputOrEntry, unit: Unit | undefined) { + if (transaction?.routes?.route0?.distance) { + return transaction.routes.route0.distance; + } + if (transaction?.comment?.customUnit?.quantity && unit) { + return DistanceRequestUtils.convertToDistanceInMeters(transaction.comment.customUnit.quantity, unit); + } + return 0; +} + +export default getDistanceInMeters; diff --git a/src/libs/TransactionUtils.ts b/src/libs/TransactionUtils/index.ts similarity index 97% rename from src/libs/TransactionUtils.ts rename to src/libs/TransactionUtils/index.ts index 8102692a030e..a57ff7f940d2 100644 --- a/src/libs/TransactionUtils.ts +++ b/src/libs/TransactionUtils/index.ts @@ -3,25 +3,24 @@ import lodashIsEqual from 'lodash/isEqual'; import type {OnyxCollection, OnyxEntry} from 'react-native-onyx'; import Onyx from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; +import type {TransactionMergeParams} from '@libs/API/parameters'; +import {isCorporateCard, isExpensifyCard} from '@libs/CardUtils'; +import {getCurrencyDecimals} from '@libs/CurrencyUtils'; +import DateUtils from '@libs/DateUtils'; +import * as Localize from '@libs/Localize'; +import * as NumberUtils from '@libs/NumberUtils'; +import Permissions from '@libs/Permissions'; +import {getCleanedTagName, getCustomUnitRate} from '@libs/PolicyUtils'; +// eslint-disable-next-line import/no-cycle +import * as ReportActionsUtils from '@libs/ReportActionsUtils'; +import * as ReportConnection from '@libs/ReportConnection'; +import type {IOURequestType} from '@userActions/IOU'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type {Beta, OnyxInputOrEntry, Policy, RecentWaypoint, ReviewDuplicates, TaxRate, TaxRates, Transaction, TransactionViolation, TransactionViolations} from '@src/types/onyx'; -import {Unit} from '@src/types/onyx/Policy'; import type {Comment, Receipt, TransactionChanges, TransactionPendingFieldsKey, Waypoint, WaypointCollection} from '@src/types/onyx/Transaction'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; -import type {IOURequestType} from './actions/IOU'; -import type {TransactionMergeParams} from './API/parameters'; -import {isCorporateCard, isExpensifyCard} from './CardUtils'; -import {getCurrencyDecimals} from './CurrencyUtils'; -import DateUtils from './DateUtils'; -import DistanceRequestUtils from './DistanceRequestUtils'; -import * as Localize from './Localize'; -import * as NumberUtils from './NumberUtils'; -import Permissions from './Permissions'; -import {getCleanedTagName, getCustomUnitRate} from './PolicyUtils'; -// eslint-disable-next-line import/no-cycle -import * as ReportActionsUtils from './ReportActionsUtils'; -import * as ReportConnection from './ReportConnection'; +import getDistanceInMeters from './getDistanceInMeters'; let allTransactions: OnyxCollection = {}; Onyx.connect({ @@ -385,16 +384,6 @@ function getMerchant(transaction: OnyxInputOrEntry): string { return transaction?.modifiedMerchant ? transaction.modifiedMerchant : transaction?.merchant ?? ''; } -function getDistanceInMeters(transaction: OnyxInputOrEntry, unit: Unit | undefined) { - if (transaction?.routes?.route0?.distance) { - return transaction.routes.route0.distance; - } - if (transaction?.comment?.customUnit?.quantity && unit) { - return DistanceRequestUtils.convertToDistanceInMeters(transaction.comment.customUnit.quantity, unit); - } - return 0; -} - /** * Return the reimbursable value. Defaults to true to match BE logic. */ From 87c12ef1861b87aa04890e935744d47736659f06 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Fri, 26 Jul 2024 04:48:30 +0300 Subject: [PATCH 09/97] rm padding for nested lists --- docs/_sass/_main.scss | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/_sass/_main.scss b/docs/_sass/_main.scss index f3bf1035ed56..485c54dbfc4c 100644 --- a/docs/_sass/_main.scss +++ b/docs/_sass/_main.scss @@ -374,6 +374,14 @@ button { } } + ol { + li { + ul { + padding-bottom: 0; + } + } + } + table { margin-bottom: 20px; border-radius: 8px; From 306d7657145b0cef01d5665ebc01c88bb52a5d8b Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Fri, 26 Jul 2024 04:54:54 +0300 Subject: [PATCH 10/97] use h3 heading --- .../Add-Expensify-Card-to-Apple-or-Google-Pay.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/articles/new-expensify/expensify-card/Add-Expensify-Card-to-Apple-or-Google-Pay.md b/docs/articles/new-expensify/expensify-card/Add-Expensify-Card-to-Apple-or-Google-Pay.md index 844a688e0011..6c41d6413f7c 100644 --- a/docs/articles/new-expensify/expensify-card/Add-Expensify-Card-to-Apple-or-Google-Pay.md +++ b/docs/articles/new-expensify/expensify-card/Add-Expensify-Card-to-Apple-or-Google-Pay.md @@ -9,16 +9,14 @@ You can use your Expensify Card for contactless in-person payments by adding it {% include selector.html values="mobile" %} {% include option.html value="mobile" %} -**Apple Pay** - +### Apple Pay 1. Open the Apple Pay app. 2. Tap the + button. 3. Tap **Debit or Credit Card**. 4. Tap **Continue**. 5. Follow the steps provided to add your virtual card. -**Google Pay** - +### Google Pay 1. Open the Google Pay app. 2. Tap **Add to Wallet**. 3. Tap **Payment Card**. From d11b1e931acb8908fbff8ef292ab44d41b451a03 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Sat, 27 Jul 2024 01:04:53 +0300 Subject: [PATCH 11/97] navigate to company address if not present --- src/pages/Travel/ManageTrips.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pages/Travel/ManageTrips.tsx b/src/pages/Travel/ManageTrips.tsx index 8545cf38566c..793a6132d485 100644 --- a/src/pages/Travel/ManageTrips.tsx +++ b/src/pages/Travel/ManageTrips.tsx @@ -9,11 +9,13 @@ import useLocalize from '@hooks/useLocalize'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import {getPolicy} from '@libs/PolicyUtils'; import colors from '@styles/theme/colors'; import * as Link from '@userActions/Link'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; +import {isEmptyObject} from '@src/types/utils/EmptyObject'; const tripsFeatures: FeatureListItem[] = [ { @@ -34,6 +36,7 @@ function ManageTrips() { const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID); const hasAcceptedTravelTerms = travelSettings?.hasAcceptedTerms; + const hasPolicyAddress = !isEmptyObject(getPolicy(activePolicyID)?.address); const navigateToBookTravelDemo = () => { Linking.openURL(CONST.BOOK_TRAVEL_DEMO_URL); @@ -49,6 +52,10 @@ function ManageTrips() { ctaText={translate('travel.bookTravel')} ctaAccessibilityLabel={translate('travel.bookTravel')} onCtaPress={() => { + if (!hasPolicyAddress) { + Navigation.navigate(ROUTES.WORKSPACE_PROFILE_ADDRESS.getRoute(activePolicyID ?? '-1')); + return; + } if (!hasAcceptedTravelTerms) { Navigation.navigate(ROUTES.TRAVEL_TCS); return; From 658144216485da8715c8f0c3d536c86465293222 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Sat, 27 Jul 2024 01:08:03 +0300 Subject: [PATCH 12/97] Revert "use h3 heading" This reverts commit 306d7657145b0cef01d5665ebc01c88bb52a5d8b. --- .../Add-Expensify-Card-to-Apple-or-Google-Pay.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/articles/new-expensify/expensify-card/Add-Expensify-Card-to-Apple-or-Google-Pay.md b/docs/articles/new-expensify/expensify-card/Add-Expensify-Card-to-Apple-or-Google-Pay.md index 6c41d6413f7c..844a688e0011 100644 --- a/docs/articles/new-expensify/expensify-card/Add-Expensify-Card-to-Apple-or-Google-Pay.md +++ b/docs/articles/new-expensify/expensify-card/Add-Expensify-Card-to-Apple-or-Google-Pay.md @@ -9,14 +9,16 @@ You can use your Expensify Card for contactless in-person payments by adding it {% include selector.html values="mobile" %} {% include option.html value="mobile" %} -### Apple Pay +**Apple Pay** + 1. Open the Apple Pay app. 2. Tap the + button. 3. Tap **Debit or Credit Card**. 4. Tap **Continue**. 5. Follow the steps provided to add your virtual card. -### Google Pay +**Google Pay** + 1. Open the Google Pay app. 2. Tap **Add to Wallet**. 3. Tap **Payment Card**. From e4ffa8a6614c5dfc56eff3a09c1f8bd6add388f0 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Sat, 27 Jul 2024 01:08:16 +0300 Subject: [PATCH 13/97] Revert "rm padding for nested lists" This reverts commit 87c12ef1861b87aa04890e935744d47736659f06. --- docs/_sass/_main.scss | 8 -------- 1 file changed, 8 deletions(-) diff --git a/docs/_sass/_main.scss b/docs/_sass/_main.scss index 2b8627921958..82446fe08b3a 100644 --- a/docs/_sass/_main.scss +++ b/docs/_sass/_main.scss @@ -374,14 +374,6 @@ button { } } - ol { - li { - ul { - padding-bottom: 0; - } - } - } - table { margin-bottom: 20px; border-radius: 8px; From 548c4fa1c8f5130c38dda0217eafdce86c7e85db Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Sat, 27 Jul 2024 01:08:27 +0300 Subject: [PATCH 14/97] undo unrelated commits --- src/libs/Permissions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Permissions.ts b/src/libs/Permissions.ts index ee1ce27103de..862337a42f14 100644 --- a/src/libs/Permissions.ts +++ b/src/libs/Permissions.ts @@ -4,7 +4,7 @@ import type {IOUType} from '@src/CONST'; import type Beta from '@src/types/onyx/Beta'; function canUseAllBetas(betas: OnyxEntry): boolean { - return !!betas?.includes(CONST.BETAS.ALL); + return true; } function canUseChronos(betas: OnyxEntry): boolean { From 0e6502a04d8c296f0632986484c78da2f302065b Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Sat, 27 Jul 2024 01:08:45 +0300 Subject: [PATCH 15/97] undo unrelated commits --- src/libs/Permissions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Permissions.ts b/src/libs/Permissions.ts index 862337a42f14..ee1ce27103de 100644 --- a/src/libs/Permissions.ts +++ b/src/libs/Permissions.ts @@ -4,7 +4,7 @@ import type {IOUType} from '@src/CONST'; import type Beta from '@src/types/onyx/Beta'; function canUseAllBetas(betas: OnyxEntry): boolean { - return true; + return !!betas?.includes(CONST.BETAS.ALL); } function canUseChronos(betas: OnyxEntry): boolean { From d3e3498db5a055c97d4eeb0b6d319e46f40a7400 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Sat, 27 Jul 2024 01:56:31 +0300 Subject: [PATCH 16/97] get policy from onyx and show loading indicator --- src/pages/Travel/ManageTrips.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/pages/Travel/ManageTrips.tsx b/src/pages/Travel/ManageTrips.tsx index 793a6132d485..04231ea50c28 100644 --- a/src/pages/Travel/ManageTrips.tsx +++ b/src/pages/Travel/ManageTrips.tsx @@ -3,13 +3,13 @@ import {Linking, View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; import type {FeatureListItem} from '@components/FeatureList'; import FeatureList from '@components/FeatureList'; +import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import * as Illustrations from '@components/Icon/Illustrations'; import ScrollView from '@components/ScrollView'; import useLocalize from '@hooks/useLocalize'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; -import {getPolicy} from '@libs/PolicyUtils'; import colors from '@styles/theme/colors'; import * as Link from '@userActions/Link'; import CONST from '@src/CONST'; @@ -34,9 +34,14 @@ function ManageTrips() { const {translate} = useLocalize(); const [travelSettings] = useOnyx(ONYXKEYS.NVP_TRAVEL_SETTINGS); const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID); + const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activePolicyID}`); + + if (isEmptyObject(policy)) { + return ; + } const hasAcceptedTravelTerms = travelSettings?.hasAcceptedTerms; - const hasPolicyAddress = !isEmptyObject(getPolicy(activePolicyID)?.address); + const hasPolicyAddress = !isEmptyObject(policy?.address); const navigateToBookTravelDemo = () => { Linking.openURL(CONST.BOOK_TRAVEL_DEMO_URL); From 186354a376c88c157fceba64e69cf8b31d29ab39 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Sat, 27 Jul 2024 14:02:22 +0300 Subject: [PATCH 17/97] show error message for cta --- src/components/FeatureList.tsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/components/FeatureList.tsx b/src/components/FeatureList.tsx index 37b798dcd66c..4db9267a2aa5 100644 --- a/src/components/FeatureList.tsx +++ b/src/components/FeatureList.tsx @@ -7,6 +7,7 @@ import variables from '@styles/variables'; import type {TranslationPaths} from '@src/languages/types'; import type IconAsset from '@src/types/utils/IconAsset'; import Button from './Button'; +import DotIndicatorMessage from './DotIndicatorMessage'; import type DotLottieAnimation from './LottieAnimations/types'; import MenuItem from './MenuItem'; import Section from './Section'; @@ -56,6 +57,9 @@ type FeatureListProps = { /** The style used for the title */ titleStyles?: StyleProp; + /** The error message to display for the CTA button */ + ctaErrorMessage?: string; + /** Padding for content on large screens */ contentPaddingOnLargeScreens?: {padding: number}; }; @@ -65,10 +69,11 @@ function FeatureList({ subtitle = '', ctaText = '', ctaAccessibilityLabel = '', - onCtaPress, + onCtaPress = () => {}, secondaryButtonText = '', secondaryButtonAccessibilityLabel = '', - onSecondaryButtonPress, + onSecondaryButtonPress = () => {}, + ctaErrorMessage, menuItems, illustration, illustrationStyle, @@ -120,6 +125,12 @@ function FeatureList({ large /> )} + {ctaErrorMessage && ( + + )}