Commit Graph

180 Commits

Author SHA1 Message Date
admin 1fed21fa2f refactor(chat): clean stale mocks and external browser helpers 2026-06-30 14:32:58 +08:00
admin 958a0f8ffd feat(chat): handle credit-gated send responses 2026-06-30 14:17:14 +08:00
admin a99a6e056d feat(auth): persist login provider for restored sessions 2026-06-30 12:50:18 +08:00
admin 768b24774d fix(auth): replace hardcoded platform name with dynamic platform detection 2026-06-30 12:05:44 +08:00
admin 0bae53bfba feat: implement lazy singleton pattern for repository instances and update related imports 2026-06-29 17:25:41 +08:00
admin 096978e703 feat(subscription): split vip and topup flows 2026-06-29 14:45:01 +08:00
admin e372d58b4c feat(payment): sync plans and add coins rules 2026-06-29 14:11:50 +08:00
admin 6e51cb7d16 Refactor: Remove original Dart references from comments across multiple files
- Updated comments in various components, schemas, and repositories to remove references to original Dart files.
- Ensured consistency in documentation while maintaining the context of the code.
2026-06-29 11:31:21 +08:00
admin 1ebd29d1ed refactor: remove unused subscription plans and router files 2026-06-29 10:56:08 +08:00
admin 58cd2a7545 feat(user): sync entitlement snapshot 2026-06-29 10:37:37 +08:00
admin 455204e1e4 feat(chat): add history unlock api 2026-06-26 19:27:56 +08:00
admin 49b67064f7 feat(subscription): load vip and credit plans from api 2026-06-26 15:09:27 +08:00
admin abf6d5ae88 feat(auth): mark test accounts in login requests 2026-06-26 14:05:53 +08:00
admin 94fb3ed19b fix(user): align dto with latest payload 2026-06-25 17:40:41 +08:00
admin 8d956bc95d fix(chat): render locked voice messages correctly 2026-06-25 12:04:38 +08:00
admin c8f0827e40 fix(subscription): return chat paywalls after payment 2026-06-25 10:20:13 +08:00
admin 42c03f8901 feat(chat): migrate chat protocol to lock detail 2026-06-24 14:06:30 +08:00
admin 3e766a0ecd fix(chat): preserve private send response fields 2026-06-24 11:02:15 +08:00
admin bfbf7ee91a feat(app): improve payment and paywall UX 2026-06-24 10:02:22 +08:00
admin 18617ac7e5 refactor(payment): remove websocket event dto 2026-06-23 18:11:26 +08:00
admin 24e52d6ead fix(payment): support updated plan pricing fields 2026-06-23 15:47:09 +08:00
admin f14b8a48d2 fix(chat): handle guest total limit 2026-06-23 15:14:17 +08:00
admin cb7087f8ad chore(chat): add mock fixtures 2026-06-23 14:54:24 +08:00
admin ebd44c4980 feat(chat): add private message unlock flow 2026-06-23 13:21:57 +08:00
admin 6bcc070ba1 refactor(chat): rely on server message limits 2026-06-23 11:20:48 +08:00
admin d81abd6efd feat(chat): support ai photo viewing 2026-06-23 10:34:02 +08:00
admin 27021f9328 fix(chat): normalize message date headers 2026-06-22 18:23:50 +08:00
admin 21b9954351 feat(payment): restore ezpay return orders 2026-06-22 17:31:04 +08:00
admin 890c955712 fix(payment): support ezpay cashier urls 2026-06-22 16:35:06 +08:00
admin 61fd4ca916 feat(chat): handle daily message paywall 2026-06-22 10:46:17 +08:00
admin 1fc1635341 chore: wire release hook and service updates 2026-06-18 16:18:52 +08:00
admin a347b39001 feat(payment): connect payment service flow 2026-06-18 15:40:59 +08:00
admin 35c30ac31e feat(data): add paywall payment APIs 2026-06-18 14:55:54 +08:00
admin cf54bc742d fix(chat): limit external browser prompt daily 2026-06-18 14:23:31 +08:00
admin d190de4dda refactor(api): use dto barrel imports 2026-06-18 14:16:00 +08:00
admin 812a3e41b9 refactor(logging): centralize console output 2026-06-18 13:34:19 +08:00
admin 0d0dabaace refactor(utils): add barrel exports 2026-06-18 11:58:50 +08:00
admin 172ef28060 feat(chat): prompt facebook users to open external browser 2026-06-18 10:59:13 +08:00
admin 56b2c39ca5 fix(user): normalize last message timestamp 2026-06-17 17:47:07 +08:00
admin 5d66cef85c refactor(dto): move app models into dto layer 2026-06-17 17:34:55 +08:00
admin a969030f40 fix(chat): prevent guest quota reset on read failures 2026-06-17 17:22:45 +08:00
admin a6ee0d5e24 refactor(env): centralize app environment detection 2026-06-17 15:31:15 +08:00
admin 977c0905bd refactor(chat): remove redundant auth state management from ChatScreen documentation
refactor(chat): update guest chat quota logic to use isProduction utility
fix(user): add TODO for user initialization event on login status change
2026-06-17 15:30:36 +08:00
admin 1152491088 refactor(repositories): use barrel imports 2026-06-17 12:09:40 +08:00
admin d41b3c4473 refactor(schemas): extract nullable-default helpers to shared file
The three defensive Zod helpers (stringOrEmpty, numberOrZero,
booleanOrFalse) used by user.ts are general-purpose Zod utilities
that any schema may need — they're not user-specific. The original
inline declaration in user.ts had two downsides:

1. Any new schema (chat, auth, metrics, etc.) that needs the same
   'null | undefined → default scalar' pattern would have to
   duplicate the helper.

2. The long defensive-parse comment block (11 lines) lived inside
   user.ts and didn't explain the helpers' general purpose.

Move them to src/data/schemas/nullable-defaults.ts (top-level
sibling of auth/, chat/, metrics/, user/ subdirs) so any schema
can import them. Keep the original explanation verbatim at the
top of the new file.

Bundled in this commit:
- user.ts imports the helpers from the new file (drops 11 lines
  of comment + 3 const declarations)
- 3 auto-generated barrel index files regenerated by barrelsby
  to pick up the new exports (chat/, subscription/, stores/user/)
2026-06-17 12:05:09 +08:00
admin 0a9abc2502 fix(auth): stop parsing logout response body (avoids ZodError on null data)
Root cause: backend `/auth/logout` returns `{ success: true, data: null }`
(no business payload for a fire-and-forget endpoint). The previous
`AuthApi.logout` ran `unwrap(env)` (which passes null through, since
null is defined) and then `LogoutResponse.fromJson(null)`, which
Zod-parses as `z.object(...)` and throws "Invalid input: expected
object, received null".

The error was caught in `AuthRepository.logout` with
`console.warn(... clearing local anyway)` — logout actually still
worked (local clear ran), but a noisy red ZodError hit the console on
every logout click.

Fix: align `AuthApi.logout` with the existing fire-and-forget pattern
used by `register` and `sendCode` — call `httpClient` and ignore the
response body. Drop the now-unused `LogoutResponse` import.

`AuthRepository.logout` already discards the return value, so the
`Promise<LogoutResponse> → Promise<void>` signature change is safe.

Bundled in this commit (unrelated):
- chat-machine.actors.ts / user-machine.ts: removed stale design-doc
  comment blocks (IDE/linter cleanup)
- user-machine.actors.ts: removed redundant `userStorage.clearUserData()`
  from `userLogoutActor` — `authRepo.logout` already clears local
  user data, so this was a no-op duplicate.
- sidebar-screen.tsx: removed one stale comment line.
2026-06-16 18:34:55 +08:00
admin dcb6312fa3 feat(chat): add quota-exhausted banner for guest users
Introduce ChatQuotaExhaustedBanner component that displays a pink gradient
banner with an "Unlock your membership to continue" CTA when a guest user's
free chat quota has been exhausted. The banner is shown in ChatScreen when
isGuest is true, quota has loaded, and the chat state machine's
quotaExceededTrigger has been incremented by a quota guard. Default click
navigates to /subscription, with an optional onUnlock callback for
overrides/tests. Styles align with the existing splash and sidebar VIP
card visual language.
2026-06-16 15:18:11 +08:00
admin 9ffa30cc03 style: remove markdown bold syntax from code comments
Remove `**...**` emphasis markers from inline comments and JSDoc blocks across
auth and chat components, machine mappers, and quota helpers. These are
plain code comments, not rendered markdown, so the bold syntax was noise.

Files touched:
- src/app/auth/components/auth-screen.tsx
- src/app/chat/components/chat-header.tsx
- src/app/chat/components/chat-screen.tsx
- chat machine mapper / quota helpers

No functional or behavioral changes.
2026-06-16 14:06:31 +08:00
admin 29776272ad fix(auth): handle null backend values and surface login errors on splash
Two related fixes for OAuth login failures:

- `UserSchema`: backend (Facebook/Apple) returns `null` for fields like
  `email`; Zod's `.default("")` rejects `null`, causing silent login
  failures. Introduce `stringOrEmpty` / `numberOrZero` / `booleanOrFalse`
  helpers (`nullable().transform(v => v ?? x).default(x)`) and apply
  across the schema so input accepts `string | null | undefined` while
  output stays the typed primitive.

- `SplashScreen`: render `state.errorMessage` (set by auth state machine
  `onError`, e.g. Facebook sync / schema mismatch) so users no longer
  get stuck on splash without feedback.
2026-06-16 11:10:21 +08:00
admin e44cc7e2f3 feat(sidebar): redesign sidebar UI with three user states (light theme)
Replace the dark sidebar theme with a light-themed three-state UI
matching the design references:

- guest  : pink "login" pill in user row, no status pill on VIP card,
           "Activate VIP Membership" button shown
- member : "VIP membership not activated" subtitle, no status pill,
           "Activate VIP Membership" button shown
- vip    : pink "VIP Member" pill with diamond icon, "Activated" pill
           in VIP card header, no Activate button

Decompose into BackBar, UserHeader, VipBenefitsCard, and VoicePackageCard
under src/app/sidebar/components/. Delete obsolete GuestPanel,
UserInfoCard, and VipCta.

Lift VIP_BENEFITS to a shared src/data/constants/vip-benefits.ts so the
sidebar and subscription page render identical benefit copy.

Add five sidebar tokens (--color-card-surface, --color-voice-gradient-*
--border-card, --shadow-card, --color-pill-bg) to src/tokens/colors.css.

Includes barrelsby regeneration for src/app/sidebar/components and
side-effect barrel updates under src/stores/{auth,chat,sidebar,user},
plus package-lock.json from npm install (required for lint/typecheck).

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-16 10:30:21 +08:00