Skip to content

Add spend rule base page#86684

Draft
luacmartins wants to merge 16 commits intocmartins-spendRuleSectionfrom
cmartins-spendRuleCreate
Draft

Add spend rule base page#86684
luacmartins wants to merge 16 commits intocmartins-spendRuleSectionfrom
cmartins-spendRuleCreate

Conversation

@luacmartins
Copy link
Copy Markdown
Contributor

Explanation of Change

Fixed Issues

$ #86521
PROPOSAL:

Tests

  • Verify that no errors appear in the JS console

Offline tests

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

@luacmartins luacmartins self-assigned this Mar 30, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 30, 2026

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/CONST/index.ts 95.16% <ø> (ø)
src/ONYXKEYS.ts 100.00% <ø> (ø)
src/SCREENS.ts 100.00% <ø> (ø)
src/components/SelectionList/BaseSelectionList.tsx 65.45% <ø> (ø)
...components/SelectionList/components/ListHeader.tsx 90.00% <ø> (ø)
src/libs/API/types.ts 100.00% <ø> (ø)
...gation/linkingConfig/RELATIONS/WORKSPACE_TO_RHP.ts 100.00% <ø> (ø)
src/libs/Navigation/linkingConfig/config.ts 76.92% <ø> (ø)
src/pages/workspace/rules/PolicyRulesPage.tsx 0.00% <0.00%> (ø)
src/types/form/SpendRuleForm.ts 0.00% <0.00%> (ø)
... and 9 more
... and 8 files with indirect coverage changes

@OSBotify

This comment has been minimized.

@OSBotify

This comment has been minimized.

@OSBotify

This comment has been minimized.

@OSBotify
Copy link
Copy Markdown
Contributor

🦜 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 diff
diff --git a/src/languages/de.ts b/src/languages/de.ts
index 1c43c9ef..9e42c7a8 100644
--- a/src/languages/de.ts
+++ b/src/languages/de.ts
@@ -6679,11 +6679,16 @@ Fordern Sie Spesendetails wie Belege und Beschreibungen an, legen Sie Limits und
                     title: 'Expensify Karten bieten integrierten Schutz – jederzeit',
                     description: `Expensify lehnt diese Belastungen immer ab:\n\n  • Dienstleistungen für Erwachsene\n  • Geldautomaten (ATMs)\n  • Glücksspiel\n  • Geldüberweisungen\n\nFügen Sie weitere Ausgabenregeln hinzu, um den Cashflow des Unternehmens zu schützen.`,
                 },
-                addSpendRule: 'Ausgabenregel hinzufügen',
+                addSpendRule: 'Ausgaberegel hinzufügen',
                 cardPageTitle: 'Karte',
                 cardsSectionTitle: 'Karten',
                 chooseCards: 'Karten auswählen',
                 saveRule: 'Regel speichern',
+                allow: 'Zulassen',
+                spendRuleSectionTitle: 'Ausgabenregel',
+                restrictionType: 'Beschränkungstyp',
+                restrictionTypeHelpAllow: 'Ausgaben werden genehmigt, wenn sie mit einem Händler oder einer Kategorie übereinstimmen und einen Höchstbetrag nicht überschreiten.',
+                restrictionTypeHelpBlock: 'Ausgaben werden abgelehnt, wenn sie einem Händler oder einer Kategorie entsprechen oder einen Höchstbetrag überschreiten.',
             },
         },
         planTypePage: {
diff --git a/src/languages/fr.ts b/src/languages/fr.ts
index 4f9aacc2..0b8bdea9 100644
--- a/src/languages/fr.ts
+++ b/src/languages/fr.ts
@@ -6703,11 +6703,16 @@ Rendez obligatoires des informations de dépense comme les reçus et les descrip
                     title: 'Les Cartes Expensify offrent une protection intégrée – en permanence',
                     description: `Expensify refuse toujours ces types de dépenses:\n\n  • Services pour adultes\n  • DAB\n  • Jeux d’argent\n  • Transferts d’argent\n\nAjoutez davantage de règles de dépenses pour protéger la trésorerie de l’entreprise.`,
                 },
-                addSpendRule: 'Ajouter une règle de dépenses',
+                addSpendRule: 'Ajouter une règle de dépense',
                 cardPageTitle: 'Carte',
                 cardsSectionTitle: 'Cartes',
                 chooseCards: 'Choisir des cartes',
                 saveRule: 'Enregistrer la règle',
+                allow: 'Autoriser',
+                spendRuleSectionTitle: 'Règle de dépense',
+                restrictionType: 'Type de restriction',
+                restrictionTypeHelpAllow: 'Les frais sont approuvés s’ils correspondent à un commerçant ou une catégorie, et ne dépassent pas un montant maximal.',
+                restrictionTypeHelpBlock: 'Les paiements sont refusés s’ils correspondent à un commerçant ou une catégorie, ou s’ils dépassent un montant maximal.',
             },
         },
         planTypePage: {
diff --git a/src/languages/it.ts b/src/languages/it.ts
index a3fdb593..9096764a 100644
--- a/src/languages/it.ts
+++ b/src/languages/it.ts
@@ -6669,8 +6669,13 @@ Richiedi dettagli sulle spese come ricevute e descrizioni, imposta limiti e valo
                 addSpendRule: 'Aggiungi regola di spesa',
                 cardPageTitle: 'Carta',
                 cardsSectionTitle: 'Carte',
-                chooseCards: 'Scegli le carte',
+                chooseCards: 'Scegli carte',
                 saveRule: 'Salva regola',
+                allow: 'Consenti',
+                spendRuleSectionTitle: 'Regola di spesa',
+                restrictionType: 'Tipo di restrizione',
+                restrictionTypeHelpAllow: 'Gli addebiti vengono approvati se corrispondono a un qualsiasi esercente o categoria e non superano un importo massimo.',
+                restrictionTypeHelpBlock: 'Le spese vengono rifiutate se corrispondono a un qualsiasi esercente o categoria, o se superano un importo massimo.',
             },
         },
         planTypePage: {
diff --git a/src/languages/ja.ts b/src/languages/ja.ts
index a0e9bf47..521507ce 100644
--- a/src/languages/ja.ts
+++ b/src/languages/ja.ts
@@ -6597,6 +6597,11 @@ ${reportName}
                 cardsSectionTitle: 'カード',
                 chooseCards: 'カードを選択',
                 saveRule: 'ルールを保存',
+                allow: '許可する',
+                spendRuleSectionTitle: '支出ルール',
+                restrictionType: '制限の種類',
+                restrictionTypeHelpAllow: '明細は、いずれかの加盟店またはカテゴリに一致し、かつ上限金額を超えない場合に承認されます。',
+                restrictionTypeHelpBlock: '加盟店またはカテゴリに一致するか、上限金額を超える支出は拒否されます。',
             },
         },
         planTypePage: {
diff --git a/src/languages/nl.ts b/src/languages/nl.ts
index 2b72a135..ca7c8168 100644
--- a/src/languages/nl.ts
+++ b/src/languages/nl.ts
@@ -6645,11 +6645,16 @@ Vereis onkostendetails zoals bonnen en beschrijvingen, stel limieten en standaar
                     title: 'Expensify Kaarten bieden altijd ingebouwde bescherming',
                     description: `Expensify wijst deze transacties altijd af:\n\n  • Seksdiensten\n  • Geldautomaten (ATM's)\n  • Gokken\n  • Geldoverschrijvingen\n\nVoeg meer bestedingsregels toe om de cashflow van je bedrijf te beschermen.`,
                 },
-                addSpendRule: 'Bestedingsregel toevoegen',
+                addSpendRule: 'Uitgavenregel toevoegen',
                 cardPageTitle: 'Kaart',
                 cardsSectionTitle: 'Kaarten',
                 chooseCards: 'Kaarten kiezen',
                 saveRule: 'Regel opslaan',
+                allow: 'Toestaan',
+                spendRuleSectionTitle: 'Bestedingsregel',
+                restrictionType: 'Restrictietype',
+                restrictionTypeHelpAllow: 'Kosten worden goedgekeurd als ze overeenkomen met een handelaar of categorie en een maximumbedrag niet overschrijden.',
+                restrictionTypeHelpBlock: 'Transacties worden geweigerd als ze overeenkomen met een handelaar of categorie, of een maximumbedrag overschrijden.',
             },
         },
         planTypePage: {
diff --git a/src/languages/pl.ts b/src/languages/pl.ts
index 7dbfd09d..5d56fa94 100644
--- a/src/languages/pl.ts
+++ b/src/languages/pl.ts
@@ -6640,11 +6640,16 @@ Wymagaj szczegółów wydatków, takich jak paragony i opisy, ustawiaj limity i
                     title: 'Karty Expensify zapewniają wbudowaną ochronę – zawsze',
                     description: `Expensify zawsze odrzuca te obciążenia:\n\n  • Usługi dla dorosłych\n  • Bankomaty\n  • Hazard\n  • Przelewy pieniężne\n\nDodaj więcej zasad wydatków, żeby chronić przepływy pieniężne firmy.`,
                 },
-                addSpendRule: 'Dodaj zasadę wydatków',
+                addSpendRule: 'Dodaj regułę wydatków',
                 cardPageTitle: 'Karta',
                 cardsSectionTitle: 'Karty',
                 chooseCards: 'Wybierz karty',
                 saveRule: 'Zapisz regułę',
+                allow: 'Zezwól',
+                spendRuleSectionTitle: 'Zasada wydatków',
+                restrictionType: 'Typ ograniczenia',
+                restrictionTypeHelpAllow: 'Opłaty są zatwierdzane, jeśli pasują do dowolnego sprzedawcy lub kategorii i nie przekraczają maksymalnej kwoty.',
+                restrictionTypeHelpBlock: 'Obciążenia są odrzucane, jeśli pasują do jakiegokolwiek sprzedawcy lub kategorii albo przekraczają maksymalną kwotę.',
             },
         },
         planTypePage: {
diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts
index 3e668407..2b31ddfe 100644
--- a/src/languages/pt-BR.ts
+++ b/src/languages/pt-BR.ts
@@ -6644,11 +6644,16 @@ Exija dados de despesas como recibos e descrições, defina limites e padrões e
                     title: 'Os Cartões Expensify oferecem proteção integrada — sempre',
                     description: `A Expensify sempre recusa estas cobranças:\n\n  • Serviços adultos\n  • Caixas eletrônicos (ATMs)\n  • Jogos de azar\n  • Transferências de dinheiro\n\nAdicione mais regras de gasto para proteger o fluxo de caixa da empresa.`,
                 },
-                addSpendRule: 'Adicionar regra de gastos',
+                addSpendRule: 'Adicionar regra de gasto',
                 cardPageTitle: 'Cartão',
                 cardsSectionTitle: 'Cartões',
                 chooseCards: 'Escolher cartões',
                 saveRule: 'Salvar regra',
+                allow: 'Permitir',
+                spendRuleSectionTitle: 'Regra de gasto',
+                restrictionType: 'Tipo de restrição',
+                restrictionTypeHelpAllow: 'As cobranças são aprovadas se corresponderem a qualquer comerciante ou categoria e não excederem um valor máximo.',
+                restrictionTypeHelpBlock: 'As cobranças são recusadas se corresponderem a qualquer comerciante ou categoria, ou excederem um valor máximo.',
             },
         },
         planTypePage: {
diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts
index 57f861b2..17334c49 100644
--- a/src/languages/zh-hans.ts
+++ b/src/languages/zh-hans.ts
@@ -6480,11 +6480,16 @@ ${reportName}
                     title: 'Expensify 卡提供始终内置的保护',
                     description: `Expensify 始终会拒绝以下消费:\n\n  • 成人服务\n  • 自动取款机(ATM)\n  • 赌博\n  • 转账汇款\n\n添加更多消费规则,保护公司的现金流。`,
                 },
-                addSpendRule: '添加支出规则',
+                addSpendRule: '添加消费规则',
                 cardPageTitle: '卡',
-                cardsSectionTitle: '卡',
-                chooseCards: '选择卡',
+                cardsSectionTitle: '卡片',
+                chooseCards: '选择卡片',
                 saveRule: '保存规则',
+                allow: '允许',
+                spendRuleSectionTitle: '支出规则',
+                restrictionType: '限制类型',
+                restrictionTypeHelpAllow: '如果与任意商户或类别匹配且不超过最高金额,费用将被批准。',
+                restrictionTypeHelpBlock: '如果消费与任何商户或类别匹配,或超过最高限额,将被拒付。',
             },
         },
         planTypePage: {

Note

You can apply these changes to your branch by copying the patch to your clipboard, then running pbpaste | git apply 😉

View workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants