import React, { ReactElement } from "react"; import { UseFormRegisterReturn } from "react-hook-form"; import { UseTransitionProps } from "react-spring"; import { IProduct, IOrder, IProductStateSelected, IProductStateFilter, EOrderPaymentType, IKioskError, TUpsellKind, ICategory } from "./index"; import { IOrderLine } from "./index"; import { IStringKeyRecord } from "./utils"; export declare enum EPaymentStatus { UNINITIALIZED = "UNINITIALIZED", PROCESSING = "PROCESSING", PARTIALLY_PAID = "PARTIALLY_PAID", PAID = "PAID", FAILED = "FAILED", PRINTING_RECEIPT = "PRINTING_RECEIPT", PRINTING_RECEIPT_SUCCESS = "PRINTING_RECEIPT_SUCCESS", SENDING_RECEIPT = "SENDING_RECEIPT", SENDING_RECEIPT_SUCCESS = "SENDING_RECEIPT_SUCCESS", ERROR = "ERROR" } /** * Theme interface * @interface ITheme * @ */ export interface ITheme { "--color-primary": string; "--color-primary-light": string; "--color-primary-dark": string; "--color-secondary": string; "--color-grey-light": string; "--color-red": string; "--color-red-light": string; "--fontFamily": string; "--fontFamily-upper": string; "--color-background": string; "--color-btn-primary": string; "--color-btn-secondary": string; "--color-btn-disabled": string; "--font-color-btn-primary": string; "--font-color-btn-secondary": string; "--font-color-btn-disabled": string; "--font-color-bg-primary": string; "--product-tile-border-color": string; [property: string]: string; } export interface IMenuProps { menu: IProduct[]; handleSelectProduct: (product: IProduct | string) => void; fallbackImg?: string; lazyLoadImg?: boolean; currency?: string; timeZone?: string; availabilityMarkOnly?: boolean; availabilityCheckInterval?: number; cols?: number; colsLg?: number; stacking: "vertical" | "horizontal"; transitionProps?: UseTransitionProps; onMenuCategoryViewed?: (category: IProduct) => void; goToCheckout: (state?: any) => void; goToStart: (state?: any) => void; order?: IOrder; changeQuantity: (line: IOrderLine, quantity: number) => void; components: IMenuComponents; onSelectCategory?: (id: string) => void; } export interface IMenuTileProps { product: IProduct; onProductClicked: (product: IProduct | string) => void; fallbackImg: string; currency?: string; lazyLoadImg?: boolean; category?: IProduct; isDisabled?: boolean; rewardsPrice?: ReactElement; isRewardsCategory?: boolean; setCategoryWithScroll?: (ICategory: ICategory) => void; } export interface IMenuCategorySectionProps { category: IProduct; onProductClicked: (IProduct: IProduct | string) => void; fallbackImg: string; lazyLoadImg?: boolean; currency?: string; cols?: number; colsLg?: number; MenuTile?: React.FC; setCategoryWithScroll?: (ICategory: ICategory) => void; selectedCategory?: ICategory; menu?: IProduct[]; } export interface IMenuTopNavProps { goToStart: (state?: any) => void; goToCheckout: (state?: any) => void; order?: IOrder; } export interface IMenuBottomNavProps { order?: IOrder; currency?: string; goToCheckout?: (state?: any) => void; fallbackImg?: string; changeQuantity: (line: IOrderLine, quantity: number) => void; } /** * @interface IMenuUpsizeProps * @property {Array|undefined} products products to offer as upsize * @property {IProduct|undefined} product original product being upsized */ export interface IMenuUpsizeProps { show: boolean; onClose: () => void; products?: IProduct[]; product?: IProduct; onProductClicked: (prod: IProduct) => void; currency: string; } export interface IMenuComponents { TopNav?: React.FC; BottomNav?: React.FC; MenuTile?: React.FC; CategorySection?: React.FC; Header?: ReactElement; Logo?: ReactElement; Upsize?: React.FC; } export interface IProductConfiguratorProps { product: IProduct; components: IProductConfiguratorComponents; currency: string; isOpen?: boolean; showDebugState?: boolean; lang?: string; handleAddToCart: (data: IAddToCartData) => void; handleGoBack: () => void; handleClose?: () => void; } export interface IAddToCartData { price: number; quantity: number; selected: IProductStateSelected; filter: IProductStateFilter; } export interface IProductConfiguratorComponents { MenuProductRootUI?: React.FC; MenuItemsUI?: React.FC; MenuOptionsUI?: React.FC; MenuProductUI?: React.FC; } export interface IMenuProductRootUIProps { product: IProduct; countedProductPrice: number; countedProductTotalPrice: number; productQuantity: number; showDebugState?: boolean; children: ReactElement; validationMap: { [selCtx: string]: { isValid: boolean; }; }; isOpen?: boolean; currency: string; increaseProductQuantity: () => void; decreaseProductQuantity: () => void; handleOnSubmit: () => void; handleGoBack: () => void; handleClose?: () => void; } export interface IMenuOptionsUIProps { optionsItem: IProduct; parentSelCtx: string; selected: IProductStateSelected; isOnSubmitted: boolean; actualQtyCnt: number; actualSelCnt: number; currency: string; children: ReactElement; nestedLvl: number; } export interface IMenuProductUIProps { product: IProduct; nestedLvl: number; registerProps: UseFormRegisterReturn; inputId: string; radioInputValue: string; isRadio: boolean; isCheckbox: boolean; isCounter: boolean; isDecrementEnabled: boolean; isIncrementEnabled: boolean; isChecked: boolean; isCheckboxEnabled: boolean; counterValue: number; handleCounterIncrementQty: () => void; handleCounterDecrementQty: () => void; currency: string; children: ReactElement; parentProduct?: IProduct; } export interface IMenuItemsUIProps { productItems: IProduct[]; parentProduct: IProduct; rootProduct: IProduct; renderMenuItem: (item: IProduct) => ReactElement; } export interface IMenuComponentProps extends IHandleUpsells { addedLine: IOrderLine | undefined; dismissAddedLine: () => void; addedLines: IOrderLine[] | undefined; dismissAddedLines: () => void; addProductToOrder: (product: IAddProductToOrderPayload) => void; getProductsByIds: (ids: string[], menu: IProduct[]) => Promise; trackProductSelected: (product: IProduct) => void; menu: IProduct[]; onMenuCategoryViewed?: (category: IProduct) => void; goToCheckout: (state?: any) => void; goToStart: (state?: any, statusInfo?: string, inactivity?: boolean) => void; order?: IOrder; changeQuantity: (line: IOrderLine, quantity: number) => void; components: IMenuComponents & { ProductConfigurator: React.FC>; }; currency?: string; timeZone?: string; } export interface ICheckoutComponentProps extends IHandleUpsells { checkoutStatus?: EPaymentStatus; checkoutError?: IKioskError; postPaymentError?: IKioskError; initializePayment: (type: EOrderPaymentType) => void; initializePrinting: () => void; navigateToMainScreen: () => void; removeLines: (line: IOrderLine | IOrderLine[]) => void; changeQuantity: (line: IOrderLine, quantity: number) => void; order?: IOrder; addProduct: (product: IProduct, data: IAddToCartData) => void; onCheckoutBegun: () => void; abandonOrder: (statusInfo?: string) => void; currency: string; } export interface IErrorComponentProps { errors: IKioskError[]; } export interface IHandleUpsells { getUpsellProducts: (kind: TUpsellKind) => Promise; haveUpsellProducts: (kind: TUpsellKind) => boolean; clearUpsell: (kind: TUpsellKind) => void; clearUpsells: () => void; } export interface IAddProductToOrderPayload extends IProduct { comment?: string; extra?: IStringKeyRecord; }