@spartacus/storefront
Version:
Spartacus Storefront is a package that you can include in your application, which allows you to add default storefront features.
56 lines (55 loc) • 2.84 kB
TypeScript
import { ChangeDetectorRef, OnDestroy, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { ActiveCartService, CmsAddToCartComponent, Product } from '@spartacus/core';
import { Observable, Subscription } from 'rxjs';
import { CmsComponentData } from '../../../cms-structure/page/model/cms-component-data';
import { ModalRef } from '../../../shared/components/modal/modal-ref';
import { ModalService } from '../../../shared/components/modal/modal.service';
import { CurrentProductService } from '../../product/current-product.service';
import * as i0 from "@angular/core";
export declare class AddToCartComponent implements OnInit, OnDestroy {
protected modalService: ModalService;
protected currentProductService: CurrentProductService;
protected cd: ChangeDetectorRef;
protected activeCartService: ActiveCartService;
protected component?: CmsComponentData<CmsAddToCartComponent>;
productCode: string;
showQuantity: boolean;
/**
* As long as we do not support #5026, we require product input, as we need
* a reference to the product model to fetch the stock data.
*/
product: Product;
maxQuantity: number;
modalRef: ModalRef;
hasStock: boolean;
inventoryThreshold: boolean;
showInventory$: Observable<boolean | undefined> | undefined;
quantity: number;
protected numberOfEntriesBeforeAdd: number;
subscription: Subscription;
addToCartForm: FormGroup;
constructor(modalService: ModalService, currentProductService: CurrentProductService, cd: ChangeDetectorRef, activeCartService: ActiveCartService, component?: CmsComponentData<CmsAddToCartComponent>);
/**
* @deprecated since 4.1
*/
constructor(modalService: ModalService, currentProductService: CurrentProductService, cd: ChangeDetectorRef, activeCartService: ActiveCartService);
ngOnInit(): void;
protected setStockInfo(product: Product): void;
/**
* In specific scenarios, we need to omit displaying the stock level or append a plus to the value.
* When backoffice forces a product to be in stock, omit showing the stock level.
* When product stock level is limited by a threshold value, append '+' at the end.
* When out of stock, display no numerical value.
*/
getInventory(): string;
updateCount(value: number): void;
addToCart(): void;
/**
* Provides required data and opens AddedToCartDialogComponent modal
*/
protected openModal(): void;
ngOnDestroy(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<AddToCartComponent, [null, null, null, null, { optional: true; }]>;
static ɵcmp: i0.ɵɵComponentDeclaration<AddToCartComponent, "cx-add-to-cart", never, { "productCode": "productCode"; "showQuantity": "showQuantity"; "product": "product"; }, {}, never, never>;
}