Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1676,6 +1676,9 @@ const CONST = {
ADD_EMPLOYEE: 'POLICYCHANGELOG_ADD_EMPLOYEE',
ADD_CARD_FEED: 'POLICYCHANGELOG_ADD_CARD_FEED',
ADD_EXPENSIFY_CARD_RULE: 'POLICYCHANGELOG_ADD_EXPENSIFY_CARD_RULE',
ADD_AGENT_RULE: 'POLICYCHANGELOG_ADD_AGENT_RULE',
UPDATE_AGENT_RULE: 'POLICYCHANGELOG_UPDATE_AGENT_RULE',
DELETE_AGENT_RULE: 'POLICYCHANGELOG_DELETE_AGENT_RULE',
ADD_INTEGRATION: 'POLICYCHANGELOG_ADD_INTEGRATION',
ADD_REPORT_FIELD: 'POLICYCHANGELOG_ADD_REPORT_FIELD',
ADD_TAG: 'POLICYCHANGELOG_ADD_TAG',
Expand Down
6 changes: 6 additions & 0 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8679,6 +8679,12 @@ Fügen Sie weitere Ausgabelimits hinzu, um den Cashflow Ihres Unternehmens zu sc
updatedMccGroupCategory: ({mccGroupName, oldCategory, newCategory}: {mccGroupName: string; oldCategory: string; newCategory: string}) =>
`hat die Standardausgabenkategorie für „${mccGroupName}“ in „${newCategory}“ geändert (zuvor „${oldCategory}“)`,
updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? 'aktiviert' : 'deaktiviert'} die Anforderung für Firmenkartenkäufe`,
agentRule: {
added: ({title, prompt}: {title: string; prompt: string}) => (title ? `hat die Agentenregel „${title}“ hinzugefügt: ${prompt}` : `hat eine Agentenregel hinzugefügt: ${prompt}`),
updated: ({title, prompt}: {title: string; prompt: string}) =>
title ? `hat die Agentenregel „${title}“ aktualisiert zu: ${prompt}` : `hat eine Agentenregel aktualisiert zu: ${prompt}`,
deleted: ({title}: {title: string}) => (title ? `hat die Agentenregel „${title}“ entfernt` : 'hat eine Agentenregel entfernt'),
},
expensifyCardRule: {
actionVerb: {block: 'blockiert', allow: 'erlaubt'},
amountOperator: {over: 'über', under: 'unter'},
Expand Down
5 changes: 5 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8466,6 +8466,11 @@ const translations = {
updatedCardFeedLiability: (feedName: string, enabled: boolean) => `${enabled ? 'enabled' : 'disabled'} cardholders to delete card transactions for card feed "${feedName}"`,
updatedCardFeedStatementPeriod: (feedName: string, newValue?: string, previousValue?: string) =>
`changed card feed "${feedName}" statement period end day${newValue ? ` to "${newValue}"` : ''}${previousValue ? ` (previously "${previousValue}")` : ''}`,
agentRule: {
added: ({title, prompt}: {title: string; prompt: string}) => (title ? `added the agent rule "${title}": ${prompt}` : `added an agent rule: ${prompt}`),
updated: ({title, prompt}: {title: string; prompt: string}) => (title ? `updated the agent rule "${title}" to: ${prompt}` : `updated an agent rule to: ${prompt}`),
deleted: ({title}: {title: string}) => (title ? `removed the agent rule "${title}"` : 'removed an agent rule'),
},
expensifyCardRule: {
actionVerb: {
block: 'blocked',
Expand Down
5 changes: 5 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8159,6 +8159,11 @@ El plan Controlar empieza en 9 $ por miembro activo al mes.`,
`${enabled ? 'habilitó' : 'deshabilitó'} que los titulares de tarjetas eliminen transacciones de la fuente de tarjetas "${feedName}"`,
updatedCardFeedStatementPeriod: (feedName: string, newValue?: string, previousValue?: string) =>
`cambió el día de cierre del período de estado de cuenta de la fuente de tarjetas "${feedName}"${newValue ? ` a "${newValue}"` : ''}${previousValue ? ` (previamente "${previousValue}")` : ''}`,
agentRule: {
added: ({title, prompt}: {title: string; prompt: string}) => (title ? `añadió la regla de agente «${title}»: ${prompt}` : `añadió una regla de agente: ${prompt}`),
updated: ({title, prompt}: {title: string; prompt: string}) => (title ? `actualizó la regla de agente «${title}» a: ${prompt}` : `actualizó una regla de agente a: ${prompt}`),
deleted: ({title}: {title: string}) => (title ? `eliminó la regla de agente «${title}»` : 'eliminó una regla de agente'),
},
expensifyCardRule: {
actionVerb: {block: 'bloqueado', allow: 'permitido'},
amountOperator: {over: 'más de', under: 'debajo'},
Expand Down
6 changes: 6 additions & 0 deletions src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8713,6 +8713,12 @@ Ajoutez davantage de règles de dépenses pour protéger la trésorerie de l’e
updatedMccGroupCategory: ({mccGroupName, oldCategory, newCategory}: {mccGroupName: string; oldCategory: string; newCategory: string}) =>
`a modifié la catégorie de dépense par défaut pour « ${mccGroupName} » en « ${newCategory} » (auparavant « ${oldCategory} »)`,
updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? 'activé' : 'désactivé'} l’exigence d’achats par carte d’entreprise`,
agentRule: {
added: ({title, prompt}: {title: string; prompt: string}) => (title ? `a ajouté la règle d’agent « ${title} » : ${prompt}` : `a ajouté une règle d’agent : ${prompt}`),
updated: ({title, prompt}: {title: string; prompt: string}) =>
title ? `a mis à jour la règle d’agent « ${title} » en : ${prompt}` : `a mis à jour une règle d’agent en : ${prompt}`,
deleted: ({title}: {title: string}) => (title ? `a supprimé la règle d’agent « ${title} »` : 'a supprimé une règle d’agent'),
},
expensifyCardRule: {
actionVerb: {block: 'bloqué', allow: 'autorisé'},
amountOperator: {over: 'terminé', under: 'sous'},
Expand Down
7 changes: 7 additions & 0 deletions src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8652,6 +8652,13 @@ Aggiungi altre regole di spesa per proteggere il flusso di cassa aziendale.`,
updatedMccGroupCategory: ({mccGroupName, oldCategory, newCategory}: {mccGroupName: string; oldCategory: string; newCategory: string}) =>
`ha modificato la categoria di spesa predefinita per "${mccGroupName}" in "${newCategory}" (precedentemente "${oldCategory}")`,
updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? 'abilitato' : 'disabilitato'} il requisito per gli acquisti con carta aziendale`,
agentRule: {
added: ({title, prompt}: {title: string; prompt: string}) =>
title ? `ha aggiunto la regola dell’agente "${title}": ${prompt}` : `ha aggiunto una regola dell’agente: ${prompt}`,
updated: ({title, prompt}: {title: string; prompt: string}) =>
title ? `ha aggiornato la regola dell’agente "${title}" in: ${prompt}` : `ha aggiornato una regola dell’agente in: ${prompt}`,
deleted: ({title}: {title: string}) => (title ? `ha rimosso la regola dell’agente "${title}"` : 'ha rimosso una regola dell’agente'),
},
expensifyCardRule: {
actionVerb: {block: 'bloccato', allow: 'consentito'},
amountOperator: {over: 'terminato', under: 'sotto'},
Expand Down
6 changes: 6 additions & 0 deletions src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8541,6 +8541,12 @@ ${reportName}`,
updatedMccGroupCategory: ({mccGroupName, oldCategory, newCategory}: {mccGroupName: string; oldCategory: string; newCategory: string}) =>
`「${mccGroupName}」のデフォルト支出カテゴリーを「${newCategory}」に変更しました(以前は「${oldCategory}」)`,
updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? '有効' : '無効'} の法人カード購入要件`,
agentRule: {
added: ({title, prompt}: {title: string; prompt: string}) => (title ? `エージェントルール「${title}」を追加しました:${prompt}` : `エージェントルールを追加しました:${prompt}`),
updated: ({title, prompt}: {title: string; prompt: string}) =>
title ? `エージェントルール「${title}」を次の内容に更新しました:${prompt}` : `エージェントルールを次の内容に更新しました:${prompt}`,
deleted: ({title}: {title: string}) => (title ? `エージェントルール「${title}」を削除しました` : 'エージェントルールを削除しました'),
},
expensifyCardRule: {
actionVerb: {block: 'ブロック済み', allow: '許可済み'},
amountOperator: {
Expand Down
6 changes: 6 additions & 0 deletions src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8626,6 +8626,12 @@ er bestedingsregels toe om de kasstroom van het bedrijf te beschermen.`,
updatedMccGroupCategory: ({mccGroupName, oldCategory, newCategory}: {mccGroupName: string; oldCategory: string; newCategory: string}) =>
`heeft de standaarduitgavencategorie voor ‘${mccGroupName}’ gewijzigd in ‘${newCategory}’ (voorheen ‘${oldCategory}’)`,
updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `vereiste ${enabled ? 'ingeschakeld' : 'uitgeschakeld'} voor bedrijfskaarttransacties`,
agentRule: {
added: ({title, prompt}: {title: string; prompt: string}) => (title ? `heeft de agentregel ‘${title}’ toegevoegd: ${prompt}` : `heeft een agentregel toegevoegd: ${prompt}`),
updated: ({title, prompt}: {title: string; prompt: string}) =>
title ? `heeft de agentregel ‘${title}’ bijgewerkt naar: ${prompt}` : `heeft een agentregel bijgewerkt naar: ${prompt}`,
deleted: ({title}: {title: string}) => (title ? `heeft de agentregel ‘${title}’ verwijderd` : 'heeft een agentregel verwijderd'),
},
expensifyCardRule: {
actionVerb: {block: 'geblokkeerd', allow: 'toegestaan'},
amountOperator: {over: 'over', under: 'onder'},
Expand Down
5 changes: 5 additions & 0 deletions src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8606,6 +8606,11 @@ Dodaj więcej zasad wydatków, żeby chronić płynność finansową firmy.`,
updatedMccGroupCategory: ({mccGroupName, oldCategory, newCategory}: {mccGroupName: string; oldCategory: string; newCategory: string}) =>
`zmieniono domyślną kategorię wydatków dla „${mccGroupName}” na „${newCategory}” (poprzednio „${oldCategory}”)`,
updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? 'włączone' : 'wyłączone'} wymóg dotyczący zakupów kartą służbową`,
agentRule: {
added: ({title, prompt}: {title: string; prompt: string}) => (title ? `dodał(a) regułę agenta „${title}”: ${prompt}` : `dodano regułę agenta: ${prompt}`),
updated: ({title, prompt}: {title: string; prompt: string}) => (title ? `zaktualizował(a) regułę agenta „${title}” na: ${prompt}` : `zaktualizowano regułę agenta na: ${prompt}`),
deleted: ({title}: {title: string}) => (title ? `usunął(-ęła) regułę agenta „${title}”` : 'usunięto regułę agenta'),
},
expensifyCardRule: {
actionVerb: {block: 'zablokowane', allow: 'dozwolone'},
amountOperator: {over: 'ponad', under: 'pod'},
Expand Down
6 changes: 6 additions & 0 deletions src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8618,6 +8618,12 @@ Adicione mais regras de gasto para proteger o fluxo de caixa da empresa.`,
updatedMccGroupCategory: ({mccGroupName, oldCategory, newCategory}: {mccGroupName: string; oldCategory: string; newCategory: string}) =>
`alterou a categoria de gasto padrão de "${mccGroupName}" para "${newCategory}" (antes "${oldCategory}")`,
updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? 'ativado' : 'desativado'} o requisito de compras com cartão corporativo`,
agentRule: {
added: ({title, prompt}: {title: string; prompt: string}) => (title ? `adicionou a regra de agente "${title}": ${prompt}` : `adicionou uma regra de agente: ${prompt}`),
updated: ({title, prompt}: {title: string; prompt: string}) =>
title ? `atualizou a regra do agente "${title}" para: ${prompt}` : `atualizou uma regra de agente para: ${prompt}`,
deleted: ({title}: {title: string}) => (title ? `removeu a regra de agente "${title}"` : 'removeu uma regra de agente'),
},
expensifyCardRule: {
actionVerb: {block: 'bloqueado', allow: 'permitido'},
amountOperator: {over: 'acima', under: 'abaixo'},
Expand Down
5 changes: 5 additions & 0 deletions src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8336,6 +8336,11 @@ ${reportName}`,
`已将“${mccGroupName}”的默认支出类别更改为“${newCategory}”(此前为“${oldCategory}”)`,
addedReportField: (fieldType: string, fieldName?: string, defaultValue?: string) => `已添加 ${fieldType} 报告字段“${fieldName}”${defaultValue ? ` 默认值为“${defaultValue}”` : ''}`,
updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? '已启用' : '已禁用'} 公司商务卡消费要求`,
agentRule: {
added: ({title, prompt}: {title: string; prompt: string}) => (title ? `已添加代理规则“${title}”:${prompt}` : `已添加代理规则:${prompt}`),
updated: ({title, prompt}: {title: string; prompt: string}) => (title ? `已将代理规则“${title}”更新为:${prompt}` : `已将代理规则更新为:${prompt}`),
deleted: ({title}: {title: string}) => (title ? `已移除代理规则“${title}”` : '已移除代理规则'),
},
expensifyCardRule: {
actionVerb: {block: '已阻止', allow: '允许'},
amountOperator: {over: '结束', under: '在……之下'},
Expand Down
45 changes: 45 additions & 0 deletions src/libs/AgentRuleChangeLogUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import type {LocalizedTranslate} from '@components/LocaleContextProvider';

import CONST from '@src/CONST';
import type ReportAction from '@src/types/onyx/ReportAction';

import type {OnyxEntry} from 'react-native-onyx';

import {getOriginalMessage, isActionOfType} from './ReportActionsUtils';

/**
* Builds the #admins system message shown when an agent rule is added. Includes the rule's title and
* full prompt; the title is server-generated and best-effort, so it may be empty.
*/
function getAddAgentRuleMessage(translate: LocalizedTranslate, reportAction: OnyxEntry<ReportAction>): string {
if (!isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_AGENT_RULE)) {
return '';
}
const message = getOriginalMessage(reportAction) ?? {};
return translate('workspaceActions.agentRule.added', {title: message.ruleTitle ?? '', prompt: message.prompt ?? ''});
}

/**
* Builds the #admins system message shown when an agent rule's prompt is updated. The title is set
* once at creation and is not changed here.
*/
function getUpdateAgentRuleMessage(translate: LocalizedTranslate, reportAction: OnyxEntry<ReportAction>): string {
if (!isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AGENT_RULE)) {
return '';
}
const message = getOriginalMessage(reportAction) ?? {};
return translate('workspaceActions.agentRule.updated', {title: message.ruleTitle ?? '', prompt: message.prompt ?? ''});
}

/**
* Builds the #admins system message shown when an agent rule is deleted. Only the title is recorded.
*/
function getDeleteAgentRuleMessage(translate: LocalizedTranslate, reportAction: OnyxEntry<ReportAction>): string {
if (!isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_AGENT_RULE)) {
return '';
}
const message = getOriginalMessage(reportAction) ?? {};
return translate('workspaceActions.agentRule.deleted', {title: message.ruleTitle ?? ''});
}

export {getAddAgentRuleMessage, getUpdateAgentRuleMessage, getDeleteAgentRuleMessage};
10 changes: 10 additions & 0 deletions src/libs/OptionsListUtils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type {LocaleContextProps, LocalizedTranslate} from '@components/LocaleCon

import type {PrivateIsArchivedMap} from '@hooks/usePrivateIsArchivedMap';

import {getAddAgentRuleMessage, getDeleteAgentRuleMessage, getUpdateAgentRuleMessage} from '@libs/AgentRuleChangeLogUtils';
import {getEnabledCategoriesCount} from '@libs/CategoryUtils';
import {convertToDisplayString} from '@libs/CurrencyUtils';
import filterArrayByMatch from '@libs/filterArrayByMatch';
Expand Down Expand Up @@ -992,6 +993,15 @@ function getLastMessageTextForReport({
if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_FEATURE_ENABLED)) {
lastMessageTextFromReport = getWorkspaceFeatureEnabledMessage(translate, lastReportAction);
}
if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_AGENT_RULE)) {
lastMessageTextFromReport = getAddAgentRuleMessage(translate, lastReportAction);
}
if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AGENT_RULE)) {
lastMessageTextFromReport = getUpdateAgentRuleMessage(translate, lastReportAction);
}
if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_AGENT_RULE)) {
lastMessageTextFromReport = getDeleteAgentRuleMessage(translate, lastReportAction);
}
if (isPolicyCopyReportAction(lastReportAction)) {
lastMessageTextFromReport = Parser.htmlToText(getPolicyChangeLogCopyMessage(translate, lastReportAction));
}
Expand Down
10 changes: 10 additions & 0 deletions src/libs/ReportNameUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import type {OnyxCollection, OnyxEntry} from 'react-native-onyx';
import {Str} from 'expensify-common';
import Onyx from 'react-native-onyx';

import {getAddAgentRuleMessage, getDeleteAgentRuleMessage, getUpdateAgentRuleMessage} from './AgentRuleChangeLogUtils';
import {convertToDisplayString} from './CurrencyUtils';
import {formatPhoneNumber as formatPhoneNumberPhoneUtils} from './LocalePhoneNumber';
import {translateLocal} from './Localize';
Expand Down Expand Up @@ -857,6 +858,15 @@ function computeReportNameBasedOnReportAction(
if (isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.REMOVE_EXPENSIFY_CARD_RULE)) {
return getRemoveExpensifyCardRuleMessage(translate, parentReportAction);
}
if (isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_AGENT_RULE)) {
return getAddAgentRuleMessage(translate, parentReportAction);
}
if (isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AGENT_RULE)) {
return getUpdateAgentRuleMessage(translate, parentReportAction);
}
if (isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_AGENT_RULE)) {
return getDeleteAgentRuleMessage(translate, parentReportAction);
}
if (isPolicyCopyReportAction(parentReportAction)) {
return Parser.htmlToText(getPolicyChangeLogCopyMessage(translate, parentReportAction));
}
Expand Down
7 changes: 7 additions & 0 deletions src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {Str} from 'expensify-common';
import type {OptionData} from './ReportUtils';

import {isAnonymousUser} from './actions/Session';
import {getAddAgentRuleMessage, getDeleteAgentRuleMessage, getUpdateAgentRuleMessage} from './AgentRuleChangeLogUtils';
import {formatPhoneNumber as formatPhoneNumberPhoneUtils} from './LocalePhoneNumber';
import {formatList} from './Localize';
import {
Expand Down Expand Up @@ -1250,6 +1251,12 @@ function getOptionData({
result.alternateText = getUpdateExpensifyCardRuleMessage(translate, lastAction);
} else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.REMOVE_EXPENSIFY_CARD_RULE) {
result.alternateText = getRemoveExpensifyCardRuleMessage(translate, lastAction);
} else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_AGENT_RULE) {
result.alternateText = getAddAgentRuleMessage(translate, lastAction);
} else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AGENT_RULE) {
result.alternateText = getUpdateAgentRuleMessage(translate, lastAction);
} else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_AGENT_RULE) {
result.alternateText = getDeleteAgentRuleMessage(translate, lastAction);
} else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_MANUAL_APPROVAL_THRESHOLD) {
result.alternateText = getUpdatedManualApprovalThresholdMessage(translate, lastAction);
} else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_BUDGET) {
Expand Down
Loading
Loading