diff --git a/src/ROUTES.ts b/src/ROUTES.ts index f10be93c951c..c077c3738e7c 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -2312,6 +2312,7 @@ const ROUTES = { SETTINGS_SUBSCRIPTION_CHANGE_BILLING_CURRENCY: 'settings/subscription/change-billing-currency', SETTINGS_SUBSCRIPTION_DISABLE_AUTO_RENEW_SURVEY: 'settings/subscription/disable-auto-renew-survey', SETTINGS_SUBSCRIPTION_CANCEL_SUBSCRIPTION: 'settings/subscription/cancel-subscription-survey', + SETTINGS_EMAIL_ISSUE: 'settings/email-issue', SETTINGS_SUBSCRIPTION_PAYMENT_HISTORY: 'settings/subscription/payment-history', SETTINGS_PRIORITY_MODE: 'settings/preferences/priority-mode', SETTINGS_LANGUAGE: 'settings/preferences/language', diff --git a/src/SCREENS.ts b/src/SCREENS.ts index 1e6e1d4f9b0c..b70fcda87d6e 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -95,6 +95,7 @@ const SCREENS = { TROUBLESHOOT: 'Settings_Troubleshoot', TROUBLESHOOT_SERVER: 'Settings_Troubleshoot_Server', HELP: 'Settings_Help', + EMAIL_ISSUE: 'Settings_Email_Issue', DYNAMIC_VERIFY_ACCOUNT: 'Dynamic_Verify_Account', DYNAMIC_ADD_BANK_ACCOUNT_VERIFY_ACCOUNT: 'Dynamic_Add_Bank_Account_Verify_Account', DYNAMIC_EXIT_SURVEY_CONFIRM: 'Dynamic_ExitSurvey_Confirm', diff --git a/src/languages/de.ts b/src/languages/de.ts index fd8e9d18cfa6..2e991882a5b0 100644 --- a/src/languages/de.ts +++ b/src/languages/de.ts @@ -1016,6 +1016,7 @@ const translations: TranslationDeepObject = { subtitle: ({date}: {date: string}) => `Abonnement endet am ${date}`, cta: 'Verwalten', }, + emailDeliveryFailure: {title: 'Wir können Ihnen keine E-Mail-Benachrichtigungen senden', subtitle: 'Konto'}, }, forYouSection: { submit: ({count}: {count: number}) => ({ @@ -11712,6 +11713,19 @@ Hier ist ein *Testbeleg*, um dir zu zeigen, wie es funktioniert:`, description: `Erstellen Sie benutzerdefinierte Agenten, die Ausgaben anhand Ihrer Regeln prüfen, genehmigen und weiterleiten. Mehr erfahren.`, }, }, + emailIssuePage: { + title: 'E-Mail-Problem', + intro: (login: string) => `Unser E-Mail-Anbieter hat das Senden an ${login} aufgrund von Zustellproblemen pausiert. Um dieses Problem zu beheben:`, + confirmEmailTitle: 'Bestätigen Sie Ihre E-Mail-Adresse', + confirmEmailDescription: (login: string) => + `Stellen Sie sicher, dass ${login} richtig geschrieben ist und ein echtes Postfach ist. Aliasse wie „expenses@domain.com“ benötigen ein eigenes funktionierendes Postfach, um sich bei Expensify anzumelden.`, + allowlistTitle: 'expensify.com auf die Allowlist setzen', + allowlistDescription: `Fügen Sie expensify.com zur Allowlist Ihres E-Mail-Clients hinzu. Möglicherweise muss Ihre IT-Abteilung die Servereinstellungen gemäß dieser Anleitung anpassen.`, + getHelpFromConcierge: 'Hilfe von Concierge erhalten', + completedSteps: 'Ich habe die obigen Schritte abgeschlossen', + errorTitle: 'Etwas ist schiefgelaufen. Bitte versuchen Sie es erneut', + errorPrompt: 'Anscheinend hat etwas nicht funktioniert. Bitte versuchen Sie es erneut. Wenn das Problem weiterhin besteht, wenden Sie sich bitte an Concierge.', + }, earlyRenewal: { confirmationDescription: ({startDate, endDate}: {startDate: string; endDate: string}) => `Verlängern Sie Ihr Abonnement für einen Zeitraum von 12 Monaten, von ${startDate} bis ${endDate}.`, diff --git a/src/languages/el.ts b/src/languages/el.ts index d7d7a7548e35..278d2b2d85e6 100644 --- a/src/languages/el.ts +++ b/src/languages/el.ts @@ -1055,6 +1055,7 @@ const translations: TranslationDeepObject = { subtitle: ({date}: {date: string}) => `Η συνδρομή λήγει στις ${date}`, cta: 'Διαχείριση', }, + emailDeliveryFailure: {title: 'Δεν μπορούμε να σας στέλνουμε ειδοποιήσεις μέσω email', subtitle: 'Λογαρια​σμός'}, }, freeTrialSection: { title: ({count}: {count: number}) => ({ @@ -11953,6 +11954,19 @@ ${reportName}`, employeePays: 'Ο εργαζόμενος πληρώνει', errorMessage: 'Δεν ήταν δυνατή η αλλαγή της προτίμησης χρέωσης μετατροπής νομίσματος. Παρακαλούμε δοκιμάστε ξανά ή επικοινωνήστε με την υποστήριξη.', }, + emailIssuePage: { + title: 'Πρόβλημα email', + intro: (login: string) => `Ο πάροχος email μας διέκοψε την αποστολή προς τη διεύθυνση ${login} λόγω προβλημάτων παράδοσης. Για να διορθώσετε αυτό το ζήτημα:`, + confirmEmailTitle: 'Επιβεβαιώστε τη διεύθυνση email σας', + confirmEmailDescription: (login: string) => + `Βεβαιωθείτε ότι το ${login} είναι σωστά γραμμένο και αντιστοιχεί σε πραγματικά εισερχό​μενα. Τα ψευδώνυμα όπως «expenses@domain.com» χρειάζονται τα δικά τους λειτουργικά εισερχό​μενα για να συνδεθούν στο Expensify.`, + allowlistTitle: 'Προσθέστε το expensify.com στη λίστα επιτρεπόμενων', + allowlistDescription: `Προσθέστε το expensify.com στη λίστα επιτρεπόμενων του προγράμματος ηλεκτρονικής αλληλογραφίας σας. Ίσως χρειαστείτε το τμήμα IT για να προσαρμόσει τις ρυθμίσεις διακομιστή μέσω αυτών των οδηγιών.`, + getHelpFromConcierge: 'Λάβετε βοήθεια από το Concierge', + completedSteps: 'Ολοκλήρωσα τα παραπάνω βήματα', + errorTitle: 'Κάτι πήγε στραβά. Δοκιμάστε ξανά', + errorPrompt: 'Φαίνεται πως κάτι δεν λειτούργησε. Δοκιμάστε ξανά. Αν το πρόβλημα συνεχιστεί, επικοινωνήστε με το Concierge.', + }, earlyRenewal: { confirmationDescription: ({startDate, endDate}: {startDate: string; endDate: string}) => `Ανανεώστε τη συνδρομή σας για περίοδο 12 μηνών, από ${startDate} έως ${endDate}.`, title: 'Ανανεώστε τη συνδρομή σας στο Expensify', diff --git a/src/languages/en.ts b/src/languages/en.ts index 61ab6e68a69f..6ecdea0e85d3 100644 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1097,6 +1097,10 @@ const translations = { title: "We couldn't bill your card on file", subtitle: 'Subscription', }, + emailDeliveryFailure: { + title: "We can't send you email notifications", + subtitle: 'Account', + }, payOverdueInvoice: { dueSoonTitle: ({date}: {date: string}) => `Pay your invoice by ${date} to avoid service interruption`, overdueTitle: 'Your payment is past due, please pay your invoice', @@ -3920,6 +3924,19 @@ const translations = { ensureYourEmailClient: `Ensure your email client allows expensify.com emails. You can find directions on how to complete this step here but you may need your IT department to help configure your email settings.`, onceTheAbove: `Once the above steps are completed, please reach out to ${CONST.EMAIL.CONCIERGE} to unblock your login.`, }, + emailIssuePage: { + title: 'Email issue', + intro: (login: string) => `Our email provider paused sending to ${login} due to delivery issues. To fix this issue:`, + confirmEmailTitle: 'Confirm your email address', + confirmEmailDescription: (login: string) => + `Make sure ${login} is spelled correctly and is a real inbox. Aliases like "expenses@domain.com" need their own working inbox to log into Expensify.`, + allowlistTitle: 'Allowlist expensify.com', + allowlistDescription: `Add expensify.com to your email client's allowlist. You may need IT to adjust server settings via these directions.`, + getHelpFromConcierge: 'Get help from Concierge', + completedSteps: "I've completed the above steps", + errorTitle: 'Something went wrong. Please try again', + errorPrompt: "Looks like something didn't work. Please try again. If the issue persists, please reach out to Concierge.", + }, openAppFailureModal: { title: 'Something went wrong...', subtitle: `We have not been able to load all of your data. We have been notified and are looking into the problem. If this persists, please reach out to`, diff --git a/src/languages/es.ts b/src/languages/es.ts index c5a2d9be8706..85f918060b81 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1008,6 +1008,7 @@ const translations: TranslationDeepObject = { subtitle: ({date}: {date: string}) => `La suscripción termina el ${date}`, cta: 'Gestionar', }, + emailDeliveryFailure: {title: 'No podemos enviarte notificaciones por correo electrónico', subtitle: 'Cuenta'}, }, freeTrialSection: { title: ({count}: {count: number}) => ({ @@ -11980,6 +11981,19 @@ ${reportName}`, description: `Crea agentes personalizados para revisar, aprobar y asignar gastos según las reglas que configures. Más información.`, }, }, + emailIssuePage: { + title: 'Problema de correo electrónico', + intro: (login: string) => `Nuestro proveedor de correo electrónico ha pausado el envío a ${login} debido a problemas de entrega. Para solucionar este problema:`, + confirmEmailTitle: 'Confirma tu dirección de correo electrónico', + confirmEmailDescription: (login: string) => + `Asegúrate de que ${login} esté escrito correctamente y sea un buzón real. Los alias como "expenses@domain.com" necesitan su propio buzón funcional para iniciar sesión en Expensify.`, + allowlistTitle: 'Incluye expensify.com en la lista de permitidos', + allowlistDescription: `Añade expensify.com a la lista de permitidos de tu cliente de correo electrónico. Es posible que tu equipo de TI deba ajustar la configuración del servidor siguiendo estas instrucciones.`, + getHelpFromConcierge: 'Obtén ayuda de Concierge', + completedSteps: 'He completado los pasos anteriores', + errorTitle: 'Algo salió mal. Por favor, inténtalo de nuevo.', + errorPrompt: 'Parece que algo no ha funcionado. Por favor, inténtalo de nuevo. Si el problema persiste, ponte en contacto con Concierge.', + }, earlyRenewal: { confirmationDescription: ({startDate, endDate}: {startDate: string; endDate: string}) => `Renueva tu suscripción por un período de 12 meses, desde ${startDate} hasta ${endDate}.`, title: 'Renueva tu suscripción de Expensify', diff --git a/src/languages/fr.ts b/src/languages/fr.ts index ef0e1e78c77e..cdb8e2c97255 100644 --- a/src/languages/fr.ts +++ b/src/languages/fr.ts @@ -1017,6 +1017,7 @@ const translations: TranslationDeepObject = { subtitle: ({date}: {date: string}) => `L’abonnement prend fin le ${date}`, cta: 'Gérer', }, + emailDeliveryFailure: {title: 'Nous ne pouvons pas vous envoyer de notifications par e-mail', subtitle: 'Compte'}, }, forYouSection: { submit: ({count}: {count: number}) => ({ @@ -11739,6 +11740,19 @@ Voici un *reçu test* pour vous montrer comment ça fonctionne :`, description: `Créez des agents personnalisés pour examiner, approuver et acheminer les dépenses selon les règles que vous définissez. En savoir plus.`, }, }, + emailIssuePage: { + title: 'Problème d’e-mail', + intro: (login: string) => `Notre fournisseur d’e-mails a interrompu l’envoi vers ${login} en raison de problèmes de distribution. Pour résoudre ce problème :`, + confirmEmailTitle: 'Confirmez votre adresse e-mail', + confirmEmailDescription: (login: string) => + `Assurez-vous que ${login} est correctement orthographié et qu’il s’agit d’une véritable boîte de réception. Les alias comme « expenses@domain.com » doivent avoir leur propre boîte de réception fonctionnelle pour se connecter à Expensify.`, + allowlistTitle: 'Ajouter expensify.com à la liste d’autorisation', + allowlistDescription: `Ajoutez expensify.com à la liste d’autorisation de votre client de messagerie. Vous aurez peut-être besoin que l’équipe informatique ajuste les paramètres du serveur en suivant ces instructions.`, + getHelpFromConcierge: 'Obtenir de l’aide de Concierge', + completedSteps: 'J’ai effectué les étapes ci-dessus', + errorTitle: 'Une erreur s’est produite. Veuillez réessayer.', + errorPrompt: "Il semble que quelque chose n'ait pas fonctionné. Veuillez réessayer. Si le problème persiste, veuillez contacter Concierge.", + }, earlyRenewal: { confirmationDescription: ({startDate, endDate}: {startDate: string; endDate: string}) => `Renouvelez votre abonnement pour une durée de 12 mois, du ${startDate} au ${endDate}.`, title: 'Renouvelez votre abonnement Expensify', diff --git a/src/languages/it.ts b/src/languages/it.ts index 200743b63e56..e461b3da0132 100644 --- a/src/languages/it.ts +++ b/src/languages/it.ts @@ -1016,6 +1016,7 @@ const translations: TranslationDeepObject = { subtitle: ({date}: {date: string}) => `L’abbonamento termina il ${date}`, cta: 'Gestisci', }, + emailDeliveryFailure: {title: 'Non possiamo inviarti notifiche via email', subtitle: 'Account'}, }, forYouSection: { submit: ({count}: {count: number}) => ({ @@ -11663,6 +11664,19 @@ Ecco una *ricevuta di prova* per mostrarti come funziona:`, description: `Crea agenti personalizzati per verificare, approvare e instradare le spese in base alle regole che imposti. Scopri di più.`, }, }, + emailIssuePage: { + title: 'Problema email', + intro: (login: string) => `Il nostro provider di posta elettronica ha sospeso l’invio a ${login} a causa di problemi di consegna. Per risolvere questo problema:`, + confirmEmailTitle: 'Conferma il tuo indirizzo email', + confirmEmailDescription: (login: string) => + `Assicurati che ${login} sia scritto correttamente e che sia una casella di posta reale. Gli alias come "expenses@domain.com" devono avere una propria casella di posta funzionante per accedere a Expensify.`, + allowlistTitle: 'Metti expensify.com nella allowlist', + allowlistDescription: `Aggiungi expensify.com alla allowlist del tuo client di posta elettronica. Potresti aver bisogno dell’IT per modificare le impostazioni del server seguendo queste istruzioni.`, + getHelpFromConcierge: 'Ottieni aiuto da Concierge', + completedSteps: 'Ho completato i passaggi sopra', + errorTitle: 'Qualcosa è andato storto. Riprova per favore', + errorPrompt: 'Sembra che qualcosa non abbia funzionato. Riprova. Se il problema persiste, contatta Concierge.', + }, earlyRenewal: { confirmationDescription: ({startDate, endDate}: {startDate: string; endDate: string}) => `Rinnova il tuo abbonamento per un periodo di 12 mesi, dal ${startDate} al ${endDate}.`, title: 'Rinnova il tuo abbonamento Expensify', diff --git a/src/languages/ja.ts b/src/languages/ja.ts index 5686951a9547..71f186dccff2 100644 --- a/src/languages/ja.ts +++ b/src/languages/ja.ts @@ -1003,6 +1003,7 @@ const translations: TranslationDeepObject = { subtitle: ({date}: {date: string}) => `サブスクリプションは${date}に終了`, cta: '管理', }, + emailDeliveryFailure: {title: 'メール通知をお送りできません', subtitle: 'アカウント'}, }, forYouSection: { submit: ({count}: {count: number}) => ({ @@ -11494,6 +11495,19 @@ ${reportName}`, description: `設定したルールに基づいて経費を確認、承認、振り分けるカスタムエージェントを作成できます。さらに詳しく。`, }, }, + emailIssuePage: { + title: 'メールの問題', + intro: (login: string) => `配信エラーのため、メールプロバイダーが${login} 宛ての送信を一時停止しました。この問題を解決するには:`, + confirmEmailTitle: 'メールアドレスを確認してください', + confirmEmailDescription: (login: string) => + `${login} の綴りが正しく、実在する受信トレイであることを確認してください。「expenses@domain.com」のようなエイリアスも、Expensify にログインするには、それ専用の有効な受信トレイが必要です。`, + allowlistTitle: 'expensify.com を許可リストに追加する', + allowlistDescription: `メールクライアントの許可リストにexpensify.comを追加してください。サーバー設定の調整が必要な場合は、IT 担当者に依頼してこちらの手順に従ってもらってください。`, + getHelpFromConcierge: 'Concierge に問い合わせる', + completedSteps: '上記の手順が完了しました', + errorTitle: '問題が発生しました。もう一度お試しください。', + errorPrompt: '問題が発生したようです。もう一度お試しください。問題が解決しない場合は、Concierge までお問い合わせください。', + }, earlyRenewal: { confirmationDescription: ({startDate, endDate}: {startDate: string; endDate: string}) => `${startDate} から ${endDate} までの12か月契約でサブスクリプションを更新します。`, title: 'Expensify のサブスクリプションを更新する', diff --git a/src/languages/nl.ts b/src/languages/nl.ts index b6b1bdd42149..14dc7da1b896 100644 --- a/src/languages/nl.ts +++ b/src/languages/nl.ts @@ -1015,6 +1015,7 @@ const translations: TranslationDeepObject = { subtitle: ({date}: {date: string}) => `Abonnement eindigt op ${date}`, cta: 'Beheren', }, + emailDeliveryFailure: {title: 'We kunnen je geen e-mailmeldingen sturen', subtitle: 'Account'}, }, forYouSection: { submit: ({count}: {count: number}) => ({ @@ -11627,6 +11628,19 @@ Hier is een *proefbon* om je te laten zien hoe het werkt:`, description: `Maak aangepaste agents om uitgaven te beoordelen, goed te keuren en door te sturen op basis van regels die jij instelt. Meer informatie.`, }, }, + emailIssuePage: { + title: 'E-mailprobleem', + intro: (login: string) => `Onze e-mailprovider is gestopt met verzenden naar ${login} vanwege afleveringsproblemen. Om dit op te lossen:`, + confirmEmailTitle: 'Bevestig je e-mailadres', + confirmEmailDescription: (login: string) => + `Zorg ervoor dat ${login} correct is gespeld en een echte inbox is. Aliassen zoals "expenses@domain.com" hebben hun eigen werkende inbox nodig om in te loggen bij Expensify.`, + allowlistTitle: 'expensify.com op de allowlist zetten', + allowlistDescription: `Voeg expensify.com toe aan de allowlist van je e-mailclient. Mogelijk moet IT de serverinstellingen aanpassen via deze instructies.`, + getHelpFromConcierge: 'Krijg hulp van Concierge', + completedSteps: 'Ik heb de bovenstaande stappen voltooid', + errorTitle: 'Er is iets misgegaan. Probeer het opnieuw.', + errorPrompt: 'Het lijkt erop dat er iets misging. Probeer het opnieuw. Als het probleem blijft bestaan, neem dan contact op met Concierge.', + }, earlyRenewal: { confirmationDescription: ({startDate, endDate}: {startDate: string; endDate: string}) => `Verleng je abonnement voor een periode van 12 maanden, van ${startDate} tot ${endDate}.`, title: 'Verleng je Expensify-abonnement', diff --git a/src/languages/pl.ts b/src/languages/pl.ts index d0218ffe04fe..1a71d952f76d 100644 --- a/src/languages/pl.ts +++ b/src/languages/pl.ts @@ -1022,6 +1022,7 @@ const translations: TranslationDeepObject = { subtitle: ({date}: {date: string}) => `Subskrypcja kończy się ${date}`, cta: 'Zarządzaj', }, + emailDeliveryFailure: {title: 'Nie możemy wysyłać ci powiadomień e-mail', subtitle: 'Konto'}, }, forYouSection: { submit: ({count}: {count: number}) => ({ @@ -11642,6 +11643,19 @@ Oto *paragon testowy*, żeby pokazać Ci, jak to działa:`, description: `Twórz niestandardowych agentów do przeglądania, zatwierdzania i kierowania wydatków na podstawie ustalonych przez siebie zasad. Dowiedz się więcej.`, }, }, + emailIssuePage: { + title: 'Problem z e‑mailem', + intro: (login: string) => `Nasz dostawca poczty wstrzymał wysyłanie na adres ${login} z powodu problemów z dostarczaniem. Aby rozwiązać ten problem:`, + confirmEmailTitle: 'Potwierdź swój adres e-mail', + confirmEmailDescription: (login: string) => + `Upewnij się, że ${login} jest wpisany poprawnie i że to prawdziwa skrzynka odbiorcza. Alias, taki jak „expenses@domain.com”, musi mieć własną działającą skrzynkę, żeby można było zalogować się do Expensify.`, + allowlistTitle: 'Dodaj expensify.com do listy dozwolonych', + allowlistDescription: `Dodaj expensify.com do listy dozwolonych w swoim kliencie e-mail. Możesz potrzebować pomocy działu IT, aby dostosować ustawienia serwera zgodnie z tymi wskazówkami.`, + getHelpFromConcierge: 'Uzyskaj pomoc od Concierge', + completedSteps: 'Wykonałem/am powyższe kroki', + errorTitle: 'Coś poszło nie tak. Spróbuj ponownie.', + errorPrompt: 'Wygląda na to, że coś nie zadziałało. Spróbuj ponownie. Jeśli problem będzie się powtarzał, skontaktuj się z Concierge.', + }, earlyRenewal: { confirmationDescription: ({startDate, endDate}: {startDate: string; endDate: string}) => `Odnów swoją subskrypcję na 12-miesięczny okres, od ${startDate} do ${endDate}.`, title: 'Odnów swoją subskrypcję Expensify', diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts index c3a3dd80685c..dcecfb25c4f2 100644 --- a/src/languages/pt-BR.ts +++ b/src/languages/pt-BR.ts @@ -1015,6 +1015,7 @@ const translations: TranslationDeepObject = { subtitle: ({date}: {date: string}) => `A assinatura termina em ${date}`, cta: 'Gerenciar', }, + emailDeliveryFailure: {title: 'Não podemos enviar notificações por e-mail para você', subtitle: 'Conta'}, }, forYouSection: { submit: ({count}: {count: number}) => ({ @@ -11619,6 +11620,19 @@ Aqui está um *comprovante de teste* para mostrar como funciona:`, description: `Crie agentes personalizados para revisar, aprovar e direcionar despesas com base nas regras que você definir. Saiba mais.`, }, }, + emailIssuePage: { + title: 'Problema de e-mail', + intro: (login: string) => `Nosso provedor de e-mail pausou o envio para ${login} devido a problemas de entrega. Para resolver esse problema:`, + confirmEmailTitle: 'Confirme seu endereço de e-mail', + confirmEmailDescription: (login: string) => + `Verifique se ${login} está escrito corretamente e é uma caixa de entrada real. Apelidos como "expenses@domain.com" precisam de uma caixa de entrada própria e funcional para entrar no Expensify.`, + allowlistTitle: 'Colocar expensify.com na lista de permissões', + allowlistDescription: `Adicione expensify.com à lista de permissões do seu cliente de e-mail. Talvez seja necessário que o TI ajuste as configurações do servidor seguindo estas instruções.`, + getHelpFromConcierge: 'Obter ajuda do Concierge', + completedSteps: 'Concluí as etapas acima', + errorTitle: 'Algo deu errado. Tente novamente.', + errorPrompt: 'Parece que algo não funcionou. Tente novamente. Se o problema persistir, entre em contato com a Concierge.', + }, earlyRenewal: { confirmationDescription: ({startDate, endDate}: {startDate: string; endDate: string}) => `Renove sua assinatura por um período de 12 meses, de ${startDate} a ${endDate}.`, title: 'Renove sua assinatura do Expensify', diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts index 71de802346df..188da5f9b552 100644 --- a/src/languages/zh-hans.ts +++ b/src/languages/zh-hans.ts @@ -978,6 +978,7 @@ const translations: TranslationDeepObject = { subtitle: ({date}: {date: string}) => `订阅将于 ${date} 结束`, cta: '管理', }, + emailDeliveryFailure: {title: '我们无法向你发送电子邮件通知', subtitle: '账户'}, }, forYouSection: { submit: ({count}: {count: number}) => ({ @@ -11203,6 +11204,19 @@ ${reportName}`, description: `创建自定义代理,根据你设置的规则审核、批准和分配报销。了解更多。`, }, }, + emailIssuePage: { + title: '邮件问题', + intro: (login: string) => `由于投递问题,我们的邮件服务提供商已暂停向 ${login} 发送邮件。要解决此问题:`, + confirmEmailTitle: '确认您的邮箱地址', + confirmEmailDescription: (login: string) => + `请确保 ${login} 拼写正确且是一个真实存在的收件箱。像“expenses@domain.com”这样的别名也需要有各自可正常使用的收件箱才能登录 Expensify。`, + allowlistTitle: '将 expensify.com 加入允许列表', + allowlistDescription: `将 expensify.com 添加到您的邮箱客户端的允许列表中。您可能需要 IT 通过这些说明调整服务器设置。`, + getHelpFromConcierge: '向 Concierge 寻求帮助', + completedSteps: '我已完成以上步骤', + errorTitle: '出现问题。请重试', + errorPrompt: '好像出了点问题。请重试。如果问题仍然存在,请联系 Concierge。', + }, earlyRenewal: { confirmationDescription: ({startDate, endDate}: {startDate: string; endDate: string}) => `将您的订阅续订为 12 个月期限,自 ${startDate} 至 ${endDate}。`, title: '续订您的 Expensify 订阅', diff --git a/src/libs/API/types.ts b/src/libs/API/types.ts index 883a395ae6bd..db07d220f287 100644 --- a/src/libs/API/types.ts +++ b/src/libs/API/types.ts @@ -692,6 +692,7 @@ const WRITE_COMMANDS = { GET_VALIDATE_CODE_FOR_ACCOUNT_MERGE: 'GetValidateCodeForAccountMerge', MERGE_WITH_VALIDATE_CODE: 'MergeWithValidateCode', RESET_SMS_DELIVERY_FAILURE_STATUS: 'ResetSMSDeliveryFailureStatus', + USER_UNBLOCK_EMAIL: 'User_UnblockEmail', SAVE_CORPAY_ONBOARDING_COMPANY_DETAILS: 'SaveCorpayOnboardingCompanyDetails', SAVE_CORPAY_ONBOARDING_BENEFICIAL_OWNER: 'SaveCorpayOnboardingBeneficialOwner', DELETE_APP_REPORT: 'DeleteAppReport', @@ -1192,6 +1193,7 @@ type WriteCommandParameters = { [WRITE_COMMANDS.SEND_REMINDER_FOR_CORPAY_SINGER_INFORMATION]: Parameters.SendReminderForCorpaySignerInformationParams; [WRITE_COMMANDS.UPDATE_WORKSPACE_CUSTOM_UNIT]: Parameters.UpdateWorkspaceCustomUnitParams; [WRITE_COMMANDS.RESET_SMS_DELIVERY_FAILURE_STATUS]: Parameters.ResetSMSDeliveryFailureStatusParams; + [WRITE_COMMANDS.USER_UNBLOCK_EMAIL]: null; [WRITE_COMMANDS.SAVE_CORPAY_ONBOARDING_COMPANY_DETAILS]: Parameters.SaveCorpayOnboardingCompanyDetailsParams; [WRITE_COMMANDS.SET_POLICY_PROHIBITED_EXPENSES]: Parameters.SetPolicyProhibitedExpensesParams; [WRITE_COMMANDS.SET_POLICY_COMMUTER_EXCLUSIONS]: Parameters.SetPolicyCommuterExclusionsParams; diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index 43af4494621e..10a029a8eb4f 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -1124,6 +1124,7 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../../pages/settings/Subscription/PaymentCard/DynamicPaymentCardCurrencySelectorPage').default, [SCREENS.SETTINGS.SUBSCRIPTION.ADD_PAYMENT_CARD]: () => require('../../../../pages/settings/Subscription/PaymentCard').default, + [SCREENS.SETTINGS.EMAIL_ISSUE]: () => require('../../../../pages/settings/EmailIssue').default, [SCREENS.WORKSPACE.REPORT_FIELDS_CREATE]: () => require('../../../../pages/workspace/reports/CreateReportFieldsPage').default, [SCREENS.WORKSPACE.DYNAMIC_REPORT_FIELDS_INITIAL_LIST_VALUE]: () => require('../../../../pages/workspace/reports/InitialListValueSelector/DynamicReportFieldsInitialListValuePage').default, diff --git a/src/libs/Navigation/linkingConfig/RELATIONS/HOME_TO_RHP.ts b/src/libs/Navigation/linkingConfig/RELATIONS/HOME_TO_RHP.ts index 4d56a8e9351f..f6aa58c81dee 100644 --- a/src/libs/Navigation/linkingConfig/RELATIONS/HOME_TO_RHP.ts +++ b/src/libs/Navigation/linkingConfig/RELATIONS/HOME_TO_RHP.ts @@ -2,8 +2,14 @@ import SCREENS from '@src/SCREENS'; const HOME_TO_RHP: Record = { // Transaction/report RHP screens opened from the Recently added slot keep Home underneath on refresh/deep-link. - // The Time Sensitive enter-signer-info flow keeps Home underneath too. - [SCREENS.HOME]: [SCREENS.RIGHT_MODAL.SEARCH_REPORT, SCREENS.RIGHT_MODAL.SEARCH_MONEY_REQUEST_REPORT, SCREENS.RIGHT_MODAL.EXPENSE_REPORT, SCREENS.REIMBURSEMENT_ACCOUNT_ENTER_SIGNER_INFO], + // The Time Sensitive enter-signer-info and email-issue flows keep Home underneath too. + [SCREENS.HOME]: [ + SCREENS.RIGHT_MODAL.SEARCH_REPORT, + SCREENS.RIGHT_MODAL.SEARCH_MONEY_REQUEST_REPORT, + SCREENS.RIGHT_MODAL.EXPENSE_REPORT, + SCREENS.REIMBURSEMENT_ACCOUNT_ENTER_SIGNER_INFO, + SCREENS.SETTINGS.EMAIL_ISSUE, + ], }; export default HOME_TO_RHP; diff --git a/src/libs/Navigation/linkingConfig/config.ts b/src/libs/Navigation/linkingConfig/config.ts index ba1c8e228bf7..057dfcf6b1d6 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -137,6 +137,10 @@ const config: LinkingOptions['config'] = { path: ROUTES.SETTINGS_SUBSCRIPTION_ADD_PAYMENT_CARD, exact: true, }, + [SCREENS.SETTINGS.EMAIL_ISSUE]: { + path: ROUTES.SETTINGS_EMAIL_ISSUE, + exact: true, + }, [SCREENS.SETTINGS.SUBSCRIPTION.CHANGE_BILLING_CURRENCY]: { path: ROUTES.SETTINGS_SUBSCRIPTION_CHANGE_BILLING_CURRENCY, exact: true, diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index dc664dd32594..28e95a6cd5a5 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -680,6 +680,7 @@ type SettingsNavigatorParamList = { [SCREENS.SETTINGS.SUBSCRIPTION.PAYMENT_HISTORY]: undefined; [SCREENS.SETTINGS.SUBSCRIPTION.SETTINGS_DETAILS]: undefined; [SCREENS.SETTINGS.SUBSCRIPTION.ADD_PAYMENT_CARD]: undefined; + [SCREENS.SETTINGS.EMAIL_ISSUE]: undefined; [SCREENS.SETTINGS.SUBSCRIPTION.CHANGE_BILLING_CURRENCY]: undefined; [SCREENS.SETTINGS.SUBSCRIPTION.DYNAMIC_PAYMENT_CARD_CURRENCY_SELECTOR]: undefined; [SCREENS.SETTINGS.SUBSCRIPTION.DYNAMIC_SUBSCRIPTION_DOWNGRADE_BLOCKED]: undefined; diff --git a/src/libs/actions/User.ts b/src/libs/actions/User.ts index c1adf3529dda..596613f79440 100644 --- a/src/libs/actions/User.ts +++ b/src/libs/actions/User.ts @@ -309,6 +309,38 @@ function updateNewsletterSubscription(isSubscribed: boolean) { }); } +/** + * Request to remove the current user's email from the suppression list. + * The backend derives the email from the session, so no params are sent. A backend failure still returns 200, so the + * caller decides success vs failure by re-reading `hasEmailDeliveryFailure` once `isUnblockingEmail` clears. + */ +function requestEmailUnblock() { + const optimisticData: Array> = [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: ONYXKEYS.ACCOUNT, + value: {isUnblockingEmail: true}, + }, + ]; + const successData: Array> = [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: ONYXKEYS.ACCOUNT, + value: {isUnblockingEmail: false}, + }, + ]; + // The failure surface is the ConfirmModal driven by hasEmailDeliveryFailure, so we deliberately do not write to account.errors here. + const failureData: Array> = [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: ONYXKEYS.ACCOUNT, + value: {isUnblockingEmail: false}, + }, + ]; + + API.write(WRITE_COMMANDS.USER_UNBLOCK_EMAIL, null, {optimisticData, successData, failureData}); +} + /** * Delete a specific contact method * @param contactMethod - the contact method being deleted @@ -1961,6 +1993,7 @@ export { resendValidateCode, requestContactMethodValidateCode, updateNewsletterSubscription, + requestEmailUnblock, deleteContactMethod, clearContactMethodErrors, clearContactMethod, diff --git a/src/pages/home/TimeSensitiveSection/items/FixEmailDelivery.tsx b/src/pages/home/TimeSensitiveSection/items/FixEmailDelivery.tsx new file mode 100644 index 000000000000..17e40a142d20 --- /dev/null +++ b/src/pages/home/TimeSensitiveSection/items/FixEmailDelivery.tsx @@ -0,0 +1,29 @@ +import BaseWidgetItem from '@components/BaseWidgetItem'; + +import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; +import useLocalize from '@hooks/useLocalize'; + +import Navigation from '@libs/Navigation/Navigation'; + +import CONST from '@src/CONST'; +import ROUTES from '@src/ROUTES'; + +import React from 'react'; + +function FixEmailDelivery() { + const {translate} = useLocalize(); + const icons = useMemoizedLazyExpensifyIcons(['Mail']); + + return ( + Navigation.navigate(ROUTES.SETTINGS_EMAIL_ISSUE)} + buttonVariant={CONST.BUTTON_VARIANT.DANGER} + /> + ); +} + +export default FixEmailDelivery; diff --git a/src/pages/home/TimeSensitiveSection/useTimeSensitiveItems.tsx b/src/pages/home/TimeSensitiveSection/useTimeSensitiveItems.tsx index 91ab72560081..e757a8ac118e 100644 --- a/src/pages/home/TimeSensitiveSection/useTimeSensitiveItems.tsx +++ b/src/pages/home/TimeSensitiveSection/useTimeSensitiveItems.tsx @@ -6,6 +6,7 @@ import useRefreshPendingDigitalWalletApproval from '@hooks/useRefreshPendingDigi import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; +import {isActingAsDelegateSelector} from '@selectors/Account'; import {createTimeSensitiveAdminPoliciesSelector} from '@selectors/Policy'; import React from 'react'; @@ -28,6 +29,7 @@ import AddVirtualCardPersonalDetails from './items/AddVirtualCardPersonalDetails import ConfirmDigitalWalletAddition from './items/ConfirmDigitalWalletAddition'; import EnterSignerInfo from './items/EnterSignerInfo'; import FixCompanyCardConnection from './items/FixCompanyCardConnection'; +import FixEmailDelivery from './items/FixEmailDelivery'; import FixFailedBilling from './items/FixFailedBilling'; import FixPersonalCardConnection from './items/FixPersonalCardConnection'; import FixPolicyConnection from './items/FixPolicyConnection'; @@ -66,6 +68,8 @@ function useTimeSensitiveItems(): React.ReactNode[] { useRefreshPendingDigitalWalletApproval(); const {shouldShowFixFailedBilling} = useTimeSensitiveBilling(); + // Hidden for delegates, since the fix flow writes to the delegator's account and contact method actions are blocked for them + const [hasEmailDeliveryFailure] = useOnyx(ONYXKEYS.ACCOUNT, {selector: (account) => !!account?.hasEmailDeliveryFailure && !isActingAsDelegateSelector(account)}); const {shouldShowOverdueInvoiceReminder, isOverdue: isInvoiceOverdue, invoiceGracePeriodEndUnixSeconds} = useTimeSensitiveOverdueInvoice(); const {shouldShowAddHomeAddress} = useTimeSensitiveHomeAddress(); const {shouldShowSubscriptionExpiring, subscriptionEndDate} = useTimeSensitiveSubscriptionExpiring(); @@ -101,20 +105,21 @@ function useTimeSensitiveItems(): React.ReactNode[] { // row first. // 1. Fix failed billing (existing customers with declined cards) // 2. Overdue subscription invoice for the billing owner - // 3. Potential card fraud - // 4. Renew subscription (annual subscription lapsing with auto-renew off) - // 5. Broken bank connections (company cards) - // 6. Broken bank connections (personal cards) - // 7. Locked bank accounts (workspace VBAs and personal) - // 8. Broken policy connections (accounting + HR) - // 9. Add home address (commuter exclusions, homeAndOffice method) - // 10. Add payment card (trial ended, no payment card) - // 11. Add bank account for a queued reimbursement - // 12. Enter signer info for global bank accounts - // 13. Expensify card shipping - // 14. Expensify card activation - // 15. Virtual Expensify card needs personal details - // 16. Digital wallet addition needs confirming + // 3. Can't send email notifications (email on the suppression list) + // 4. Potential card fraud + // 5. Renew subscription (annual subscription lapsing with auto-renew off) + // 6. Broken bank connections (company cards) + // 7. Broken bank connections (personal cards) + // 8. Locked bank accounts (workspace VBAs and personal) + // 9. Broken policy connections (accounting + HR) + // 10. Add home address (commuter exclusions, homeAndOffice method) + // 11. Add payment card (trial ended, no payment card) + // 12. Add bank account for a queued reimbursement + // 13. Enter signer info for global bank accounts + // 14. Expensify card shipping + // 15. Expensify card activation + // 16. Virtual Expensify card needs personal details + // 17. Digital wallet addition needs confirming const items: React.ReactNode[] = []; // Priority 1: Failed billing for existing customers @@ -131,7 +136,11 @@ function useTimeSensitiveItems(): React.ReactNode[] { />, ); } - // Priority 3: Card fraud alerts + // Priority 3: Email on the suppression list, so notifications can't be delivered + if (hasEmailDeliveryFailure) { + items.push(); + } + // Priority 4: Card fraud alerts if (shouldShowReviewCardFraud) { for (const card of cardsWithFraud) { if (!card.nameValuePairs?.possibleFraud) { @@ -145,7 +154,7 @@ function useTimeSensitiveItems(): React.ReactNode[] { ); } } - // Priority 4: Annual subscription lapsing with auto-renew off + // Priority 5: Annual subscription lapsing with auto-renew off if (shouldShowSubscriptionExpiring) { items.push( , ); } - // Priority 5: Broken company card connections + // Priority 6: Broken company card connections for (const connection of brokenCompanyCardConnections) { const card = cardFeedErrors.cardsWithBrokenFeedConnection[connection.cardID]; if (!card) { @@ -169,7 +178,7 @@ function useTimeSensitiveItems(): React.ReactNode[] { />, ); } - // Priority 6: Broken personal card connections + // Priority 7: Broken personal card connections for (const connection of brokenPersonalCardConnections) { const card = cardFeedErrors.personalCardsWithBrokenConnection[connection.cardID]; if (!card) { @@ -182,7 +191,7 @@ function useTimeSensitiveItems(): React.ReactNode[] { />, ); } - // Priority 7: Locked bank accounts + // Priority 8: Locked bank accounts for (const lockedBankAccount of lockedBankAccounts) { items.push( , ); } - // Priority 8: Broken policy connections (accounting + HR) + // Priority 9: Broken policy connections (accounting + HR) for (const connection of brokenPolicyConnections) { items.push( , ); } - // Priority 9: Add home address (commuter exclusions, homeAndOffice method) + // Priority 10: Add home address (commuter exclusions, homeAndOffice method) if (shouldShowAddHomeAddress) { items.push(); } - // Priority 10: Add payment card (trial ended, no payment card) + // Priority 11: Add payment card (trial ended, no payment card) if (shouldShowAddPaymentCard) { items.push(); } - // Priority 11: Add bank account for a queued reimbursement + // Priority 12: Add bank account for a queued reimbursement if (shouldShowAddBankAccount) { items.push(); } - // Priority 12: Enter signer info for global bank accounts + // Priority 13: Enter signer info for global bank accounts for (const item of pendingSignerInfo) { items.push( , ); } - // Priority 13: Expensify card shipping + // Priority 14: Expensify card shipping if (shouldShowAddShippingAddress) { for (const card of cardsNeedingShippingAddress) { items.push( @@ -238,7 +247,7 @@ function useTimeSensitiveItems(): React.ReactNode[] { ); } } - // Priority 14: Expensify card activation + // Priority 15: Expensify card activation if (shouldShowActivateCard) { for (const card of cardsNeedingActivation) { items.push( @@ -249,7 +258,7 @@ function useTimeSensitiveItems(): React.ReactNode[] { ); } } - // Priority 15: Virtual Expensify card needs personal details before reveal + // Priority 16: Virtual Expensify card needs personal details before reveal if (shouldShowAddVirtualCardPersonalDetails) { for (const card of virtualCardsNeedingPersonalDetails) { items.push( @@ -260,7 +269,7 @@ function useTimeSensitiveItems(): React.ReactNode[] { ); } } - // Priority 16: Confirm a digital wallet addition + // Priority 17: Confirm a digital wallet addition if (shouldShowConfirmDigitalWalletAddition) { for (const card of cardsPendingDigitalWalletApproval) { items.push( diff --git a/src/pages/settings/EmailIssue/index.tsx b/src/pages/settings/EmailIssue/index.tsx new file mode 100644 index 000000000000..fc65099fe46a --- /dev/null +++ b/src/pages/settings/EmailIssue/index.tsx @@ -0,0 +1,144 @@ +import Button from '@components/Button'; +import FixedFooter from '@components/FixedFooter'; +import HeaderWithBackButtonAndTitle from '@components/Header/composed/HeaderWithBackButtonAndTitle'; +import {ModalActions} from '@components/Modal/Global/ModalContext'; +import RenderHTML from '@components/RenderHTML'; +import ScreenWrapper from '@components/ScreenWrapper'; +import ScrollView from '@components/ScrollView'; +import Text from '@components/Text'; + +import useConfirmModal from '@hooks/useConfirmModal'; +import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; +import useLocalize from '@hooks/useLocalize'; +import useNetwork from '@hooks/useNetwork'; +import useOnyx from '@hooks/useOnyx'; +import {usePersonalDetailsByIDs} from '@hooks/usePersonalDetails'; +import usePrevious from '@hooks/usePrevious'; +import useThemeStyles from '@hooks/useThemeStyles'; + +import Navigation from '@libs/Navigation/Navigation'; + +import {navigateToConciergeChat} from '@userActions/Report'; +import {requestEmailUnblock} from '@userActions/User'; + +import CONST from '@src/CONST'; +import ONYXKEYS from '@src/ONYXKEYS'; +import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue'; + +import {useIsFocused} from '@react-navigation/native'; +import {hasSeenTourSelector} from '@selectors/Onboarding'; +import React, {useEffect} from 'react'; +import {View} from 'react-native'; + +function EmailIssuePage() { + const styles = useThemeStyles(); + const {translate} = useLocalize(); + const {isOffline} = useNetwork(); + const {showConfirmModal} = useConfirmModal(); + const isFocused = useIsFocused(); + + const [account, accountMetadata] = useOnyx(ONYXKEYS.ACCOUNT); + const {login, accountID: currentUserAccountID} = useCurrentUserPersonalDetails(); + + const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID); + const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED); + const [isSelfTourViewed] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {selector: hasSeenTourSelector}); + const [conciergePersonalDetails] = usePersonalDetailsByIDs([CONST.ACCOUNT_ID.CONCIERGE]); + + const hasEmailDeliveryFailure = !!account?.hasEmailDeliveryFailure; + const isUnblockingEmail = !!account?.isUnblockingEmail; + const prevIsUnblockingEmail = usePrevious(isUnblockingEmail); + + // Leave whenever the flag is false while this page is mounted. This covers both a successful unblock + // (the flag clears, so we dismiss) and landing here via a stale deep link when there was never a failure. + // Wait for the account to finish loading first, otherwise a still-loading `false` triggers a spurious redirect. + // Only leave while this page is on top, so a flag that clears while Concierge is open doesn't close Concierge instead. + // On a cold deep link this runs before the navigation ref is ready, when goBack() would be a no-op, so wait for it. + useEffect(() => { + if (!isFocused || isLoadingOnyxValue(accountMetadata) || hasEmailDeliveryFailure) { + return; + } + Navigation.isNavigationReady().then(() => Navigation.goBack()); + }, [isFocused, accountMetadata, hasEmailDeliveryFailure]); + + // The request has finished once isUnblockingEmail falls from true to false. A backend failure still + // returns 200, so if the flag is still set the unblock did not take. Surface the single generic retry modal. + useEffect(() => { + if (!prevIsUnblockingEmail || isUnblockingEmail || !hasEmailDeliveryFailure) { + return; + } + showConfirmModal({ + id: 'emailIssueRetry', + title: translate('emailIssuePage.errorTitle'), + prompt: translate('emailIssuePage.errorPrompt'), + confirmText: translate('common.tryAgain'), + cancelText: translate('common.dismiss'), + shouldShowCancelButton: true, + shouldDisableConfirmButtonWhenOffline: true, + }).then((result) => { + if (result?.action !== ModalActions.CONFIRM) { + return; + } + requestEmailUnblock(); + }); + }, [prevIsUnblockingEmail, isUnblockingEmail, hasEmailDeliveryFailure, showConfirmModal, translate]); + + return ( + + + + + + + + + {`1. ${translate('emailIssuePage.confirmEmailTitle')}`} + + + + + + {`2. ${translate('emailIssuePage.allowlistTitle')}`} + + + + + + + + + + + + ); +} + +export default EmailIssuePage; diff --git a/src/types/onyx/Account.ts b/src/types/onyx/Account.ts index 1a5d86a57143..8f8683689812 100644 --- a/src/types/onyx/Account.ts +++ b/src/types/onyx/Account.ts @@ -83,6 +83,9 @@ type Account = { /** Is this account having trouble receiving emails? */ hasEmailDeliveryFailure?: boolean; + /** Whether an email unblock request is currently in flight */ + isUnblockingEmail?: boolean; + /** User recovery codes for setting up 2-FA */ recoveryCodes?: string; diff --git a/tests/actions/UserTest.ts b/tests/actions/UserTest.ts index 68f64b35f4f8..79190046810d 100644 --- a/tests/actions/UserTest.ts +++ b/tests/actions/UserTest.ts @@ -406,6 +406,54 @@ describe('actions/User', () => { }); }); + describe('requestEmailUnblock', () => { + it('should call API.write with USER_UNBLOCK_EMAIL and no params', async () => { + // Given the user is on the email issue page + + // When requestEmailUnblock is called + UserActions.requestEmailUnblock(); + await waitForBatchedUpdates(); + + // Then API.write targets USER_UNBLOCK_EMAIL with null params, since the backend derives the email from the session + expect(mockAPI.write).toHaveBeenCalledWith( + WRITE_COMMANDS.USER_UNBLOCK_EMAIL, + null, + expect.objectContaining({ + optimisticData: anyArray, + successData: anyArray, + failureData: anyArray, + }), + ); + }); + + it('should set isUnblockingEmail optimistically', async () => { + // When requestEmailUnblock is called + UserActions.requestEmailUnblock(); + await waitForBatchedUpdates(); + + // Then the optimistic update flags the account as unblocking + const onyxData = mockAPI.write.mock.calls.at(0)?.[2]; + const optimisticUpdate = onyxData?.optimisticData?.find((update) => update.key === ONYXKEYS.ACCOUNT); + + expect(optimisticUpdate?.value).toEqual({isUnblockingEmail: true}); + }); + + it('should clear isUnblockingEmail on both success and failure without writing to account.errors', async () => { + // When requestEmailUnblock is called + UserActions.requestEmailUnblock(); + await waitForBatchedUpdates(); + + // Then both branches clear the loading flag, and neither writes account.errors: the ConfirmModal on + // EmailIssuePage is the only failure surface (deliberate deviation from the generic-error spec). + const onyxData = mockAPI.write.mock.calls.at(0)?.[2]; + const successUpdate = onyxData?.successData?.find((update) => update.key === ONYXKEYS.ACCOUNT); + const failureUpdate = onyxData?.failureData?.find((update) => update.key === ONYXKEYS.ACCOUNT); + + expect(successUpdate?.value).toEqual({isUnblockingEmail: false}); + expect(failureUpdate?.value).toEqual({isUnblockingEmail: false}); + }); + }); + describe('validateSecondaryLogin', () => { beforeEach(() => { jest.spyOn(DeviceActions, 'getDeviceInfoWithID').mockResolvedValue('{"deviceID":"test-device"}'); diff --git a/tests/ui/EmailIssuePageTest.tsx b/tests/ui/EmailIssuePageTest.tsx new file mode 100644 index 000000000000..a076588ffc7d --- /dev/null +++ b/tests/ui/EmailIssuePageTest.tsx @@ -0,0 +1,272 @@ +import {act, fireEvent, render, screen} from '@testing-library/react-native'; + +import {LocaleContextProvider} from '@components/LocaleContextProvider'; + +import type useOnyx from '@hooks/useOnyx'; + +import Navigation from '@libs/Navigation/Navigation'; +import type * as NetworkStateModule from '@libs/NetworkState'; + +import EmailIssuePage from '@pages/settings/EmailIssue'; + +import * as UserActions from '@userActions/User'; + +import ONYXKEYS from '@src/ONYXKEYS'; + +import type * as NativeNavigation from '@react-navigation/native'; +import type ReactNative from 'react-native'; + +import React from 'react'; +import Onyx from 'react-native-onyx'; + +import * as TestHelper from '../utils/TestHelper'; +import waitForBatchedUpdatesWithAct from '../utils/waitForBatchedUpdatesWithAct'; + +const LOGIN = 'test@user.com'; + +let mockIsOffline = false; +let mockAccountMetadataStatus: 'loading' | 'loaded' = 'loaded'; +let mockIsFocused = true; + +jest.mock('@hooks/useOnyx', () => { + const actualUseOnyx = jest.requireActual<{default: typeof useOnyx}>('@hooks/useOnyx').default; + + return { + __esModule: true, + default: (...args: Parameters) => { + const result = actualUseOnyx(...args); + // Inlined literal (not ONYXKEYS.ACCOUNT): jest.mock factories can't reference out-of-scope imports. + return args.at(0) === 'account' ? [result.at(0), {status: mockAccountMetadataStatus}] : result; + }, + }; +}); + +jest.mock('@libs/Navigation/Navigation', () => ({ + navigate: jest.fn(), + goBack: jest.fn(), + getActiveRoute: jest.fn(() => ''), + getActiveRouteWithoutParams: jest.fn(() => ''), + isNavigationReady: jest.fn(() => Promise.resolve()), +})); + +// The page is rendered outside a NavigationContainer, so drive focus directly to model another screen (e.g. Concierge) on top. +jest.mock('@react-navigation/native', () => ({ + ...jest.requireActual('@react-navigation/native'), + useIsFocused: () => mockIsFocused, + usePreventRemove: jest.fn(), +})); + +// `useNetwork` reads this through `useSyncExternalStore` without a notification, so set it before the render +// under test rather than after. +jest.mock('@libs/NetworkState', () => ({ + ...jest.requireActual('@libs/NetworkState'), + getIsOffline: () => mockIsOffline, +})); + +// The real confirm modal is bridged through the global modal system, which needs Navigation methods this file's +// lightweight Navigation mock doesn't provide. Stub the hook instead so tests can assert on what EmailIssuePage +// asks it to show and control how it resolves. +const mockShowConfirmModal = jest.fn(); +jest.mock('@hooks/useConfirmModal', () => + jest.fn(() => ({ + showConfirmModal: mockShowConfirmModal, + })), +); + +// Who the current user is isn't what this page's own logic is about (that's CurrentUserPersonalDetailsProvider's +// concern); fix it to a constant so the login-interpolated copy is deterministic here. +jest.mock('@hooks/useCurrentUserPersonalDetails', () => jest.fn(() => ({login: 'test@user.com', accountID: 1}))); + +// requestEmailUnblock itself (the API.write call, optimistic/success/failure shape) is covered in +// tests/actions/UserTest.ts. Here it's mocked so the page's own effects (redirect, retry modal, offline guard) +// can be driven directly through Onyx instead of depending on that action's real implementation. +jest.mock('@userActions/User', () => ({ + requestEmailUnblock: jest.fn(), +})); + +jest.mock('@components/RenderHTML', () => { + const ReactMock = jest.requireActual('react'); + const {Text} = jest.requireActual('react-native'); + + return ({html}: {html: string}) => { + const plainText = html.replaceAll(/<[^>]*>/g, ''); + return ReactMock.createElement(Text, null, plainText); + }; +}); + +const mockRequestEmailUnblock = jest.mocked(UserActions.requestEmailUnblock); + +function renderPage() { + return render( + + + , + ); +} + +describe('EmailIssuePage', () => { + beforeAll(() => { + Onyx.init({keys: ONYXKEYS}); + }); + + beforeEach(() => { + mockIsOffline = false; + mockAccountMetadataStatus = 'loaded'; + mockIsFocused = true; + mockShowConfirmModal.mockReset().mockResolvedValue({action: 'CLOSE'}); + mockRequestEmailUnblock.mockClear(); + jest.mocked(Navigation.goBack).mockClear(); + }); + + afterEach(async () => { + await act(async () => { + await Onyx.clear(); + }); + await waitForBatchedUpdatesWithAct(); + }); + + it('navigates back once the account loads and the flag is already false (stale deep link)', async () => { + // Given the account has finished loading and there is no email delivery failure + await act(async () => { + await Onyx.merge(ONYXKEYS.ACCOUNT, {hasEmailDeliveryFailure: false}); + }); + + // When the page mounts + renderPage(); + await waitForBatchedUpdatesWithAct(); + + // Then it redirects away instead of showing stale fix-it steps + expect(Navigation.goBack).toHaveBeenCalled(); + }); + + it('does not redirect while the account is still loading', async () => { + // Given the account is still loading + mockAccountMetadataStatus = 'loading'; + + // When the page mounts + renderPage(); + await waitForBatchedUpdatesWithAct(); + + // Then it must not treat the not-yet-loaded `false` as a real "no failure" and redirect away + expect(Navigation.goBack).not.toHaveBeenCalled(); + }); + + it('flips the flag false and navigates back once the unblock succeeds', async () => { + // Given a user with an email delivery failure viewing the page + await act(async () => { + await Onyx.merge(ONYXKEYS.ACCOUNT, {hasEmailDeliveryFailure: true}); + }); + renderPage(); + await waitForBatchedUpdatesWithAct(); + expect(Navigation.goBack).not.toHaveBeenCalled(); + + // When the backend confirms the unblock (the response's onyxData clears the flag) + await act(async () => { + await Onyx.merge(ONYXKEYS.ACCOUNT, {hasEmailDeliveryFailure: false}); + }); + await waitForBatchedUpdatesWithAct(); + + // Then the page leaves + expect(Navigation.goBack).toHaveBeenCalled(); + }); + + it('does not navigate back when the flag clears while another screen is on top', async () => { + // Given a user with an email delivery failure who opened Concierge from this page, so it is no longer focused + await act(async () => { + await Onyx.merge(ONYXKEYS.ACCOUNT, {hasEmailDeliveryFailure: true}); + }); + mockIsFocused = false; + renderPage(); + await waitForBatchedUpdatesWithAct(); + + // When the flag clears in the meantime + await act(async () => { + await Onyx.merge(ONYXKEYS.ACCOUNT, {hasEmailDeliveryFailure: false}); + }); + await waitForBatchedUpdatesWithAct(); + + // Then goBack is not called, since it would close the Concierge chat on top instead of this page + expect(Navigation.goBack).not.toHaveBeenCalled(); + }); + + it('shows the retry modal when isUnblockingEmail settles false but the flag is still true, and retries on confirm', async () => { + // Given a user with an email delivery failure who has just pressed the unblock button + await act(async () => { + await Onyx.merge(ONYXKEYS.ACCOUNT, {hasEmailDeliveryFailure: true, isUnblockingEmail: true}); + }); + renderPage(); + await waitForBatchedUpdatesWithAct(); + + mockShowConfirmModal.mockResolvedValue({action: 'CONFIRM'}); + + // When the request settles but the failure flag is still set (a 200 that did not unblock the login) + await act(async () => { + await Onyx.merge(ONYXKEYS.ACCOUNT, {isUnblockingEmail: false}); + }); + await waitForBatchedUpdatesWithAct(); + + // Then the generic retry modal is shown + expect(mockShowConfirmModal).toHaveBeenCalledWith( + expect.objectContaining({ + title: TestHelper.translateLocal('emailIssuePage.errorTitle'), + prompt: TestHelper.translateLocal('emailIssuePage.errorPrompt'), + }), + ); + + // And pressing "Try again" (CONFIRM) retries the unblock request + await waitForBatchedUpdatesWithAct(); + expect(mockRequestEmailUnblock).toHaveBeenCalledTimes(1); + }); + + it('disables the retry modal confirm button while offline', async () => { + // Given a user with an email delivery failure who has just pressed the unblock button + await act(async () => { + await Onyx.merge(ONYXKEYS.ACCOUNT, {hasEmailDeliveryFailure: true, isUnblockingEmail: true}); + }); + renderPage(); + await waitForBatchedUpdatesWithAct(); + + mockShowConfirmModal.mockResolvedValue({action: 'CANCEL'}); + + // When the request settles with the failure flag still set + await act(async () => { + await Onyx.merge(ONYXKEYS.ACCOUNT, {isUnblockingEmail: false}); + }); + await waitForBatchedUpdatesWithAct(); + + // Then the modal is asked to disable "Try again" while offline (the modal is stubbed here, so the + // disabled state itself is the modal's concern), so an offline retry can't queue another request indefinitely + expect(mockShowConfirmModal).toHaveBeenCalledWith(expect.objectContaining({shouldDisableConfirmButtonWhenOffline: true})); + }); + + it('disables the main unblock button while offline', async () => { + // Given a user with an email delivery failure who is offline + mockIsOffline = true; + await act(async () => { + await Onyx.merge(ONYXKEYS.ACCOUNT, {hasEmailDeliveryFailure: true}); + }); + renderPage(); + await waitForBatchedUpdatesWithAct(); + + // When the user presses the main button anyway + fireEvent.press(screen.getByText(TestHelper.translateLocal('emailIssuePage.completedSteps'))); + await waitForBatchedUpdatesWithAct(); + + // Then the request is not sent (Button's own isDisabled guard swallows the press) + expect(mockRequestEmailUnblock).not.toHaveBeenCalled(); + }); + + it('renders the fix-it steps with the current login interpolated', async () => { + // Given a user with an email delivery failure + await act(async () => { + await Onyx.merge(ONYXKEYS.ACCOUNT, {hasEmailDeliveryFailure: true}); + }); + + // When the page renders + renderPage(); + await waitForBatchedUpdatesWithAct(); + + // Then the intro and confirm-email steps reference the account's own login + expect(screen.getAllByText(new RegExp(LOGIN)).length).toBeGreaterThan(0); + }); +}); diff --git a/tests/unit/pages/home/TimeSensitiveSection/FixEmailDeliveryTest.tsx b/tests/unit/pages/home/TimeSensitiveSection/FixEmailDeliveryTest.tsx new file mode 100644 index 000000000000..78ca4cc00318 --- /dev/null +++ b/tests/unit/pages/home/TimeSensitiveSection/FixEmailDeliveryTest.tsx @@ -0,0 +1,66 @@ +import {fireEvent, render, screen} from '@testing-library/react-native'; + +import Navigation from '@libs/Navigation/Navigation'; + +import FixEmailDelivery from '@src/pages/home/TimeSensitiveSection/items/FixEmailDelivery'; +import ROUTES from '@src/ROUTES'; + +jest.mock('@libs/Navigation/Navigation', () => ({ + __esModule: true, + default: { + navigate: jest.fn(), + }, +})); + +jest.mock('@hooks/useLocalize', () => jest.fn(() => ({translate: jest.fn((key: string) => key)}))); + +jest.mock('@hooks/useLazyAsset', () => ({ + useMemoizedLazyExpensifyIcons: jest.fn(() => ({ + Mail: () => null, + })), +})); + +jest.mock('@hooks/useResponsiveLayout', () => jest.fn(() => ({shouldUseNarrowLayout: false}))); +jest.mock('@hooks/useTheme', () => jest.fn(() => ({white: '#fff'}))); +jest.mock('@hooks/useThemeStyles', () => + jest.fn( + () => + new Proxy( + {}, + { + get: () => jest.fn(() => ({})), + }, + ), + ), +); + +describe('FixEmailDelivery', () => { + beforeEach(() => { + jest.mocked(Navigation.navigate).mockClear(); + }); + + afterEach(() => { + jest.restoreAllMocks(); + }); + + it('renders the email delivery failure copy', () => { + // Given the row is rendered for a user whose email is on the suppression list + // When it renders + render(); + + // Then it shows the failure title and subtitle + expect(screen.getByText('homePage.timeSensitiveSection.emailDeliveryFailure.title')).toBeOnTheScreen(); + expect(screen.getByText('homePage.timeSensitiveSection.emailDeliveryFailure.subtitle')).toBeOnTheScreen(); + }); + + it('navigates to the email issue RHP when Fix is pressed', () => { + // Given the row is rendered + render(); + + // When the user presses the Fix CTA + fireEvent.press(screen.getByText('homePage.timeSensitiveSection.ctaFix')); + + // Then it opens the email issue page + expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.SETTINGS_EMAIL_ISSUE); + }); +});