@kosdev-code/kos-dispense-sdk 2.1.22 → 2.1.25

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 (49) hide show
  1. package/{dispense-registration-manager-DEyW37S3.cjs → dispense-registration-manager-BkJ1ggtS.cjs} +2 -2
  2. package/{dispense-registration-manager-DEyW37S3.cjs.map → dispense-registration-manager-BkJ1ggtS.cjs.map} +1 -1
  3. package/{dispense-registration-manager-C36ULeOU.js → dispense-registration-manager-CcFUS_KM.js} +72 -69
  4. package/{dispense-registration-manager-C36ULeOU.js.map → dispense-registration-manager-CcFUS_KM.js.map} +1 -1
  5. package/{extension-utils-C3CjcNm5.cjs → extension-utils-DUV7OQR1.cjs} +2 -2
  6. package/{extension-utils-C3CjcNm5.cjs.map → extension-utils-DUV7OQR1.cjs.map} +1 -1
  7. package/{extension-utils-dTIk56MQ.js → extension-utils-DeLiIgFH.js} +2 -2
  8. package/{extension-utils-dTIk56MQ.js.map → extension-utils-DeLiIgFH.js.map} +1 -1
  9. package/index.cjs +1 -1
  10. package/index.cjs.map +1 -1
  11. package/index.js +112 -113
  12. package/index.js.map +1 -1
  13. package/models/models/generic-pour/generic-pour-model.d.ts +2 -1
  14. package/models/models/generic-pour/generic-pour-model.d.ts.map +1 -1
  15. package/models/models/generic-pour/types/index.d.ts +1 -0
  16. package/models/models/nozzle/index.d.ts +1 -1
  17. package/models/models/nozzle/index.d.ts.map +1 -1
  18. package/models/models/nozzle/nozzle-model.d.ts +2 -2
  19. package/models/models/nozzle/nozzle-model.d.ts.map +1 -1
  20. package/models/models/nozzle/types/index.d.ts +8 -0
  21. package/models.cjs +1 -1
  22. package/models.js +2 -2
  23. package/package.json +4 -4
  24. package/pump-provider-BTnIydH2.js +1302 -0
  25. package/pump-provider-BTnIydH2.js.map +1 -0
  26. package/pump-provider-BUfMtaXv.cjs +2 -0
  27. package/pump-provider-BUfMtaXv.cjs.map +1 -0
  28. package/ui/hooks/cui-kit/dispense-topics.d.ts +47 -0
  29. package/ui/hooks/cui-kit/dispense-topics.d.ts.map +1 -0
  30. package/ui/hooks/cui-kit/use-beverages.d.ts +2 -1
  31. package/ui/hooks/cui-kit/use-beverages.d.ts.map +1 -1
  32. package/ui/hooks/cui-kit/use-cui-kit.d.ts.map +1 -1
  33. package/ui/hooks/cui-kit/use-dispense-lifecycle.d.ts +2 -1
  34. package/ui/hooks/cui-kit/use-dispense-lifecycle.d.ts.map +1 -1
  35. package/ui/hooks/generic-pour/use-generic-pour.d.ts +2 -2
  36. package/ui/hooks/generic-pour/use-generic-pour.d.ts.map +1 -1
  37. package/ui/hooks/pour/use-pour.d.ts +2 -1
  38. package/ui/hooks/pour/use-pour.d.ts.map +1 -1
  39. package/ui/hooks/utils/pour-strategy/hold-to-pour-strategy.d.ts.map +1 -1
  40. package/ui/hooks/utils/pour-strategy/pour-strategy.d.ts +2 -9
  41. package/ui/hooks/utils/pour-strategy/pour-strategy.d.ts.map +1 -1
  42. package/ui/hooks/utils/pour-strategy/tap-to-pour-strategy.d.ts.map +1 -1
  43. package/ui.cjs +1 -1
  44. package/ui.js +67 -68
  45. package/ui.js.map +1 -1
  46. package/pump-provider-BXvrC3jL.js +0 -1304
  47. package/pump-provider-BXvrC3jL.js.map +0 -1
  48. package/pump-provider-Bp45210p.cjs +0 -2
  49. package/pump-provider-Bp45210p.cjs.map +0 -1
@@ -1,2 +1,2 @@
1
- "use strict";var V=Object.defineProperty;var v=(t,e,a)=>e in t?V(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var o=(t,e,a)=>(v(t,typeof e!="symbol"?e+"":e,a),a);const n=require("./dispense-registration-manager-DEyW37S3.cjs"),r=require("@kosdev-code/kos-ui-sdk"),s=require("react"),O=Object.freeze(Object.defineProperty({__proto__:null,getIngredients:n.getIngredients},Symbol.toStringTag,{value:"Module"})),H=Object.freeze(Object.defineProperty({__proto__:null,addAssignment:n.addAssignment,assignHolderIngredient:n.assignHolderIngredient,deleteAssignment:n.deleteAssignment,getAssignments:n.getAssignments,getHolders:n.getHolders,replaceLine:n.replaceLine,sendRfidOverride:n.sendRfidOverride,unassignHolderIngredient:n.unassignHolderIngredient},Symbol.toStringTag,{value:"Module"})),j=Object.freeze(Object.defineProperty({__proto__:null,getAssembly:n.getAssembly},Symbol.toStringTag,{value:"Module"})),D=Object.freeze(Object.defineProperty({__proto__:null,getIntentVolume:n.getIntentVolume,sendIntent:n.sendIntent},Symbol.toStringTag,{value:"Module"})),F=Object.freeze(Object.defineProperty({__proto__:null,clearPourable:n.clearPourable,getAvailability:n.getAvailability,pourNamedPourable:n.pourNamedPourable,pourPourable:n.pourPourable,selectPourable:n.selectPourable},Symbol.toStringTag,{value:"Module"})),R=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),L=Object.freeze(Object.defineProperty({__proto__:null,pourOnTarget:n.pourOnTarget},Symbol.toStringTag,{value:"Module"})),$=t=>{var l,u,M,x;const[e,a]=s.useState(((l=t==null?void 0:t.slice)==null?void 0:l.maxVolMl)??0),[i,m]=s.useState(((u=t==null?void 0:t.slice)==null?void 0:u.currentVolMl)??0),[p,T]=s.useState(((M=t==null?void 0:t.slice)==null?void 0:M.maxVolMl)!==void 0),[g,_]=s.useState(((x=t==null?void 0:t.slice)==null?void 0:x.currentVolMl)!==void 0),[I,S]=s.useState(i<=0?0:Math.floor((i||1)/(e||1)*100)),[f,P]=s.useState(p&&g);return s.useEffect(()=>{const A=r.kosAutoEffect(()=>{var d,c,y,E;a(((d=t==null?void 0:t.slice)==null?void 0:d.maxVolMl)??0),m(((c=t==null?void 0:t.slice)==null?void 0:c.currentVolMl)??0),T(((y=t==null?void 0:t.slice)==null?void 0:y.maxVolMl)!==void 0),_(((E=t==null?void 0:t.slice)==null?void 0:E.currentVolMl)!==void 0),S(i<=0?0:Math.floor((i||1)/(e||1)*100)),P(p&&g)});return()=>{A()}},[t]),{maxVolume:e,remainingVolume:i,fillPercent:I,hasFuelGuage:f}};class b{constructor(){o(this,"core",new r.CoreExtensionManager)}registerIngredientDataMapper(e){return r.ExtensionManager.dataMapper.registerDataMapper(n.ExtensionType.IngredientMapper,e),this}registerIngredientLoader(e){return r.ExtensionManager.loader.registerLoader(n.ExtensionType.IngredientLoader,e),this}registerIngredientIndex(e){return r.ExtensionManager.indexExtension.registerIndexExtension(n.ExtensionType.IngredientIndex,e),this}registerIngredientTypeMapper(e){return r.ExtensionManager.propertyMapper.registerPropertyMapper(n.ExtensionType.IngredientTypeMapper,e),this}registerHolderDataMapper(e){return r.ExtensionManager.dataMapper.registerDataMapper(n.ExtensionType.HolderMapper,e),this}registerHolderTypeMapper(e){return r.ExtensionManager.propertyMapper.registerPropertyMapper(n.ExtensionType.HolderTypeMapper,e),this}registerHolderIngredientMapper(e){return r.ExtensionManager.propertyMapper.registerPropertyMapper(n.ExtensionType.HolderTypeMapper,e),this}registerHolderIndex(e){return r.ExtensionManager.indexExtension.registerIndexExtension(n.ExtensionType.HolderIndex,e),this}registerAvailabilityDataMapper(e){return r.ExtensionManager.dataMapper.registerDataMapper(n.ExtensionType.AvailabilityMapper,e),this}registerAvailabilityLoader(e){return r.ExtensionManager.loader.registerLoader(n.ExtensionType.AvailabilityLoader,e),this}registerSelectedPourableDataMapper(e){return r.ExtensionManager.dataMapper.registerDataMapper(n.ExtensionType.SelectedPourableMapper,e),this}registerAssemblyDataMapper(e){return r.ExtensionManager.dataMapper.registerDataMapper(n.ExtensionType.AssemblyMapper,e),this}registerBoardIndex(e){return r.ExtensionManager.indexExtension.registerIndexExtension(n.ExtensionType.BoardIndex,e),this}registerBoardDataMapper(e){return r.ExtensionManager.dataMapper.registerDataMapper(n.ExtensionType.BoardMapper,e),this}registerAssemblyFeatureFlagResolver(e){var a;return(a=r.ExtensionManager[r.EXTENSION_FEATURE_FLAG_RESOLVER])==null||a.register(n.ExtensionType.AssemblyFeatureFlags,e),this}}class z{constructor(){o(this,"dispense");o(this,"core");this.dispense=new b,this.core=new r.CoreExtensionManager}}exports.DispenseExtensionManager=b;exports.KosExtensionManager=z;exports.assembly=R;exports.getFuelGaugeValue=$;exports.index=j;exports.index$1=L;exports.index$2=H;exports.index$3=O;exports.index$4=F;exports.index$5=D;
2
- //# sourceMappingURL=extension-utils-C3CjcNm5.cjs.map
1
+ "use strict";var V=Object.defineProperty;var v=(t,e,a)=>e in t?V(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var o=(t,e,a)=>(v(t,typeof e!="symbol"?e+"":e,a),a);const n=require("./dispense-registration-manager-BkJ1ggtS.cjs"),r=require("@kosdev-code/kos-ui-sdk"),s=require("react"),O=Object.freeze(Object.defineProperty({__proto__:null,getIngredients:n.getIngredients},Symbol.toStringTag,{value:"Module"})),H=Object.freeze(Object.defineProperty({__proto__:null,addAssignment:n.addAssignment,assignHolderIngredient:n.assignHolderIngredient,deleteAssignment:n.deleteAssignment,getAssignments:n.getAssignments,getHolders:n.getHolders,replaceLine:n.replaceLine,sendRfidOverride:n.sendRfidOverride,unassignHolderIngredient:n.unassignHolderIngredient},Symbol.toStringTag,{value:"Module"})),j=Object.freeze(Object.defineProperty({__proto__:null,getAssembly:n.getAssembly},Symbol.toStringTag,{value:"Module"})),D=Object.freeze(Object.defineProperty({__proto__:null,getIntentVolume:n.getIntentVolume,sendIntent:n.sendIntent},Symbol.toStringTag,{value:"Module"})),F=Object.freeze(Object.defineProperty({__proto__:null,clearPourable:n.clearPourable,getAvailability:n.getAvailability,pourNamedPourable:n.pourNamedPourable,pourPourable:n.pourPourable,selectPourable:n.selectPourable},Symbol.toStringTag,{value:"Module"})),R=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),L=Object.freeze(Object.defineProperty({__proto__:null,pourOnTarget:n.pourOnTarget},Symbol.toStringTag,{value:"Module"})),$=t=>{var l,u,M,x;const[e,a]=s.useState(((l=t==null?void 0:t.slice)==null?void 0:l.maxVolMl)??0),[i,m]=s.useState(((u=t==null?void 0:t.slice)==null?void 0:u.currentVolMl)??0),[p,T]=s.useState(((M=t==null?void 0:t.slice)==null?void 0:M.maxVolMl)!==void 0),[g,_]=s.useState(((x=t==null?void 0:t.slice)==null?void 0:x.currentVolMl)!==void 0),[I,S]=s.useState(i<=0?0:Math.floor((i||1)/(e||1)*100)),[f,P]=s.useState(p&&g);return s.useEffect(()=>{const A=r.kosAutoEffect(()=>{var d,c,y,E;a(((d=t==null?void 0:t.slice)==null?void 0:d.maxVolMl)??0),m(((c=t==null?void 0:t.slice)==null?void 0:c.currentVolMl)??0),T(((y=t==null?void 0:t.slice)==null?void 0:y.maxVolMl)!==void 0),_(((E=t==null?void 0:t.slice)==null?void 0:E.currentVolMl)!==void 0),S(i<=0?0:Math.floor((i||1)/(e||1)*100)),P(p&&g)});return()=>{A()}},[t]),{maxVolume:e,remainingVolume:i,fillPercent:I,hasFuelGuage:f}};class b{constructor(){o(this,"core",new r.CoreExtensionManager)}registerIngredientDataMapper(e){return r.ExtensionManager.dataMapper.registerDataMapper(n.ExtensionType.IngredientMapper,e),this}registerIngredientLoader(e){return r.ExtensionManager.loader.registerLoader(n.ExtensionType.IngredientLoader,e),this}registerIngredientIndex(e){return r.ExtensionManager.indexExtension.registerIndexExtension(n.ExtensionType.IngredientIndex,e),this}registerIngredientTypeMapper(e){return r.ExtensionManager.propertyMapper.registerPropertyMapper(n.ExtensionType.IngredientTypeMapper,e),this}registerHolderDataMapper(e){return r.ExtensionManager.dataMapper.registerDataMapper(n.ExtensionType.HolderMapper,e),this}registerHolderTypeMapper(e){return r.ExtensionManager.propertyMapper.registerPropertyMapper(n.ExtensionType.HolderTypeMapper,e),this}registerHolderIngredientMapper(e){return r.ExtensionManager.propertyMapper.registerPropertyMapper(n.ExtensionType.HolderTypeMapper,e),this}registerHolderIndex(e){return r.ExtensionManager.indexExtension.registerIndexExtension(n.ExtensionType.HolderIndex,e),this}registerAvailabilityDataMapper(e){return r.ExtensionManager.dataMapper.registerDataMapper(n.ExtensionType.AvailabilityMapper,e),this}registerAvailabilityLoader(e){return r.ExtensionManager.loader.registerLoader(n.ExtensionType.AvailabilityLoader,e),this}registerSelectedPourableDataMapper(e){return r.ExtensionManager.dataMapper.registerDataMapper(n.ExtensionType.SelectedPourableMapper,e),this}registerAssemblyDataMapper(e){return r.ExtensionManager.dataMapper.registerDataMapper(n.ExtensionType.AssemblyMapper,e),this}registerBoardIndex(e){return r.ExtensionManager.indexExtension.registerIndexExtension(n.ExtensionType.BoardIndex,e),this}registerBoardDataMapper(e){return r.ExtensionManager.dataMapper.registerDataMapper(n.ExtensionType.BoardMapper,e),this}registerAssemblyFeatureFlagResolver(e){var a;return(a=r.ExtensionManager[r.EXTENSION_FEATURE_FLAG_RESOLVER])==null||a.register(n.ExtensionType.AssemblyFeatureFlags,e),this}}class z{constructor(){o(this,"dispense");o(this,"core");this.dispense=new b,this.core=new r.CoreExtensionManager}}exports.DispenseExtensionManager=b;exports.KosExtensionManager=z;exports.assembly=R;exports.getFuelGaugeValue=$;exports.index=j;exports.index$1=L;exports.index$2=H;exports.index$3=O;exports.index$4=F;exports.index$5=D;
2
+ //# sourceMappingURL=extension-utils-DUV7OQR1.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"extension-utils-C3CjcNm5.cjs","sources":["../../../../packages/sdk/kos-dispense-sdk/src/models/models/holder/utils/holder-utils.ts","../../../../packages/sdk/kos-dispense-sdk/src/models/utils/extension-utils.ts"],"sourcesContent":["import { kosAutoEffect } from \"@kosdev-code/kos-ui-sdk\";\nimport { useEffect, useState } from \"react\";\nimport type { HolderModel } from \"../types\";\n\nexport const getFuelGaugeValue = (holder: HolderModel) => {\n const [maxVolume, setMaxVolume] = useState<number>(\n holder?.slice?.maxVolMl ?? 0\n );\n const [remainingVolume, setRemainingVolume] = useState<number>(\n holder?.slice?.currentVolMl ?? 0\n );\n\n const [hasMaxVolume, setHasMaxVolume] = useState<boolean>(\n holder?.slice?.maxVolMl !== undefined\n );\n\n const [hasRemainingVolume, setHasRemainingVolume] = useState<boolean>(\n holder?.slice?.currentVolMl !== undefined\n );\n\n const [fillPercent, setFillPercent] = useState<number>(\n remainingVolume <= 0\n ? 0\n : Math.floor(((remainingVolume || 1) / (maxVolume || 1)) * 100)\n );\n\n const [hasFuelGuage, setHasFuelGuage] = useState<boolean>(\n hasMaxVolume && hasRemainingVolume\n );\n\n useEffect(() => {\n const disposer = kosAutoEffect(() => {\n setMaxVolume(holder?.slice?.maxVolMl ?? 0);\n setRemainingVolume(holder?.slice?.currentVolMl ?? 0);\n setHasMaxVolume(holder?.slice?.maxVolMl !== undefined);\n setHasRemainingVolume(holder?.slice?.currentVolMl !== undefined);\n setFillPercent(\n remainingVolume <= 0\n ? 0\n : Math.floor(((remainingVolume || 1) / (maxVolume || 1)) * 100)\n );\n setHasFuelGuage(hasMaxVolume && hasRemainingVolume);\n });\n\n return () => {\n disposer();\n };\n }, [holder]);\n\n return { maxVolume, remainingVolume, fillPercent, hasFuelGuage };\n};\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport {\n CoreExtensionManager,\n DataLoader,\n DataMapper,\n EXTENSION_FEATURE_FLAG_RESOLVER,\n ExtensionManager,\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 * Maps data into the {@link IngredientModel}\n *\n * It is common for the ingredient data provided by the ingredient service to be augmented with additional properties that are\n * not provided by the base KOS Ingredient model. The {@link IngredientMapper} extension point allows for the data to be mapped\n * into the {@link IngredientModel} and the {@link IngredientModel.data} property to be augmented with additional properties.\n *\n * @example\n * The following example shows how to map the data from the service response into the {@link IngredientModel}.\n * The context is provided by the {@link IngredientLoader} extension point with its data being used to optionally augment the\n * ingredient data.\n *\n * The result of the mapping will be available in the `data` property of the {@link IngredientModel}.\n *\n * In this case the `IngedientReponseData` interface represents the data being returned by the ingredient service and the\n * `IngredientData` interface represents the data that will be available in the {@link IngredientModel.data} property. The `ingredientDataMapper`\n * is responsible for mapping from one format to the other.\n *\n * ```typescript\n *\n * interface IngredientResponseData extends NozzleServices.IngredientResponse {\n * chilled: boolean;\n * carbonated: boolean;\n * highYield: boolean;\n * }\n *\n * interface IngredientData {\n * chilled: boolean;\n * carbonated: boolean;\n * highYield: boolean;\n * }\n *\n * export const ingredientDataMapper = async (\n * data: IngredientResponseData,\n * context: IngredientContext\n * ): Promise<IngredientData> => {\n * return {\n * chilled: data.chilled,\n * carbonated: data.carbonated,\n * highYield: data.highYield,\n * }\n * }\n * ```\n * */\n registerIngredientDataMapper(ingredientDataMapper: IngredientDataMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.IngredientMapper,\n ingredientDataMapper\n );\n\n return this;\n }\n\n /**\n * Loads data that will be provided as context into the {@link IngredientMapper}\n *\n * @example\n * The following example shows how to load the brandset data, normalize it into a map and then provide it back to the framework\n * where it can be used by the other extension points.\n *\n * In the ingredient container model, the data is provided to the {@link IngredientMapper} extension point in order to augment ingredient data\n * and also loaded into the ingredient container model context in order to make the data available throughout the code.\n *\n * ```typescript\n * export const ingredientContextLoader = async (): Promise<BeverageContext> => {\n * const response = await kosFetch('kos:/system/some/ingredient/endpoint.json');\n *\n * if (response.status !== 200) {\n * KosLog.error('Failed to load ingredient data');\n * return {};\n * }\n * const json = await response.json();\n * return json;\n * };\n * ```\n * */\n registerIngredientLoader(ingredientLoader: DataLoader) {\n ExtensionManager.loader.registerLoader(\n ExtensionType.IngredientLoader,\n ingredientLoader\n );\n return this;\n }\n\n registerIngredientIndex(ingredientIndex: IndexExtension) {\n ExtensionManager.indexExtension.registerIndexExtension(\n ExtensionType.IngredientIndex,\n ingredientIndex\n );\n return this;\n }\n\n /**\n * Registers a data mapper for the {@link IngredientModel}\n * */\n registerIngredientTypeMapper(ingredientTypeMapper: IngredientTypeMapper) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.IngredientTypeMapper,\n ingredientTypeMapper\n );\n return this;\n }\n\n /**\n * Registers a data mapper for the {@link HolderModel} model.\n * @param holderDataMapper - Mapping function that maps additional data from holder service response\n * @returns\n */\n registerHolderDataMapper(holderDataMapper: HolderDataMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.HolderMapper,\n holderDataMapper\n );\n return this;\n }\n\n registerHolderTypeMapper(holderTypeMapper: HolderTypeMapper) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.HolderTypeMapper,\n holderTypeMapper\n );\n return this;\n }\n\n /**\n * Maps the ingredientId property of the holder into the {@link HolderModel}.\n * If not provided, the ingredientId will assume that the value is mapped from the\n * ingredientId property of the service response.\n * */\n registerHolderIngredientMapper(holderTypeMapper: HolderTypeMapper) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.HolderTypeMapper,\n holderTypeMapper\n );\n return this;\n }\n\n registerHolderIndex<T extends HolderModel = HolderModel>(\n holderIndex: IndexExtension<T>\n ) {\n ExtensionManager.indexExtension.registerIndexExtension(\n ExtensionType.HolderIndex,\n holderIndex\n );\n return this;\n }\n\n /**\n * Maps data into the {@link AvailabilityModel}\n *\n * @example\n * The following example shows how to map the data from the service response into the {@link AvailabilityModel}.\n * The context is provided by the {@link AvailabilityLoader} extension point with its data being used to augment the\n * availability data.\n *\n * The result of the mapping will be available in the `data` property of the {@link AvailabilityModel}.\n *\n * ```typescript\n * export const beverageDataMapper = async (\n * data: NozzleServices.BeverageResponse,\n * context: BeverageContext\n * ): Promise<BeverageData> => {\n * const id = data.altId;\n * const iconUrl = encodeURI(\n * `http://localhost:8081/system/brandset/${context?.[id]?.icon}`\n * );\n * const cuiColorCode = context?.[id]?.cuiColorCode\n * ? context?.[id]?.cuiColorCode\n * : '';\n * return { iconUrl, cuiColorCode };\n * };\n * ```\n * */\n registerAvailabilityDataMapper(availabilityMapper: AvailabilityDataMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.AvailabilityMapper,\n availabilityMapper\n );\n return this;\n }\n\n /**\n * Loads data that will be provided as context into the {@link AvailabilityMapper}\n *\n * @example\n * A common use case is to load brandset data that is UI specific and not provided directly by the Java service.\n *\n * The following example shows how to load the brandset data, normalize it into a map and then provide it back to the framework\n * where it can be used by the other extension points.\n *\n * In the nozzle model, the data is provided to the {@link AvailabilityMapper} extension point in order to augment availability data\n * and also loaded into the nozzle model context in order to make the data available throughout the code.\n *\n * ```typescript\n * export const beverageContextLoader = async (): Promise<BeverageContext> => {\n * const response = await kosFetch('kos:/system/brandset/brandset.json');\n *\n * if (response.status !== 200) {\n * KosLog.error('Failed to load beverage data');\n * return {};\n * }\n * const json: BrandsetResponse | null = await response.json();\n * const initialBeverages: Record<string, BrandsetIngredient> = {};\n * const beverages = json?.ingredients?.reduce((acc, beverage) => {\n * acc[beverage.ingredientId] = beverage;\n * return acc;\n * }, initialBeverages);\n * return beverages;\n * };\n * ```\n * */\n registerAvailabilityLoader(availabilityLoader: DataLoader) {\n ExtensionManager.loader.registerLoader(\n ExtensionType.AvailabilityLoader,\n availabilityLoader\n );\n return this;\n }\n\n /**\n * Maps the abstract {@link SelectedPourable} data into a format that is specific to the nozzle.\n * */\n registerSelectedPourableDataMapper(\n selectedPourableMapper: SelectedPourableMapper\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.SelectedPourableMapper,\n selectedPourableMapper\n );\n return this;\n }\n\n /**\n * Maps data into the {@link AssemblyModel} data.\n * Used in cases where the base assembly has been extended with additional properties in the backend. This extension\n * point allows for the data to be mapped into the {@link AssemblyModel} and augmented with additional properties.\n *\n * @example\n *\n * In this example of an implementation of a {@link AssemblyMapper}, the {@link AssemblyResponse} data is mapped into\n * a {@link FreestyleAssembly} object.\n *\n * The {@link FreestyleAssemblyResponse} interface represents the additional data being returned by the assembly service and is\n * merged into the {@link AssemblyResponse} interface.\n *\n * The {@link FreestyleAssembly} interface represents the additional data, beyond the base data set, that will be merged into the {@link AssemblyModel}.\n *\n * The mapper is responsible for mapping from the {@link FreestyleAssemblyResponse} format to the {@link FreestyleAssembly} format.\n * ```typescript\n * import { AssemblyTypes } from \"@kosdev-code/kos-dispense-sdk\";\n * import { DataMapper } from \"@kosdev-code/kos-ui-sdk\";\n *\n * // define the additional data being returned by the assembly service\n * export interface FreestyleAssemblyResponse {\n * iceAgitator?: {\n * name: \"iceAgitator\";\n * path: string;\n * };\n * }\n *\n * // define the additional data structure that will be merged into the assembly model\n * export interface FreestyleAssembly {\n * iceAgitator: {\n * path: string;\n * };\n * carbAgitator: {\n * path: string;\n * };\n * }\n *\n *\n * // define the mapper that will map the data from the service response into the additional data structure\n * // that will be merged into the assembly model.\n * // In this case the mapper is responsible for mapping from the {@link FreestyleAssemblyResponse} format to the {@link FreestyleAssembly} format.\n * export const assemblyDataMapper: DataMapper<\n * AssemblyTypes.AssemblyResponse<FreestyleAssemblyResponse>,\n * FreestyleAssembly\n * > = async (data) => {\n * const response = data.assemblies.reduce((acc, assembly) => {\n * const agitatorKeys = [\"iceAgitator\", \"carbAgitator\"];\n * agitatorKeys.forEach((key) => {\n * const agitator = assembly[key];\n * if (agitator) {\n * acc[key] = agitator;\n * }\n * });\n *\n * return acc;\n * }, {} as FreestyleAssembly);\n * return response;\n * };\n *```\n */\n registerAssemblyDataMapper(assemblyDataMapper: AssemblyMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.AssemblyMapper,\n assemblyDataMapper\n );\n return this;\n }\n\n registerBoardIndex(boardIndex: IndexExtension) {\n ExtensionManager.indexExtension.registerIndexExtension(\n ExtensionType.BoardIndex,\n boardIndex\n );\n return this;\n }\n\n registerBoardDataMapper(boardDataMapper: BoardDataMapper<any, any>) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.BoardMapper,\n boardDataMapper\n );\n return this;\n }\n\n 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":["getFuelGaugeValue","holder","maxVolume","setMaxVolume","useState","_a","remainingVolume","setRemainingVolume","_b","hasMaxVolume","setHasMaxVolume","_c","hasRemainingVolume","setHasRemainingVolume","_d","fillPercent","setFillPercent","hasFuelGuage","setHasFuelGuage","useEffect","disposer","kosAutoEffect","DispenseExtensionManager","__publicField","CoreExtensionManager","ingredientDataMapper","ExtensionManager","ExtensionType","ingredientLoader","ingredientIndex","ingredientTypeMapper","holderDataMapper","holderTypeMapper","holderIndex","availabilityMapper","availabilityLoader","selectedPourableMapper","assemblyDataMapper","boardIndex","boardDataMapper","assemblyFeatureFlagResolver","EXTENSION_FEATURE_FLAG_RESOLVER","KosExtensionManager"],"mappings":"sgDAIaA,EAAqBC,GAAwB,aACxD,KAAM,CAACC,EAAWC,CAAY,EAAIC,EAAAA,WAChCC,EAAAJ,GAAA,YAAAA,EAAQ,QAAR,YAAAI,EAAe,WAAY,CAAA,EAEvB,CAACC,EAAiBC,CAAkB,EAAIH,EAAAA,WAC5CI,EAAAP,GAAA,YAAAA,EAAQ,QAAR,YAAAO,EAAe,eAAgB,CAAA,EAG3B,CAACC,EAAcC,CAAe,EAAIN,EAAAA,WACtCO,EAAAV,GAAA,YAAAA,EAAQ,QAAR,YAAAU,EAAe,YAAa,MAAA,EAGxB,CAACC,EAAoBC,CAAqB,EAAIT,EAAAA,WAClDU,EAAAb,GAAA,YAAAA,EAAQ,QAAR,YAAAa,EAAe,gBAAiB,MAAA,EAG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A,cAAc,qBACda,GAEK,IACT,CACF,CAUO,MAAME,CAAoB,CAG/B,aAAc,CAFdnB,EAAA,iBACAA,EAAA,aAEE,KAAK,SAAW,IAAID,EACpB,KAAK,KAAO,IAAIE,sBAClB,CACF"}
1
+ {"version":3,"file":"extension-utils-DUV7OQR1.cjs","sources":["../../../../packages/sdk/kos-dispense-sdk/src/models/models/holder/utils/holder-utils.ts","../../../../packages/sdk/kos-dispense-sdk/src/models/utils/extension-utils.ts"],"sourcesContent":["import { kosAutoEffect } from \"@kosdev-code/kos-ui-sdk\";\nimport { useEffect, useState } from \"react\";\nimport type { HolderModel } from \"../types\";\n\nexport const getFuelGaugeValue = (holder: HolderModel) => {\n const [maxVolume, setMaxVolume] = useState<number>(\n holder?.slice?.maxVolMl ?? 0\n );\n const [remainingVolume, setRemainingVolume] = useState<number>(\n holder?.slice?.currentVolMl ?? 0\n );\n\n const [hasMaxVolume, setHasMaxVolume] = useState<boolean>(\n holder?.slice?.maxVolMl !== undefined\n );\n\n const [hasRemainingVolume, setHasRemainingVolume] = useState<boolean>(\n holder?.slice?.currentVolMl !== undefined\n );\n\n const [fillPercent, setFillPercent] = useState<number>(\n remainingVolume <= 0\n ? 0\n : Math.floor(((remainingVolume || 1) / (maxVolume || 1)) * 100)\n );\n\n const [hasFuelGuage, setHasFuelGuage] = useState<boolean>(\n hasMaxVolume && hasRemainingVolume\n );\n\n useEffect(() => {\n const disposer = kosAutoEffect(() => {\n setMaxVolume(holder?.slice?.maxVolMl ?? 0);\n setRemainingVolume(holder?.slice?.currentVolMl ?? 0);\n setHasMaxVolume(holder?.slice?.maxVolMl !== undefined);\n setHasRemainingVolume(holder?.slice?.currentVolMl !== undefined);\n setFillPercent(\n remainingVolume <= 0\n ? 0\n : Math.floor(((remainingVolume || 1) / (maxVolume || 1)) * 100)\n );\n setHasFuelGuage(hasMaxVolume && hasRemainingVolume);\n });\n\n return () => {\n disposer();\n };\n }, [holder]);\n\n return { maxVolume, remainingVolume, fillPercent, hasFuelGuage };\n};\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport {\n CoreExtensionManager,\n DataLoader,\n DataMapper,\n EXTENSION_FEATURE_FLAG_RESOLVER,\n ExtensionManager,\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 * Maps data into the {@link IngredientModel}\n *\n * It is common for the ingredient data provided by the ingredient service to be augmented with additional properties that are\n * not provided by the base KOS Ingredient model. The {@link IngredientMapper} extension point allows for the data to be mapped\n * into the {@link IngredientModel} and the {@link IngredientModel.data} property to be augmented with additional properties.\n *\n * @example\n * The following example shows how to map the data from the service response into the {@link IngredientModel}.\n * The context is provided by the {@link IngredientLoader} extension point with its data being used to optionally augment the\n * ingredient data.\n *\n * The result of the mapping will be available in the `data` property of the {@link IngredientModel}.\n *\n * In this case the `IngedientReponseData` interface represents the data being returned by the ingredient service and the\n * `IngredientData` interface represents the data that will be available in the {@link IngredientModel.data} property. The `ingredientDataMapper`\n * is responsible for mapping from one format to the other.\n *\n * ```typescript\n *\n * interface IngredientResponseData extends NozzleServices.IngredientResponse {\n * chilled: boolean;\n * carbonated: boolean;\n * highYield: boolean;\n * }\n *\n * interface IngredientData {\n * chilled: boolean;\n * carbonated: boolean;\n * highYield: boolean;\n * }\n *\n * export const ingredientDataMapper = async (\n * data: IngredientResponseData,\n * context: IngredientContext\n * ): Promise<IngredientData> => {\n * return {\n * chilled: data.chilled,\n * carbonated: data.carbonated,\n * highYield: data.highYield,\n * }\n * }\n * ```\n * */\n registerIngredientDataMapper(ingredientDataMapper: IngredientDataMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.IngredientMapper,\n ingredientDataMapper\n );\n\n return this;\n }\n\n /**\n * Loads data that will be provided as context into the {@link IngredientMapper}\n *\n * @example\n * The following example shows how to load the brandset data, normalize it into a map and then provide it back to the framework\n * where it can be used by the other extension points.\n *\n * In the ingredient container model, the data is provided to the {@link IngredientMapper} extension point in order to augment ingredient data\n * and also loaded into the ingredient container model context in order to make the data available throughout the code.\n *\n * ```typescript\n * export const ingredientContextLoader = async (): Promise<BeverageContext> => {\n * const response = await kosFetch('kos:/system/some/ingredient/endpoint.json');\n *\n * if (response.status !== 200) {\n * KosLog.error('Failed to load ingredient data');\n * return {};\n * }\n * const json = await response.json();\n * return json;\n * };\n * ```\n * */\n registerIngredientLoader(ingredientLoader: DataLoader) {\n ExtensionManager.loader.registerLoader(\n ExtensionType.IngredientLoader,\n ingredientLoader\n );\n return this;\n }\n\n registerIngredientIndex(ingredientIndex: IndexExtension) {\n ExtensionManager.indexExtension.registerIndexExtension(\n ExtensionType.IngredientIndex,\n ingredientIndex\n );\n return this;\n }\n\n /**\n * Registers a data mapper for the {@link IngredientModel}\n * */\n registerIngredientTypeMapper(ingredientTypeMapper: IngredientTypeMapper) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.IngredientTypeMapper,\n ingredientTypeMapper\n );\n return this;\n }\n\n /**\n * Registers a data mapper for the {@link HolderModel} model.\n * @param holderDataMapper - Mapping function that maps additional data from holder service response\n * @returns\n */\n registerHolderDataMapper(holderDataMapper: HolderDataMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.HolderMapper,\n holderDataMapper\n );\n return this;\n }\n\n registerHolderTypeMapper(holderTypeMapper: HolderTypeMapper) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.HolderTypeMapper,\n holderTypeMapper\n );\n return this;\n }\n\n /**\n * Maps the ingredientId property of the holder into the {@link HolderModel}.\n * If not provided, the ingredientId will assume that the value is mapped from the\n * ingredientId property of the service response.\n * */\n registerHolderIngredientMapper(holderTypeMapper: HolderTypeMapper) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.HolderTypeMapper,\n holderTypeMapper\n );\n return this;\n }\n\n registerHolderIndex<T extends HolderModel = HolderModel>(\n holderIndex: IndexExtension<T>\n ) {\n ExtensionManager.indexExtension.registerIndexExtension(\n ExtensionType.HolderIndex,\n holderIndex\n );\n return this;\n }\n\n /**\n * Maps data into the {@link AvailabilityModel}\n *\n * @example\n * The following example shows how to map the data from the service response into the {@link AvailabilityModel}.\n * The context is provided by the {@link AvailabilityLoader} extension point with its data being used to augment the\n * availability data.\n *\n * The result of the mapping will be available in the `data` property of the {@link AvailabilityModel}.\n *\n * ```typescript\n * export const beverageDataMapper = async (\n * data: NozzleServices.BeverageResponse,\n * context: BeverageContext\n * ): Promise<BeverageData> => {\n * const id = data.altId;\n * const iconUrl = encodeURI(\n * `http://localhost:8081/system/brandset/${context?.[id]?.icon}`\n * );\n * const cuiColorCode = context?.[id]?.cuiColorCode\n * ? context?.[id]?.cuiColorCode\n * : '';\n * return { iconUrl, cuiColorCode };\n * };\n * ```\n * */\n registerAvailabilityDataMapper(availabilityMapper: AvailabilityDataMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.AvailabilityMapper,\n availabilityMapper\n );\n return this;\n }\n\n /**\n * Loads data that will be provided as context into the {@link AvailabilityMapper}\n *\n * @example\n * A common use case is to load brandset data that is UI specific and not provided directly by the Java service.\n *\n * The following example shows how to load the brandset data, normalize it into a map and then provide it back to the framework\n * where it can be used by the other extension points.\n *\n * In the nozzle model, the data is provided to the {@link AvailabilityMapper} extension point in order to augment availability data\n * and also loaded into the nozzle model context in order to make the data available throughout the code.\n *\n * ```typescript\n * export const beverageContextLoader = async (): Promise<BeverageContext> => {\n * const response = await kosFetch('kos:/system/brandset/brandset.json');\n *\n * if (response.status !== 200) {\n * KosLog.error('Failed to load beverage data');\n * return {};\n * }\n * const json: BrandsetResponse | null = await response.json();\n * const initialBeverages: Record<string, BrandsetIngredient> = {};\n * const beverages = json?.ingredients?.reduce((acc, beverage) => {\n * acc[beverage.ingredientId] = beverage;\n * return acc;\n * }, initialBeverages);\n * return beverages;\n * };\n * ```\n * */\n registerAvailabilityLoader(availabilityLoader: DataLoader) {\n ExtensionManager.loader.registerLoader(\n ExtensionType.AvailabilityLoader,\n availabilityLoader\n );\n return this;\n }\n\n /**\n * Maps the abstract {@link SelectedPourable} data into a format that is specific to the nozzle.\n * */\n registerSelectedPourableDataMapper(\n selectedPourableMapper: SelectedPourableMapper\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.SelectedPourableMapper,\n selectedPourableMapper\n );\n return this;\n }\n\n /**\n * Maps data into the {@link AssemblyModel} data.\n * Used in cases where the base assembly has been extended with additional properties in the backend. This extension\n * point allows for the data to be mapped into the {@link AssemblyModel} and augmented with additional properties.\n *\n * @example\n *\n * In this example of an implementation of a {@link AssemblyMapper}, the {@link AssemblyResponse} data is mapped into\n * a {@link FreestyleAssembly} object.\n *\n * The {@link FreestyleAssemblyResponse} interface represents the additional data being returned by the assembly service and is\n * merged into the {@link AssemblyResponse} interface.\n *\n * The {@link FreestyleAssembly} interface represents the additional data, beyond the base data set, that will be merged into the {@link AssemblyModel}.\n *\n * The mapper is responsible for mapping from the {@link FreestyleAssemblyResponse} format to the {@link FreestyleAssembly} format.\n * ```typescript\n * import { AssemblyTypes } from \"@kosdev-code/kos-dispense-sdk\";\n * import { DataMapper } from \"@kosdev-code/kos-ui-sdk\";\n *\n * // define the additional data being returned by the assembly service\n * export interface FreestyleAssemblyResponse {\n * iceAgitator?: {\n * name: \"iceAgitator\";\n * path: string;\n * };\n * }\n *\n * // define the additional data structure that will be merged into the assembly model\n * export interface FreestyleAssembly {\n * iceAgitator: {\n * path: string;\n * };\n * carbAgitator: {\n * path: string;\n * };\n * }\n *\n *\n * // define the mapper that will map the data from the service response into the additional data structure\n * // that will be merged into the assembly model.\n * // In this case the mapper is responsible for mapping from the {@link FreestyleAssemblyResponse} format to the {@link FreestyleAssembly} format.\n * export const assemblyDataMapper: DataMapper<\n * AssemblyTypes.AssemblyResponse<FreestyleAssemblyResponse>,\n * FreestyleAssembly\n * > = async (data) => {\n * const response = data.assemblies.reduce((acc, assembly) => {\n * const agitatorKeys = [\"iceAgitator\", \"carbAgitator\"];\n * agitatorKeys.forEach((key) => {\n * const agitator = assembly[key];\n * if (agitator) {\n * acc[key] = agitator;\n * }\n * });\n *\n * return acc;\n * }, {} as FreestyleAssembly);\n * return response;\n * };\n *```\n */\n registerAssemblyDataMapper(assemblyDataMapper: AssemblyMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.AssemblyMapper,\n assemblyDataMapper\n );\n return this;\n }\n\n registerBoardIndex(boardIndex: IndexExtension) {\n ExtensionManager.indexExtension.registerIndexExtension(\n ExtensionType.BoardIndex,\n boardIndex\n );\n return this;\n }\n\n registerBoardDataMapper(boardDataMapper: BoardDataMapper<any, any>) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.BoardMapper,\n boardDataMapper\n );\n return this;\n }\n\n 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":["getFuelGaugeValue","holder","maxVolume","setMaxVolume","useState","_a","remainingVolume","setRemainingVolume","_b","hasMaxVolume","setHasMaxVolume","_c","hasRemainingVolume","setHasRemainingVolume","_d","fillPercent","setFillPercent","hasFuelGuage","setHasFuelGuage","useEffect","disposer","kosAutoEffect","DispenseExtensionManager","__publicField","CoreExtensionManager","ingredientDataMapper","ExtensionManager","ExtensionType","ingredientLoader","ingredientIndex","ingredientTypeMapper","holderDataMapper","holderTypeMapper","holderIndex","availabilityMapper","availabilityLoader","selectedPourableMapper","assemblyDataMapper","boardIndex","boardDataMapper","assemblyFeatureFlagResolver","EXTENSION_FEATURE_FLAG_RESOLVER","KosExtensionManager"],"mappings":"sgDAIaA,EAAqBC,GAAwB,aACxD,KAAM,CAACC,EAAWC,CAAY,EAAIC,EAAAA,WAChCC,EAAAJ,GAAA,YAAAA,EAAQ,QAAR,YAAAI,EAAe,WAAY,CAAA,EAEvB,CAACC,EAAiBC,CAAkB,EAAIH,EAAAA,WAC5CI,EAAAP,GAAA,YAAAA,EAAQ,QAAR,YAAAO,EAAe,eAAgB,CAAA,EAG3B,CAACC,EAAcC,CAAe,EAAIN,EAAAA,WACtCO,EAAAV,GAAA,YAAAA,EAAQ,QAAR,YAAAU,EAAe,YAAa,MAAA,EAGxB,CAACC,EAAoBC,CAAqB,EAAIT,EAAAA,WAClDU,EAAAb,GAAA,YAAAA,EAAQ,QAAR,YAAAa,EAAe,gBAAiB,MAAA,EAG5B,CAACC,EAAaC,CAAc,EAAIZ,EAAAA,SACpCE,GAAmB,EACf,EACA,KAAK,OAAQA,GAAmB,IAAMJ,GAAa,GAAM,GAAG,CAAA,EAG5D,CAACe,EAAcC,CAAe,EAAId,EAAAA,SACtCK,GAAgBG,CAAA,EAGlBO,OAAAA,EAAAA,UAAU,IAAM,CACd,MAAMC,EAAWC,EAAAA,cAAc,IAAM,aACnClB,IAAaE,EAAAJ,GAAA,YAAAA,EAAQ,QAAR,YAAAI,EAAe,WAAY,CAAC,EACzCE,IAAmBC,EAAAP,GAAA,YAAAA,EAAQ,QAAR,YAAAO,EAAe,eAAgB,CAAC,EACnDE,IAAgBC,EAAAV,GAAA,YAAAA,EAAQ,QAAR,YAAAU,EAAe,YAAa,MAAS,EACrDE,IAAsBC,EAAAb,GAAA,YAAAA,EAAQ,QAAR,YAAAa,EAAe,gBAAiB,MAAS,EAC/DE,EACEV,GAAmB,EACf,E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ACdO,CAAA,EAEK,IACT,CAgCA,2BAA2BC,EAAgC,CACzDT,OAAAA,EAAAA,iBAAiB,OAAO,eACtBC,EAAAA,cAAc,mBACdQ,CAAA,EAEK,IACT,CAKA,mCACEC,EACA,CACAV,OAAAA,EAAAA,iBAAiB,WAAW,mBAC1BC,EAAAA,cAAc,uBACdS,CAAA,EAEK,IACT,CA+DA,2BAA2BC,EAAoC,CAC7DX,OAAAA,EAAAA,iBAAiB,WAAW,mBAC1BC,EAAAA,cAAc,eACdU,CAAA,EAEK,IACT,CAEA,mBAAmBC,EAA4B,CAC7CZ,OAAAA,EAAAA,iBAAiB,eAAe,uBAC9BC,EAAAA,cAAc,WACdW,CAAA,EAEK,IACT,CAEA,wBAAwBC,EAA4C,CAClEb,OAAAA,EAAAA,iBAAiB,WAAW,mBAC1BC,EAAAA,cAAc,YACdY,CAAA,EAEK,IACT,CAEA,oCACEC,EACA,OACAd,OAAAA,EAAAA,EAAAA,iBAAiBe,EAAAA,+BAA+B,IAAhDf,MAAAA,EAAmD,SACjDC,EAAAA,cAAc,qBACda,GAEK,IACT,CACF,CAUO,MAAME,CAAoB,CAG/B,aAAc,CAFdnB,EAAA,iBACAA,EAAA,aAEE,KAAK,SAAW,IAAID,EACpB,KAAK,KAAO,IAAIE,sBAClB,CACF"}
@@ -1,7 +1,7 @@
1
1
  var P = Object.defineProperty;
2
2
  var A = (r, e, s) => e in r ? P(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s;
3
3
  var p = (r, e, s) => (A(r, typeof e != "symbol" ? e + "" : e, s), s);
4
- import { p as T, q as j, s as D, t as H, u as F, v as L, w as R, x as z, y as $, z as w, F as B, J as G, L as N, M as K, O as k, Q as q, R as C, S as J, E as t } from "./dispense-registration-manager-C36ULeOU.js";
4
+ import { p as T, q as j, s as D, t as H, u as F, v as L, w as R, x as z, y as $, z as w, F as B, J as G, L as N, M as K, O as k, Q as q, R as C, S as J, E as t } from "./dispense-registration-manager-CcFUS_KM.js";
5
5
  import { kosAutoEffect as Q, CoreExtensionManager as y, ExtensionManager as a, EXTENSION_FEATURE_FLAG_RESOLVER as U } from "@kosdev-code/kos-ui-sdk";
6
6
  import { useState as n, useEffect as X } from "react";
7
7
  const re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -378,4 +378,4 @@ export {
378
378
  oe as g,
379
379
  ae as i
380
380
  };
381
- //# sourceMappingURL=extension-utils-dTIk56MQ.js.map
381
+ //# sourceMappingURL=extension-utils-DeLiIgFH.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"extension-utils-dTIk56MQ.js","sources":["../../../../packages/sdk/kos-dispense-sdk/src/models/models/holder/utils/holder-utils.ts","../../../../packages/sdk/kos-dispense-sdk/src/models/utils/extension-utils.ts"],"sourcesContent":["import { kosAutoEffect } from \"@kosdev-code/kos-ui-sdk\";\nimport { useEffect, useState } from \"react\";\nimport type { HolderModel } from \"../types\";\n\nexport const getFuelGaugeValue = (holder: HolderModel) => {\n const [maxVolume, setMaxVolume] = useState<number>(\n holder?.slice?.maxVolMl ?? 0\n );\n const [remainingVolume, setRemainingVolume] = useState<number>(\n holder?.slice?.currentVolMl ?? 0\n );\n\n const [hasMaxVolume, setHasMaxVolume] = useState<boolean>(\n holder?.slice?.maxVolMl !== undefined\n );\n\n const [hasRemainingVolume, setHasRemainingVolume] = useState<boolean>(\n holder?.slice?.currentVolMl !== undefined\n );\n\n const [fillPercent, setFillPercent] = useState<number>(\n remainingVolume <= 0\n ? 0\n : Math.floor(((remainingVolume || 1) / (maxVolume || 1)) * 100)\n );\n\n const [hasFuelGuage, setHasFuelGuage] = useState<boolean>(\n hasMaxVolume && hasRemainingVolume\n );\n\n useEffect(() => {\n const disposer = kosAutoEffect(() => {\n setMaxVolume(holder?.slice?.maxVolMl ?? 0);\n setRemainingVolume(holder?.slice?.currentVolMl ?? 0);\n setHasMaxVolume(holder?.slice?.maxVolMl !== undefined);\n setHasRemainingVolume(holder?.slice?.currentVolMl !== undefined);\n setFillPercent(\n remainingVolume <= 0\n ? 0\n : Math.floor(((remainingVolume || 1) / (maxVolume || 1)) * 100)\n );\n setHasFuelGuage(hasMaxVolume && hasRemainingVolume);\n });\n\n return () => {\n disposer();\n };\n }, [holder]);\n\n return { maxVolume, remainingVolume, fillPercent, hasFuelGuage };\n};\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport {\n CoreExtensionManager,\n DataLoader,\n DataMapper,\n EXTENSION_FEATURE_FLAG_RESOLVER,\n ExtensionManager,\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 * Maps data into the {@link IngredientModel}\n *\n * It is common for the ingredient data provided by the ingredient service to be augmented with additional properties that are\n * not provided by the base KOS Ingredient model. The {@link IngredientMapper} extension point allows for the data to be mapped\n * into the {@link IngredientModel} and the {@link IngredientModel.data} property to be augmented with additional properties.\n *\n * @example\n * The following example shows how to map the data from the service response into the {@link IngredientModel}.\n * The context is provided by the {@link IngredientLoader} extension point with its data being used to optionally augment the\n * ingredient data.\n *\n * The result of the mapping will be available in the `data` property of the {@link IngredientModel}.\n *\n * In this case the `IngedientReponseData` interface represents the data being returned by the ingredient service and the\n * `IngredientData` interface represents the data that will be available in the {@link IngredientModel.data} property. The `ingredientDataMapper`\n * is responsible for mapping from one format to the other.\n *\n * ```typescript\n *\n * interface IngredientResponseData extends NozzleServices.IngredientResponse {\n * chilled: boolean;\n * carbonated: boolean;\n * highYield: boolean;\n * }\n *\n * interface IngredientData {\n * chilled: boolean;\n * carbonated: boolean;\n * highYield: boolean;\n * }\n *\n * export const ingredientDataMapper = async (\n * data: IngredientResponseData,\n * context: IngredientContext\n * ): Promise<IngredientData> => {\n * return {\n * chilled: data.chilled,\n * carbonated: data.carbonated,\n * highYield: data.highYield,\n * }\n * }\n * ```\n * */\n registerIngredientDataMapper(ingredientDataMapper: IngredientDataMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.IngredientMapper,\n ingredientDataMapper\n );\n\n return this;\n }\n\n /**\n * Loads data that will be provided as context into the {@link IngredientMapper}\n *\n * @example\n * The following example shows how to load the brandset data, normalize it into a map and then provide it back to the framework\n * where it can be used by the other extension points.\n *\n * In the ingredient container model, the data is provided to the {@link IngredientMapper} extension point in order to augment ingredient data\n * and also loaded into the ingredient container model context in order to make the data available throughout the code.\n *\n * ```typescript\n * export const ingredientContextLoader = async (): Promise<BeverageContext> => {\n * const response = await kosFetch('kos:/system/some/ingredient/endpoint.json');\n *\n * if (response.status !== 200) {\n * KosLog.error('Failed to load ingredient data');\n * return {};\n * }\n * const json = await response.json();\n * return json;\n * };\n * ```\n * */\n registerIngredientLoader(ingredientLoader: DataLoader) {\n ExtensionManager.loader.registerLoader(\n ExtensionType.IngredientLoader,\n ingredientLoader\n );\n return this;\n }\n\n registerIngredientIndex(ingredientIndex: IndexExtension) {\n ExtensionManager.indexExtension.registerIndexExtension(\n ExtensionType.IngredientIndex,\n ingredientIndex\n );\n return this;\n }\n\n /**\n * Registers a data mapper for the {@link IngredientModel}\n * */\n registerIngredientTypeMapper(ingredientTypeMapper: IngredientTypeMapper) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.IngredientTypeMapper,\n ingredientTypeMapper\n );\n return this;\n }\n\n /**\n * Registers a data mapper for the {@link HolderModel} model.\n * @param holderDataMapper - Mapping function that maps additional data from holder service response\n * @returns\n */\n registerHolderDataMapper(holderDataMapper: HolderDataMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.HolderMapper,\n holderDataMapper\n );\n return this;\n }\n\n registerHolderTypeMapper(holderTypeMapper: HolderTypeMapper) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.HolderTypeMapper,\n holderTypeMapper\n );\n return this;\n }\n\n /**\n * Maps the ingredientId property of the holder into the {@link HolderModel}.\n * If not provided, the ingredientId will assume that the value is mapped from the\n * ingredientId property of the service response.\n * */\n registerHolderIngredientMapper(holderTypeMapper: HolderTypeMapper) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.HolderTypeMapper,\n holderTypeMapper\n );\n return this;\n }\n\n registerHolderIndex<T extends HolderModel = HolderModel>(\n holderIndex: IndexExtension<T>\n ) {\n ExtensionManager.indexExtension.registerIndexExtension(\n ExtensionType.HolderIndex,\n holderIndex\n );\n return this;\n }\n\n /**\n * Maps data into the {@link AvailabilityModel}\n *\n * @example\n * The following example shows how to map the data from the service response into the {@link AvailabilityModel}.\n * The context is provided by the {@link AvailabilityLoader} extension point with its data being used to augment the\n * availability data.\n *\n * The result of the mapping will be available in the `data` property of the {@link AvailabilityModel}.\n *\n * ```typescript\n * export const beverageDataMapper = async (\n * data: NozzleServices.BeverageResponse,\n * context: BeverageContext\n * ): Promise<BeverageData> => {\n * const id = data.altId;\n * const iconUrl = encodeURI(\n * `http://localhost:8081/system/brandset/${context?.[id]?.icon}`\n * );\n * const cuiColorCode = context?.[id]?.cuiColorCode\n * ? context?.[id]?.cuiColorCode\n * : '';\n * return { iconUrl, cuiColorCode };\n * };\n * ```\n * */\n registerAvailabilityDataMapper(availabilityMapper: AvailabilityDataMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.AvailabilityMapper,\n availabilityMapper\n );\n return this;\n }\n\n /**\n * Loads data that will be provided as context into the {@link AvailabilityMapper}\n *\n * @example\n * A common use case is to load brandset data that is UI specific and not provided directly by the Java service.\n *\n * The following example shows how to load the brandset data, normalize it into a map and then provide it back to the framework\n * where it can be used by the other extension points.\n *\n * In the nozzle model, the data is provided to the {@link AvailabilityMapper} extension point in order to augment availability data\n * and also loaded into the nozzle model context in order to make the data available throughout the code.\n *\n * ```typescript\n * export const beverageContextLoader = async (): Promise<BeverageContext> => {\n * const response = await kosFetch('kos:/system/brandset/brandset.json');\n *\n * if (response.status !== 200) {\n * KosLog.error('Failed to load beverage data');\n * return {};\n * }\n * const json: BrandsetResponse | null = await response.json();\n * const initialBeverages: Record<string, BrandsetIngredient> = {};\n * const beverages = json?.ingredients?.reduce((acc, beverage) => {\n * acc[beverage.ingredientId] = beverage;\n * return acc;\n * }, initialBeverages);\n * return beverages;\n * };\n * ```\n * */\n registerAvailabilityLoader(availabilityLoader: DataLoader) {\n ExtensionManager.loader.registerLoader(\n ExtensionType.AvailabilityLoader,\n availabilityLoader\n );\n return this;\n }\n\n /**\n * Maps the abstract {@link SelectedPourable} data into a format that is specific to the nozzle.\n * */\n registerSelectedPourableDataMapper(\n selectedPourableMapper: SelectedPourableMapper\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.SelectedPourableMapper,\n selectedPourableMapper\n );\n return this;\n }\n\n /**\n * Maps data into the {@link AssemblyModel} data.\n * Used in cases where the base assembly has been extended with additional properties in the backend. This extension\n * point allows for the data to be mapped into the {@link AssemblyModel} and augmented with additional properties.\n *\n * @example\n *\n * In this example of an implementation of a {@link AssemblyMapper}, the {@link AssemblyResponse} data is mapped into\n * a {@link FreestyleAssembly} object.\n *\n * The {@link FreestyleAssemblyResponse} interface represents the additional data being returned by the assembly service and is\n * merged into the {@link AssemblyResponse} interface.\n *\n * The {@link FreestyleAssembly} interface represents the additional data, beyond the base data set, that will be merged into the {@link AssemblyModel}.\n *\n * The mapper is responsible for mapping from the {@link FreestyleAssemblyResponse} format to the {@link FreestyleAssembly} format.\n * ```typescript\n * import { AssemblyTypes } from \"@kosdev-code/kos-dispense-sdk\";\n * import { DataMapper } from \"@kosdev-code/kos-ui-sdk\";\n *\n * // define the additional data being returned by the assembly service\n * export interface FreestyleAssemblyResponse {\n * iceAgitator?: {\n * name: \"iceAgitator\";\n * path: string;\n * };\n * }\n *\n * // define the additional data structure that will be merged into the assembly model\n * export interface FreestyleAssembly {\n * iceAgitator: {\n * path: string;\n * };\n * carbAgitator: {\n * path: string;\n * };\n * }\n *\n *\n * // define the mapper that will map the data from the service response into the additional data structure\n * // that will be merged into the assembly model.\n * // In this case the mapper is responsible for mapping from the {@link FreestyleAssemblyResponse} format to the {@link FreestyleAssembly} format.\n * export const assemblyDataMapper: DataMapper<\n * AssemblyTypes.AssemblyResponse<FreestyleAssemblyResponse>,\n * FreestyleAssembly\n * > = async (data) => {\n * const response = data.assemblies.reduce((acc, assembly) => {\n * const agitatorKeys = [\"iceAgitator\", \"carbAgitator\"];\n * agitatorKeys.forEach((key) => {\n * const agitator = assembly[key];\n * if (agitator) {\n * acc[key] = agitator;\n * }\n * });\n *\n * return acc;\n * }, {} as FreestyleAssembly);\n * return response;\n * };\n *```\n */\n registerAssemblyDataMapper(assemblyDataMapper: AssemblyMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.AssemblyMapper,\n assemblyDataMapper\n );\n return this;\n }\n\n registerBoardIndex(boardIndex: IndexExtension) {\n ExtensionManager.indexExtension.registerIndexExtension(\n ExtensionType.BoardIndex,\n boardIndex\n );\n return this;\n }\n\n registerBoardDataMapper(boardDataMapper: BoardDataMapper<any, any>) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.BoardMapper,\n boardDataMapper\n );\n return this;\n }\n\n 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":["getFuelGaugeValue","holder","maxVolume","setMaxVolume","useState","_a","remainingVolume","setRemainingVolume","_b","hasMaxVolume","setHasMaxVolume","_c","hasRemainingVolume","setHasRemainingVolume","_d","fillPercent","setFillPercent","hasFuelGuage","setHasFuelGuage","useEffect","disposer","kosAutoEffect","DispenseExtensionManager","__publicField","CoreExtensionManager","ingredientDataMapper","ExtensionManager","ExtensionType","ingredientLoader","ingredientIndex","ingredientTypeMapper","holderDataMapper","holderTypeMapper","holderIndex","availabilityMapper","availabilityLoader","selectedPourableMapper","assemblyDataMapper","boardIndex","boardDataMapper","assemblyFeatureFlagResolver","EXTENSION_FEATURE_FLAG_RESOLVER","KosExtensionManager"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8CAIaA,KAAoB,CAACC,MAAwB;;AACxD,QAAM,CAACC,GAAWC,CAAY,IAAIC;AAAA,MAChCC,IAAAJ,KAAA,gBAAAA,EAAQ,UAAR,gBAAAI,EAAe,aAAY;AAAA,EAAA,GAEvB,CAACC,GAAiBC,CAAkB,IAAIH;AAAA,MAC5CI,IAAAP,KAAA,gBAAAA,EAAQ,UAAR,gBAAAO,EAAe,iBAAgB;AAAA,EAAA,GAG3B,CAACC,GAAcC,CAAe,IAAIN;AAAA,MACtCO,IAAAV,KAAA,gBAAAA,EAAQ,UAAR,gBAAAU,EAAe,cAAa;AAAA,EAAA,GAGxB,CAACC,GAAoBC,CAAqB,IAAIT;AAAA,MAClDU,IAAAb,KAAA,gBAAAA,EAAQ,UAAR,gBAAAa,EAAe,kBAAiB;AAAA,EAAA,GAG5B,CAACC,GAAaC,CAAc,IAAIZ;AAAA,IACpCE,KAAmB,IACf,IACA,KAAK,OAAQA,KAAmB,MAAMJ,KAAa,KAAM,GAAG;AAAA,EAAA,GAG5D,CAACe,GAAcC,CAAe,IAAId;AAAA,IACtCK,KAAgBG;AAAA,EAAA;AAGlB,SAAAO,EAAU,MAAM;AACd,UAAMC,IAAWC,EAAc,MAAM;;AACnC,MAAAlB,IAAaE,IAAAJ,KAAA,gBAAAA,EAAQ,UAAR,gBAAAI,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AAEE,SAAK,WAAW,IAAID,EAAA,GACpB,KAAK,OAAO,IAAIE,EAAA;AAAA,EAClB;AACF;"}
1
+ {"version":3,"file":"extension-utils-DeLiIgFH.js","sources":["../../../../packages/sdk/kos-dispense-sdk/src/models/models/holder/utils/holder-utils.ts","../../../../packages/sdk/kos-dispense-sdk/src/models/utils/extension-utils.ts"],"sourcesContent":["import { kosAutoEffect } from \"@kosdev-code/kos-ui-sdk\";\nimport { useEffect, useState } from \"react\";\nimport type { HolderModel } from \"../types\";\n\nexport const getFuelGaugeValue = (holder: HolderModel) => {\n const [maxVolume, setMaxVolume] = useState<number>(\n holder?.slice?.maxVolMl ?? 0\n );\n const [remainingVolume, setRemainingVolume] = useState<number>(\n holder?.slice?.currentVolMl ?? 0\n );\n\n const [hasMaxVolume, setHasMaxVolume] = useState<boolean>(\n holder?.slice?.maxVolMl !== undefined\n );\n\n const [hasRemainingVolume, setHasRemainingVolume] = useState<boolean>(\n holder?.slice?.currentVolMl !== undefined\n );\n\n const [fillPercent, setFillPercent] = useState<number>(\n remainingVolume <= 0\n ? 0\n : Math.floor(((remainingVolume || 1) / (maxVolume || 1)) * 100)\n );\n\n const [hasFuelGuage, setHasFuelGuage] = useState<boolean>(\n hasMaxVolume && hasRemainingVolume\n );\n\n useEffect(() => {\n const disposer = kosAutoEffect(() => {\n setMaxVolume(holder?.slice?.maxVolMl ?? 0);\n setRemainingVolume(holder?.slice?.currentVolMl ?? 0);\n setHasMaxVolume(holder?.slice?.maxVolMl !== undefined);\n setHasRemainingVolume(holder?.slice?.currentVolMl !== undefined);\n setFillPercent(\n remainingVolume <= 0\n ? 0\n : Math.floor(((remainingVolume || 1) / (maxVolume || 1)) * 100)\n );\n setHasFuelGuage(hasMaxVolume && hasRemainingVolume);\n });\n\n return () => {\n disposer();\n };\n }, [holder]);\n\n return { maxVolume, remainingVolume, fillPercent, hasFuelGuage };\n};\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport {\n CoreExtensionManager,\n DataLoader,\n DataMapper,\n EXTENSION_FEATURE_FLAG_RESOLVER,\n ExtensionManager,\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 * Maps data into the {@link IngredientModel}\n *\n * It is common for the ingredient data provided by the ingredient service to be augmented with additional properties that are\n * not provided by the base KOS Ingredient model. The {@link IngredientMapper} extension point allows for the data to be mapped\n * into the {@link IngredientModel} and the {@link IngredientModel.data} property to be augmented with additional properties.\n *\n * @example\n * The following example shows how to map the data from the service response into the {@link IngredientModel}.\n * The context is provided by the {@link IngredientLoader} extension point with its data being used to optionally augment the\n * ingredient data.\n *\n * The result of the mapping will be available in the `data` property of the {@link IngredientModel}.\n *\n * In this case the `IngedientReponseData` interface represents the data being returned by the ingredient service and the\n * `IngredientData` interface represents the data that will be available in the {@link IngredientModel.data} property. The `ingredientDataMapper`\n * is responsible for mapping from one format to the other.\n *\n * ```typescript\n *\n * interface IngredientResponseData extends NozzleServices.IngredientResponse {\n * chilled: boolean;\n * carbonated: boolean;\n * highYield: boolean;\n * }\n *\n * interface IngredientData {\n * chilled: boolean;\n * carbonated: boolean;\n * highYield: boolean;\n * }\n *\n * export const ingredientDataMapper = async (\n * data: IngredientResponseData,\n * context: IngredientContext\n * ): Promise<IngredientData> => {\n * return {\n * chilled: data.chilled,\n * carbonated: data.carbonated,\n * highYield: data.highYield,\n * }\n * }\n * ```\n * */\n registerIngredientDataMapper(ingredientDataMapper: IngredientDataMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.IngredientMapper,\n ingredientDataMapper\n );\n\n return this;\n }\n\n /**\n * Loads data that will be provided as context into the {@link IngredientMapper}\n *\n * @example\n * The following example shows how to load the brandset data, normalize it into a map and then provide it back to the framework\n * where it can be used by the other extension points.\n *\n * In the ingredient container model, the data is provided to the {@link IngredientMapper} extension point in order to augment ingredient data\n * and also loaded into the ingredient container model context in order to make the data available throughout the code.\n *\n * ```typescript\n * export const ingredientContextLoader = async (): Promise<BeverageContext> => {\n * const response = await kosFetch('kos:/system/some/ingredient/endpoint.json');\n *\n * if (response.status !== 200) {\n * KosLog.error('Failed to load ingredient data');\n * return {};\n * }\n * const json = await response.json();\n * return json;\n * };\n * ```\n * */\n registerIngredientLoader(ingredientLoader: DataLoader) {\n ExtensionManager.loader.registerLoader(\n ExtensionType.IngredientLoader,\n ingredientLoader\n );\n return this;\n }\n\n registerIngredientIndex(ingredientIndex: IndexExtension) {\n ExtensionManager.indexExtension.registerIndexExtension(\n ExtensionType.IngredientIndex,\n ingredientIndex\n );\n return this;\n }\n\n /**\n * Registers a data mapper for the {@link IngredientModel}\n * */\n registerIngredientTypeMapper(ingredientTypeMapper: IngredientTypeMapper) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.IngredientTypeMapper,\n ingredientTypeMapper\n );\n return this;\n }\n\n /**\n * Registers a data mapper for the {@link HolderModel} model.\n * @param holderDataMapper - Mapping function that maps additional data from holder service response\n * @returns\n */\n registerHolderDataMapper(holderDataMapper: HolderDataMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.HolderMapper,\n holderDataMapper\n );\n return this;\n }\n\n registerHolderTypeMapper(holderTypeMapper: HolderTypeMapper) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.HolderTypeMapper,\n holderTypeMapper\n );\n return this;\n }\n\n /**\n * Maps the ingredientId property of the holder into the {@link HolderModel}.\n * If not provided, the ingredientId will assume that the value is mapped from the\n * ingredientId property of the service response.\n * */\n registerHolderIngredientMapper(holderTypeMapper: HolderTypeMapper) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.HolderTypeMapper,\n holderTypeMapper\n );\n return this;\n }\n\n registerHolderIndex<T extends HolderModel = HolderModel>(\n holderIndex: IndexExtension<T>\n ) {\n ExtensionManager.indexExtension.registerIndexExtension(\n ExtensionType.HolderIndex,\n holderIndex\n );\n return this;\n }\n\n /**\n * Maps data into the {@link AvailabilityModel}\n *\n * @example\n * The following example shows how to map the data from the service response into the {@link AvailabilityModel}.\n * The context is provided by the {@link AvailabilityLoader} extension point with its data being used to augment the\n * availability data.\n *\n * The result of the mapping will be available in the `data` property of the {@link AvailabilityModel}.\n *\n * ```typescript\n * export const beverageDataMapper = async (\n * data: NozzleServices.BeverageResponse,\n * context: BeverageContext\n * ): Promise<BeverageData> => {\n * const id = data.altId;\n * const iconUrl = encodeURI(\n * `http://localhost:8081/system/brandset/${context?.[id]?.icon}`\n * );\n * const cuiColorCode = context?.[id]?.cuiColorCode\n * ? context?.[id]?.cuiColorCode\n * : '';\n * return { iconUrl, cuiColorCode };\n * };\n * ```\n * */\n registerAvailabilityDataMapper(availabilityMapper: AvailabilityDataMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.AvailabilityMapper,\n availabilityMapper\n );\n return this;\n }\n\n /**\n * Loads data that will be provided as context into the {@link AvailabilityMapper}\n *\n * @example\n * A common use case is to load brandset data that is UI specific and not provided directly by the Java service.\n *\n * The following example shows how to load the brandset data, normalize it into a map and then provide it back to the framework\n * where it can be used by the other extension points.\n *\n * In the nozzle model, the data is provided to the {@link AvailabilityMapper} extension point in order to augment availability data\n * and also loaded into the nozzle model context in order to make the data available throughout the code.\n *\n * ```typescript\n * export const beverageContextLoader = async (): Promise<BeverageContext> => {\n * const response = await kosFetch('kos:/system/brandset/brandset.json');\n *\n * if (response.status !== 200) {\n * KosLog.error('Failed to load beverage data');\n * return {};\n * }\n * const json: BrandsetResponse | null = await response.json();\n * const initialBeverages: Record<string, BrandsetIngredient> = {};\n * const beverages = json?.ingredients?.reduce((acc, beverage) => {\n * acc[beverage.ingredientId] = beverage;\n * return acc;\n * }, initialBeverages);\n * return beverages;\n * };\n * ```\n * */\n registerAvailabilityLoader(availabilityLoader: DataLoader) {\n ExtensionManager.loader.registerLoader(\n ExtensionType.AvailabilityLoader,\n availabilityLoader\n );\n return this;\n }\n\n /**\n * Maps the abstract {@link SelectedPourable} data into a format that is specific to the nozzle.\n * */\n registerSelectedPourableDataMapper(\n selectedPourableMapper: SelectedPourableMapper\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.SelectedPourableMapper,\n selectedPourableMapper\n );\n return this;\n }\n\n /**\n * Maps data into the {@link AssemblyModel} data.\n * Used in cases where the base assembly has been extended with additional properties in the backend. This extension\n * point allows for the data to be mapped into the {@link AssemblyModel} and augmented with additional properties.\n *\n * @example\n *\n * In this example of an implementation of a {@link AssemblyMapper}, the {@link AssemblyResponse} data is mapped into\n * a {@link FreestyleAssembly} object.\n *\n * The {@link FreestyleAssemblyResponse} interface represents the additional data being returned by the assembly service and is\n * merged into the {@link AssemblyResponse} interface.\n *\n * The {@link FreestyleAssembly} interface represents the additional data, beyond the base data set, that will be merged into the {@link AssemblyModel}.\n *\n * The mapper is responsible for mapping from the {@link FreestyleAssemblyResponse} format to the {@link FreestyleAssembly} format.\n * ```typescript\n * import { AssemblyTypes } from \"@kosdev-code/kos-dispense-sdk\";\n * import { DataMapper } from \"@kosdev-code/kos-ui-sdk\";\n *\n * // define the additional data being returned by the assembly service\n * export interface FreestyleAssemblyResponse {\n * iceAgitator?: {\n * name: \"iceAgitator\";\n * path: string;\n * };\n * }\n *\n * // define the additional data structure that will be merged into the assembly model\n * export interface FreestyleAssembly {\n * iceAgitator: {\n * path: string;\n * };\n * carbAgitator: {\n * path: string;\n * };\n * }\n *\n *\n * // define the mapper that will map the data from the service response into the additional data structure\n * // that will be merged into the assembly model.\n * // In this case the mapper is responsible for mapping from the {@link FreestyleAssemblyResponse} format to the {@link FreestyleAssembly} format.\n * export const assemblyDataMapper: DataMapper<\n * AssemblyTypes.AssemblyResponse<FreestyleAssemblyResponse>,\n * FreestyleAssembly\n * > = async (data) => {\n * const response = data.assemblies.reduce((acc, assembly) => {\n * const agitatorKeys = [\"iceAgitator\", \"carbAgitator\"];\n * agitatorKeys.forEach((key) => {\n * const agitator = assembly[key];\n * if (agitator) {\n * acc[key] = agitator;\n * }\n * });\n *\n * return acc;\n * }, {} as FreestyleAssembly);\n * return response;\n * };\n *```\n */\n registerAssemblyDataMapper(assemblyDataMapper: AssemblyMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.AssemblyMapper,\n assemblyDataMapper\n );\n return this;\n }\n\n registerBoardIndex(boardIndex: IndexExtension) {\n ExtensionManager.indexExtension.registerIndexExtension(\n ExtensionType.BoardIndex,\n boardIndex\n );\n return this;\n }\n\n registerBoardDataMapper(boardDataMapper: BoardDataMapper<any, any>) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.BoardMapper,\n boardDataMapper\n );\n return this;\n }\n\n 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":["getFuelGaugeValue","holder","maxVolume","setMaxVolume","useState","_a","remainingVolume","setRemainingVolume","_b","hasMaxVolume","setHasMaxVolume","_c","hasRemainingVolume","setHasRemainingVolume","_d","fillPercent","setFillPercent","hasFuelGuage","setHasFuelGuage","useEffect","disposer","kosAutoEffect","DispenseExtensionManager","__publicField","CoreExtensionManager","ingredientDataMapper","ExtensionManager","ExtensionType","ingredientLoader","ingredientIndex","ingredientTypeMapper","holderDataMapper","holderTypeMapper","holderIndex","availabilityMapper","availabilityLoader","selected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AA,IAAA,GAEK;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;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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA+DA,2BAA2BC,GAAoC;AAC7D,WAAAX,EAAiB,WAAW;AAAA,MAC1BC,EAAc;AAAA,MACdU;AAAA,IAAA,GAEK;AAAA,EACT;AAAA,EAEA,mBAAmBC,GAA4B;AAC7C,WAAAZ,EAAiB,eAAe;AAAA,MAC9BC,EAAc;AAAA,MACdW;AAAA,IAAA,GAEK;AAAA,EACT;AAAA,EAEA,wBAAwBC,GAA4C;AAClE,WAAAb,EAAiB,WAAW;AAAA,MAC1BC,EAAc;AAAA,MACdY;AAAA,IAAA,GAEK;AAAA,EACT;AAAA,EAEA,oCACEC,GACA;;AACA,YAAAnC,IAAAqB,EAAiBe,CAA+B,MAAhD,QAAApC,EAAmD;AAAA,MACjDsB,EAAc;AAAA,MACda;AAAA,OAEK;AAAA,EACT;AACF;AAUO,MAAME,GAAoB;AAAA,EAG/B,cAAc;AAFd,IAAAnB,EAAA;AACA,IAAAA,EAAA;AAEE,SAAK,WAAW,IAAID,EAAA,GACpB,KAAK,OAAO,IAAIE,EAAA;AAAA,EAClB;AACF;"}
package/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./dispense-registration-manager-DEyW37S3.cjs"),o=require("./extension-utils-C3CjcNm5.cjs"),e=require("./pump-provider-Bp45210p.cjs"),i=require("@kosdev-code/kos-ui-plugin/utilities");require("@kosdev-code/kos-ui-sdk");require("react");require("@emotion/react/jsx-runtime");require("@kosdev-code/kos-dispense-sdk");const t=i.createExtensionSchema({},{rankable:!1}),n=i.extensionPointId("cui","control","pour"),u=i.defineExtensionPoint({id:n,contributionKey:"controlPour",displayName:"Control Pour",description:"Extension point for controlled pour plugin configurations with view support",hasView:!0,isRankable:!1,schema:t,metadata:{exportName:"ControlPourExtension",category:"Dispense",tags:["pour","control","beverage"]},validate:(s,a)=>{i.validateWithSchema(t,s,a)},transform:i.createViewAwareTransform()}),d=n;exports.Assembly=r.Assembly;exports.Availability=r.Availability;exports.Board=r.Board;exports.BoardContainer=r.BoardContainer;Object.defineProperty(exports,"BoardContainerModel",{enumerable:!0,get:()=>r.BoardContainerModel});exports.CONTEXT_ASSEMBLY_DATA=r.CONTEXT_ASSEMBLY_DATA;exports.CONTEXT_ASSEMBLY_RAW_DATA=r.CONTEXT_ASSEMBLY_RAW_DATA;exports.DeviceAssembly=r.DeviceAssembly;exports.DispenseModelType=r.DispenseModelType;exports.DispenserModels=r.kosModels;exports.ExtensionType=r.ExtensionType;exports.GenericPour=r.GenericPour;exports.Holder=r.Holder;exports.HolderContainer=r.HolderContainer;exports.Ingredient=r.Ingredient;exports.IngredientContainer=r.IngredientContainer;exports.KosModelRegistry=r.KosModelRegistry;exports.Nozzle=r.Nozzle;exports.PourState=r.PourState;exports.Pump=r.Pump;exports.PumpContainer=r.PumpContainer;exports.PumpIndex=r.PumpIndex;exports.TOPIC_BOARD_LINKED=r.TOPIC_BOARD_LINKED;exports.TOPIC_BOARD_UNLINKED=r.TOPIC_BOARD_UNLINKED;exports.TOPIC_GENERIC_POUR_CANCEL=r.TOPIC_GENERIC_POUR_CANCEL;exports.TOPIC_GENERIC_POUR_PROGRESS=r.TOPIC_GENERIC_POUR_PROGRESS;exports.TOPIC_GENERIC_POUR_STARTED=r.TOPIC_GENERIC_POUR_STARTED;exports.kosModels=r.kosModels;exports.registerDispenseModels=r.registerDispenseModels;exports.AssemblyServices=o.index;exports.AssemblyTypes=o.assembly;exports.DispenseExtensionManager=o.DispenseExtensionManager;exports.GenericPourServices=o.index$1;exports.HolderServices=o.index$2;exports.IngredientServices=o.index$3;exports.KosExtensionManager=o.KosExtensionManager;exports.NozzleServices=o.index$4;exports.PumpServices=o.index$5;exports.getFuelGaugeValue=o.getFuelGaugeValue;exports.AssemblyProvider=e.AssemblyProvider;exports.AvailabilityProvider=e.AvailabilityProvider;exports.BoardContainerProvider=e.BoardContainerProvider;exports.BoardProvider=e.BoardProvider;exports.CuiKit=e.CuiKit;exports.CuiKitWrapper=e.CuiKitWrapper;exports.DISPENSE_GROUP_BEVERAGE=e.DISPENSE_GROUP_BEVERAGE;exports.DISPENSE_GROUP_BRAND=e.DISPENSE_GROUP_BRAND;exports.DISPENSE_GROUP_FLAVOR=e.DISPENSE_GROUP_FLAVOR;exports.DeviceAssemblyProvider=e.DeviceAssemblyProvider;exports.HoldToPourIntentStrategy=e.HoldToPourIntentStrategy;exports.HoldToPourStrategy=e.HoldToPourStrategy;exports.HolderContainerProvider=e.HolderContainerProvider;exports.HolderProvider=e.HolderProvider;exports.IngredientContainerProvider=e.IngredientContainerProvider;exports.IngredientProvider=e.IngredientProvider;exports.NozzleProvider=e.NozzleProvider;exports.PourContext=e.PourContext;exports.PumpProvider=e.PumpProvider;exports.TapOrHoldIntentStrategy=e.TapOrHoldIntentStrategy;exports.TapToPourIntentStrategy=e.TapToPourIntentStrategy;exports.TapToPourStrategy=e.TapToPourStrategy;exports.initializeCuiKit=e.initializeCuiKit;exports.useAssembly=e.useAssembly;exports.useAssemblyContext=e.useAssemblyContext;exports.useAvailability=e.useAvailability;exports.useAvailabilityContext=e.useAvailabilityContext;exports.useBeverages=e.useBeverages;exports.useBoard=e.useBoard;exports.useBoardContainer=e.useBoardContainer;exports.useBoardContainerContext=e.useBoardContainerContext;exports.useBoardContext=e.useBoardContext;exports.useBrands=e.useBrands;exports.useCuiKit=e.useCuiKit;exports.useCuiKitTimers=e.useCuiKitTimers;exports.useDefaultCuiKitLifecycle=e.useDefaultCuiKitLifecycle;exports.useDeviceAssembly=e.useDeviceAssembly;exports.useDeviceAssemblyContext=e.useDeviceAssemblyContext;exports.useDispenseLifecycle=e.useDispenseLifecycle;exports.useFlavors=e.useFlavors;exports.useGenericPour=e.useGenericPour;exports.useHolder=e.useHolder;exports.useHolderContainer=e.useHolderContainer;exports.useHolderContainerContext=e.useHolderContainerContext;exports.useHolderContext=e.useHolderContext;exports.useIngredient=e.useIngredient;exports.useIngredientContainer=e.useIngredientContainer;exports.useIngredientContainerContext=e.useIngredientContainerContext;exports.useIngredientContext=e.useIngredientContext;exports.useIngredientPour=e.useIngredientPour;exports.useNozzle=e.useNozzle;exports.useNozzleContext=e.useNozzleContext;exports.useNozzlePour=e.useNozzlePour;exports.usePourTarget=e.usePourTarget;exports.usePumpContext=e.usePumpContext;exports.withAssembly=e.withAssembly;exports.withBeverage=e.withBeverage;exports.withBoard=e.withBoard;exports.withBoardContainer=e.withBoardContainer;exports.withDeviceAssembly=e.withDeviceAssembly;exports.withGenericPour=e.withGenericPour;exports.withHolder=e.withHolder;exports.withHolderContainer=e.withHolderContainer;exports.withIngredient=e.withIngredient;exports.withIngredientContainer=e.withIngredientContainer;exports.withNozzle=e.withNozzle;exports.ControlPourExtension=u;exports.EXTENSION_POINT_CONTROL_POUR=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./dispense-registration-manager-BkJ1ggtS.cjs"),o=require("./extension-utils-DUV7OQR1.cjs"),e=require("./pump-provider-BUfMtaXv.cjs"),t=require("@kosdev-code/kos-ui-plugin/utilities");require("@kosdev-code/kos-ui-sdk");require("react");require("@emotion/react/jsx-runtime");const i=t.createExtensionSchema({},{rankable:!1}),n=t.extensionPointId("cui","control","pour"),u=t.defineExtensionPoint({id:n,contributionKey:"controlPour",displayName:"Control Pour",description:"Extension point for controlled pour plugin configurations with view support",hasView:!0,isRankable:!1,schema:i,metadata:{exportName:"ControlPourExtension",category:"Dispense",tags:["pour","control","beverage"]},validate:(s,a)=>{t.validateWithSchema(i,s,a)},transform:t.createViewAwareTransform()}),d=n;exports.Assembly=r.Assembly;exports.Availability=r.Availability;exports.Board=r.Board;exports.BoardContainer=r.BoardContainer;Object.defineProperty(exports,"BoardContainerModel",{enumerable:!0,get:()=>r.BoardContainerModel});exports.CONTEXT_ASSEMBLY_DATA=r.CONTEXT_ASSEMBLY_DATA;exports.CONTEXT_ASSEMBLY_RAW_DATA=r.CONTEXT_ASSEMBLY_RAW_DATA;exports.DeviceAssembly=r.DeviceAssembly;exports.DispenseModelType=r.DispenseModelType;exports.DispenserModels=r.kosModels;exports.ExtensionType=r.ExtensionType;exports.GenericPour=r.GenericPour;exports.Holder=r.Holder;exports.HolderContainer=r.HolderContainer;exports.Ingredient=r.Ingredient;exports.IngredientContainer=r.IngredientContainer;exports.KosModelRegistry=r.KosModelRegistry;exports.Nozzle=r.Nozzle;exports.PourState=r.PourState;exports.Pump=r.Pump;exports.PumpContainer=r.PumpContainer;exports.PumpIndex=r.PumpIndex;exports.TOPIC_BOARD_LINKED=r.TOPIC_BOARD_LINKED;exports.TOPIC_BOARD_UNLINKED=r.TOPIC_BOARD_UNLINKED;exports.TOPIC_GENERIC_POUR_CANCEL=r.TOPIC_GENERIC_POUR_CANCEL;exports.TOPIC_GENERIC_POUR_PROGRESS=r.TOPIC_GENERIC_POUR_PROGRESS;exports.TOPIC_GENERIC_POUR_STARTED=r.TOPIC_GENERIC_POUR_STARTED;exports.kosModels=r.kosModels;exports.registerDispenseModels=r.registerDispenseModels;exports.AssemblyServices=o.index;exports.AssemblyTypes=o.assembly;exports.DispenseExtensionManager=o.DispenseExtensionManager;exports.GenericPourServices=o.index$1;exports.HolderServices=o.index$2;exports.IngredientServices=o.index$3;exports.KosExtensionManager=o.KosExtensionManager;exports.NozzleServices=o.index$4;exports.PumpServices=o.index$5;exports.getFuelGaugeValue=o.getFuelGaugeValue;exports.AssemblyProvider=e.AssemblyProvider;exports.AvailabilityProvider=e.AvailabilityProvider;exports.BoardContainerProvider=e.BoardContainerProvider;exports.BoardProvider=e.BoardProvider;exports.CuiKit=e.CuiKit;exports.CuiKitWrapper=e.CuiKitWrapper;exports.DISPENSE_GROUP_BEVERAGE=e.DISPENSE_GROUP_BEVERAGE;exports.DISPENSE_GROUP_BRAND=e.DISPENSE_GROUP_BRAND;exports.DISPENSE_GROUP_FLAVOR=e.DISPENSE_GROUP_FLAVOR;exports.DeviceAssemblyProvider=e.DeviceAssemblyProvider;exports.HoldToPourIntentStrategy=e.HoldToPourIntentStrategy;exports.HoldToPourStrategy=e.HoldToPourStrategy;exports.HolderContainerProvider=e.HolderContainerProvider;exports.HolderProvider=e.HolderProvider;exports.IngredientContainerProvider=e.IngredientContainerProvider;exports.IngredientProvider=e.IngredientProvider;exports.NozzleProvider=e.NozzleProvider;exports.PourContext=e.PourContext;exports.PumpProvider=e.PumpProvider;exports.TapOrHoldIntentStrategy=e.TapOrHoldIntentStrategy;exports.TapToPourIntentStrategy=e.TapToPourIntentStrategy;exports.TapToPourStrategy=e.TapToPourStrategy;exports.initializeCuiKit=e.initializeCuiKit;exports.useAssembly=e.useAssembly;exports.useAssemblyContext=e.useAssemblyContext;exports.useAvailability=e.useAvailability;exports.useAvailabilityContext=e.useAvailabilityContext;exports.useBeverages=e.useBeverages;exports.useBoard=e.useBoard;exports.useBoardContainer=e.useBoardContainer;exports.useBoardContainerContext=e.useBoardContainerContext;exports.useBoardContext=e.useBoardContext;exports.useBrands=e.useBrands;exports.useCuiKit=e.useCuiKit;exports.useCuiKitTimers=e.useCuiKitTimers;exports.useDefaultCuiKitLifecycle=e.useDefaultCuiKitLifecycle;exports.useDeviceAssembly=e.useDeviceAssembly;exports.useDeviceAssemblyContext=e.useDeviceAssemblyContext;exports.useDispenseLifecycle=e.useDispenseLifecycle;exports.useFlavors=e.useFlavors;exports.useGenericPour=e.useGenericPour;exports.useHolder=e.useHolder;exports.useHolderContainer=e.useHolderContainer;exports.useHolderContainerContext=e.useHolderContainerContext;exports.useHolderContext=e.useHolderContext;exports.useIngredient=e.useIngredient;exports.useIngredientContainer=e.useIngredientContainer;exports.useIngredientContainerContext=e.useIngredientContainerContext;exports.useIngredientContext=e.useIngredientContext;exports.useIngredientPour=e.useIngredientPour;exports.useNozzle=e.useNozzle;exports.useNozzleContext=e.useNozzleContext;exports.useNozzlePour=e.useNozzlePour;exports.usePourTarget=e.usePourTarget;exports.usePumpContext=e.usePumpContext;exports.withAssembly=e.withAssembly;exports.withBeverage=e.withBeverage;exports.withBoard=e.withBoard;exports.withBoardContainer=e.withBoardContainer;exports.withDeviceAssembly=e.withDeviceAssembly;exports.withGenericPour=e.withGenericPour;exports.withHolder=e.withHolder;exports.withHolderContainer=e.withHolderContainer;exports.withIngredient=e.withIngredient;exports.withIngredientContainer=e.withIngredientContainer;exports.withNozzle=e.withNozzle;exports.ControlPourExtension=u;exports.EXTENSION_POINT_CONTROL_POUR=d;
2
2
  //# sourceMappingURL=index.cjs.map
package/index.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../../packages/sdk/kos-dispense-sdk/src/extensions/control-pour-extension.ts"],"sourcesContent":["// eslint-disable-next-line @nx/enforce-module-boundaries\nimport {\n createExtensionSchema,\n createViewAwareTransform,\n defineExtensionPoint,\n extensionPointId,\n validateWithSchema,\n type ValidationContext,\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"],"names":["ControlPourSchema","createExtensionSchema","EXTENSION_ID","extensionPointId","ControlPourExtension","defineExtensionPoint","data","context","validateWithSchema","createViewAwareTransform","EXTENSION_POINT_CONTROL_POUR"],"mappings":"2ZAYA,MAAMA,EAAoBC,EAAAA,sBAAsB,CAAA,EAAI,CAAE,SAAU,GAAO,EAKjEC,EAAeC,EAAAA,iBAAiB,MAAO,UAAW,MAAM,EAQjDC,EAAuBC,EAAAA,qBAGlC,CACA,GAAIH,EACJ,gBAAiB,cACjB,YAAa,eACb,YACE,8EACF,QAAS,GACT,WAAY,GAEZ,OAAQF,EACR,SAAU,CACR,WAAY,uBACZ,SAAU,WACV,KAAM,CAAC,OAAQ,UAAW,UAAU,CAAA,EAGtC,SAAU,CAACM,EAA6BC,IAA+B,CAErEC,qBAAmBR,EAAmBM,EAAMC,CAAO,CACrD,EAEA,UAAWE,EAAAA,yBAAA,CACb,CAAC,EAGYC,EAA+BR"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../../packages/sdk/kos-dispense-sdk/src/extensions/control-pour-extension.ts"],"sourcesContent":["// eslint-disable-next-line @nx/enforce-module-boundaries\nimport {\n createExtensionSchema,\n createViewAwareTransform,\n defineExtensionPoint,\n extensionPointId,\n validateWithSchema,\n type ValidationContext,\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"],"names":["ControlPourSchema","createExtensionSchema","EXTENSION_ID","extensionPointId","ControlPourExtension","defineExtensionPoint","data","context","validateWithSchema","createViewAwareTransform","EXTENSION_POINT_CONTROL_POUR"],"mappings":"kXAYA,MAAMA,EAAoBC,EAAAA,sBAAsB,CAAA,EAAI,CAAE,SAAU,GAAO,EAKjEC,EAAeC,EAAAA,iBAAiB,MAAO,UAAW,MAAM,EAQjDC,EAAuBC,EAAAA,qBAGlC,CACA,GAAIH,EACJ,gBAAiB,cACjB,YAAa,eACb,YACE,8EACF,QAAS,GACT,WAAY,GAEZ,OAAQF,EACR,SAAU,CACR,WAAY,uBACZ,SAAU,WACV,KAAM,CAAC,OAAQ,UAAW,UAAU,CAAA,EAGtC,SAAU,CAACM,EAA6BC,IAA+B,CAErEC,qBAAmBR,EAAmBM,EAAMC,CAAO,CACrD,EAEA,UAAWE,EAAAA,yBAAA,CACb,CAAC,EAGYC,EAA+BR"}
package/index.js CHANGED
@@ -1,12 +1,11 @@
1
- import { A as g, b as v, e as A, d as T, B as y, C as S, a as N, f as _, D as x, o as D, E as O, G as b, H as R, j as B, I as h, k as f, K as w, N as z, n as H, P as G, l as K, m as M, T as L, c as U, g as V, h as k, i as X, o as F, r as W } from "./dispense-registration-manager-C36ULeOU.js";
2
- import { i as j, f as q, D as J, a as Q, b as Z, c as $, K as ee, d as se, e as ae, g as oe } from "./extension-utils-dTIk56MQ.js";
3
- import { A as te, a as ie, d as ne, B as ue, f as le, C as de, G as Pe, F as Ce, J as ce, D as pe, a4 as me, a5 as Ee, j as Ie, H as ge, m as ve, I as Ae, N as Te, ab as ye, P as Se, a6 as Ne, a7 as _e, a8 as xe, i as De, q as Oe, u as be, r as Re, b as Be, z as he, t as fe, x as we, e as ze, c as He, E as Ge, K as Ke, O as Me, L as Le, R as Ue, g as Ve, M as ke, Q as Xe, a9 as Fe, T as We, V as Ye, k as je, h as qe, X as Je, _ as Qe, n as Ze, l as $e, Y as es, a0 as ss, o as as, a2 as os, a3 as rs, p as ts, w as is, s as ns, v as us, y as ls, S as ds, aa as Ps, U as Cs, W as cs, Z as ps, $ as ms, a1 as Es } from "./pump-provider-BXvrC3jL.js";
1
+ import { A as I, b as g, e as v, d as A, B as T, C as y, a as S, f as N, D as _, o as x, E as D, G as O, H as b, j as R, I as B, k as h, K as f, N as w, n as z, P as H, l as G, m as K, T as M, c as L, g as U, h as V, i as k, o as X, r as F } from "./dispense-registration-manager-CcFUS_KM.js";
2
+ import { i as Y, f as j, D as q, a as J, b as Q, c as Z, K as $, d as ee, e as se, g as ae } from "./extension-utils-DeLiIgFH.js";
3
+ import { A as re, a as te, d as ie, B as ne, f as ue, C as le, G as de, F as Pe, J as Ce, D as ce, a4 as pe, a5 as me, j as Ee, H as Ie, m as ge, I as ve, N as Ae, ab as Te, P as ye, a6 as Se, a7 as Ne, a8 as _e, i as xe, q as De, u as Oe, r as be, b as Re, z as Be, t as he, x as fe, e as we, c as ze, E as He, K as Ge, O as Ke, L as Me, R as Le, g as Ue, M as Ve, Q as ke, a9 as Xe, T as Fe, V as We, k as Ye, h as je, X as qe, _ as Je, n as Qe, l as Ze, Y as $e, a0 as es, o as ss, a2 as as, a3 as os, p as rs, w as ts, s as is, v as ns, y as us, S as ls, aa as ds, U as Ps, W as Cs, Z as cs, $ as ps, a1 as ms } from "./pump-provider-BTnIydH2.js";
4
4
  import { createExtensionSchema as r, extensionPointId as t, defineExtensionPoint as i, createViewAwareTransform as n, validateWithSchema as u } from "@kosdev-code/kos-ui-plugin/utilities";
5
5
  import "@kosdev-code/kos-ui-sdk";
6
6
  import "react";
7
7
  import "@emotion/react/jsx-runtime";
8
- import "@kosdev-code/kos-dispense-sdk";
9
- const e = r({}, { rankable: !1 }), s = t("cui", "control", "pour"), p = i({
8
+ const e = r({}, { rankable: !1 }), s = t("cui", "control", "pour"), c = i({
10
9
  id: s,
11
10
  contributionKey: "controlPour",
12
11
  displayName: "Control Pour",
@@ -23,114 +22,114 @@ const e = r({}, { rankable: !1 }), s = t("cui", "control", "pour"), p = i({
23
22
  u(e, a, o);
24
23
  },
25
24
  transform: n()
26
- }), m = s;
25
+ }), p = s;
27
26
  export {
28
- g as Assembly,
29
- te as AssemblyProvider,
30
- j as AssemblyServices,
31
- q as AssemblyTypes,
32
- v as Availability,
33
- ie as AvailabilityProvider,
34
- A as Board,
35
- T as BoardContainer,
36
- y as BoardContainerModel,
37
- ne as BoardContainerProvider,
38
- ue as BoardProvider,
39
- S as CONTEXT_ASSEMBLY_DATA,
40
- N as CONTEXT_ASSEMBLY_RAW_DATA,
41
- p as ControlPourExtension,
42
- le as CuiKit,
43
- de as CuiKitWrapper,
44
- Pe as DISPENSE_GROUP_BEVERAGE,
45
- Ce as DISPENSE_GROUP_BRAND,
46
- ce as DISPENSE_GROUP_FLAVOR,
47
- _ as DeviceAssembly,
48
- pe as DeviceAssemblyProvider,
49
- J as DispenseExtensionManager,
50
- x as DispenseModelType,
51
- D as DispenserModels,
52
- m as EXTENSION_POINT_CONTROL_POUR,
53
- O as ExtensionType,
54
- b as GenericPour,
55
- Q as GenericPourServices,
56
- me as HoldToPourIntentStrategy,
57
- Ee as HoldToPourStrategy,
58
- R as Holder,
59
- B as HolderContainer,
60
- Ie as HolderContainerProvider,
61
- ge as HolderProvider,
62
- Z as HolderServices,
63
- h as Ingredient,
64
- f as IngredientContainer,
65
- ve as IngredientContainerProvider,
66
- Ae as IngredientProvider,
67
- $ as IngredientServices,
68
- ee as KosExtensionManager,
69
- w as KosModelRegistry,
70
- z as Nozzle,
71
- Te as NozzleProvider,
72
- se as NozzleServices,
73
- ye as PourContext,
74
- H as PourState,
75
- G as Pump,
76
- K as PumpContainer,
77
- M as PumpIndex,
78
- Se as PumpProvider,
79
- ae as PumpServices,
80
- L as TOPIC_BOARD_LINKED,
81
- U as TOPIC_BOARD_UNLINKED,
82
- V as TOPIC_GENERIC_POUR_CANCEL,
83
- k as TOPIC_GENERIC_POUR_PROGRESS,
84
- X as TOPIC_GENERIC_POUR_STARTED,
85
- Ne as TapOrHoldIntentStrategy,
86
- _e as TapToPourIntentStrategy,
87
- xe as TapToPourStrategy,
88
- oe as getFuelGaugeValue,
89
- De as initializeCuiKit,
90
- F as kosModels,
91
- W as registerDispenseModels,
92
- Oe as useAssembly,
93
- be as useAssemblyContext,
94
- Re as useAvailability,
95
- Be as useAvailabilityContext,
96
- he as useBeverages,
97
- fe as useBoard,
98
- we as useBoardContainer,
99
- ze as useBoardContainerContext,
100
- He as useBoardContext,
101
- Ge as useBrands,
102
- Ke as useCuiKit,
103
- Me as useCuiKitTimers,
104
- Le as useDefaultCuiKitLifecycle,
105
- Ue as useDeviceAssembly,
106
- Ve as useDeviceAssemblyContext,
107
- ke as useDispenseLifecycle,
108
- Xe as useFlavors,
109
- Fe as useGenericPour,
110
- We as useHolder,
111
- Ye as useHolderContainer,
112
- je as useHolderContainerContext,
113
- qe as useHolderContext,
114
- Je as useIngredient,
115
- Qe as useIngredientContainer,
116
- Ze as useIngredientContainerContext,
117
- $e as useIngredientContext,
118
- es as useIngredientPour,
119
- ss as useNozzle,
120
- as as useNozzleContext,
121
- os as useNozzlePour,
122
- rs as usePourTarget,
123
- ts as usePumpContext,
124
- is as withAssembly,
125
- ns as withBeverage,
126
- us as withBoard,
127
- ls as withBoardContainer,
128
- ds as withDeviceAssembly,
129
- Ps as withGenericPour,
130
- Cs as withHolder,
131
- cs as withHolderContainer,
132
- ps as withIngredient,
133
- ms as withIngredientContainer,
134
- Es as withNozzle
27
+ I as Assembly,
28
+ re as AssemblyProvider,
29
+ Y as AssemblyServices,
30
+ j as AssemblyTypes,
31
+ g as Availability,
32
+ te as AvailabilityProvider,
33
+ v as Board,
34
+ A as BoardContainer,
35
+ T as BoardContainerModel,
36
+ ie as BoardContainerProvider,
37
+ ne as BoardProvider,
38
+ y as CONTEXT_ASSEMBLY_DATA,
39
+ S as CONTEXT_ASSEMBLY_RAW_DATA,
40
+ c as ControlPourExtension,
41
+ ue as CuiKit,
42
+ le as CuiKitWrapper,
43
+ de as DISPENSE_GROUP_BEVERAGE,
44
+ Pe as DISPENSE_GROUP_BRAND,
45
+ Ce as DISPENSE_GROUP_FLAVOR,
46
+ N as DeviceAssembly,
47
+ ce as DeviceAssemblyProvider,
48
+ q as DispenseExtensionManager,
49
+ _ as DispenseModelType,
50
+ x as DispenserModels,
51
+ p as EXTENSION_POINT_CONTROL_POUR,
52
+ D as ExtensionType,
53
+ O as GenericPour,
54
+ J as GenericPourServices,
55
+ pe as HoldToPourIntentStrategy,
56
+ me as HoldToPourStrategy,
57
+ b as Holder,
58
+ R as HolderContainer,
59
+ Ee as HolderContainerProvider,
60
+ Ie as HolderProvider,
61
+ Q as HolderServices,
62
+ B as Ingredient,
63
+ h as IngredientContainer,
64
+ ge as IngredientContainerProvider,
65
+ ve as IngredientProvider,
66
+ Z as IngredientServices,
67
+ $ as KosExtensionManager,
68
+ f as KosModelRegistry,
69
+ w as Nozzle,
70
+ Ae as NozzleProvider,
71
+ ee as NozzleServices,
72
+ Te as PourContext,
73
+ z as PourState,
74
+ H as Pump,
75
+ G as PumpContainer,
76
+ K as PumpIndex,
77
+ ye as PumpProvider,
78
+ se as PumpServices,
79
+ M as TOPIC_BOARD_LINKED,
80
+ L as TOPIC_BOARD_UNLINKED,
81
+ U as TOPIC_GENERIC_POUR_CANCEL,
82
+ V as TOPIC_GENERIC_POUR_PROGRESS,
83
+ k as TOPIC_GENERIC_POUR_STARTED,
84
+ Se as TapOrHoldIntentStrategy,
85
+ Ne as TapToPourIntentStrategy,
86
+ _e as TapToPourStrategy,
87
+ ae as getFuelGaugeValue,
88
+ xe as initializeCuiKit,
89
+ X as kosModels,
90
+ F as registerDispenseModels,
91
+ De as useAssembly,
92
+ Oe as useAssemblyContext,
93
+ be as useAvailability,
94
+ Re as useAvailabilityContext,
95
+ Be as useBeverages,
96
+ he as useBoard,
97
+ fe as useBoardContainer,
98
+ we as useBoardContainerContext,
99
+ ze as useBoardContext,
100
+ He as useBrands,
101
+ Ge as useCuiKit,
102
+ Ke as useCuiKitTimers,
103
+ Me as useDefaultCuiKitLifecycle,
104
+ Le as useDeviceAssembly,
105
+ Ue as useDeviceAssemblyContext,
106
+ Ve as useDispenseLifecycle,
107
+ ke as useFlavors,
108
+ Xe as useGenericPour,
109
+ Fe as useHolder,
110
+ We as useHolderContainer,
111
+ Ye as useHolderContainerContext,
112
+ je as useHolderContext,
113
+ qe as useIngredient,
114
+ Je as useIngredientContainer,
115
+ Qe as useIngredientContainerContext,
116
+ Ze as useIngredientContext,
117
+ $e as useIngredientPour,
118
+ es as useNozzle,
119
+ ss as useNozzleContext,
120
+ as as useNozzlePour,
121
+ os as usePourTarget,
122
+ rs as usePumpContext,
123
+ ts as withAssembly,
124
+ is as withBeverage,
125
+ ns as withBoard,
126
+ us as withBoardContainer,
127
+ ls as withDeviceAssembly,
128
+ ds as withGenericPour,
129
+ Ps as withHolder,
130
+ Cs as withHolderContainer,
131
+ cs as withIngredient,
132
+ ps as withIngredientContainer,
133
+ ms as withNozzle
135
134
  };
136
135
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../packages/sdk/kos-dispense-sdk/src/extensions/control-pour-extension.ts"],"sourcesContent":["// eslint-disable-next-line @nx/enforce-module-boundaries\nimport {\n createExtensionSchema,\n createViewAwareTransform,\n defineExtensionPoint,\n extensionPointId,\n validateWithSchema,\n type ValidationContext,\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"],"names":["ControlPourSchema","createExtensionSchema","EXTENSION_ID","extensionPointId","ControlPourExtension","defineExtensionPoint","data","context","validateWithSchema","createViewAwareTransform","EXTENSION_POINT_CONTROL_POUR"],"mappings":";;;;;;;;AAYA,MAAMA,IAAoBC,EAAsB,CAAA,GAAI,EAAE,UAAU,IAAO,GAKjEC,IAAeC,EAAiB,OAAO,WAAW,MAAM,GAQjDC,IAAuBC,EAGlC;AAAA,EACA,IAAIH;AAAA,EACJ,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,aACE;AAAA,EACF,SAAS;AAAA,EACT,YAAY;AAAA,EAEZ,QAAQF;AAAA,EACR,UAAU;AAAA,IACR,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,MAAM,CAAC,QAAQ,WAAW,UAAU;AAAA,EAAA;AAAA,EAGtC,UAAU,CAACM,GAA6BC,MAA+B;AAErE,IAAAC,EAAmBR,GAAmBM,GAAMC,CAAO;AAAA,EACrD;AAAA,EAEA,WAAWE,EAAA;AACb,CAAC,GAGYC,IAA+BR;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../packages/sdk/kos-dispense-sdk/src/extensions/control-pour-extension.ts"],"sourcesContent":["// eslint-disable-next-line @nx/enforce-module-boundaries\nimport {\n createExtensionSchema,\n createViewAwareTransform,\n defineExtensionPoint,\n extensionPointId,\n validateWithSchema,\n type ValidationContext,\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"],"names":["ControlPourSchema","createExtensionSchema","EXTENSION_ID","extensionPointId","ControlPourExtension","defineExtensionPoint","data","context","validateWithSchema","createViewAwareTransform","EXTENSION_POINT_CONTROL_POUR"],"mappings":";;;;;;;AAYA,MAAMA,IAAoBC,EAAsB,CAAA,GAAI,EAAE,UAAU,IAAO,GAKjEC,IAAeC,EAAiB,OAAO,WAAW,MAAM,GAQjDC,IAAuBC,EAGlC;AAAA,EACA,IAAIH;AAAA,EACJ,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,aACE;AAAA,EACF,SAAS;AAAA,EACT,YAAY;AAAA,EAEZ,QAAQF;AAAA,EACR,UAAU;AAAA,IACR,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,MAAM,CAAC,QAAQ,WAAW,UAAU;AAAA,EAAA;AAAA,EAGtC,UAAU,CAACM,GAA6BC,MAA+B;AAErE,IAAAC,EAAmBR,GAAmBM,GAAMC,CAAO;AAAA,EACrD;AAAA,EAEA,WAAWE,EAAA;AACb,CAAC,GAGYC,IAA+BR;"}
@@ -1,6 +1,6 @@
1
1
  import { GenericPourOptions } from './types';
2
2
  import { PourState } from '../types';
3
- import { PourStrategyAware } from '../../../ui/hooks/utils/pour-strategy';
3
+ import { PourStrategyAware } from '../nozzle/types';
4
4
  import { FutureContainer, IFutureModel, IKosDataModel, PublicModelInterface, KosData, KosFutureAwareFull, KosLoggerAware, KosStateMachineAware } from '@kosdev-code/kos-ui-sdk';
5
5
 
6
6
  export declare const MODEL_TYPE = "generic-pour-model";
@@ -22,6 +22,7 @@ export declare class GenericPourModelImpl implements IKosDataModel, PourStrategy
22
22
  updateContextData(key: string, value: any): void;
23
23
  removeContextData(key: string): void;
24
24
  clearContextData(): void;
25
+ updateModel(options: GenericPourOptions): void;
25
26
  handlePouringStart(): void;
26
27
  handlePouringEnd(): void;
27
28
  handleCancelStart(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"generic-pour-model.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-dispense-sdk/src/models/models/generic-pour/generic-pour-model.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,eAAe,EAGf,YAAY,EACZ,aAAa,EAEb,oBAAoB,EAWpB,KAAK,OAAO,EACZ,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EAC1B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD,eAAO,MAAM,UAAU,uBAAuB,CAAC;AAE/C,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,oBAAoB,CAAC,CAAC;AAE1E,eAAO,MAAM,0BAA0B,8BAA8B,CAAC;AACtE,eAAO,MAAM,2BAA2B,+BAA+B,CAAC;AACxE,eAAO,MAAM,yBAAyB,6BAA6B,CAAC;AAMpE,KAAK,SAAS,GACV,YAAY,GACZ,aAAa,GACb,aAAa,GACb,eAAe,GACf,gBAAgB,CAAC;AAqCrB,MAAM,WAAW,oBACf,SAAQ,cAAc,EACpB,kBAAkB,CAAC,GAAG,CAAC,EACvB,oBAAoB,CAAC,SAAS,EAAE,SAAS,CAAC;CAAG;AAEjD,qBAsCa,oBACX,YAAW,aAAa,EAAE,iBAAiB,EAAE,eAAe;IAE5D,EAAE,EAAE,MAAM,CAAC;IACX,kBAAkB,EAAE,CAClB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,KACnC,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IAEjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,KAAK,CAA+B;gBAEhC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB;IAUxD,IAAI,WAAW,WAKd;IAED,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;IAIzC,iBAAiB,CAAC,GAAG,EAAE,MAAM;IAI7B,gBAAgB;IAShB,kBAAkB,IAAI,IAAI;IAmB1B,gBAAgB,IAAI,IAAI;IAKxB,iBAAiB,IAAI,IAAI;IAKzB,cAAc,IAAI,IAAI;IAqBtB;;;;;;;SAOK;IAGQ,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM;IA8BrB,UAAU;IAUvB;;;OAGG;IACH,IAAI,SAAS,YAOZ;IAED;;;;;;;;OAQG;IACH,IAAI,OAAO,YAEV;IAED,IAAI,YAAY,WAEf;IAMD,cAAc,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,CAAC;CA6BzC"}
1
+ {"version":3,"file":"generic-pour-model.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-dispense-sdk/src/models/models/generic-pour/generic-pour-model.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,eAAe,EAGf,YAAY,EACZ,aAAa,EAEb,oBAAoB,EAWpB,KAAK,OAAO,EACZ,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EAC1B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAa,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAA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AM;IA8BrB,UAAU;IAUvB;;;OAGG;IACH,IAAI,SAAS,YAOZ;IAED;;;;;;;;OAQG;IACH,IAAI,OAAO,YAEV;IAED,IAAI,YAAY,WAEf;IAMD,cAAc,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,CAAC;CA6BzC"}
@@ -2,4 +2,5 @@ export interface GenericPourOptions {
2
2
  servicePathFactory: (selectedId: string) => string;
3
3
  selectedId?: string;
4
4
  pourType?: string;
5
+ initialData?: Record<string, any>;
5
6
  }
@@ -1,5 +1,5 @@
1
1
  export { Nozzle, type NozzleModel } from './nozzle-model';
2
- export type { NozzleOptions, SelectedPourable } from './types';
2
+ export type { NozzleOptions, PourStrategyAware, SelectedPourable, } from './types';
3
3
  /** @category KOS Services */
4
4
  export * as NozzleServices from './services';
5
5
  //# sourceMappingURL=index.d.ts.map