import '@vaadin/vaadin-text-field/vaadin-integer-field'; import { CSSResultArray, PropertyDeclarations, TemplateResult } from 'lit-element'; import { ImageDescription, ItemInterface } from '../types'; import { SignableFields } from './SignableFields'; /** * This component allows a user to configure an item. * * The item may be configured using HTML properties or a JS object. * * @csspart picture - Image of the product in preview stack (for single products) or grid (for bundles). * @csspart item - The root element inside of the shadow dom. */ export declare class Item extends SignableFields { /** @readonly */ static get styles(): CSSResultArray; /** @readonly */ static get scopedElements(): Record; /** @readonly */ static get properties(): PropertyDeclarations; readonly rel = "product_item"; /** * **Required** the name of the item. * * **Example:** `"Dog food"` */ name?: string; /** * **Required** the price of a unit of this item * * **Example:** `10` */ price?: number; /** * Makes quantity input readonly. */ readonly: boolean; /** * Optional an image url to be displayed in the form. */ image?: string; /** * Optional the alt text for the image */ alt?: string; /** * Optional an image url to be displayed in the foxy cart once the custumer reaches the cart. */ url?: string; /** * Optional item code. This property affects cart UI only. * See [Products](https://wiki.foxycart.com/v/2.0/products) wiki for more details. * * **Example:** `"ISBN 978-0-12-345678-9"` */ code?: string | number; /** * Optional parent code. This property affects cart UI only. * It causes Foxy Cart to recognize the parent-child relationship between two items. * * Nested items set this property automatically. * * **Example:** `"ISBN 978-0-12-345678-9"` */ parent_code?: string | number; /** * **Required** The quantity of this item in the cart. */ quantity: number; /** * Optional quantity max. The maximum number of items of these to be added. */ quantity_max?: number; /** * Optional quantity min. The minimum number of items of these to be added. */ quantity_min?: number; /** * Optional category. Sets the category this item is in. * See [Products](https://wiki.foxycart.com/v/2.0/products) wiki for more details. * * **Example:** `"heavy"` */ category?: string; /** * Optional expires. Sets the expiration time of this item. * * Advanced usage only: This property affects cart UI only. * This web component will not react to this property. * * The item cannot be purchased after expiration, but if it is part of a * subscription, it remains in the subscription as long as it stands. * * See [Products](https://wiki.foxycart.com/v/2.0/products) wiki for more details. * * **Example:** `15` */ expires?: string; /** * Optional per item weight. This property affects cart UI only. */ weight?: number; /** * Optional. Specify a ship-to address for a specific item. * * Advanced usage only: This property affects cart UI only. * This element does not provide any means for the user to specify this property. */ shipto?: string; /** * Optional length. This property affects cart UI only. */ length?: number; /** * Optional width. This property affects cart UI only. */ width?: number; /** * Optional height. This property affects cart UI only. */ height?: number; /** * The total price of this item. * * It takes into account child items and the quantity. */ total?: number; /** * 3-letter lowercase currency code. * It is provided by the form if not set. * * **Example:** `"usd"` */ currency: string; /** A boolean indicating that this element is a item **/ protected isItem: boolean; /** Boolean indicating that this item is a child item */ protected isChildItem: boolean; /** * A unique id set to the item. Advanced usage only. */ readonly pid: number; private static __existingIds; private __childItemsObserver?; private __modified; private __childPrices; private __images; private __childrenCount; private __itemDescription; private __handleQuantity; constructor(); /** * Each child item is an object that can have any of the public properties of this element. * Child elements will be created accordingly. */ get items(): ItemInterface[]; /** * Creates child elements from ItemInterface[] */ set items(value: ItemInterface[]); get value(): ItemInterface; set value(v: ItemInterface); updated(changedProperties: Map): void; render(): TemplateResult; getImageDescription(): ImageDescription; /** * Items have their signed names prefixed with their id. * * @argument fieldName the name of the field to get the signed version. * @argument open whether this field is editable by the user. * @returns signed version of the name, prefixed with the item id. */ signedName(fieldName: string): string; /** * Creates a new unique id to be used in the form * * Ids are used to distinguish different items in a single form. * Ids are prepended to fields names to allow Foxy Cart to know to what * item a particular field relates. * * @return number the newly created id */ private static __newId; private __updateDescriptionEl; /** * Add an element to the default slot */ private __addSlottedEl; /** * Creates a code if none is provided by the user */ private __setCode; /** * Create child items from items field. */ private __createItems; private __setTotalPrice; /** * The price of the total qty of each of the child items */ private __computeTotalPrice; /** * Constraints Items must eventually adhere to. **/ private __isValid; private __translateAmount; private __observeItems; private __acknowledgeChildItems; private __acknowledgeItem; /** React to changes in child items */ private __changedChildItem; /** Execute a list of actions against all child items */ private __onEachChildItem; }