Skip to content
Open
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
8 changes: 5 additions & 3 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1935,14 +1935,16 @@ const translations: TranslationDeepObject<typeof en> = {
actorType: ValueOf<typeof CONST.NEXT_STEP.ACTOR_TYPE>,
_eta?: string,
_etaType?: ValueOf<typeof CONST.NEXT_STEP.ETA_TYPE>,
requiredDepositCurrency?: string,
) => {
const account = requiredDepositCurrency ? `${requiredDepositCurrency}-Bankkonto` : 'Bankkonto';
switch (actorType) {
case CONST.NEXT_STEP.ACTOR_TYPE.CURRENT_USER:
return `Warten darauf, dass <strong>Sie</strong> ein Bankkonto hinzufügen.`;
return `Warten darauf, dass <strong>Sie</strong> ein ${account} hinzufügen.`;
case CONST.NEXT_STEP.ACTOR_TYPE.OTHER_USER:
return `Warten darauf, dass <strong>${actor}</strong> ein Bankkonto hinzufügt.`;
return `Warten darauf, dass <strong>${actor}</strong> ein ${account} hinzufügt.`;
case CONST.NEXT_STEP.ACTOR_TYPE.UNSPECIFIED_ADMIN:
return `Warten Sie darauf, dass ein Admin ein Bankkonto hinzufügt.`;
return `Warten Sie darauf, dass ein Admin ein ${account} hinzufügt.`;
}
},
[CONST.NEXT_STEP.MESSAGE_KEY.WAITING_FOR_AUTOMATIC_SUBMIT]: (
Expand Down
8 changes: 5 additions & 3 deletions src/languages/el.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1986,14 +1986,16 @@ const translations: TranslationDeepObject<typeof en> = {
actorType: ValueOf<typeof CONST.NEXT_STEP.ACTOR_TYPE>,
_eta?: string,
_etaType?: ValueOf<typeof CONST.NEXT_STEP.ETA_TYPE>,
requiredDepositCurrency?: string,
) => {
const account = requiredDepositCurrency ? `τραπεζικό λογαριασμό σε ${requiredDepositCurrency}` : 'τραπεζικό λογαριασμό';
switch (actorType) {
case CONST.NEXT_STEP.ACTOR_TYPE.CURRENT_USER:
return `Αναμένουμε από <strong>εσάς</strong> να προσθέσετε έναν τραπεζικό λογαριασμό.`;
return `Αναμένουμε από <strong>εσάς</strong> να προσθέσετε έναν ${account}.`;
case CONST.NEXT_STEP.ACTOR_TYPE.OTHER_USER:
return `Αναμονή για να προσθέσει ο/η <strong>${actor}</strong> έναν τραπεζικό λογαριασμό.`;
return `Αναμονή για να προσθέσει ο/η <strong>${actor}</strong> έναν ${account}.`;
case CONST.NEXT_STEP.ACTOR_TYPE.UNSPECIFIED_ADMIN:
return `Αναμονή για να προσθέσει ένας διαχειριστής έναν τραπεζικό λογαριασμό.`;
return `Αναμονή για να προσθέσει ένας διαχειριστής έναν ${account}.`;
}
},
[CONST.NEXT_STEP.MESSAGE_KEY.WAITING_FOR_AUTOMATIC_SUBMIT]: (
Expand Down
8 changes: 5 additions & 3 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2005,16 +2005,18 @@ const translations = {
actorType: ValueOf<typeof CONST.NEXT_STEP.ACTOR_TYPE>,
_eta?: string,
_etaType?: ValueOf<typeof CONST.NEXT_STEP.ETA_TYPE>,
requiredDepositCurrency?: string,
) => {
const account = requiredDepositCurrency ? `${requiredDepositCurrency} bank account` : 'bank account';
// Disabling the default-case lint rule here is actually safer as this forces us to make the switch cases exhaustive
// eslint-disable-next-line default-case
switch (actorType) {
case CONST.NEXT_STEP.ACTOR_TYPE.CURRENT_USER:
return `Waiting for <strong>you</strong> to add a bank account.`;
return `Waiting for <strong>you</strong> to add a ${account}.`;
case CONST.NEXT_STEP.ACTOR_TYPE.OTHER_USER:
return `Waiting for <strong>${actor}</strong> to add a bank account.`;
return `Waiting for <strong>${actor}</strong> to add a ${account}.`;
case CONST.NEXT_STEP.ACTOR_TYPE.UNSPECIFIED_ADMIN:
return `Waiting for an admin to add a bank account.`;
return `Waiting for an admin to add a ${account}.`;
}
},
[CONST.NEXT_STEP.MESSAGE_KEY.WAITING_FOR_AUTOMATIC_SUBMIT]: (
Expand Down
9 changes: 5 additions & 4 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1865,14 +1865,15 @@ const translations: TranslationDeepObject<typeof en> = {
}
},
[CONST.NEXT_STEP.MESSAGE_KEY.NO_FURTHER_ACTION]: (_actor, _actorType, _eta, _etaType) => `¡No se requiere ninguna acción adicional!`,
[CONST.NEXT_STEP.MESSAGE_KEY.WAITING_FOR_SUBMITTER_ACCOUNT]: (actor, actorType, _eta, _etaType) => {
[CONST.NEXT_STEP.MESSAGE_KEY.WAITING_FOR_SUBMITTER_ACCOUNT]: (actor, actorType, _eta, _etaType, requiredDepositCurrency) => {
const account = requiredDepositCurrency ? `cuenta bancaria en ${requiredDepositCurrency}` : 'cuenta bancaria';
switch (actorType) {
case CONST.NEXT_STEP.ACTOR_TYPE.CURRENT_USER:
return `Esperando a que <strong>tú</strong> añadas una cuenta bancaria.`;
return `Esperando a que <strong>tú</strong> añadas una ${account}.`;
case CONST.NEXT_STEP.ACTOR_TYPE.OTHER_USER:
return `Esperando a que <strong>${actor}</strong> añada una cuenta bancaria.`;
return `Esperando a que <strong>${actor}</strong> añada una ${account}.`;
case CONST.NEXT_STEP.ACTOR_TYPE.UNSPECIFIED_ADMIN:
return `Esperando a que un administrador añada una cuenta bancaria.`;
return `Esperando a que un administrador añada una ${account}.`;
}
},
[CONST.NEXT_STEP.MESSAGE_KEY.WAITING_FOR_AUTOMATIC_SUBMIT]: (actor, actorType, eta, etaType) => {
Expand Down
8 changes: 5 additions & 3 deletions src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1940,14 +1940,16 @@ const translations: TranslationDeepObject<typeof en> = {
actorType: ValueOf<typeof CONST.NEXT_STEP.ACTOR_TYPE>,
_eta?: string,
_etaType?: ValueOf<typeof CONST.NEXT_STEP.ETA_TYPE>,
requiredDepositCurrency?: string,
) => {
const account = requiredDepositCurrency ? `compte bancaire en ${requiredDepositCurrency}` : 'compte bancaire';
switch (actorType) {
case CONST.NEXT_STEP.ACTOR_TYPE.CURRENT_USER:
return `En attente que <strong>vous</strong> ajoutiez un compte bancaire.`;
return `En attente que <strong>vous</strong> ajoutiez un ${account}.`;
case CONST.NEXT_STEP.ACTOR_TYPE.OTHER_USER:
return `En attente que <strong>${actor}</strong> ajoute un compte bancaire.`;
return `En attente que <strong>${actor}</strong> ajoute un ${account}.`;
case CONST.NEXT_STEP.ACTOR_TYPE.UNSPECIFIED_ADMIN:
return `En attente qu’un administrateur ajoute un compte bancaire.`;
return `En attente qu’un administrateur ajoute un ${account}.`;
}
},
[CONST.NEXT_STEP.MESSAGE_KEY.WAITING_FOR_AUTOMATIC_SUBMIT]: (
Expand Down
8 changes: 5 additions & 3 deletions src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1931,14 +1931,16 @@ const translations: TranslationDeepObject<typeof en> = {
actorType: ValueOf<typeof CONST.NEXT_STEP.ACTOR_TYPE>,
_eta?: string,
_etaType?: ValueOf<typeof CONST.NEXT_STEP.ETA_TYPE>,
requiredDepositCurrency?: string,
) => {
const account = requiredDepositCurrency ? `conto bancario in ${requiredDepositCurrency}` : 'conto bancario';
switch (actorType) {
case CONST.NEXT_STEP.ACTOR_TYPE.CURRENT_USER:
return `In attesa che <strong>tu</strong> aggiunga un conto bancario.`;
return `In attesa che <strong>tu</strong> aggiunga un ${account}.`;
case CONST.NEXT_STEP.ACTOR_TYPE.OTHER_USER:
return `In attesa che <strong>${actor}</strong> aggiunga un conto bancario.`;
return `In attesa che <strong>${actor}</strong> aggiunga un ${account}.`;
case CONST.NEXT_STEP.ACTOR_TYPE.UNSPECIFIED_ADMIN:
return `In attesa che un amministratore aggiunga un conto bancario.`;
return `In attesa che un amministratore aggiunga un ${account}.`;
}
},
[CONST.NEXT_STEP.MESSAGE_KEY.WAITING_FOR_AUTOMATIC_SUBMIT]: (
Expand Down
8 changes: 5 additions & 3 deletions src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1911,14 +1911,16 @@ const translations: TranslationDeepObject<typeof en> = {
actorType: ValueOf<typeof CONST.NEXT_STEP.ACTOR_TYPE>,
_eta?: string,
_etaType?: ValueOf<typeof CONST.NEXT_STEP.ETA_TYPE>,
requiredDepositCurrency?: string,
) => {
const account = requiredDepositCurrency ? `${requiredDepositCurrency} 銀行口座` : '銀行口座';
switch (actorType) {
case CONST.NEXT_STEP.ACTOR_TYPE.CURRENT_USER:
return `銀行口座の追加を<strong>お待ちしています</strong>。`;
return `${account}の追加を<strong>お待ちしています</strong>。`;
case CONST.NEXT_STEP.ACTOR_TYPE.OTHER_USER:
return `<strong>${actor}</strong> が銀行口座を追加するのを待っています。`;
return `<strong>${actor}</strong> が${account}を追加するのを待っています。`;
case CONST.NEXT_STEP.ACTOR_TYPE.UNSPECIFIED_ADMIN:
return `管理者が銀行口座を追加するのを待っています。`;
return `管理者が${account}を追加するのを待っています。`;
}
},
[CONST.NEXT_STEP.MESSAGE_KEY.WAITING_FOR_AUTOMATIC_SUBMIT]: (
Expand Down
8 changes: 5 additions & 3 deletions src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1927,14 +1927,16 @@ const translations: TranslationDeepObject<typeof en> = {
actorType: ValueOf<typeof CONST.NEXT_STEP.ACTOR_TYPE>,
_eta?: string,
_etaType?: ValueOf<typeof CONST.NEXT_STEP.ETA_TYPE>,
requiredDepositCurrency?: string,
) => {
const account = requiredDepositCurrency ? `${requiredDepositCurrency} bankrekening` : 'bankrekening';
switch (actorType) {
case CONST.NEXT_STEP.ACTOR_TYPE.CURRENT_USER:
return `Er wordt gewacht tot <strong>jij</strong> een bankrekening toevoegt.`;
return `Er wordt gewacht tot <strong>jij</strong> een ${account} toevoegt.`;
case CONST.NEXT_STEP.ACTOR_TYPE.OTHER_USER:
return `Wachten tot <strong>${actor}</strong> een bankrekening toevoegt.`;
return `Wachten tot <strong>${actor}</strong> een ${account} toevoegt.`;
case CONST.NEXT_STEP.ACTOR_TYPE.UNSPECIFIED_ADMIN:
return `Wachten tot een beheerder een bankrekening toevoegt.`;
return `Wachten tot een beheerder een ${account} toevoegt.`;
}
},
[CONST.NEXT_STEP.MESSAGE_KEY.WAITING_FOR_AUTOMATIC_SUBMIT]: (
Expand Down
8 changes: 5 additions & 3 deletions src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1924,14 +1924,16 @@ const translations: TranslationDeepObject<typeof en> = {
actorType: ValueOf<typeof CONST.NEXT_STEP.ACTOR_TYPE>,
_eta?: string,
_etaType?: ValueOf<typeof CONST.NEXT_STEP.ETA_TYPE>,
requiredDepositCurrency?: string,
) => {
const account = requiredDepositCurrency ? `konto bankowe w ${requiredDepositCurrency}` : 'konto bankowe';
switch (actorType) {
case CONST.NEXT_STEP.ACTOR_TYPE.CURRENT_USER:
return `Czekamy, aż <strong>dodasz</strong> konto bankowe.`;
return `Czekamy, aż <strong>dodasz</strong> ${account}.`;
case CONST.NEXT_STEP.ACTOR_TYPE.OTHER_USER:
return `Oczekiwanie, aż <strong>${actor}</strong> doda konto bankowe.`;
return `Oczekiwanie, aż <strong>${actor}</strong> doda ${account}.`;
case CONST.NEXT_STEP.ACTOR_TYPE.UNSPECIFIED_ADMIN:
return `Oczekiwanie na dodanie konta bankowego przez administratora.`;
return `Oczekiwanie na dodanie ${account} przez administratora.`;
}
},
[CONST.NEXT_STEP.MESSAGE_KEY.WAITING_FOR_AUTOMATIC_SUBMIT]: (
Expand Down
8 changes: 5 additions & 3 deletions src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1921,14 +1921,16 @@ const translations: TranslationDeepObject<typeof en> = {
actorType: ValueOf<typeof CONST.NEXT_STEP.ACTOR_TYPE>,
_eta?: string,
_etaType?: ValueOf<typeof CONST.NEXT_STEP.ETA_TYPE>,
requiredDepositCurrency?: string,
) => {
const account = requiredDepositCurrency ? `conta bancária em ${requiredDepositCurrency}` : 'conta bancária';
switch (actorType) {
case CONST.NEXT_STEP.ACTOR_TYPE.CURRENT_USER:
return `Esperando <strong>você</strong> adicionar uma conta bancária.`;
return `Esperando <strong>você</strong> adicionar uma ${account}.`;
case CONST.NEXT_STEP.ACTOR_TYPE.OTHER_USER:
return `Aguardando <strong>${actor}</strong> adicionar uma conta bancária.`;
return `Aguardando <strong>${actor}</strong> adicionar uma ${account}.`;
case CONST.NEXT_STEP.ACTOR_TYPE.UNSPECIFIED_ADMIN:
return `Aguardando um administrador adicionar uma conta bancária.`;
return `Aguardando um administrador adicionar uma ${account}.`;
}
},
[CONST.NEXT_STEP.MESSAGE_KEY.WAITING_FOR_AUTOMATIC_SUBMIT]: (
Expand Down
8 changes: 5 additions & 3 deletions src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1858,14 +1858,16 @@ const translations: TranslationDeepObject<typeof en> = {
actorType: ValueOf<typeof CONST.NEXT_STEP.ACTOR_TYPE>,
_eta?: string,
_etaType?: ValueOf<typeof CONST.NEXT_STEP.ETA_TYPE>,
requiredDepositCurrency?: string,
) => {
const account = requiredDepositCurrency ? `${requiredDepositCurrency} 银行账户` : '银行账户';
switch (actorType) {
case CONST.NEXT_STEP.ACTOR_TYPE.CURRENT_USER:
return `正在等待<strong>你</strong>添加银行账户。`;
return `正在等待<strong>你</strong>添加${account}。`;
case CONST.NEXT_STEP.ACTOR_TYPE.OTHER_USER:
return `正在等待 <strong>${actor}</strong> 添加银行账户。`;
return `正在等待 <strong>${actor}</strong> 添加${account}。`;
case CONST.NEXT_STEP.ACTOR_TYPE.UNSPECIFIED_ADMIN:
return `正在等待管理员添加银行账户。`;
return `正在等待管理员添加${account}。`;
}
},
[CONST.NEXT_STEP.MESSAGE_KEY.WAITING_FOR_AUTOMATIC_SUBMIT]: (
Expand Down
1 change: 1 addition & 0 deletions src/libs/DebugUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ function validateReportDraftProperty(key: keyof Report | keyof ReportNameValuePa
actorAccountID: 'number',
eta: 'object',
iconFill: 'string',
requiredDepositCurrency: 'string',
});
case 'tripData':
return validateObject<ObjectElement<Report, 'tripData'>>(value, {
Expand Down
7 changes: 6 additions & 1 deletion src/libs/NextStepUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ function buildNextStepMessage(
etaType = CONST.NEXT_STEP.ETA_TYPE.DATE_TIME;
}

return `<next-step>${translate(`nextStep.message.${nextStep.messageKey}`, actor, actorType, eta, etaType)}</next-step>`;
const requiredDepositCurrency = nextStep.requiredDepositCurrency ? Str.htmlEncode(nextStep.requiredDepositCurrency) : undefined;
const message =
nextStep.messageKey === CONST.NEXT_STEP.MESSAGE_KEY.WAITING_FOR_SUBMITTER_ACCOUNT
? translate('nextStep.message.waitingForSubmitterAccount', actor, actorType, eta, etaType, requiredDepositCurrency)
: translate(`nextStep.message.${nextStep.messageKey}`, actor, actorType, eta, etaType);
return `<next-step>${message}</next-step>`;
}

function doesReportContainTransactions(report: OnyxEntry<Report>): boolean {
Expand Down
3 changes: 3 additions & 0 deletions src/types/onyx/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ type ReportNextStep = {

/** The fill color of the icon */
iconFill?: string;

/** Currency the submitter's deposit account must use for direct reimbursement, named in the waitingForSubmitterAccount copy */
requiredDepositCurrency?: string;
};

/** Model of report data */
Expand Down
25 changes: 25 additions & 0 deletions tests/unit/NextStepUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,31 @@ describe('libs/NextStepUtils', () => {
expect(message).toBe('<next-step>Waiting for HiddenMarker to submit expenses.</next-step>');
});

it.each([
{requiredDepositCurrency: CONST.CURRENCY.USD, expectedAccount: 'USD bank account'},
{requiredDepositCurrency: '<strong>USD</strong>', expectedAccount: '&lt;strong&gt;USD&lt;/strong&gt; bank account'},
{requiredDepositCurrency: undefined, expectedAccount: 'bank account'},
])('renders the required deposit currency when it is available', ({requiredDepositCurrency, expectedAccount}) => {
const currentUserAccountID = 780071;
const nextStep: ReportNextStep = {
messageKey: CONST.NEXT_STEP.MESSAGE_KEY.WAITING_FOR_SUBMITTER_ACCOUNT,
icon: CONST.NEXT_STEP.ICONS.HOURGLASS,
actorAccountID: currentUserAccountID,
requiredDepositCurrency,
};
const translateWithDepositCurrency: LocalizedTranslate = (path, ...parameters) => {
if (path === 'nextStep.message.waitingForSubmitterAccount') {
const currency = parameters.at(4);
const account = typeof currency === 'string' ? `${currency} bank account` : 'bank account';
return `Waiting for <strong>you</strong> to add a ${account}.`;
}
return translateLocal(path, ...parameters);
};

const message = buildNextStepMessage(nextStep, translateWithDepositCurrency, currentUserAccountID, formatPhoneNumber);
expect(message).toBe(`<next-step>Waiting for <strong>you</strong> to add a ${expectedAccount}.</next-step>`);
});

it('uses the provided phone number formatter when resolving an SMS actor login', async () => {
const phoneActorAccountID = 780071;
const phoneActorLogin = '18332403628@expensify.sms';
Expand Down
Loading