From 2e5faefe6704a2a8bde2a546dd7710e8b1ba69a7 Mon Sep 17 00:00:00 2001 From: daledah Date: Mon, 12 Aug 2024 13:23:08 +0700 Subject: [PATCH 01/28] fix: remove Expensify employee from list participants --- .../MoneyRequestConfirmationList.tsx | 56 ++++++++++--------- src/libs/ReportUtils.ts | 4 +- .../iou/request/step/IOURequestStepAmount.tsx | 6 +- 3 files changed, 37 insertions(+), 29 deletions(-) diff --git a/src/components/MoneyRequestConfirmationList.tsx b/src/components/MoneyRequestConfirmationList.tsx index 8ab996dcbfe9..458e5fbbaca1 100755 --- a/src/components/MoneyRequestConfirmationList.tsx +++ b/src/components/MoneyRequestConfirmationList.tsx @@ -483,33 +483,35 @@ function MoneyRequestConfirmationList({ const currencySymbol = currencyList?.[iouCurrencyCode ?? '']?.symbol ?? iouCurrencyCode; const formattedTotalAmount = CurrencyUtils.convertToDisplayStringWithoutCurrency(iouAmount, iouCurrencyCode); - return [payeeOption, ...selectedParticipants].map((participantOption: Participant) => ({ - ...participantOption, - tabIndex: -1, - isSelected: false, - isInteractive: !shouldDisableParticipant(participantOption), - rightElement: ( - onSplitShareChange(participantOption.accountID ?? -1, Number(value))} - maxLength={formattedTotalAmount.length} - contentWidth={formattedTotalAmount.length * 8} - /> - ), - })); + return [payeeOption, ...selectedParticipants] + .filter((participantOption) => !PolicyUtils.isExpensifyTeam(participantOption.login)) + .map((participantOption: Participant) => ({ + ...participantOption, + tabIndex: -1, + isSelected: false, + isInteractive: !shouldDisableParticipant(participantOption), + rightElement: ( + onSplitShareChange(participantOption.accountID ?? -1, Number(value))} + maxLength={formattedTotalAmount.length} + contentWidth={formattedTotalAmount.length * 8} + /> + ), + })); }, [ isTypeSplit, payeePersonalDetails, diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 62e259b8f05c..968c88019ea2 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -6196,7 +6196,9 @@ function getMoneyRequestOptions(report: OnyxEntry, policy: OnyxEntry currentUserPersonalDetails?.accountID !== accountID); + const otherParticipants = reportParticipants.filter( + (accountID) => currentUserPersonalDetails?.accountID !== accountID && !PolicyUtils.isExpensifyTeam(allPersonalDetails?.[accountID]?.login), + ); const hasSingleParticipantInReport = otherParticipants.length === 1; let options: IOUType[] = []; diff --git a/src/pages/iou/request/step/IOURequestStepAmount.tsx b/src/pages/iou/request/step/IOURequestStepAmount.tsx index 069f86ce0899..a7457c88280d 100644 --- a/src/pages/iou/request/step/IOURequestStepAmount.tsx +++ b/src/pages/iou/request/step/IOURequestStepAmount.tsx @@ -10,6 +10,7 @@ import * as TransactionEdit from '@libs/actions/TransactionEdit'; import * as CurrencyUtils from '@libs/CurrencyUtils'; import Navigation from '@libs/Navigation/Navigation'; import * as OptionsListUtils from '@libs/OptionsListUtils'; +import * as PolicyUtils from '@libs/PolicyUtils'; import * as ReportUtils from '@libs/ReportUtils'; import * as TransactionUtils from '@libs/TransactionUtils'; import {getRequestType} from '@libs/TransactionUtils'; @@ -79,6 +80,7 @@ function IOURequestStepAmount({ const isSaveButtonPressed = useRef(false); const iouRequestType = getRequestType(transaction); const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID ?? -1}`); + const [allPersonalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST); const isEditing = action === CONST.IOU.ACTION.EDIT; const isSplitBill = iouType === CONST.IOU.TYPE.SPLIT; @@ -253,7 +255,9 @@ function IOURequestStepAmount({ } IOU.setMoneyRequestParticipantsFromReport(transactionID, report); if (isSplitBill && !report.isOwnPolicyExpenseChat && report.participants) { - const participantAccountIDs = Object.keys(report.participants).map((accountID) => Number(accountID)); + const participantAccountIDs = Object.keys(report.participants) + .map((accountID) => Number(accountID)) + .filter((accountID) => !PolicyUtils.isExpensifyTeam(allPersonalDetails?.[accountID]?.login)); IOU.setSplitShares(transaction, amountInSmallestCurrencyUnits, currency || CONST.CURRENCY.USD, participantAccountIDs); } navigateToConfirmationPage(); From 9e4d5da697a71051d70e0cee42cc66018fec6347 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Tue, 13 Aug 2024 23:36:35 +0300 Subject: [PATCH 02/28] prevented displaying disabled tag in money request view --- src/components/ReportActionItem/MoneyRequestView.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx index 13376c05a0f2..1d2facdecd4f 100644 --- a/src/components/ReportActionItem/MoneyRequestView.tsx +++ b/src/components/ReportActionItem/MoneyRequestView.tsx @@ -412,7 +412,13 @@ function MoneyRequestView({ ...parentReportAction?.errors, }; - const tagList = policyTagLists.map(({name, orderWeight}, index) => { + const tagList = policyTagLists.map(({name, orderWeight, tags}, index) => { + const tag = TransactionUtils.getTagForDisplay(updatedTransaction ?? transaction, index); + const shouldShowTag = !!tag || OptionsListUtils.hasEnabledOptions(tags); + if (!shouldShowTag) { + return null; + } + const tagError = getErrorForField( 'tag', { @@ -429,7 +435,7 @@ function MoneyRequestView({ > Date: Wed, 14 Aug 2024 00:38:52 +0300 Subject: [PATCH 03/28] fix lint --- src/components/ReportActionItem/MoneyRequestView.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx index 1d2facdecd4f..d7c693ea8446 100644 --- a/src/components/ReportActionItem/MoneyRequestView.tsx +++ b/src/components/ReportActionItem/MoneyRequestView.tsx @@ -414,8 +414,8 @@ function MoneyRequestView({ const tagList = policyTagLists.map(({name, orderWeight, tags}, index) => { const tag = TransactionUtils.getTagForDisplay(updatedTransaction ?? transaction, index); - const shouldShowTag = !!tag || OptionsListUtils.hasEnabledOptions(tags); - if (!shouldShowTag) { + const shouldShow = !!tag || OptionsListUtils.hasEnabledOptions(tags); + if (!shouldShow) { return null; } From c4adb96aecbfda021a549bc39b73b93676a310d2 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Thu, 15 Aug 2024 23:02:11 +0300 Subject: [PATCH 04/28] reused tagForDisplay variable --- src/components/ReportActionItem/MoneyRequestView.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx index d7c693ea8446..20450a434e95 100644 --- a/src/components/ReportActionItem/MoneyRequestView.tsx +++ b/src/components/ReportActionItem/MoneyRequestView.tsx @@ -413,8 +413,8 @@ function MoneyRequestView({ }; const tagList = policyTagLists.map(({name, orderWeight, tags}, index) => { - const tag = TransactionUtils.getTagForDisplay(updatedTransaction ?? transaction, index); - const shouldShow = !!tag || OptionsListUtils.hasEnabledOptions(tags); + const tagForDisplay = TransactionUtils.getTagForDisplay(updatedTransaction ?? transaction, index); + const shouldShow = !!tagForDisplay || OptionsListUtils.hasEnabledOptions(tags); if (!shouldShow) { return null; } @@ -426,7 +426,7 @@ function MoneyRequestView({ tagListName: name, }, PolicyUtils.hasDependentTags(policy, policyTagList), - TransactionUtils.getTagForDisplay(updatedTransaction ?? transaction, index), + tagForDisplay, ); return ( Date: Sat, 17 Aug 2024 04:27:43 +0500 Subject: [PATCH 05/28] redirect to proper place after upgrade --- src/pages/workspace/categories/CategoryGLCodePage.tsx | 2 +- src/pages/workspace/categories/CategoryPayrollCodePage.tsx | 2 +- src/pages/workspace/tags/TagGLCodePage.tsx | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pages/workspace/categories/CategoryGLCodePage.tsx b/src/pages/workspace/categories/CategoryGLCodePage.tsx index 12660597247f..131f17a14242 100644 --- a/src/pages/workspace/categories/CategoryGLCodePage.tsx +++ b/src/pages/workspace/categories/CategoryGLCodePage.tsx @@ -38,7 +38,7 @@ function CategoryGLCodePage({route}: EditCategoryPageProps) { if (newGLCode !== glCode) { Category.setPolicyCategoryGLCode(route.params.policyID, categoryName, newGLCode); } - Navigation.dismissModal(); + Navigation.goBack(ROUTES.WORKSPACE_CATEGORY_SETTINGS.getRoute(route.params.policyID, categoryName)); }, [categoryName, glCode, route.params.policyID], ); diff --git a/src/pages/workspace/categories/CategoryPayrollCodePage.tsx b/src/pages/workspace/categories/CategoryPayrollCodePage.tsx index a72e4238d91b..df5ba802a566 100644 --- a/src/pages/workspace/categories/CategoryPayrollCodePage.tsx +++ b/src/pages/workspace/categories/CategoryPayrollCodePage.tsx @@ -38,7 +38,7 @@ function CategoryPayrollCodePage({route}: EditCategoryPageProps) { if (newPayrollCode !== payrollCode) { Category.setPolicyCategoryPayrollCode(route.params.policyID, categoryName, newPayrollCode); } - Navigation.dismissModal(); + Navigation.goBack(ROUTES.WORKSPACE_CATEGORY_SETTINGS.getRoute(route.params.policyID, categoryName)); }, [categoryName, payrollCode, route.params.policyID], ); diff --git a/src/pages/workspace/tags/TagGLCodePage.tsx b/src/pages/workspace/tags/TagGLCodePage.tsx index 895275e1c112..54e5c034ca07 100644 --- a/src/pages/workspace/tags/TagGLCodePage.tsx +++ b/src/pages/workspace/tags/TagGLCodePage.tsx @@ -18,6 +18,7 @@ import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import * as Tag from '@userActions/Policy/Tag'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; +import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/WorkspaceTagForm'; import type {PolicyTagLists} from '@src/types/onyx'; @@ -45,7 +46,7 @@ function TagGLCodePage({route, policyTags}: EditTagGLCodePageProps) { if (newGLCode !== glCode) { Tag.setPolicyTagGLCode(route.params.policyID, tagName, orderWeight, newGLCode); } - Navigation.dismissModal(); + Navigation.goBack(ROUTES.WORKSPACE_TAG_SETTINGS.getRoute(route.params.policyID, orderWeight, tagName)); }, [glCode, route.params.policyID, tagName, orderWeight], ); From a5bf00dfae07701e3a5c8f4e2f74ade742d06d60 Mon Sep 17 00:00:00 2001 From: hurali97 Date: Tue, 20 Aug 2024 13:26:56 +0500 Subject: [PATCH 06/28] fix: cannot read property routes of undefined --- .../setupCustomAndroidBackHandler/index.android.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/libs/Navigation/setupCustomAndroidBackHandler/index.android.ts b/src/libs/Navigation/setupCustomAndroidBackHandler/index.android.ts index 10aa8b99a484..107dae2bb74c 100644 --- a/src/libs/Navigation/setupCustomAndroidBackHandler/index.android.ts +++ b/src/libs/Navigation/setupCustomAndroidBackHandler/index.android.ts @@ -13,8 +13,7 @@ type SearchPageProps = StackScreenProps { const rootState = navigationRef.getRootState(); - - const bottomTabRoute = rootState.routes.find((route) => route.name === NAVIGATORS.BOTTOM_TAB_NAVIGATOR); + const bottomTabRoute = rootState?.routes?.find((route) => route.name === NAVIGATORS.BOTTOM_TAB_NAVIGATOR); const bottomTabRoutes = bottomTabRoute?.state?.routes; const focusedRoute = findFocusedRoute(rootState); @@ -23,7 +22,7 @@ function setupCustomAndroidBackHandler() { return false; } - const isLastScreenOnStack = bottomTabRoutes.length === 1 && rootState.routes.length === 1; + const isLastScreenOnStack = bottomTabRoutes.length === 1 && rootState?.routes?.length === 1; if (NativeModules.HybridAppModule && isLastScreenOnStack) { NativeModules.HybridAppModule.exitApp(); @@ -35,7 +34,7 @@ function setupCustomAndroidBackHandler() { navigationRef.dispatch({...StackActions.pop(), target: bottomTabRoute?.state?.key}); navigationRef.dispatch({...StackActions.pop()}); - const centralPaneRouteAfterPop = getTopmostCentralPaneRoute({routes: [rootState.routes.at(-2)]} as State); + const centralPaneRouteAfterPop = getTopmostCentralPaneRoute({routes: [rootState?.routes?.at(-2)]} as State); const bottomTabRouteAfterPop = bottomTabRoutes.at(-2); // It's possible that central pane search is desynchronized with the bottom tab search. @@ -57,7 +56,7 @@ function setupCustomAndroidBackHandler() { // It's possible that central pane search is desynchronized with the bottom tab search. // e.g. opening a tab different than search will wipe out central pane screens. // In that case we have to push the proper one. - if (bottomTabRoutes && bottomTabRoutes?.length >= 2 && bottomTabRoutes[bottomTabRoutes.length - 2].name === SCREENS.SEARCH.BOTTOM_TAB && rootState.routes.length === 1) { + if (bottomTabRoutes && bottomTabRoutes?.length >= 2 && bottomTabRoutes[bottomTabRoutes.length - 2].name === SCREENS.SEARCH.BOTTOM_TAB && rootState?.routes?.length === 1) { const {policyID, ...restParams} = bottomTabRoutes[bottomTabRoutes.length - 2].params as SearchPageProps['route']['params']; navigationRef.dispatch({...StackActions.push(SCREENS.SEARCH.CENTRAL_PANE, {...restParams, policyIDs: policyID})}); navigationRef.dispatch({...StackActions.pop(), target: bottomTabRoute?.state?.key}); From 7bbf7d2a0760723d4419d35ce9b3a9af7ae26df6 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Tue, 20 Aug 2024 17:16:13 +0530 Subject: [PATCH 07/28] fix: Chat - Unable to deselect user using The Tab key. Signed-off-by: krishna2323 --- .../Attachments/AttachmentCarousel/CarouselItem.tsx | 2 +- .../AttachmentView/AttachmentViewImage/index.tsx | 2 +- src/components/AvatarWithImagePicker.tsx | 2 +- .../HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx | 2 +- src/components/PDFView/index.native.tsx | 2 +- src/components/PDFView/index.tsx | 2 +- src/components/ReferralProgramCTA.tsx | 4 ++-- src/components/RoomHeaderAvatars.tsx | 4 ++-- src/components/TextLink.tsx | 2 +- src/components/VideoPlayerPreview/VideoPlayerThumbnail.tsx | 2 +- src/pages/NewChatPage.tsx | 4 ++-- src/pages/ProfilePage.tsx | 2 +- .../iou/request/step/IOURequestStepScan/index.native.tsx | 6 +++--- src/pages/iou/request/step/IOURequestStepScan/index.tsx | 6 +++--- 14 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/components/Attachments/AttachmentCarousel/CarouselItem.tsx b/src/components/Attachments/AttachmentCarousel/CarouselItem.tsx index a9b5dfb7feb6..453b7b4fd106 100644 --- a/src/components/Attachments/AttachmentCarousel/CarouselItem.tsx +++ b/src/components/Attachments/AttachmentCarousel/CarouselItem.tsx @@ -58,7 +58,7 @@ function CarouselItem({item, onPress, isFocused, isModalHovered}: CarouselItemPr diff --git a/src/components/Attachments/AttachmentView/AttachmentViewImage/index.tsx b/src/components/Attachments/AttachmentView/AttachmentViewImage/index.tsx index c195c1e34554..0ec2bb5ef0b5 100644 --- a/src/components/Attachments/AttachmentView/AttachmentViewImage/index.tsx +++ b/src/components/Attachments/AttachmentView/AttachmentViewImage/index.tsx @@ -34,7 +34,7 @@ function AttachmentViewImage({url, file, isAuthTokenRequired, loadComplete, onPr onPress={onPress} disabled={loadComplete} style={[styles.flex1, styles.flexRow, styles.alignSelfStretch]} - accessibilityRole={CONST.ACCESSIBILITY_ROLE.IMAGEBUTTON} + accessibilityRole={CONST.ROLE.BUTTON} // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing accessibilityLabel={file?.name || translate('attachmentView.unknownFilename')} > diff --git a/src/components/AvatarWithImagePicker.tsx b/src/components/AvatarWithImagePicker.tsx index a1b8524dd293..337bbaf98ca1 100644 --- a/src/components/AvatarWithImagePicker.tsx +++ b/src/components/AvatarWithImagePicker.tsx @@ -368,7 +368,7 @@ function AvatarWithImagePicker({ > onPressAvatar(openPicker)} - accessibilityRole={CONST.ACCESSIBILITY_ROLE.IMAGEBUTTON} + accessibilityRole={CONST.ROLE.BUTTON} accessibilityLabel={translate('avatarWithImagePicker.editImage')} disabled={isAvatarCropModalOpen || (disabled && !enablePreview)} disabledStyle={disabledStyle} diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx b/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx index 1e73cce1630f..aedd0747fd7a 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx +++ b/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx @@ -97,7 +97,7 @@ function ImageRenderer({tnode}: ImageRendererProps) { showContextMenuForReport(event, anchor, report?.reportID ?? '-1', action, checkIfContextMenuActive, ReportUtils.isArchivedRoom(report, reportNameValuePairs)) } shouldUseHapticsOnLongPress - accessibilityRole={CONST.ACCESSIBILITY_ROLE.IMAGEBUTTON} + accessibilityRole={CONST.ROLE.BUTTON} accessibilityLabel={translate('accessibilityHints.viewAttachment')} > {thumbnailImageComponent} diff --git a/src/components/PDFView/index.native.tsx b/src/components/PDFView/index.native.tsx index 55f85aa74b37..44ef894cb994 100644 --- a/src/components/PDFView/index.native.tsx +++ b/src/components/PDFView/index.native.tsx @@ -172,7 +172,7 @@ function PDFView({onToggleKeyboard, onLoadComplete, fileName, onPress, isFocused onPress={onPress} fullDisabled={successToLoadPDF} style={[themeStyles.flex1, themeStyles.alignSelfStretch, !failedToLoadPDF && themeStyles.flexRow]} - accessibilityRole={CONST.ACCESSIBILITY_ROLE.IMAGEBUTTON} + accessibilityRole={CONST.ROLE.BUTTON} // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing accessibilityLabel={fileName || translate('attachmentView.unknownFilename')} > diff --git a/src/components/PDFView/index.tsx b/src/components/PDFView/index.tsx index 2edf699affab..69d886dc7c37 100644 --- a/src/components/PDFView/index.tsx +++ b/src/components/PDFView/index.tsx @@ -131,7 +131,7 @@ function PDFView({onToggleKeyboard, fileName, onPress, isFocused, sourceURL, max diff --git a/src/components/ReferralProgramCTA.tsx b/src/components/ReferralProgramCTA.tsx index 086b875451c0..808df9c4d94d 100644 --- a/src/components/ReferralProgramCTA.tsx +++ b/src/components/ReferralProgramCTA.tsx @@ -54,7 +54,7 @@ function ReferralProgramCTA({referralContentType, style, onDismiss}: ReferralPro }} style={[styles.br2, styles.highlightBG, styles.flexRow, styles.justifyContentBetween, styles.alignItemsCenter, {gap: 10, padding: 10}, styles.pl5, style]} accessibilityLabel="referral" - role={CONST.ACCESSIBILITY_ROLE.BUTTON} + role={CONST.ROLE.BUTTON} > {translate(`referralProgram.${referralContentType}.buttonText1`)} @@ -72,7 +72,7 @@ function ReferralProgramCTA({referralContentType, style, onDismiss}: ReferralPro e.preventDefault(); }} style={[styles.touchableButtonImage]} - role={CONST.ACCESSIBILITY_ROLE.BUTTON} + role={CONST.ROLE.BUTTON} accessibilityLabel={translate('common.close')} > navigateToAvatarPage(icons[0])} - accessibilityRole={CONST.ACCESSIBILITY_ROLE.IMAGEBUTTON} + accessibilityRole={CONST.ROLE.BUTTON} accessibilityLabel={icons[0].name ?? ''} disabled={icons[0].source === Expensicons.FallbackAvatar} > @@ -77,7 +77,7 @@ function RoomHeaderAvatars({icons, reportID}: RoomHeaderAvatarsProps) { navigateToAvatarPage(icon)} - accessibilityRole={CONST.ACCESSIBILITY_ROLE.IMAGEBUTTON} + accessibilityRole={CONST.ROLE.BUTTON} accessibilityLabel={icon.name ?? ''} disabled={icon.source === Expensicons.FallbackAvatar} > diff --git a/src/components/TextLink.tsx b/src/components/TextLink.tsx index b6ffb14753c1..2d390f9811e6 100644 --- a/src/components/TextLink.tsx +++ b/src/components/TextLink.tsx @@ -62,7 +62,7 @@ function TextLink({href, onPress, children, style, onMouseDown = (event) => even return ( DeviceCapabilities.canUseTouchScreen() && ControlSelection.block()} onPressOut={() => ControlSelection.unblock()} diff --git a/src/pages/NewChatPage.tsx b/src/pages/NewChatPage.tsx index 805fd90ab369..77611e269928 100755 --- a/src/pages/NewChatPage.tsx +++ b/src/pages/NewChatPage.tsx @@ -255,8 +255,8 @@ function NewChatPage({isGroupChat}: NewChatPageProps) { toggleOption(item)} disabled={item.isDisabled} - role={CONST.ACCESSIBILITY_ROLE.CHECKBOX} - accessibilityLabel={CONST.ACCESSIBILITY_ROLE.CHECKBOX} + role={CONST.ROLE.BUTTON} + accessibilityLabel={CONST.ROLE.BUTTON} style={[styles.flexRow, styles.alignItemsCenter, styles.ml3]} > diff --git a/src/pages/ProfilePage.tsx b/src/pages/ProfilePage.tsx index d172e2089983..8b12ae4b63ab 100755 --- a/src/pages/ProfilePage.tsx +++ b/src/pages/ProfilePage.tsx @@ -197,7 +197,7 @@ function ProfilePage({route}: ProfilePageProps) { style={[styles.noOutline, styles.mb4]} onPress={() => Navigation.navigate(ROUTES.PROFILE_AVATAR.getRoute(String(accountID)))} accessibilityLabel={translate('common.profile')} - accessibilityRole={CONST.ACCESSIBILITY_ROLE.IMAGEBUTTON} + accessibilityRole={CONST.ROLE.BUTTON} disabled={!hasAvatar} > diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx index 528b3ab1e88f..9c24e92689cc 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx @@ -552,7 +552,7 @@ function IOURequestStepScan({ {({openPicker}) => ( { @@ -571,7 +571,7 @@ function IOURequestStepScan({ )} {hasFlash && ( ( { openPicker({ onPicked: setReceiptAndNavigate, @@ -619,7 +619,7 @@ function IOURequestStepScan({ )} Date: Wed, 21 Aug 2024 03:40:25 +0530 Subject: [PATCH 08/28] update CONST.ACCESSIBILITY_ROLE to CONST.ROLE Signed-off-by: krishna2323 --- src/components/Button/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Button/index.tsx b/src/components/Button/index.tsx index 1441266c76de..72746aa1f65d 100644 --- a/src/components/Button/index.tsx +++ b/src/components/Button/index.tsx @@ -137,13 +137,13 @@ type ButtonProps = Partial & { type KeyboardShortcutComponentProps = Pick; -const accessibilityRoles: string[] = Object.values(CONST.ACCESSIBILITY_ROLE); +const accessibilityRoles: string[] = Object.values(CONST.ROLE); function KeyboardShortcutComponent({isDisabled = false, isLoading = false, onPress = () => {}, pressOnEnter, allowBubble, enterKeyEventListenerPriority}: KeyboardShortcutComponentProps) { const isFocused = useIsFocused(); const activeElementRole = useActiveElementRole(); - const shouldDisableEnterShortcut = useMemo(() => accessibilityRoles.includes(activeElementRole ?? '') && activeElementRole !== CONST.ACCESSIBILITY_ROLE.TEXT, [activeElementRole]); + const shouldDisableEnterShortcut = useMemo(() => accessibilityRoles.includes(activeElementRole ?? '') && activeElementRole !== CONST.ROLE.PRESENTATION, [activeElementRole]); const keyboardShortcutCallback = useCallback( (event?: GestureResponderEvent | KeyboardEvent) => { From 779fbb387a0944f77729477d14f261142d31a0c8 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Wed, 21 Aug 2024 10:56:28 +0800 Subject: [PATCH 09/28] update to fix autolink doesn't work if put before img markdown --- ios/Podfile.lock | 8 ++++---- package-lock.json | 16 ++++++++-------- package.json | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index e665278197b6..0b1847863a3f 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1871,7 +1871,7 @@ PODS: - RNGoogleSignin (10.0.1): - GoogleSignIn (~> 7.0) - React-Core - - RNLiveMarkdown (0.1.113): + - RNLiveMarkdown (0.1.116): - glog - hermes-engine - RCT-Folly (= 2022.05.16.00) @@ -1889,9 +1889,9 @@ PODS: - React-utils - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - - RNLiveMarkdown/common (= 0.1.113) + - RNLiveMarkdown/common (= 0.1.116) - Yoga - - RNLiveMarkdown/common (0.1.113): + - RNLiveMarkdown/common (0.1.116): - glog - hermes-engine - RCT-Folly (= 2022.05.16.00) @@ -2614,7 +2614,7 @@ SPEC CHECKSUMS: RNFS: 4ac0f0ea233904cb798630b3c077808c06931688 RNGestureHandler: 74b7b3d06d667ba0bbf41da7718f2607ae0dfe8f RNGoogleSignin: ccaa4a81582cf713eea562c5dd9dc1961a715fd0 - RNLiveMarkdown: 235376cd828014e8bad6949ea5bb202688fa5bb0 + RNLiveMarkdown: 19b5b73960ca70a47582c9376bb20e6dc52f021e RNLocalize: d4b8af4e442d4bcca54e68fc687a2129b4d71a81 rnmapbox-maps: df8fe93dbd251f25022f4023d31bc04160d4d65c RNPermissions: d2392b754e67bc14491f5b12588bef2864e783f3 diff --git a/package-lock.json b/package-lock.json index 4c0b1948c009..47ed9331a4bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@babel/plugin-proposal-private-methods": "^7.18.6", "@babel/plugin-proposal-private-property-in-object": "^7.21.11", "@dotlottie/react-player": "^1.6.3", - "@expensify/react-native-live-markdown": "^0.1.113", + "@expensify/react-native-live-markdown": "^0.1.115", "@expo/metro-runtime": "~3.1.1", "@formatjs/intl-datetimeformat": "^6.10.0", "@formatjs/intl-listformat": "^7.2.2", @@ -55,7 +55,7 @@ "date-fns-tz": "^2.0.0", "dom-serializer": "^0.2.2", "domhandler": "^4.3.0", - "expensify-common": "2.0.72", + "expensify-common": "2.0.76", "expo": "^50.0.3", "expo-av": "~13.10.4", "expo-image": "1.11.0", @@ -3952,9 +3952,9 @@ } }, "node_modules/@expensify/react-native-live-markdown": { - "version": "0.1.113", - "resolved": "https://registry.npmjs.org/@expensify/react-native-live-markdown/-/react-native-live-markdown-0.1.113.tgz", - "integrity": "sha512-MeZTqW1Dd2oUAVmedaU6p/TE+mmhWibSkcz8VC10PyCn6HkwO7ZykaSXMjsJHoUyvx9vYaG/4iF9enWXe4+h5w==", + "version": "0.1.116", + "resolved": "https://registry.npmjs.org/@expensify/react-native-live-markdown/-/react-native-live-markdown-0.1.116.tgz", + "integrity": "sha512-+l3SarKLyHUaeRWl+FU/Hrjk0iz5Caeps+aBfQgR5T1XQITDYtpSAruy4ZCw0R0wC6l7c44z8tDU7g5Biniq+A==", "workspaces": [ "parser", "example", @@ -26135,9 +26135,9 @@ } }, "node_modules/expensify-common": { - "version": "2.0.72", - "resolved": "https://registry.npmjs.org/expensify-common/-/expensify-common-2.0.72.tgz", - "integrity": "sha512-/mrlSic8y3D7pbbGMe3ZtDhHOS+WmrqgBEy3P/o9qW6CFpczs9cqjp9DfF8L53qvGtiD7cm5au4tapj01Yas/g==", + "version": "2.0.76", + "resolved": "https://registry.npmjs.org/expensify-common/-/expensify-common-2.0.76.tgz", + "integrity": "sha512-nCM6laaj25kurdiD9rhAXmQKhi8eciIFlshN8P4A7gsjFIScXnRG8fwXM5tX+8ET0vqAOA2SACeNVTT3vGUUsQ==", "dependencies": { "awesome-phonenumber": "^5.4.0", "classnames": "2.5.0", diff --git a/package.json b/package.json index 679ca1793b2d..179e3162c214 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "@babel/plugin-proposal-private-methods": "^7.18.6", "@babel/plugin-proposal-private-property-in-object": "^7.21.11", "@dotlottie/react-player": "^1.6.3", - "@expensify/react-native-live-markdown": "^0.1.113", + "@expensify/react-native-live-markdown": "^0.1.115", "@expo/metro-runtime": "~3.1.1", "@formatjs/intl-datetimeformat": "^6.10.0", "@formatjs/intl-listformat": "^7.2.2", @@ -111,7 +111,7 @@ "date-fns-tz": "^2.0.0", "dom-serializer": "^0.2.2", "domhandler": "^4.3.0", - "expensify-common": "2.0.72", + "expensify-common": "2.0.76", "expo": "^50.0.3", "expo-av": "~13.10.4", "expo-image": "1.11.0", From 7c045ab7b966a05d6a8063f9f5c5bd3fffd62941 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Wed, 21 Aug 2024 10:56:38 +0800 Subject: [PATCH 10/28] pass alt to the image --- .../HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx | 2 ++ src/components/ImageWithSizeCalculation.tsx | 6 +++++- src/components/ThumbnailImage.tsx | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx b/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx index 1e73cce1630f..5eb7290fa3aa 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx +++ b/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx @@ -57,6 +57,7 @@ function ImageRenderer({tnode}: ImageRendererProps) { const previewSource = tryResolveUrlFromApiRoot(htmlAttribs.src); const source = tryResolveUrlFromApiRoot(isAttachmentOrReceipt ? attachmentSourceAttribute : htmlAttribs.src); + const alt = htmlAttribs.alt const imageWidth = (htmlAttribs['data-expensify-width'] && parseInt(htmlAttribs['data-expensify-width'], 10)) || undefined; const imageHeight = (htmlAttribs['data-expensify-height'] && parseInt(htmlAttribs['data-expensify-height'], 10)) || undefined; const imagePreviewModalDisabled = htmlAttribs['data-expensify-preview-modal-disabled'] === 'true'; @@ -71,6 +72,7 @@ function ImageRenderer({tnode}: ImageRendererProps) { fallbackIcon={fallbackIcon} imageWidth={imageWidth} imageHeight={imageHeight} + altText={alt} /> ); diff --git a/src/components/ImageWithSizeCalculation.tsx b/src/components/ImageWithSizeCalculation.tsx index 3d940103715d..c25ce07f44be 100644 --- a/src/components/ImageWithSizeCalculation.tsx +++ b/src/components/ImageWithSizeCalculation.tsx @@ -25,6 +25,9 @@ type ImageWithSizeCalculationProps = { /** Url for image to display */ url: string | ImageSourcePropType; + /** alt text for the image */ + altText: string; + /** Any additional styles to apply */ style?: StyleProp; @@ -46,7 +49,7 @@ type ImageWithSizeCalculationProps = { * performing some calculation on a network image after fetching dimensions so * it can be appropriately resized. */ -function ImageWithSizeCalculation({url, style, onMeasure, onLoadFailure, isAuthTokenRequired, objectPosition = CONST.IMAGE_OBJECT_POSITION.INITIAL}: ImageWithSizeCalculationProps) { +function ImageWithSizeCalculation({url, altText, style, onMeasure, onLoadFailure, isAuthTokenRequired, objectPosition = CONST.IMAGE_OBJECT_POSITION.INITIAL}: ImageWithSizeCalculationProps) { const styles = useThemeStyles(); const isLoadedRef = useRef(null); const [isImageCached, setIsImageCached] = useState(true); @@ -97,6 +100,7 @@ function ImageWithSizeCalculation({url, style, onMeasure, onLoadFailure, isAuthT { diff --git a/src/components/ThumbnailImage.tsx b/src/components/ThumbnailImage.tsx index 04d0200ea228..d457d0ae5dd7 100644 --- a/src/components/ThumbnailImage.tsx +++ b/src/components/ThumbnailImage.tsx @@ -23,6 +23,9 @@ type ThumbnailImageProps = { /** Source URL for the preview image */ previewSourceURL: string | ImageSourcePropType; + /** alt text for the image */ + altText: string; + /** Any additional styles to apply */ style?: StyleProp; @@ -61,6 +64,7 @@ type UpdateImageSizeParams = { function ThumbnailImage({ previewSourceURL, + altText, style, isAuthTokenRequired, imageWidth = 200, @@ -132,6 +136,7 @@ function ThumbnailImage({ setFailedToLoad(true)} isAuthTokenRequired={isAuthTokenRequired} From f830c70838c4164de83335479f2c5d764935e4cb Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Wed, 21 Aug 2024 11:06:12 +0800 Subject: [PATCH 11/28] prettier --- .../HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx b/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx index 5eb7290fa3aa..12e2f11d943a 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx +++ b/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx @@ -57,7 +57,7 @@ function ImageRenderer({tnode}: ImageRendererProps) { const previewSource = tryResolveUrlFromApiRoot(htmlAttribs.src); const source = tryResolveUrlFromApiRoot(isAttachmentOrReceipt ? attachmentSourceAttribute : htmlAttribs.src); - const alt = htmlAttribs.alt + const alt = htmlAttribs.alt; const imageWidth = (htmlAttribs['data-expensify-width'] && parseInt(htmlAttribs['data-expensify-width'], 10)) || undefined; const imageHeight = (htmlAttribs['data-expensify-height'] && parseInt(htmlAttribs['data-expensify-height'], 10)) || undefined; const imagePreviewModalDisabled = htmlAttribs['data-expensify-preview-modal-disabled'] === 'true'; From cdf7fc70daa9983ca23c4aaf0db97c102b3dbc62 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Wed, 21 Aug 2024 11:12:56 +0800 Subject: [PATCH 12/28] typing --- src/components/ImageWithSizeCalculation.tsx | 2 +- src/components/ThumbnailImage.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/ImageWithSizeCalculation.tsx b/src/components/ImageWithSizeCalculation.tsx index c25ce07f44be..ebea1a90efca 100644 --- a/src/components/ImageWithSizeCalculation.tsx +++ b/src/components/ImageWithSizeCalculation.tsx @@ -26,7 +26,7 @@ type ImageWithSizeCalculationProps = { url: string | ImageSourcePropType; /** alt text for the image */ - altText: string; + altText?: string; /** Any additional styles to apply */ style?: StyleProp; diff --git a/src/components/ThumbnailImage.tsx b/src/components/ThumbnailImage.tsx index d457d0ae5dd7..cea528e4537c 100644 --- a/src/components/ThumbnailImage.tsx +++ b/src/components/ThumbnailImage.tsx @@ -24,7 +24,7 @@ type ThumbnailImageProps = { previewSourceURL: string | ImageSourcePropType; /** alt text for the image */ - altText: string; + altText?: string; /** Any additional styles to apply */ style?: StyleProp; From 963b00b6987e1a72a460984188630255a58d81c7 Mon Sep 17 00:00:00 2001 From: Agata Kosior Date: Wed, 21 Aug 2024 13:06:56 +0200 Subject: [PATCH 13/28] fix: navigate back to expensify card page after issuing, show only cards assigned to the member in details --- .../WorkspaceExpensifyCardPageEmptyState.tsx | 2 +- .../expensifyCard/issueNew/ConfirmationStep.tsx | 3 ++- .../members/WorkspaceMemberDetailsPage.tsx | 14 ++++++++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx index 15ad69b3ba13..4d4a2927d194 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx @@ -50,7 +50,7 @@ function WorkspaceExpensifyCardPageEmptyState({route, policy}: WorkspaceExpensif const eligibleBankAccounts = CardUtils.getEligibleBankAccountsForCard(bankAccountList ?? {}); const reimbursementAccountStatus = reimbursementAccount?.achData?.state ?? ''; - const isSetupUnfinished = isEmptyObject(bankAccountList) && reimbursementAccountStatus !== CONST.BANK_ACCOUNT.STATE.OPEN; + const isSetupUnfinished = isEmptyObject(bankAccountList) && reimbursementAccountStatus && reimbursementAccountStatus !== CONST.BANK_ACCOUNT.STATE.OPEN; const startFlow = useCallback(() => { if (!eligibleBankAccounts.length || isSetupUnfinished) { diff --git a/src/pages/workspace/expensifyCard/issueNew/ConfirmationStep.tsx b/src/pages/workspace/expensifyCard/issueNew/ConfirmationStep.tsx index 75758e84e62c..aed246227d7d 100644 --- a/src/pages/workspace/expensifyCard/issueNew/ConfirmationStep.tsx +++ b/src/pages/workspace/expensifyCard/issueNew/ConfirmationStep.tsx @@ -18,6 +18,7 @@ import Navigation from '@navigation/Navigation'; import * as Card from '@userActions/Card'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; +import ROUTES from '@src/ROUTES'; import type {IssueNewCardStep} from '@src/types/onyx/Card'; type ConfirmationStepProps = { @@ -36,7 +37,7 @@ function ConfirmationStep({policyID}: ConfirmationStepProps) { const submit = () => { Card.issueExpensifyCard(policyID, CONST.COUNTRY.US, data); - Navigation.goBack(); + Navigation.navigate(ROUTES.WORKSPACE_EXPENSIFY_CARD.getRoute(policyID ?? '-1')); Card.clearIssueNewCardFlow(); }; diff --git a/src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx b/src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx index 2742033430ba..60216745c11e 100644 --- a/src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx +++ b/src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx @@ -75,12 +75,22 @@ function WorkspaceMemberDetailsPage({personalDetails, policy, route}: WorkspaceM const ownerDetails = personalDetails?.[policy?.ownerAccountID ?? -1] ?? ({} as PersonalDetails); const policyOwnerDisplayName = ownerDetails.displayName ?? policy?.owner ?? ''; + const memberCards = useMemo(() => { + if (!cardsList) { + return []; + } + return Object.values(cardsList).filter((card) => card.accountID === accountID); + }, [cardsList, accountID]); + const confirmModalPrompt = useMemo(() => { const isApprover = Member.isApprover(policy, accountID); if (!isApprover) { return translate('workspace.people.removeMemberPrompt', {memberName: displayName}); } - return translate('workspace.people.removeMembersWarningPrompt', {memberName: displayName, ownerName: policyOwnerDisplayName}); + return translate('workspace.people.removeMembersWarningPrompt', { + memberName: displayName, + ownerName: policyOwnerDisplayName, + }); }, [accountID, policy, displayName, policyOwnerDisplayName, translate]); const roleItems: ListItemType[] = useMemo( @@ -259,7 +269,7 @@ function WorkspaceMemberDetailsPage({personalDetails, policy, route}: WorkspaceM {translate('walletPage.assignedCards')} - {Object.values(cardsList ?? {}).map((card) => ( + {memberCards.map((card) => ( Date: Wed, 21 Aug 2024 15:38:47 +0200 Subject: [PATCH 14/28] fix: return to proper page from issuenew card flow --- src/pages/workspace/expensifyCard/issueNew/AssigneeStep.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/expensifyCard/issueNew/AssigneeStep.tsx b/src/pages/workspace/expensifyCard/issueNew/AssigneeStep.tsx index 3190c4ba295c..de7fddefa9dc 100644 --- a/src/pages/workspace/expensifyCard/issueNew/AssigneeStep.tsx +++ b/src/pages/workspace/expensifyCard/issueNew/AssigneeStep.tsx @@ -57,7 +57,7 @@ function AssigneeStep({policy}: AssigneeStepProps) { Card.setIssueNewCardStepAndData({step: CONST.EXPENSIFY_CARD.STEP.CONFIRMATION, isEditing: false}); return; } - Navigation.navigate(ROUTES.WORKSPACE_EXPENSIFY_CARD.getRoute(policy?.id ?? '-1')); + Navigation.goBack(); Card.clearIssueNewCardFlow(); }; From b3f00c76477648cd76c98dbf673f5d28129ab90d Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Thu, 22 Aug 2024 01:05:47 +0700 Subject: [PATCH 15/28] adjust all selected --- .../workspace/reportFields/ReportFieldsListValuesPage.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/workspace/reportFields/ReportFieldsListValuesPage.tsx b/src/pages/workspace/reportFields/ReportFieldsListValuesPage.tsx index 61967a729cd3..95c06b2331e9 100644 --- a/src/pages/workspace/reportFields/ReportFieldsListValuesPage.tsx +++ b/src/pages/workspace/reportFields/ReportFieldsListValuesPage.tsx @@ -116,9 +116,9 @@ function ReportFieldsListValuesPage({ }; const toggleAllValues = () => { - const isAllSelected = listValues.length === Object.keys(selectedValues).length; + const areAllSelected = listValues.length === selectedValuesArray.length; - setSelectedValues(isAllSelected ? {} : Object.fromEntries(listValues.map((value) => [value, true]))); + setSelectedValues(areAllSelected ? {} : Object.fromEntries(listValues.map((value) => [value, true]))); }; const handleDeleteValues = () => { @@ -176,7 +176,7 @@ function ReportFieldsListValuesPage({ const getHeaderButtons = () => { const options: Array>> = []; - if ((isSmallScreenWidth ? selectionMode?.isEnabled : true) && selectedValuesArray.length > 0) { + if (isSmallScreenWidth ? selectionMode?.isEnabled : selectedValuesArray.length > 0) { if (selectedValuesArray.length > 0) { options.push({ icon: Expensicons.Trashcan, From 98fa00ecbf59fdc94cd5536a8bf2b17e35ec4dc9 Mon Sep 17 00:00:00 2001 From: Anusha Date: Thu, 22 Aug 2024 00:51:12 +0500 Subject: [PATCH 16/28] fix hold rbr --- src/libs/actions/IOU.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index bbb6e3c48fcd..d68c4c39521a 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -7617,7 +7617,9 @@ function putOnHold(transactionID: string, comment: string, reportID: string) { const currentTime = DateUtils.getDBTime(); const createdReportAction = ReportUtils.buildOptimisticHoldReportAction(currentTime); const createdReportActionComment = ReportUtils.buildOptimisticHoldReportActionComment(comment, DateUtils.addMillisecondsFromDateTime(currentTime, 1)); - + const newViolation = {name: CONST.VIOLATIONS.HOLD, type: CONST.VIOLATION_TYPES.VIOLATION}; + const transactionViolations = allTransactionViolations[`${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`] ?? []; + const updatedViolations = [...transactionViolations, newViolation]; const optimisticData: OnyxUpdate[] = [ { onyxMethod: Onyx.METHOD.MERGE, @@ -7637,6 +7639,11 @@ function putOnHold(transactionID: string, comment: string, reportID: string) { }, }, }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`, + value: updatedViolations, + }, ]; const successData: OnyxUpdate[] = [ From 4789618471f8a1663a58a3e54358b05aff03f143 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Thu, 22 Aug 2024 05:57:00 +0530 Subject: [PATCH 17/28] remove ACCESSIBILITY_ROLE constant. Signed-off-by: krishna2323 --- src/CONST.ts | 63 ---------------------------------------------------- 1 file changed, 63 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index b31bcc424c84..447c519dfcf9 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -3758,69 +3758,6 @@ const CONST = { EXPENSIFY_LOGO_SIZE_RATIO: 0.22, EXPENSIFY_LOGO_MARGIN_RATIO: 0.03, }, - /** - * Acceptable values for the `accessibilityRole` prop on react native components. - * - * **IMPORTANT:** Do not use with the `role` prop as it can cause errors. - * - * @deprecated ACCESSIBILITY_ROLE is deprecated. Please use CONST.ROLE instead. - */ - ACCESSIBILITY_ROLE: { - /** - * @deprecated Please stop using the accessibilityRole prop and use the role prop instead. - */ - BUTTON: 'button', - - /** - * @deprecated Please stop using the accessibilityRole prop and use the role prop instead. - */ - LINK: 'link', - - /** - * @deprecated Please stop using the accessibilityRole prop and use the role prop instead. - */ - MENUITEM: 'menuitem', - - /** - * @deprecated Please stop using the accessibilityRole prop and use the role prop instead. - */ - TEXT: 'text', - - /** - * @deprecated Please stop using the accessibilityRole prop and use the role prop instead. - */ - RADIO: 'radio', - - /** - * @deprecated Please stop using the accessibilityRole prop and use the role prop instead. - */ - IMAGEBUTTON: 'imagebutton', - - /** - * @deprecated Please stop using the accessibilityRole prop and use the role prop instead. - */ - CHECKBOX: 'checkbox', - - /** - * @deprecated Please stop using the accessibilityRole prop and use the role prop instead. - */ - SWITCH: 'switch', - - /** - * @deprecated Please stop using the accessibilityRole prop and use the role prop instead. - */ - ADJUSTABLE: 'adjustable', - - /** - * @deprecated Please stop using the accessibilityRole prop and use the role prop instead. - */ - IMAGE: 'image', - - /** - * @deprecated Please stop using the accessibilityRole prop and use the role prop instead. - */ - TEXTBOX: 'textbox', - }, /** * Acceptable values for the `role` attribute on react native components. * From e850cb0bcf2604a817b1bdbba0f590065835276d Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Thu, 22 Aug 2024 14:45:42 +0700 Subject: [PATCH 18/28] remove pading bottom --- .../BeneficialOwnerInfo/substeps/BeneficialOwnerCheckUBO.tsx | 2 +- .../substeps/BeneficialOwnerDetailsFormSubsteps/AddressUBO.tsx | 2 +- .../BeneficialOwnerDetailsFormSubsteps/DateOfBirthUBO.tsx | 2 +- .../BeneficialOwnerDetailsFormSubsteps/LegalNameUBO.tsx | 2 +- .../SocialSecurityNumberUBO.tsx | 2 +- .../BusinessInfo/substeps/AddressBusiness.tsx | 2 +- .../BusinessInfo/substeps/IncorporationDateBusiness.tsx | 2 +- .../BusinessInfo/substeps/IncorporationStateBusiness.tsx | 2 +- .../ReimbursementAccount/BusinessInfo/substeps/NameBusiness.tsx | 2 +- .../BusinessInfo/substeps/PhoneNumberBusiness.tsx | 2 +- .../BusinessInfo/substeps/TaxIdBusiness.tsx | 2 +- .../BusinessInfo/substeps/TypeBusiness/TypeBusiness.tsx | 2 +- .../BusinessInfo/substeps/WebsiteBusiness.tsx | 2 +- .../ReimbursementAccount/PersonalInfo/substeps/Address.tsx | 2 +- .../ReimbursementAccount/PersonalInfo/substeps/DateOfBirth.tsx | 2 +- .../ReimbursementAccount/PersonalInfo/substeps/FullName.tsx | 2 +- .../PersonalInfo/substeps/SocialSecurityNumber.tsx | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/pages/ReimbursementAccount/BeneficialOwnerInfo/substeps/BeneficialOwnerCheckUBO.tsx b/src/pages/ReimbursementAccount/BeneficialOwnerInfo/substeps/BeneficialOwnerCheckUBO.tsx index fc98ee21aff2..438551cf4044 100644 --- a/src/pages/ReimbursementAccount/BeneficialOwnerInfo/substeps/BeneficialOwnerCheckUBO.tsx +++ b/src/pages/ReimbursementAccount/BeneficialOwnerInfo/substeps/BeneficialOwnerCheckUBO.tsx @@ -47,7 +47,7 @@ function BeneficialOwnerCheckUBO({title, onSelectedValue, defaultValue}: Benefic submitButtonText={translate('common.confirm')} onSubmit={handleSubmit} style={[styles.mh5, styles.flexGrow1]} - submitButtonStyles={[styles.pb5, styles.mb0]} + submitButtonStyles={[styles.mb0]} > {title} {translate('beneficialOwnerInfoStep.regulationRequiresUsToVerifyTheIdentity')} diff --git a/src/pages/ReimbursementAccount/BeneficialOwnerInfo/substeps/BeneficialOwnerDetailsFormSubsteps/AddressUBO.tsx b/src/pages/ReimbursementAccount/BeneficialOwnerInfo/substeps/BeneficialOwnerDetailsFormSubsteps/AddressUBO.tsx index 284a27108a48..1b03432b7f3e 100644 --- a/src/pages/ReimbursementAccount/BeneficialOwnerInfo/substeps/BeneficialOwnerDetailsFormSubsteps/AddressUBO.tsx +++ b/src/pages/ReimbursementAccount/BeneficialOwnerInfo/substeps/BeneficialOwnerDetailsFormSubsteps/AddressUBO.tsx @@ -69,7 +69,7 @@ function AddressUBO({reimbursementAccountDraft, onNext, isEditing, beneficialOwn submitButtonText={translate(isEditing ? 'common.confirm' : 'common.next')} validate={validate} onSubmit={handleSubmit} - submitButtonStyles={[styles.mb0, styles.pb5]} + submitButtonStyles={[styles.mb0]} style={[styles.mh5, styles.flexGrow1]} > {translate('beneficialOwnerInfoStep.enterTheOwnersAddress')} diff --git a/src/pages/ReimbursementAccount/BeneficialOwnerInfo/substeps/BeneficialOwnerDetailsFormSubsteps/DateOfBirthUBO.tsx b/src/pages/ReimbursementAccount/BeneficialOwnerInfo/substeps/BeneficialOwnerDetailsFormSubsteps/DateOfBirthUBO.tsx index 2173d19887ad..b5a4a6a94bed 100644 --- a/src/pages/ReimbursementAccount/BeneficialOwnerInfo/substeps/BeneficialOwnerDetailsFormSubsteps/DateOfBirthUBO.tsx +++ b/src/pages/ReimbursementAccount/BeneficialOwnerInfo/substeps/BeneficialOwnerDetailsFormSubsteps/DateOfBirthUBO.tsx @@ -62,7 +62,7 @@ function DateOfBirthUBO({reimbursementAccountDraft, onNext, isEditing, beneficia validate={validate} onSubmit={handleSubmit} style={[styles.mh5, styles.flexGrow2, styles.justifyContentBetween]} - submitButtonStyles={[styles.pb5, styles.mb0]} + submitButtonStyles={[styles.mb0]} > {translate('beneficialOwnerInfoStep.enterTheDateOfBirthOfTheOwner')} {translate('beneficialOwnerInfoStep.enterLegalFirstAndLastName')} {translate('beneficialOwnerInfoStep.enterTheLast4')} diff --git a/src/pages/ReimbursementAccount/BusinessInfo/substeps/AddressBusiness.tsx b/src/pages/ReimbursementAccount/BusinessInfo/substeps/AddressBusiness.tsx index bd9524626a14..2526e15042b1 100644 --- a/src/pages/ReimbursementAccount/BusinessInfo/substeps/AddressBusiness.tsx +++ b/src/pages/ReimbursementAccount/BusinessInfo/substeps/AddressBusiness.tsx @@ -76,7 +76,7 @@ function AddressBusiness({reimbursementAccount, onNext, isEditing}: AddressBusin submitButtonText={translate(isEditing ? 'common.confirm' : 'common.next')} validate={validate} onSubmit={handleSubmit} - submitButtonStyles={[styles.mb0, styles.pb5]} + submitButtonStyles={[styles.mb0]} style={[styles.mh5, styles.flexGrow1]} > {translate('businessInfoStep.enterYourCompanysAddress')} diff --git a/src/pages/ReimbursementAccount/BusinessInfo/substeps/IncorporationDateBusiness.tsx b/src/pages/ReimbursementAccount/BusinessInfo/substeps/IncorporationDateBusiness.tsx index 274e087cc415..168cb02fd925 100644 --- a/src/pages/ReimbursementAccount/BusinessInfo/substeps/IncorporationDateBusiness.tsx +++ b/src/pages/ReimbursementAccount/BusinessInfo/substeps/IncorporationDateBusiness.tsx @@ -63,7 +63,7 @@ function IncorporationDateBusiness({reimbursementAccount, reimbursementAccountDr validate={validate} onSubmit={handleSubmit} style={[styles.mh5, styles.flexGrow1]} - submitButtonStyles={[styles.pb5, styles.mb0]} + submitButtonStyles={[styles.mb0]} > {translate('businessInfoStep.selectYourCompanysIncorporationDate')} {translate('businessInfoStep.pleaseSelectTheStateYourCompanyWasIncorporatedIn')} {translate('businessInfoStep.enterTheNameOfYourBusiness')} {translate('businessInfoStep.enterYourCompanysPhoneNumber')} {translate('businessInfoStep.enterYourCompanysTaxIdNumber')} {translate('businessInfoStep.selectYourCompanysType')} {translate('businessInfoStep.enterYourCompanysWebsite')} {translate('common.websiteExample')} diff --git a/src/pages/ReimbursementAccount/PersonalInfo/substeps/Address.tsx b/src/pages/ReimbursementAccount/PersonalInfo/substeps/Address.tsx index e802b9f5d765..b37dd207ea37 100644 --- a/src/pages/ReimbursementAccount/PersonalInfo/substeps/Address.tsx +++ b/src/pages/ReimbursementAccount/PersonalInfo/substeps/Address.tsx @@ -74,7 +74,7 @@ function Address({reimbursementAccount, onNext, isEditing}: AddressProps) { submitButtonText={translate(isEditing ? 'common.confirm' : 'common.next')} validate={validate} onSubmit={handleSubmit} - submitButtonStyles={[styles.mb0, styles.pb5]} + submitButtonStyles={[styles.mb0]} style={[styles.mh5, styles.flexGrow1]} > diff --git a/src/pages/ReimbursementAccount/PersonalInfo/substeps/DateOfBirth.tsx b/src/pages/ReimbursementAccount/PersonalInfo/substeps/DateOfBirth.tsx index 6fe391bbe957..8c68380d6e55 100644 --- a/src/pages/ReimbursementAccount/PersonalInfo/substeps/DateOfBirth.tsx +++ b/src/pages/ReimbursementAccount/PersonalInfo/substeps/DateOfBirth.tsx @@ -71,7 +71,7 @@ function DateOfBirth({reimbursementAccount, reimbursementAccountDraft, onNext, i validate={validate} onSubmit={handleSubmit} style={[styles.mh5, styles.flexGrow2, styles.justifyContentBetween]} - submitButtonStyles={[styles.pb5, styles.mb0]} + submitButtonStyles={[styles.mb0]} > {translate('personalInfoStep.enterYourDateOfBirth')} {translate('personalInfoStep.enterYourLegalFirstAndLast')} diff --git a/src/pages/ReimbursementAccount/PersonalInfo/substeps/SocialSecurityNumber.tsx b/src/pages/ReimbursementAccount/PersonalInfo/substeps/SocialSecurityNumber.tsx index 390880fa65f2..2f08980f2bd0 100644 --- a/src/pages/ReimbursementAccount/PersonalInfo/substeps/SocialSecurityNumber.tsx +++ b/src/pages/ReimbursementAccount/PersonalInfo/substeps/SocialSecurityNumber.tsx @@ -60,7 +60,7 @@ function SocialSecurityNumber({reimbursementAccount, onNext, isEditing}: SocialS validate={validate} onSubmit={handleSubmit} style={[styles.mh5, styles.flexGrow1]} - submitButtonStyles={[styles.pb5, styles.mb0]} + submitButtonStyles={[styles.mb0]} > {translate('personalInfoStep.enterTheLast4')} From 7a3d786d9ad3109e81dd36d72234f400e6f0b4a1 Mon Sep 17 00:00:00 2001 From: Agata Kosior Date: Thu, 22 Aug 2024 10:18:54 +0200 Subject: [PATCH 19/28] fix: lint --- src/pages/workspace/expensifyCard/issueNew/AssigneeStep.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/workspace/expensifyCard/issueNew/AssigneeStep.tsx b/src/pages/workspace/expensifyCard/issueNew/AssigneeStep.tsx index de7fddefa9dc..042e93ae2fae 100644 --- a/src/pages/workspace/expensifyCard/issueNew/AssigneeStep.tsx +++ b/src/pages/workspace/expensifyCard/issueNew/AssigneeStep.tsx @@ -22,7 +22,6 @@ import Navigation from '@navigation/Navigation'; import * as Card from '@userActions/Card'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import ROUTES from '@src/ROUTES'; import type * as OnyxTypes from '@src/types/onyx'; const MINIMUM_MEMBER_TO_SHOW_SEARCH = 8; From 34cd6582b773ffaf020afd119d28f4819d92bb68 Mon Sep 17 00:00:00 2001 From: daledah Date: Thu, 22 Aug 2024 17:57:50 +0700 Subject: [PATCH 20/28] fix: add allPersonalDetails to moneyRequestOptions deps --- .../ReportActionCompose/AttachmentPickerWithMenuItems.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.tsx b/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.tsx index 5d7b5b1390c2..9c61e0178a54 100644 --- a/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.tsx +++ b/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.tsx @@ -7,6 +7,7 @@ import type {FileObject} from '@components/AttachmentModal'; import AttachmentPicker from '@components/AttachmentPicker'; import Icon from '@components/Icon'; import * as Expensicons from '@components/Icon/Expensicons'; +import {usePersonalDetails} from '@components/OnyxProvider'; import type {PopoverMenuItem} from '@components/PopoverMenu'; import PopoverMenu from '@components/PopoverMenu'; import PressableWithFeedback from '@components/Pressable/PressableWithFeedback'; @@ -122,6 +123,7 @@ function AttachmentPickerWithMenuItems({ const {translate} = useLocalize(); const {windowHeight, windowWidth} = useWindowDimensions(); const {shouldUseNarrowLayout} = useResponsiveLayout(); + const allPersonalDetails = usePersonalDetails(); /** * Returns the list of IOU Options @@ -167,7 +169,8 @@ function AttachmentPickerWithMenuItems({ return ReportUtils.temporary_getMoneyRequestOptions(report, policy, reportParticipantIDs ?? []).map((option) => ({ ...options[option], })); - }, [translate, report, policy, reportParticipantIDs]); + // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps + }, [translate, report, policy, reportParticipantIDs, allPersonalDetails]); /** * Determines if we can show the task option From 8036e49d85515b0a98bc11c5dc3de6597dcab580 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Fri, 23 Aug 2024 03:57:34 +0530 Subject: [PATCH 21/28] fix: There is no selected background after selecting Submission frequency as monthly. Signed-off-by: krishna2323 --- .../workflows/WorkspaceAutoReportingFrequencyPage.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/pages/workspace/workflows/WorkspaceAutoReportingFrequencyPage.tsx b/src/pages/workspace/workflows/WorkspaceAutoReportingFrequencyPage.tsx index 704f1def7ad3..d026c218910f 100644 --- a/src/pages/workspace/workflows/WorkspaceAutoReportingFrequencyPage.tsx +++ b/src/pages/workspace/workflows/WorkspaceAutoReportingFrequencyPage.tsx @@ -1,5 +1,5 @@ import type {StackScreenProps} from '@react-navigation/stack'; -import React, {useState} from 'react'; +import React from 'react'; import type {ValueOf} from 'type-fest'; import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; @@ -52,17 +52,14 @@ function WorkspaceAutoReportingFrequencyPage({policy, route}: WorkspaceAutoRepor const {translate, preferredLocale, toLocaleOrdinal} = useLocalize(); const styles = useThemeStyles(); - const [isMonthlyFrequency, setIsMonthlyFrequency] = useState(autoReportingFrequency === CONST.POLICY.AUTO_REPORTING_FREQUENCIES.MONTHLY); const onSelectAutoReportingFrequency = (item: WorkspaceAutoReportingFrequencyPageItem) => { Policy.setWorkspaceAutoReportingFrequency(policy?.id ?? '-1', item.keyForList as AutoReportingFrequencyKey); if (item.keyForList === CONST.POLICY.AUTO_REPORTING_FREQUENCIES.MONTHLY) { - setIsMonthlyFrequency(true); return; } - setIsMonthlyFrequency(false); Navigation.goBack(); }; @@ -103,7 +100,7 @@ function WorkspaceAutoReportingFrequencyPage({policy, route}: WorkspaceAutoRepor text: getAutoReportingFrequencyDisplayNames(preferredLocale)[frequencyKey as AutoReportingFrequencyKey] || '', keyForList: frequencyKey, isSelected: frequencyKey === autoReportingFrequency, - footerContent: isMonthlyFrequency && frequencyKey === CONST.POLICY.AUTO_REPORTING_FREQUENCIES.MONTHLY ? monthlyFrequencyDetails() : null, + footerContent: frequencyKey === autoReportingFrequency && frequencyKey === CONST.POLICY.AUTO_REPORTING_FREQUENCIES.MONTHLY ? monthlyFrequencyDetails() : null, })); return ( @@ -137,6 +134,7 @@ function WorkspaceAutoReportingFrequencyPage({policy, route}: WorkspaceAutoRepor sections={[{data: autoReportingFrequencyItems}]} onSelectRow={onSelectAutoReportingFrequency} initiallyFocusedOptionKey={autoReportingFrequency} + shouldUpdateFocusedIndex /> From c5815e63d0484eabcbb3f40a057718a2aa68869e Mon Sep 17 00:00:00 2001 From: Hans Date: Fri, 23 Aug 2024 15:57:17 +0700 Subject: [PATCH 22/28] inital tenant API --- .../ConnectToXeroFlow/index.native.tsx | 2 +- src/components/ConnectToXeroFlow/index.tsx | 2 +- .../parameters/UpdateXeroGenericTypeParams.ts | 7 + src/libs/API/parameters/index.ts | 1 + src/libs/API/types.ts | 10 ++ src/libs/actions/connections/ConnectToXero.ts | 29 ---- src/libs/actions/connections/Xero.ts | 145 ++++++++++++++++++ src/pages/workspace/accounting/utils.tsx | 2 +- .../accounting/xero/XeroImportPage.tsx | 2 +- .../XeroOrganizationConfigurationPage.tsx | 4 +- .../XeroTrackingCategoryConfigurationPage.tsx | 2 +- 11 files changed, 170 insertions(+), 36 deletions(-) create mode 100644 src/libs/API/parameters/UpdateXeroGenericTypeParams.ts delete mode 100644 src/libs/actions/connections/ConnectToXero.ts create mode 100644 src/libs/actions/connections/Xero.ts diff --git a/src/components/ConnectToXeroFlow/index.native.tsx b/src/components/ConnectToXeroFlow/index.native.tsx index e603fece6bd0..735c4bf131a3 100644 --- a/src/components/ConnectToXeroFlow/index.native.tsx +++ b/src/components/ConnectToXeroFlow/index.native.tsx @@ -8,7 +8,7 @@ import HeaderWithBackButton from '@components/HeaderWithBackButton'; import Modal from '@components/Modal'; import RequireTwoFactorAuthenticationModal from '@components/RequireTwoFactorAuthenticationModal'; import useLocalize from '@hooks/useLocalize'; -import {getXeroSetupLink} from '@libs/actions/connections/ConnectToXero'; +import {getXeroSetupLink} from '@libs/actions/connections/Xero'; import getUAForWebView from '@libs/getUAForWebView'; import Navigation from '@libs/Navigation/Navigation'; import CONST from '@src/CONST'; diff --git a/src/components/ConnectToXeroFlow/index.tsx b/src/components/ConnectToXeroFlow/index.tsx index ade4c1191bb0..0a3403be78ec 100644 --- a/src/components/ConnectToXeroFlow/index.tsx +++ b/src/components/ConnectToXeroFlow/index.tsx @@ -3,7 +3,7 @@ import {useOnyx} from 'react-native-onyx'; import RequireTwoFactorAuthenticationModal from '@components/RequireTwoFactorAuthenticationModal'; import useEnvironment from '@hooks/useEnvironment'; import useLocalize from '@hooks/useLocalize'; -import {getXeroSetupLink} from '@libs/actions/connections/ConnectToXero'; +import {getXeroSetupLink} from '@libs/actions/connections/Xero'; import Navigation from '@libs/Navigation/Navigation'; import * as Link from '@userActions/Link'; import ONYXKEYS from '@src/ONYXKEYS'; diff --git a/src/libs/API/parameters/UpdateXeroGenericTypeParams.ts b/src/libs/API/parameters/UpdateXeroGenericTypeParams.ts new file mode 100644 index 000000000000..02667483bdd3 --- /dev/null +++ b/src/libs/API/parameters/UpdateXeroGenericTypeParams.ts @@ -0,0 +1,7 @@ +type UpdateXeroGenericTypeParams = { + policyID: string; + settingValue: string; + idempotencyKey: string; +}; + +export default UpdateXeroGenericTypeParams; diff --git a/src/libs/API/parameters/index.ts b/src/libs/API/parameters/index.ts index a72220c3d943..351b6da47505 100644 --- a/src/libs/API/parameters/index.ts +++ b/src/libs/API/parameters/index.ts @@ -279,3 +279,4 @@ export type {default as UpdateExpensifyCardTitleParams} from './UpdateExpensifyC export type {default as OpenCardDetailsPageParams} from './OpenCardDetailsPageParams'; export type {default as ToggleCardContinuousReconciliationParams} from './ToggleCardContinuousReconciliationParams'; export type {default as UpdateExpensifyCardLimitTypeParams} from './UpdateExpensifyCardLimitTypeParams'; +export type {default as UpdateXeroGenericTypeParams} from './UpdateXeroGenericTypeParams'; diff --git a/src/libs/API/types.ts b/src/libs/API/types.ts index de63ed032afe..cdd56bdc6f2e 100644 --- a/src/libs/API/types.ts +++ b/src/libs/API/types.ts @@ -335,6 +335,10 @@ const WRITE_COMMANDS = { CREATE_EXPENSIFY_CARD: 'CreateExpensifyCard', CREATE_ADMIN_ISSUED_VIRTUAL_CARD: 'CreateAdminIssuedVirtualCard', TOGGLE_CARD_CONTINUOUS_RECONCILIATION: 'ToggleCardContinuousReconciliation', + UPDATE_XERO_IMPORT_TRACKING_CATEGORIES: 'UpdateXeroImportTrackingCategories', + UPDATE_XERO_IMPORT_TAX_RATES: 'UpdateXeroImportTaxRates', + UPDATE_XERO_TENANT_ID: 'UpdateXeroTenantID', + UPDATE_XERO_MAPPING: 'UpdateXeroMappings', } as const; type WriteCommand = ValueOf; @@ -675,6 +679,12 @@ type WriteCommandParameters = { [WRITE_COMMANDS.CREATE_EXPENSIFY_CARD]: Parameters.CreateExpensifyCardParams; [WRITE_COMMANDS.CREATE_ADMIN_ISSUED_VIRTUAL_CARD]: Omit; [WRITE_COMMANDS.TOGGLE_CARD_CONTINUOUS_RECONCILIATION]: Parameters.ToggleCardContinuousReconciliationParams; + + // Xero API + [WRITE_COMMANDS.UPDATE_XERO_TENANT_ID]: Parameters.UpdateXeroGenericTypeParams; + [WRITE_COMMANDS.UPDATE_XERO_IMPORT_TAX_RATES]: Parameters.UpdateXeroGenericTypeParams; + [WRITE_COMMANDS.UPDATE_XERO_MAPPING]: Parameters.UpdateXeroGenericTypeParams; + [WRITE_COMMANDS.UPDATE_XERO_IMPORT_TRACKING_CATEGORIES]: Parameters.UpdateXeroGenericTypeParams; }; const READ_COMMANDS = { diff --git a/src/libs/actions/connections/ConnectToXero.ts b/src/libs/actions/connections/ConnectToXero.ts deleted file mode 100644 index e327b218989c..000000000000 --- a/src/libs/actions/connections/ConnectToXero.ts +++ /dev/null @@ -1,29 +0,0 @@ -import type {OnyxEntry} from 'react-native-onyx'; -import type {ConnectPolicyToAccountingIntegrationParams} from '@libs/API/parameters'; -import {READ_COMMANDS} from '@libs/API/types'; -import {getCommandURL} from '@libs/ApiUtils'; -import CONST from '@src/CONST'; -import type * as OnyxTypes from '@src/types/onyx'; -import type {XeroTrackingCategory} from '@src/types/onyx/Policy'; - -const getXeroSetupLink = (policyID: string) => { - const params: ConnectPolicyToAccountingIntegrationParams = {policyID}; - const commandURL = getCommandURL({command: READ_COMMANDS.CONNECT_POLICY_TO_XERO, shouldSkipWebProxy: true}); - return commandURL + new URLSearchParams(params).toString(); -}; - -const getTrackingCategories = (policy: OnyxEntry): Array => { - const {trackingCategories} = policy?.connections?.xero?.data ?? {}; - const {mappings} = policy?.connections?.xero?.config ?? {}; - - if (!trackingCategories) { - return []; - } - - return trackingCategories.map((category) => ({ - ...category, - value: mappings?.[`${CONST.XERO_CONFIG.TRACKING_CATEGORY_PREFIX}${category.id}`] ?? '', - })); -}; - -export {getXeroSetupLink, getTrackingCategories}; diff --git a/src/libs/actions/connections/Xero.ts b/src/libs/actions/connections/Xero.ts new file mode 100644 index 000000000000..4339c0663fd0 --- /dev/null +++ b/src/libs/actions/connections/Xero.ts @@ -0,0 +1,145 @@ +import isObject from 'lodash/isObject'; +import type {OnyxEntry, OnyxUpdate} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; +import * as API from '@libs/API'; +import type {ConnectPolicyToAccountingIntegrationParams, UpdateXeroGenericTypeParams} from '@libs/API/parameters'; +import {READ_COMMANDS, WRITE_COMMANDS} from '@libs/API/types'; +import {getCommandURL} from '@libs/ApiUtils'; +import * as ErrorUtils from '@libs/ErrorUtils'; +import CONST from '@src/CONST'; +import ONYXKEYS from '@src/ONYXKEYS'; +import type * as OnyxTypes from '@src/types/onyx'; +import type * as OnyxCommon from '@src/types/onyx/OnyxCommon'; +import type {Connections, XeroTrackingCategory} from '@src/types/onyx/Policy'; + +const getXeroSetupLink = (policyID: string) => { + const params: ConnectPolicyToAccountingIntegrationParams = {policyID}; + const commandURL = getCommandURL({command: READ_COMMANDS.CONNECT_POLICY_TO_XERO, shouldSkipWebProxy: true}); + return commandURL + new URLSearchParams(params).toString(); +}; + +const getTrackingCategories = (policy: OnyxEntry): Array => { + const {trackingCategories} = policy?.connections?.xero?.data ?? {}; + const {mappings} = policy?.connections?.xero?.config ?? {}; + + if (!trackingCategories) { + return []; + } + + return trackingCategories.map((category) => ({ + ...category, + value: mappings?.[`${CONST.XERO_CONFIG.TRACKING_CATEGORY_PREFIX}${category.id}`] ?? '', + })); +}; + +function createXeroPendingFields( + settingName: TSettingName, + settingValue: Partial, + pendingValue: OnyxCommon.PendingAction, +) { + if (!isObject(settingValue)) { + return {[settingName]: pendingValue}; + } + + return Object.keys(settingValue).reduce>((acc, setting) => { + acc[setting] = pendingValue; + return acc; + }, {}); +} + +function createXeroErrorFields( + settingName: TSettingName, + settingValue: Partial, + errorValue: OnyxCommon.Errors | null, +) { + if (!isObject(settingValue)) { + return {[settingName]: errorValue}; + } + + return Object.keys(settingValue).reduce((acc, setting) => { + acc[setting] = errorValue; + return acc; + }, {}); +} + +function prepareXeroOptimisticData( + policyID: string, + settingName: TSettingName, + settingValue: Partial, + oldSettingValue?: Partial | null, +) { + const optimisticData: OnyxUpdate[] = [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, + value: { + connections: { + xero: { + config: { + [settingName]: settingValue ?? null, + pendingFields: createXeroPendingFields(settingName, settingValue, CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE), + errorFields: createXeroErrorFields(settingName, settingValue, null), + }, + }, + }, + }, + }, + ]; + + const failureData: OnyxUpdate[] = [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, + value: { + connections: { + xero: { + config: { + [settingName]: oldSettingValue ?? null, + pendingFields: createXeroPendingFields(settingName, settingValue, null), + errorFields: createXeroErrorFields(settingName, settingValue, ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('common.genericErrorMessage')), + }, + }, + }, + }, + }, + ]; + + const successData: OnyxUpdate[] = [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, + value: { + connections: { + xero: { + config: { + pendingFields: createXeroPendingFields(settingName, settingValue, null), + errorFields: createXeroErrorFields(settingName, settingValue, null), + }, + }, + }, + }, + }, + ]; + + return {optimisticData, failureData, successData}; +} + +function updateXeroImportTrackingCategories() {} + +function updateXeroImportTaxRates() {} + +function updateXeroTenantID(policyID: string, settingValue: string, oldSettingValue?: string) { + const parameters: UpdateXeroGenericTypeParams = { + policyID, + settingValue: JSON.stringify(settingValue), + idempotencyKey: String(CONST.XERO_CONFIG.TENANT_ID), + }; + + const {optimisticData, successData, failureData} = prepareXeroOptimisticData(policyID, CONST.XERO_CONFIG.TENANT_ID, settingValue, oldSettingValue); + + API.write(WRITE_COMMANDS.UPDATE_XERO_TENANT_ID, parameters, {optimisticData, successData, failureData}); +} + +function updateXeroMappings() {} + +export {getXeroSetupLink, getTrackingCategories, updateXeroImportTrackingCategories, updateXeroImportTaxRates, updateXeroTenantID, updateXeroMappings}; diff --git a/src/pages/workspace/accounting/utils.tsx b/src/pages/workspace/accounting/utils.tsx index 22bc97236b70..05ee41b85b9b 100644 --- a/src/pages/workspace/accounting/utils.tsx +++ b/src/pages/workspace/accounting/utils.tsx @@ -6,7 +6,7 @@ import ConnectToXeroFlow from '@components/ConnectToXeroFlow'; import * as Expensicons from '@components/Icon/Expensicons'; import type {LocaleContextProps} from '@components/LocaleContextProvider'; import Navigation from '@navigation/Navigation'; -import {getTrackingCategories} from '@userActions/connections/ConnectToXero'; +import {getTrackingCategories} from '@userActions/connections/Xero'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import type {Policy} from '@src/types/onyx'; diff --git a/src/pages/workspace/accounting/xero/XeroImportPage.tsx b/src/pages/workspace/accounting/xero/XeroImportPage.tsx index db0252098b89..87f4b3a8ac9a 100644 --- a/src/pages/workspace/accounting/xero/XeroImportPage.tsx +++ b/src/pages/workspace/accounting/xero/XeroImportPage.tsx @@ -10,7 +10,7 @@ import {getCurrentXeroOrganizationName} from '@libs/PolicyUtils'; import * as PolicyUtils from '@libs/PolicyUtils'; import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; -import {getTrackingCategories} from '@userActions/connections/ConnectToXero'; +import {getTrackingCategories} from '@userActions/connections/Xero'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; diff --git a/src/pages/workspace/accounting/xero/XeroOrganizationConfigurationPage.tsx b/src/pages/workspace/accounting/xero/XeroOrganizationConfigurationPage.tsx index b23363c79963..5137c98811b8 100644 --- a/src/pages/workspace/accounting/xero/XeroOrganizationConfigurationPage.tsx +++ b/src/pages/workspace/accounting/xero/XeroOrganizationConfigurationPage.tsx @@ -9,7 +9,7 @@ import SelectionScreen from '@components/SelectionScreen'; import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; -import {updatePolicyXeroConnectionConfig} from '@libs/actions/connections'; +import {updateXeroTenantID} from '@libs/actions/connections/Xero'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; @@ -59,7 +59,7 @@ function XeroOrganizationConfigurationPage({ return; } - updatePolicyXeroConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.XERO, CONST.XERO_CONFIG.TENANT_ID, keyForList, xeroConfig?.tenantID); + updateXeroTenantID(policyID, keyForList, xeroConfig?.tenantID); Navigation.goBack(); }; diff --git a/src/pages/workspace/accounting/xero/XeroTrackingCategoryConfigurationPage.tsx b/src/pages/workspace/accounting/xero/XeroTrackingCategoryConfigurationPage.tsx index 9d27c8887e6e..3a1b154e08d9 100644 --- a/src/pages/workspace/accounting/xero/XeroTrackingCategoryConfigurationPage.tsx +++ b/src/pages/workspace/accounting/xero/XeroTrackingCategoryConfigurationPage.tsx @@ -6,7 +6,7 @@ import OfflineWithFeedback from '@components/OfflineWithFeedback'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Connections from '@libs/actions/connections'; -import {getTrackingCategories} from '@libs/actions/connections/ConnectToXero'; +import {getTrackingCategories} from '@libs/actions/connections/Xero'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; import {areSettingsInErrorFields, settingsPendingAction} from '@libs/PolicyUtils'; From 1baf50fe5c4740c6810b8bcefec3f56f00643911 Mon Sep 17 00:00:00 2001 From: Hans Date: Fri, 23 Aug 2024 17:07:56 +0700 Subject: [PATCH 23/28] update rest of the api --- src/libs/actions/connections/Xero.ts | 49 +++++++++++++++++-- ...roMapTrackingCategoryConfigurationPage.tsx | 6 +-- .../xero/XeroTaxesConfigurationPage.tsx | 12 +---- .../XeroTrackingCategoryConfigurationPage.tsx | 12 +---- 4 files changed, 52 insertions(+), 27 deletions(-) diff --git a/src/libs/actions/connections/Xero.ts b/src/libs/actions/connections/Xero.ts index 4339c0663fd0..fa08dec2e391 100644 --- a/src/libs/actions/connections/Xero.ts +++ b/src/libs/actions/connections/Xero.ts @@ -124,9 +124,42 @@ function prepareXeroOptimisticData, + oldImportTrackingCategories?: Partial, +) { + const parameters: UpdateXeroGenericTypeParams = { + policyID, + settingValue: JSON.stringify(importTrackingCategories), + idempotencyKey: String(CONST.XERO_CONFIG.IMPORT_TRACKING_CATEGORIES), + }; + + const {optimisticData, failureData, successData} = prepareXeroOptimisticData( + policyID, + CONST.XERO_CONFIG.IMPORT_TRACKING_CATEGORIES, + importTrackingCategories, + oldImportTrackingCategories, + ); -function updateXeroImportTaxRates() {} + API.write(WRITE_COMMANDS.UPDATE_XERO_IMPORT_TRACKING_CATEGORIES, parameters, {optimisticData, failureData, successData}); +} + +function updateXeroImportTaxRates( + policyID: string, + importTaxesRate: Partial, + oldImportTaxesRate?: Partial, +) { + const parameters: UpdateXeroGenericTypeParams = { + policyID, + settingValue: JSON.stringify(importTaxesRate), + idempotencyKey: String(CONST.XERO_CONFIG.IMPORT_TAX_RATES), + }; + + const {optimisticData, failureData, successData} = prepareXeroOptimisticData(policyID, CONST.XERO_CONFIG.IMPORT_TAX_RATES, importTaxesRate, oldImportTaxesRate); + + API.write(WRITE_COMMANDS.UPDATE_XERO_IMPORT_TAX_RATES, parameters, {optimisticData, failureData, successData}); +} function updateXeroTenantID(policyID: string, settingValue: string, oldSettingValue?: string) { const parameters: UpdateXeroGenericTypeParams = { @@ -140,6 +173,16 @@ function updateXeroTenantID(policyID: string, settingValue: string, oldSettingVa API.write(WRITE_COMMANDS.UPDATE_XERO_TENANT_ID, parameters, {optimisticData, successData, failureData}); } -function updateXeroMappings() {} +function updateXeroMappings(policyID: string, mappingValue: Partial, oldMappingValue?: Partial) { + const parameters: UpdateXeroGenericTypeParams = { + policyID, + settingValue: JSON.stringify(mappingValue), + idempotencyKey: String(CONST.XERO_CONFIG.MAPPINGS), + }; + + const {optimisticData, failureData, successData} = prepareXeroOptimisticData(policyID, CONST.XERO_CONFIG.MAPPINGS, mappingValue, oldMappingValue); + + API.write(WRITE_COMMANDS.UPDATE_XERO_MAPPING, parameters, {optimisticData, failureData, successData}); +} export {getXeroSetupLink, getTrackingCategories, updateXeroImportTrackingCategories, updateXeroImportTaxRates, updateXeroTenantID, updateXeroMappings}; diff --git a/src/pages/workspace/accounting/xero/XeroMapTrackingCategoryConfigurationPage.tsx b/src/pages/workspace/accounting/xero/XeroMapTrackingCategoryConfigurationPage.tsx index 42e3f50bae0a..dae46f32dc54 100644 --- a/src/pages/workspace/accounting/xero/XeroMapTrackingCategoryConfigurationPage.tsx +++ b/src/pages/workspace/accounting/xero/XeroMapTrackingCategoryConfigurationPage.tsx @@ -6,7 +6,7 @@ import SelectionScreen from '@components/SelectionScreen'; import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; -import * as Connections from '@libs/actions/connections'; +import * as Xero from '@libs/actions/connections/Xero'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; import {settingsPendingAction} from '@libs/PolicyUtils'; @@ -60,10 +60,8 @@ function XeroMapTrackingCategoryConfigurationPage({policy}: WithPolicyProps) { const updateMapping = useCallback( (option: {value: string}) => { if (option.value !== categoryName) { - Connections.updatePolicyXeroConnectionConfig( + Xero.updateXeroMappings( policyID, - CONST.POLICY.CONNECTIONS.NAME.XERO, - CONST.XERO_CONFIG.MAPPINGS, categoryId ? {[`${CONST.XERO_CONFIG.TRACKING_CATEGORY_PREFIX}${categoryId}`]: option.value} : {}, categoryId ? {[`${CONST.XERO_CONFIG.TRACKING_CATEGORY_PREFIX}${categoryId}`]: currentTrackingCategoryValue} : {}, ); diff --git a/src/pages/workspace/accounting/xero/XeroTaxesConfigurationPage.tsx b/src/pages/workspace/accounting/xero/XeroTaxesConfigurationPage.tsx index 57053cb30808..cf695b57aa38 100644 --- a/src/pages/workspace/accounting/xero/XeroTaxesConfigurationPage.tsx +++ b/src/pages/workspace/accounting/xero/XeroTaxesConfigurationPage.tsx @@ -2,7 +2,7 @@ import React from 'react'; import ConnectionLayout from '@components/ConnectionLayout'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; -import * as Connections from '@libs/actions/connections'; +import * as Xero from '@libs/actions/connections/Xero'; import * as ErrorUtils from '@libs/ErrorUtils'; import * as PolicyUtils from '@libs/PolicyUtils'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; @@ -33,15 +33,7 @@ function XeroTaxesConfigurationPage({policy}: WithPolicyProps) { title={translate('workspace.accounting.import')} switchAccessibilityLabel={translate('workspace.xero.customers')} isActive={isSwitchOn} - onToggle={() => - Connections.updatePolicyXeroConnectionConfig( - policyID, - CONST.POLICY.CONNECTIONS.NAME.XERO, - CONST.XERO_CONFIG.IMPORT_TAX_RATES, - !xeroConfig?.importTaxRates, - xeroConfig?.importTaxRates, - ) - } + onToggle={() => Xero.updateXeroImportTaxRates(policyID, !xeroConfig?.importTaxRates, xeroConfig?.importTaxRates)} errors={ErrorUtils.getLatestErrorField(xeroConfig ?? {}, CONST.XERO_CONFIG.IMPORT_TAX_RATES)} onCloseError={() => Policy.clearXeroErrorField(policyID, CONST.XERO_CONFIG.IMPORT_TAX_RATES)} pendingAction={PolicyUtils.settingsPendingAction([CONST.XERO_CONFIG.IMPORT_TAX_RATES], xeroConfig?.pendingFields)} diff --git a/src/pages/workspace/accounting/xero/XeroTrackingCategoryConfigurationPage.tsx b/src/pages/workspace/accounting/xero/XeroTrackingCategoryConfigurationPage.tsx index 3a1b154e08d9..98b8bbb3a89c 100644 --- a/src/pages/workspace/accounting/xero/XeroTrackingCategoryConfigurationPage.tsx +++ b/src/pages/workspace/accounting/xero/XeroTrackingCategoryConfigurationPage.tsx @@ -5,7 +5,7 @@ import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; import OfflineWithFeedback from '@components/OfflineWithFeedback'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; -import * as Connections from '@libs/actions/connections'; +import * as Xero from '@libs/actions/connections/Xero'; import {getTrackingCategories} from '@libs/actions/connections/Xero'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; @@ -53,15 +53,7 @@ function XeroTrackingCategoryConfigurationPage({policy}: WithPolicyProps) { switchAccessibilityLabel={translate('workspace.xero.trackingCategories')} isActive={isSwitchOn} wrapperStyle={styles.mv3} - onToggle={() => - Connections.updatePolicyXeroConnectionConfig( - policyID, - CONST.POLICY.CONNECTIONS.NAME.XERO, - CONST.XERO_CONFIG.IMPORT_TRACKING_CATEGORIES, - !xeroConfig?.importTrackingCategories, - xeroConfig?.importTrackingCategories, - ) - } + onToggle={() => Xero.updateXeroImportTrackingCategories(policyID, !xeroConfig?.importTrackingCategories, xeroConfig?.importTrackingCategories)} pendingAction={settingsPendingAction([CONST.XERO_CONFIG.IMPORT_TRACKING_CATEGORIES], xeroConfig?.pendingFields)} errors={ErrorUtils.getLatestErrorField(xeroConfig ?? {}, CONST.XERO_CONFIG.IMPORT_TRACKING_CATEGORIES)} onCloseError={() => Policy.clearXeroErrorField(policyID, CONST.XERO_CONFIG.IMPORT_TRACKING_CATEGORIES)} From 9485198ebba281dfdae1acf70b29680ce7aed7b2 Mon Sep 17 00:00:00 2001 From: Hans Date: Fri, 23 Aug 2024 17:21:51 +0700 Subject: [PATCH 24/28] small cleanup --- .../accounting/xero/XeroOrganizationConfigurationPage.tsx | 4 ++-- .../accounting/xero/XeroTrackingCategoryConfigurationPage.tsx | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/pages/workspace/accounting/xero/XeroOrganizationConfigurationPage.tsx b/src/pages/workspace/accounting/xero/XeroOrganizationConfigurationPage.tsx index 5137c98811b8..bb49c5212fb2 100644 --- a/src/pages/workspace/accounting/xero/XeroOrganizationConfigurationPage.tsx +++ b/src/pages/workspace/accounting/xero/XeroOrganizationConfigurationPage.tsx @@ -9,7 +9,7 @@ import SelectionScreen from '@components/SelectionScreen'; import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; -import {updateXeroTenantID} from '@libs/actions/connections/Xero'; +import * as Xero from '@libs/actions/connections/Xero'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; @@ -59,7 +59,7 @@ function XeroOrganizationConfigurationPage({ return; } - updateXeroTenantID(policyID, keyForList, xeroConfig?.tenantID); + Xero.updateXeroTenantID(policyID, keyForList, xeroConfig?.tenantID); Navigation.goBack(); }; diff --git a/src/pages/workspace/accounting/xero/XeroTrackingCategoryConfigurationPage.tsx b/src/pages/workspace/accounting/xero/XeroTrackingCategoryConfigurationPage.tsx index 98b8bbb3a89c..5aa6b2cd4efe 100644 --- a/src/pages/workspace/accounting/xero/XeroTrackingCategoryConfigurationPage.tsx +++ b/src/pages/workspace/accounting/xero/XeroTrackingCategoryConfigurationPage.tsx @@ -6,7 +6,6 @@ import OfflineWithFeedback from '@components/OfflineWithFeedback'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Xero from '@libs/actions/connections/Xero'; -import {getTrackingCategories} from '@libs/actions/connections/Xero'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; import {areSettingsInErrorFields, settingsPendingAction} from '@libs/PolicyUtils'; @@ -28,7 +27,7 @@ function XeroTrackingCategoryConfigurationPage({policy}: WithPolicyProps) { const isSwitchOn = !!xeroConfig?.importTrackingCategories; const menuItems = useMemo(() => { - const trackingCategories = getTrackingCategories(policy); + const trackingCategories = Xero.getTrackingCategories(policy); return trackingCategories.map((category: XeroTrackingCategory & {value: string}) => ({ id: category.id, description: translate('workspace.xero.mapTrackingCategoryTo', {categoryName: category.name}) as TranslationPaths, From 3a66ca18ad75b56e79b926cbb2135e75ab208607 Mon Sep 17 00:00:00 2001 From: Ren Jones <153645623+ren-jones@users.noreply.github.com> Date: Fri, 23 Aug 2024 09:11:36 -0500 Subject: [PATCH 25/28] Update Quickbooks-Online-Troubleshooting.md Small edits + New FAQ section --- .../Quickbooks-Online-Troubleshooting.md | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/docs/articles/new-expensify/connections/quickbooks-online/Quickbooks-Online-Troubleshooting.md b/docs/articles/new-expensify/connections/quickbooks-online/Quickbooks-Online-Troubleshooting.md index b132a75e9297..ff1b9bfab9fb 100644 --- a/docs/articles/new-expensify/connections/quickbooks-online/Quickbooks-Online-Troubleshooting.md +++ b/docs/articles/new-expensify/connections/quickbooks-online/Quickbooks-Online-Troubleshooting.md @@ -9,13 +9,13 @@ If an error occurs during an automatic export to QuickBooks Online: - You’ll receive an email detailing the error. - The error will appear in the related Workspace Chat, indicated by a red dot next to the report. -- For auto-sync errors, a message will be posted in the related #admins room. The message contains a link to the workspace’s Accounting settings where an explanation for the error appears next to the connection. +- For auto-sync errors, a message will be posted in the related #admins room. The message contains a link to the workspace’s accounting settings where an explanation for the error appears next to the connection. An error on a report will prevent it from automatically exporting. -### How to resolve: +### How to resolve -To resolve this, open the expense and make the required changes. Then an admin must manually export the report to QuickBooks Online by clicking on Details > Export: +Open the expense and make the required changes. Then an admin must manually export the report to QuickBooks Online by clicking Details > Export. ![Click the Export button found in the Details tab](https://help.expensify.com/assets/images/QBO_help_02.png){:width="100%"} @@ -27,11 +27,26 @@ To export a report, it must be in the Approved, Closed, or Reimbursed state. If ![If the Report is in the Open status, the Not Ready to Export message shows](https://help.expensify.com/assets/images/QBO_help_04.png){:width="100%"} -### How to resolve: +### How to resolve -To resolve this, open the report and make the required changes: +Open the report and make the required changes: -1. If the report is in the Open status, please ensure that it is submitted. +1. If the report is in the Open status, ensure that it is submitted. 2. If the Report is in the Processing status, an admin or approver will need to approve it. -Once this is done, then an admin must manually export the report to QuickBooks Online. +Once this is done, an admin must manually export the report to QuickBooks Online. + +{% include faq-begin.md %} + +**How do I disconnect the QuickBooks Online connection?** + +1. Click your profile image or icon in the bottom left menu. +2. Scroll down and click **Workspaces** in the left menu. +3. Select the workspace you want to disconnect from QuickBooks Online. +4. Click **Accounting** in the left menu. +5. Click the three dot menu icon to the right of QuickBooks Online and select **Disconnect**. +6. Click **Disconnect** to confirm. + +You will no longer see the imported options from QuickBooks Online. + +{% include faq-end.md %} From ee3a5c52c7f015a0755d32489b4741ad7a99692d Mon Sep 17 00:00:00 2001 From: Cristi Paval Date: Mon, 26 Aug 2024 15:51:34 +0300 Subject: [PATCH 26/28] Revert PR 47418 --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 71278ea481af..11f192564162 100644 --- a/package-lock.json +++ b/package-lock.json @@ -104,7 +104,7 @@ "react-native-localize": "^2.2.6", "react-native-modal": "^13.0.0", "react-native-onyx": "2.0.65", - "react-native-pager-view": "6.3.4", + "react-native-pager-view": "6.2.3", "react-native-pdf": "6.7.3", "react-native-performance": "^5.1.0", "react-native-permissions": "^3.10.0", @@ -37593,9 +37593,9 @@ } }, "node_modules/react-native-pager-view": { - "version": "6.3.4", - "resolved": "https://registry.npmjs.org/react-native-pager-view/-/react-native-pager-view-6.3.4.tgz", - "integrity": "sha512-4PEQd52EOwWcfiFJZ4VGSlY+GZfumvUzNbAozsMEgJaLvOHOMMl+Arfsc0txgtGdS49uEiHFLLZthZQzxx/Mog==", + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/react-native-pager-view/-/react-native-pager-view-6.2.3.tgz", + "integrity": "sha512-dqVpXWFtPNfD3D2QQQr8BP+ullS5MhjRJuF8Z/qml4QTILcrWaW8F5iAxKkQR3Jl0ikcEryG/+SQlNcwlo0Ggg==", "peerDependencies": { "react": "*", "react-native": "*" diff --git a/package.json b/package.json index 3fc98b583b89..bc0036ce3cc6 100644 --- a/package.json +++ b/package.json @@ -160,7 +160,7 @@ "react-native-localize": "^2.2.6", "react-native-modal": "^13.0.0", "react-native-onyx": "2.0.65", - "react-native-pager-view": "6.3.4", + "react-native-pager-view": "6.2.3", "react-native-pdf": "6.7.3", "react-native-performance": "^5.1.0", "react-native-permissions": "^3.10.0", From 49680df86267bbc668959a26c87fe1d4dc02dd64 Mon Sep 17 00:00:00 2001 From: OSBotify Date: Mon, 26 Aug 2024 15:22:24 +0000 Subject: [PATCH 27/28] Update version to 9.0.24-2 --- 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 10b5f74ce660..9bef5fd7cb32 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -108,8 +108,8 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion multiDexEnabled rootProject.ext.multiDexEnabled - versionCode 1009002401 - versionName "9.0.24-1" + versionCode 1009002402 + versionName "9.0.24-2" // 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 4b272838832b..daf97c0ab588 100644 --- a/ios/NewExpensify/Info.plist +++ b/ios/NewExpensify/Info.plist @@ -40,7 +40,7 @@ CFBundleVersion - 9.0.24.1 + 9.0.24.2 FullStory OrgId diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist index fff7dd6f3d55..fecfe9e01604 100644 --- a/ios/NewExpensifyTests/Info.plist +++ b/ios/NewExpensifyTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 9.0.24.1 + 9.0.24.2 diff --git a/ios/NotificationServiceExtension/Info.plist b/ios/NotificationServiceExtension/Info.plist index 94f999e972c4..8b2a1c7af855 100644 --- a/ios/NotificationServiceExtension/Info.plist +++ b/ios/NotificationServiceExtension/Info.plist @@ -13,7 +13,7 @@ CFBundleShortVersionString 9.0.24 CFBundleVersion - 9.0.24.1 + 9.0.24.2 NSExtension NSExtensionPointIdentifier diff --git a/package-lock.json b/package-lock.json index 11f192564162..8eaf09d73eda 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "new.expensify", - "version": "9.0.24-1", + "version": "9.0.24-2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "new.expensify", - "version": "9.0.24-1", + "version": "9.0.24-2", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index bc0036ce3cc6..7ac754944273 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "9.0.24-1", + "version": "9.0.24-2", "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 c9103c1d6bd7b345c186be16520d715e25bbec8b Mon Sep 17 00:00:00 2001 From: OSBotify Date: Mon, 26 Aug 2024 15:43:29 +0000 Subject: [PATCH 28/28] Update version to 9.0.24-3 --- 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 9bef5fd7cb32..cfd339b4c7da 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -108,8 +108,8 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion multiDexEnabled rootProject.ext.multiDexEnabled - versionCode 1009002402 - versionName "9.0.24-2" + versionCode 1009002403 + versionName "9.0.24-3" // 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 daf97c0ab588..a690017617dd 100644 --- a/ios/NewExpensify/Info.plist +++ b/ios/NewExpensify/Info.plist @@ -40,7 +40,7 @@ CFBundleVersion - 9.0.24.2 + 9.0.24.3 FullStory OrgId diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist index fecfe9e01604..63a754c008d6 100644 --- a/ios/NewExpensifyTests/Info.plist +++ b/ios/NewExpensifyTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 9.0.24.2 + 9.0.24.3 diff --git a/ios/NotificationServiceExtension/Info.plist b/ios/NotificationServiceExtension/Info.plist index 8b2a1c7af855..81200c8db51b 100644 --- a/ios/NotificationServiceExtension/Info.plist +++ b/ios/NotificationServiceExtension/Info.plist @@ -13,7 +13,7 @@ CFBundleShortVersionString 9.0.24 CFBundleVersion - 9.0.24.2 + 9.0.24.3 NSExtension NSExtensionPointIdentifier diff --git a/package-lock.json b/package-lock.json index 4cd452fd701f..b0663d943923 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "new.expensify", - "version": "9.0.24-2", + "version": "9.0.24-3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "new.expensify", - "version": "9.0.24-2", + "version": "9.0.24-3", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index ffef9f25cbe3..df772917c218 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "9.0.24-2", + "version": "9.0.24-3", "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.",