Commit Graph

165 Commits

Author SHA1 Message Date
b981c7cf80 fix(miniapp): use correct totals in balance summary (totalDue, purchase ledger, utility ledger) 2026-03-17 00:39:22 +04:00
748878e789 feat(miniapp): add purchase-only and utilities balance sections to balances view 2026-03-17 00:28:35 +04:00
02c79ae629 feat: add payer control for purchases
- Add explicit payerMemberId field to purchase ledger entries
- Add 'Paid by' selector in mini app purchase add/edit forms
- Default payer to current user when creating new purchases
- Allow admins to change who made existing purchases
- Update backend handlers to accept and persist payerMemberId
- Add i18n translations for 'Paid by' label (EN/RU)

All quality gates pass: build, typecheck, lint, format, test

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 17:44:20 +04:00
b71480e9f1 fix(miniapp): prevent focus loss in destinations form 2026-03-16 04:46:09 +04:00
594c370677 refactor(miniapp): unify settings design with editable-list pattern 2026-03-15 03:48:40 +04:00
f8ab08a7cb fix(miniapp): use type import for JSX from solid-js 2026-03-15 03:22:07 +04:00
87f0ad0e8d feat(miniapp): restore utility categories CRUD in settings 2026-03-15 03:16:02 +04:00
25018a3c33 fix(miniapp): translate chat topic role in settings 2026-03-15 03:08:59 +04:00
07c5ffb82d Fix Bind Topic Error by making callback handling more robust
- Wrap answerCallbackQuery and editMessageText in try-catch to handle expired queries
- Answer callback queries as early as possible
- Add setup_tracking to allowed pending action types for better type safety
- Ignore 'query is too old' and 'message is not modified' errors gracefully
2026-03-15 02:50:32 +04:00
5e39cdf455 Fix setup command and refine payment clarification logic
- Fix BUTTON_TYPE_INVALID in non-private chats by using URL buttons for mini app links
- Localize clarification questions and processing messages
- Add language instructions to AI prompt
- Allow default payment amounts when not explicitly specified
2026-03-15 02:34:34 +04:00
afbda43c0e fix(bot): localize topic processor responses and allow optional payment amounts 2026-03-15 02:27:44 +04:00
3c53ab9e1a feat(bot): implement /app and /keyboard commands, add dashboard links 2026-03-15 02:13:32 +04:00
531e52b238 feat(bot): improve /setup UX and update checklist on /bind
- Enhance /setup message with a warmer greeting and binding instructions\n- Rename 'Setup' buttons to 'Create' for clarity\n- Track /setup message ID to enable automatic checklist updates when /bind is used\n- Refresh /setup checklist after successful topic binding\n- Update English and Russian translations
2026-03-15 01:44:13 +04:00
d0475743f8 fix(finance): gracefully handle initial state without rent rules
Allow building the finance dashboard even if no rent rule is configured for the cycle.
Defaults to 0 rent in the cycle's currency. Added regression tests in application
service and miniapp dashboard handler.
2026-03-15 01:38:54 +04:00
f4e5a49621 feat(bot): restore /bind command and improve /setup welcoming experience 2026-03-15 01:17:22 +04:00
b2e1e0f213 feat(bot): refactor /setup and add /bind command
- Simplify /setup message: remove chat ID, use emojis, compact layout
- Remove 'Bind' buttons from /setup
- Add /bind command for binding existing topics
- Remove old binding mode with 10-min timeout
- Update i18n translations for en and ru
2026-03-15 00:14:40 +04:00
e24c53dce2 feat(bot): replace /invite with /join_link command
- Remove /invite command and targeted invite flow
- Add /join_link command to generate shareable household join link
- Update i18n translations for en and ru
- Update command registration to include join_link in admin commands
2026-03-14 23:46:32 +04:00
0af8ea6f48 feat: add chat topic binding for casual conversation
Add ability to bind a dedicated chat topic where normal conversation
happens, separate from functional topics (purchases, payments, etc.)

- Add 'chat' to HOUSEHOLD_TOPIC_ROLES
- Add /bind_chat_topic command for admins
- Update i18n strings for en/ru
- Add command to admin scope in telegram-commands
2026-03-14 23:32:14 +04:00
290b18545e chore(bot): clean up topic processor log levels and add start log 2026-03-14 15:23:12 +04:00
b01a129466 fix(bot): include all schema properties in required array for OpenAI Structured Outputs 2026-03-14 15:04:13 +04:00
8de8419028 feat(bot): enhance topic processor logging for diagnosis
Added comprehensive logging to topic-processor.ts to capture API errors, parsing failures, and silent decisions. Also added result logging to purchase and payment ingestion handlers to trace the processor's output.
2026-03-14 14:54:49 +04:00
572c21f621 feat(bot): add error logging to topic processor
Previously, the topic processor swallowed errors silently, making debugging impossible. This commit adds error logging to the topic processor catch block.
2026-03-14 14:43:32 +04:00
b44b3bde93 fix(bot): silence topic processor failure messages unless explicitly mentioned
Previously, the bot would reply with a 'Zzz...' message to every message in a topic if the topic processor failed or was missing. This change ensures the bot remains silent unless it is explicitly mentioned by the user.
2026-03-14 14:33:29 +04:00
f38ee499ae feat(bot): unified topic processor replacing router+interpreter stack
Replace 3-layer architecture (gpt-5-nano router + gpt-4o-mini interpreter) with
single unified topic processor (gpt-4o-mini) for simplified message handling.

New components:
- HouseholdContextCache: TTL-based caching (5 min) for household config data
- TopicProcessor: Unified classification + parsing with structured JSON output

Key changes:
- Renamed ASSISTANT_ROUTER_MODEL → TOPIC_PROCESSOR_MODEL
- Added TOPIC_PROCESSOR_TIMEOUT_MS (default 10s)
- Refactored save() → saveWithInterpretation() for pre-parsed interpretations
- Removed deprecated createOpenAiTopicMessageRouter and ~300 lines legacy code
- Fixed typing indicator to only start when needed (purchase routes)
- Fixed amount formatting: convert minor units to major for rawText

Routes: silent, chat_reply, purchase, purchase_clarification, payment,
payment_clarification, topic_helper, dismiss_workflow

All 212 bot tests pass. Typecheck, lint, format, build clean.
2026-03-14 13:33:57 +04:00
9c3bb100e3 feat(miniapp): remove members count from home screen purchases card
- Remove 'Members' row from Purchases card in 'no payment' mode
- Remove unused homeMembersCountLabel i18n key from en/ru locales
2026-03-14 12:50:59 +04:00
62d62091a3 feat: add skeleton loading states for initial data load
- Add loading signal to DashboardContext
- Update Skeleton component to accept style prop
- Add skeleton UI to HomeRoute, LedgerRoute, and BalancesRoute
- Use Switch/Match pattern for three-state handling (loading/empty/content)
2026-03-14 11:08:35 +04:00
9cac339d0a fix: improve AI router prompt for topic message routing
- Add engagement rule: respond when engaged=yes/mention/reply (not silent)
- Add explicit purchase rules: classify as candidate when realistic items + amount
- Add fantastical purchase rule: respond with chat_reply (playful), not silent
- Add payment classification rules
- Simplify prompt structure for clarity
2026-03-14 10:44:03 +04:00
488a488137 feat: add quick payment action and improve copy button UX
Mini App Home Screen:
- Add 'Record Payment' button to utilities and rent period cards
- Pre-fill payment amount with member's share (rentShare/utilityShare)
- Modal dialog with amount input and currency display
- Toast notifications for copy and payment success/failure feedback

Copy Button Improvements:
- Increase spacing between icon and text (4px → 8px)
- Add hover background and padding for better touch target
- Green background highlight when copied (in addition to icon color change)
- Toast notification appears when copying any value

Backend:
- Add /api/miniapp/payments/add endpoint for quick payments
- Payment notifications sent to 'reminders' topic in Telegram
- Include member name, payment type, amount, and period in notification

Files:
- New: apps/miniapp/src/components/ui/toast.tsx
- Modified: apps/miniapp/src/routes/home.tsx, apps/miniapp/src/index.css,
  apps/miniapp/src/theme.css, apps/miniapp/src/i18n.ts,
  apps/bot/src/miniapp-billing.ts, apps/bot/src/server.ts

Quality Gates:  format, lint, typecheck, build, test

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-14 08:51:53 +04:00
771d64aa4e miniapp: refresh after mutations, activity expand, squash chart palette 2026-03-14 02:40:14 +04:00
1274cefc0f Stabilize purchase functionality: fix ID prefix, uniqueness, and split participant inclusion 2026-03-13 22:29:17 +04:00
31dd1dc2ee fix: purchase split rebalancing and input focus issues
- Add onBlur handler to Input component for rebalancing on blur
- Rewrite rebalancePurchaseSplit to calculate delta vs total and distribute
- Extract ParticipantSplitInputs component with proper SolidJS reactivity
- Button shows 'Balance' when validation fails, 'Save' when valid
- Add i18n keys for purchaseBalanceAction and purchaseRebalanceAction
2026-03-13 10:40:42 +04:00
588174fa52 Support rebalance and validate purchase splits
Add ParticipantShare type and client-side rebalance/validation helpers for purchase splits (rebalancePurchaseSplit, recalculatePercentages, calculateRemainingToAllocate, validatePurchaseDraft). Integrate rebalancing and validation into the miniapp ledger UI (auto-adjust shares, percentage<>amount syncing, remaining/error display, prefill participants on new purchase, disable save when invalid). On the backend, tighten input validation in finance-command-service for custom_amounts (require explicit shares and sum match) and make settlement-engine more lenient when reading legacy/malformed custom splits (ignore missing shares, accept explicit subset). Also add a test ensuring dashboard generation doesn't 500 on legacy malformed purchases.
2026-03-13 07:54:30 +04:00
ba99460a34 fix(feedback): normalize anonymous rate limit timestamps 2026-03-13 06:16:21 +04:00
94a5904f54 feat(miniapp): refine UI and add utility bill management
- Fix collapsible padding and button spacing
- Add subtotal to balance card
- Add utility bill management for admins
- Fix lints and type checks across the monorepo
- Implement rejectPendingHouseholdMember in repository and service
2026-03-13 05:52:34 +04:00
f1670c521f Refine topic workflow followups 2026-03-13 02:21:08 +04:00
88b50d2cb7 Refine topic assistant conversation context 2026-03-12 22:00:31 +04:00
401bbbdcca Refine topic context and purchase followup guards 2026-03-12 20:24:50 +04:00
b7fa489d24 Fix topic message history persistence 2026-03-12 19:21:37 +04:00
23faeef738 feat(bot): add topic history-aware assistant replies 2026-03-12 19:06:51 +04:00
5ebae7714c fix(bot): improve purchase-topic conversation flow 2026-03-12 18:23:26 +04:00
8374d18189 feat(bot): add shared topic router 2026-03-12 17:12:26 +04:00
014d791bdc fix(bot): improve calculated purchase confirmation flow 2026-03-12 15:35:02 +04:00
ca61085179 Fix purchase topic engagement gating 2026-03-12 14:44:55 +04:00
0d2065fd5e feat(miniapp): redesign balance and due-state flows 2026-03-12 14:08:55 +04:00
6053379f31 fix(miniapp): clarify cycle summary and balance sections 2026-03-12 13:12:39 +04:00
a38686c8b0 fix(miniapp): tighten house layout and restore balance details 2026-03-12 12:45:00 +04:00
ae2a54a7bf fix(miniapp): clean up russian household copy 2026-03-12 11:42:21 +04:00
5f37b3cc23 fix(miniapp): refresh data after locale changes 2026-03-12 11:41:08 +04:00
bfe6ae65ae fix(miniapp): tighten add and delete controls 2026-03-12 11:40:11 +04:00
a50b826b40 feat(miniapp): improve billing settings controls 2026-03-12 11:37:57 +04:00