fix(bot): improve calculated purchase confirmation flow

This commit is contained in:
2026-03-12 15:35:02 +04:00
parent 995725f121
commit 014d791bdc
8 changed files with 708 additions and 70 deletions

View File

@@ -288,8 +288,12 @@ export const enBotTranslations: BotTranslationCatalog = {
purchase: {
sharedPurchaseFallback: 'shared purchase',
processing: 'Checking that purchase...',
proposal: (summary, participants) =>
`I think this shared purchase was: ${summary}.${participants ? `\n\n${participants}` : ''}\nConfirm or cancel below.`,
proposal: (summary: string, calculationNote: string | null, participants: string | null) =>
`I think this shared purchase was: ${summary}.${calculationNote ? `\n${calculationNote}` : ''}${participants ? `\n\n${participants}` : ''}\nConfirm or cancel below.`,
calculatedAmountNote: (explanation: string | null) =>
explanation
? `I calculated the total as ${explanation}. Is that right?`
: 'I calculated the total for this purchase. Is that right?',
clarification: (question) => question,
clarificationMissingAmountAndCurrency:
'What amount and currency should I record for this shared purchase?',
@@ -304,7 +308,13 @@ export const enBotTranslations: BotTranslationCatalog = {
participantToggleIncluded: (displayName) => `${displayName}`,
participantToggleExcluded: (displayName) => `${displayName}`,
confirmButton: 'Confirm',
calculatedConfirmButton: 'Looks right',
calculatedFixAmountButton: 'Fix amount',
cancelButton: 'Cancel',
calculatedFixAmountPrompt:
'Reply with the corrected total and currency in this topic, and I will re-check the purchase.',
calculatedFixAmountRequestedToast: 'Reply with the corrected total.',
calculatedFixAmountAlreadyRequested: 'Waiting for the corrected total.',
confirmed: (summary) => `Purchase confirmed: ${summary}`,
cancelled: (summary) => `Purchase proposal cancelled: ${summary}`,
confirmedToast: 'Purchase confirmed.',

View File

@@ -292,8 +292,12 @@ export const ruBotTranslations: BotTranslationCatalog = {
purchase: {
sharedPurchaseFallback: 'общая покупка',
processing: 'Проверяю покупку...',
proposal: (summary, participants) =>
`Похоже, это общая покупка: ${summary}.${participants ? `\n\n${participants}` : ''}\одтвердите или отмените ниже.`,
proposal: (summary: string, calculationNote: string | null, participants: string | null) =>
`Похоже, это общая покупка: ${summary}.${calculationNote ? `\n${calculationNote}` : ''}${participants ? `\n\n${participants}` : ''}\одтвердите или отмените ниже.`,
calculatedAmountNote: (explanation: string | null) =>
explanation
? `Я посчитал итог как ${explanation}. Всё верно?`
: 'Я посчитал итоговую сумму для этой покупки. Всё верно?',
clarification: (question) => question,
clarificationMissingAmountAndCurrency:
'Какую сумму и валюту нужно записать для этой общей покупки?',
@@ -308,7 +312,13 @@ export const ruBotTranslations: BotTranslationCatalog = {
participantToggleIncluded: (displayName) => `${displayName}`,
participantToggleExcluded: (displayName) => `${displayName}`,
confirmButton: 'Подтвердить',
calculatedConfirmButton: 'Верно',
calculatedFixAmountButton: 'Исправить сумму',
cancelButton: 'Отменить',
calculatedFixAmountPrompt:
'Ответьте в этот топик исправленной итоговой суммой и валютой, и я заново проверю покупку.',
calculatedFixAmountRequestedToast: 'Ответьте исправленной суммой.',
calculatedFixAmountAlreadyRequested: 'Жду исправленную сумму.',
confirmed: (summary) => `Покупка подтверждена: ${summary}`,
cancelled: (summary) => `Предложение покупки отменено: ${summary}`,
confirmedToast: 'Покупка подтверждена.',

View File

@@ -268,7 +268,12 @@ export interface BotTranslationCatalog {
purchase: {
sharedPurchaseFallback: string
processing: string
proposal: (summary: string, participants: string | null) => string
proposal: (
summary: string,
calculationNote: string | null,
participants: string | null
) => string
calculatedAmountNote: (explanation: string | null) => string
clarification: (question: string) => string
clarificationMissingAmountAndCurrency: string
clarificationMissingAmount: string
@@ -281,7 +286,12 @@ export interface BotTranslationCatalog {
participantToggleIncluded: (displayName: string) => string
participantToggleExcluded: (displayName: string) => string
confirmButton: string
calculatedConfirmButton: string
calculatedFixAmountButton: string
cancelButton: string
calculatedFixAmountPrompt: string
calculatedFixAmountRequestedToast: string
calculatedFixAmountAlreadyRequested: string
confirmed: (summary: string) => string
cancelled: (summary: string) => string
confirmedToast: string