Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 1x 1x 1x 1x 1x 1x 4x 4x 4x 4x 4x 5x 4x 1x 1x | import { ChangeDetectionStrategy, Component, Signal, inject } from '@angular/core';
import { toSignal } from '@angular/core/rxjs-interop';
import { ActivatedRoute } from '@angular/router';
import { map } from 'rxjs';
import { WithdrawalFacade } from 'ish-core/facades/withdrawal.facade';
import { Withdrawal } from 'ish-core/models/withdrawal/withdrawal.model';
/**
* Page component for the right-of-withdrawal request flow.
*
* Orchestrates the two-step withdrawal process:
* 1. The customer enters the order number and email to look up the order (`createWithdrawal`).
* 2. The customer confirms and submits the full withdrawal request (`submitWithdrawal`).
*/
@Component({
selector: 'ish-withdrawal-request-page',
standalone: false,
templateUrl: './withdrawal-request-page.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [WithdrawalFacade],
})
export class WithdrawalRequestPageComponent {
withdrawal = this.withdrawalFacade.withdrawal;
loading = this.withdrawalFacade.loading;
error = this.withdrawalFacade.error;
initialized = this.withdrawalFacade.initialized;
params: Signal<{ orderDocumentNumber: string; orderEmail: string }> = toSignal(
inject(ActivatedRoute).queryParamMap.pipe(
map(params => ({ orderDocumentNumber: params.get('orderDocumentNumber'), orderEmail: params.get('orderEmail') }))
)
);
constructor(private withdrawalFacade: WithdrawalFacade) {}
createWithdrawal(data: Withdrawal) {
this.withdrawalFacade.createWithdrawal(data);
}
submitWithdrawal(data: Withdrawal) {
this.withdrawalFacade.sendWithdrawal(data);
}
}
|