From 5dc3f6b9cdfb77b1f56f0aee93c74d04460ef280 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Wed, 28 Jan 2026 14:05:33 +0800 Subject: [PATCH 01/17] refactor netsuite connection page to use useSubPage --- src/CONST/index.ts | 17 ++++-- src/ROUTES.ts | 9 ++- src/hooks/useSubPage/types.ts | 2 +- .../NetSuiteTokenInputPage.tsx | 60 +++++++++---------- .../substeps/NetSuiteTokenInputForm.tsx | 4 +- .../substeps/NetSuiteTokenSetupContent.tsx | 6 +- .../workspace/accounting/netsuite/types.ts | 5 +- 7 files changed, 55 insertions(+), 48 deletions(-) diff --git a/src/CONST/index.ts b/src/CONST/index.ts index 22e530eaaa26..010b736835e3 100755 --- a/src/CONST/index.ts +++ b/src/CONST/index.ts @@ -2481,12 +2481,19 @@ const CONST = { APPROVAL_ACCOUNT: 'approvalAccount', CUSTOM_FORM_ID_OPTIONS: 'customFormIDOptions', TOKEN_INPUT_STEP_NAMES: ['1', '2', '3', '4', '5'], + TOKEN_INPUT_PAGE_NAME: { + INSTALL: 'install', + AUTHENTICATION: 'authentication', + SOAP: 'soap', + ACCESS_TOKEN: 'access-token', + CREDENTIALS: 'credentials', + }, TOKEN_INPUT_STEP_KEYS: { - 0: 'installBundle', - 1: 'enableTokenAuthentication', - 2: 'enableSoapServices', - 3: 'createAccessToken', - 4: 'enterCredentials', + install: 'installBundle', + authentication: 'enableTokenAuthentication', + soap: 'enableSoapServices', + 'access-token': 'createAccessToken', + credentials: 'enterCredentials', }, IMPORT_CUSTOM_FIELDS: { CUSTOM_SEGMENTS: 'customSegments', diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 1d46e291aac4..c754292f73db 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -3232,8 +3232,13 @@ const ROUTES = { getRoute: (policyID: string) => `workspaces/${policyID}/accounting/netsuite/existing-connections` as const, }, POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT: { - route: 'workspaces/:policyID/accounting/netsuite/token-input', - getRoute: (policyID: string) => `workspaces/${policyID}/accounting/netsuite/token-input` as const, + route: 'workspaces/:policyID/accounting/netsuite/token-input/:subPage?', + getRoute: (policyID: string | undefined, subPage?: string) => { + if (!policyID) { + Log.warn('Invalid policyID is used to build the POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT route'); + } + return `workspaces/${policyID}/accounting/netsuite/token-input${subPage ? `/${subPage}` : ''}` as const; + }, }, POLICY_ACCOUNTING_NETSUITE_IMPORT: { route: 'workspaces/:policyID/accounting/netsuite/import', diff --git a/src/hooks/useSubPage/types.ts b/src/hooks/useSubPage/types.ts index c8152a3a3143..acf98d3210ed 100644 --- a/src/hooks/useSubPage/types.ts +++ b/src/hooks/useSubPage/types.ts @@ -3,7 +3,7 @@ import type {Route} from '@src/ROUTES'; type SubPageProps = { /** value indicating whether user is editing one of the sub pages */ - isEditing: boolean; + isEditing?: boolean; /** continues to next sub page */ onNext: (data?: unknown) => void; diff --git a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx index 484dbf3a19c1..bde758e40e36 100644 --- a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx +++ b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx @@ -1,28 +1,31 @@ -import React, {useRef} from 'react'; -import type {ComponentType, ForwardedRef} from 'react'; +import React from 'react'; import {View} from 'react-native'; import ConnectionLayout from '@components/ConnectionLayout'; -import InteractiveStepSubHeader from '@components/InteractiveStepSubHeader'; -import type {InteractiveStepSubHeaderHandle} from '@components/InteractiveStepSubHeader'; -import useSubStep from '@hooks/useSubStep'; +import InteractiveStepSubPageHeader from '@components/InteractiveStepSubPageHeader'; +import useSubPage from '@hooks/useSubPage'; import useThemeStyles from '@hooks/useThemeStyles'; import {isAuthenticationError} from '@libs/actions/connections'; import Navigation from '@libs/Navigation/Navigation'; -import type {SubStepWithPolicy} from '@pages/workspace/accounting/netsuite/types'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; import CONST from '@src/CONST'; +import ROUTES from '@src/ROUTES'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; +import type {CustomSubPageTokenInputProps} from '../types'; import NetSuiteTokenInputForm from './substeps/NetSuiteTokenInputForm'; import NetSuiteTokenSetupContent from './substeps/NetSuiteTokenSetupContent'; -const staticContentSteps = Array>(4).fill(NetSuiteTokenSetupContent); -const tokenInputSteps: Array> = [...staticContentSteps, NetSuiteTokenInputForm]; +const pages = [ + {pageName: CONST.NETSUITE_CONFIG.TOKEN_INPUT_PAGE_NAME.INSTALL, component: NetSuiteTokenSetupContent}, + {pageName: CONST.NETSUITE_CONFIG.TOKEN_INPUT_PAGE_NAME.AUTHENTICATION, component: NetSuiteTokenSetupContent}, + {pageName: CONST.NETSUITE_CONFIG.TOKEN_INPUT_PAGE_NAME.SOAP, component: NetSuiteTokenSetupContent}, + {pageName: CONST.NETSUITE_CONFIG.TOKEN_INPUT_PAGE_NAME.ACCESS_TOKEN, component: NetSuiteTokenSetupContent}, + {pageName: CONST.NETSUITE_CONFIG.TOKEN_INPUT_PAGE_NAME.CREDENTIALS, component: NetSuiteTokenInputForm}, +]; function NetSuiteTokenInputPage({policy}: WithPolicyConnectionsProps) { const policyID = policy?.id; const styles = useThemeStyles(); - const ref: ForwardedRef = useRef(null); const hasAuthError = isAuthenticationError(policy, CONST.POLICY.CONNECTIONS.NAME.NETSUITE); @@ -30,27 +33,19 @@ function NetSuiteTokenInputPage({policy}: WithPolicyConnectionsProps) { Navigation.dismissModal(); }; - const { - componentToRender: SubStep, - isEditing, - nextScreen, - prevScreen, - screenIndex, - moveTo, - } = useSubStep({bodyContent: tokenInputSteps, startFrom: hasAuthError ? 4 : 0, onFinished: submit}); + const {CurrentPage, nextPage, prevPage, pageIndex, moveTo, currentPageName} = useSubPage({ + pages, + onFinished: submit, + startFrom: hasAuthError ? 4 : 0, + buildRoute: (pageName) => ROUTES.POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT.getRoute(policyID, pageName), + }); const handleBackButtonPress = () => { - if (screenIndex === 0) { + if (pageIndex === 0) { Navigation.goBack(); return; } - ref.current?.movePrevious(); - prevScreen(); - }; - - const handleNextScreen = () => { - ref.current?.moveNext(); - nextScreen(); + prevPage(); }; const shouldPageBeBlocked = !isEmptyObject(policy?.connections?.[CONST.POLICY.CONNECTIONS.NAME.NETSUITE]) && !hasAuthError; @@ -68,20 +63,19 @@ function NetSuiteTokenInputPage({policy}: WithPolicyConnectionsProps) { onBackButtonPress={handleBackButtonPress} shouldLoadForEmptyConnection={isEmptyObject(policy?.connections?.[CONST.POLICY.CONNECTIONS.NAME.NETSUITE])} shouldBeBlocked={shouldPageBeBlocked} - shouldUseScrollView={SubStep !== NetSuiteTokenInputForm} + shouldUseScrollView={CurrentPage !== NetSuiteTokenInputForm} > - - diff --git a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/substeps/NetSuiteTokenInputForm.tsx b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/substeps/NetSuiteTokenInputForm.tsx index 4928fb2b4e17..b1f448c1bf0f 100644 --- a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/substeps/NetSuiteTokenInputForm.tsx +++ b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/substeps/NetSuiteTokenInputForm.tsx @@ -13,12 +13,12 @@ import {connectPolicyToNetSuite} from '@libs/actions/connections/NetSuiteCommand import {isMobileSafari} from '@libs/Browser'; import {addErrorMessage} from '@libs/ErrorUtils'; import Parser from '@libs/Parser'; -import type {SubStepWithPolicy} from '@pages/workspace/accounting/netsuite/types'; +import type {CustomSubPageTokenInputProps} from '@pages/workspace/accounting/netsuite/types'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import INPUT_IDS from '@src/types/form/NetSuiteTokenInputForm'; -function NetSuiteTokenInputForm({onNext, policyID}: SubStepWithPolicy) { +function NetSuiteTokenInputForm({onNext, policyID}: CustomSubPageTokenInputProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); const {inputCallbackRef} = useAutoFocusInput(); diff --git a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/substeps/NetSuiteTokenSetupContent.tsx b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/substeps/NetSuiteTokenSetupContent.tsx index 0301e634a582..541f52a11ba0 100644 --- a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/substeps/NetSuiteTokenSetupContent.tsx +++ b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/substeps/NetSuiteTokenSetupContent.tsx @@ -7,16 +7,16 @@ import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Parser from '@libs/Parser'; -import type {SubStepWithPolicy} from '@pages/workspace/accounting/netsuite/types'; +import type {CustomSubPageTokenInputProps} from '@pages/workspace/accounting/netsuite/types'; import CONST from '@src/CONST'; import type {TranslationPaths} from '@src/languages/types'; -function NetSuiteTokenSetupContent({onNext, screenIndex}: SubStepWithPolicy) { +function NetSuiteTokenSetupContent({onNext, currentPageName}: CustomSubPageTokenInputProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); const stepKeys = CONST.NETSUITE_CONFIG.TOKEN_INPUT_STEP_KEYS; - const currentStepKey = stepKeys[(screenIndex ?? 0) as keyof typeof stepKeys]; + const currentStepKey = stepKeys[currentPageName as keyof typeof stepKeys]; const titleKey = `workspace.netsuite.tokenInput.formSteps.${currentStepKey}.title` as TranslationPaths; const description = `workspace.netsuite.tokenInput.formSteps.${currentStepKey}.description` as TranslationPaths; diff --git a/src/pages/workspace/accounting/netsuite/types.ts b/src/pages/workspace/accounting/netsuite/types.ts index 910c5a67d9a0..61f9ef5c1041 100644 --- a/src/pages/workspace/accounting/netsuite/types.ts +++ b/src/pages/workspace/accounting/netsuite/types.ts @@ -3,6 +3,7 @@ import type {ValueOf} from 'type-fest'; import type {MenuItemProps} from '@components/MenuItem'; import type {OfflineWithFeedbackProps} from '@components/OfflineWithFeedback'; import type {SelectorType} from '@components/SelectionScreen'; +import type {SubPageProps} from '@hooks/useSubPage/types'; import type {SubStepProps} from '@hooks/useSubStep/types'; import type {ToggleSettingOptionRowProps} from '@pages/workspace/workflows/ToggleSettingsOptionRow'; import type CONST from '@src/CONST'; @@ -106,7 +107,7 @@ type CustomListSelectorType = SelectorType & { id: string; }; -type SubStepWithPolicy = SubStepProps & {policyID: string | undefined}; +type CustomSubPageTokenInputProps = SubPageProps & {policyID: string | undefined}; export type { MenuItem, @@ -118,5 +119,5 @@ export type { CustomFieldSubStepWithPolicy, CustomListSelectorType, ExtendedMenuItemWithSubscribedSettings, - SubStepWithPolicy, + CustomSubPageTokenInputProps, }; From 16cae1c090154ebd3d77fae6eaa4fc54a81401dd Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Thu, 29 Jan 2026 12:16:55 +0800 Subject: [PATCH 02/17] give the number a meaningful name --- .../netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx index bde758e40e36..2262f0b11585 100644 --- a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx +++ b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx @@ -22,6 +22,7 @@ const pages = [ {pageName: CONST.NETSUITE_CONFIG.TOKEN_INPUT_PAGE_NAME.ACCESS_TOKEN, component: NetSuiteTokenSetupContent}, {pageName: CONST.NETSUITE_CONFIG.TOKEN_INPUT_PAGE_NAME.CREDENTIALS, component: NetSuiteTokenInputForm}, ]; +const CREDENTIALS_PAGE_INDEX = 4; function NetSuiteTokenInputPage({policy}: WithPolicyConnectionsProps) { const policyID = policy?.id; @@ -36,7 +37,7 @@ function NetSuiteTokenInputPage({policy}: WithPolicyConnectionsProps) { const {CurrentPage, nextPage, prevPage, pageIndex, moveTo, currentPageName} = useSubPage({ pages, onFinished: submit, - startFrom: hasAuthError ? 4 : 0, + startFrom: hasAuthError ? CREDENTIALS_PAGE_INDEX : 0, buildRoute: (pageName) => ROUTES.POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT.getRoute(policyID, pageName), }); From 472b19a0e9704d09e3a5831651e9f0bc436e8c7c Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Thu, 29 Jan 2026 12:18:46 +0800 Subject: [PATCH 03/17] use full path --- .../netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx index 2262f0b11585..d5faad4b51ad 100644 --- a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx +++ b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx @@ -11,7 +11,7 @@ import withPolicyConnections from '@pages/workspace/withPolicyConnections'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; -import type {CustomSubPageTokenInputProps} from '../types'; +import type {CustomSubPageTokenInputProps} from '@pages/workspace/accounting/netsuite/types'; import NetSuiteTokenInputForm from './substeps/NetSuiteTokenInputForm'; import NetSuiteTokenSetupContent from './substeps/NetSuiteTokenSetupContent'; From 7fd4700693985989724daf80c5aec4f2eb074ef6 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Thu, 29 Jan 2026 12:23:00 +0800 Subject: [PATCH 04/17] get policyID from the params --- .../netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx index d5faad4b51ad..70e934c9c5c8 100644 --- a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx +++ b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx @@ -24,7 +24,7 @@ const pages = [ ]; const CREDENTIALS_PAGE_INDEX = 4; -function NetSuiteTokenInputPage({policy}: WithPolicyConnectionsProps) { +function NetSuiteTokenInputPage({policy, route}: WithPolicyConnectionsProps) { const policyID = policy?.id; const styles = useThemeStyles(); @@ -38,7 +38,7 @@ function NetSuiteTokenInputPage({policy}: WithPolicyConnectionsProps) { pages, onFinished: submit, startFrom: hasAuthError ? CREDENTIALS_PAGE_INDEX : 0, - buildRoute: (pageName) => ROUTES.POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT.getRoute(policyID, pageName), + buildRoute: (pageName) => ROUTES.POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT.getRoute(route.params.policyID, pageName), }); const handleBackButtonPress = () => { From ce7b1abdd61f9edc405a216cedec6c1c345b1ab4 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Thu, 29 Jan 2026 13:34:54 +0800 Subject: [PATCH 05/17] update type --- src/hooks/useSubPage/types.ts | 2 +- .../netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hooks/useSubPage/types.ts b/src/hooks/useSubPage/types.ts index acf98d3210ed..c8152a3a3143 100644 --- a/src/hooks/useSubPage/types.ts +++ b/src/hooks/useSubPage/types.ts @@ -3,7 +3,7 @@ import type {Route} from '@src/ROUTES'; type SubPageProps = { /** value indicating whether user is editing one of the sub pages */ - isEditing?: boolean; + isEditing: boolean; /** continues to next sub page */ onNext: (data?: unknown) => void; diff --git a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx index 70e934c9c5c8..8d28aba001de 100644 --- a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx +++ b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx @@ -74,6 +74,7 @@ function NetSuiteTokenInputPage({policy, route}: WithPolicyConnectionsProps) { /> Date: Thu, 29 Jan 2026 13:36:03 +0800 Subject: [PATCH 06/17] prettier --- .../netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx index 8d28aba001de..b2baec0f9995 100644 --- a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx +++ b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx @@ -6,12 +6,12 @@ import useSubPage from '@hooks/useSubPage'; import useThemeStyles from '@hooks/useThemeStyles'; import {isAuthenticationError} from '@libs/actions/connections'; import Navigation from '@libs/Navigation/Navigation'; +import type {CustomSubPageTokenInputProps} from '@pages/workspace/accounting/netsuite/types'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; -import type {CustomSubPageTokenInputProps} from '@pages/workspace/accounting/netsuite/types'; import NetSuiteTokenInputForm from './substeps/NetSuiteTokenInputForm'; import NetSuiteTokenSetupContent from './substeps/NetSuiteTokenSetupContent'; From 3f37288f31cd52133abe211f000f79aeeef949b5 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Fri, 30 Jan 2026 15:20:13 +0800 Subject: [PATCH 07/17] chore: restructure the const --- src/CONST/index.ts | 30 +++++++++++-------- .../NetSuiteTokenInputPage.tsx | 15 +++++----- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/CONST/index.ts b/src/CONST/index.ts index 40ae6a0ab628..ad2f3d0b9f2e 100755 --- a/src/CONST/index.ts +++ b/src/CONST/index.ts @@ -2482,19 +2482,23 @@ const CONST = { APPROVAL_ACCOUNT: 'approvalAccount', CUSTOM_FORM_ID_OPTIONS: 'customFormIDOptions', TOKEN_INPUT_STEP_NAMES: ['1', '2', '3', '4', '5'], - TOKEN_INPUT_PAGE_NAME: { - INSTALL: 'install', - AUTHENTICATION: 'authentication', - SOAP: 'soap', - ACCESS_TOKEN: 'access-token', - CREDENTIALS: 'credentials', - }, - TOKEN_INPUT_STEP_KEYS: { - install: 'installBundle', - authentication: 'enableTokenAuthentication', - soap: 'enableSoapServices', - 'access-token': 'createAccessToken', - credentials: 'enterCredentials', + TOKEN_INPUT: { + STEP_INDEX_LIST: ['1', '2', '3', '4'], + PAGE_NAME: { + INSTALL: 'install', + AUTHENTICATION: 'authentication', + SOAP: 'soap', + ACCESS_TOKEN: 'access-token', + CREDENTIALS: 'credentials', + }, + CREDENTIALS_PAGE_INDEX: 4, + STEP_KEYS: { + install: 'installBundle', + authentication: 'enableTokenAuthentication', + soap: 'enableSoapServices', + 'access-token': 'createAccessToken', + credentials: 'enterCredentials', + }, }, IMPORT_CUSTOM_FIELDS: { CUSTOM_SEGMENTS: 'customSegments', diff --git a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx index b2baec0f9995..1e6776d68587 100644 --- a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx +++ b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx @@ -16,13 +16,12 @@ import NetSuiteTokenInputForm from './substeps/NetSuiteTokenInputForm'; import NetSuiteTokenSetupContent from './substeps/NetSuiteTokenSetupContent'; const pages = [ - {pageName: CONST.NETSUITE_CONFIG.TOKEN_INPUT_PAGE_NAME.INSTALL, component: NetSuiteTokenSetupContent}, - {pageName: CONST.NETSUITE_CONFIG.TOKEN_INPUT_PAGE_NAME.AUTHENTICATION, component: NetSuiteTokenSetupContent}, - {pageName: CONST.NETSUITE_CONFIG.TOKEN_INPUT_PAGE_NAME.SOAP, component: NetSuiteTokenSetupContent}, - {pageName: CONST.NETSUITE_CONFIG.TOKEN_INPUT_PAGE_NAME.ACCESS_TOKEN, component: NetSuiteTokenSetupContent}, - {pageName: CONST.NETSUITE_CONFIG.TOKEN_INPUT_PAGE_NAME.CREDENTIALS, component: NetSuiteTokenInputForm}, + {pageName: CONST.NETSUITE_CONFIG.TOKEN_INPUT.PAGE_NAME.INSTALL, component: NetSuiteTokenSetupContent}, + {pageName: CONST.NETSUITE_CONFIG.TOKEN_INPUT.PAGE_NAME.AUTHENTICATION, component: NetSuiteTokenSetupContent}, + {pageName: CONST.NETSUITE_CONFIG.TOKEN_INPUT.PAGE_NAME.SOAP, component: NetSuiteTokenSetupContent}, + {pageName: CONST.NETSUITE_CONFIG.TOKEN_INPUT.PAGE_NAME.ACCESS_TOKEN, component: NetSuiteTokenSetupContent}, + {pageName: CONST.NETSUITE_CONFIG.TOKEN_INPUT.PAGE_NAME.CREDENTIALS, component: NetSuiteTokenInputForm}, ]; -const CREDENTIALS_PAGE_INDEX = 4; function NetSuiteTokenInputPage({policy, route}: WithPolicyConnectionsProps) { const policyID = policy?.id; @@ -37,7 +36,7 @@ function NetSuiteTokenInputPage({policy, route}: WithPolicyConnectionsProps) { const {CurrentPage, nextPage, prevPage, pageIndex, moveTo, currentPageName} = useSubPage({ pages, onFinished: submit, - startFrom: hasAuthError ? CREDENTIALS_PAGE_INDEX : 0, + startFrom: hasAuthError ? CONST.NETSUITE_CONFIG.TOKEN_INPUT.CREDENTIALS_PAGE_INDEX : 0, buildRoute: (pageName) => ROUTES.POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT.getRoute(route.params.policyID, pageName), }); @@ -69,7 +68,7 @@ function NetSuiteTokenInputPage({policy, route}: WithPolicyConnectionsProps) { From 7a46b72027d8f973e7a4cb47f705c2966e0fde91 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Fri, 30 Jan 2026 15:20:33 +0800 Subject: [PATCH 08/17] chore: remove unused const --- src/CONST/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/CONST/index.ts b/src/CONST/index.ts index ad2f3d0b9f2e..946104932f40 100755 --- a/src/CONST/index.ts +++ b/src/CONST/index.ts @@ -2481,7 +2481,6 @@ const CONST = { AUTO_CREATE_ENTITIES: 'autoCreateEntities', APPROVAL_ACCOUNT: 'approvalAccount', CUSTOM_FORM_ID_OPTIONS: 'customFormIDOptions', - TOKEN_INPUT_STEP_NAMES: ['1', '2', '3', '4', '5'], TOKEN_INPUT: { STEP_INDEX_LIST: ['1', '2', '3', '4'], PAGE_NAME: { From f4814532622412a0228069967ffb17883ba1a1f1 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Fri, 30 Jan 2026 18:07:36 +0800 Subject: [PATCH 09/17] forget to update how the const accessed --- .../NetSuiteTokenInput/substeps/NetSuiteTokenSetupContent.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/substeps/NetSuiteTokenSetupContent.tsx b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/substeps/NetSuiteTokenSetupContent.tsx index 541f52a11ba0..15cb664ee310 100644 --- a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/substeps/NetSuiteTokenSetupContent.tsx +++ b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/substeps/NetSuiteTokenSetupContent.tsx @@ -15,7 +15,7 @@ function NetSuiteTokenSetupContent({onNext, currentPageName}: CustomSubPageToken const styles = useThemeStyles(); const {translate} = useLocalize(); - const stepKeys = CONST.NETSUITE_CONFIG.TOKEN_INPUT_STEP_KEYS; + const stepKeys = CONST.NETSUITE_CONFIG.TOKEN_INPUT.STEP_KEYS; const currentStepKey = stepKeys[currentPageName as keyof typeof stepKeys]; const titleKey = `workspace.netsuite.tokenInput.formSteps.${currentStepKey}.title` as TranslationPaths; From 9ca32bb7d9c196481a51d4eb40bccbb5e9291fe2 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 3 Feb 2026 17:35:47 +0800 Subject: [PATCH 10/17] show loading indicator when redirecting --- .../netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx index 1e6776d68587..03ce0f45b2d0 100644 --- a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx +++ b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx @@ -1,6 +1,7 @@ import React from 'react'; import {View} from 'react-native'; import ConnectionLayout from '@components/ConnectionLayout'; +import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import InteractiveStepSubPageHeader from '@components/InteractiveStepSubPageHeader'; import useSubPage from '@hooks/useSubPage'; import useThemeStyles from '@hooks/useThemeStyles'; @@ -33,7 +34,7 @@ function NetSuiteTokenInputPage({policy, route}: WithPolicyConnectionsProps) { Navigation.dismissModal(); }; - const {CurrentPage, nextPage, prevPage, pageIndex, moveTo, currentPageName} = useSubPage({ + const {CurrentPage, nextPage, prevPage, pageIndex, moveTo, currentPageName, isRedirecting} = useSubPage({ pages, onFinished: submit, startFrom: hasAuthError ? CONST.NETSUITE_CONFIG.TOKEN_INPUT.CREDENTIALS_PAGE_INDEX : 0, @@ -50,6 +51,10 @@ function NetSuiteTokenInputPage({policy, route}: WithPolicyConnectionsProps) { const shouldPageBeBlocked = !isEmptyObject(policy?.connections?.[CONST.POLICY.CONNECTIONS.NAME.NETSUITE]) && !hasAuthError; + if (isRedirecting) { + return ; + } + return ( Date: Wed, 4 Feb 2026 01:14:21 +0800 Subject: [PATCH 11/17] update route type --- src/libs/Navigation/types.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index a29fb057fbda..63b4e26d54e0 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -932,6 +932,8 @@ type SettingsNavigatorParamList = { }; [SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_TOKEN_INPUT]: { policyID: string; + subPage?: string; + action?: 'edit'; }; [SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_IMPORT]: { policyID: string; From d21d48019514b7fc0faf97ef9f50ef4ef6f8933d Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Mon, 16 Feb 2026 14:51:27 +0800 Subject: [PATCH 12/17] directly open the subpage --- src/ROUTES.ts | 6 +++--- src/components/ConnectToNetSuiteFlow/index.tsx | 5 +++-- .../NetSuiteTokenInput/NetSuiteTokenInputPage.tsx | 8 ++------ .../{substeps => subPages}/NetSuiteTokenInputForm.tsx | 0 .../{substeps => subPages}/NetSuiteTokenSetupContent.tsx | 0 src/pages/workspace/accounting/netsuite/utils.ts | 9 +++++++++ src/pages/workspace/accounting/utils.tsx | 3 ++- 7 files changed, 19 insertions(+), 12 deletions(-) rename src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/{substeps => subPages}/NetSuiteTokenInputForm.tsx (100%) rename src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/{substeps => subPages}/NetSuiteTokenSetupContent.tsx (100%) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 2a5876e20726..f1791417c915 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -3356,12 +3356,12 @@ const ROUTES = { getRoute: (policyID: string) => `workspaces/${policyID}/accounting/netsuite/existing-connections` as const, }, POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT: { - route: 'workspaces/:policyID/accounting/netsuite/token-input/:subPage?', - getRoute: (policyID: string | undefined, subPage?: string) => { + route: 'workspaces/:policyID/accounting/netsuite/token-input/:subPage', + getRoute: (policyID: string | undefined, subPage: string) => { if (!policyID) { Log.warn('Invalid policyID is used to build the POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT route'); } - return `workspaces/${policyID}/accounting/netsuite/token-input${subPage ? `/${subPage}` : ''}` as const; + return `workspaces/${policyID}/accounting/netsuite/token-input/${subPage}` as const; }, }, POLICY_ACCOUNTING_NETSUITE_IMPORT: { diff --git a/src/components/ConnectToNetSuiteFlow/index.tsx b/src/components/ConnectToNetSuiteFlow/index.tsx index 3b681d7e39e5..abc5609d2c46 100644 --- a/src/components/ConnectToNetSuiteFlow/index.tsx +++ b/src/components/ConnectToNetSuiteFlow/index.tsx @@ -13,6 +13,7 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type {ConnectToNetSuiteFlowProps} from './types'; +import {getTokenInputStartPageName} from '@pages/workspace/accounting/netsuite/utils'; function ConnectToNetSuiteFlow({policyID}: ConnectToNetSuiteFlowProps) { const {translate} = useLocalize(); @@ -37,7 +38,7 @@ function ConnectToNetSuiteFlow({policyID}: ConnectToNetSuiteFlowProps) { icon: Expensicons.LinkCopy, text: translate('workspace.common.createNewConnection'), onSelected: () => { - Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT.getRoute(policyID)); + Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT.getRoute(policyID, getTokenInputStartPageName(policy))); setIsReuseConnectionsPopoverOpen(false); }, }, @@ -53,7 +54,7 @@ function ConnectToNetSuiteFlow({policyID}: ConnectToNetSuiteFlowProps) { useEffect(() => { if (shouldGoToCredentialsPage || !hasPoliciesConnectedToNetSuite) { - Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT.getRoute(policyID)); + Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT.getRoute(policyID, getTokenInputStartPageName(policy))); return; } setIsReuseConnectionsPopoverOpen(true); diff --git a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx index 03ce0f45b2d0..98ef4dc3165f 100644 --- a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx +++ b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx @@ -5,7 +5,6 @@ import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import InteractiveStepSubPageHeader from '@components/InteractiveStepSubPageHeader'; import useSubPage from '@hooks/useSubPage'; import useThemeStyles from '@hooks/useThemeStyles'; -import {isAuthenticationError} from '@libs/actions/connections'; import Navigation from '@libs/Navigation/Navigation'; import type {CustomSubPageTokenInputProps} from '@pages/workspace/accounting/netsuite/types'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; @@ -13,8 +12,8 @@ import withPolicyConnections from '@pages/workspace/withPolicyConnections'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; -import NetSuiteTokenInputForm from './substeps/NetSuiteTokenInputForm'; -import NetSuiteTokenSetupContent from './substeps/NetSuiteTokenSetupContent'; +import NetSuiteTokenInputForm from './subPages/NetSuiteTokenInputForm'; +import NetSuiteTokenSetupContent from './subPages/NetSuiteTokenSetupContent'; const pages = [ {pageName: CONST.NETSUITE_CONFIG.TOKEN_INPUT.PAGE_NAME.INSTALL, component: NetSuiteTokenSetupContent}, @@ -28,8 +27,6 @@ function NetSuiteTokenInputPage({policy, route}: WithPolicyConnectionsProps) { const policyID = policy?.id; const styles = useThemeStyles(); - const hasAuthError = isAuthenticationError(policy, CONST.POLICY.CONNECTIONS.NAME.NETSUITE); - const submit = () => { Navigation.dismissModal(); }; @@ -37,7 +34,6 @@ function NetSuiteTokenInputPage({policy, route}: WithPolicyConnectionsProps) { const {CurrentPage, nextPage, prevPage, pageIndex, moveTo, currentPageName, isRedirecting} = useSubPage({ pages, onFinished: submit, - startFrom: hasAuthError ? CONST.NETSUITE_CONFIG.TOKEN_INPUT.CREDENTIALS_PAGE_INDEX : 0, buildRoute: (pageName) => ROUTES.POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT.getRoute(route.params.policyID, pageName), }); diff --git a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/substeps/NetSuiteTokenInputForm.tsx b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/subPages/NetSuiteTokenInputForm.tsx similarity index 100% rename from src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/substeps/NetSuiteTokenInputForm.tsx rename to src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/subPages/NetSuiteTokenInputForm.tsx diff --git a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/substeps/NetSuiteTokenSetupContent.tsx b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/subPages/NetSuiteTokenSetupContent.tsx similarity index 100% rename from src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/substeps/NetSuiteTokenSetupContent.tsx rename to src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/subPages/NetSuiteTokenSetupContent.tsx diff --git a/src/pages/workspace/accounting/netsuite/utils.ts b/src/pages/workspace/accounting/netsuite/utils.ts index 6ee461504053..d3698949d62a 100644 --- a/src/pages/workspace/accounting/netsuite/utils.ts +++ b/src/pages/workspace/accounting/netsuite/utils.ts @@ -2,6 +2,9 @@ import type {ValueOf} from 'type-fest'; import {canUseProvincialTaxNetSuite, canUseTaxNetSuite} from '@libs/PolicyUtils'; import CONST from '@src/CONST'; import type {NetSuiteConnectionConfig, NetSuiteSubsidiary} from '@src/types/onyx/Policy'; +import {isAuthenticationError} from '@libs/actions/connections'; +import type Policy from '@src/types/onyx/Policy'; +import type {OnyxEntry} from 'react-native-onyx'; function shouldHideReimbursedReportsSection(config?: NetSuiteConnectionConfig) { return config?.reimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.JOURNAL_ENTRY; @@ -73,6 +76,11 @@ function getImportCustomFieldsSettings(importField: ValueOf `${importField}_${index}`); } +function getTokenInputStartPageName(policy: OnyxEntry) { + const hasAuthError = isAuthenticationError(policy, CONST.POLICY.CONNECTIONS.NAME.NETSUITE); + return hasAuthError ? CONST.NETSUITE_CONFIG.TOKEN_INPUT.PAGE_NAME.CREDENTIALS : CONST.NETSUITE_CONFIG.TOKEN_INPUT.PAGE_NAME.INSTALL; +} + export { shouldHideReimbursedReportsSection, shouldHideReportsExportTo, @@ -89,4 +97,5 @@ export { shouldHideTaxPostingAccountSelect, shouldHideExportForeignCurrencyAmount, getImportCustomFieldsSettings, + getTokenInputStartPageName, }; diff --git a/src/pages/workspace/accounting/utils.tsx b/src/pages/workspace/accounting/utils.tsx index a7bf68e6f21d..c509b6b084fa 100644 --- a/src/pages/workspace/accounting/utils.tsx +++ b/src/pages/workspace/accounting/utils.tsx @@ -23,6 +23,7 @@ import {isEmptyObject} from '@src/types/utils/EmptyObject'; import type IconAsset from '@src/types/utils/IconAsset'; import { getImportCustomFieldsSettings, + getTokenInputStartPageName, shouldHideCustomFormIDOptions, shouldHideExportForeignCurrencyAmount, shouldHideExportJournalsTo, @@ -221,7 +222,7 @@ function getAccountingIntegrationData( integrationAlias: CONST.UPGRADE_FEATURE_INTRO_MAPPING.netsuite.alias, backToAfterWorkspaceUpgradeRoute: integrationToDisconnect ? ROUTES.POLICY_ACCOUNTING.getRoute(policyID, connectionName, integrationToDisconnect, shouldDisconnectIntegrationBeforeConnecting) - : ROUTES.POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT.getRoute(policyID), + : ROUTES.POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT.getRoute(policyID, getTokenInputStartPageName(policy)), }, pendingFields: {...netsuiteConfig?.pendingFields, ...policy?.connections?.netsuite?.config?.pendingFields, ...policy?.connections?.netsuite?.options?.config?.pendingFields}, errorFields: {...netsuiteConfig?.errorFields, ...policy?.connections?.netsuite?.config?.errorFields, ...policy?.connections?.netsuite?.options?.config?.errorFields}, From 98faa3b16ec888b1e4a972d43ed7ec02ed859869 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Mon, 16 Feb 2026 14:56:15 +0800 Subject: [PATCH 13/17] readd removed code --- .../netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx index 98ef4dc3165f..352f31773f73 100644 --- a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx +++ b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx @@ -5,6 +5,7 @@ import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import InteractiveStepSubPageHeader from '@components/InteractiveStepSubPageHeader'; import useSubPage from '@hooks/useSubPage'; import useThemeStyles from '@hooks/useThemeStyles'; +import {isAuthenticationError} from '@libs/actions/connections'; import Navigation from '@libs/Navigation/Navigation'; import type {CustomSubPageTokenInputProps} from '@pages/workspace/accounting/netsuite/types'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; @@ -27,6 +28,8 @@ function NetSuiteTokenInputPage({policy, route}: WithPolicyConnectionsProps) { const policyID = policy?.id; const styles = useThemeStyles(); + const hasAuthError = isAuthenticationError(policy, CONST.POLICY.CONNECTIONS.NAME.NETSUITE); + const submit = () => { Navigation.dismissModal(); }; From 691a23e977f1b7a4b2fa02f66969a993d910c001 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Mon, 16 Feb 2026 14:57:27 +0800 Subject: [PATCH 14/17] update type --- src/libs/Navigation/types.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index 50125ec2b49e..a376ea3a5789 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -937,8 +937,6 @@ type SettingsNavigatorParamList = { }; [SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_TOKEN_INPUT]: { policyID: string; - subPage?: string; - action?: 'edit'; }; [SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_IMPORT]: { policyID: string; From f3bcb251c3fddfddb68c9f2067173008e6f52b4d Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Mon, 16 Feb 2026 14:57:42 +0800 Subject: [PATCH 15/17] remove unused code --- .../netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx index 352f31773f73..d07b29ebea61 100644 --- a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx +++ b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx @@ -1,7 +1,6 @@ import React from 'react'; import {View} from 'react-native'; import ConnectionLayout from '@components/ConnectionLayout'; -import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import InteractiveStepSubPageHeader from '@components/InteractiveStepSubPageHeader'; import useSubPage from '@hooks/useSubPage'; import useThemeStyles from '@hooks/useThemeStyles'; @@ -34,7 +33,7 @@ function NetSuiteTokenInputPage({policy, route}: WithPolicyConnectionsProps) { Navigation.dismissModal(); }; - const {CurrentPage, nextPage, prevPage, pageIndex, moveTo, currentPageName, isRedirecting} = useSubPage({ + const {CurrentPage, nextPage, prevPage, pageIndex, moveTo, currentPageName} = useSubPage({ pages, onFinished: submit, buildRoute: (pageName) => ROUTES.POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT.getRoute(route.params.policyID, pageName), @@ -50,10 +49,6 @@ function NetSuiteTokenInputPage({policy, route}: WithPolicyConnectionsProps) { const shouldPageBeBlocked = !isEmptyObject(policy?.connections?.[CONST.POLICY.CONNECTIONS.NAME.NETSUITE]) && !hasAuthError; - if (isRedirecting) { - return ; - } - return ( Date: Mon, 16 Feb 2026 17:21:40 +0800 Subject: [PATCH 16/17] rename --- src/components/ConnectToNetSuiteFlow/index.tsx | 6 +++--- src/pages/workspace/accounting/netsuite/utils.ts | 4 ++-- src/pages/workspace/accounting/utils.tsx | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/ConnectToNetSuiteFlow/index.tsx b/src/components/ConnectToNetSuiteFlow/index.tsx index abc5609d2c46..3db40c651bf6 100644 --- a/src/components/ConnectToNetSuiteFlow/index.tsx +++ b/src/components/ConnectToNetSuiteFlow/index.tsx @@ -13,7 +13,7 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type {ConnectToNetSuiteFlowProps} from './types'; -import {getTokenInputStartPageName} from '@pages/workspace/accounting/netsuite/utils'; +import {getInitialSubPageForNetsuiteTokenInput} from '@pages/workspace/accounting/netsuite/utils'; function ConnectToNetSuiteFlow({policyID}: ConnectToNetSuiteFlowProps) { const {translate} = useLocalize(); @@ -38,7 +38,7 @@ function ConnectToNetSuiteFlow({policyID}: ConnectToNetSuiteFlowProps) { icon: Expensicons.LinkCopy, text: translate('workspace.common.createNewConnection'), onSelected: () => { - Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT.getRoute(policyID, getTokenInputStartPageName(policy))); + Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT.getRoute(policyID, getInitialSubPageForNetsuiteTokenInput(policy))); setIsReuseConnectionsPopoverOpen(false); }, }, @@ -54,7 +54,7 @@ function ConnectToNetSuiteFlow({policyID}: ConnectToNetSuiteFlowProps) { useEffect(() => { if (shouldGoToCredentialsPage || !hasPoliciesConnectedToNetSuite) { - Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT.getRoute(policyID, getTokenInputStartPageName(policy))); + Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT.getRoute(policyID, getInitialSubPageForNetsuiteTokenInput(policy))); return; } setIsReuseConnectionsPopoverOpen(true); diff --git a/src/pages/workspace/accounting/netsuite/utils.ts b/src/pages/workspace/accounting/netsuite/utils.ts index d3698949d62a..1e47998a41f7 100644 --- a/src/pages/workspace/accounting/netsuite/utils.ts +++ b/src/pages/workspace/accounting/netsuite/utils.ts @@ -76,7 +76,7 @@ function getImportCustomFieldsSettings(importField: ValueOf `${importField}_${index}`); } -function getTokenInputStartPageName(policy: OnyxEntry) { +function getInitialSubPageForNetsuiteTokenInput(policy: OnyxEntry) { const hasAuthError = isAuthenticationError(policy, CONST.POLICY.CONNECTIONS.NAME.NETSUITE); return hasAuthError ? CONST.NETSUITE_CONFIG.TOKEN_INPUT.PAGE_NAME.CREDENTIALS : CONST.NETSUITE_CONFIG.TOKEN_INPUT.PAGE_NAME.INSTALL; } @@ -97,5 +97,5 @@ export { shouldHideTaxPostingAccountSelect, shouldHideExportForeignCurrencyAmount, getImportCustomFieldsSettings, - getTokenInputStartPageName, + getInitialSubPageForNetsuiteTokenInput, }; diff --git a/src/pages/workspace/accounting/utils.tsx b/src/pages/workspace/accounting/utils.tsx index c509b6b084fa..50f7d9569592 100644 --- a/src/pages/workspace/accounting/utils.tsx +++ b/src/pages/workspace/accounting/utils.tsx @@ -23,7 +23,7 @@ import {isEmptyObject} from '@src/types/utils/EmptyObject'; import type IconAsset from '@src/types/utils/IconAsset'; import { getImportCustomFieldsSettings, - getTokenInputStartPageName, + getInitialSubPageForNetsuiteTokenInput, shouldHideCustomFormIDOptions, shouldHideExportForeignCurrencyAmount, shouldHideExportJournalsTo, @@ -222,7 +222,7 @@ function getAccountingIntegrationData( integrationAlias: CONST.UPGRADE_FEATURE_INTRO_MAPPING.netsuite.alias, backToAfterWorkspaceUpgradeRoute: integrationToDisconnect ? ROUTES.POLICY_ACCOUNTING.getRoute(policyID, connectionName, integrationToDisconnect, shouldDisconnectIntegrationBeforeConnecting) - : ROUTES.POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT.getRoute(policyID, getTokenInputStartPageName(policy)), + : ROUTES.POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT.getRoute(policyID, getInitialSubPageForNetsuiteTokenInput(policy)), }, pendingFields: {...netsuiteConfig?.pendingFields, ...policy?.connections?.netsuite?.config?.pendingFields, ...policy?.connections?.netsuite?.options?.config?.pendingFields}, errorFields: {...netsuiteConfig?.errorFields, ...policy?.connections?.netsuite?.config?.errorFields, ...policy?.connections?.netsuite?.options?.config?.errorFields}, From 1af269cee986fbb5a1ba3d9a569fe7c57fed92a2 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Fri, 20 Feb 2026 18:18:10 +0800 Subject: [PATCH 17/17] lint --- src/components/ConnectToNetSuiteFlow/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ConnectToNetSuiteFlow/index.tsx b/src/components/ConnectToNetSuiteFlow/index.tsx index 3db40c651bf6..0cd41c8b0fd8 100644 --- a/src/components/ConnectToNetSuiteFlow/index.tsx +++ b/src/components/ConnectToNetSuiteFlow/index.tsx @@ -12,8 +12,8 @@ import type {AnchorPosition} from '@styles/index'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; -import type {ConnectToNetSuiteFlowProps} from './types'; import {getInitialSubPageForNetsuiteTokenInput} from '@pages/workspace/accounting/netsuite/utils'; +import type {ConnectToNetSuiteFlowProps} from './types'; function ConnectToNetSuiteFlow({policyID}: ConnectToNetSuiteFlowProps) { const {translate} = useLocalize();