@kosdev-code/kos-dispense-sdk 2.0.33 → 2.0.35
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.
- package/dispense-registration-manager-BZeOXyYn.cjs +2 -0
- package/dispense-registration-manager-BZeOXyYn.cjs.map +1 -0
- package/{dispense-registration-manager-CKFF29mO.js → dispense-registration-manager-eOOE05xT.js} +333 -328
- package/dispense-registration-manager-eOOE05xT.js.map +1 -0
- package/{extension-utils-Bb22_AzV.js → extension-utils-B9gziKDQ.js} +69 -62
- package/extension-utils-B9gziKDQ.js.map +1 -0
- package/{extension-utils-CScCluY5.cjs → extension-utils-DcOOx69a.cjs} +2 -2
- package/extension-utils-DcOOx69a.cjs.map +1 -0
- package/index.cjs +1 -1
- package/index.js +87 -85
- package/models/constants/constants.d.ts +2 -1
- package/models/constants/constants.d.ts.map +1 -1
- package/models/models/assembly/assembly-model.d.ts +1 -0
- package/models/models/assembly/assembly-model.d.ts.map +1 -1
- package/models/models/assembly/index.d.ts +2 -1
- package/models/models/assembly/index.d.ts.map +1 -1
- package/models/utils/extension-utils.d.ts +3 -2
- package/models/utils/extension-utils.d.ts.map +1 -1
- package/models/utils/service.d.ts +5 -1
- package/models/utils/service.d.ts.map +1 -1
- package/models.cjs +1 -1
- package/models.js +28 -26
- package/package.json +3 -3
- package/pump-provider-BgSHNZEC.js +1239 -0
- package/pump-provider-BgSHNZEC.js.map +1 -0
- package/pump-provider-BkfgOMJx.cjs +2 -0
- package/pump-provider-BkfgOMJx.cjs.map +1 -0
- package/ui/hooks/cui-kit/use-default-cui-kit-lifecycle.d.ts +75 -1
- package/ui/hooks/cui-kit/use-default-cui-kit-lifecycle.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-dispense-lifecycle.d.ts +3 -1
- package/ui/hooks/cui-kit/use-dispense-lifecycle.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-dispense-timers.d.ts.map +1 -1
- package/ui.cjs +1 -1
- package/ui.js +2 -2
- package/dispense-registration-manager-CKFF29mO.js.map +0 -1
- package/dispense-registration-manager-CjKpNrUy.cjs +0 -2
- package/dispense-registration-manager-CjKpNrUy.cjs.map +0 -1
- package/extension-utils-Bb22_AzV.js.map +0 -1
- package/extension-utils-CScCluY5.cjs.map +0 -1
- package/pump-provider-CP6xxU4h.cjs +0 -2
- package/pump-provider-CP6xxU4h.cjs.map +0 -1
- package/pump-provider-jdIoS5JD.js +0 -1155
- package/pump-provider-jdIoS5JD.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extension-utils-CScCluY5.cjs","sources":["../../../../packages/sdk/kos-dispense-sdk/src/models/models/holder/utils/holder-utils.ts","../../../../packages/sdk/kos-dispense-sdk/src/models/utils/extension-utils.ts"],"sourcesContent":["import { kosAutoEffect } from \"@kosdev-code/kos-ui-sdk\";\nimport { useEffect, useState } from \"react\";\nimport type { HolderModel } from \"../types\";\n\nexport const getFuelGaugeValue = (holder: HolderModel) => {\n const [maxVolume, setMaxVolume] = useState<number>(\n holder?.slice?.maxVolMl ?? 0\n );\n const [remainingVolume, setRemainingVolume] = useState<number>(\n holder?.slice?.currentVolMl ?? 0\n );\n\n const [hasMaxVolume, setHasMaxVolume] = useState<boolean>(\n holder?.slice?.maxVolMl !== undefined\n );\n\n const [hasRemainingVolume, setHasRemainingVolume] = useState<boolean>(\n holder?.slice?.currentVolMl !== undefined\n );\n\n const [fillPercent, setFillPercent] = useState<number>(\n remainingVolume <= 0\n ? 0\n : Math.floor(((remainingVolume || 1) / (maxVolume || 1)) * 100)\n );\n\n const [hasFuelGuage, setHasFuelGuage] = useState<boolean>(\n hasMaxVolume && hasRemainingVolume\n );\n\n useEffect(() => {\n const disposer = kosAutoEffect(() => {\n setMaxVolume(holder?.slice?.maxVolMl ?? 0);\n setRemainingVolume(holder?.slice?.currentVolMl ?? 0);\n setHasMaxVolume(holder?.slice?.maxVolMl !== undefined);\n setHasRemainingVolume(holder?.slice?.currentVolMl !== undefined);\n setFillPercent(\n remainingVolume <= 0\n ? 0\n : Math.floor(((remainingVolume || 1) / (maxVolume || 1)) * 100)\n );\n setHasFuelGuage(hasMaxVolume && hasRemainingVolume);\n });\n\n return () => {\n disposer();\n };\n }, [holder]);\n\n return { maxVolume, remainingVolume, fillPercent, hasFuelGuage };\n};\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport {\n CoreExtensionManager,\n DataLoader,\n DataMapper,\n ExtensionManager,\n IndexExtension,\n PropertyMapper,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport { ExtensionType } from \"../constants\";\nimport { AssemblyTypes } from \"../models\";\nimport type { HolderResponse } from \"../models/holder/services\";\nimport type { HolderModel } from \"../models/holder/types\";\nimport type { IngredientResponse } from \"../models/ingredient/services\";\nimport type { BeverageResponse } from \"../models/nozzle/services\";\nimport type { SelectedPourable } from \"../models/nozzle/types\";\n\nexport type IngredientDataMapper<\n AdditionalData extends object = Record<string, any>\n> = DataMapper<IngredientResponse, AdditionalData, any>;\n\n/**\n * Mapping function that maps an ingredient response into the type property of\n * the {@link IngredientModel}.\n */\nexport type IngredientTypeMapper<\n T extends IngredientResponse = IngredientResponse\n> = PropertyMapper<T, string>;\n\n/**\n * Mapping function that maps additional data from holder service response\n * into the {@link HolderModel} data.\n */\nexport type HolderTypeMapper<T extends HolderResponse = HolderResponse> =\n PropertyMapper<T, string>;\n\n/**\n * Mapping function that maps additional data from holder service response\n * into the {@link HolderModel} data.\n */\nexport type HolderDataMapper<\n AdditionalData extends object = Record<string, any>,\n HolderData extends HolderResponse = HolderResponse\n> = DataMapper<HolderData, AdditionalData, any>;\n\nexport type GroupBeverageResponse = BeverageResponse & { groupId: string };\nexport type AvailabilityDataMapper<\n AdditionalData extends object = Record<string, any>,\n AvailabilityData extends GroupBeverageResponse = GroupBeverageResponse\n> = DataMapper<AvailabilityData, AdditionalData, any>;\n\nexport type SelectedPourableMapper = DataMapper<SelectedPourable, any>;\n\nexport type BoardDataMapper<\n AdditionalData extends object = Record<string, any>,\n BoardData extends AssemblyTypes.AssemblyBoard<any> = AssemblyTypes.AssemblyBoard<any>\n> = DataMapper<BoardData, AdditionalData, any>;\n\nexport type AssemblyMapper<\n AdditionalData extends object = Record<string, any>,\n AssemblyResponseData extends AssemblyTypes.AssemblyResponse<any> = AssemblyTypes.AssemblyResponse<any>\n> = DataMapper<AssemblyResponseData, AdditionalData, any>;\n/**\n * The DispenseExtensionManager is responsible for managing the extension points that are specific to the Dispense application.\n */\nexport class DispenseExtensionManager {\n core: CoreExtensionManager = new CoreExtensionManager();\n /**\n * Maps data into the {@link IngredientModel}\n *\n * It is common for the ingredient data provided by the ingredient service to be augmented with additional properties that are\n * not provided by the base KOS Ingredient model. The {@link IngredientMapper} extension point allows for the data to be mapped\n * into the {@link IngredientModel} and the {@link IngredientModel.data} property to be augmented with additional properties.\n *\n * @example\n * The following example shows how to map the data from the service response into the {@link IngredientModel}.\n * The context is provided by the {@link IngredientLoader} extension point with its data being used to optionally augment the\n * ingredient data.\n *\n * The result of the mapping will be available in the `data` property of the {@link IngredientModel}.\n *\n * In this case the `IngedientReponseData` interface represents the data being returned by the ingredient service and the\n * `IngredientData` interface represents the data that will be available in the {@link IngredientModel.data} property. The `ingredientDataMapper`\n * is responsible for mapping from one format to the other.\n *\n * ```typescript\n *\n * interface IngredientResponseData extends NozzleServices.IngredientResponse {\n * chilled: boolean;\n * carbonated: boolean;\n * highYield: boolean;\n * }\n *\n * interface IngredientData {\n * chilled: boolean;\n * carbonated: boolean;\n * highYield: boolean;\n * }\n *\n * export const ingredientDataMapper = async (\n * data: IngredientResponseData,\n * context: IngredientContext\n * ): Promise<IngredientData> => {\n * return {\n * chilled: data.chilled,\n * carbonated: data.carbonated,\n * highYield: data.highYield,\n * }\n * }\n * ```\n * */\n registerIngredientDataMapper(ingredientDataMapper: IngredientDataMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.IngredientMapper,\n ingredientDataMapper\n );\n\n return this;\n }\n\n /**\n * Loads data that will be provided as context into the {@link IngredientMapper}\n *\n * @example\n * The following example shows how to load the brandset data, normalize it into a map and then provide it back to the framework\n * where it can be used by the other extension points.\n *\n * In the ingredient container model, the data is provided to the {@link IngredientMapper} extension point in order to augment ingredient data\n * and also loaded into the ingredient container model context in order to make the data available throughout the code.\n *\n * ```typescript\n * export const ingredientContextLoader = async (): Promise<BeverageContext> => {\n * const response = await kosFetch('kos:/system/some/ingredient/endpoint.json');\n *\n * if (response.status !== 200) {\n * KosLog.error('Failed to load ingredient data');\n * return {};\n * }\n * const json = await response.json();\n * return json;\n * };\n * ```\n * */\n registerIngredientLoader(ingredientLoader: DataLoader) {\n ExtensionManager.loader.registerLoader(\n ExtensionType.IngredientLoader,\n ingredientLoader\n );\n return this;\n }\n\n registerIngredientIndex(ingredientIndex: IndexExtension) {\n ExtensionManager.indexExtension.registerIndexExtension(\n ExtensionType.IngredientIndex,\n ingredientIndex\n );\n return this;\n }\n\n /**\n * Registers a data mapper for the {@link IngredientModel}\n * */\n registerIngredientTypeMapper(ingredientTypeMapper: IngredientTypeMapper) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.IngredientTypeMapper,\n ingredientTypeMapper\n );\n return this;\n }\n\n /**\n * Registers a data mapper for the {@link HolderModel} model.\n * @param holderDataMapper - Mapping function that maps additional data from holder service response\n * @returns\n */\n registerHolderDataMapper(holderDataMapper: HolderDataMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.HolderMapper,\n holderDataMapper\n );\n return this;\n }\n\n registerHolderTypeMapper(holderTypeMapper: HolderTypeMapper) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.HolderTypeMapper,\n holderTypeMapper\n );\n return this;\n }\n\n /**\n * Maps the ingredientId property of the holder into the {@link HolderModel}.\n * If not provided, the ingredientId will assume that the value is mapped from the\n * ingredientId property of the service response.\n * */\n registerHolderIngredientMapper(holderTypeMapper: HolderTypeMapper) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.HolderTypeMapper,\n holderTypeMapper\n );\n return this;\n }\n\n registerHolderIndex<T extends HolderModel = HolderModel>(\n holderIndex: IndexExtension<T>\n ) {\n ExtensionManager.indexExtension.registerIndexExtension(\n ExtensionType.HolderIndex,\n holderIndex\n );\n return this;\n }\n\n /**\n * Maps data into the {@link AvailabilityModel}\n *\n * @example\n * The following example shows how to map the data from the service response into the {@link AvailabilityModel}.\n * The context is provided by the {@link AvailabilityLoader} extension point with its data being used to augment the\n * availability data.\n *\n * The result of the mapping will be available in the `data` property of the {@link AvailabilityModel}.\n *\n * ```typescript\n * export const beverageDataMapper = async (\n * data: NozzleServices.BeverageResponse,\n * context: BeverageContext\n * ): Promise<BeverageData> => {\n * const id = data.altId;\n * const iconUrl = encodeURI(\n * `http://localhost:8081/system/brandset/${context?.[id]?.icon}`\n * );\n * const cuiColorCode = context?.[id]?.cuiColorCode\n * ? context?.[id]?.cuiColorCode\n * : '';\n * return { iconUrl, cuiColorCode };\n * };\n * ```\n * */\n registerAvailabilityDataMapper(availabilityMapper: AvailabilityDataMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.AvailabilityMapper,\n availabilityMapper\n );\n return this;\n }\n\n /**\n * Loads data that will be provided as context into the {@link AvailabilityMapper}\n *\n * @example\n * A common use case is to load brandset data that is UI specific and not provided directly by the Java service.\n *\n * The following example shows how to load the brandset data, normalize it into a map and then provide it back to the framework\n * where it can be used by the other extension points.\n *\n * In the nozzle model, the data is provided to the {@link AvailabilityMapper} extension point in order to augment availability data\n * and also loaded into the nozzle model context in order to make the data available throughout the code.\n *\n * ```typescript\n * export const beverageContextLoader = async (): Promise<BeverageContext> => {\n * const response = await kosFetch('kos:/system/brandset/brandset.json');\n *\n * if (response.status !== 200) {\n * KosLog.error('Failed to load beverage data');\n * return {};\n * }\n * const json: BrandsetResponse | null = await response.json();\n * const initialBeverages: Record<string, BrandsetIngredient> = {};\n * const beverages = json?.ingredients?.reduce((acc, beverage) => {\n * acc[beverage.ingredientId] = beverage;\n * return acc;\n * }, initialBeverages);\n * return beverages;\n * };\n * ```\n * */\n registerAvailabilityLoader(availabilityLoader: DataLoader) {\n ExtensionManager.loader.registerLoader(\n ExtensionType.AvailabilityLoader,\n availabilityLoader\n );\n return this;\n }\n\n /**\n * Maps the abstract {@link SelectedPourable} data into a format that is specific to the nozzle.\n * */\n registerSelectedPourableDataMapper(\n selectedPourableMapper: SelectedPourableMapper\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.SelectedPourableMapper,\n selectedPourableMapper\n );\n return this;\n }\n\n /**\n * Maps data into the {@link AssemblyModel} data.\n * Used in cases where the base assembly has been extended with additional properties in the backend. This extension\n * point allows for the data to be mapped into the {@link AssemblyModel} and augmented with additional properties.\n *\n * @example\n *\n * In this example of an implementation of a {@link AssemblyMapper}, the {@link AssemblyResponse} data is mapped into\n * a {@link FreestyleAssembly} object.\n *\n * The {@link FreestyleAssemblyResponse} interface represents the additional data being returned by the assembly service and is\n * merged into the {@link AssemblyResponse} interface.\n *\n * The {@link FreestyleAssembly} interface represents the additional data, beyond the base data set, that will be merged into the {@link AssemblyModel}.\n *\n * The mapper is responsible for mapping from the {@link FreestyleAssemblyResponse} format to the {@link FreestyleAssembly} format.\n * ```typescript\n * import { AssemblyTypes } from \"@kosdev-code/kos-dispense-sdk\";\n * import { DataMapper } from \"@kosdev-code/kos-ui-sdk\";\n *\n * // define the additional data being returned by the assembly service\n * export interface FreestyleAssemblyResponse {\n * iceAgitator?: {\n * name: \"iceAgitator\";\n * path: string;\n * };\n * }\n *\n * // define the additional data structure that will be merged into the assembly model\n * export interface FreestyleAssembly {\n * iceAgitator: {\n * path: string;\n * };\n * carbAgitator: {\n * path: string;\n * };\n * }\n *\n *\n * // define the mapper that will map the data from the service response into the additional data structure\n * // that will be merged into the assembly model.\n * // In this case the mapper is responsible for mapping from the {@link FreestyleAssemblyResponse} format to the {@link FreestyleAssembly} format.\n * export const assemblyDataMapper: DataMapper<\n * AssemblyTypes.AssemblyResponse<FreestyleAssemblyResponse>,\n * FreestyleAssembly\n * > = async (data) => {\n * const response = data.assemblies.reduce((acc, assembly) => {\n * const agitatorKeys = [\"iceAgitator\", \"carbAgitator\"];\n * agitatorKeys.forEach((key) => {\n * const agitator = assembly[key];\n * if (agitator) {\n * acc[key] = agitator;\n * }\n * });\n *\n * return acc;\n * }, {} as FreestyleAssembly);\n * return response;\n * };\n *```\n */\n registerAssemblyDataMapper(assemblyDataMapper: AssemblyMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.AssemblyMapper,\n assemblyDataMapper\n );\n return this;\n }\n\n registerBoardIndex(boardIndex: IndexExtension) {\n ExtensionManager.indexExtension.registerIndexExtension(\n ExtensionType.BoardIndex,\n boardIndex\n );\n return this;\n }\n\n registerBoardDataMapper(boardDataMapper: BoardDataMapper<any, any>) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.BoardMapper,\n boardDataMapper\n );\n return this;\n }\n}\n\n/**\n * The KosExtensionManager provides access to the extension points that are provided in the SDK for Dispense applications.\n *\n * The extension points are divided into two categories:\n *\n * @param core - The core extension {@link CoreExtensionManager} points are used to extend the base models that are provided by the SDK.\n * @param dispense - The dispense extension {@link DispenseExtensionManager} points are used to extend the models that are specific to the Dispense SDK.\n */\nexport class KosExtensionManager {\n dispense: DispenseExtensionManager;\n core: CoreExtensionManager;\n constructor() {\n this.dispense = new DispenseExtensionManager();\n this.core = new CoreExtensionManager();\n }\n}\n"],"names":["getFuelGaugeValue","holder","maxVolume","setMaxVolume","useState","_a","remainingVolume","setRemainingVolume","_b","hasMaxVolume","setHasMaxVolume","_c","hasRemainingVolume","setHasRemainingVolume","_d","fillPercent","setFillPercent","hasFuelGuage","setHasFuelGuage","useEffect","disposer","kosAutoEffect","DispenseExtensionManager","__publicField","CoreExtensionManager","ingredientDataMapper","ExtensionManager","ExtensionType","ingredientLoader","ingredientIndex","ingredientTypeMapper","holderDataMapper","holderTypeMapper","holderIndex","availabilityMapper","availabilityLoader","selectedPourableMapper","assemblyDataMapper","boardIndex","boardDataMapper","KosExtensionManager"],"mappings":"sgDAIaA,EAAqBC,GAAwB,aAClD,KAAA,CAACC,EAAWC,CAAY,EAAIC,EAAA,WAChCC,EAAAJ,GAAA,YAAAA,EAAQ,QAAR,YAAAI,EAAe,WAAY,CAAA,EAEvB,CAACC,EAAiBC,CAAkB,EAAIH,EAAA,WAC5CI,EAAAP,GAAA,YAAAA,EAAQ,QAAR,YAAAO,EAAe,eAAgB,CAAA,EAG3B,CAACC,EAAcC,CAAe,EAAIN,EAAA,WACtCO,EAAAV,GAAA,YAAAA,EAAQ,QAAR,YAAAU,EAAe,YAAa,MAAA,EAGxB,CAACC,EAAoBC,CAAqB,EAAIT,EAAA,WAClDU,EAAAb,GAAA,YAAAA,EAAQ,QAAR,YAAAa,EAAe,gBAAiB,MAAA,EAG5B,CAACC,EAAaC,CAAc,EAAIZ,EAAA,SACpCE,GAAmB,EACf,EACA,KAAK,OAAQA,GAAmB,IAAMJ,GAAa,GAAM,GAAG,CAAA,EAG5D,CAACe,EAAcC,CAAe,EAAId,EAAA,SACtCK,GAAgBG,CAAA,EAGlBO,OAAAA,EAAAA,UAAU,IAAM,CACR,MAAAC,EAAWC,EAAAA,cAAc,IAAM,aACtBlB,IAAAE,EAAAJ,GAAA,YAAAA,EAAQ,QAAR,YAAAI,EAAe,WAAY,CAAC,EACtBE,IAAAC,EAAAP,GAAA,YAAAA,EAAQ,QAAR,YAAAO,EAAe,eAAgB,CAAC,EACnCE,IAAAC,EAAAV,GAAA,YAAAA,EAAQ,QAAR,YAAAU,EAAe,YAAa,MAAS,EAC/BE,IAAAC,EAAAb,GAAA,YAAAA,EAAQ,QAAR,YAAAa,EAAe,gBAAiB,MAAS,EAC/DE,EACEV,GAAmB,EACf,EACA,KAAK,OAAQA,GAAmB,IAAMJ,GAAa,GAAM,GAAG,CAAA,EAElEgB,EAAgBT,GAAgBG,CAAkB,CAAA,CAC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EAEK,IACT,CAKA,mCACEC,EACA,CACAV,OAAAA,EAAA,iBAAiB,WAAW,mBAC1BC,EAAAA,cAAc,uBACdS,CAAA,EAEK,IACT,CA+DA,2BAA2BC,EAAoC,CAC7DX,OAAAA,EAAA,iBAAiB,WAAW,mBAC1BC,EAAAA,cAAc,eACdU,CAAA,EAEK,IACT,CAEA,mBAAmBC,EAA4B,CAC7CZ,OAAAA,EAAA,iBAAiB,eAAe,uBAC9BC,EAAAA,cAAc,WACdW,CAAA,EAEK,IACT,CAEA,wBAAwBC,EAA4C,CAClEb,OAAAA,EAAA,iBAAiB,WAAW,mBAC1BC,EAAAA,cAAc,YACdY,CAAA,EAEK,IACT,CACF,CAUO,MAAMC,CAAoB,CAG/B,aAAc,CAFdjB,EAAA,iBACAA,EAAA,aAEO,KAAA,SAAW,IAAID,EACf,KAAA,KAAO,IAAIE,EAAAA,oBAClB,CACF"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var We=Object.defineProperty;var Je=(e,t,r)=>t in e?We(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var y=(e,t,r)=>(Je(e,typeof t!="symbol"?t+"":t,r),r);const b=require("@emotion/react/jsx-runtime"),u=require("@kosdev-code/kos-ui-sdk"),o=require("react"),g=require("./dispense-registration-manager-CjKpNrUy.cjs"),ae=()=>{const e=g.Assembly.type;return u.useKosModel({modelId:e,modelType:g.Assembly.type,options:{}})};function Qe(e){return t=>{const{model:r,status:n,KosModelLoader:s}=ae();return b.jsx(s,{...n,children:b.jsx(e,{...t,assembly:r})})}}const ue=()=>{const e=g.Availability.type;return u.useKosModel({modelId:e,modelType:g.Availability.type,options:{}})};function Xe(e){return t=>{const{model:r,status:n,KosModelLoader:s}=ue();return b.jsx(s,{...n,children:b.jsx(e,{...t,beverage:r})})}}const ce=e=>{const t=e;return u.useKosModel({modelId:t,modelType:g.Board.type,options:{}})};function Ze(e){return t=>r=>{const{model:n,status:s,KosModelLoader:i}=ce(t);return b.jsx(i,{...s,children:b.jsx(e,{...r,board:n})})}}const de=()=>{const e=g.BoardContainer.type;return u.useKosModel({modelId:e,modelType:g.BoardContainer.type,options:{}})};function ze(e){return t=>{const{model:r,status:n,KosModelLoader:s}=de();return b.jsx(s,{...n,children:b.jsx(e,{...t,boardContainer:r})})}}const le=e=>{const t=e;return u.useKosModel({modelId:t,modelType:g.Nozzle.type,options:{path:e}})},ke=o.createContext(void 0),Te=({children:e,path:t})=>{const{model:r,ready:n}=le(t),s=o.useMemo(()=>n&&r?{model:r}:{},[n,r]);return b.jsx(ke.Provider,{value:s,children:e})},A=()=>{const e=o.useContext(ke);if(!e)throw new Error("useNozzleContext must be used within a NozzleProvider");return e},Ie=({onBeverageSelected:e,onClearBeverage:t,companionType:r})=>{const{model:n}=A(),[s,i]=o.useState([]),[c,l]=o.useState(null),h=o.useMemo(()=>r?s.map(d=>u.getKosCompanionModel(d,r)):[],[s,r]),f=o.useCallback(async d=>{l(d),await(n==null?void 0:n.setSelectedPourable({beverage:d})),e==null||e(d)},[n,e]),m=o.useCallback(async()=>{l(null),await(n==null?void 0:n.setSelectedPourable({beverage:void 0})),t==null||t()},[n,t]);return o.useEffect(()=>{const d=u.kosAutoEffect(()=>{if(!n)return;const C=n.selectedBrand;if(!C){const a=n.getGroupAvailabilityItems("beverages").filter(x=>x.visible);i(a??[]);return}const v=n.getAvailabilityByParent(C.id).filter(a=>a.visible);i(v??[])});return()=>{d()}},[n]),{beverages:s,beverageCompanions:h,selectBeverage:f,selectedBeverage:c,clearBeverage:m}},Ae=({onBrandSelected:e,onBrandCleared:t,companionType:r})=>{const{model:n}=A(),[s,i]=o.useState(null),[c,l]=o.useState([]),h=o.useMemo(()=>r?c.map(d=>u.getKosCompanionModel(d,r)):[],[c,r]),f=o.useCallback(async d=>{i(d),n==null||n.setSelectedBrand(d),e==null||e(d)},[n,e]),m=o.useCallback(()=>{i(null),n==null||n.setSelectedBrand(void 0),t==null||t()},[n,t]);return o.useEffect(()=>{const d=u.kosAutoEffect(()=>{n&&l(n.visibleBrands)});return()=>{d()}},[n]),{brands:c,brandCompanions:h,selectedBrand:s,selectBrand:f,clearBrand:m}},et=u.KosLog.createLogger({name:"HoldToPourStrategy",group:"kos-hooks"}),be={name:"HoldToPourStrategy",async initiate(e){if(!(e!=null&&e.canPour)){et.debug(`Nozzle ${e==null?void 0:e.id} cannot pour. Returning early.`);return}await(e==null?void 0:e.pour())},async initiateEnded(e){await(e==null?void 0:e.cancelPour())}},F=u.KosLog.createLogger({name:"useNozzlePour",group:"kos-hooks"}),$e=({onPour:e,onPourCancel:t,onBeforePour:r,onBeforePourRejected:n,strategy:s=be})=>{const{model:i}=A(),c=o.useCallback(async()=>{(r?await(r==null?void 0:r()):!0)?(F.debug(`[${s==null?void 0:s.name}] - Pour initiated for nozzle ${i==null?void 0:i.id}.`),s==null||s.initiate(i),e==null||e()):(F.debug(`[${s==null?void 0:s.name}] - Did not pass onBeforePour gate for nozzle ${i==null?void 0:i.id}. Cancelling pour.`),n==null||n())},[e,i,s,r,t]),l=o.useCallback(()=>{var m;F.debug(`[${s==null?void 0:s.name}] - Pour initiate ended called for nozzle ${i==null?void 0:i.id}.`),(m=s==null?void 0:s.initiateEnded)==null||m.call(s,i),t==null||t()},[t,i,s]),h=o.useCallback(()=>{F.debug(`Force cancelling pour for nozzle ${i==null?void 0:i.id}.`),i==null||i.cancelPour(),t==null||t()},[t,i]);return{handlers:u.usePressGesture({onPressed:c,onRelease:l}).dom,cancel:h,status:i}},Ee=({onFlavorSelected:e,onFlavorCleared:t,companionType:r})=>{const{model:n}=A(),s=o.useMemo(()=>(n==null?void 0:n.getGroupAvailabilityItems("flavors").filter(m=>m.visible))??[],[n]),i=o.useMemo(()=>r?s.map(m=>u.getKosCompanionModel(m,r)):[],[s,r]),[c,l]=o.useState([]),h=o.useCallback(async m=>{if(l(d=>d!=null&&d.includes(m)?[...d.filter(C=>C!==m)]:[...d??[],m]),n!=null&&n.selectedPourable){const{beverage:d}=n.selectedPourable;await n.setSelectedPourable({beverage:d,additional:c??[]})}e==null||e(m,c??[])},[n,e,c]),f=o.useCallback(async()=>{if(l([]),n!=null&&n.selectedPourable){const{beverage:m}=n.selectedPourable;n.setSelectedPourable({beverage:m}),t==null||t()}},[n,t]);return{flavors:s,flavorCompanions:i,selectFlavor:h,selectedFlavors:c,clearFlavors:f}},j="brands",O="beverages",H="flavors",B=u.KosLog.createLogger({name:"use-cui-kit"}),Ke=({initialGroup:e=j,options:t={}})=>{var G,_,U;const[r,n]=o.useState(e),{model:s}=A(),i=o.useRef([]),c=o.useCallback(p=>{n(H);const I=`/kos/dispense/${s==null?void 0:s.path}/brand/selected/`;u.EventBus.publish(I,p)},[s==null?void 0:s.path]),l=o.useCallback(()=>{const p=`/kos/dispense/${s==null?void 0:s.path}/brand/cleared/`;u.EventBus.publish(p,{})},[s==null?void 0:s.path]),h=o.useCallback(p=>{n(H);const I=`/kos/dispense/${s==null?void 0:s.path}/beverage/selected/`;u.EventBus.publish(I,p)},[s==null?void 0:s.path]),f=o.useCallback(()=>{const p=`/kos/dispense/${s==null?void 0:s.path}/beverage/cleared/`;u.EventBus.publish(p,{})},[s==null?void 0:s.path]),m=o.useCallback(p=>{const I=`/kos/dispense/${s==null?void 0:s.path}/flavor/selected/`;u.EventBus.publish(I,p)},[s==null?void 0:s.path]),d=o.useCallback(()=>{const p=`/kos/dispense/${s==null?void 0:s.path}/flavor/cleared/`;u.EventBus.publish(p,{})},[s==null?void 0:s.path]),C=o.useCallback(()=>{const p=`/kos/dispense/${s==null?void 0:s.path}/pour/`;u.EventBus.publish(p,{})},[s==null?void 0:s.path]),v=o.useCallback(async()=>{const p=`/kos/dispense/${s==null?void 0:s.path}/pre/pour/`;return u.EventBus.publish(p,{}),await(P==null?void 0:P())||!0},[s==null?void 0:s.path]),a=o.useCallback(async()=>{const p=`/kos/dispense/${s==null?void 0:s.path}/pre/pour/rejected/`;u.EventBus.publish(p,{})},[s==null?void 0:s.path]),x=o.useCallback(()=>{const p=`/kos/dispense/${s==null?void 0:s.path}/pour/cancel/`;u.EventBus.publish(p,{})},[s==null?void 0:s.path]),{brands:L,selectBrand:T,selectedBrand:$,clearBrand:E,brandCompanions:Y}=Ae({companionType:(G=t.companionTypes)==null?void 0:G.brand,onBrandSelected:c,onBrandCleared:l}),{beverages:q,selectBeverage:W,selectedBeverage:J,clearBeverage:w,beverageCompanions:S}=Ie({companionType:(_=t.companionTypes)==null?void 0:_.beverage,onBeverageSelected:h,onClearBeverage:f}),{clearFlavors:Q,flavors:N,selectFlavor:k,selectedFlavors:K,flavorCompanions:X}=Ee({companionType:(U=t.companionTypes)==null?void 0:U.flavor,onFlavorSelected:m,onFlavorCleared:d}),[P,M]=o.useState(),Z=o.useCallback(p=>{M(()=>p)},[]),z=$e({onPour:C,onPourCancel:x,onBeforePour:v,onBeforePourRejected:a}),ee=o.useCallback(()=>{switch(B.debug(`Navigating back from group: ${r}`),r){case j:w(),E();break;case O:case H:n(e),w(),E();break}},[w,E,r,e]),te=o.useCallback(()=>{const p=`/kos/dispense/${s==null?void 0:s.path}/home/`;u.EventBus.publish(p,{}),n(e),e===j&&(w(),E()),e===O&&w()},[w,E,e]),se=o.useCallback(()=>{if(i.current.length===0){B.debug("No timers to pause.");return}B.debug(`Pausing ${i.current.length} timers.`),i.current.forEach(p=>{B.debug(`Pausing timer with id ${p.id}.`),p.pause()})},[]),re=o.useCallback(()=>{if(i.current.length===0){B.debug("No timers to restart.");return}B.debug(`Restarting ${i.current.length} timers.`),i.current.forEach(p=>{B.debug(`Restarting timer with id ${p.id}.`),p.restart()})},[]);return{timers:{add:o.useCallback(p=>{if(p){if(i.current.some(I=>I.id===p.id)){B.debug(`Timer with id ${p.id} already exists.`);return}i.current.push(p)}},[]),pause:se,restart:re},nav:{currentGroup:r,back:ee,home:te},pour:z,updateOnBeforePour:Z,selections:{[j]:$,[O]:J,[H]:K},[j]:{models:L,companions:Y,clear:E,handlers:{onSelected:T}},[O]:{models:q,companions:S,clear:w,handlers:{onSelected:W}},[H]:{models:N,companions:X,clear:Q,handlers:{onSelected:k}}}},tt=e=>{const{model:t}=A(),[r,n]=o.useState(null),{onAmbientTimer:s,onAttractTimer:i,onResetAttractTimer:c,onResumeAttractTimer:l,defaultAttractTime:h,defaultAmbientTime:f}=e,m=o.useCallback(()=>{s&&(u.KosLog.info("Ambient timer expired. Calling callback"),s==null||s())},[s]),d=o.useCallback(()=>{i&&(u.KosLog.info("Attract timer expired. Calling callback"),i==null||i())},[i]),C=o.useCallback(()=>{r&&(r.restart(),c==null||c())},[r,c]),v=o.useCallback(()=>{r&&(r.reset(),c==null||c())},[r,c]),a=o.useCallback(()=>{r&&(r.pause(),l==null||l())},[r,l]);return o.useEffect(()=>{if(t&&h){u.KosLog.info("Nozzle is available. Creating timers");const x=u.TimerManager.createTimer("attract-timer-"+t.path,h);return h&&(x==null||x.addTimeoutAction({name:"attract-timer",remainingTime:0,action:d})),f&&(x==null||x.addTimeoutAction({name:"ambient-timer",remainingTime:f,action:m})),h&&(x==null||x.start()),n(x??null),()=>{x==null||x.reset(),n(null)}}return()=>{u.KosLog.info("Nozzle is not available. No timers to clear")}},[f,h,m,d,t]),{attractTimer:r,restart:C,pause:v,resume:a}},st=(e,t)=>{if(t)return u.EventBus.subscribe(e,t).unsubscribe},Se=({onInit:e,onBrandSelected:t,onBrandCleared:r,onBeverageCleared:n,onBeverageSelected:s,onFlavorCleared:i,onFlavorSelected:c,onReturnToHome:l,onPour:h,onPourCancel:f,onBeforePourRejected:m,onAmbientTimer:d,onAttractTimer:C,onResumeAttractTimer:v})=>{const{model:a}=A();o.useEffect(()=>{const L=[{topic:`/kos/dispense/${a==null?void 0:a.path}/brand/selected/`,callback:t},{topic:`/kos/dispense/${a==null?void 0:a.path}/brand/cleared/`,callback:r},{topic:`/kos/dispense/${a==null?void 0:a.path}/beverage/selected/`,callback:s},{topic:`/kos/dispense/${a==null?void 0:a.path}/beverage/cleared/`,callback:n},{topic:`/kos/dispense/${a==null?void 0:a.path}/flavor/selected/`,callback:c},{topic:`/kos/dispense/${a==null?void 0:a.path}/flavor/cleared/`,callback:i},{topic:`/kos/dispense/${a==null?void 0:a.path}/pour/`,callback:h},{topic:`/kos/dispense/${a==null?void 0:a.path}/pour/cancel/`,callback:f},{topic:`/kos/dispense/${a==null?void 0:a.path}/pre/pour/rejected/`,callback:m},{topic:`/kos/dispense/${a==null?void 0:a.path}/ambient/start/`,callback:d},{topic:`/kos/dispense/${a==null?void 0:a.path}/attract/start/`,callback:C},{topic:`/kos/dispense/${a==null?void 0:a.path}/attract/resume/`,callback:v},{topic:`/kos/dispense/${a==null?void 0:a.path}/init/`,callback:e},{topic:`/kos/dispense/${a==null?void 0:a.path}/home/`,callback:l}].map(({topic:T,callback:$})=>st(T,$));return()=>{L.forEach(T=>T==null?void 0:T())}},[a==null?void 0:a.path,d,C,n,s,r,t,i,c,h,f,v,e,l])},ie=e=>{const{model:t}=A(),[r,n]=o.useState(null),{onAreYouThereTimer:s,onIdleTimer:i,onResetIdleTimer:c,defaultAreYouThereTime:l=10,defaultIdleTime:h=20}=e,f=o.useCallback(()=>{s&&(u.KosLog.info("Are you there timer expired. Calling callback"),s==null||s())},[s]),m=o.useCallback(()=>{i&&(u.KosLog.info("Idle timer expired. Calling callback"),i==null||i())},[i]),d=o.useCallback(()=>{r&&(r.restart(),c==null||c())},[r,c]),C=o.useCallback(()=>{r&&(r.reset(),c==null||c())},[r,c]);return o.useEffect(()=>{if(t){u.KosLog.info("Nozzle is available. Creating timers");const v=u.TimerManager.createTimer(`${e.prefix??""}idle-timer-${t.path}`,h);return v==null||v.addTimeoutAction({name:"idle-timer",remainingTime:0,action:m}),v==null||v.addTimeoutAction({name:"are-you-there-timer",remainingTime:l,action:f}),n(v??null),()=>{v==null||v.reset(),n(null)}}return()=>{u.KosLog.info("Nozzle is not available. No timers to clear")}},[l,h,f,m,t,e.prefix]),{idleTimer:r,restart:d,pause:C}},rt=({kit:e,inactivity:t,pour:r,screens:n})=>{var I,xe,ge,Pe;const[s,i]=o.useState(!1),[c,l]=o.useState(!1),[h,f]=o.useState(!1),{model:m}=A(),[d,C]=o.useState(!1),v=(t==null?void 0:t.idleTimeout)??15,a=(t==null?void 0:t.areYouThereTimeoutOffset)??10,x=(r==null?void 0:r.idleTimeout)??(t==null?void 0:t.idleTimeout)??10,L=(r==null?void 0:r.areYouThereTimeoutOffset)??(t==null?void 0:t.areYouThereTimeoutOffset)??5,T=n==null?void 0:n.ambientTimeoutOffset,$=n==null?void 0:n.attractTimeout,E=o.useCallback(()=>{i(!0)},[]),Y=o.useCallback(()=>{i(!1),e==null||e.nav.home()},[(I=e==null?void 0:e.nav)==null?void 0:I.home]),q=o.useCallback(()=>{T&&(l(!0),f(!1))},[T]),W=o.useCallback(()=>{$&&(f(!0),l(!1))},[$]),J=o.useCallback(()=>{$&&(f(!1),l(!1),e==null||e.nav.home())},[e==null?void 0:e.nav,$]),{pause:w,restart:S,resume:Q,attractTimer:N}=tt({defaultAmbientTime:T,defaultAttractTime:$,onAmbientTimer:q,onAttractTimer:W,onResumeAttractTimer:J});(xe=e==null?void 0:e.timers)==null||xe.add(N);const{pause:k,restart:K,idleTimer:X}=ie({defaultAreYouThereTime:a,defaultIdleTime:v,onAreYouThereTimer:E,onIdleTimer:Y});(ge=e==null?void 0:e.timers)==null||ge.add(X);const{pause:P,restart:M,idleTimer:Z}=ie({defaultAreYouThereTime:L,defaultIdleTime:x,onAreYouThereTimer:E,onIdleTimer:Y,prefix:"pour-"});(Pe=e==null?void 0:e.timers)==null||Pe.add(Z);const z=o.useCallback(()=>{C(!1),P(),k()},[k,P]),ee=o.useCallback(()=>{C(!0),console.log("restarting pour timer"),M(),k()},[k,M]),te=o.useCallback(()=>{C(!1),console.log("restarting pour timer on before pour rejected"),P(),K()},[]),se=o.useCallback(()=>{i(!1),d?(M(),k()):(K(),P())},[d,k,P,K,M]),re=o.useCallback(()=>{w(),f(!1),l(!1),K()},[w,K]),Ce=o.useCallback(()=>{f(!1),l(!1),C(!1),P(),S()},[S,P]),G=o.useCallback(()=>{f(!1),l(!1),C(!1),w(),K()},[w,K]),_=o.useCallback(()=>{f(!1),l(!1),C(!1),S(),k(),P()},[S,k,P]),U=o.useCallback(()=>{f(!1),l(!1),S(),k()},[S,k]);Se({onBrandSelected:re,onBrandCleared:Ce,onBeverageSelected:G,onBeverageCleared:_,onPour:z,onPourCancel:ee,onBeforePourRejected:te,onInit:U});const p=d?L:a;return o.useEffect(()=>{if(m&&N){const qe=`/kos/dispense/${m==null?void 0:m.path}/init/`;u.EventBus.publish(qe,{})}},[m,N]),{showAreYouThere:s,clearAreYouThere:se,areYouThereCountdown:p,showAmbientScreen:c,showAttractScreen:h,pauseScreenTimer:Q}},me=()=>{const e=g.DeviceAssembly.type;return u.useKosModel({modelId:e,modelType:g.DeviceAssembly.type,options:{}})};function nt(e){return t=>{const{model:r,status:n,KosModelLoader:s}=me();return b.jsx(s,{...n,children:b.jsx(e,{...t,deviceAssembly:r})})}}const pe=e=>{const t=e;return u.useKosModel({modelId:t,modelType:g.Holder.type,options:{}})};function ot(e,t){return r=>{const{model:n,status:s,KosModelLoader:i}=pe(e);return b.jsx(i,{...s,children:b.jsx(t,{...r,holder:n})})}}const he=()=>{const e=g.HolderContainer.type;return u.useKosModel({modelId:e,modelType:g.HolderContainer.type,options:{}})};function it(e){return t=>{const{model:r,status:n,KosModelLoader:s}=he();return b.jsx(s,{...n,children:b.jsx(e,{...t,holderContainer:r})})}}const fe=()=>{const e=g.Ingredient.type;return u.useKosModel({modelId:e,modelType:g.Ingredient.type,options:{}})},ne=u.KosLog.createLogger({name:"HoldToPourIntentStrategy",group:"kos-hooks"}),Be={name:"HoldToPourIntentStrategy",async initiate(e,t){if(!(e!=null&&e.canPour)){ne.debug(`${e==null?void 0:e.id} cannot pour. Returning early.`);return}t?(ne.debug(`performing intent: ${t}`),await(e==null?void 0:e.performIntent(t))):ne.debug("no intent provided. Returning early.")},async initiateEnded(e){await(e==null?void 0:e.cancelPour())}},oe=u.KosLog.createLogger({name:"useNozzlePour",group:"kos-hooks"}),at=({onPour:e,onPourCancel:t,intentContainer:r,strategy:n=Be})=>{const s=o.useCallback(()=>{oe.debug(`[${n==null?void 0:n.name}] - Pour initiated for model ${r==null?void 0:r.id}.`),n==null||n.initiate(r),e==null||e()},[e,r,n]),i=o.useCallback(()=>{var h;oe.debug(`[${n==null?void 0:n.name}] - Pour initiate ended called for nozzle ${r==null?void 0:r.id}.`),(h=n==null?void 0:n.initiateEnded)==null||h.call(n,r),t==null||t()},[t,r,n]),c=o.useCallback(()=>{oe.debug(`Force cancelling pour for nozzle ${r==null?void 0:r.id}.`),r==null||r.cancelPour(),t==null||t()},[t,r]);return{handlers:u.usePressGesture({onPressed:s,onRelease:i}).dom,cancel:c,status:r}};function ut(e){return t=>{const{model:r,status:n,KosModelLoader:s}=fe();return b.jsx(s,{...n,children:b.jsx(e,{...t,ingredient:r})})}}const ve=()=>{const e=g.IngredientContainer.type;return u.useKosModel({modelId:e,modelType:g.IngredientContainer.type,options:{}})};function ct(e){return t=>{const{model:r,status:n,KosModelLoader:s}=ve();return b.jsx(s,{...n,children:b.jsx(e,{...t,ingredientContainer:r})})}}function dt(e,t){return r=>{const{model:n,status:s,KosModelLoader:i}=le(e);return b.jsx(i,{...s,children:b.jsx(t,{...r,nozzle:n})})}}const D=u.KosLog.createLogger({name:"usePour",group:"kos-hooks"}),lt=({onBeforePour:e,onPour:t,onPourCancel:r,onPourAbort:n,pourTarget:s,strategy:i=be})=>{const c=o.useCallback(async()=>{D.debug(`[${i==null?void 0:i.name}] - calling before pour for pour target ${s==null?void 0:s.id}.`),(e?await(e==null?void 0:e()):!0)?(D.debug(`[${i==null?void 0:i.name}] - Pour initiated for pour target ${s==null?void 0:s.id}.`),await(i==null?void 0:i.initiate(s)),t==null||t(),s!=null&&s.isPouring||n==null||n()):(D.debug(`[${i==null?void 0:i.name}] - Pour cancelled for pour target ${s==null?void 0:s.id}.`),r==null||r())},[t,s,i]),l=o.useCallback(async()=>{var d;D.debug(`[${i==null?void 0:i.name}] - Pour initiate ended called for pour target ${s==null?void 0:s.id}.`),await((d=i==null?void 0:i.initiateEnded)==null?void 0:d.call(i,s))||r==null||r()},[r,s,i]),h=o.useCallback(async()=>{D.debug(`Force cancelling pour for pour target ${s==null?void 0:s.id}.`),await(s==null?void 0:s.cancelPour()),r==null||r()},[r,s]);return{handlers:u.usePressGesture({onPressed:c,onRelease:l}).dom,cancel:h,status:s}},R=u.KosLog.createLogger({name:"TapOrHoldIntentStrategy",group:"kos-hooks"});class bt{constructor(t){y(this,"intent");y(this,"name","TapOrHoldIntentStrategy");y(this,"isHold",!1);y(this,"disposer",null);this.intent=t}async initiate(t,r){if(this.disposer=setTimeout(()=>{this.isHold=!0},250),t!=null&&t.isPouring&&!this.isHold){R.debug("additional tap detected. cancelling pour"),await t.cancelPour();return}if(!(t!=null&&t.canPour)){R.debug(`${t==null?void 0:t.id} cannot pour. Returning early.`);return}r?(R.debug(`performing intent: ${r}`),await(t==null?void 0:t.performIntent(r))):R.debug("no intent provided. Returning early.")}async initiateEnded(t){return this.disposer&&clearTimeout(this.disposer),this.disposer=null,this.isHold?(await(t==null?void 0:t.cancelPour()),!1):(R.debug("Tap detected. don't cancel and return."),!0)}}const V=u.KosLog.createLogger({name:"TapToPourIntentStrategy",group:"kos-hooks"}),mt={name:"TapToPourIntentStrategy",async initiate(e,t){if(e!=null&&e.isPouring){V.debug(`Nozzle ${e==null?void 0:e.id} is already pouring. cancelling pour`),await e.cancelPour();return}if(!(e!=null&&e.canPour)){V.debug(`Nozzle ${e==null?void 0:e.id} cannot pour. Returning early.`);return}t?(V.debug(`performing intent: ${t}`),await(e==null?void 0:e.performIntent(t))):V.debug("no intent provided. Returning early.")},async initiateEnded(e){return!0}},we=u.KosLog.createLogger({name:"HoldToPourStrategy",group:"kos-hooks"}),pt={name:"TapToPourStrategy",async initiate(e){if(e!=null&&e.isPouring){we.debug(`Nozzle ${e==null?void 0:e.id} is already pouring. cancelling pour`),await e.cancelPour();return}if(!(e!=null&&e.canPour)){we.debug(`Nozzle ${e==null?void 0:e.id} cannot pour. Returning early.`);return}await(e==null?void 0:e.pour())},async initiateEnded(e){return!0}},Le=(e,t,r)=>{const n=e;return u.useKosModel({modelId:n,modelType:g.GenericPour.type,options:{servicePathFactory:t,selectedId:r}})};function ht(e){return t=>{const{model:r,status:n,KosModelLoader:s}=Le(t.id,t.servicePathFactory,t.itemId);return b.jsx(s,{...n,children:b.jsx(e,{...t,genericPour:r})})}}const Me=o.createContext(void 0),ft=({children:e})=>{const{model:t,ready:r}=ae(),n=o.useMemo(()=>r&&t?{model:t}:{},[r,t]);return b.jsx(Me.Provider,{value:n,children:e})},vt=()=>{const e=o.useContext(Me);if(!e)throw new Error("useAssemblyContext must be used within a AssemblyProvider");return e},je=o.createContext(void 0),Ct=({children:e})=>{const{model:t,ready:r}=ue(),n=o.useMemo(()=>r&&t?{model:t}:{},[r,t]);return b.jsx(je.Provider,{value:n,children:e})},xt=()=>{const e=o.useContext(je);if(!e)throw new Error("useAvailabilityContext must be used within a AvailabilityProvider");return e},He=o.createContext(void 0),gt=({children:e,id:t})=>{const{model:r,ready:n}=ce(t),s=o.useMemo(()=>n&&r?{model:r}:{},[n,r]);return b.jsx(He.Provider,{value:s,children:e})},Pt=()=>{const e=o.useContext(He);if(!e)throw new Error("useBoardContext must be used within a BoardProvider");return e},Ne=o.createContext(void 0),wt=({children:e})=>{const{model:t,ready:r}=de(),n=o.useMemo(()=>r&&t?{model:t}:{},[r,t]);return b.jsx(Ne.Provider,{value:n,children:e})},kt=()=>{const e=o.useContext(Ne);if(!e)throw new Error("useBoardContainerContext must be used within a BoardContainerProvider");return e},ye=o.createContext(void 0),De=({children:e})=>{const{model:t,ready:r}=me(),n=o.useMemo(()=>{if(r&&t){const i=t.nozzlePaths;return{model:t,nozzlePaths:i}}return{}},[r,t]),s=r&&t?e:null;return b.jsx(ye.Provider,{value:n,children:s})},Re=()=>{const e=o.useContext(ye);if(!e)throw new Error("useDeviceAssemblyContext must be used within a DeviceAssemblyProvider");return e};function Tt(){const e=o.createContext(null);return[()=>{const r=o.useContext(e);if(r===void 0)throw new Error("useDispenseKitContext must be used within a Provider");return r},e.Provider]}function Oe({children:e,provider:t,props:r,nozzleProps:n}){const s=Ke(r);return b.jsx(t,{value:s,children:e(n||{})})}function It({children:e,provider:t,props:r}){const{nozzlePaths:n}=Re(),s=(n==null?void 0:n.length)||0;return(n==null?void 0:n.map((c,l)=>b.jsx(Te,{path:c,children:b.jsx(Oe,{provider:t,props:r,nozzleProps:{nozzleIndex:l,nozzlePath:c,totalNozzles:s,isFirstNozzle:l===0,isLastNozzle:l===s-1},children:e})},c)))||[]}function Ye({provider:e,props:t}){return({children:r})=>e?b.jsx(De,{children:b.jsx(It,{provider:e,props:t,children:r})}):null}function At(e){const[t,r]=Tt();return[t,Ye({provider:r,props:e})]}const Ge=o.createContext(void 0),$t=({children:e,id:t})=>{const{model:r,ready:n}=pe(t||""),s=o.useMemo(()=>n&&r?{model:r}:{},[n,r]);return b.jsx(Ge.Provider,{value:s,children:e})},Et=()=>{const e=o.useContext(Ge);if(!e)throw new Error("useHolderContext must be used within a HolderProvider");return e},_e=o.createContext(void 0),Kt=({children:e})=>{const{model:t,ready:r}=he(),n=o.useMemo(()=>r&&t?{model:t}:{},[r,t]);return b.jsx(_e.Provider,{value:n,children:e})},St=()=>{const e=o.useContext(_e);if(!e)throw new Error("useHolderContainerContext must be used within a HolderContainerProvider");return e},Ue=o.createContext(void 0),Bt=({children:e})=>{const{model:t,ready:r}=fe(),n=o.useMemo(()=>r&&t?{model:t}:{},[r,t]);return b.jsx(Ue.Provider,{value:n,children:e})},Lt=()=>{const e=o.useContext(Ue);if(!e)throw new Error("useIngredientContext must be used within a IngredientProvider");return e},Fe=o.createContext(void 0),Mt=({children:e})=>{const{model:t,ready:r}=ve(),n=o.useMemo(()=>r&&t?{model:t}:{},[r,t]);return b.jsx(Fe.Provider,{value:n,children:e})},jt=()=>{const e=o.useContext(Fe);if(!e)throw new Error("useIngredientContainerContext must be used within a IngredientContainerProvider");return e},Ht=()=>{const e=g.Pump.type;return u.useKosModel({modelId:e,modelType:g.Pump.type,options:{}})},Ve=o.createContext(void 0),Nt=({children:e})=>{const{model:t,ready:r}=Ht(),n=o.useMemo(()=>r&&t?{model:t}:{},[r,t]);return b.jsx(Ve.Provider,{value:n,children:e})},yt=()=>{const e=o.useContext(Ve);if(!e)throw new Error("usePumpContext must be used within a PumpProvider");return e};exports.AssemblyProvider=ft;exports.AvailabilityProvider=Ct;exports.BoardContainerProvider=wt;exports.BoardProvider=gt;exports.CuiKit=Ye;exports.CuiKitWrapper=Oe;exports.DISPENSE_GROUP_BEVERAGE=O;exports.DISPENSE_GROUP_BRAND=j;exports.DISPENSE_GROUP_FLAVOR=H;exports.DeviceAssemblyProvider=De;exports.HoldToPourIntentStrategy=Be;exports.HoldToPourStrategy=be;exports.HolderContainerProvider=Kt;exports.HolderProvider=$t;exports.IngredientContainerProvider=Mt;exports.IngredientProvider=Bt;exports.NozzleProvider=Te;exports.PumpProvider=Nt;exports.TapOrHoldIntentStrategy=bt;exports.TapToPourIntentStrategy=mt;exports.TapToPourStrategy=pt;exports.initializeCuiKit=At;exports.useAssembly=ae;exports.useAssemblyContext=vt;exports.useAvailability=ue;exports.useAvailabilityContext=xt;exports.useBeverages=Ie;exports.useBoard=ce;exports.useBoardContainer=de;exports.useBoardContainerContext=kt;exports.useBoardContext=Pt;exports.useBrands=Ae;exports.useCuiKit=Ke;exports.useCuiKitTimers=ie;exports.useDefaultCuiKitLifecycle=rt;exports.useDeviceAssembly=me;exports.useDeviceAssemblyContext=Re;exports.useDispenseLifecycle=Se;exports.useFlavors=Ee;exports.useGenericPour=Le;exports.useHolder=pe;exports.useHolderContainer=he;exports.useHolderContainerContext=St;exports.useHolderContext=Et;exports.useIngredient=fe;exports.useIngredientContainer=ve;exports.useIngredientContainerContext=jt;exports.useIngredientContext=Lt;exports.useIngredientPour=at;exports.useNozzle=le;exports.useNozzleContext=A;exports.useNozzlePour=$e;exports.usePourTarget=lt;exports.usePumpContext=yt;exports.withAssembly=Qe;exports.withBeverage=Xe;exports.withBoard=Ze;exports.withBoardContainer=ze;exports.withDeviceAssembly=nt;exports.withGenericPour=ht;exports.withHolder=ot;exports.withHolderContainer=it;exports.withIngredient=ut;exports.withIngredientContainer=ct;exports.withNozzle=dt;
|
|
2
|
-
//# sourceMappingURL=pump-provider-CP6xxU4h.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pump-provider-CP6xxU4h.cjs","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/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","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 } 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 { HoldToPourStrategy } from \"../utils/pour-strategy/hold-to-pour-strategy\";\nimport type { PourStrategy } from \"../utils/pour-strategy/pour-strategy\";\n\ninterface NozzlePourProps {\n onBeforePour?: () => Promise<boolean>;\n onBeforePourRejected?: () => void;\n onPour?: () => void;\n onPourCancel?: () => void;\n strategy?: PourStrategy;\n}\n\nexport interface NozzlePourResponse {\n handlers: (...args: any[]) => ReactDOMAttributes;\n cancel: () => void;\n\n status?: {\n canPour: boolean;\n isPouring: boolean;\n currentState: PourState;\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 strategy = HoldToPourStrategy,\n}: NozzlePourProps): NozzlePourResponse => {\n const { model: nozzle } = useNozzleContext();\n\n const handlePour = useCallback(async () => {\n const canPour = onBeforePour ? await onBeforePour?.() : 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 }, [onPour, nozzle, strategy, onBeforePour, onPourCancel]);\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 handlers = usePressGesture({\n onPressed: handlePour,\n onRelease: handleCancelPour,\n });\n\n return {\n handlers: handlers.dom,\n cancel: forceCancelPour,\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 { 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: (callback: () => Promise<boolean>) => 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 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 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 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(async () => {\n const topic = `/kos/dispense/${nozzle?.path}/pre/pour/`;\n EventBus.publish(topic, {});\n return (await onBeforePour?.()) || true;\n }, [nozzle?.path]);\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] = useState<() => 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 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 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}: 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}/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 onInit,\n onReturnToHome,\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 defaultIdleTime?: number;\n defaultAreYouThereTime?: number;\n onIdleTimer?: VoidFunction;\n onAreYouThereTimer?: VoidFunction;\n onResetIdleTimer?: VoidFunction;\n prefix?: string;\n}\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 const handleAreYouThereTimer = useCallback(() => {\n if (onAreYouThereTimer) {\n KosLog.info(\"Are you there timer expired. Calling callback\");\n onAreYouThereTimer?.();\n }\n }, [onAreYouThereTimer]);\n\n const handleIdleTimer = useCallback(() => {\n if (onIdleTimer) {\n KosLog.info(\"Idle timer expired. Calling callback\");\n onIdleTimer?.();\n }\n }, [onIdleTimer]);\n\n const handleRestartIdleTimer = useCallback(() => {\n if (idleTimer) {\n idleTimer.restart();\n onResetIdleTimer?.();\n }\n }, [idleTimer, onResetIdleTimer]);\n\n const handlePauseIdleTimer = useCallback(() => {\n if (idleTimer) {\n idleTimer.reset();\n onResetIdleTimer?.();\n }\n }, [idleTimer, onResetIdleTimer]);\n useEffect(() => {\n if (nozzle) {\n KosLog.info(\"Nozzle is available. Creating timers\");\n const timer = TimerManager.createTimer(\n `${props.prefix ?? \"\"}idle-timer-${nozzle.path}`,\n defaultIdleTime\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 KosLog.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 } 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\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\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}\nexport const useDefaultCuiKitLifecycle = ({\n kit,\n inactivity,\n pour,\n screens,\n}: Props): LifecycleData => {\n const [showAreYouThere, setShowAreYouThere] = useState(false);\n const [showAmbientScreen, setShowAmbientScreen] = useState(false);\n const [showAttractScreen, setShowAttractScreen] = useState(false);\n\n const { model: nozzle } = useNozzleContext();\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 handleAreYouThere = useCallback(() => {\n setShowAreYouThere(true);\n }, []);\n\n const handleIdleTimeout = useCallback(() => {\n setShowAreYouThere(false);\n kit?.nav.home();\n }, [kit?.nav?.home]);\n\n const handleAmbientTimer = useCallback(() => {\n if (ambientTimeout) {\n setShowAmbientScreen(true);\n setShowAttractScreen(false);\n }\n }, [ambientTimeout]);\n\n const handleAttractTimer = useCallback(() => {\n if (attractTimeout) {\n setShowAttractScreen(true);\n setShowAmbientScreen(false);\n }\n }, [attractTimeout]);\n\n const handleAttractResume = useCallback(() => {\n if (attractTimeout) {\n setShowAttractScreen(false);\n setShowAmbientScreen(false);\n kit?.nav.home();\n }\n }, [kit?.nav, attractTimeout]);\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 { pause, restart, idleTimer } = useCuiKitTimers({\n defaultAreYouThereTime: areYouThereTimeout,\n defaultIdleTime: idleTimeout,\n onAreYouThereTimer: handleAreYouThere,\n onIdleTimer: handleIdleTimeout,\n });\n\n kit?.timers?.add(idleTimer);\n\n const {\n pause: pausePourTimer,\n restart: restartPourTimer,\n idleTimer: pourIdleTimer,\n } = useCuiKitTimers({\n defaultAreYouThereTime: areYouTherePourTimeout,\n defaultIdleTime: idlePourTimeout,\n onAreYouThereTimer: handleAreYouThere,\n onIdleTimer: handleIdleTimeout,\n prefix: \"pour-\",\n });\n\n kit?.timers?.add(pourIdleTimer);\n\n const handlePour = useCallback(() => {\n setHasPoured(false);\n pausePourTimer();\n pause();\n }, [pause, pausePourTimer]);\n\n const handlePourCancel = useCallback(() => {\n setHasPoured(true);\n console.log(\"restarting pour timer\");\n restartPourTimer();\n pause();\n }, [pause, restartPourTimer]);\n\n const handleBeforePourRejected = useCallback(() => {\n setHasPoured(false);\n console.log(\"restarting pour timer on before pour rejected\");\n pausePourTimer();\n restart();\n }, []);\n const clearAreYouThere = useCallback(() => {\n setShowAreYouThere(false);\n if (hasPoured) {\n restartPourTimer();\n pause();\n } else {\n restart();\n pausePourTimer();\n }\n }, [hasPoured, pause, pausePourTimer, restart, restartPourTimer]);\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 });\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 areYouThereCountdown,\n showAmbientScreen,\n showAttractScreen,\n pauseScreenTimer: resume,\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 } 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 { 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?: () => Promise<boolean>;\n onPour?: () => void;\n onPourCancel?: () => void;\n onPourAbort?: () => void;\n pourTarget: PourStrategyAware;\n strategy?: PourStrategy;\n}\n\nexport interface PourResponse {\n handlers: (...args: any[]) => ReactDOMAttributes;\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 strategy = HoldToPourStrategy,\n}: PourProps): PourResponse => {\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?.() : 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, pourTarget, strategy]);\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 handlers = usePressGesture({\n onPressed: handlePour,\n onRelease: handleCancelPour,\n });\n\n return {\n handlers: handlers.dom,\n cancel: forceCancelPour,\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","b","useBrands","onBrandSelected","onBrandCleared","setSelectedBrand","brands","setBrands","selectBrand","clearBrand","logger","KosLog","HoldToPourStrategy","useNozzlePour","onPour","onPourCancel","onBeforePour","onBeforePourRejected","strategy","handlePour","handleCancelPour","_a","forceCancelPour","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","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","disposers","useCuiKitTimers","idleTimer","setIdleTimer","onAreYouThereTimer","onIdleTimer","onResetIdleTimer","defaultAreYouThereTime","defaultIdleTime","handleAreYouThereTimer","handleIdleTimer","handleRestartIdleTimer","handlePauseIdleTimer","useDefaultCuiKitLifecycle","kit","inactivity","screens","showAreYouThere","setShowAreYouThere","showAmbientScreen","setShowAmbientScreen","showAttractScreen","setShowAttractScreen","hasPoured","setHasPoured","idleTimeout","areYouThereTimeout","idlePourTimeout","areYouTherePourTimeout","ambientTimeout","attractTimeout","handleAreYouThere","handleIdleTimeout","handleAttractResume","ambientPause","ambientRestart","resume","pause","restart","pausePourTimer","restartPourTimer","pourIdleTimer","_d","handlePourCancel","clearAreYouThere","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","__publicField","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":"yVAGaA,GAAc,IAAM,CAC/B,MAAMC,EAAUC,EAAS,SAAA,KAOlB,OANQC,EAAAA,YAA2B,CACxC,QAAAF,EACA,UAAWC,EAAS,SAAA,KACpB,QAAS,CAAC,CAAA,CACX,CAGH,ECLO,SAASE,GACdC,EACA,CACA,OAAQC,GAAwC,CAC9C,KAAM,CAAE,MAAAC,EAAO,OAAAC,EAAQ,eAAAC,GAAmBT,GAAY,EAGpD,OAAAU,EAAA,IAACD,EAAgB,CAAA,GAAGD,EAClB,SAAAE,EAAA,IAACL,GAAkB,GAAIC,EAAa,SAAUC,CAAO,CAAA,CACvD,CAAA,CAAA,CAGN,CChBO,MAAMI,GAAkB,IAAM,CACnC,MAAMV,EAAUW,EAAa,aAAA,KAOtB,OANQT,EAAAA,YAA+B,CAC5C,QAAAF,EACA,UAAWW,EAAa,aAAA,KACxB,QAAS,CAAC,CAAA,CACX,CAGH,ECLO,SAASC,GACdR,EACA,CACA,OAAQC,GAA4C,CAClD,KAAM,CAAE,MAAAC,EAAO,OAAAC,EAAQ,eAAAC,GAAmBE,GAAgB,EAGxD,OAAAD,EAAA,IAACD,EAAgB,CAAA,GAAGD,EAClB,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