diff --git a/src/languages/en.ts b/src/languages/en.ts index ef7a7c83c42c6..cfe46cbbc34b8 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -7,8 +7,9 @@ import type { AccountOwnerParams, ActionsAreCurrentlyRestricted, AddedOrDeletedPolicyReportFieldParams, - AddedPolicyCustomUnitRateParams, + AddedPolicyApprovalRuleParams, AddEmployeeParams, + AddOrDeletePolicyCustomUnitRateParams, AddressLineParams, AdminCanceledRequestParams, AlreadySignedInParams, @@ -132,6 +133,9 @@ import type { PayerPaidParams, PayerSettledParams, PaySomeoneParams, + PolicyAddedReportFieldOptionParams, + PolicyDisabledReportFieldAllOptionsParams, + PolicyDisabledReportFieldOptionParams, PolicyExpenseChatNameParams, ReconciliationWorksParams, RemovedFromApprovalWorkflowParams, @@ -192,13 +196,23 @@ import type { UnshareParams, UntilTimeParams, UpdatedCustomFieldParams, + UpdatedPolicyApprovalRuleParams, + UpdatedPolicyAuditRateParams, + UpdatedPolicyCategoryExpenseLimitTypeParams, + UpdatedPolicyCategoryGLCodeParams, + UpdatedPolicyCategoryMaxAmountNoReceiptParams, + UpdatedPolicyCategoryMaxExpenseAmountParams, UpdatedPolicyCategoryNameParams, UpdatedPolicyCategoryParams, UpdatedPolicyCurrencyParams, + UpdatedPolicyCustomUnitRateParams, + UpdatedPolicyCustomUnitTaxClaimablePercentageParams, + UpdatedPolicyCustomUnitTaxRateExternalIDParams, UpdatedPolicyDescriptionParams, UpdatedPolicyFieldWithNewAndOldValueParams, UpdatedPolicyFieldWithValueParam, UpdatedPolicyFrequencyParams, + UpdatedPolicyManualApprovalThresholdParams, UpdatedPolicyPreventSelfApprovalParams, UpdatedPolicyReportFieldDefaultValueParams, UpdatedPolicyTagFieldParams, @@ -206,6 +220,8 @@ import type { UpdatedPolicyTagParams, UpdatedTheDistanceMerchantParams, UpdatedTheRequestParams, + UpdatePolicyCustomUnitParams, + UpdatePolicyCustomUnitTaxEnabledParams, UpdateRoleParams, UsePlusButtonParams, UserIsAlreadyMemberParams, @@ -5150,10 +5166,64 @@ const translations = { billcom: 'BILLCOM', }, workspaceActions: { + addApprovalRule: ({approverEmail, approverName, field, name}: AddedPolicyApprovalRuleParams) => `added ${approverName} (${approverEmail}) as an approver for the ${field} "${name}"`, + deleteApprovalRule: ({approverEmail, approverName, field, name}: AddedPolicyApprovalRuleParams) => + `removed ${approverName} (${approverEmail}) as an approver for the ${field} "${name}"`, + updateApprovalRule: ({field, name, newApproverEmail, newApproverName, oldApproverEmail, oldApproverName}: UpdatedPolicyApprovalRuleParams) => { + const formatApprover = (displayName?: string, email?: string) => (displayName ? `${displayName} (${email})` : email); + + return `changed the approver for the ${field} "${name}" to ${formatApprover(newApproverName, newApproverEmail)} (previously ${formatApprover( + oldApproverName, + oldApproverEmail, + )})`; + }, addCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `added the category "${categoryName}"`, deleteCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `removed the category "${categoryName}"`, updateCategory: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => `${oldValue ? 'disabled' : 'enabled'} the category "${categoryName}"`, + updateCategoryPayrollCode: ({oldValue, categoryName, newValue}: UpdatedPolicyCategoryGLCodeParams) => { + if (!oldValue) { + return `added the payroll code "${newValue}" to the category "${categoryName}"`; + } + if (!newValue && oldValue) { + return `removed the payroll code "${oldValue}" from the category "${categoryName}"`; + } + return `changed the "${categoryName}" category payroll code to “${newValue}” (previously “${oldValue}”)`; + }, + updateCategoryGLCode: ({oldValue, categoryName, newValue}: UpdatedPolicyCategoryGLCodeParams) => { + if (!oldValue) { + return `added the GL code "${newValue}” to the category "${categoryName}"`; + } + if (!newValue && oldValue) { + return `removed the GL code "${oldValue}" from the category "${categoryName}"`; + } + return `changed the “${categoryName}” category GL code to “${newValue}” (previously “${oldValue}“)`; + }, + updateAreCommentsRequired: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => { + return `changed the "${categoryName}" category description to ${!oldValue ? 'required' : 'not required'} (previously ${!oldValue ? 'not required' : 'required'})`; + }, + updateCategoryMaxExpenseAmount: ({categoryName, oldAmount, newAmount}: UpdatedPolicyCategoryMaxExpenseAmountParams) => { + if (newAmount && !oldAmount) { + return `added a ${newAmount} max amount to the category "${categoryName}"`; + } + if (oldAmount && !newAmount) { + return `removed the ${oldAmount} max amount from the category "${categoryName}"`; + } + return `changed the "${categoryName}" category max amount to ${newAmount} (previously ${oldAmount})`; + }, + updateCategoryExpenseLimitType: ({categoryName, oldValue, newValue}: UpdatedPolicyCategoryExpenseLimitTypeParams) => { + if (!oldValue) { + return `added a limit type of ${newValue} to the category "${categoryName}"`; + } + return `changed the "${categoryName}" category limit type to ${newValue} (previously ${oldValue})`; + }, + updateCategoryMaxAmountNoReceipt: ({categoryName, oldValue, newValue}: UpdatedPolicyCategoryMaxAmountNoReceiptParams) => { + if (!oldValue) { + return `updated the category "${categoryName}" by changing Receipts to ${newValue}`; + } + return `changed the "${categoryName}" category to ${newValue} (previously ${oldValue})`; + }, setCategoryName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `renamed the category "${oldName}" to "${newName}"`, + updateTagListName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `changed the tag list name to "${newName}" (previously "${oldName}")`, addTag: ({tagListName, tagName}: UpdatedPolicyTagParams) => `added the tag "${tagName}" to the list "${tagListName}"`, updateTagName: ({tagListName, newName, oldName}: UpdatedPolicyTagNameParams) => `updated the tag list "${tagListName}" by changing the tag "${oldName}" to "${newName}`, updateTagEnabled: ({tagListName, tagName, enabled}: UpdatedPolicyTagParams) => `${enabled ? 'enabled' : 'disabled'} the tag "${tagName}" on the list "${tagListName}"`, @@ -5165,9 +5235,37 @@ const translations = { } return `updated the tag "${tagName}" on the list "${tagListName}" by adding a ${updatedField} of "${newValue}"`; }, - addCustomUnitRate: ({customUnitName, rateName}: AddedPolicyCustomUnitRateParams) => `added a new "${customUnitName}" rate "${rateName}"`, + updateCustomUnit: ({customUnitName, newValue, oldValue, updatedField}: UpdatePolicyCustomUnitParams) => + `changed the ${customUnitName} ${updatedField} to "${newValue}" (previously "${oldValue}")`, + updateCustomUnitTaxEnabled: ({newValue}: UpdatePolicyCustomUnitTaxEnabledParams) => `${newValue ? 'enabled' : 'disabled'} tax tracking on distance rates`, + addCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `added a new "${customUnitName}" rate "${rateName}"`, + updatedCustomUnitRate: ({customUnitName, customUnitRateName, newValue, oldValue, updatedField}: UpdatedPolicyCustomUnitRateParams) => + `changed the rate of the ${customUnitName} ${updatedField} "${customUnitRateName}" to "${newValue}" (previously "${oldValue}")`, + updatedCustomUnitTaxRateExternalID: ({customUnitRateName, newValue, newTaxPercentage, oldTaxPercentage, oldValue}: UpdatedPolicyCustomUnitTaxRateExternalIDParams) => { + if (oldTaxPercentage && oldValue) { + return `changed the tax rate on the distance rate "${customUnitRateName}" to "${newValue} (${newTaxPercentage})" (previously "${oldValue} (${oldTaxPercentage})")`; + } + return `added the tax rate "${newValue} (${newTaxPercentage})" to the distance rate "${customUnitRateName}"`; + }, + updatedCustomUnitTaxClaimablePercentage: ({customUnitRateName, newValue, oldValue}: UpdatedPolicyCustomUnitTaxClaimablePercentageParams) => { + if (oldValue) { + return `changed the tax reclaimable portion on the distance rate "${customUnitRateName}" to "${newValue}" (previously "${oldValue}")`; + } + return `added a tax reclaimable portion of "${newValue}" to the distance rate "${customUnitRateName}`; + }, + deleteCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `removed the "${customUnitName}" rate "${rateName}"`, addedReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `added ${fieldType} Report Field "${fieldName}"`, updateReportFieldDefaultValue: ({defaultValue, fieldName}: UpdatedPolicyReportFieldDefaultValueParams) => `set the default value of report field "${fieldName}" to "${defaultValue}"`, + addedReportFieldOption: ({fieldName, optionName}: PolicyAddedReportFieldOptionParams) => `added the option "${optionName}" to the report field "${fieldName}"`, + removedReportFieldOption: ({fieldName, optionName}: PolicyAddedReportFieldOptionParams) => `removed the option "${optionName}" from the report field "${fieldName}"`, + updateReportFieldOptionDisabled: ({fieldName, optionName, optionEnabled}: PolicyDisabledReportFieldOptionParams) => + `${optionEnabled ? 'enabled' : 'disabled'} the option "${optionName}" for the report field "${fieldName}"`, + updateReportFieldAllOptionsDisabled: ({fieldName, optionName, allEnabled, toggledOptionsCount}: PolicyDisabledReportFieldAllOptionsParams) => { + if (toggledOptionsCount && toggledOptionsCount > 1) { + return `${allEnabled ? 'enabled' : 'disabled'} all options for the report field "${fieldName}" `; + } + return `${allEnabled ? 'enabled' : 'disabled'} the option "${optionName}" for the report field "${fieldName}", making all options ${allEnabled ? 'enabled' : 'disabled'}`; + }, deleteReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `removed ${fieldType} Report Field "${fieldName}"`, preventSelfApproval: ({oldValue, newValue}: UpdatedPolicyPreventSelfApprovalParams) => `updated "Prevent self-approval" to "${newValue === 'true' ? 'Enabled' : 'Disabled'}" (previously "${oldValue === 'true' ? 'Enabled' : 'Disabled'}")`, @@ -5212,6 +5310,10 @@ const translations = { updateApprovalMode: ({newValue, oldValue}: ChangeFieldParams) => `updated the approval mode to "${newValue}" (previously "${oldValue}")`, upgradedWorkspace: 'upgraded this workspace to the Control plan', downgradedWorkspace: 'downgraded this workspace to the Collect plan', + updatedAuditRate: ({oldAuditRate, newAuditRate}: UpdatedPolicyAuditRateParams) => + `changed the rate of reports randomly routed for manual approval to ${Math.round(newAuditRate * 100)}% (previously ${Math.round(oldAuditRate * 100)}%)`, + updatedManualApprovalThreshold: ({oldLimit, newLimit}: UpdatedPolicyManualApprovalThresholdParams) => + `changed the manual approval limit for all expenses to ${newLimit} (previously ${oldLimit})`, }, roomMembersPage: { memberNotFound: 'Member not found.', @@ -5554,6 +5656,7 @@ const translations = { leftWorkspace: ({nameOrEmail}: LeftWorkspaceParams) => `${nameOrEmail} left the workspace`, removeMember: ({email, role}: AddEmployeeParams) => `removed ${role} ${email}`, removedConnection: ({connectionName}: ConnectionNameParams) => `removed connection to ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName]}`, + addedConnection: ({connectionName}: ConnectionNameParams) => `connected to ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName]}`, leftTheChat: 'left the chat', }, }, diff --git a/src/languages/es.ts b/src/languages/es.ts index 735e63e747215..419797fdd3c02 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -6,8 +6,9 @@ import type { AccountOwnerParams, ActionsAreCurrentlyRestricted, AddedOrDeletedPolicyReportFieldParams, - AddedPolicyCustomUnitRateParams, + AddedPolicyApprovalRuleParams, AddEmployeeParams, + AddOrDeletePolicyCustomUnitRateParams, AddressLineParams, AdminCanceledRequestParams, AlreadySignedInParams, @@ -131,6 +132,9 @@ import type { PayerPaidParams, PayerSettledParams, PaySomeoneParams, + PolicyAddedReportFieldOptionParams, + PolicyDisabledReportFieldAllOptionsParams, + PolicyDisabledReportFieldOptionParams, PolicyExpenseChatNameParams, ReconciliationWorksParams, RemovedFromApprovalWorkflowParams, @@ -191,13 +195,23 @@ import type { UnshareParams, UntilTimeParams, UpdatedCustomFieldParams, + UpdatedPolicyApprovalRuleParams, + UpdatedPolicyAuditRateParams, + UpdatedPolicyCategoryExpenseLimitTypeParams, + UpdatedPolicyCategoryGLCodeParams, + UpdatedPolicyCategoryMaxAmountNoReceiptParams, + UpdatedPolicyCategoryMaxExpenseAmountParams, UpdatedPolicyCategoryNameParams, UpdatedPolicyCategoryParams, UpdatedPolicyCurrencyParams, + UpdatedPolicyCustomUnitRateParams, + UpdatedPolicyCustomUnitTaxClaimablePercentageParams, + UpdatedPolicyCustomUnitTaxRateExternalIDParams, UpdatedPolicyDescriptionParams, UpdatedPolicyFieldWithNewAndOldValueParams, UpdatedPolicyFieldWithValueParam, UpdatedPolicyFrequencyParams, + UpdatedPolicyManualApprovalThresholdParams, UpdatedPolicyPreventSelfApprovalParams, UpdatedPolicyReportFieldDefaultValueParams, UpdatedPolicyTagFieldParams, @@ -205,6 +219,8 @@ import type { UpdatedPolicyTagParams, UpdatedTheDistanceMerchantParams, UpdatedTheRequestParams, + UpdatePolicyCustomUnitParams, + UpdatePolicyCustomUnitTaxEnabledParams, UpdateRoleParams, UsePlusButtonParams, UserIsAlreadyMemberParams, @@ -5202,10 +5218,62 @@ const translations = { billcom: 'BILLCOM', }, workspaceActions: { + addApprovalRule: ({approverEmail, approverName, field, name}: AddedPolicyApprovalRuleParams) => + `añadió a ${approverName} (${approverEmail}) como aprobador para la ${field} "${name}"`, + deleteApprovalRule: ({approverEmail, approverName, field, name}: AddedPolicyApprovalRuleParams) => + `eliminó a ${approverName} (${approverEmail}) como aprobador para la ${field} "${name}"`, + updateApprovalRule: ({field, name, newApproverEmail, newApproverName, oldApproverEmail, oldApproverName}: UpdatedPolicyApprovalRuleParams) => { + const formatApprover = (displayName?: string, email?: string) => (displayName ? `${displayName} (${email})` : email); + + return `cambió el aprobador para la ${field} "${name}" a ${formatApprover(newApproverName, newApproverEmail)} (previamente ${formatApprover(oldApproverName, oldApproverEmail)})`; + }, addCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `añadió la categoría "${categoryName}""`, deleteCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `eliminó la categoría "${categoryName}"`, updateCategory: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => `${oldValue ? 'deshabilitó' : 'habilitó'} la categoría "${categoryName}"`, - setCategoryName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `renombró la categoría "${oldName}" a "${newName}`, + updateCategoryPayrollCode: ({oldValue, categoryName, newValue}: UpdatedPolicyCategoryGLCodeParams) => { + if (!oldValue) { + return `añadió el código de nómina "${newValue}" a la categoría "${categoryName}"`; + } + if (!newValue && oldValue) { + return `eliminó el código de nómina "${oldValue}" de la categoría "${categoryName}"`; + } + return `cambió el código de nómina de la categoría "${categoryName}" a “${newValue}” (previamente “${oldValue}”)`; + }, + updateCategoryGLCode: ({oldValue, categoryName, newValue}: UpdatedPolicyCategoryGLCodeParams) => { + if (!oldValue) { + return `añadió el código GL "${newValue}" a la categoría "${categoryName}"`; + } + if (!newValue && oldValue) { + return `eliminó el código GL "${oldValue}" de la categoría "${categoryName}"`; + } + return `cambió el código GL de la categoría “${categoryName}” a “${newValue}” (previamente “${oldValue}”)`; + }, + updateAreCommentsRequired: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => { + return `cambió la descripción de la categoría "${categoryName}" a ${!oldValue ? 'requerida' : 'no requerida'} (previamente ${!oldValue ? 'no requerida' : 'requerida'})`; + }, + updateCategoryMaxExpenseAmount: ({categoryName, oldAmount, newAmount}: UpdatedPolicyCategoryMaxExpenseAmountParams) => { + if (newAmount && !oldAmount) { + return `añadió un importe máximo de ${newAmount} a la categoría "${categoryName}"`; + } + if (oldAmount && !newAmount) { + return `eliminó el importe máximo de ${oldAmount} de la categoría "${categoryName}"`; + } + return `cambió el importe máximo de la categoría "${categoryName}" a ${newAmount} (previamente ${oldAmount})`; + }, + updateCategoryExpenseLimitType: ({categoryName, oldValue, newValue}: UpdatedPolicyCategoryExpenseLimitTypeParams) => { + if (!oldValue) { + return `añadió un tipo de límite de ${newValue} a la categoría "${categoryName}"`; + } + return `actualizó la categoría "${categoryName}" cambiando el Tipo de Límite a ${newValue} (previamente "${oldValue}")`; + }, + updateCategoryMaxAmountNoReceipt: ({categoryName, oldValue, newValue}: UpdatedPolicyCategoryMaxAmountNoReceiptParams) => { + if (!oldValue) { + return `actualizó la categoría "${categoryName}" cambiando Recibos a ${newValue}`; + } + return `cambió la categoría "${categoryName}" a ${newValue} (previamente ${oldValue})`; + }, + setCategoryName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `renombró la categoría "${oldName}" a "${newName}"`, + updateTagListName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `cambió el nombre de la lista de etiquetas a "${newName}" (previamente "${oldName}")`, addTag: ({tagListName, tagName}: UpdatedPolicyTagParams) => `añadió la etiqueta "${tagName}" a la lista "${tagListName}"`, updateTagName: ({tagListName, newName, oldName}: UpdatedPolicyTagNameParams) => `actualizó la lista de etiquetas "${tagListName}" cambiando la etiqueta "${oldName}" a "${newName}"`, updateTagEnabled: ({tagListName, tagName, enabled}: UpdatedPolicyTagParams) => `${enabled ? 'habilitó' : 'deshabilitó'} la etiqueta "${tagName}" en la lista "${tagListName}"`, @@ -5217,10 +5285,40 @@ const translations = { } return `actualizó la etiqueta "${tagName}" en la lista "${tagListName}" añadiendo un ${updatedField} de "${newValue}"`; }, - addCustomUnitRate: ({customUnitName, rateName}: AddedPolicyCustomUnitRateParams) => `añadió una nueva tasa de "${rateName}" para "${customUnitName}"`, + updateCustomUnit: ({customUnitName, newValue, oldValue, updatedField}: UpdatePolicyCustomUnitParams) => + `cambió el ${customUnitName} ${updatedField} a "${newValue}" (previamente "${oldValue}")`, + updateCustomUnitTaxEnabled: ({newValue}: UpdatePolicyCustomUnitTaxEnabledParams) => `${newValue ? 'habilitó' : 'deshabilitó'} el seguimiento de impuestos en tasas de distancia`, + addCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `añadió una nueva tasa de "${rateName}" para "${customUnitName}"`, + updatedCustomUnitRate: ({customUnitName, customUnitRateName, newValue, oldValue, updatedField}: UpdatedPolicyCustomUnitRateParams) => + `cambió la tasa de ${customUnitName} ${updatedField} "${customUnitRateName}" a "${newValue}" (previamente "${oldValue}")`, + updatedCustomUnitTaxRateExternalID: ({customUnitRateName, newValue, newTaxPercentage, oldTaxPercentage, oldValue}: UpdatedPolicyCustomUnitTaxRateExternalIDParams) => { + if (oldTaxPercentage && oldValue) { + return `cambió la tasa de impuesto en la tasa por distancia "${customUnitRateName}" a "${newValue} (${newTaxPercentage})" (previamente "${oldValue} (${oldTaxPercentage})")`; + } + return `añadió la tasa de impuesto "${newValue} (${newTaxPercentage})" a la tasa de distancia "${customUnitRateName}"`; + }, + updatedCustomUnitTaxClaimablePercentage: ({customUnitRateName, newValue, oldValue}: UpdatedPolicyCustomUnitTaxClaimablePercentageParams) => { + if (oldValue) { + return `cambió la parte recuperable de impuestos en la tasa por distancia "${customUnitRateName}" a "${newValue}" (previamente "${oldValue}")`; + } + return `añadió una parte recuperable de impuestos de "${newValue}" a la tasa por distancia "${customUnitRateName}`; + }, + deleteCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `eliminó la tasa "${rateName}" de "${customUnitName}"`, addedReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `añadió el campo de informe ${fieldType} "${fieldName}"`, updateReportFieldDefaultValue: ({defaultValue, fieldName}: UpdatedPolicyReportFieldDefaultValueParams) => `estableció el valor predeterminado del campo de informe "${fieldName}" en "${defaultValue}"`, + addedReportFieldOption: ({fieldName, optionName}: PolicyAddedReportFieldOptionParams) => `añadió la opción "${optionName}" al campo de informe "${fieldName}"`, + removedReportFieldOption: ({fieldName, optionName}: PolicyAddedReportFieldOptionParams) => `eliminó la opción "${optionName}" del campo de informe "${fieldName}"`, + updateReportFieldOptionDisabled: ({fieldName, optionName, optionEnabled}: PolicyDisabledReportFieldOptionParams) => + `${optionEnabled ? 'habilitó' : 'deshabilitó'} la opción "${optionName}" para el campo de informe "${fieldName}"`, + updateReportFieldAllOptionsDisabled: ({fieldName, optionName, allEnabled, toggledOptionsCount}: PolicyDisabledReportFieldAllOptionsParams) => { + if (toggledOptionsCount && toggledOptionsCount > 1) { + return `${allEnabled ? 'habilitó' : 'deshabilitó'} todas las opciones para el campo de informe "${fieldName}"`; + } + return `${allEnabled ? 'habilitó' : 'deshabilitó'} la opción "${optionName}" para el campo de informe "${fieldName}", haciendo que todas las opciones queden ${ + allEnabled ? 'habilitadas' : 'deshabilitadas' + }`; + }, deleteReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `eliminó el campo de informe ${fieldType} "${fieldName}"`, preventSelfApproval: ({oldValue, newValue}: UpdatedPolicyPreventSelfApprovalParams) => `actualizó "Evitar la autoaprobación" a "${newValue === 'true' ? 'Habilitada' : 'Deshabilitada'}" (previamente "${oldValue === 'true' ? 'Habilitada' : 'Deshabilitada'}")`, @@ -5266,6 +5364,10 @@ const translations = { updateApprovalMode: ({newValue, oldValue}: ChangeFieldParams) => `actualizó el modo de aprobación a "${newValue}" (previamente "${oldValue}")`, upgradedWorkspace: 'mejoró este espacio de trabajo al plan Controlar', downgradedWorkspace: 'bajó de categoría este espacio de trabajo al plan Recopilar', + updatedAuditRate: ({oldAuditRate, newAuditRate}: UpdatedPolicyAuditRateParams) => + `cambió la tasa de informes enviados aleatoriamente para aprobación manual a ${Math.round(newAuditRate * 100)}% (previamente ${Math.round(oldAuditRate * 100)}%)`, + updatedManualApprovalThreshold: ({oldLimit, newLimit}: UpdatedPolicyManualApprovalThresholdParams) => + `cambió el límite de aprobación manual para todos los gastos a ${newLimit} (previamente ${oldLimit})`, }, roomMembersPage: { memberNotFound: 'Miembro no encontrado.', @@ -5613,6 +5715,7 @@ const translations = { leftWorkspace: ({nameOrEmail}: LeftWorkspaceParams) => `${nameOrEmail} salió del espacio de trabajo`, removeMember: ({email, role}: AddEmployeeParams) => `eliminado ${role} ${email}`, removedConnection: ({connectionName}: ConnectionNameParams) => `eliminó la conexión a ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName]}`, + addedConnection: ({connectionName}: ConnectionNameParams) => `se conectó a ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName]}`, leftTheChat: 'salió del chat', }, }, diff --git a/src/languages/params.ts b/src/languages/params.ts index b988af96101d0..baee33a478e8e 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -312,6 +312,14 @@ type UpdatedPolicyCurrencyParams = {oldCurrency: string; newCurrency: string}; type UpdatedPolicyCategoryParams = {categoryName: string; oldValue?: boolean}; +type UpdatedPolicyCategoryGLCodeParams = {categoryName: string; oldValue?: string; newValue?: string}; + +type UpdatedPolicyCategoryMaxExpenseAmountParams = {categoryName: string; oldAmount?: string; newAmount?: string}; + +type UpdatedPolicyCategoryExpenseLimitTypeParams = {categoryName: string; oldValue?: string; newValue: string}; + +type UpdatedPolicyCategoryMaxAmountNoReceiptParams = {categoryName: string; oldValue?: string; newValue: string}; + type UpdatedPolicyTagParams = {tagListName: string; tagName?: string; enabled?: boolean; count?: string}; type UpdatedPolicyTagNameParams = {oldName: string; newName: string; tagListName: string}; @@ -320,12 +328,32 @@ type UpdatedPolicyTagFieldParams = {oldValue?: string; newValue: string; tagName type UpdatedPolicyCategoryNameParams = {oldName: string; newName?: string}; -type AddedPolicyCustomUnitRateParams = {customUnitName: string; rateName: string}; +type UpdatePolicyCustomUnitTaxEnabledParams = {newValue: boolean}; + +type UpdatePolicyCustomUnitParams = {oldValue: string; newValue: string; customUnitName: string; updatedField: string}; + +type AddOrDeletePolicyCustomUnitRateParams = {customUnitName: string; rateName: string}; + +type UpdatedPolicyCustomUnitRateParams = {customUnitName: string; customUnitRateName: string; oldValue: string; newValue: string; updatedField: string}; + +type UpdatedPolicyCustomUnitTaxRateExternalIDParams = {customUnitRateName: string; newValue: string; newTaxPercentage: string; oldValue?: string; oldTaxPercentage?: string}; + +type UpdatedPolicyCustomUnitTaxClaimablePercentageParams = {customUnitRateName: string; newValue: number; oldValue?: number}; type AddedOrDeletedPolicyReportFieldParams = {fieldType: string; fieldName?: string}; type UpdatedPolicyReportFieldDefaultValueParams = {fieldName?: string; defaultValue?: string}; +type PolicyAddedReportFieldOptionParams = {fieldName?: string; optionName: string}; + +type PolicyDisabledReportFieldOptionParams = {fieldName: string; optionName: string; optionEnabled: boolean}; + +type PolicyDisabledReportFieldAllOptionsParams = {fieldName: string; optionName: string; allEnabled: boolean; toggledOptionsCount?: number}; + +type AddedPolicyApprovalRuleParams = {approverEmail: string; approverName: string; field: string; name: string}; + +type UpdatedPolicyApprovalRuleParams = {oldApproverEmail: string; oldApproverName?: string; newApproverEmail: string; newApproverName?: string; field: string; name: string}; + type UpdatedPolicyPreventSelfApprovalParams = {oldValue: string; newValue: string}; type UpdatedPolicyFieldWithNewAndOldValueParams = {oldValue: string; newValue: string}; @@ -334,6 +362,10 @@ type UpdatedPolicyFieldWithValueParam = {value: boolean}; type UpdatedPolicyFrequencyParams = {oldFrequency: string; newFrequency: string}; +type UpdatedPolicyAuditRateParams = {oldAuditRate: number; newAuditRate: number}; + +type UpdatedPolicyManualApprovalThresholdParams = {oldLimit: string; newLimit: string}; + type ChangeTypeParams = {oldType: string; newType: string}; type DelegateSubmitParams = {delegateUser: string; originalManager: string}; @@ -938,16 +970,32 @@ export type { WorkEmailMergingBlockedParams, NewWorkspaceNameParams, AddedOrDeletedPolicyReportFieldParams, - AddedPolicyCustomUnitRateParams, + UpdatedPolicyCustomUnitRateParams, + UpdatedPolicyCustomUnitTaxRateExternalIDParams, + UpdatedPolicyCustomUnitTaxClaimablePercentageParams, UpdatedPolicyTagParams, UpdatedPolicyTagNameParams, UpdatedPolicyTagFieldParams, UpdatedPolicyReportFieldDefaultValueParams, + PolicyAddedReportFieldOptionParams, + PolicyDisabledReportFieldOptionParams, + PolicyDisabledReportFieldAllOptionsParams, SubmitsToParams, SettlementDateParams, PolicyExpenseChatNameParams, YourPlanPriceValueParams, NeedCategoryForExportToIntegrationParams, + UpdatedPolicyAuditRateParams, + UpdatedPolicyManualApprovalThresholdParams, + UpdatePolicyCustomUnitTaxEnabledParams, + UpdatePolicyCustomUnitParams, + AddOrDeletePolicyCustomUnitRateParams, + AddedPolicyApprovalRuleParams, + UpdatedPolicyApprovalRuleParams, + UpdatedPolicyCategoryGLCodeParams, + UpdatedPolicyCategoryMaxExpenseAmountParams, + UpdatedPolicyCategoryExpenseLimitTypeParams, + UpdatedPolicyCategoryMaxAmountNoReceiptParams, SubscriptionSettingsSummaryParams, ReviewParams, CurrencyInputDisabledTextParams, diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index a2f3503d036db..4a4fb54adacab 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -19,7 +19,7 @@ import type {Message, OldDotReportAction, OriginalMessage, ReportActions} from ' import type ReportActionName from '@src/types/onyx/ReportActionName'; import type DeepValueOf from '@src/types/utils/DeepValueOf'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; -import {convertToDisplayString} from './CurrencyUtils'; +import {convertAmountToDisplayString, convertToDisplayString, convertToShortDisplayString} from './CurrencyUtils'; import DateUtils from './DateUtils'; import {getEnvironmentURL} from './Environment/Environment'; import getBase62ReportID from './getBase62ReportID'; @@ -35,7 +35,7 @@ import {getPolicy, isPolicyAdmin as isPolicyAdminPolicyUtils} from './PolicyUtil import type {getReportName, OptimisticIOUReportAction, PartialReportAction} from './ReportUtils'; import StringUtils from './StringUtils'; import {isOnHoldByTransactionID} from './TransactionUtils'; -import {getReportFieldAlternativeTextTranslationKey} from './WorkspaceReportFieldUtils'; +import {getReportFieldTypeTranslationKey} from './WorkspaceReportFieldUtils'; type LastVisibleMessage = { lastMessageText: string; @@ -2007,8 +2007,9 @@ function getWorkspaceFrequencyUpdateMessage(action: ReportAction): string { }); } -function getWorkspaceCategoryUpdateMessage(action: ReportAction): string { - const {categoryName, oldValue, newName, oldName} = getOriginalMessage(action as ReportAction) ?? {}; +function getWorkspaceCategoryUpdateMessage(action: ReportAction, policyID?: string): string { + const {categoryName, oldValue, newName, oldName, updatedField, newValue, currency} = + getOriginalMessage(action as ReportAction) ?? {}; if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_CATEGORY && categoryName) { return translateLocal('workspaceActions.addCategory', { @@ -2023,10 +2024,75 @@ function getWorkspaceCategoryUpdateMessage(action: ReportAction): string { } if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CATEGORY && categoryName) { - return translateLocal('workspaceActions.updateCategory', { - oldValue: !!oldValue, - categoryName, - }); + if (updatedField === 'enabled') { + return translateLocal('workspaceActions.updateCategory', { + oldValue: !!oldValue, + categoryName, + }); + } + + if (updatedField === 'areCommentsRequired' && typeof oldValue === 'boolean') { + return translateLocal('workspaceActions.updateAreCommentsRequired', { + oldValue, + categoryName, + }); + } + + if (updatedField === 'Payroll Code' && typeof oldValue === 'string' && typeof newValue === 'string') { + return translateLocal('workspaceActions.updateCategoryPayrollCode', { + oldValue, + categoryName, + newValue, + }); + } + + if (updatedField === 'GL Code' && typeof oldValue === 'string' && typeof newValue === 'string') { + return translateLocal('workspaceActions.updateCategoryGLCode', { + oldValue, + categoryName, + newValue, + }); + } + + if (updatedField === 'maxExpenseAmount' && (typeof oldValue === 'string' || typeof oldValue === 'number')) { + return translateLocal('workspaceActions.updateCategoryMaxExpenseAmount', { + oldAmount: Number(oldValue) ? convertAmountToDisplayString(Number(oldValue), currency) : undefined, + newAmount: Number(newValue ?? 0) ? convertAmountToDisplayString(Number(newValue), currency) : undefined, + categoryName, + }); + } + + if (updatedField === 'expenseLimitType' && typeof newValue === 'string' && typeof oldValue === 'string') { + return translateLocal('workspaceActions.updateCategoryExpenseLimitType', { + categoryName, + oldValue: oldValue ? translateLocal(`workspace.rules.categoryRules.expenseLimitTypes.${oldValue}` as TranslationPaths) : undefined, + newValue: translateLocal(`workspace.rules.categoryRules.expenseLimitTypes.${newValue}` as TranslationPaths), + }); + } + + if (updatedField === 'maxAmountNoReceipt' && typeof oldValue !== 'boolean' && typeof newValue !== 'boolean') { + const policy = getPolicy(policyID); + + const maxExpenseAmountToDisplay = policy?.maxExpenseAmountNoReceipt === CONST.DISABLED_MAX_EXPENSE_VALUE ? 0 : policy?.maxExpenseAmountNoReceipt; + + const formatAmount = () => convertToShortDisplayString(maxExpenseAmountToDisplay, policy?.outputCurrency ?? CONST.CURRENCY.USD); + const getTranslation = (value?: number | string) => { + if (value === CONST.DISABLED_MAX_EXPENSE_VALUE) { + return translateLocal('workspace.rules.categoryRules.requireReceiptsOverList.never'); + } + if (value === 0) { + return translateLocal('workspace.rules.categoryRules.requireReceiptsOverList.always'); + } + + return translateLocal('workspace.rules.categoryRules.requireReceiptsOverList.default', {defaultAmount: formatAmount()}); + }; + + return translateLocal('workspaceActions.updateCategoryMaxAmountNoReceipt', { + categoryName, + oldValue: getTranslation(oldValue), + newValue: getTranslation(newValue), + }); + } } if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.SET_CATEGORY_NAME && oldName && newName) { @@ -2083,7 +2149,7 @@ function getWorkspaceTagUpdateMessage(action: ReportAction): string { if ( action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_TAG && tagListName && - typeof oldValue === 'string' && + (typeof oldValue === 'string' || typeof oldValue === 'undefined') && typeof newValue === 'string' && tagName && updatedField @@ -2100,6 +2166,38 @@ function getWorkspaceTagUpdateMessage(action: ReportAction): string { return getReportActionText(action); } +function getTagListNameUpdatedMessage(action: ReportAction): string { + const {oldName, newName} = getOriginalMessage(action as ReportAction) ?? {}; + if (newName && oldName) { + return translateLocal('workspaceActions.updateTagListName', { + oldName, + newName, + }); + } + return getReportActionText(action); +} + +function getWorkspaceCustomUnitUpdatedMessage(action: ReportAction): string { + const {oldValue, newValue, customUnitName, updatedField} = getOriginalMessage(action as ReportAction) ?? {}; + + if (customUnitName === 'Distance' && updatedField === 'taxEnabled' && typeof newValue === 'boolean') { + return translateLocal('workspaceActions.updateCustomUnitTaxEnabled', { + newValue, + }); + } + + if (customUnitName && typeof oldValue === 'string' && typeof newValue === 'string' && updatedField) { + return translateLocal('workspaceActions.updateCustomUnit', { + customUnitName, + newValue, + oldValue, + updatedField, + }); + } + + return getReportActionText(action); +} + function getWorkspaceCustomUnitRateAddedMessage(action: ReportAction): string { const {customUnitName, rateName} = getOriginalMessage(action as ReportAction) ?? {}; @@ -2113,13 +2211,60 @@ function getWorkspaceCustomUnitRateAddedMessage(action: ReportAction): string { return getReportActionText(action); } +function getWorkspaceCustomUnitRateUpdatedMessage(action: ReportAction): string { + const {customUnitName, customUnitRateName, updatedField, oldValue, newValue, newTaxPercentage, oldTaxPercentage} = + getOriginalMessage(action as ReportAction) ?? {}; + + if (customUnitName && customUnitRateName && updatedField === 'rate' && typeof oldValue === 'string' && typeof newValue === 'string') { + return translateLocal('workspaceActions.updatedCustomUnitRate', { + customUnitName, + customUnitRateName, + updatedField, + oldValue, + newValue, + }); + } + + if (customUnitRateName && updatedField === 'taxRateExternalID' && typeof newValue === 'string' && newTaxPercentage) { + return translateLocal('workspaceActions.updatedCustomUnitTaxRateExternalID', { + customUnitRateName, + newValue, + newTaxPercentage, + oldTaxPercentage, + oldValue: oldValue as string | undefined, + }); + } + + if (customUnitRateName && updatedField === 'taxClaimablePercentage' && typeof newValue === 'number' && customUnitRateName) { + return translateLocal('workspaceActions.updatedCustomUnitTaxClaimablePercentage', { + customUnitRateName, + newValue: parseFloat(parseFloat(newValue ?? 0).toFixed(2)), + oldValue: typeof oldValue === 'number' ? parseFloat(parseFloat(oldValue ?? 0).toFixed(2)) : undefined, + }); + } + + return getReportActionText(action); +} + +function getWorkspaceCustomUnitRateDeletedMessage(action: ReportAction): string { + const {customUnitName, rateName} = getOriginalMessage(action as ReportAction) ?? {}; + if (customUnitName && rateName) { + return translateLocal('workspaceActions.deleteCustomUnitRate', { + customUnitName, + rateName, + }); + } + + return getReportActionText(action); +} + function getWorkspaceReportFieldAddMessage(action: ReportAction): string { const {fieldName, fieldType} = getOriginalMessage(action as ReportAction) ?? {}; if (fieldName && fieldType) { return translateLocal('workspaceActions.addedReportField', { fieldName, - fieldType: translateLocal(getReportFieldAlternativeTextTranslationKey(fieldType as PolicyReportFieldType)), + fieldType: translateLocal(getReportFieldTypeTranslationKey(fieldType as PolicyReportFieldType)).toLowerCase(), }); } @@ -2127,7 +2272,8 @@ function getWorkspaceReportFieldAddMessage(action: ReportAction): string { } function getWorkspaceReportFieldUpdateMessage(action: ReportAction): string { - const {updateType, fieldName, defaultValue} = getOriginalMessage(action as ReportAction) ?? {}; + const {updateType, fieldName, defaultValue, optionName, allEnabled, optionEnabled, toggledOptionsCount} = + getOriginalMessage(action as ReportAction) ?? {}; if (updateType === 'updatedDefaultValue' && fieldName && defaultValue) { return translateLocal('workspaceActions.updateReportFieldDefaultValue', { @@ -2136,6 +2282,37 @@ function getWorkspaceReportFieldUpdateMessage(action: ReportAction): string { }); } + if (updateType === 'addedOption' && fieldName && optionName) { + return translateLocal('workspaceActions.addedReportFieldOption', { + fieldName, + optionName, + }); + } + + if (updateType === 'changedOptionDisabled' && fieldName && optionName) { + return translateLocal('workspaceActions.updateReportFieldOptionDisabled', { + fieldName, + optionName, + optionEnabled: !!optionEnabled, + }); + } + + if (updateType === 'updatedAllDisabled' && fieldName && optionName) { + return translateLocal('workspaceActions.updateReportFieldAllOptionsDisabled', { + fieldName, + optionName, + allEnabled: !!allEnabled, + toggledOptionsCount, + }); + } + + if (updateType === 'removedOption' && fieldName && optionName) { + return translateLocal('workspaceActions.removedReportFieldOption', { + fieldName, + optionName, + }); + } + return getReportActionText(action); } @@ -2145,7 +2322,7 @@ function getWorkspaceReportFieldDeleteMessage(action: ReportAction): string { if (fieldType && fieldName) { return translateLocal('workspaceActions.deleteReportField', { fieldName, - fieldType: translateLocal(getReportFieldAlternativeTextTranslationKey(fieldType as PolicyReportFieldType)), + fieldType: translateLocal(getReportFieldTypeTranslationKey(fieldType as PolicyReportFieldType)).toLowerCase(), }); } @@ -2268,6 +2445,15 @@ function getPolicyChangeLogDeleteMemberMessage(reportAction: OnyxInputOrEntry): string { + if (!isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_INTEGRATION)) { + return ''; + } + const originalMessage = getOriginalMessage(reportAction); + const connectionName = originalMessage?.connectionName; + return connectionName ? translateLocal('report.actions.type.addedConnection', {connectionName}) : ''; +} + function getRemovedConnectionMessage(reportAction: OnyxEntry): string { if (!isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_INTEGRATION)) { return ''; @@ -2287,6 +2473,55 @@ function getRenamedAction(reportAction: OnyxEntry) { + const {name, approverAccountID, approverEmail, field, approverName} = + getOriginalMessage(reportAction as ReportAction) ?? {}; + + if (name && approverAccountID && approverEmail && field && approverName) { + return translateLocal('workspaceActions.addApprovalRule', { + approverEmail, + approverName, + field, + name, + }); + } + + return getReportActionText(reportAction); +} + +function getDeletedApprovaRulelMessage(reportAction: OnyxEntry) { + const {name, approverAccountID, approverEmail, field, approverName} = + getOriginalMessage(reportAction as ReportAction) ?? {}; + + if (name && approverAccountID && approverEmail && field && approverName) { + return translateLocal('workspaceActions.deleteApprovalRule', { + approverEmail, + approverName, + field, + name, + }); + } + + return getReportActionText(reportAction); +} + +function getUpdatedApprovalRuleMessage(reportAction: OnyxEntry) { + const {field, oldApproverEmail, oldApproverName, newApproverEmail, newApproverName, name} = + getOriginalMessage(reportAction as ReportAction) ?? {}; + + if (field && oldApproverEmail && newApproverEmail && name) { + return translateLocal('workspaceActions.updateApprovalRule', { + field, + name, + newApproverEmail, + newApproverName, + oldApproverEmail, + oldApproverName, + }); + } + return getReportActionText(reportAction); +} + function getRemovedFromApprovalChainMessage(reportAction: OnyxEntry>) { const originalMessage = getOriginalMessage(reportAction); const submittersNames = getPersonalDetailsByIDs({ @@ -2303,6 +2538,28 @@ function getDemotedFromWorkspaceMessage(reportAction: OnyxEntry) { + const {oldAuditRate, newAuditRate} = getOriginalMessage(reportAction as ReportAction) ?? {}; + + if (typeof oldAuditRate !== 'number' || typeof newAuditRate !== 'number') { + return getReportActionText(reportAction); + } + return translateLocal('workspaceActions.updatedAuditRate', {oldAuditRate, newAuditRate}); +} + +function getUpdatedManualApprovalThresholdMessage(reportAction: OnyxEntry) { + const { + oldLimit, + newLimit, + currency = CONST.CURRENCY.USD, + } = getOriginalMessage(reportAction as ReportAction) ?? {}; + + if (typeof oldLimit !== 'number' || typeof oldLimit !== 'number') { + return getReportActionText(reportAction); + } + return translateLocal('workspaceActions.updatedManualApprovalThreshold', {oldLimit: convertToDisplayString(oldLimit, currency), newLimit: convertToDisplayString(newLimit, currency)}); +} + function isCardIssuedAction(reportAction: OnyxEntry) { return isActionOfType( reportAction, @@ -2464,6 +2721,9 @@ export { getNumberOfMoneyRequests, getOneTransactionThreadReportID, getOriginalMessage, + getAddedApprovaRulelMessage, + getDeletedApprovaRulelMessage, + getUpdatedApprovalRuleMessage, getRemovedFromApprovalChainMessage, getDemotedFromWorkspaceMessage, getReportAction, @@ -2580,6 +2840,13 @@ export { getWorkspaceTagUpdateMessage, getWorkspaceReportFieldUpdateMessage, getWorkspaceReportFieldDeleteMessage, + getUpdatedAuditRateMessage, + getUpdatedManualApprovalThresholdMessage, + getWorkspaceCustomUnitRateDeletedMessage, + getAddedConnectionMessage, + getWorkspaceCustomUnitRateUpdatedMessage, + getTagListNameUpdatedMessage, + getWorkspaceCustomUnitUpdatedMessage, getReportActions, getReopenedMessage, getLeaveRoomMessage, diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 936851e731fa8..d8dded0b9bcee 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -25,7 +25,10 @@ import Parser from './Parser'; import Performance from './Performance'; import {getCleanedTagName, getPolicy} from './PolicyUtils'; import { + getAddedApprovaRulelMessage, + getAddedConnectionMessage, getCardIssuedMessage, + getDeletedApprovaRulelMessage, getIntegrationSyncFailedMessage, getLastVisibleMessage, getMessageOfOldDotReportAction, @@ -46,9 +49,17 @@ import { getReportActionMessageText, getRetractedMessage, getSortedReportActions, + getTagListNameUpdatedMessage, + getUpdatedApprovalRuleMessage, + getUpdatedAuditRateMessage, + getUpdatedManualApprovalThresholdMessage, + getUpdateRoomDescriptionMessage, getWorkspaceCategoryUpdateMessage, getWorkspaceCurrencyUpdateMessage, getWorkspaceCustomUnitRateAddedMessage, + getWorkspaceCustomUnitRateDeletedMessage, + getWorkspaceCustomUnitRateUpdatedMessage, + getWorkspaceCustomUnitUpdatedMessage, getWorkspaceDescriptionUpdatedMessage, getWorkspaceFrequencyUpdateMessage, getWorkspaceReportFieldAddMessage, @@ -620,10 +631,18 @@ function getOptionData({ isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.SET_CATEGORY_NAME) ) { result.alternateText = getWorkspaceCategoryUpdateMessage(lastAction); + } else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_TAG_LIST_NAME)) { + result.alternateText = getCleanedTagName(getTagListNameUpdatedMessage(lastAction) ?? ''); } else if (isTagModificationAction(lastAction?.actionName)) { result.alternateText = getCleanedTagName(getWorkspaceTagUpdateMessage(lastAction) ?? ''); + } else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_UNIT)) { + result.alternateText = getWorkspaceCustomUnitUpdatedMessage(lastAction); } else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_CUSTOM_UNIT_RATE)) { result.alternateText = getWorkspaceCustomUnitRateAddedMessage(lastAction); + } else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_UNIT_RATE)) { + result.alternateText = getWorkspaceCustomUnitRateUpdatedMessage(lastAction); + } else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_CUSTOM_UNIT_RATE)) { + result.alternateText = getWorkspaceCustomUnitRateDeletedMessage(lastAction); } else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_REPORT_FIELD)) { result.alternateText = getWorkspaceReportFieldAddMessage(lastAction); } else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_REPORT_FIELD)) { @@ -649,6 +668,8 @@ function getOptionData({ result.alternateText = formatReportLastMessageText(Parser.htmlToText(`${lastActorDisplayName}: ${lastMessageText}`)); } else if (lastAction && isOldDotReportAction(lastAction)) { result.alternateText = getMessageOfOldDotReportAction(lastAction); + } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.ROOM_CHANGE_LOG.UPDATE_ROOM_DESCRIPTION) { + result.alternateText = getUpdateRoomDescriptionMessage(lastAction); } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_EMPLOYEE) { result.alternateText = getPolicyChangeLogAddEmployeeMessage(lastAction); } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_EMPLOYEE) { @@ -657,8 +678,20 @@ function getOptionData({ result.alternateText = getPolicyChangeLogDeleteMemberMessage(lastAction); } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_CUSTOM_UNIT_RATE) { result.alternateText = getReportActionMessageText(lastAction) ?? ''; + } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_INTEGRATION) { + result.alternateText = getAddedConnectionMessage(lastAction); } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_INTEGRATION) { result.alternateText = getRemovedConnectionMessage(lastAction); + } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUDIT_RATE) { + result.alternateText = getUpdatedAuditRateMessage(lastAction); + } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_APPROVER_RULE) { + result.alternateText = getAddedApprovaRulelMessage(lastAction); + } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_APPROVER_RULE) { + result.alternateText = getDeletedApprovaRulelMessage(lastAction); + } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_APPROVER_RULE) { + result.alternateText = getUpdatedApprovalRuleMessage(lastAction); + } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_MANUAL_APPROVAL_THRESHOLD) { + result.alternateText = getUpdatedManualApprovalThresholdMessage(lastAction); } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.RETRACTED) { result.alternateText = getRetractedMessage(); } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REOPENED) { diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx index 0d1aa64237527..fbb4212fe8ee9 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx @@ -23,7 +23,10 @@ import {getCleanedTagName} from '@libs/PolicyUtils'; import ReportActionComposeFocusManager from '@libs/ReportActionComposeFocusManager'; import { getActionableMentionWhisperMessage, + getAddedApprovaRulelMessage, + getAddedConnectionMessage, getCardIssuedMessage, + getDeletedApprovaRulelMessage, getExportIntegrationMessageHTML, getIntegrationSyncFailedMessage, getIOUReportIDFromReportActionPreview, @@ -42,10 +45,17 @@ import { getRenamedAction, getReopenedMessage, getReportActionMessageText, + getTagListNameUpdatedMessage, + getUpdatedApprovalRuleMessage, + getUpdatedAuditRateMessage, + getUpdatedManualApprovalThresholdMessage, getUpdateRoomDescriptionMessage, getWorkspaceCategoryUpdateMessage, getWorkspaceCurrencyUpdateMessage, getWorkspaceCustomUnitRateAddedMessage, + getWorkspaceCustomUnitRateDeletedMessage, + getWorkspaceCustomUnitRateUpdatedMessage, + getWorkspaceCustomUnitUpdatedMessage, getWorkspaceDescriptionUpdatedMessage, getWorkspaceFrequencyUpdateMessage, getWorkspaceReportFieldAddMessage, @@ -525,10 +535,18 @@ const ContextMenuActions: ContextMenuAction[] = [ reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.SET_CATEGORY_NAME ) { Clipboard.setString(getWorkspaceCategoryUpdateMessage(reportAction)); + } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_TAG_LIST_NAME) { + Clipboard.setString(getCleanedTagName(getTagListNameUpdatedMessage(reportAction))); } else if (isTagModificationAction(reportAction.actionName)) { Clipboard.setString(getCleanedTagName(getWorkspaceTagUpdateMessage(reportAction))); + } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_UNIT) { + Clipboard.setString(getWorkspaceCustomUnitUpdatedMessage(reportAction)); } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_CUSTOM_UNIT_RATE) { Clipboard.setString(getWorkspaceCustomUnitRateAddedMessage(reportAction)); + } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_UNIT_RATE) { + Clipboard.setString(getWorkspaceCustomUnitRateUpdatedMessage(reportAction)); + } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_CUSTOM_UNIT_RATE) { + Clipboard.setString(getWorkspaceCustomUnitRateDeletedMessage(reportAction)); } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_REPORT_FIELD) { Clipboard.setString(getWorkspaceReportFieldAddMessage(reportAction)); } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_REPORT_FIELD) { @@ -624,8 +642,20 @@ const ContextMenuActions: ContextMenuAction[] = [ setClipboardMessage(getIntegrationSyncFailedMessage(reportAction)); } else if (isCardIssuedAction(reportAction)) { setClipboardMessage(getCardIssuedMessage({reportAction, shouldRenderHTML: true, policyID: report?.policyID, card})); + } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_INTEGRATION)) { + setClipboardMessage(getAddedConnectionMessage(reportAction)); } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_INTEGRATION)) { setClipboardMessage(getRemovedConnectionMessage(reportAction)); + } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUDIT_RATE)) { + setClipboardMessage(getUpdatedAuditRateMessage(reportAction)); + } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_APPROVER_RULE)) { + setClipboardMessage(getAddedApprovaRulelMessage(reportAction)); + } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_APPROVER_RULE)) { + setClipboardMessage(getDeletedApprovaRulelMessage(reportAction)); + } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_APPROVER_RULE)) { + setClipboardMessage(getUpdatedApprovalRuleMessage(reportAction)); + } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_MANUAL_APPROVAL_THRESHOLD)) { + setClipboardMessage(getUpdatedManualApprovalThresholdMessage(reportAction)); } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.CHANGE_POLICY) { const displayMessage = getPolicyChangeMessage(reportAction); Clipboard.setString(displayMessage); diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx index 38b13aeb3e37a..bd89e04e6122e 100644 --- a/src/pages/home/report/PureReportActionItem.tsx +++ b/src/pages/home/report/PureReportActionItem.tsx @@ -58,6 +58,9 @@ import {getDisplayNameOrDefault} from '@libs/PersonalDetailsUtils'; import {getCleanedTagName} from '@libs/PolicyUtils'; import { extractLinksFromMessageHtml, + getAddedApprovaRulelMessage, + getAddedConnectionMessage, + getDeletedApprovaRulelMessage, getDemotedFromWorkspaceMessage, getDismissedViolationMessageText, getIntegrationSyncFailedMessage, @@ -77,10 +80,17 @@ import { getReopenedMessage, getReportActionMessage, getReportActionText, + getTagListNameUpdatedMessage, + getUpdatedApprovalRuleMessage, + getUpdatedAuditRateMessage, + getUpdatedManualApprovalThresholdMessage, getWhisperedTo, getWorkspaceCategoryUpdateMessage, getWorkspaceCurrencyUpdateMessage, getWorkspaceCustomUnitRateAddedMessage, + getWorkspaceCustomUnitRateDeletedMessage, + getWorkspaceCustomUnitRateUpdatedMessage, + getWorkspaceCustomUnitUpdatedMessage, getWorkspaceFrequencyUpdateMessage, getWorkspaceReportFieldAddMessage, getWorkspaceReportFieldDeleteMessage, @@ -1068,11 +1078,19 @@ function PureReportActionItem({ action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CATEGORY || action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.SET_CATEGORY_NAME ) { - children = ; + children = ; + } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_TAG_LIST_NAME) { + children = ; } else if (isTagModificationAction(action.actionName)) { children = ; + } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_UNIT) { + children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_CUSTOM_UNIT_RATE) { children = ; + } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_UNIT_RATE) { + children = ; + } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_CUSTOM_UNIT_RATE) { + children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_REPORT_FIELD) { children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_REPORT_FIELD) { @@ -1095,6 +1113,12 @@ function PureReportActionItem({ children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_EMPLOYEE) { children = ; + } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_APPROVER_RULE)) { + children = ; + } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_APPROVER_RULE)) { + children = ; + } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_APPROVER_RULE)) { + children = ; } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.REMOVED_FROM_APPROVAL_CHAIN)) { children = ; } else if (isActionableJoinRequest(action)) { @@ -1134,8 +1158,14 @@ function PureReportActionItem({ children = ; } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.INTEGRATION_SYNC_FAILED)) { children = ; + } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_INTEGRATION)) { + children = ; } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_INTEGRATION)) { children = ; + } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUDIT_RATE)) { + children = ; + } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_MANUAL_APPROVAL_THRESHOLD)) { + children = ; } else { const hasBeenFlagged = ![CONST.MODERATION.MODERATOR_DECISION_APPROVED, CONST.MODERATION.MODERATOR_DECISION_PENDING].some((item) => item === moderationDecision) && !isPendingRemove(action); diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index 003718ea51926..585a60fa78de8 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -370,9 +370,18 @@ type OriginalMessagePolicyChangeLog = { /** Custom unit name */ customUnitName?: string; + /** Rate name of the custom unit */ + customUnitRateName?: string; + /** Custom unit name */ rateName?: string; + /** Tax percentage of the new tax rate linked to distance rate */ + newTaxPercentage?: string; + + /** Tax percentage of the old tax rate linked to distance rate */ + oldTaxPercentage?: string; + /** Added/Updated tag name */ tagName?: string; @@ -399,6 +408,54 @@ type OriginalMessagePolicyChangeLog = { /** Old role of user or old value of the category/tag field */ oldValue?: boolean | string; + + /** Old approval audit rate */ + oldAuditRate?: number; + + /** New approval audit rate */ + newAuditRate?: number; + + /** Old limit of manual approval threshold */ + oldLimit?: number; + + /** New limit of manual approval threshold */ + newLimit?: number; + + /** Name for the field of which approver has been updated */ + name?: string; + + /** Account ID of the approver */ + approverAccountID?: string; + + /** Email of the new approver */ + newApproverEmail?: string; + + /** Name of the new approver */ + newApproverName?: string; + + /** Email of the old approver */ + oldApproverEmail?: string; + + /** Name of the old approver */ + oldApproverName?: string; + + /** Email of the approver */ + approverEmail?: string; + + /** Name of the approver */ + approverName?: string; + + /** Option name of a list report field */ + optionName?: string; + + /** Option enabled state of a list report field */ + optionEnabled?: string; + + /** Number of report field options updated */ + toggledOptionsCount?: number; + + /** Are all allEnabled report field options enabled */ + allEnabled?: string; }; /** Model of `join policy` report action */