import { Injectable } from '@angular/core' ; import { BREAKPOINT , PageLayoutHandler } from '@spartacus/storefront' ; import { Observable } from 'rxjs' ; import { Router } from '@angular/router' ; import { map } from 'rxjs/operators' ; import { CHECKOUT_REVIEW_ORDER_PATH , checkoutSkipSlots , } from './config/checkout.config' ; @ Injectable ( { providedIn : 'root' , } ) export class CheckoutReviewPageLayoutHandler implements PageLayoutHandler { constructor ( private router ) { } handle ( slots , pageTemplate ? , section ? , breakpoint ? ) { return slots . pipe ( map ( ( _slots ) => { if ( this . isCheckoutReviewRoute ( ) ) { return this . filterCheckoutSlots ( _slots ) ; } else { return _slots ; } } ) ) ; } filterCheckoutSlots ( slots ) { return slots . filter ( ( slot ) => ! checkoutSkipSlots . includes ( slot ) ) ; } isCheckoutReviewRoute ( ) { return this . router . url === CHECKOUT_REVIEW_ORDER_PATH ; } }