@kosdev-code/kos-freestyle-sdk 0.1.0-dev.5092 → 0.1.0-dev.5096
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-BUUtrM-T.cjs +2 -0
- package/{extension-utils-z9pjqLGA.cjs.map → extension-utils-BUUtrM-T.cjs.map} +1 -1
- package/extension-utils-sj0P_x9E.js +220 -0
- package/{extension-utils-m2DUoUsn.js.map → extension-utils-sj0P_x9E.js.map} +1 -1
- package/freestyle-registration-manager-DSugLmqT.js +1739 -0
- package/freestyle-registration-manager-DSugLmqT.js.map +1 -0
- package/freestyle-registration-manager-rmrOsUZq.cjs +2 -0
- package/freestyle-registration-manager-rmrOsUZq.cjs.map +1 -0
- package/index.cjs +1 -1
- package/index.js +34 -27
- package/models/models/cgp-pump/cgp-pump-model.d.ts +24 -0
- package/models/models/cgp-pump/cgp-pump-model.d.ts.map +1 -0
- package/models/models/cgp-pump/index.d.ts +4 -0
- package/models/models/cgp-pump/index.d.ts.map +1 -0
- package/models/models/cgp-pump/types/index.d.ts +5 -0
- package/models/models/fcm-pump/fcm-pump-model.d.ts +28 -0
- package/models/models/fcm-pump/fcm-pump-model.d.ts.map +1 -0
- package/models/models/fcm-pump/fcm-pump-registration.d.ts +87 -0
- package/models/models/fcm-pump/fcm-pump-registration.d.ts.map +1 -0
- package/models/models/fcm-pump/index.d.ts +5 -0
- package/models/models/fcm-pump/index.d.ts.map +1 -0
- package/models/models/fcm-pump/services/fcm-pump-services.d.ts +17 -0
- package/models/models/fcm-pump/services/fcm-pump-services.d.ts.map +1 -0
- package/models/models/fcm-pump/services/index.d.ts +2 -0
- package/models/models/fcm-pump/services/index.d.ts.map +1 -0
- package/models/models/fcm-pump/types/index.d.ts +5 -0
- package/models/models/index.d.ts +4 -0
- package/models/models/index.d.ts.map +1 -1
- package/models/models/lfcv-pump/index.d.ts +5 -0
- package/models/models/lfcv-pump/index.d.ts.map +1 -0
- package/models/models/lfcv-pump/lfcv-pump-model.d.ts +20 -0
- package/models/models/lfcv-pump/lfcv-pump-model.d.ts.map +1 -0
- package/models/models/lfcv-pump/lfcv-pump-registration.d.ts +87 -0
- package/models/models/lfcv-pump/lfcv-pump-registration.d.ts.map +1 -0
- package/models/models/lfcv-pump/services/index.d.ts +2 -0
- package/models/models/lfcv-pump/services/index.d.ts.map +1 -0
- package/models/models/lfcv-pump/services/lfcv-pump-services.d.ts +10 -0
- package/models/models/lfcv-pump/services/lfcv-pump-services.d.ts.map +1 -0
- package/models/models/lfcv-pump/types/index.d.ts +5 -0
- package/models/models/spm-pump/index.d.ts +5 -0
- package/models/models/spm-pump/index.d.ts.map +1 -0
- package/models/models/spm-pump/services/index.d.ts +2 -0
- package/models/models/spm-pump/services/index.d.ts.map +1 -0
- package/models/models/spm-pump/services/spm-pump-services.d.ts +7 -0
- package/models/models/spm-pump/services/spm-pump-services.d.ts.map +1 -0
- package/models/models/spm-pump/spm-pump-model.d.ts +26 -0
- package/models/models/spm-pump/spm-pump-model.d.ts.map +1 -0
- package/models/models/spm-pump/spm-pump-registration.d.ts +87 -0
- package/models/models/spm-pump/spm-pump-registration.d.ts.map +1 -0
- package/models/models/spm-pump/types/index.d.ts +5 -0
- package/models/utils/freestyle-registration-manager.d.ts.map +1 -1
- package/models.cjs +1 -1
- package/models.js +27 -20
- package/package.json +4 -4
- package/ui.cjs +1 -1
- package/ui.js +2 -2
- package/{use-nutrition-info-BfMITXJ8.cjs → use-nutrition-info-DSdA_SRp.cjs} +2 -2
- package/{use-nutrition-info-BfMITXJ8.cjs.map → use-nutrition-info-DSdA_SRp.cjs.map} +1 -1
- package/{use-nutrition-info-BFA7IT1r.js → use-nutrition-info-DtcZs7dL.js} +5 -5
- package/{use-nutrition-info-BFA7IT1r.js.map → use-nutrition-info-DtcZs7dL.js.map} +1 -1
- package/extension-utils-m2DUoUsn.js +0 -201
- package/extension-utils-z9pjqLGA.cjs +0 -2
- package/freestyle-registration-manager-CymJYnwk.js +0 -1260
- package/freestyle-registration-manager-CymJYnwk.js.map +0 -1
- package/freestyle-registration-manager-Dt77hR6f.cjs +0 -2
- package/freestyle-registration-manager-Dt77hR6f.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-nutrition-info-
|
|
1
|
+
{"version":3,"file":"use-nutrition-info-DSdA_SRp.cjs","sources":["../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/freestyle-assembly/use-freestyle-assembly.ts","../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/freestyle-nozzle/use-freestyle-nozzle.ts","../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/ice-agitator/use-ice-agitator.ts","../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/ice-agitator/with-ice-agitator.tsx","../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/nutrition/use-nutrition-info.ts"],"sourcesContent":["import { useAssemblyContext } from \"@kosdev-code/kos-dispense-sdk\";\nimport { getKosCompanionModel } from \"@kosdev-code/kos-ui-sdk\";\nimport {\n FreestyleAssembly,\n type FreestyleAssemblyModel,\n} from \"../../../models\";\n\nexport const useFreestyleAssemblyContext =\n (): FreestyleAssemblyModel | null => {\n const { model } = useAssemblyContext();\n\n const freestyleAssembly = model\n ? getKosCompanionModel<FreestyleAssemblyModel>(\n model,\n FreestyleAssembly.type\n )\n : null;\n\n return freestyleAssembly;\n };\n","import { useNozzleContext } from \"@kosdev-code/kos-dispense-sdk\";\nimport { getKosCompanionModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { FreestyleNozzle, type FreestyleNozzleModel } from \"../../../models\";\n\nexport const useFreestyleNozzleContext = (): FreestyleNozzleModel | null => {\n const { model } = useNozzleContext();\n\n const freestyleNozzle = model\n ? getKosCompanionModel<FreestyleNozzleModel>(model, FreestyleNozzle.type)\n : null;\n\n return freestyleNozzle;\n};\n","import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { IceAgitator, type IceAgitatorModel } from \"../../../models\";\n\nexport const useIceAgitator = (id: string) => {\n const modelId = id;\n const result = useKosModel<IceAgitatorModel>({\n modelId,\n modelType: IceAgitator.type,\n options: {},\n });\n\n return result;\n};\n","import { IceAgitatorModel } from \"../../../models\";\nimport { useIceAgitator } from \"./use-ice-agitator\";\n\nexport interface IceAgitatorProps {\n iceAgitator: IceAgitatorModel;\n}\n\nexport function withIceAgitator<T extends IceAgitatorProps = IceAgitatorProps>(\n WrappedComponent: React.ComponentType<T>\n) {\n return (id: string) => (props: Omit<T, keyof IceAgitatorProps>) => {\n const { model, status, KosModelLoader } = useIceAgitator(id);\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} iceAgitator={model} />\n </KosModelLoader>\n );\n };\n}\n","import { kosAutoEffect } from \"@kosdev-code/kos-ui-sdk\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport type { FreestyleNozzleServices } from \"../../../models\";\nimport { useFreestyleNozzleContext } from \"../freestyle-nozzle\";\n\n// Custom function to check deep equality of two arrays\nconst arraysEqual = (a: number[], b: number[]): boolean => {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n};\n\nexport const useNutritionInfo = (cupSizes: number[]) => {\n const freestyleNozzle = useFreestyleNozzleContext();\n const [nutritionInfo, setNutritionInfo] =\n useState<FreestyleNozzleServices.FreestyleNutritionInfoResponse>();\n\n // Use a ref to keep track of the previous cupSizes value\n const prevCupSizesRef = useRef<number[]>([]);\n\n useEffect(() => {\n if (freestyleNozzle && !arraysEqual(cupSizes, prevCupSizesRef.current)) {\n freestyleNozzle.cupSizes = cupSizes;\n prevCupSizesRef.current = cupSizes;\n }\n const disposer = kosAutoEffect(() => {\n if (freestyleNozzle) {\n setNutritionInfo(freestyleNozzle.nutritionInfo);\n }\n });\n\n return () => {\n disposer();\n };\n }, [cupSizes, freestyleNozzle]);\n\n return nutritionInfo;\n};\n"],"names":["useFreestyleAssemblyContext","model","useAssemblyContext","getKosCompanionModel","FreestyleAssembly","useFreestyleNozzleContext","useNozzleContext","FreestyleNozzle","useIceAgitator","id","modelId","useKosModel","IceAgitator","withIceAgitator","WrappedComponent","props","status","KosModelLoader","jsx","arraysEqual","a","b","i","useNutritionInfo","cupSizes","freestyleNozzle","nutritionInfo","setNutritionInfo","useState","prevCupSizesRef","useRef","useEffect","disposer","kosAutoEffect"],"mappings":"yNAOaA,EACX,IAAqC,CACnC,KAAM,CAAE,MAAAC,CAAA,EAAUC,qBAAA,EASlB,OAP0BD,EACtBE,EAAAA,qBACEF,EACAG,oBAAkB,IAAA,EAEpB,IAGN,ECfWC,EAA4B,IAAmC,CAC1E,KAAM,CAAE,MAAAJ,CAAA,EAAUK,mBAAA,EAMlB,OAJwBL,EACpBE,EAAAA,qBAA2CF,EAAOM,EAAAA,gBAAgB,IAAI,EACtE,IAGN,ECTaC,EAAkBC,GAAe,CAC5C,MAAMC,EAAUD,EAOhB,OANeE,EAAAA,YAA8B,CAC3C,QAAAD,EACA,UAAWE,EAAAA,YAAY,KACvB,QAAS,CAAA,CAAC,CACX,CAGH,ECLO,SAASC,EACdC,EACA,CACA,OAAQL,GAAgBM,GAA2C,CACjE,KAAM,CAAE,MAAAd,EAAO,OAAAe,EAAQ,eAAAC,CAAA,EAAmBT,EAAeC,CAAE,EAE3D,OACES,EAAAA,IAACD,EAAA,CAAgB,GAAGD,EAClB,SAAAE,EAAAA,IAACJ,GAAkB,GAAIC,EAAa,YAAad,CAAA,CAAO,CAAA,CAC1D,CAEJ,CACF,CCZA,MAAMkB,EAAc,CAACC,EAAaC,IAAyB,CACzD,GAAID,EAAE,SAAWC,EAAE,OAAQ,MAAO,GAClC,QAASC,EAAI,EAAGA,EAAIF,EAAE,OAAQE,IAC5B,GAAIF,EAAEE,CAAC,IAAMD,EAAEC,CAAC,EAAG,MAAO,GAE5B,MAAO,EACT,EAEaC,EAAoBC,GAAuB,CACtD,MAAMC,EAAkBpB,EAAA,EAClB,CAACqB,EAAeC,CAAgB,EACpCC,WAAA,EAGIC,EAAkBC,EAAAA,OAAiB,EAAE,EAE3CC,OAAAA,EAAAA,UAAU,IAAM,CACVN,GAAmB,CAACN,EAAYK,EAAUK,EAAgB,OAAO,IACnEJ,EAAgB,SAAWD,EAC3BK,EAAgB,QAAUL,GAE5B,MAAMQ,EAAWC,EAAAA,cAAc,IAAM,CAC/BR,GACFE,EAAiBF,EAAgB,aAAa,CAElD,CAAC,EAED,MAAO,IAAM,CACXO,EAAA,CACF,CACF,EAAG,CAACR,EAAUC,CAAe,CAAC,EAEvBC,CACT"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { useAssemblyContext as
|
|
1
|
+
import { useAssemblyContext as i, useNozzleContext as f } from "@kosdev-code/kos-dispense-sdk";
|
|
2
2
|
import { getKosCompanionModel as u, useKosModel as c, kosAutoEffect as m } from "@kosdev-code/kos-ui-sdk";
|
|
3
|
-
import {
|
|
3
|
+
import { e as a, g as y, i as d } from "./freestyle-registration-manager-DSugLmqT.js";
|
|
4
4
|
import { jsx as l } from "@emotion/react/jsx-runtime";
|
|
5
5
|
import { useState as p, useRef as z, useEffect as A } from "react";
|
|
6
6
|
const E = () => {
|
|
7
|
-
const { model: e } =
|
|
7
|
+
const { model: e } = i();
|
|
8
8
|
return e ? u(
|
|
9
9
|
e,
|
|
10
10
|
a.type
|
|
11
11
|
) : null;
|
|
12
12
|
}, g = () => {
|
|
13
|
-
const { model: e } =
|
|
13
|
+
const { model: e } = f();
|
|
14
14
|
return e ? u(e, y.type) : null;
|
|
15
15
|
}, I = (e) => c({
|
|
16
16
|
modelId: e,
|
|
@@ -49,4 +49,4 @@ export {
|
|
|
49
49
|
E as u,
|
|
50
50
|
K as w
|
|
51
51
|
};
|
|
52
|
-
//# sourceMappingURL=use-nutrition-info-
|
|
52
|
+
//# sourceMappingURL=use-nutrition-info-DtcZs7dL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-nutrition-info-
|
|
1
|
+
{"version":3,"file":"use-nutrition-info-DtcZs7dL.js","sources":["../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/freestyle-assembly/use-freestyle-assembly.ts","../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/freestyle-nozzle/use-freestyle-nozzle.ts","../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/ice-agitator/use-ice-agitator.ts","../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/ice-agitator/with-ice-agitator.tsx","../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/nutrition/use-nutrition-info.ts"],"sourcesContent":["import { useAssemblyContext } from \"@kosdev-code/kos-dispense-sdk\";\nimport { getKosCompanionModel } from \"@kosdev-code/kos-ui-sdk\";\nimport {\n FreestyleAssembly,\n type FreestyleAssemblyModel,\n} from \"../../../models\";\n\nexport const useFreestyleAssemblyContext =\n (): FreestyleAssemblyModel | null => {\n const { model } = useAssemblyContext();\n\n const freestyleAssembly = model\n ? getKosCompanionModel<FreestyleAssemblyModel>(\n model,\n FreestyleAssembly.type\n )\n : null;\n\n return freestyleAssembly;\n };\n","import { useNozzleContext } from \"@kosdev-code/kos-dispense-sdk\";\nimport { getKosCompanionModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { FreestyleNozzle, type FreestyleNozzleModel } from \"../../../models\";\n\nexport const useFreestyleNozzleContext = (): FreestyleNozzleModel | null => {\n const { model } = useNozzleContext();\n\n const freestyleNozzle = model\n ? getKosCompanionModel<FreestyleNozzleModel>(model, FreestyleNozzle.type)\n : null;\n\n return freestyleNozzle;\n};\n","import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { IceAgitator, type IceAgitatorModel } from \"../../../models\";\n\nexport const useIceAgitator = (id: string) => {\n const modelId = id;\n const result = useKosModel<IceAgitatorModel>({\n modelId,\n modelType: IceAgitator.type,\n options: {},\n });\n\n return result;\n};\n","import { IceAgitatorModel } from \"../../../models\";\nimport { useIceAgitator } from \"./use-ice-agitator\";\n\nexport interface IceAgitatorProps {\n iceAgitator: IceAgitatorModel;\n}\n\nexport function withIceAgitator<T extends IceAgitatorProps = IceAgitatorProps>(\n WrappedComponent: React.ComponentType<T>\n) {\n return (id: string) => (props: Omit<T, keyof IceAgitatorProps>) => {\n const { model, status, KosModelLoader } = useIceAgitator(id);\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} iceAgitator={model} />\n </KosModelLoader>\n );\n };\n}\n","import { kosAutoEffect } from \"@kosdev-code/kos-ui-sdk\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport type { FreestyleNozzleServices } from \"../../../models\";\nimport { useFreestyleNozzleContext } from \"../freestyle-nozzle\";\n\n// Custom function to check deep equality of two arrays\nconst arraysEqual = (a: number[], b: number[]): boolean => {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n};\n\nexport const useNutritionInfo = (cupSizes: number[]) => {\n const freestyleNozzle = useFreestyleNozzleContext();\n const [nutritionInfo, setNutritionInfo] =\n useState<FreestyleNozzleServices.FreestyleNutritionInfoResponse>();\n\n // Use a ref to keep track of the previous cupSizes value\n const prevCupSizesRef = useRef<number[]>([]);\n\n useEffect(() => {\n if (freestyleNozzle && !arraysEqual(cupSizes, prevCupSizesRef.current)) {\n freestyleNozzle.cupSizes = cupSizes;\n prevCupSizesRef.current = cupSizes;\n }\n const disposer = kosAutoEffect(() => {\n if (freestyleNozzle) {\n setNutritionInfo(freestyleNozzle.nutritionInfo);\n }\n });\n\n return () => {\n disposer();\n };\n }, [cupSizes, freestyleNozzle]);\n\n return nutritionInfo;\n};\n"],"names":["useFreestyleAssemblyContext","model","useAssemblyContext","getKosCompanionModel","FreestyleAssembly","useFreestyleNozzleContext","useNozzleContext","FreestyleNozzle","useIceAgitator","id","useKosModel","IceAgitator","withIceAgitator","WrappedComponent","props","status","KosModelLoader","jsx","arraysEqual","a","b","i","useNutritionInfo","cupSizes","freestyleNozzle","nutritionInfo","setNutritionInfo","useState","prevCupSizesRef","useRef","useEffect","disposer","kosAutoEffect"],"mappings":";;;;;AAOO,MAAMA,IACX,MAAqC;AACnC,QAAM,EAAE,OAAAC,EAAA,IAAUC,EAAA;AASlB,SAP0BD,IACtBE;AAAA,IACEF;AAAA,IACAG,EAAkB;AAAA,EAAA,IAEpB;AAGN,GCfWC,IAA4B,MAAmC;AAC1E,QAAM,EAAE,OAAAJ,EAAA,IAAUK,EAAA;AAMlB,SAJwBL,IACpBE,EAA2CF,GAAOM,EAAgB,IAAI,IACtE;AAGN,GCTaC,IAAiB,CAACC,MAEdC,EAA8B;AAAA,EAC3C,SAFcD;AAAA,EAGd,WAAWE,EAAY;AAAA,EACvB,SAAS,CAAA;AAAC,CACX;ACFI,SAASC,EACdC,GACA;AACA,SAAO,CAACJ,MAAe,CAACK,MAA2C;AACjE,UAAM,EAAE,OAAAb,GAAO,QAAAc,GAAQ,gBAAAC,EAAA,IAAmBR,EAAeC,CAAE;AAE3D,WACE,gBAAAQ,EAACD,GAAA,EAAgB,GAAGD,GAClB,UAAA,gBAAAE,EAACJ,KAAkB,GAAIC,GAAa,aAAab,EAAA,CAAO,EAAA,CAC1D;AAAA,EAEJ;AACF;ACZA,MAAMiB,IAAc,CAACC,GAAaC,MAAyB;AACzD,MAAID,EAAE,WAAWC,EAAE;AAAQ,WAAO;AAClC,WAASC,IAAI,GAAGA,IAAIF,EAAE,QAAQE;AAC5B,QAAIF,EAAEE,CAAC,MAAMD,EAAEC,CAAC;AAAG,aAAO;AAE5B,SAAO;AACT,GAEaC,IAAmB,CAACC,MAAuB;AACtD,QAAMC,IAAkBnB,EAAA,GAClB,CAACoB,GAAeC,CAAgB,IACpCC,EAAA,GAGIC,IAAkBC,EAAiB,EAAE;AAE3C,SAAAC,EAAU,MAAM;AACd,IAAIN,KAAmB,CAACN,EAAYK,GAAUK,EAAgB,OAAO,MACnEJ,EAAgB,WAAWD,GAC3BK,EAAgB,UAAUL;AAE5B,UAAMQ,IAAWC,EAAc,MAAM;AACnC,MAAIR,KACFE,EAAiBF,EAAgB,aAAa;AAAA,IAElD,CAAC;AAED,WAAO,MAAM;AACX,MAAAO,EAAA;AAAA,IACF;AAAA,EACF,GAAG,CAACR,GAAUC,CAAe,CAAC,GAEvBC;AACT;"}
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
var c = Object.defineProperty;
|
|
2
|
-
var g = (r, e, t) => e in r ? c(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
-
var o = (r, e, t) => (g(r, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
-
import { j as u, N as p, k as b, l as y, m as v, n as f } from "./freestyle-registration-manager-CymJYnwk.js";
|
|
5
|
-
import { DispenseExtensionManager as w } from "@kosdev-code/kos-dispense-sdk";
|
|
6
|
-
import { kosFetch as M, processMiddleware as I, ExtensionManager as d, KosFeatureFlags as S, EXTENSION_TROUBLE_DATA_MAPPER as h, CoreExtensionManager as F } from "@kosdev-code/kos-ui-sdk";
|
|
7
|
-
const Z = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
8
|
-
__proto__: null,
|
|
9
|
-
InvalidRequestError: u,
|
|
10
|
-
NutritionInfoError: p,
|
|
11
|
-
getFreestyleNutritionInfo: b
|
|
12
|
-
}, Symbol.toStringTag, { value: "Module" })), ee = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
13
|
-
__proto__: null,
|
|
14
|
-
replacePump: y
|
|
15
|
-
}, Symbol.toStringTag, { value: "Module" })), m = (r, e) => (r[e.dbId.toString()] = e, r), E = async (r, e) => {
|
|
16
|
-
const s = r.data.assets.reduce(m, {});
|
|
17
|
-
r.result = { ...r.result, assets: s }, await e();
|
|
18
|
-
};
|
|
19
|
-
function B(r) {
|
|
20
|
-
const e = {};
|
|
21
|
-
for (const t in r)
|
|
22
|
-
if (r.hasOwnProperty(t) && t.includes("slot") && !t.includes("slotrb")) {
|
|
23
|
-
const n = t.split(".")[1], a = r[`slot.${n}.beverage`];
|
|
24
|
-
if (a) {
|
|
25
|
-
e[a] || (e[a] = {}), e[a].rank = n;
|
|
26
|
-
const i = t.replace(`slot.${n}.`, "");
|
|
27
|
-
e[a][i] = r[t];
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return e;
|
|
31
|
-
}
|
|
32
|
-
const R = (r) => (e, t) => (e[t] = r.beverageScreens[t], e[t].beverages = B(e[t]), e), A = async (r, e) => {
|
|
33
|
-
const t = r.data, s = Object.keys(t.beverageScreens).reduce(
|
|
34
|
-
R(t),
|
|
35
|
-
t.beverageScreens
|
|
36
|
-
);
|
|
37
|
-
r.result = { ...r.result, beverageScreens: s }, await e();
|
|
38
|
-
}, _ = (r, e) => (r[e.beverageId.toString()] = e, r), P = async (r, e) => {
|
|
39
|
-
const t = r.data, s = t.beverages.reduce(
|
|
40
|
-
_,
|
|
41
|
-
{}
|
|
42
|
-
), n = t.beverages.reduce((a, i) => (a[i.dbId.toString()] = i.beverageId.toString(), a), {});
|
|
43
|
-
r.result = { ...r.result, beverages: s, beverageMap: n }, await e();
|
|
44
|
-
};
|
|
45
|
-
function O(r) {
|
|
46
|
-
const e = { rank: 0 };
|
|
47
|
-
for (const t in r)
|
|
48
|
-
if (r.hasOwnProperty(t) && t.includes("slot")) {
|
|
49
|
-
const s = t.split(".")[1], n = s.split(":")[1], a = r[`slot.${s}.brand`];
|
|
50
|
-
if (a) {
|
|
51
|
-
e[a] || (e[a] = {
|
|
52
|
-
rank: Number(n)
|
|
53
|
-
});
|
|
54
|
-
const i = t.replace(`slot.${s}.`, "");
|
|
55
|
-
e[a][i] = r[t];
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return e;
|
|
59
|
-
}
|
|
60
|
-
const k = async (r, e) => {
|
|
61
|
-
const t = r.data, s = O(t.brandScreen);
|
|
62
|
-
r.result = { ...r.result, brandScreen: s }, await e();
|
|
63
|
-
}, T = (r, e) => (r[e.dbId.toString()] = e, r), N = async (r, e) => {
|
|
64
|
-
const s = r.data.brands.reduce(T, {});
|
|
65
|
-
r.result = { ...r.result, brands: s }, await e();
|
|
66
|
-
}, $ = async (r, e) => {
|
|
67
|
-
r.result = { ...r.data }, await e();
|
|
68
|
-
}, q = (r, e) => (r[e.dbId.toString()] = e, r), z = async (r, e) => {
|
|
69
|
-
const s = r.data.flavors.reduce(
|
|
70
|
-
q,
|
|
71
|
-
{}
|
|
72
|
-
);
|
|
73
|
-
r.result = { ...r.result, flavors: s }, await e();
|
|
74
|
-
};
|
|
75
|
-
function K(r, e) {
|
|
76
|
-
return r[`slotrb:${e}.brand`];
|
|
77
|
-
}
|
|
78
|
-
const L = (r) => (e, t, s, n) => {
|
|
79
|
-
e.relatedBrand || (e.relatedBrand = {}), e.relatedBrand[t] || (e.relatedBrand[t] = {
|
|
80
|
-
rank: s
|
|
81
|
-
});
|
|
82
|
-
const a = n.replace(`slotrb:${s}.`, "");
|
|
83
|
-
e.relatedBrand[t][a] = r[n];
|
|
84
|
-
};
|
|
85
|
-
function C(r) {
|
|
86
|
-
const e = {};
|
|
87
|
-
for (const t in r)
|
|
88
|
-
if (r.hasOwnProperty(t) && t.includes("slot") && t.includes("slotrb")) {
|
|
89
|
-
const n = t.split(":")[1].split(".")[0], a = K(r, n);
|
|
90
|
-
L(r)(e, a, n, t);
|
|
91
|
-
}
|
|
92
|
-
return e;
|
|
93
|
-
}
|
|
94
|
-
const U = (r) => (e, t) => (e[t] = r.beverageScreens[t], e[t].beverages = {
|
|
95
|
-
...e[t].beverages,
|
|
96
|
-
...C(e[t])
|
|
97
|
-
}, e), x = async (r, e) => {
|
|
98
|
-
const t = r.data, s = Object.keys(t.beverageScreens).reduce(
|
|
99
|
-
U(t),
|
|
100
|
-
t.beverageScreens
|
|
101
|
-
);
|
|
102
|
-
r.result = { ...r.result, beverageScreens: s }, await e();
|
|
103
|
-
}, D = async (r, e = [], t = !1) => {
|
|
104
|
-
const s = t ? [...e] : [
|
|
105
|
-
$,
|
|
106
|
-
E,
|
|
107
|
-
z,
|
|
108
|
-
P,
|
|
109
|
-
N,
|
|
110
|
-
A,
|
|
111
|
-
x,
|
|
112
|
-
k,
|
|
113
|
-
...e
|
|
114
|
-
];
|
|
115
|
-
return await I(r, s);
|
|
116
|
-
}, V = ({
|
|
117
|
-
url: r = "http://localhost:8081/system/cui/core.json",
|
|
118
|
-
middleware: e = [],
|
|
119
|
-
replace: t = !1
|
|
120
|
-
} = {}) => async () => {
|
|
121
|
-
const s = await M(r);
|
|
122
|
-
if (s.ok) {
|
|
123
|
-
const n = await s.json();
|
|
124
|
-
if (!n)
|
|
125
|
-
throw new Error("Failed to parse availability context");
|
|
126
|
-
return await D(n, e, t);
|
|
127
|
-
}
|
|
128
|
-
throw new Error("Failed to load availability context");
|
|
129
|
-
}, X = async (r) => {
|
|
130
|
-
const { id: e, name: t, ...s } = r;
|
|
131
|
-
return {
|
|
132
|
-
...s,
|
|
133
|
-
ingredientMacro: s.bib && !s.sweetener ? "macro" : "micro"
|
|
134
|
-
};
|
|
135
|
-
}, G = {
|
|
136
|
-
macro: "ingredientMacro"
|
|
137
|
-
}, Y = async (r) => {
|
|
138
|
-
var e;
|
|
139
|
-
return {
|
|
140
|
-
bevId: (e = r.beverage) == null ? void 0 : e.rawId
|
|
141
|
-
};
|
|
142
|
-
}, l = "pluginVisibility";
|
|
143
|
-
class j {
|
|
144
|
-
constructor(e, t) {
|
|
145
|
-
o(this, "core");
|
|
146
|
-
o(this, "dispense");
|
|
147
|
-
this.core = e, this.dispense = t;
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Loads the core brandset data into a format that can be consumed by the
|
|
151
|
-
* freestyle models.
|
|
152
|
-
* */
|
|
153
|
-
registerFreestyleBrandsetReader(e = {}) {
|
|
154
|
-
return this.dispense.registerAvailabilityLoader(
|
|
155
|
-
V(e)
|
|
156
|
-
), this;
|
|
157
|
-
}
|
|
158
|
-
registerFreestylePourableMapper() {
|
|
159
|
-
this.dispense.registerSelectedPourableDataMapper(Y);
|
|
160
|
-
}
|
|
161
|
-
registerFreestyleAssemblyMapper() {
|
|
162
|
-
this.dispense.registerAssemblyDataMapper(v);
|
|
163
|
-
}
|
|
164
|
-
registerFreestyleIngredientIndex() {
|
|
165
|
-
this.dispense.registerIngredientIndex(G);
|
|
166
|
-
}
|
|
167
|
-
registerFreestyleIngredientDataMapper() {
|
|
168
|
-
this.dispense.registerIngredientDataMapper(X);
|
|
169
|
-
}
|
|
170
|
-
registerFreestyleIceAgitator() {
|
|
171
|
-
d[l].register(
|
|
172
|
-
l,
|
|
173
|
-
(e) => e !== "iceAgitator" || S.isFeatureEnabled(f)
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
registerFreestyleAgitationRequiredTroubleMapper() {
|
|
177
|
-
d[h].register(
|
|
178
|
-
"agitationRequired",
|
|
179
|
-
async (e) => ({ isAgitationRequired: !!e.data.agitationRequired })
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
|
-
initializeFreestyleExtension() {
|
|
183
|
-
this.registerFreestylePourableMapper(), this.registerFreestyleAssemblyMapper(), this.registerFreestyleIngredientIndex(), this.registerFreestyleIngredientDataMapper(), this.registerFreestyleIceAgitator(), this.registerFreestyleAgitationRequiredTroubleMapper();
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
class re {
|
|
187
|
-
constructor() {
|
|
188
|
-
o(this, "dispense");
|
|
189
|
-
o(this, "core");
|
|
190
|
-
o(this, "freestyle");
|
|
191
|
-
this.dispense = new w(), this.core = new F(), this.freestyle = new j(this.core, this.dispense);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
export {
|
|
195
|
-
l as E,
|
|
196
|
-
j as F,
|
|
197
|
-
re as K,
|
|
198
|
-
ee as a,
|
|
199
|
-
Z as i
|
|
200
|
-
};
|
|
201
|
-
//# sourceMappingURL=extension-utils-m2DUoUsn.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var g=Object.defineProperty;var p=(r,e,t)=>e in r?g(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var d=(r,e,t)=>(p(r,typeof e!="symbol"?e+"":e,t),t);const l=require("./freestyle-registration-manager-Dt77hR6f.cjs"),b=require("@kosdev-code/kos-dispense-sdk"),i=require("@kosdev-code/kos-ui-sdk"),y=Object.freeze(Object.defineProperty({__proto__:null,InvalidRequestError:l.InvalidRequestError,NutritionInfoError:l.NutritionInfoError,getFreestyleNutritionInfo:l.getFreestyleNutritionInfo},Symbol.toStringTag,{value:"Module"})),v=Object.freeze(Object.defineProperty({__proto__:null,replacePump:l.replacePump},Symbol.toStringTag,{value:"Module"})),I=(r,e)=>(r[e.dbId.toString()]=e,r),f=async(r,e)=>{const s=r.data.assets.reduce(I,{});r.result={...r.result,assets:s},await e()};function M(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 o=t.replace(`slot.${n}.`,"");e[a][o]=r[t]}}return e}const S=r=>(e,t)=>(e[t]=r.beverageScreens[t],e[t].beverages=M(e[t]),e),w=async(r,e)=>{const t=r.data,s=Object.keys(t.beverageScreens).reduce(S(t),t.beverageScreens);r.result={...r.result,beverageScreens:s},await e()},h=(r,e)=>(r[e.beverageId.toString()]=e,r),E=async(r,e)=>{const t=r.data,s=t.beverages.reduce(h,{}),n=t.beverages.reduce((a,o)=>(a[o.dbId.toString()]=o.beverageId.toString(),a),{});r.result={...r.result,beverages:s,beverageMap:n},await e()};function F(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 o=t.replace(`slot.${s}.`,"");e[a][o]=r[t]}}return e}const B=async(r,e)=>{const t=r.data,s=F(t.brandScreen);r.result={...r.result,brandScreen:s},await e()},R=(r,e)=>(r[e.dbId.toString()]=e,r),m=async(r,e)=>{const s=r.data.brands.reduce(R,{});r.result={...r.result,brands:s},await e()},A=async(r,e)=>{r.result={...r.data},await e()},_=(r,e)=>(r[e.dbId.toString()]=e,r),P=async(r,e)=>{const s=r.data.flavors.reduce(_,{});r.result={...r.result,flavors:s},await e()};function k(r,e){return r[`slotrb:${e}.brand`]}const O=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 N(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=k(r,n);O(r)(e,a,n,t)}return e}const T=r=>(e,t)=>(e[t]=r.beverageScreens[t],e[t].beverages={...e[t].beverages,...N(e[t])},e),q=async(r,e)=>{const t=r.data,s=Object.keys(t.beverageScreens).reduce(T(t),t.beverageScreens);r.result={...r.result,beverageScreens:s},await e()},$=async(r,e=[],t=!1)=>{const s=t?[...e]:[A,f,P,E,m,w,q,B,...e];return await i.processMiddleware(r,s)},x=({url:r="http://localhost:8081/system/cui/core.json",middleware:e=[],replace:t=!1}={})=>async()=>{const s=await i.kosFetch(r);if(s.ok){const n=await s.json();if(!n)throw new Error("Failed to parse availability context");return await $(n,e,t)}throw new Error("Failed to load availability context")},L=async r=>{const{id:e,name:t,...s}=r;return{...s,ingredientMacro:s.bib&&!s.sweetener?"macro":"micro"}},z={macro:"ingredientMacro"},K=async r=>{var e;return{bevId:(e=r.beverage)==null?void 0:e.rawId}},c="pluginVisibility";class u{constructor(e,t){d(this,"core");d(this,"dispense");this.core=e,this.dispense=t}registerFreestyleBrandsetReader(e={}){return this.dispense.registerAvailabilityLoader(x(e)),this}registerFreestylePourableMapper(){this.dispense.registerSelectedPourableDataMapper(K)}registerFreestyleAssemblyMapper(){this.dispense.registerAssemblyDataMapper(l.freestyleAssemblyDataMapper)}registerFreestyleIngredientIndex(){this.dispense.registerIngredientIndex(z)}registerFreestyleIngredientDataMapper(){this.dispense.registerIngredientDataMapper(L)}registerFreestyleIceAgitator(){i.ExtensionManager[c].register(c,e=>e!=="iceAgitator"||i.KosFeatureFlags.isFeatureEnabled(l.FEATURE_SUPPORTS_ICE))}registerFreestyleAgitationRequiredTroubleMapper(){i.ExtensionManager[i.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 U{constructor(){d(this,"dispense");d(this,"core");d(this,"freestyle");this.dispense=new b.DispenseExtensionManager,this.core=new i.CoreExtensionManager,this.freestyle=new u(this.core,this.dispense)}}exports.EXTENSION_PLUGIN_VISIBILITY=c;exports.FreestyleExtensionManager=u;exports.KosExtensionManager=U;exports.index=y;exports.index$1=v;
|
|
2
|
-
//# sourceMappingURL=extension-utils-z9pjqLGA.cjs.map
|