@kosdev-code/kos-freestyle-sdk 0.1.0-dev.5187 → 0.1.0-dev.5190
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/{extension-utils-DSygTC6m.cjs → extension-utils-BIzRIXwB.cjs} +2 -2
- package/{extension-utils-DSygTC6m.cjs.map → extension-utils-BIzRIXwB.cjs.map} +1 -1
- package/{extension-utils-a_ajKIu1.js → extension-utils-D-CdnEQJ.js} +2 -2
- package/{extension-utils-a_ajKIu1.js.map → extension-utils-D-CdnEQJ.js.map} +1 -1
- package/index.cjs +1 -1
- package/index.js +3 -3
- package/models/models/agitation-required-trouble/agitation-required-trouble-model.d.ts.map +1 -1
- package/models.cjs +1 -1
- package/models.js +2 -2
- package/package.json +4 -4
- package/{service-DyLnkK6H.js → service-B5BitF77.js} +32 -32
- package/{service-DyLnkK6H.js.map → service-B5BitF77.js.map} +1 -1
- package/{service-D8GRisCE.cjs → service-Dlc0A1Rk.cjs} +2 -2
- package/{service-D8GRisCE.cjs.map → service-Dlc0A1Rk.cjs.map} +1 -1
- package/ui.cjs +1 -1
- package/ui.js +2 -2
- package/{use-nutrition-info-DK4oEzW9.js → use-nutrition-info-CGBsABee.js} +2 -2
- package/{use-nutrition-info-DK4oEzW9.js.map → use-nutrition-info-CGBsABee.js.map} +1 -1
- package/{use-nutrition-info-CN9i519Z.cjs → use-nutrition-info-tOQ6wnpq.cjs} +2 -2
- package/{use-nutrition-info-CN9i519Z.cjs.map → use-nutrition-info-tOQ6wnpq.cjs.map} +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
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-
|
|
2
|
-
//# sourceMappingURL=extension-utils-
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension-utils-DSygTC6m.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,EAAS,eAAeE,CAAG,GAAKA,EAAI,SAAS,MAAM,GAEjD,CADiBA,EAAI,SAAS,QAAQ,EACvB,CACjB,MAAMC,E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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
|
+
{"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,EAAS,eAAeE,CAAG,GAAKA,EAAI,SAAS,MAAM,GAEjD,CADiBA,EAAI,SAAS,QAAQ,EACvB,CACjB,MAAMC,EAAOD,EAAI,MAAM,GAAG,EAAE,CAAC,EACvBE,EAAaJ,EAAS,QAAQG,CAAI,WAAW,EAEnD,GAAIC,EAAY,CAETH,EAAaG,CAAU,IAC1BH,EAAaG,CAAU,EAAI,CAAA,GAG7BH,EAAaG,CAAU,EAAE,KAAOD,EAEhC,MAAME,EAAcH,EAAI,QAAQ,QAAQC,CAAI,IAAK,EAAE,EACnDF,EAAaG,CAAU,EAAEC,CAAW,EAAIL,EAASE,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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,7 +1,7 @@
|
|
|
1
1
|
var c = Object.defineProperty;
|
|
2
2
|
var p = (r, e, t) => e in r ? c(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
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-
|
|
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
5
|
import { DispenseExtensionManager as P } from "@kosdev-code/kos-dispense-sdk";
|
|
6
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
7
|
const de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
@@ -217,4 +217,4 @@ export {
|
|
|
217
217
|
ge as d,
|
|
218
218
|
de as i
|
|
219
219
|
};
|
|
220
|
-
//# sourceMappingURL=extension-utils-
|
|
220
|
+
//# sourceMappingURL=extension-utils-D-CdnEQJ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension-utils-a_ajKIu1.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,G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E,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
|
+
{"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","KosFe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C;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;"}
|
package/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./service-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./service-Dlc0A1Rk.cjs"),t=require("./extension-utils-BIzRIXwB.cjs"),r=require("./use-nutrition-info-tOQ6wnpq.cjs");require("@kosdev-code/kos-ui-sdk");require("@kosdev-code/kos-dispense-sdk");require("@emotion/react/jsx-runtime");require("react");exports.AGITATION_REQUIRED_TROUBLE=e.AGITATION_REQUIRED_TROUBLE;exports.AgitationRequiredTrouble=e.AgitationRequiredTrouble;exports.CarbAgitator=e.CarbAgitator;exports.CartridgeAgitator=e.CartridgeAgitator;exports.CartridgeAgitatorContainer=e.CartridgeAgitatorContainer;exports.CartridgeAgitatorEvents=e.CartridgeAgitatorEvents;exports.CgpPump=e.CgpPump;exports.FREESTYLE_SERVICE=e.service$2;exports.FREESTYLE_SERVICE_1_6_5=e.service;exports.FREESTYLE_SERVICE_1_8_1=e.service$1;exports.FcmPump=e.FcmPump;exports.FreestyleAssembly=e.FreestyleAssembly;exports.FreestyleHolder=e.FreestyleHolder;exports.FreestyleNozzle=e.FreestyleNozzle;exports.FreestylePump=e.FreestylePump;exports.HANDLE_SERVICE=e.service$4;exports.HANDLE_SERVICE_1_8_1=e.service$3;exports.IceAgitator=e.IceAgitator;exports.IceAgitatorEvents=e.IceAgitatorEvents;exports.KosModelRegistry=e.KosModelRegistry;exports.LfcvPump=e.LfcvPump;exports.RemoteTray=e.RemoteTray;exports.RemoteTrayContainer=e.RemoteTrayContainer;exports.SpmPump=e.SpmPump;exports.registerFreestyleModels=e.registerFreestyleModels;exports.EXTENSION_PLUGIN_VISIBILITY=t.EXTENSION_PLUGIN_VISIBILITY;exports.FcmPumpServices=t.index;exports.FreestyleExtensionManager=t.FreestyleExtensionManager;exports.FreestyleNozzleServices=t.index$1;exports.FreestylePumpServices=t.index$2;exports.KosExtensionManager=t.KosExtensionManager;exports.LfcvPumpServices=t.index$3;exports.SpmPumpServices=t.index$4;exports.useFreestyleAssemblyContext=r.useFreestyleAssemblyContext;exports.useFreestyleNozzleContext=r.useFreestyleNozzleContext;exports.useIceAgitator=r.useIceAgitator;exports.useNutritionInfo=r.useNutritionInfo;exports.withIceAgitator=r.withIceAgitator;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as i, j as E, C as m, c as l, a as I, b as p, d as g, l as n, s as S, k as _, F as u, e as F, f as c, g as A, h as R, n as y, m as C, i as L, I as T, K as N, L as P, o as d, R as v, S as b, r as f } from "./service-
|
|
2
|
-
import { E as z, i as V, F as K, a as M, b as Y, K as D, c as H, d as O } from "./extension-utils-
|
|
3
|
-
import { u as h, a as w, b as B, c as G, w as j } from "./use-nutrition-info-
|
|
1
|
+
import { A as i, j as E, C as m, c as l, a as I, b as p, d as g, l as n, s as S, k as _, F as u, e as F, f as c, g as A, h as R, n as y, m as C, i as L, I as T, K as N, L as P, o as d, R as v, S as b, r as f } from "./service-B5BitF77.js";
|
|
2
|
+
import { E as z, i as V, F as K, a as M, b as Y, K as D, c as H, d as O } from "./extension-utils-D-CdnEQJ.js";
|
|
3
|
+
import { u as h, a as w, b as B, c as G, w as j } from "./use-nutrition-info-CGBsABee.js";
|
|
4
4
|
import "@kosdev-code/kos-ui-sdk";
|
|
5
5
|
import "@kosdev-code/kos-dispense-sdk";
|
|
6
6
|
import "@emotion/react/jsx-runtime";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agitation-required-trouble-model.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-freestyle-sdk/src/models/models/agitation-required-trouble/agitation-required-trouble-model.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAEL,WAAW,EACX,KAAK,iBAAiB,EACvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,2BAA2B,EAC3B,oBAAoB,EACpB,YAAY,EACZ,YAAY,EACb,MAAM,yBAAyB,CAAC;AAWjC,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,SAAS,CAAC;AAE/D;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,qCAAqC,CAAC;AAE7D;;;;;;;;;GASG;AACH,MAAM,MAAM,6BAA6B,GACvC,oBAAoB,CAAC,iCAAiC,CAAC,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,qBAAqB,iBAAkB,YAAY,mDAK/D,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,iCAAiC,CAAC;AAEzE,MAAM,WAAW,iCACf,SAAQ,cAAc,EACpB,uBAAuB,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC;IAC1D,0FAA0F;IAC1F,OAAO,EAAE,YAAY,CAAC,iBAAiB,CAAC,CAAC;CAC1C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,qBAGa,iCACX,YAAW,aAAa,EAAE,gBAAgB,EAAE,YAAY,EAAE,UAAU;IAEpE;;;;;;;OAOG;IACH,MAAM,CAAC,YAAY,EAAE,2BAA2B,CAC9C,6BAA6B,EAC7B,+BAA+B,CAChC,CAAC;IAEF;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,cAAc,CAAS;IAE/B;;;;;OAKG;IAKH,iBAAiB,EAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAE/C;;;;OAIG;gBACS,OAAO,EAAE,MAAM;IAK3B;;;;;;;OAOG;IACG,OAAO,IAAI,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC;IAIpD;;;;;;;;OAQG;
|
|
1
|
+
{"version":3,"file":"agitation-required-trouble-model.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-freestyle-sdk/src/models/models/agitation-required-trouble/agitation-required-trouble-model.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAEL,WAAW,EACX,KAAK,iBAAiB,EACvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,2BAA2B,EAC3B,oBAAoB,EACpB,YAAY,EACZ,YAAY,EACb,MAAM,yBAAyB,CAAC;AAWjC,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,SAAS,CAAC;AAE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G;AACH,eAAO,MAAM,wBAAwB,6FACW,CAAC"}
|
package/models.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./service-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./service-Dlc0A1Rk.cjs"),r=require("./extension-utils-BIzRIXwB.cjs");require("@kosdev-code/kos-ui-sdk");require("@kosdev-code/kos-dispense-sdk");exports.AGITATION_REQUIRED_TROUBLE=e.AGITATION_REQUIRED_TROUBLE;exports.AgitationRequiredTrouble=e.AgitationRequiredTrouble;exports.CarbAgitator=e.CarbAgitator;exports.CartridgeAgitator=e.CartridgeAgitator;exports.CartridgeAgitatorContainer=e.CartridgeAgitatorContainer;exports.CartridgeAgitatorEvents=e.CartridgeAgitatorEvents;exports.CgpPump=e.CgpPump;exports.FREESTYLE_SERVICE=e.service$2;exports.FREESTYLE_SERVICE_1_6_5=e.service;exports.FREESTYLE_SERVICE_1_8_1=e.service$1;exports.FcmPump=e.FcmPump;exports.FreestyleAssembly=e.FreestyleAssembly;exports.FreestyleHolder=e.FreestyleHolder;exports.FreestyleNozzle=e.FreestyleNozzle;exports.FreestylePump=e.FreestylePump;exports.HANDLE_SERVICE=e.service$4;exports.HANDLE_SERVICE_1_8_1=e.service$3;exports.IceAgitator=e.IceAgitator;exports.IceAgitatorEvents=e.IceAgitatorEvents;exports.KosModelRegistry=e.KosModelRegistry;exports.LfcvPump=e.LfcvPump;exports.SpmPump=e.SpmPump;exports.registerFreestyleModels=e.registerFreestyleModels;exports.EXTENSION_PLUGIN_VISIBILITY=r.EXTENSION_PLUGIN_VISIBILITY;exports.FcmPumpServices=r.index;exports.FreestyleExtensionManager=r.FreestyleExtensionManager;exports.FreestyleNozzleServices=r.index$1;exports.FreestylePumpServices=r.index$2;exports.KosExtensionManager=r.KosExtensionManager;exports.LfcvPumpServices=r.index$3;exports.SpmPumpServices=r.index$4;
|
|
2
2
|
//# sourceMappingURL=models.cjs.map
|
package/models.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as t, j as E, C as i, c as o, a as m, b as S, d as _, l as I, s as g, k as l, F as p, e as F, f as c, g as A, h as R, n, m as C, i as u, I as L, K as y, L as P, S as d, r as v } from "./service-
|
|
2
|
-
import { E as N, i as V, F as b, a as f, b as x, K as z, c as K, d as M } from "./extension-utils-
|
|
1
|
+
import { A as t, j as E, C as i, c as o, a as m, b as S, d as _, l as I, s as g, k as l, F as p, e as F, f as c, g as A, h as R, n, m as C, i as u, I as L, K as y, L as P, S as d, r as v } from "./service-B5BitF77.js";
|
|
2
|
+
import { E as N, i as V, F as b, a as f, b as x, K as z, c as K, d as M } from "./extension-utils-D-CdnEQJ.js";
|
|
3
3
|
import "@kosdev-code/kos-ui-sdk";
|
|
4
4
|
import "@kosdev-code/kos-dispense-sdk";
|
|
5
5
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kosdev-code/kos-freestyle-sdk",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.5190",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./index.d.ts",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -23,15 +23,15 @@
|
|
|
23
23
|
"./package.json": "./package.json"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@kosdev-code/kos-ui-sdk": "0.1.0-dev.
|
|
27
|
-
"@kosdev-code/kos-dispense-sdk": "0.1.0-dev.
|
|
26
|
+
"@kosdev-code/kos-ui-sdk": "0.1.0-dev.5190",
|
|
27
|
+
"@kosdev-code/kos-dispense-sdk": "0.1.0-dev.5190"
|
|
28
28
|
},
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"registry": "https://registry.npmjs.org/"
|
|
31
31
|
},
|
|
32
32
|
"kos": {
|
|
33
33
|
"build": {
|
|
34
|
-
"gitHash": "
|
|
34
|
+
"gitHash": "2ba7db6f93d0e6a77b8bc4377ab6d3b413a32e69"
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -2,7 +2,7 @@ var vt = Object.defineProperty;
|
|
|
2
2
|
var Tt = (e, t, r) => t in e ? vt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
3
|
var i = (e, t, r) => (Tt(e, typeof t != "symbol" ? t + "" : t, r), r);
|
|
4
4
|
import { resolveServiceUrl as A, ServiceFactory as w, KosLog as $, createPropKey as U, kosStateProp as O, kosConfigProperty as b, kosStateEntry as be, kosStateExit as _t, kosStateGuard as Pe, kosFuture as I, kosModel as f, kosLoggerAware as V, kosCompanion as ve, kosFutureAware as xe, kosStateMachine as It, DependencyLifecycle as Ue, KosModelContainer as $t, kosChild as qe, kosModelEffect as Te, EventBus as k, KosModelRegistrationFactory as E, SingletonKosModelRegistrationFactory as _e, FetchError as Ie, FutureManager as y, FutureEndState as q, FutureHandler as Ge, kosParentAware as je, KosFeatureFlags as ue, getKosCompanionModel as Ct, getKosModelSync as R, kosContainerAware as Ot, KosContextManager as Et, kosAction as Z, KOS_MODEL_ID as C, kosMultipleFutureAware as St, kosTopicHandler as At, modelTypeEventTopicFactory as wt, RegistrationManager as m, registerCoreModels as Mt, Trouble as Rt, ExtensionManager as ce, EXTENSION_TROUBLE_DATA_MAPPER as de, createClient as H, kosServiceRequest as B } from "@kosdev-code/kos-ui-sdk";
|
|
5
|
-
import { PourState as d, Assembly as Ve, KosModelRegistry as Dt, registerDispenseModels as
|
|
5
|
+
import { PourState as d, Assembly as Ve, KosModelRegistry as Dt, registerDispenseModels as Ft, Nozzle as Lt, Pump as zt, Holder as Nt, PumpContainer as xt, PumpIndex as Ut } from "@kosdev-code/kos-dispense-sdk";
|
|
6
6
|
const { URL: He } = A("ICE_AGITATOR_SERVICE"), { postModel: qt } = w.build({
|
|
7
7
|
basePath: `${He}/api/ext/freestyle/ice`
|
|
8
8
|
});
|
|
@@ -359,7 +359,7 @@ class Q {
|
|
|
359
359
|
}
|
|
360
360
|
i(Q, "TOPIC_AGITATION_STARTED", "/kos/events/ddk/agitation-started"), i(Q, "TOPIC_AGITATION_ENDED", "/kos/events/ddk/agitation-ended");
|
|
361
361
|
const Qt = U("statePath");
|
|
362
|
-
let
|
|
362
|
+
let L = class {
|
|
363
363
|
constructor(e, t) {
|
|
364
364
|
i(this, "id");
|
|
365
365
|
i(this, "agitating");
|
|
@@ -388,22 +388,22 @@ let F = class {
|
|
|
388
388
|
};
|
|
389
389
|
ae([
|
|
390
390
|
O({ path: Qt, attribute: "agitating" })
|
|
391
|
-
],
|
|
391
|
+
], L.prototype, "agitating", 2);
|
|
392
392
|
ae([
|
|
393
393
|
I()
|
|
394
|
-
],
|
|
394
|
+
], L.prototype, "testAgitate", 1);
|
|
395
395
|
ae([
|
|
396
396
|
Te({
|
|
397
397
|
dependencies: (e) => [e.isAgitating]
|
|
398
398
|
})
|
|
399
|
-
],
|
|
400
|
-
|
|
399
|
+
], L.prototype, "handleAgitation", 1);
|
|
400
|
+
L = ae([
|
|
401
401
|
f(ke),
|
|
402
402
|
xe(),
|
|
403
403
|
V()
|
|
404
|
-
],
|
|
404
|
+
], L);
|
|
405
405
|
const Je = new E({
|
|
406
|
-
class:
|
|
406
|
+
class: L,
|
|
407
407
|
type: ke
|
|
408
408
|
}), Ce = new _e({
|
|
409
409
|
class: J,
|
|
@@ -1048,18 +1048,18 @@ te = st([
|
|
|
1048
1048
|
const Me = new E({
|
|
1049
1049
|
class: te,
|
|
1050
1050
|
type: nt
|
|
1051
|
-
}), { URL: lt } = A("PUMP_SERVICE"), { postModel:
|
|
1051
|
+
}), { URL: lt } = A("PUMP_SERVICE"), { postModel: Fr } = w.build({
|
|
1052
1052
|
basePath: `${lt}/api/ext/freestyle/microCalibration`
|
|
1053
1053
|
}), pe = $.createLogger({
|
|
1054
1054
|
name: "freestyle-pump-service",
|
|
1055
1055
|
group: "Services"
|
|
1056
|
-
}),
|
|
1056
|
+
}), Lr = async (e, t) => {
|
|
1057
1057
|
var r, o, a, n, s;
|
|
1058
1058
|
pe.debug(
|
|
1059
1059
|
`replacePump - sending POST request to /api/ext/freestyle/microCalibration/cal/${e}/code/${t}`
|
|
1060
1060
|
);
|
|
1061
1061
|
try {
|
|
1062
|
-
const u = await
|
|
1062
|
+
const u = await Fr({
|
|
1063
1063
|
model: {},
|
|
1064
1064
|
urlOverride: `${lt}/api/ext/freestyle/microCalibration/cal/${e}/code/${t}`
|
|
1065
1065
|
});
|
|
@@ -1090,7 +1090,7 @@ let me = class {
|
|
|
1090
1090
|
}
|
|
1091
1091
|
// -------------------LIFECYCLE----------------------------
|
|
1092
1092
|
async replacePump(e) {
|
|
1093
|
-
const [t, r] = await
|
|
1093
|
+
const [t, r] = await Lr(this.pump.path, e);
|
|
1094
1094
|
return t && this.logger.error(`Failed to replace the pump, ${this.pump.id}`, t), [t, r];
|
|
1095
1095
|
}
|
|
1096
1096
|
};
|
|
@@ -1100,23 +1100,23 @@ me = Nr([
|
|
|
1100
1100
|
const Re = new E({
|
|
1101
1101
|
class: me,
|
|
1102
1102
|
type: ut
|
|
1103
|
-
}), { URL:
|
|
1104
|
-
basePath: `${
|
|
1103
|
+
}), { URL: F } = A("ICE_AGITATOR_SERVICE"), { getAll: ct, postModel: se } = w.build({
|
|
1104
|
+
basePath: `${F}/api/ext/freestyle/ice`
|
|
1105
1105
|
}), dt = $.createLogger({
|
|
1106
1106
|
name: "ice-agitator-service",
|
|
1107
1107
|
group: "Services"
|
|
1108
1108
|
}), xr = async (e) => (dt.debug("sending GET for ice types"), await ct({
|
|
1109
|
-
urlOverride: `${
|
|
1109
|
+
urlOverride: `${F}/api/handle/${e}/types`
|
|
1110
1110
|
})), Ur = async (e, t) => (dt.debug("sending POST for ice types"), await se({
|
|
1111
|
-
urlOverride: `${
|
|
1111
|
+
urlOverride: `${F}/api/handle/${e}/type/${t}`,
|
|
1112
1112
|
model: {}
|
|
1113
1113
|
})), qr = async (e) => await ct({
|
|
1114
|
-
urlOverride: `${
|
|
1114
|
+
urlOverride: `${F}/api/kos/config/details/${e}/4`
|
|
1115
1115
|
}), Gr = async (e, t) => {
|
|
1116
1116
|
const r = await se({
|
|
1117
1117
|
model: {},
|
|
1118
1118
|
tracker: t,
|
|
1119
|
-
urlOverride: `${
|
|
1119
|
+
urlOverride: `${F}/api/handle/${e}/pour`
|
|
1120
1120
|
});
|
|
1121
1121
|
if (!(r != null && r.data))
|
|
1122
1122
|
throw new Error("No response from server");
|
|
@@ -1125,7 +1125,7 @@ const Re = new E({
|
|
|
1125
1125
|
const r = await se({
|
|
1126
1126
|
model: {},
|
|
1127
1127
|
tracker: t,
|
|
1128
|
-
urlOverride: `${
|
|
1128
|
+
urlOverride: `${F}/api/handle/${e}/test/agitation`
|
|
1129
1129
|
});
|
|
1130
1130
|
if (!(r != null && r.data))
|
|
1131
1131
|
throw new Error("No response from server");
|
|
@@ -1134,7 +1134,7 @@ const Re = new E({
|
|
|
1134
1134
|
const r = await se({
|
|
1135
1135
|
model: {},
|
|
1136
1136
|
tracker: t,
|
|
1137
|
-
urlOverride: `${
|
|
1137
|
+
urlOverride: `${F}/api/handle/${e}/test/gate`
|
|
1138
1138
|
});
|
|
1139
1139
|
if (!(r != null && r.data))
|
|
1140
1140
|
throw new Error("No response from server");
|
|
@@ -1632,14 +1632,14 @@ let x = class {
|
|
|
1632
1632
|
* @returns The holder model or undefined if not yet loaded
|
|
1633
1633
|
*/
|
|
1634
1634
|
get holder() {
|
|
1635
|
-
if (!this.trouble
|
|
1635
|
+
if (!this.trouble)
|
|
1636
1636
|
return;
|
|
1637
1637
|
const e = this.trouble.data.holderPaths[0], t = R(e);
|
|
1638
1638
|
if (!(!this._holdersLoaded && !t.model))
|
|
1639
1639
|
return t == null ? void 0 : t.model;
|
|
1640
1640
|
}
|
|
1641
1641
|
updateHolder() {
|
|
1642
|
-
if (!this._holdersLoaded) {
|
|
1642
|
+
if (!this._holdersLoaded && this.trouble) {
|
|
1643
1643
|
const e = this.trouble.data.holderPaths[0];
|
|
1644
1644
|
R(e).model && (this._holdersLoaded = !0);
|
|
1645
1645
|
}
|
|
@@ -1752,8 +1752,8 @@ const ca = x.Registration, da = ["iceAgitator"], pa = {
|
|
|
1752
1752
|
supportsCarb: n,
|
|
1753
1753
|
supportsIce: a
|
|
1754
1754
|
};
|
|
1755
|
-
}, ha = (e) => () => (Mt(e)(),
|
|
1756
|
-
|
|
1755
|
+
}, ha = (e) => () => (Mt(e)(), Ft(e)(), Me.register(), ge.register(), ht.register(), Ke.register(), Ce.register(), oa.register(), gr.register(), Wr.register(), ar.register(), Re.register(), Ae.register(), j.register(), Ee.register(), m.companion.register(e)(
|
|
1756
|
+
Lt.type,
|
|
1757
1757
|
Me.type
|
|
1758
1758
|
), m.companion.register(e)(
|
|
1759
1759
|
Ve.type,
|
|
@@ -1838,19 +1838,19 @@ const De = H(), Oa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.define
|
|
|
1838
1838
|
function ma(e) {
|
|
1839
1839
|
return B(e);
|
|
1840
1840
|
}
|
|
1841
|
-
const
|
|
1841
|
+
const Fe = H(), Ea = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1842
1842
|
__proto__: null,
|
|
1843
|
-
api:
|
|
1844
|
-
default:
|
|
1843
|
+
api: Fe,
|
|
1844
|
+
default: Fe,
|
|
1845
1845
|
kosServiceRequest: ma
|
|
1846
1846
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1847
1847
|
function ya(e) {
|
|
1848
1848
|
return B(e);
|
|
1849
1849
|
}
|
|
1850
|
-
const
|
|
1850
|
+
const Le = H(), Sa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1851
1851
|
__proto__: null,
|
|
1852
|
-
api:
|
|
1853
|
-
default:
|
|
1852
|
+
api: Le,
|
|
1853
|
+
default: Le,
|
|
1854
1854
|
kosServiceRequest: ya
|
|
1855
1855
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1856
1856
|
function ba(e) {
|
|
@@ -1911,7 +1911,7 @@ export {
|
|
|
1911
1911
|
nr as v,
|
|
1912
1912
|
we as w,
|
|
1913
1913
|
Mr as x,
|
|
1914
|
-
|
|
1914
|
+
Lr as y,
|
|
1915
1915
|
Ia as z
|
|
1916
1916
|
};
|
|
1917
|
-
//# sourceMappingURL=service-
|
|
1917
|
+
//# sourceMappingURL=service-B5BitF77.js.map
|