Short messages in the corner after an action (saved, failed, reminder).
Mounted with
CDK
Overlay. Errors stay until dismissed; warnings linger longer; identical
messages collapse into one with a count. Enable with provideAfricaniesToasts().
`,
})
export class ToastPage {
private readonly toast = inject(ToastService);
protected readonly variantsCode = TOAST_VARIANTS;
protected readonly stackCode = TOAST_STACK;
protected readonly httpCode = TOAST_HTTP;
protected showInfo(): void {
this.toast.info('Cutoff is in 2 hours for this lane.', 'Reminder');
}
protected showSuccess(): void {
this.toast.success('Shipment saved', 'Done');
}
protected showWarning(): void {
this.toast.warning('Rates may be outdated. Refresh before quoting.');
}
protected showError(): void {
this.toast.error('Could not reach the carrier API.', 'Request failed');
}
protected showManyErrors(): void {
for (const name of [
'FedEx',
'UPS',
'DHL',
'USPS',
'OnTrac',
'LaserShip',
'Amazon',
'XPO',
]) {
this.toast.error(`Could not reach ${name}.`, 'Request failed');
}
}
protected clearAll(): void {
this.toast.clear();
}
protected spamError(): void {
this.toast.error('Warehouse offline', 'Sync failed');
}
protected simulateOk(): void {
this.toast.success('Shipment created');
}
protected simulateFail(): void {
this.toast.error('Could not create shipment', 'Request failed');
}
protected simulateSilentOk(): void {
this.toast.info('Finished with withToast({ success: false }) — no success toast.');
}
}