From b2a5dac17597fac3ca69f79d0853f36bfdb7fc56 Mon Sep 17 00:00:00 2001 From: Agata Kosior Date: Fri, 20 Sep 2024 19:38:28 +0700 Subject: [PATCH 01/33] feat: add translations --- src/languages/en.ts | 2 ++ src/languages/es.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/languages/en.ts b/src/languages/en.ts index bd5ff405529e..cd0c542b2fd3 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -2882,6 +2882,8 @@ export default { expensifyCard: { issueAndManageCards: 'Issue and manage your Expensify Cards', getStartedIssuing: 'Get started by issuing your first virtual or physical card.', + verificationInProgress: 'Verification in progress...', + verifyingTheDetails: "We're verifying a few details. Concierge will let you know when Expensify Cards are ready to issue.", disclaimer: 'The Expensify Visa® Commercial Card is issued by The Bancorp Bank, N.A., Member FDIC, pursuant to a license from Visa U.S.A. Inc. and may not be used at all merchants that accept Visa cards. Apple® and the Apple logo® are trademarks of Apple Inc., registered in the U.S. and other countries. App Store is a service mark of Apple Inc. Google Play and the Google Play logo are trademarks of Google LLC.', issueCard: 'Issue card', diff --git a/src/languages/es.ts b/src/languages/es.ts index 2f11de46faed..7a5f613f3df3 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -2927,6 +2927,8 @@ export default { expensifyCard: { issueAndManageCards: 'Emitir y gestionar Tarjetas Expensify', getStartedIssuing: 'Empieza emitiendo tu primera tarjeta virtual o física.', + verificationInProgress: 'Verificación en curso...', + verifyingTheDetails: "We're verifying a few details. Concierge will let you know when Expensify Cards are ready to issue.", disclaimer: 'La tarjeta comercial Expensify Visa® es emitida por The Bancorp Bank, N.A., miembro de la FDIC, en virtud de una licencia de Visa U.S.A. Inc. y no puede utilizarse en todos los comercios que aceptan tarjetas Visa. Apple® y el logotipo de Apple® son marcas comerciales de Apple Inc. registradas en EE.UU. y otros países. App Store es una marca de servicio de Apple Inc. Google Play y el logotipo de Google Play son marcas comerciales de Google LLC.', issueCard: 'Emitir tarjeta', From 5e6a468e538e25632efb12dba0ed58319583c998 Mon Sep 17 00:00:00 2001 From: Agata Kosior Date: Fri, 20 Sep 2024 20:12:43 +0700 Subject: [PATCH 02/33] feat: change modal text and hide the buttons for unverified bank account --- .../workspace/expensifyCard/EmptyCardView.tsx | 14 +++++++++++--- .../WorkspaceExpensifyCardListPage.tsx | 17 ++++++++++++++--- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/pages/workspace/expensifyCard/EmptyCardView.tsx b/src/pages/workspace/expensifyCard/EmptyCardView.tsx index d3eb3a15fae8..b2915823ab8d 100644 --- a/src/pages/workspace/expensifyCard/EmptyCardView.tsx +++ b/src/pages/workspace/expensifyCard/EmptyCardView.tsx @@ -13,7 +13,15 @@ import useWindowDimensions from '@hooks/useWindowDimensions'; import colors from '@styles/theme/colors'; import CONST from '@src/CONST'; -function EmptyCardView() { +type EmptyCardViewProps = { + /** Title of the empty state */ + title: string; + + /** Subtitle of the empty state */ + subtitle: string; +}; + +function EmptyCardView({title, subtitle}: EmptyCardViewProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); const {windowHeight} = useWindowDimensions(); @@ -35,8 +43,8 @@ function EmptyCardView() { }, shouldUseNarrowLayout && {maxHeight: 250}, ]} - title={translate('workspace.expensifyCard.issueAndManageCards')} - subtitle={translate('workspace.expensifyCard.getStartedIssuing')} + title={title} + subtitle={subtitle} minModalHeight={500} /> diff --git a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx index 25de151bbb6d..044fbeddf506 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx @@ -16,6 +16,7 @@ import usePolicy from '@hooks/usePolicy'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; import * as CardUtils from '@libs/CardUtils'; +import * as PolicyUtils from '@libs/PolicyUtils'; import Navigation from '@navigation/Navigation'; import type {FullScreenNavigatorParamList} from '@navigation/types'; import CONST from '@src/CONST'; @@ -43,7 +44,14 @@ function WorkspaceExpensifyCardListPage({route, cardsList}: WorkspaceExpensifyCa const policyID = route.params.policyID; const policy = usePolicy(policyID); + const workspaceAccountID = PolicyUtils.getWorkspaceAccountID(policyID); const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST); + const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`); + + const paymentBankAccountID = cardSettings?.paymentBankAccountID ?? 0; + const [bankAccountsList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST); + + const isBankAccountVerified = bankAccountsList?.[paymentBankAccountID]?.accountData?.approvedBy !== 'Automatic'; const policyCurrency = useMemo(() => policy?.outputCurrency ?? CONST.CURRENCY.USD, [policy]); @@ -115,11 +123,14 @@ function WorkspaceExpensifyCardListPage({route, cardsList}: WorkspaceExpensifyCa shouldShowBackButton={shouldUseNarrowLayout} onBackButtonPress={() => Navigation.goBack()} > - {!shouldUseNarrowLayout && getHeaderButtons()} + {!shouldUseNarrowLayout && isBankAccountVerified && getHeaderButtons()} - {shouldUseNarrowLayout && {getHeaderButtons()}} + {shouldUseNarrowLayout && isBankAccountVerified && {getHeaderButtons()}} {isEmptyObject(cardsList) ? ( - + ) : ( Date: Fri, 20 Sep 2024 20:37:58 +0700 Subject: [PATCH 03/33] fix: fix header height for mobile --- src/hooks/useEmptyViewHeaderHeight/index.ios.ts | 5 +++-- src/hooks/useEmptyViewHeaderHeight/index.ts | 6 ++++-- src/pages/workspace/expensifyCard/EmptyCardView.tsx | 7 +++++-- .../expensifyCard/WorkspaceExpensifyCardListPage.tsx | 4 +++- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/hooks/useEmptyViewHeaderHeight/index.ios.ts b/src/hooks/useEmptyViewHeaderHeight/index.ios.ts index d59e105574bf..d74e713f4b07 100644 --- a/src/hooks/useEmptyViewHeaderHeight/index.ios.ts +++ b/src/hooks/useEmptyViewHeaderHeight/index.ios.ts @@ -1,10 +1,11 @@ import useSafeAreaInsets from '@hooks/useSafeAreaInsets'; import {BUTTON_HEIGHT, BUTTON_MARGIN, HEADER_HEIGHT} from './const'; -function useEmptyViewHeaderHeight(isSmallScreenWidth: boolean): number { +function useEmptyViewHeaderHeight(isSmallScreenWidth: boolean, areHeaderButtonsDisplayed: boolean): number { const safeAreaInsets = useSafeAreaInsets(); + const BUTTONS_HEIGHT = areHeaderButtonsDisplayed ? BUTTON_HEIGHT + BUTTON_MARGIN : 0; - return isSmallScreenWidth ? HEADER_HEIGHT + BUTTON_HEIGHT + BUTTON_MARGIN + safeAreaInsets.top : HEADER_HEIGHT; + return isSmallScreenWidth ? HEADER_HEIGHT + BUTTONS_HEIGHT + safeAreaInsets.top : HEADER_HEIGHT; } export default useEmptyViewHeaderHeight; diff --git a/src/hooks/useEmptyViewHeaderHeight/index.ts b/src/hooks/useEmptyViewHeaderHeight/index.ts index d241d95b236f..3f0c34d340fa 100644 --- a/src/hooks/useEmptyViewHeaderHeight/index.ts +++ b/src/hooks/useEmptyViewHeaderHeight/index.ts @@ -1,7 +1,9 @@ import {BUTTON_HEIGHT, BUTTON_MARGIN, HEADER_HEIGHT} from './const'; -function useEmptyViewHeaderHeight(isSmallScreenWidth: boolean): number { - return isSmallScreenWidth ? HEADER_HEIGHT + BUTTON_HEIGHT + BUTTON_MARGIN : HEADER_HEIGHT; +function useEmptyViewHeaderHeight(isSmallScreenWidth: boolean, areHeaderButtonsDisplayed: boolean): number { + const BUTTONS_HEIGHT = areHeaderButtonsDisplayed ? BUTTON_HEIGHT + BUTTON_MARGIN : 0; + + return isSmallScreenWidth ? HEADER_HEIGHT + BUTTONS_HEIGHT : HEADER_HEIGHT; } export default useEmptyViewHeaderHeight; diff --git a/src/pages/workspace/expensifyCard/EmptyCardView.tsx b/src/pages/workspace/expensifyCard/EmptyCardView.tsx index b2915823ab8d..24162e7c2b48 100644 --- a/src/pages/workspace/expensifyCard/EmptyCardView.tsx +++ b/src/pages/workspace/expensifyCard/EmptyCardView.tsx @@ -19,15 +19,18 @@ type EmptyCardViewProps = { /** Subtitle of the empty state */ subtitle: string; + + /** Whether the header buttons be displayed */ + areHeaderButtonsDisplayed: boolean; }; -function EmptyCardView({title, subtitle}: EmptyCardViewProps) { +function EmptyCardView({title, subtitle, areHeaderButtonsDisplayed}: EmptyCardViewProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); const {windowHeight} = useWindowDimensions(); const {shouldUseNarrowLayout} = useResponsiveLayout(); - const headerHeight = useEmptyViewHeaderHeight(shouldUseNarrowLayout); + const headerHeight = useEmptyViewHeaderHeight(shouldUseNarrowLayout, areHeaderButtonsDisplayed); return ( diff --git a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx index 044fbeddf506..40a9d63f10c2 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx @@ -51,7 +51,8 @@ function WorkspaceExpensifyCardListPage({route, cardsList}: WorkspaceExpensifyCa const paymentBankAccountID = cardSettings?.paymentBankAccountID ?? 0; const [bankAccountsList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST); - const isBankAccountVerified = bankAccountsList?.[paymentBankAccountID]?.accountData?.approvedBy !== 'Automatic'; + // TODO: change approvedBy check for more accurate verification status + const isBankAccountVerified = bankAccountsList?.[paymentBankAccountID]?.accountData?.approvedBy === 'Automatic'; const policyCurrency = useMemo(() => policy?.outputCurrency ?? CONST.CURRENCY.USD, [policy]); @@ -128,6 +129,7 @@ function WorkspaceExpensifyCardListPage({route, cardsList}: WorkspaceExpensifyCa {shouldUseNarrowLayout && isBankAccountVerified && {getHeaderButtons()}} {isEmptyObject(cardsList) ? ( From c0e22484138a160d5532f171e28e1261db0080e3 Mon Sep 17 00:00:00 2001 From: Agata Kosior Date: Sat, 21 Sep 2024 08:05:56 +0700 Subject: [PATCH 04/33] fix: apply requested changes --- src/pages/workspace/expensifyCard/EmptyCardView.tsx | 2 +- .../workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pages/workspace/expensifyCard/EmptyCardView.tsx b/src/pages/workspace/expensifyCard/EmptyCardView.tsx index 24162e7c2b48..f71f837be50e 100644 --- a/src/pages/workspace/expensifyCard/EmptyCardView.tsx +++ b/src/pages/workspace/expensifyCard/EmptyCardView.tsx @@ -20,7 +20,7 @@ type EmptyCardViewProps = { /** Subtitle of the empty state */ subtitle: string; - /** Whether the header buttons be displayed */ + /** Whether the header buttons are displayed */ areHeaderButtonsDisplayed: boolean; }; diff --git a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx index 40a9d63f10c2..b3864088324d 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx @@ -51,8 +51,7 @@ function WorkspaceExpensifyCardListPage({route, cardsList}: WorkspaceExpensifyCa const paymentBankAccountID = cardSettings?.paymentBankAccountID ?? 0; const [bankAccountsList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST); - // TODO: change approvedBy check for more accurate verification status - const isBankAccountVerified = bankAccountsList?.[paymentBankAccountID]?.accountData?.approvedBy === 'Automatic'; + const isBankAccountVerified = bankAccountsList?.[paymentBankAccountID]?.accountData?.state === CONST.BANK_ACCOUNT.STATE.OPEN; const policyCurrency = useMemo(() => policy?.outputCurrency ?? CONST.CURRENCY.USD, [policy]); From ec1b3de1f10e77b695112a8a8de434128b14324a Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Mon, 21 Oct 2024 15:12:25 +0700 Subject: [PATCH 05/33] change background color of focus element --- .../AttachmentPicker/index.native.tsx | 5 +++++ .../EmojiPicker/EmojiPickerMenuItem/index.tsx | 3 +-- src/components/PopoverMenu.tsx | 5 ++++- src/components/SelectionList/BaseListItem.tsx | 4 +++- .../Search/TransactionListItem.tsx | 2 +- src/libs/Permissions.ts | 1 + src/styles/utils/index.ts | 20 ++++++++++++++++--- 7 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/components/AttachmentPicker/index.native.tsx b/src/components/AttachmentPicker/index.native.tsx index 975ea6c548c0..4a357178d5f3 100644 --- a/src/components/AttachmentPicker/index.native.tsx +++ b/src/components/AttachmentPicker/index.native.tsx @@ -16,6 +16,8 @@ import useArrowKeyFocusManager from '@hooks/useArrowKeyFocusManager'; import useKeyboardShortcut from '@hooks/useKeyboardShortcut'; import useLocalize from '@hooks/useLocalize'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; +import useStyleUtils from '@hooks/useStyleUtils'; +import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import * as FileUtils from '@libs/fileDownload/FileUtils'; import CONST from '@src/CONST'; @@ -115,6 +117,8 @@ function AttachmentPicker({ shouldValidateImage = true, }: AttachmentPickerProps) { const styles = useThemeStyles(); + const StyleUtils = useStyleUtils(); + const theme = useTheme(); const [isVisible, setIsVisible] = useState(false); const completeAttachmentSelection = useRef<(data: FileObject) => void>(() => {}); @@ -427,6 +431,7 @@ function AttachmentPicker({ title={translate(item.textTranslationKey)} onPress={() => selectItem(item)} focused={focusedIndex === menuIndex} + wrapperStyle={StyleUtils.getItemBackgroundColorStyle(false, focusedIndex === menuIndex, theme.activeComponentBG, theme.hoverComponentBG)} /> ))} diff --git a/src/components/EmojiPicker/EmojiPickerMenuItem/index.tsx b/src/components/EmojiPicker/EmojiPickerMenuItem/index.tsx index 8aaf4a14e560..1629089dace5 100644 --- a/src/components/EmojiPicker/EmojiPickerMenuItem/index.tsx +++ b/src/components/EmojiPicker/EmojiPickerMenuItem/index.tsx @@ -68,8 +68,7 @@ function EmojiPickerMenuItem({ ref.current = el ?? null; }} style={({pressed}) => [ - isFocused ? themeStyles.emojiItemKeyboardHighlighted : {}, - isHovered || isHighlighted ? themeStyles.emojiItemHighlighted : {}, + isFocused || isHovered || isHighlighted ? themeStyles.emojiItemHighlighted : {}, Browser.isMobile() && StyleUtils.getButtonBackgroundColorStyle(getButtonState(false, pressed)), themeStyles.emojiItem, ]} diff --git a/src/components/PopoverMenu.tsx b/src/components/PopoverMenu.tsx index b1aa2fc28338..ffa78ec5ac27 100644 --- a/src/components/PopoverMenu.tsx +++ b/src/components/PopoverMenu.tsx @@ -8,6 +8,7 @@ import type {ModalProps} from 'react-native-modal'; import useArrowKeyFocusManager from '@hooks/useArrowKeyFocusManager'; import useKeyboardShortcut from '@hooks/useKeyboardShortcut'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; +import useStyleUtils from '@hooks/useStyleUtils'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; @@ -159,6 +160,7 @@ function PopoverMenu({ shouldUpdateFocusedIndex = true, }: PopoverMenuProps) { const styles = useThemeStyles(); + const StyleUtils = useStyleUtils(); const theme = useTheme(); // We need to use isSmallScreenWidth instead of shouldUseNarrowLayout to apply correct popover styles const {isSmallScreenWidth} = useResponsiveLayout(); @@ -299,6 +301,7 @@ function PopoverMenu({ {currentMenuItems.map((item, menuIndex) => { const {text, onSelected, subMenuItems, shouldCallAfterModalHide, ...menuItemProps} = item; + return ( ({ }: BaseListItemProps) { const theme = useTheme(); const styles = useThemeStyles(); + const StyleUtils = useStyleUtils(); const {hovered, bind} = useHover(); const {isMouseDownOnInput, setMouseUp} = useMouseContext(); @@ -102,7 +104,7 @@ function BaseListItem({ tabIndex={item.tabIndex} wrapperStyle={pressableWrapperStyle} > - + {typeof children === 'function' ? children(hovered) : children} {!canSelectMultiple && item.isSelected && !rightHandSideComponent && ( diff --git a/src/components/SelectionList/Search/TransactionListItem.tsx b/src/components/SelectionList/Search/TransactionListItem.tsx index f56687550e4d..4fd1ec4cce75 100644 --- a/src/components/SelectionList/Search/TransactionListItem.tsx +++ b/src/components/SelectionList/Search/TransactionListItem.tsx @@ -34,7 +34,7 @@ function TransactionListItem({ // Removing background style because they are added to the parent OpacityView via animatedHighlightStyle styles.bgTransparent, item.isSelected && styles.activeComponentBG, - isFocused && styles.sidebarLinkActive, + isFocused && styles.hoveredComponentBG, styles.mh0, ]; diff --git a/src/libs/Permissions.ts b/src/libs/Permissions.ts index 24de2e612208..47fa860af63c 100644 --- a/src/libs/Permissions.ts +++ b/src/libs/Permissions.ts @@ -4,6 +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); } diff --git a/src/styles/utils/index.ts b/src/styles/utils/index.ts index 65faa941866a..ff925fdba079 100644 --- a/src/styles/utils/index.ts +++ b/src/styles/utils/index.ts @@ -1119,6 +1119,21 @@ function getAmountWidth(amount: string): number { return width; } +function getItemBackgroundColorStyle(isSelected: boolean, isFocused: boolean, selectedBG: string, focusedBG: string): ViewStyle { + let backgroundColor; + if (isSelected) { + backgroundColor = selectedBG; + } + + if (isFocused) { + backgroundColor = focusedBG; + } + + return { + backgroundColor, + }; +} + const staticStyleUtils = { positioning, combineStyles, @@ -1193,6 +1208,7 @@ const staticStyleUtils = { getAmountWidth, getBorderRadiusStyle, getHighResolutionInfoWrapperStyle, + getItemBackgroundColorStyle, }; const createStyleUtils = (theme: ThemeColors, styles: ThemeStyles) => ({ @@ -1211,9 +1227,7 @@ const createStyleUtils = (theme: ThemeColors, styles: ThemeStyles) => ({ getAutoCompleteSuggestionItemStyle: (highlightedEmojiIndex: number, rowHeight: number, isHovered: boolean, currentEmojiIndex: number): ViewStyle[] => { let backgroundColor; - if (currentEmojiIndex === highlightedEmojiIndex) { - backgroundColor = theme.activeComponentBG; - } else if (isHovered) { + if (isHovered || currentEmojiIndex === highlightedEmojiIndex) { backgroundColor = theme.hoverComponentBG; } From 46dad8211725536a78e37b35390a8958fcd35e47 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Mon, 21 Oct 2024 15:53:20 +0700 Subject: [PATCH 06/33] fix lint --- src/libs/Permissions.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/Permissions.ts b/src/libs/Permissions.ts index 47fa860af63c..24de2e612208 100644 --- a/src/libs/Permissions.ts +++ b/src/libs/Permissions.ts @@ -4,7 +4,6 @@ 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); } From 69704c108f4cc2154101fa6175de8943deb8f43d Mon Sep 17 00:00:00 2001 From: Wojciech Boman Date: Tue, 22 Oct 2024 15:20:10 +0200 Subject: [PATCH 07/33] Read amount from ref in onSelectionChange in MoneyRequestAmountInput --- src/components/MoneyRequestAmountInput.tsx | 8 ++++++-- .../{index.android.tsx => index.native.tsx} | 0 2 files changed, 6 insertions(+), 2 deletions(-) rename src/libs/shouldIgnoreSelectionWhenUpdatedManually/{index.android.tsx => index.native.tsx} (100%) diff --git a/src/components/MoneyRequestAmountInput.tsx b/src/components/MoneyRequestAmountInput.tsx index 702e6c384b58..f0c83a5e776f 100644 --- a/src/components/MoneyRequestAmountInput.tsx +++ b/src/components/MoneyRequestAmountInput.tsx @@ -135,6 +135,8 @@ function MoneyRequestAmountInput( const textInput = useRef(null); + const amountRef = useRef(undefined); + const decimals = CurrencyUtils.getCurrencyDecimals(currency); const selectedAmountAsString = amount ? onFormatAmount(amount, currency) : ''; @@ -172,8 +174,9 @@ function MoneyRequestAmountInput( willSelectionBeUpdatedManually.current = true; let hasSelectionBeenSet = false; + const strippedAmount = MoneyRequestUtils.stripCommaFromAmount(finalAmount); + amountRef.current = strippedAmount; setCurrentAmount((prevAmount) => { - const strippedAmount = MoneyRequestUtils.stripCommaFromAmount(finalAmount); const isForwardDelete = prevAmount.length > strippedAmount.length && forwardDeletePressedRef.current; if (!hasSelectionBeenSet) { hasSelectionBeenSet = true; @@ -312,7 +315,8 @@ function MoneyRequestAmountInput( if (!shouldUpdateSelection) { return; } - const maxSelection = formattedAmount.length; + const maxSelection = amountRef.current?.length ?? formattedAmount.length; + amountRef.current = undefined; const start = Math.min(e.nativeEvent.selection.start, maxSelection); const end = Math.min(e.nativeEvent.selection.end, maxSelection); setSelection({start, end}); diff --git a/src/libs/shouldIgnoreSelectionWhenUpdatedManually/index.android.tsx b/src/libs/shouldIgnoreSelectionWhenUpdatedManually/index.native.tsx similarity index 100% rename from src/libs/shouldIgnoreSelectionWhenUpdatedManually/index.android.tsx rename to src/libs/shouldIgnoreSelectionWhenUpdatedManually/index.native.tsx From 8efa457071caec493ef6092d3b529ef035271d4e Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Wed, 23 Oct 2024 15:53:53 +0700 Subject: [PATCH 08/33] improve-bank-acc-flow --- .../ReimbursementAccountPage.tsx | 17 +++++++++++------ .../WorkspaceExpensifyCardPageEmptyState.tsx | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx b/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx index 47c1aadf493a..2578ca13209a 100644 --- a/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx +++ b/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx @@ -2,7 +2,7 @@ import type {RouteProp} from '@react-navigation/native'; import type {StackScreenProps} from '@react-navigation/stack'; import {Str} from 'expensify-common'; import lodashPick from 'lodash/pick'; -import React, {useEffect, useRef, useState} from 'react'; +import React, {useCallback, useEffect, useRef, useState} from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; @@ -176,7 +176,6 @@ function ReimbursementAccountPage({route, policy}: ReimbursementAccountPageProps which acts similarly to `componentDidUpdate` when the `reimbursementAccount` dependency changes. */ const [hasACHDataBeenLoaded, setHasACHDataBeenLoaded] = useState(reimbursementAccount !== CONST.REIMBURSEMENT_ACCOUNT.DEFAULT_DATA && isPreviousPolicy); - const [shouldShowContinueSetupButton, setShouldShowContinueSetupButton] = useState(getShouldShowContinueSetupButtonInitialValue()); function getBankAccountFields(fieldNames: T[]): Pick { return { @@ -187,21 +186,27 @@ function ReimbursementAccountPage({route, policy}: ReimbursementAccountPageProps /** * Returns true if a VBBA exists in any state other than OPEN or LOCKED */ - function hasInProgressVBBA(): boolean { + const hasInProgressVBBA = useCallback(() => { return !!achData?.bankAccountID && !!achData?.state && achData?.state !== BankAccount.STATE.OPEN && achData?.state !== BankAccount.STATE.LOCKED; - } + }, [achData?.bankAccountID, achData?.state]); /* * Calculates the state used to show the "Continue with setup" view. If a bank account setup is already in progress and * no specific further step was passed in the url we'll show the workspace bank account reset modal if the user wishes to start over */ - function getShouldShowContinueSetupButtonInitialValue(): boolean { + const getShouldShowContinueSetupButtonInitialValue = useCallback(() => { if (!hasInProgressVBBA()) { // Since there is no VBBA in progress, we won't need to show the component ContinueBankAccountSetup return false; } return achData?.state === BankAccount.STATE.PENDING || [CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT, ''].includes(getStepToOpenFromRouteParams(route)); - } + }, [achData?.state, hasInProgressVBBA, route]); + const [shouldShowContinueSetupButton, setShouldShowContinueSetupButton] = useState(getShouldShowContinueSetupButtonInitialValue()); + + useEffect(() => { + setShouldShowContinueSetupButton(getShouldShowContinueSetupButtonInitialValue()); + setHasACHDataBeenLoaded(reimbursementAccount !== CONST.REIMBURSEMENT_ACCOUNT.DEFAULT_DATA && isPreviousPolicy); + }, [achData, getShouldShowContinueSetupButtonInitialValue, isPreviousPolicy, reimbursementAccount]); const handleNextNonUSDBankAccountStep = () => { switch (nonUSDBankAccountStep) { diff --git a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx index 7dc6293e23ea..6339872545fb 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx @@ -55,7 +55,7 @@ function WorkspaceExpensifyCardPageEmptyState({route, policy}: WorkspaceExpensif const eligibleBankAccounts = CardUtils.getEligibleBankAccountsForCard(bankAccountList ?? {}); const reimbursementAccountStatus = reimbursementAccount?.achData?.state ?? ''; - const isSetupUnfinished = isEmptyObject(bankAccountList) && reimbursementAccountStatus && reimbursementAccountStatus !== CONST.BANK_ACCOUNT.STATE.OPEN; + const isSetupUnfinished = !eligibleBankAccounts.length && reimbursementAccountStatus && reimbursementAccountStatus !== CONST.BANK_ACCOUNT.STATE.OPEN; const startFlow = useCallback(() => { if (!eligibleBankAccounts.length || isSetupUnfinished) { From 2745418321e6297d5b40509b840714f445ae3550 Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Wed, 23 Oct 2024 15:59:37 +0700 Subject: [PATCH 09/33] fix lint --- .../expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx index 6339872545fb..88026af0021b 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx @@ -22,7 +22,6 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -import {isEmptyObject} from '@src/types/utils/EmptyObject'; const expensifyCardFeatures: FeatureListItem[] = [ { From d270f920b1ca0924ccc36ed9682bd992bc033c81 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Wed, 23 Oct 2024 17:20:24 +0700 Subject: [PATCH 10/33] fix bg for selected item --- src/components/PopoverMenu.tsx | 2 +- src/styles/utils/index.ts | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/components/PopoverMenu.tsx b/src/components/PopoverMenu.tsx index 9f0072ccf04a..bab65702d8d3 100644 --- a/src/components/PopoverMenu.tsx +++ b/src/components/PopoverMenu.tsx @@ -269,6 +269,7 @@ function PopoverMenu({ setCurrentMenuItems(menuItems); }, [menuItems]); + return ( {currentMenuItems.map((item, menuIndex) => { const {text, onSelected, subMenuItems, shouldCallAfterModalHide, ...menuItemProps} = item; - return ( Date: Wed, 23 Oct 2024 17:24:07 +0700 Subject: [PATCH 11/33] fix prettier --- src/components/PopoverMenu.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/PopoverMenu.tsx b/src/components/PopoverMenu.tsx index bab65702d8d3..b1aa34bbf1fd 100644 --- a/src/components/PopoverMenu.tsx +++ b/src/components/PopoverMenu.tsx @@ -269,7 +269,6 @@ function PopoverMenu({ setCurrentMenuItems(menuItems); }, [menuItems]); - return ( Date: Thu, 24 Oct 2024 11:39:49 +0200 Subject: [PATCH 12/33] Add comment to onSelectionChange in MoneyRequestAmountInput --- src/components/MoneyRequestAmountInput.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/MoneyRequestAmountInput.tsx b/src/components/MoneyRequestAmountInput.tsx index f0c83a5e776f..b06968ed7219 100644 --- a/src/components/MoneyRequestAmountInput.tsx +++ b/src/components/MoneyRequestAmountInput.tsx @@ -315,6 +315,8 @@ function MoneyRequestAmountInput( if (!shouldUpdateSelection) { return; } + + // When the amount is updated in setNewAmount on iOS, in onSelectionChange formattedAmount stores the value before the update. Using amountRef allows us to read the updated value const maxSelection = amountRef.current?.length ?? formattedAmount.length; amountRef.current = undefined; const start = Math.min(e.nativeEvent.selection.start, maxSelection); From 6bd9d7bd2d0debfeb98f2c2785b810c9e2b452f6 Mon Sep 17 00:00:00 2001 From: Agata Kosior Date: Fri, 25 Oct 2024 18:51:28 +0700 Subject: [PATCH 13/33] fix: change the condition based on we display the modal --- src/ONYXKEYS.ts | 4 +++ .../WorkspaceExpensifyCardListPage.tsx | 7 ++---- src/types/onyx/CardOnWaitlist.ts | 25 +++++++++++++++++++ src/types/onyx/index.ts | 2 ++ 4 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 src/types/onyx/CardOnWaitlist.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 427e05052ae3..ec67a177d072 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -527,6 +527,9 @@ const ONYXKEYS = { /** Currently displaying feed */ LAST_SELECTED_FEED: 'lastSelectedFeed_', + + /** Whether the bank account chosen for Expensify Card in on verification waitlist */ + NVP_EXPENSIFY_ON_CARD_WAITLIST: 'nvp_expensify_onCardWaitlist', }, /** List of Form ids */ @@ -857,6 +860,7 @@ type OnyxCollectionValuesMapping = { [ONYXKEYS.COLLECTION.EXPENSIFY_CARD_CONTINUOUS_RECONCILIATION_CONNECTION]: OnyxTypes.PolicyConnectionName; [ONYXKEYS.COLLECTION.EXPENSIFY_CARD_USE_CONTINUOUS_RECONCILIATION]: boolean; [ONYXKEYS.COLLECTION.LAST_SELECTED_FEED]: OnyxTypes.CompanyCardFeed; + [ONYXKEYS.COLLECTION.NVP_EXPENSIFY_ON_CARD_WAITLIST]: OnyxTypes.CardOnWaitlist; }; type OnyxValuesMapping = { diff --git a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx index 8f27e745083c..7be3e496c93b 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx @@ -47,12 +47,9 @@ function WorkspaceExpensifyCardListPage({route, cardsList}: WorkspaceExpensifyCa const policy = usePolicy(policyID); const workspaceAccountID = PolicyUtils.getWorkspaceAccountID(policyID); const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST); - const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`); + const [cardOnWaitlist] = useOnyx(`${ONYXKEYS.COLLECTION.NVP_EXPENSIFY_ON_CARD_WAITLIST}${policyID}`); - const paymentBankAccountID = cardSettings?.paymentBankAccountID ?? 0; - const [bankAccountsList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST); - - const isBankAccountVerified = bankAccountsList?.[paymentBankAccountID]?.accountData?.state === CONST.BANK_ACCOUNT.STATE.OPEN; + const isBankAccountVerified = !!cardOnWaitlist; const policyCurrency = useMemo(() => policy?.outputCurrency ?? CONST.CURRENCY.USD, [policy]); diff --git a/src/types/onyx/CardOnWaitlist.ts b/src/types/onyx/CardOnWaitlist.ts new file mode 100644 index 000000000000..ba09374996de --- /dev/null +++ b/src/types/onyx/CardOnWaitlist.ts @@ -0,0 +1,25 @@ +/** Card on waitlist data model */ +type CardOnWaitlist = { + /** Whether the user uses the bank account on another domain */ + bankAccountIsNotOn0therDomain: boolean; + + /** Domain name in "+@expensify-policy.exfy" format */ + domainName: string; + + /** Whether the user has a balance checked */ + hasBalanceBeenChecked: boolean; + + /** Whether the user has a verified account */ + hasVerifiedAccount: boolean; + + /** Whether the user has a withdrawal account */ + hasWithdrawalAccount: string; + + /** Whether the user is a member of a private domain */ + isMember0fPrivateDomain: boolean; + + /** Whether the account passed the latest checks */ + passedLatestChecks: boolean; +}; + +export default CardOnWaitlist; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index fe559aab3aa9..aaf15d764157 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -13,6 +13,7 @@ import type Card from './Card'; import type {CardList, IssueNewCard, WorkspaceCardsList} from './Card'; import type CardFeeds from './CardFeeds'; import type {AddNewCompanyCardFeed, CompanyCardFeed} from './CardFeeds'; +import type CardOnWaitlist from './CardOnWaitlist'; import type {CapturedLogs, Log} from './Console'; import type Credentials from './Credentials'; import type Currency from './Currency'; @@ -123,6 +124,7 @@ export type { Currency, CurrencyList, CustomStatusDraft, + CardOnWaitlist, DismissedReferralBanners, Download, WorkspaceCardsList, From 0f2882a2f413ded9c21e2ec80e233b19ef122bde Mon Sep 17 00:00:00 2001 From: Agata Kosior Date: Fri, 25 Oct 2024 18:51:53 +0700 Subject: [PATCH 14/33] fix: minor fix --- .../workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx index 7be3e496c93b..5d2fdaf28c9f 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx @@ -49,7 +49,7 @@ function WorkspaceExpensifyCardListPage({route, cardsList}: WorkspaceExpensifyCa const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST); const [cardOnWaitlist] = useOnyx(`${ONYXKEYS.COLLECTION.NVP_EXPENSIFY_ON_CARD_WAITLIST}${policyID}`); - const isBankAccountVerified = !!cardOnWaitlist; + const isBankAccountVerified = !cardOnWaitlist; const policyCurrency = useMemo(() => policy?.outputCurrency ?? CONST.CURRENCY.USD, [policy]); From 9c91a30ad518a9c0dd49ab445ac244c5bc30ee53 Mon Sep 17 00:00:00 2001 From: Agata Kosior Date: Fri, 25 Oct 2024 19:46:51 +0700 Subject: [PATCH 15/33] fix: add missing _ --- src/ONYXKEYS.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index ec67a177d072..2af706c772bf 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -529,7 +529,7 @@ const ONYXKEYS = { LAST_SELECTED_FEED: 'lastSelectedFeed_', /** Whether the bank account chosen for Expensify Card in on verification waitlist */ - NVP_EXPENSIFY_ON_CARD_WAITLIST: 'nvp_expensify_onCardWaitlist', + NVP_EXPENSIFY_ON_CARD_WAITLIST: 'nvp_expensify_onCardWaitlist_', }, /** List of Form ids */ From 254db36cc6f3fb464bde8a8c4422db6d627bab1c Mon Sep 17 00:00:00 2001 From: Georgia Monahan Date: Mon, 28 Oct 2024 11:06:42 +0000 Subject: [PATCH 16/33] Use %bank% cards --- src/languages/en.ts | 1 + src/languages/es.ts | 1 + .../companyCards/WorkspaceCompanyCardsListHeaderButtons.tsx | 5 +++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index f4501f758557..4362c02a827e 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -3122,6 +3122,7 @@ const translations = { assignCard: 'Assign card', cardNumber: 'Card number', customFeed: 'Custom feed', + feedName: ({feedName}: CompanyCardFeedNameParams) => `${feedName} cards`, directFeed: 'Direct feed', whoNeedsCardAssigned: 'Who needs a card assigned?', chooseCard: 'Choose a card', diff --git a/src/languages/es.ts b/src/languages/es.ts index 6614afbc483d..7d2d3d643a4e 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -3161,6 +3161,7 @@ const translations = { assignCard: 'Asignar tarjeta', cardNumber: 'Número de la tarjeta', customFeed: 'Fuente personalizada', + feedName: ({feedName}: CompanyCardFeedNameParams) => `Tarjetas ${feedName}`, directFeed: 'Fuente directa', whoNeedsCardAssigned: '¿Quién necesita una tarjeta?', chooseCard: 'Elige una tarjeta', diff --git a/src/pages/workspace/companyCards/WorkspaceCompanyCardsListHeaderButtons.tsx b/src/pages/workspace/companyCards/WorkspaceCompanyCardsListHeaderButtons.tsx index efd95ecb8980..4b8f34897076 100644 --- a/src/pages/workspace/companyCards/WorkspaceCompanyCardsListHeaderButtons.tsx +++ b/src/pages/workspace/companyCards/WorkspaceCompanyCardsListHeaderButtons.tsx @@ -38,6 +38,7 @@ function WorkspaceCompanyCardsListHeaderButtons({policyID, selectedFeed}: Worksp const [cardFeeds] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${workspaceAccountID}`); const shouldChangeLayout = isMediumScreenWidth || shouldUseNarrowLayout; const feedName = cardFeeds?.settings?.companyCardNicknames?.[selectedFeed] ?? CardUtils.getCardFeedName(selectedFeed); + const formattedFeedName = translate('workspace.companyCards.feedName', {feedName}); const isCustomFeed = CONST.COMPANY_CARD.FEED_BANK_NAME.MASTER_CARD === selectedFeed || CONST.COMPANY_CARD.FEED_BANK_NAME.VISA === selectedFeed || CONST.COMPANY_CARD.FEED_BANK_NAME.AMEX === selectedFeed; @@ -51,7 +52,7 @@ function WorkspaceCompanyCardsListHeaderButtons({policyID, selectedFeed}: Worksp Navigation.navigate(ROUTES.WORKSPACE_COMPANY_CARDS_SELECT_FEED.getRoute(policyID))} style={[styles.flexRow, styles.alignItemsCenter, styles.gap3, shouldChangeLayout && styles.mb3]} - accessibilityLabel={feedName} + accessibilityLabel={formattedFeedName} > - {feedName} + {formattedFeedName} {PolicyUtils.hasPolicyFeedsError(cardFeeds?.settings?.companyCards ?? {}, selectedFeed) && ( Date: Mon, 28 Oct 2024 14:21:20 +0100 Subject: [PATCH 17/33] Add fields limit --- src/CONST.ts | 1 + src/pages/workspace/companyCards/addNew/CardNameStep.tsx | 1 + src/pages/workspace/companyCards/addNew/DetailsStep.tsx | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/src/CONST.ts b/src/CONST.ts index 2ba002d47534..4ae3975cfc4d 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -2929,6 +2929,7 @@ const CONST = { // Character Limits FORM_CHARACTER_LIMIT: 50, + STANDARD_LENGTH_LIMIT: 100, LEGAL_NAMES_CHARACTER_LIMIT: 150, LOGIN_CHARACTER_LIMIT: 254, CATEGORY_NAME_LIMIT: 256, diff --git a/src/pages/workspace/companyCards/addNew/CardNameStep.tsx b/src/pages/workspace/companyCards/addNew/CardNameStep.tsx index 2b910515ba64..c1fd28accef6 100644 --- a/src/pages/workspace/companyCards/addNew/CardNameStep.tsx +++ b/src/pages/workspace/companyCards/addNew/CardNameStep.tsx @@ -67,6 +67,7 @@ function CardNameStep() { role={CONST.ROLE.PRESENTATION} defaultValue={addNewCard?.data?.bankName} containerStyles={[styles.mb6]} + maxLength={CONST.STANDARD_LENGTH_LIMIT} ref={inputCallbackRef} /> diff --git a/src/pages/workspace/companyCards/addNew/DetailsStep.tsx b/src/pages/workspace/companyCards/addNew/DetailsStep.tsx index 2c719acd47d8..c4b427578a52 100644 --- a/src/pages/workspace/companyCards/addNew/DetailsStep.tsx +++ b/src/pages/workspace/companyCards/addNew/DetailsStep.tsx @@ -104,6 +104,7 @@ function DetailsStep({policyID}: DetailsStepProps) { inputID={INPUT_IDS.PROCESSOR_ID} label={translate('workspace.companyCards.addNewCard.feedDetails.vcf.processorLabel')} role={CONST.ROLE.PRESENTATION} + maxLength={CONST.STANDARD_LENGTH_LIMIT} containerStyles={[styles.mb6]} ref={inputCallbackRef} /> @@ -112,6 +113,7 @@ function DetailsStep({policyID}: DetailsStepProps) { inputID={INPUT_IDS.BANK_ID} label={translate('workspace.companyCards.addNewCard.feedDetails.vcf.bankLabel')} role={CONST.ROLE.PRESENTATION} + maxLength={CONST.STANDARD_LENGTH_LIMIT} containerStyles={[styles.mb6]} /> @@ -130,6 +133,7 @@ function DetailsStep({policyID}: DetailsStepProps) { inputID={INPUT_IDS.DISTRIBUTION_ID} label={translate('workspace.companyCards.addNewCard.feedDetails.cdf.distributionLabel')} role={CONST.ROLE.PRESENTATION} + maxLength={CONST.STANDARD_LENGTH_LIMIT} containerStyles={[styles.mb6]} ref={inputCallbackRef} /> @@ -141,6 +145,7 @@ function DetailsStep({policyID}: DetailsStepProps) { inputID={INPUT_IDS.DELIVERY_FILE_NAME} label={translate('workspace.companyCards.addNewCard.feedDetails.gl1025.fileNameLabel')} role={CONST.ROLE.PRESENTATION} + maxLength={CONST.STANDARD_LENGTH_LIMIT} containerStyles={[styles.mb6]} ref={inputCallbackRef} /> From 4532fdeee15b085e94bebbbb90f019fc6eec87a3 Mon Sep 17 00:00:00 2001 From: Agata Kosior Date: Mon, 28 Oct 2024 21:17:03 +0700 Subject: [PATCH 18/33] fix: change verifying modal illustration --- .../workspace/expensifyCard/EmptyCardView.tsx | 41 +++++++++---------- .../WorkspaceExpensifyCardListPage.tsx | 6 +-- 2 files changed, 21 insertions(+), 26 deletions(-) diff --git a/src/pages/workspace/expensifyCard/EmptyCardView.tsx b/src/pages/workspace/expensifyCard/EmptyCardView.tsx index f71f837be50e..1902a4c60810 100644 --- a/src/pages/workspace/expensifyCard/EmptyCardView.tsx +++ b/src/pages/workspace/expensifyCard/EmptyCardView.tsx @@ -14,23 +14,17 @@ import colors from '@styles/theme/colors'; import CONST from '@src/CONST'; type EmptyCardViewProps = { - /** Title of the empty state */ - title: string; - - /** Subtitle of the empty state */ - subtitle: string; - - /** Whether the header buttons are displayed */ - areHeaderButtonsDisplayed: boolean; + /** Whether the bank account is verified */ + isBankAccountVerified: boolean; }; -function EmptyCardView({title, subtitle, areHeaderButtonsDisplayed}: EmptyCardViewProps) { +function EmptyCardView({isBankAccountVerified}: EmptyCardViewProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); const {windowHeight} = useWindowDimensions(); const {shouldUseNarrowLayout} = useResponsiveLayout(); - const headerHeight = useEmptyViewHeaderHeight(shouldUseNarrowLayout, areHeaderButtonsDisplayed); + const headerHeight = useEmptyViewHeaderHeight(shouldUseNarrowLayout, isBankAccountVerified); return ( @@ -38,17 +32,22 @@ function EmptyCardView({title, subtitle, areHeaderButtonsDisplayed}: EmptyCardVi {translate('workspace.expensifyCard.disclaimer')} diff --git a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx index 5d2fdaf28c9f..8709b2864fda 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx @@ -126,11 +126,7 @@ function WorkspaceExpensifyCardListPage({route, cardsList}: WorkspaceExpensifyCa {shouldUseNarrowLayout && isBankAccountVerified && {getHeaderButtons()}} {isEmptyObject(cardsList) ? ( - + ) : ( Date: Tue, 29 Oct 2024 16:31:11 +0700 Subject: [PATCH 19/33] add shouldRemoveHoverBackground prop --- src/components/MenuItem.tsx | 6 +++++- src/components/PopoverMenu.tsx | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/MenuItem.tsx b/src/components/MenuItem.tsx index a40fd925cd2e..602ecca3518c 100644 --- a/src/components/MenuItem.tsx +++ b/src/components/MenuItem.tsx @@ -251,6 +251,9 @@ type MenuItemBaseProps = { /** Should we remove the background color of the menu item */ shouldRemoveBackground?: boolean; + /** Should we remove the hover background color of the menu item */ + shouldRemoveHoverBackground?: boolean; + /** Should we use default cursor for disabled content */ shouldUseDefaultCursorWhenDisabled?: boolean; @@ -411,6 +414,7 @@ function MenuItem( shouldEscapeText = undefined, shouldGreyOutWhenDisabled = true, shouldRemoveBackground = false, + shouldRemoveHoverBackground = false, shouldUseDefaultCursorWhenDisabled = false, shouldShowLoadingSpinnerIcon = false, isAnonymousAction = false, @@ -594,7 +598,7 @@ function MenuItem( StyleUtils.getButtonBackgroundColorStyle(getButtonState(focused || isHovered, pressed, success, disabled, interactive), true), ...(Array.isArray(wrapperStyle) ? wrapperStyle : [wrapperStyle]), shouldGreyOutWhenDisabled && disabled && styles.buttonOpacityDisabled, - isHovered && interactive && !focused && !pressed && !shouldRemoveBackground && styles.hoveredComponentBG, + isHovered && interactive && !focused && !pressed && !shouldRemoveBackground && !shouldRemoveHoverBackground && styles.hoveredComponentBG, ] as StyleProp } disabledStyle={shouldUseDefaultCursorWhenDisabled && [styles.cursorDefault]} diff --git a/src/components/PopoverMenu.tsx b/src/components/PopoverMenu.tsx index b1aa34bbf1fd..9aab414971de 100644 --- a/src/components/PopoverMenu.tsx +++ b/src/components/PopoverMenu.tsx @@ -323,6 +323,7 @@ function PopoverMenu({ setFocusedIndex(menuIndex); }} wrapperStyle={StyleUtils.getItemBackgroundColorStyle(!!item.isSelected, focusedIndex === menuIndex, theme.activeComponentBG, theme.hoverComponentBG)} + shouldRemoveHoverBackground={item.isSelected} titleStyle={StyleSheet.flatten([styles.flex1, item.titleStyle])} // eslint-disable-next-line react/jsx-props-no-spreading {...menuItemProps} From 4bf4988e5e9dbb9d10a8194143364858d1b1f70d Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Tue, 29 Oct 2024 18:41:41 +0700 Subject: [PATCH 20/33] add line break --- src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx b/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx index 98ea7032ce94..9fdcea824c3c 100644 --- a/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx +++ b/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx @@ -202,6 +202,7 @@ function ReimbursementAccountPage({route, policy}: ReimbursementAccountPageProps } return achData?.state === BankAccount.STATE.PENDING || [CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT, ''].includes(getStepToOpenFromRouteParams(route)); }, [achData?.state, hasInProgressVBBA, route]); + const [shouldShowContinueSetupButton, setShouldShowContinueSetupButton] = useState(getShouldShowContinueSetupButtonInitialValue()); useEffect(() => { From a203bb22758b7366624e98c5c5e10fcb4e1ba14e Mon Sep 17 00:00:00 2001 From: Alberto Date: Tue, 29 Oct 2024 12:56:18 +0100 Subject: [PATCH 21/33] Add Per Diem Beta --- src/CONST.ts | 1 + src/libs/Permissions.ts | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/CONST.ts b/src/CONST.ts index 8e240ac43ca1..02df30286580 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -509,6 +509,7 @@ const CONST = { WORKSPACE_RULES: 'workspaceRules', COMBINED_TRACK_SUBMIT: 'combinedTrackSubmit', CATEGORY_AND_TAG_APPROVERS: 'categoryAndTagApprovers', + PER_DIEM: 'newDotPerDiem', }, BUTTON_STATES: { DEFAULT: 'default', diff --git a/src/libs/Permissions.ts b/src/libs/Permissions.ts index 45203c1db5b6..05a801e6f4ef 100644 --- a/src/libs/Permissions.ts +++ b/src/libs/Permissions.ts @@ -53,6 +53,10 @@ function canUseCombinedTrackSubmit(betas: OnyxEntry): boolean { return !!betas?.includes(CONST.BETAS.COMBINED_TRACK_SUBMIT); } +function canUsePerDiem(betas: OnyxEntry): boolean { + return !!betas?.includes(CONST.BETAS.PER_DIEM) || canUseAllBetas(betas); +} + /** * Link previews are temporarily disabled. */ @@ -73,4 +77,5 @@ export default { canUseWorkspaceRules, canUseCombinedTrackSubmit, canUseCategoryAndTagApprovers, + canUsePerDiem, }; From 8ab57e6db138a02139a36a2928ab2e7fc3a0a678 Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Tue, 29 Oct 2024 19:03:59 +0700 Subject: [PATCH 22/33] clean condition --- .../expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx index 88026af0021b..2b3bb8a4b9e8 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx @@ -57,12 +57,12 @@ function WorkspaceExpensifyCardPageEmptyState({route, policy}: WorkspaceExpensif const isSetupUnfinished = !eligibleBankAccounts.length && reimbursementAccountStatus && reimbursementAccountStatus !== CONST.BANK_ACCOUNT.STATE.OPEN; const startFlow = useCallback(() => { - if (!eligibleBankAccounts.length || isSetupUnfinished) { + if (!eligibleBankAccounts.length) { Navigation.navigate(ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute('new', policy?.id, ROUTES.WORKSPACE_EXPENSIFY_CARD.getRoute(policy?.id ?? '-1'))); } else { Navigation.navigate(ROUTES.WORKSPACE_EXPENSIFY_CARD_BANK_ACCOUNT.getRoute(policy?.id ?? '-1')); } - }, [eligibleBankAccounts.length, isSetupUnfinished, policy?.id]); + }, [eligibleBankAccounts.length, policy?.id]); const confirmCurrencyChangeAndHideModal = useCallback(() => { if (!policy) { From 950164f793501e072b58ee4f8890f0c7f49bba4a Mon Sep 17 00:00:00 2001 From: Stevie LaFortune Date: Tue, 29 Oct 2024 09:36:37 -0500 Subject: [PATCH 23/33] Update and rename Billing-page-coming-soon.md to Billing-page.md Removing coming soon from the title of the billing page --- .../billing-and-subscriptions/Billing-page-coming-soon.md | 6 ------ .../new-expensify/billing-and-subscriptions/Billing-page.md | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) delete mode 100644 docs/articles/new-expensify/billing-and-subscriptions/Billing-page-coming-soon.md create mode 100644 docs/articles/new-expensify/billing-and-subscriptions/Billing-page.md diff --git a/docs/articles/new-expensify/billing-and-subscriptions/Billing-page-coming-soon.md b/docs/articles/new-expensify/billing-and-subscriptions/Billing-page-coming-soon.md deleted file mode 100644 index 2ae2fcd2426d..000000000000 --- a/docs/articles/new-expensify/billing-and-subscriptions/Billing-page-coming-soon.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: Billing and Subscriptions -description: Coming soon ---- - -# Coming Soon diff --git a/docs/articles/new-expensify/billing-and-subscriptions/Billing-page.md b/docs/articles/new-expensify/billing-and-subscriptions/Billing-page.md new file mode 100644 index 000000000000..f945840d65da --- /dev/null +++ b/docs/articles/new-expensify/billing-and-subscriptions/Billing-page.md @@ -0,0 +1,6 @@ +--- +title: Billing and Subscriptions +description: An overview of how billing works in Expensify. +--- + +# Coming Soon From 7ff99b880f556f7a095811b447509b162dbd71e6 Mon Sep 17 00:00:00 2001 From: Stevie LaFortune Date: Tue, 29 Oct 2024 09:49:41 -0500 Subject: [PATCH 24/33] Update redirects.csv update url https://help.expensify.com/articles/new-expensify/billing-and-subscriptions/Billing-page-coming-soon to https://help.expensify.com/articles/new-expensify/billing-and-subscriptions/Billing-page removing coming soon --- docs/redirects.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/redirects.csv b/docs/redirects.csv index d3672618cfad..06fd7c1ef502 100644 --- a/docs/redirects.csv +++ b/docs/redirects.csv @@ -590,3 +590,4 @@ https://help.expensify.com/articles/expensify-classic/articles/expensify-classic https://help.expensify.com/articles/expensify-classic/articles/expensify-classic/expenses/Bulk-Upload-Multiple-Invoices,https://help.expensify.com/articles/expensify-classic/articles/expensify-classic/expenses/Add-Invoices-in-Bulk https://help.expensify.com/articles/expensify-classic/bank-accounts-and-payments/payments/Pay-Bills,https://help.expensify.com/articles/expensify-classic/bank-accounts-and-payments/payments/Create-and-Pay-Bills https://help.expensify.com/articles/new-expensify/billing-and-subscriptions/add-a-payment-card-and-view-your-subscription,https://help.expensify.com/articles/new-expensify/billing-and-subscriptions/Add-a-payment-card-and-view-your-subscription +https://help.expensify.com/articles/new-expensify/billing-and-subscriptions/Billing-page-coming-soon,https://help.expensify.com/articles/new-expensify/billing-and-subscriptions/Billing-page From 02ba35fc23d4f81f611f77fa8a220f19a8d0c0ad Mon Sep 17 00:00:00 2001 From: David Bondy Date: Tue, 29 Oct 2024 16:03:55 -0600 Subject: [PATCH 25/33] remove debounce and just rely on normal state management --- src/pages/ReportParticipantsPage.tsx | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/pages/ReportParticipantsPage.tsx b/src/pages/ReportParticipantsPage.tsx index 8029067f5026..07ae32ad79b5 100755 --- a/src/pages/ReportParticipantsPage.tsx +++ b/src/pages/ReportParticipantsPage.tsx @@ -18,7 +18,6 @@ import TableListItem from '@components/SelectionList/TableListItem'; import type {ListItem, SelectionListHandle} from '@components/SelectionList/types'; import SelectionListWithModal from '@components/SelectionListWithModal'; import Text from '@components/Text'; -import useDebouncedState from '@hooks/useDebouncedState'; import useLocalize from '@hooks/useLocalize'; import useMobileSelectionMode from '@hooks/useMobileSelectionMode'; import useNetwork from '@hooks/useNetwork'; @@ -67,18 +66,7 @@ function ReportParticipantsPage({report, route}: ReportParticipantsPageProps) { const isFocused = useIsFocused(); const {isOffline} = useNetwork(); const canSelectMultiple = isGroupChat && isCurrentUserAdmin && (isSmallScreenWidth ? selectionMode?.isEnabled : true); - const [searchValue, debouncedSearchValue, setSearchValue] = useDebouncedState(''); - - useEffect( - () => () => { - UserSearchPhraseActions.clearUserSearchPhrase(); - }, - [], - ); - - useEffect(() => { - UserSearchPhraseActions.updateUserSearchPhrase(debouncedSearchValue); - }, [debouncedSearchValue]); + const [searchValue, setSearchValue] = useState(''); useEffect(() => { if (isFocused) { From e99cd841787c94a9f6879415e5aedb6fe3d9366e Mon Sep 17 00:00:00 2001 From: David Bondy Date: Tue, 29 Oct 2024 16:19:43 -0600 Subject: [PATCH 26/33] simplify updating state --- src/pages/ReportParticipantsPage.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pages/ReportParticipantsPage.tsx b/src/pages/ReportParticipantsPage.tsx index 07ae32ad79b5..405e1dd688f2 100755 --- a/src/pages/ReportParticipantsPage.tsx +++ b/src/pages/ReportParticipantsPage.tsx @@ -412,9 +412,7 @@ function ReportParticipantsPage({report, route}: ReportParticipantsPageProps) { shouldShowTextInput={shouldShowTextInput} textInputLabel={translate('selectionList.findMember')} textInputValue={searchValue} - onChangeText={(value) => { - setSearchValue(value); - }} + onChangeText={setSearchValue} headerMessage={headerMessage} ListItem={TableListItem} onSelectRow={openMemberDetails} From e870c00ae6c8d89a654c14c7622c54a45192c719 Mon Sep 17 00:00:00 2001 From: Jakub Piasecki Date: Wed, 30 Oct 2024 10:21:59 +0100 Subject: [PATCH 27/33] Change artifact name --- .github/workflows/buildAndroid.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/buildAndroid.yml b/.github/workflows/buildAndroid.yml index 90ed0e46661a..49f3d23ec02c 100644 --- a/.github/workflows/buildAndroid.yml +++ b/.github/workflows/buildAndroid.yml @@ -163,7 +163,7 @@ jobs: echo "APK_PATH=$apkPath" echo "APK_FILE_NAME=$(basename "$apkPath")" echo "SHOULD_UPLOAD_SOURCEMAPS=$SHOULD_UPLOAD_SOURCEMAPS" - echo "APK_ARTIFACT_NAME=${{ inputs.artifact-prefix }}android-artifact-apk" >> "$GITHUB_OUTPUT" + echo "APK_ARTIFACT_NAME=${{ inputs.artifact-prefix }}android-apk-artifact" >> "$GITHUB_OUTPUT" } >> "$GITHUB_OUTPUT" - name: Upload Android AAB artifact From c05e4df6c69d3fd68b441865618c7ed2dc5cfcc0 Mon Sep 17 00:00:00 2001 From: OSBotify Date: Wed, 30 Oct 2024 10:37:02 +0000 Subject: [PATCH 28/33] Update version to 9.0.55-7 --- android/app/build.gradle | 4 ++-- ios/NewExpensify/Info.plist | 2 +- ios/NewExpensifyTests/Info.plist | 2 +- ios/NotificationServiceExtension/Info.plist | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index b60acfb17937..d628848eac24 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -110,8 +110,8 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion multiDexEnabled rootProject.ext.multiDexEnabled - versionCode 1009005506 - versionName "9.0.55-6" + versionCode 1009005507 + versionName "9.0.55-7" // Supported language variants must be declared here to avoid from being removed during the compilation. // This also helps us to not include unnecessary language variants in the APK. resConfigs "en", "es" diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist index d65f6a1789ab..60b0a3fc9d24 100644 --- a/ios/NewExpensify/Info.plist +++ b/ios/NewExpensify/Info.plist @@ -40,7 +40,7 @@ CFBundleVersion - 9.0.55.6 + 9.0.55.7 FullStory OrgId diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist index 66a47b5a0fc2..11ff0996c50d 100644 --- a/ios/NewExpensifyTests/Info.plist +++ b/ios/NewExpensifyTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 9.0.55.6 + 9.0.55.7 diff --git a/ios/NotificationServiceExtension/Info.plist b/ios/NotificationServiceExtension/Info.plist index ea7fdc172282..ea3fe90ea712 100644 --- a/ios/NotificationServiceExtension/Info.plist +++ b/ios/NotificationServiceExtension/Info.plist @@ -13,7 +13,7 @@ CFBundleShortVersionString 9.0.55 CFBundleVersion - 9.0.55.6 + 9.0.55.7 NSExtension NSExtensionPointIdentifier diff --git a/package-lock.json b/package-lock.json index 902d89678e6b..d34a33ab8aae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "new.expensify", - "version": "9.0.55-6", + "version": "9.0.55-7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "new.expensify", - "version": "9.0.55-6", + "version": "9.0.55-7", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 0a659780c48b..3fd91b404e61 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "9.0.55-6", + "version": "9.0.55-7", "author": "Expensify, Inc.", "homepage": "https://new.expensify.com", "description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.", From 67b9f35e2422d9f98edd77c388ffd1b4a55b0b76 Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Wed, 30 Oct 2024 12:52:17 +0100 Subject: [PATCH 29/33] fix: take merge commit for delta ref instead of head commit (as it may be out-dated comparing to latest changes in main) --- .github/workflows/e2ePerformanceTests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index 95accf9b391b..2111f777e852 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -60,7 +60,7 @@ jobs: id: getDeltaRef run: | if [ '${{ steps.getPullRequestDetails.outputs.IS_MERGED }}' == 'true' ]; then - echo "DELTA_REF=${{ steps.getPullRequestDetails.outputs.HEAD_COMMIT_SHA }}" >> "$GITHUB_OUTPUT" + echo "DELTA_REF=${{ steps.getPullRequestDetails.outputs.MERGE_COMMIT_SHA }}" >> "$GITHUB_OUTPUT" else # Set dummy git credentials git config --global user.email "test@test.com" From ae46c09f0d447cd8cd86efd7d7a26aeff345285d Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Wed, 30 Oct 2024 13:02:47 +0100 Subject: [PATCH 30/33] chore: just for tests --- .github/workflows/e2ePerformanceTests.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index 2111f777e852..248a97480e4b 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -32,22 +32,6 @@ jobs: with: fetch-depth: 0 # Fetches the entire history - - name: Determine "baseline ref" (prev merge commit) - id: getBaselineRef - run: | - # Get the name of the current branch - current_branch=$(git rev-parse --abbrev-ref HEAD) - - if [ "$current_branch" = "main" ]; then - # On the main branch, find the previous merge commit - previous_merge=$(git rev-list --merges HEAD~1 | head -n 1) - else - # On a feature branch, find the common ancestor of the current branch and main - previous_merge=$(git merge-base HEAD main) - fi - echo "$previous_merge" - echo "BASELINE_REF=$previous_merge" >> "$GITHUB_OUTPUT" - - name: Get pull request details id: getPullRequestDetails uses: ./.github/actions/javascript/getPullRequestDetails From 788c7d82b2248ae467fb7fcbff3e8b88353786ee Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Wed, 30 Oct 2024 13:07:43 +0100 Subject: [PATCH 31/33] chore: debug failure when run manually --- .github/workflows/e2ePerformanceTests.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index 248a97480e4b..804d97e3c53a 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -32,6 +32,24 @@ jobs: with: fetch-depth: 0 # Fetches the entire history + - name: Determine "baseline ref" (prev merge commit) + id: getBaselineRef + run: | + # Get the name of the current branch + current_branch=$(git rev-parse --abbrev-ref HEAD) + + echo "$current_branch" + + if [ "$current_branch" = "main" ]; then + # On the main branch, find the previous merge commit + previous_merge=$(git rev-list --merges HEAD~1 | head -n 1) + else + # On a feature branch, find the common ancestor of the current branch and main + previous_merge=$(git merge-base HEAD main) + fi + echo "$previous_merge" + echo "BASELINE_REF=$previous_merge" >> "$GITHUB_OUTPUT" + - name: Get pull request details id: getPullRequestDetails uses: ./.github/actions/javascript/getPullRequestDetails From 40fa4ef6c529b0c946be1f0299036fd90f5393be Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Wed, 30 Oct 2024 13:42:03 +0100 Subject: [PATCH 32/33] fix: pre-fetch main to be able to find `merge-base` --- .github/workflows/e2ePerformanceTests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index 804d97e3c53a..6249d9957f73 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -32,6 +32,9 @@ jobs: with: fetch-depth: 0 # Fetches the entire history + - name: Fetch main branch + run: git fetch origin main:main + - name: Determine "baseline ref" (prev merge commit) id: getBaselineRef run: | From 3387fe6cc5c53658b97bff5fc9bfe78b5230788a Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Wed, 30 Oct 2024 13:46:38 +0100 Subject: [PATCH 33/33] fix: remove debug code --- .github/workflows/e2ePerformanceTests.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index 6249d9957f73..6c13a0140b97 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -41,8 +41,6 @@ jobs: # Get the name of the current branch current_branch=$(git rev-parse --abbrev-ref HEAD) - echo "$current_branch" - if [ "$current_branch" = "main" ]; then # On the main branch, find the previous merge commit previous_merge=$(git rev-list --merges HEAD~1 | head -n 1)