@kosdev-code/kos-dispense-sdk 2.1.32 → 2.1.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{dispense-registration-manager-CcFUS_KM.js → dispense-registration-manager-Cl2UbU1m.js} +161 -158
- package/{dispense-registration-manager-CcFUS_KM.js.map → dispense-registration-manager-Cl2UbU1m.js.map} +1 -1
- package/dispense-registration-manager-DK1ePXkY.cjs +2 -0
- package/{dispense-registration-manager-BkJ1ggtS.cjs.map → dispense-registration-manager-DK1ePXkY.cjs.map} +1 -1
- package/extension-utils-CAqmOmVh.cjs +2 -0
- package/extension-utils-CAqmOmVh.cjs.map +1 -0
- package/{extension-utils-DeLiIgFH.js → extension-utils-CECRZtAt.js} +149 -66
- package/extension-utils-CECRZtAt.js.map +1 -0
- package/index.cjs +1 -1
- package/index.js +3 -3
- package/models/models/nozzle/nozzle-model.d.ts +2 -2
- package/models/models/nozzle/nozzle-model.d.ts.map +1 -1
- package/models/utils/extension-utils.d.ts +90 -18
- package/models/utils/extension-utils.d.ts.map +1 -1
- package/models/utils/service.d.ts +8 -8
- package/models/utils/services/dispense/1.6.5/service.d.ts +8 -8
- package/models/utils/services/dispense/1.8.1/service.d.ts +8 -8
- package/models/utils/services/dispense/daily/service.d.ts +8 -8
- package/models.cjs +1 -1
- package/models.js +2 -2
- package/package.json +2 -2
- package/pump-provider-C-6CuGgY.cjs +2 -0
- package/pump-provider-C-6CuGgY.cjs.map +1 -0
- package/{pump-provider-BTnIydH2.js → pump-provider-DoK4li3d.js} +247 -241
- package/pump-provider-DoK4li3d.js.map +1 -0
- package/ui/hooks/cui-kit/use-beverages.d.ts +1 -1
- package/ui/hooks/cui-kit/use-beverages.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-brands.d.ts +1 -1
- package/ui/hooks/cui-kit/use-brands.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-cui-kit.d.ts +1 -1
- package/ui/hooks/cui-kit/use-cui-kit.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-flavors.d.ts +1 -1
- package/ui/hooks/cui-kit/use-flavors.d.ts.map +1 -1
- package/ui.cjs +1 -1
- package/ui.js +2 -2
- package/dispense-registration-manager-BkJ1ggtS.cjs +0 -2
- package/extension-utils-DUV7OQR1.cjs +0 -2
- package/extension-utils-DUV7OQR1.cjs.map +0 -1
- package/extension-utils-DeLiIgFH.js.map +0 -1
- package/pump-provider-BTnIydH2.js.map +0 -1
- package/pump-provider-BUfMtaXv.cjs +0 -2
- package/pump-provider-BUfMtaXv.cjs.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var V=Object.defineProperty;var v=(t,e,r)=>e in t?V(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var o=(t,e,r)=>(v(t,typeof e!="symbol"?e+"":e,r),r);const n=require("./dispense-registration-manager-DK1ePXkY.cjs"),a=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,r]=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=a.kosAutoEffect(()=>{var d,c,y,E;r(((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 a.CoreExtensionManager)}registerIngredientDataMapper(e,r){return a.ExtensionManager.dataMapper.registerDataMapper(n.ExtensionType.IngredientMapper,e,r),this}registerIngredientLoader(e,r){return a.ExtensionManager.loader.registerLoader(n.ExtensionType.IngredientLoader,e,r),this}registerIngredientIndex(e){return a.ExtensionManager.indexExtension.registerIndexExtension(n.ExtensionType.IngredientIndex,e),this}registerIngredientTypeMapper(e,r){return a.ExtensionManager.propertyMapper.registerPropertyMapper(n.ExtensionType.IngredientTypeMapper,e,r),this}registerHolderDataMapper(e,r){return a.ExtensionManager.dataMapper.registerDataMapper(n.ExtensionType.HolderMapper,e,r),this}registerHolderTypeMapper(e,r){return a.ExtensionManager.propertyMapper.registerPropertyMapper(n.ExtensionType.HolderTypeMapper,e,r),this}registerHolderIngredientMapper(e,r){return a.ExtensionManager.propertyMapper.registerPropertyMapper(n.ExtensionType.HolderTypeMapper,e,r),this}registerHolderIndex(e){return a.ExtensionManager.indexExtension.registerIndexExtension(n.ExtensionType.HolderIndex,e),this}registerAvailabilityDataMapper(e,r){return a.ExtensionManager.dataMapper.registerDataMapper(n.ExtensionType.AvailabilityMapper,e,r),this}registerAvailabilityLoader(e,r){return a.ExtensionManager.loader.registerLoader(n.ExtensionType.AvailabilityLoader,e,r),this}registerSelectedPourableDataMapper(e,r){return a.ExtensionManager.dataMapper.registerDataMapper(n.ExtensionType.SelectedPourableMapper,e,r),this}registerAssemblyDataMapper(e,r){return a.ExtensionManager.dataMapper.registerDataMapper(n.ExtensionType.AssemblyMapper,e,r),this}registerBoardIndex(e){return a.ExtensionManager.indexExtension.registerIndexExtension(n.ExtensionType.BoardIndex,e),this}registerBoardDataMapper(e,r){return a.ExtensionManager.dataMapper.registerDataMapper(n.ExtensionType.BoardMapper,e,r),this}registerAssemblyFeatureFlagResolver(e){var r;return(r=a.ExtensionManager[a.EXTENSION_FEATURE_FLAG_RESOLVER])==null||r.register(n.ExtensionType.AssemblyFeatureFlags,e),this}}class z{constructor(){o(this,"dispense");o(this,"core");this.dispense=new b,this.core=new a.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-CAqmOmVh.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-utils-CAqmOmVh.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 ExtensionOptions,\n IndexExtension,\n PropertyMapper,\n type FlagResolver,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport { ExtensionType } from \"../constants\";\nimport { AssemblyTypes, type AssemblyModel } from \"../models\";\nimport type { HolderResponse } from \"../models/holder/services\";\nimport type { HolderModel } from \"../models/holder/types\";\nimport type { IngredientResponse } from \"../models/ingredient/services\";\nimport type { BeverageResponse } from \"../models/nozzle/services\";\nimport type { SelectedPourable } from \"../models/nozzle/types\";\n\nexport type IngredientDataMapper<\n AdditionalData extends object = Record<string, any>\n> = DataMapper<IngredientResponse, AdditionalData, any>;\n\n/**\n * Mapping function that maps an ingredient response into the type property of\n * the {@link IngredientModel}.\n */\nexport type IngredientTypeMapper<\n T extends IngredientResponse = IngredientResponse\n> = PropertyMapper<T, string>;\n\n/**\n * Mapping function that maps additional data from holder service response\n * into the {@link HolderModel} data.\n */\nexport type HolderTypeMapper<T extends HolderResponse = HolderResponse> =\n PropertyMapper<T, string>;\n\n/**\n * Mapping function that maps additional data from holder service response\n * into the {@link HolderModel} data.\n */\nexport type HolderDataMapper<\n AdditionalData extends object = Record<string, any>,\n HolderData extends HolderResponse = HolderResponse\n> = DataMapper<HolderData, AdditionalData, any>;\n\nexport type GroupBeverageResponse = BeverageResponse & { groupId: string };\nexport type AvailabilityDataMapper<\n AdditionalData extends object = Record<string, any>,\n AvailabilityData extends GroupBeverageResponse = GroupBeverageResponse\n> = DataMapper<AvailabilityData, AdditionalData, any>;\n\nexport type SelectedPourableMapper = DataMapper<SelectedPourable, any>;\n\nexport type BoardDataMapper<\n AdditionalData extends object = Record<string, any>,\n BoardData extends AssemblyTypes.AssemblyBoard<any> = AssemblyTypes.AssemblyBoard<any>\n> = DataMapper<BoardData, AdditionalData, any>;\n\nexport type AssemblyMapper<\n AdditionalData extends object = Record<string, any>,\n AssemblyResponseData extends AssemblyTypes.AssemblyResponse<any> = AssemblyTypes.AssemblyResponse<any>\n> = DataMapper<AssemblyResponseData, AdditionalData, any>;\n/**\n * The DispenseExtensionManager is responsible for managing the extension points that are specific to the Dispense application.\n */\nexport class DispenseExtensionManager {\n core: CoreExtensionManager = new CoreExtensionManager();\n /**\n * 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 * @param ingredientDataMapper - Mapping function that maps an {@link IngredientResponse} into additional model data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n *\n * @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(\n ingredientDataMapper: IngredientDataMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.IngredientMapper,\n ingredientDataMapper,\n options\n );\n\n return this;\n }\n\n /**\n * Loads data that will be provided as context into the {@link IngredientMapper}.\n *\n * @param ingredientLoader - Async function that loads and returns ingredient context data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on loader failure.\n * Set to `\"continue\"` to log the error and return `undefined` instead.\n * @returns this instance for chaining\n *\n * @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(\n ingredientLoader: DataLoader,\n options?: ExtensionOptions\n ) {\n ExtensionManager.loader.registerLoader(\n ExtensionType.IngredientLoader,\n ingredientLoader,\n options\n );\n return this;\n }\n\n registerIngredientIndex(ingredientIndex: IndexExtension) {\n ExtensionManager.indexExtension.registerIndexExtension(\n ExtensionType.IngredientIndex,\n ingredientIndex\n );\n return this;\n }\n\n /**\n * Registers a property mapper that derives the `type` property of the {@link IngredientModel}\n * from an {@link IngredientResponse}.\n *\n * @param ingredientTypeMapper - Mapping function that extracts a type string from an {@link IngredientResponse}\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and return a fallback value instead.\n * @returns this instance for chaining\n * */\n registerIngredientTypeMapper(\n ingredientTypeMapper: IngredientTypeMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.IngredientTypeMapper,\n ingredientTypeMapper,\n options\n );\n return this;\n }\n\n /**\n * Registers a data mapper for the {@link HolderModel} model.\n *\n * @param holderDataMapper - Mapping function that maps additional data from a {@link HolderResponse}\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n */\n registerHolderDataMapper(\n holderDataMapper: HolderDataMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.HolderMapper,\n holderDataMapper,\n options\n );\n return this;\n }\n\n /**\n * Registers a property mapper that derives the `type` property of the {@link HolderModel}\n * from a {@link HolderResponse}.\n *\n * @param holderTypeMapper - Mapping function that extracts a type string from a {@link HolderResponse}\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and return a fallback value instead.\n * @returns this instance for chaining\n */\n registerHolderTypeMapper(\n holderTypeMapper: HolderTypeMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.HolderTypeMapper,\n holderTypeMapper,\n options\n );\n return this;\n }\n\n /**\n * Maps the ingredientId property of the holder into the {@link HolderModel}.\n * If not provided, the ingredientId will assume that the value is mapped from the\n * ingredientId property of the service response.\n *\n * @param holderTypeMapper - Mapping function that extracts the ingredientId from a {@link HolderResponse}\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and return a fallback value instead.\n * @returns this instance for chaining\n * */\n registerHolderIngredientMapper(\n holderTypeMapper: HolderTypeMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.HolderTypeMapper,\n holderTypeMapper,\n options\n );\n return this;\n }\n\n registerHolderIndex<T extends HolderModel = HolderModel>(\n holderIndex: IndexExtension<T>\n ) {\n ExtensionManager.indexExtension.registerIndexExtension(\n ExtensionType.HolderIndex,\n holderIndex\n );\n return this;\n }\n\n /**\n * Maps data into the {@link AvailabilityModel}.\n *\n * @param availabilityMapper - Mapping function that maps a {@link GroupBeverageResponse} into additional availability data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n *\n * @example\n * 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(\n availabilityMapper: AvailabilityDataMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.AvailabilityMapper,\n availabilityMapper,\n options\n );\n return this;\n }\n\n /**\n * Loads data that will be provided as context into the {@link AvailabilityMapper}.\n *\n * @param availabilityLoader - Async function that loads and returns availability context data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on loader failure.\n * Set to `\"continue\"` to log the error and return `undefined` instead.\n * @returns this instance for chaining\n *\n * @example\n * 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(\n availabilityLoader: DataLoader,\n options?: ExtensionOptions\n ) {\n ExtensionManager.loader.registerLoader(\n ExtensionType.AvailabilityLoader,\n availabilityLoader,\n options\n );\n return this;\n }\n\n /**\n * Maps the abstract {@link SelectedPourable} data into a format that is specific to the nozzle.\n *\n * @param selectedPourableMapper - Mapping function that transforms {@link SelectedPourable} data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n * */\n registerSelectedPourableDataMapper(\n selectedPourableMapper: SelectedPourableMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.SelectedPourableMapper,\n selectedPourableMapper,\n options\n );\n return this;\n }\n\n /**\n * 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 * @param assemblyDataMapper - Mapping function that maps an {@link AssemblyTypes.AssemblyResponse} into additional assembly data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n *\n * @example\n *\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(\n assemblyDataMapper: AssemblyMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.AssemblyMapper,\n assemblyDataMapper,\n options\n );\n return this;\n }\n\n registerBoardIndex(boardIndex: IndexExtension) {\n ExtensionManager.indexExtension.registerIndexExtension(\n ExtensionType.BoardIndex,\n boardIndex\n );\n return this;\n }\n\n /**\n * Registers a data mapper for the board model within an assembly.\n *\n * @param boardDataMapper - Mapping function that maps an {@link AssemblyTypes.AssemblyBoard} into additional board data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n */\n registerBoardDataMapper(\n boardDataMapper: BoardDataMapper<any, any>,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.BoardMapper,\n boardDataMapper,\n options\n );\n return this;\n }\n\n registerAssemblyFeatureFlagResolver(\n assemblyFeatureFlagResolver: FlagResolver<AssemblyModel>\n ) {\n ExtensionManager[EXTENSION_FEATURE_FLAG_RESOLVER]?.register(\n ExtensionType.AssemblyFeatureFlags,\n assemblyFeatureFlagResolver\n );\n return this;\n }\n}\n\n/**\n * The KosExtensionManager provides access to the extension points that are provided in the SDK for Dispense applications.\n *\n * The extension points are divided into two categories:\n *\n * @param core - The core extension {@link CoreExtensionManager} points are used to extend the base models that are provided by the SDK.\n * @param dispense - The dispense extension {@link DispenseExtensionManager} points are used to extend the models that are specific to the Dispense SDK.\n */\nexport class KosExtensionManager {\n dispense: DispenseExtensionManager;\n core: CoreExtensionManager;\n constructor() {\n this.dispense = new DispenseExtensionManager();\n this.core = new CoreExtensionManager();\n }\n}\n"],"names":["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","options","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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C,OAAAA,EAAAA,iBAAiB,WAAW,mBAC1BC,EAAAA,cAAc,eACdU,EACAZ,CAAA,EAEK,IACT,CAEA,mBAAmBa,EAA4B,CAC7CZ,OAAAA,EAAAA,iBAAiB,eAAe,uBAC9BC,EAAAA,cAAc,WACdW,CAAA,EAEK,IACT,CAWA,wBACEC,EACAd,EACA,CACAC,OAAAA,EAAAA,iBAAiB,WAAW,mBAC1BC,EAAAA,cAAc,YACdY,EACAd,CAAA,EAEK,IACT,CAEA,oCACEe,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,CAFdpB,EAAA,iBACAA,EAAA,aAEE,KAAK,SAAW,IAAID,EACpB,KAAK,KAAO,IAAIE,sBAClB,CACF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var P = Object.defineProperty;
|
|
2
|
-
var A = (r, e,
|
|
3
|
-
var p = (r, e,
|
|
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
|
|
5
|
-
import { kosAutoEffect as Q, CoreExtensionManager as y, ExtensionManager as
|
|
2
|
+
var A = (r, e, t) => e in r ? P(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var p = (r, e, t) => (A(r, typeof e != "symbol" ? e + "" : e, t), t);
|
|
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 a } from "./dispense-registration-manager-Cl2UbU1m.js";
|
|
5
|
+
import { kosAutoEffect as Q, CoreExtensionManager as y, ExtensionManager as s, 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({
|
|
8
8
|
__proto__: null,
|
|
@@ -38,7 +38,7 @@ const re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
38
38
|
pourOnTarget: J
|
|
39
39
|
}, Symbol.toStringTag, { value: "Module" })), oe = (r) => {
|
|
40
40
|
var g, u, M, c;
|
|
41
|
-
const [e,
|
|
41
|
+
const [e, t] = n(
|
|
42
42
|
((g = r == null ? void 0 : r.slice) == null ? void 0 : g.maxVolMl) ?? 0
|
|
43
43
|
), [i, _] = n(
|
|
44
44
|
((u = r == null ? void 0 : r.slice) == null ? void 0 : u.currentVolMl) ?? 0
|
|
@@ -54,7 +54,7 @@ const re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
54
54
|
return X(() => {
|
|
55
55
|
const V = Q(() => {
|
|
56
56
|
var d, m, b, x;
|
|
57
|
-
|
|
57
|
+
t(((d = r == null ? void 0 : r.slice) == null ? void 0 : d.maxVolMl) ?? 0), _(((m = r == null ? void 0 : r.slice) == null ? void 0 : m.currentVolMl) ?? 0), f(((b = r == null ? void 0 : r.slice) == null ? void 0 : b.maxVolMl) !== void 0), I(((x = r == null ? void 0 : r.slice) == null ? void 0 : x.currentVolMl) !== void 0), S(
|
|
58
58
|
i <= 0 ? 0 : Math.floor((i || 1) / (e || 1) * 100)
|
|
59
59
|
), O(o && l);
|
|
60
60
|
});
|
|
@@ -74,6 +74,12 @@ class W {
|
|
|
74
74
|
* not provided by the base KOS Ingredient model. The {@link IngredientMapper} extension point allows for the data to be mapped
|
|
75
75
|
* into the {@link IngredientModel} and the {@link IngredientModel.data} property to be augmented with additional properties.
|
|
76
76
|
*
|
|
77
|
+
* @param ingredientDataMapper - Mapping function that maps an {@link IngredientResponse} into additional model data
|
|
78
|
+
* @param options - Optional {@link ExtensionOptions} to control failure behavior.
|
|
79
|
+
* Defaults to `failurePolicy: "throw"`, which throws an {@link ExtensionException} on mapper failure.
|
|
80
|
+
* Set to `"continue"` to log the error and continue processing remaining mappers.
|
|
81
|
+
* @returns this instance for chaining
|
|
82
|
+
*
|
|
77
83
|
* @example
|
|
78
84
|
* The following example shows how to map the data from the service response into the {@link IngredientModel}.
|
|
79
85
|
* The context is provided by the {@link IngredientLoader} extension point with its data being used to optionally augment the
|
|
@@ -111,14 +117,21 @@ class W {
|
|
|
111
117
|
* }
|
|
112
118
|
* ```
|
|
113
119
|
* */
|
|
114
|
-
registerIngredientDataMapper(e) {
|
|
115
|
-
return
|
|
116
|
-
|
|
117
|
-
e
|
|
120
|
+
registerIngredientDataMapper(e, t) {
|
|
121
|
+
return s.dataMapper.registerDataMapper(
|
|
122
|
+
a.IngredientMapper,
|
|
123
|
+
e,
|
|
124
|
+
t
|
|
118
125
|
), this;
|
|
119
126
|
}
|
|
120
127
|
/**
|
|
121
|
-
* Loads data that will be provided as context into the {@link IngredientMapper}
|
|
128
|
+
* Loads data that will be provided as context into the {@link IngredientMapper}.
|
|
129
|
+
*
|
|
130
|
+
* @param ingredientLoader - Async function that loads and returns ingredient context data
|
|
131
|
+
* @param options - Optional {@link ExtensionOptions} to control failure behavior.
|
|
132
|
+
* Defaults to `failurePolicy: "throw"`, which throws an {@link ExtensionException} on loader failure.
|
|
133
|
+
* Set to `"continue"` to log the error and return `undefined` instead.
|
|
134
|
+
* @returns this instance for chaining
|
|
122
135
|
*
|
|
123
136
|
* @example
|
|
124
137
|
* The following example shows how to load the brandset data, normalize it into a map and then provide it back to the framework
|
|
@@ -140,63 +153,101 @@ class W {
|
|
|
140
153
|
* };
|
|
141
154
|
* ```
|
|
142
155
|
* */
|
|
143
|
-
registerIngredientLoader(e) {
|
|
144
|
-
return
|
|
145
|
-
|
|
146
|
-
e
|
|
156
|
+
registerIngredientLoader(e, t) {
|
|
157
|
+
return s.loader.registerLoader(
|
|
158
|
+
a.IngredientLoader,
|
|
159
|
+
e,
|
|
160
|
+
t
|
|
147
161
|
), this;
|
|
148
162
|
}
|
|
149
163
|
registerIngredientIndex(e) {
|
|
150
|
-
return
|
|
151
|
-
|
|
164
|
+
return s.indexExtension.registerIndexExtension(
|
|
165
|
+
a.IngredientIndex,
|
|
152
166
|
e
|
|
153
167
|
), this;
|
|
154
168
|
}
|
|
155
169
|
/**
|
|
156
|
-
* Registers a
|
|
170
|
+
* Registers a property mapper that derives the `type` property of the {@link IngredientModel}
|
|
171
|
+
* from an {@link IngredientResponse}.
|
|
172
|
+
*
|
|
173
|
+
* @param ingredientTypeMapper - Mapping function that extracts a type string from an {@link IngredientResponse}
|
|
174
|
+
* @param options - Optional {@link ExtensionOptions} to control failure behavior.
|
|
175
|
+
* Defaults to `failurePolicy: "throw"`, which throws an {@link ExtensionException} on mapper failure.
|
|
176
|
+
* Set to `"continue"` to log the error and return a fallback value instead.
|
|
177
|
+
* @returns this instance for chaining
|
|
157
178
|
* */
|
|
158
|
-
registerIngredientTypeMapper(e) {
|
|
159
|
-
return
|
|
160
|
-
|
|
161
|
-
e
|
|
179
|
+
registerIngredientTypeMapper(e, t) {
|
|
180
|
+
return s.propertyMapper.registerPropertyMapper(
|
|
181
|
+
a.IngredientTypeMapper,
|
|
182
|
+
e,
|
|
183
|
+
t
|
|
162
184
|
), this;
|
|
163
185
|
}
|
|
164
186
|
/**
|
|
165
187
|
* Registers a data mapper for the {@link HolderModel} model.
|
|
166
|
-
*
|
|
167
|
-
* @
|
|
188
|
+
*
|
|
189
|
+
* @param holderDataMapper - Mapping function that maps additional data from a {@link HolderResponse}
|
|
190
|
+
* @param options - Optional {@link ExtensionOptions} to control failure behavior.
|
|
191
|
+
* Defaults to `failurePolicy: "throw"`, which throws an {@link ExtensionException} on mapper failure.
|
|
192
|
+
* Set to `"continue"` to log the error and continue processing remaining mappers.
|
|
193
|
+
* @returns this instance for chaining
|
|
168
194
|
*/
|
|
169
|
-
registerHolderDataMapper(e) {
|
|
170
|
-
return
|
|
171
|
-
|
|
172
|
-
e
|
|
195
|
+
registerHolderDataMapper(e, t) {
|
|
196
|
+
return s.dataMapper.registerDataMapper(
|
|
197
|
+
a.HolderMapper,
|
|
198
|
+
e,
|
|
199
|
+
t
|
|
173
200
|
), this;
|
|
174
201
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
202
|
+
/**
|
|
203
|
+
* Registers a property mapper that derives the `type` property of the {@link HolderModel}
|
|
204
|
+
* from a {@link HolderResponse}.
|
|
205
|
+
*
|
|
206
|
+
* @param holderTypeMapper - Mapping function that extracts a type string from a {@link HolderResponse}
|
|
207
|
+
* @param options - Optional {@link ExtensionOptions} to control failure behavior.
|
|
208
|
+
* Defaults to `failurePolicy: "throw"`, which throws an {@link ExtensionException} on mapper failure.
|
|
209
|
+
* Set to `"continue"` to log the error and return a fallback value instead.
|
|
210
|
+
* @returns this instance for chaining
|
|
211
|
+
*/
|
|
212
|
+
registerHolderTypeMapper(e, t) {
|
|
213
|
+
return s.propertyMapper.registerPropertyMapper(
|
|
214
|
+
a.HolderTypeMapper,
|
|
215
|
+
e,
|
|
216
|
+
t
|
|
179
217
|
), this;
|
|
180
218
|
}
|
|
181
219
|
/**
|
|
182
220
|
* Maps the ingredientId property of the holder into the {@link HolderModel}.
|
|
183
221
|
* If not provided, the ingredientId will assume that the value is mapped from the
|
|
184
222
|
* ingredientId property of the service response.
|
|
223
|
+
*
|
|
224
|
+
* @param holderTypeMapper - Mapping function that extracts the ingredientId from a {@link HolderResponse}
|
|
225
|
+
* @param options - Optional {@link ExtensionOptions} to control failure behavior.
|
|
226
|
+
* Defaults to `failurePolicy: "throw"`, which throws an {@link ExtensionException} on mapper failure.
|
|
227
|
+
* Set to `"continue"` to log the error and return a fallback value instead.
|
|
228
|
+
* @returns this instance for chaining
|
|
185
229
|
* */
|
|
186
|
-
registerHolderIngredientMapper(e) {
|
|
187
|
-
return
|
|
188
|
-
|
|
189
|
-
e
|
|
230
|
+
registerHolderIngredientMapper(e, t) {
|
|
231
|
+
return s.propertyMapper.registerPropertyMapper(
|
|
232
|
+
a.HolderTypeMapper,
|
|
233
|
+
e,
|
|
234
|
+
t
|
|
190
235
|
), this;
|
|
191
236
|
}
|
|
192
237
|
registerHolderIndex(e) {
|
|
193
|
-
return
|
|
194
|
-
|
|
238
|
+
return s.indexExtension.registerIndexExtension(
|
|
239
|
+
a.HolderIndex,
|
|
195
240
|
e
|
|
196
241
|
), this;
|
|
197
242
|
}
|
|
198
243
|
/**
|
|
199
|
-
* Maps data into the {@link AvailabilityModel}
|
|
244
|
+
* Maps data into the {@link AvailabilityModel}.
|
|
245
|
+
*
|
|
246
|
+
* @param availabilityMapper - Mapping function that maps a {@link GroupBeverageResponse} into additional availability data
|
|
247
|
+
* @param options - Optional {@link ExtensionOptions} to control failure behavior.
|
|
248
|
+
* Defaults to `failurePolicy: "throw"`, which throws an {@link ExtensionException} on mapper failure.
|
|
249
|
+
* Set to `"continue"` to log the error and continue processing remaining mappers.
|
|
250
|
+
* @returns this instance for chaining
|
|
200
251
|
*
|
|
201
252
|
* @example
|
|
202
253
|
* The following example shows how to map the data from the service response into the {@link AvailabilityModel}.
|
|
@@ -221,14 +272,21 @@ class W {
|
|
|
221
272
|
* };
|
|
222
273
|
* ```
|
|
223
274
|
* */
|
|
224
|
-
registerAvailabilityDataMapper(e) {
|
|
225
|
-
return
|
|
226
|
-
|
|
227
|
-
e
|
|
275
|
+
registerAvailabilityDataMapper(e, t) {
|
|
276
|
+
return s.dataMapper.registerDataMapper(
|
|
277
|
+
a.AvailabilityMapper,
|
|
278
|
+
e,
|
|
279
|
+
t
|
|
228
280
|
), this;
|
|
229
281
|
}
|
|
230
282
|
/**
|
|
231
|
-
* Loads data that will be provided as context into the {@link AvailabilityMapper}
|
|
283
|
+
* Loads data that will be provided as context into the {@link AvailabilityMapper}.
|
|
284
|
+
*
|
|
285
|
+
* @param availabilityLoader - Async function that loads and returns availability context data
|
|
286
|
+
* @param options - Optional {@link ExtensionOptions} to control failure behavior.
|
|
287
|
+
* Defaults to `failurePolicy: "throw"`, which throws an {@link ExtensionException} on loader failure.
|
|
288
|
+
* Set to `"continue"` to log the error and return `undefined` instead.
|
|
289
|
+
* @returns this instance for chaining
|
|
232
290
|
*
|
|
233
291
|
* @example
|
|
234
292
|
* A common use case is to load brandset data that is UI specific and not provided directly by the Java service.
|
|
@@ -257,19 +315,27 @@ class W {
|
|
|
257
315
|
* };
|
|
258
316
|
* ```
|
|
259
317
|
* */
|
|
260
|
-
registerAvailabilityLoader(e) {
|
|
261
|
-
return
|
|
262
|
-
|
|
263
|
-
e
|
|
318
|
+
registerAvailabilityLoader(e, t) {
|
|
319
|
+
return s.loader.registerLoader(
|
|
320
|
+
a.AvailabilityLoader,
|
|
321
|
+
e,
|
|
322
|
+
t
|
|
264
323
|
), this;
|
|
265
324
|
}
|
|
266
325
|
/**
|
|
267
326
|
* Maps the abstract {@link SelectedPourable} data into a format that is specific to the nozzle.
|
|
327
|
+
*
|
|
328
|
+
* @param selectedPourableMapper - Mapping function that transforms {@link SelectedPourable} data
|
|
329
|
+
* @param options - Optional {@link ExtensionOptions} to control failure behavior.
|
|
330
|
+
* Defaults to `failurePolicy: "throw"`, which throws an {@link ExtensionException} on mapper failure.
|
|
331
|
+
* Set to `"continue"` to log the error and continue processing remaining mappers.
|
|
332
|
+
* @returns this instance for chaining
|
|
268
333
|
* */
|
|
269
|
-
registerSelectedPourableDataMapper(e) {
|
|
270
|
-
return
|
|
271
|
-
|
|
272
|
-
e
|
|
334
|
+
registerSelectedPourableDataMapper(e, t) {
|
|
335
|
+
return s.dataMapper.registerDataMapper(
|
|
336
|
+
a.SelectedPourableMapper,
|
|
337
|
+
e,
|
|
338
|
+
t
|
|
273
339
|
), this;
|
|
274
340
|
}
|
|
275
341
|
/**
|
|
@@ -277,6 +343,12 @@ class W {
|
|
|
277
343
|
* Used in cases where the base assembly has been extended with additional properties in the backend. This extension
|
|
278
344
|
* point allows for the data to be mapped into the {@link AssemblyModel} and augmented with additional properties.
|
|
279
345
|
*
|
|
346
|
+
* @param assemblyDataMapper - Mapping function that maps an {@link AssemblyTypes.AssemblyResponse} into additional assembly data
|
|
347
|
+
* @param options - Optional {@link ExtensionOptions} to control failure behavior.
|
|
348
|
+
* Defaults to `failurePolicy: "throw"`, which throws an {@link ExtensionException} on mapper failure.
|
|
349
|
+
* Set to `"continue"` to log the error and continue processing remaining mappers.
|
|
350
|
+
* @returns this instance for chaining
|
|
351
|
+
*
|
|
280
352
|
* @example
|
|
281
353
|
*
|
|
282
354
|
* In this example of an implementation of a {@link AssemblyMapper}, the {@link AssemblyResponse} data is mapped into
|
|
@@ -333,28 +405,39 @@ class W {
|
|
|
333
405
|
* };
|
|
334
406
|
*```
|
|
335
407
|
*/
|
|
336
|
-
registerAssemblyDataMapper(e) {
|
|
337
|
-
return
|
|
338
|
-
|
|
339
|
-
e
|
|
408
|
+
registerAssemblyDataMapper(e, t) {
|
|
409
|
+
return s.dataMapper.registerDataMapper(
|
|
410
|
+
a.AssemblyMapper,
|
|
411
|
+
e,
|
|
412
|
+
t
|
|
340
413
|
), this;
|
|
341
414
|
}
|
|
342
415
|
registerBoardIndex(e) {
|
|
343
|
-
return
|
|
344
|
-
|
|
416
|
+
return s.indexExtension.registerIndexExtension(
|
|
417
|
+
a.BoardIndex,
|
|
345
418
|
e
|
|
346
419
|
), this;
|
|
347
420
|
}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
421
|
+
/**
|
|
422
|
+
* Registers a data mapper for the board model within an assembly.
|
|
423
|
+
*
|
|
424
|
+
* @param boardDataMapper - Mapping function that maps an {@link AssemblyTypes.AssemblyBoard} into additional board data
|
|
425
|
+
* @param options - Optional {@link ExtensionOptions} to control failure behavior.
|
|
426
|
+
* Defaults to `failurePolicy: "throw"`, which throws an {@link ExtensionException} on mapper failure.
|
|
427
|
+
* Set to `"continue"` to log the error and continue processing remaining mappers.
|
|
428
|
+
* @returns this instance for chaining
|
|
429
|
+
*/
|
|
430
|
+
registerBoardDataMapper(e, t) {
|
|
431
|
+
return s.dataMapper.registerDataMapper(
|
|
432
|
+
a.BoardMapper,
|
|
433
|
+
e,
|
|
434
|
+
t
|
|
352
435
|
), this;
|
|
353
436
|
}
|
|
354
437
|
registerAssemblyFeatureFlagResolver(e) {
|
|
355
|
-
var
|
|
356
|
-
return (
|
|
357
|
-
|
|
438
|
+
var t;
|
|
439
|
+
return (t = s[U]) == null || t.register(
|
|
440
|
+
a.AssemblyFeatureFlags,
|
|
358
441
|
e
|
|
359
442
|
), this;
|
|
360
443
|
}
|
|
@@ -378,4 +461,4 @@ export {
|
|
|
378
461
|
oe as g,
|
|
379
462
|
ae as i
|
|
380
463
|
};
|
|
381
|
-
//# sourceMappingURL=extension-utils-
|
|
464
|
+
//# sourceMappingURL=extension-utils-CECRZtAt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-utils-CECRZtAt.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 ExtensionOptions,\n IndexExtension,\n PropertyMapper,\n type FlagResolver,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport { ExtensionType } from \"../constants\";\nimport { AssemblyTypes, type AssemblyModel } from \"../models\";\nimport type { HolderResponse } from \"../models/holder/services\";\nimport type { HolderModel } from \"../models/holder/types\";\nimport type { IngredientResponse } from \"../models/ingredient/services\";\nimport type { BeverageResponse } from \"../models/nozzle/services\";\nimport type { SelectedPourable } from \"../models/nozzle/types\";\n\nexport type IngredientDataMapper<\n AdditionalData extends object = Record<string, any>\n> = DataMapper<IngredientResponse, AdditionalData, any>;\n\n/**\n * Mapping function that maps an ingredient response into the type property of\n * the {@link IngredientModel}.\n */\nexport type IngredientTypeMapper<\n T extends IngredientResponse = IngredientResponse\n> = PropertyMapper<T, string>;\n\n/**\n * Mapping function that maps additional data from holder service response\n * into the {@link HolderModel} data.\n */\nexport type HolderTypeMapper<T extends HolderResponse = HolderResponse> =\n PropertyMapper<T, string>;\n\n/**\n * Mapping function that maps additional data from holder service response\n * into the {@link HolderModel} data.\n */\nexport type HolderDataMapper<\n AdditionalData extends object = Record<string, any>,\n HolderData extends HolderResponse = HolderResponse\n> = DataMapper<HolderData, AdditionalData, any>;\n\nexport type GroupBeverageResponse = BeverageResponse & { groupId: string };\nexport type AvailabilityDataMapper<\n AdditionalData extends object = Record<string, any>,\n AvailabilityData extends GroupBeverageResponse = GroupBeverageResponse\n> = DataMapper<AvailabilityData, AdditionalData, any>;\n\nexport type SelectedPourableMapper = DataMapper<SelectedPourable, any>;\n\nexport type BoardDataMapper<\n AdditionalData extends object = Record<string, any>,\n BoardData extends AssemblyTypes.AssemblyBoard<any> = AssemblyTypes.AssemblyBoard<any>\n> = DataMapper<BoardData, AdditionalData, any>;\n\nexport type AssemblyMapper<\n AdditionalData extends object = Record<string, any>,\n AssemblyResponseData extends AssemblyTypes.AssemblyResponse<any> = AssemblyTypes.AssemblyResponse<any>\n> = DataMapper<AssemblyResponseData, AdditionalData, any>;\n/**\n * The DispenseExtensionManager is responsible for managing the extension points that are specific to the Dispense application.\n */\nexport class DispenseExtensionManager {\n core: CoreExtensionManager = new CoreExtensionManager();\n /**\n * 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 * @param ingredientDataMapper - Mapping function that maps an {@link IngredientResponse} into additional model data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n *\n * @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(\n ingredientDataMapper: IngredientDataMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.IngredientMapper,\n ingredientDataMapper,\n options\n );\n\n return this;\n }\n\n /**\n * Loads data that will be provided as context into the {@link IngredientMapper}.\n *\n * @param ingredientLoader - Async function that loads and returns ingredient context data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on loader failure.\n * Set to `\"continue\"` to log the error and return `undefined` instead.\n * @returns this instance for chaining\n *\n * @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(\n ingredientLoader: DataLoader,\n options?: ExtensionOptions\n ) {\n ExtensionManager.loader.registerLoader(\n ExtensionType.IngredientLoader,\n ingredientLoader,\n options\n );\n return this;\n }\n\n registerIngredientIndex(ingredientIndex: IndexExtension) {\n ExtensionManager.indexExtension.registerIndexExtension(\n ExtensionType.IngredientIndex,\n ingredientIndex\n );\n return this;\n }\n\n /**\n * Registers a property mapper that derives the `type` property of the {@link IngredientModel}\n * from an {@link IngredientResponse}.\n *\n * @param ingredientTypeMapper - Mapping function that extracts a type string from an {@link IngredientResponse}\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and return a fallback value instead.\n * @returns this instance for chaining\n * */\n registerIngredientTypeMapper(\n ingredientTypeMapper: IngredientTypeMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.IngredientTypeMapper,\n ingredientTypeMapper,\n options\n );\n return this;\n }\n\n /**\n * Registers a data mapper for the {@link HolderModel} model.\n *\n * @param holderDataMapper - Mapping function that maps additional data from a {@link HolderResponse}\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n */\n registerHolderDataMapper(\n holderDataMapper: HolderDataMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.HolderMapper,\n holderDataMapper,\n options\n );\n return this;\n }\n\n /**\n * Registers a property mapper that derives the `type` property of the {@link HolderModel}\n * from a {@link HolderResponse}.\n *\n * @param holderTypeMapper - Mapping function that extracts a type string from a {@link HolderResponse}\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and return a fallback value instead.\n * @returns this instance for chaining\n */\n registerHolderTypeMapper(\n holderTypeMapper: HolderTypeMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.HolderTypeMapper,\n holderTypeMapper,\n options\n );\n return this;\n }\n\n /**\n * Maps the ingredientId property of the holder into the {@link HolderModel}.\n * If not provided, the ingredientId will assume that the value is mapped from the\n * ingredientId property of the service response.\n *\n * @param holderTypeMapper - Mapping function that extracts the ingredientId from a {@link HolderResponse}\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and return a fallback value instead.\n * @returns this instance for chaining\n * */\n registerHolderIngredientMapper(\n holderTypeMapper: HolderTypeMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.HolderTypeMapper,\n holderTypeMapper,\n options\n );\n return this;\n }\n\n registerHolderIndex<T extends HolderModel = HolderModel>(\n holderIndex: IndexExtension<T>\n ) {\n ExtensionManager.indexExtension.registerIndexExtension(\n ExtensionType.HolderIndex,\n holderIndex\n );\n return this;\n }\n\n /**\n * Maps data into the {@link AvailabilityModel}.\n *\n * @param availabilityMapper - Mapping function that maps a {@link GroupBeverageResponse} into additional availability data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n *\n * @example\n * 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(\n availabilityMapper: AvailabilityDataMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.AvailabilityMapper,\n availabilityMapper,\n options\n );\n return this;\n }\n\n /**\n * Loads data that will be provided as context into the {@link AvailabilityMapper}.\n *\n * @param availabilityLoader - Async function that loads and returns availability context data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on loader failure.\n * Set to `\"continue\"` to log the error and return `undefined` instead.\n * @returns this instance for chaining\n *\n * @example\n * 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(\n availabilityLoader: DataLoader,\n options?: ExtensionOptions\n ) {\n ExtensionManager.loader.registerLoader(\n ExtensionType.AvailabilityLoader,\n availabilityLoader,\n options\n );\n return this;\n }\n\n /**\n * Maps the abstract {@link SelectedPourable} data into a format that is specific to the nozzle.\n *\n * @param selectedPourableMapper - Mapping function that transforms {@link SelectedPourable} data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n * */\n registerSelectedPourableDataMapper(\n selectedPourableMapper: SelectedPourableMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.SelectedPourableMapper,\n selectedPourableMapper,\n options\n );\n return this;\n }\n\n /**\n * 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 * @param assemblyDataMapper - Mapping function that maps an {@link AssemblyTypes.AssemblyResponse} into additional assembly data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n *\n * @example\n *\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(\n assemblyDataMapper: AssemblyMapper,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.AssemblyMapper,\n assemblyDataMapper,\n options\n );\n return this;\n }\n\n registerBoardIndex(boardIndex: IndexExtension) {\n ExtensionManager.indexExtension.registerIndexExtension(\n ExtensionType.BoardIndex,\n boardIndex\n );\n return this;\n }\n\n /**\n * Registers a data mapper for the board model within an assembly.\n *\n * @param boardDataMapper - Mapping function that maps an {@link AssemblyTypes.AssemblyBoard} into additional board data\n * @param options - Optional {@link ExtensionOptions} to control failure behavior.\n * Defaults to `failurePolicy: \"throw\"`, which throws an {@link ExtensionException} on mapper failure.\n * Set to `\"continue\"` to log the error and continue processing remaining mappers.\n * @returns this instance for chaining\n */\n registerBoardDataMapper(\n boardDataMapper: BoardDataMapper<any, any>,\n options?: ExtensionOptions\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.BoardMapper,\n boardDataMapper,\n options\n );\n return this;\n }\n\n registerAssemblyFeatureFlagResolver(\n assemblyFeatureFlagResolver: FlagResolver<AssemblyModel>\n ) {\n ExtensionManager[EXTENSION_FEATURE_FLAG_RESOLVER]?.register(\n ExtensionType.AssemblyFeatureFlags,\n assemblyFeatureFlagResolver\n );\n return this;\n }\n}\n\n/**\n * The KosExtensionManager provides access to the extension points that are provided in the SDK for Dispense applications.\n *\n * The extension points are divided into two categories:\n *\n * @param core - The core extension {@link CoreExtensionManager} points are used to extend the base models that are provided by the SDK.\n * @param dispense - The dispense extension {@link DispenseExtensionManager} points are used to extend the models that are specific to the Dispense SDK.\n */\nexport class KosExtensionManager {\n dispense: DispenseExtensionManager;\n core: CoreExtensionManager;\n constructor() {\n this.dispense = new DispenseExtensionManager();\n this.core = new CoreExtensionManager();\n }\n}\n"],"names":["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","options","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,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AA;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,EAqEA,2BACEY,GACAZ,GACA;AACA,WAAAC,EAAiB,WAAW;AAAA,MAC1BC,EAAc;AAAA,MACdU;AAAA,MACAZ;AAAA,IAAA,GAEK;AAAA,EACT;AAAA,EAEA,mBAAmBa,GAA4B;AAC7C,WAAAZ,EAAiB,eAAe;AAAA,MAC9BC,EAAc;AAAA,MACdW;AAAA,IAAA,GAEK;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,wBACEC,GACAd,GACA;AACA,WAAAC,EAAiB,WAAW;AAAA,MAC1BC,EAAc;AAAA,MACdY;AAAA,MACAd;AAAA,IAAA,GAEK;AAAA,EACT;AAAA,EAEA,oCACEe,GACA;;AACA,YAAApC,IAAAsB,EAAiBe,CAA+B,MAAhD,QAAArC,EAAmD;AAAA,MACjDuB,EAAc;AAAA,MACda;AAAA,OAEK;AAAA,EACT;AACF;AAUO,MAAME,GAAoB;AAAA,EAG/B,cAAc;AAFd,IAAApB,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-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./dispense-registration-manager-DK1ePXkY.cjs"),o=require("./extension-utils-CAqmOmVh.cjs"),e=require("./pump-provider-C-6CuGgY.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.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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-
|
|
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-
|
|
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-
|
|
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-Cl2UbU1m.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-CECRZtAt.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-DoK4li3d.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";
|
|
@@ -69,7 +69,7 @@ declare class NozzleModelImpl implements PourStrategyAware {
|
|
|
69
69
|
get pourProgress(): number;
|
|
70
70
|
constructor(modelId: string, options: NozzleOptions);
|
|
71
71
|
updateModel(): void;
|
|
72
|
-
setSelectedBrand(brand?: AvailabilityModel): void;
|
|
72
|
+
setSelectedBrand(brand?: AvailabilityModel, _context?: Record<string, any>): void;
|
|
73
73
|
get selectedBrand(): AvailabilityModel<any, Record<string, any>> | undefined;
|
|
74
74
|
/**
|
|
75
75
|
* Set the values used to determine the selected pourable for this nozzle.
|
|
@@ -79,7 +79,7 @@ declare class NozzleModelImpl implements PourStrategyAware {
|
|
|
79
79
|
* @param pourable.additional The additional items such as flavors or other items that could be incorporated
|
|
80
80
|
* into the pourable.
|
|
81
81
|
* */
|
|
82
|
-
setSelectedPourable({ beverage, additional, context
|
|
82
|
+
setSelectedPourable({ beverage, additional, context }: SelectedPourable, forceUpdate?: boolean): Promise<void>;
|
|
83
83
|
/**
|
|
84
84
|
* Utility method that will return the availability nodes that belong to the specified
|
|
85
85
|
* group as defined in the dispenser beverage graph. For example, a dispenser
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nozzle-model.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-dispense-sdk/src/models/models/nozzle/nozzle-model.ts"],"names":[],"mappings":"AACA,OAAO,EAuBL,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,aAAa,EAElB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC1B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAEL,KAAK,iBAAiB,EAEvB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAML,KAAK,oBAAoB,EA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IAMnB,gBAAgB,CAAC,KAAK,CAAC,EAAE,iBAAiB;
|
|
1
|
+
{"version":3,"file":"nozzle-model.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-dispense-sdk/src/models/models/nozzle/nozzle-model.ts"],"names":[],"mappings":"AACA,OAAO,EAuBL,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,aAAa,EAElB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC1B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAEL,KAAK,iBAAiB,EAEvB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAML,KAAK,oBAAoB,EAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EACV,aAAa,EAKb,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAajB,eAAO,MAAM,yBAAyB,6BAA6B,CAAC;AACpE,eAAO,MAAM,0BAA0B,8BAA8B,CAAC;AACtE,eAAO,MAAM,wBAAwB,4BAA4B,CAAC;AAMlE,KAAK,SAAS,GACV,YAAY,GACZ,aAAa,GACb,aAAa,GACb,eAAe,GACf,gBAAgB,CAAC;AAMrB,UAAU,eACR,SAAQ,eAAe,EACrB,aAAa,EACb,eAAe,EACf,cAAc,EACd,oBAAoB,CAAC,SAAS,EAAE,SAAS,CAAC;CAAG;AAEjD;;GAEG;AACH,cAqCM,eAAgB,YAAW,iBAAiB;IAChD,4CAA4C;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,iBAAiB,CAAC,CAAoB;IAC9C,OAAO,CAAC,cAAc,CAAC,CAAoB;IAC3C,OAAO,CAAC,gBAAgB,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