@kosdev-code/kos-dispense-sdk 2.1.9 → 2.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"pump-provider-BK8kyTyX.js","sources":["../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/assembly/use-assembly.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/assembly/with-assembly.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/availability/use-availability.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/availability/with-availability.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/board/use-board.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/board/with-board.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/board-container/use-board-container.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/board-container/with-board-container.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/nozzle/use-nozzle.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/contexts/nozzle/nozzle-provider.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/cui-kit/use-beverages.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/cui-kit/use-brands.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/utils/pour-context.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/utils/pour-strategy/hold-to-pour-strategy.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/nozzle-pour/use-nozzle-pour.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/cui-kit/use-flavors.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/cui-kit/use-cui-kit.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/cui-kit/use-ambient-attract-timers.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/cui-kit/use-dispense-lifecycle.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/cui-kit/use-dispense-timers.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/cui-kit/use-default-cui-kit-lifecycle.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/device-assembly/use-device-assembly.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/device-assembly/with-device-assembly.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/holder/use-holder.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/holder/with-holder.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/holder-container/use-holder-container.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/holder-container/with-holder-container.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/ingredient/use-ingredient.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/utils/pour-strategy/hold-to-pour-intent-strategy.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/ingredient/use-ingredient-pour.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/ingredient/with-ingredient.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/ingredient-container/use-ingredient-container.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/ingredient-container/with-ingredient-container.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/nozzle/with-nozzle.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/pour/use-pour.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/utils/pour-strategy/tap-or-hold-to-pour-intent-strategy.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/utils/pour-strategy/tap-to-pour-intent-strategy.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/utils/pour-strategy/tap-to-pour-strategy.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/generic-pour/use-generic-pour.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/generic-pour/with-generic-pour.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/contexts/assembly/assembly-provider.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/contexts/availability/availability-provider.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/contexts/board/board-provider.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/contexts/board-container/board-container-provider.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/contexts/device-assembly/device-assembly-provider.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/contexts/cui-kit/cui-kit.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/contexts/holder/holder-provider.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/contexts/holder-container/holder-container-provider.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/contexts/ingredient/ingredient-provider.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/contexts/ingredient-container/ingredient-container-provider.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/pump/use-pump.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/contexts/pump/pump-provider.tsx"],"sourcesContent":["import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { Assembly, type AssemblyModel } from \"../../../models\";\n\nexport const useAssembly = () => {\n const modelId = Assembly.type;\n const result = useKosModel<AssemblyModel>({\n modelId,\n modelType: Assembly.type,\n options: {},\n });\n\n return result;\n};\n","import type { AssemblyModel } from \"../../../models\";\nimport { useAssembly } from \"./use-assembly\";\n\ninterface AssemblyProps {\n assembly: AssemblyModel;\n}\n// react HOC to provide a Assembly to a component\nexport function withAssembly<T extends AssemblyProps = AssemblyProps>(\n WrappedComponent: React.ComponentType<T>\n) {\n return (props: Omit<T, keyof AssemblyProps>) => {\n const { model, status, KosModelLoader } = useAssembly();\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} assembly={model} />\n </KosModelLoader>\n );\n };\n}\n","import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { Availability, type AvailabilityModel } from \"../../../models\";\n\nexport const useAvailability = () => {\n const modelId = Availability.type;\n const result = useKosModel<AvailabilityModel>({\n modelId,\n modelType: Availability.type,\n options: {},\n });\n\n return result;\n};\n","import type { AvailabilityModel } from \"../../../models\";\nimport { useAvailability } from \"./use-availability\";\n\ninterface AvailabilityProps {\n beverage: AvailabilityModel;\n}\n// react HOC to provide a Beverage to a component\nexport function withBeverage<T extends AvailabilityProps = AvailabilityProps>(\n WrappedComponent: React.ComponentType<T>\n) {\n return (props: Omit<T, keyof AvailabilityProps>) => {\n const { model, status, KosModelLoader } = useAvailability();\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} beverage={model} />\n </KosModelLoader>\n );\n };\n}\n","import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { Board, type BoardModel } from \"../../../models\";\n\nexport const useBoard = (id: string) => {\n const modelId = id;\n const result = useKosModel<BoardModel>({\n modelId,\n modelType: Board.type,\n options: {},\n });\n\n return result;\n};\n","import type { BoardModel } from \"../../../models\";\nimport { useBoard } from \"./use-board\";\n\ninterface BoardProps {\n board: BoardModel;\n}\n// react HOC to provide a Board to a component\nexport function withBoard<T extends BoardProps = BoardProps>(\n WrappedComponent: React.ComponentType<T>\n) {\n return (id: string) => (props: Omit<T, keyof BoardProps>) => {\n const { model, status, KosModelLoader } = useBoard(id);\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} board={model} />\n </KosModelLoader>\n );\n };\n}\n","import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { BoardContainer, type BoardContainerModel } from \"../../../models\";\n\nexport const useBoardContainer = () => {\n const modelId = BoardContainer.type;\n const result = useKosModel<BoardContainerModel>({\n modelId,\n modelType: BoardContainer.type,\n options: {},\n });\n\n return result;\n};\n","import type { BoardContainerModel } from \"../../../models\";\nimport { useBoardContainer } from \"./use-board-container\";\n\ninterface BoardContainerProps {\n boardContainer: BoardContainerModel;\n}\n// react HOC to provide a BoardContainer to a component\nexport function withBoardContainer<\n T extends BoardContainerProps = BoardContainerProps\n>(WrappedComponent: React.ComponentType<T>) {\n return (props: Omit<T, keyof BoardContainerProps>) => {\n const { model, status, KosModelLoader } = useBoardContainer();\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} boardContainer={model} />\n </KosModelLoader>\n );\n };\n}\n","import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { Nozzle, type NozzleModel } from \"../../../models\";\n\nexport const useNozzle = (path: string) => {\n const modelId = path;\n const result = useKosModel<NozzleModel>({\n modelId,\n modelType: Nozzle.type,\n options: {\n path,\n },\n });\n\n return result;\n};\n","import { PropsWithChildren, createContext, useContext, useMemo } from \"react\";\nimport { NozzleModel } from \"../../../models\";\nimport { useNozzle } from \"../../hooks/nozzle/use-nozzle\";\n\ninterface NozzleType {\n model?: NozzleModel;\n}\nconst Nozzle = createContext<NozzleType | undefined>(undefined);\n\ninterface NozzleProviderProps {\n path: string;\n}\n\nexport const NozzleProvider: React.FunctionComponent<\n PropsWithChildren<NozzleProviderProps>\n> = ({ children, path }) => {\n const { model, ready } = useNozzle(path);\n const value: NozzleType = useMemo(() => {\n if (ready && model) {\n return { model };\n }\n return {};\n }, [ready, model]);\n return <Nozzle.Provider value={value}>{children}</Nozzle.Provider>;\n};\nexport const useNozzleContext = () => {\n const context = useContext(Nozzle);\n if (!context) {\n throw new Error(\"useNozzleContext must be used within a NozzleProvider\");\n }\n return context;\n};\n","import {\n getKosCompanionModel,\n kosAutoEffect,\n type IKosDataModel,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport type { AvailabilityModel } from \"../../../models\";\nimport { useNozzleContext } from \"../../contexts/nozzle/nozzle-provider\";\n\ninterface Props {\n onBeverageSelected?: (brand: AvailabilityModel) => void;\n onClearBeverage?: () => void;\n companionType?: string;\n}\nexport const useBeverages = <\n B extends Record<string, any> = any,\n C extends IKosDataModel = IKosDataModel\n>({\n onBeverageSelected,\n onClearBeverage,\n companionType,\n}: Props) => {\n const { model: nozzle } = useNozzleContext();\n const [beverages, setBeverages] = useState<AvailabilityModel<B>[]>([]);\n const [selectedBeverage, setSelectedBeverage] =\n useState<AvailabilityModel<B> | null>(null);\n\n const companions = useMemo(() => {\n if (!companionType) return [];\n return beverages.map((brand) =>\n getKosCompanionModel<C>(brand, companionType)\n );\n }, [beverages, companionType]);\n const selectBeverage = useCallback(\n async (beverage: AvailabilityModel) => {\n setSelectedBeverage(beverage);\n await nozzle?.setSelectedPourable({ beverage });\n onBeverageSelected?.(beverage);\n },\n [nozzle, onBeverageSelected]\n );\n\n const clearBeverage = useCallback(async () => {\n setSelectedBeverage(null);\n await nozzle?.setSelectedPourable({ beverage: undefined });\n onClearBeverage?.();\n }, [nozzle, onClearBeverage]);\n useEffect(() => {\n const disposer = kosAutoEffect(() => {\n if (!nozzle) return;\n const selectedBrand = nozzle.selectedBrand;\n if (!selectedBrand) {\n const allBeverages = nozzle\n .getGroupAvailabilityItems<B>(\"beverages\")\n .filter((beverage) => beverage.visible);\n setBeverages(allBeverages ?? []);\n return;\n }\n const beverages = nozzle\n .getAvailabilityByParent<B>(selectedBrand.id)\n .filter((b) => b.visible);\n setBeverages(beverages ?? []);\n });\n return () => {\n disposer();\n };\n }, [nozzle]);\n return {\n beverages,\n beverageCompanions: companions,\n selectBeverage,\n selectedBeverage,\n clearBeverage,\n };\n};\n","import {\n getKosCompanionModel,\n kosAutoEffect,\n type IKosDataModel,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport type { AvailabilityModel } from \"../../../models\";\nimport { useNozzleContext } from \"../../contexts/nozzle/nozzle-provider\";\n\ninterface Props {\n onBrandSelected?: (brand: AvailabilityModel) => void;\n onBrandCleared?: () => void;\n companionType?: string;\n}\nexport const useBrands = <\n B extends Record<string, any> = any,\n C extends IKosDataModel = IKosDataModel\n>({\n onBrandSelected,\n onBrandCleared,\n companionType,\n}: Props) => {\n const { model: nozzle } = useNozzleContext();\n const [selectedBrand, setSelectedBrand] =\n useState<AvailabilityModel<B> | null>(null);\n\n const [brands, setBrands] = useState<AvailabilityModel<B>[]>([]);\n\n const companions = useMemo(() => {\n if (!companionType) return [];\n return brands.map((brand) => getKosCompanionModel<C>(brand, companionType));\n }, [brands, companionType]);\n\n const selectBrand = useCallback(\n async (brand: AvailabilityModel<B>) => {\n setSelectedBrand(brand);\n nozzle?.setSelectedBrand(brand);\n onBrandSelected?.(brand);\n },\n [nozzle, onBrandSelected]\n );\n\n const clearBrand = useCallback(() => {\n setSelectedBrand(null);\n nozzle?.setSelectedBrand(undefined);\n onBrandCleared?.();\n }, [nozzle, onBrandCleared]);\n\n useEffect(() => {\n const disposer = kosAutoEffect(() => {\n if (!nozzle) return;\n setBrands(nozzle.visibleBrands);\n });\n return () => {\n disposer();\n };\n }, [nozzle]);\n\n return {\n brands,\n brandCompanions: companions,\n selectedBrand,\n selectBrand,\n clearBrand,\n };\n};\n","export class PourContext {\n private _data = new Map<string, any>();\n\n get<T>(key: string): T | undefined {\n return this._data.get(key);\n }\n set<T>(key: string, value: T) {\n this._data.set(key, value);\n }\n remove(key: string) {\n this._data.delete(key);\n }\n has(key: string): boolean {\n return this._data.has(key);\n }\n}\n","import { KosLog } from \"@kosdev-code/kos-ui-sdk\";\nimport type { PourStrategy, PourStrategyAware } from \"./pour-strategy\";\nconst logger = KosLog.createLogger({\n name: \"HoldToPourStrategy\",\n group: \"kos-hooks\",\n});\n\nexport const HoldToPourStrategy: PourStrategy = {\n name: \"HoldToPourStrategy\",\n async initiate(nozzle?: PourStrategyAware): Promise<void> {\n if (!nozzle?.canPour) {\n logger.debug(`Nozzle ${nozzle?.id} cannot pour. Returning early.`);\n return;\n }\n await nozzle?.pour();\n },\n\n async initiateEnded(nozzle?: PourStrategyAware): Promise<void> {\n await nozzle?.cancelPour();\n },\n};\n","import { useCallback, useState } from \"react\";\n\nimport { KosLog, usePressGesture } from \"@kosdev-code/kos-ui-sdk\";\nimport type { ReactDOMAttributes } from \"@use-gesture/react/dist/declarations/src/types\";\nimport type { PourState } from \"../../../models/models/types/pouring\";\nimport { useNozzleContext } from \"../../contexts/nozzle\";\nimport { PourContext } from \"../../utils/pour-context\";\nimport { HoldToPourStrategy } from \"../utils/pour-strategy/hold-to-pour-strategy\";\nimport type { PourStrategy } from \"../utils/pour-strategy/pour-strategy\";\n\ninterface NozzlePourProps {\n onBeforePour?: (context?: PourContext) => Promise<boolean>;\n onBeforePourRejected?: () => void;\n onPour?: () => void;\n onPourCancel?: () => void;\n strategy?: PourStrategy;\n pourContext?: PourContext;\n}\n\nexport interface NozzlePourResponse {\n handlers: (...args: any[]) => ReactDOMAttributes;\n cancel: () => void;\n updatePourContext?: (key: string, value: any) => void;\n removeFromPourContext?: (key: string) => void;\n status?: {\n canPour: boolean;\n isPouring: boolean;\n currentState: PourState;\n pourProgress: number;\n };\n}\n\nconst logger = KosLog.createLogger({\n name: \"useNozzlePour\",\n group: \"kos-hooks\",\n});\n/**\n * Hook that encapsulates the logic for handling nozzle pouring.\n *\n * The hook will return a number of gesture handlers that can be spread onto a DOM element.\n * The hook will automatically detects if touch or mouse events are used.\n *\n *\n * @param onPour - callback initiated after pouring starts\n * @param onPourCancel - callback initiated after pouring is cancelled\n * @returns handlers - gesture handlers for nozzle pouring\n *\n *\n * @example\n * const { handlers } = useNozzlePour({\n * onPour: () => {\n * console.log(\"Pouring started\");\n * },\n * onPourCancel: () => {\n * console.log(\"Pouring cancelled\");\n * },\n * });\n *\n * <div {...handlers()} />\n *\n *\n * @see {@link NozzleModel.pour}\n * @see {@link NozzleModel.cancelPour}\n * @see {@link usePressGesture}\n **/\nexport const useNozzlePour = ({\n onPour,\n onPourCancel,\n onBeforePour,\n onBeforePourRejected,\n pourContext,\n strategy = HoldToPourStrategy,\n}: NozzlePourProps): NozzlePourResponse => {\n const { model: nozzle } = useNozzleContext();\n const [context, _setContext] = useState<PourContext>(\n pourContext || new PourContext()\n );\n const handlePour = useCallback(async () => {\n const canPour = onBeforePour ? await onBeforePour?.(context) : true;\n if (canPour) {\n logger.debug(\n `[${strategy?.name}] - Pour initiated for nozzle ${nozzle?.id}.`\n );\n strategy?.initiate(nozzle);\n onPour?.();\n } else {\n logger.debug(\n `[${strategy?.name}] - Did not pass onBeforePour gate for nozzle ${nozzle?.id}. Cancelling pour.`\n );\n onBeforePourRejected?.();\n }\n }, [\n onPour,\n nozzle,\n strategy,\n onBeforePour,\n onPourCancel,\n context,\n onBeforePourRejected,\n ]);\n\n const handleCancelPour = useCallback(() => {\n logger.debug(\n `[${strategy?.name}] - Pour initiate ended called for nozzle ${nozzle?.id}.`\n );\n strategy?.initiateEnded?.(nozzle);\n onPourCancel?.();\n }, [onPourCancel, nozzle, strategy]);\n\n const forceCancelPour = useCallback(() => {\n logger.debug(`Force cancelling pour for nozzle ${nozzle?.id}.`);\n nozzle?.cancelPour();\n onPourCancel?.();\n }, [onPourCancel, nozzle]);\n\n const handleUpdateContext = useCallback(\n (key: string, value: any) => {\n context.set(key, value);\n },\n [context]\n );\n\n const handleRemoveFromContext = useCallback(\n (key: string) => {\n context.remove(key);\n },\n [context]\n );\n const handlers = usePressGesture({\n onPressed: handlePour,\n onRelease: handleCancelPour,\n });\n\n return {\n handlers: handlers.dom,\n cancel: forceCancelPour,\n updatePourContext: handleUpdateContext,\n removeFromPourContext: handleRemoveFromContext,\n status: nozzle,\n };\n};\n","import {\n getKosCompanionModel,\n type IKosDataModel,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport { useCallback, useMemo, useState } from \"react\";\nimport type { AvailabilityModel } from \"../../../models\";\nimport { useNozzleContext } from \"../../contexts/nozzle/nozzle-provider\";\ninterface Props {\n onFlavorSelected?: (\n flavor: AvailabilityModel,\n flavors: AvailabilityModel[]\n ) => void;\n onFlavorCleared?: () => void;\n companionType?: string;\n}\nexport const useFlavors = <\n F extends Record<string, any> = any,\n C extends IKosDataModel = IKosDataModel\n>({\n onFlavorSelected,\n onFlavorCleared,\n companionType,\n}: Props) => {\n const { model: nozzle } = useNozzleContext();\n const flavors = useMemo(\n () =>\n nozzle\n ?.getGroupAvailabilityItems<F>(\"flavors\")\n .filter((f) => f.visible) ?? [],\n [nozzle]\n );\n\n const companions = useMemo(() => {\n if (!companionType) return [];\n return flavors.map((flavor) =>\n getKosCompanionModel<C>(flavor, companionType)\n );\n }, [flavors, companionType]);\n const [selectedFlavors, setSelectedFlavors] = useState<\n AvailabilityModel[] | null\n >([]);\n\n const selectFlavor = useCallback(\n async (flavor: AvailabilityModel) => {\n setSelectedFlavors((previous) =>\n previous?.includes(flavor)\n ? [...previous.filter((p) => p !== flavor)]\n : [...(previous ?? []), flavor]\n );\n\n if (nozzle?.selectedPourable) {\n const { beverage } = nozzle.selectedPourable;\n await nozzle.setSelectedPourable({\n beverage,\n additional: selectedFlavors ?? [],\n });\n }\n onFlavorSelected?.(flavor, selectedFlavors ?? []);\n },\n [nozzle, onFlavorSelected, selectedFlavors]\n );\n\n const clear = useCallback(async () => {\n setSelectedFlavors([]);\n if (nozzle?.selectedPourable) {\n const { beverage } = nozzle.selectedPourable;\n nozzle.setSelectedPourable({ beverage });\n onFlavorCleared?.();\n }\n }, [nozzle, onFlavorCleared]);\n return {\n flavors,\n flavorCompanions: companions,\n selectFlavor,\n selectedFlavors,\n clearFlavors: clear,\n };\n};\n","import type { IKosDataModel, KosTimer } from \"@kosdev-code/kos-ui-sdk\";\nimport { EventBus, KosLog } from \"@kosdev-code/kos-ui-sdk\";\nimport { useCallback, useRef, useState } from \"react\";\nimport type { AvailabilityModel } from \"../../../models\";\nimport { useNozzleContext } from \"../../contexts/nozzle/nozzle-provider\";\nimport type { PourContext } from \"../../utils/pour-context\";\nimport { useNozzlePour } from \"../nozzle-pour/use-nozzle-pour\";\nimport { useBeverages } from \"./use-beverages\";\nimport { useBrands } from \"./use-brands\";\nimport { useFlavors } from \"./use-flavors\";\nexport const DISPENSE_GROUP_BRAND = \"brands\";\nexport const DISPENSE_GROUP_BEVERAGE = \"beverages\";\nexport const DISPENSE_GROUP_FLAVOR = \"flavors\";\n\nconst log = KosLog.createLogger({ name: \"use-cui-kit\" });\ntype InitialGroup =\n | typeof DISPENSE_GROUP_BRAND\n | typeof DISPENSE_GROUP_BEVERAGE;\nexport interface UseCuiKitProps {\n /**\n * The initial group to display when the cui kit is first rendered.\n * The default is to start at the list of brands however for simpler cases\n * it may be desirable to start at the list of beverages.\n */\n initialGroup?: InitialGroup;\n\n /**\n * Options to configure the behavior of the cui kit.\n */\n options?: {\n /**\n * The companion types to associate with the brand, beverage, and flavor models. This\n * is useful when companion models have been created to represent the brand, beverage, and flavor\n * models rather than merely augmenting the AvailabilityModel data.\n */\n companionTypes?: {\n /**\n * The model type of the brand companion.\n */\n brand?: string;\n /**\n * The model type of the beverage companion.\n */\n beverage?: string;\n /**\n * The model type of the flavor companion.\n */\n flavor?: string;\n };\n };\n}\n\ninterface DispenseGroupType<\n AdditionalData extends Record<string, any> = any,\n Companion extends IKosDataModel = IKosDataModel\n> {\n /**\n * The list of AvailabilityModels to display in the group.\n */\n models: AvailabilityModel<AdditionalData>[];\n\n /**\n * The list of companion models that are associated with the models in the group.\n *\n * If no companion model types are provided in the options, this list will be empty.\n */\n companions?: Companion[];\n\n /**\n * Clear the current selection in the group. This will reset the group to its initial state.\n */\n clear: VoidFunction;\n\n /**\n * The event handlers for the group. These handlers will be called when a model in the group is selected.\n */\n handlers: {\n /**\n * The handler to call when a model in the group is selected.\n */\n onSelected: (model: AvailabilityModel<AdditionalData>) => void;\n };\n}\nexport interface CuiKitType<\n BrandData extends Record<string, any> = any,\n BeverageData extends Record<string, any> = any,\n FlavorData extends Record<string, any> = any,\n BrandCompanion extends IKosDataModel = IKosDataModel,\n BeverageCompanion extends IKosDataModel = IKosDataModel,\n FlavorCompanion extends IKosDataModel = IKosDataModel\n> {\n /**\n * Provides functions and status related to the timers in the cui kit if available.\n */\n timers: {\n /**\n * Adds a timer to the cui kit. This will be used by a cui kit lifecycle manager to\n * manage the timers in the kit.\n * The timers will be paused and restarted as needed based on the lifecycle of the cui kit\n * @param timer - the timer to add to the cui kit.\n * @returns void\n */\n add: (timer?: KosTimer | null) => void;\n /**\n * Pauses all timers in the cui kit.\n */\n pause: VoidFunction;\n\n /**\n * Restarts all timers in the cui kit.\n */\n restart: VoidFunction;\n };\n /**\n * The navigation state of the cui kit.\n */\n nav: {\n /**\n * The current group that is being displayed.\n */\n currentGroup: string;\n\n /**\n * The handler to navigate back to the previous group.\n */\n back: VoidFunction;\n\n /**\n * The handler to navigate to the initial group as defined in the options.\n */\n home: VoidFunction;\n };\n\n /**\n * Provides functions and status related to the pour operation.\n */\n pour: ReturnType<typeof useNozzlePour>;\n\n updateOnBeforePour: (\n callback: (context?: PourContext) => Promise<boolean>\n ) => void;\n\n /**\n * The current selections of the cui kit.\n */\n selections: {\n /**\n * The selected brand model.\n */\n [DISPENSE_GROUP_BRAND]: AvailabilityModel<BrandData> | null;\n\n /**\n * The selected beverage model.\n */\n [DISPENSE_GROUP_BEVERAGE]: AvailabilityModel<BeverageData> | null;\n\n /**\n * The selected flavor models.\n */\n [DISPENSE_GROUP_FLAVOR]: AvailabilityModel<FlavorData>[] | null;\n };\n\n /**\n * The brands modules provides the state and handlers required to manage the set of brands for the dispenser:\n *\n * @property {AvailabilityModel<BrandData>[]} models - The list of brands for the dispenser.\n *\n * The models will be instances of AvailabilityModel<BrandData> with any data mappings already\n * applied to the data property on the model.\n *\n * Since these are KOS models, any changes to the model state will be automatically reflected in any components consuming them.\n *\n * @property {BrandCompanion[]} companions - In more advanced cases, the KOS framework allows you to define additional models\n * that will get created alongside the brand AvailabilityModels instances.\n * Using these companions as a form of extension, this field will return the corresponding set of companion models that\n * represent your custom brands.\n \n * @property {Object} handlers - Contains handler methods.\n * @property {Function} handlers.onSelected - When a user selects a brand, this handler can be called with the selected AvailabilityModel\n * to ensure that the CUI Kit state is kept up to date.\n *\n * @property {Function} clear - Calling this function will clear the selected brand and beverage in the CUI Kit. This updates the state both locally\n * and in the backend by clearing the selection in the Dispense SDK NozzleModel.\n */\n [DISPENSE_GROUP_BRAND]: DispenseGroupType<BrandData, BrandCompanion>;\n /**\n * The beverages modules provides the state and handlers required to manage the set of beverages for the current brand selection:\n *\n * @property {AvailabilityModel<BeverageData>[]} models - The list of beverages for the current brand selection. As the user selects brands\n * in the UI then this list of beverages will be updated to reflect new selection. If there are no brands\n * defined in the brandset then this will always return the full list of beverages.\n *\n * The models will be instances of AvailabilityModel<T> with any data mappings (shown in the next section) already\n * applied to the data property on the model.\n *\n * Since these are KOS models, any changes to the model state will be automatically reflected in any components consuming them.\n *\n * @property {BeverageCompanion[]} companions - In more advanced cases, the KOS framework allows you to define additional models\n * that will get created alongside the “beverage” AvailabilityModels instances.\n *\n * This is useful in cases where new functionality beyond what is exposed in the AvailabilityModel is required. For\n * example, if in your application, you need Beverages to be able to fetch nutritional information on selection then\n * you could create a companion model that will get created for each AvailabilityModel and expose the methods and\n * data to retrieve this information.\n *\n * Using these companions as a form of extension, this field will return the corresponding set of companion models that\n * represent your custom beverages.\n \n * @property {Object} handlers - Contains handler methods.\n * @property {Function} handlers.onSelected - When a user selects a beverage, this handler can be called with the selected AvailabilityModel\n * to ensure that the CUI Kit state is kept up to date.\n *\n * @property {Function} clear - Calling this function will clear the selected beverage in the CUI Kit. This updates the state both locally\n * and in the backend by clearing the selection in the Dispense SDK NozzleModel.\n */\n [DISPENSE_GROUP_BEVERAGE]: DispenseGroupType<BeverageData, BeverageCompanion>;\n\n /**\n * The group of flavors to display. This list will be filtered\n * based on previous selections and the relationships of the models in the graph.\n * For example, if a beverage has been selected, this will return the list of flavors that\n * are associated with the selected beverage. Otherwise, it will return the list of all flavors.\n */\n [DISPENSE_GROUP_FLAVOR]: DispenseGroupType<FlavorData, FlavorCompanion>;\n}\n\nexport const useCuiKit = <\n BrandData extends Record<string, any> = any,\n BeverageData extends Record<string, any> = any,\n FlavorData extends Record<string, any> = any,\n BrandCompanion extends IKosDataModel = IKosDataModel,\n BeverageCompanion extends IKosDataModel = IKosDataModel,\n FlavorCompanion extends IKosDataModel = IKosDataModel\n>({\n initialGroup = DISPENSE_GROUP_BRAND,\n options = {},\n}: UseCuiKitProps): CuiKitType<\n BrandData,\n BeverageData,\n FlavorData,\n BrandCompanion,\n BeverageCompanion,\n FlavorCompanion\n> => {\n const [currentGroup, setCurrentGroup] = useState<string>(initialGroup);\n const { model: nozzle } = useNozzleContext();\n const timersRef = useRef<KosTimer[]>([]);\n const updatePourContext = useRef<(key: string, value: any) => void>();\n const removeFromPourContext = useRef<(key: string) => void>();\n const onBrandSelected = useCallback(\n (model: AvailabilityModel) => {\n setCurrentGroup(DISPENSE_GROUP_FLAVOR);\n const topic = `/kos/dispense/${nozzle?.path}/brand/selected/`;\n EventBus.publish(topic, model);\n },\n [nozzle?.path]\n );\n\n const onBrandCleared = useCallback(() => {\n const topic = `/kos/dispense/${nozzle?.path}/brand/cleared/`;\n EventBus.publish(topic, {});\n }, [nozzle?.path]);\n\n const onBeverageSelected = useCallback(\n (model: AvailabilityModel) => {\n setCurrentGroup(DISPENSE_GROUP_FLAVOR);\n updatePourContext.current?.(\"selectedBeverage\", model);\n const topic = `/kos/dispense/${nozzle?.path}/beverage/selected/`;\n EventBus.publish(topic, model);\n },\n [nozzle?.path]\n );\n\n const onBeverageCleared = useCallback(() => {\n const topic = `/kos/dispense/${nozzle?.path}/beverage/cleared/`;\n removeFromPourContext.current?.(\"selectedBeverage\");\n EventBus.publish(topic, {});\n }, [nozzle?.path]);\n\n const onFlavorSelected = useCallback(\n (model: AvailabilityModel) => {\n const topic = `/kos/dispense/${nozzle?.path}/flavor/selected/`;\n EventBus.publish(topic, model);\n },\n [nozzle?.path]\n );\n\n const onFlavorCleared = useCallback(() => {\n const topic = `/kos/dispense/${nozzle?.path}/flavor/cleared/`;\n EventBus.publish(topic, {});\n }, [nozzle?.path]);\n\n const onPour = useCallback(() => {\n const topic = `/kos/dispense/${nozzle?.path}/pour/`;\n EventBus.publish(topic, {});\n }, [nozzle?.path]);\n\n const handleBeforePour = useCallback(\n async (context?: PourContext) => {\n const topic = `/kos/dispense/${nozzle?.path}/pre/pour/`;\n EventBus.publish(topic, {});\n return (await onBeforePour?.(context)) || true;\n },\n [nozzle?.path]\n );\n\n const handleBeforePourRejected = useCallback(async () => {\n const topic = `/kos/dispense/${nozzle?.path}/pre/pour/rejected/`;\n EventBus.publish(topic, {});\n }, [nozzle?.path]);\n\n const onPourCancel = useCallback(() => {\n const topic = `/kos/dispense/${nozzle?.path}/pour/cancel/`;\n EventBus.publish(topic, {});\n }, [nozzle?.path]);\n const { brands, selectBrand, selectedBrand, clearBrand, brandCompanions } =\n useBrands<BrandData, BrandCompanion>({\n companionType: options.companionTypes?.brand,\n onBrandSelected: onBrandSelected,\n onBrandCleared: onBrandCleared,\n });\n const {\n beverages,\n selectBeverage,\n selectedBeverage,\n clearBeverage,\n beverageCompanions,\n } = useBeverages<BeverageData, BeverageCompanion>({\n companionType: options.companionTypes?.beverage,\n onBeverageSelected: onBeverageSelected,\n onClearBeverage: onBeverageCleared,\n });\n\n const {\n clearFlavors,\n flavors,\n selectFlavor,\n selectedFlavors,\n flavorCompanions,\n } = useFlavors<FlavorData, FlavorCompanion>({\n companionType: options.companionTypes?.flavor,\n onFlavorSelected: onFlavorSelected,\n onFlavorCleared: onFlavorCleared,\n });\n\n const [onBeforePour, setOnBeforePour] =\n useState<(context?: PourContext) => Promise<boolean>>();\n const updateOnBeforePour = useCallback((callback: () => Promise<boolean>) => {\n setOnBeforePour(() => callback);\n }, []);\n const pour = useNozzlePour({\n onPour: onPour,\n onPourCancel: onPourCancel,\n onBeforePour: handleBeforePour,\n onBeforePourRejected: handleBeforePourRejected,\n });\n\n updatePourContext.current = pour.updatePourContext;\n removeFromPourContext.current = pour.removeFromPourContext;\n\n const back = useCallback(() => {\n log.debug(`Navigating back from group: ${currentGroup}`);\n switch (currentGroup) {\n case DISPENSE_GROUP_BRAND:\n clearBeverage();\n clearBrand();\n break;\n case DISPENSE_GROUP_BEVERAGE:\n case DISPENSE_GROUP_FLAVOR:\n setCurrentGroup(initialGroup);\n clearBeverage();\n clearBrand();\n break;\n }\n }, [clearBeverage, clearBrand, currentGroup, initialGroup]);\n\n const home = useCallback(() => {\n const topic = `/kos/dispense/${nozzle?.path}/home/`;\n EventBus.publish(topic, {});\n setCurrentGroup(initialGroup);\n if (initialGroup === DISPENSE_GROUP_BRAND) {\n clearBeverage();\n clearBrand();\n }\n\n if (initialGroup === DISPENSE_GROUP_BEVERAGE) {\n clearBeverage();\n }\n }, [clearBeverage, clearBrand, initialGroup]);\n\n const pauseTimers = useCallback(() => {\n if (timersRef.current.length === 0) {\n log.debug(\"No timers to pause.\");\n return;\n }\n log.debug(`Pausing ${timersRef.current.length} timers.`);\n timersRef.current.forEach((timer) => {\n log.debug(`Pausing timer with id ${timer.id}.`);\n timer.pause();\n });\n }, []);\n\n const restartTimers = useCallback(() => {\n if (timersRef.current.length === 0) {\n log.debug(\"No timers to restart.\");\n return;\n }\n log.debug(`Restarting ${timersRef.current.length} timers.`);\n timersRef.current.forEach((timer) => {\n log.debug(`Restarting timer with id ${timer.id}.`);\n timer.restart();\n });\n }, []);\n\n const addTimer = useCallback((timer?: KosTimer | null) => {\n if (!timer) {\n return;\n }\n // Check if the timer already exists in the timersRef\n if (timersRef.current.some((t) => t.id === timer.id)) {\n log.debug(`Timer with id ${timer.id} already exists.`);\n return;\n }\n // Add the timer to the timersRef\n\n timersRef.current.push(timer);\n }, []);\n return {\n timers: {\n add: addTimer,\n pause: pauseTimers,\n restart: restartTimers,\n },\n nav: {\n currentGroup,\n back,\n home,\n },\n\n pour,\n\n updateOnBeforePour,\n\n selections: {\n [DISPENSE_GROUP_BRAND]: selectedBrand,\n [DISPENSE_GROUP_BEVERAGE]: selectedBeverage,\n [DISPENSE_GROUP_FLAVOR]: selectedFlavors,\n },\n [DISPENSE_GROUP_BRAND]: {\n models: brands,\n companions: brandCompanions,\n clear: clearBrand,\n handlers: {\n onSelected: selectBrand,\n },\n },\n [DISPENSE_GROUP_BEVERAGE]: {\n models: beverages,\n companions: beverageCompanions,\n clear: clearBeverage,\n handlers: {\n onSelected: selectBeverage,\n },\n },\n [DISPENSE_GROUP_FLAVOR]: {\n models: flavors,\n companions: flavorCompanions,\n clear: clearFlavors,\n handlers: {\n onSelected: selectFlavor,\n },\n },\n };\n};\n","import { KosLog, TimerManager, type KosTimer } from \"@kosdev-code/kos-ui-sdk\";\nimport { useCallback, useEffect, useState } from \"react\";\nimport { useNozzleContext } from \"../../contexts/nozzle/nozzle-provider\";\n\ninterface TimerProps {\n defaultAmbientTime?: number;\n defaultAttractTime?: number;\n onAttractTimer?: VoidFunction;\n onAmbientTimer?: VoidFunction;\n onResetAttractTimer?: VoidFunction;\n onResumeAttractTimer?: VoidFunction;\n}\n\nexport const useAmbientAttractTimers = (props: TimerProps) => {\n const { model: nozzle } = useNozzleContext();\n\n const [attractTimer, setAttractTimer] = useState<KosTimer | null>(null);\n const {\n onAmbientTimer,\n onAttractTimer,\n onResetAttractTimer,\n onResumeAttractTimer,\n defaultAttractTime,\n defaultAmbientTime,\n } = props;\n\n const handleAmbientTimer = useCallback(() => {\n if (onAmbientTimer) {\n KosLog.info(\"Ambient timer expired. Calling callback\");\n onAmbientTimer?.();\n }\n }, [onAmbientTimer]);\n\n const handleAttractTimer = useCallback(() => {\n if (onAttractTimer) {\n KosLog.info(\"Attract timer expired. Calling callback\");\n onAttractTimer?.();\n }\n }, [onAttractTimer]);\n\n const handleResetAttractTimer = useCallback(() => {\n if (attractTimer) {\n attractTimer.restart();\n onResetAttractTimer?.();\n }\n }, [attractTimer, onResetAttractTimer]);\n\n const handlePauseAttractTimer = useCallback(() => {\n if (attractTimer) {\n attractTimer.reset();\n onResetAttractTimer?.();\n }\n }, [attractTimer, onResetAttractTimer]);\n\n const handleResume = useCallback(() => {\n if (attractTimer) {\n attractTimer.pause();\n onResumeAttractTimer?.();\n }\n }, [attractTimer, onResumeAttractTimer]);\n\n useEffect(() => {\n if (nozzle && defaultAttractTime) {\n KosLog.info(\"Nozzle is available. Creating timers\");\n const timer = TimerManager.createTimer(\n \"attract-timer-\" + nozzle.path,\n defaultAttractTime\n );\n\n if (defaultAttractTime) {\n timer?.addTimeoutAction({\n name: \"attract-timer\",\n remainingTime: 0,\n action: handleAttractTimer,\n });\n }\n\n if (defaultAmbientTime) {\n timer?.addTimeoutAction({\n name: \"ambient-timer\",\n remainingTime: defaultAmbientTime,\n action: handleAmbientTimer,\n });\n }\n if (defaultAttractTime) {\n timer?.start();\n }\n setAttractTimer(timer ?? null);\n return () => {\n timer?.reset();\n setAttractTimer(null);\n };\n }\n return () => {\n KosLog.info(\"Nozzle is not available. No timers to clear\");\n };\n }, [\n defaultAmbientTime,\n defaultAttractTime,\n handleAmbientTimer,\n handleAttractTimer,\n nozzle,\n ]);\n return {\n attractTimer,\n restart: handleResetAttractTimer,\n pause: handlePauseAttractTimer,\n resume: handleResume,\n };\n};\n","import { EventBus } from \"@kosdev-code/kos-ui-sdk\";\nimport { useEffect } from \"react\";\nimport type { AvailabilityModel } from \"../../../models\";\nimport { useNozzleContext } from \"../../contexts/nozzle/nozzle-provider\";\n\ninterface Props<\n BrandData extends Record<string, any> = any,\n BeverageData extends Record<string, any> = any,\n FlavorData extends Record<string, any> = any\n> {\n onBrandSelected?: (brand: AvailabilityModel<BrandData>) => void;\n onBrandCleared?: () => void;\n onBeverageSelected?: (brand: AvailabilityModel<BeverageData>) => void;\n onBeverageCleared?: () => void;\n onFlavorSelected?: (brand: AvailabilityModel<FlavorData>) => void;\n onFlavorCleared?: () => void;\n onReturnToHome?: () => void;\n onPour?: () => void;\n onPourCancel?: () => void;\n onBeforePourRejected?: () => void;\n onAmbientTimer?: () => void;\n onAttractTimer?: () => void;\n onResumeAttractTimer?: () => void;\n onIdleTimeout?: () => void;\n onAreYouThereTimeout?: () => void;\n onInit?: () => void;\n}\n\nconst subscribe = (topic: string, callback?: (args: any) => void) => {\n if (callback) {\n const result = EventBus.subscribe(topic, callback);\n return result.unsubscribe;\n }\n return undefined;\n};\nexport const useDispenseLifecycle = ({\n onInit,\n onBrandSelected,\n onBrandCleared,\n onBeverageCleared,\n onBeverageSelected,\n onFlavorCleared,\n onFlavorSelected,\n onReturnToHome,\n onPour,\n onPourCancel,\n onBeforePourRejected,\n onAmbientTimer,\n onAttractTimer,\n onResumeAttractTimer,\n onIdleTimeout,\n onAreYouThereTimeout,\n}: Props) => {\n const { model: nozzle } = useNozzleContext();\n\n useEffect(() => {\n const topics = [\n {\n topic: `/kos/dispense/${nozzle?.path}/brand/selected/`,\n callback: onBrandSelected,\n },\n {\n topic: `/kos/dispense/${nozzle?.path}/brand/cleared/`,\n callback: onBrandCleared,\n },\n {\n topic: `/kos/dispense/${nozzle?.path}/beverage/selected/`,\n callback: onBeverageSelected,\n },\n {\n topic: `/kos/dispense/${nozzle?.path}/beverage/cleared/`,\n callback: onBeverageCleared,\n },\n {\n topic: `/kos/dispense/${nozzle?.path}/flavor/selected/`,\n callback: onFlavorSelected,\n },\n {\n topic: `/kos/dispense/${nozzle?.path}/flavor/cleared/`,\n callback: onFlavorCleared,\n },\n { topic: `/kos/dispense/${nozzle?.path}/pour/`, callback: onPour },\n {\n topic: `/kos/dispense/${nozzle?.path}/pour/cancel/`,\n callback: onPourCancel,\n },\n {\n topic: `/kos/dispense/${nozzle?.path}/pre/pour/rejected/`,\n callback: onBeforePourRejected,\n },\n\n {\n topic: `/kos/dispense/${nozzle?.path}/ambient/start/`,\n callback: onAmbientTimer,\n },\n {\n topic: `/kos/dispense/${nozzle?.path}/attract/start/`,\n callback: onAttractTimer,\n },\n {\n topic: `/kos/dispense/${nozzle?.path}/attract/resume/`,\n callback: onResumeAttractTimer,\n },\n {\n topic: `/kos/dispense/${nozzle?.path}/idle/timeout/`,\n callback: onIdleTimeout,\n },\n {\n topic: `/kos/dispense/${nozzle?.path}/are-you-there/timeout/`,\n callback: onAreYouThereTimeout,\n },\n {\n topic: `/kos/dispense/${nozzle?.path}/init/`,\n callback: onInit,\n },\n {\n topic: `/kos/dispense/${nozzle?.path}/home/`,\n callback: onReturnToHome,\n },\n ];\n\n const disposers = topics.map(({ topic, callback }) =>\n subscribe(topic, callback)\n );\n\n return () => {\n disposers.forEach((disposer) => disposer?.());\n };\n }, [\n nozzle?.path,\n onAmbientTimer,\n onAttractTimer,\n onBeverageCleared,\n onBeverageSelected,\n onBrandCleared,\n onBrandSelected,\n onFlavorCleared,\n onFlavorSelected,\n onPour,\n onPourCancel,\n onResumeAttractTimer,\n onIdleTimeout,\n onAreYouThereTimeout,\n onInit,\n onReturnToHome,\n ]);\n};\n","import { KosLog, TimerManager, type KosTimer } from \"@kosdev-code/kos-ui-sdk\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { useNozzleContext } from \"../../contexts/nozzle/nozzle-provider\";\n\ninterface TimerProps {\n defaultIdleTime?: number;\n defaultAreYouThereTime?: number;\n onIdleTimer?: VoidFunction;\n onAreYouThereTimer?: VoidFunction;\n onResetIdleTimer?: VoidFunction;\n prefix?: string;\n}\n\nconst log = KosLog.createLogger({ name: \"useCuiKitTimers\" });\nexport const useCuiKitTimers = (props: TimerProps) => {\n const { model: nozzle } = useNozzleContext();\n const [idleTimer, setIdleTimer] = useState<KosTimer | null>(null);\n const {\n onAreYouThereTimer,\n onIdleTimer,\n onResetIdleTimer,\n defaultAreYouThereTime = 10,\n defaultIdleTime = 20,\n } = props;\n\n // Track if we've already fired the \"Are You There\" action for this timer cycle\n const hasAreYouThereFiredRef = useRef(false);\n\n const handleAreYouThereTimer = useCallback(() => {\n // Only fire once per timer cycle\n if (!hasAreYouThereFiredRef.current && onAreYouThereTimer) {\n KosLog.info(\"Are you there timer expired. Calling callback\");\n hasAreYouThereFiredRef.current = true;\n onAreYouThereTimer?.();\n }\n }, [onAreYouThereTimer]);\n\n const handleIdleTimer = useCallback(() => {\n log.debug(\n \"handleIdleTimer called in useCuiKitTimers, onIdleTimer exists:\",\n !!onIdleTimer\n );\n if (onIdleTimer) {\n log.debug(\"Idle timer expired. Calling callback\");\n onIdleTimer?.();\n } else {\n log.debug(\"No onIdleTimer callback provided!\");\n }\n }, [onIdleTimer]);\n\n const handleRestartIdleTimer = useCallback(() => {\n log.debug(`TIMER RESTART called for ${props.prefix ?? \"\"}timer`);\n if (idleTimer) {\n idleTimer.restart();\n hasAreYouThereFiredRef.current = false; // Reset flag when timer restarts\n onResetIdleTimer?.();\n }\n }, [idleTimer, onResetIdleTimer, props.prefix]);\n\n const handlePauseIdleTimer = useCallback(() => {\n log.debug(`TIMER PAUSE/RESET called for ${props.prefix ?? \"\"}timer`);\n if (idleTimer) {\n idleTimer.reset();\n hasAreYouThereFiredRef.current = false; // Reset flag when timer is reset/paused\n onResetIdleTimer?.();\n }\n }, [idleTimer, onResetIdleTimer, props.prefix]);\n useEffect(() => {\n log.debug(\n `useCuiKitTimers effect triggered - nozzle: ${!!nozzle}, path: ${\n nozzle?.path\n }, callbacks: handleIdle=${!!handleIdleTimer}, handleAreYouThere=${!!handleAreYouThereTimer}`\n );\n if (nozzle) {\n log.info(\"Nozzle is available. Creating timers\");\n const timer = TimerManager.createTimer(\n `${props.prefix ?? \"\"}idle-timer-${nozzle.path}`,\n defaultIdleTime\n );\n log.debug(\n `Adding idle timer action for ${props.prefix ?? \"\"}idle-timer-${\n nozzle.path\n } with callback:`,\n !!handleIdleTimer\n );\n timer?.addTimeoutAction({\n name: \"idle-timer\",\n remainingTime: 0,\n action: handleIdleTimer,\n });\n\n timer?.addTimeoutAction({\n name: \"are-you-there-timer\",\n remainingTime: defaultAreYouThereTime,\n action: handleAreYouThereTimer,\n });\n setIdleTimer(timer ?? null);\n return () => {\n timer?.reset();\n setIdleTimer(null);\n };\n }\n return () => {\n log.info(\"Nozzle is not available. No timers to clear\");\n };\n }, [\n defaultAreYouThereTime,\n defaultIdleTime,\n handleAreYouThereTimer,\n handleIdleTimer,\n nozzle,\n props.prefix,\n ]);\n return {\n idleTimer,\n restart: handleRestartIdleTimer,\n pause: handlePauseIdleTimer,\n };\n};\n","import { EventBus, KosLog } from \"@kosdev-code/kos-ui-sdk\";\nimport { useCallback, useEffect, useState } from \"react\";\nimport { useNozzleContext } from \"../../contexts/nozzle/nozzle-provider\";\nimport { useAmbientAttractTimers } from \"./use-ambient-attract-timers\";\nimport type { CuiKitType } from \"./use-cui-kit\";\nimport { useDispenseLifecycle } from \"./use-dispense-lifecycle\";\nimport { useCuiKitTimers } from \"./use-dispense-timers\";\n\nconst log = KosLog.createLogger({ name: \"useDefaultCuiKitLifecycle\" });\n/**\n * Hook that provides default CUI Kit lifecycle management with support for preflight checks.\n *\n * @example\n * // Basic usage without preflight check\n * const lifecycle = useDefaultCuiKitLifecycle({\n * kit,\n * inactivity: { idleTimeout: 60, areYouThereTimeoutOffset: 10 }\n * });\n *\n * @example\n * // With before callback to validate conditions before showing \"Are You There\"\n * const lifecycle = useDefaultCuiKitLifecycle({\n * kit,\n * inactivity: { idleTimeout: 60, areYouThereTimeoutOffset: 10 },\n * onBeforeAreYouThereTimer: async () => {\n * // Check if user has items in cart\n * if (cartItems.length === 0) {\n * return false; // Skip \"Are You There\" if no items selected\n * }\n *\n * // Check system status\n * const systemStatus = await checkSystemAvailability();\n * return systemStatus.isOperational;\n * }\n * });\n *\n * @example\n * // Advanced before callback with multiple conditions\n * const onBeforeAreYouThereTimer = useCallback(async () => {\n * // Don't show if pour is in progress\n * if (pourInProgress) return false;\n *\n * // Don't show if maintenance mode is active\n * const maintenance = await checkMaintenanceStatus();\n * if (maintenance.active) return false;\n *\n * // Don't show if user has premium access (extended timeout)\n * if (user?.isPremium) return false;\n *\n * return true; // Show \"Are You There\" screen\n * }, [pourInProgress, user]);\n */\n\ninterface TimerProps {\n /**\n * The idle timeout in seconds. This is the time in seconds that the screen will wait before\n * the current session is considered idle at which point the current selections will be cleared\n * and the screen will return to the home screen.\n */\n idleTimeout?: number;\n\n /**\n * This is the amount of time left in the idle timeout at which point the are you there screen will be shown.\n *\n * For example, if the idle timer was set to 60 seconds and the areYouThereTimeoutOffset was set to 10 seconds,\n * the are you there screen would be shown after 50 seconds of inactivity to provide an opportunity for the user\n * to indicate that they are still present.\n */\n areYouThereTimeoutOffset?: number;\n}\ninterface Props {\n /**\n * The CuiKit instance\n */\n kit?: CuiKitType | null;\n\n /**\n * The timer configuration for the inactivity timer\n */\n inactivity?: TimerProps;\n\n /**\n * An alternate timer configuration that is applied when a pour has been initiated\n * in the current session. This is useful when the idle timeout should be different\n * when a pour has been initiated.\n */\n pour?: TimerProps;\n /**\n * Screen configuration to control the visibility and timing of the attract and ambient screens.\n */\n screens?: {\n /**\n * The amount of time in seconds before the attract screen is shown.\n */\n attractTimeout?: number;\n\n /**\n * The amount of time in seconds measured as an offset from the attract timeout\n * that the ambient screen will be shown. For example, if the attract screen is to be\n * show after 300 seconds and the ambient timeout is set to 120 seconds, the ambient screen will appear\n * after 180 seconds and display for 120 seconds before the attract screen is shown.\n */\n ambientTimeoutOffset?: number;\n };\n\n /**\n * Optional callback function that executes when the areYouThere timer expires.\n * If provided, this function will be called before showing the \"Are You There\" screen.\n * The screen will only be shown if the callback returns true.\n *\n * @returns Promise<boolean> - Return true to show the \"Are You There\" screen, false to prevent it\n */\n onBeforeAreYouThereTimer?: () => Promise<boolean>;\n\n /**\n * Defines what happens to timers when onBeforeAreYouThereTimer returns false.\n * - \"pause\" - Pause the current timer (default)\n * - \"restart\" - Restart the timer from the beginning\n * - \"none\" - Do nothing, let timers continue as-is\n */\n areYouThereRejectionPolicy?: \"pause\" | \"restart\" | \"none\";\n}\n\ninterface LifecycleData {\n /**\n * Flag to indicate if the are you there timoute screen should be shown\n * @type {boolean}\n */\n showAreYouThere: boolean;\n\n /**\n * Callback that when invoked will reset the are you there timer and hide the screen\n * @returns\n */\n clearAreYouThere: () => void;\n\n /**\n * The countdown value for the are you there screen. This value is used to display the countdown.\n * If a pour has been initiated at any point in the current session, the countdown value will be based\n * on the pour idleTimeout and pour areYouThereTimeoutOffset value. Otherwise it will be based on the\n * inactivity idleTimeout and areYouThereTimeoutOffset values.\n * @type {number}\n *\n */\n areYouThereCountdown: number;\n\n /**\n * Flag to indicate if the ambient screen should be shown\n */\n showAmbientScreen: boolean;\n\n /**\n * Flag to indicate if the attract screen should be shown\n */\n showAttractScreen: boolean;\n\n /**\n * Callback to pause and reset the screen timer. This will typically be called when a user\n * interacts with the screen when the ambient or attract screen is show. This will set\n * the `showAmbientScreen` and `showAttractScreen` flags to false and reset the timer.\n */\n pauseScreenTimer: () => void;\n\n /**\n * Callback to restart the ambient screen timer. This will typically be called when a user\n * interacts with the screen when the ambient or attract screen is show. This will set\n * the `showAmbientScreen` and `showAttractScreen` flags to false and restart the timer.\n */\n restartScreenTimer: () => void;\n\n /**\n * Callback to pause the idle timer. This is typically called when the user interacts with the screen\n * and should pause the idle timer.\n */\n pauseIdleTimer: () => void;\n\n /**\n * Callback to restart the idle timer. This is typically called when the user interacts with the screen\n * and should restart the idle timer.\n */\n restartIdleTimer: () => void;\n}\nexport const useDefaultCuiKitLifecycle = ({\n kit,\n inactivity,\n pour,\n screens,\n onBeforeAreYouThereTimer,\n areYouThereRejectionPolicy = \"pause\",\n}: Props): LifecycleData => {\n const [showAmbientScreen, setShowAmbientScreen] = useState(false);\n const [showAttractScreen, setShowAttractScreen] = useState(false);\n\n const { model: nozzle } = useNozzleContext();\n\n const [hasPoured, setHasPoured] = useState(false);\n const idleTimeout = inactivity?.idleTimeout ?? 15;\n const areYouThereTimeout = inactivity?.areYouThereTimeoutOffset ?? 10;\n const idlePourTimeout = pour?.idleTimeout ?? inactivity?.idleTimeout ?? 10;\n const areYouTherePourTimeout =\n pour?.areYouThereTimeoutOffset ?? inactivity?.areYouThereTimeoutOffset ?? 5;\n const ambientTimeout = screens?.ambientTimeoutOffset;\n const attractTimeout = screens?.attractTimeout;\n\n const handleIdleTimeout = useCallback(() => {\n log.info(\"handleIdleTimeout called - navigating home and publishing event\");\n setShowAreYouThere(false); // Clear the Are You There modal\n kit?.nav.home();\n\n // Publish idle timeout event\n if (nozzle) {\n const topic = `/kos/dispense/${nozzle.path}/idle/timeout/`;\n EventBus.publish(topic, {});\n }\n }, [kit?.nav?.home, nozzle]);\n\n const handleResetIdleTimer = useCallback(() => {\n log.info(\"handleResetIdleTimer called - resetting idle timer\");\n setShowAreYouThere(false); // Clear the Are You There modal\n }, []);\n\n const handleAmbientTimer = useCallback(() => {\n if (ambientTimeout) {\n setShowAmbientScreen(true);\n setShowAttractScreen(false);\n\n // Publish ambient timer event\n if (nozzle) {\n const topic = `/kos/dispense/${nozzle.path}/ambient/start/`;\n EventBus.publish(topic, {});\n }\n }\n }, [ambientTimeout, nozzle]);\n\n const handleAttractTimer = useCallback(() => {\n if (attractTimeout) {\n setShowAttractScreen(true);\n setShowAmbientScreen(false);\n\n // Publish attract timer event\n if (nozzle) {\n const topic = `/kos/dispense/${nozzle.path}/attract/start/`;\n EventBus.publish(topic, {});\n }\n }\n }, [attractTimeout, nozzle]);\n\n const handleAttractResume = useCallback(() => {\n if (attractTimeout) {\n setShowAttractScreen(false);\n setShowAmbientScreen(false);\n kit?.nav.home();\n\n // Publish attract resume event\n if (nozzle) {\n const topic = `/kos/dispense/${nozzle.path}/attract/resume/`;\n EventBus.publish(topic, {});\n }\n }\n }, [kit?.nav, attractTimeout, nozzle]);\n\n const {\n pause: ambientPause,\n restart: ambientRestart,\n resume,\n attractTimer,\n } = useAmbientAttractTimers({\n defaultAmbientTime: ambientTimeout,\n defaultAttractTime: attractTimeout,\n onAmbientTimer: handleAmbientTimer,\n onAttractTimer: handleAttractTimer,\n onResumeAttractTimer: handleAttractResume,\n });\n\n kit?.timers?.add(attractTimer);\n\n const [showAreYouThere, setShowAreYouThere] = useState(false);\n\n // Create timer hooks first\n log.info(\n \"Creating idle timer with timeout:\",\n idleTimeout,\n \"seconds and callback:\",\n !!handleIdleTimeout\n );\n const { pause, restart, idleTimer } = useCuiKitTimers({\n defaultAreYouThereTime: areYouThereTimeout,\n defaultIdleTime: idleTimeout,\n onIdleTimer: handleIdleTimeout,\n onResetIdleTimer: handleResetIdleTimer,\n });\n\n log.info(\n `Creating pour timer with timeout: ${idlePourTimeout} seconds and callback: ${!!handleIdleTimeout}`\n );\n const {\n pause: pausePourTimer,\n restart: restartPourTimer,\n idleTimer: pourIdleTimer,\n } = useCuiKitTimers({\n defaultAreYouThereTime: areYouTherePourTimeout,\n defaultIdleTime: idlePourTimeout,\n onIdleTimer: handleIdleTimeout,\n prefix: \"pour-\",\n });\n\n // Define the Are You There handler with access to timer controls\n const handleAreYouThereTimer = useCallback(async () => {\n let shouldShowAreYouThere = true;\n\n // If a before callback is provided, run it first\n if (onBeforeAreYouThereTimer) {\n try {\n shouldShowAreYouThere = await onBeforeAreYouThereTimer();\n } catch (error) {\n log.error(`onBeforeAreYouThereTimer callback failed: ${error}`);\n shouldShowAreYouThere = false;\n }\n }\n\n if (shouldShowAreYouThere) {\n // Publish are you there timeout event\n if (nozzle) {\n const topic = `/kos/dispense/${nozzle.path}/are-you-there/timeout/`;\n EventBus.publish(topic, {});\n }\n setShowAreYouThere(true);\n\n // Pause the appropriate timer to prevent repeated calls\n if (hasPoured) {\n pausePourTimer();\n } else {\n pause();\n }\n } else {\n // Handle timer based on rejection policy\n switch (areYouThereRejectionPolicy) {\n case \"pause\":\n if (hasPoured) {\n pausePourTimer();\n } else {\n pause();\n }\n break;\n case \"restart\":\n if (hasPoured) {\n restartPourTimer();\n } else {\n restart();\n }\n break;\n case \"none\":\n // Do nothing - let timers continue\n break;\n }\n }\n }, [onBeforeAreYouThereTimer, nozzle, areYouThereRejectionPolicy, hasPoured]);\n\n const clearAreYouThere = useCallback(() => {\n setShowAreYouThere(false);\n ambientPause();\n if (hasPoured) {\n restartPourTimer();\n pause();\n } else {\n restart();\n pausePourTimer();\n }\n }, [hasPoured, pause, pausePourTimer, restart, restartPourTimer]);\n\n // Add the Are You There callback to the timers\n useEffect(() => {\n if (idleTimer) {\n idleTimer.addTimeoutAction({\n name: \"are-you-there-timer\",\n remainingTime: areYouThereTimeout,\n action: handleAreYouThereTimer,\n });\n }\n }, [idleTimer, areYouThereTimeout, handleAreYouThereTimer]);\n\n useEffect(() => {\n if (pourIdleTimer) {\n pourIdleTimer.addTimeoutAction({\n name: \"pour-are-you-there-timer\",\n remainingTime: areYouTherePourTimeout,\n action: handleAreYouThereTimer,\n });\n }\n }, [pourIdleTimer, areYouTherePourTimeout, handleAreYouThereTimer]);\n\n // Add timers to the kit\n kit?.timers?.add(idleTimer);\n kit?.timers?.add(pourIdleTimer);\n\n const handlePour = useCallback(() => {\n setHasPoured(false);\n pausePourTimer();\n pause();\n ambientPause();\n }, [pause, pausePourTimer]);\n\n const handlePourCancel = useCallback(() => {\n setHasPoured(true);\n log.info(\"restarting pour timer\");\n restartPourTimer();\n ambientPause();\n pause();\n }, [pause, restartPourTimer]);\n\n const handleBeforePourRejected = useCallback(() => {\n setHasPoured(false);\n log.info(\"restarting pour timer on before pour rejected\");\n pausePourTimer();\n restart();\n }, []);\n\n const handleBrandSelected = useCallback(() => {\n ambientPause();\n setShowAttractScreen(false);\n setShowAmbientScreen(false);\n restart();\n }, [ambientPause, restart]);\n\n const handleBrandCleared = useCallback(() => {\n setShowAttractScreen(false);\n setShowAmbientScreen(false);\n setHasPoured(false);\n pausePourTimer();\n ambientRestart();\n }, [ambientRestart, pausePourTimer]);\n\n const handleBeverageSelected = useCallback(() => {\n setShowAttractScreen(false);\n setShowAmbientScreen(false);\n setHasPoured(false);\n ambientPause();\n restart();\n }, [ambientPause, restart]);\n\n const handleBeverageCleared = useCallback(() => {\n setShowAttractScreen(false);\n setShowAmbientScreen(false);\n setHasPoured(false);\n ambientRestart();\n pause();\n pausePourTimer();\n }, [ambientRestart, pause, pausePourTimer]);\n\n const handleInit = useCallback(() => {\n setShowAttractScreen(false);\n setShowAmbientScreen(false);\n ambientRestart();\n pause();\n }, [ambientRestart, pause]);\n\n useDispenseLifecycle({\n onBrandSelected: handleBrandSelected,\n onBrandCleared: handleBrandCleared,\n onBeverageSelected: handleBeverageSelected,\n onBeverageCleared: handleBeverageCleared,\n onPour: handlePour,\n onPourCancel: handlePourCancel,\n onBeforePourRejected: handleBeforePourRejected,\n onInit: handleInit,\n // Note: Timer-related handlers (onIdleTimeout, onAmbientTimer, onAttractTimer,\n // onResumeAttractTimer, onAreYouThereTimeout) are NOT included here since this\n // component's own timer hooks call those handlers directly. Including them would\n // create circular event loops.\n });\n\n const areYouThereCountdown = hasPoured\n ? areYouTherePourTimeout\n : areYouThereTimeout;\n\n useEffect(() => {\n if (nozzle && attractTimer) {\n const topic = `/kos/dispense/${nozzle?.path}/init/`;\n EventBus.publish(topic, {});\n }\n }, [nozzle, attractTimer]);\n\n return {\n showAreYouThere,\n clearAreYouThere,\n pauseIdleTimer: pause,\n restartIdleTimer: restart,\n areYouThereCountdown,\n showAmbientScreen,\n showAttractScreen,\n pauseScreenTimer: ambientPause,\n restartScreenTimer: ambientRestart,\n };\n};\n","import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { DeviceAssembly, type DeviceAssemblyModel } from \"../../../models\";\n\nexport const useDeviceAssembly = () => {\n const modelId = DeviceAssembly.type;\n const result = useKosModel<DeviceAssemblyModel>({\n modelId,\n modelType: DeviceAssembly.type,\n options: {},\n });\n\n return result;\n};\n","import type { DeviceAssemblyModel } from \"../../../models\";\nimport { useDeviceAssembly } from \"./use-device-assembly\";\n\ninterface DeviceAssemblyProps {\n deviceAssembly: DeviceAssemblyModel;\n}\n\ntype HoCDeviceAssemblyProps = DeviceAssemblyProps;\n// react HOC to provide a DeviceAssembly to a component\nexport function withDeviceAssembly<\n T extends HoCDeviceAssemblyProps = HoCDeviceAssemblyProps\n>(WrappedComponent: React.ComponentType<T>) {\n return (props: Omit<T, keyof DeviceAssemblyProps>) => {\n const { model, status, KosModelLoader } = useDeviceAssembly();\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} deviceAssembly={model} />\n </KosModelLoader>\n );\n };\n}\n","import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { Holder, type HolderModel } from \"../../../models\";\n\nexport const useHolder = (id: string) => {\n const modelId = id;\n const result = useKosModel<HolderModel>({\n modelId,\n modelType: Holder.type,\n options: {},\n });\n\n return result;\n};\n","import type { HolderModel } from \"../../../models\";\nimport { useHolder } from \"./use-holder\";\n\ninterface HolderProps {\n holder: HolderModel;\n}\n// react HOC to provide a Holder to a component\nexport function withHolder<T extends HolderProps = HolderProps>(\n id: string,\n WrappedComponent: React.ComponentType<T>\n) {\n return (props: Omit<T, keyof HolderProps>) => {\n const { model, status, KosModelLoader } = useHolder(id);\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} holder={model} />\n </KosModelLoader>\n );\n };\n}\n","import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { HolderContainer, type HolderContainerModel } from \"../../../models\";\n\nexport const useHolderContainer = () => {\n const modelId = HolderContainer.type;\n const result = useKosModel<HolderContainerModel>({\n modelId,\n modelType: HolderContainer.type,\n options: {},\n });\n\n return result;\n};\n","import type { HolderContainerModel } from \"../../../models\";\nimport { useHolderContainer } from \"./use-holder-container\";\n\ninterface HolderContainerProps {\n holderContainer: HolderContainerModel;\n}\n// react HOC to provide a HolderContainer to a component\nexport function withHolderContainer<\n T extends HolderContainerProps = HolderContainerProps\n>(WrappedComponent: React.ComponentType<T>) {\n return (props: Omit<T, keyof HolderContainerProps>) => {\n const { model, status, KosModelLoader } = useHolderContainer();\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} holderContainer={model} />\n </KosModelLoader>\n );\n };\n}\n","import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { Ingredient, type IngredientModel } from \"../../../models\";\n\nexport const useIngredient = () => {\n const modelId = Ingredient.type;\n const result = useKosModel<IngredientModel>({\n modelId,\n modelType: Ingredient.type,\n options: {},\n });\n\n return result;\n};\n","import { KosLog } from \"@kosdev-code/kos-ui-sdk\";\nimport type { IntentAware } from \"../../../../models\";\nimport type { PourStrategy } from \"./pour-strategy\";\n\nconst logger = KosLog.createLogger({\n name: \"HoldToPourIntentStrategy\",\n group: \"kos-hooks\",\n});\nexport const HoldToPourIntentStrategy: PourStrategy<IntentAware> = {\n name: \"HoldToPourIntentStrategy\",\n async initiate(model?: IntentAware, intent?: string): Promise<void> {\n if (!model?.canPour) {\n logger.debug(`${model?.id} cannot pour. Returning early.`);\n return;\n }\n if (intent) {\n logger.debug(`performing intent: ${intent}`);\n await model?.performIntent(intent);\n } else {\n logger.debug(\"no intent provided. Returning early.\");\n }\n },\n\n async initiateEnded(nozzle?: IntentAware): Promise<void> {\n await nozzle?.cancelPour();\n },\n};\n","import { useCallback } from \"react\";\n\nimport { KosLog, usePressGesture } from \"@kosdev-code/kos-ui-sdk\";\nimport type { ReactDOMAttributes } from \"@use-gesture/react/dist/declarations/src/types\";\nimport type { IntentAware } from \"../../../models\";\nimport { HoldToPourIntentStrategy } from \"../utils/pour-strategy/hold-to-pour-intent-strategy\";\nimport type { PourStrategy } from \"../utils/pour-strategy/pour-strategy\";\n\ninterface IngredientPourProps {\n onPour?: () => void;\n onPourCancel?: () => void;\n intentContainer: IntentAware;\n strategy?: PourStrategy<IntentAware>;\n}\n\nexport interface IngredientPourResponse {\n handlers: (...args: any[]) => ReactDOMAttributes;\n cancel: () => void;\n\n status?: {\n canPour: boolean;\n isPouring: boolean;\n };\n}\n\nconst logger = KosLog.createLogger({\n name: \"useNozzlePour\",\n group: \"kos-hooks\",\n});\n/**\n * Hook that encapsulates the logic for handling ingredient pouring.\n *\n * The hook will return a number of gesture handlers that can be spread onto a DOM element.\n * The hook will automatically detects if touch or mouse events are used.\n *\n *\n * @param onPour - callback initiated after pouring starts\n * @param onPourCancel - callback initiated after pouring is cancelled\n * @returns handlers - gesture handlers for nozzle pouring\n *\n *\n * @example\n * const { handlers } = useIngredientPour({\n * onPour: () => {\n * console.log(\"Pouring started\");\n * },\n * onPourCancel: () => {\n * console.log(\"Pouring cancelled\");\n * },\n * });\n *\n * <div {...handlers()} />\n *\n *\n * @see {@link IntentAware.performIntent}\n * @see {@link usePressGesture}\n **/\nexport const useIngredientPour = ({\n onPour,\n onPourCancel,\n intentContainer,\n strategy = HoldToPourIntentStrategy,\n}: IngredientPourProps): IngredientPourResponse => {\n const handlePour = useCallback(() => {\n logger.debug(\n `[${strategy?.name}] - Pour initiated for model ${intentContainer?.id}.`\n );\n strategy?.initiate(intentContainer);\n onPour?.();\n }, [onPour, intentContainer, strategy]);\n\n const handleCancelPour = useCallback(() => {\n logger.debug(\n `[${strategy?.name}] - Pour initiate ended called for nozzle ${intentContainer?.id}.`\n );\n strategy?.initiateEnded?.(intentContainer);\n onPourCancel?.();\n }, [onPourCancel, intentContainer, strategy]);\n\n const forceCancelPour = useCallback(() => {\n logger.debug(`Force cancelling pour for nozzle ${intentContainer?.id}.`);\n intentContainer?.cancelPour();\n onPourCancel?.();\n }, [onPourCancel, intentContainer]);\n\n const handlers = usePressGesture({\n onPressed: handlePour,\n onRelease: handleCancelPour,\n });\n\n return {\n handlers: handlers.dom,\n cancel: forceCancelPour,\n status: intentContainer,\n };\n};\n","import type { IngredientModel } from \"../../../models\";\nimport { useIngredient } from \"./use-ingredient\";\n\ninterface IngredientProps {\n ingredient: IngredientModel;\n}\n// react HOC to provide a Ingredient to a component\nexport function withIngredient<T extends IngredientProps = IngredientProps>(\n WrappedComponent: React.ComponentType<T>\n) {\n return (props: Omit<T, keyof IngredientProps>) => {\n const { model, status, KosModelLoader } = useIngredient();\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} ingredient={model} />\n </KosModelLoader>\n );\n };\n}\n","import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport {\n IngredientContainer,\n type IngredientContainerModel,\n} from \"../../../models\";\n\nexport const useIngredientContainer = () => {\n const modelId = IngredientContainer.type;\n const result = useKosModel<IngredientContainerModel>({\n modelId,\n modelType: IngredientContainer.type,\n options: {},\n });\n\n return result;\n};\n","import type { IngredientContainerModel } from \"../../../models\";\nimport { useIngredientContainer } from \"./use-ingredient-container\";\n\ninterface IngredientContainerProps {\n ingredientContainer: IngredientContainerModel;\n}\n// react HOC to provide a IngredientContainer to a component\nexport function withIngredientContainer<\n T extends IngredientContainerProps = IngredientContainerProps\n>(WrappedComponent: React.ComponentType<T>) {\n return (props: Omit<T, keyof IngredientContainerProps>) => {\n const { model, status, KosModelLoader } = useIngredientContainer();\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} ingredientContainer={model} />\n </KosModelLoader>\n );\n };\n}\n","import type { NozzleModel } from \"../../../models\";\nimport { useNozzle } from \"./use-nozzle\";\n\ninterface NozzleProps {\n nozzle: NozzleModel;\n}\n// react HOC to provide a Nozzle to a component\nexport function withNozzle<T extends NozzleProps = NozzleProps>(\n path: string,\n WrappedComponent: React.ComponentType<T>\n) {\n return (props: Omit<T, keyof NozzleProps>) => {\n const { model, status, KosModelLoader } = useNozzle(path);\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} nozzle={model} />\n </KosModelLoader>\n );\n };\n}\n","import { useCallback, useState } from \"react\";\n\nimport { KosLog, usePressGesture } from \"@kosdev-code/kos-ui-sdk\";\nimport type { ReactDOMAttributes } from \"@use-gesture/react/dist/declarations/src/types\";\nimport type { PourState } from \"../../../models/models/types/pouring\";\nimport { PourContext } from \"../../utils/pour-context\";\nimport { HoldToPourStrategy } from \"../utils/pour-strategy/hold-to-pour-strategy\";\nimport type {\n PourStrategy,\n PourStrategyAware,\n} from \"../utils/pour-strategy/pour-strategy\";\n\ninterface PourProps {\n onBeforePour?: (context?: PourContext) => Promise<boolean>;\n onPour?: () => void;\n onPourCancel?: () => void;\n onPourAbort?: () => void;\n pourTarget: PourStrategyAware;\n strategy?: PourStrategy;\n pourContext?: PourContext;\n}\n\nexport interface PourResponse {\n handlers: (...args: any[]) => ReactDOMAttributes;\n updatePourContext?: (key: string, value: any) => void;\n removeFromPourContext?: (key: string) => void;\n cancel: () => void;\n\n status?: {\n canPour: boolean;\n isPouring: boolean;\n currentState: PourState;\n };\n}\n\nconst logger = KosLog.createLogger({\n name: \"usePour\",\n group: \"kos-hooks\",\n});\n/**\n * Hook that encapsulates the logic for handling generic pouring.\n *\n * The hook will return a number of gesture handlers that can be spread onto a DOM element.\n * The hook will automatically detects if touch or mouse events are used.\n *\n *\n * @param onPour - callback initiated after pouring starts\n * @param onPourCancel - callback initiated after pouring is cancelled\n * @returns handlers - gesture handlers for nozzle pouring\n *\n *\n * @example\n * const { handlers } = usePour({\n * onPour: () => {\n * console.log(\"Pouring started\");\n * },\n * onPourCancel: () => {\n * console.log(\"Pouring cancelled\");\n * },\n * });\n *\n * <div {...handlers()} />\n *\n \n * @see {@link usePressGesture}\n **/\nexport const usePourTarget = ({\n onBeforePour,\n onPour,\n onPourCancel,\n onPourAbort,\n pourTarget,\n pourContext,\n strategy = HoldToPourStrategy,\n}: PourProps): PourResponse => {\n const [context, _setContext] = useState<PourContext>(\n pourContext || new PourContext()\n );\n const handlePour = useCallback(async () => {\n logger.debug(\n `[${strategy?.name}] - calling before pour for pour target ${pourTarget?.id}.`\n );\n const canPour = onBeforePour ? await onBeforePour?.(context) : true;\n if (canPour) {\n logger.debug(\n `[${strategy?.name}] - Pour initiated for pour target ${pourTarget?.id}.`\n );\n await strategy?.initiate(pourTarget);\n onPour?.();\n if (!pourTarget?.isPouring) {\n onPourAbort?.();\n }\n } else {\n logger.debug(\n `[${strategy?.name}] - Pour cancelled for pour target ${pourTarget?.id}.`\n );\n onPourCancel?.();\n }\n }, [onPour, onBeforePour, onPourAbort, pourTarget, strategy, context]);\n\n const handleCancelPour = useCallback(async () => {\n logger.debug(\n `[${strategy?.name}] - Pour initiate ended called for pour target ${pourTarget?.id}.`\n );\n const ignore = await strategy?.initiateEnded?.(pourTarget);\n if (!ignore) {\n onPourCancel?.();\n }\n }, [onPourCancel, pourTarget, strategy]);\n\n const forceCancelPour = useCallback(async () => {\n logger.debug(`Force cancelling pour for pour target ${pourTarget?.id}.`);\n await pourTarget?.cancelPour();\n onPourCancel?.();\n }, [onPourCancel, pourTarget]);\n\n const handleUpdateContext = useCallback(\n (key: string, value: any) => {\n context.set(key, value);\n },\n [context]\n );\n\n const handleRemoveFromContext = useCallback(\n (key: string) => {\n context.remove(key);\n },\n [context]\n );\n\n const handlers = usePressGesture({\n onPressed: handlePour,\n onRelease: handleCancelPour,\n });\n\n return {\n handlers: handlers.dom,\n cancel: forceCancelPour,\n updatePourContext: handleUpdateContext,\n removeFromPourContext: handleRemoveFromContext,\n status: pourTarget,\n };\n};\n","import { KosLog } from \"@kosdev-code/kos-ui-sdk\";\nimport type { IntentAware } from \"../../../../models\";\nimport type { PourStrategy } from \"./pour-strategy\";\n\nconst logger = KosLog.createLogger({\n name: \"TapOrHoldIntentStrategy\",\n group: \"kos-hooks\",\n});\n\nexport class TapOrHoldIntentStrategy implements PourStrategy<IntentAware> {\n intent: string;\n name = \"TapOrHoldIntentStrategy\";\n isHold = false;\n private disposer?: NodeJS.Timeout | null = null;\n constructor(intent: string) {\n this.intent = intent;\n }\n\n async initiate(model?: IntentAware, intent?: string): Promise<void> {\n this.disposer = setTimeout(() => {\n this.isHold = true;\n }, 250);\n\n if (model?.isPouring && !this.isHold) {\n logger.debug(`additional tap detected. cancelling pour`);\n await model.cancelPour();\n return;\n }\n if (!model?.canPour) {\n logger.debug(`${model?.id} cannot pour. Returning early.`);\n return;\n }\n if (intent) {\n logger.debug(`performing intent: ${intent}`);\n await model?.performIntent(intent);\n } else {\n logger.debug(\"no intent provided. Returning early.\");\n }\n }\n async initiateEnded(nozzle?: IntentAware): Promise<boolean> {\n if (this.disposer) clearTimeout(this.disposer);\n this.disposer = null;\n if (!this.isHold) {\n logger.debug(\"Tap detected. don't cancel and return.\");\n return true;\n }\n await nozzle?.cancelPour();\n return false;\n }\n}\n","import { KosLog } from \"@kosdev-code/kos-ui-sdk\";\nimport type { IntentAware } from \"../../../../models\";\nimport type { PourStrategy } from \"./pour-strategy\";\n\nconst logger = KosLog.createLogger({\n name: \"TapToPourIntentStrategy\",\n group: \"kos-hooks\",\n});\nexport const TapToPourIntentStrategy: PourStrategy<IntentAware> = {\n name: \"TapToPourIntentStrategy\",\n async initiate(model?: IntentAware, intent?: string): Promise<void> {\n if (model?.isPouring) {\n logger.debug(`Nozzle ${model?.id} is already pouring. cancelling pour`);\n await model.cancelPour();\n return;\n }\n if (!model?.canPour) {\n logger.debug(`Nozzle ${model?.id} cannot pour. Returning early.`);\n return;\n }\n if (intent) {\n logger.debug(`performing intent: ${intent}`);\n await model?.performIntent(intent);\n } else {\n logger.debug(\"no intent provided. Returning early.\");\n }\n },\n\n async initiateEnded(_nozzle?: IntentAware): Promise<boolean> {\n return true;\n },\n};\n","import { KosLog } from \"@kosdev-code/kos-ui-sdk\";\nimport type { PourStrategy, PourStrategyAware } from \"./pour-strategy\";\n\nconst logger = KosLog.createLogger({\n name: \"HoldToPourStrategy\",\n group: \"kos-hooks\",\n});\nexport const TapToPourStrategy: PourStrategy = {\n name: \"TapToPourStrategy\",\n async initiate(nozzle?: PourStrategyAware): Promise<void> {\n if (nozzle?.isPouring) {\n logger.debug(`Nozzle ${nozzle?.id} is already pouring. cancelling pour`);\n await nozzle.cancelPour();\n return;\n }\n if (!nozzle?.canPour) {\n logger.debug(`Nozzle ${nozzle?.id} cannot pour. Returning early.`);\n return;\n }\n await nozzle?.pour();\n },\n\n async initiateEnded(_nozzle?: PourStrategyAware): Promise<boolean> {\n return true;\n },\n};\n","import {\n GenericPour,\n GenericPourModel,\n type GenericPourOptions,\n} from \"@kosdev-code/kos-dispense-sdk\";\nimport { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\n\nexport const useGenericPour = (\n id: string,\n servicePathFactory: (selectedId: string) => string,\n itemId?: string\n) => {\n const modelId = id;\n const result = useKosModel<GenericPourModel, GenericPourOptions>({\n modelId,\n modelType: GenericPour.type,\n options: {\n servicePathFactory,\n selectedId: itemId,\n },\n });\n\n return result;\n};\n","import { GenericPourModel } from \"@kosdev-code/kos-dispense-sdk\";\nimport { useGenericPour } from \"./use-generic-pour\";\n\ninterface GenericPourProps {\n genericPour: GenericPourModel;\n}\n\ninterface Identifiable {\n id: string;\n servicePathFactory: (selectedId: string) => string;\n itemId?: string;\n}\n\ntype HoCGenericPourProps = GenericPourProps & Identifiable;\n// react HOC to provide a GenericPour to a component\nexport function withGenericPour<\n T extends HoCGenericPourProps = HoCGenericPourProps\n>(WrappedComponent: React.ComponentType<T>) {\n return (props: Omit<T, keyof GenericPourProps>) => {\n const { model, status, KosModelLoader } = useGenericPour(\n props.id,\n props.servicePathFactory,\n props.itemId\n );\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} genericPour={model} />\n </KosModelLoader>\n );\n };\n}\n","import { PropsWithChildren, createContext, useContext, useMemo } from \"react\";\nimport type { AssemblyModel } from \"../../../models/models/assembly\";\nimport { useAssembly } from \"../../hooks\";\n\ninterface AssemblyType<\n AssemblyExt extends object = any,\n HolderExt extends object = any\n> {\n model?: AssemblyModel<AssemblyExt, HolderExt>;\n}\nconst Assembly = createContext<AssemblyType | undefined>(undefined);\n\ninterface AssemblyProviderProps {}\n\nexport const AssemblyProvider: React.FunctionComponent<\n PropsWithChildren<AssemblyProviderProps>\n> = ({ children }) => {\n const { model, ready } = useAssembly();\n const value: AssemblyType = useMemo(() => {\n if (ready && model) {\n return { model };\n }\n return {};\n }, [ready, model]);\n return <Assembly.Provider value={value}>{children}</Assembly.Provider>;\n};\nexport const useAssemblyContext = <\n AssemblyExt extends object = any,\n HolderExt extends object = any\n>() => {\n const context: AssemblyType<AssemblyExt, HolderExt> = useContext(\n Assembly\n ) as AssemblyType<AssemblyExt, HolderExt>;\n if (!context) {\n throw new Error(\n \"useAssemblyContext must be used within a AssemblyProvider\"\n );\n }\n return context;\n};\n","import { PropsWithChildren, createContext, useContext, useMemo } from \"react\";\nimport type { AvailabilityModel } from \"../../../models\";\nimport { useAvailability } from \"../../hooks/availability/use-availability\";\n\ninterface AvailabilityType {\n model?: AvailabilityModel;\n}\nconst Availability = createContext<AvailabilityType | undefined>(undefined);\n\ninterface AvailabilityProviderProps {\n id?: string;\n}\n\nexport const AvailabilityProvider: React.FunctionComponent<\n PropsWithChildren<AvailabilityProviderProps>\n> = ({ children }) => {\n const { model, ready } = useAvailability();\n const value: AvailabilityType = useMemo(() => {\n if (ready && model) {\n return { model };\n }\n return {};\n }, [ready, model]);\n return (\n <Availability.Provider value={value}>{children}</Availability.Provider>\n );\n};\nexport const useAvailabilityContext = () => {\n const context = useContext(Availability);\n if (!context) {\n throw new Error(\n \"useAvailabilityContext must be used within a AvailabilityProvider\"\n );\n }\n return context;\n};\n","import { PropsWithChildren, createContext, useContext, useMemo } from \"react\";\nimport type { BoardModel } from \"../../../models\";\nimport { useBoard } from \"../../hooks/board/use-board\";\n\ninterface BoardType {\n model?: BoardModel;\n}\nconst Board = createContext<BoardType | undefined>(undefined);\n\ninterface BoardProviderProps {\n id: string;\n}\n\nexport const BoardProvider: React.FunctionComponent<\n PropsWithChildren<BoardProviderProps>\n> = ({ children, id }) => {\n const { model, ready } = useBoard(id);\n const value: BoardType = useMemo(() => {\n if (ready && model) {\n return { model };\n }\n return {};\n }, [ready, model]);\n return <Board.Provider value={value}>{children}</Board.Provider>;\n};\nexport const useBoardContext = () => {\n const context = useContext(Board);\n if (!context) {\n throw new Error(\"useBoardContext must be used within a BoardProvider\");\n }\n return context;\n};\n","import { PropsWithChildren, createContext, useContext, useMemo } from \"react\";\nimport type { BoardContainerModel } from \"../../../models\";\nimport { useBoardContainer } from \"../../hooks/board-container/use-board-container\";\n\ninterface BoardContainerType {\n model?: BoardContainerModel;\n}\nconst BoardContainer = createContext<BoardContainerType | undefined>(undefined);\n\ninterface BoardContainerProviderProps {}\n\nexport const BoardContainerProvider: React.FunctionComponent<\n PropsWithChildren<BoardContainerProviderProps>\n> = ({ children }) => {\n const { model, ready } = useBoardContainer();\n const value: BoardContainerType = useMemo(() => {\n if (ready && model) {\n return { model };\n }\n return {};\n }, [ready, model]);\n return (\n <BoardContainer.Provider value={value}>{children}</BoardContainer.Provider>\n );\n};\nexport const useBoardContainerContext = () => {\n const context = useContext(BoardContainer);\n if (!context) {\n throw new Error(\n \"useBoardContainerContext must be used within a BoardContainerProvider\"\n );\n }\n return context;\n};\n","import { PropsWithChildren, createContext, useContext, useMemo } from \"react\";\nimport { DeviceAssemblyModel } from \"../../../models\";\nimport { useDeviceAssembly } from \"../../hooks/device-assembly/use-device-assembly\";\n\ninterface DeviceAssemblyType {\n model?: DeviceAssemblyModel;\n nozzlePaths?: string[];\n}\nconst DeviceAssemblyContext = createContext<DeviceAssemblyType | undefined>(\n undefined\n);\n\ntype DeviceAssemblyProviderProps = object;\n\nexport const DeviceAssemblyProvider: React.FunctionComponent<\n PropsWithChildren<DeviceAssemblyProviderProps>\n> = ({ children }) => {\n const { model, ready } = useDeviceAssembly();\n const value: DeviceAssemblyType = useMemo(() => {\n if (ready && model) {\n const nozzlePaths = model.nozzlePaths;\n return { model, nozzlePaths };\n }\n return {};\n }, [ready, model]);\n\n const content = ready && model ? children : null;\n return (\n <DeviceAssemblyContext.Provider value={value}>\n {content}\n </DeviceAssemblyContext.Provider>\n );\n};\nexport const useDeviceAssemblyContext = () => {\n const context = useContext(DeviceAssemblyContext);\n if (!context) {\n throw new Error(\n \"useDeviceAssemblyContext must be used within a DeviceAssemblyProvider\"\n );\n }\n return context;\n};\n","import React, { useContext, type ReactNode } from \"react\";\nimport {\n useCuiKit,\n type CuiKitType,\n type UseCuiKitProps,\n} from \"../../hooks/cui-kit/use-cui-kit\";\nimport {\n DeviceAssemblyProvider,\n useDeviceAssemblyContext,\n} from \"../device-assembly/device-assembly-provider\";\nimport { NozzleProvider } from \"../nozzle/nozzle-provider\";\n\nfunction createDispenseKitContext<\n BrandData extends Record<string, any> = any,\n BeverageData extends Record<string, any> = any,\n FlavorData extends Record<string, any> = any\n>() {\n const CuiKitContext = React.createContext<CuiKitType<\n BrandData,\n BeverageData,\n FlavorData\n > | null>(null);\n\n const useCuiKitContext = () => {\n const ctx = useContext(CuiKitContext);\n if (ctx === undefined) {\n throw new Error(\"useDispenseKitContext must be used within a Provider\");\n }\n return ctx;\n };\n\n return [useCuiKitContext, CuiKitContext.Provider] as const;\n}\n\nexport function CuiKitWrapper<\n BrandData extends Record<string, any> = any,\n BeverageData extends Record<string, any> = any,\n FlavorData extends Record<string, any> = any\n>({\n children,\n provider: CuiKitProvider,\n props,\n nozzleProps,\n}: DispenseViewProps & { nozzleProps?: ChildProps }) {\n const result = useCuiKit<BrandData, BeverageData, FlavorData>(props);\n\n return (\n <CuiKitProvider value={result}>\n {children(nozzleProps || {})}\n </CuiKitProvider>\n );\n}\n\ninterface ChildProps {\n nozzleIndex?: number;\n nozzlePath?: string;\n totalNozzles?: number;\n isFirstNozzle?: boolean;\n isLastNozzle?: boolean;\n}\n\ninterface DispenseViewProps<\n BrandData extends Record<string, any> = any,\n BeverageData extends Record<string, any> = any,\n FlavorData extends Record<string, any> = any\n> {\n children: (props: ChildProps) => ReactNode;\n provider: React.Provider<CuiKitType<\n BrandData,\n BeverageData,\n FlavorData\n > | null>;\n props: UseCuiKitProps;\n}\nfunction DispenseView<\n BrandData extends Record<string, any> = any,\n BeverageData extends Record<string, any> = any,\n FlavorData extends Record<string, any> = any\n>({\n children,\n provider,\n props,\n}: DispenseViewProps<BrandData, BeverageData, FlavorData>) {\n const { nozzlePaths } = useDeviceAssemblyContext();\n const totalNozzles = nozzlePaths?.length || 0;\n\n const nozzles =\n nozzlePaths?.map((path, index) => (\n <NozzleProvider key={path} path={path}>\n <CuiKitWrapper<BrandData, BeverageData, FlavorData>\n provider={provider}\n props={props}\n nozzleProps={{\n nozzleIndex: index,\n nozzlePath: path,\n totalNozzles,\n isFirstNozzle: index === 0,\n isLastNozzle: index === totalNozzles - 1,\n }}\n >\n {children}\n </CuiKitWrapper>\n </NozzleProvider>\n )) || [];\n return nozzles;\n}\n\nexport interface CuiKitProps {\n children: () => ReactNode;\n}\n\ninterface CuiKitProviderProps<\n BrandData extends Record<string, any> = any,\n BeverageData extends Record<string, any> = any,\n FlavorData extends Record<string, any> = any\n> {\n provider: React.Provider<CuiKitType<\n BrandData,\n BeverageData,\n FlavorData\n > | null>;\n props: UseCuiKitProps;\n}\nexport function CuiKit<\n BrandData extends Record<string, any> = any,\n BeverageData extends Record<string, any> = any,\n FlavorData extends Record<string, any> = any\n>({\n provider,\n props,\n}: CuiKitProviderProps<BrandData, BeverageData, FlavorData>) {\n return ({ children }: CuiKitProps) =>\n provider ? (\n <DeviceAssemblyProvider>\n <DispenseView<BrandData, BeverageData, FlavorData>\n provider={provider}\n props={props}\n >\n {children}\n </DispenseView>\n </DeviceAssemblyProvider>\n ) : null;\n}\n\nexport function initializeCuiKit<\n BrandData extends Record<string, any> = any,\n BeverageData extends Record<string, any> = any,\n FlavorData extends Record<string, any> = any\n>(props: UseCuiKitProps) {\n const [useCuiKitContext, DispenseKitProvider] = createDispenseKitContext<\n BrandData,\n BeverageData,\n FlavorData\n >();\n return [\n useCuiKitContext,\n CuiKit({ provider: DispenseKitProvider, props }),\n ] as const;\n}\n","import { PropsWithChildren, createContext, useContext, useMemo } from \"react\";\nimport type { HolderModel } from \"../../../models\";\nimport { useHolder } from \"../../hooks/holder/use-holder\";\n\ninterface HolderType {\n model?: HolderModel;\n}\nconst Holder = createContext<HolderType | undefined>(undefined);\n\ninterface HolderProviderProps {\n id?: string;\n}\n\nexport const HolderProvider: React.FunctionComponent<\n PropsWithChildren<HolderProviderProps>\n> = ({ children, id }) => {\n const { model, ready } = useHolder(id || \"\");\n const value: HolderType = useMemo(() => {\n if (ready && model) {\n return { model };\n }\n return {};\n }, [ready, model]);\n return <Holder.Provider value={value}>{children}</Holder.Provider>;\n};\nexport const useHolderContext = () => {\n const context = useContext(Holder);\n if (!context) {\n throw new Error(\"useHolderContext must be used within a HolderProvider\");\n }\n return context;\n};\n","import { PropsWithChildren, createContext, useContext, useMemo } from \"react\";\nimport { type HolderContainerModel } from \"../../../models\";\nimport { useHolderContainer } from \"../../hooks/holder-container/use-holder-container\";\n\ninterface HolderContainerType {\n model?: HolderContainerModel;\n}\nconst HolderContainer = createContext<HolderContainerType | undefined>(\n undefined\n);\n\ninterface HolderContainerProviderProps {\n id?: string;\n}\n\nexport const HolderContainerProvider: React.FunctionComponent<\n PropsWithChildren<HolderContainerProviderProps>\n> = ({ children }) => {\n const { model, ready } = useHolderContainer();\n const value: HolderContainerType = useMemo(() => {\n if (ready && model) {\n return { model };\n }\n return {};\n }, [ready, model]);\n return (\n <HolderContainer.Provider value={value}>\n {children}\n </HolderContainer.Provider>\n );\n};\nexport const useHolderContainerContext = () => {\n const context = useContext(HolderContainer);\n if (!context) {\n throw new Error(\n \"useHolderContainerContext must be used within a HolderContainerProvider\"\n );\n }\n return context;\n};\n","import { PropsWithChildren, createContext, useContext, useMemo } from \"react\";\nimport type { IngredientModel } from \"../../../models\";\nimport { useIngredient } from \"../../hooks/ingredient/use-ingredient\";\n\ninterface IngredientType {\n model?: IngredientModel;\n}\nconst Ingredient = createContext<IngredientType | undefined>(undefined);\n\ninterface IngredientProviderProps {\n id?: string;\n}\n\nexport const IngredientProvider: React.FunctionComponent<\n PropsWithChildren<IngredientProviderProps>\n> = ({ children }) => {\n const { model, ready } = useIngredient();\n const value: IngredientType = useMemo(() => {\n if (ready && model) {\n return { model };\n }\n return {};\n }, [ready, model]);\n return <Ingredient.Provider value={value}>{children}</Ingredient.Provider>;\n};\nexport const useIngredientContext = () => {\n const context = useContext(Ingredient);\n if (!context) {\n throw new Error(\n \"useIngredientContext must be used within a IngredientProvider\"\n );\n }\n return context;\n};\n","import { PropsWithChildren, createContext, useContext, useMemo } from \"react\";\nimport type { IngredientContainerModel } from \"../../../models\";\nimport { useIngredientContainer } from \"../../hooks/ingredient-container/use-ingredient-container\";\n\ninterface IngredientContainerType {\n model?: IngredientContainerModel;\n}\nconst IngredientContainer = createContext<IngredientContainerType | undefined>(\n undefined\n);\n\ninterface IngredientContainerProviderProps {\n id?: string;\n}\n\nexport const IngredientContainerProvider: React.FunctionComponent<\n PropsWithChildren<IngredientContainerProviderProps>\n> = ({ children }) => {\n const { model, ready } = useIngredientContainer();\n const value: IngredientContainerType = useMemo(() => {\n if (ready && model) {\n return { model };\n }\n return {};\n }, [ready, model]);\n return (\n <IngredientContainer.Provider value={value}>\n {children}\n </IngredientContainer.Provider>\n );\n};\nexport const useIngredientContainerContext = () => {\n const context = useContext(IngredientContainer);\n if (!context) {\n throw new Error(\n \"useIngredientContainerContext must be used within a IngredientContainerProvider\"\n );\n }\n return context;\n};\n","import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { Pump, type PumpModel } from \"../../../models\";\n\nexport const usePump = () => {\n const modelId = Pump.type;\n const result = useKosModel<PumpModel>({\n modelId,\n modelType: Pump.type,\n options: {},\n });\n\n return result;\n};\n","import { PropsWithChildren, createContext, useContext, useMemo } from \"react\";\nimport type { PumpModel } from \"../../../models\";\nimport { usePump } from \"../../hooks/pump/use-pump\";\n\ninterface PumpType {\n model?: PumpModel;\n}\nconst Pump = createContext<PumpType | undefined>(undefined);\n\ninterface PumpProviderProps {\n id?: string;\n}\n\nexport const PumpProvider: React.FunctionComponent<\n PropsWithChildren<PumpProviderProps>\n> = ({ children }) => {\n const { model, ready } = usePump();\n const value: PumpType = useMemo(() => {\n if (ready && model) {\n return { model };\n }\n return {};\n }, [ready, model]);\n return <Pump.Provider value={value}>{children}</Pump.Provider>;\n};\nexport const usePumpContext = () => {\n const context = useContext(Pump);\n if (!context) {\n throw new Error(\"usePumpContext must be used within a PumpProvider\");\n }\n return context;\n};\n"],"names":["useAssembly","modelId","Assembly","useKosModel","withAssembly","WrappedComponent","props","model","status","KosModelLoader","jsx","useAvailability","Availability","withBeverage","useBoard","id","Board","withBoard","useBoardContainer","BoardContainer","withBoardContainer","useNozzle","path","Nozzle","createContext","NozzleProvider","children","ready","value","useMemo","useNozzleContext","context","useContext","useBeverages","onBeverageSelected","onClearBeverage","companionType","nozzle","beverages","setBeverages","useState","selectedBeverage","setSelectedBeverage","companions","brand","getKosCompanionModel","selectBeverage","useCallback","beverage","clearBeverage","useEffect","disposer","kosAutoEffect","selectedBrand","allBeverages","useBrands","onBrandSelected","onBrandCleared","setSelectedBrand","brands","setBrands","selectBrand","clearBrand","PourContext","__publicField","key","logger","KosLog","HoldToPourStrategy","useNozzlePour","onPour","onPourCancel","onBeforePour","onBeforePourRejected","pourContext","strategy","_setContext","handlePour","handleCancelPour","_a","forceCancelPour","handleUpdateContext","handleRemoveFromContext","usePressGesture","useFlavors","onFlavorSelected","onFlavorCleared","flavors","f","flavor","selectedFlavors","setSelectedFlavors","selectFlavor","previous","p","clear","DISPENSE_GROUP_BRAND","DISPENSE_GROUP_BEVERAGE","DISPENSE_GROUP_FLAVOR","log","useCuiKit","initialGroup","options","currentGroup","setCurrentGroup","timersRef","useRef","updatePourContext","removeFromPourContext","topic","EventBus","onBeverageCleared","handleBeforePour","handleBeforePourRejected","brandCompanions","beverageCompanions","_b","clearFlavors","flavorCompanions","_c","setOnBeforePour","updateOnBeforePour","callback","pour","back","home","pauseTimers","timer","restartTimers","t","useAmbientAttractTimers","attractTimer","setAttractTimer","onAmbientTimer","onAttractTimer","onResetAttractTimer","onResumeAttractTimer","defaultAttractTime","defaultAmbientTime","handleAmbientTimer","handleAttractTimer","handleResetAttractTimer","handlePauseAttractTimer","handleResume","TimerManager","subscribe","useDispenseLifecycle","onInit","onReturnToHome","onIdleTimeout","onAreYouThereTimeout","disposers","useCuiKitTimers","idleTimer","setIdleTimer","onAreYouThereTimer","onIdleTimer","onResetIdleTimer","defaultAreYouThereTime","defaultIdleTime","hasAreYouThereFiredRef","handleAreYouThereTimer","handleIdleTimer","handleRestartIdleTimer","handlePauseIdleTimer","useDefaultCuiKitLifecycle","kit","inactivity","screens","onBeforeAreYouThereTimer","areYouThereRejectionPolicy","showAmbientScreen","setShowAmbientScreen","showAttractScreen","setShowAttractScreen","hasPoured","setHasPoured","idleTimeout","areYouThereTimeout","idlePourTimeout","areYouTherePourTimeout","ambientTimeout","attractTimeout","handleIdleTimeout","setShowAreYouThere","handleResetIdleTimer","handleAttractResume","ambientPause","ambientRestart","showAreYouThere","pause","restart","pausePourTimer","restartPourTimer","pourIdleTimer","shouldShowAreYouThere","error","clearAreYouThere","_d","handlePourCancel","handleBrandSelected","handleBrandCleared","handleBeverageSelected","handleBeverageCleared","handleInit","areYouThereCountdown","useDeviceAssembly","DeviceAssembly","withDeviceAssembly","useHolder","Holder","withHolder","useHolderContainer","HolderContainer","withHolderContainer","useIngredient","Ingredient","HoldToPourIntentStrategy","intent","useIngredientPour","intentContainer","withIngredient","useIngredientContainer","IngredientContainer","withIngredientContainer","withNozzle","usePourTarget","onPourAbort","pourTarget","TapOrHoldIntentStrategy","TapToPourIntentStrategy","_nozzle","TapToPourStrategy","useGenericPour","servicePathFactory","itemId","GenericPour","withGenericPour","AssemblyProvider","useAssemblyContext","AvailabilityProvider","useAvailabilityContext","BoardProvider","useBoardContext","BoardContainerProvider","useBoardContainerContext","DeviceAssemblyContext","DeviceAssemblyProvider","nozzlePaths","content","useDeviceAssemblyContext","createDispenseKitContext","CuiKitContext","React","ctx","CuiKitWrapper","CuiKitProvider","nozzleProps","result","DispenseView","provider","totalNozzles","index","CuiKit","initializeCuiKit","useCuiKitContext","DispenseKitProvider","HolderProvider","useHolderContext","HolderContainerProvider","useHolderContainerContext","IngredientProvider","useIngredientContext","IngredientContainerProvider","useIngredientContainerContext","usePump","Pump","PumpProvider","usePumpContext"],"mappings":";;;;;;;;AAGO,MAAMA,KAAc,MAAM;AAC/B,QAAMC,IAAUC,GAAS;AAOzB,SANeC,EAA2B;AAAA,IACxC,SAAAF;AAAA,IACA,WAAWC,GAAS;AAAA,IACpB,SAAS,CAAA;AAAA,EAAC,CACX;AAGH;ACLO,SAASE,GACdC,GACA;AACA,SAAO,CAACC,MAAwC;AAC9C,U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A,MACR;AAAA,IAAA;AAGJ,SAAOA;AACT,GCpCaoP,KAAU,MAAM;AAC3B,QAAMlR,IAAUmR,GAAK;AAOrB,SANejR,EAAuB;AAAA,IACpC,SAAAF;AAAA,IACA,WAAWmR,GAAK;AAAA,IAChB,SAAS,CAAA;AAAA,EAAC,CACX;AAGH,GCLMA,KAAO5P,EAAoC,MAAS,GAM7C6P,KAET,CAAC,EAAE,UAAA3P,QAAe;AACpB,QAAM,EAAE,OAAAnB,GAAO,OAAAoB,EAAA,IAAUwP,GAAA,GACnBvP,IAAkBC,EAAQ,MAC1BF,KAASpB,IACJ,EAAE,OAAAA,EAAA,IAEJ,CAAA,GACN,CAACoB,GAAOpB,CAAK,CAAC;AACjB,SAAO,gBAAAG,EAAC0Q,GAAK,UAAL,EAAc,OAAAxP,GAAe,UAAAF,EAAA,CAAS;AAChD,GACa4P,KAAiB,MAAM;AAClC,QAAMvP,IAAUC,EAAWoP,EAAI;AAC/B,MAAI,CAACrP;AACH,UAAM,IAAI,MAAM,mDAAmD;AAErE,SAAOA;AACT;"}
1
+ {"version":3,"file":"pump-provider-DodZo0It.js","sources":["../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/assembly/use-assembly.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/assembly/with-assembly.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/availability/use-availability.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/availability/with-availability.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/board/use-board.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/board/with-board.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/board-container/use-board-container.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/board-container/with-board-container.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/nozzle/use-nozzle.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/contexts/nozzle/nozzle-provider.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/cui-kit/use-beverages.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/cui-kit/use-brands.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/utils/pour-context.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/utils/pour-strategy/hold-to-pour-strategy.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/nozzle-pour/use-nozzle-pour.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/cui-kit/use-flavors.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/cui-kit/use-cui-kit.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/cui-kit/use-ambient-attract-timers.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/cui-kit/use-dispense-lifecycle.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/cui-kit/use-dispense-timers.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/cui-kit/use-default-cui-kit-lifecycle.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/device-assembly/use-device-assembly.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/device-assembly/with-device-assembly.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/holder/use-holder.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/holder/with-holder.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/holder-container/use-holder-container.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/holder-container/with-holder-container.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/ingredient/use-ingredient.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/utils/pour-strategy/hold-to-pour-intent-strategy.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/ingredient/use-ingredient-pour.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/ingredient/with-ingredient.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/ingredient-container/use-ingredient-container.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/ingredient-container/with-ingredient-container.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/nozzle/with-nozzle.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/pour/use-pour.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/utils/pour-strategy/tap-or-hold-to-pour-intent-strategy.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/utils/pour-strategy/tap-to-pour-intent-strategy.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/utils/pour-strategy/tap-to-pour-strategy.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/generic-pour/use-generic-pour.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/generic-pour/with-generic-pour.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/contexts/assembly/assembly-provider.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/contexts/availability/availability-provider.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/contexts/board/board-provider.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/contexts/board-container/board-container-provider.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/contexts/device-assembly/device-assembly-provider.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/contexts/cui-kit/cui-kit.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/contexts/holder/holder-provider.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/contexts/holder-container/holder-container-provider.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/contexts/ingredient/ingredient-provider.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/contexts/ingredient-container/ingredient-container-provider.tsx","../../../../packages/sdk/kos-dispense-sdk/src/ui/hooks/pump/use-pump.ts","../../../../packages/sdk/kos-dispense-sdk/src/ui/contexts/pump/pump-provider.tsx"],"sourcesContent":["import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { Assembly, type AssemblyModel } from \"../../../models\";\n\nexport const useAssembly = () => {\n const modelId = Assembly.type;\n const result = useKosModel<AssemblyModel>({\n modelId,\n modelType: Assembly.type,\n options: {},\n });\n\n return result;\n};\n","import type { AssemblyModel } from \"../../../models\";\nimport { useAssembly } from \"./use-assembly\";\n\ninterface AssemblyProps {\n assembly: AssemblyModel;\n}\n// react HOC to provide a Assembly to a component\nexport function withAssembly<T extends AssemblyProps = AssemblyProps>(\n WrappedComponent: React.ComponentType<T>\n) {\n return (props: Omit<T, keyof AssemblyProps>) => {\n const { model, status, KosModelLoader } = useAssembly();\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} assembly={model} />\n </KosModelLoader>\n );\n };\n}\n","import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { Availability, type AvailabilityModel } from \"../../../models\";\n\nexport const useAvailability = () => {\n const modelId = Availability.type;\n const result = useKosModel<AvailabilityModel>({\n modelId,\n modelType: Availability.type,\n options: {},\n });\n\n return result;\n};\n","import type { AvailabilityModel } from \"../../../models\";\nimport { useAvailability } from \"./use-availability\";\n\ninterface AvailabilityProps {\n beverage: AvailabilityModel;\n}\n// react HOC to provide a Beverage to a component\nexport function withBeverage<T extends AvailabilityProps = AvailabilityProps>(\n WrappedComponent: React.ComponentType<T>\n) {\n return (props: Omit<T, keyof AvailabilityProps>) => {\n const { model, status, KosModelLoader } = useAvailability();\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} beverage={model} />\n </KosModelLoader>\n );\n };\n}\n","import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { Board, type BoardModel } from \"../../../models\";\n\nexport const useBoard = (id: string) => {\n const modelId = id;\n const result = useKosModel<BoardModel>({\n modelId,\n modelType: Board.type,\n options: {},\n });\n\n return result;\n};\n","import type { BoardModel } from \"../../../models\";\nimport { useBoard } from \"./use-board\";\n\ninterface BoardProps {\n board: BoardModel;\n}\n// react HOC to provide a Board to a component\nexport function withBoard<T extends BoardProps = BoardProps>(\n WrappedComponent: React.ComponentType<T>\n) {\n return (id: string) => (props: Omit<T, keyof BoardProps>) => {\n const { model, status, KosModelLoader } = useBoard(id);\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} board={model} />\n </KosModelLoader>\n );\n };\n}\n","import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { BoardContainer, type BoardContainerModel } from \"../../../models\";\n\nexport const useBoardContainer = () => {\n const modelId = BoardContainer.type;\n const result = useKosModel<BoardContainerModel>({\n modelId,\n modelType: BoardContainer.type,\n options: {},\n });\n\n return result;\n};\n","import type { BoardContainerModel } from \"../../../models\";\nimport { useBoardContainer } from \"./use-board-container\";\n\ninterface BoardContainerProps {\n boardContainer: BoardContainerModel;\n}\n// react HOC to provide a BoardContainer to a component\nexport function withBoardContainer<\n T extends BoardContainerProps = BoardContainerProps\n>(WrappedComponent: React.ComponentType<T>) {\n return (props: Omit<T, keyof BoardContainerProps>) => {\n const { model, status, KosModelLoader } = useBoardContainer();\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} boardContainer={model} />\n </KosModelLoader>\n );\n };\n}\n","import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { Nozzle, type NozzleModel } from \"../../../models\";\n\nexport const useNozzle = (path: string) => {\n const modelId = path;\n const result = useKosModel<NozzleModel>({\n modelId,\n modelType: Nozzle.type,\n options: {\n path,\n },\n });\n\n return result;\n};\n","import { PropsWithChildren, createContext, useContext, useMemo } from \"react\";\nimport { NozzleModel } from \"../../../models\";\nimport { useNozzle } from \"../../hooks/nozzle/use-nozzle\";\n\ninterface NozzleType {\n model?: NozzleModel;\n}\nconst Nozzle = createContext<NozzleType | undefined>(undefined);\n\ninterface NozzleProviderProps {\n path: string;\n}\n\nexport const NozzleProvider: React.FunctionComponent<\n PropsWithChildren<NozzleProviderProps>\n> = ({ children, path }) => {\n const { model, ready } = useNozzle(path);\n const value: NozzleType = useMemo(() => {\n if (ready && model) {\n return { model };\n }\n return {};\n }, [ready, model]);\n return <Nozzle.Provider value={value}>{children}</Nozzle.Provider>;\n};\nexport const useNozzleContext = () => {\n const context = useContext(Nozzle);\n if (!context) {\n throw new Error(\"useNozzleContext must be used within a NozzleProvider\");\n }\n return context;\n};\n","import {\n getKosCompanionModel,\n kosAutoEffect,\n type IKosDataModel,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport type { AvailabilityModel } from \"../../../models\";\nimport { useNozzleContext } from \"../../contexts/nozzle/nozzle-provider\";\n\ninterface Props {\n onBeverageSelected?: (brand: AvailabilityModel) => void;\n onClearBeverage?: () => void;\n companionType?: string;\n}\nexport const useBeverages = <\n B extends Record<string, any> = any,\n C extends IKosDataModel = IKosDataModel\n>({\n onBeverageSelected,\n onClearBeverage,\n companionType,\n}: Props) => {\n const { model: nozzle } = useNozzleContext();\n const [beverages, setBeverages] = useState<AvailabilityModel<B>[]>([]);\n const [selectedBeverage, setSelectedBeverage] =\n useState<AvailabilityModel<B> | null>(null);\n\n const companions = useMemo(() => {\n if (!companionType) return [];\n return beverages.map((brand) =>\n getKosCompanionModel<C>(brand, companionType)\n );\n }, [beverages, companionType]);\n const selectBeverage = useCallback(\n async (beverage: AvailabilityModel) => {\n setSelectedBeverage(beverage);\n await nozzle?.setSelectedPourable({ beverage });\n onBeverageSelected?.(beverage);\n },\n [nozzle, onBeverageSelected]\n );\n\n const clearBeverage = useCallback(async () => {\n setSelectedBeverage(null);\n await nozzle?.setSelectedPourable({ beverage: undefined });\n onClearBeverage?.();\n }, [nozzle, onClearBeverage]);\n useEffect(() => {\n const disposer = kosAutoEffect(() => {\n if (!nozzle) return;\n const selectedBrand = nozzle.selectedBrand;\n if (!selectedBrand) {\n const allBeverages = nozzle\n .getGroupAvailabilityItems<B>(\"beverages\")\n .filter((beverage) => beverage.visible);\n setBeverages(allBeverages ?? []);\n return;\n }\n const beverages = nozzle\n .getAvailabilityByParent<B>(selectedBrand.id)\n .filter((b) => b.visible);\n setBeverages(beverages ?? []);\n });\n return () => {\n disposer();\n };\n }, [nozzle]);\n return {\n beverages,\n beverageCompanions: companions,\n selectBeverage,\n selectedBeverage,\n clearBeverage,\n };\n};\n","import {\n getKosCompanionModel,\n kosAutoEffect,\n type IKosDataModel,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport type { AvailabilityModel } from \"../../../models\";\nimport { useNozzleContext } from \"../../contexts/nozzle/nozzle-provider\";\n\ninterface Props {\n onBrandSelected?: (brand: AvailabilityModel) => void;\n onBrandCleared?: () => void;\n companionType?: string;\n}\nexport const useBrands = <\n B extends Record<string, any> = any,\n C extends IKosDataModel = IKosDataModel\n>({\n onBrandSelected,\n onBrandCleared,\n companionType,\n}: Props) => {\n const { model: nozzle } = useNozzleContext();\n const [selectedBrand, setSelectedBrand] =\n useState<AvailabilityModel<B> | null>(null);\n\n const [brands, setBrands] = useState<AvailabilityModel<B>[]>([]);\n\n const companions = useMemo(() => {\n if (!companionType) return [];\n return brands.map((brand) => getKosCompanionModel<C>(brand, companionType));\n }, [brands, companionType]);\n\n const selectBrand = useCallback(\n async (brand: AvailabilityModel<B>) => {\n setSelectedBrand(brand);\n nozzle?.setSelectedBrand(brand);\n onBrandSelected?.(brand);\n },\n [nozzle, onBrandSelected]\n );\n\n const clearBrand = useCallback(() => {\n setSelectedBrand(null);\n nozzle?.setSelectedBrand(undefined);\n onBrandCleared?.();\n }, [nozzle, onBrandCleared]);\n\n useEffect(() => {\n const disposer = kosAutoEffect(() => {\n if (!nozzle) return;\n setBrands(nozzle.visibleBrands);\n });\n return () => {\n disposer();\n };\n }, [nozzle]);\n\n return {\n brands,\n brandCompanions: companions,\n selectedBrand,\n selectBrand,\n clearBrand,\n };\n};\n","export class PourContext {\n private _data = new Map<string, any>();\n\n get<T>(key: string): T | undefined {\n return this._data.get(key);\n }\n set<T>(key: string, value: T) {\n this._data.set(key, value);\n }\n remove(key: string) {\n this._data.delete(key);\n }\n has(key: string): boolean {\n return this._data.has(key);\n }\n}\n","import { KosLog } from \"@kosdev-code/kos-ui-sdk\";\nimport type { PourStrategy, PourStrategyAware } from \"./pour-strategy\";\nconst logger = KosLog.createLogger({\n name: \"HoldToPourStrategy\",\n group: \"kos-hooks\",\n});\n\nexport const HoldToPourStrategy: PourStrategy = {\n name: \"HoldToPourStrategy\",\n async initiate(nozzle?: PourStrategyAware): Promise<void> {\n if (!nozzle?.canPour) {\n logger.debug(`Nozzle ${nozzle?.id} cannot pour. Returning early.`);\n return;\n }\n await nozzle?.pour();\n },\n\n async initiateEnded(nozzle?: PourStrategyAware): Promise<void> {\n await nozzle?.cancelPour();\n },\n};\n","import { useCallback, useState } from \"react\";\n\nimport { KosLog, usePressGesture } from \"@kosdev-code/kos-ui-sdk\";\nimport type { ReactDOMAttributes } from \"@use-gesture/react/dist/declarations/src/types\";\nimport type { PourState } from \"../../../models/models/types/pouring\";\nimport { useNozzleContext } from \"../../contexts/nozzle\";\nimport { PourContext } from \"../../utils/pour-context\";\nimport { HoldToPourStrategy } from \"../utils/pour-strategy/hold-to-pour-strategy\";\nimport type { PourStrategy } from \"../utils/pour-strategy/pour-strategy\";\n\ninterface NozzlePourProps {\n onBeforePour?: (context?: PourContext) => Promise<boolean>;\n onBeforePourRejected?: () => void;\n onPour?: () => void;\n onPourCancel?: () => void;\n strategy?: PourStrategy;\n pourContext?: PourContext;\n}\n\nexport interface NozzlePourResponse {\n handlers: (...args: any[]) => ReactDOMAttributes;\n cancel: () => void;\n updatePourContext?: (key: string, value: any) => void;\n removeFromPourContext?: (key: string) => void;\n status?: {\n canPour: boolean;\n isPouring: boolean;\n currentState: PourState;\n pourProgress: number;\n };\n}\n\nconst logger = KosLog.createLogger({\n name: \"useNozzlePour\",\n group: \"kos-hooks\",\n});\n/**\n * Hook that encapsulates the logic for handling nozzle pouring.\n *\n * The hook will return a number of gesture handlers that can be spread onto a DOM element.\n * The hook will automatically detects if touch or mouse events are used.\n *\n *\n * @param onPour - callback initiated after pouring starts\n * @param onPourCancel - callback initiated after pouring is cancelled\n * @returns handlers - gesture handlers for nozzle pouring\n *\n *\n * @example\n * const { handlers } = useNozzlePour({\n * onPour: () => {\n * console.log(\"Pouring started\");\n * },\n * onPourCancel: () => {\n * console.log(\"Pouring cancelled\");\n * },\n * });\n *\n * <div {...handlers()} />\n *\n *\n * @see {@link NozzleModel.pour}\n * @see {@link NozzleModel.cancelPour}\n * @see {@link usePressGesture}\n **/\nexport const useNozzlePour = ({\n onPour,\n onPourCancel,\n onBeforePour,\n onBeforePourRejected,\n pourContext,\n strategy = HoldToPourStrategy,\n}: NozzlePourProps): NozzlePourResponse => {\n const { model: nozzle } = useNozzleContext();\n const [context, _setContext] = useState<PourContext>(\n pourContext || new PourContext()\n );\n const handlePour = useCallback(async () => {\n const canPour = onBeforePour ? await onBeforePour?.(context) : true;\n if (canPour) {\n logger.debug(\n `[${strategy?.name}] - Pour initiated for nozzle ${nozzle?.id}.`\n );\n strategy?.initiate(nozzle);\n onPour?.();\n } else {\n logger.debug(\n `[${strategy?.name}] - Did not pass onBeforePour gate for nozzle ${nozzle?.id}. Cancelling pour.`\n );\n onBeforePourRejected?.();\n }\n }, [\n onPour,\n nozzle,\n strategy,\n onBeforePour,\n onPourCancel,\n context,\n onBeforePourRejected,\n ]);\n\n const handleCancelPour = useCallback(() => {\n logger.debug(\n `[${strategy?.name}] - Pour initiate ended called for nozzle ${nozzle?.id}.`\n );\n strategy?.initiateEnded?.(nozzle);\n onPourCancel?.();\n }, [onPourCancel, nozzle, strategy]);\n\n const forceCancelPour = useCallback(() => {\n logger.debug(`Force cancelling pour for nozzle ${nozzle?.id}.`);\n nozzle?.cancelPour();\n onPourCancel?.();\n }, [onPourCancel, nozzle]);\n\n const handleUpdateContext = useCallback(\n (key: string, value: any) => {\n context.set(key, value);\n },\n [context]\n );\n\n const handleRemoveFromContext = useCallback(\n (key: string) => {\n context.remove(key);\n },\n [context]\n );\n const handlers = usePressGesture({\n onPressed: handlePour,\n onRelease: handleCancelPour,\n });\n\n return {\n handlers: handlers.dom,\n cancel: forceCancelPour,\n updatePourContext: handleUpdateContext,\n removeFromPourContext: handleRemoveFromContext,\n status: nozzle,\n };\n};\n","import {\n getKosCompanionModel,\n type IKosDataModel,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport { useCallback, useMemo, useState } from \"react\";\nimport type { AvailabilityModel } from \"../../../models\";\nimport { useNozzleContext } from \"../../contexts/nozzle/nozzle-provider\";\ninterface Props {\n onFlavorSelected?: (\n flavor: AvailabilityModel,\n flavors: AvailabilityModel[]\n ) => void;\n onFlavorCleared?: () => void;\n companionType?: string;\n}\nexport const useFlavors = <\n F extends Record<string, any> = any,\n C extends IKosDataModel = IKosDataModel\n>({\n onFlavorSelected,\n onFlavorCleared,\n companionType,\n}: Props) => {\n const { model: nozzle } = useNozzleContext();\n const flavors = useMemo(\n () =>\n nozzle\n ?.getGroupAvailabilityItems<F>(\"flavors\")\n .filter((f) => f.visible) ?? [],\n [nozzle]\n );\n\n const companions = useMemo(() => {\n if (!companionType) return [];\n return flavors.map((flavor) =>\n getKosCompanionModel<C>(flavor, companionType)\n );\n }, [flavors, companionType]);\n const [selectedFlavors, setSelectedFlavors] = useState<\n AvailabilityModel[] | null\n >([]);\n\n const selectFlavor = useCallback(\n async (flavor: AvailabilityModel) => {\n setSelectedFlavors((previous) =>\n previous?.includes(flavor)\n ? [...previous.filter((p) => p !== flavor)]\n : [...(previous ?? []), flavor]\n );\n\n if (nozzle?.selectedPourable) {\n const { beverage } = nozzle.selectedPourable;\n await nozzle.setSelectedPourable({\n beverage,\n additional: selectedFlavors ?? [],\n });\n }\n onFlavorSelected?.(flavor, selectedFlavors ?? []);\n },\n [nozzle, onFlavorSelected, selectedFlavors]\n );\n\n const clear = useCallback(async () => {\n setSelectedFlavors([]);\n if (nozzle?.selectedPourable) {\n const { beverage } = nozzle.selectedPourable;\n nozzle.setSelectedPourable({ beverage });\n onFlavorCleared?.();\n }\n }, [nozzle, onFlavorCleared]);\n return {\n flavors,\n flavorCompanions: companions,\n selectFlavor,\n selectedFlavors,\n clearFlavors: clear,\n };\n};\n","import type { IKosDataModel, KosTimer } from \"@kosdev-code/kos-ui-sdk\";\nimport { EventBus, KosLog } from \"@kosdev-code/kos-ui-sdk\";\nimport { useCallback, useRef, useState } from \"react\";\nimport type { AvailabilityModel } from \"../../../models\";\nimport { useNozzleContext } from \"../../contexts/nozzle/nozzle-provider\";\nimport type { PourContext } from \"../../utils/pour-context\";\nimport { useNozzlePour } from \"../nozzle-pour/use-nozzle-pour\";\nimport { useBeverages } from \"./use-beverages\";\nimport { useBrands } from \"./use-brands\";\nimport { useFlavors } from \"./use-flavors\";\nexport const DISPENSE_GROUP_BRAND = \"brands\";\nexport const DISPENSE_GROUP_BEVERAGE = \"beverages\";\nexport const DISPENSE_GROUP_FLAVOR = \"flavors\";\n\nconst log = KosLog.createLogger({ name: \"use-cui-kit\" });\ntype InitialGroup =\n | typeof DISPENSE_GROUP_BRAND\n | typeof DISPENSE_GROUP_BEVERAGE;\nexport interface UseCuiKitProps {\n /**\n * The initial group to display when the cui kit is first rendered.\n * The default is to start at the list of brands however for simpler cases\n * it may be desirable to start at the list of beverages.\n */\n initialGroup?: InitialGroup;\n\n /**\n * Options to configure the behavior of the cui kit.\n */\n options?: {\n /**\n * The companion types to associate with the brand, beverage, and flavor models. This\n * is useful when companion models have been created to represent the brand, beverage, and flavor\n * models rather than merely augmenting the AvailabilityModel data.\n */\n companionTypes?: {\n /**\n * The model type of the brand companion.\n */\n brand?: string;\n /**\n * The model type of the beverage companion.\n */\n beverage?: string;\n /**\n * The model type of the flavor companion.\n */\n flavor?: string;\n };\n };\n}\n\ninterface DispenseGroupType<\n AdditionalData extends Record<string, any> = any,\n Companion extends IKosDataModel = IKosDataModel\n> {\n /**\n * The list of AvailabilityModels to display in the group.\n */\n models: AvailabilityModel<AdditionalData>[];\n\n /**\n * The list of companion models that are associated with the models in the group.\n *\n * If no companion model types are provided in the options, this list will be empty.\n */\n companions?: Companion[];\n\n /**\n * Clear the current selection in the group. This will reset the group to its initial state.\n */\n clear: VoidFunction;\n\n /**\n * The event handlers for the group. These handlers will be called when a model in the group is selected.\n */\n handlers: {\n /**\n * The handler to call when a model in the group is selected.\n */\n onSelected: (model: AvailabilityModel<AdditionalData>) => void;\n };\n}\nexport interface CuiKitType<\n BrandData extends Record<string, any> = any,\n BeverageData extends Record<string, any> = any,\n FlavorData extends Record<string, any> = any,\n BrandCompanion extends IKosDataModel = IKosDataModel,\n BeverageCompanion extends IKosDataModel = IKosDataModel,\n FlavorCompanion extends IKosDataModel = IKosDataModel\n> {\n /**\n * Provides functions and status related to the timers in the cui kit if available.\n */\n timers: {\n /**\n * Adds a timer to the cui kit. This will be used by a cui kit lifecycle manager to\n * manage the timers in the kit.\n * The timers will be paused and restarted as needed based on the lifecycle of the cui kit\n * @param timer - the timer to add to the cui kit.\n * @returns void\n */\n add: (timer?: KosTimer | null) => void;\n /**\n * Pauses all timers in the cui kit.\n */\n pause: VoidFunction;\n\n /**\n * Restarts all timers in the cui kit.\n */\n restart: VoidFunction;\n };\n /**\n * The navigation state of the cui kit.\n */\n nav: {\n /**\n * The current group that is being displayed.\n */\n currentGroup: string;\n\n /**\n * The handler to navigate back to the previous group.\n */\n back: VoidFunction;\n\n /**\n * The handler to navigate to the initial group as defined in the options.\n */\n home: VoidFunction;\n };\n\n /**\n * Provides functions and status related to the pour operation.\n */\n pour: ReturnType<typeof useNozzlePour>;\n\n updateOnBeforePour: (\n callback: (context?: PourContext) => Promise<boolean>\n ) => void;\n\n /**\n * The current selections of the cui kit.\n */\n selections: {\n /**\n * The selected brand model.\n */\n [DISPENSE_GROUP_BRAND]: AvailabilityModel<BrandData> | null;\n\n /**\n * The selected beverage model.\n */\n [DISPENSE_GROUP_BEVERAGE]: AvailabilityModel<BeverageData> | null;\n\n /**\n * The selected flavor models.\n */\n [DISPENSE_GROUP_FLAVOR]: AvailabilityModel<FlavorData>[] | null;\n };\n\n /**\n * The brands modules provides the state and handlers required to manage the set of brands for the dispenser:\n *\n * @property {AvailabilityModel<BrandData>[]} models - The list of brands for the dispenser.\n *\n * The models will be instances of AvailabilityModel<BrandData> with any data mappings already\n * applied to the data property on the model.\n *\n * Since these are KOS models, any changes to the model state will be automatically reflected in any components consuming them.\n *\n * @property {BrandCompanion[]} companions - In more advanced cases, the KOS framework allows you to define additional models\n * that will get created alongside the brand AvailabilityModels instances.\n * Using these companions as a form of extension, this field will return the corresponding set of companion models that\n * represent your custom brands.\n \n * @property {Object} handlers - Contains handler methods.\n * @property {Function} handlers.onSelected - When a user selects a brand, this handler can be called with the selected AvailabilityModel\n * to ensure that the CUI Kit state is kept up to date.\n *\n * @property {Function} clear - Calling this function will clear the selected brand and beverage in the CUI Kit. This updates the state both locally\n * and in the backend by clearing the selection in the Dispense SDK NozzleModel.\n */\n [DISPENSE_GROUP_BRAND]: DispenseGroupType<BrandData, BrandCompanion>;\n /**\n * The beverages modules provides the state and handlers required to manage the set of beverages for the current brand selection:\n *\n * @property {AvailabilityModel<BeverageData>[]} models - The list of beverages for the current brand selection. As the user selects brands\n * in the UI then this list of beverages will be updated to reflect new selection. If there are no brands\n * defined in the brandset then this will always return the full list of beverages.\n *\n * The models will be instances of AvailabilityModel<T> with any data mappings (shown in the next section) already\n * applied to the data property on the model.\n *\n * Since these are KOS models, any changes to the model state will be automatically reflected in any components consuming them.\n *\n * @property {BeverageCompanion[]} companions - In more advanced cases, the KOS framework allows you to define additional models\n * that will get created alongside the “beverage” AvailabilityModels instances.\n *\n * This is useful in cases where new functionality beyond what is exposed in the AvailabilityModel is required. For\n * example, if in your application, you need Beverages to be able to fetch nutritional information on selection then\n * you could create a companion model that will get created for each AvailabilityModel and expose the methods and\n * data to retrieve this information.\n *\n * Using these companions as a form of extension, this field will return the corresponding set of companion models that\n * represent your custom beverages.\n \n * @property {Object} handlers - Contains handler methods.\n * @property {Function} handlers.onSelected - When a user selects a beverage, this handler can be called with the selected AvailabilityModel\n * to ensure that the CUI Kit state is kept up to date.\n *\n * @property {Function} clear - Calling this function will clear the selected beverage in the CUI Kit. This updates the state both locally\n * and in the backend by clearing the selection in the Dispense SDK NozzleModel.\n */\n [DISPENSE_GROUP_BEVERAGE]: DispenseGroupType<BeverageData, BeverageCompanion>;\n\n /**\n * The group of flavors to display. This list will be filtered\n * based on previous selections and the relationships of the models in the graph.\n * For example, if a beverage has been selected, this will return the list of flavors that\n * are associated with the selected beverage. Otherwise, it will return the list of all flavors.\n */\n [DISPENSE_GROUP_FLAVOR]: DispenseGroupType<FlavorData, FlavorCompanion>;\n}\n\nexport const useCuiKit = <\n BrandData extends Record<string, any> = any,\n BeverageData extends Record<string, any> = any,\n FlavorData extends Record<string, any> = any,\n BrandCompanion extends IKosDataModel = IKosDataModel,\n BeverageCompanion extends IKosDataModel = IKosDataModel,\n FlavorCompanion extends IKosDataModel = IKosDataModel\n>({\n initialGroup = DISPENSE_GROUP_BRAND,\n options = {},\n}: UseCuiKitProps): CuiKitType<\n BrandData,\n BeverageData,\n FlavorData,\n BrandCompanion,\n BeverageCompanion,\n FlavorCompanion\n> => {\n const [currentGroup, setCurrentGroup] = useState<string>(initialGroup);\n const { model: nozzle } = useNozzleContext();\n const timersRef = useRef<KosTimer[]>([]);\n const updatePourContext = useRef<(key: string, value: any) => void>();\n const removeFromPourContext = useRef<(key: string) => void>();\n const onBrandSelected = useCallback(\n (model: AvailabilityModel) => {\n setCurrentGroup(DISPENSE_GROUP_FLAVOR);\n const topic = `/kos/dispense/${nozzle?.path}/brand/selected/`;\n EventBus.publish(topic, model);\n },\n [nozzle?.path]\n );\n\n const onBrandCleared = useCallback(() => {\n const topic = `/kos/dispense/${nozzle?.path}/brand/cleared/`;\n EventBus.publish(topic, {});\n }, [nozzle?.path]);\n\n const onBeverageSelected = useCallback(\n (model: AvailabilityModel) => {\n setCurrentGroup(DISPENSE_GROUP_FLAVOR);\n updatePourContext.current?.(\"selectedBeverage\", model);\n const topic = `/kos/dispense/${nozzle?.path}/beverage/selected/`;\n EventBus.publish(topic, model);\n },\n [nozzle?.path]\n );\n\n const onBeverageCleared = useCallback(() => {\n const topic = `/kos/dispense/${nozzle?.path}/beverage/cleared/`;\n removeFromPourContext.current?.(\"selectedBeverage\");\n EventBus.publish(topic, {});\n }, [nozzle?.path]);\n\n const onFlavorSelected = useCallback(\n (model: AvailabilityModel) => {\n const topic = `/kos/dispense/${nozzle?.path}/flavor/selected/`;\n EventBus.publish(topic, model);\n },\n [nozzle?.path]\n );\n\n const onFlavorCleared = useCallback(() => {\n const topic = `/kos/dispense/${nozzle?.path}/flavor/cleared/`;\n EventBus.publish(topic, {});\n }, [nozzle?.path]);\n\n const onPour = useCallback(() => {\n const topic = `/kos/dispense/${nozzle?.path}/pour/`;\n EventBus.publish(topic, {});\n }, [nozzle?.path]);\n\n const handleBeforePour = useCallback(\n async (context?: PourContext) => {\n const topic = `/kos/dispense/${nozzle?.path}/pre/pour/`;\n EventBus.publish(topic, {});\n return (await onBeforePour?.(context)) || true;\n },\n [nozzle?.path]\n );\n\n const handleBeforePourRejected = useCallback(async () => {\n const topic = `/kos/dispense/${nozzle?.path}/pre/pour/rejected/`;\n EventBus.publish(topic, {});\n }, [nozzle?.path]);\n\n const onPourCancel = useCallback(() => {\n const topic = `/kos/dispense/${nozzle?.path}/pour/cancel/`;\n EventBus.publish(topic, {});\n }, [nozzle?.path]);\n const { brands, selectBrand, selectedBrand, clearBrand, brandCompanions } =\n useBrands<BrandData, BrandCompanion>({\n companionType: options.companionTypes?.brand,\n onBrandSelected: onBrandSelected,\n onBrandCleared: onBrandCleared,\n });\n const {\n beverages,\n selectBeverage,\n selectedBeverage,\n clearBeverage,\n beverageCompanions,\n } = useBeverages<BeverageData, BeverageCompanion>({\n companionType: options.companionTypes?.beverage,\n onBeverageSelected: onBeverageSelected,\n onClearBeverage: onBeverageCleared,\n });\n\n const {\n clearFlavors,\n flavors,\n selectFlavor,\n selectedFlavors,\n flavorCompanions,\n } = useFlavors<FlavorData, FlavorCompanion>({\n companionType: options.companionTypes?.flavor,\n onFlavorSelected: onFlavorSelected,\n onFlavorCleared: onFlavorCleared,\n });\n\n const [onBeforePour, setOnBeforePour] =\n useState<(context?: PourContext) => Promise<boolean>>();\n const updateOnBeforePour = useCallback((callback: () => Promise<boolean>) => {\n setOnBeforePour(() => callback);\n }, []);\n const pour = useNozzlePour({\n onPour: onPour,\n onPourCancel: onPourCancel,\n onBeforePour: handleBeforePour,\n onBeforePourRejected: handleBeforePourRejected,\n });\n\n updatePourContext.current = pour.updatePourContext;\n removeFromPourContext.current = pour.removeFromPourContext;\n\n const back = useCallback(() => {\n log.debug(`Navigating back from group: ${currentGroup}`);\n switch (currentGroup) {\n case DISPENSE_GROUP_BRAND:\n clearBeverage();\n clearBrand();\n break;\n case DISPENSE_GROUP_BEVERAGE:\n case DISPENSE_GROUP_FLAVOR:\n setCurrentGroup(initialGroup);\n clearBeverage();\n clearBrand();\n break;\n }\n }, [clearBeverage, clearBrand, currentGroup, initialGroup]);\n\n const home = useCallback(() => {\n const topic = `/kos/dispense/${nozzle?.path}/home/`;\n EventBus.publish(topic, {});\n setCurrentGroup(initialGroup);\n if (initialGroup === DISPENSE_GROUP_BRAND) {\n clearBeverage();\n clearBrand();\n }\n\n if (initialGroup === DISPENSE_GROUP_BEVERAGE) {\n clearBeverage();\n }\n }, [clearBeverage, clearBrand, initialGroup]);\n\n const pauseTimers = useCallback(() => {\n if (timersRef.current.length === 0) {\n log.debug(\"No timers to pause.\");\n return;\n }\n log.debug(`Pausing ${timersRef.current.length} timers.`);\n timersRef.current.forEach((timer) => {\n log.debug(`Pausing timer with id ${timer.id}.`);\n timer.pause();\n });\n }, []);\n\n const restartTimers = useCallback(() => {\n if (timersRef.current.length === 0) {\n log.debug(\"No timers to restart.\");\n return;\n }\n log.debug(`Restarting ${timersRef.current.length} timers.`);\n timersRef.current.forEach((timer) => {\n log.debug(`Restarting timer with id ${timer.id}.`);\n timer.restart();\n });\n }, []);\n\n const addTimer = useCallback((timer?: KosTimer | null) => {\n if (!timer) {\n return;\n }\n // Check if the timer already exists in the timersRef\n if (timersRef.current.some((t) => t.id === timer.id)) {\n log.debug(`Timer with id ${timer.id} already exists.`);\n return;\n }\n // Add the timer to the timersRef\n\n timersRef.current.push(timer);\n }, []);\n return {\n timers: {\n add: addTimer,\n pause: pauseTimers,\n restart: restartTimers,\n },\n nav: {\n currentGroup,\n back,\n home,\n },\n\n pour,\n\n updateOnBeforePour,\n\n selections: {\n [DISPENSE_GROUP_BRAND]: selectedBrand,\n [DISPENSE_GROUP_BEVERAGE]: selectedBeverage,\n [DISPENSE_GROUP_FLAVOR]: selectedFlavors,\n },\n [DISPENSE_GROUP_BRAND]: {\n models: brands,\n companions: brandCompanions,\n clear: clearBrand,\n handlers: {\n onSelected: selectBrand,\n },\n },\n [DISPENSE_GROUP_BEVERAGE]: {\n models: beverages,\n companions: beverageCompanions,\n clear: clearBeverage,\n handlers: {\n onSelected: selectBeverage,\n },\n },\n [DISPENSE_GROUP_FLAVOR]: {\n models: flavors,\n companions: flavorCompanions,\n clear: clearFlavors,\n handlers: {\n onSelected: selectFlavor,\n },\n },\n };\n};\n","import { KosLog, TimerManager, type KosTimer } from \"@kosdev-code/kos-ui-sdk\";\nimport { useCallback, useEffect, useState } from \"react\";\nimport { useNozzleContext } from \"../../contexts/nozzle/nozzle-provider\";\n\ninterface TimerProps {\n defaultAmbientTime?: number;\n defaultAttractTime?: number;\n onAttractTimer?: VoidFunction;\n onAmbientTimer?: VoidFunction;\n onResetAttractTimer?: VoidFunction;\n onResumeAttractTimer?: VoidFunction;\n}\n\nexport const useAmbientAttractTimers = (props: TimerProps) => {\n const { model: nozzle } = useNozzleContext();\n\n const [attractTimer, setAttractTimer] = useState<KosTimer | null>(null);\n const {\n onAmbientTimer,\n onAttractTimer,\n onResetAttractTimer,\n onResumeAttractTimer,\n defaultAttractTime,\n defaultAmbientTime,\n } = props;\n\n const handleAmbientTimer = useCallback(() => {\n if (onAmbientTimer) {\n KosLog.info(\"Ambient timer expired. Calling callback\");\n onAmbientTimer?.();\n }\n }, [onAmbientTimer]);\n\n const handleAttractTimer = useCallback(() => {\n if (onAttractTimer) {\n KosLog.info(\"Attract timer expired. Calling callback\");\n onAttractTimer?.();\n }\n }, [onAttractTimer]);\n\n const handleResetAttractTimer = useCallback(() => {\n if (attractTimer) {\n attractTimer.restart();\n onResetAttractTimer?.();\n }\n }, [attractTimer, onResetAttractTimer]);\n\n const handlePauseAttractTimer = useCallback(() => {\n if (attractTimer) {\n attractTimer.reset();\n onResetAttractTimer?.();\n }\n }, [attractTimer, onResetAttractTimer]);\n\n const handleResume = useCallback(() => {\n if (attractTimer) {\n attractTimer.pause();\n onResumeAttractTimer?.();\n }\n }, [attractTimer, onResumeAttractTimer]);\n\n useEffect(() => {\n if (nozzle && defaultAttractTime) {\n KosLog.info(\"Nozzle is available. Creating timers\");\n const timer = TimerManager.createTimer(\n \"attract-timer-\" + nozzle.path,\n defaultAttractTime\n );\n\n if (defaultAttractTime) {\n timer?.addTimeoutAction({\n name: \"attract-timer\",\n remainingTime: 0,\n action: handleAttractTimer,\n });\n }\n\n if (defaultAmbientTime) {\n timer?.addTimeoutAction({\n name: \"ambient-timer\",\n remainingTime: defaultAmbientTime,\n action: handleAmbientTimer,\n });\n }\n if (defaultAttractTime) {\n timer?.start();\n }\n setAttractTimer(timer ?? null);\n return () => {\n timer?.reset();\n setAttractTimer(null);\n };\n }\n return () => {\n KosLog.info(\"Nozzle is not available. No timers to clear\");\n };\n }, [\n defaultAmbientTime,\n defaultAttractTime,\n handleAmbientTimer,\n handleAttractTimer,\n nozzle,\n ]);\n return {\n attractTimer,\n restart: handleResetAttractTimer,\n pause: handlePauseAttractTimer,\n resume: handleResume,\n };\n};\n","import { EventBus } from \"@kosdev-code/kos-ui-sdk\";\nimport { useEffect } from \"react\";\nimport type { AvailabilityModel } from \"../../../models\";\nimport { useNozzleContext } from \"../../contexts/nozzle/nozzle-provider\";\n\ninterface Props<\n BrandData extends Record<string, any> = any,\n BeverageData extends Record<string, any> = any,\n FlavorData extends Record<string, any> = any\n> {\n onBrandSelected?: (brand: AvailabilityModel<BrandData>) => void;\n onBrandCleared?: () => void;\n onBeverageSelected?: (brand: AvailabilityModel<BeverageData>) => void;\n onBeverageCleared?: () => void;\n onFlavorSelected?: (brand: AvailabilityModel<FlavorData>) => void;\n onFlavorCleared?: () => void;\n onReturnToHome?: () => void;\n onPour?: () => void;\n onPourCancel?: () => void;\n onBeforePourRejected?: () => void;\n onAmbientTimer?: () => void;\n onAttractTimer?: () => void;\n onResumeAttractTimer?: () => void;\n onIdleTimeout?: () => void;\n onAreYouThereTimeout?: () => void;\n onInit?: () => void;\n}\n\nconst subscribe = (topic: string, callback?: (args: any) => void) => {\n if (callback) {\n const result = EventBus.subscribe(topic, callback);\n return result.unsubscribe;\n }\n return undefined;\n};\nexport const useDispenseLifecycle = ({\n onInit,\n onBrandSelected,\n onBrandCleared,\n onBeverageCleared,\n onBeverageSelected,\n onFlavorCleared,\n onFlavorSelected,\n onReturnToHome,\n onPour,\n onPourCancel,\n onBeforePourRejected,\n onAmbientTimer,\n onAttractTimer,\n onResumeAttractTimer,\n onIdleTimeout,\n onAreYouThereTimeout,\n}: Props) => {\n const { model: nozzle } = useNozzleContext();\n\n useEffect(() => {\n const topics = [\n {\n topic: `/kos/dispense/${nozzle?.path}/brand/selected/`,\n callback: onBrandSelected,\n },\n {\n topic: `/kos/dispense/${nozzle?.path}/brand/cleared/`,\n callback: onBrandCleared,\n },\n {\n topic: `/kos/dispense/${nozzle?.path}/beverage/selected/`,\n callback: onBeverageSelected,\n },\n {\n topic: `/kos/dispense/${nozzle?.path}/beverage/cleared/`,\n callback: onBeverageCleared,\n },\n {\n topic: `/kos/dispense/${nozzle?.path}/flavor/selected/`,\n callback: onFlavorSelected,\n },\n {\n topic: `/kos/dispense/${nozzle?.path}/flavor/cleared/`,\n callback: onFlavorCleared,\n },\n { topic: `/kos/dispense/${nozzle?.path}/pour/`, callback: onPour },\n {\n topic: `/kos/dispense/${nozzle?.path}/pour/cancel/`,\n callback: onPourCancel,\n },\n {\n topic: `/kos/dispense/${nozzle?.path}/pre/pour/rejected/`,\n callback: onBeforePourRejected,\n },\n\n {\n topic: `/kos/dispense/${nozzle?.path}/ambient/start/`,\n callback: onAmbientTimer,\n },\n {\n topic: `/kos/dispense/${nozzle?.path}/attract/start/`,\n callback: onAttractTimer,\n },\n {\n topic: `/kos/dispense/${nozzle?.path}/attract/resume/`,\n callback: onResumeAttractTimer,\n },\n {\n topic: `/kos/dispense/${nozzle?.path}/idle/timeout/`,\n callback: onIdleTimeout,\n },\n {\n topic: `/kos/dispense/${nozzle?.path}/are-you-there/timeout/`,\n callback: onAreYouThereTimeout,\n },\n {\n topic: `/kos/dispense/${nozzle?.path}/init/`,\n callback: onInit,\n },\n {\n topic: `/kos/dispense/${nozzle?.path}/home/`,\n callback: onReturnToHome,\n },\n ];\n\n const disposers = topics.map(({ topic, callback }) =>\n subscribe(topic, callback)\n );\n\n return () => {\n disposers.forEach((disposer) => disposer?.());\n };\n }, [\n nozzle?.path,\n onAmbientTimer,\n onAttractTimer,\n onBeverageCleared,\n onBeverageSelected,\n onBrandCleared,\n onBrandSelected,\n onFlavorCleared,\n onFlavorSelected,\n onPour,\n onPourCancel,\n onResumeAttractTimer,\n onIdleTimeout,\n onAreYouThereTimeout,\n onInit,\n onReturnToHome,\n ]);\n};\n","import { KosLog, TimerManager, type KosTimer } from \"@kosdev-code/kos-ui-sdk\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { useNozzleContext } from \"../../contexts/nozzle/nozzle-provider\";\n\ninterface TimerProps {\n defaultIdleTime?: number;\n defaultAreYouThereTime?: number;\n onIdleTimer?: VoidFunction;\n onAreYouThereTimer?: VoidFunction;\n onResetIdleTimer?: VoidFunction;\n prefix?: string;\n}\n\nconst log = KosLog.createLogger({ name: \"useCuiKitTimers\" });\nexport const useCuiKitTimers = (props: TimerProps) => {\n const { model: nozzle } = useNozzleContext();\n const [idleTimer, setIdleTimer] = useState<KosTimer | null>(null);\n const {\n onAreYouThereTimer,\n onIdleTimer,\n onResetIdleTimer,\n defaultAreYouThereTime = 10,\n defaultIdleTime = 20,\n } = props;\n\n // Track if we've already fired the \"Are You There\" action for this timer cycle\n const hasAreYouThereFiredRef = useRef(false);\n\n const handleAreYouThereTimer = useCallback(() => {\n // Only fire once per timer cycle\n if (!hasAreYouThereFiredRef.current && onAreYouThereTimer) {\n KosLog.info(\"Are you there timer expired. Calling callback\");\n hasAreYouThereFiredRef.current = true;\n onAreYouThereTimer?.();\n }\n }, [onAreYouThereTimer]);\n\n const handleIdleTimer = useCallback(() => {\n log.debug(\n \"handleIdleTimer called in useCuiKitTimers, onIdleTimer exists:\",\n !!onIdleTimer\n );\n if (onIdleTimer) {\n log.debug(\"Idle timer expired. Calling callback\");\n onIdleTimer?.();\n } else {\n log.debug(\"No onIdleTimer callback provided!\");\n }\n }, [onIdleTimer]);\n\n const handleRestartIdleTimer = useCallback(() => {\n log.debug(`TIMER RESTART called for ${props.prefix ?? \"\"}timer`);\n if (idleTimer) {\n idleTimer.restart();\n hasAreYouThereFiredRef.current = false; // Reset flag when timer restarts\n onResetIdleTimer?.();\n }\n }, [idleTimer, onResetIdleTimer, props.prefix]);\n\n const handlePauseIdleTimer = useCallback(() => {\n log.debug(`TIMER PAUSE/RESET called for ${props.prefix ?? \"\"}timer`);\n if (idleTimer) {\n idleTimer.reset();\n hasAreYouThereFiredRef.current = false; // Reset flag when timer is reset/paused\n onResetIdleTimer?.();\n }\n }, [idleTimer, onResetIdleTimer, props.prefix]);\n useEffect(() => {\n log.debug(\n `useCuiKitTimers effect triggered - nozzle: ${!!nozzle}, path: ${\n nozzle?.path\n }, callbacks: handleIdle=${!!handleIdleTimer}, handleAreYouThere=${!!handleAreYouThereTimer}`\n );\n if (nozzle) {\n log.info(\"Nozzle is available. Creating timers\");\n const timer = TimerManager.createTimer(\n `${props.prefix ?? \"\"}idle-timer-${nozzle.path}`,\n defaultIdleTime\n );\n log.debug(\n `Adding idle timer action for ${props.prefix ?? \"\"}idle-timer-${\n nozzle.path\n } with callback:`,\n !!handleIdleTimer\n );\n timer?.addTimeoutAction({\n name: \"idle-timer\",\n remainingTime: 0,\n action: handleIdleTimer,\n });\n\n timer?.addTimeoutAction({\n name: \"are-you-there-timer\",\n remainingTime: defaultAreYouThereTime,\n action: handleAreYouThereTimer,\n });\n setIdleTimer(timer ?? null);\n return () => {\n timer?.reset();\n setIdleTimer(null);\n };\n }\n return () => {\n log.info(\"Nozzle is not available. No timers to clear\");\n };\n }, [\n defaultAreYouThereTime,\n defaultIdleTime,\n handleAreYouThereTimer,\n handleIdleTimer,\n nozzle,\n props.prefix,\n ]);\n return {\n idleTimer,\n restart: handleRestartIdleTimer,\n pause: handlePauseIdleTimer,\n };\n};\n","import { EventBus, KosLog } from \"@kosdev-code/kos-ui-sdk\";\nimport { useCallback, useEffect, useState } from \"react\";\nimport { useNozzleContext } from \"../../contexts/nozzle/nozzle-provider\";\nimport { useAmbientAttractTimers } from \"./use-ambient-attract-timers\";\nimport type { CuiKitType } from \"./use-cui-kit\";\nimport { useDispenseLifecycle } from \"./use-dispense-lifecycle\";\nimport { useCuiKitTimers } from \"./use-dispense-timers\";\n\nconst log = KosLog.createLogger({ name: \"useDefaultCuiKitLifecycle\" });\n/**\n * Hook that provides default CUI Kit lifecycle management with support for preflight checks.\n *\n * @example\n * // Basic usage without preflight check\n * const lifecycle = useDefaultCuiKitLifecycle({\n * kit,\n * inactivity: { idleTimeout: 60, areYouThereTimeoutOffset: 10 }\n * });\n *\n * @example\n * // With before callback to validate conditions before showing \"Are You There\"\n * const lifecycle = useDefaultCuiKitLifecycle({\n * kit,\n * inactivity: { idleTimeout: 60, areYouThereTimeoutOffset: 10 },\n * onBeforeAreYouThereTimer: async () => {\n * // Check if user has items in cart\n * if (cartItems.length === 0) {\n * return false; // Skip \"Are You There\" if no items selected\n * }\n *\n * // Check system status\n * const systemStatus = await checkSystemAvailability();\n * return systemStatus.isOperational;\n * }\n * });\n *\n * @example\n * // Advanced before callback with multiple conditions\n * const onBeforeAreYouThereTimer = useCallback(async () => {\n * // Don't show if pour is in progress\n * if (pourInProgress) return false;\n *\n * // Don't show if maintenance mode is active\n * const maintenance = await checkMaintenanceStatus();\n * if (maintenance.active) return false;\n *\n * // Don't show if user has premium access (extended timeout)\n * if (user?.isPremium) return false;\n *\n * return true; // Show \"Are You There\" screen\n * }, [pourInProgress, user]);\n */\n\ninterface TimerProps {\n /**\n * The idle timeout in seconds. This is the time in seconds that the screen will wait before\n * the current session is considered idle at which point the current selections will be cleared\n * and the screen will return to the home screen.\n */\n idleTimeout?: number;\n\n /**\n * This is the amount of time left in the idle timeout at which point the are you there screen will be shown.\n *\n * For example, if the idle timer was set to 60 seconds and the areYouThereTimeoutOffset was set to 10 seconds,\n * the are you there screen would be shown after 50 seconds of inactivity to provide an opportunity for the user\n * to indicate that they are still present.\n */\n areYouThereTimeoutOffset?: number;\n}\ninterface Props {\n /**\n * The CuiKit instance\n */\n kit?: CuiKitType | null;\n\n /**\n * The timer configuration for the inactivity timer\n */\n inactivity?: TimerProps;\n\n /**\n * An alternate timer configuration that is applied when a pour has been initiated\n * in the current session. This is useful when the idle timeout should be different\n * when a pour has been initiated.\n */\n pour?: TimerProps;\n /**\n * Screen configuration to control the visibility and timing of the attract and ambient screens.\n */\n screens?: {\n /**\n * The amount of time in seconds before the attract screen is shown.\n */\n attractTimeout?: number;\n\n /**\n * The amount of time in seconds measured as an offset from the attract timeout\n * that the ambient screen will be shown. For example, if the attract screen is to be\n * show after 300 seconds and the ambient timeout is set to 120 seconds, the ambient screen will appear\n * after 180 seconds and display for 120 seconds before the attract screen is shown.\n */\n ambientTimeoutOffset?: number;\n };\n\n /**\n * Optional callback function that executes when the areYouThere timer expires.\n * If provided, this function will be called before showing the \"Are You There\" screen.\n * The screen will only be shown if the callback returns true.\n *\n * @returns Promise<boolean> - Return true to show the \"Are You There\" screen, false to prevent it\n */\n onBeforeAreYouThereTimer?: () => Promise<boolean>;\n\n /**\n * Defines what happens to timers when onBeforeAreYouThereTimer returns false.\n * - \"pause\" - Pause the current timer (default)\n * - \"restart\" - Restart the timer from the beginning\n * - \"none\" - Do nothing, let timers continue as-is\n */\n areYouThereRejectionPolicy?: \"pause\" | \"restart\" | \"none\";\n}\n\ninterface LifecycleData {\n /**\n * Flag to indicate if the are you there timoute screen should be shown\n * @type {boolean}\n */\n showAreYouThere: boolean;\n\n /**\n * Callback that when invoked will reset the are you there timer and hide the screen\n * @returns\n */\n clearAreYouThere: () => void;\n\n /**\n * The countdown value for the are you there screen. This value is used to display the countdown.\n * If a pour has been initiated at any point in the current session, the countdown value will be based\n * on the pour idleTimeout and pour areYouThereTimeoutOffset value. Otherwise it will be based on the\n * inactivity idleTimeout and areYouThereTimeoutOffset values.\n * @type {number}\n *\n */\n areYouThereCountdown: number;\n\n /**\n * Flag to indicate if the ambient screen should be shown\n */\n showAmbientScreen: boolean;\n\n /**\n * Flag to indicate if the attract screen should be shown\n */\n showAttractScreen: boolean;\n\n /**\n * Callback to pause and reset the screen timer. This will typically be called when a user\n * interacts with the screen when the ambient or attract screen is show. This will set\n * the `showAmbientScreen` and `showAttractScreen` flags to false and reset the timer.\n */\n pauseScreenTimer: () => void;\n\n /**\n * Callback to restart the ambient screen timer. This will typically be called when a user\n * interacts with the screen when the ambient or attract screen is show. This will set\n * the `showAmbientScreen` and `showAttractScreen` flags to false and restart the timer.\n */\n restartScreenTimer: () => void;\n\n /**\n * Callback to pause the idle timer. This is typically called when the user interacts with the screen\n * and should pause the idle timer.\n */\n pauseIdleTimer: () => void;\n\n /**\n * Callback to restart the idle timer. This is typically called when the user interacts with the screen\n * and should restart the idle timer.\n */\n restartIdleTimer: () => void;\n}\nexport const useDefaultCuiKitLifecycle = ({\n kit,\n inactivity,\n pour,\n screens,\n onBeforeAreYouThereTimer,\n areYouThereRejectionPolicy = \"pause\",\n}: Props): LifecycleData => {\n const [showAmbientScreen, setShowAmbientScreen] = useState(false);\n const [showAttractScreen, setShowAttractScreen] = useState(false);\n\n const { model: nozzle } = useNozzleContext();\n\n const [hasPoured, setHasPoured] = useState(false);\n const idleTimeout = inactivity?.idleTimeout ?? 15;\n const areYouThereTimeout = inactivity?.areYouThereTimeoutOffset ?? 10;\n const idlePourTimeout = pour?.idleTimeout ?? inactivity?.idleTimeout ?? 10;\n const areYouTherePourTimeout =\n pour?.areYouThereTimeoutOffset ?? inactivity?.areYouThereTimeoutOffset ?? 5;\n const ambientTimeout = screens?.ambientTimeoutOffset;\n const attractTimeout = screens?.attractTimeout;\n\n const handleIdleTimeout = useCallback(() => {\n log.info(\"handleIdleTimeout called - navigating home and publishing event\");\n setShowAreYouThere(false); // Clear the Are You There modal\n kit?.nav.home();\n\n // Publish idle timeout event\n if (nozzle) {\n const topic = `/kos/dispense/${nozzle.path}/idle/timeout/`;\n EventBus.publish(topic, {});\n }\n }, [kit?.nav?.home, nozzle]);\n\n const handleResetIdleTimer = useCallback(() => {\n log.info(\"handleResetIdleTimer called - resetting idle timer\");\n setShowAreYouThere(false); // Clear the Are You There modal\n }, []);\n\n const handleAmbientTimer = useCallback(() => {\n if (ambientTimeout) {\n setShowAmbientScreen(true);\n setShowAttractScreen(false);\n\n // Publish ambient timer event\n if (nozzle) {\n const topic = `/kos/dispense/${nozzle.path}/ambient/start/`;\n EventBus.publish(topic, {});\n }\n }\n }, [ambientTimeout, nozzle]);\n\n const handleAttractTimer = useCallback(() => {\n if (attractTimeout) {\n setShowAttractScreen(true);\n setShowAmbientScreen(false);\n\n // Publish attract timer event\n if (nozzle) {\n const topic = `/kos/dispense/${nozzle.path}/attract/start/`;\n EventBus.publish(topic, {});\n }\n }\n }, [attractTimeout, nozzle]);\n\n const handleAttractResume = useCallback(() => {\n if (attractTimeout) {\n setShowAttractScreen(false);\n setShowAmbientScreen(false);\n kit?.nav.home();\n\n // Publish attract resume event\n if (nozzle) {\n const topic = `/kos/dispense/${nozzle.path}/attract/resume/`;\n EventBus.publish(topic, {});\n }\n }\n }, [kit?.nav, attractTimeout, nozzle]);\n\n const {\n pause: ambientPause,\n restart: ambientRestart,\n resume,\n attractTimer,\n } = useAmbientAttractTimers({\n defaultAmbientTime: ambientTimeout,\n defaultAttractTime: attractTimeout,\n onAmbientTimer: handleAmbientTimer,\n onAttractTimer: handleAttractTimer,\n onResumeAttractTimer: handleAttractResume,\n });\n\n kit?.timers?.add(attractTimer);\n\n const [showAreYouThere, setShowAreYouThere] = useState(false);\n\n // Create timer hooks first\n log.info(\n \"Creating idle timer with timeout:\",\n idleTimeout,\n \"seconds and callback:\",\n !!handleIdleTimeout\n );\n const { pause, restart, idleTimer } = useCuiKitTimers({\n defaultAreYouThereTime: areYouThereTimeout,\n defaultIdleTime: idleTimeout,\n onIdleTimer: handleIdleTimeout,\n onResetIdleTimer: handleResetIdleTimer,\n });\n\n log.info(\n `Creating pour timer with timeout: ${idlePourTimeout} seconds and callback: ${!!handleIdleTimeout}`\n );\n const {\n pause: pausePourTimer,\n restart: restartPourTimer,\n idleTimer: pourIdleTimer,\n } = useCuiKitTimers({\n defaultAreYouThereTime: areYouTherePourTimeout,\n defaultIdleTime: idlePourTimeout,\n onIdleTimer: handleIdleTimeout,\n prefix: \"pour-\",\n });\n\n // Define the Are You There handler with access to timer controls\n const handleAreYouThereTimer = useCallback(async () => {\n let shouldShowAreYouThere = true;\n\n // If a before callback is provided, run it first\n if (onBeforeAreYouThereTimer) {\n try {\n shouldShowAreYouThere = await onBeforeAreYouThereTimer();\n } catch (error) {\n log.error(`onBeforeAreYouThereTimer callback failed: ${error}`);\n shouldShowAreYouThere = false;\n }\n }\n\n if (shouldShowAreYouThere) {\n // Publish are you there timeout event\n if (nozzle) {\n const topic = `/kos/dispense/${nozzle.path}/are-you-there/timeout/`;\n EventBus.publish(topic, {});\n }\n setShowAreYouThere(true);\n\n // Pause the appropriate timer to prevent repeated calls\n if (hasPoured) {\n pausePourTimer();\n } else {\n pause();\n }\n } else {\n // Handle timer based on rejection policy\n switch (areYouThereRejectionPolicy) {\n case \"pause\":\n if (hasPoured) {\n pausePourTimer();\n } else {\n pause();\n }\n break;\n case \"restart\":\n if (hasPoured) {\n restartPourTimer();\n } else {\n restart();\n }\n break;\n case \"none\":\n // Do nothing - let timers continue\n break;\n }\n }\n }, [onBeforeAreYouThereTimer, nozzle, areYouThereRejectionPolicy, hasPoured]);\n\n const clearAreYouThere = useCallback(() => {\n setShowAreYouThere(false);\n ambientPause();\n if (hasPoured) {\n restartPourTimer();\n pause();\n } else {\n restart();\n pausePourTimer();\n }\n }, [hasPoured, pause, pausePourTimer, restart, restartPourTimer]);\n\n // Add the Are You There callback to the timers\n useEffect(() => {\n if (idleTimer) {\n idleTimer.addTimeoutAction({\n name: \"are-you-there-timer\",\n remainingTime: areYouThereTimeout,\n action: handleAreYouThereTimer,\n });\n }\n }, [idleTimer, areYouThereTimeout, handleAreYouThereTimer]);\n\n useEffect(() => {\n if (pourIdleTimer) {\n pourIdleTimer.addTimeoutAction({\n name: \"pour-are-you-there-timer\",\n remainingTime: areYouTherePourTimeout,\n action: handleAreYouThereTimer,\n });\n }\n }, [pourIdleTimer, areYouTherePourTimeout, handleAreYouThereTimer]);\n\n // Add timers to the kit\n kit?.timers?.add(idleTimer);\n kit?.timers?.add(pourIdleTimer);\n\n const handlePour = useCallback(() => {\n setHasPoured(false);\n pausePourTimer();\n pause();\n ambientPause();\n }, [pause, pausePourTimer]);\n\n const handlePourCancel = useCallback(() => {\n setHasPoured(true);\n log.info(\"restarting pour timer\");\n restartPourTimer();\n ambientPause();\n pause();\n }, [pause, restartPourTimer]);\n\n const handleBeforePourRejected = useCallback(() => {\n setHasPoured(false);\n log.info(\"restarting pour timer on before pour rejected\");\n pausePourTimer();\n restart();\n }, []);\n\n const handleBrandSelected = useCallback(() => {\n ambientPause();\n setShowAttractScreen(false);\n setShowAmbientScreen(false);\n restart();\n }, [ambientPause, restart]);\n\n const handleBrandCleared = useCallback(() => {\n setShowAttractScreen(false);\n setShowAmbientScreen(false);\n setHasPoured(false);\n pausePourTimer();\n ambientRestart();\n }, [ambientRestart, pausePourTimer]);\n\n const handleBeverageSelected = useCallback(() => {\n setShowAttractScreen(false);\n setShowAmbientScreen(false);\n setHasPoured(false);\n ambientPause();\n restart();\n }, [ambientPause, restart]);\n\n const handleBeverageCleared = useCallback(() => {\n setShowAttractScreen(false);\n setShowAmbientScreen(false);\n setHasPoured(false);\n ambientRestart();\n pause();\n pausePourTimer();\n }, [ambientRestart, pause, pausePourTimer]);\n\n const handleInit = useCallback(() => {\n setShowAttractScreen(false);\n setShowAmbientScreen(false);\n ambientRestart();\n pause();\n }, [ambientRestart, pause]);\n\n useDispenseLifecycle({\n onBrandSelected: handleBrandSelected,\n onBrandCleared: handleBrandCleared,\n onBeverageSelected: handleBeverageSelected,\n onBeverageCleared: handleBeverageCleared,\n onPour: handlePour,\n onPourCancel: handlePourCancel,\n onBeforePourRejected: handleBeforePourRejected,\n onInit: handleInit,\n // Note: Timer-related handlers (onIdleTimeout, onAmbientTimer, onAttractTimer,\n // onResumeAttractTimer, onAreYouThereTimeout) are NOT included here since this\n // component's own timer hooks call those handlers directly. Including them would\n // create circular event loops.\n });\n\n const areYouThereCountdown = hasPoured\n ? areYouTherePourTimeout\n : areYouThereTimeout;\n\n useEffect(() => {\n if (nozzle && attractTimer) {\n const topic = `/kos/dispense/${nozzle?.path}/init/`;\n EventBus.publish(topic, {});\n }\n }, [nozzle, attractTimer]);\n\n return {\n showAreYouThere,\n clearAreYouThere,\n pauseIdleTimer: pause,\n restartIdleTimer: restart,\n areYouThereCountdown,\n showAmbientScreen,\n showAttractScreen,\n pauseScreenTimer: ambientPause,\n restartScreenTimer: ambientRestart,\n };\n};\n","import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { DeviceAssembly, type DeviceAssemblyModel } from \"../../../models\";\n\nexport const useDeviceAssembly = () => {\n const modelId = DeviceAssembly.type;\n const result = useKosModel<DeviceAssemblyModel>({\n modelId,\n modelType: DeviceAssembly.type,\n options: {},\n });\n\n return result;\n};\n","import type { DeviceAssemblyModel } from \"../../../models\";\nimport { useDeviceAssembly } from \"./use-device-assembly\";\n\ninterface DeviceAssemblyProps {\n deviceAssembly: DeviceAssemblyModel;\n}\n\ntype HoCDeviceAssemblyProps = DeviceAssemblyProps;\n// react HOC to provide a DeviceAssembly to a component\nexport function withDeviceAssembly<\n T extends HoCDeviceAssemblyProps = HoCDeviceAssemblyProps\n>(WrappedComponent: React.ComponentType<T>) {\n return (props: Omit<T, keyof DeviceAssemblyProps>) => {\n const { model, status, KosModelLoader } = useDeviceAssembly();\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} deviceAssembly={model} />\n </KosModelLoader>\n );\n };\n}\n","import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { Holder, type HolderModel } from \"../../../models\";\n\nexport const useHolder = (id: string) => {\n const modelId = id;\n const result = useKosModel<HolderModel>({\n modelId,\n modelType: Holder.type,\n options: {},\n });\n\n return result;\n};\n","import type { HolderModel } from \"../../../models\";\nimport { useHolder } from \"./use-holder\";\n\ninterface HolderProps {\n holder: HolderModel;\n}\n// react HOC to provide a Holder to a component\nexport function withHolder<T extends HolderProps = HolderProps>(\n id: string,\n WrappedComponent: React.ComponentType<T>\n) {\n return (props: Omit<T, keyof HolderProps>) => {\n const { model, status, KosModelLoader } = useHolder(id);\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} holder={model} />\n </KosModelLoader>\n );\n };\n}\n","import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { HolderContainer, type HolderContainerModel } from \"../../../models\";\n\nexport const useHolderContainer = () => {\n const modelId = HolderContainer.type;\n const result = useKosModel<HolderContainerModel>({\n modelId,\n modelType: HolderContainer.type,\n options: {},\n });\n\n return result;\n};\n","import type { HolderContainerModel } from \"../../../models\";\nimport { useHolderContainer } from \"./use-holder-container\";\n\ninterface HolderContainerProps {\n holderContainer: HolderContainerModel;\n}\n// react HOC to provide a HolderContainer to a component\nexport function withHolderContainer<\n T extends HolderContainerProps = HolderContainerProps\n>(WrappedComponent: React.ComponentType<T>) {\n return (props: Omit<T, keyof HolderContainerProps>) => {\n const { model, status, KosModelLoader } = useHolderContainer();\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} holderContainer={model} />\n </KosModelLoader>\n );\n };\n}\n","import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { Ingredient, type IngredientModel } from \"../../../models\";\n\nexport const useIngredient = () => {\n const modelId = Ingredient.type;\n const result = useKosModel<IngredientModel>({\n modelId,\n modelType: Ingredient.type,\n options: {},\n });\n\n return result;\n};\n","import { KosLog } from \"@kosdev-code/kos-ui-sdk\";\nimport type { IntentAware } from \"../../../../models\";\nimport type { PourStrategy } from \"./pour-strategy\";\n\nconst logger = KosLog.createLogger({\n name: \"HoldToPourIntentStrategy\",\n group: \"kos-hooks\",\n});\nexport const HoldToPourIntentStrategy: PourStrategy<IntentAware> = {\n name: \"HoldToPourIntentStrategy\",\n async initiate(model?: IntentAware, intent?: string): Promise<void> {\n if (!model?.canPour) {\n logger.debug(`${model?.id} cannot pour. Returning early.`);\n return;\n }\n if (intent) {\n logger.debug(`performing intent: ${intent}`);\n await model?.performIntent(intent);\n } else {\n logger.debug(\"no intent provided. Returning early.\");\n }\n },\n\n async initiateEnded(nozzle?: IntentAware): Promise<void> {\n await nozzle?.cancelPour();\n },\n};\n","import { useCallback } from \"react\";\n\nimport { KosLog, usePressGesture } from \"@kosdev-code/kos-ui-sdk\";\nimport type { ReactDOMAttributes } from \"@use-gesture/react/dist/declarations/src/types\";\nimport type { IntentAware } from \"../../../models\";\nimport { HoldToPourIntentStrategy } from \"../utils/pour-strategy/hold-to-pour-intent-strategy\";\nimport type { PourStrategy } from \"../utils/pour-strategy/pour-strategy\";\n\ninterface IngredientPourProps {\n onPour?: () => void;\n onPourCancel?: () => void;\n intentContainer: IntentAware;\n strategy?: PourStrategy<IntentAware>;\n}\n\nexport interface IngredientPourResponse {\n handlers: (...args: any[]) => ReactDOMAttributes;\n cancel: () => void;\n\n status?: {\n canPour: boolean;\n isPouring: boolean;\n };\n}\n\nconst logger = KosLog.createLogger({\n name: \"useNozzlePour\",\n group: \"kos-hooks\",\n});\n/**\n * Hook that encapsulates the logic for handling ingredient pouring.\n *\n * The hook will return a number of gesture handlers that can be spread onto a DOM element.\n * The hook will automatically detects if touch or mouse events are used.\n *\n *\n * @param onPour - callback initiated after pouring starts\n * @param onPourCancel - callback initiated after pouring is cancelled\n * @returns handlers - gesture handlers for nozzle pouring\n *\n *\n * @example\n * const { handlers } = useIngredientPour({\n * onPour: () => {\n * console.log(\"Pouring started\");\n * },\n * onPourCancel: () => {\n * console.log(\"Pouring cancelled\");\n * },\n * });\n *\n * <div {...handlers()} />\n *\n *\n * @see {@link IntentAware.performIntent}\n * @see {@link usePressGesture}\n **/\nexport const useIngredientPour = ({\n onPour,\n onPourCancel,\n intentContainer,\n strategy = HoldToPourIntentStrategy,\n}: IngredientPourProps): IngredientPourResponse => {\n const handlePour = useCallback(() => {\n logger.debug(\n `[${strategy?.name}] - Pour initiated for model ${intentContainer?.id}.`\n );\n strategy?.initiate(intentContainer);\n onPour?.();\n }, [onPour, intentContainer, strategy]);\n\n const handleCancelPour = useCallback(() => {\n logger.debug(\n `[${strategy?.name}] - Pour initiate ended called for nozzle ${intentContainer?.id}.`\n );\n strategy?.initiateEnded?.(intentContainer);\n onPourCancel?.();\n }, [onPourCancel, intentContainer, strategy]);\n\n const forceCancelPour = useCallback(() => {\n logger.debug(`Force cancelling pour for nozzle ${intentContainer?.id}.`);\n intentContainer?.cancelPour();\n onPourCancel?.();\n }, [onPourCancel, intentContainer]);\n\n const handlers = usePressGesture({\n onPressed: handlePour,\n onRelease: handleCancelPour,\n });\n\n return {\n handlers: handlers.dom,\n cancel: forceCancelPour,\n status: intentContainer,\n };\n};\n","import type { IngredientModel } from \"../../../models\";\nimport { useIngredient } from \"./use-ingredient\";\n\ninterface IngredientProps {\n ingredient: IngredientModel;\n}\n// react HOC to provide a Ingredient to a component\nexport function withIngredient<T extends IngredientProps = IngredientProps>(\n WrappedComponent: React.ComponentType<T>\n) {\n return (props: Omit<T, keyof IngredientProps>) => {\n const { model, status, KosModelLoader } = useIngredient();\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} ingredient={model} />\n </KosModelLoader>\n );\n };\n}\n","import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport {\n IngredientContainer,\n type IngredientContainerModel,\n} from \"../../../models\";\n\nexport const useIngredientContainer = () => {\n const modelId = IngredientContainer.type;\n const result = useKosModel<IngredientContainerModel>({\n modelId,\n modelType: IngredientContainer.type,\n options: {},\n });\n\n return result;\n};\n","import type { IngredientContainerModel } from \"../../../models\";\nimport { useIngredientContainer } from \"./use-ingredient-container\";\n\ninterface IngredientContainerProps {\n ingredientContainer: IngredientContainerModel;\n}\n// react HOC to provide a IngredientContainer to a component\nexport function withIngredientContainer<\n T extends IngredientContainerProps = IngredientContainerProps\n>(WrappedComponent: React.ComponentType<T>) {\n return (props: Omit<T, keyof IngredientContainerProps>) => {\n const { model, status, KosModelLoader } = useIngredientContainer();\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} ingredientContainer={model} />\n </KosModelLoader>\n );\n };\n}\n","import type { NozzleModel } from \"../../../models\";\nimport { useNozzle } from \"./use-nozzle\";\n\ninterface NozzleProps {\n nozzle: NozzleModel;\n}\n// react HOC to provide a Nozzle to a component\nexport function withNozzle<T extends NozzleProps = NozzleProps>(\n path: string,\n WrappedComponent: React.ComponentType<T>\n) {\n return (props: Omit<T, keyof NozzleProps>) => {\n const { model, status, KosModelLoader } = useNozzle(path);\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} nozzle={model} />\n </KosModelLoader>\n );\n };\n}\n","import { useCallback, useState } from \"react\";\n\nimport { KosLog, usePressGesture } from \"@kosdev-code/kos-ui-sdk\";\nimport type { ReactDOMAttributes } from \"@use-gesture/react/dist/declarations/src/types\";\nimport type { PourState } from \"../../../models/models/types/pouring\";\nimport { PourContext } from \"../../utils/pour-context\";\nimport { HoldToPourStrategy } from \"../utils/pour-strategy/hold-to-pour-strategy\";\nimport type {\n PourStrategy,\n PourStrategyAware,\n} from \"../utils/pour-strategy/pour-strategy\";\n\ninterface PourProps {\n onBeforePour?: (context?: PourContext) => Promise<boolean>;\n onPour?: () => void;\n onPourCancel?: () => void;\n onPourAbort?: () => void;\n pourTarget: PourStrategyAware;\n strategy?: PourStrategy;\n pourContext?: PourContext;\n}\n\nexport interface PourResponse {\n handlers: (...args: any[]) => ReactDOMAttributes;\n updatePourContext?: (key: string, value: any) => void;\n removeFromPourContext?: (key: string) => void;\n cancel: () => void;\n\n status?: {\n canPour: boolean;\n isPouring: boolean;\n currentState: PourState;\n };\n}\n\nconst logger = KosLog.createLogger({\n name: \"usePour\",\n group: \"kos-hooks\",\n});\n/**\n * Hook that encapsulates the logic for handling generic pouring.\n *\n * The hook will return a number of gesture handlers that can be spread onto a DOM element.\n * The hook will automatically detects if touch or mouse events are used.\n *\n *\n * @param onPour - callback initiated after pouring starts\n * @param onPourCancel - callback initiated after pouring is cancelled\n * @returns handlers - gesture handlers for nozzle pouring\n *\n *\n * @example\n * const { handlers } = usePour({\n * onPour: () => {\n * console.log(\"Pouring started\");\n * },\n * onPourCancel: () => {\n * console.log(\"Pouring cancelled\");\n * },\n * });\n *\n * <div {...handlers()} />\n *\n \n * @see {@link usePressGesture}\n **/\nexport const usePourTarget = ({\n onBeforePour,\n onPour,\n onPourCancel,\n onPourAbort,\n pourTarget,\n pourContext,\n strategy = HoldToPourStrategy,\n}: PourProps): PourResponse => {\n const [context, _setContext] = useState<PourContext>(\n pourContext || new PourContext()\n );\n const handlePour = useCallback(async () => {\n logger.debug(\n `[${strategy?.name}] - calling before pour for pour target ${pourTarget?.id}.`\n );\n const canPour = onBeforePour ? await onBeforePour?.(context) : true;\n if (canPour) {\n logger.debug(\n `[${strategy?.name}] - Pour initiated for pour target ${pourTarget?.id}.`\n );\n await strategy?.initiate(pourTarget);\n onPour?.();\n if (!pourTarget?.isPouring) {\n onPourAbort?.();\n }\n } else {\n logger.debug(\n `[${strategy?.name}] - Pour cancelled for pour target ${pourTarget?.id}.`\n );\n onPourCancel?.();\n }\n }, [onPour, onBeforePour, onPourAbort, pourTarget, strategy, context]);\n\n const handleCancelPour = useCallback(async () => {\n logger.debug(\n `[${strategy?.name}] - Pour initiate ended called for pour target ${pourTarget?.id}.`\n );\n const ignore = await strategy?.initiateEnded?.(pourTarget);\n if (!ignore) {\n onPourCancel?.();\n }\n }, [onPourCancel, pourTarget, strategy]);\n\n const forceCancelPour = useCallback(async () => {\n logger.debug(`Force cancelling pour for pour target ${pourTarget?.id}.`);\n await pourTarget?.cancelPour();\n onPourCancel?.();\n }, [onPourCancel, pourTarget]);\n\n const handleUpdateContext = useCallback(\n (key: string, value: any) => {\n context.set(key, value);\n },\n [context]\n );\n\n const handleRemoveFromContext = useCallback(\n (key: string) => {\n context.remove(key);\n },\n [context]\n );\n\n const handlers = usePressGesture({\n onPressed: handlePour,\n onRelease: handleCancelPour,\n });\n\n return {\n handlers: handlers.dom,\n cancel: forceCancelPour,\n updatePourContext: handleUpdateContext,\n removeFromPourContext: handleRemoveFromContext,\n status: pourTarget,\n };\n};\n","import { KosLog } from \"@kosdev-code/kos-ui-sdk\";\nimport type { IntentAware } from \"../../../../models\";\nimport type { PourStrategy } from \"./pour-strategy\";\n\nconst logger = KosLog.createLogger({\n name: \"TapOrHoldIntentStrategy\",\n group: \"kos-hooks\",\n});\n\nexport class TapOrHoldIntentStrategy implements PourStrategy<IntentAware> {\n intent: string;\n name = \"TapOrHoldIntentStrategy\";\n isHold = false;\n private disposer?: NodeJS.Timeout | null = null;\n constructor(intent: string) {\n this.intent = intent;\n }\n\n async initiate(model?: IntentAware, intent?: string): Promise<void> {\n this.disposer = setTimeout(() => {\n this.isHold = true;\n }, 250);\n\n if (model?.isPouring && !this.isHold) {\n logger.debug(`additional tap detected. cancelling pour`);\n await model.cancelPour();\n return;\n }\n if (!model?.canPour) {\n logger.debug(`${model?.id} cannot pour. Returning early.`);\n return;\n }\n if (intent) {\n logger.debug(`performing intent: ${intent}`);\n await model?.performIntent(intent);\n } else {\n logger.debug(\"no intent provided. Returning early.\");\n }\n }\n async initiateEnded(nozzle?: IntentAware): Promise<boolean> {\n if (this.disposer) clearTimeout(this.disposer);\n this.disposer = null;\n if (!this.isHold) {\n logger.debug(\"Tap detected. don't cancel and return.\");\n return true;\n }\n await nozzle?.cancelPour();\n return false;\n }\n}\n","import { KosLog } from \"@kosdev-code/kos-ui-sdk\";\nimport type { IntentAware } from \"../../../../models\";\nimport type { PourStrategy } from \"./pour-strategy\";\n\nconst logger = KosLog.createLogger({\n name: \"TapToPourIntentStrategy\",\n group: \"kos-hooks\",\n});\nexport const TapToPourIntentStrategy: PourStrategy<IntentAware> = {\n name: \"TapToPourIntentStrategy\",\n async initiate(model?: IntentAware, intent?: string): Promise<void> {\n if (model?.isPouring) {\n logger.debug(`Nozzle ${model?.id} is already pouring. cancelling pour`);\n await model.cancelPour();\n return;\n }\n if (!model?.canPour) {\n logger.debug(`Nozzle ${model?.id} cannot pour. Returning early.`);\n return;\n }\n if (intent) {\n logger.debug(`performing intent: ${intent}`);\n await model?.performIntent(intent);\n } else {\n logger.debug(\"no intent provided. Returning early.\");\n }\n },\n\n async initiateEnded(_nozzle?: IntentAware): Promise<boolean> {\n return true;\n },\n};\n","import { KosLog } from \"@kosdev-code/kos-ui-sdk\";\nimport type { PourStrategy, PourStrategyAware } from \"./pour-strategy\";\n\nconst logger = KosLog.createLogger({\n name: \"HoldToPourStrategy\",\n group: \"kos-hooks\",\n});\nexport const TapToPourStrategy: PourStrategy = {\n name: \"TapToPourStrategy\",\n async initiate(nozzle?: PourStrategyAware): Promise<void> {\n if (nozzle?.isPouring) {\n logger.debug(`Nozzle ${nozzle?.id} is already pouring. cancelling pour`);\n await nozzle.cancelPour();\n return;\n }\n if (!nozzle?.canPour) {\n logger.debug(`Nozzle ${nozzle?.id} cannot pour. Returning early.`);\n return;\n }\n await nozzle?.pour();\n },\n\n async initiateEnded(_nozzle?: PourStrategyAware): Promise<boolean> {\n return true;\n },\n};\n","import {\n GenericPour,\n GenericPourModel,\n type GenericPourOptions,\n} from \"@kosdev-code/kos-dispense-sdk\";\nimport { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\n\nexport const useGenericPour = (\n id: string,\n servicePathFactory: (selectedId: string) => string,\n itemId?: string\n) => {\n const modelId = id;\n const result = useKosModel<GenericPourModel, GenericPourOptions>({\n modelId,\n modelType: GenericPour.type,\n options: {\n servicePathFactory,\n selectedId: itemId,\n },\n });\n\n return result;\n};\n","import { GenericPourModel } from \"@kosdev-code/kos-dispense-sdk\";\nimport { useGenericPour } from \"./use-generic-pour\";\n\ninterface GenericPourProps {\n genericPour: GenericPourModel;\n}\n\ninterface Identifiable {\n id: string;\n servicePathFactory: (selectedId: string) => string;\n itemId?: string;\n}\n\ntype HoCGenericPourProps = GenericPourProps & Identifiable;\n// react HOC to provide a GenericPour to a component\nexport function withGenericPour<\n T extends HoCGenericPourProps = HoCGenericPourProps\n>(WrappedComponent: React.ComponentType<T>) {\n return (props: Omit<T, keyof GenericPourProps>) => {\n const { model, status, KosModelLoader } = useGenericPour(\n props.id,\n props.servicePathFactory,\n props.itemId\n );\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} genericPour={model} />\n </KosModelLoader>\n );\n };\n}\n","import { PropsWithChildren, createContext, useContext, useMemo } from \"react\";\nimport type { AssemblyModel } from \"../../../models/models/assembly\";\nimport { useAssembly } from \"../../hooks\";\n\ninterface AssemblyType<\n AssemblyExt extends object = any,\n HolderExt extends object = any\n> {\n model?: AssemblyModel<AssemblyExt, HolderExt>;\n}\nconst Assembly = createContext<AssemblyType | undefined>(undefined);\n\ninterface AssemblyProviderProps {}\n\nexport const AssemblyProvider: React.FunctionComponent<\n PropsWithChildren<AssemblyProviderProps>\n> = ({ children }) => {\n const { model, ready } = useAssembly();\n const value: AssemblyType = useMemo(() => {\n if (ready && model) {\n return { model };\n }\n return {};\n }, [ready, model]);\n return <Assembly.Provider value={value}>{children}</Assembly.Provider>;\n};\nexport const useAssemblyContext = <\n AssemblyExt extends object = any,\n HolderExt extends object = any\n>() => {\n const context: AssemblyType<AssemblyExt, HolderExt> = useContext(\n Assembly\n ) as AssemblyType<AssemblyExt, HolderExt>;\n if (!context) {\n throw new Error(\n \"useAssemblyContext must be used within a AssemblyProvider\"\n );\n }\n return context;\n};\n","import { PropsWithChildren, createContext, useContext, useMemo } from \"react\";\nimport type { AvailabilityModel } from \"../../../models\";\nimport { useAvailability } from \"../../hooks/availability/use-availability\";\n\ninterface AvailabilityType {\n model?: AvailabilityModel;\n}\nconst Availability = createContext<AvailabilityType | undefined>(undefined);\n\ninterface AvailabilityProviderProps {\n id?: string;\n}\n\nexport const AvailabilityProvider: React.FunctionComponent<\n PropsWithChildren<AvailabilityProviderProps>\n> = ({ children }) => {\n const { model, ready } = useAvailability();\n const value: AvailabilityType = useMemo(() => {\n if (ready && model) {\n return { model };\n }\n return {};\n }, [ready, model]);\n return (\n <Availability.Provider value={value}>{children}</Availability.Provider>\n );\n};\nexport const useAvailabilityContext = () => {\n const context = useContext(Availability);\n if (!context) {\n throw new Error(\n \"useAvailabilityContext must be used within a AvailabilityProvider\"\n );\n }\n return context;\n};\n","import { PropsWithChildren, createContext, useContext, useMemo } from \"react\";\nimport type { BoardModel } from \"../../../models\";\nimport { useBoard } from \"../../hooks/board/use-board\";\n\ninterface BoardType {\n model?: BoardModel;\n}\nconst Board = createContext<BoardType | undefined>(undefined);\n\ninterface BoardProviderProps {\n id: string;\n}\n\nexport const BoardProvider: React.FunctionComponent<\n PropsWithChildren<BoardProviderProps>\n> = ({ children, id }) => {\n const { model, ready } = useBoard(id);\n const value: BoardType = useMemo(() => {\n if (ready && model) {\n return { model };\n }\n return {};\n }, [ready, model]);\n return <Board.Provider value={value}>{children}</Board.Provider>;\n};\nexport const useBoardContext = () => {\n const context = useContext(Board);\n if (!context) {\n throw new Error(\"useBoardContext must be used within a BoardProvider\");\n }\n return context;\n};\n","import { PropsWithChildren, createContext, useContext, useMemo } from \"react\";\nimport type { BoardContainerModel } from \"../../../models\";\nimport { useBoardContainer } from \"../../hooks/board-container/use-board-container\";\n\ninterface BoardContainerType {\n model?: BoardContainerModel;\n}\nconst BoardContainer = createContext<BoardContainerType | undefined>(undefined);\n\ninterface BoardContainerProviderProps {}\n\nexport const BoardContainerProvider: React.FunctionComponent<\n PropsWithChildren<BoardContainerProviderProps>\n> = ({ children }) => {\n const { model, ready } = useBoardContainer();\n const value: BoardContainerType = useMemo(() => {\n if (ready && model) {\n return { model };\n }\n return {};\n }, [ready, model]);\n return (\n <BoardContainer.Provider value={value}>{children}</BoardContainer.Provider>\n );\n};\nexport const useBoardContainerContext = () => {\n const context = useContext(BoardContainer);\n if (!context) {\n throw new Error(\n \"useBoardContainerContext must be used within a BoardContainerProvider\"\n );\n }\n return context;\n};\n","import { PropsWithChildren, createContext, useContext, useMemo } from \"react\";\nimport { DeviceAssemblyModel } from \"../../../models\";\nimport { useDeviceAssembly } from \"../../hooks/device-assembly/use-device-assembly\";\n\ninterface DeviceAssemblyType {\n model?: DeviceAssemblyModel;\n nozzlePaths?: string[];\n}\nconst DeviceAssemblyContext = createContext<DeviceAssemblyType | undefined>(\n undefined\n);\n\ntype DeviceAssemblyProviderProps = object;\n\nexport const DeviceAssemblyProvider: React.FunctionComponent<\n PropsWithChildren<DeviceAssemblyProviderProps>\n> = ({ children }) => {\n const { model, ready } = useDeviceAssembly();\n const value: DeviceAssemblyType = useMemo(() => {\n if (ready && model) {\n const nozzlePaths = model.nozzlePaths;\n return { model, nozzlePaths };\n }\n return {};\n }, [ready, model]);\n\n const content = ready && model ? children : null;\n return (\n <DeviceAssemblyContext.Provider value={value}>\n {content}\n </DeviceAssemblyContext.Provider>\n );\n};\nexport const useDeviceAssemblyContext = () => {\n const context = useContext(DeviceAssemblyContext);\n if (!context) {\n throw new Error(\n \"useDeviceAssemblyContext must be used within a DeviceAssemblyProvider\"\n );\n }\n return context;\n};\n","import React, { useContext, type ReactNode } from \"react\";\nimport {\n useCuiKit,\n type CuiKitType,\n type UseCuiKitProps,\n} from \"../../hooks/cui-kit/use-cui-kit\";\nimport {\n DeviceAssemblyProvider,\n useDeviceAssemblyContext,\n} from \"../device-assembly/device-assembly-provider\";\nimport { NozzleProvider } from \"../nozzle/nozzle-provider\";\n\nfunction createDispenseKitContext<\n BrandData extends Record<string, any> = any,\n BeverageData extends Record<string, any> = any,\n FlavorData extends Record<string, any> = any\n>() {\n const CuiKitContext = React.createContext<CuiKitType<\n BrandData,\n BeverageData,\n FlavorData\n > | null>(null);\n\n const useCuiKitContext = () => {\n const ctx = useContext(CuiKitContext);\n if (ctx === undefined) {\n throw new Error(\"useDispenseKitContext must be used within a Provider\");\n }\n return ctx;\n };\n\n return [useCuiKitContext, CuiKitContext.Provider] as const;\n}\n\nexport function CuiKitWrapper<\n BrandData extends Record<string, any> = any,\n BeverageData extends Record<string, any> = any,\n FlavorData extends Record<string, any> = any\n>({\n children,\n provider: CuiKitProvider,\n props,\n nozzleProps,\n}: DispenseViewProps & { nozzleProps?: ChildProps }) {\n const result = useCuiKit<BrandData, BeverageData, FlavorData>(props);\n\n return (\n <CuiKitProvider value={result}>\n {children(nozzleProps || {})}\n </CuiKitProvider>\n );\n}\n\ninterface ChildProps {\n nozzleIndex?: number;\n nozzlePath?: string;\n totalNozzles?: number;\n isFirstNozzle?: boolean;\n isLastNozzle?: boolean;\n}\n\ninterface DispenseViewProps<\n BrandData extends Record<string, any> = any,\n BeverageData extends Record<string, any> = any,\n FlavorData extends Record<string, any> = any\n> {\n children: (props: ChildProps) => ReactNode;\n provider: React.Provider<CuiKitType<\n BrandData,\n BeverageData,\n FlavorData\n > | null>;\n props: UseCuiKitProps;\n}\nfunction DispenseView<\n BrandData extends Record<string, any> = any,\n BeverageData extends Record<string, any> = any,\n FlavorData extends Record<string, any> = any\n>({\n children,\n provider,\n props,\n}: DispenseViewProps<BrandData, BeverageData, FlavorData>) {\n const { nozzlePaths } = useDeviceAssemblyContext();\n const totalNozzles = nozzlePaths?.length || 0;\n\n const nozzles =\n nozzlePaths?.map((path, index) => (\n <NozzleProvider key={path} path={path}>\n <CuiKitWrapper<BrandData, BeverageData, FlavorData>\n provider={provider}\n props={props}\n nozzleProps={{\n nozzleIndex: index,\n nozzlePath: path,\n totalNozzles,\n isFirstNozzle: index === 0,\n isLastNozzle: index === totalNozzles - 1,\n }}\n >\n {children}\n </CuiKitWrapper>\n </NozzleProvider>\n )) || [];\n return nozzles;\n}\n\nexport interface CuiKitProps {\n children: () => ReactNode;\n}\n\ninterface CuiKitProviderProps<\n BrandData extends Record<string, any> = any,\n BeverageData extends Record<string, any> = any,\n FlavorData extends Record<string, any> = any\n> {\n provider: React.Provider<CuiKitType<\n BrandData,\n BeverageData,\n FlavorData\n > | null>;\n props: UseCuiKitProps;\n}\nexport function CuiKit<\n BrandData extends Record<string, any> = any,\n BeverageData extends Record<string, any> = any,\n FlavorData extends Record<string, any> = any\n>({\n provider,\n props,\n}: CuiKitProviderProps<BrandData, BeverageData, FlavorData>) {\n return ({ children }: CuiKitProps) =>\n provider ? (\n <DeviceAssemblyProvider>\n <DispenseView<BrandData, BeverageData, FlavorData>\n provider={provider}\n props={props}\n >\n {children}\n </DispenseView>\n </DeviceAssemblyProvider>\n ) : null;\n}\n\nexport function initializeCuiKit<\n BrandData extends Record<string, any> = any,\n BeverageData extends Record<string, any> = any,\n FlavorData extends Record<string, any> = any\n>(props: UseCuiKitProps) {\n const [useCuiKitContext, DispenseKitProvider] = createDispenseKitContext<\n BrandData,\n BeverageData,\n FlavorData\n >();\n return [\n useCuiKitContext,\n CuiKit({ provider: DispenseKitProvider, props }),\n ] as const;\n}\n","import { PropsWithChildren, createContext, useContext, useMemo } from \"react\";\nimport type { HolderModel } from \"../../../models\";\nimport { useHolder } from \"../../hooks/holder/use-holder\";\n\ninterface HolderType {\n model?: HolderModel;\n}\nconst Holder = createContext<HolderType | undefined>(undefined);\n\ninterface HolderProviderProps {\n id?: string;\n}\n\nexport const HolderProvider: React.FunctionComponent<\n PropsWithChildren<HolderProviderProps>\n> = ({ children, id }) => {\n const { model, ready } = useHolder(id || \"\");\n const value: HolderType = useMemo(() => {\n if (ready && model) {\n return { model };\n }\n return {};\n }, [ready, model]);\n return <Holder.Provider value={value}>{children}</Holder.Provider>;\n};\nexport const useHolderContext = () => {\n const context = useContext(Holder);\n if (!context) {\n throw new Error(\"useHolderContext must be used within a HolderProvider\");\n }\n return context;\n};\n","import { PropsWithChildren, createContext, useContext, useMemo } from \"react\";\nimport { type HolderContainerModel } from \"../../../models\";\nimport { useHolderContainer } from \"../../hooks/holder-container/use-holder-container\";\n\ninterface HolderContainerType {\n model?: HolderContainerModel;\n}\nconst HolderContainer = createContext<HolderContainerType | undefined>(\n undefined\n);\n\ninterface HolderContainerProviderProps {\n id?: string;\n}\n\nexport const HolderContainerProvider: React.FunctionComponent<\n PropsWithChildren<HolderContainerProviderProps>\n> = ({ children }) => {\n const { model, ready } = useHolderContainer();\n const value: HolderContainerType = useMemo(() => {\n if (ready && model) {\n return { model };\n }\n return {};\n }, [ready, model]);\n return (\n <HolderContainer.Provider value={value}>\n {children}\n </HolderContainer.Provider>\n );\n};\nexport const useHolderContainerContext = () => {\n const context = useContext(HolderContainer);\n if (!context) {\n throw new Error(\n \"useHolderContainerContext must be used within a HolderContainerProvider\"\n );\n }\n return context;\n};\n","import { PropsWithChildren, createContext, useContext, useMemo } from \"react\";\nimport type { IngredientModel } from \"../../../models\";\nimport { useIngredient } from \"../../hooks/ingredient/use-ingredient\";\n\ninterface IngredientType {\n model?: IngredientModel;\n}\nconst Ingredient = createContext<IngredientType | undefined>(undefined);\n\ninterface IngredientProviderProps {\n id?: string;\n}\n\nexport const IngredientProvider: React.FunctionComponent<\n PropsWithChildren<IngredientProviderProps>\n> = ({ children }) => {\n const { model, ready } = useIngredient();\n const value: IngredientType = useMemo(() => {\n if (ready && model) {\n return { model };\n }\n return {};\n }, [ready, model]);\n return <Ingredient.Provider value={value}>{children}</Ingredient.Provider>;\n};\nexport const useIngredientContext = () => {\n const context = useContext(Ingredient);\n if (!context) {\n throw new Error(\n \"useIngredientContext must be used within a IngredientProvider\"\n );\n }\n return context;\n};\n","import { PropsWithChildren, createContext, useContext, useMemo } from \"react\";\nimport type { IngredientContainerModel } from \"../../../models\";\nimport { useIngredientContainer } from \"../../hooks/ingredient-container/use-ingredient-container\";\n\ninterface IngredientContainerType {\n model?: IngredientContainerModel;\n}\nconst IngredientContainer = createContext<IngredientContainerType | undefined>(\n undefined\n);\n\ninterface IngredientContainerProviderProps {\n id?: string;\n}\n\nexport const IngredientContainerProvider: React.FunctionComponent<\n PropsWithChildren<IngredientContainerProviderProps>\n> = ({ children }) => {\n const { model, ready } = useIngredientContainer();\n const value: IngredientContainerType = useMemo(() => {\n if (ready && model) {\n return { model };\n }\n return {};\n }, [ready, model]);\n return (\n <IngredientContainer.Provider value={value}>\n {children}\n </IngredientContainer.Provider>\n );\n};\nexport const useIngredientContainerContext = () => {\n const context = useContext(IngredientContainer);\n if (!context) {\n throw new Error(\n \"useIngredientContainerContext must be used within a IngredientContainerProvider\"\n );\n }\n return context;\n};\n","import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { Pump, type PumpModel } from \"../../../models\";\n\nexport const usePump = () => {\n const modelId = Pump.type;\n const result = useKosModel<PumpModel>({\n modelId,\n modelType: Pump.type,\n options: {},\n });\n\n return result;\n};\n","import { PropsWithChildren, createContext, useContext, useMemo } from \"react\";\nimport type { PumpModel } from \"../../../models\";\nimport { usePump } from \"../../hooks/pump/use-pump\";\n\ninterface PumpType {\n model?: PumpModel;\n}\nconst Pump = createContext<PumpType | undefined>(undefined);\n\ninterface PumpProviderProps {\n id?: string;\n}\n\nexport const PumpProvider: React.FunctionComponent<\n PropsWithChildren<PumpProviderProps>\n> = ({ children }) => {\n const { model, ready } = usePump();\n const value: PumpType = useMemo(() => {\n if (ready && model) {\n return { model };\n }\n return {};\n }, [ready, model]);\n return <Pump.Provider value={value}>{children}</Pump.Provider>;\n};\nexport const usePumpContext = () => {\n const context = useContext(Pump);\n if (!context) {\n throw new Error(\"usePumpContext must be used within a PumpProvider\");\n }\n return context;\n};\n"],"names":["useAssembly","modelId","Assembly","useKosModel","withAssembly","WrappedComponent","props","model","status","KosModelLoader","jsx","useAvailability","Availability","withBeverage","useBoard","id","Board","withBoard","useBoardContainer","BoardContainer","withBoardContainer","useNozzle","path","Nozzle","createContext","NozzleProvider","children","ready","value","useMemo","useNozzleContext","context","useContext","useBeverages","onBeverageSelected","onClearBeverage","companionType","nozzle","beverages","setBeverages","useState","selectedBeverage","setSelectedBeverage","companions","brand","getKosCompanionModel","selectBeverage","useCallback","beverage","clearBeverage","useEffect","disposer","kosAutoEffect","selectedBrand","allBeverages","useBrands","onBrandSelected","onBrandCleared","setSelectedBrand","brands","setBrands","selectBrand","clearBrand","PourContext","__publicField","key","logger","KosLog","HoldToPourStrategy","useNozzlePour","onPour","onPourCancel","onBeforePour","onBeforePourRejected","pourContext","strategy","_setContext","handlePour","handleCancelPour","_a","forceCancelPour","handleUpdateContext","handleRemoveFromContext","usePressGesture","useFlavors","onFlavorSelected","onFlavorCleared","flavors","f","flavor","selectedFlavors","setSelectedFlavors","selectFlavor","previous","p","clear","DISPENSE_GROUP_BRAND","DISPENSE_GROUP_BEVERAGE","DISPENSE_GROUP_FLAVOR","log","useCuiKit","initialGroup","options","currentGroup","setCurrentGroup","timersRef","useRef","updatePourContext","removeFromPourContext","topic","EventBus","onBeverageCleared","handleBeforePour","handleBeforePourRejected","brandCompanions","beverageCompanions","_b","clearFlavors","flavorCompanions","_c","setOnBeforePour","updateOnBeforePour","callback","pour","back","home","pauseTimers","timer","restartTimers","t","useAmbientAttractTimers","attractTimer","setAttractTimer","onAmbientTimer","onAttractTimer","onResetAttractTimer","onResumeAttractTimer","defaultAttractTime","defaultAmbientTime","handleAmbientTimer","handleAttractTimer","handleResetAttractTimer","handlePauseAttractTimer","handleResume","TimerManager","subscribe","useDispenseLifecycle","onInit","onReturnToHome","onIdleTimeout","onAreYouThereTimeout","disposers","useCuiKitTimers","idleTimer","setIdleTimer","onAreYouThereTimer","onIdleTimer","onResetIdleTimer","defaultAreYouThereTime","defaultIdleTime","hasAreYouThereFiredRef","handleAreYouThereTimer","handleIdleTimer","handleRestartIdleTimer","handlePauseIdleTimer","useDefaultCuiKitLifecycle","kit","inactivity","screens","onBeforeAreYouThereTimer","areYouThereRejectionPolicy","showAmbientScreen","setShowAmbientScreen","showAttractScreen","setShowAttractScreen","hasPoured","setHasPoured","idleTimeout","areYouThereTimeout","idlePourTimeout","areYouTherePourTimeout","ambientTimeout","attractTimeout","handleIdleTimeout","setShowAreYouThere","handleResetIdleTimer","handleAttractResume","ambientPause","ambientRestart","showAreYouThere","pause","restart","pausePourTimer","restartPourTimer","pourIdleTimer","shouldShowAreYouThere","error","clearAreYouThere","_d","handlePourCancel","handleBrandSelected","handleBrandCleared","handleBeverageSelected","handleBeverageCleared","handleInit","areYouThereCountdown","useDeviceAssembly","DeviceAssembly","withDeviceAssembly","useHolder","Holder","withHolder","useHolderContainer","HolderContainer","withHolderContainer","useIngredient","Ingredient","HoldToPourIntentStrategy","intent","useIngredientPour","intentContainer","withIngredient","useIngredientContainer","IngredientContainer","withIngredientContainer","withNozzle","usePourTarget","onPourAbort","pourTarget","TapOrHoldIntentStrategy","TapToPourIntentStrategy","_nozzle","TapToPourStrategy","useGenericPour","servicePathFactory","itemId","GenericPour","withGenericPour","AssemblyProvider","useAssemblyContext","AvailabilityProvider","useAvailabilityContext","BoardProvider","useBoardContext","BoardContainerProvider","useBoardContainerContext","DeviceAssemblyContext","DeviceAssemblyProvider","nozzlePaths","content","useDeviceAssemblyContext","createDispenseKitContext","CuiKitContext","React","ctx","CuiKitWrapper","CuiKitProvider","nozzleProps","result","DispenseView","provider","totalNozzles","index","CuiKit","initializeCuiKit","useCuiKitContext","DispenseKitProvider","HolderProvider","useHolderContext","HolderContainerProvider","useHolderContainerContext","IngredientProvider","useIngredientContext","IngredientContainerProvider","useIngredientContainerContext","usePump","Pump","PumpProvider","usePumpContext"],"mappings":";;;;;;;;AAGO,MAAMA,KAAc,MAAM;AAC/B,QAAMC,IAAUC,GAAS;AAOzB,SANeC,EAA2B;AAAA,IACxC,SAAAF;AAAA,IACA,WAAWC,GAAS;AAAA,IACpB,SAAS,CAAA;AAAA,EAAC,CACX;AAGH;ACLO,SAASE,GACdC,GACA;AACA,SAAO,CAACC,MAAwC;AAC9C,UAAM,EAAE,OAAAC,GAAO,QAAAC,GAAQ,gBAAAC,EAAA,IAAmBT,GAAA;AAE1C,WACE,gBAAAU,EAACD,GAAA,EAAgB,GAAGD,GAClB,UAAA,gBAAAE,EAACL,KAAkB,GAAIC,GAAa,UAAUC,EAAA,CAAO,EAAA,CACvD;AAAA,EAEJ;AACF;AChBO,MAAMI,KAAkB,MAAM;AACnC,QAAMV,IAAUW,GAAa;AAO7B,SANeT,EAA+B;AAAA,IAC5C,SAAAF;AAAA,IACA,WAAWW,GAAa;AAAA,IACxB,SAAS,CAAA;AAAA,EAAC,CACX;AAGH;ACLO,SAASC,GACdR,GACA;AACA,SAAO,CAACC,MAA4C;AAClD,UAAM,EAAE,OAAAC,GAAO,QAAAC,GAAQ,gBAAAC,EAAA,IAAmBE,GAAA;AAE1C,WACE,gBAAAD,EAACD,GAAA,EAAgB,GAAGD,GAClB,UAAA,gBAAAE,EAACL,KAAkB,GAAIC,GAAa,UAAUC,EAAA,CAAO,EAAA,CACvD;AAAA,EAEJ;AACF;AChBO,MAAMO,KAAW,CAACC,MAERZ,EAAwB;AAAA,EACrC,SAFcY;AAAA,EAG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