diff --git a/src/CONST/index.ts b/src/CONST/index.ts index e8d303b1b8e18..3f115cf69442e 100755 --- a/src/CONST/index.ts +++ b/src/CONST/index.ts @@ -1427,6 +1427,9 @@ const CONST = { UPDATE_DEFAULT_APPROVER: 'POLICYCHANGELOG_UPDATE_DEFAULT_APPROVER', UPDATE_SUBMITS_TO: 'POLICYCHANGELOG_UPDATE_SUBMITS_TO', UPDATE_FORWARDS_TO: 'POLICYCHANGELOG_UPDATE_FORWARDS_TO', + UPDATE_CUSTOM_TAX_NAME: 'POLICYCHANGELOG_UPDATE_CUSTOM_TAX_NAME', + UPDATE_CURRENCY_DEFAULT_TAX: 'POLICYCHANGELOG_UPDATE_CURRENCY_DEFAULT_TAX', + UPDATE_FOREIGN_CURRENCY_DEFAULT_TAX: 'POLICYCHANGELOG_UPDATE_FOREIGN_CURRENCY_DEFAULT_TAX', UPDATE_INVOICE_COMPANY_NAME: 'POLICYCHANGELOG_UPDATE_INVOICE_COMPANY_NAME', UPDATE_INVOICE_COMPANY_WEBSITE: 'POLICYCHANGELOG_UPDATE_INVOICE_COMPANY_WEBSITE', UPDATE_MANUAL_APPROVAL_THRESHOLD: 'POLICYCHANGELOG_UPDATE_MANUAL_APPROVAL_THRESHOLD', diff --git a/src/languages/de.ts b/src/languages/de.ts index b4f1403031081..7aed291a430ff 100644 --- a/src/languages/de.ts +++ b/src/languages/de.ts @@ -76,6 +76,9 @@ import type { UpdatedPolicyReportFieldDefaultValueParams, UpdatedPolicyTagFieldParams, UpdatedPolicyTagListParams, + UpdatedPolicyCurrencyDefaultTaxParams, + UpdatedPolicyCustomTaxNameParams, + UpdatedPolicyForeignCurrencyDefaultTaxParams, UpdatedPolicyTagListRequiredParams, UpdatedPolicyTagNameParams, UpdatedPolicyTagParams, @@ -6819,7 +6822,11 @@ Fordern Sie Spesendetails wie Belege und Beschreibungen an, legen Sie Limits und ? `hat die/den autorisierte:n Zahler:in in „${newReimburser}“ geändert (zuvor „${previousReimburser}“)` : `den/die autorisierte/n Zahler/in in „${newReimburser}“ geändert`, updateReimbursementEnabled: ({enabled}: UpdatedPolicyReimbursementEnabledParams) => `${enabled ? 'aktiviert' : 'deaktiviert'} Rückerstattungen`, - addTax: ({taxName}: UpdatedPolicyTaxParams) => `hat die Steuer „${taxName}“ hinzugefügt`, + updateCustomTaxName: ({oldName, newName}: UpdatedPolicyCustomTaxNameParams) => `benutzerdefinierten Steuernamen in „${newName}" geändert (zuvor „${oldName}")`, + updateCurrencyDefaultTax: ({oldName, newName}: UpdatedPolicyCurrencyDefaultTaxParams) => `Standard-Steuerbetrag der Workspace-Währung auf „${newName}" geändert (zuvor „${oldName}")`, + updateForeignCurrencyDefaultTax: ({oldName, newName}: UpdatedPolicyForeignCurrencyDefaultTaxParams) => + `den Standardsteuersatz für Fremdwährungen in „${newName}" geändert (zuvor „${oldName}")`, + addTax: ({taxName}: UpdatedPolicyTaxParams) => `die Steuer „${taxName}" hinzugefügt`, deleteTax: ({taxName}: UpdatedPolicyTaxParams) => `hat die Steuer „${taxName}“ entfernt`, updateTax: ({oldValue, taxName, updatedField, newValue}: UpdatedPolicyTaxParams) => { if (!updatedField) { diff --git a/src/languages/en.ts b/src/languages/en.ts index b9813b075f676..b7d32704351f9 100644 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -53,8 +53,11 @@ import type { UpdatedPolicyBudgetNotificationParams, UpdatedPolicyCategoriesParams, UpdatedPolicyCategoryMaxAmountNoReceiptParams, + UpdatedPolicyCurrencyDefaultTaxParams, + UpdatedPolicyCustomTaxNameParams, UpdatedPolicyCustomUnitSubRateParams, UpdatedPolicyDefaultTitleParams, + UpdatedPolicyForeignCurrencyDefaultTaxParams, UpdatedPolicyManualApprovalThresholdParams, UpdatedPolicyOwnershipParams, UpdatedPolicyPreventSelfApprovalParams, @@ -6895,6 +6898,10 @@ const translations = { changedReimburser: ({newReimburser, previousReimburser}: UpdatedPolicyReimburserParams) => previousReimburser ? `changed the authorized payer to "${newReimburser}" (previously "${previousReimburser}")` : `changed the authorized payer to "${newReimburser}"`, updateReimbursementEnabled: ({enabled}: UpdatedPolicyReimbursementEnabledParams) => `${enabled ? 'enabled' : 'disabled'} reimbursements`, + updateCustomTaxName: ({oldName, newName}: UpdatedPolicyCustomTaxNameParams) => `changed the custom tax name to "${newName}" (previously "${oldName}")`, + updateCurrencyDefaultTax: ({oldName, newName}: UpdatedPolicyCurrencyDefaultTaxParams) => `changed the workspace currency default tax rate to "${newName}" (previously "${oldName}")`, + updateForeignCurrencyDefaultTax: ({oldName, newName}: UpdatedPolicyForeignCurrencyDefaultTaxParams) => + `changed the foreign currency default tax rate to "${newName}" (previously "${oldName}")`, addTax: ({taxName}: UpdatedPolicyTaxParams) => `added the tax "${taxName}"`, deleteTax: ({taxName}: UpdatedPolicyTaxParams) => `removed the tax "${taxName}"`, updateTax: ({oldValue, taxName, updatedField, newValue}: UpdatedPolicyTaxParams) => { diff --git a/src/languages/es.ts b/src/languages/es.ts index d36023e9b4f8d..6fb9ea3c57879 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -6758,6 +6758,9 @@ ${amount} para ${merchant} - ${date}`, previousForwardsTo ? `cambió el flujo de aprobación para ${approver} para dejar de reenviar informes aprobados (anteriormente reenviados a ${previousForwardsTo})` : `cambió el flujo de aprobación para ${approver} para dejar de reenviar informes aprobados`, + updateCustomTaxName: ({oldName, newName}) => `cambió el nombre del impuesto personalizado a "${newName}" (antes "${oldName}")`, + updateCurrencyDefaultTax: ({oldName, newName}) => `cambió la tasa impositiva predeterminada de la moneda del espacio de trabajo a "${newName}" (anteriormente "${oldName}")`, + updateForeignCurrencyDefaultTax: ({oldName, newName}) => `cambió la tasa impositiva predeterminada de la moneda extranjera a "${newName}" (anteriormente "${oldName}")`, changedInvoiceCompanyName: ({newValue, oldValue}: {newValue: string; oldValue?: string}) => oldValue ? `cambió el nombre de la empresa de la factura a "${newValue}" (previamente "${oldValue}")` : `estableció el nombre de la empresa de la factura como "${newValue}"`, changedInvoiceCompanyWebsite: ({newValue, oldValue}: {newValue: string; oldValue?: string}) => diff --git a/src/languages/fr.ts b/src/languages/fr.ts index 809aa73933c76..d6dc6f0adee2a 100644 --- a/src/languages/fr.ts +++ b/src/languages/fr.ts @@ -65,8 +65,11 @@ import type { UpdatedPolicyBudgetNotificationParams, UpdatedPolicyCategoriesParams, UpdatedPolicyCategoryMaxAmountNoReceiptParams, + UpdatedPolicyCurrencyDefaultTaxParams, + UpdatedPolicyCustomTaxNameParams, UpdatedPolicyCustomUnitSubRateParams, UpdatedPolicyDefaultTitleParams, + UpdatedPolicyForeignCurrencyDefaultTaxParams, UpdatedPolicyManualApprovalThresholdParams, UpdatedPolicyOwnershipParams, UpdatedPolicyPreventSelfApprovalParams, @@ -6840,6 +6843,11 @@ Rendez obligatoires des informations de dépense comme les reçus et les descrip changedReimburser: ({newReimburser, previousReimburser}: UpdatedPolicyReimburserParams) => previousReimburser ? `a modifié le payeur autorisé en « ${newReimburser} » (auparavant « ${previousReimburser} »)` : `a modifié le payeur autorisé en « ${newReimburser} »`, updateReimbursementEnabled: ({enabled}: UpdatedPolicyReimbursementEnabledParams) => `Remboursements ${enabled ? 'Activé' : 'Désactivé'}`, + updateCustomTaxName: ({oldName, newName}: UpdatedPolicyCustomTaxNameParams) => `a modifié le nom de taxe personnalisé en « ${newName} » (auparavant « ${oldName} »)`, + updateCurrencyDefaultTax: ({oldName, newName}: UpdatedPolicyCurrencyDefaultTaxParams) => + `a modifié le taux de taxe par défaut de la devise de l'espace de travail en « ${newName} » (auparavant « ${oldName} »)`, + updateForeignCurrencyDefaultTax: ({oldName, newName}: UpdatedPolicyForeignCurrencyDefaultTaxParams) => + `a modifié le taux de taxe par défaut en devise étrangère en « ${newName} » (auparavant « ${oldName} »)`, addTax: ({taxName}: UpdatedPolicyTaxParams) => `a ajouté la taxe « ${taxName} »`, deleteTax: ({taxName}: UpdatedPolicyTaxParams) => `a supprimé la taxe « ${taxName} »`, updateTax: ({oldValue, taxName, updatedField, newValue}: UpdatedPolicyTaxParams) => { diff --git a/src/languages/it.ts b/src/languages/it.ts index ebba8e0b93761..51c74363f3eb6 100644 --- a/src/languages/it.ts +++ b/src/languages/it.ts @@ -65,8 +65,11 @@ import type { UpdatedPolicyBudgetNotificationParams, UpdatedPolicyCategoriesParams, UpdatedPolicyCategoryMaxAmountNoReceiptParams, + UpdatedPolicyCurrencyDefaultTaxParams, + UpdatedPolicyCustomTaxNameParams, UpdatedPolicyCustomUnitSubRateParams, UpdatedPolicyDefaultTitleParams, + UpdatedPolicyForeignCurrencyDefaultTaxParams, UpdatedPolicyManualApprovalThresholdParams, UpdatedPolicyOwnershipParams, UpdatedPolicyPreventSelfApprovalParams, @@ -6805,6 +6808,11 @@ Richiedi dettagli sulle spese come ricevute e descrizioni, imposta limiti e valo ? `ha modificato il pagatore autorizzato in "${newReimburser}" (in precedenza "${previousReimburser}")` : `ha modificato il pagatore autorizzato in "${newReimburser}"`, updateReimbursementEnabled: ({enabled}: UpdatedPolicyReimbursementEnabledParams) => `Rimborsi ${enabled ? 'abilitato' : 'disattivato'}`, + updateCustomTaxName: ({oldName, newName}: UpdatedPolicyCustomTaxNameParams) => `ha cambiato il nome dell'imposta personalizzata in "${newName}" (precedentemente "${oldName}")`, + updateCurrencyDefaultTax: ({oldName, newName}: UpdatedPolicyCurrencyDefaultTaxParams) => + `ha modificato l'aliquota fiscale predefinita della valuta dello spazio di lavoro in "${newName}" (in precedenza "${oldName}")`, + updateForeignCurrencyDefaultTax: ({oldName, newName}: UpdatedPolicyForeignCurrencyDefaultTaxParams) => + `ha modificato l'aliquota fiscale predefinita per valuta estera in "${newName}" (in precedenza "${oldName}")`, addTax: ({taxName}: UpdatedPolicyTaxParams) => `ha aggiunto l’imposta “${taxName}”`, deleteTax: ({taxName}: UpdatedPolicyTaxParams) => `ha rimosso l'imposta "${taxName}"`, updateTax: ({oldValue, taxName, updatedField, newValue}: UpdatedPolicyTaxParams) => { diff --git a/src/languages/ja.ts b/src/languages/ja.ts index f9942a74e38fd..398d20c69d6a1 100644 --- a/src/languages/ja.ts +++ b/src/languages/ja.ts @@ -65,8 +65,11 @@ import type { UpdatedPolicyBudgetNotificationParams, UpdatedPolicyCategoriesParams, UpdatedPolicyCategoryMaxAmountNoReceiptParams, + UpdatedPolicyCurrencyDefaultTaxParams, + UpdatedPolicyCustomTaxNameParams, UpdatedPolicyCustomUnitSubRateParams, UpdatedPolicyDefaultTitleParams, + UpdatedPolicyForeignCurrencyDefaultTaxParams, UpdatedPolicyManualApprovalThresholdParams, UpdatedPolicyOwnershipParams, UpdatedPolicyPreventSelfApprovalParams, @@ -6733,6 +6736,9 @@ ${reportName} changedReimburser: ({newReimburser, previousReimburser}: UpdatedPolicyReimburserParams) => previousReimburser ? `認可された支払者を「${newReimburser}」(以前は「${previousReimburser}」)に変更しました` : `承認済み支払担当者を「${newReimburser}」に変更しました`, updateReimbursementEnabled: ({enabled}: UpdatedPolicyReimbursementEnabledParams) => `${enabled ? '有効' : '無効'}件の精算`, + updateCustomTaxName: ({oldName, newName}: UpdatedPolicyCustomTaxNameParams) => `カスタム税区分名を「${newName}」(以前は「${oldName}」)に変更しました`, + updateCurrencyDefaultTax: ({oldName, newName}: UpdatedPolicyCurrencyDefaultTaxParams) => `ワークスペースの通貨デフォルト税率を「${newName}」(以前は「${oldName}」)に変更しました`, + updateForeignCurrencyDefaultTax: ({oldName, newName}: UpdatedPolicyForeignCurrencyDefaultTaxParams) => `外貨のデフォルト税率を「${newName}」に変更しました(以前は「${oldName}」)。`, addTax: ({taxName}: UpdatedPolicyTaxParams) => `税「${taxName}」を追加しました`, deleteTax: ({taxName}: UpdatedPolicyTaxParams) => `税金「${taxName}」を削除しました`, updateTax: ({oldValue, taxName, updatedField, newValue}: UpdatedPolicyTaxParams) => { diff --git a/src/languages/nl.ts b/src/languages/nl.ts index 95d7cd4f6b03f..dcc3988331085 100644 --- a/src/languages/nl.ts +++ b/src/languages/nl.ts @@ -65,8 +65,11 @@ import type { UpdatedPolicyBudgetNotificationParams, UpdatedPolicyCategoriesParams, UpdatedPolicyCategoryMaxAmountNoReceiptParams, + UpdatedPolicyCurrencyDefaultTaxParams, + UpdatedPolicyCustomTaxNameParams, UpdatedPolicyCustomUnitSubRateParams, UpdatedPolicyDefaultTitleParams, + UpdatedPolicyForeignCurrencyDefaultTaxParams, UpdatedPolicyManualApprovalThresholdParams, UpdatedPolicyOwnershipParams, UpdatedPolicyPreventSelfApprovalParams, @@ -6784,6 +6787,11 @@ Vereis onkostendetails zoals bonnen en beschrijvingen, stel limieten en standaar ? `heeft de gemachtigde betaler gewijzigd in „${newReimburser}” (voorheen „${previousReimburser}”)` : `heeft de gemachtigde betaler gewijzigd naar ‘${newReimburser}’`, updateReimbursementEnabled: ({enabled}: UpdatedPolicyReimbursementEnabledParams) => `${enabled ? 'ingeschakeld' : 'uitgeschakeld'} terugbetalingen`, + updateCustomTaxName: ({oldName, newName}: UpdatedPolicyCustomTaxNameParams) => `de aangepaste belastingnaam gewijzigd in "${newName}" (voorheen "${oldName}")`, + updateCurrencyDefaultTax: ({oldName, newName}: UpdatedPolicyCurrencyDefaultTaxParams) => + `heeft het standaardbelastingtarief van de werkruimtevaluta gewijzigd in "${newName}" (voorheen "${oldName}")`, + updateForeignCurrencyDefaultTax: ({oldName, newName}: UpdatedPolicyForeignCurrencyDefaultTaxParams) => + `heeft het standaardbelastingtarief voor vreemde valuta gewijzigd in '${newName}' (voorheen '${oldName}')`, addTax: ({taxName}: UpdatedPolicyTaxParams) => `heeft de belasting ‘${taxName}’ toegevoegd`, deleteTax: ({taxName}: UpdatedPolicyTaxParams) => `heeft de belasting ‘${taxName}’ verwijderd`, updateTax: ({oldValue, taxName, updatedField, newValue}: UpdatedPolicyTaxParams) => { diff --git a/src/languages/params.ts b/src/languages/params.ts index 9c51ca146c4ea..8a5112bbb527d 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -214,6 +214,12 @@ type UpdatedPolicyManualApprovalThresholdParams = {oldLimit: string; newLimit: s type UpdatedPolicyReimbursementEnabledParams = {enabled: boolean}; +type UpdatedPolicyCustomTaxNameParams = {oldName: string; newName: string}; + +type UpdatedPolicyCurrencyDefaultTaxParams = {oldName: string; newName: string}; + +type UpdatedPolicyForeignCurrencyDefaultTaxParams = {oldName: string; newName: string}; + type UpdatedPolicyReimburserParams = {newReimburser: string; previousReimburser?: string}; type ExportedToIntegrationParams = {label: string; markedManually?: boolean; inProgress?: boolean; lastModified?: string}; @@ -477,6 +483,9 @@ export type { AddedOrDeletedPolicyReportFieldParams, UpdatedPolicyManualApprovalThresholdParams, UpdatedPolicyReimbursementEnabledParams, + UpdatedPolicyCustomTaxNameParams, + UpdatedPolicyCurrencyDefaultTaxParams, + UpdatedPolicyForeignCurrencyDefaultTaxParams, UpdatedPolicyReimburserParams, UpdatePolicyCustomUnitTaxEnabledParams, ImportPolicyCustomUnitRatesParams, diff --git a/src/languages/pl.ts b/src/languages/pl.ts index 59a3b8858ba3f..b8604a98bbd12 100644 --- a/src/languages/pl.ts +++ b/src/languages/pl.ts @@ -65,8 +65,11 @@ import type { UpdatedPolicyBudgetNotificationParams, UpdatedPolicyCategoriesParams, UpdatedPolicyCategoryMaxAmountNoReceiptParams, + UpdatedPolicyCurrencyDefaultTaxParams, + UpdatedPolicyCustomTaxNameParams, UpdatedPolicyCustomUnitSubRateParams, UpdatedPolicyDefaultTitleParams, + UpdatedPolicyForeignCurrencyDefaultTaxParams, UpdatedPolicyManualApprovalThresholdParams, UpdatedPolicyOwnershipParams, UpdatedPolicyPreventSelfApprovalParams, @@ -6774,6 +6777,11 @@ Wymagaj szczegółów wydatków, takich jak paragony i opisy, ustawiaj limity i ? `zmienił(a) upoważnioną osobę zwracającą wydatki na „${newReimburser}” (wcześniej „${previousReimburser}”)` : `zmienił(a) upoważnionego płatnika na „${newReimburser}”`, updateReimbursementEnabled: ({enabled}: UpdatedPolicyReimbursementEnabledParams) => `${enabled ? 'włączone' : 'wyłączone'} zwrotów kosztów`, + updateCustomTaxName: ({oldName, newName}: UpdatedPolicyCustomTaxNameParams) => `zmieniono niestandardową nazwę podatku na „${newName}" (poprzednio „${oldName}")`, + updateCurrencyDefaultTax: ({oldName, newName}: UpdatedPolicyCurrencyDefaultTaxParams) => + `zmienił domyślną stawkę podatku waluty w przestrzeni roboczej na „${newName}" (wcześniej „${oldName}")`, + updateForeignCurrencyDefaultTax: ({oldName, newName}: UpdatedPolicyForeignCurrencyDefaultTaxParams) => + `zmieniono domyślną stawkę podatku dla obcej waluty na „${newName}" (wcześniej „${oldName}")`, addTax: ({taxName}: UpdatedPolicyTaxParams) => `dodano podatek „${taxName}”`, deleteTax: ({taxName}: UpdatedPolicyTaxParams) => `usunął(-ę) podatek „${taxName}”`, updateTax: ({oldValue, taxName, updatedField, newValue}: UpdatedPolicyTaxParams) => { diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts index cb056498d33f3..9fad0b8007773 100644 --- a/src/languages/pt-BR.ts +++ b/src/languages/pt-BR.ts @@ -65,8 +65,11 @@ import type { UpdatedPolicyBudgetNotificationParams, UpdatedPolicyCategoriesParams, UpdatedPolicyCategoryMaxAmountNoReceiptParams, + UpdatedPolicyCurrencyDefaultTaxParams, + UpdatedPolicyCustomTaxNameParams, UpdatedPolicyCustomUnitSubRateParams, UpdatedPolicyDefaultTitleParams, + UpdatedPolicyForeignCurrencyDefaultTaxParams, UpdatedPolicyManualApprovalThresholdParams, UpdatedPolicyOwnershipParams, UpdatedPolicyPreventSelfApprovalParams, @@ -6776,6 +6779,11 @@ Exija dados de despesas como recibos e descrições, defina limites e padrões e changedReimburser: ({newReimburser, previousReimburser}: UpdatedPolicyReimburserParams) => previousReimburser ? `alterou o pagador autorizado para "${newReimburser}" (anteriormente "${previousReimburser}")` : `alterou o pagador autorizado para "${newReimburser}"`, updateReimbursementEnabled: ({enabled}: UpdatedPolicyReimbursementEnabledParams) => `reembolsos ${enabled ? 'ativado' : 'desativado'}`, + updateCustomTaxName: ({oldName, newName}: UpdatedPolicyCustomTaxNameParams) => `alterou o nome do imposto personalizado para "${newName}" (antes "${oldName}")`, + updateCurrencyDefaultTax: ({oldName, newName}: UpdatedPolicyCurrencyDefaultTaxParams) => + `alterou a taxa de imposto padrão da moeda do workspace para "${newName}" (anteriormente "${oldName}")`, + updateForeignCurrencyDefaultTax: ({oldName, newName}: UpdatedPolicyForeignCurrencyDefaultTaxParams) => + `alterou a alíquota de imposto padrão em moeda estrangeira para "${newName}" (anteriormente "${oldName}")`, addTax: ({taxName}: UpdatedPolicyTaxParams) => `adicionou o imposto "${taxName}"`, deleteTax: ({taxName}: UpdatedPolicyTaxParams) => `removeu o imposto "${taxName}"`, updateTax: ({oldValue, taxName, updatedField, newValue}: UpdatedPolicyTaxParams) => { diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts index de176b57f9101..67fe4745d0cbb 100644 --- a/src/languages/zh-hans.ts +++ b/src/languages/zh-hans.ts @@ -65,8 +65,11 @@ import type { UpdatedPolicyBudgetNotificationParams, UpdatedPolicyCategoriesParams, UpdatedPolicyCategoryMaxAmountNoReceiptParams, + UpdatedPolicyCurrencyDefaultTaxParams, + UpdatedPolicyCustomTaxNameParams, UpdatedPolicyCustomUnitSubRateParams, UpdatedPolicyDefaultTitleParams, + UpdatedPolicyForeignCurrencyDefaultTaxParams, UpdatedPolicyManualApprovalThresholdParams, UpdatedPolicyOwnershipParams, UpdatedPolicyPreventSelfApprovalParams, @@ -6623,7 +6626,10 @@ ${reportName} changedReimburser: ({newReimburser, previousReimburser}: UpdatedPolicyReimburserParams) => previousReimburser ? `将授权付款人更改为“${newReimburser}”(之前为“${previousReimburser}”)` : `已将授权付款人更改为“${newReimburser}”`, updateReimbursementEnabled: ({enabled}: UpdatedPolicyReimbursementEnabledParams) => `${enabled ? '已启用' : '已禁用'} 笔报销`, - addTax: ({taxName}: UpdatedPolicyTaxParams) => `已添加税费“${taxName}”`, + updateCustomTaxName: ({oldName, newName}: UpdatedPolicyCustomTaxNameParams) => `将自定义税种名称更改为"${newName}"(之前为"${oldName}")`, + updateCurrencyDefaultTax: ({oldName, newName}: UpdatedPolicyCurrencyDefaultTaxParams) => `将工作区货币的默认税率更改为"${newName}"(之前为"${oldName}")`, + updateForeignCurrencyDefaultTax: ({oldName, newName}: UpdatedPolicyForeignCurrencyDefaultTaxParams) => `将外币默认税率更改为"${newName}"(之前为"${oldName}")`, + addTax: ({taxName}: UpdatedPolicyTaxParams) => `已添加税费"${taxName}"`, deleteTax: ({taxName}: UpdatedPolicyTaxParams) => `已移除税费“${taxName}”`, updateTax: ({oldValue, taxName, updatedField, newValue}: UpdatedPolicyTaxParams) => { if (!updatedField) { diff --git a/src/libs/OptionsListUtils/index.ts b/src/libs/OptionsListUtils/index.ts index e876f77d4292f..b27bdab3bde38 100644 --- a/src/libs/OptionsListUtils/index.ts +++ b/src/libs/OptionsListUtils/index.ts @@ -39,8 +39,11 @@ import { getAutoReimbursementMessage, getChangedApproverActionMessage, getCombinedReportActions, + getCurrencyDefaultTaxUpdateMessage, + getCustomTaxNameUpdateMessage, getDynamicExternalWorkflowRoutedMessage, getExportIntegrationLastMessageText, + getForeignCurrencyDefaultTaxUpdateMessage, getInvoiceCompanyNameUpdateMessage, getInvoiceCompanyWebsiteUpdateMessage, getIOUReportIDFromReportActionPreview, @@ -63,6 +66,7 @@ import { getTravelUpdateMessage, getUpdateACHAccountMessage, getUpdateRoomDescriptionMessage, + getWorkspaceTaxUpdateMessage, hasPendingDEWApprove, hasPendingDEWSubmit, isActionableAddPaymentCard, @@ -829,6 +833,22 @@ function getLastMessageTextForReport({ if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUTO_REIMBURSEMENT)) { lastMessageTextFromReport = getAutoReimbursementMessage(translate, lastReportAction); } + if ( + isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_TAX) || + isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_TAX) || + isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_TAX) + ) { + lastMessageTextFromReport = getWorkspaceTaxUpdateMessage(translate, lastReportAction); + } + if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_TAX_NAME)) { + lastMessageTextFromReport = getCustomTaxNameUpdateMessage(translate, lastReportAction); + } + if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CURRENCY_DEFAULT_TAX)) { + lastMessageTextFromReport = getCurrencyDefaultTaxUpdateMessage(translate, lastReportAction); + } + if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_FOREIGN_CURRENCY_DEFAULT_TAX)) { + lastMessageTextFromReport = getForeignCurrencyDefaultTaxUpdateMessage(translate, lastReportAction); + } // we do not want to show report closed in LHN for non archived report so use getReportLastMessage as fallback instead of lastMessageText from report if (reportID && !isReportArchived && report.lastActionType === CONST.REPORT.ACTIONS.TYPE.CLOSED) { diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 910693f3e4227..f11e8a77a8924 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -2701,6 +2701,36 @@ function getWorkspaceTaxUpdateMessage(translate: LocalizedTranslate, action: Rep return getReportActionText(action); } +function getCustomTaxNameUpdateMessage(translate: LocalizedTranslate, action: ReportAction): string { + const {oldName = '', newName} = getOriginalMessage(action as ReportAction) ?? {}; + + if (newName) { + return translate('workspaceActions.updateCustomTaxName', {oldName, newName}); + } + + return getReportActionText(action); +} + +function getCurrencyDefaultTaxUpdateMessage(translate: LocalizedTranslate, action: ReportAction): string { + const {oldName = '', newName} = getOriginalMessage(action as ReportAction) ?? {}; + + if (newName) { + return translate('workspaceActions.updateCurrencyDefaultTax', {oldName, newName}); + } + + return getReportActionText(action); +} + +function getForeignCurrencyDefaultTaxUpdateMessage(translate: LocalizedTranslate, action: ReportAction): string { + const {oldName = '', newName} = getOriginalMessage(action as ReportAction) ?? {}; + + if (newName) { + return translate('workspaceActions.updateForeignCurrencyDefaultTax', {oldName, newName}); + } + + return getReportActionText(action); +} + function getWorkspaceTagUpdateMessage(translate: LocalizedTranslate, action: ReportAction | undefined): string { const {tagListName, tagName, enabled, newName, newValue, oldName, oldValue, updatedField, count} = getOriginalMessage(action as ReportAction) ?? {}; @@ -4266,6 +4296,9 @@ export { getUpdateACHAccountMessage, getWorkspaceCurrencyUpdateMessage, getWorkspaceTaxUpdateMessage, + getCustomTaxNameUpdateMessage, + getCurrencyDefaultTaxUpdateMessage, + getForeignCurrencyDefaultTaxUpdateMessage, getWorkspaceFrequencyUpdateMessage, getPolicyChangeLogMaxExpenseAmountNoReceiptMessage, getPolicyChangeLogMaxExpenseAmountMessage, diff --git a/src/libs/ReportNameUtils.ts b/src/libs/ReportNameUtils.ts index a939b9fa47e4c..ab2010c5bd442 100644 --- a/src/libs/ReportNameUtils.ts +++ b/src/libs/ReportNameUtils.ts @@ -38,8 +38,11 @@ import { getChangedApproverActionMessage, getCompanyAddressUpdateMessage, getCompanyCardConnectionBrokenMessage, + getCurrencyDefaultTaxUpdateMessage, + getCustomTaxNameUpdateMessage, getDefaultApproverUpdateMessage, getDismissedViolationMessageText, + getForeignCurrencyDefaultTaxUpdateMessage, getForwardsToUpdateMessage, getIntegrationSyncFailedMessage, getInvoiceCompanyNameUpdateMessage, @@ -518,6 +521,26 @@ function computeReportNameBasedOnReportAction( return getReimburserUpdateMessage(translate, parentReportAction); } + if ( + isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_TAX) || + isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_TAX) || + isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_TAX) + ) { + return getWorkspaceTaxUpdateMessage(translate, parentReportAction); + } + + if (isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_TAX_NAME)) { + return getCustomTaxNameUpdateMessage(translate, parentReportAction); + } + + if (isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CURRENCY_DEFAULT_TAX)) { + return getCurrencyDefaultTaxUpdateMessage(translate, parentReportAction); + } + + if (isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_FOREIGN_CURRENCY_DEFAULT_TAX)) { + return getForeignCurrencyDefaultTaxUpdateMessage(translate, parentReportAction); + } + if (isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.ACTIONABLE_CARD_FRAUD_ALERT) && getOriginalMessage(parentReportAction)?.resolution) { return getActionableCardFraudAlertResolutionMessage(translate, parentReportAction); } diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 4a75fbc26f665..2f98d4bcc30af 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -36,9 +36,12 @@ import { getChangedApproverActionMessage, getCompanyAddressUpdateMessage, getCompanyCardConnectionBrokenMessage, + getCurrencyDefaultTaxUpdateMessage, + getCustomTaxNameUpdateMessage, getDefaultApproverUpdateMessage, getDeletedApprovalRuleMessage, getDeletedBudgetMessage, + getForeignCurrencyDefaultTaxUpdateMessage, getForwardsToUpdateMessage, getIntegrationSyncFailedMessage, getInvoiceCompanyNameUpdateMessage, @@ -937,6 +940,12 @@ function getOptionData({ isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_TAX) ) { result.alternateText = getWorkspaceTaxUpdateMessage(translate, lastAction); + } else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_TAX_NAME)) { + result.alternateText = getCustomTaxNameUpdateMessage(translate, lastAction); + } else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CURRENCY_DEFAULT_TAX)) { + result.alternateText = getCurrencyDefaultTaxUpdateMessage(translate, lastAction); + } else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_FOREIGN_CURRENCY_DEFAULT_TAX)) { + result.alternateText = getForeignCurrencyDefaultTaxUpdateMessage(translate, lastAction); } else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_TAG_LIST_NAME)) { result.alternateText = getCleanedTagName(getTagListNameUpdatedMessage(translate, lastAction) ?? ''); } else if (isTagModificationAction(lastAction?.actionName ?? '')) { diff --git a/src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx b/src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx index 857c40bf1cd92..8317bcf38455d 100644 --- a/src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx @@ -37,12 +37,15 @@ import { getCompanyAddressUpdateMessage, getCompanyCardConnectionBrokenMessage, getCreatedReportForUnapprovedTransactionsMessage, + getCurrencyDefaultTaxUpdateMessage, + getCustomTaxNameUpdateMessage, getDefaultApproverUpdateMessage, getDeletedApprovalRuleMessage, getDeletedBudgetMessage, getDismissedViolationMessageText, getDynamicExternalWorkflowRoutedMessage, getExportIntegrationMessageHTML, + getForeignCurrencyDefaultTaxUpdateMessage, getForwardsToUpdateMessage, getHarvestCreatedExpenseReportMessage, getIntegrationSyncFailedMessage, @@ -831,6 +834,12 @@ const ContextMenuActions: ContextMenuAction[] = [ reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_TAX ) { Clipboard.setString(getWorkspaceTaxUpdateMessage(translate, reportAction)); + } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_TAX_NAME) { + Clipboard.setString(getCustomTaxNameUpdateMessage(translate, reportAction)); + } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CURRENCY_DEFAULT_TAX) { + Clipboard.setString(getCurrencyDefaultTaxUpdateMessage(translate, reportAction)); + } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_FOREIGN_CURRENCY_DEFAULT_TAX) { + Clipboard.setString(getForeignCurrencyDefaultTaxUpdateMessage(translate, reportAction)); } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_TAG_LIST_NAME) { Clipboard.setString(getCleanedTagName(getTagListNameUpdatedMessage(translate, reportAction))); } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_TAG_LIST) { diff --git a/src/pages/inbox/report/PureReportActionItem.tsx b/src/pages/inbox/report/PureReportActionItem.tsx index b56a7f7f8004e..1ff88c415c39e 100644 --- a/src/pages/inbox/report/PureReportActionItem.tsx +++ b/src/pages/inbox/report/PureReportActionItem.tsx @@ -81,11 +81,14 @@ import { getCompanyAddressUpdateMessage, getCompanyCardConnectionBrokenMessage, getCreatedReportForUnapprovedTransactionsMessage, + getCurrencyDefaultTaxUpdateMessage, + getCustomTaxNameUpdateMessage, getDefaultApproverUpdateMessage, getDeletedApprovalRuleMessage, getDeletedBudgetMessage, getDemotedFromWorkspaceMessage, getDismissedViolationMessageText, + getForeignCurrencyDefaultTaxUpdateMessage, getForwardsToUpdateMessage, getHarvestCreatedExpenseReportMessage, getIntegrationSyncFailedMessage, @@ -1530,6 +1533,12 @@ function PureReportActionItem({ action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_TAX ) { children = ; + } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_TAX_NAME) { + children = ; + } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CURRENCY_DEFAULT_TAX) { + children = ; + } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_FOREIGN_CURRENCY_DEFAULT_TAX) { + children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_TAG_LIST_NAME) { children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_TAG_LIST) { diff --git a/tests/ui/PureReportActionItemTest.tsx b/tests/ui/PureReportActionItemTest.tsx index e9e6cf986ce7e..f95e12b71dbea 100644 --- a/tests/ui/PureReportActionItemTest.tsx +++ b/tests/ui/PureReportActionItemTest.tsx @@ -239,6 +239,33 @@ describe('PureReportActionItem', () => { expect(screen.getByText(actorEmail)).toBeOnTheScreen(); expect(screen.getByText(Parser.htmlToText(translateLocal('workspaceActions.forcedCorporateUpgrade')))).toBeOnTheScreen(); }); + + it('UPDATE_CUSTOM_TAX_NAME action', async () => { + const action = createReportAction(CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_TAX_NAME, {oldName: 'Sales Tax', newName: 'VAT'}); + renderItemWithAction(action); + await waitForBatchedUpdatesWithAct(); + + expect(screen.getByText(actorEmail)).toBeOnTheScreen(); + expect(screen.getByText('changed the custom tax name to "VAT" (previously "Sales Tax")')).toBeOnTheScreen(); + }); + + it('UPDATE_CURRENCY_DEFAULT_TAX action', async () => { + const action = createReportAction(CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CURRENCY_DEFAULT_TAX, {oldName: 'Standard Rate', newName: 'Reduced Rate'}); + renderItemWithAction(action); + await waitForBatchedUpdatesWithAct(); + + expect(screen.getByText(actorEmail)).toBeOnTheScreen(); + expect(screen.getByText('changed the workspace currency default tax rate to "Reduced Rate" (previously "Standard Rate")')).toBeOnTheScreen(); + }); + + it('UPDATE_FOREIGN_CURRENCY_DEFAULT_TAX action', async () => { + const action = createReportAction(CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_FOREIGN_CURRENCY_DEFAULT_TAX, {oldName: 'Foreign Tax (15%)', newName: 'Foreign Tax (10%)'}); + renderItemWithAction(action); + await waitForBatchedUpdatesWithAct(); + + expect(screen.getByText(actorEmail)).toBeOnTheScreen(); + expect(screen.getByText('changed the foreign currency default tax rate to "Foreign Tax (10%)" (previously "Foreign Tax (15%)")')).toBeOnTheScreen(); + }); }); describe('DEW (Dynamic External Workflow) actions', () => { diff --git a/tests/unit/OptionsListUtilsTest.tsx b/tests/unit/OptionsListUtilsTest.tsx index 563253c5b0ae2..04da5a9846ced 100644 --- a/tests/unit/OptionsListUtilsTest.tsx +++ b/tests/unit/OptionsListUtilsTest.tsx @@ -45,7 +45,13 @@ import { sortAlphabetically, } from '@libs/OptionsListUtils'; import Parser from '@libs/Parser'; -import {getChangedApproverActionMessage, getDynamicExternalWorkflowRoutedMessage} from '@libs/ReportActionsUtils'; +import { + getChangedApproverActionMessage, + getCurrencyDefaultTaxUpdateMessage, + getCustomTaxNameUpdateMessage, + getDynamicExternalWorkflowRoutedMessage, + getForeignCurrencyDefaultTaxUpdateMessage, +} from '@libs/ReportActionsUtils'; import { canCreateTaskInReport, canUserPerformWriteAction, @@ -4262,6 +4268,63 @@ describe('OptionsListUtils', () => { expect(lastMessage).toBe(Parser.htmlToText(translate(CONST.LOCALES.EN, 'workspaceActions.forcedCorporateUpgrade'))); }); }); + it('UPDATE_CUSTOM_TAX_NAME action', async () => { + const report: Report = createRandomReport(0, undefined); + const action: ReportAction = { + ...createRandomReportAction(1), + actionName: CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_TAX_NAME, + message: [{type: 'COMMENT', text: ''}], + originalMessage: {oldName: 'Sales Tax', newName: 'VAT'}, + }; + await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}`, { + [action.reportActionID]: action, + }); + const lastMessage = getLastMessageTextForReport({ + translate: translateLocal, + report, + lastActorDetails: null, + isReportArchived: false, + }); + expect(lastMessage).toBe(getCustomTaxNameUpdateMessage(translateLocal, action)); + }); + it('UPDATE_CURRENCY_DEFAULT_TAX action', async () => { + const report: Report = createRandomReport(0, undefined); + const action: ReportAction = { + ...createRandomReportAction(1), + actionName: CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CURRENCY_DEFAULT_TAX, + message: [{type: 'COMMENT', text: ''}], + originalMessage: {oldName: 'Standard Rate', newName: 'Reduced Rate'}, + }; + await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}`, { + [action.reportActionID]: action, + }); + const lastMessage = getLastMessageTextForReport({ + translate: translateLocal, + report, + lastActorDetails: null, + isReportArchived: false, + }); + expect(lastMessage).toBe(getCurrencyDefaultTaxUpdateMessage(translateLocal, action)); + }); + it('UPDATE_FOREIGN_CURRENCY_DEFAULT_TAX action', async () => { + const report: Report = createRandomReport(0, undefined); + const action: ReportAction = { + ...createRandomReportAction(1), + actionName: CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_FOREIGN_CURRENCY_DEFAULT_TAX, + message: [{type: 'COMMENT', text: ''}], + originalMessage: {oldName: 'Foreign Tax (15%)', newName: 'Foreign Tax (10%)'}, + }; + await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}`, { + [action.reportActionID]: action, + }); + const lastMessage = getLastMessageTextForReport({ + translate: translateLocal, + report, + lastActorDetails: null, + isReportArchived: false, + }); + expect(lastMessage).toBe(getForeignCurrencyDefaultTaxUpdateMessage(translateLocal, action)); + }); it('TAKE_CONTROL action', async () => { const report: Report = createRandomReport(0, undefined); const takeControlAction: ReportAction = { diff --git a/tests/unit/ReportActionsUtilsTest.ts b/tests/unit/ReportActionsUtilsTest.ts index a2732899644e2..049981d2e948b 100644 --- a/tests/unit/ReportActionsUtilsTest.ts +++ b/tests/unit/ReportActionsUtilsTest.ts @@ -16,6 +16,9 @@ import { getCardIssuedMessage, getCompanyAddressUpdateMessage, getCreatedReportForUnapprovedTransactionsMessage, + getCurrencyDefaultTaxUpdateMessage, + getCustomTaxNameUpdateMessage, + getForeignCurrencyDefaultTaxUpdateMessage, getInvoiceCompanyNameUpdateMessage, getInvoiceCompanyWebsiteUpdateMessage, getOneTransactionThreadReportID, @@ -3345,6 +3348,72 @@ describe('ReportActionsUtils', () => { }); }); + describe('getCustomTaxNameUpdateMessage', () => { + it('should return the correct message when updating custom tax name', () => { + // Given an UPDATE_CUSTOM_TAX_NAME action with old and new names + const action = { + actionName: CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_TAX_NAME, + reportActionID: '1', + created: '', + originalMessage: { + oldName: 'Sales Tax', + newName: 'VAT', + }, + message: [], + } as ReportAction; + + // When getting the update message + const result = getCustomTaxNameUpdateMessage(translateLocal, action); + + // Then it should return the correct message with old and new names + expect(result).toBe('changed the custom tax name to "VAT" (previously "Sales Tax")'); + }); + }); + + describe('getCurrencyDefaultTaxUpdateMessage', () => { + it('should return the correct message when updating workspace currency default tax', () => { + // Given an UPDATE_CURRENCY_DEFAULT_TAX action with old and new names + const action = { + actionName: CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CURRENCY_DEFAULT_TAX, + reportActionID: '1', + created: '', + originalMessage: { + oldName: 'Standard Rate', + newName: 'Reduced Rate', + }, + message: [], + } as ReportAction; + + // When getting the update message + const result = getCurrencyDefaultTaxUpdateMessage(translateLocal, action); + + // Then it should return the correct message with old and new names + expect(result).toBe('changed the workspace currency default tax rate to "Reduced Rate" (previously "Standard Rate")'); + }); + }); + + describe('getForeignCurrencyDefaultTaxUpdateMessage', () => { + it('should return the correct message when updating foreign currency default tax', () => { + // Given an UPDATE_FOREIGN_CURRENCY_DEFAULT_TAX action with old and new names + const action = { + actionName: CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_FOREIGN_CURRENCY_DEFAULT_TAX, + reportActionID: '1', + created: '', + originalMessage: { + oldName: 'Foreign Tax (15%)', + newName: 'Foreign Tax (10%)', + }, + message: [], + } as ReportAction; + + // When getting the update message + const result = getForeignCurrencyDefaultTaxUpdateMessage(translateLocal, action); + + // Then it should return the correct message with old and new names + expect(result).toBe('changed the foreign currency default tax rate to "Foreign Tax (10%)" (previously "Foreign Tax (15%)")'); + }); + }); + describe('getAutoPayApprovedReportsEnabledMessage', () => { it('should return enabled message when auto-pay is enabled', () => { const action = { diff --git a/tests/unit/ReportUtilsTest.ts b/tests/unit/ReportUtilsTest.ts index a85b906cd66aa..a8c48fabdc297 100644 --- a/tests/unit/ReportUtilsTest.ts +++ b/tests/unit/ReportUtilsTest.ts @@ -1865,6 +1865,81 @@ describe('ReportUtils', () => { expect(reportName).toBe('updated the name of this workspace to "New Workspace" (previously "Old Workspace")'); }); + test('should handle add tax action', () => { + const action: ReportAction = { + ...baseParentReportAction, + actionName: CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_TAX, + originalMessage: {taxName: 'Sales Tax (10%)'}, + }; + + const reportActions = { + [`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.parentReportID}`]: {[action.reportActionID]: action}, + }; + const reportName = computeReportName(report, undefined, undefined, undefined, undefined, participantsPersonalDetails, reportActions); + + expect(reportName).toBe('added the tax "Sales Tax (10%)"'); + }); + + test('should handle delete tax action', () => { + const action: ReportAction = { + ...baseParentReportAction, + actionName: CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_TAX, + originalMessage: {taxName: 'Old Tax (5%)'}, + }; + + const reportActions = { + [`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.parentReportID}`]: {[action.reportActionID]: action}, + }; + const reportName = computeReportName(report, undefined, undefined, undefined, undefined, participantsPersonalDetails, reportActions); + + expect(reportName).toBe('removed the tax "Old Tax (5%)"'); + }); + + test('should handle custom tax name update action', () => { + const action: ReportAction = { + ...baseParentReportAction, + actionName: CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_TAX_NAME, + originalMessage: {oldName: 'Sales Tax', newName: 'VAT'}, + }; + + const reportActions = { + [`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.parentReportID}`]: {[action.reportActionID]: action}, + }; + const reportName = computeReportName(report, undefined, undefined, undefined, undefined, participantsPersonalDetails, reportActions); + + expect(reportName).toBe('changed the custom tax name to "VAT" (previously "Sales Tax")'); + }); + + test('should handle currency default tax update action', () => { + const action: ReportAction = { + ...baseParentReportAction, + actionName: CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CURRENCY_DEFAULT_TAX, + originalMessage: {oldName: 'Standard Rate', newName: 'Reduced Rate'}, + }; + + const reportActions = { + [`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.parentReportID}`]: {[action.reportActionID]: action}, + }; + const reportName = computeReportName(report, undefined, undefined, undefined, undefined, participantsPersonalDetails, reportActions); + + expect(reportName).toBe('changed the workspace currency default tax rate to "Reduced Rate" (previously "Standard Rate")'); + }); + + test('should handle foreign currency default tax update action', () => { + const action: ReportAction = { + ...baseParentReportAction, + actionName: CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_FOREIGN_CURRENCY_DEFAULT_TAX, + originalMessage: {oldName: 'Foreign Tax (15%)', newName: 'Foreign Tax (10%)'}, + }; + + const reportActions = { + [`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.parentReportID}`]: {[action.reportActionID]: action}, + }; + const reportName = computeReportName(report, undefined, undefined, undefined, undefined, participantsPersonalDetails, reportActions); + + expect(reportName).toBe('changed the foreign currency default tax rate to "Foreign Tax (10%)" (previously "Foreign Tax (15%)")'); + }); + test('should handle corporate force upgrade action', () => { const forceUpgradeAction: ReportAction = { ...baseParentReportAction, diff --git a/tests/unit/SidebarUtilsTest.ts b/tests/unit/SidebarUtilsTest.ts index cf4f9a800a911..c5da1169a3bf2 100644 --- a/tests/unit/SidebarUtilsTest.ts +++ b/tests/unit/SidebarUtilsTest.ts @@ -1415,6 +1415,123 @@ describe('SidebarUtils', () => { expect(result?.alternateText).toBe(`${getReportActionMessageText(lastAction)}`); }); + it('returns the correct alternate text for UPDATE_CUSTOM_TAX_NAME action', async () => { + const report: Report = { + ...createRandomReport(4, 'policyAdmins'), + participants: {'18921695': {notificationPreference: 'always'}}, + }; + const lastAction: ReportAction = { + ...createRandomReportAction(2), + actionName: CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_TAX_NAME, + originalMessage: {oldName: 'Sales Tax', newName: 'VAT'}, + }; + const reportActions: ReportActions = {[lastAction.reportActionID]: lastAction}; + await act(async () => { + await Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`, report); + await Onyx.set(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}`, reportActions); + }); + + const result = SidebarUtils.getOptionData({ + report, + reportAttributes: undefined, + reportNameValuePairs: {}, + personalDetails: {}, + policy: undefined, + invoiceReceiverPolicy: undefined, + parentReportAction: undefined, + conciergeReportID: '', + oneTransactionThreadReport: undefined, + card: undefined, + translate: translateLocal, + localeCompare, + lastAction, + lastActionReport: undefined, + isReportArchived: undefined, + currentUserAccountID: 0, + reportAttributesDerived: undefined, + }); + + expect(result?.alternateText).toBe('changed the custom tax name to "VAT" (previously "Sales Tax")'); + }); + + it('returns the correct alternate text for UPDATE_CURRENCY_DEFAULT_TAX action', async () => { + const report: Report = { + ...createRandomReport(4, 'policyAdmins'), + participants: {'18921695': {notificationPreference: 'always'}}, + }; + const lastAction: ReportAction = { + ...createRandomReportAction(2), + actionName: CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CURRENCY_DEFAULT_TAX, + originalMessage: {oldName: 'Standard Rate', newName: 'Reduced Rate'}, + }; + const reportActions: ReportActions = {[lastAction.reportActionID]: lastAction}; + await act(async () => { + await Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`, report); + await Onyx.set(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}`, reportActions); + }); + + const result = SidebarUtils.getOptionData({ + report, + reportAttributes: undefined, + reportNameValuePairs: {}, + personalDetails: {}, + policy: undefined, + invoiceReceiverPolicy: undefined, + parentReportAction: undefined, + conciergeReportID: '', + oneTransactionThreadReport: undefined, + card: undefined, + translate: translateLocal, + localeCompare, + lastAction, + lastActionReport: undefined, + isReportArchived: undefined, + currentUserAccountID: 0, + reportAttributesDerived: undefined, + }); + + expect(result?.alternateText).toBe('changed the workspace currency default tax rate to "Reduced Rate" (previously "Standard Rate")'); + }); + + it('returns the correct alternate text for UPDATE_FOREIGN_CURRENCY_DEFAULT_TAX action', async () => { + const report: Report = { + ...createRandomReport(4, 'policyAdmins'), + participants: {'18921695': {notificationPreference: 'always'}}, + }; + const lastAction: ReportAction = { + ...createRandomReportAction(2), + actionName: CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_FOREIGN_CURRENCY_DEFAULT_TAX, + originalMessage: {oldName: 'Foreign Tax (15%)', newName: 'Foreign Tax (10%)'}, + }; + const reportActions: ReportActions = {[lastAction.reportActionID]: lastAction}; + await act(async () => { + await Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`, report); + await Onyx.set(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}`, reportActions); + }); + + const result = SidebarUtils.getOptionData({ + report, + reportAttributes: undefined, + reportNameValuePairs: {}, + personalDetails: {}, + policy: undefined, + invoiceReceiverPolicy: undefined, + parentReportAction: undefined, + conciergeReportID: '', + oneTransactionThreadReport: undefined, + card: undefined, + translate: translateLocal, + localeCompare, + lastAction, + lastActionReport: undefined, + isReportArchived: undefined, + currentUserAccountID: 0, + reportAttributesDerived: undefined, + }); + + expect(result?.alternateText).toBe('changed the foreign currency default tax rate to "Foreign Tax (10%)" (previously "Foreign Tax (15%)")'); + }); + it('returns @Hidden as an alternate text if the last action mentioned account has no name', async () => { // When a report has last action with mention of an account that has no name const report: Report = {