@kosdev-code/kos-freestyle-sdk 2.1.33 → 2.1.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/extension-utils--qB2FP1I.js +237 -0
  2. package/extension-utils--qB2FP1I.js.map +1 -0
  3. package/extension-utils-DQSu9dSv.cjs +2 -0
  4. package/extension-utils-DQSu9dSv.cjs.map +1 -0
  5. package/index.cjs +1 -1
  6. package/index.js +26 -27
  7. package/models/models/ice-agitator/ice-agitator-model.d.ts +5 -4
  8. package/models/models/ice-agitator/ice-agitator-model.d.ts.map +1 -1
  9. package/models/models/ice-agitator/index.d.ts +1 -2
  10. package/models/models/ice-agitator/index.d.ts.map +1 -1
  11. package/models/models/lfcv-pump/index.d.ts +1 -3
  12. package/models/models/lfcv-pump/index.d.ts.map +1 -1
  13. package/models/models/lfcv-pump/lfcv-pump-model.d.ts +8 -7
  14. package/models/models/lfcv-pump/lfcv-pump-model.d.ts.map +1 -1
  15. package/models/utils/extension-utils.d.ts +3 -0
  16. package/models/utils/extension-utils.d.ts.map +1 -1
  17. package/models/utils/extensions/assembly/assembly-data-mapper.d.ts +1 -2
  18. package/models/utils/extensions/assembly/assembly-data-mapper.d.ts.map +1 -1
  19. package/models/utils/extensions/trouble/trouble-utils.d.ts +10 -0
  20. package/models/utils/extensions/trouble/trouble-utils.d.ts.map +1 -0
  21. package/models/utils/services/freestyle/1.6.5/service.d.ts +8 -8
  22. package/models/utils/services/freestyle/1.8.1/service.d.ts +8 -8
  23. package/models/utils/services/freestyle/daily/service.d.ts +8 -8
  24. package/models/utils/services/handle/1.8.1/service.d.ts +8 -8
  25. package/models/utils/services/handle/daily/service.d.ts +8 -8
  26. package/models.cjs +1 -1
  27. package/models.js +16 -17
  28. package/package.json +2 -2
  29. package/{service-B5BitF77.js → service-BuugCicr.js} +534 -544
  30. package/service-BuugCicr.js.map +1 -0
  31. package/service-DSV9Dr2d.cjs +2 -0
  32. package/service-DSV9Dr2d.cjs.map +1 -0
  33. package/ui.cjs +1 -1
  34. package/ui.js +2 -2
  35. package/{use-nutrition-info-CGBsABee.js → use-nutrition-info-CPEwk_O-.js} +11 -11
  36. package/{use-nutrition-info-CGBsABee.js.map → use-nutrition-info-CPEwk_O-.js.map} +1 -1
  37. package/{use-nutrition-info-tOQ6wnpq.cjs → use-nutrition-info-C_myxRvf.cjs} +2 -2
  38. package/{use-nutrition-info-tOQ6wnpq.cjs.map → use-nutrition-info-C_myxRvf.cjs.map} +1 -1
  39. package/extension-utils-BIzRIXwB.cjs +0 -2
  40. package/extension-utils-BIzRIXwB.cjs.map +0 -1
  41. package/extension-utils-D-CdnEQJ.js +0 -220
  42. package/extension-utils-D-CdnEQJ.js.map +0 -1
  43. package/models/models/ice-agitator/ice-agitator-registration.d.ts +0 -85
  44. package/models/models/ice-agitator/ice-agitator-registration.d.ts.map +0 -1
  45. package/models/models/lfcv-pump/lfcv-pump-registration.d.ts +0 -87
  46. package/models/models/lfcv-pump/lfcv-pump-registration.d.ts.map +0 -1
  47. package/models/models/lfcv-pump/services/index.d.ts +0 -2
  48. package/models/models/lfcv-pump/services/index.d.ts.map +0 -1
  49. package/models/models/lfcv-pump/services/lfcv-pump-services.d.ts +0 -10
  50. package/models/models/lfcv-pump/services/lfcv-pump-services.d.ts.map +0 -1
  51. package/service-B5BitF77.js.map +0 -1
  52. package/service-Dlc0A1Rk.cjs +0 -2
  53. package/service-Dlc0A1Rk.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"use-nutrition-info-tOQ6wnpq.cjs","sources":["../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/freestyle-assembly/use-freestyle-assembly.ts","../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/freestyle-nozzle/use-freestyle-nozzle.ts","../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/ice-agitator/use-ice-agitator.ts","../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/ice-agitator/with-ice-agitator.tsx","../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/nutrition/use-nutrition-info.ts"],"sourcesContent":["import { useAssemblyContext } from \"@kosdev-code/kos-dispense-sdk\";\nimport { getKosCompanionModel } from \"@kosdev-code/kos-ui-sdk\";\nimport {\n FreestyleAssembly,\n type FreestyleAssemblyModel,\n} from \"../../../models\";\n\nexport const useFreestyleAssemblyContext =\n (): FreestyleAssemblyModel | null => {\n const { model } = useAssemblyContext();\n\n const freestyleAssembly = model\n ? getKosCompanionModel<FreestyleAssemblyModel>(\n model,\n FreestyleAssembly.type\n )\n : null;\n\n return freestyleAssembly;\n };\n","import { useNozzleContext } from \"@kosdev-code/kos-dispense-sdk\";\nimport { getKosCompanionModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { FreestyleNozzle, type FreestyleNozzleModel } from \"../../../models\";\n\nexport const useFreestyleNozzleContext = (): FreestyleNozzleModel | null => {\n const { model } = useNozzleContext();\n\n const freestyleNozzle = model\n ? getKosCompanionModel<FreestyleNozzleModel>(model, FreestyleNozzle.type)\n : null;\n\n return freestyleNozzle;\n};\n","import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { IceAgitator, type IceAgitatorModel } from \"../../../models\";\n\nexport const useIceAgitator = (id: string) => {\n const modelId = id;\n const result = useKosModel<IceAgitatorModel>({\n modelId,\n modelType: IceAgitator.type,\n options: {},\n });\n\n return result;\n};\n","import { IceAgitatorModel } from \"../../../models\";\nimport { useIceAgitator } from \"./use-ice-agitator\";\n\nexport interface IceAgitatorProps {\n iceAgitator: IceAgitatorModel;\n}\n\nexport function withIceAgitator<T extends IceAgitatorProps = IceAgitatorProps>(\n WrappedComponent: React.ComponentType<T>\n) {\n return (id: string) => (props: Omit<T, keyof IceAgitatorProps>) => {\n const { model, status, KosModelLoader } = useIceAgitator(id);\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} iceAgitator={model} />\n </KosModelLoader>\n );\n };\n}\n","import { kosAutoEffect } from \"@kosdev-code/kos-ui-sdk\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport type { FreestyleNozzleServices } from \"../../../models\";\nimport { useFreestyleNozzleContext } from \"../freestyle-nozzle\";\n\n// Custom function to check deep equality of two arrays\nconst arraysEqual = (a: number[], b: number[]): boolean => {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n};\n\nexport const useNutritionInfo = (cupSizes: number[]) => {\n const freestyleNozzle = useFreestyleNozzleContext();\n const [nutritionInfo, setNutritionInfo] =\n useState<FreestyleNozzleServices.FreestyleNutritionInfoResponse>();\n\n // Use a ref to keep track of the previous cupSizes value\n const prevCupSizesRef = useRef<number[]>([]);\n\n useEffect(() => {\n if (freestyleNozzle && !arraysEqual(cupSizes, prevCupSizesRef.current)) {\n freestyleNozzle.cupSizes = cupSizes;\n prevCupSizesRef.current = cupSizes;\n }\n const disposer = kosAutoEffect(() => {\n if (freestyleNozzle) {\n setNutritionInfo(freestyleNozzle.nutritionInfo);\n }\n });\n\n return () => {\n disposer();\n };\n }, [cupSizes, freestyleNozzle]);\n\n return nutritionInfo;\n};\n"],"names":["useFreestyleAssemblyContext","model","useAssemblyContext","getKosCompanionModel","FreestyleAssembly","useFreestyleNozzleContext","useNozzleContext","FreestyleNozzle","useIceAgitator","id","modelId","useKosModel","IceAgitator","withIceAgitator","WrappedComponent","props","status","KosModelLoader","jsx","arraysEqual","a","b","i","useNutritionInfo","cupSizes","freestyleNozzle","nutritionInfo","setNutritionInfo","useState","prevCupSizesRef","useRef","useEffect","disposer","kosAutoEffect"],"mappings":"kMAOaA,EACX,IAAqC,CACnC,KAAM,CAAE,MAAAC,CAAA,EAAUC,qBAAA,EASlB,OAP0BD,EACtBE,EAAAA,qBACEF,EACAG,oBAAkB,IAAA,EAEpB,IAGN,ECfWC,EAA4B,IAAmC,CAC1E,KAAM,CAAE,MAAAJ,CAAA,EAAUK,mBAAA,EAMlB,OAJwBL,EACpBE,EAAAA,qBAA2CF,EAAOM,EAAAA,gBAAgB,IAAI,EACtE,IAGN,ECTaC,EAAkBC,GAAe,CAC5C,MAAMC,EAAUD,EAOhB,OANeE,EAAAA,YAA8B,CAC3C,QAAAD,EACA,UAAWE,EAAAA,YAAY,KACvB,QAAS,CAAA,CAAC,CACX,CAGH,ECLO,SAASC,EACdC,EACA,CACA,OAAQL,GAAgBM,GAA2C,CACjE,KAAM,CAAE,MAAAd,EAAO,OAAAe,EAAQ,eAAAC,CAAA,EAAmBT,EAAeC,CAAE,EAE3D,OACES,EAAAA,IAACD,EAAA,CAAgB,GAAGD,EAClB,SAAAE,EAAAA,IAACJ,GAAkB,GAAIC,EAAa,YAAad,CAAA,CAAO,CAAA,CAC1D,CAEJ,CACF,CCZA,MAAMkB,EAAc,CAACC,EAAaC,IAAyB,CACzD,GAAID,EAAE,SAAWC,EAAE,OAAQ,MAAO,GAClC,QAASC,EAAI,EAAGA,EAAIF,EAAE,OAAQE,IAC5B,GAAIF,EAAEE,CAAC,IAAMD,EAAEC,CAAC,EAAG,MAAO,GAE5B,MAAO,EACT,EAEaC,EAAoBC,GAAuB,CACtD,MAAMC,EAAkBpB,EAAA,EAClB,CAACqB,EAAeC,CAAgB,EACpCC,WAAA,EAGIC,EAAkBC,EAAAA,OAAiB,EAAE,EAE3CC,OAAAA,EAAAA,UAAU,IAAM,CACVN,GAAmB,CAACN,EAAYK,EAAUK,EAAgB,OAAO,IACnEJ,EAAgB,SAAWD,EAC3BK,EAAgB,QAAUL,GAE5B,MAAMQ,EAAWC,EAAAA,cAAc,IAAM,CAC/BR,GACFE,EAAiBF,EAAgB,aAAa,CAElD,CAAC,EAED,MAAO,IAAM,CACXO,EAAA,CACF,CACF,EAAG,CAACR,EAAUC,CAAe,CAAC,EAEvBC,CACT"}
1
+ {"version":3,"file":"use-nutrition-info-C_myxRvf.cjs","sources":["../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/freestyle-assembly/use-freestyle-assembly.ts","../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/freestyle-nozzle/use-freestyle-nozzle.ts","../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/ice-agitator/use-ice-agitator.ts","../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/ice-agitator/with-ice-agitator.tsx","../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/nutrition/use-nutrition-info.ts"],"sourcesContent":["import { useAssemblyContext } from \"@kosdev-code/kos-dispense-sdk\";\nimport { getKosCompanionModel } from \"@kosdev-code/kos-ui-sdk\";\nimport {\n FreestyleAssembly,\n type FreestyleAssemblyModel,\n} from \"../../../models\";\n\nexport const useFreestyleAssemblyContext =\n (): FreestyleAssemblyModel | null => {\n const { model } = useAssemblyContext();\n\n const freestyleAssembly = model\n ? getKosCompanionModel<FreestyleAssemblyModel>(\n model,\n FreestyleAssembly.type\n )\n : null;\n\n return freestyleAssembly;\n };\n","import { useNozzleContext } from \"@kosdev-code/kos-dispense-sdk\";\nimport { getKosCompanionModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { FreestyleNozzle, type FreestyleNozzleModel } from \"../../../models\";\n\nexport const useFreestyleNozzleContext = (): FreestyleNozzleModel | null => {\n const { model } = useNozzleContext();\n\n const freestyleNozzle = model\n ? getKosCompanionModel<FreestyleNozzleModel>(model, FreestyleNozzle.type)\n : null;\n\n return freestyleNozzle;\n};\n","import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { IceAgitator, type IceAgitatorModel } from \"../../../models\";\n\nexport const useIceAgitator = (id: string) => {\n const modelId = id;\n const result = useKosModel<IceAgitatorModel>({\n modelId,\n modelType: IceAgitator.type,\n options: {},\n });\n\n return result;\n};\n","import { IceAgitatorModel } from \"../../../models\";\nimport { useIceAgitator } from \"./use-ice-agitator\";\n\nexport interface IceAgitatorProps {\n iceAgitator: IceAgitatorModel;\n}\n\nexport function withIceAgitator<T extends IceAgitatorProps = IceAgitatorProps>(\n WrappedComponent: React.ComponentType<T>\n) {\n return (id: string) => (props: Omit<T, keyof IceAgitatorProps>) => {\n const { model, status, KosModelLoader } = useIceAgitator(id);\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} iceAgitator={model} />\n </KosModelLoader>\n );\n };\n}\n","import { kosAutoEffect } from \"@kosdev-code/kos-ui-sdk\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport type { FreestyleNozzleServices } from \"../../../models\";\nimport { useFreestyleNozzleContext } from \"../freestyle-nozzle\";\n\n// Custom function to check deep equality of two arrays\nconst arraysEqual = (a: number[], b: number[]): boolean => {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n};\n\nexport const useNutritionInfo = (cupSizes: number[]) => {\n const freestyleNozzle = useFreestyleNozzleContext();\n const [nutritionInfo, setNutritionInfo] =\n useState<FreestyleNozzleServices.FreestyleNutritionInfoResponse>();\n\n // Use a ref to keep track of the previous cupSizes value\n const prevCupSizesRef = useRef<number[]>([]);\n\n useEffect(() => {\n if (freestyleNozzle && !arraysEqual(cupSizes, prevCupSizesRef.current)) {\n freestyleNozzle.cupSizes = cupSizes;\n prevCupSizesRef.current = cupSizes;\n }\n const disposer = kosAutoEffect(() => {\n if (freestyleNozzle) {\n setNutritionInfo(freestyleNozzle.nutritionInfo);\n }\n });\n\n return () => {\n disposer();\n };\n }, [cupSizes, freestyleNozzle]);\n\n return nutritionInfo;\n};\n"],"names":["useFreestyleAssemblyContext","model","useAssemblyContext","getKosCompanionModel","FreestyleAssembly","useFreestyleNozzleContext","useNozzleContext","FreestyleNozzle","useIceAgitator","id","modelId","useKosModel","IceAgitator","withIceAgitator","WrappedComponent","props","status","KosModelLoader","jsx","arraysEqual","a","b","i","useNutritionInfo","cupSizes","freestyleNozzle","nutritionInfo","setNutritionInfo","useState","prevCupSizesRef","useRef","useEffect","disposer","kosAutoEffect"],"mappings":"kMAOaA,EACX,IAAqC,CACnC,KAAM,CAAE,MAAAC,C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EAAA,CACF,CACF,EAAG,CAACR,EAAUC,CAAe,CAAC,EAEvBC,CACT"}
@@ -1,2 +0,0 @@
1
- "use strict";var u=Object.defineProperty;var g=(r,e,t)=>e in r?u(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var d=(r,e,t)=>(g(r,typeof e!="symbol"?e+"":e,t),t);const i=require("./service-Dlc0A1Rk.cjs"),b=require("@kosdev-code/kos-dispense-sdk"),o=require("@kosdev-code/kos-ui-sdk"),y=Object.freeze(Object.defineProperty({__proto__:null,performCalibrate:i.performCalibrate,performComplete:i.performComplete,performElectricalTest:i.performElectricalTest,performPreCalibrate:i.performPreCalibrate,performVerify:i.performVerify},Symbol.toStringTag,{value:"Module"})),f=Object.freeze(Object.defineProperty({__proto__:null,InvalidRequestError:i.InvalidRequestError,NutritionInfoError:i.NutritionInfoError,getFreestyleNutritionInfo:i.getFreestyleNutritionInfo},Symbol.toStringTag,{value:"Module"})),v=Object.freeze(Object.defineProperty({__proto__:null,replacePump:i.replacePump},Symbol.toStringTag,{value:"Module"})),m=Object.freeze(Object.defineProperty({__proto__:null,getLfcvPumps:i.getLfcvPumps},Symbol.toStringTag,{value:"Module"})),S=Object.freeze(Object.defineProperty({__proto__:null,performCalibrate:i.performCalibrate$1,performComplete:i.performComplete$1,performPreCalibrate:i.performPreCalibrate$1,performVerify:i.performVerify$1},Symbol.toStringTag,{value:"Module"})),I=(r,e)=>(r[e.dbId.toString()]=e,r),M=async(r,e)=>{const s=r.data.assets.reduce(I,{});r.result={...r.result,assets:s},await e()};function w(r){const e={};for(const t in r)if(r.hasOwnProperty(t)&&t.includes("slot")&&!t.includes("slotrb")){const n=t.split(".")[1],a=r[`slot.${n}.beverage`];if(a){e[a]||(e[a]={}),e[a].rank=n;const l=t.replace(`slot.${n}.`,"");e[a][l]=r[t]}}return e}const E=r=>(e,t)=>(e[t]=r.beverageScreens[t],e[t].beverages=w(e[t]),e),_=async(r,e)=>{const t=r.data,s=Object.keys(t.beverageScreens).reduce(E(t),t.beverageScreens);r.result={...r.result,beverageScreens:s},await e()},h=(r,e)=>(r[e.beverageId.toString()]=e,r),F=async(r,e)=>{const t=r.data,s=t.beverages.reduce(h,{}),n=t.beverages.reduce((a,l)=>(a[l.dbId.toString()]=l.beverageId.toString(),a),{});r.result={...r.result,beverages:s,beverageMap:n},await e()};function P(r){const e={rank:0};for(const t in r)if(r.hasOwnProperty(t)&&t.includes("slot")){const s=t.split(".")[1],n=s.split(":")[1],a=r[`slot.${s}.brand`];if(a){e[a]||(e[a]={rank:Number(n)});const l=t.replace(`slot.${s}.`,"");e[a][l]=r[t]}}return e}const B=async(r,e)=>{const t=r.data,s=P(t.brandScreen);r.result={...r.result,brandScreen:s},await e()},R=(r,e)=>(r[e.dbId.toString()]=e,r),O=async(r,e)=>{const s=r.data.brands.reduce(R,{});r.result={...r.result,brands:s},await e()},$=async(r,e)=>{r.result={...r.data},await e()},T=(r,e)=>(r[e.dbId.toString()]=e,r),A=async(r,e)=>{const s=r.data.flavors.reduce(T,{});r.result={...r.result,flavors:s},await e()};function C(r,e){return r[`slotrb:${e}.brand`]}const k=r=>(e,t,s,n)=>{e.relatedBrand||(e.relatedBrand={}),e.relatedBrand[t]||(e.relatedBrand[t]={rank:s});const a=n.replace(`slotrb:${s}.`,"");e.relatedBrand[t][a]=r[n]};function x(r){const e={};for(const t in r)if(r.hasOwnProperty(t)&&t.includes("slot")&&t.includes("slotrb")){const n=t.split(":")[1].split(".")[0],a=C(r,n);k(r)(e,a,n,t)}return e}const N=r=>(e,t)=>(e[t]=r.beverageScreens[t],e[t].beverages={...e[t].beverages,...x(e[t])},e),q=async(r,e)=>{const t=r.data,s=Object.keys(t.beverageScreens).reduce(N(t),t.beverageScreens);r.result={...r.result,beverageScreens:s},await e()},z=async(r,e=[],t=!1)=>{const s=t?[...e]:[$,M,A,F,O,_,q,B,...e];return await o.processMiddleware(r,s)},L=({url:r="http://localhost:8081/system/cui/core.json",middleware:e=[],replace:t=!1}={})=>async()=>{const s=await o.kosFetch(r);if(s.ok){const n=await s.json();if(!n)throw new Error("Failed to parse availability context");return await z(n,e,t)}throw new Error("Failed to load availability context")},V=async r=>{const{id:e,name:t,...s}=r;return{...s,ingredientMacro:s.bib&&!s.sweetener?"macro":"micro"}},K={macro:"ingredientMacro"},U=async r=>{var e;return{bevId:(e=r.beverage)==null?void 0:e.rawId}},c="pluginVisibility";class p{constructor(e,t){d(this,"core");d(this,"dispense");this.core=e,this.dispense=t}registerFreestyleBrandsetReader(e={}){return this.dispense.registerAvailabilityLoader(L(e)),this}registerFreestylePourableMapper(){this.dispense.registerSelectedPourableDataMapper(U)}registerFreestyleAssemblyMapper(){this.dispense.registerAssemblyDataMapper(i.freestyleAssemblyDataMapper)}registerFreestyleIngredientIndex(){this.dispense.registerIngredientIndex(K)}registerFreestyleIngredientDataMapper(){this.dispense.registerIngredientDataMapper(V)}registerFreestyleIceAgitator(){o.ExtensionManager[c].register(c,e=>e!=="iceAgitator"||o.KosFeatureFlags.isFeatureEnabled(i.FEATURE_SUPPORTS_ICE))}registerFreestyleAgitationRequiredTroubleMapper(){o.ExtensionManager[o.EXTENSION_TROUBLE_DATA_MAPPER].register("agitationRequired",async e=>({isAgitationRequired:!!e.data.agitationRequired}))}initializeFreestyleExtension(){this.registerFreestylePourableMapper(),this.registerFreestyleAssemblyMapper(),this.registerFreestyleIngredientIndex(),this.registerFreestyleIngredientDataMapper(),this.registerFreestyleIceAgitator(),this.registerFreestyleAgitationRequiredTroubleMapper()}}class j{constructor(){d(this,"dispense");d(this,"core");d(this,"freestyle");this.dispense=new b.DispenseExtensionManager,this.core=new o.CoreExtensionManager,this.freestyle=new p(this.core,this.dispense)}}exports.EXTENSION_PLUGIN_VISIBILITY=c;exports.FreestyleExtensionManager=p;exports.KosExtensionManager=j;exports.index=y;exports.index$1=f;exports.index$2=v;exports.index$3=m;exports.index$4=S;
2
- //# sourceMappingURL=extension-utils-BIzRIXwB.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extension-utils-BIzRIXwB.cjs","sources":["../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/assets.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/beverage-screen.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/beverages.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/brand-screen.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/brands.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/copy-input.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/flavors.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/util/locate-brand.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/util/process-related-brand.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/related-brands.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/freestyle-loader.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/ingredient/model-extension.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/pourable/select-pourable-mapper.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extension-utils.ts"],"sourcesContent":["import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type { Asset, AvailabilityContext, UiSchemaResponse } from \"../types\";\n\nconst assetReducer = (acc: Record<string, Asset>, asset: Asset) => {\n acc[asset.dbId.toString()] = asset;\n return acc;\n};\n\n/**\n * Middleware that will normalize the assets array into a dictionary\n * @param context The context object that contains the data and result\n * @param next called at the end of the middleware to indicate that the next middleware can be called\n */\nexport const assetsMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const assets = input.assets.reduce(assetReducer, {} as Record<string, Asset>);\n context.result = { ...context.result, assets };\n await next();\n};\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type {\n AvailabilityContext,\n BeverageScreen,\n BeverageScreenData,\n UiSchemaResponse,\n} from \"../types\";\n\nfunction organizeBeverageData(\n jsonData: Record<string, any>\n): BeverageScreenData {\n const beverageData: BeverageScreenData = {};\n\n for (const key in jsonData) {\n // eslint-disable-next-line no-prototype-builtins\n if (jsonData.hasOwnProperty(key) && key.includes(\"slot\")) {\n const relatedBrand = key.includes(\"slotrb\");\n if (!relatedBrand) {\n const slot = key.split(\".\")[1]; // Extracting the slot number\n const beverageId = jsonData[`slot.${slot}.beverage`];\n\n if (beverageId) {\n // eslint-disable-next-line max-depth\n if (!beverageData[beverageId]) {\n beverageData[beverageId] = {};\n }\n\n beverageData[beverageId].rank = slot;\n // Removing the slot.x part from the key and adding to the object\n const beverageKey = key.replace(`slot.${slot}.`, \"\");\n beverageData[beverageId][beverageKey] = jsonData[key];\n }\n }\n }\n }\n\n return beverageData;\n}\nconst beverageScreenReducer =\n (input: UiSchemaResponse) =>\n (acc: Record<string, BeverageScreen>, curr: string) => {\n acc[curr] = input.beverageScreens[curr];\n acc[curr].beverages = organizeBeverageData(acc[curr]);\n return acc;\n };\n\n/**\n * Middleware that will normalize the beverage screen data. The middleware will perform the following:\n * 1. Organize the beverage screen data into a dictionary keyed by the brand id\n * 2. Adds a beverages property to the beverage screen data that contains the organized beverage data\n * 3. Processes related brands for each beverage screen\n *\n * @param context The context object that contains the data and result\n * @param next called at the end of the middleware to indicate that the next middleware can be called\n */\nexport const beverageScreenMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const beverageScreens = Object.keys(input.beverageScreens).reduce(\n beverageScreenReducer(input),\n input.beverageScreens\n );\n context.result = { ...context.result, beverageScreens };\n await next();\n};\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type { AvailabilityContext, Beverage, UiSchemaResponse } from \"../types\";\n\nconst beverageReducer = (acc: Record<string, Beverage>, beverage: Beverage) => {\n acc[beverage.beverageId.toString()] = beverage;\n return acc;\n};\n\n/**\n * Middleware that will normalize the brands array into a dictionary\n * @param context The context object that contains the data and result\n * @param next called at the end of the middleware to indicate that the next middleware can be called\n */\nexport const beveragesMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const beverages = input.beverages.reduce(\n beverageReducer,\n {} as Record<string, Beverage>\n );\n const beverageMap = input.beverages.reduce((acc, curr) => {\n acc[curr.dbId.toString()] = curr.beverageId.toString();\n return acc;\n }, {} as Record<string, string>);\n context.result = { ...context.result, beverages, beverageMap };\n await next();\n};\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type {\n AvailabilityContext,\n BrandScreenData,\n UiSchemaResponse,\n} from \"../types\";\n\nfunction organizeBrandData(jsonData: Record<string, any>): Record<string, any> {\n const brandScreenData: BrandScreenData = { rank: 0 };\n\n for (const key in jsonData) {\n // eslint-disable-next-line no-prototype-builtins\n if (jsonData.hasOwnProperty(key) && key.includes(\"slot\")) {\n const slot = key.split(\".\")[1]; // Extracting the slot number\n const position = slot.split(\":\")[1]; // Extracting the position number\n const brandId = jsonData[`slot.${slot}.brand`];\n\n if (brandId) {\n if (!brandScreenData[brandId]) {\n brandScreenData[brandId] = {\n rank: Number(position),\n };\n }\n\n // Removing the slot.x part from the key and adding to the object\n const brandKey = key.replace(`slot.${slot}.`, \"\");\n brandScreenData[brandId][brandKey] = jsonData[key];\n }\n }\n }\n\n return brandScreenData;\n}\nexport const brandScreenMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const brandScreen = organizeBrandData(input.brandScreen);\n context.result = { ...context.result, brandScreen };\n await next();\n};\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type { AvailabilityContext, Brand, UiSchemaResponse } from \"../types\";\n\nconst brandReducer = (acc: Record<string, Brand>, brand: Brand) => {\n acc[brand.dbId.toString()] = brand;\n return acc;\n};\n\n/**\n * Middleware that will normalize the brands array into a dictionary\n * @param context The context object that contains the data and result\n * @param next called at the end of the middleware to indicate that the next middleware can be called\n */\nexport const brandsMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const brands = input.brands.reduce(brandReducer, {} as Record<string, Brand>);\n context.result = { ...context.result, brands };\n await next();\n};\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\n\nexport const copyMiddleware: Middleware<any, any> = async (context, next) => {\n context.result = { ...context.data };\n await next();\n};\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type { AvailabilityContext, Flavor, UiSchemaResponse } from \"../types\";\n\nconst flavorReducer = (acc: Record<string, Flavor>, flavor: Flavor) => {\n acc[flavor.dbId.toString()] = flavor;\n return acc;\n};\n\n/**\n * Middleware that will normalize the flavors array into a dictionary\n * @param context The context object that contains the data and result\n * @param next called at the end of the middleware to indicate that the next middleware can be called\n */\nexport const flavorsMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const flavors = input.flavors.reduce(\n flavorReducer,\n {} as Record<string, Flavor>\n );\n context.result = { ...context.result, flavors };\n await next();\n};\n","export function locateRelatedBrand(\n jsonData: Record<string, any>,\n slot: string\n) {\n const relatedBrand = jsonData[`slotrb:${slot}.brand`];\n return relatedBrand;\n}\n","import type { BeverageScreenData } from \"../types\";\n\nexport const processRelatedBrand =\n (json: Record<string, any>) =>\n (\n beverageData: BeverageScreenData,\n brandId: string,\n slot: string,\n key: string\n ) => {\n if (!beverageData.relatedBrand) {\n beverageData.relatedBrand = {};\n }\n\n if (!beverageData.relatedBrand[brandId]) {\n beverageData.relatedBrand[brandId] = {\n rank: slot,\n };\n }\n\n const beverageKey = key.replace(`slotrb:${slot}.`, \"\");\n beverageData.relatedBrand[brandId][beverageKey] = json[key];\n };\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type {\n AvailabilityContext,\n BeverageScreen,\n BeverageScreenData,\n UiSchemaResponse,\n} from \"../types\";\nimport { locateRelatedBrand } from \"../util/locate-brand\";\nimport { processRelatedBrand } from \"../util/process-related-brand\";\n\nfunction organizeBeverageData(\n jsonData: Record<string, any>\n): BeverageScreenData {\n const beverageData: BeverageScreenData = {};\n\n for (const key in jsonData) {\n // eslint-disable-next-line no-prototype-builtins\n if (jsonData.hasOwnProperty(key) && key.includes(\"slot\")) {\n const relatedBrand = key.includes(\"slotrb\");\n if (relatedBrand) {\n const slot = key.split(\":\")[1].split(\".\")[0]; // Extracting the slot number\n const relatedBrand = locateRelatedBrand(jsonData, slot);\n processRelatedBrand(jsonData)(beverageData, relatedBrand, slot, key);\n }\n }\n }\n\n return beverageData;\n}\nconst beverageScreenReducer =\n (input: UiSchemaResponse) =>\n (acc: Record<string, BeverageScreen>, curr: string) => {\n acc[curr] = input.beverageScreens[curr];\n acc[curr].beverages = {\n ...acc[curr].beverages,\n ...organizeBeverageData(acc[curr]),\n };\n return acc;\n };\n\n/**\n * Middleware that will normalize the beverage screen data. The middleware will perform the following:\n * 1. Organize the beverage screen data into a dictionary keyed by the brand id\n * 2. Adds a beverages property to the beverage screen data that contains the organized beverage data\n * 3. Processes related brands for each beverage screen\n *\n * @param context The context object that contains the data and result\n * @param next called at the end of the middleware to indicate that the next middleware can be called\n */\nexport const relatedBrandMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const beverageScreens = Object.keys(input.beverageScreens).reduce(\n beverageScreenReducer(input),\n input.beverageScreens\n );\n context.result = { ...context.result, beverageScreens };\n await next();\n};\n","import {\n kosFetch,\n processMiddleware,\n type DataLoader,\n type Middleware,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport { assetsMiddleware } from \"./middleware/assets\";\nimport { beverageScreenMiddleware } from \"./middleware/beverage-screen\";\nimport { beveragesMiddleware } from \"./middleware/beverages\";\nimport { brandScreenMiddleware } from \"./middleware/brand-screen\";\nimport { brandsMiddleware } from \"./middleware/brands\";\nimport { copyMiddleware } from \"./middleware/copy-input\";\nimport { flavorsMiddleware } from \"./middleware/flavors\";\nimport { relatedBrandMiddleware } from \"./middleware/related-brands\";\nimport type { AvailabilityContext, UiSchemaResponse } from \"./types\";\n\nexport const transformAvailabilityData = async (\n input: UiSchemaResponse,\n additionalMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n >[] = [],\n replace = false\n): Promise<AvailabilityContext> => {\n const middleware = replace\n ? [...additionalMiddleware]\n : [\n copyMiddleware,\n assetsMiddleware,\n flavorsMiddleware,\n beveragesMiddleware,\n brandsMiddleware,\n beverageScreenMiddleware,\n relatedBrandMiddleware,\n brandScreenMiddleware,\n ...additionalMiddleware,\n ];\n const availabilityContext = await processMiddleware<\n UiSchemaResponse,\n AvailabilityContext\n >(input, middleware);\n\n return availabilityContext;\n};\n\n/**\n * Props for the freestyle availability loader\n */\nexport interface AvailabilityLoaderProps {\n /** the url to send the request for the UiSchemaData. Defaults to http://localhost:8081/system/cui/core.json */\n url?: string;\n\n /** additional middlewares to execute as part of the data processing */\n middleware?: Middleware<UiSchemaResponse, AvailabilityContext>[];\n\n /** if true, replace the default middleware with the provided middleware */\n replace?: boolean;\n}\n/**\n * Utility method to load the freestyle brandset data into the availability context.\n *\n * This loader will retrieve the UI Schema from the provided URL and transform it into\n * a format that can be used to populate the availability brands and beverages with UI schema\n * data.\n *\n * With this data, the availability models can have access to the brandset assets for\n * brands, beverages and flavours.\n *\n *\n * @param props\n * @returns A DataLoader function that will load the availability context\n */\nexport const freestyleAvailabilityLoader =\n ({\n url = \"http://localhost:8081/system/cui/core.json\",\n middleware = [],\n replace = false,\n }: AvailabilityLoaderProps = {}): DataLoader =>\n async (): Promise<AvailabilityContext> => {\n const schema = await kosFetch(url);\n if (schema.ok) {\n const response = await schema.json<UiSchemaResponse>();\n if (!response) {\n throw new Error(\"Failed to parse availability context\");\n }\n return await transformAvailabilityData(response, middleware, replace);\n }\n throw new Error(\"Failed to load availability context\");\n };\n","import {\n DataMapper,\n IndexExtension,\n PropertyMapper,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport type {\n FreestyleIngredientData,\n FreestyleIngredientModelData,\n FreestyleIngredientResponseData,\n} from \"../../../models/types/ingredients\";\n\nexport const ingredientDataMapper: DataMapper = async (\n data: FreestyleIngredientResponseData\n) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { id, name, ...rest } = data;\n const response: FreestyleIngredientData = {\n ...rest,\n ingredientMacro: rest.bib && !rest.sweetener ? \"macro\" : \"micro\",\n };\n return response;\n};\n\nexport const ingredientIndexExtension: IndexExtension<FreestyleIngredientModelData> =\n {\n macro: \"ingredientMacro\",\n };\nexport const ingredientCategoryMapper: PropertyMapper = (\n ingredientData: FreestyleIngredientResponseData\n) => ingredientData.type;\n","import type { SelectedPourable } from \"@kosdev-code/kos-dispense-sdk\";\n\nexport const pourableRequestMapper = async (data: SelectedPourable) => {\n return {\n bevId: data.beverage?.rawId,\n };\n};\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { DispenseExtensionManager } from \"@kosdev-code/kos-dispense-sdk\";\nimport {\n CoreExtensionManager,\n EXTENSION_TROUBLE_DATA_MAPPER,\n ExtensionManager,\n KosFeatureFlags,\n type TroubleModel,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport type { AgitationRequiredTroubleIface } from \"../models/cartridge-agitator/types\";\nimport { FEATURE_SUPPORTS_ICE } from \"../models/freestyle-assembly/freestyle-assembly-model\";\nimport { freestyleAssemblyDataMapper } from \"./extensions/assembly/assembly-data-mapper\";\nimport {\n freestyleAvailabilityLoader,\n type AvailabilityLoaderProps,\n} from \"./extensions/availability/freestyle-loader\";\nimport {\n ingredientDataMapper,\n ingredientIndexExtension,\n} from \"./extensions/ingredient\";\nimport { pourableRequestMapper } from \"./extensions/pourable/select-pourable-mapper\";\nexport const EXTENSION_PLUGIN_VISIBILITY = \"pluginVisibility\";\n\nexport class FreestyleExtensionManager {\n core: CoreExtensionManager;\n dispense: DispenseExtensionManager;\n constructor(core: CoreExtensionManager, dispense: DispenseExtensionManager) {\n this.core = core;\n this.dispense = dispense;\n }\n\n /**\n * Loads the core brandset data into a format that can be consumed by the\n * freestyle models.\n * */\n registerFreestyleBrandsetReader(props: AvailabilityLoaderProps = {}) {\n this.dispense.registerAvailabilityLoader(\n freestyleAvailabilityLoader(props)\n );\n\n return this;\n }\n\n registerFreestylePourableMapper() {\n this.dispense.registerSelectedPourableDataMapper(pourableRequestMapper);\n }\n\n registerFreestyleAssemblyMapper() {\n this.dispense.registerAssemblyDataMapper(freestyleAssemblyDataMapper);\n }\n\n registerFreestyleIngredientIndex() {\n this.dispense.registerIngredientIndex(ingredientIndexExtension);\n }\n\n registerFreestyleIngredientDataMapper() {\n this.dispense.registerIngredientDataMapper(ingredientDataMapper);\n }\n\n registerFreestyleIceAgitator() {\n ExtensionManager[EXTENSION_PLUGIN_VISIBILITY].register(\n EXTENSION_PLUGIN_VISIBILITY,\n (key) =>\n key !== \"iceAgitator\" ||\n KosFeatureFlags.isFeatureEnabled(FEATURE_SUPPORTS_ICE)\n );\n }\n\n registerFreestyleAgitationRequiredTroubleMapper() {\n ExtensionManager[EXTENSION_TROUBLE_DATA_MAPPER].register(\n \"agitationRequired\",\n async (trouble: TroubleModel<AgitationRequiredTroubleIface>) => {\n return { isAgitationRequired: !!trouble.data.agitationRequired };\n }\n );\n }\n\n initializeFreestyleExtension() {\n this.registerFreestylePourableMapper();\n this.registerFreestyleAssemblyMapper();\n this.registerFreestyleIngredientIndex();\n this.registerFreestyleIngredientDataMapper();\n this.registerFreestyleIceAgitator();\n this.registerFreestyleAgitationRequiredTroubleMapper();\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 freestyle: FreestyleExtensionManager;\n constructor() {\n this.dispense = new DispenseExtensionManager();\n this.core = new CoreExtensionManager();\n this.freestyle = new FreestyleExtensionManager(this.core, this.dispense);\n }\n}\n"],"names":["assetReducer","acc","asset","assetsMiddleware","context","next","assets","organizeBeverageData","jsonData","beverageData","key","slot","beverageId","beverageKey","beverageScreenReducer","input","curr","beverageScreenMiddleware","beverageScreens","beverageReducer","beverage","beveragesMiddleware","beverages","beverageMap","organizeBrandData","brandScreenData","position","brandId","brandKey","brandScreenMiddleware","brandScreen","brandReducer","brand","brandsMiddleware","brands","copyMiddleware","flavorReducer","flavor","flavorsMiddleware","flavors","locateRelatedBrand","processRelatedBrand","json","relatedBrand","relatedBrandMiddleware","transformAvailabilityData","additionalMiddleware","replace","middleware","processMiddleware","freestyleAvailabilityLoader","url","schema","kosFetch","response","ingredientDataMapper","data","id","name","rest","ingredientIndexExtension","pourableRequestMapper","_a","EXTENSION_PLUGIN_VISIBILITY","FreestyleExtensionManager","core","dispense","__publicField","props","freestyleAssemblyDataMapper","ExtensionManager","KosFeatureFlags","FEATURE_SUPPORTS_ICE","EXTENSION_TROUBLE_DATA_MAPPER","trouble","KosExtensionManager","DispenseExtensionManager","CoreExtensionManager"],"mappings":"gxCAGMA,EAAe,CAACC,EAA4BC,KAChDD,EAAIC,EAAM,KAAK,SAAA,CAAU,EAAIA,EACtBD,GAQIE,EAGT,MAAOC,EAASC,IAAS,CAE3B,MAAMC,EADQF,EAAQ,KACD,OAAO,OAAOJ,EAAc,CAAA,CAA2B,EAC5EI,EAAQ,OAAS,CAAE,GAAGA,EAAQ,OAAQ,OAAAE,CAAA,EACtC,MAAMD,EAAA,CACR,ECbA,SAASE,EACPC,EACoB,CACpB,MAAMC,EAAmC,CAAA,EAEzC,UAAWC,KAAOF,EAEhB,GAAIA,EA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CAAgCE,EAAiC,GAAI,CACnE,YAAK,SAAS,2BACZlB,EAA4BkB,CAAK,CAAA,EAG5B,IACT,CAEA,iCAAkC,CAChC,KAAK,SAAS,mCAAmCP,CAAqB,CACxE,CAEA,iCAAkC,CAChC,KAAK,SAAS,2BAA2BQ,6BAA2B,CACtE,CAEA,kCAAmC,CACjC,KAAK,SAAS,wBAAwBT,CAAwB,CAChE,CAEA,uCAAwC,CACtC,KAAK,SAAS,6BAA6BL,CAAoB,CACjE,CAEA,8BAA+B,CAC7Be,EAAAA,iBAAiBP,CAA2B,EAAE,SAC5CA,EACCrD,GACCA,IAAQ,eACR6D,EAAAA,gBAAgB,iBAAiBC,EAAAA,oBAAoB,CAAA,CAE3D,CAEA,iDAAkD,CAChDF,EAAAA,iBAAiBG,EAAAA,6BAA6B,EAAE,SAC9C,oBACA,MAAOC,IACE,CAAE,oBAAqB,CAAC,CAACA,EAAQ,KAAK,iBAAA,EAC/C,CAEJ,CAEA,8BAA+B,CAC7B,KAAK,gCAAA,EACL,KAAK,gCAAA,EACL,KAAK,iCAAA,EACL,KAAK,sCAAA,EACL,KAAK,6BAAA,EACL,KAAK,gDAAA,CACP,CACF,CASO,MAAMC,CAAoB,CAI/B,aAAc,CAHdR,EAAA,iBACAA,EAAA,aACAA,EAAA,kBAEE,KAAK,SAAW,IAAIS,2BACpB,KAAK,KAAO,IAAIC,uBAChB,KAAK,UAAY,IAAIb,EAA0B,KAAK,KAAM,KAAK,QAAQ,CACzE,CACF"}
@@ -1,220 +0,0 @@
1
- var c = Object.defineProperty;
2
- var p = (r, e, t) => e in r ? c(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var o = (r, e, t) => (p(r, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { p as u, q as g, t as b, u as y, v as f, w as v, N as m, x as S, y as M, z as w, B as I, D as h, E as _, G as E, H as F, J as B } from "./service-B5BitF77.js";
5
- import { DispenseExtensionManager as P } from "@kosdev-code/kos-dispense-sdk";
6
- import { kosFetch as R, processMiddleware as O, ExtensionManager as l, KosFeatureFlags as A, EXTENSION_TROUBLE_DATA_MAPPER as $, CoreExtensionManager as T } from "@kosdev-code/kos-ui-sdk";
7
- const de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8
- __proto__: null,
9
- performCalibrate: u,
10
- performComplete: g,
11
- performElectricalTest: b,
12
- performPreCalibrate: y,
13
- performVerify: f
14
- }, Symbol.toStringTag, { value: "Module" })), ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
15
- __proto__: null,
16
- InvalidRequestError: v,
17
- NutritionInfoError: m,
18
- getFreestyleNutritionInfo: S
19
- }, Symbol.toStringTag, { value: "Module" })), pe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
20
- __proto__: null,
21
- replacePump: M
22
- }, Symbol.toStringTag, { value: "Module" })), ue = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
23
- __proto__: null,
24
- getLfcvPumps: w
25
- }, Symbol.toStringTag, { value: "Module" })), ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
26
- __proto__: null,
27
- performCalibrate: I,
28
- performComplete: h,
29
- performPreCalibrate: _,
30
- performVerify: E
31
- }, Symbol.toStringTag, { value: "Module" })), C = (r, e) => (r[e.dbId.toString()] = e, r), k = async (r, e) => {
32
- const s = r.data.assets.reduce(C, {});
33
- r.result = { ...r.result, assets: s }, await e();
34
- };
35
- function z(r) {
36
- const e = {};
37
- for (const t in r)
38
- if (r.hasOwnProperty(t) && t.includes("slot") && !t.includes("slotrb")) {
39
- const a = t.split(".")[1], n = r[`slot.${a}.beverage`];
40
- if (n) {
41
- e[n] || (e[n] = {}), e[n].rank = a;
42
- const i = t.replace(`slot.${a}.`, "");
43
- e[n][i] = r[t];
44
- }
45
- }
46
- return e;
47
- }
48
- const N = (r) => (e, t) => (e[t] = r.beverageScreens[t], e[t].beverages = z(e[t]), e), q = async (r, e) => {
49
- const t = r.data, s = Object.keys(t.beverageScreens).reduce(
50
- N(t),
51
- t.beverageScreens
52
- );
53
- r.result = { ...r.result, beverageScreens: s }, await e();
54
- }, x = (r, e) => (r[e.beverageId.toString()] = e, r), K = async (r, e) => {
55
- const t = r.data, s = t.beverages.reduce(
56
- x,
57
- {}
58
- ), a = t.beverages.reduce((n, i) => (n[i.dbId.toString()] = i.beverageId.toString(), n), {});
59
- r.result = { ...r.result, beverages: s, beverageMap: a }, await e();
60
- };
61
- function L(r) {
62
- const e = { rank: 0 };
63
- for (const t in r)
64
- if (r.hasOwnProperty(t) && t.includes("slot")) {
65
- const s = t.split(".")[1], a = s.split(":")[1], n = r[`slot.${s}.brand`];
66
- if (n) {
67
- e[n] || (e[n] = {
68
- rank: Number(a)
69
- });
70
- const i = t.replace(`slot.${s}.`, "");
71
- e[n][i] = r[t];
72
- }
73
- }
74
- return e;
75
- }
76
- const j = async (r, e) => {
77
- const t = r.data, s = L(t.brandScreen);
78
- r.result = { ...r.result, brandScreen: s }, await e();
79
- }, V = (r, e) => (r[e.dbId.toString()] = e, r), D = async (r, e) => {
80
- const s = r.data.brands.reduce(V, {});
81
- r.result = { ...r.result, brands: s }, await e();
82
- }, U = async (r, e) => {
83
- r.result = { ...r.data }, await e();
84
- }, G = (r, e) => (r[e.dbId.toString()] = e, r), X = async (r, e) => {
85
- const s = r.data.flavors.reduce(
86
- G,
87
- {}
88
- );
89
- r.result = { ...r.result, flavors: s }, await e();
90
- };
91
- function H(r, e) {
92
- return r[`slotrb:${e}.brand`];
93
- }
94
- const J = (r) => (e, t, s, a) => {
95
- e.relatedBrand || (e.relatedBrand = {}), e.relatedBrand[t] || (e.relatedBrand[t] = {
96
- rank: s
97
- });
98
- const n = a.replace(`slotrb:${s}.`, "");
99
- e.relatedBrand[t][n] = r[a];
100
- };
101
- function Y(r) {
102
- const e = {};
103
- for (const t in r)
104
- if (r.hasOwnProperty(t) && t.includes("slot") && t.includes("slotrb")) {
105
- const a = t.split(":")[1].split(".")[0], n = H(r, a);
106
- J(r)(e, n, a, t);
107
- }
108
- return e;
109
- }
110
- const Q = (r) => (e, t) => (e[t] = r.beverageScreens[t], e[t].beverages = {
111
- ...e[t].beverages,
112
- ...Y(e[t])
113
- }, e), W = async (r, e) => {
114
- const t = r.data, s = Object.keys(t.beverageScreens).reduce(
115
- Q(t),
116
- t.beverageScreens
117
- );
118
- r.result = { ...r.result, beverageScreens: s }, await e();
119
- }, Z = async (r, e = [], t = !1) => {
120
- const s = t ? [...e] : [
121
- U,
122
- k,
123
- X,
124
- K,
125
- D,
126
- q,
127
- W,
128
- j,
129
- ...e
130
- ];
131
- return await O(r, s);
132
- }, ee = ({
133
- url: r = "http://localhost:8081/system/cui/core.json",
134
- middleware: e = [],
135
- replace: t = !1
136
- } = {}) => async () => {
137
- const s = await R(r);
138
- if (s.ok) {
139
- const a = await s.json();
140
- if (!a)
141
- throw new Error("Failed to parse availability context");
142
- return await Z(a, e, t);
143
- }
144
- throw new Error("Failed to load availability context");
145
- }, re = async (r) => {
146
- const { id: e, name: t, ...s } = r;
147
- return {
148
- ...s,
149
- ingredientMacro: s.bib && !s.sweetener ? "macro" : "micro"
150
- };
151
- }, te = {
152
- macro: "ingredientMacro"
153
- }, se = async (r) => {
154
- var e;
155
- return {
156
- bevId: (e = r.beverage) == null ? void 0 : e.rawId
157
- };
158
- }, d = "pluginVisibility";
159
- class ae {
160
- constructor(e, t) {
161
- o(this, "core");
162
- o(this, "dispense");
163
- this.core = e, this.dispense = t;
164
- }
165
- /**
166
- * Loads the core brandset data into a format that can be consumed by the
167
- * freestyle models.
168
- * */
169
- registerFreestyleBrandsetReader(e = {}) {
170
- return this.dispense.registerAvailabilityLoader(
171
- ee(e)
172
- ), this;
173
- }
174
- registerFreestylePourableMapper() {
175
- this.dispense.registerSelectedPourableDataMapper(se);
176
- }
177
- registerFreestyleAssemblyMapper() {
178
- this.dispense.registerAssemblyDataMapper(F);
179
- }
180
- registerFreestyleIngredientIndex() {
181
- this.dispense.registerIngredientIndex(te);
182
- }
183
- registerFreestyleIngredientDataMapper() {
184
- this.dispense.registerIngredientDataMapper(re);
185
- }
186
- registerFreestyleIceAgitator() {
187
- l[d].register(
188
- d,
189
- (e) => e !== "iceAgitator" || A.isFeatureEnabled(B)
190
- );
191
- }
192
- registerFreestyleAgitationRequiredTroubleMapper() {
193
- l[$].register(
194
- "agitationRequired",
195
- async (e) => ({ isAgitationRequired: !!e.data.agitationRequired })
196
- );
197
- }
198
- initializeFreestyleExtension() {
199
- this.registerFreestylePourableMapper(), this.registerFreestyleAssemblyMapper(), this.registerFreestyleIngredientIndex(), this.registerFreestyleIngredientDataMapper(), this.registerFreestyleIceAgitator(), this.registerFreestyleAgitationRequiredTroubleMapper();
200
- }
201
- }
202
- class be {
203
- constructor() {
204
- o(this, "dispense");
205
- o(this, "core");
206
- o(this, "freestyle");
207
- this.dispense = new P(), this.core = new T(), this.freestyle = new ae(this.core, this.dispense);
208
- }
209
- }
210
- export {
211
- d as E,
212
- ae as F,
213
- be as K,
214
- ce as a,
215
- pe as b,
216
- ue as c,
217
- ge as d,
218
- de as i
219
- };
220
- //# sourceMappingURL=extension-utils-D-CdnEQJ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extension-utils-D-CdnEQJ.js","sources":["../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/assets.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/beverage-screen.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/beverages.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/brand-screen.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/brands.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/copy-input.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/flavors.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/util/locate-brand.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/util/process-related-brand.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/related-brands.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/freestyle-loader.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/ingredient/model-extension.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/pourable/select-pourable-mapper.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extension-utils.ts"],"sourcesContent":["import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type { Asset, AvailabilityContext, UiSchemaResponse } from \"../types\";\n\nconst assetReducer = (acc: Record<string, Asset>, asset: Asset) => {\n acc[asset.dbId.toString()] = asset;\n return acc;\n};\n\n/**\n * Middleware that will normalize the assets array into a dictionary\n * @param context The context object that contains the data and result\n * @param next called at the end of the middleware to indicate that the next middleware can be called\n */\nexport const assetsMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const assets = input.assets.reduce(assetReducer, {} as Record<string, Asset>);\n context.result = { ...context.result, assets };\n await next();\n};\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type {\n AvailabilityContext,\n BeverageScreen,\n BeverageScreenData,\n UiSchemaResponse,\n} from \"../types\";\n\nfunction organizeBeverageData(\n jsonData: Record<string, any>\n): BeverageScreenData {\n const beverageData: BeverageScreenData = {};\n\n for (const key in jsonData) {\n // eslint-disable-next-line no-prototype-builtins\n if (jsonData.hasOwnProperty(key) && key.includes(\"slot\")) {\n const relatedBrand = key.includes(\"slotrb\");\n if (!relatedBrand) {\n const slot = key.split(\".\")[1]; // Extracting the slot number\n const beverageId = jsonData[`slot.${slot}.beverage`];\n\n if (beverageId) {\n // eslint-disable-next-line max-depth\n if (!beverageData[beverageId]) {\n beverageData[beverageId] = {};\n }\n\n beverageData[beverageId].rank = slot;\n // Removing the slot.x part from the key and adding to the object\n const beverageKey = key.replace(`slot.${slot}.`, \"\");\n beverageData[beverageId][beverageKey] = jsonData[key];\n }\n }\n }\n }\n\n return beverageData;\n}\nconst beverageScreenReducer =\n (input: UiSchemaResponse) =>\n (acc: Record<string, BeverageScreen>, curr: string) => {\n acc[curr] = input.beverageScreens[curr];\n acc[curr].beverages = organizeBeverageData(acc[curr]);\n return acc;\n };\n\n/**\n * Middleware that will normalize the beverage screen data. The middleware will perform the following:\n * 1. Organize the beverage screen data into a dictionary keyed by the brand id\n * 2. Adds a beverages property to the beverage screen data that contains the organized beverage data\n * 3. Processes related brands for each beverage screen\n *\n * @param context The context object that contains the data and result\n * @param next called at the end of the middleware to indicate that the next middleware can be called\n */\nexport const beverageScreenMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const beverageScreens = Object.keys(input.beverageScreens).reduce(\n beverageScreenReducer(input),\n input.beverageScreens\n );\n context.result = { ...context.result, beverageScreens };\n await next();\n};\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type { AvailabilityContext, Beverage, UiSchemaResponse } from \"../types\";\n\nconst beverageReducer = (acc: Record<string, Beverage>, beverage: Beverage) => {\n acc[beverage.beverageId.toString()] = beverage;\n return acc;\n};\n\n/**\n * Middleware that will normalize the brands array into a dictionary\n * @param context The context object that contains the data and result\n * @param next called at the end of the middleware to indicate that the next middleware can be called\n */\nexport const beveragesMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const beverages = input.beverages.reduce(\n beverageReducer,\n {} as Record<string, Beverage>\n );\n const beverageMap = input.beverages.reduce((acc, curr) => {\n acc[curr.dbId.toString()] = curr.beverageId.toString();\n return acc;\n }, {} as Record<string, string>);\n context.result = { ...context.result, beverages, beverageMap };\n await next();\n};\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type {\n AvailabilityContext,\n BrandScreenData,\n UiSchemaResponse,\n} from \"../types\";\n\nfunction organizeBrandData(jsonData: Record<string, any>): Record<string, any> {\n const brandScreenData: BrandScreenData = { rank: 0 };\n\n for (const key in jsonData) {\n // eslint-disable-next-line no-prototype-builtins\n if (jsonData.hasOwnProperty(key) && key.includes(\"slot\")) {\n const slot = key.split(\".\")[1]; // Extracting the slot number\n const position = slot.split(\":\")[1]; // Extracting the position number\n const brandId = jsonData[`slot.${slot}.brand`];\n\n if (brandId) {\n if (!brandScreenData[brandId]) {\n brandScreenData[brandId] = {\n rank: Number(position),\n };\n }\n\n // Removing the slot.x part from the key and adding to the object\n const brandKey = key.replace(`slot.${slot}.`, \"\");\n brandScreenData[brandId][brandKey] = jsonData[key];\n }\n }\n }\n\n return brandScreenData;\n}\nexport const brandScreenMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const brandScreen = organizeBrandData(input.brandScreen);\n context.result = { ...context.result, brandScreen };\n await next();\n};\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type { AvailabilityContext, Brand, UiSchemaResponse } from \"../types\";\n\nconst brandReducer = (acc: Record<string, Brand>, brand: Brand) => {\n acc[brand.dbId.toString()] = brand;\n return acc;\n};\n\n/**\n * Middleware that will normalize the brands array into a dictionary\n * @param context The context object that contains the data and result\n * @param next called at the end of the middleware to indicate that the next middleware can be called\n */\nexport const brandsMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const brands = input.brands.reduce(brandReducer, {} as Record<string, Brand>);\n context.result = { ...context.result, brands };\n await next();\n};\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\n\nexport const copyMiddleware: Middleware<any, any> = async (context, next) => {\n context.result = { ...context.data };\n await next();\n};\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type { AvailabilityContext, Flavor, UiSchemaResponse } from \"../types\";\n\nconst flavorReducer = (acc: Record<string, Flavor>, flavor: Flavor) => {\n acc[flavor.dbId.toString()] = flavor;\n return acc;\n};\n\n/**\n * Middleware that will normalize the flavors array into a dictionary\n * @param context The context object that contains the data and result\n * @param next called at the end of the middleware to indicate that the next middleware can be called\n */\nexport const flavorsMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const flavors = input.flavors.reduce(\n flavorReducer,\n {} as Record<string, Flavor>\n );\n context.result = { ...context.result, flavors };\n await next();\n};\n","export function locateRelatedBrand(\n jsonData: Record<string, any>,\n slot: string\n) {\n const relatedBrand = jsonData[`slotrb:${slot}.brand`];\n return relatedBrand;\n}\n","import type { BeverageScreenData } from \"../types\";\n\nexport const processRelatedBrand =\n (json: Record<string, any>) =>\n (\n beverageData: BeverageScreenData,\n brandId: string,\n slot: string,\n key: string\n ) => {\n if (!beverageData.relatedBrand) {\n beverageData.relatedBrand = {};\n }\n\n if (!beverageData.relatedBrand[brandId]) {\n beverageData.relatedBrand[brandId] = {\n rank: slot,\n };\n }\n\n const beverageKey = key.replace(`slotrb:${slot}.`, \"\");\n beverageData.relatedBrand[brandId][beverageKey] = json[key];\n };\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type {\n AvailabilityContext,\n BeverageScreen,\n BeverageScreenData,\n UiSchemaResponse,\n} from \"../types\";\nimport { locateRelatedBrand } from \"../util/locate-brand\";\nimport { processRelatedBrand } from \"../util/process-related-brand\";\n\nfunction organizeBeverageData(\n jsonData: Record<string, any>\n): BeverageScreenData {\n const beverageData: BeverageScreenData = {};\n\n for (const key in jsonData) {\n // eslint-disable-next-line no-prototype-builtins\n if (jsonData.hasOwnProperty(key) && key.includes(\"slot\")) {\n const relatedBrand = key.includes(\"slotrb\");\n if (relatedBrand) {\n const slot = key.split(\":\")[1].split(\".\")[0]; // Extracting the slot number\n const relatedBrand = locateRelatedBrand(jsonData, slot);\n processRelatedBrand(jsonData)(beverageData, relatedBrand, slot, key);\n }\n }\n }\n\n return beverageData;\n}\nconst beverageScreenReducer =\n (input: UiSchemaResponse) =>\n (acc: Record<string, BeverageScreen>, curr: string) => {\n acc[curr] = input.beverageScreens[curr];\n acc[curr].beverages = {\n ...acc[curr].beverages,\n ...organizeBeverageData(acc[curr]),\n };\n return acc;\n };\n\n/**\n * Middleware that will normalize the beverage screen data. The middleware will perform the following:\n * 1. Organize the beverage screen data into a dictionary keyed by the brand id\n * 2. Adds a beverages property to the beverage screen data that contains the organized beverage data\n * 3. Processes related brands for each beverage screen\n *\n * @param context The context object that contains the data and result\n * @param next called at the end of the middleware to indicate that the next middleware can be called\n */\nexport const relatedBrandMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const beverageScreens = Object.keys(input.beverageScreens).reduce(\n beverageScreenReducer(input),\n input.beverageScreens\n );\n context.result = { ...context.result, beverageScreens };\n await next();\n};\n","import {\n kosFetch,\n processMiddleware,\n type DataLoader,\n type Middleware,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport { assetsMiddleware } from \"./middleware/assets\";\nimport { beverageScreenMiddleware } from \"./middleware/beverage-screen\";\nimport { beveragesMiddleware } from \"./middleware/beverages\";\nimport { brandScreenMiddleware } from \"./middleware/brand-screen\";\nimport { brandsMiddleware } from \"./middleware/brands\";\nimport { copyMiddleware } from \"./middleware/copy-input\";\nimport { flavorsMiddleware } from \"./middleware/flavors\";\nimport { relatedBrandMiddleware } from \"./middleware/related-brands\";\nimport type { AvailabilityContext, UiSchemaResponse } from \"./types\";\n\nexport const transformAvailabilityData = async (\n input: UiSchemaResponse,\n additionalMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n >[] = [],\n replace = false\n): Promise<AvailabilityContext> => {\n const middleware = replace\n ? [...additionalMiddleware]\n : [\n copyMiddleware,\n assetsMiddleware,\n flavorsMiddleware,\n beveragesMiddleware,\n brandsMiddleware,\n beverageScreenMiddleware,\n relatedBrandMiddleware,\n brandScreenMiddleware,\n ...additionalMiddleware,\n ];\n const availabilityContext = await processMiddleware<\n UiSchemaResponse,\n AvailabilityContext\n >(input, middleware);\n\n return availabilityContext;\n};\n\n/**\n * Props for the freestyle availability loader\n */\nexport interface AvailabilityLoaderProps {\n /** the url to send the request for the UiSchemaData. Defaults to http://localhost:8081/system/cui/core.json */\n url?: string;\n\n /** additional middlewares to execute as part of the data processing */\n middleware?: Middleware<UiSchemaResponse, AvailabilityContext>[];\n\n /** if true, replace the default middleware with the provided middleware */\n replace?: boolean;\n}\n/**\n * Utility method to load the freestyle brandset data into the availability context.\n *\n * This loader will retrieve the UI Schema from the provided URL and transform it into\n * a format that can be used to populate the availability brands and beverages with UI schema\n * data.\n *\n * With this data, the availability models can have access to the brandset assets for\n * brands, beverages and flavours.\n *\n *\n * @param props\n * @returns A DataLoader function that will load the availability context\n */\nexport const freestyleAvailabilityLoader =\n ({\n url = \"http://localhost:8081/system/cui/core.json\",\n middleware = [],\n replace = false,\n }: AvailabilityLoaderProps = {}): DataLoader =>\n async (): Promise<AvailabilityContext> => {\n const schema = await kosFetch(url);\n if (schema.ok) {\n const response = await schema.json<UiSchemaResponse>();\n if (!response) {\n throw new Error(\"Failed to parse availability context\");\n }\n return await transformAvailabilityData(response, middleware, replace);\n }\n throw new Error(\"Failed to load availability context\");\n };\n","import {\n DataMapper,\n IndexExtension,\n PropertyMapper,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport type {\n FreestyleIngredientData,\n FreestyleIngredientModelData,\n FreestyleIngredientResponseData,\n} from \"../../../models/types/ingredients\";\n\nexport const ingredientDataMapper: DataMapper = async (\n data: FreestyleIngredientResponseData\n) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { id, name, ...rest } = data;\n const response: FreestyleIngredientData = {\n ...rest,\n ingredientMacro: rest.bib && !rest.sweetener ? \"macro\" : \"micro\",\n };\n return response;\n};\n\nexport const ingredientIndexExtension: IndexExtension<FreestyleIngredientModelData> =\n {\n macro: \"ingredientMacro\",\n };\nexport const ingredientCategoryMapper: PropertyMapper = (\n ingredientData: FreestyleIngredientResponseData\n) => ingredientData.type;\n","import type { SelectedPourable } from \"@kosdev-code/kos-dispense-sdk\";\n\nexport const pourableRequestMapper = async (data: SelectedPourable) => {\n return {\n bevId: data.beverage?.rawId,\n };\n};\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { DispenseExtensionManager } from \"@kosdev-code/kos-dispense-sdk\";\nimport {\n CoreExtensionManager,\n EXTENSION_TROUBLE_DATA_MAPPER,\n ExtensionManager,\n KosFeatureFlags,\n type TroubleModel,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport type { AgitationRequiredTroubleIface } from \"../models/cartridge-agitator/types\";\nimport { FEATURE_SUPPORTS_ICE } from \"../models/freestyle-assembly/freestyle-assembly-model\";\nimport { freestyleAssemblyDataMapper } from \"./extensions/assembly/assembly-data-mapper\";\nimport {\n freestyleAvailabilityLoader,\n type AvailabilityLoaderProps,\n} from \"./extensions/availability/freestyle-loader\";\nimport {\n ingredientDataMapper,\n ingredientIndexExtension,\n} from \"./extensions/ingredient\";\nimport { pourableRequestMapper } from \"./extensions/pourable/select-pourable-mapper\";\nexport const EXTENSION_PLUGIN_VISIBILITY = \"pluginVisibility\";\n\nexport class FreestyleExtensionManager {\n core: CoreExtensionManager;\n dispense: DispenseExtensionManager;\n constructor(core: CoreExtensionManager, dispense: DispenseExtensionManager) {\n this.core = core;\n this.dispense = dispense;\n }\n\n /**\n * Loads the core brandset data into a format that can be consumed by the\n * freestyle models.\n * */\n registerFreestyleBrandsetReader(props: AvailabilityLoaderProps = {}) {\n this.dispense.registerAvailabilityLoader(\n freestyleAvailabilityLoader(props)\n );\n\n return this;\n }\n\n registerFreestylePourableMapper() {\n this.dispense.registerSelectedPourableDataMapper(pourableRequestMapper);\n }\n\n registerFreestyleAssemblyMapper() {\n this.dispense.registerAssemblyDataMapper(freestyleAssemblyDataMapper);\n }\n\n registerFreestyleIngredientIndex() {\n this.dispense.registerIngredientIndex(ingredientIndexExtension);\n }\n\n registerFreestyleIngredientDataMapper() {\n this.dispense.registerIngredientDataMapper(ingredientDataMapper);\n }\n\n registerFreestyleIceAgitator() {\n ExtensionManager[EXTENSION_PLUGIN_VISIBILITY].register(\n EXTENSION_PLUGIN_VISIBILITY,\n (key) =>\n key !== \"iceAgitator\" ||\n KosFeatureFlags.isFeatureEnabled(FEATURE_SUPPORTS_ICE)\n );\n }\n\n registerFreestyleAgitationRequiredTroubleMapper() {\n ExtensionManager[EXTENSION_TROUBLE_DATA_MAPPER].register(\n \"agitationRequired\",\n async (trouble: TroubleModel<AgitationRequiredTroubleIface>) => {\n return { isAgitationRequired: !!trouble.data.agitationRequired };\n }\n );\n }\n\n initializeFreestyleExtension() {\n this.registerFreestylePourableMapper();\n this.registerFreestyleAssemblyMapper();\n this.registerFreestyleIngredientIndex();\n this.registerFreestyleIngredientDataMapper();\n this.registerFreestyleIceAgitator();\n this.registerFreestyleAgitationRequiredTroubleMapper();\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 freestyle: FreestyleExtensionManager;\n constructor() {\n this.dispense = new DispenseExtensionManager();\n this.core = new CoreExtensionManager();\n this.freestyle = new FreestyleExtensionManager(this.core, this.dispense);\n }\n}\n"],"names":["assetReducer","acc","asset","assetsMiddleware","context","next","assets","organizeBeverageData","jsonData","beverageData","key","slot","beverageId","beverageKey","beverageScreenReducer","input","curr","beverageScreenMiddleware","beverageScreens","beverageReducer","beverage","beveragesMiddleware","beverages","beverageMap","organizeBrandData","brandScreenData","position","brandId","brandKey","brandScreenMiddleware","brandScreen","brandReducer","brand","brandsMiddleware","brands","copyMiddleware","flavorReducer","flavor","flavorsMiddleware","flavors","locateRelatedBrand","processRelatedBrand","json","relatedBrand","relatedBrandMiddleware","transformAvailabilityData","additionalMiddleware","replace","middleware","processMiddleware","freestyleAvailabilityLoader","url","schema","kosFetch","response","ingredientDataMapper","data","id","name","rest","ingredientIndexExtension","pourableRequestMapper","_a","EXTENSION_PLUGIN_VISIBILITY","FreestyleExtensionManager","core","dispense","__publicField","props","freestyleAssemblyDataMapper","ExtensionManager","KosFeatureFlags","FEATURE_SUPPORTS_ICE","EXTENSION_TROUBLE_DATA_MAPPER","trouble","KosExtensionManager","DispenseExtensionManager","CoreExtensionManager"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8CAGMA,IAAe,CAACC,GAA4BC,OAChDD,EAAIC,EAAM,KAAK,SAAA,CAAU,IAAIA,GACtBD,IAQIE,IAGT,OAAOC,GAASC,MAAS;AAE3B,QAAMC,IADQF,EAAQ,KACD,OAAO,OAAOJ,GAAc,CAAA,CAA2B;AAC5E,EAAAI,EAAQ,SAAS,EAAE,GAAGA,EAAQ,QAAQ,QAAAE,EAAA,GACtC,MAAMD,EAAA;AACR;ACbA,SAASE,EACPC,GACoB;AACpB,QAAMC,IAAmC,CAAA;AAEzC,aAAWC,KAAOF;AAEhB,QAAIA,EAAS,eAAeE,CAAG,KAAKA,EAAI,SAAS,MAAM,KAEjD,CADiBA,EAAI,SAAS,QAAQ,GACvB;AACjB,YAAMC,IAAOD,EAAI,MAAM,GAAG,EAAE,CAAC,GACvBE,IAAaJ,EAAS,QAAQG,CAAI,WAAW;AAEnD,UAAIC,GAAY;AAEd,QAAKH,EAAaG,CAAU,MAC1BH,EAAaG,CAAU,IAAI,CAAA,IAG7BH,EAAaG,CAAU,EAAE,OAAOD;AAEhC,cAAME,IAAcH,EAAI,QAAQ,QAAQC,CAAI,KAAK,EAAE;AACnD,QAAAF,EAAaG,CAAU,EAAEC,CAAW,IAAIL,EAASE,CAAG;AAAA,MACt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AAiC,IAAI;AACnE,gBAAK,SAAS;AAAA,MACZlB,GAA4BkB,CAAK;AAAA,IAAA,GAG5B;AAAA,EACT;AAAA,EAEA,kCAAkC;AAChC,SAAK,SAAS,mCAAmCP,EAAqB;AAAA,EACxE;AAAA,EAEA,kCAAkC;AAChC,SAAK,SAAS,2BAA2BQ,CAA2B;AAAA,EACtE;AAAA,EAEA,mCAAmC;AACjC,SAAK,SAAS,wBAAwBT,EAAwB;AAAA,EAChE;AAAA,EAEA,wCAAwC;AACtC,SAAK,SAAS,6BAA6BL,EAAoB;AAAA,EACjE;AAAA,EAEA,+BAA+B;AAC7B,IAAAe,EAAiBP,CAA2B,EAAE;AAAA,MAC5CA;AAAA,MACA,CAACrD,MACCA,MAAQ,iBACR6D,EAAgB,iBAAiBC,CAAoB;AAAA,IAAA;AAAA,EAE3D;AAAA,EAEA,kDAAkD;AAChD,IAAAF,EAAiBG,CAA6B,EAAE;AAAA,MAC9C;AAAA,MACA,OAAOC,OACE,EAAE,qBAAqB,CAAC,CAACA,EAAQ,KAAK,kBAAA;AAAA,IAC/C;AAAA,EAEJ;AAAA,EAEA,+BAA+B;AAC7B,SAAK,gCAAA,GACL,KAAK,gCAAA,GACL,KAAK,iCAAA,GACL,KAAK,sCAAA,GACL,KAAK,6BAAA,GACL,KAAK,gDAAA;AAAA,EACP;AACF;AASO,MAAMC,GAAoB;AAAA,EAI/B,cAAc;AAHd,IAAAR,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AAEE,SAAK,WAAW,IAAIS,EAAA,GACpB,KAAK,OAAO,IAAIC,EAAA,GAChB,KAAK,YAAY,IAAIb,GAA0B,KAAK,MAAM,KAAK,QAAQ;AAAA,EACzE;AACF;"}
@@ -1,85 +0,0 @@
1
- import { IceAgitatorOptions } from './types';
2
- import { IceAgitatorModel } from './ice-agitator-model';
3
- import { KosModelRegistrationFactory } from '@kosdev-code/kos-ui-sdk';
4
-
5
- /**
6
- * # IceAgitator
7
- *
8
- * The registration bean includes convenience methods for creating and working with IceAgitatorModel instances.
9
- *
10
- * ## type
11
- * The type property is a string that identifies the model type.
12
- * The type is used to identify the model type in the model registry and to narrow down the model type in type predicates. It's most frequently
13
- * used when declaring dependencies on models.
14
- *
15
- * @example
16
- * ```typescript
17
- *
18
- * @kosDependency({modelType: IceAgitator.type, id: "iceAgitatorId"})
19
- * private iceAgitatorModel: IceAgitatorModel;
20
- * ```
21
- *
22
- *
23
- * ## factory
24
- *
25
- * The factory method creates a factory function that can be used to create new IceAgitatorModel instances.
26
- *
27
-
28
- * The factory function is a curried function that takes the model id as the first argument and the options as the second argument.
29
- *
30
- * If a model with the specified id already exists, the factory function will return the existing model. The options will be ignored
31
- * in this case and the existing model will be returned in its current state.
32
- *
33
- * @example
34
- * ```typescript
35
- * const model = IceAgitator.factory("iceAgitatorId")({
36
- * // Add option data
37
- * });
38
- * ```
39
-
40
-
41
- *
42
- * ## predicate
43
- *
44
- * [Typescript type predicate](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates) function that will identify and narrow down a model to a IceAgitatorModel.
45
- *
46
- * @example
47
- * ```typescript
48
- *
49
- * const model: IKosDataModel = ...; // some model
50
- *
51
- * if (IceAgitator.predicate(model)) {
52
- * // if the function evaluates to true, the model is narrowed down to IceAgitatorModel
53
- * // and the compiler will know that the model has the IceAgitatorModel interface
54
- * model.updateAvailability(false);
55
- * }
56
- * ```
57
- *
58
- * ## registration
59
- *
60
- * The registration property is an object that can be used to simplify registration of the model with the model registry. The registration object
61
- * can be spread into the model registration and provides all of the required information to register the model implementation class against the model type.
62
- *
63
- *
64
- * @example
65
- *
66
- * In an application registration file you can declare the model registration as follows:
67
- *
68
- * **registration.ts**
69
- * ```typescript
70
- * import { IceAgitator } from "@kos-ui/kos-dispenser-model";
71
- * ...
72
- * import { ExtensionManager, IKosRegistry } from "@kosdev-code/kos-ui-sdk";
73
- * export const kosModels: IKosRegistry["models"] = {
74
- * ...IceAgitator.registration,
75
- * };
76
- * ```
77
- *
78
- * ## registration.singleton
79
-
80
- * The iceAgitator model is NOT a singleton model. This means that each time the factory function is called with a unique ID, a new model instance will be created.
81
- * If the factory function is called with an ID that already exists, the existing model will be returned.
82
-
83
- * */
84
- export declare const IceAgitator: KosModelRegistrationFactory<IceAgitatorModel, IceAgitatorOptions>;
85
- //# sourceMappingURL=ice-agitator-registration.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ice-agitator-registration.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-freestyle-sdk/src/models/models/ice-agitator/ice-agitator-registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8EK;AAEL,eAAO,MAAM,WAAW,mEAMtB,CAAC"}
@@ -1,87 +0,0 @@
1
- import { LfcvPumpModel } from './lfcv-pump-model';
2
- import { LfcvPumpOptions } from './types';
3
- import { KosModelRegistrationFactory } from '@kosdev-code/kos-ui-sdk';
4
-
5
- /**
6
- * # LfcvPump
7
- *
8
- * The registration bean includes convenience methods for creating and working with LfcvPumpModel instances.
9
- *
10
- * ## type
11
- * The type property is a string that identifies the model type.
12
- * The type is used to identify the model type in the model registry and to narrow down the model type in type predicates. It's most frequently
13
- * used when declaring dependencies on models.
14
- *
15
- * @example
16
- * ```typescript
17
- *
18
- * @kosDependency({modelType: LfcvPump.type, id: "lfcvPumpId"})
19
- * private lfcvPumpModel: LfcvPumpModel;
20
- * ```
21
- *
22
- *
23
- * ## factory
24
- *
25
- * The factory method creates a factory function that can be used to create new LfcvPumpModel instances.
26
- *
27
-
28
- * The factory function is a curried function that takes the model id as the first argument and the options as the second argument.
29
- *
30
- * If a model with the specified id already exists, the factory function will return the existing model. The options will be ignored
31
- * in this case and the existing model will be returned in its current state.
32
- *
33
- * @example
34
- * ```typescript
35
- * const model = LfcvPump.factory("lfcvPumpId")({
36
- * // Add option data
37
- * });
38
- * ```
39
-
40
-
41
- *
42
- * ## predicate
43
- *
44
- * [Typescript type predicate](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates) function that will identify and narrow down a model to a LfcvPumpModel.
45
- *
46
- * @example
47
- * ```typescript
48
- *
49
- * const model: IKosDataModel = ...; // some model
50
- *
51
- * if (LfcvPump.predicate(model)) {
52
- * // if the function evaluates to true, the model is narrowed down to LfcvPumpModel
53
- * // and the compiler will know that the model has the LfcvPumpModel interface
54
- * model.updateAvailability(false);
55
- * }
56
- * ```
57
- *
58
- * ## registration
59
- *
60
- * The registration property is an object that can be used to simplify registration of the model with the model registry. The registration object
61
- * can be spread into the model registration and provides all of the required information to register the model implementation class against the model type.
62
- *
63
- *
64
- * @example
65
- *
66
- * In an application registration file you can declare the model registration as follows:
67
- *
68
- * **registration.ts**
69
- * ```typescript
70
- * import { LfcvPump } from "@kos-ui/project-models";
71
- * import { KosModelRegistry } from "@kosdev-code/kos-dispense-sdk";
72
- *
73
- * import { initKosProvider } from "@kosdev-code/kos-ui-sdk";
74
- *
75
- * KosModelRegistry.dispense
76
- * .models()
77
- * .model(LfcvPump);
78
- * ```
79
- *
80
- * ## registration.singleton
81
-
82
- * The lfcvPump model is NOT a singleton model. This means that each time the factory function is called with a unique ID, a new model instance will be created.
83
- * If the factory function is called with an ID that already exists, the existing model will be returned.
84
-
85
- * */
86
- export declare const LfcvPump: KosModelRegistrationFactory<LfcvPumpModel, LfcvPumpOptions>;
87
- //# sourceMappingURL=lfcv-pump-registration.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lfcv-pump-registration.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-freestyle-sdk/src/models/models/lfcv-pump/lfcv-pump-registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgFK;AACL,eAAO,MAAM,QAAQ,6DAMnB,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './lfcv-pump-services';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/sdk/kos-freestyle-sdk/src/models/models/lfcv-pump/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
@@ -1,10 +0,0 @@
1
- interface LfcvPumpResponse {
2
- id: string;
3
- }
4
- /**
5
- * @category Service
6
- * Retrieves the initial lfcv-pump data.
7
- */
8
- export declare const getLfcvPumps: () => Promise<import('@kosdev-code/kos-ui-sdk').KosServiceResponse<LfcvPumpResponse[]> | undefined>;
9
- export {};
10
- //# sourceMappingURL=lfcv-pump-services.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lfcv-pump-services.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/sdk/kos-freestyle-sdk/src/models/models/lfcv-pump/services/lfcv-pump-services.ts"],"names":[],"mappings":"AAcA,UAAU,gBAAgB;IACxB,EAAE,EAAE,MAAM,CAAC;CACZ;AACD;;;GAGG;AACH,eAAO,MAAM,YAAY,qGAIxB,CAAC"}