fix: cart email/phone capture form was never rendered
recordOrder() and autoSubmitPurchase() read userEmail()/userPhone() signals and submitEmail() was fully implemented (validation, error handling), but the success screen's template never rendered the inputs - so the form was unreachable and the fallback auto-submit always sent blank email/phone. - Added the email/phone form to the payment-success screen, wired to the existing signals/handlers. - autoSubmitPurchase() (the 5s fallback if the user doesn't submit manually) no longer navigates home via an unconditional setTimeout(0) fired before the submission result is known - it now waits for submitPurchaseEmail() to settle, same as the manual path, and skips entirely if the user already submitted (new purchaseSubmitted flag). - It also now sends whatever the user has typed instead of hardcoded-blank fields, and shows a toast instead of only logging to console when no Telegram user id is available. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -271,6 +271,44 @@
|
||||
<div class="payment-status-screen success" role="status" aria-live="polite">
|
||||
<div class="success-icon" aria-hidden="true">✓</div>
|
||||
<h2>{{ 'cart.paymentSuccess' | translate }}</h2>
|
||||
@if (!purchaseSubmitted()) {
|
||||
<p>{{ 'cart.paymentSuccessDesc' | translate }}</p>
|
||||
<form class="contact-capture-form" (ngSubmit)="submitEmail()">
|
||||
<label>
|
||||
<input
|
||||
type="email"
|
||||
name="email"
|
||||
[value]="userEmail()"
|
||||
[placeholder]="'cart.emailPlaceholder' | translate"
|
||||
[attr.aria-invalid]="!!emailError()"
|
||||
(input)="onEmailInput($event)"
|
||||
(blur)="onEmailBlur()"
|
||||
[disabled]="emailSubmitting()"
|
||||
/>
|
||||
@if (emailError()) {
|
||||
<span class="field-error">{{ emailError() }}</span>
|
||||
}
|
||||
</label>
|
||||
<label>
|
||||
<input
|
||||
type="tel"
|
||||
name="phone"
|
||||
[value]="userPhone()"
|
||||
[placeholder]="'cart.phonePlaceholder' | translate"
|
||||
[attr.aria-invalid]="!!phoneError()"
|
||||
(input)="onPhoneInput($event)"
|
||||
(blur)="onPhoneBlur()"
|
||||
[disabled]="emailSubmitting()"
|
||||
/>
|
||||
@if (phoneError()) {
|
||||
<span class="field-error">{{ phoneError() }}</span>
|
||||
}
|
||||
</label>
|
||||
<button type="submit" [disabled]="emailSubmitting()">
|
||||
{{ emailSubmitting() ? ('cart.sending' | translate) : ('cart.send' | translate) }}
|
||||
</button>
|
||||
</form>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user