@kosdev-code/kos-dispense-sdk 0.1.0-next.970 → 0.1.0-next.975

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.
Files changed (50) hide show
  1. package/.kos.json +7 -0
  2. package/{dispense-registration-manager-Da9CW_cN.js → dispense-registration-manager-J59_vyyY.js} +584 -184
  3. package/dispense-registration-manager-J59_vyyY.js.map +1 -0
  4. package/{dispense-registration-manager-Dtb31fcI.cjs → dispense-registration-manager-OYGAiIZy.cjs} +551 -151
  5. package/dispense-registration-manager-OYGAiIZy.cjs.map +1 -0
  6. package/{extension-utils-D_dnBLH6.js → extension-utils-DEM1emOY.js} +2 -2
  7. package/{extension-utils-D_dnBLH6.js.map → extension-utils-DEM1emOY.js.map} +1 -1
  8. package/{extension-utils-Cfhe358W.cjs → extension-utils-Pd5ntKtv.cjs} +2 -2
  9. package/{extension-utils-Cfhe358W.cjs.map → extension-utils-Pd5ntKtv.cjs.map} +1 -1
  10. package/index.cjs +6 -4
  11. package/index.cjs.map +1 -1
  12. package/index.js +66 -64
  13. package/models/models/cui-kit-state/cui-kit-state-model.d.ts +131 -0
  14. package/models/models/cui-kit-state/cui-kit-state-model.d.ts.map +1 -0
  15. package/models/models/cui-kit-state/index.d.ts +4 -0
  16. package/models/models/cui-kit-state/index.d.ts.map +1 -0
  17. package/models/models/cui-kit-state/types/index.d.ts +68 -0
  18. package/models/models/index.d.ts +1 -0
  19. package/models/models/index.d.ts.map +1 -1
  20. package/models/utils/dispense-registration-manager.d.ts +13 -0
  21. package/models/utils/dispense-registration-manager.d.ts.map +1 -1
  22. package/models/utils/pour-context.d.ts +8 -0
  23. package/models/utils/pour-context.d.ts.map +1 -0
  24. package/models.cjs +4 -2
  25. package/models.cjs.map +1 -1
  26. package/models.js +17 -15
  27. package/package.json +5 -5
  28. package/{pump-provider-uNNMh9uh.cjs → pump-provider-BSbTT-BC.cjs} +371 -418
  29. package/pump-provider-BSbTT-BC.cjs.map +1 -0
  30. package/{pump-provider-BQmCKz7S.js → pump-provider-Ch7NOeRj.js} +417 -464
  31. package/pump-provider-Ch7NOeRj.js.map +1 -0
  32. package/ui/contexts/cui-kit/cui-kit.d.ts +12 -1
  33. package/ui/contexts/cui-kit/cui-kit.d.ts.map +1 -1
  34. package/ui/hooks/cui-kit/use-cui-kit.d.ts +44 -5
  35. package/ui/hooks/cui-kit/use-cui-kit.d.ts.map +1 -1
  36. package/ui/hooks/utils/pour-strategy/hold-to-pour-intent-strategy.d.ts.map +1 -1
  37. package/ui/hooks/utils/pour-strategy/hold-to-pour-strategy.d.ts.map +1 -1
  38. package/ui/hooks/utils/pour-strategy/pour-strategy.d.ts +2 -0
  39. package/ui/hooks/utils/pour-strategy/pour-strategy.d.ts.map +1 -1
  40. package/ui/hooks/utils/pour-strategy/tap-or-hold-to-pour-intent-strategy.d.ts.map +1 -1
  41. package/ui/utils/pour-context.d.ts +1 -7
  42. package/ui/utils/pour-context.d.ts.map +1 -1
  43. package/ui.cjs +3 -2
  44. package/ui.cjs.map +1 -1
  45. package/ui.js +49 -48
  46. package/ui.js.map +1 -1
  47. package/dispense-registration-manager-Da9CW_cN.js.map +0 -1
  48. package/dispense-registration-manager-Dtb31fcI.cjs.map +0 -1
  49. package/pump-provider-BQmCKz7S.js.map +0 -1
  50. package/pump-provider-uNNMh9uh.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"extension-utils-D_dnBLH6.js","sources":["../../../packages/kos-dispense-sdk/src/models/models/holder/utils/holder-utils.ts","../../../packages/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 EXTENSION_FEATURE_FLAG_RESOLVER,\n ExtensionManager,\n ExtensionOptions,\n IndexExtension,\n PropertyMapper,\n type FlagResolver,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport { ExtensionType } from \"../constants\";\nimport { AssemblyTypes, type AssemblyModel } 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 * Registers a data mapper for the {@link IngredientModel}.\n *\n * Ingredient service data often needs properties the base model does not carry. The mapper receives each\n * {@link IngredientResponse} and the data returned by the ingredient loader as context, and its result\n * becomes the model's `data` property.\n *\n * @param ingredientDataMapper - Mapping function that maps an {@link IngredientResponse} into additional model data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n */\n registerIngredientDataMapper(\n ingredientDataMapper: IngredientDataMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.IngredientMapper,\n ingredientDataMapper,\n options\n );\n\n return this;\n }\n\n /**\n * Registers a loader whose result is passed as context to the ingredient data and type mappers.\n *\n * @param ingredientLoader - Async function that loads and returns ingredient context data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on loader failure.\n * Set to `\"continue\"` to log the error and return `undefined` instead.\n * @returns this instance for chaining\n */\n registerIngredientLoader(\n ingredientLoader: DataLoader,\n options?: ExtensionOptions\n ) {\n ExtensionManager.loader.registerLoader(\n ExtensionType.IngredientLoader,\n ingredientLoader,\n options\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 property mapper that derives the `type` property of the {@link IngredientModel}\n * from an {@link IngredientResponse}.\n *\n * @param ingredientTypeMapper - Mapping function that extracts a type string from an {@link IngredientResponse}\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and return a fallback value instead.\n * @returns this instance for chaining\n * */\n registerIngredientTypeMapper(\n ingredientTypeMapper: IngredientTypeMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.IngredientTypeMapper,\n ingredientTypeMapper,\n options\n );\n return this;\n }\n\n /**\n * Registers a data mapper for the {@link HolderModel} model.\n *\n * @param holderDataMapper - Mapping function that maps additional data from a {@link HolderResponse}\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n */\n registerHolderDataMapper(\n holderDataMapper: HolderDataMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.HolderMapper,\n holderDataMapper,\n options\n );\n return this;\n }\n\n /**\n * Registers a property mapper that derives the `type` property of the {@link HolderModel}\n * from a {@link HolderResponse}.\n *\n * @param holderTypeMapper - Mapping function that extracts a type string from a {@link HolderResponse}\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and return a fallback value instead.\n * @returns this instance for chaining\n */\n registerHolderTypeMapper(\n holderTypeMapper: HolderTypeMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.HolderTypeMapper,\n holderTypeMapper,\n options\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 * @param holderTypeMapper - Mapping function that extracts the ingredientId from a {@link HolderResponse}\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and return a fallback value instead.\n * @returns this instance for chaining\n * */\n registerHolderIngredientMapper(\n holderTypeMapper: HolderTypeMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.HolderTypeMapper,\n holderTypeMapper,\n options\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 * Registers a data mapper for the {@link AvailabilityModel}.\n *\n * The mapper receives each availability node, with its `groupId`, and the data returned by the\n * availability loader as context. Its result becomes the model's `data` property.\n *\n * @param availabilityMapper - Mapping function that maps a {@link GroupBeverageResponse} into additional availability data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n *\n * @example\n * ```typescript\n * const beverageDataMapper: AvailabilityDataMapper<BeverageData> = async (\n * data,\n * context?: Record<string, BrandsetIngredient>\n * ) => ({\n * iconUrl: context?.[data.altId]?.icon ?? \"\",\n * });\n * ```\n */\n registerAvailabilityDataMapper(\n availabilityMapper: AvailabilityDataMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.AvailabilityMapper,\n availabilityMapper,\n options\n );\n return this;\n }\n\n /**\n * Registers a loader whose result is passed as context to the availability data mapper. A common use is\n * loading UI-specific brandset data that the backend service does not provide.\n *\n * @param availabilityLoader - Async function that loads and returns availability context data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on loader failure.\n * Set to `\"continue\"` to log the error and return `undefined` instead.\n * @returns this instance for chaining\n *\n * @example\n * ```typescript\n * const beverageContextLoader = async () => {\n * const response = await kosFetch(\"kos:/system/brandset/brandset.json\");\n * const json: BrandsetResponse = await response.json();\n * return Object.fromEntries(json.ingredients.map((i) => [i.ingredientId, i]));\n * };\n * ```\n */\n registerAvailabilityLoader(\n availabilityLoader: DataLoader,\n options?: ExtensionOptions\n ) {\n ExtensionManager.loader.registerLoader(\n ExtensionType.AvailabilityLoader,\n availabilityLoader,\n options\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 * @param selectedPourableMapper - Mapping function that transforms {@link SelectedPourable} data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n * */\n registerSelectedPourableDataMapper(\n selectedPourableMapper: SelectedPourableMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.SelectedPourableMapper,\n selectedPourableMapper,\n options\n );\n return this;\n }\n\n /**\n * Registers a data mapper for the {@link AssemblyModel}, for backends that extend the assembly response\n * with additional properties. The mapper's result is merged into the assembly model.\n *\n * @param assemblyDataMapper - Mapping function that maps an {@link AssemblyTypes.AssemblyResponse} into additional assembly data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n *\n * @example\n * ```typescript\n * interface IceAgitatorExt {\n * iceAgitator?: { name: string; path: string };\n * }\n *\n * const assemblyDataMapper: AssemblyMapper<\n * { iceAgitatorPath?: string },\n * AssemblyTypes.AssemblyResponse<{ AssemblyExt: IceAgitatorExt }>\n * > = async (data) => ({\n * iceAgitatorPath: data.assemblies.find((a) => a.iceAgitator)?.iceAgitator?.path,\n * });\n * ```\n */\n registerAssemblyDataMapper(\n assemblyDataMapper: AssemblyMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.AssemblyMapper,\n assemblyDataMapper,\n options\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 /**\n * Registers a data mapper for the board model within an assembly.\n *\n * @param boardDataMapper - Mapping function that maps an {@link AssemblyTypes.AssemblyBoard} into additional board data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n */\n registerBoardDataMapper(\n boardDataMapper: BoardDataMapper<any, any>,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.BoardMapper,\n boardDataMapper,\n options\n );\n return this;\n }\n\n registerAssemblyFeatureFlagResolver(\n assemblyFeatureFlagResolver: FlagResolver<AssemblyModel>\n ) {\n ExtensionManager[EXTENSION_FEATURE_FLAG_RESOLVER]?.register(\n ExtensionType.AssemblyFeatureFlags,\n assemblyFeatureFlagResolver\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":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,MAAM,oBAAoB,CAAC,WAAwB;AACxD,QAAM,CAAC,WAAW,YAAY,IAAI;AAAA,IAChC,QAAQ,OAAO,YAAY;AAAA,EAAA;AAE7B,QAAM,CAAC,iBAAiB,kBAAkB,IAAI;AAAA,IAC5C,QAAQ,OAAO,gBAAgB;AAAA,EAAA;AAGjC,QAAM,CAAC,cAAc,eAAe,IAAI;AAAA,IACtC,QAAQ,OAAO,aAAa;AAAA,EAAA;AAG9B,QAAM,CAAC,oBAAoB,qBAAqB,IAAI;AAAA,IAClD,QAAQ,OAAO,iBAAiB;AAAA,EAAA;AAGlC,QAAM,CAAC,aAAa,cAAc,IAAI;AAAA,IACpC,mBAAmB,IACf,IACA,KAAK,OAAQ,mBAAmB,MAAM,aAAa,KAAM,GAAG;AAAA,EAAA;AAGlE,Q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AAA;AAAA;AAAA;AAAA,EAWA,mCACE,wBACA,SACA;AACA,qBAAiB,WAAW;AAAA,MAC1B,cAAc;AAAA,MACd;AAAA,MACA;AAAA,IAAA;AAEF,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA0BA,2BACE,oBACA,SACA;AACA,qBAAiB,WAAW;AAAA,MAC1B,cAAc;AAAA,MACd;AAAA,MACA;AAAA,IAAA;AAEF,WAAO;AAAA,EACT;AAAA,EAEA,mBAAmB,YAA4B;AAC7C,qBAAiB,eAAe;AAAA,MAC9B,cAAc;AAAA,MACd;AAAA,IAAA;AAEF,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,wBACE,iBACA,SACA;AACA,qBAAiB,WAAW;AAAA,MAC1B,cAAc;AAAA,MACd;AAAA,MACA;AAAA,IAAA;AAEF,WAAO;AAAA,EACT;AAAA,EAEA,oCACE,6BACA;AACA,qBAAiB,+BAA+B,GAAG;AAAA,MACjD,cAAc;AAAA,MACd;AAAA,IAAA;AAEF,WAAO;AAAA,EACT;AACF;AAUO,MAAM,oBAAoB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA,cAAc;AACZ,SAAK,WAAW,IAAI,yBAAA;AACpB,SAAK,OAAO,IAAI,qBAAA;AAAA,EAClB;AACF;"}
1
+ {"version":3,"file":"extension-utils-DEM1emOY.js","sources":["../../../packages/kos-dispense-sdk/src/models/models/holder/utils/holder-utils.ts","../../../packages/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 EXTENSION_FEATURE_FLAG_RESOLVER,\n ExtensionManager,\n ExtensionOptions,\n IndexExtension,\n PropertyMapper,\n type FlagResolver,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport { ExtensionType } from \"../constants\";\nimport { AssemblyTypes, type AssemblyModel } 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 * Registers a data mapper for the {@link IngredientModel}.\n *\n * Ingredient service data often needs properties the base model does not carry. The mapper receives each\n * {@link IngredientResponse} and the data returned by the ingredient loader as context, and its result\n * becomes the model's `data` property.\n *\n * @param ingredientDataMapper - Mapping function that maps an {@link IngredientResponse} into additional model data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n */\n registerIngredientDataMapper(\n ingredientDataMapper: IngredientDataMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.IngredientMapper,\n ingredientDataMapper,\n options\n );\n\n return this;\n }\n\n /**\n * Registers a loader whose result is passed as context to the ingredient data and type mappers.\n *\n * @param ingredientLoader - Async function that loads and returns ingredient context data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on loader failure.\n * Set to `\"continue\"` to log the error and return `undefined` instead.\n * @returns this instance for chaining\n */\n registerIngredientLoader(\n ingredientLoader: DataLoader,\n options?: ExtensionOptions\n ) {\n ExtensionManager.loader.registerLoader(\n ExtensionType.IngredientLoader,\n ingredientLoader,\n options\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 property mapper that derives the `type` property of the {@link IngredientModel}\n * from an {@link IngredientResponse}.\n *\n * @param ingredientTypeMapper - Mapping function that extracts a type string from an {@link IngredientResponse}\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and return a fallback value instead.\n * @returns this instance for chaining\n * */\n registerIngredientTypeMapper(\n ingredientTypeMapper: IngredientTypeMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.IngredientTypeMapper,\n ingredientTypeMapper,\n options\n );\n return this;\n }\n\n /**\n * Registers a data mapper for the {@link HolderModel} model.\n *\n * @param holderDataMapper - Mapping function that maps additional data from a {@link HolderResponse}\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n */\n registerHolderDataMapper(\n holderDataMapper: HolderDataMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.HolderMapper,\n holderDataMapper,\n options\n );\n return this;\n }\n\n /**\n * Registers a property mapper that derives the `type` property of the {@link HolderModel}\n * from a {@link HolderResponse}.\n *\n * @param holderTypeMapper - Mapping function that extracts a type string from a {@link HolderResponse}\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and return a fallback value instead.\n * @returns this instance for chaining\n */\n registerHolderTypeMapper(\n holderTypeMapper: HolderTypeMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.HolderTypeMapper,\n holderTypeMapper,\n options\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 * @param holderTypeMapper - Mapping function that extracts the ingredientId from a {@link HolderResponse}\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and return a fallback value instead.\n * @returns this instance for chaining\n * */\n registerHolderIngredientMapper(\n holderTypeMapper: HolderTypeMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.HolderTypeMapper,\n holderTypeMapper,\n options\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 * Registers a data mapper for the {@link AvailabilityModel}.\n *\n * The mapper receives each availability node, with its `groupId`, and the data returned by the\n * availability loader as context. Its result becomes the model's `data` property.\n *\n * @param availabilityMapper - Mapping function that maps a {@link GroupBeverageResponse} into additional availability data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n *\n * @example\n * ```typescript\n * const beverageDataMapper: AvailabilityDataMapper<BeverageData> = async (\n * data,\n * context?: Record<string, BrandsetIngredient>\n * ) => ({\n * iconUrl: context?.[data.altId]?.icon ?? \"\",\n * });\n * ```\n */\n registerAvailabilityDataMapper(\n availabilityMapper: AvailabilityDataMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.AvailabilityMapper,\n availabilityMapper,\n options\n );\n return this;\n }\n\n /**\n * Registers a loader whose result is passed as context to the availability data mapper. A common use is\n * loading UI-specific brandset data that the backend service does not provide.\n *\n * @param availabilityLoader - Async function that loads and returns availability context data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on loader failure.\n * Set to `\"continue\"` to log the error and return `undefined` instead.\n * @returns this instance for chaining\n *\n * @example\n * ```typescript\n * const beverageContextLoader = async () => {\n * const response = await kosFetch(\"kos:/system/brandset/brandset.json\");\n * const json: BrandsetResponse = await response.json();\n * return Object.fromEntries(json.ingredients.map((i) => [i.ingredientId, i]));\n * };\n * ```\n */\n registerAvailabilityLoader(\n availabilityLoader: DataLoader,\n options?: ExtensionOptions\n ) {\n ExtensionManager.loader.registerLoader(\n ExtensionType.AvailabilityLoader,\n availabilityLoader,\n options\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 * @param selectedPourableMapper - Mapping function that transforms {@link SelectedPourable} data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n * */\n registerSelectedPourableDataMapper(\n selectedPourableMapper: SelectedPourableMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.SelectedPourableMapper,\n selectedPourableMapper,\n options\n );\n return this;\n }\n\n /**\n * Registers a data mapper for the {@link AssemblyModel}, for backends that extend the assembly response\n * with additional properties. The mapper's result is merged into the assembly model.\n *\n * @param assemblyDataMapper - Mapping function that maps an {@link AssemblyTypes.AssemblyResponse} into additional assembly data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n *\n * @example\n * ```typescript\n * interface IceAgitatorExt {\n * iceAgitator?: { name: string; path: string };\n * }\n *\n * const assemblyDataMapper: AssemblyMapper<\n * { iceAgitatorPath?: string },\n * AssemblyTypes.AssemblyResponse<{ AssemblyExt: IceAgitatorExt }>\n * > = async (data) => ({\n * iceAgitatorPath: data.assemblies.find((a) => a.iceAgitator)?.iceAgitator?.path,\n * });\n * ```\n */\n registerAssemblyDataMapper(\n assemblyDataMapper: AssemblyMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.AssemblyMapper,\n assemblyDataMapper,\n options\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 /**\n * Registers a data mapper for the board model within an assembly.\n *\n * @param boardDataMapper - Mapping function that maps an {@link AssemblyTypes.AssemblyBoard} into additional board data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n */\n registerBoardDataMapper(\n boardDataMapper: BoardDataMapper<any, any>,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.BoardMapper,\n boardDataMapper,\n options\n );\n return this;\n }\n\n registerAssemblyFeatureFlagResolver(\n assemblyFeatureFlagResolver: FlagResolver<AssemblyModel>\n ) {\n ExtensionManager[EXTENSION_FEATURE_FLAG_RESOLVER]?.register(\n ExtensionType.AssemblyFeatureFlags,\n assemblyFeatureFlagResolver\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":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,MAAM,oBAAoB,CAAC,WAAwB;AACxD,QAAM,CAAC,WAAW,YAAY,IAAI;AAAA,IAChC,QAAQ,OAAO,YAAY;AAAA,EAAA;AAE7B,QAAM,CAAC,iBAAiB,kBAAkB,IAAI;AAAA,IAC5C,QAAQ,OAAO,gBAAgB;AAAA,EAAA;AAGjC,QAAM,CAAC,cAAc,eAAe,IAAI;AAAA,IACtC,QAAQ,OAAO,aAAa;AAAA,EAAA;AAG9B,QAAM,CAAC,oBAAoB,qBAAqB,IAAI;AAAA,IAClD,QAAQ,OAAO,iBAAiB;AAAA,EAAA;AAGlC,QAAM,CAAC,aAAa,cAA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ACtB,cAAc;AAAA,MACd;AAAA,MACA;AAAA,IAAA;AAEF,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,mCACE,wBACA,SACA;AACA,qBAAiB,WAAW;AAAA,MAC1B,cAAc;AAAA,MACd;AAAA,MACA;AAAA,IAAA;AAEF,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA0BA,2BACE,oBACA,SACA;AACA,qBAAiB,WAAW;AAAA,MAC1B,cAAc;AAAA,MACd;AAAA,MACA;AAAA,IAAA;AAEF,WAAO;AAAA,EACT;AAAA,EAEA,mBAAmB,YAA4B;AAC7C,qBAAiB,eAAe;AAAA,MAC9B,cAAc;AAAA,MACd;AAAA,IAAA;AAEF,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,wBACE,iBACA,SACA;AACA,qBAAiB,WAAW;AAAA,MAC1B,cAAc;AAAA,MACd;AAAA,MACA;AAAA,IAAA;AAEF,WAAO;AAAA,EACT;AAAA,EAEA,oCACE,6BACA;AACA,qBAAiB,+BAA+B,GAAG;AAAA,MACjD,cAAc;AAAA,MACd;AAAA,IAAA;AAEF,WAAO;AAAA,EACT;AACF;AAUO,MAAM,oBAAoB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA,cAAc;AACZ,SAAK,WAAW,IAAI,yBAAA;AACpB,SAAK,OAAO,IAAI,qBAAA;AAAA,EAClB;AACF;"}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const dispenseRegistrationManager = require("./dispense-registration-manager-Dtb31fcI.cjs");
2
+ const dispenseRegistrationManager = require("./dispense-registration-manager-OYGAiIZy.cjs");
3
3
  const kosUiSdk = require("@kosdev-code/kos-ui-sdk");
4
4
  const React = require("react");
5
5
  const index$5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -359,4 +359,4 @@ exports.index$2 = index$4;
359
359
  exports.index$3 = index$5;
360
360
  exports.index$4 = index$1;
361
361
  exports.index$5 = index$2;
362
- //# sourceMappingURL=extension-utils-Cfhe358W.cjs.map
362
+ //# sourceMappingURL=extension-utils-Pd5ntKtv.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"extension-utils-Cfhe358W.cjs","sources":["../../../packages/kos-dispense-sdk/src/models/models/holder/utils/holder-utils.ts","../../../packages/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 EXTENSION_FEATURE_FLAG_RESOLVER,\n ExtensionManager,\n ExtensionOptions,\n IndexExtension,\n PropertyMapper,\n type FlagResolver,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport { ExtensionType } from \"../constants\";\nimport { AssemblyTypes, type AssemblyModel } 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 * Registers a data mapper for the {@link IngredientModel}.\n *\n * Ingredient service data often needs properties the base model does not carry. The mapper receives each\n * {@link IngredientResponse} and the data returned by the ingredient loader as context, and its result\n * becomes the model's `data` property.\n *\n * @param ingredientDataMapper - Mapping function that maps an {@link IngredientResponse} into additional model data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n */\n registerIngredientDataMapper(\n ingredientDataMapper: IngredientDataMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.IngredientMapper,\n ingredientDataMapper,\n options\n );\n\n return this;\n }\n\n /**\n * Registers a loader whose result is passed as context to the ingredient data and type mappers.\n *\n * @param ingredientLoader - Async function that loads and returns ingredient context data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on loader failure.\n * Set to `\"continue\"` to log the error and return `undefined` instead.\n * @returns this instance for chaining\n */\n registerIngredientLoader(\n ingredientLoader: DataLoader,\n options?: ExtensionOptions\n ) {\n ExtensionManager.loader.registerLoader(\n ExtensionType.IngredientLoader,\n ingredientLoader,\n options\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 property mapper that derives the `type` property of the {@link IngredientModel}\n * from an {@link IngredientResponse}.\n *\n * @param ingredientTypeMapper - Mapping function that extracts a type string from an {@link IngredientResponse}\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and return a fallback value instead.\n * @returns this instance for chaining\n * */\n registerIngredientTypeMapper(\n ingredientTypeMapper: IngredientTypeMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.IngredientTypeMapper,\n ingredientTypeMapper,\n options\n );\n return this;\n }\n\n /**\n * Registers a data mapper for the {@link HolderModel} model.\n *\n * @param holderDataMapper - Mapping function that maps additional data from a {@link HolderResponse}\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n */\n registerHolderDataMapper(\n holderDataMapper: HolderDataMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.HolderMapper,\n holderDataMapper,\n options\n );\n return this;\n }\n\n /**\n * Registers a property mapper that derives the `type` property of the {@link HolderModel}\n * from a {@link HolderResponse}.\n *\n * @param holderTypeMapper - Mapping function that extracts a type string from a {@link HolderResponse}\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and return a fallback value instead.\n * @returns this instance for chaining\n */\n registerHolderTypeMapper(\n holderTypeMapper: HolderTypeMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.HolderTypeMapper,\n holderTypeMapper,\n options\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 * @param holderTypeMapper - Mapping function that extracts the ingredientId from a {@link HolderResponse}\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and return a fallback value instead.\n * @returns this instance for chaining\n * */\n registerHolderIngredientMapper(\n holderTypeMapper: HolderTypeMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.HolderTypeMapper,\n holderTypeMapper,\n options\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 * Registers a data mapper for the {@link AvailabilityModel}.\n *\n * The mapper receives each availability node, with its `groupId`, and the data returned by the\n * availability loader as context. Its result becomes the model's `data` property.\n *\n * @param availabilityMapper - Mapping function that maps a {@link GroupBeverageResponse} into additional availability data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n *\n * @example\n * ```typescript\n * const beverageDataMapper: AvailabilityDataMapper<BeverageData> = async (\n * data,\n * context?: Record<string, BrandsetIngredient>\n * ) => ({\n * iconUrl: context?.[data.altId]?.icon ?? \"\",\n * });\n * ```\n */\n registerAvailabilityDataMapper(\n availabilityMapper: AvailabilityDataMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.AvailabilityMapper,\n availabilityMapper,\n options\n );\n return this;\n }\n\n /**\n * Registers a loader whose result is passed as context to the availability data mapper. A common use is\n * loading UI-specific brandset data that the backend service does not provide.\n *\n * @param availabilityLoader - Async function that loads and returns availability context data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on loader failure.\n * Set to `\"continue\"` to log the error and return `undefined` instead.\n * @returns this instance for chaining\n *\n * @example\n * ```typescript\n * const beverageContextLoader = async () => {\n * const response = await kosFetch(\"kos:/system/brandset/brandset.json\");\n * const json: BrandsetResponse = await response.json();\n * return Object.fromEntries(json.ingredients.map((i) => [i.ingredientId, i]));\n * };\n * ```\n */\n registerAvailabilityLoader(\n availabilityLoader: DataLoader,\n options?: ExtensionOptions\n ) {\n ExtensionManager.loader.registerLoader(\n ExtensionType.AvailabilityLoader,\n availabilityLoader,\n options\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 * @param selectedPourableMapper - Mapping function that transforms {@link SelectedPourable} data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n * */\n registerSelectedPourableDataMapper(\n selectedPourableMapper: SelectedPourableMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.SelectedPourableMapper,\n selectedPourableMapper,\n options\n );\n return this;\n }\n\n /**\n * Registers a data mapper for the {@link AssemblyModel}, for backends that extend the assembly response\n * with additional properties. The mapper's result is merged into the assembly model.\n *\n * @param assemblyDataMapper - Mapping function that maps an {@link AssemblyTypes.AssemblyResponse} into additional assembly data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n *\n * @example\n * ```typescript\n * interface IceAgitatorExt {\n * iceAgitator?: { name: string; path: string };\n * }\n *\n * const assemblyDataMapper: AssemblyMapper<\n * { iceAgitatorPath?: string },\n * AssemblyTypes.AssemblyResponse<{ AssemblyExt: IceAgitatorExt }>\n * > = async (data) => ({\n * iceAgitatorPath: data.assemblies.find((a) => a.iceAgitator)?.iceAgitator?.path,\n * });\n * ```\n */\n registerAssemblyDataMapper(\n assemblyDataMapper: AssemblyMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.AssemblyMapper,\n assemblyDataMapper,\n options\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 /**\n * Registers a data mapper for the board model within an assembly.\n *\n * @param boardDataMapper - Mapping function that maps an {@link AssemblyTypes.AssemblyBoard} into additional board data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n */\n registerBoardDataMapper(\n boardDataMapper: BoardDataMapper<any, any>,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.BoardMapper,\n boardDataMapper,\n options\n );\n return this;\n }\n\n registerAssemblyFeatureFlagResolver(\n assemblyFeatureFlagResolver: FlagResolver<AssemblyModel>\n ) {\n ExtensionManager[EXTENSION_FEATURE_FLAG_RESOLVER]?.register(\n ExtensionType.AssemblyFeatureFlags,\n assemblyFeatureFlagResolver\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":["useState","useEffect","kosAutoEffect","CoreExtensionManager","ExtensionManager","ExtensionType","EXTENSION_FEATURE_FLAG_RESOLVER"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,MAAM,oBAAoB,CAAC,WAAwB;AACxD,QAAM,CAAC,WAAW,YAAY,IAAIA,MAAAA;AAAAA,IAChC,QAAQ,OAAO,YAAY;AAAA,EAAA;AAE7B,QAAM,CAAC,iBAAiB,kBAAkB,IAAIA,MAAAA;AAAAA,IAC5C,QAAQ,OAAO,gBAAgB;AAAA,EAAA;AAGjC,QAAM,CAAC,cAAc,eAAe,IAAIA,MAAAA;AAAAA,IACtC,QAAQ,OAAO,aAAa;AAAA,EAAA;AAG9B,QAAM,CAAC,oBAAoB,qBAAqB,IAAIA,MAAAA;AAAAA,IAClD,QAAQ,OAAO,iBAAiB;AAAA,EAAA;AAGlC,QAAM,CAAC,aAAa,cAAc,IAAIA,MAAAA;AAAAA,IACpC,mBAAmB,IACf,IACA,KAAK,OAAQ,mBAAmB,MAAM,aAAa,KAAM,GAAG;AAAA,EAAA;AAGlE,QAAM,CAAC,cAAc,eAAe,IAAIA,MAAAA;AAAAA,IACtC,gBAAgB;AAAA,EAAA;AAGlBC,QAAAA,UAAU,MAAM;AACd,UAAM,WAAWC,SAAAA,cAAc,MAAM;AACnC,mBAAa,QAAQ,OAAO,YAAY,CAAC;AACzC,yBAAmB,QAAQ,OAAO,gBAAgB,CAAC;AACnD,sBAAgB,QAAQ,OAAO,aAAa,MAAS;AACrD,4BAAsB,QAAQ,OAAO,iBAAiB,MAAS;AAC/D;AAAA,QACE,mBAAmB,IACf,IACA,KAAK,OAAQ,mBAAmB,MAAM,aAAa,KAAM,GAAG;AAAA,MAAA;AAElE,sBAAgB,gBAAgB,kBAAkB;AAAA,IACpD,C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AA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA0BA,2BACE,oBACA,SACA;AACAD,aAAAA,iBAAiB,WAAW;AAAA,MAC1BC,4BAAAA,cAAc;AAAA,MACd;AAAA,MACA;AAAA,IAAA;AAEF,WAAO;AAAA,EACT;AAAA,EAEA,mBAAmB,YAA4B;AAC7CD,aAAAA,iBAAiB,eAAe;AAAA,MAC9BC,4BAAAA,cAAc;AAAA,MACd;AAAA,IAAA;AAEF,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,wBACE,iBACA,SACA;AACAD,aAAAA,iBAAiB,WAAW;AAAA,MAC1BC,4BAAAA,cAAc;AAAA,MACd;AAAA,MACA;AAAA,IAAA;AAEF,WAAO;AAAA,EACT;AAAA,EAEA,oCACE,6BACA;AACAD,aAAAA,iBAAiBE,SAAAA,+BAA+B,GAAG;AAAA,MACjDD,4BAAAA,cAAc;AAAA,MACd;AAAA,IAAA;AAEF,WAAO;AAAA,EACT;AACF;AAUO,MAAM,oBAAoB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA,cAAc;AACZ,SAAK,WAAW,IAAI,yBAAA;AACpB,SAAK,OAAO,IAAIF,8BAAA;AAAA,EAClB;AACF;;;;;;;;;;;"}
1
+ {"version":3,"file":"extension-utils-Pd5ntKtv.cjs","sources":["../../../packages/kos-dispense-sdk/src/models/models/holder/utils/holder-utils.ts","../../../packages/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 EXTENSION_FEATURE_FLAG_RESOLVER,\n ExtensionManager,\n ExtensionOptions,\n IndexExtension,\n PropertyMapper,\n type FlagResolver,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport { ExtensionType } from \"../constants\";\nimport { AssemblyTypes, type AssemblyModel } 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 * Registers a data mapper for the {@link IngredientModel}.\n *\n * Ingredient service data often needs properties the base model does not carry. The mapper receives each\n * {@link IngredientResponse} and the data returned by the ingredient loader as context, and its result\n * becomes the model's `data` property.\n *\n * @param ingredientDataMapper - Mapping function that maps an {@link IngredientResponse} into additional model data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n */\n registerIngredientDataMapper(\n ingredientDataMapper: IngredientDataMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.IngredientMapper,\n ingredientDataMapper,\n options\n );\n\n return this;\n }\n\n /**\n * Registers a loader whose result is passed as context to the ingredient data and type mappers.\n *\n * @param ingredientLoader - Async function that loads and returns ingredient context data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on loader failure.\n * Set to `\"continue\"` to log the error and return `undefined` instead.\n * @returns this instance for chaining\n */\n registerIngredientLoader(\n ingredientLoader: DataLoader,\n options?: ExtensionOptions\n ) {\n ExtensionManager.loader.registerLoader(\n ExtensionType.IngredientLoader,\n ingredientLoader,\n options\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 property mapper that derives the `type` property of the {@link IngredientModel}\n * from an {@link IngredientResponse}.\n *\n * @param ingredientTypeMapper - Mapping function that extracts a type string from an {@link IngredientResponse}\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and return a fallback value instead.\n * @returns this instance for chaining\n * */\n registerIngredientTypeMapper(\n ingredientTypeMapper: IngredientTypeMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.IngredientTypeMapper,\n ingredientTypeMapper,\n options\n );\n return this;\n }\n\n /**\n * Registers a data mapper for the {@link HolderModel} model.\n *\n * @param holderDataMapper - Mapping function that maps additional data from a {@link HolderResponse}\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n */\n registerHolderDataMapper(\n holderDataMapper: HolderDataMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.HolderMapper,\n holderDataMapper,\n options\n );\n return this;\n }\n\n /**\n * Registers a property mapper that derives the `type` property of the {@link HolderModel}\n * from a {@link HolderResponse}.\n *\n * @param holderTypeMapper - Mapping function that extracts a type string from a {@link HolderResponse}\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and return a fallback value instead.\n * @returns this instance for chaining\n */\n registerHolderTypeMapper(\n holderTypeMapper: HolderTypeMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.HolderTypeMapper,\n holderTypeMapper,\n options\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 * @param holderTypeMapper - Mapping function that extracts the ingredientId from a {@link HolderResponse}\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and return a fallback value instead.\n * @returns this instance for chaining\n * */\n registerHolderIngredientMapper(\n holderTypeMapper: HolderTypeMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.HolderTypeMapper,\n holderTypeMapper,\n options\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 * Registers a data mapper for the {@link AvailabilityModel}.\n *\n * The mapper receives each availability node, with its `groupId`, and the data returned by the\n * availability loader as context. Its result becomes the model's `data` property.\n *\n * @param availabilityMapper - Mapping function that maps a {@link GroupBeverageResponse} into additional availability data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n *\n * @example\n * ```typescript\n * const beverageDataMapper: AvailabilityDataMapper<BeverageData> = async (\n * data,\n * context?: Record<string, BrandsetIngredient>\n * ) => ({\n * iconUrl: context?.[data.altId]?.icon ?? \"\",\n * });\n * ```\n */\n registerAvailabilityDataMapper(\n availabilityMapper: AvailabilityDataMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.AvailabilityMapper,\n availabilityMapper,\n options\n );\n return this;\n }\n\n /**\n * Registers a loader whose result is passed as context to the availability data mapper. A common use is\n * loading UI-specific brandset data that the backend service does not provide.\n *\n * @param availabilityLoader - Async function that loads and returns availability context data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on loader failure.\n * Set to `\"continue\"` to log the error and return `undefined` instead.\n * @returns this instance for chaining\n *\n * @example\n * ```typescript\n * const beverageContextLoader = async () => {\n * const response = await kosFetch(\"kos:/system/brandset/brandset.json\");\n * const json: BrandsetResponse = await response.json();\n * return Object.fromEntries(json.ingredients.map((i) => [i.ingredientId, i]));\n * };\n * ```\n */\n registerAvailabilityLoader(\n availabilityLoader: DataLoader,\n options?: ExtensionOptions\n ) {\n ExtensionManager.loader.registerLoader(\n ExtensionType.AvailabilityLoader,\n availabilityLoader,\n options\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 * @param selectedPourableMapper - Mapping function that transforms {@link SelectedPourable} data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n * */\n registerSelectedPourableDataMapper(\n selectedPourableMapper: SelectedPourableMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.SelectedPourableMapper,\n selectedPourableMapper,\n options\n );\n return this;\n }\n\n /**\n * Registers a data mapper for the {@link AssemblyModel}, for backends that extend the assembly response\n * with additional properties. The mapper's result is merged into the assembly model.\n *\n * @param assemblyDataMapper - Mapping function that maps an {@link AssemblyTypes.AssemblyResponse} into additional assembly data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n *\n * @example\n * ```typescript\n * interface IceAgitatorExt {\n * iceAgitator?: { name: string; path: string };\n * }\n *\n * const assemblyDataMapper: AssemblyMapper<\n * { iceAgitatorPath?: string },\n * AssemblyTypes.AssemblyResponse<{ AssemblyExt: IceAgitatorExt }>\n * > = async (data) => ({\n * iceAgitatorPath: data.assemblies.find((a) => a.iceAgitator)?.iceAgitator?.path,\n * });\n * ```\n */\n registerAssemblyDataMapper(\n assemblyDataMapper: AssemblyMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.AssemblyMapper,\n assemblyDataMapper,\n options\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 /**\n * Registers a data mapper for the board model within an assembly.\n *\n * @param boardDataMapper - Mapping function that maps an {@link AssemblyTypes.AssemblyBoard} into additional board data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n */\n registerBoardDataMapper(\n boardDataMapper: BoardDataMapper<any, any>,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.BoardMapper,\n boardDataMapper,\n options\n );\n return this;\n }\n\n registerAssemblyFeatureFlagResolver(\n assemblyFeatureFlagResolver: FlagResolver<AssemblyModel>\n ) {\n ExtensionManager[EXTENSION_FEATURE_FLAG_RESOLVER]?.register(\n ExtensionType.AssemblyFeatureFlags,\n assemblyFeatureFlagResolver\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":["useState","useEffect","kosAutoEffect","CoreExtensionManager","ExtensionManager","ExtensionType","EXTENSION_FEATURE_FLAG_RESOLVER"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,MAAM,oBAAoB,CAAC,WAAwB;AACxD,QAAM,CAAC,WAAW,YAAY,IAAIA,MAAAA;AAAAA,IAChC,QAAQ,OAAO,YAAY;AAAA,EAAA;AAE7B,QAAM,CAAC,iBAAiB,kBAAkB,IAAIA,MAAAA;AAAAA,IAC5C,QAAQ,OAAO,gBAAgB;AAAA,EAAA;AAGjC,QAAM,CAAC,cAAc,eAAe,IAAIA,MAAAA;AAAAA,IACtC,QAAQ,OAAO,aAAa;AAAA,EAAA;AAG9B,QAAM,CAAC,oBAAoB,qBAAqB,IAAIA,MAAAA;AAAAA,IAClD,QAAQ,OAAO,iBAAiB;AAAA,EAAA;AAGlC,QAAM,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,IAAA;AAEF,WAAO;AAAA,EACT;AACF;AAUO,MAAM,oBAAoB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA,cAAc;AACZ,SAAK,WAAW,IAAI,yBAAA;AACpB,SAAK,OAAO,IAAIF,8BAAA;AAAA,EAClB;AACF;;;;;;;;;;;"}
package/index.cjs CHANGED
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const kosApiLevels = require("@kosdev-code/kos-api-levels");
4
4
  const utilities = require("@kosdev-code/kos-ui-plugin/utilities");
5
- const dispenseRegistrationManager = require("./dispense-registration-manager-Dtb31fcI.cjs");
6
- const extensionUtils = require("./extension-utils-Cfhe358W.cjs");
7
- const pumpProvider = require("./pump-provider-uNNMh9uh.cjs");
5
+ const dispenseRegistrationManager = require("./dispense-registration-manager-OYGAiIZy.cjs");
6
+ const extensionUtils = require("./extension-utils-Pd5ntKtv.cjs");
7
+ const pumpProvider = require("./pump-provider-BSbTT-BC.cjs");
8
8
  const ControlPourSchema = utilities.createExtensionSchema({}, { rankable: false });
9
9
  const EXTENSION_ID = utilities.extensionPointId("cui", "control", "pour");
10
10
  const ControlPourExtension = utilities.defineExtensionPoint({
@@ -37,6 +37,7 @@ Object.defineProperty(exports, "BoardContainerModel", {
37
37
  });
38
38
  exports.CONTEXT_ASSEMBLY_DATA = dispenseRegistrationManager.CONTEXT_ASSEMBLY_DATA;
39
39
  exports.CONTEXT_ASSEMBLY_RAW_DATA = dispenseRegistrationManager.CONTEXT_ASSEMBLY_RAW_DATA;
40
+ exports.CuiKitState = dispenseRegistrationManager.CuiKitState;
40
41
  exports.DeviceAssembly = dispenseRegistrationManager.DeviceAssembly;
41
42
  exports.DispenseModelType = dispenseRegistrationManager.DispenseModelType;
42
43
  exports.DispenserModels = dispenseRegistrationManager.kosModels;
@@ -48,6 +49,7 @@ exports.Ingredient = dispenseRegistrationManager.Ingredient;
48
49
  exports.IngredientContainer = dispenseRegistrationManager.IngredientContainer;
49
50
  exports.KosModelRegistry = dispenseRegistrationManager.KosModelRegistry;
50
51
  exports.Nozzle = dispenseRegistrationManager.Nozzle;
52
+ exports.PourContext = dispenseRegistrationManager.PourContext;
51
53
  exports.PourState = dispenseRegistrationManager.PourState;
52
54
  exports.Pump = dispenseRegistrationManager.Pump;
53
55
  exports.PumpContainer = dispenseRegistrationManager.PumpContainer;
@@ -58,6 +60,7 @@ exports.TOPIC_GENERIC_POUR_CANCEL = dispenseRegistrationManager.TOPIC_GENERIC_PO
58
60
  exports.TOPIC_GENERIC_POUR_PROGRESS = dispenseRegistrationManager.TOPIC_GENERIC_POUR_PROGRESS;
59
61
  exports.TOPIC_GENERIC_POUR_STARTED = dispenseRegistrationManager.TOPIC_GENERIC_POUR_STARTED;
60
62
  exports.kosModels = dispenseRegistrationManager.kosModels;
63
+ exports.registerCuiKitModels = dispenseRegistrationManager.registerCuiKitModels;
61
64
  exports.registerDispenseModels = dispenseRegistrationManager.registerDispenseModels;
62
65
  exports.AssemblyServices = extensionUtils.index;
63
66
  exports.AssemblyTypes = extensionUtils.assembly;
@@ -86,7 +89,6 @@ exports.HolderProvider = pumpProvider.HolderProvider;
86
89
  exports.IngredientContainerProvider = pumpProvider.IngredientContainerProvider;
87
90
  exports.IngredientProvider = pumpProvider.IngredientProvider;
88
91
  exports.NozzleProvider = pumpProvider.NozzleProvider;
89
- exports.PourContext = pumpProvider.PourContext;
90
92
  exports.PumpProvider = pumpProvider.PumpProvider;
91
93
  exports.TapOrHoldIntentStrategy = pumpProvider.TapOrHoldIntentStrategy;
92
94
  exports.TapToPourIntentStrategy = pumpProvider.TapToPourIntentStrategy;
package/index.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../packages/kos-dispense-sdk/src/extensions/control-pour-extension.ts","../../../packages/kos-dispense-sdk/src/index.ts"],"sourcesContent":["// eslint-disable-next-line @nx/enforce-module-boundaries\nimport type { ValidationContext } from \"@kosdev-code/kos-ui-plugin/utilities\";\nimport {\n createExtensionSchema,\n extensionPointId,\n createViewAwareTransform,\n defineExtensionPoint,\n validateWithSchema,\n} from \"@kosdev-code/kos-ui-plugin/utilities\";\nimport { z } from \"zod\";\n\n// Define the Zod schema for Control Pour contributions\nconst ControlPourSchema = createExtensionSchema({}, { rankable: false });\n\n// Define the control pour types locally\ntype ControlPourDefinition = z.infer<typeof ControlPourSchema>;\n\nconst EXTENSION_ID = extensionPointId(\"cui\", \"control\", \"pour\");\n\n/**\n * Control Pour extension point for beverage dispensing interfaces\n *\n * Allows plugin developers to contribute controlled pour functionality\n * to CUI applications that register this extension point.\n */\nexport const ControlPourExtension = defineExtensionPoint<\n ControlPourDefinition,\n ControlPourDefinition\n>({\n id: EXTENSION_ID,\n contributionKey: \"controlPour\",\n displayName: \"Control Pour\",\n description:\n \"Extension point for controlled pour plugin configurations with view support\",\n hasView: true,\n isRankable: false,\n\n schema: ControlPourSchema,\n metadata: {\n exportName: \"ControlPourExtension\",\n category: \"Dispense\",\n tags: [\"pour\", \"control\", \"beverage\"],\n },\n\n validate: (data: ControlPourDefinition, context: ValidationContext) => {\n // Use Zod validation\n validateWithSchema(ControlPourSchema, data, context);\n },\n\n transform: createViewAwareTransform<ControlPourDefinition>(),\n});\n\n// Export constants for backward compatibility\nexport const EXTENSION_POINT_CONTROL_POUR = EXTENSION_ID;\nexport type { ControlPourDefinition };\n","import { registerApiLevels } from \"@kosdev-code/kos-api-levels\";\n\n// Registers the package-level API integer for this SDK.\n// The per-service catalog (which services changed and why) lives in\n// kos-api-levels/generated/api-archaeology-report.md, produced by the archaeology scanner.\nregisterApiLevels({ \"kos-dispense-sdk\": 16 });\n\nexport * from \"./extensions\";\nexport * from \"./models\";\nexport { kosModels as DispenserModels } from \"./models\";\nexport * from \"./models/models/generic-pour\";\nexport * from \"./ui\";\n"],"names":["createExtensionSchema","extensionPointId","defineExtensionPoint","validateWithSchema","createViewAwareTransform","registerApiLevels"],"mappings":";;;;;;;AAYA,MAAM,oBAAoBA,UAAAA,sBAAsB,CAAA,GAAI,EAAE,UAAU,OAAO;AAKvE,MAAM,eAAeC,UAAAA,iBAAiB,OAAO,WAAW,MAAM;AAQvD,MAAM,uBAAuBC,UAAAA,qBAGlC;AAAA,EACA,IAAI;AAAA,EACJ,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,aACE;AAAA,EACF,SAAS;AAAA,EACT,YAAY;AAAA,EAEZ,QAAQ;AAAA,EACR,UAAU;AAAA,IACR,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,MAAM,CAAC,QAAQ,WAAW,UAAU;AAAA,EAAA;AAAA,EAGtC,UAAU,CAAC,MAA6B,YAA+B;AAErEC,iCAAmB,mBAAmB,MAAM,OAAO;AAAA,EACrD;AAAA,EAEA,WAAWC,UAAAA,yBAAA;AACb,CAAC;AAGM,MAAM,+BAA+B;AChD5CC,aAAAA,kBAAkB,EAAE,oBAAoB,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../packages/kos-dispense-sdk/src/extensions/control-pour-extension.ts","../../../packages/kos-dispense-sdk/src/index.ts"],"sourcesContent":["// eslint-disable-next-line @nx/enforce-module-boundaries\nimport type { ValidationContext } from \"@kosdev-code/kos-ui-plugin/utilities\";\nimport {\n createExtensionSchema,\n extensionPointId,\n createViewAwareTransform,\n defineExtensionPoint,\n validateWithSchema,\n} from \"@kosdev-code/kos-ui-plugin/utilities\";\nimport { z } from \"zod\";\n\n// Define the Zod schema for Control Pour contributions\nconst ControlPourSchema = createExtensionSchema({}, { rankable: false });\n\n// Define the control pour types locally\ntype ControlPourDefinition = z.infer<typeof ControlPourSchema>;\n\nconst EXTENSION_ID = extensionPointId(\"cui\", \"control\", \"pour\");\n\n/**\n * Control Pour extension point for beverage dispensing interfaces\n *\n * Allows plugin developers to contribute controlled pour functionality\n * to CUI applications that register this extension point.\n */\nexport const ControlPourExtension = defineExtensionPoint<\n ControlPourDefinition,\n ControlPourDefinition\n>({\n id: EXTENSION_ID,\n contributionKey: \"controlPour\",\n displayName: \"Control Pour\",\n description:\n \"Extension point for controlled pour plugin configurations with view support\",\n hasView: true,\n isRankable: false,\n\n schema: ControlPourSchema,\n metadata: {\n exportName: \"ControlPourExtension\",\n category: \"Dispense\",\n tags: [\"pour\", \"control\", \"beverage\"],\n },\n\n validate: (data: ControlPourDefinition, context: ValidationContext) => {\n // Use Zod validation\n validateWithSchema(ControlPourSchema, data, context);\n },\n\n transform: createViewAwareTransform<ControlPourDefinition>(),\n});\n\n// Export constants for backward compatibility\nexport const EXTENSION_POINT_CONTROL_POUR = EXTENSION_ID;\nexport type { ControlPourDefinition };\n","import { registerApiLevels } from \"@kosdev-code/kos-api-levels\";\n\n// Registers the package-level API integer for this SDK.\n// The per-service catalog (which services changed and why) lives in\n// kos-api-levels/generated/api-archaeology-report.md, produced by the archaeology scanner.\nregisterApiLevels({ \"kos-dispense-sdk\": 16 });\n\nexport * from \"./extensions\";\nexport * from \"./models\";\nexport { kosModels as DispenserModels } from \"./models\";\nexport * from \"./models/models/generic-pour\";\nexport * from \"./ui\";\n"],"names":["createExtensionSchema","extensionPointId","defineExtensionPoint","validateWithSchema","createViewAwareTransform","registerApiLevels"],"mappings":";;;;;;;AAYA,MAAM,oBAAoBA,UAAAA,sBAAsB,CAAA,GAAI,EAAE,UAAU,OAAO;AAKvE,MAAM,eAAeC,UAAAA,iBAAiB,OAAO,WAAW,MAAM;AAQvD,MAAM,uBAAuBC,UAAAA,qBAGlC;AAAA,EACA,IAAI;AAAA,EACJ,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,aACE;AAAA,EACF,SAAS;AAAA,EACT,YAAY;AAAA,EAEZ,QAAQ;AAAA,EACR,UAAU;AAAA,IACR,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,MAAM,CAAC,QAAQ,WAAW,UAAU;AAAA,EAAA;AAAA,EAGtC,UAAU,CAAC,MAA6B,YAA+B;AAErEC,iCAAmB,mBAAmB,MAAM,OAAO;AAAA,EACrD;AAAA,EAEA,WAAWC,UAAAA,yBAAA;AACb,CAAC;AAGM,MAAM,+BAA+B;AChD5CC,aAAAA,kBAAkB,EAAE,oBAAoB,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { registerApiLevels } from "@kosdev-code/kos-api-levels";
2
2
  import { createExtensionSchema, extensionPointId, defineExtensionPoint, createViewAwareTransform, validateWithSchema } from "@kosdev-code/kos-ui-plugin/utilities";
3
- import { A, a, B, b, c, C, d, D, e, o, E, G, H, f, I, g, K, N, P, h, i, j, T, k, l, m, n, o as o2, r } from "./dispense-registration-manager-Da9CW_cN.js";
4
- import { i as i2, a as a2, D as D2, b as b2, c as c2, d as d2, K as K2, e as e2, f as f2, g as g2 } from "./extension-utils-D_dnBLH6.js";
5
- import { A as A2, a as a3, B as B2, b as b3, C as C2, c as c3, D as D3, d as d3, e as e3, f as f3, H as H2, g as g3, h as h2, i as i3, I as I2, j as j2, N as N2, P as P2, k as k2, T as T2, l as l2, m as m2, n as n2, u, o as o3, p, q, r as r2, s, t, v, w, x, y, z, E as E2, F, G as G2, J, K as K3, L, M, O, Q, R, S, U, V, W, X, Y, Z, _, $, a0, a1, a2 as a22, a3 as a32, a4, a5, a6, a7, a8, a9, aa, ab } from "./pump-provider-BQmCKz7S.js";
3
+ import { A, a, B, b, c, C, d, e, D, f, q, E, G, H, g, I, h, K, N, P, i, j, k, l, T, m, n, o, p, q as q2, r, s } from "./dispense-registration-manager-J59_vyyY.js";
4
+ import { i as i2, a as a2, D as D2, b as b2, c as c2, d as d2, K as K2, e as e2, f as f2, g as g2 } from "./extension-utils-DEM1emOY.js";
5
+ import { A as A2, a as a3, B as B2, b as b3, C as C2, c as c3, D as D3, d as d3, e as e3, f as f3, H as H2, g as g3, h as h2, i as i3, I as I2, j as j2, N as N2, P as P2, T as T2, k as k2, l as l2, m as m2, u, n as n2, o as o2, p as p2, q as q3, r as r2, s as s2, t, v, w, x, y, z, E as E2, F, G as G2, J, K as K3, L, M, O, Q, R, S, U, V, W, X, Y, Z, _, $, a0, a1, a2 as a22, a3 as a32, a4, a5, a6, a7, a8, a9, aa } from "./pump-provider-Ch7NOeRj.js";
6
6
  const ControlPourSchema = createExtensionSchema({}, { rankable: false });
7
7
  const EXTENSION_ID = extensionPointId("cui", "control", "pour");
8
8
  const ControlPourExtension = defineExtensionPoint({
@@ -41,6 +41,7 @@ export {
41
41
  d as CONTEXT_ASSEMBLY_RAW_DATA,
42
42
  ControlPourExtension,
43
43
  C2 as CuiKit,
44
+ e as CuiKitState,
44
45
  c3 as CuiKitWrapper,
45
46
  D3 as DISPENSE_GROUP_BEVERAGE,
46
47
  d3 as DISPENSE_GROUP_BRAND,
@@ -48,8 +49,8 @@ export {
48
49
  D as DeviceAssembly,
49
50
  f3 as DeviceAssemblyProvider,
50
51
  D2 as DispenseExtensionManager,
51
- e as DispenseModelType,
52
- o as DispenserModels,
52
+ f as DispenseModelType,
53
+ q as DispenserModels,
53
54
  EXTENSION_POINT_CONTROL_POUR,
54
55
  E as ExtensionType,
55
56
  G as GenericPour,
@@ -57,12 +58,12 @@ export {
57
58
  H2 as HoldToPourIntentStrategy,
58
59
  g3 as HoldToPourStrategy,
59
60
  H as Holder,
60
- f as HolderContainer,
61
+ g as HolderContainer,
61
62
  h2 as HolderContainerProvider,
62
63
  i3 as HolderProvider,
63
64
  c2 as HolderServices,
64
65
  I as Ingredient,
65
- g as IngredientContainer,
66
+ h as IngredientContainer,
66
67
  I2 as IngredientContainerProvider,
67
68
  j2 as IngredientProvider,
68
69
  d2 as IngredientServices,
@@ -71,67 +72,68 @@ export {
71
72
  N as Nozzle,
72
73
  N2 as NozzleProvider,
73
74
  e2 as NozzleServices,
74
- P2 as PourContext,
75
- P as PourState,
76
- h as Pump,
77
- i as PumpContainer,
78
- j as PumpIndex,
79
- k2 as PumpProvider,
75
+ P as PourContext,
76
+ i as PourState,
77
+ j as Pump,
78
+ k as PumpContainer,
79
+ l as PumpIndex,
80
+ P2 as PumpProvider,
80
81
  f2 as PumpServices,
81
82
  T as TOPIC_BOARD_LINKED,
82
- k as TOPIC_BOARD_UNLINKED,
83
- l as TOPIC_GENERIC_POUR_CANCEL,
84
- m as TOPIC_GENERIC_POUR_PROGRESS,
85
- n as TOPIC_GENERIC_POUR_STARTED,
83
+ m as TOPIC_BOARD_UNLINKED,
84
+ n as TOPIC_GENERIC_POUR_CANCEL,
85
+ o as TOPIC_GENERIC_POUR_PROGRESS,
86
+ p as TOPIC_GENERIC_POUR_STARTED,
86
87
  T2 as TapOrHoldIntentStrategy,
87
- l2 as TapToPourIntentStrategy,
88
- m2 as TapToPourStrategy,
88
+ k2 as TapToPourIntentStrategy,
89
+ l2 as TapToPourStrategy,
89
90
  g2 as getFuelGaugeValue,
90
- n2 as initializeCuiKit,
91
- o2 as kosModels,
92
- r as registerDispenseModels,
91
+ m2 as initializeCuiKit,
92
+ q2 as kosModels,
93
+ r as registerCuiKitModels,
94
+ s as registerDispenseModels,
93
95
  u as useAssembly,
94
- o3 as useAssemblyContext,
95
- p as useAvailability,
96
- q as useAvailabilityContext,
97
- r2 as useBeverages,
98
- s as useBoard,
99
- t as useBoardContainer,
100
- v as useBoardContainerContext,
101
- w as useBoardContext,
102
- x as useBrands,
103
- y as useCuiKit,
104
- z as useCuiKitTimers,
105
- E2 as useDefaultCuiKitLifecycle,
106
- F as useDeviceAssembly,
107
- G2 as useDeviceAssemblyContext,
108
- J as useDispenseLifecycle,
109
- K3 as useFlavors,
110
- L as useGenericPour,
111
- M as useHolder,
112
- O as useHolderContainer,
113
- Q as useHolderContainerContext,
114
- R as useHolderContext,
115
- S as useIngredient,
116
- U as useIngredientContainer,
117
- V as useIngredientContainerContext,
118
- W as useIngredientContext,
119
- X as useIngredientPour,
120
- Y as useNozzle,
121
- Z as useNozzleContext,
122
- _ as useNozzlePour,
123
- $ as usePourTarget,
124
- a0 as usePumpContext,
125
- a1 as withAssembly,
126
- a22 as withBeverage,
127
- a32 as withBoard,
128
- a4 as withBoardContainer,
129
- a5 as withDeviceAssembly,
130
- a6 as withGenericPour,
131
- a7 as withHolder,
132
- a8 as withHolderContainer,
133
- a9 as withIngredient,
134
- aa as withIngredientContainer,
135
- ab as withNozzle
96
+ n2 as useAssemblyContext,
97
+ o2 as useAvailability,
98
+ p2 as useAvailabilityContext,
99
+ q3 as useBeverages,
100
+ r2 as useBoard,
101
+ s2 as useBoardContainer,
102
+ t as useBoardContainerContext,
103
+ v as useBoardContext,
104
+ w as useBrands,
105
+ x as useCuiKit,
106
+ y as useCuiKitTimers,
107
+ z as useDefaultCuiKitLifecycle,
108
+ E2 as useDeviceAssembly,
109
+ F as useDeviceAssemblyContext,
110
+ G2 as useDispenseLifecycle,
111
+ J as useFlavors,
112
+ K3 as useGenericPour,
113
+ L as useHolder,
114
+ M as useHolderContainer,
115
+ O as useHolderContainerContext,
116
+ Q as useHolderContext,
117
+ R as useIngredient,
118
+ S as useIngredientContainer,
119
+ U as useIngredientContainerContext,
120
+ V as useIngredientContext,
121
+ W as useIngredientPour,
122
+ X as useNozzle,
123
+ Y as useNozzleContext,
124
+ Z as useNozzlePour,
125
+ _ as usePourTarget,
126
+ $ as usePumpContext,
127
+ a0 as withAssembly,
128
+ a1 as withBeverage,
129
+ a22 as withBoard,
130
+ a32 as withBoardContainer,
131
+ a4 as withDeviceAssembly,
132
+ a5 as withGenericPour,
133
+ a6 as withHolder,
134
+ a7 as withHolderContainer,
135
+ a8 as withIngredient,
136
+ a9 as withIngredientContainer,
137
+ aa as withNozzle
136
138
  };
137
139
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,131 @@
1
+ import { IKosDataModel, IKosIdentifiable, KosRegistrationFor, PublicModelInterface, KosLoggerAware } from '@kosdev-code/kos-ui-sdk';
2
+ import { PourStrategy } from '../../../ui/hooks/utils/pour-strategy/pour-strategy';
3
+ import { PourContext } from '../../utils/pour-context';
4
+ import { AvailabilityModel } from '../availability/types';
5
+ import { NozzleModel } from '../nozzle';
6
+ import { PourStrategyAware } from '../nozzle/types';
7
+ import { CuiKitGroup, CuiKitStateOptions, CuiKitSteps, CuiPourOptions, CuiPourResult } from './types';
8
+ export declare const MODEL_TYPE = "cui-kit-state-model";
9
+ export type CuiKitStateModel = PublicModelInterface<CuiKitStateModelImpl>;
10
+ export interface CuiKitStateModelImpl extends KosLoggerAware {
11
+ }
12
+ export declare const MODEL_CONFIG: {
13
+ readonly modelTypeId: "cui-kit-state-model";
14
+ readonly singleton: false;
15
+ };
16
+ /** The model id of the CUI Kit driving the nozzle at `nozzlePath`. */
17
+ export declare const cuiKitId: (nozzlePath: string) => string;
18
+ /**
19
+ * The state behind a nozzle's CUI Kit: the step being shown, the selections, and the
20
+ * navigation between steps. `useCuiKit` exposes it to React; the lifecycle events
21
+ * (`/kos/dispense/{nozzlePath}/...`) are published from here.
22
+ *
23
+ * Without `steps`, navigation keeps the original flow: brand → beverage → flavor, with
24
+ * `back()` returning to the start. With `steps`, only the declared steps are shown and
25
+ * `back()` moves to the previous one.
26
+ *
27
+ * @kosService dispense.cui-kit-state
28
+ */
29
+ export declare class CuiKitStateModelImpl implements IKosDataModel, IKosIdentifiable {
30
+ static Registration: KosRegistrationFor<typeof MODEL_CONFIG, CuiKitStateModel, CuiKitStateOptions>;
31
+ id: string;
32
+ nozzlePath: string;
33
+ initialGroup: "brands" | "beverages";
34
+ steps?: CuiKitSteps;
35
+ companionTypes: NonNullable<CuiKitStateOptions["companionTypes"]>;
36
+ currentGroup: CuiKitGroup;
37
+ selectedBrand: AvailabilityModel | null;
38
+ selectedBeverage: AvailabilityModel | null;
39
+ selectedFlavors: AvailabilityModel[];
40
+ pourStrategy?: PourStrategy;
41
+ onPourComplete?: (result: CuiPourResult) => void;
42
+ /** Data passed to the before-pour gate; carries `selectedBeverage`. */
43
+ pourContext: PourContext;
44
+ /** The target of the last pour the kit started. */
45
+ activeTarget?: PourStrategyAware;
46
+ private beforePour?;
47
+ private pressCount;
48
+ private released;
49
+ private lastPourState?;
50
+ private lastPourError?;
51
+ nozzle: NozzleModel;
52
+ constructor(modelId: string, options: CuiKitStateOptions);
53
+ updateModel(options: CuiKitStateOptions): void;
54
+ /** The steps shown, in order. */
55
+ get enabledSteps(): CuiKitGroup[];
56
+ /** The step navigation starts at and `home()` returns to. */
57
+ get firstGroup(): "brands" | "beverages";
58
+ /** The step `back()` moves to, or undefined when there is none. */
59
+ get previousGroup(): CuiKitGroup | undefined;
60
+ get canBack(): boolean;
61
+ get brands(): AvailabilityModel[];
62
+ /** Whether the kit shows a brands step; without `steps` it follows `initialGroup`. */
63
+ get hasBrands(): boolean;
64
+ get beverages(): AvailabilityModel[];
65
+ get flavors(): AvailabilityModel[];
66
+ get brandCompanions(): IKosDataModel[];
67
+ get beverageCompanions(): IKosDataModel[];
68
+ get flavorCompanions(): IKosDataModel[];
69
+ private companionsOf;
70
+ selectBrand(brand: AvailabilityModel, context?: Record<string, any>): void;
71
+ clearBrand(): void;
72
+ selectBeverage(beverage: AvailabilityModel, context?: Record<string, any>, forceUpdate?: boolean): Promise<void>;
73
+ clearBeverage(): Promise<void>;
74
+ /** Toggles a flavor and sends the beverage with the resulting flavors to the nozzle. */
75
+ selectFlavor(flavor: AvailabilityModel, context?: Record<string, any>, forceUpdate?: boolean): Promise<void>;
76
+ clearFlavors(): Promise<void>;
77
+ /** Moves to the previous step. Without `steps`, returns to the start and clears brand and beverage. */
78
+ back(): void;
79
+ /** Returns to the first step and clears the selections. */
80
+ home(): void;
81
+ /** Number of `useCuiKit` hooks attached to this kit. */
82
+ attached: number;
83
+ /**
84
+ * Attaches a `useCuiKit` hook. A nozzle has one kit hook; components read it through
85
+ * the kit's context. Returns false, and logs an error, for a second hook.
86
+ */
87
+ attach(): boolean;
88
+ detach(): void;
89
+ /**
90
+ * Returns the kit to the first step with nothing selected, as a newly mounted kit
91
+ * starts. The nozzle's own selection is left as it is.
92
+ */
93
+ reset(): void;
94
+ /**
95
+ * Moves to the pour step. Only available when `steps.pour` is on. With `start`, also
96
+ * starts a pour; ignored, with a warning, when the pour needs a held button.
97
+ */
98
+ toPour(options?: CuiPourOptions & {
99
+ start?: boolean;
100
+ }): void;
101
+ /** Sets the before-pour gate the kit calls before every pour. */
102
+ setBeforePour(callback?: (context?: PourContext) => Promise<boolean>): void;
103
+ /** Starts a pour without a gesture (a click-to-pour button or an automated pour). */
104
+ startPour(options?: CuiPourOptions): Promise<boolean>;
105
+ /** The press half of a pour gesture; `releasePour` is the release. */
106
+ pressPour(options?: CuiPourOptions): Promise<boolean>;
107
+ /** The release half of a pour gesture. */
108
+ releasePour(options?: CuiPourOptions): void;
109
+ /** Cancels the pour the kit started last. */
110
+ cancelPour(): Promise<void>;
111
+ /** The pour target whose state the kit reports: the last one poured, else the nozzle. */
112
+ get pourTarget(): PourStrategyAware | undefined;
113
+ private strategyFor;
114
+ /**
115
+ * select → prepare → before-pour gate → pour. While the target is pouring nothing is
116
+ * selected; for a gesture, a release before the pour starts stops the sequence.
117
+ */
118
+ private runPour;
119
+ /**
120
+ * Selects a beverage, and its brand first when the kit has a brands step, and waits
121
+ * for the nozzle.
122
+ */
123
+ private selectForPour;
124
+ /** Calls onPourComplete when the pour target returns to idle without being cancelled. */
125
+ trackPourCompletion(): void;
126
+ publishBeverageList(): void;
127
+ private publish;
128
+ init(): Promise<void>;
129
+ }
130
+ export declare const CuiKitState: import('@kosdev-code/kos-ui-sdk').KosModelRegistrationFactory<CuiKitStateModel, CuiKitStateOptions>;
131
+ //# sourceMappingURL=cui-kit-state-model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cui-kit-state-model.d.ts","sourceRoot":"","sources":["../../../../../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,CAAC,WAAW;IAInB;;;OAGG;YACW,OAAO;IA0CrB;;;OAGG;YACW,aAAa;IAY3B,yFAAyF;IAMzF,mBAAmB;IAsBnB,mBAAmB;IAInB,OAAO,CAAC,OAAO;IAMT,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAG5B;AAED,eAAO,MAAM,WAAW,qGAAoC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { CuiKitState } from './cui-kit-state-model';
2
+ export type { CuiKitStateModel } from './cui-kit-state-model';
3
+ export type * from './types';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-dispense-sdk/src/models/models/cui-kit-state/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,mBAAmB,SAAS,CAAC"}