Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 0 additions & 9 deletions src/components/ConnectToHRFlow/types.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import FullPageOfflineBlockingView from '@components/BlockingViews/FullPageOffli
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import Modal from '@components/Modal';

import useLocalize from '@hooks/useLocalize';
import useNetwork from '@hooks/useNetwork';
import useThemeStyles from '@hooks/useThemeStyles';

Expand All @@ -15,10 +14,9 @@ import {openAuthSessionAsync} from 'expo-web-browser';
import React, {useEffect, useRef, useState} from 'react';
import {StyleSheet, View} from 'react-native';

import type ConnectToHRFlowProps from './types';
import type ConnectToMergeFlowProps from './types';

function ConnectToHRFlow({setupLink, onDone}: ConnectToHRFlowProps) {
const {translate} = useLocalize();
function ConnectToMergeFlow({setupLink, title, onDone}: ConnectToMergeFlowProps) {
const styles = useThemeStyles();
const hasOpened = useRef(false);
const isDismissed = useRef(false);
Expand Down Expand Up @@ -77,7 +75,7 @@ function ConnectToHRFlow({setupLink, onDone}: ConnectToHRFlowProps) {
type={CONST.MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE}
>
<HeaderWithBackButton
title={translate('workspace.common.hr')}
title={title}
onBackButtonPress={dismiss}
/>
<FullPageOfflineBlockingView>
Expand All @@ -89,4 +87,4 @@ function ConnectToHRFlow({setupLink, onDone}: ConnectToHRFlowProps) {
);
}

export default ConnectToHRFlow;
export default ConnectToMergeFlow;
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import FullPageOfflineBlockingView from '@components/BlockingViews/FullPageOffli
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import Modal from '@components/Modal';

import useLocalize from '@hooks/useLocalize';
import useNetwork from '@hooks/useNetwork';
import useThemeStyles from '@hooks/useThemeStyles';

Expand All @@ -19,10 +18,9 @@ import React, {useEffect, useRef, useState} from 'react';
import {StyleSheet, View} from 'react-native';
import {WebView} from 'react-native-webview';

import type ConnectToHRFlowProps from './types';
import type ConnectToMergeFlowProps from './types';

function ConnectToHRFlow({setupLink, onDone}: ConnectToHRFlowProps) {
const {translate} = useLocalize();
function ConnectToMergeFlow({setupLink, title, onDone}: ConnectToMergeFlowProps) {
const styles = useThemeStyles();
const [isWebViewOpen, setIsWebViewOpen] = useState(true);
const [popupUrl, setPopupUrl] = useState<string | null>(null);
Expand Down Expand Up @@ -103,7 +101,7 @@ function ConnectToHRFlow({setupLink, onDone}: ConnectToHRFlowProps) {
type={CONST.MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE}
>
<HeaderWithBackButton
title={translate('workspace.common.hr')}
title={title}
onBackButtonPress={handleBackPress}
/>
<FullPageOfflineBlockingView>
Expand Down Expand Up @@ -152,4 +150,4 @@ function ConnectToHRFlow({setupLink, onDone}: ConnectToHRFlowProps) {
);
}

export default ConnectToHRFlow;
export default ConnectToMergeFlow;
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import {openLink} from '@userActions/Link';

import {useEffect} from 'react';

import type ConnectToHRFlowProps from './types';
import type ConnectToMergeFlowProps from './types';

function ConnectToHRFlow({setupLink}: ConnectToHRFlowProps) {
function ConnectToMergeFlow({setupLink}: ConnectToMergeFlowProps) {
const {environmentURL} = useEnvironment();

useEffect(() => {
Expand All @@ -16,4 +16,4 @@ function ConnectToHRFlow({setupLink}: ConnectToHRFlowProps) {
return null;
}

export default ConnectToHRFlow;
export default ConnectToMergeFlow;
12 changes: 12 additions & 0 deletions src/components/ConnectToMergeFlow/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
type ConnectToMergeFlowProps = {
/** The URL to open for the provider's Merge Link connection flow */
setupLink: string;

/** Title shown in the flow's header, e.g. the connection category the provider belongs to */
title: string;

/** Called when the flow is dismissed or completed so the parent can unmount the component */
onDone?: () => void;
};

export default ConnectToMergeFlowProps;
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {setMergeHRInitialSyncModalShown} from '@libs/actions/connections/merge/HR';
import {MERGE_INITIAL_SYNC_MODAL_SHOWN_KEYS, setMergeInitialSyncModalShown} from '@libs/actions/connections/merge';
import type {MergeConnectionName} from '@libs/merge/MergeUtils';
import TransitionTracker from '@libs/Navigation/TransitionTracker';
import Visibility from '@libs/Visibility';

Expand All @@ -13,13 +14,13 @@ import useOnyx from './useOnyx';
import usePolicy from './usePolicy';

/**
* Shows a one-time informational modal when the Merge HR connection's initial sync is in progress.
* Shows a one-time informational modal when the given Merge connection's initial sync is in progress.
*/
function useMergeHRInitialSyncingModal(policyID: string, isFocused: boolean) {
function useMergeInitialSyncingModal(policyID: string, connectionName: MergeConnectionName, isFocused: boolean) {
const policy = usePolicy(policyID);
const {showConfirmModal} = useConfirmModal();
const {translate} = useLocalize();
const [hasShownModal] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_MERGE_HR_INITIAL_SYNC_MODAL_SHOWN}${policyID}`);
const [hasShownModal] = useOnyx(`${MERGE_INITIAL_SYNC_MODAL_SHOWN_KEYS[connectionName]}${policyID}`);
const [isAppVisible, setIsAppVisible] = useState(Visibility.isVisible);
const [isAnyModalVisible] = useOnyx(ONYXKEYS.MODAL, {selector: (modal) => !!modal?.isVisible});

Expand All @@ -29,17 +30,17 @@ function useMergeHRInitialSyncingModal(policyID: string, isFocused: boolean) {
if (hasShownModal) {
return;
}
setMergeHRInitialSyncModalShown(policyID);
setMergeInitialSyncModalShown(policyID, connectionName);
showConfirmModal({
id: `merge-hr-syncing-${policyID}`,
title: translate('workspace.hr.syncingModalTitle'),
prompt: translate('workspace.hr.syncingModalDescription'),
id: `merge-syncing-${connectionName}-${policyID}`,
title: translate('workspace.merge.syncingModalTitle'),
prompt: translate('workspace.merge.syncingModalDescription'),
confirmText: translate('common.buttonConfirm'),
shouldShowCancelButton: false,
});
});

const mergeLastSync = policy?.connections?.[CONST.POLICY.CONNECTIONS.NAME.MERGE_HR]?.lastSync;
const mergeLastSync = policy?.connections?.[connectionName]?.lastSync;

useEffect(() => {
const isInitialSyncInProgress = mergeLastSync?.syncStatus === CONST.MERGE.SYNC_STATUS.SYNCING && mergeLastSync?.syncType === CONST.MERGE.SYNC_TYPE.INITIAL;
Expand All @@ -52,4 +53,4 @@ function useMergeHRInitialSyncingModal(policyID: string, isFocused: boolean) {
}, [mergeLastSync?.syncStatus, mergeLastSync?.syncType, isFocused, isAppVisible, isAnyModalVisible]);
}

export default useMergeHRInitialSyncingModal;
export default useMergeInitialSyncingModal;
4 changes: 2 additions & 2 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8599,8 +8599,6 @@ Fügen Sie weitere Ausgabelimits hinzu, um den Cashflow Ihres Unternehmens zu sc
providerApprovalMode: (providerName: string) => `${providerName}-Genehmigungsmodus`,
providerFinalApprover: (providerName: string) => `${providerName} Endgenehmigende*r`,
syncing: 'Mitarbeitende werden synchronisiert',
syncingModalTitle: 'Ihre Verbindung wird synchronisiert',
syncingModalDescription: 'Die erste Verbindung kann einige Zeit dauern. Sie werden über alle Fehler benachrichtigt.',
approvalModeDescription: (providerName: string) => `Mitglieder und Manager sind für die Synchronisation mit ${providerName} eingerichtet.`,
approvalModeWarningTitle: 'Genehmigungsmodus ändern?',
approvalModeWarningPrompt: (providerName: string, helpSiteURL: string) =>
Expand Down Expand Up @@ -8694,6 +8692,8 @@ Fügen Sie weitere Ausgabelimits hinzu, um den Cashflow Ihres Unternehmens zu sc
custom: 'Benutzerdefinierte Genehmigung',
advanced: 'Erweiterte Genehmigung',
},
syncingModalTitle: 'Ihre Verbindung wird synchronisiert',
syncingModalDescription: 'Die erste Verbindung kann einige Zeit dauern. Sie werden über alle Fehler benachrichtigt.',
syncLimitReached: {title: 'Versuchen Sie es morgen noch einmal', prompt: 'Sie haben Ihr Synchronisierungslimit für heute erreicht.'},
},
emptyDomain: {
Expand Down
4 changes: 2 additions & 2 deletions src/languages/el.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7577,8 +7577,6 @@ _Για πιο αναλυτικές οδηγίες, [επισκεφθείτε τ
providerApprovalMode: (providerName: string) => `λειτουργία έγκρισης ${providerName}`,
providerFinalApprover: (providerName: string) => `τελικός εγκριτής ${providerName}`,
syncing: 'Γίνεται συγχρονισμός υπαλλήλων',
syncingModalTitle: 'Η σύνδεσή σας συγχρονίζεται',
syncingModalDescription: 'Η πρώτη σύνδεση μπορεί να πάρει λίγο χρόνο. Θα ενημερωθείτε για τυχόν σφάλματα.',
approvalModeDescription: (providerName: string) => `Τα μέλη και οι υπεύθυνοι έχουν ρυθμιστεί ώστε να συγχρονίζονται με το ${providerName}.`,
approvalModeWarningTitle: 'Αλλαγή λειτουργίας έγκρισης;',
approvalModeWarningPrompt: (providerName: string, helpSiteURL: string) =>
Expand Down Expand Up @@ -7675,6 +7673,8 @@ _Για πιο αναλυτικές οδηγίες, [επισκεφθείτε τ
custom: 'Προσαρμοσμένη έγκριση',
advanced: 'Προηγμένη έγκριση',
},
syncingModalTitle: 'Η σύνδεσή σας συγχρονίζεται',
syncingModalDescription: 'Η πρώτη σύνδεση μπορεί να πάρει λίγο χρόνο. Θα ενημερωθείτε για τυχόν σφάλματα.',
syncLimitReached: {
title: 'Δοκιμάστε ξανά αύριο',
prompt: 'Έχετε φτάσει το όριο συγχρονισμών σας για σήμερα.',
Expand Down
4 changes: 2 additions & 2 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7554,8 +7554,6 @@ const translations = {
providerApprovalMode: (providerName: string) => `${providerName} approval mode`,
providerFinalApprover: (providerName: string) => `${providerName} final approver`,
syncing: 'Syncing employees',
syncingModalTitle: 'Your connection is syncing',
syncingModalDescription: "The first connection can take some time. You'll be notified of any errors.",
approvalModeDescription: (providerName: string) => `Members and managers are set up to sync with ${providerName}.`,
approvalModeWarningTitle: 'Change approval mode?',
approvalModeWarningPrompt: (providerName: string, helpSiteURL: string) =>
Expand Down Expand Up @@ -7655,6 +7653,8 @@ const translations = {
advanced: 'Advanced approval',
custom: 'Custom approval',
},
syncingModalTitle: 'Your connection is syncing',
syncingModalDescription: "The first connection can take some time. You'll be notified of any errors.",
syncLimitReached: {
title: 'Try again tomorrow',
prompt: "You've reached your sync limit for the day.",
Expand Down
4 changes: 2 additions & 2 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7317,8 +7317,6 @@ El plan Controlar empieza en 9 $ por miembro activo al mes.`,
providerApprovalMode: (providerName: string) => `Modo de aprobación de ${providerName}`,
providerFinalApprover: (providerName: string) => `Aprobador final de ${providerName}`,
syncing: 'Sincronizando empleados',
syncingModalTitle: 'Tu conexión se está sincronizando',
syncingModalDescription: 'La primera conexión puede tardar un poco. Se te notificará de cualquier error.',
approvalModeDescription: (providerName: string) => `Los miembros y gerentes están configurados para sincronizarse con ${providerName}.`,
approvalModeWarningTitle: '¿Cambiar modo de aprobación?',
approvalModeWarningPrompt: (providerName: string, helpSiteURL: string) =>
Expand Down Expand Up @@ -7412,6 +7410,8 @@ El plan Controlar empieza en 9 $ por miembro activo al mes.`,
custom: 'Aprobación personalizada',
advanced: 'Aprobación avanzada',
},
syncingModalTitle: 'Tu conexión se está sincronizando',
syncingModalDescription: 'La primera conexión puede tardar un poco. Se te notificará de cualquier error.',
syncLimitReached: {title: 'Inténtalo de nuevo mañana', prompt: 'Has alcanzado tu límite de sincronización de hoy.'},
},
export: {
Expand Down
4 changes: 2 additions & 2 deletions src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8616,8 +8616,6 @@ Ajoutez davantage de règles de dépenses pour protéger la trésorerie de l’e
providerApprovalMode: (providerName: string) => `Mode d'approbation ${providerName}`,
providerFinalApprover: (providerName: string) => `Approbateur final ${providerName}`,
syncing: 'Synchronisation des employés',
syncingModalTitle: 'Votre connexion est en cours de synchronisation',
syncingModalDescription: 'La première connexion peut prendre un certain temps. Vous serez informé de toute erreur.',
approvalModeDescription: (providerName: string) => `Les membres et les responsables sont configurés pour se synchroniser avec ${providerName}.`,
approvalModeWarningTitle: 'Changer le mode d’approbation ?',
approvalModeWarningPrompt: (providerName: string, helpSiteURL: string) =>
Expand Down Expand Up @@ -8711,6 +8709,8 @@ Ajoutez davantage de règles de dépenses pour protéger la trésorerie de l’e
custom: 'Approbation personnalisée',
advanced: 'Approbation avancée',
},
syncingModalTitle: 'Votre connexion est en cours de synchronisation',
syncingModalDescription: 'La première connexion peut prendre un certain temps. Vous serez informé de toute erreur.',
syncLimitReached: {title: 'Réessayez demain', prompt: "Vous avez atteint votre limite de synchronisation pour aujourd'hui."},
},
emptyDomain: {
Expand Down
4 changes: 2 additions & 2 deletions src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8546,8 +8546,6 @@ Aggiungi altre regole di spesa per proteggere il flusso di cassa aziendale.`,
providerApprovalMode: (providerName: string) => `Modalità di approvazione ${providerName}`,
providerFinalApprover: (providerName: string) => `Approvatore finale ${providerName}`,
syncing: 'Sincronizzazione dipendenti',
syncingModalTitle: 'La tua connessione è in sincronizzazione',
syncingModalDescription: "La prima connessione può richiedere un po' di tempo. Ti verrà notificato qualsiasi errore.",
approvalModeDescription: (providerName: string) => `I membri e i responsabili sono configurati per la sincronizzazione con ${providerName}.`,
approvalModeWarningTitle: 'Cambiare modalità di approvazione?',
approvalModeWarningPrompt: (providerName: string, helpSiteURL: string) =>
Expand Down Expand Up @@ -8641,6 +8639,8 @@ Aggiungi altre regole di spesa per proteggere il flusso di cassa aziendale.`,
custom: 'Approvazione personalizzata',
advanced: 'Approvazione avanzata',
},
syncingModalTitle: 'La tua connessione è in sincronizzazione',
syncingModalDescription: "La prima connessione può richiedere un po' di tempo. Ti verrà notificato qualsiasi errore.",
syncLimitReached: {title: 'Riprova domani', prompt: 'Hai raggiunto il limite di sincronizzazioni per oggi.'},
},
emptyDomain: {
Expand Down
4 changes: 2 additions & 2 deletions src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8438,8 +8438,6 @@ ${reportName}`,
providerApprovalMode: (providerName: string) => `${providerName} 承認モード`,
providerFinalApprover: (providerName: string) => `${providerName} 最終承認者`,
syncing: '従業員を同期しています',
syncingModalTitle: '接続を同期しています',
syncingModalDescription: '最初の接続には時間がかかる場合があります。エラーが発生した場合は通知されます。',
approvalModeDescription: (providerName: string) => `メンバーとマネージャーは ${providerName} と同期するように設定されています。`,
approvalModeWarningTitle: '承認モードを変更しますか?',
approvalModeWarningPrompt: (providerName: string, helpSiteURL: string) =>
Expand Down Expand Up @@ -8532,6 +8530,8 @@ ${reportName}`,
custom: 'カスタム承認',
advanced: '詳細承認',
},
syncingModalTitle: '接続を同期しています',
syncingModalDescription: '最初の接続には時間がかかる場合があります。エラーが発生した場合は通知されます。',
syncLimitReached: {title: '明日もう一度お試しください', prompt: '本日の同期上限に達しました。'},
},
emptyDomain: {
Expand Down
4 changes: 2 additions & 2 deletions src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8525,8 +8525,6 @@ er bestedingsregels toe om de kasstroom van het bedrijf te beschermen.`,
providerApprovalMode: (providerName: string) => `${providerName}-goedkeuringsmodus`,
providerFinalApprover: (providerName: string) => `Laatste ${providerName}-fiatteur`,
syncing: 'Werknemers synchroniseren',
syncingModalTitle: 'Je verbinding wordt gesynchroniseerd',
syncingModalDescription: 'De eerste verbinding kan even duren. Je krijgt een melding als er fouten optreden.',
approvalModeDescription: (providerName: string) => `Leden en managers zijn ingesteld om te synchroniseren met ${providerName}.`,
approvalModeWarningTitle: 'Goedkeuringsmodus wijzigen?',
approvalModeWarningPrompt: (providerName: string, helpSiteURL: string) =>
Expand Down Expand Up @@ -8620,6 +8618,8 @@ er bestedingsregels toe om de kasstroom van het bedrijf te beschermen.`,
custom: 'Aangepaste goedkeuring',
advanced: 'Geavanceerde goedkeuring',
},
syncingModalTitle: 'Je verbinding wordt gesynchroniseerd',
syncingModalDescription: 'De eerste verbinding kan even duren. Je krijgt een melding als er fouten optreden.',
syncLimitReached: {title: 'Probeer het morgen opnieuw', prompt: 'Je hebt je synchronisatielimiet voor vandaag bereikt.'},
},
emptyDomain: {title: 'Verbeter je beveiliging met domeinen', subtitle: 'Vereis dat leden op je domein inloggen via single sign-on, beperk het aanmaken van werkruimtes en meer.'},
Expand Down
Loading
Loading