[Home Page] [Release 2] Create TimeSensitiveSection Component#80951
Conversation
|
Hey, I noticed you changed If you want to automatically generate translations for other locales, an Expensify employee will have to:
Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running: npx ts-node ./scripts/generateTranslations.ts --helpTypically, you'd want to translate only what you changed by running |
|
@ZhenjaHorbach Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2cf3edfebd
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const discountInfo = getEarlyDiscountInfo(firstDayFreeTrial); | ||
|
|
||
| // Don't show offers for Team plan with 2025 pricing | ||
| const isTeamWithNew2025Pricing = hasTeam2025Pricing && subscriptionPlan === CONST.POLICY.TYPE.TEAM; | ||
|
|
||
| // Determine which offer to show (they are mutually exclusive) | ||
| const shouldShow50off = discountInfo?.discountType === 50 && !isTeamWithNew2025Pricing; | ||
| const shouldShow25off = discountInfo?.discountType === 25 && !doesUserHavePaymentCardAdded(userBillingFundID) && !isTeamWithNew2025Pricing; |
There was a problem hiding this comment.
Recompute offer visibility as time advances
Because discountInfo is computed once during the parent render and never updated, the widget won’t respond to time-based changes while the user remains on Home. If the first 24 hours elapse (or the trial window ends) without another parent re-render, Offer50off will return null but TimeSensitiveSection will still render the container (and won’t switch to 25% or hide entirely), leaving an empty “Time sensitive” section. This can happen for users who keep the app open across the 24‑hour boundary. Consider moving the timer state up or recomputing discountInfo on an interval so the parent visibility logic updates.
Useful? React with 👍 / 👎.
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
🚧 @grgia has triggered a test Expensify/App build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
|
@WojtekBoman TS failing on this one |
Reviewer Checklist
Screenshots/VideosAndroid: HybridApp2026-01-30.00.07.28.movAndroid: mWeb Chrome2026-01-30.00.09.41.moviOS: HybridApp2026-01-30.00.07.28.moviOS: mWeb Safari2026-01-30.00.09.41.movMacOS: Chrome / Safari2026-01-30.00.04.06.mov |
🦜 Polyglot Parrot! 🦜Squawk! Looks like you added some shiny new English strings. Allow me to parrot them back to you in other tongues: View the translation diffdiff --git a/src/languages/de.ts b/src/languages/de.ts
index b19bc081..cc241c33 100644
--- a/src/languages/de.ts
+++ b/src/languages/de.ts
@@ -642,6 +642,7 @@ const translations: TranslationDeepObject<typeof en> = {
month: 'Monat',
home: 'Startseite',
week: 'Woche',
+ secondAbbreviation: 's',
},
supportalNoAccess: {
title: 'Nicht so schnell',
@@ -8265,6 +8266,12 @@ Hier ist ein *Testbeleg*, um dir zu zeigen, wie es funktioniert:`,
upcomingTodos: 'Anstehende To-dos werden hier angezeigt.',
},
},
+ timeSensitiveSection: {
+ title: 'Zeitkritisch',
+ cta: 'Antrag',
+ offer50off: {title: 'Erhalte 50 % Rabatt auf dein erstes Jahr!', subtitle: ({formattedTime}: {formattedTime: string}) => `${formattedTime} verbleibend`},
+ offer25off: {title: 'Erhalten Sie 25 % Rabatt auf Ihr erstes Jahr!', subtitle: ({days}: {days: number}) => `${days} ${days === 1 ? 'Tag' : 'Tage'} verbleiben`},
+ },
},
};
// IMPORTANT: This line is manually replaced in generate translation files by scripts/generateTranslations.ts,
diff --git a/src/languages/fr.ts b/src/languages/fr.ts
index 07c89ef1..7e65bb26 100644
--- a/src/languages/fr.ts
+++ b/src/languages/fr.ts
@@ -644,6 +644,7 @@ const translations: TranslationDeepObject<typeof en> = {
month: 'Mois',
home: 'Accueil',
week: 'Semaine',
+ secondAbbreviation: 's',
},
supportalNoAccess: {
title: 'Pas si vite',
@@ -7036,7 +7037,7 @@ Exigez des informations de dépense comme les reçus et les descriptions, défin
[CONST.SEARCH.GROUP_BY.CARD]: 'Carte',
[CONST.SEARCH.GROUP_BY.WITHDRAWAL_ID]: 'ID de retrait',
[CONST.SEARCH.GROUP_BY.CATEGORY]: 'Catégorie',
- [CONST.SEARCH.GROUP_BY.MERCHANT]: 'Commerçant',
+ [CONST.SEARCH.GROUP_BY.MERCHANT]: 'Marchand',
[CONST.SEARCH.GROUP_BY.TAG]: 'Étiquette',
[CONST.SEARCH.GROUP_BY.MONTH]: 'Mois',
[CONST.SEARCH.GROUP_BY.WEEK]: 'Semaine',
@@ -8271,6 +8272,12 @@ Voici un *reçu test* pour vous montrer comment cela fonctionne :`,
upcomingTodos: 'Les tâches à venir apparaîtront ici.',
},
},
+ timeSensitiveSection: {
+ title: 'Urgent',
+ cta: 'Demande',
+ offer50off: {title: 'Obtenez 50 % de réduction sur votre première année !', subtitle: ({formattedTime}: {formattedTime: string}) => `${formattedTime} restant`},
+ offer25off: {title: 'Obtenez 25 % de réduction sur votre première année !', subtitle: ({days}: {days: number}) => `${days} ${days === 1 ? 'jour' : 'jours'} restants`},
+ },
},
};
// IMPORTANT: This line is manually replaced in generate translation files by scripts/generateTranslations.ts,
diff --git a/src/languages/it.ts b/src/languages/it.ts
index d3f3eaca..7676b1e8 100644
--- a/src/languages/it.ts
+++ b/src/languages/it.ts
@@ -643,6 +643,7 @@ const translations: TranslationDeepObject<typeof en> = {
month: 'Mese',
home: 'Home',
week: 'Settimana',
+ secondAbbreviation: 's',
},
supportalNoAccess: {
title: 'Non così in fretta',
@@ -7014,7 +7015,7 @@ Richiedi dettagli di spesa come ricevute e descrizioni, imposta limiti e valori
[CONST.SEARCH.GROUP_BY.WITHDRAWAL_ID]: 'ID prelievo', //_/\__/_/ \_,_/\__/\__/\_,_/
[CONST.SEARCH.GROUP_BY.CATEGORY]: 'Categoria',
[CONST.SEARCH.GROUP_BY.MERCHANT]: 'Esercente',
- [CONST.SEARCH.GROUP_BY.TAG]: 'Tag',
+ [CONST.SEARCH.GROUP_BY.TAG]: 'Etichetta',
[CONST.SEARCH.GROUP_BY.MONTH]: 'Mese',
[CONST.SEARCH.GROUP_BY.WEEK]: 'Settimana',
},
@@ -8251,6 +8252,12 @@ Ecco una *ricevuta di prova* per mostrarti come funziona:`,
upcomingTodos: 'Le prossime attività da fare verranno visualizzate qui.',
},
},
+ timeSensitiveSection: {
+ title: 'Urgente',
+ cta: 'Richiesta',
+ offer50off: {title: 'Ottieni il 50% di sconto sul tuo primo anno!', subtitle: ({formattedTime}: {formattedTime: string}) => `${formattedTime} rimanenti`},
+ offer25off: {title: 'Ottieni il 25% di sconto sul tuo primo anno!', subtitle: ({days}: {days: number}) => `${days} ${days === 1 ? 'giorno' : 'giorni'} rimanenti`},
+ },
},
};
// IMPORTANT: This line is manually replaced in generate translation files by scripts/generateTranslations.ts,
diff --git a/src/languages/ja.ts b/src/languages/ja.ts
index 188d04a7..8bf725bf 100644
--- a/src/languages/ja.ts
+++ b/src/languages/ja.ts
@@ -642,6 +642,7 @@ const translations: TranslationDeepObject<typeof en> = {
month: '月',
home: 'ホーム',
week: '週',
+ secondAbbreviation: '秒',
},
supportalNoAccess: {
title: 'ちょっと待ってください',
@@ -8163,6 +8164,12 @@ Expensify の使い方をお見せするための*テストレシート*がこ
upcomingTodos: '今後のTo-doがここに表示されます。',
},
},
+ timeSensitiveSection: {
+ title: '至急',
+ cta: '申請',
+ offer50off: {title: '初年度が50%オフ!', subtitle: ({formattedTime}: {formattedTime: string}) => `残り${formattedTime}`},
+ offer25off: {title: '初年度が25%オフ!', subtitle: ({days}: {days: number}) => `残り ${days} ${days === 1 ? '日' : '日'}`},
+ },
},
};
// IMPORTANT: This line is manually replaced in generate translation files by scripts/generateTranslations.ts,
diff --git a/src/languages/nl.ts b/src/languages/nl.ts
index f1ff6c99..7e92a6ea 100644
--- a/src/languages/nl.ts
+++ b/src/languages/nl.ts
@@ -643,6 +643,7 @@ const translations: TranslationDeepObject<typeof en> = {
month: 'Maand',
home: 'Start',
week: 'Week',
+ secondAbbreviation: 's',
},
supportalNoAccess: {
title: 'Niet zo snel',
@@ -6997,7 +6998,7 @@ Vraag verplichte uitgavedetails zoals bonnetjes en beschrijvingen, stel limieten
[CONST.SEARCH.GROUP_BY.WITHDRAWAL_ID]: 'Opname-ID',
[CONST.SEARCH.GROUP_BY.CATEGORY]: 'Categorie',
[CONST.SEARCH.GROUP_BY.MERCHANT]: 'Handelaar',
- [CONST.SEARCH.GROUP_BY.TAG]: 'Tag',
+ [CONST.SEARCH.GROUP_BY.TAG]: 'Label',
[CONST.SEARCH.GROUP_BY.MONTH]: 'Maand',
[CONST.SEARCH.GROUP_BY.WEEK]: 'Week',
},
@@ -8227,6 +8228,12 @@ Hier is een *testbon* om je te laten zien hoe het werkt:`,
upcomingTodos: 'Aankomende taken verschijnen hier.',
},
},
+ timeSensitiveSection: {
+ title: 'Tijdgevoelig',
+ cta: 'Declaratie',
+ offer50off: {title: 'Krijg 50% korting op je eerste jaar!', subtitle: ({formattedTime}: {formattedTime: string}) => `${formattedTime} resterend`},
+ offer25off: {title: 'Krijg 25% korting op je eerste jaar!', subtitle: ({days}: {days: number}) => `Nog ${days} ${days === 1 ? 'dag' : 'dagen'} resterend`},
+ },
},
};
// IMPORTANT: This line is manually replaced in generate translation files by scripts/generateTranslations.ts,
diff --git a/src/languages/pl.ts b/src/languages/pl.ts
index 554e9d2a..e1626ebb 100644
--- a/src/languages/pl.ts
+++ b/src/languages/pl.ts
@@ -643,6 +643,7 @@ const translations: TranslationDeepObject<typeof en> = {
month: 'Miesiąc',
home: 'Strona główna',
week: 'Tydzień',
+ secondAbbreviation: 's',
},
supportalNoAccess: {
title: 'Nie tak szybko',
@@ -6985,7 +6986,7 @@ Wymagaj szczegółów wydatków, takich jak paragony i opisy, ustawiaj limity i
[CONST.SEARCH.GROUP_BY.WITHDRAWAL_ID]: 'ID wypłaty',
[CONST.SEARCH.GROUP_BY.CATEGORY]: 'Kategoria',
[CONST.SEARCH.GROUP_BY.MERCHANT]: 'Sprzedawca',
- [CONST.SEARCH.GROUP_BY.TAG]: 'Tag',
+ [CONST.SEARCH.GROUP_BY.TAG]: 'Znacznik',
[CONST.SEARCH.GROUP_BY.MONTH]: 'Miesiąc',
[CONST.SEARCH.GROUP_BY.WEEK]: 'Tydzień',
},
@@ -8212,6 +8213,12 @@ Oto *paragon testowy*, który pokazuje, jak to działa:`,
upcomingTodos: 'Nadchodzące zadania do wykonania pojawią się tutaj.',
},
},
+ timeSensitiveSection: {
+ title: 'Pilne',
+ cta: 'Roszczenie',
+ offer50off: {title: 'Uzyskaj 50% zniżki na pierwszy rok!', subtitle: ({formattedTime}: {formattedTime: string}) => `Pozostało: ${formattedTime}`},
+ offer25off: {title: 'Uzyskaj 25% zniżki na pierwszy rok!', subtitle: ({days}: {days: number}) => `Pozostało ${days} ${days === 1 ? 'dzień' : 'dni'}`},
+ },
},
};
// IMPORTANT: This line is manually replaced in generate translation files by scripts/generateTranslations.ts,
diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts
index a558a4a3..3273d43a 100644
--- a/src/languages/pt-BR.ts
+++ b/src/languages/pt-BR.ts
@@ -642,6 +642,7 @@ const translations: TranslationDeepObject<typeof en> = {
month: 'Mês',
home: 'Início',
week: 'Semana',
+ secondAbbreviation: 's',
},
supportalNoAccess: {
title: 'Não tão rápido',
@@ -8221,6 +8222,12 @@ Aqui está um *recibo de teste* para mostrar como funciona:`,
upcomingTodos: 'Próximas tarefas aparecerão aqui.',
},
},
+ timeSensitiveSection: {
+ title: 'Urgente',
+ cta: 'Solicitação',
+ offer50off: {title: 'Ganhe 50% de desconto no seu primeiro ano!', subtitle: ({formattedTime}: {formattedTime: string}) => `${formattedTime} restante`},
+ offer25off: {title: 'Ganhe 25% de desconto no seu primeiro ano!', subtitle: ({days}: {days: number}) => `${days} ${days === 1 ? 'dia' : 'dias'} restantes`},
+ },
},
};
// IMPORTANT: This line is manually replaced in generate translation files by scripts/generateTranslations.ts,
diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts
index b9c9b59b..916c4fcc 100644
--- a/src/languages/zh-hans.ts
+++ b/src/languages/zh-hans.ts
@@ -639,6 +639,7 @@ const translations: TranslationDeepObject<typeof en> = {
month: '月',
home: '首页',
week: '周',
+ secondAbbreviation: 's',
},
supportalNoAccess: {
title: '先别急',
@@ -6829,10 +6830,11 @@ ${reportName}
purchaseCurrency: '购买货币',
groupBy: {
[CONST.SEARCH.GROUP_BY.FROM]: '来自',
- [CONST.SEARCH.GROUP_BY.CARD]: '卡',
- [CONST.SEARCH.GROUP_BY.WITHDRAWAL_ID]: '提现编号',
+ [CONST.SEARCH.GROUP_BY.CARD]: '卡片',
+ //_/\__/_/ \_,_/\__/\__/\_,_/
+ [CONST.SEARCH.GROUP_BY.WITHDRAWAL_ID]: '提现 ID',
[CONST.SEARCH.GROUP_BY.CATEGORY]: '类别',
- [CONST.SEARCH.GROUP_BY.MERCHANT]: '商户',
+ [CONST.SEARCH.GROUP_BY.MERCHANT]: '商家',
[CONST.SEARCH.GROUP_BY.TAG]: '标签',
[CONST.SEARCH.GROUP_BY.MONTH]: '月',
[CONST.SEARCH.GROUP_BY.WEEK]: '周',
@@ -7981,6 +7983,12 @@ ${reportName}
begin: '开始',
emptyStateMessages: {nicelyDone: '做得很好', keepAnEyeOut: '敬请关注接下来的更新!', allCaughtUp: '你已经全部看完了', upcomingTodos: '即将进行的待办事项会显示在此处。'},
},
+ timeSensitiveSection: {
+ title: '时间敏感',
+ cta: '报销申请',
+ offer50off: {title: '首年立享五折优惠!', subtitle: ({formattedTime}: {formattedTime: string}) => `剩余 ${formattedTime}`},
+ offer25off: {title: '首次年度订阅立享 25% 折扣!', subtitle: ({days}: {days: number}) => `剩余 ${days} ${days === 1 ? '天' : '天'}`},
+ },
},
};
// IMPORTANT: This line is manually replaced in generate translation files by scripts/generateTranslations.ts,
Note You can apply these changes to your branch by copying the patch to your clipboard, then running |
| // Don't show offers for Team plan with 2025 pricing | ||
| const isTeamWithNew2025Pricing = hasTeam2025Pricing && subscriptionPlan === CONST.POLICY.TYPE.TEAM; | ||
|
|
||
| // Determine which offer to show (they are mutually exclusive) | ||
| const shouldShow50off = discountInfo?.discountType === 50 && !isTeamWithNew2025Pricing; | ||
| const shouldShow25off = discountInfo?.discountType === 25 && !doesUserHavePaymentCardAdded(userBillingFundID) && !isTeamWithNew2025Pricing; |
There was a problem hiding this comment.
this logic is also in the Subscriptions page and it is same, right? this should be taken out to util method and covered with unit tests, can you do that please?
That is on all ad hocs |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f82b6f7f38
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const discountInfo = getEarlyDiscountInfo(firstDayFreeTrial); | ||
|
|
||
| if (!shouldShowDiscount || !discountInfo) { | ||
| return null; | ||
| } | ||
|
|
||
| // Determine which offer to show based on discount type (they are mutually exclusive) | ||
| const shouldShow50off = discountInfo.discountType === 50; | ||
| const shouldShow25off = discountInfo.discountType === 25; |
There was a problem hiding this comment.
Recompute discount type so offers switch after 24h
Because discountInfo is computed once per render and shouldShow50off/shouldShow25off are derived from it, the parent never re-evaluates which offer to show as time passes. If a user opens Home during the first 24 hours and keeps it open past the cutoff, Offer50off keeps rendering (its own interval only updates the countdown text) and the 25% offer never appears. This deviates from the “50% only within first 24h” logic; consider moving the timer/discountInfo state to the section or switching on discountInfo.discountType inside the 50% item so it unmounts once the first day elapses.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
I think this is edge case we do not have to worry about
| // Use the same logic as the subscription page to determine if discount banner should be shown | ||
| const shouldShowDiscount = shouldShowDiscountBanner(hasTeam2025Pricing, subscriptionPlan, firstDayFreeTrial, lastDayFreeTrial, userBillingFundID); | ||
| const discountInfo = getEarlyDiscountInfo(firstDayFreeTrial); | ||
|
|
||
| if (!shouldShowDiscount || !discountInfo) { | ||
| return null; |
There was a problem hiding this comment.
Don’t gate the 50% offer on missing billing card
shouldShowDiscountBanner returns false when userBillingFundID is set (see doesUserHavePaymentCardAdded in SubscriptionUtils), so this section never renders for users who already added a billing card. The PR description says only the 25% offer requires “no billing card,” so users who add a card within the first 24 hours would incorrectly miss the 50% offer. Consider using a visibility check that only applies the “no card” requirement to the 25% path.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The desceription will be udpated
mountiny
left a comment
There was a problem hiding this comment.
Looking good, lets add unit test for it
| import ROUTES from '@src/ROUTES'; | ||
|
|
||
| type Offer25offProps = { | ||
| days: number; |
| import ROUTES from '@src/ROUTES'; | ||
|
|
||
| type Offer50offProps = { | ||
| firstDayFreeTrial: string | undefined; |
|
🚧 @mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
| import ROUTES from '@src/ROUTES'; | ||
|
|
||
| type Offer50offProps = { | ||
| firstDayFreeTrial: string | undefined; |
| import ROUTES from '@src/ROUTES'; | ||
|
|
||
| type Offer25offProps = { | ||
| days: number; |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.3.11-16 🚀
|
|
@adamgrzybowski is there a shortcut we could use to get around waiting 8+ days for the last test case? |
|
@nlemma, I think you can use an older account |
|
🚀 Deployed to production by https://github.com/Julesssss in version: 9.3.12-1 🚀
|

Explanation of Change
This PR implements a new "Time Sensitive" section on the Home page that displays promotional discount offers for users during their free trial period.
Changes
Business Logic
Fixed Issues
$ #79982
PROPOSAL:
Tests
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Test 50% Off Offer
Test 25% Off Offer
Test Section Hidden
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-01-29.at.12.57.58.mov
Screen.Recording.2026-01-29.at.12.58.58.mov