@kosdev-code/kos-freestyle-sdk 0.1.0-dev.5171 → 0.1.0-dev.5180
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-CIeLBxMW.cjs → extension-utils-CbiToj2v.cjs} +2 -2
- package/{extension-utils-CIeLBxMW.cjs.map → extension-utils-CbiToj2v.cjs.map} +1 -1
- package/{extension-utils-mrQ_wiPv.js → extension-utils-DP5eulYE.js} +2 -2
- package/{extension-utils-mrQ_wiPv.js.map → extension-utils-DP5eulYE.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 +195 -5
- package/models/models/agitation-required-trouble/agitation-required-trouble-model.d.ts.map +1 -1
- package/models/models/agitation-required-trouble/index.d.ts +4 -2
- package/models/models/agitation-required-trouble/index.d.ts.map +1 -1
- package/models/models/carb-agitator/carb-agitator-model.d.ts +258 -0
- package/models/models/carb-agitator/carb-agitator-model.d.ts.map +1 -1
- package/models/models/carb-agitator/services/carb-tank-services.d.ts +25 -0
- package/models/models/carb-agitator/services/carb-tank-services.d.ts.map +1 -1
- package/models/utils/freestyle-registration-manager.d.ts.map +1 -1
- package/models.cjs +1 -1
- package/models.js +2 -2
- package/package.json +4 -4
- package/{service-DrOwtgpN.cjs → service-BYZ3LYEa.cjs} +2 -2
- package/service-BYZ3LYEa.cjs.map +1 -0
- package/{service-Rmefh9Kc.js → service-_jG-Kd3m.js} +539 -413
- package/service-_jG-Kd3m.js.map +1 -0
- package/ui.cjs +1 -1
- package/ui.js +2 -2
- package/{use-nutrition-info-Cb4qW_qq.js → use-nutrition-info-B9ybCLwb.js} +2 -2
- package/{use-nutrition-info-Cb4qW_qq.js.map → use-nutrition-info-B9ybCLwb.js.map} +1 -1
- package/{use-nutrition-info-DOOjBBqm.cjs → use-nutrition-info-C-RDcG4S.cjs} +2 -2
- package/{use-nutrition-info-DOOjBBqm.cjs.map → use-nutrition-info-C-RDcG4S.cjs.map} +1 -1
- package/models/models/agitation-required-trouble/agitation-required-trouble-registration.d.ts +0 -87
- package/models/models/agitation-required-trouble/agitation-required-trouble-registration.d.ts.map +0 -1
- package/service-DrOwtgpN.cjs.map +0 -1
- package/service-Rmefh9Kc.js.map +0 -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-BYZ3LYEa.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-CbiToj2v.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension-utils-CIeLBxMW.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":"gxCA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,EAA0B,KAAK,KAAM,KAAK,QAAQ,CACzE,CACF"}
|
|
1
|
+
{"version":3,"file":"extension-utils-CbiToj2v.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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,EAAA,iBAEE,KAAK,KAAOF,EACZ,KAAK,SAAWC,CAClB,CAMA,gCAAgCE,EAAiC,GAAI,CACnE,YAAK,SAAS,2BACZlB,EAA4BkB,CAAK,CAAA,EAG5B,IACT,CAEA,iCAAkC,CAChC,KAAK,SAAS,mCAAmCP,CAAqB,CACxE,CAEA,iCAAkC,CAChC,KAAK,SAAS,2BAA2BQ,6BAA2B,CACtE,CAEA,kCAAmC,CACjC,KAAK,SAAS,wBAAwBT,CAAwB,CAChE,CAEA,uCAAwC,CACtC,KAAK,SAAS,6BAA6BL,CAAoB,CACjE,CAEA,8BAA+B,CAC7Be,EAAAA,iBAAiBP,CAA2B,EAAE,SAC5CA,EACCrD,GACCA,IAAQ,eACR6D,EAAAA,gBAAgB,iBAAiBC,EAAAA,oBAAoB,CAAA,CAE3D,CAEA,iDAAkD,CAChDF,EAAAA,iBAAiBG,EAAAA,6BAA6B,EAAE,SAC9C,oBACA,MAAOC,IACE,CAAE,oBAAqB,CAAC,CAACA,EAAQ,KAAK,iBAAA,EAC/C,CAEJ,CAEA,8BAA+B,CAC7B,KAAK,gCAAA,EACL,KAAK,gCAAA,EACL,KAAK,iCAAA,EACL,KAAK,sCAAA,EACL,KAAK,6BAAA,EACL,KAAK,gDAAA,CACP,CACF,CASO,MAAMC,CAAoB,CAI/B,aAAc,CAHdR,EAAA,iBACAA,EAAA,aACAA,EAAA,kBAEE,KAAK,SAAW,IAAIS,2BACpB,KAAK,KAAO,IAAIC,uBAChB,KAAK,UAAY,IAAIb,EAA0B,KAAK,KAAM,KAAK,QAAQ,CACzE,CACF"}
|
|
@@ -1,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-_jG-Kd3m.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-DP5eulYE.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension-utils-mrQ_wiPv.js","sources":["../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/assets.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/beverage-screen.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/beverages.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/brand-screen.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/brands.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/copy-input.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/flavors.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/util/locate-brand.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/util/process-related-brand.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/related-brands.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/freestyle-loader.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/ingredient/model-extension.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/pourable/select-pourable-mapper.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extension-utils.ts"],"sourcesContent":["import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type { Asset, AvailabilityContext, UiSchemaResponse } from \"../types\";\n\nconst assetReducer = (acc: Record<string, Asset>, asset: Asset) => {\n acc[asset.dbId.toString()] = asset;\n return acc;\n};\n\n/**\n * Middleware that will normalize the assets array into a dictionary\n * @param context The context object that contains the data and result\n * @param next called at the end of the middleware to indicate that the next middleware can be called\n */\nexport const assetsMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const assets = input.assets.reduce(assetReducer, {} as Record<string, Asset>);\n context.result = { ...context.result, assets };\n await next();\n};\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type {\n AvailabilityContext,\n BeverageScreen,\n BeverageScreenData,\n UiSchemaResponse,\n} from \"../types\";\n\nfunction organizeBeverageData(\n jsonData: Record<string, any>\n): BeverageScreenData {\n const beverageData: BeverageScreenData = {};\n\n for (const key in jsonData) {\n // eslint-disable-next-line no-prototype-builtins\n if (jsonData.hasOwnProperty(key) && key.includes(\"slot\")) {\n const relatedBrand = key.includes(\"slotrb\");\n if (!relatedBrand) {\n const slot = key.split(\".\")[1]; // Extracting the slot number\n const beverageId = jsonData[`slot.${slot}.beverage`];\n\n if (beverageId) {\n // eslint-disable-next-line max-depth\n if (!beverageData[beverageId]) {\n beverageData[beverageId] = {};\n }\n\n beverageData[beverageId].rank = slot;\n // Removing the slot.x part from the key and adding to the object\n const beverageKey = key.replace(`slot.${slot}.`, \"\");\n beverageData[beverageId][beverageKey] = jsonData[key];\n }\n }\n }\n }\n\n return beverageData;\n}\nconst beverageScreenReducer =\n (input: UiSchemaResponse) =>\n (acc: Record<string, BeverageScreen>, curr: string) => {\n acc[curr] = input.beverageScreens[curr];\n acc[curr].beverages = organizeBeverageData(acc[curr]);\n return acc;\n };\n\n/**\n * Middleware that will normalize the beverage screen data. The middleware will perform the following:\n * 1. Organize the beverage screen data into a dictionary keyed by the brand id\n * 2. Adds a beverages property to the beverage screen data that contains the organized beverage data\n * 3. Processes related brands for each beverage screen\n *\n * @param context The context object that contains the data and result\n * @param next called at the end of the middleware to indicate that the next middleware can be called\n */\nexport const beverageScreenMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const beverageScreens = Object.keys(input.beverageScreens).reduce(\n beverageScreenReducer(input),\n input.beverageScreens\n );\n context.result = { ...context.result, beverageScreens };\n await next();\n};\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type { AvailabilityContext, Beverage, UiSchemaResponse } from \"../types\";\n\nconst beverageReducer = (acc: Record<string, Beverage>, beverage: Beverage) => {\n acc[beverage.beverageId.toString()] = beverage;\n return acc;\n};\n\n/**\n * Middleware that will normalize the brands array into a dictionary\n * @param context The context object that contains the data and result\n * @param next called at the end of the middleware to indicate that the next middleware can be called\n */\nexport const beveragesMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const beverages = input.beverages.reduce(\n beverageReducer,\n {} as Record<string, Beverage>\n );\n const beverageMap = input.beverages.reduce((acc, curr) => {\n acc[curr.dbId.toString()] = curr.beverageId.toString();\n return acc;\n }, {} as Record<string, string>);\n context.result = { ...context.result, beverages, beverageMap };\n await next();\n};\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type {\n AvailabilityContext,\n BrandScreenData,\n UiSchemaResponse,\n} from \"../types\";\n\nfunction organizeBrandData(jsonData: Record<string, any>): Record<string, any> {\n const brandScreenData: BrandScreenData = { rank: 0 };\n\n for (const key in jsonData) {\n // eslint-disable-next-line no-prototype-builtins\n if (jsonData.hasOwnProperty(key) && key.includes(\"slot\")) {\n const slot = key.split(\".\")[1]; // Extracting the slot number\n const position = slot.split(\":\")[1]; // Extracting the position number\n const brandId = jsonData[`slot.${slot}.brand`];\n\n if (brandId) {\n if (!brandScreenData[brandId]) {\n brandScreenData[brandId] = {\n rank: Number(position),\n };\n }\n\n // Removing the slot.x part from the key and adding to the object\n const brandKey = key.replace(`slot.${slot}.`, \"\");\n brandScreenData[brandId][brandKey] = jsonData[key];\n }\n }\n }\n\n return brandScreenData;\n}\nexport const brandScreenMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const brandScreen = organizeBrandData(input.brandScreen);\n context.result = { ...context.result, brandScreen };\n await next();\n};\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type { AvailabilityContext, Brand, UiSchemaResponse } from \"../types\";\n\nconst brandReducer = (acc: Record<string, Brand>, brand: Brand) => {\n acc[brand.dbId.toString()] = brand;\n return acc;\n};\n\n/**\n * Middleware that will normalize the brands array into a dictionary\n * @param context The context object that contains the data and result\n * @param next called at the end of the middleware to indicate that the next middleware can be called\n */\nexport const brandsMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const brands = input.brands.reduce(brandReducer, {} as Record<string, Brand>);\n context.result = { ...context.result, brands };\n await next();\n};\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\n\nexport const copyMiddleware: Middleware<any, any> = async (context, next) => {\n context.result = { ...context.data };\n await next();\n};\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type { AvailabilityContext, Flavor, UiSchemaResponse } from \"../types\";\n\nconst flavorReducer = (acc: Record<string, Flavor>, flavor: Flavor) => {\n acc[flavor.dbId.toString()] = flavor;\n return acc;\n};\n\n/**\n * Middleware that will normalize the flavors array into a dictionary\n * @param context The context object that contains the data and result\n * @param next called at the end of the middleware to indicate that the next middleware can be called\n */\nexport const flavorsMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const flavors = input.flavors.reduce(\n flavorReducer,\n {} as Record<string, Flavor>\n );\n context.result = { ...context.result, flavors };\n await next();\n};\n","export function locateRelatedBrand(\n jsonData: Record<string, any>,\n slot: string\n) {\n const relatedBrand = jsonData[`slotrb:${slot}.brand`];\n return relatedBrand;\n}\n","import type { BeverageScreenData } from \"../types\";\n\nexport const processRelatedBrand =\n (json: Record<string, any>) =>\n (\n beverageData: BeverageScreenData,\n brandId: string,\n slot: string,\n key: string\n ) => {\n if (!beverageData.relatedBrand) {\n beverageData.relatedBrand = {};\n }\n\n if (!beverageData.relatedBrand[brandId]) {\n beverageData.relatedBrand[brandId] = {\n rank: slot,\n };\n }\n\n const beverageKey = key.replace(`slotrb:${slot}.`, \"\");\n beverageData.relatedBrand[brandId][beverageKey] = json[key];\n };\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type {\n AvailabilityContext,\n BeverageScreen,\n BeverageScreenData,\n UiSchemaResponse,\n} from \"../types\";\nimport { locateRelatedBrand } from \"../util/locate-brand\";\nimport { processRelatedBrand } from \"../util/process-related-brand\";\n\nfunction organizeBeverageData(\n jsonData: Record<string, any>\n): BeverageScreenData {\n const beverageData: BeverageScreenData = {};\n\n for (const key in jsonData) {\n // eslint-disable-next-line no-prototype-builtins\n if (jsonData.hasOwnProperty(key) && key.includes(\"slot\")) {\n const relatedBrand = key.includes(\"slotrb\");\n if (relatedBrand) {\n const slot = key.split(\":\")[1].split(\".\")[0]; // Extracting the slot number\n const relatedBrand = locateRelatedBrand(jsonData, slot);\n processRelatedBrand(jsonData)(beverageData, relatedBrand, slot, key);\n }\n }\n }\n\n return beverageData;\n}\nconst beverageScreenReducer =\n (input: UiSchemaResponse) =>\n (acc: Record<string, BeverageScreen>, curr: string) => {\n acc[curr] = input.beverageScreens[curr];\n acc[curr].beverages = {\n ...acc[curr].beverages,\n ...organizeBeverageData(acc[curr]),\n };\n return acc;\n };\n\n/**\n * Middleware that will normalize the beverage screen data. The middleware will perform the following:\n * 1. Organize the beverage screen data into a dictionary keyed by the brand id\n * 2. Adds a beverages property to the beverage screen data that contains the organized beverage data\n * 3. Processes related brands for each beverage screen\n *\n * @param context The context object that contains the data and result\n * @param next called at the end of the middleware to indicate that the next middleware can be called\n */\nexport const relatedBrandMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const beverageScreens = Object.keys(input.beverageScreens).reduce(\n beverageScreenReducer(input),\n input.beverageScreens\n );\n context.result = { ...context.result, beverageScreens };\n await next();\n};\n","import {\n kosFetch,\n processMiddleware,\n type DataLoader,\n type Middleware,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport { assetsMiddleware } from \"./middleware/assets\";\nimport { beverageScreenMiddleware } from \"./middleware/beverage-screen\";\nimport { beveragesMiddleware } from \"./middleware/beverages\";\nimport { brandScreenMiddleware } from \"./middleware/brand-screen\";\nimport { brandsMiddleware } from \"./middleware/brands\";\nimport { copyMiddleware } from \"./middleware/copy-input\";\nimport { flavorsMiddleware } from \"./middleware/flavors\";\nimport { relatedBrandMiddleware } from \"./middleware/related-brands\";\nimport type { AvailabilityContext, UiSchemaResponse } from \"./types\";\n\nexport const transformAvailabilityData = async (\n input: UiSchemaResponse,\n additionalMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n >[] = [],\n replace = false\n): Promise<AvailabilityContext> => {\n const middleware = replace\n ? [...additionalMiddleware]\n : [\n copyMiddleware,\n assetsMiddleware,\n flavorsMiddleware,\n beveragesMiddleware,\n brandsMiddleware,\n beverageScreenMiddleware,\n relatedBrandMiddleware,\n brandScreenMiddleware,\n ...additionalMiddleware,\n ];\n const availabilityContext = await processMiddleware<\n UiSchemaResponse,\n AvailabilityContext\n >(input, middleware);\n\n return availabilityContext;\n};\n\n/**\n * Props for the freestyle availability loader\n */\nexport interface AvailabilityLoaderProps {\n /** the url to send the request for the UiSchemaData. Defaults to http://localhost:8081/system/cui/core.json */\n url?: string;\n\n /** additional middlewares to execute as part of the data processing */\n middleware?: Middleware<UiSchemaResponse, AvailabilityContext>[];\n\n /** if true, replace the default middleware with the provided middleware */\n replace?: boolean;\n}\n/**\n * Utility method to load the freestyle brandset data into the availability context.\n *\n * This loader will retrieve the UI Schema from the provided URL and transform it into\n * a format that can be used to populate the availability brands and beverages with UI schema\n * data.\n *\n * With this data, the availability models can have access to the brandset assets for\n * brands, beverages and flavours.\n *\n *\n * @param props\n * @returns A DataLoader function that will load the availability context\n */\nexport const freestyleAvailabilityLoader =\n ({\n url = \"http://localhost:8081/system/cui/core.json\",\n middleware = [],\n replace = false,\n }: AvailabilityLoaderProps = {}): DataLoader =>\n async (): Promise<AvailabilityContext> => {\n const schema = await kosFetch(url);\n if (schema.ok) {\n const response = await schema.json<UiSchemaResponse>();\n if (!response) {\n throw new Error(\"Failed to parse availability context\");\n }\n return await transformAvailabilityData(response, middleware, replace);\n }\n throw new Error(\"Failed to load availability context\");\n };\n","import {\n DataMapper,\n IndexExtension,\n PropertyMapper,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport type {\n FreestyleIngredientData,\n FreestyleIngredientModelData,\n FreestyleIngredientResponseData,\n} from \"../../../models/types/ingredients\";\n\nexport const ingredientDataMapper: DataMapper = async (\n data: FreestyleIngredientResponseData\n) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { id, name, ...rest } = data;\n const response: FreestyleIngredientData = {\n ...rest,\n ingredientMacro: rest.bib && !rest.sweetener ? \"macro\" : \"micro\",\n };\n return response;\n};\n\nexport const ingredientIndexExtension: IndexExtension<FreestyleIngredientModelData> =\n {\n macro: \"ingredientMacro\",\n };\nexport const ingredientCategoryMapper: PropertyMapper = (\n ingredientData: FreestyleIngredientResponseData\n) => ingredientData.type;\n","import type { SelectedPourable } from \"@kosdev-code/kos-dispense-sdk\";\n\nexport const pourableRequestMapper = async (data: SelectedPourable) => {\n return {\n bevId: data.beverage?.rawId,\n };\n};\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { DispenseExtensionManager } from \"@kosdev-code/kos-dispense-sdk\";\nimport {\n CoreExtensionManager,\n EXTENSION_TROUBLE_DATA_MAPPER,\n ExtensionManager,\n KosFeatureFlags,\n type TroubleModel,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport type { AgitationRequiredTroubleIface } from \"../models/cartridge-agitator/types\";\nimport { FEATURE_SUPPORTS_ICE } from \"../models/freestyle-assembly/freestyle-assembly-model\";\nimport { freestyleAssemblyDataMapper } from \"./extensions/assembly/assembly-data-mapper\";\nimport {\n freestyleAvailabilityLoader,\n type AvailabilityLoaderProps,\n} from \"./extensions/availability/freestyle-loader\";\nimport {\n ingredientDataMapper,\n ingredientIndexExtension,\n} from \"./extensions/ingredient\";\nimport { pourableRequestMapper } from \"./extensions/pourable/select-pourable-mapper\";\nexport const EXTENSION_PLUGIN_VISIBILITY = \"pluginVisibility\";\n\nexport class FreestyleExtensionManager {\n core: CoreExtensionManager;\n dispense: DispenseExtensionManager;\n constructor(core: CoreExtensionManager, dispense: DispenseExtensionManager) {\n this.core = core;\n this.dispense = dispense;\n }\n\n /**\n * Loads the core brandset data into a format that can be consumed by the\n * freestyle models.\n * */\n registerFreestyleBrandsetReader(props: AvailabilityLoaderProps = {}) {\n this.dispense.registerAvailabilityLoader(\n freestyleAvailabilityLoader(props)\n );\n\n return this;\n }\n\n registerFreestylePourableMapper() {\n this.dispense.registerSelectedPourableDataMapper(pourableRequestMapper);\n }\n\n registerFreestyleAssemblyMapper() {\n this.dispense.registerAssemblyDataMapper(freestyleAssemblyDataMapper);\n }\n\n registerFreestyleIngredientIndex() {\n this.dispense.registerIngredientIndex(ingredientIndexExtension);\n }\n\n registerFreestyleIngredientDataMapper() {\n this.dispense.registerIngredientDataMapper(ingredientDataMapper);\n }\n\n registerFreestyleIceAgitator() {\n ExtensionManager[EXTENSION_PLUGIN_VISIBILITY].register(\n EXTENSION_PLUGIN_VISIBILITY,\n (key) =>\n key !== \"iceAgitator\" ||\n KosFeatureFlags.isFeatureEnabled(FEATURE_SUPPORTS_ICE)\n );\n }\n\n registerFreestyleAgitationRequiredTroubleMapper() {\n ExtensionManager[EXTENSION_TROUBLE_DATA_MAPPER].register(\n \"agitationRequired\",\n async (trouble: TroubleModel<AgitationRequiredTroubleIface>) => {\n return { isAgitationRequired: !!trouble.data.agitationRequired };\n }\n );\n }\n\n initializeFreestyleExtension() {\n this.registerFreestylePourableMapper();\n this.registerFreestyleAssemblyMapper();\n this.registerFreestyleIngredientIndex();\n this.registerFreestyleIngredientDataMapper();\n this.registerFreestyleIceAgitator();\n this.registerFreestyleAgitationRequiredTroubleMapper();\n }\n}\n/**\n * The KosExtensionManager provides access to the extension points that are provided in the SDK for Dispense applications.\n *\n * The extension points are divided into two categories:\n *\n * @param core - The core extension {@link CoreExtensionManager} points are used to extend the base models that are provided by the SDK.\n * @param dispense - The dispense extension {@link DispenseExtensionManager} points are used to extend the models that are specific to the Dispense SDK.\n */\nexport class KosExtensionManager {\n dispense: DispenseExtensionManager;\n core: CoreExtensionManager;\n freestyle: FreestyleExtensionManager;\n constructor() {\n this.dispense = new DispenseExtensionManager();\n this.core = new CoreExtensionManager();\n this.freestyle = new FreestyleExtensionManager(this.core, this.dispense);\n }\n}\n"],"names":["assetReducer","acc","asset","assetsMiddleware","context","next","assets","organizeBeverageData","jsonData","beverageData","key","slot","beverageId","beverageKey","beverageScreenReducer","input","curr","beverageScreenMiddleware","beverageScreens","beverageReducer","beverage","beveragesMiddleware","beverages","beverageMap","organizeBrandData","brandScreenData","position","brandId","brandKey","brandScreenMiddleware","brandScreen","brandReducer","brand","brandsMiddleware","brands","copyMiddleware","flavorReducer","flavor","flavorsMiddleware","flavors","locateRelatedBrand","processRelatedBrand","json","relatedBrand","relatedBrandMiddleware","transformAvailabilityData","additionalMiddleware","replace","middleware","processMiddleware","freestyleAvailabilityLoader","url","schema","kosFetch","response","ingredientDataMapper","data","id","name","rest","ingredientIndexExtension","pourableRequestMapper","_a","EXTENSION_PLUGIN_VISIBILITY","FreestyleExtensionManager","core","dispense","__publicField","props","freestyleAssemblyDataMapper","ExtensionManager","KosFeatureFlags","FEATURE_SUPPORTS_ICE","EXTENSION_TROUBLE_DATA_MAPPER","trouble","KosExtensionManager","DispenseExtensionManager","CoreExtensionManager"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8CAGMA,IAAe,CAACC,GAA4BC,OAChDD,EAAIC,EAAM,KAAK,SAAA,CAAU,IAAIA,GACtBD,IAQIE,IAGT,OAAOC,GAASC,MAAS;AAE3B,QAAMC,IADQF,EAAQ,KACD,OAAO,OAAOJ,GAAc,CAAA,CAA2B;AAC5E,EAAAI,EAAQ,SAAS,EAAE,GAAGA,EAAQ,QAAQ,QAAAE,EAAA,GACtC,MAAMD,EAAA;AACR;ACbA,SAASE,EACPC,GACoB;AACpB,QAAMC,IAAmC,CAAA;AAEzC,aAAWC,KAAOF;AAEhB,QAAIA,EAAS,eAAeE,CAAG,KAAKA,EAAI,SAAS,MAAM,KAEjD,CADiBA,EAAI,SAAS,QAAQ,GACvB;AACjB,YAAMC,IAAOD,EAAI,MAAM,GAAG,EAAE,CAAC,GACvBE,IAAaJ,EAAS,QAAQG,CAAI,WAAW;AAEnD,UAAIC,GAAY;AAEd,QAAKH,EAAaG,CAAU,MAC1BH,EAAaG,CAAU,IAAI,CAAA,IAG7BH,EAAaG,CAAU,EAAE,OAAOD;AAEhC,cAAME,IAAcH,EAAI,QAAQ,QAAQC,CAAI,KAAK,EAAE;AACnD,QAAAF,EAAaG,CAAU,EAAEC,CAAW,IAAIL,EAASE,CAAG;AAAA,MACtD;AAAA,IACF;AAIJ,SAAOD;AACT;AACA,MAAMK,IACJ,CAACC,MACD,CAACd,GAAqCe,OACpCf,EAAIe,CAAI,IAAID,EAAM,gBAAgBC,CAAI,GACtCf,EAAIe,CAAI,EAAE,YAAYT,EAAqBN,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EA,kCAAkC;AAChC,SAAK,SAAS,2BAA2BQ,CAA2B;AAAA,EACtE;AAAA,EAEA,mCAAmC;AACjC,SAAK,SAAS,wBAAwBT,EAAwB;AAAA,EAChE;AAAA,EAEA,wCAAwC;AACtC,SAAK,SAAS,6BAA6BL,EAAoB;AAAA,EACjE;AAAA,EAEA,+BAA+B;AAC7B,IAAAe,EAAiBP,CAA2B,EAAE;AAAA,MAC5CA;AAAA,MACA,CAACrD,MACCA,MAAQ,iBACR6D,EAAgB,iBAAiBC,CAAoB;AAAA,IAAA;AAAA,EAE3D;AAAA,EAEA,kDAAkD;AAChD,IAAAF,EAAiBG,CAA6B,EAAE;AAAA,MAC9C;AAAA,MACA,OAAOC,OACE,EAAE,qBAAqB,CAAC,CAACA,EAAQ,KAAK,kBAAA;AAAA,IAC/C;AAAA,EAEJ;AAAA,EAEA,+BAA+B;AAC7B,SAAK,gCAAA,GACL,KAAK,gCAAA,GACL,KAAK,iCAAA,GACL,KAAK,sCAAA,GACL,KAAK,6BAAA,GACL,KAAK,gDAAA;AAAA,EACP;AACF;AASO,MAAMC,GAAoB;AAAA,EAI/B,cAAc;AAHd,IAAAR,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AAEE,SAAK,WAAW,IAAIS,EAAA,GACpB,KAAK,OAAO,IAAIC,EAAA,GAChB,KAAK,YAAY,IAAIb,GAA0B,KAAK,MAAM,KAAK,QAAQ;AAAA,EACzE;AACF;"}
|
|
1
|
+
{"version":3,"file":"extension-utils-DP5eulYE.js","sources":["../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/assets.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/beverage-screen.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/beverages.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/brand-screen.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/brands.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/copy-input.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/flavors.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/util/locate-brand.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/util/process-related-brand.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/middleware/related-brands.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/availability/freestyle-loader.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/ingredient/model-extension.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/pourable/select-pourable-mapper.ts","../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extension-utils.ts"],"sourcesContent":["import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type { Asset, AvailabilityContext, UiSchemaResponse } from \"../types\";\n\nconst assetReducer = (acc: Record<string, Asset>, asset: Asset) => {\n acc[asset.dbId.toString()] = asset;\n return acc;\n};\n\n/**\n * Middleware that will normalize the assets array into a dictionary\n * @param context The context object that contains the data and result\n * @param next called at the end of the middleware to indicate that the next middleware can be called\n */\nexport const assetsMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const assets = input.assets.reduce(assetReducer, {} as Record<string, Asset>);\n context.result = { ...context.result, assets };\n await next();\n};\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type {\n AvailabilityContext,\n BeverageScreen,\n BeverageScreenData,\n UiSchemaResponse,\n} from \"../types\";\n\nfunction organizeBeverageData(\n jsonData: Record<string, any>\n): BeverageScreenData {\n const beverageData: BeverageScreenData = {};\n\n for (const key in jsonData) {\n // eslint-disable-next-line no-prototype-builtins\n if (jsonData.hasOwnProperty(key) && key.includes(\"slot\")) {\n const relatedBrand = key.includes(\"slotrb\");\n if (!relatedBrand) {\n const slot = key.split(\".\")[1]; // Extracting the slot number\n const beverageId = jsonData[`slot.${slot}.beverage`];\n\n if (beverageId) {\n // eslint-disable-next-line max-depth\n if (!beverageData[beverageId]) {\n beverageData[beverageId] = {};\n }\n\n beverageData[beverageId].rank = slot;\n // Removing the slot.x part from the key and adding to the object\n const beverageKey = key.replace(`slot.${slot}.`, \"\");\n beverageData[beverageId][beverageKey] = jsonData[key];\n }\n }\n }\n }\n\n return beverageData;\n}\nconst beverageScreenReducer =\n (input: UiSchemaResponse) =>\n (acc: Record<string, BeverageScreen>, curr: string) => {\n acc[curr] = input.beverageScreens[curr];\n acc[curr].beverages = organizeBeverageData(acc[curr]);\n return acc;\n };\n\n/**\n * Middleware that will normalize the beverage screen data. The middleware will perform the following:\n * 1. Organize the beverage screen data into a dictionary keyed by the brand id\n * 2. Adds a beverages property to the beverage screen data that contains the organized beverage data\n * 3. Processes related brands for each beverage screen\n *\n * @param context The context object that contains the data and result\n * @param next called at the end of the middleware to indicate that the next middleware can be called\n */\nexport const beverageScreenMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const beverageScreens = Object.keys(input.beverageScreens).reduce(\n beverageScreenReducer(input),\n input.beverageScreens\n );\n context.result = { ...context.result, beverageScreens };\n await next();\n};\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type { AvailabilityContext, Beverage, UiSchemaResponse } from \"../types\";\n\nconst beverageReducer = (acc: Record<string, Beverage>, beverage: Beverage) => {\n acc[beverage.beverageId.toString()] = beverage;\n return acc;\n};\n\n/**\n * Middleware that will normalize the brands array into a dictionary\n * @param context The context object that contains the data and result\n * @param next called at the end of the middleware to indicate that the next middleware can be called\n */\nexport const beveragesMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const beverages = input.beverages.reduce(\n beverageReducer,\n {} as Record<string, Beverage>\n );\n const beverageMap = input.beverages.reduce((acc, curr) => {\n acc[curr.dbId.toString()] = curr.beverageId.toString();\n return acc;\n }, {} as Record<string, string>);\n context.result = { ...context.result, beverages, beverageMap };\n await next();\n};\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type {\n AvailabilityContext,\n BrandScreenData,\n UiSchemaResponse,\n} from \"../types\";\n\nfunction organizeBrandData(jsonData: Record<string, any>): Record<string, any> {\n const brandScreenData: BrandScreenData = { rank: 0 };\n\n for (const key in jsonData) {\n // eslint-disable-next-line no-prototype-builtins\n if (jsonData.hasOwnProperty(key) && key.includes(\"slot\")) {\n const slot = key.split(\".\")[1]; // Extracting the slot number\n const position = slot.split(\":\")[1]; // Extracting the position number\n const brandId = jsonData[`slot.${slot}.brand`];\n\n if (brandId) {\n if (!brandScreenData[brandId]) {\n brandScreenData[brandId] = {\n rank: Number(position),\n };\n }\n\n // Removing the slot.x part from the key and adding to the object\n const brandKey = key.replace(`slot.${slot}.`, \"\");\n brandScreenData[brandId][brandKey] = jsonData[key];\n }\n }\n }\n\n return brandScreenData;\n}\nexport const brandScreenMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const brandScreen = organizeBrandData(input.brandScreen);\n context.result = { ...context.result, brandScreen };\n await next();\n};\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type { AvailabilityContext, Brand, UiSchemaResponse } from \"../types\";\n\nconst brandReducer = (acc: Record<string, Brand>, brand: Brand) => {\n acc[brand.dbId.toString()] = brand;\n return acc;\n};\n\n/**\n * Middleware that will normalize the brands array into a dictionary\n * @param context The context object that contains the data and result\n * @param next called at the end of the middleware to indicate that the next middleware can be called\n */\nexport const brandsMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const brands = input.brands.reduce(brandReducer, {} as Record<string, Brand>);\n context.result = { ...context.result, brands };\n await next();\n};\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\n\nexport const copyMiddleware: Middleware<any, any> = async (context, next) => {\n context.result = { ...context.data };\n await next();\n};\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type { AvailabilityContext, Flavor, UiSchemaResponse } from \"../types\";\n\nconst flavorReducer = (acc: Record<string, Flavor>, flavor: Flavor) => {\n acc[flavor.dbId.toString()] = flavor;\n return acc;\n};\n\n/**\n * Middleware that will normalize the flavors array into a dictionary\n * @param context The context object that contains the data and result\n * @param next called at the end of the middleware to indicate that the next middleware can be called\n */\nexport const flavorsMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const flavors = input.flavors.reduce(\n flavorReducer,\n {} as Record<string, Flavor>\n );\n context.result = { ...context.result, flavors };\n await next();\n};\n","export function locateRelatedBrand(\n jsonData: Record<string, any>,\n slot: string\n) {\n const relatedBrand = jsonData[`slotrb:${slot}.brand`];\n return relatedBrand;\n}\n","import type { BeverageScreenData } from \"../types\";\n\nexport const processRelatedBrand =\n (json: Record<string, any>) =>\n (\n beverageData: BeverageScreenData,\n brandId: string,\n slot: string,\n key: string\n ) => {\n if (!beverageData.relatedBrand) {\n beverageData.relatedBrand = {};\n }\n\n if (!beverageData.relatedBrand[brandId]) {\n beverageData.relatedBrand[brandId] = {\n rank: slot,\n };\n }\n\n const beverageKey = key.replace(`slotrb:${slot}.`, \"\");\n beverageData.relatedBrand[brandId][beverageKey] = json[key];\n };\n","import type { Middleware } from \"@kosdev-code/kos-ui-sdk\";\nimport type {\n AvailabilityContext,\n BeverageScreen,\n BeverageScreenData,\n UiSchemaResponse,\n} from \"../types\";\nimport { locateRelatedBrand } from \"../util/locate-brand\";\nimport { processRelatedBrand } from \"../util/process-related-brand\";\n\nfunction organizeBeverageData(\n jsonData: Record<string, any>\n): BeverageScreenData {\n const beverageData: BeverageScreenData = {};\n\n for (const key in jsonData) {\n // eslint-disable-next-line no-prototype-builtins\n if (jsonData.hasOwnProperty(key) && key.includes(\"slot\")) {\n const relatedBrand = key.includes(\"slotrb\");\n if (relatedBrand) {\n const slot = key.split(\":\")[1].split(\".\")[0]; // Extracting the slot number\n const relatedBrand = locateRelatedBrand(jsonData, slot);\n processRelatedBrand(jsonData)(beverageData, relatedBrand, slot, key);\n }\n }\n }\n\n return beverageData;\n}\nconst beverageScreenReducer =\n (input: UiSchemaResponse) =>\n (acc: Record<string, BeverageScreen>, curr: string) => {\n acc[curr] = input.beverageScreens[curr];\n acc[curr].beverages = {\n ...acc[curr].beverages,\n ...organizeBeverageData(acc[curr]),\n };\n return acc;\n };\n\n/**\n * Middleware that will normalize the beverage screen data. The middleware will perform the following:\n * 1. Organize the beverage screen data into a dictionary keyed by the brand id\n * 2. Adds a beverages property to the beverage screen data that contains the organized beverage data\n * 3. Processes related brands for each beverage screen\n *\n * @param context The context object that contains the data and result\n * @param next called at the end of the middleware to indicate that the next middleware can be called\n */\nexport const relatedBrandMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n> = async (context, next) => {\n const input = context.data;\n const beverageScreens = Object.keys(input.beverageScreens).reduce(\n beverageScreenReducer(input),\n input.beverageScreens\n );\n context.result = { ...context.result, beverageScreens };\n await next();\n};\n","import {\n kosFetch,\n processMiddleware,\n type DataLoader,\n type Middleware,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport { assetsMiddleware } from \"./middleware/assets\";\nimport { beverageScreenMiddleware } from \"./middleware/beverage-screen\";\nimport { beveragesMiddleware } from \"./middleware/beverages\";\nimport { brandScreenMiddleware } from \"./middleware/brand-screen\";\nimport { brandsMiddleware } from \"./middleware/brands\";\nimport { copyMiddleware } from \"./middleware/copy-input\";\nimport { flavorsMiddleware } from \"./middleware/flavors\";\nimport { relatedBrandMiddleware } from \"./middleware/related-brands\";\nimport type { AvailabilityContext, UiSchemaResponse } from \"./types\";\n\nexport const transformAvailabilityData = async (\n input: UiSchemaResponse,\n additionalMiddleware: Middleware<\n UiSchemaResponse,\n AvailabilityContext\n >[] = [],\n replace = false\n): Promise<AvailabilityContext> => {\n const middleware = replace\n ? [...additionalMiddleware]\n : [\n copyMiddleware,\n assetsMiddleware,\n flavorsMiddleware,\n beveragesMiddleware,\n brandsMiddleware,\n beverageScreenMiddleware,\n relatedBrandMiddleware,\n brandScreenMiddleware,\n ...additionalMiddleware,\n ];\n const availabilityContext = await processMiddleware<\n UiSchemaResponse,\n AvailabilityContext\n >(input, middleware);\n\n return availabilityContext;\n};\n\n/**\n * Props for the freestyle availability loader\n */\nexport interface AvailabilityLoaderProps {\n /** the url to send the request for the UiSchemaData. Defaults to http://localhost:8081/system/cui/core.json */\n url?: string;\n\n /** additional middlewares to execute as part of the data processing */\n middleware?: Middleware<UiSchemaResponse, AvailabilityContext>[];\n\n /** if true, replace the default middleware with the provided middleware */\n replace?: boolean;\n}\n/**\n * Utility method to load the freestyle brandset data into the availability context.\n *\n * This loader will retrieve the UI Schema from the provided URL and transform it into\n * a format that can be used to populate the availability brands and beverages with UI schema\n * data.\n *\n * With this data, the availability models can have access to the brandset assets for\n * brands, beverages and flavours.\n *\n *\n * @param props\n * @returns A DataLoader function that will load the availability context\n */\nexport const freestyleAvailabilityLoader =\n ({\n url = \"http://localhost:8081/system/cui/core.json\",\n middleware = [],\n replace = false,\n }: AvailabilityLoaderProps = {}): DataLoader =>\n async (): Promise<AvailabilityContext> => {\n const schema = await kosFetch(url);\n if (schema.ok) {\n const response = await schema.json<UiSchemaResponse>();\n if (!response) {\n throw new Error(\"Failed to parse availability context\");\n }\n return await transformAvailabilityData(response, middleware, replace);\n }\n throw new Error(\"Failed to load availability context\");\n };\n","import {\n DataMapper,\n IndexExtension,\n PropertyMapper,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport type {\n FreestyleIngredientData,\n FreestyleIngredientModelData,\n FreestyleIngredientResponseData,\n} from \"../../../models/types/ingredients\";\n\nexport const ingredientDataMapper: DataMapper = async (\n data: FreestyleIngredientResponseData\n) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { id, name, ...rest } = data;\n const response: FreestyleIngredientData = {\n ...rest,\n ingredientMacro: rest.bib && !rest.sweetener ? \"macro\" : \"micro\",\n };\n return response;\n};\n\nexport const ingredientIndexExtension: IndexExtension<FreestyleIngredientModelData> =\n {\n macro: \"ingredientMacro\",\n };\nexport const ingredientCategoryMapper: PropertyMapper = (\n ingredientData: FreestyleIngredientResponseData\n) => ingredientData.type;\n","import type { SelectedPourable } from \"@kosdev-code/kos-dispense-sdk\";\n\nexport const pourableRequestMapper = async (data: SelectedPourable) => {\n return {\n bevId: data.beverage?.rawId,\n };\n};\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { DispenseExtensionManager } from \"@kosdev-code/kos-dispense-sdk\";\nimport {\n CoreExtensionManager,\n EXTENSION_TROUBLE_DATA_MAPPER,\n ExtensionManager,\n KosFeatureFlags,\n type TroubleModel,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport type { AgitationRequiredTroubleIface } from \"../models/cartridge-agitator/types\";\nimport { FEATURE_SUPPORTS_ICE } from \"../models/freestyle-assembly/freestyle-assembly-model\";\nimport { freestyleAssemblyDataMapper } from \"./extensions/assembly/assembly-data-mapper\";\nimport {\n freestyleAvailabilityLoader,\n type AvailabilityLoaderProps,\n} from \"./extensions/availability/freestyle-loader\";\nimport {\n ingredientDataMapper,\n ingredientIndexExtension,\n} from \"./extensions/ingredient\";\nimport { pourableRequestMapper } from \"./extensions/pourable/select-pourable-mapper\";\nexport const EXTENSION_PLUGIN_VISIBILITY = \"pluginVisibility\";\n\nexport class FreestyleExtensionManager {\n core: CoreExtensionManager;\n dispense: DispenseExtensionManager;\n constructor(core: CoreExtensionManager, dispense: DispenseExtensionManager) {\n this.core = core;\n this.dispense = dispense;\n }\n\n /**\n * Loads the core brandset data into a format that can be consumed by the\n * freestyle models.\n * */\n registerFreestyleBrandsetReader(props: AvailabilityLoaderProps = {}) {\n this.dispense.registerAvailabilityLoader(\n freestyleAvailabilityLoader(props)\n );\n\n return this;\n }\n\n registerFreestylePourableMapper() {\n this.dispense.registerSelectedPourableDataMapper(pourableRequestMapper);\n }\n\n registerFreestyleAssemblyMapper() {\n this.dispense.registerAssemblyDataMapper(freestyleAssemblyDataMapper);\n }\n\n registerFreestyleIngredientIndex() {\n this.dispense.registerIngredientIndex(ingredientIndexExtension);\n }\n\n registerFreestyleIngredientDataMapper() {\n this.dispense.registerIngredientDataMapper(ingredientDataMapper);\n }\n\n registerFreestyleIceAgitator() {\n ExtensionManager[EXTENSION_PLUGIN_VISIBILITY].register(\n EXTENSION_PLUGIN_VISIBILITY,\n (key) =>\n key !== \"iceAgitator\" ||\n KosFeatureFlags.isFeatureEnabled(FEATURE_SUPPORTS_ICE)\n );\n }\n\n registerFreestyleAgitationRequiredTroubleMapper() {\n ExtensionManager[EXTENSION_TROUBLE_DATA_MAPPER].register(\n \"agitationRequired\",\n async (trouble: TroubleModel<AgitationRequiredTroubleIface>) => {\n return { isAgitationRequired: !!trouble.data.agitationRequired };\n }\n );\n }\n\n initializeFreestyleExtension() {\n this.registerFreestylePourableMapper();\n this.registerFreestyleAssemblyMapper();\n this.registerFreestyleIngredientIndex();\n this.registerFreestyleIngredientDataMapper();\n this.registerFreestyleIceAgitator();\n this.registerFreestyleAgitationRequiredTroubleMapper();\n }\n}\n/**\n * The KosExtensionManager provides access to the extension points that are provided in the SDK for Dispense applications.\n *\n * The extension points are divided into two categories:\n *\n * @param core - The core extension {@link CoreExtensionManager} points are used to extend the base models that are provided by the SDK.\n * @param dispense - The dispense extension {@link DispenseExtensionManager} points are used to extend the models that are specific to the Dispense SDK.\n */\nexport class KosExtensionManager {\n dispense: DispenseExtensionManager;\n core: CoreExtensionManager;\n freestyle: FreestyleExtensionManager;\n constructor() {\n this.dispense = new DispenseExtensionManager();\n this.core = new CoreExtensionManager();\n this.freestyle = new FreestyleExtensionManager(this.core, this.dispense);\n }\n}\n"],"names":["assetReducer","acc","asset","assetsMiddleware","context","next","assets","organizeBeverageData","jsonData","beverageData","key","slot","beverageId","beverageKey","beverageScreenReducer","input","curr","beverageScreenMiddleware","beverageScreens","beverageReducer","beverage","beveragesMiddleware","beverages","beverageMap","organizeBrandData","brandScreenData","position","brandId","brandKey","brandScreenMiddleware","brandScreen","brandReducer","brand","brandsMiddleware","brands","copyMiddleware","flavorReducer","flavor","flavorsMiddleware","flavors","locateRelatedBrand","processRelatedBrand","json","relatedBrand","relatedBrandMiddleware","transformAvailabilityData","additionalMiddleware","replace","middleware","processMiddleware","freestyleAvailabilityLoader","url","schema","kosFetch","response","ingredientDataMapper","data","id","name","rest","ingredientIndexExtension","pourableRequestMapper","_a","EXTENSION_PLUGIN_VISIBILITY","FreestyleExtensionManager","core","dispense","__publicField","props","freestyleAssemblyDataMapper","ExtensionManager","KosFeatureFlags","FEATURE_SUPPORTS_ICE","EXTENSION_TROUBLE_DATA_MAPPER","trouble","KosExtensionManager","DispenseExtensionManager","CoreExtensionManager"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8CAGMA,IAAe,CAACC,GAA4BC,OAChDD,EAAIC,EAAM,KAAK,SAAA,CAAU,IAAIA,GACtBD,IAQIE,IAGT,OAAOC,GAASC,MAAS;AAE3B,QAAMC,IADQF,EAAQ,KACD,OAAO,OAAOJ,GAAc,CAAA,CAA2B;AAC5E,EAAAI,EAAQ,SAAS,EAAE,GAAGA,EAAQ,QAAQ,QAAAE,EAAA,GACtC,MAAMD,EAAA;AACR;ACbA,SAASE,EACPC,GACoB;AACpB,QAAMC,IAAmC,CAAA;AAEzC,aAAWC,KAAOF;AAEhB,QAAIA,EAAS,eAAeE,CAAG,KAAKA,EAAI,SAAS,MAAM,KAEjD,CADiBA,EAAI,SAAS,QAAQ,GACvB;AACjB,YAAMC,IAAOD,EAAI,MAAM,GAAG,EAAE,CAAC,GACvBE,IAAaJ,EAAS,QAAQG,CAAI,WAAW;AAEnD,UAAIC,GAAY;AAEd,QAAKH,EAAaG,CAAU,MAC1BH,EAAaG,CAAU,IAAI,CAAA,IAG7BH,EAAaG,CAAU,EAAE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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-BYZ3LYEa.cjs"),t=require("./extension-utils-CbiToj2v.cjs"),r=require("./use-nutrition-info-C-RDcG4S.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-_jG-Kd3m.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-DP5eulYE.js";
|
|
3
|
+
import { u as h, a as w, b as B, c as G, w as j } from "./use-nutrition-info-B9ybCLwb.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,25 +1,215 @@
|
|
|
1
1
|
import { AgitationRequiredTroubleOptions } from './types';
|
|
2
|
-
import { DeferAware, FutureResponse, IKosDataModel, IKosIdentifiable, KosConfigProperty,
|
|
3
|
-
import { HolderModel } from '@kosdev-code/kos-dispense-sdk';
|
|
2
|
+
import { DeferAware, FutureResponse, IKosDataModel, IKosIdentifiable, KosCompanionComposition, KosConfigProperty, KosLoggerAware, KosModelRegistrationFactory, PublicModelInterface, ResolveAware, TroubleModel } from '@kosdev-code/kos-ui-sdk';
|
|
3
|
+
import { HolderModel, HolderTroubleData } from '@kosdev-code/kos-dispense-sdk';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Agitation required trouble model type identifier.
|
|
7
|
+
*
|
|
8
|
+
* Used for model registration and type predicates when working with
|
|
9
|
+
* agitation-related troubles in the KOS framework.
|
|
10
|
+
*
|
|
11
|
+
* @category Trouble Models
|
|
12
|
+
*/
|
|
5
13
|
export declare const MODEL_TYPE = "agitation-required-trouble-model";
|
|
14
|
+
/**
|
|
15
|
+
* Public interface for the AgitationRequiredTrouble model.
|
|
16
|
+
*
|
|
17
|
+
* This model manages troubles related to insufficient agitation in beverage
|
|
18
|
+
* holders, providing resolution capabilities and deferral logic based on
|
|
19
|
+
* configuration properties.
|
|
20
|
+
*
|
|
21
|
+
* @see {@link AgitationRequiredTroubleModelImpl} for the implementation
|
|
22
|
+
* @category Trouble Models
|
|
23
|
+
*/
|
|
6
24
|
export type AgitationRequiredTroubleModel = PublicModelInterface<AgitationRequiredTroubleModelImpl>;
|
|
25
|
+
/**
|
|
26
|
+
* Factory function to determine if a trouble requires agitation handling.
|
|
27
|
+
*
|
|
28
|
+
* Examines the trouble model's data to determine if it represents an
|
|
29
|
+
* insufficient agitation condition that requires a dedicated agitation
|
|
30
|
+
* trouble model.
|
|
31
|
+
*
|
|
32
|
+
* @param troubleModel - The trouble model to examine
|
|
33
|
+
* @returns The agitation model type if agitation is required, undefined otherwise
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* const modelType = agitationModelFactory(troubleModel);
|
|
38
|
+
* if (modelType) {
|
|
39
|
+
* // Create agitation trouble model
|
|
40
|
+
* const agitationModel = AgitationRequiredTrouble
|
|
41
|
+
* .instance(troubleModel.id)
|
|
42
|
+
* .options({ companionParent: troubleModel })
|
|
43
|
+
* .build();
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @category Trouble Models
|
|
48
|
+
*/
|
|
7
49
|
export declare const agitationModelFactory: (troubleModel: TroubleModel) => "agitation-required-trouble-model" | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Trouble type identifier for insufficient agitation troubles.
|
|
52
|
+
*
|
|
53
|
+
* This constant is used to filter and identify agitation-related troubles
|
|
54
|
+
* in the trouble system.
|
|
55
|
+
*
|
|
56
|
+
* @category Trouble Models
|
|
57
|
+
*/
|
|
8
58
|
export declare const AGITATION_REQUIRED_TROUBLE = "InsufficientAgitationTrouble";
|
|
59
|
+
export interface AgitationRequiredTroubleModelImpl extends KosLoggerAware, KosCompanionComposition<TroubleModel<HolderTroubleData>> {
|
|
60
|
+
/** Parent trouble model (set by @kosCompanion decorator via parentProperty: "trouble") */
|
|
61
|
+
trouble: TroubleModel<HolderTroubleData>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Companion model for managing agitation-required troubles in KOS beverage dispensers.
|
|
65
|
+
*
|
|
66
|
+
* This model represents troubles caused by insufficient agitation in ingredient holders,
|
|
67
|
+
* typically occurring when carbonation levels are too low or agitation mechanisms fail.
|
|
68
|
+
* It provides resolution capabilities and deferral logic to prevent pouring until
|
|
69
|
+
* agitation conditions are met.
|
|
70
|
+
*
|
|
71
|
+
* The model integrates with the KOS configuration system to respect the
|
|
72
|
+
* `ncui.agitateBeforePour` setting, allowing operators to control whether
|
|
73
|
+
* pouring should wait for agitation to complete.
|
|
74
|
+
*
|
|
75
|
+
* @remarks
|
|
76
|
+
* This is a companion model to the parent trouble model, created via the
|
|
77
|
+
* {@link agitationModelFactory} when a trouble's `agitationRequired` flag is set.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* // Factory-based creation (typical usage)
|
|
82
|
+
* const agitationTrouble = AgitationRequiredTrouble
|
|
83
|
+
* .instance(troubleId)
|
|
84
|
+
* .options({ companionParent: parentTroubleModel })
|
|
85
|
+
* .build();
|
|
86
|
+
*
|
|
87
|
+
* // Check if pouring should be deferred
|
|
88
|
+
* if (agitationTrouble.shouldDefer) {
|
|
89
|
+
* await agitationTrouble.defer();
|
|
90
|
+
* }
|
|
91
|
+
*
|
|
92
|
+
* // Resolve the trouble
|
|
93
|
+
* await agitationTrouble.resolve();
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* @category Trouble Models
|
|
97
|
+
* @author Mark Pomerant (mark@matrica.ca)
|
|
98
|
+
* @version 2.1.27
|
|
99
|
+
*/
|
|
9
100
|
export declare class AgitationRequiredTroubleModelImpl implements IKosDataModel, IKosIdentifiable, ResolveAware, DeferAware {
|
|
101
|
+
/**
|
|
102
|
+
* Registration factory for creating AgitationRequiredTrouble model instances.
|
|
103
|
+
*
|
|
104
|
+
* Automatically injected by the `@kosModel` decorator. Use the exported
|
|
105
|
+
* {@link AgitationRequiredTrouble} constant instead of accessing this directly.
|
|
106
|
+
*
|
|
107
|
+
* @see {@link AgitationRequiredTrouble}
|
|
108
|
+
*/
|
|
109
|
+
static Registration: KosModelRegistrationFactory<AgitationRequiredTroubleModel, AgitationRequiredTroubleOptions>;
|
|
110
|
+
/**
|
|
111
|
+
* Unique identifier for this model instance.
|
|
112
|
+
*/
|
|
10
113
|
id: string;
|
|
11
|
-
private logger;
|
|
12
|
-
private trouble;
|
|
13
114
|
private _deferred;
|
|
14
115
|
private _holdersLoaded;
|
|
116
|
+
/**
|
|
117
|
+
* Configuration property controlling whether to wait for agitation before pouring.
|
|
118
|
+
*
|
|
119
|
+
* When enabled, pouring will be deferred if the holder has insufficient agitation troubles.
|
|
120
|
+
* This ensures beverage quality by preventing pours with inadequate carbonation or mixing.
|
|
121
|
+
*/
|
|
15
122
|
agitateBeforePour: KosConfigProperty<boolean>;
|
|
16
|
-
|
|
123
|
+
/**
|
|
124
|
+
* Creates a new AgitationRequiredTrouble model instance.
|
|
125
|
+
*
|
|
126
|
+
* @param modelId - Unique identifier for this model instance (typically matches parent trouble ID)
|
|
127
|
+
*/
|
|
128
|
+
constructor(modelId: string);
|
|
129
|
+
/**
|
|
130
|
+
* Resolves the agitation trouble by delegating to the parent trouble model.
|
|
131
|
+
*
|
|
132
|
+
* Resolution typically involves completing the agitation process and clearing
|
|
133
|
+
* the trouble state once carbonation or mixing levels are acceptable.
|
|
134
|
+
*
|
|
135
|
+
* @returns Promise resolving to the future response from the parent trouble's resolution
|
|
136
|
+
*/
|
|
17
137
|
resolve(): Promise<FutureResponse | undefined>;
|
|
138
|
+
/**
|
|
139
|
+
* Gets the holder model associated with this agitation trouble.
|
|
140
|
+
*
|
|
141
|
+
* The holder is the physical container (cartridge holder, ingredient holder, etc.)
|
|
142
|
+
* that requires agitation. Returns undefined if the holder model hasn't been
|
|
143
|
+
* loaded yet through the Assembly model initialization.
|
|
144
|
+
*
|
|
145
|
+
* @returns The holder model or undefined if not yet loaded
|
|
146
|
+
*/
|
|
18
147
|
get holder(): HolderModel<any> | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* Handles Assembly model events to track when holder models become available.
|
|
150
|
+
*
|
|
151
|
+
* This topic handler listens for Assembly model lifecycle events to determine
|
|
152
|
+
* when holder models have been fully loaded and are accessible.
|
|
153
|
+
*
|
|
154
|
+
* @internal
|
|
155
|
+
*/
|
|
19
156
|
updateHolder(): void;
|
|
157
|
+
/**
|
|
158
|
+
* Determines if trouble resolution should be deferred until agitation completes.
|
|
159
|
+
*
|
|
160
|
+
* Trouble resolution is deferred when:
|
|
161
|
+
* 1. The holder has active insufficient agitation troubles
|
|
162
|
+
* 2. The `agitateBeforePour` configuration is enabled
|
|
163
|
+
*
|
|
164
|
+
* This ensures that operations requiring agitation (prime, purge, or other
|
|
165
|
+
* holder-related troubles) wait for proper carbonation or mixing before
|
|
166
|
+
* being marked as resolved.
|
|
167
|
+
*
|
|
168
|
+
* @returns true if trouble resolution should wait for agitation to complete
|
|
169
|
+
*/
|
|
20
170
|
get shouldDefer(): boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Gets the current deferral state of this trouble.
|
|
173
|
+
*
|
|
174
|
+
* @returns true if this trouble resolution is currently deferred
|
|
175
|
+
*/
|
|
21
176
|
get deferred(): boolean;
|
|
177
|
+
/**
|
|
178
|
+
* Marks this trouble as deferred, preventing immediate resolution.
|
|
179
|
+
*
|
|
180
|
+
* Called by the trouble system to indicate that trouble resolution
|
|
181
|
+
* should wait for agitation to complete before being marked as resolved.
|
|
182
|
+
*/
|
|
22
183
|
defer(): void;
|
|
184
|
+
/**
|
|
185
|
+
* Clears the deferral state, allowing trouble resolution to proceed.
|
|
186
|
+
*
|
|
187
|
+
* Typically called after agitation has completed and the trouble can
|
|
188
|
+
* now be safely resolved.
|
|
189
|
+
*/
|
|
23
190
|
clearDefer(): void;
|
|
24
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Registration factory for creating AgitationRequiredTrouble model instances.
|
|
194
|
+
*
|
|
195
|
+
* Use this constant to create new instances of the agitation trouble model
|
|
196
|
+
* using the fluent factory pattern.
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```typescript
|
|
200
|
+
* // Create a new agitation trouble model
|
|
201
|
+
* const agitationTrouble = AgitationRequiredTrouble
|
|
202
|
+
* .instance(troubleId)
|
|
203
|
+
* .options({ companionParent: parentTroubleModel })
|
|
204
|
+
* .build();
|
|
205
|
+
*
|
|
206
|
+
* // Check deferral status
|
|
207
|
+
* if (agitationTrouble.shouldDefer) {
|
|
208
|
+
* console.log('Pouring deferred due to agitation');
|
|
209
|
+
* }
|
|
210
|
+
* ```
|
|
211
|
+
*
|
|
212
|
+
* @category Trouble Models
|
|
213
|
+
*/
|
|
214
|
+
export declare const AgitationRequiredTrouble: KosModelRegistrationFactory<AgitationRequiredTroubleModel, AgitationRequiredTroubleOptions>;
|
|
25
215
|
//# sourceMappingURL=agitation-required-trouble-model.d.ts.map
|
|
@@ -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,OAAO,EAEL,WAAW,
|
|
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;IACH,IAAI,MAAM,iCAST;IAED;;;;;;;OAOG;IAKH,YAAY;IAUZ;;;;;;;;;;;;OAYG;IACH,IAAI,WAAW,YASd;IAED;;;;OAIG;IACH,IAAI,QAAQ,YAEX;IAED;;;;;OAKG;IACH,KAAK;IAIL;;;;;OAKG;IACH,UAAU;CAGX;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,wBAAwB,6FACW,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* (C) Copyright 2024, TCCC, All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
export { AGITATION_REQUIRED_TROUBLE, AgitationRequiredTrouble, type AgitationRequiredTroubleModel, } from './agitation-required-trouble-model';
|
|
3
5
|
export type * from './types';
|
|
4
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-freestyle-sdk/src/models/models/agitation-required-trouble/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,KAAK,6BAA6B,GACnC,MAAM,oCAAoC,CAAC;AAC5C,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-freestyle-sdk/src/models/models/agitation-required-trouble/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,KAAK,6BAA6B,GACnC,MAAM,oCAAoC,CAAC;AAC5C,mBAAmB,SAAS,CAAC"}
|