Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
80ab6d4
Surface Import workflows on the Workflows page
MelvinBot Jun 26, 2026
c336859
Merge remote-tracking branch 'origin/main' into claude-importWorkflow…
MelvinBot Jul 1, 2026
90c5e99
Move More menu to page header and restore Add approval workflow in card
MelvinBot Jul 2, 2026
1123f29
Route Import workflows mapping step to a Workflows-context imported s…
MelvinBot Jul 2, 2026
ef4aaec
Merge remote-tracking branch 'origin/main' into claude-importWorkflow…
MelvinBot Jul 5, 2026
b9f028b
Reorder imports in ImportWorkflowsPage to satisfy import/order grouping
MelvinBot Jul 5, 2026
80c9738
Address Codex review: gate import by workflow write access, add 'Add …
MelvinBot Jul 7, 2026
3333db4
Fix: keep Workflows central pane under imported role picker
MelvinBot Jul 10, 2026
a40dc69
Merge remote-tracking branch 'origin/main' into claude-importWorkflow…
MelvinBot Jul 14, 2026
68ba641
Show only Import workflows in the Workflows More menu; restore Add ap…
MelvinBot Jul 14, 2026
93a63c0
Block workflows import for HR read-only workflow mode
MelvinBot Jul 15, 2026
1a4108c
Merge remote-tracking branch 'origin/main' into claude-importWorkflow…
MelvinBot Jul 17, 2026
1b6cd8b
Route Submit 2026 workspaces to approvals upgrade from Import workflows
MelvinBot Jul 17, 2026
42859f9
Merge remote-tracking branch 'origin/main' into claude-importWorkflow…
MelvinBot Jul 21, 2026
f06158b
Use 'Invite members' title and 'Invite' CTA on the workflows import c…
MelvinBot Jul 21, 2026
ef7a67d
Merge remote-tracking branch 'origin/main' into claude-importWorkflow…
MelvinBot Jul 28, 2026
4f5d823
Merge branch 'main' into claude-importWorkflowsOnWorkflowsPage
deetergp Jul 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4072,6 +4072,7 @@ const CONST = {
SETTINGS: 'settings',
EXPORT: 'export',
SYNC_WITH_HR: 'syncWithHR',
ADD_APPROVAL_WORKFLOW: 'addApprovalWorkflow',
},
MEMBERS_BULK_ACTION_TYPES: {
REMOVE: 'remove',
Expand Down Expand Up @@ -8870,6 +8871,7 @@ const CONST = {
WORKFLOWS: {
AUTO_REPORTING_FREQUENCY: 'WorkspaceWorkflows-AutoReportingFrequency',
ADD_APPROVAL: 'WorkspaceWorkflows-AddApproval',
MORE_DROPDOWN: 'WorkspaceWorkflows-MoreDropdown',
LOAD_MORE_APPROVALS: 'WorkspaceWorkflows-LoadMoreApprovals',
BANK_ACCOUNT: 'WorkspaceWorkflows-BankAccount',
ADD_BANK_ACCOUNT: 'WorkspaceWorkflows-AddBankAccount',
Expand Down
14 changes: 13 additions & 1 deletion src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ const DYNAMIC_ROUTES = {
},
IMPORTED_MEMBERS_ROLE: {
path: 'imported-members-role',
entryScreens: [SCREENS.WORKSPACE.MEMBERS_IMPORTED_CONFIRMATION],
entryScreens: [SCREENS.WORKSPACE.MEMBERS_IMPORTED_CONFIRMATION, SCREENS.WORKSPACE.WORKFLOWS_IMPORTED_CONFIRMATION],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep the imported role selector in the workflows context

When a workflow import includes non-workspace submitters/approvers, the confirmation page can open imported-members-role from WORKFLOWS_IMPORTED_CONFIRMATION, but the dynamic screen is still only related to SCREENS.WORKSPACE.MEMBERS in WORKSPACE_TO_RHP. Because getAdaptedStateFromPath() uses that inverse relation before considering the dynamic route's base path, refreshing/deep-linking/adapting this role picker reconstructs the Members page underneath instead of Workflows, so closing the RHP drops users into the wrong workspace section. This needs a workflow-specific relation/route or other handling before allowing the workflows confirmation as an entry screen.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MelvinBot lets fix this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 3333db4.

Root cause: the imported-members role picker (DYNAMIC_IMPORTED_MEMBERS_ROLE) was listed under SCREENS.WORKSPACE.MEMBERS in WORKSPACE_TO_RHP.ts. Its inverse (RHP_TO_WORKSPACE) maps each RHP screen to exactly one central pane, so RHP_TO_WORKSPACE[role] = MEMBERS. On refresh/deep-link, getMatchingFullScreenRoute matched that relation before reaching the dynamic base-path branch, forcing Members underneath even when the picker was opened from Workflows — exactly what you flagged.

Fix: removed the role screen from that relation (WORKSPACE_TO_RHP.ts). It's a dynamic route, so with no static pin getMatchingFullScreenRoute now falls through to its dynamic-suffix branch, which strips imported-members-role, re-parses the base confirmation path, and recurses — resolving RHP_TO_WORKSPACE[WORKFLOWS_IMPORTED_CONFIRMATION] = WORKFLOWS from the workflow flow and MEMBERS_IMPORTED_CONFIRMATION → MEMBERS from the member flow. So the correct section is now reconstructed underneath for both entry points, and closing the RHP lands the user in the right place.

Why not just add it to the WORKFLOWS group too?

createInverseRelation collapses to one central pane per RHP screen (last write wins), so listing it under both would simply swap the regression from Workflows to Members. Deferring to the base path is the only way to serve both entry points — the same mechanism dynamic routes already rely on (e.g. VERIFY_ACCOUNT, the accounting export selectors). Added an inline comment on the omission so it isn't "helpfully" re-added later.

Checks: lint (changed file) ✅, navigation Jest suite ✅ (37 suites / 419 tests). Pre-existing tsgo errors in the loading-indicator components (StyleSheet.absoluteFillObject) are unrelated to this change; the authoritative typecheck (tsc) runs in CI.

},
REPORT_SETTINGS: {
path: 'report-settings',
Expand Down Expand Up @@ -2730,6 +2730,18 @@ const ROUTES = {
return `workspaces/${policyID}/workflows` as const;
},
},
WORKSPACE_WORKFLOWS_IMPORT: {
route: 'workspaces/:policyID/workflows/import',
getRoute: (policyID: string) => `workspaces/${policyID}/workflows/import` as const,
},
WORKSPACE_WORKFLOWS_IMPORTED: {
route: 'workspaces/:policyID/workflows/imported',
getRoute: (policyID: string) => `workspaces/${policyID}/workflows/imported` as const,
},
WORKSPACE_WORKFLOWS_IMPORTED_CONFIRMATION: {
route: 'workspaces/:policyID/workflows/imported/confirmation',
getRoute: (policyID: string) => `workspaces/${policyID}/workflows/imported/confirmation` as const,
},
WORKSPACE_WORKFLOWS_APPROVALS_NEW: {
route: 'workspaces/:policyID/workflows/approvals/new',
getRoute: (policyID: string) => `workspaces/${policyID}/workflows/approvals/new` as const,
Expand Down
3 changes: 3 additions & 0 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,9 @@ const SCREENS = {
DYNAMIC_WORKSPACE_OVERVIEW_ADDRESS: 'Dynamic_Workspace_Overview_Address',
DYNAMIC_WORKSPACE_OVERVIEW_PLAN: 'Dynamic_Workspace_Overview_Plan_Type',
WORKFLOWS: 'Workspace_Workflows',
WORKFLOWS_IMPORT: 'Workspace_Workflows_Import',
WORKFLOWS_IMPORTED: 'Workspace_Workflows_Imported',
WORKFLOWS_IMPORTED_CONFIRMATION: 'Workspace_Workflows_Imported_Confirmation',
WORKFLOWS_PAYER: 'Workspace_Workflows_Payer',
WORKFLOWS_APPROVALS_NEW: 'Workspace_Approvals_New',
WORKFLOWS_APPROVALS_EDIT: 'Workspace_Approvals_Edit',
Expand Down
1 change: 1 addition & 0 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,7 @@ const translations: TranslationDeepObject<typeof en> = {
'Die hochgeladene Datei ist entweder leer oder enthält ungültige Daten. Bitte stelle sicher, dass die Datei korrekt formatiert ist und alle erforderlichen Informationen enthält, bevor du sie erneut hochlädst.',
importSpreadsheetLibraryError: 'Laden des Tabellenmoduls fehlgeschlagen. Bitte überprüfe deine Internetverbindung und versuche es erneut.',
importSpreadsheet: 'Tabellenkalkulation importieren',
importWorkflows: 'Workflows importieren',
downloadCSV: 'CSV herunterladen',
importMemberConfirmation: () => ({
one: `Bitte bestätige die folgenden Details für ein neues Workspace-Mitglied, das im Rahmen dieses Uploads hinzugefügt wird. Bestehende Mitglieder erhalten keine Rollenaktualisierungen oder Einladungsnachrichten.`,
Expand Down
1 change: 1 addition & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1272,6 +1272,7 @@ const translations = {
'The file you uploaded is either empty or contains invalid data. Please ensure that the file is correctly formatted and contains the necessary information before uploading it again.',
importSpreadsheetLibraryError: 'Failed to load spreadsheet module. Please check your internet connection and try again.',
importSpreadsheet: 'Import spreadsheet',
importWorkflows: 'Import workflows',
downloadCSV: 'Download CSV',
importMemberConfirmation: () => ({
one: `Please confirm the details below for a new workspace member that will be added as part of this upload. Existing members won’t receive any role updates or invite messages.`,
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,7 @@ const translations: TranslationDeepObject<typeof en> = {
'El archivo que subiste está vacío o contiene datos no válidos. Asegúrate de que el archivo esté correctamente formateado y contenga la información necesaria antes de volver a subirlo.',
importSpreadsheetLibraryError: 'Error al cargar el módulo de hojas de cálculo. Por favor, verifica tu conexión a internet e inténtalo de nuevo.',
importSpreadsheet: 'Importar hoja de cálculo',
importWorkflows: 'Importar flujos de trabajo',
downloadCSV: 'Descargar CSV',
importMemberConfirmation: () => ({
one: `Por favor confirma los detalles a continuación para un nuevo miembro del espacio de trabajo que se agregará como parte de esta carga. Los miembros existentes no recibirán actualizaciones de rol ni mensajes de invitación.`,
Expand Down
1 change: 1 addition & 0 deletions src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,7 @@ const translations: TranslationDeepObject<typeof en> = {
'Le fichier que vous avez téléchargé est soit vide, soit contient des données non valides. Veuillez vous assurer que le fichier est correctement formaté et contient les informations nécessaires avant de le télécharger à nouveau.',
importSpreadsheetLibraryError: 'Échec du chargement du module de feuille de calcul. Veuillez vérifier votre connexion Internet et réessayer.',
importSpreadsheet: 'Importer un tableau',
importWorkflows: 'Importer les workflows',
downloadCSV: 'Télécharger le CSV',
importMemberConfirmation: () => ({
one: `Veuillez confirmer les détails ci-dessous pour un nouveau membre de l’espace de travail qui sera ajouté dans le cadre de ce téléversement. Les membres existants ne recevront aucune mise à jour de rôle ni message d’invitation.`,
Expand Down
1 change: 1 addition & 0 deletions src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,7 @@ const translations: TranslationDeepObject<typeof en> = {
'Il file che hai caricato è vuoto oppure contiene dati non validi. Assicurati che il file sia formattato correttamente e contenga le informazioni necessarie prima di caricarlo di nuovo.',
importSpreadsheetLibraryError: 'Caricamento del modulo foglio di calcolo non riuscito. Controlla la connessione a Internet e riprova.',
importSpreadsheet: 'Importa foglio di calcolo',
importWorkflows: 'Importa flussi di lavoro',
downloadCSV: 'Scarica CSV',
importMemberConfirmation: () => ({
one: `Conferma i dettagli seguenti per il nuovo membro dello spazio di lavoro che verrà aggiunto come parte di questo caricamento. I membri esistenti non riceveranno aggiornamenti di ruolo né messaggi di invito.`,
Expand Down
1 change: 1 addition & 0 deletions src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,7 @@ const translations: TranslationDeepObject<typeof en> = {
'アップロードしたファイルは空であるか、無効なデータが含まれています。再度アップロードする前に、ファイルの形式が正しく、必要な情報が含まれていることを確認してください。',
importSpreadsheetLibraryError: 'スプレッドシートモジュールの読み込みに失敗しました。インターネット接続を確認して、もう一度お試しください。',
importSpreadsheet: 'スプレッドシートをインポート',
importWorkflows: 'ワークフローをインポート',
downloadCSV: 'CSV をダウンロード',
importMemberConfirmation: () => ({
one: `このアップロードの一部として追加される新しいワークスペースメンバーの詳細を、以下で確認してください。既存のメンバーにはロールの更新や招待メッセージは送信されません。`,
Expand Down
1 change: 1 addition & 0 deletions src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,7 @@ const translations: TranslationDeepObject<typeof en> = {
'Het bestand dat je hebt geüpload is leeg of bevat ongeldige gegevens. Controleer voordat je het opnieuw uploadt of het bestand correct is opgemaakt en alle vereiste informatie bevat.',
importSpreadsheetLibraryError: 'Laden van spreadsheetmodule mislukt. Controleer je internetverbinding en probeer het opnieuw.',
importSpreadsheet: 'Spreadsheet importeren',
importWorkflows: 'Workflows importeren',
downloadCSV: 'CSV downloaden',
importMemberConfirmation: () => ({
one: `Bevestig hieronder de gegevens voor een nieuw werkruimte‑lid dat wordt toegevoegd als onderdeel van deze upload. Bestaande leden ontvangen geen rolupdates of uitnodigingsberichten.`,
Expand Down
1 change: 1 addition & 0 deletions src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1192,6 +1192,7 @@ const translations: TranslationDeepObject<typeof en> = {
'Przesłany plik jest pusty lub zawiera nieprawidłowe dane. Upewnij się, że plik ma prawidłowy format i zawiera wszystkie wymagane informacje, zanim prześlesz go ponownie.',
importSpreadsheetLibraryError: 'Nie udało się załadować modułu arkusza kalkulacyjnego. Sprawdź połączenie z internetem i spróbuj ponownie.',
importSpreadsheet: 'Importuj arkusz kalkulacyjny',
importWorkflows: 'Importuj przepływy pracy',
downloadCSV: 'Pobierz plik CSV',
importMemberConfirmation: () => ({
one: `Potwierdź poniższe dane nowego członka przestrzeni roboczej, który zostanie dodany w ramach tego przesyłania. Istniejący członkowie nie otrzymają żadnych aktualizacji ról ani zaproszeń.`,
Expand Down
1 change: 1 addition & 0 deletions src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,7 @@ const translations: TranslationDeepObject<typeof en> = {
'O arquivo que você enviou está vazio ou contém dados inválidos. Verifique se o arquivo está formatado corretamente e contém as informações necessárias antes de enviá-lo novamente.',
importSpreadsheetLibraryError: 'Falha ao carregar o módulo de planilha. Verifique sua conexão com a internet e tente novamente.',
importSpreadsheet: 'Importar planilha',
importWorkflows: 'Importar fluxos de trabalho',
downloadCSV: 'Baixar CSV',
importMemberConfirmation: () => ({
one: `Confirme os detalhes abaixo para o novo membro do espaço de trabalho que será adicionado como parte deste envio. Membros existentes não receberão atualizações de função nem mensagens de convite.`,
Expand Down
1 change: 1 addition & 0 deletions src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,7 @@ const translations: TranslationDeepObject<typeof en> = {
invalidFileMessage: '您上传的文件为空或包含无效数据。请确保文件格式正确且包含所需信息,然后再重新上传。',
importSpreadsheetLibraryError: '加载电子表格模块失败。请检查您的互联网连接,然后重试。',
importSpreadsheet: '导入电子表格',
importWorkflows: '导入工作流程',
downloadCSV: '下载 CSV',
importMemberConfirmation: () => ({
one: `请确认以下新工作区成员的详细信息,该成员将作为此次上传的一部分被添加。现有成员不会收到任何角色更新或邀请消息。`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,11 @@ const SettingsModalStackNavigator = createModalStackNavigator<SettingsNavigatorP
require<ReactComponentModule>('../../../../pages/settings/Subscription/SubscriptionPlan/DynamicSubscriptionPlanDowngradeBlockedPage').default,
[SCREENS.WORKSPACE.DYNAMIC_WORKSPACE_INVITE]: () => require<ReactComponentModule>('../../../../pages/workspace/DynamicWorkspaceInvitePage').default,
[SCREENS.WORKSPACE.MEMBERS_IMPORT]: () => require<ReactComponentModule>('../../../../pages/workspace/members/ImportMembersPage').default,
[SCREENS.WORKSPACE.WORKFLOWS_IMPORT]: () => require<ReactComponentModule>('../../../../pages/workspace/workflows/ImportWorkflowsPage').default,
[SCREENS.WORKSPACE.MEMBERS_IMPORTED]: () => require<ReactComponentModule>('../../../../pages/workspace/members/ImportedMembersPage').default,
[SCREENS.WORKSPACE.MEMBERS_IMPORTED_CONFIRMATION]: () => require<ReactComponentModule>('../../../../pages/workspace/members/ImportedMembersConfirmationPage').default,
[SCREENS.WORKSPACE.WORKFLOWS_IMPORTED]: () => require<ReactComponentModule>('../../../../pages/workspace/members/ImportedMembersPage').default,
[SCREENS.WORKSPACE.WORKFLOWS_IMPORTED_CONFIRMATION]: () => require<ReactComponentModule>('../../../../pages/workspace/members/ImportedMembersConfirmationPage').default,
[SCREENS.WORKSPACE.WORKFLOWS_APPROVALS_NEW]: () => require<ReactComponentModule>('../../../../pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsCreatePage').default,
[SCREENS.WORKSPACE.WORKFLOWS_APPROVALS_EDIT]: () => require<ReactComponentModule>('../../../../pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsEditPage').default,
[SCREENS.WORKSPACE.DYNAMIC_WORKFLOWS_APPROVALS_EXPENSES_FROM]: () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,18 @@ const WORKSPACE_TO_RHP: Partial<Record<keyof WorkspaceSplitNavigatorParamList, s
SCREENS.WORKSPACE.MEMBERS_IMPORT,
SCREENS.WORKSPACE.MEMBERS_IMPORTED,
SCREENS.WORKSPACE.MEMBERS_IMPORTED_CONFIRMATION,
SCREENS.WORKSPACE.DYNAMIC_IMPORTED_MEMBERS_ROLE,
// DYNAMIC_IMPORTED_MEMBERS_ROLE (the imported-members role picker) is deliberately NOT listed here.
// It is a dynamic route shared by the Members and Workflows importers, so it must render under Members
// OR Workflows depending on the confirmation screen it was opened from. Pinning it to a central pane here
// would make getMatchingFullScreenRoute resolve that pane before reaching the dynamic base-path branch,
// forcing Members underneath even when opened from Workflows. Leaving it out lets the base path decide.
SCREENS.WORKSPACE.DYNAMIC_COMPANY_CARD_DETAILS,
],
[SCREENS.WORKSPACE.ROOMS]: [SCREENS.WORKSPACE.ROOM_CREATE],
[SCREENS.WORKSPACE.WORKFLOWS]: [
SCREENS.WORKSPACE.WORKFLOWS_IMPORT,
SCREENS.WORKSPACE.WORKFLOWS_IMPORTED,
SCREENS.WORKSPACE.WORKFLOWS_IMPORTED_CONFIRMATION,
SCREENS.WORKSPACE.WORKFLOWS_APPROVALS_NEW,
SCREENS.WORKSPACE.WORKFLOWS_APPROVALS_EDIT,
SCREENS.WORKSPACE.DYNAMIC_WORKFLOWS_APPROVALS_EXPENSES_FROM,
Expand Down
9 changes: 9 additions & 0 deletions src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,15 @@ const config: LinkingOptions<RootNavigatorParamList>['config'] = {
[SCREENS.WORKSPACE.MEMBERS_IMPORT]: {
path: ROUTES.WORKSPACE_MEMBERS_IMPORT.route,
},
[SCREENS.WORKSPACE.WORKFLOWS_IMPORT]: {
path: ROUTES.WORKSPACE_WORKFLOWS_IMPORT.route,
},
[SCREENS.WORKSPACE.WORKFLOWS_IMPORTED]: {
path: ROUTES.WORKSPACE_WORKFLOWS_IMPORTED.route,
},
[SCREENS.WORKSPACE.WORKFLOWS_IMPORTED_CONFIRMATION]: {
path: ROUTES.WORKSPACE_WORKFLOWS_IMPORTED_CONFIRMATION.route,
},
[SCREENS.WORKSPACE.MEMBERS_IMPORTED]: {
path: ROUTES.WORKSPACE_MEMBERS_IMPORTED.route,
},
Expand Down
9 changes: 9 additions & 0 deletions src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,15 @@ type SettingsNavigatorParamList = {
[SCREENS.WORKSPACE.MEMBERS_IMPORT]: {
policyID: string;
};
[SCREENS.WORKSPACE.WORKFLOWS_IMPORT]: {
policyID: string;
};
[SCREENS.WORKSPACE.WORKFLOWS_IMPORTED]: {
policyID: string;
};
[SCREENS.WORKSPACE.WORKFLOWS_IMPORTED_CONFIRMATION]: {
policyID: string;
};
[SCREENS.WORKSPACE.MEMBERS_IMPORTED]: {
policyID: string;
};
Expand Down
17 changes: 12 additions & 5 deletions src/pages/workspace/members/ImportedMembersConfirmationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,17 @@ import NotFoundPage from '@pages/ErrorPage/NotFoundPage';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES, {DYNAMIC_ROUTES} from '@src/ROUTES';
import type SCREENS from '@src/SCREENS';
import SCREENS from '@src/SCREENS';

import type {GestureResponderEvent} from 'react-native/Libraries/Types/CoreEventTypes';

import React, {useEffect, useMemo, useRef, useState} from 'react';
import {View} from 'react-native';

type ImportedMembersConfirmationPageProps = PlatformStackScreenProps<SettingsNavigatorParamList, typeof SCREENS.WORKSPACE.MEMBERS_IMPORTED>;
type ImportedMembersConfirmationPageProps = PlatformStackScreenProps<
SettingsNavigatorParamList,
typeof SCREENS.WORKSPACE.MEMBERS_IMPORTED_CONFIRMATION | typeof SCREENS.WORKSPACE.WORKFLOWS_IMPORTED_CONFIRMATION
>;

function ImportedMembersConfirmationPage({route}: ImportedMembersConfirmationPageProps) {
const styles = useThemeStyles();
Expand Down Expand Up @@ -96,11 +99,15 @@ function ImportedMembersConfirmationPage({route}: ImportedMembersConfirmationPag
openExternalLink(CONST.OLD_DOT_PUBLIC_URLS.PRIVACY_URL);
};

// The same confirmation screen is reused for the Members importer and the Workflows importer, so we return the user
// to the page the import was started from.
const isWorkflowsImport = route.name === SCREENS.WORKSPACE.WORKFLOWS_IMPORTED_CONFIRMATION;

const closeImportPageAndModal = () => {
setIsClosing(true);
setIsImporting(false);
closeImportPage();
Navigation.goBack(ROUTES.WORKSPACE_MEMBERS.getRoute(policyID));
Navigation.goBack(isWorkflowsImport ? ROUTES.WORKSPACE_WORKFLOWS.getRoute(policyID) : ROUTES.WORKSPACE_MEMBERS.getRoute(policyID));
};

const importMembers = async () => {
Expand Down Expand Up @@ -131,7 +138,7 @@ function ImportedMembersConfirmationPage({route}: ImportedMembersConfirmationPag
shouldShowOfflineIndicatorInWideScreen
>
<HeaderWithBackButton
title={translate('workspace.inviteMessage.confirmDetails')}
title={isWorkflowsImport ? translate('workspace.invite.members') : translate('workspace.inviteMessage.confirmDetails')}
subtitle={policy?.name}
shouldShowBackButton
onBackButtonPress={() => {
Expand Down Expand Up @@ -174,7 +181,7 @@ function ImportedMembersConfirmationPage({route}: ImportedMembersConfirmationPag
style={styles.mb3}
>
<Button.KeyboardShortcut />
<Button.Text>{translate('common.import')}</Button.Text>
<Button.Text>{isWorkflowsImport ? translate('common.invite') : translate('common.import')}</Button.Text>
</Button>
<PressableWithoutFeedback
onPress={openPrivacyURL}
Expand Down
Loading
Loading