Customer-driven session end flow: - AppBar 'akhiri' action on chat_screen (visible when connected and not already closing). - Tap fires confirm_end_step1 HaloPopup. lanjut akhiri -> step2; gak jadi balik -> dismiss, stay in chat. - confirm_end_step2 HaloPopup. tulis pesan penutup -> closing_message_sheet HaloBottomSheet (textarea + kirim & akhiri / lewat — langsung akhiri). lewati saja closes immediately. - Both close paths POST /api/client/session/:sessionId/end via session_closure_notifier.closeSession() and route to /chat/thank-you. - 409 from the close endpoint surfaces a ClosureRejectedByMitraData state and a stub HaloPopup with TODO(stage8) for the BestieOfflinePopup returning variant. Removed the legacy _showSessionExpiredDialog modal — Stage 6's ChatExpiredBanner is the replacement notification. Inline _buildGoodbyeView retained with a TODO for the mitra-side early end flow (still reaches it). endSessionTwoStepConfirmProvider hardcoded to true with a TODO — the Stage 1.5 app_config row exists but no client-readable config endpoint exists yet. Flip the provider to a FutureProvider once the read endpoint ships. Maestro 07_end_session_2step.yaml chains after the chat-happy flow and asserts the Indonesian copy at each step. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
28 lines
941 B
Dart
28 lines
941 B
Dart
import 'package:flutter/material.dart';
|
|
import '../../../core/theme/widgets/halo_popup.dart';
|
|
|
|
/// Stage 7 — second confirm popup. Customer has already chosen to end; this
|
|
/// step nudges (not forces) them to leave a closing message, with `lewati saja`
|
|
/// as the bypass into the close-session API directly.
|
|
class ConfirmEndStep2 {
|
|
const ConfirmEndStep2._();
|
|
|
|
static Future<void> show(
|
|
BuildContext context, {
|
|
required VoidCallback onWriteMessage,
|
|
required VoidCallback onSkip,
|
|
}) {
|
|
return HaloPopup.show<void>(
|
|
context,
|
|
title: 'mau tinggalin pesan penutup?',
|
|
body: 'kamu bisa tulis pesan terakhir buat bestie sebelum sesi ditutup',
|
|
icon: const Text('💌', style: TextStyle(fontSize: 40)),
|
|
primary: HaloPopupAction(
|
|
label: 'tulis pesan penutup',
|
|
onPressed: onWriteMessage,
|
|
),
|
|
secondary: HaloPopupAction(label: 'lewati saja', onPressed: onSkip),
|
|
);
|
|
}
|
|
}
|