-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: prevent console error messages on checkout shipping page (#1040)
- Loading branch information
Showing
7 changed files
with
48 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 18 additions & 16 deletions
34
src/app/pages/checkout-shipping/formly/shipping-info/shipping-info.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
<span>{{ shippingMethod?.name }}:</span> | ||
<strong *ngIf="shippingMethod?.shippingCosts">{{ shippingMethod?.shippingCosts | ishPrice }} </strong> | ||
<span *ngIf="shippingMethod?.shippingTimeMin && shippingMethod?.shippingTimeMax" class="form-text form-text-inline"> | ||
{{ 'checkout.shipping.delivery_time.description' | translate }} | ||
<span *ngIf="shippingMethod?.shippingTimeMin === 0 && shippingMethod?.shippingTimeMax === 1"> | ||
{{ 'checkout.shipping.delivery_time.within24' | translate }} | ||
<ng-container *ngIf="shippingMethod$ | async as shippingMethod"> | ||
<span>{{ shippingMethod.name }}:</span> | ||
<strong *ngIf="shippingMethod.shippingCosts">{{ shippingMethod.shippingCosts | ishPrice }} </strong> | ||
<span *ngIf="shippingMethod.shippingTimeMin && shippingMethod.shippingTimeMax" class="form-text form-text-inline"> | ||
{{ 'checkout.shipping.delivery_time.description' | translate }} | ||
<span *ngIf="shippingMethod.shippingTimeMin === 0 && shippingMethod.shippingTimeMax === 1"> | ||
{{ 'checkout.shipping.delivery_time.within24' | translate }} | ||
</span> | ||
<span *ngIf="shippingMethod.shippingTimeMin === 0 && shippingMethod.shippingTimeMax > 1"> | ||
{{ 'checkout.shipping.delivery_time.within' | translate: { '0': shippingMethod?.shippingTimeMax } }} | ||
</span> | ||
<span *ngIf="shippingMethod.shippingTimeMin > 0"> | ||
{{ | ||
'checkout.shipping.delivery_time' | ||
| translate: { '0': shippingMethod.shippingTimeMin, '1': shippingMethod.shippingTimeMax } | ||
}} | ||
</span> | ||
</span> | ||
<span *ngIf="shippingMethod?.shippingTimeMin === 0 && shippingMethod?.shippingTimeMax > 1"> | ||
{{ 'checkout.shipping.delivery_time.within' | translate: { '0': shippingMethod?.shippingTimeMax } }} | ||
</span> | ||
<span *ngIf="shippingMethod?.shippingTimeMin > 0"> | ||
{{ | ||
'checkout.shipping.delivery_time' | ||
| translate: { '0': shippingMethod?.shippingTimeMin, '1': shippingMethod?.shippingTimeMax } | ||
}} | ||
</span> | ||
</span> | ||
</ng-container> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 15 additions & 3 deletions
18
src/app/pages/checkout-shipping/formly/shipping-info/shipping-info.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,24 @@ | ||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; | ||
import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core'; | ||
import { Observable } from 'rxjs'; | ||
|
||
import { CheckoutFacade } from 'ish-core/facades/checkout.facade'; | ||
import { ShippingMethod } from 'ish-core/models/shipping-method/shipping-method.model'; | ||
|
||
@Component({ | ||
selector: 'ish-shipping-info', | ||
templateUrl: './shipping-info.component.html', | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class ShippingInfoComponent { | ||
@Input() shippingMethod: ShippingMethod; | ||
export class ShippingInfoComponent implements OnInit { | ||
@Input() shippingMethodId: string; | ||
|
||
shippingMethod$: Observable<ShippingMethod>; | ||
|
||
constructor(private checkoutFacade: CheckoutFacade) {} | ||
|
||
ngOnInit(): void { | ||
if (this.shippingMethodId) { | ||
this.shippingMethod$ = this.checkoutFacade.shippingMethod$(this.shippingMethodId); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters