import { LivestreamingProps } from './livestreaming'; import { PlayerProduct } from './Product'; export declare enum AddToCartActionTypes { OPEN_TAB = "openTab", OPEN_VARIATION_SELECTOR = "openVariationSelector", ADD_TO_CART = "addToCart" } export type AddToCartPlayerSettings = Pick; type AddToCartCreateAction = (data: T) => AddToCartAction; type AddToCartCreateActionExec = (data: T) => any; export type AddToCartAction = { type: AddToCartActionTypes; exec: () => any; }; /** * The keys must be coincide with "AddToCartHookActionTypes" enum values */ export type AddToCartActionFactory = { openTab: AddToCartCreateAction; openVariationSelector: AddToCartCreateAction; addToCart: AddToCartCreateAction; }; export type AddToCartActionFactoryMap = { openTab: AddToCartCreateActionExec; openVariationSelector: AddToCartCreateActionExec; addToCart: AddToCartCreateActionExec; }; type TransformHookContext = { product: PlayerProduct; playerSettings: AddToCartPlayerSettings; }; type ValidateHookContext = { product: PlayerProduct; playerSettings: AddToCartPlayerSettings; defaultAction: AddToCartAction; action: AddToCartActionFactory; }; type AddToCartCreateNotify = (message: string) => void; export type AddToCartNotifyFactory = { error: AddToCartCreateNotify; success: AddToCartCreateNotify; }; type EndHookContext = { playerSettings: AddToCartPlayerSettings; error: Error | string | null | unknown; notify: AddToCartNotifyFactory; actionExecuted: AddToCartAction; }; interface AddToCartHooks { transform: (context: TransformHookContext) => PlayerProduct | Promise; validate: (context: ValidateHookContext) => AddToCartAction | Promise; end: (context: EndHookContext) => void | boolean | Promise; } export interface AddToCartConfig { hooks?: Partial; actionFactory?: Partial; } export {};