- Backend: payment_sessions + pairing_failures tables; payment.service.js and pairing-failure.service.js (new); rewritten pairing.service.js (payment-gated blast + targeted "Curhat lagi" + cancel + fallback); rewritten extension.service.js (data-driven auto-approve with offline safeguard, charge-at-approval); pricing.service.js (extension tiers without free trial); mitra-status.service.js (countAvailableMitras cached path); 60s sweeper for stale payment sessions - Backend routes: client.payment.routes, client.mitra-availability.routes, internal/failed-pairings.routes; client.chat.routes rewritten for payment-gated start + /returning + /cancel + /fallback-to-blast; internal/config.routes adds 4 new keys with Valkey invalidate publish - client_app: mitra-availability poll, payment screen + notifier, pairing notifier rewrite (PairingTargetedWaiting + PairingFailed states), targeted-waiting overlay + bestie-unavailable dialog, "Curhat lagi" CTA, failed-pairing terminal, extension via payment-session - mitra_app: PairingRequestType enum, returning-chat 20s countdown auto-dismiss, extension card "otomatis disetujui" copy - control_center: 4 new config rows in Settings, Failed Pairings page (filter + paginate + action menu), sidebar + route registered - Test infrastructure: Vitest backend (7/7 pass), Playwright CC (4/4 pass), Maestro mobile scaffold (CLI install pending) - Bugs found via Playwright + fixed: LoginPage labels not associated with inputs (a11y); backend internal CORS missing PATCH/PUT/DELETE in allow-methods (silent settings breakage in browsers since Stage 4) - Docs: phase3.7.md PRD, phase3.7-plan.md, phase3.7-questions.md (Q&A), phase3.7-testing.md (E2E checklist), phase3.7-test-run-2026-05-03.md (today's run results) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
71 lines
2.9 KiB
Dart
71 lines
2.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import '../../../core/pairing/pairing_notifier.dart';
|
|
|
|
/// Full-screen modal overlay shown above the searching screen during the 20s
|
|
/// targeted-mitra wait window. The overlay reads its state directly from the
|
|
/// [PairingTargetedWaitingData] passed in by the parent — the local countdown
|
|
/// ticks are owned by the pairing notifier so the overlay just renders.
|
|
///
|
|
/// "Batalkan" calls `pairingNotifier.cancelSearch()` which posts to
|
|
/// `/api/client/chat/chat-requests/cancel` and transitions state to
|
|
/// `PairingCancelledData`. The parent screen listens for that and pops home.
|
|
class TargetedWaitingOverlay extends ConsumerWidget {
|
|
final PairingTargetedWaitingData waiting;
|
|
|
|
const TargetedWaitingOverlay({super.key, required this.waiting});
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
return Container(
|
|
// Slight scrim so the underlying searching UI is still visible but the
|
|
// overlay clearly owns the foreground.
|
|
color: Colors.black.withValues(alpha: 0.55),
|
|
child: Center(
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 32),
|
|
child: Card(
|
|
elevation: 6,
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
|
child: Padding(
|
|
padding: const EdgeInsets.fromLTRB(24, 24, 24, 16),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
const SizedBox(
|
|
width: 56,
|
|
height: 56,
|
|
child: CircularProgressIndicator(strokeWidth: 3),
|
|
),
|
|
const SizedBox(height: 20),
|
|
Text(
|
|
'Menunggu konfirmasi ${waiting.mitraName}',
|
|
textAlign: TextAlign.center,
|
|
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
'${waiting.secondsRemaining}d',
|
|
style: const TextStyle(fontSize: 28, fontWeight: FontWeight.w300),
|
|
),
|
|
const SizedBox(height: 8),
|
|
const Text(
|
|
'Bestie punya 20 detik untuk merespon. Kalau tidak ada respon, kami bantu cari bestie lain.',
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(fontSize: 13, color: Colors.grey),
|
|
),
|
|
const SizedBox(height: 16),
|
|
TextButton(
|
|
onPressed: () => ref.read(pairingProvider.notifier).cancelSearch(),
|
|
child: const Text('Batalkan'),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|