From fbd1293b7ccc544312e5035ba74a23b301c8163c Mon Sep 17 00:00:00 2001 From: Dmitry Afonchenko Date: Mon, 9 Nov 2026 20:29:12 +0400 Subject: [PATCH 1/3] =?UTF-8?q?=D0=92=D1=82=D1=8F=D0=BD=D1=83=D0=B2=D1=88?= =?UTF-8?q?=D0=B8=D0=B9=D1=81=D1=8F=20=D0=BD=D0=BE=D0=B2=D0=B8=D1=87=D0=BE?= =?UTF-8?q?=D0=BA=20=D0=BD=D0=B0=207-=D0=B9=20=D0=B4=D0=B5=D0=BD=D1=8C=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D1=83=D1=87=D0=B0=D0=B5=D1=82=20=D1=81=D1=82?= =?UTF-8?q?=D0=B0=D1=80=D1=83=D1=8E=20=D1=86=D0=B5=D0=BD=D1=83=20=C2=AB?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D1=81=D0=B2=D0=BE=D0=B8=D1=85=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5+ уроков (без онбординга) в 2+ разных дня за первую неделю, без оплаты и без действующего Про — на 7-й день вместо обычного напоминания предложение: после повышения — старая цена на 72 часа (триггер engaged_offer; /plans и /purchase берут её, пейволл говорит до когда), до повышения — «кто купит до 1 декабря, продлевает по этой цене навсегда». Кнопка открывает пейволл. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01TAcLBj2Fn8nAKE4qWyn5es --- FEATURES.md | 2 +- .../Interfaces/IUserNotificationService.cs | 6 + src/Application/MiniApp/EngagedOffer.cs | 58 ++++++++++ src/Application/MiniApp/PriceSchedule.cs | 17 +++ .../Notifications/FirstWeekNudgeService.cs | 42 +++++++ .../Services/TelegramNotificationService.cs | 32 ++++++ src/Trale/Controllers/MiniAppController.cs | 13 ++- src/Trale/miniapp-src/src/api.ts | 4 +- .../src/components/ProPaywall.test.tsx | 7 ++ .../miniapp-src/src/components/ProPaywall.tsx | 11 +- .../DailyReturnNotificationServiceTests.cs | 4 +- .../FirstWeekNudgeServiceTests.cs | 107 +++++++++++++++++- .../MiniApp/PriceRiseTests.cs | 33 ++++++ 13 files changed, 326 insertions(+), 10 deletions(-) create mode 100644 src/Application/MiniApp/EngagedOffer.cs diff --git a/FEATURES.md b/FEATURES.md index c1cdee53..3a1adadd 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -522,7 +522,7 @@ Validation: loader logs a warning and skips any sentence-builder question whose - `FeedTreatService` — buy & feed a treat - `AchievementsService` / `GetAchievementsQuery` — achievements - `DailyReturnNotificationService` — D1+ return push, picks least-progressed module, claim-before-send (#940); leaves people in their first 8 days to `FirstWeekNudgeService` (once that is switched on) -- `FirstWeekNudgeService` — days 1, 3 and 7 after registration, at about the hour of joining: a message with the next lesson (title and goal from `IMiniAppContentProvider.LessonOrder` — the mini-app's order, Georgian with Cyrillic reading) of the module gone furthest in (the alphabet's first lesson if none is finished) and a button straight into it (`src=push_first_week_d`). Only to those who opened the mini-app and have not studied in the last 20 h; skips blocked users and those with notifications off; a day missed by more than a day is skipped. Only people registered after it was switched on (marker `first_week_switched_on`). Once per day and person: triggers `first_week_d1` / `_d3` / `_d7` never expire +- `FirstWeekNudgeService` — days 1, 3 and 7 after registration, at about the hour of joining: a message with the next lesson (title and goal from `IMiniAppContentProvider.LessonOrder` — the mini-app's order, Georgian with Cyrillic reading) of the module gone furthest in (the alphabet's first lesson if none is finished) and a button straight into it (`src=push_first_week_d`). Only to those who opened the mini-app and have not studied in the last 20 h; skips blocked users and those with notifications off; a day missed by more than a day is skipped. Only people registered after it was switched on (marker `first_week_switched_on`). Once per day and person: triggers `first_week_d1` / `_d3` / `_d7` never expire. On day 7 whoever studies in earnest (`EngagedOffer`: ≥5 finished lessons, onboarding not counted, on ≥2 different days; no payment, no running Pro) gets the offer of the old prices instead of the day-7 message, however recently they studied: trigger `engaged_offer`; after the rise the old prices hold for this person for 72 h (`PriceSchedule.OfferEndsAtAsync` — `/plans` returns `offerEndsAtUtc`, `/purchase` charges the old price, the paywall says until when); before the rise the message says that buying before it keeps the old prices for good. Button opens the paywall (`?paywall=1&src=push_engaged_offer`) - `StreakNotificationService` — streak-milestone push at exact 7 / 30 / 100 days; per-milestone `streak_{n}` trigger (epic #894, §82, #995) - `FirstOpenReminderService` — one reminder from Bombora to a newcomer who started the bot and has not opened the mini-app (no `MiniAppUserProgress` row) 24–72h after registration; same single button as the first message. Skips blocked users and those with notifications off. Only people registered after the reminder was first switched on (marker row `first_open_reminder_switched_on` in `NotificationTriggers`) — never the older base. Once per person: the `first_open_reminder` trigger never expires - `CoinsNotificationService` — coins-stale push when ≥50 spendable XP + no feeding in 7d; 7-day cooldown via `coins` trigger (epic #894, §82, #994) diff --git a/src/Application/Common/Interfaces/IUserNotificationService.cs b/src/Application/Common/Interfaces/IUserNotificationService.cs index 50a95f22..5604ef6f 100644 --- a/src/Application/Common/Interfaces/IUserNotificationService.cs +++ b/src/Application/Common/Interfaces/IUserNotificationService.cs @@ -72,5 +72,11 @@ Task SendReferralBonusGrantedAsync( /// A first-week message (see FirstWeekNudgeService): the text and one web-app button straight into /// the lesson, tagged src=push_first_week_d<day>. 403 → user flagged inactive; 429 → single retry. /// + /// + /// The day-7 offer of the old prices (see EngagedOffer): the text and one web-app button that opens the + /// paywall, tagged src=push_engaged_offer. 403 → user flagged inactive; 429 → single retry. + /// + Task SendEngagedOfferAsync(User user, string text, CancellationToken ct); + Task SendFirstWeekNudgeAsync(User user, Application.Notifications.FirstWeekNudge nudge, CancellationToken ct); } diff --git a/src/Application/MiniApp/EngagedOffer.cs b/src/Application/MiniApp/EngagedOffer.cs new file mode 100644 index 00000000..214fb8d4 --- /dev/null +++ b/src/Application/MiniApp/EngagedOffer.cs @@ -0,0 +1,58 @@ +using Domain.Entities; + +namespace Application.MiniApp; + +/// +/// The day-7 message to a newcomer who studies in earnest: the old prices — until the rise for everyone, +/// after it for this person for . Paid days start after the free ones, +/// so buying early loses nothing. +/// +public static class EngagedOffer +{ + /// Lessons finished in the first week, on at least different days. + public const int MinLessons = 5; + public const int MinDays = 2; + + private static readonly string[] Months = + ["января", "февраля", "марта", "апреля", "мая", "июня", "июля", "августа", "сентября", "октября", "ноября", "декабря"]; + + /// «1 декабря» / «12 декабря, 18:00» — Tbilisi time (UTC+4, no daylight saving). + public static string TbilisiDate(DateTime utc, bool withTime = false) + { + var t = utc.AddHours(4); + return withTime ? $"{t.Day} {Months[t.Month - 1]}, {t:HH:mm}" : $"{t.Day} {Months[t.Month - 1]}"; + } + + public static string Text(int lessons, DateTime nowUtc, PriceSchedule prices) + { + var quarter = SubscriptionPlans.ByPlan(SubscriptionPlan.Quarter)!; + var year = SubscriptionPlans.ByPlan(SubscriptionPlan.Year)!; + var head = $"Уроков за неделю: {lessons} — ты занимаешься всерьёз 💪"; + const string freeDays = "Бесплатные дни не сгорят: оплаченный срок начнётся после них."; + + if (!prices.HasRisen(nowUtc)) + return $""" + {head} + + С {TbilisiDate(prices.RiseAtUtc)} цены вырастут, а пока: + • 3 месяца — {quarter.StarsPrice} ⭐ (потом {SubscriptionPlans.RaisedPrice(quarter)} ⭐) + • год — {year.StarsPrice} ⭐ (потом {SubscriptionPlans.RaisedPrice(year)} ⭐) + + Кто купит до {TbilisiDate(prices.RiseAtUtc)}, будет продлевать по этой цене и дальше — навсегда. {freeDays} + + Купи сейчас — кнопка ниже. + """; + + return $""" + {head} + + Для тебя — цена «для своих» на 72 часа, до {TbilisiDate(nowUtc + PriceSchedule.OfferLasts, withTime: true)} по Тбилиси: + • 3 месяца — {quarter.StarsPrice} ⭐ вместо {SubscriptionPlans.RaisedPrice(quarter)} ⭐ + • год — {year.StarsPrice} ⭐ вместо {SubscriptionPlans.RaisedPrice(year)} ⭐ + + {freeDays} + + Купи сейчас по цене для своих — кнопка ниже. + """; + } +} diff --git a/src/Application/MiniApp/PriceSchedule.cs b/src/Application/MiniApp/PriceSchedule.cs index a3056b25..fe9f85d2 100644 --- a/src/Application/MiniApp/PriceSchedule.cs +++ b/src/Application/MiniApp/PriceSchedule.cs @@ -9,6 +9,8 @@ namespace Application.MiniApp; /// to (about +50%). /// Whoever paid before that keeps the old prices for good: a thank-you to the first buyers. /// Until the rise everybody pays the old prices and the paywall says when they go up. +/// A newcomer who studies in earnest gets the old prices for on day 7 +/// (, trigger ). /// public class PriceSchedule { @@ -18,6 +20,21 @@ public class PriceSchedule public bool HasRisen(DateTime nowUtc) => nowUtc >= RiseAtUtc; + /// The offer of the old prices to a newcomer who studies in earnest; its trigger row's + /// LastSentAt is when it was made. + public const string OfferSource = "engaged_offer"; + public static readonly TimeSpan OfferLasts = TimeSpan.FromHours(72); + + /// Until when this person's offer of the old prices runs; null — no offer running. + public async Task OfferEndsAtAsync(ITraleDbContext db, long telegramId, DateTime nowUtc, CancellationToken ct) + { + var madeAt = await db.NotificationTriggers + .Where(t => t.UserId == telegramId && t.Source == OfferSource) + .Select(t => (DateTime?)t.LastSentAt) + .FirstOrDefaultAsync(ct); + return madeAt is { } at && at + OfferLasts > nowUtc ? at + OfferLasts : null; + } + /// A payment before the rise that was not refunded — the old prices stay for this person. public Task KeepsOldPricesAsync(ITraleDbContext db, Guid userId, CancellationToken ct) => db.Payments.AnyAsync(p => p.UserId == userId && p.RefundedAtUtc == null && p.PurchasedAtUtc < RiseAtUtc, ct); diff --git a/src/Application/Notifications/FirstWeekNudgeService.cs b/src/Application/Notifications/FirstWeekNudgeService.cs index e3233b24..2a61d371 100644 --- a/src/Application/Notifications/FirstWeekNudgeService.cs +++ b/src/Application/Notifications/FirstWeekNudgeService.cs @@ -2,6 +2,7 @@ using Application.Common; using Application.Common.Interfaces; using Application.Common.Interfaces.MiniApp; +using Application.MiniApp; using Domain.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; @@ -19,6 +20,10 @@ namespace Application.Notifications; /// the existing base gets nothing. While someone is in their first week, /// leaves them to these messages. /// +/// On day 7 whoever studies in earnest — lessons on +/// different days, no payment, no running Pro — gets the offer of the old prices (, +/// trigger ) instead of the day-7 message, whenever they last studied. +/// /// Once per day and person: the trigger first_week_d1 / _d3 / _d7 is claimed before /// sending and never expires, so neither a second run nor a second instance sends it again. A day that was /// missed by more than a day (the worker was down) is skipped. @@ -27,6 +32,7 @@ public class FirstWeekNudgeService( ITraleDbContext db, IMiniAppContentProvider content, IUserNotificationService notificationService, + PriceSchedule prices, ILoggerFactory loggerFactory) : IFirstWeekNudgeService { private readonly ILogger _logger = loggerFactory.CreateLogger(); @@ -52,6 +58,9 @@ public async Task DispatchAsync(DateTime nowUtc, CancellationToken ct) { var switchedOnAt = await SwitchedOnAtAsync(db, nowUtc, ct); + if (switchedOnAt <= nowUtc - TimeSpan.FromDays(7)) + await OfferToEngagedAsync(nowUtc, switchedOnAt, ct); + foreach (var day in Days) { var registeredBefore = nowUtc - TimeSpan.FromDays(day); @@ -89,6 +98,39 @@ public async Task DispatchAsync(DateTime nowUtc, CancellationToken ct) await db.SaveChangesAsync(ct); } + private async Task OfferToEngagedAsync(DateTime nowUtc, DateTime switchedOnAt, CancellationToken ct) + { + var registeredBefore = nowUtc - TimeSpan.FromDays(7); + var registeredAfter = registeredBefore - TimeSpan.FromDays(1); + var day7 = SourceFor(7); + + var due = await db.Users + .Where(u => u.IsActive && u.NotificationsEnabled + && u.RegisteredAtUtc >= switchedOnAt + && u.RegisteredAtUtc <= registeredBefore + && u.RegisteredAtUtc > registeredAfter + && !db.Payments.Any(p => p.UserId == u.Id) + && !db.NotificationTriggers.Any(t => t.UserId == u.TelegramId && (t.Source == day7 || t.Source == PriceSchedule.OfferSource))) + .ToListAsync(ct); + + foreach (var user in due.Where(u => !u.HasActivePro(nowUtc))) + { + var done = await db.LessonEvents + .Where(e => e.UserId == user.Id && e.Event == "lesson_complete" && e.ModuleId != "onboarding" && e.CreatedAtUtc >= user.RegisteredAtUtc) + .Select(e => e.CreatedAtUtc) + .ToListAsync(ct); + if (done.Count < EngagedOffer.MinLessons || done.Select(at => at.Date).Distinct().Count() < EngagedOffer.MinDays) + continue; + + if (!await db.TryClaimNotificationTriggerAsync(user.TelegramId, PriceSchedule.OfferSource, null, nowUtc, Never, ct)) + continue; + // The offer stands in for the day-7 message. + await db.TryClaimNotificationTriggerAsync(user.TelegramId, day7, "offer", nowUtc, Never, ct); + + await notificationService.SendEngagedOfferAsync(user, EngagedOffer.Text(done.Count, nowUtc, prices), ct); + } + } + /// The day's message: the next lesson of the module the person has gone furthest in /// (the alphabet for someone who has not finished a lesson yet). Null — nothing left to take. public FirstWeekNudge? Build(int day, string completedLessonsJson) diff --git a/src/Infrastructure/Telegram/Services/TelegramNotificationService.cs b/src/Infrastructure/Telegram/Services/TelegramNotificationService.cs index f6e9d2b8..8006e786 100644 --- a/src/Infrastructure/Telegram/Services/TelegramNotificationService.cs +++ b/src/Infrastructure/Telegram/Services/TelegramNotificationService.cs @@ -435,6 +435,38 @@ await _client.SendTextMessageAsync( await Task.Delay(BulkSendDelay, ct); } + public async Task SendEngagedOfferAsync(Domain.Entities.User user, string text, CancellationToken ct) + { + if (!_botConfig.MiniAppEnabled || string.IsNullOrEmpty(_botConfig.HostAddress)) return; + + var keyboard = new InlineKeyboardMarkup(new[] + { + new[] { InlineKeyboardButton.WithWebApp("Купить по цене для своих", new WebAppInfo { Url = $"{_botConfig.NormalizedHost()}/?paywall=1&src=push_engaged_offer" }) } + }); + + try + { + await _client.SendTextMessageAsync(chatId: user.TelegramId, text: text, replyMarkup: keyboard, cancellationToken: ct); + } + catch (ApiRequestException ex) when (ex.ErrorCode == 429) + { + var retryAfterSeconds = ex.Parameters?.RetryAfter ?? 1; + _logger.LogInformation( + "Engaged offer for {TelegramId} hit rate limit; retrying after {RetryAfter}s", + user.TelegramId, retryAfterSeconds); + await Task.Delay(TimeSpan.FromSeconds(retryAfterSeconds), ct); + await _client.SendTextMessageAsync(chatId: user.TelegramId, text: text, replyMarkup: keyboard, cancellationToken: ct); + } + catch (ApiRequestException ex) when (ex.ErrorCode == 403) + { + _logger.LogInformation("Engaged offer for {TelegramId} blocked (403); marking user inactive", user.TelegramId); + user.IsActive = false; + return; + } + + await Task.Delay(BulkSendDelay, ct); + } + public async Task SendFirstWeekNudgeAsync(Domain.Entities.User user, Application.Notifications.FirstWeekNudge nudge, CancellationToken ct) { if (!_botConfig.MiniAppEnabled || string.IsNullOrEmpty(_botConfig.HostAddress)) return; diff --git a/src/Trale/Controllers/MiniAppController.cs b/src/Trale/Controllers/MiniAppController.cs index 101030cf..80be4d1f 100644 --- a/src/Trale/Controllers/MiniAppController.cs +++ b/src/Trale/Controllers/MiniAppController.cs @@ -187,12 +187,15 @@ public async Task GetPlans([FromServices] PriceSchedule prices, C var applyTestPricing = user != null && TestPricingTelegramIds.Contains(user.TelegramId); var keepsOldPrices = user != null && await prices.KeepsOldPricesAsync(_dbContext, user.Id, ct); var now = DateTime.UtcNow; + // The offer of the old prices to a newcomer who studies in earnest — it matters only after the rise. + var offerEndsAt = user != null && !keepsOldPrices && prices.HasRisen(now) + ? await prices.OfferEndsAtAsync(_dbContext, user.TelegramId, now, ct) : null; var plans = SubscriptionPlans.All.Select(p => new { id = p.Plan.ToString(), payloadId = p.PayloadId, - stars = applyTestPricing ? TestPricingStars : prices.PriceFor(p, now, keepsOldPrices), + stars = applyTestPricing ? TestPricingStars : prices.PriceFor(p, now, keepsOldPrices || offerEndsAt != null), // The price for everyone after the rise — a card shows it crossed out when this person pays less. regularStars = SubscriptionPlans.RaisedPrice(p), durationDays = p.DurationDays, @@ -205,7 +208,9 @@ public async Task GetPlans([FromServices] PriceSchedule prices, C // Until the rise — when prices go up; null after it. pricesRiseAtUtc = prices.HasRisen(now) ? (DateTime?)null : prices.RiseAtUtc, // Paid before the rise: the old prices stay for good, and the paywall thanks them. - keepsOldPrices + keepsOldPrices, + // The old prices for a while, offered to a newcomer who studies in earnest; null — no offer running. + offerEndsAtUtc = offerEndsAt }); } @@ -280,7 +285,9 @@ public async Task Purchase([FromBody] PurchaseRequest req, [FromS return BadRequest(new { error = "invalid_plan" }); } - plan = plan with { StarsPrice = prices.PriceFor(plan, DateTime.UtcNow, await prices.KeepsOldPricesAsync(_dbContext, user.Id, ct)) }; + var oldPrices = await prices.KeepsOldPricesAsync(_dbContext, user.Id, ct) + || await prices.OfferEndsAtAsync(_dbContext, user.TelegramId, DateTime.UtcNow, ct) != null; + plan = plan with { StarsPrice = prices.PriceFor(plan, DateTime.UtcNow, oldPrices) }; if (TestPricingTelegramIds.Contains(user.TelegramId)) { diff --git a/src/Trale/miniapp-src/src/api.ts b/src/Trale/miniapp-src/src/api.ts index e332f8e5..d35dbe45 100644 --- a/src/Trale/miniapp-src/src/api.ts +++ b/src/Trale/miniapp-src/src/api.ts @@ -253,7 +253,9 @@ export const api = { /** До повышения — когда цены вырастут; после — null. */ pricesRiseAtUtc?: string | null /** Платил до повышения: старые цены навсегда. */ - keepsOldPrices?: boolean }>('/api/miniapp/plans'), + keepsOldPrices?: boolean + /** Старая цена «для своих» втянувшемуся новичку — до этого момента; null — предложения нет. */ + offerEndsAtUtc?: string | null }>('/api/miniapp/plans'), purchase: (plan: string) => request<{ ok: boolean; alreadyPro?: boolean; invoiceLink?: string }>('/api/miniapp/purchase', { diff --git a/src/Trale/miniapp-src/src/components/ProPaywall.test.tsx b/src/Trale/miniapp-src/src/components/ProPaywall.test.tsx index 5656e15e..c1295987 100644 --- a/src/Trale/miniapp-src/src/components/ProPaywall.test.tsx +++ b/src/Trale/miniapp-src/src/components/ProPaywall.test.tsx @@ -143,4 +143,11 @@ describe('ProPaywall — повышение цен', () => { expect(screen.queryByTestId('paywall-price-rise')).toBeNull() expect(screen.queryByTestId('paywall-regular-price')).toBeNull() }) + + it('shows a newcomer the price for their own until the offer ends', async () => { + api.plans.mockResolvedValue({ plans: [month(100, 149)], pricesRiseAtUtc: null, keepsOldPrices: false, offerEndsAtUtc: '2026-12-12T14:00:00Z' } as never) + await open() + expect(screen.getByTestId('paywall-offer').textContent).toBe('Цена для своих — до 12 декабря, 18:00 по Тбилиси. Купи сейчас, потом цена станет обычной.') + expect(screen.getByTestId('paywall-regular-price').textContent).toBe('149 ⭐') + }) }) diff --git a/src/Trale/miniapp-src/src/components/ProPaywall.tsx b/src/Trale/miniapp-src/src/components/ProPaywall.tsx index 52c9f7fc..44fe750f 100644 --- a/src/Trale/miniapp-src/src/components/ProPaywall.tsx +++ b/src/Trale/miniapp-src/src/components/ProPaywall.tsx @@ -33,9 +33,10 @@ const RECOMMENDED_PLAN = 'Year' const MONTHS = ['января', 'февраля', 'марта', 'апреля', 'мая', 'июня', 'июля', 'августа', 'сентября', 'октября', 'ноября', 'декабря'] /** «1 декабря» — день по Тбилиси (UTC+4, без перехода на летнее время). */ -export function tbilisiDay(utc: string): string { +export function tbilisiDay(utc: string, withTime = false): string { const d = new Date(new Date(utc).getTime() + 4 * 3600_000) - return `${d.getUTCDate()} ${MONTHS[d.getUTCMonth()]}` + const time = `${String(d.getUTCHours()).padStart(2, '0')}:${String(d.getUTCMinutes()).padStart(2, '0')}` + return `${d.getUTCDate()} ${MONTHS[d.getUTCMonth()]}${withTime ? `, ${time}` : ''}` } /** @@ -50,6 +51,7 @@ export default function ProPaywall({ trigger, onClose, onPurchaseSuccess }: Prop const [selectedPlan, setSelectedPlan] = useState(RECOMMENDED_PLAN) const [riseAt, setRiseAt] = useState(null) const [keepsOldPrices, setKeepsOldPrices] = useState(false) + const [offerEndsAt, setOfferEndsAt] = useState(null) // «Что смутило?»: сервер заранее говорит, есть ли что спросить, если шторку закроют не купив, // — тогда закрытие не ждёт ответа сети, когда спрашивать нечего. Сам показ сервер запоминает при закрытии. const questionDue = useRef(false) @@ -75,6 +77,7 @@ export default function ProPaywall({ trigger, onClose, onPurchaseSuccess }: Prop setPlans(r.plans) setRiseAt(r.pricesRiseAtUtc ?? null) setKeepsOldPrices(r.keepsOldPrices === true) + setOfferEndsAt(r.offerEndsAtUtc ?? null) setState('default') if (!r.plans.some((p) => p.id === RECOMMENDED_PLAN) && r.plans.length > 0) { setSelectedPlan(r.plans[0].id) @@ -354,6 +357,10 @@ export default function ProPaywall({ trigger, onClose, onPurchaseSuccess }: Prop
Спасибо, что ты с нами с самого начала! Для тебя цены не вырастут — навсегда.
+ ) : offerEndsAt ? ( +
+ Цена для своих — до {tbilisiDay(offerEndsAt, true)} по Тбилиси. Купи сейчас, потом цена станет обычной. +
) : riseAt ? (
С {tbilisiDay(riseAt)} цены вырастут. Купи сейчас — заплатишь по нынешней цене. diff --git a/tests/Application.UnitTests/Notifications/DailyReturnNotificationServiceTests.cs b/tests/Application.UnitTests/Notifications/DailyReturnNotificationServiceTests.cs index 52e2901e..89322bb1 100644 --- a/tests/Application.UnitTests/Notifications/DailyReturnNotificationServiceTests.cs +++ b/tests/Application.UnitTests/Notifications/DailyReturnNotificationServiceTests.cs @@ -161,7 +161,7 @@ public async Task DispatchAsync_NewcomerInTheFirstWeek_IsLeftToTheFirstWeekMessa { // The first-week messages were switched on long ago; this person registered three days ago. await new FirstWeekNudgeService(Context, Mock.Of(), - _notificationServiceMock.Object, NullLoggerFactory.Instance).DispatchAsync(DateTime.UtcNow.AddDays(-30), CancellationToken.None); + _notificationServiceMock.Object, new Application.MiniApp.PriceSchedule(), NullLoggerFactory.Instance).DispatchAsync(DateTime.UtcNow.AddDays(-30), CancellationToken.None); var user = await SeedEligibleUser(); user.RegisteredAtUtc = DateTime.UtcNow.AddDays(-3); await Context.SaveChangesAsync(); @@ -175,7 +175,7 @@ public async Task DispatchAsync_NewcomerInTheFirstWeek_IsLeftToTheFirstWeekMessa public async Task DispatchAsync_PersonPastTheFirstWeek_StillGetsTheReturnPush() { await new FirstWeekNudgeService(Context, Mock.Of(), - _notificationServiceMock.Object, NullLoggerFactory.Instance).DispatchAsync(DateTime.UtcNow.AddDays(-30), CancellationToken.None); + _notificationServiceMock.Object, new Application.MiniApp.PriceSchedule(), NullLoggerFactory.Instance).DispatchAsync(DateTime.UtcNow.AddDays(-30), CancellationToken.None); var user = await SeedEligibleUser(); user.RegisteredAtUtc = DateTime.UtcNow.AddDays(-9); await Context.SaveChangesAsync(); diff --git a/tests/Application.UnitTests/Notifications/FirstWeekNudgeServiceTests.cs b/tests/Application.UnitTests/Notifications/FirstWeekNudgeServiceTests.cs index 4906459d..617cf9fc 100644 --- a/tests/Application.UnitTests/Notifications/FirstWeekNudgeServiceTests.cs +++ b/tests/Application.UnitTests/Notifications/FirstWeekNudgeServiceTests.cs @@ -16,16 +16,23 @@ public class FirstWeekNudgeServiceTests : CommandTestsBase private Mock _sender = null!; private FirstWeekNudgeService _sut = null!; private readonly List<(long TelegramId, FirstWeekNudge Nudge)> _sent = []; + private readonly List<(long TelegramId, string Text)> _offers = []; + private Application.MiniApp.PriceSchedule _prices = new(); private long _nextTelegramId = 92000; [SetUp] public void SetUp() { _sent.Clear(); + _offers.Clear(); + _prices = new Application.MiniApp.PriceSchedule { RiseAtUtc = Now.AddDays(-10) }; _sender = new Mock(); _sender.Setup(s => s.SendFirstWeekNudgeAsync(It.IsAny(), It.IsAny(), It.IsAny())) .Callback((u, n, _) => _sent.Add((u.TelegramId, n))) .Returns(Task.CompletedTask); + _sender.Setup(s => s.SendEngagedOfferAsync(It.IsAny(), It.IsAny(), It.IsAny())) + .Callback((u, t, _) => _offers.Add((u.TelegramId, t))) + .Returns(Task.CompletedTask); var content = new Mock(); // In the alphabet the words lesson 12 comes right after letters lesson 1. content.Setup(c => c.LessonOrder("alphabet-progressive")).Returns( @@ -38,7 +45,7 @@ public void SetUp() content.Setup(c => c.LessonOrder(It.IsNotIn("alphabet-progressive", "numbers"))).Returns([]); content.Setup(c => c.ModuleTitle("alphabet-progressive")).Returns("Алфавит"); content.Setup(c => c.ModuleTitle("numbers")).Returns("Числа"); - _sut = new FirstWeekNudgeService(Context, content.Object, _sender.Object, NullLoggerFactory.Instance); + _sut = new FirstWeekNudgeService(Context, content.Object, _sender.Object, _prices, NullLoggerFactory.Instance); } private async Task SwitchedOnLongAgo() => await _sut.DispatchAsync(Now.AddDays(-30), CancellationToken.None); @@ -177,4 +184,102 @@ public async Task Bot_blocked_or_notifications_off_get_nothing() _sent.ShouldBeEmpty(); } + + // ── Day 7: the old prices for whoever studies in earnest ───────────────── + + private async Task Studied(User user, params (int Day, int Lessons)[] days) + { + foreach (var (day, lessons) in days) + for (var i = 0; i < lessons; i++) + Context.LessonEvents.Add(new LessonEvent + { + Id = Guid.NewGuid(), UserId = user.Id, ModuleId = "alphabet-progressive", LessonId = i + 1, + StepKind = "check", Event = "lesson_complete", CreatedAtUtc = user.RegisteredAtUtc.AddDays(day).AddMinutes(i) + }); + await Context.SaveChangesAsync(); + } + + [Test] + public async Task Five_lessons_on_two_days_get_the_offer_instead_of_the_day_seven_message() + { + await SwitchedOnLongAgo(); + var user = await Newcomer(Now.AddDays(-7), lastPlayed: Now.AddHours(-2)); + await Studied(user, (0, 3), (2, 3)); + + await _sut.DispatchAsync(Now, CancellationToken.None); + await _sut.DispatchAsync(Now.AddHours(1), CancellationToken.None); + + var offer = _offers.ShouldHaveSingleItem(); + offer.Text.ShouldContain("Уроков за неделю: 6"); + offer.Text.ShouldContain("3 месяца — 249 ⭐ вместо 349 ⭐"); + offer.Text.ShouldContain("до 23 ноября, 16:00 по Тбилиси"); + offer.Text.ShouldContain("Купи сейчас"); + SentTo(user).ShouldBeEmpty("the offer stands in for the day-7 message"); + Context.NotificationTriggers.Single(t => t.UserId == user.TelegramId && t.Source == Application.MiniApp.PriceSchedule.OfferSource) + .LastSentAt.ShouldBe(Now); + } + + [Test] + public async Task Before_the_rise_the_offer_says_the_price_stays_for_good() + { + _prices = new Application.MiniApp.PriceSchedule { RiseAtUtc = new DateTime(2026, 11, 30, 20, 0, 0, DateTimeKind.Utc) }; + SetUp_with_prices(); + await SwitchedOnLongAgo(); + var user = await Newcomer(Now.AddDays(-7)); + await Studied(user, (1, 2), (3, 3)); + + await _sut.DispatchAsync(Now, CancellationToken.None); + + var text = _offers.ShouldHaveSingleItem().Text; + text.ShouldContain("С 1 декабря цены вырастут"); + text.ShouldContain("3 месяца — 249 ⭐ (потом 349 ⭐)"); + text.ShouldContain("навсегда"); + } + + [Test] + public async Task Lessons_on_one_day_or_fewer_than_five_get_the_ordinary_day_seven_message() + { + await SwitchedOnLongAgo(); + var oneDay = await Newcomer(Now.AddDays(-7)); + await Studied(oneDay, (0, 8)); + var few = await Newcomer(Now.AddDays(-7)); + await Studied(few, (0, 2), (3, 2)); + + await _sut.DispatchAsync(Now, CancellationToken.None); + + _offers.ShouldBeEmpty(); + SentTo(oneDay).ShouldHaveSingleItem().Day.ShouldBe(7); + SentTo(few).ShouldHaveSingleItem().Day.ShouldBe(7); + } + + [Test] + public async Task Whoever_paid_or_has_pro_gets_no_offer() + { + await SwitchedOnLongAgo(); + var paid = await Newcomer(Now.AddDays(-7)); + await Studied(paid, (0, 3), (2, 3)); + Context.Payments.Add(new Payment + { + Id = Guid.NewGuid(), UserId = paid.Id, TelegramPaymentChargeId = "c1", PayloadId = "Stars_Pro_Month", + Plan = SubscriptionPlan.Month, Amount = 100, Currency = "XTR", PurchasedAtUtc = Now.AddDays(-1) + }); + var gifted = await Newcomer(Now.AddDays(-7)); + gifted.IsPro = true; + gifted.SubscriptionPlan = SubscriptionPlan.Month; + gifted.SubscribedUntil = Now.AddDays(20); + await Context.SaveChangesAsync(); + await Studied(gifted, (0, 3), (2, 3)); + + await _sut.DispatchAsync(Now, CancellationToken.None); + + _offers.ShouldBeEmpty(); + } + + private void SetUp_with_prices() + { + var content = new Mock(); + content.Setup(c => c.LessonOrder(It.IsAny())).Returns([new LessonOutline(1, "Первые буквы", "Три буквы.")]); + content.Setup(c => c.ModuleTitle(It.IsAny())).Returns("Алфавит"); + _sut = new FirstWeekNudgeService(Context, content.Object, _sender.Object, _prices, NullLoggerFactory.Instance); + } } diff --git a/tests/IntegrationTests/MiniApp/PriceRiseTests.cs b/tests/IntegrationTests/MiniApp/PriceRiseTests.cs index b8fd7f16..3e29902a 100644 --- a/tests/IntegrationTests/MiniApp/PriceRiseTests.cs +++ b/tests/IntegrationTests/MiniApp/PriceRiseTests.cs @@ -122,4 +122,37 @@ public async Task A_refunded_payment_or_one_after_the_rise_does_not_keep_the_old Stars(await Plans(app, refunded), "Month").Should().Be(149); Stars(await Plans(app, paidAfter), "Month").Should().Be(149); } + + private static async Task Offered(TraleTestApplication app, User user, DateTime at) + { + await using var scope = app.Services.CreateAsyncScope(); + var db = scope.ServiceProvider.GetRequiredService(); + db.NotificationTriggers.Add(new NotificationTrigger + { + Id = Guid.NewGuid(), UserId = user.TelegramId, Source = PriceSchedule.OfferSource, LastSentAt = at + }); + await db.SaveChangesAsync(CancellationToken.None); + } + + [Test] + public async Task A_running_offer_gives_the_old_price_in_the_cards_and_the_invoice_until_it_ends() + { + await using var app = App(DateTime.UtcNow.AddDays(-10)); + var offered = await NewUser(app); + var madeAt = DateTime.UtcNow.AddHours(-10); + await Offered(app, offered, madeAt); + var expired = await NewUser(app); + await Offered(app, expired, DateTime.UtcNow.AddHours(-73)); + + var plans = await Plans(app, offered); + + Stars(plans, "Quarter").Should().Be(249); + plans.GetProperty("offerEndsAtUtc").GetDateTime().Should().BeCloseTo(madeAt + PriceSchedule.OfferLasts, TimeSpan.FromSeconds(1)); + (await InvoiceStars(app, offered, "Year")).Should().Be(849); + + var after = await Plans(app, expired); + Stars(after, "Quarter").Should().Be(349); + after.GetProperty("offerEndsAtUtc").ValueKind.Should().Be(JsonValueKind.Null); + (await InvoiceStars(app, expired, "Year")).Should().Be(1199); + } } From b0b77f1f07eb2dd2b20362178d804805e527a60e Mon Sep 17 00:00:00 2001 From: Dmitry Afonchenko Date: Mon, 9 Nov 2026 23:08:14 +0400 Subject: [PATCH 2/3] =?UTF-8?q?Engaged=20offer:=20=C2=AB=D1=81=D0=BD=D0=B8?= =?UTF-8?q?=D0=B6=D0=B5=D0=BD=D0=BD=D0=B0=D1=8F=20=D1=86=D0=B5=D0=BD=D0=B0?= =?UTF-8?q?=C2=BB=20instead=20of=20=C2=AB=D1=86=D0=B5=D0=BD=D0=B0=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D1=81=D0=B2=D0=BE=D0=B8=D1=85=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01TAcLBj2Fn8nAKE4qWyn5es --- FEATURES.md | 2 +- .../Interfaces/IUserNotificationService.cs | 2 +- src/Application/MiniApp/EngagedOffer.cs | 7 ++++-- .../Notifications/FirstWeekNudgeService.cs | 2 +- .../Services/TelegramNotificationService.cs | 4 +-- src/Trale/miniapp-src/src/api.ts | 2 +- .../src/components/ProPaywall.test.tsx | 2 +- .../miniapp-src/src/components/ProPaywall.tsx | 2 +- src/Trale/wwwroot/index.html | 25 +++++++++++-------- .../FirstWeekNudgeServiceTests.cs | 8 +++--- 10 files changed, 32 insertions(+), 24 deletions(-) diff --git a/FEATURES.md b/FEATURES.md index 3a1adadd..70ccac01 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -522,7 +522,7 @@ Validation: loader logs a warning and skips any sentence-builder question whose - `FeedTreatService` — buy & feed a treat - `AchievementsService` / `GetAchievementsQuery` — achievements - `DailyReturnNotificationService` — D1+ return push, picks least-progressed module, claim-before-send (#940); leaves people in their first 8 days to `FirstWeekNudgeService` (once that is switched on) -- `FirstWeekNudgeService` — days 1, 3 and 7 after registration, at about the hour of joining: a message with the next lesson (title and goal from `IMiniAppContentProvider.LessonOrder` — the mini-app's order, Georgian with Cyrillic reading) of the module gone furthest in (the alphabet's first lesson if none is finished) and a button straight into it (`src=push_first_week_d`). Only to those who opened the mini-app and have not studied in the last 20 h; skips blocked users and those with notifications off; a day missed by more than a day is skipped. Only people registered after it was switched on (marker `first_week_switched_on`). Once per day and person: triggers `first_week_d1` / `_d3` / `_d7` never expire. On day 7 whoever studies in earnest (`EngagedOffer`: ≥5 finished lessons, onboarding not counted, on ≥2 different days; no payment, no running Pro) gets the offer of the old prices instead of the day-7 message, however recently they studied: trigger `engaged_offer`; after the rise the old prices hold for this person for 72 h (`PriceSchedule.OfferEndsAtAsync` — `/plans` returns `offerEndsAtUtc`, `/purchase` charges the old price, the paywall says until when); before the rise the message says that buying before it keeps the old prices for good. Button opens the paywall (`?paywall=1&src=push_engaged_offer`) +- `FirstWeekNudgeService` — days 1, 3 and 7 after registration, at about the hour of joining: a message with the next lesson (title and goal from `IMiniAppContentProvider.LessonOrder` — the mini-app's order, Georgian with Cyrillic reading) of the module gone furthest in (the alphabet's first lesson if none is finished) and a button straight into it (`src=push_first_week_d`). Only to those who opened the mini-app and have not studied in the last 20 h; skips blocked users and those with notifications off; a day missed by more than a day is skipped. Only people registered after it was switched on (marker `first_week_switched_on`). Once per day and person: triggers `first_week_d1` / `_d3` / `_d7` never expire. On day 7 whoever studies in earnest (`EngagedOffer`: ≥5 finished lessons, onboarding not counted, on ≥2 different days; no payment, no running Pro) gets the offer of the old prices instead of the day-7 message, however recently they studied: trigger `engaged_offer`; after the rise the old prices hold for this person for 72 h (`PriceSchedule.OfferEndsAtAsync` — `/plans` returns `offerEndsAtUtc`, `/purchase` charges the old price, the paywall says until when; message and button say «сниженная цена»); before the rise the message says that buying before it keeps the old prices for good. Button opens the paywall (`?paywall=1&src=push_engaged_offer`) - `StreakNotificationService` — streak-milestone push at exact 7 / 30 / 100 days; per-milestone `streak_{n}` trigger (epic #894, §82, #995) - `FirstOpenReminderService` — one reminder from Bombora to a newcomer who started the bot and has not opened the mini-app (no `MiniAppUserProgress` row) 24–72h after registration; same single button as the first message. Skips blocked users and those with notifications off. Only people registered after the reminder was first switched on (marker row `first_open_reminder_switched_on` in `NotificationTriggers`) — never the older base. Once per person: the `first_open_reminder` trigger never expires - `CoinsNotificationService` — coins-stale push when ≥50 spendable XP + no feeding in 7d; 7-day cooldown via `coins` trigger (epic #894, §82, #994) diff --git a/src/Application/Common/Interfaces/IUserNotificationService.cs b/src/Application/Common/Interfaces/IUserNotificationService.cs index 5604ef6f..57a20607 100644 --- a/src/Application/Common/Interfaces/IUserNotificationService.cs +++ b/src/Application/Common/Interfaces/IUserNotificationService.cs @@ -76,7 +76,7 @@ Task SendReferralBonusGrantedAsync( /// The day-7 offer of the old prices (see EngagedOffer): the text and one web-app button that opens the /// paywall, tagged src=push_engaged_offer. 403 → user flagged inactive; 429 → single retry. /// - Task SendEngagedOfferAsync(User user, string text, CancellationToken ct); + Task SendEngagedOfferAsync(User user, string text, string button, CancellationToken ct); Task SendFirstWeekNudgeAsync(User user, Application.Notifications.FirstWeekNudge nudge, CancellationToken ct); } diff --git a/src/Application/MiniApp/EngagedOffer.cs b/src/Application/MiniApp/EngagedOffer.cs index 214fb8d4..824a39b9 100644 --- a/src/Application/MiniApp/EngagedOffer.cs +++ b/src/Application/MiniApp/EngagedOffer.cs @@ -23,6 +23,9 @@ public static string TbilisiDate(DateTime utc, bool withTime = false) return withTime ? $"{t.Day} {Months[t.Month - 1]}, {t:HH:mm}" : $"{t.Day} {Months[t.Month - 1]}"; } + public static string Button(DateTime nowUtc, PriceSchedule prices) => + prices.HasRisen(nowUtc) ? "Купить по сниженной цене" : "Купить по старой цене"; + public static string Text(int lessons, DateTime nowUtc, PriceSchedule prices) { var quarter = SubscriptionPlans.ByPlan(SubscriptionPlan.Quarter)!; @@ -46,13 +49,13 @@ Купи сейчас — кнопка ниже. return $""" {head} - Для тебя — цена «для своих» на 72 часа, до {TbilisiDate(nowUtc + PriceSchedule.OfferLasts, withTime: true)} по Тбилиси: + Специально для тебя — сниженная цена на 72 часа, до {TbilisiDate(nowUtc + PriceSchedule.OfferLasts, withTime: true)} по Тбилиси: • 3 месяца — {quarter.StarsPrice} ⭐ вместо {SubscriptionPlans.RaisedPrice(quarter)} ⭐ • год — {year.StarsPrice} ⭐ вместо {SubscriptionPlans.RaisedPrice(year)} ⭐ {freeDays} - Купи сейчас по цене для своих — кнопка ниже. + Купи сейчас по сниженной цене — кнопка ниже. """; } } diff --git a/src/Application/Notifications/FirstWeekNudgeService.cs b/src/Application/Notifications/FirstWeekNudgeService.cs index 2a61d371..f20dad9d 100644 --- a/src/Application/Notifications/FirstWeekNudgeService.cs +++ b/src/Application/Notifications/FirstWeekNudgeService.cs @@ -127,7 +127,7 @@ private async Task OfferToEngagedAsync(DateTime nowUtc, DateTime switchedOnAt, C // The offer stands in for the day-7 message. await db.TryClaimNotificationTriggerAsync(user.TelegramId, day7, "offer", nowUtc, Never, ct); - await notificationService.SendEngagedOfferAsync(user, EngagedOffer.Text(done.Count, nowUtc, prices), ct); + await notificationService.SendEngagedOfferAsync(user, EngagedOffer.Text(done.Count, nowUtc, prices), EngagedOffer.Button(nowUtc, prices), ct); } } diff --git a/src/Infrastructure/Telegram/Services/TelegramNotificationService.cs b/src/Infrastructure/Telegram/Services/TelegramNotificationService.cs index 8006e786..16805fed 100644 --- a/src/Infrastructure/Telegram/Services/TelegramNotificationService.cs +++ b/src/Infrastructure/Telegram/Services/TelegramNotificationService.cs @@ -435,13 +435,13 @@ await _client.SendTextMessageAsync( await Task.Delay(BulkSendDelay, ct); } - public async Task SendEngagedOfferAsync(Domain.Entities.User user, string text, CancellationToken ct) + public async Task SendEngagedOfferAsync(Domain.Entities.User user, string text, string button, CancellationToken ct) { if (!_botConfig.MiniAppEnabled || string.IsNullOrEmpty(_botConfig.HostAddress)) return; var keyboard = new InlineKeyboardMarkup(new[] { - new[] { InlineKeyboardButton.WithWebApp("Купить по цене для своих", new WebAppInfo { Url = $"{_botConfig.NormalizedHost()}/?paywall=1&src=push_engaged_offer" }) } + new[] { InlineKeyboardButton.WithWebApp(button, new WebAppInfo { Url = $"{_botConfig.NormalizedHost()}/?paywall=1&src=push_engaged_offer" }) } }); try diff --git a/src/Trale/miniapp-src/src/api.ts b/src/Trale/miniapp-src/src/api.ts index d35dbe45..d15043b6 100644 --- a/src/Trale/miniapp-src/src/api.ts +++ b/src/Trale/miniapp-src/src/api.ts @@ -254,7 +254,7 @@ export const api = { pricesRiseAtUtc?: string | null /** Платил до повышения: старые цены навсегда. */ keepsOldPrices?: boolean - /** Старая цена «для своих» втянувшемуся новичку — до этого момента; null — предложения нет. */ + /** Сниженная (старая) цена втянувшемуся новичку — до этого момента; null — предложения нет. */ offerEndsAtUtc?: string | null }>('/api/miniapp/plans'), purchase: (plan: string) => diff --git a/src/Trale/miniapp-src/src/components/ProPaywall.test.tsx b/src/Trale/miniapp-src/src/components/ProPaywall.test.tsx index c1295987..5850f0a9 100644 --- a/src/Trale/miniapp-src/src/components/ProPaywall.test.tsx +++ b/src/Trale/miniapp-src/src/components/ProPaywall.test.tsx @@ -147,7 +147,7 @@ describe('ProPaywall — повышение цен', () => { it('shows a newcomer the price for their own until the offer ends', async () => { api.plans.mockResolvedValue({ plans: [month(100, 149)], pricesRiseAtUtc: null, keepsOldPrices: false, offerEndsAtUtc: '2026-12-12T14:00:00Z' } as never) await open() - expect(screen.getByTestId('paywall-offer').textContent).toBe('Цена для своих — до 12 декабря, 18:00 по Тбилиси. Купи сейчас, потом цена станет обычной.') + expect(screen.getByTestId('paywall-offer').textContent).toBe('Специально для тебя — сниженная цена до 12 декабря, 18:00 по Тбилиси. Купи сейчас, потом цена станет обычной.') expect(screen.getByTestId('paywall-regular-price').textContent).toBe('149 ⭐') }) }) diff --git a/src/Trale/miniapp-src/src/components/ProPaywall.tsx b/src/Trale/miniapp-src/src/components/ProPaywall.tsx index 44fe750f..24b60c85 100644 --- a/src/Trale/miniapp-src/src/components/ProPaywall.tsx +++ b/src/Trale/miniapp-src/src/components/ProPaywall.tsx @@ -359,7 +359,7 @@ export default function ProPaywall({ trigger, onClose, onPurchaseSuccess }: Prop
) : offerEndsAt ? (
- Цена для своих — до {tbilisiDay(offerEndsAt, true)} по Тбилиси. Купи сейчас, потом цена станет обычной. + Специально для тебя — сниженная цена до {tbilisiDay(offerEndsAt, true)} по Тбилиси. Купи сейчас, потом цена станет обычной.
) : riseAt ? (
diff --git a/src/Trale/wwwroot/index.html b/src/Trale/wwwroot/index.html index 40958209..d13cad1d 100644 --- a/src/Trale/wwwroot/index.html +++ b/src/Trale/wwwroot/index.html @@ -8,6 +8,10 @@ + + + + @@ -50,19 +54,18 @@ TraleBot — учи грузинский язык в Telegram | ქართული ენა - - + + + + +
- + +
TraleBot · ისწავლე ქართული

Изучение грузинского языка — весело, в Telegram

Начать в Telegram
🏔
📖
🗣
გამარჯობაприветA0 · Выживание
მადლობაспасибоA0 · Выживание
კარგიхорошоA0 · Выживание
სახლიдомA0 · Выживание
ბოდიშიизвиниA0 · Выживание
მე მქვიაменя зовутA0 · Выживание
აГласные5 букв
ბЛёгкие согласные5 букв
გЧастые согласные5 букв
დТройки5 букв
ეОставшиеся11 букв
აПриветствияგამარჯობა, მადლობა
ბО себеменя зовут, откуда ты
გSOS-фразыне понимаю, сколько стоит
ა1–10ერთი...ათი
ბ11–20двадцатеричная система
გ21–100ოცდაერთი, ასი
დ100+, порядковые, дниმეორე, ოთხშაბათი
აМестоимения + «быть»ვარ, ხარ, არის
ბ«Иметь»აქვს vs ჰყავს
გУказательныеეს / ეგ / ის
დБазовые глаголыვ- = я, -ს = он
ეПадеживсе 7 грузинских падежей
ვПослелоги-ში, -ზე, -თან и другие
ზПрилагательныеლამაზი → საუკეთესო
აКафеменю, заказ, счёт
ბТакси и городмаршрут, районы
გВрачсимптомы, аптека
დМагазинпокупки, цены
ეЗнакомствопрофессия, семья
ვГлаголы движения11 уроков, направления
აЧетыре класса глаголовпереходные, непереходные
ბВерсионные гласные-უ-, -ი-, -ე-
გПриставки направленияდა- შე- გა- ა-...
დИмперфектვწერდი — я писал
ეАористпереворот падежей
ვСклонение местоименийის→მან/მას/მისი
ზУсловные предложенияреальные и нереальные
აПерфект (Серия III)подлежащее в дательном
ბПлюсквамперфектდამეწერა
გСослагательное наклонениевсе три серии
დПричастия-ება/-ობა формы
ეОтносительные предложенияრომელიც (склоняется!)
ვКаузатив и потенциалშეუძლია
უფასო · бесплатно
а потом
выгодно

Начать изучение грузинского языка

начать путь
Начать в Telegram
diff --git a/tests/Application.UnitTests/Notifications/FirstWeekNudgeServiceTests.cs b/tests/Application.UnitTests/Notifications/FirstWeekNudgeServiceTests.cs index 617cf9fc..1c2256b7 100644 --- a/tests/Application.UnitTests/Notifications/FirstWeekNudgeServiceTests.cs +++ b/tests/Application.UnitTests/Notifications/FirstWeekNudgeServiceTests.cs @@ -30,8 +30,8 @@ public void SetUp() _sender.Setup(s => s.SendFirstWeekNudgeAsync(It.IsAny(), It.IsAny(), It.IsAny())) .Callback((u, n, _) => _sent.Add((u.TelegramId, n))) .Returns(Task.CompletedTask); - _sender.Setup(s => s.SendEngagedOfferAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Callback((u, t, _) => _offers.Add((u.TelegramId, t))) + _sender.Setup(s => s.SendEngagedOfferAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) + .Callback((u, t, b, _) => _offers.Add((u.TelegramId, t + "\n[" + b + "]"))) .Returns(Task.CompletedTask); var content = new Mock(); // In the alphabet the words lesson 12 comes right after letters lesson 1. @@ -213,7 +213,8 @@ public async Task Five_lessons_on_two_days_get_the_offer_instead_of_the_day_seve offer.Text.ShouldContain("Уроков за неделю: 6"); offer.Text.ShouldContain("3 месяца — 249 ⭐ вместо 349 ⭐"); offer.Text.ShouldContain("до 23 ноября, 16:00 по Тбилиси"); - offer.Text.ShouldContain("Купи сейчас"); + offer.Text.ShouldContain("Купи сейчас по сниженной цене"); + offer.Text.ShouldContain("[Купить по сниженной цене]"); SentTo(user).ShouldBeEmpty("the offer stands in for the day-7 message"); Context.NotificationTriggers.Single(t => t.UserId == user.TelegramId && t.Source == Application.MiniApp.PriceSchedule.OfferSource) .LastSentAt.ShouldBe(Now); @@ -234,6 +235,7 @@ public async Task Before_the_rise_the_offer_says_the_price_stays_for_good() text.ShouldContain("С 1 декабря цены вырастут"); text.ShouldContain("3 месяца — 249 ⭐ (потом 349 ⭐)"); text.ShouldContain("навсегда"); + text.ShouldContain("[Купить по старой цене]"); } [Test] From 5a56569ca0a5146c4cd8c805dce23da5236ff7eb Mon Sep 17 00:00:00 2001 From: Dmitry Afonchenko Date: Mon, 9 Nov 2026 23:08:23 +0400 Subject: [PATCH 3/3] Restore wwwroot/index.html Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01TAcLBj2Fn8nAKE4qWyn5es --- src/Trale/wwwroot/index.html | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/Trale/wwwroot/index.html b/src/Trale/wwwroot/index.html index d13cad1d..40958209 100644 --- a/src/Trale/wwwroot/index.html +++ b/src/Trale/wwwroot/index.html @@ -8,10 +8,6 @@ - - - - @@ -54,18 +50,19 @@ TraleBot — учи грузинский язык в Telegram | ქართული ენა - - - - - + +
- -
TraleBot · ისწავლე ქართული

Изучение грузинского языка — весело, в Telegram

Начать в Telegram
🏔
📖
🗣
გამარჯობაприветA0 · Выживание
მადლობაспасибоA0 · Выживание
კარგიхорошоA0 · Выживание
სახლიдомA0 · Выживание
ბოდიშიизвиниA0 · Выживание
მე მქვიაменя зовутA0 · Выживание
აГласные5 букв
ბЛёгкие согласные5 букв
გЧастые согласные5 букв
დТройки5 букв
ეОставшиеся11 букв
აПриветствияგამარჯობა, მადლობა
ბО себеменя зовут, откуда ты
გSOS-фразыне понимаю, сколько стоит
ა1–10ერთი...ათი
ბ11–20двадцатеричная система
გ21–100ოცდაერთი, ასი
დ100+, порядковые, дниმეორე, ოთხშაბათი
აМестоимения + «быть»ვარ, ხარ, არის
ბ«Иметь»აქვს vs ჰყავს
გУказательныеეს / ეგ / ის
დБазовые глаголыვ- = я, -ს = он
ეПадеживсе 7 грузинских падежей
ვПослелоги-ში, -ზე, -თან и другие
ზПрилагательныеლამაზი → საუკეთესო
აКафеменю, заказ, счёт
ბТакси и городмаршрут, районы
გВрачсимптомы, аптека
დМагазинпокупки, цены
ეЗнакомствопрофессия, семья
ვГлаголы движения11 уроков, направления
აЧетыре класса глаголовпереходные, непереходные
ბВерсионные гласные-უ-, -ი-, -ე-
გПриставки направленияდა- შე- გა- ა-...
დИмперфектვწერდი — я писал
ეАористпереворот падежей
ვСклонение местоименийის→მან/მას/მისი
ზУсловные предложенияреальные и нереальные
აПерфект (Серия III)подлежащее в дательном
ბПлюсквамперфектდამეწერა
გСослагательное наклонениевсе три серии
დПричастия-ება/-ობა формы
ეОтносительные предложенияრომელიც (склоняется!)
ვКаузатив и потенциалშეუძლია
უფასო · бесплатно
а потом
выгодно

Начать изучение грузинского языка

начать путь
Начать в Telegram
+