@kosdev-code/kos-dispense-sdk 2.0.33 → 2.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dispense-registration-manager-BZeOXyYn.cjs +2 -0
- package/dispense-registration-manager-BZeOXyYn.cjs.map +1 -0
- package/{dispense-registration-manager-CKFF29mO.js → dispense-registration-manager-eOOE05xT.js} +333 -328
- package/dispense-registration-manager-eOOE05xT.js.map +1 -0
- package/{extension-utils-Bb22_AzV.js → extension-utils-B9gziKDQ.js} +69 -62
- package/extension-utils-B9gziKDQ.js.map +1 -0
- package/{extension-utils-CScCluY5.cjs → extension-utils-DcOOx69a.cjs} +2 -2
- package/extension-utils-DcOOx69a.cjs.map +1 -0
- package/index.cjs +1 -1
- package/index.js +87 -85
- package/models/constants/constants.d.ts +2 -1
- package/models/constants/constants.d.ts.map +1 -1
- package/models/models/assembly/assembly-model.d.ts +1 -0
- package/models/models/assembly/assembly-model.d.ts.map +1 -1
- package/models/models/assembly/index.d.ts +2 -1
- package/models/models/assembly/index.d.ts.map +1 -1
- package/models/utils/extension-utils.d.ts +3 -2
- package/models/utils/extension-utils.d.ts.map +1 -1
- package/models/utils/service.d.ts +5 -1
- package/models/utils/service.d.ts.map +1 -1
- package/models.cjs +1 -1
- package/models.js +28 -26
- package/package.json +3 -3
- package/pump-provider-BgSHNZEC.js +1239 -0
- package/pump-provider-BgSHNZEC.js.map +1 -0
- package/pump-provider-BkfgOMJx.cjs +2 -0
- package/pump-provider-BkfgOMJx.cjs.map +1 -0
- package/ui/hooks/cui-kit/use-default-cui-kit-lifecycle.d.ts +75 -1
- package/ui/hooks/cui-kit/use-default-cui-kit-lifecycle.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-dispense-lifecycle.d.ts +3 -1
- package/ui/hooks/cui-kit/use-dispense-lifecycle.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-dispense-timers.d.ts.map +1 -1
- package/ui.cjs +1 -1
- package/ui.js +2 -2
- package/dispense-registration-manager-CKFF29mO.js.map +0 -1
- package/dispense-registration-manager-CjKpNrUy.cjs +0 -2
- package/dispense-registration-manager-CjKpNrUy.cjs.map +0 -1
- package/extension-utils-Bb22_AzV.js.map +0 -1
- package/extension-utils-CScCluY5.cjs.map +0 -1
- package/pump-provider-CP6xxU4h.cjs +0 -2
- package/pump-provider-CP6xxU4h.cjs.map +0 -1
- package/pump-provider-jdIoS5JD.js +0 -1155
- package/pump-provider-jdIoS5JD.js.map +0 -1
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var p = (
|
|
4
|
-
import {
|
|
5
|
-
import { kosAutoEffect as
|
|
6
|
-
import { useState as n, useEffect as
|
|
7
|
-
const
|
|
1
|
+
var P = Object.defineProperty;
|
|
2
|
+
var A = (r, e, s) => e in r ? P(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s;
|
|
3
|
+
var p = (r, e, s) => (A(r, typeof e != "symbol" ? e + "" : e, s), s);
|
|
4
|
+
import { m as T, n as j, o as D, p as H, q as F, s as L, t as z, u as R, v as $, w, x as B, y as G, z as N, F as K, J as k, L as q, M as C, O as J, E as t } from "./dispense-registration-manager-eOOE05xT.js";
|
|
5
|
+
import { kosAutoEffect as U, CoreExtensionManager as y, ExtensionManager as a, EXTENSION_FEATURE_FLAG_RESOLVER as X } from "@kosdev-code/kos-ui-sdk";
|
|
6
|
+
import { useState as n, useEffect as Q } from "react";
|
|
7
|
+
const re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
8
8
|
__proto__: null,
|
|
9
|
-
getIngredients:
|
|
9
|
+
getIngredients: T
|
|
10
10
|
}, Symbol.toStringTag, { value: "Module" })), te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
11
11
|
__proto__: null,
|
|
12
|
-
addAssignment:
|
|
13
|
-
assignHolderIngredient:
|
|
14
|
-
deleteAssignment:
|
|
15
|
-
getAssignments:
|
|
12
|
+
addAssignment: j,
|
|
13
|
+
assignHolderIngredient: D,
|
|
14
|
+
deleteAssignment: H,
|
|
15
|
+
getAssignments: F,
|
|
16
16
|
getHolders: L,
|
|
17
|
-
replaceLine:
|
|
18
|
-
sendRfidOverride:
|
|
19
|
-
unassignHolderIngredient:
|
|
20
|
-
}, Symbol.toStringTag, { value: "Module" })), re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
21
|
-
__proto__: null,
|
|
22
|
-
getAssembly: B
|
|
17
|
+
replaceLine: z,
|
|
18
|
+
sendRfidOverride: R,
|
|
19
|
+
unassignHolderIngredient: $
|
|
23
20
|
}, Symbol.toStringTag, { value: "Module" })), ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
24
21
|
__proto__: null,
|
|
25
|
-
|
|
26
|
-
sendIntent: G
|
|
22
|
+
getAssembly: w
|
|
27
23
|
}, Symbol.toStringTag, { value: "Module" })), se = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
28
24
|
__proto__: null,
|
|
29
|
-
|
|
25
|
+
getIntentVolume: B,
|
|
26
|
+
sendIntent: G
|
|
27
|
+
}, Symbol.toStringTag, { value: "Module" })), ne = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
28
|
+
__proto__: null,
|
|
29
|
+
clearPourable: N,
|
|
30
30
|
getAvailability: K,
|
|
31
31
|
pourNamedPourable: k,
|
|
32
32
|
pourPourable: q,
|
|
33
|
-
selectPourable:
|
|
34
|
-
}, Symbol.toStringTag, { value: "Module" })), ne = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
35
|
-
__proto__: null
|
|
33
|
+
selectPourable: C
|
|
36
34
|
}, Symbol.toStringTag, { value: "Module" })), ie = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
35
|
+
__proto__: null
|
|
36
|
+
}, Symbol.toStringTag, { value: "Module" })), pe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
37
37
|
__proto__: null,
|
|
38
|
-
pourOnTarget:
|
|
39
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
38
|
+
pourOnTarget: J
|
|
39
|
+
}, Symbol.toStringTag, { value: "Module" })), oe = (r) => {
|
|
40
40
|
var g, u, M, c;
|
|
41
41
|
const [e, s] = n(
|
|
42
|
-
((g =
|
|
42
|
+
((g = r == null ? void 0 : r.slice) == null ? void 0 : g.maxVolMl) ?? 0
|
|
43
43
|
), [i, _] = n(
|
|
44
|
-
((u =
|
|
44
|
+
((u = r == null ? void 0 : r.slice) == null ? void 0 : u.currentVolMl) ?? 0
|
|
45
45
|
), [o, f] = n(
|
|
46
|
-
((M =
|
|
46
|
+
((M = r == null ? void 0 : r.slice) == null ? void 0 : M.maxVolMl) !== void 0
|
|
47
47
|
), [l, I] = n(
|
|
48
|
-
((c =
|
|
49
|
-
), [
|
|
48
|
+
((c = r == null ? void 0 : r.slice) == null ? void 0 : c.currentVolMl) !== void 0
|
|
49
|
+
), [E, v] = n(
|
|
50
50
|
i <= 0 ? 0 : Math.floor((i || 1) / (e || 1) * 100)
|
|
51
|
-
), [
|
|
51
|
+
), [O, S] = n(
|
|
52
52
|
o && l
|
|
53
53
|
);
|
|
54
|
-
return
|
|
55
|
-
const
|
|
56
|
-
var d, m,
|
|
57
|
-
s(((d =
|
|
54
|
+
return Q(() => {
|
|
55
|
+
const V = U(() => {
|
|
56
|
+
var d, m, b, x;
|
|
57
|
+
s(((d = r == null ? void 0 : r.slice) == null ? void 0 : d.maxVolMl) ?? 0), _(((m = r == null ? void 0 : r.slice) == null ? void 0 : m.currentVolMl) ?? 0), f(((b = r == null ? void 0 : r.slice) == null ? void 0 : b.maxVolMl) !== void 0), I(((x = r == null ? void 0 : r.slice) == null ? void 0 : x.currentVolMl) !== void 0), v(
|
|
58
58
|
i <= 0 ? 0 : Math.floor((i || 1) / (e || 1) * 100)
|
|
59
59
|
), S(o && l);
|
|
60
60
|
});
|
|
61
61
|
return () => {
|
|
62
|
-
|
|
62
|
+
V();
|
|
63
63
|
};
|
|
64
|
-
}, [
|
|
64
|
+
}, [r]), { maxVolume: e, remainingVolume: i, fillPercent: E, hasFuelGuage: O };
|
|
65
65
|
};
|
|
66
66
|
class W {
|
|
67
67
|
constructor() {
|
|
@@ -113,7 +113,7 @@ class W {
|
|
|
113
113
|
* */
|
|
114
114
|
registerIngredientDataMapper(e) {
|
|
115
115
|
return a.dataMapper.registerDataMapper(
|
|
116
|
-
|
|
116
|
+
t.IngredientMapper,
|
|
117
117
|
e
|
|
118
118
|
), this;
|
|
119
119
|
}
|
|
@@ -142,13 +142,13 @@ class W {
|
|
|
142
142
|
* */
|
|
143
143
|
registerIngredientLoader(e) {
|
|
144
144
|
return a.loader.registerLoader(
|
|
145
|
-
|
|
145
|
+
t.IngredientLoader,
|
|
146
146
|
e
|
|
147
147
|
), this;
|
|
148
148
|
}
|
|
149
149
|
registerIngredientIndex(e) {
|
|
150
150
|
return a.indexExtension.registerIndexExtension(
|
|
151
|
-
|
|
151
|
+
t.IngredientIndex,
|
|
152
152
|
e
|
|
153
153
|
), this;
|
|
154
154
|
}
|
|
@@ -157,7 +157,7 @@ class W {
|
|
|
157
157
|
* */
|
|
158
158
|
registerIngredientTypeMapper(e) {
|
|
159
159
|
return a.propertyMapper.registerPropertyMapper(
|
|
160
|
-
|
|
160
|
+
t.IngredientTypeMapper,
|
|
161
161
|
e
|
|
162
162
|
), this;
|
|
163
163
|
}
|
|
@@ -168,13 +168,13 @@ class W {
|
|
|
168
168
|
*/
|
|
169
169
|
registerHolderDataMapper(e) {
|
|
170
170
|
return a.dataMapper.registerDataMapper(
|
|
171
|
-
|
|
171
|
+
t.HolderMapper,
|
|
172
172
|
e
|
|
173
173
|
), this;
|
|
174
174
|
}
|
|
175
175
|
registerHolderTypeMapper(e) {
|
|
176
176
|
return a.propertyMapper.registerPropertyMapper(
|
|
177
|
-
|
|
177
|
+
t.HolderTypeMapper,
|
|
178
178
|
e
|
|
179
179
|
), this;
|
|
180
180
|
}
|
|
@@ -185,13 +185,13 @@ class W {
|
|
|
185
185
|
* */
|
|
186
186
|
registerHolderIngredientMapper(e) {
|
|
187
187
|
return a.propertyMapper.registerPropertyMapper(
|
|
188
|
-
|
|
188
|
+
t.HolderTypeMapper,
|
|
189
189
|
e
|
|
190
190
|
), this;
|
|
191
191
|
}
|
|
192
192
|
registerHolderIndex(e) {
|
|
193
193
|
return a.indexExtension.registerIndexExtension(
|
|
194
|
-
|
|
194
|
+
t.HolderIndex,
|
|
195
195
|
e
|
|
196
196
|
), this;
|
|
197
197
|
}
|
|
@@ -223,7 +223,7 @@ class W {
|
|
|
223
223
|
* */
|
|
224
224
|
registerAvailabilityDataMapper(e) {
|
|
225
225
|
return a.dataMapper.registerDataMapper(
|
|
226
|
-
|
|
226
|
+
t.AvailabilityMapper,
|
|
227
227
|
e
|
|
228
228
|
), this;
|
|
229
229
|
}
|
|
@@ -259,7 +259,7 @@ class W {
|
|
|
259
259
|
* */
|
|
260
260
|
registerAvailabilityLoader(e) {
|
|
261
261
|
return a.loader.registerLoader(
|
|
262
|
-
|
|
262
|
+
t.AvailabilityLoader,
|
|
263
263
|
e
|
|
264
264
|
), this;
|
|
265
265
|
}
|
|
@@ -268,7 +268,7 @@ class W {
|
|
|
268
268
|
* */
|
|
269
269
|
registerSelectedPourableDataMapper(e) {
|
|
270
270
|
return a.dataMapper.registerDataMapper(
|
|
271
|
-
|
|
271
|
+
t.SelectedPourableMapper,
|
|
272
272
|
e
|
|
273
273
|
), this;
|
|
274
274
|
}
|
|
@@ -335,24 +335,31 @@ class W {
|
|
|
335
335
|
*/
|
|
336
336
|
registerAssemblyDataMapper(e) {
|
|
337
337
|
return a.dataMapper.registerDataMapper(
|
|
338
|
-
|
|
338
|
+
t.AssemblyMapper,
|
|
339
339
|
e
|
|
340
340
|
), this;
|
|
341
341
|
}
|
|
342
342
|
registerBoardIndex(e) {
|
|
343
343
|
return a.indexExtension.registerIndexExtension(
|
|
344
|
-
|
|
344
|
+
t.BoardIndex,
|
|
345
345
|
e
|
|
346
346
|
), this;
|
|
347
347
|
}
|
|
348
348
|
registerBoardDataMapper(e) {
|
|
349
349
|
return a.dataMapper.registerDataMapper(
|
|
350
|
-
|
|
350
|
+
t.BoardMapper,
|
|
351
|
+
e
|
|
352
|
+
), this;
|
|
353
|
+
}
|
|
354
|
+
registerAssemblyFeatureFlagResolver(e) {
|
|
355
|
+
var s;
|
|
356
|
+
return (s = a[X]) == null || s.register(
|
|
357
|
+
t.AssemblyFeatureFlags,
|
|
351
358
|
e
|
|
352
359
|
), this;
|
|
353
360
|
}
|
|
354
361
|
}
|
|
355
|
-
class
|
|
362
|
+
class le {
|
|
356
363
|
constructor() {
|
|
357
364
|
p(this, "dispense");
|
|
358
365
|
p(this, "core");
|
|
@@ -361,14 +368,14 @@ class oe {
|
|
|
361
368
|
}
|
|
362
369
|
export {
|
|
363
370
|
W as D,
|
|
364
|
-
|
|
365
|
-
|
|
371
|
+
le as K,
|
|
372
|
+
pe as a,
|
|
366
373
|
te as b,
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
374
|
+
re as c,
|
|
375
|
+
ne as d,
|
|
376
|
+
se as e,
|
|
377
|
+
ie as f,
|
|
378
|
+
oe as g,
|
|
379
|
+
ae as i
|
|
373
380
|
};
|
|
374
|
-
//# sourceMappingURL=extension-utils-
|
|
381
|
+
//# sourceMappingURL=extension-utils-B9gziKDQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-utils-B9gziKDQ.js","sources":["../../../../packages/sdk/kos-dispense-sdk/src/models/models/holder/utils/holder-utils.ts","../../../../packages/sdk/kos-dispense-sdk/src/models/utils/extension-utils.ts"],"sourcesContent":["import { kosAutoEffect } from \"@kosdev-code/kos-ui-sdk\";\nimport { useEffect, useState } from \"react\";\nimport type { HolderModel } from \"../types\";\n\nexport const getFuelGaugeValue = (holder: HolderModel) => {\n const [maxVolume, setMaxVolume] = useState<number>(\n holder?.slice?.maxVolMl ?? 0\n );\n const [remainingVolume, setRemainingVolume] = useState<number>(\n holder?.slice?.currentVolMl ?? 0\n );\n\n const [hasMaxVolume, setHasMaxVolume] = useState<boolean>(\n holder?.slice?.maxVolMl !== undefined\n );\n\n const [hasRemainingVolume, setHasRemainingVolume] = useState<boolean>(\n holder?.slice?.currentVolMl !== undefined\n );\n\n const [fillPercent, setFillPercent] = useState<number>(\n remainingVolume <= 0\n ? 0\n : Math.floor(((remainingVolume || 1) / (maxVolume || 1)) * 100)\n );\n\n const [hasFuelGuage, setHasFuelGuage] = useState<boolean>(\n hasMaxVolume && hasRemainingVolume\n );\n\n useEffect(() => {\n const disposer = kosAutoEffect(() => {\n setMaxVolume(holder?.slice?.maxVolMl ?? 0);\n setRemainingVolume(holder?.slice?.currentVolMl ?? 0);\n setHasMaxVolume(holder?.slice?.maxVolMl !== undefined);\n setHasRemainingVolume(holder?.slice?.currentVolMl !== undefined);\n setFillPercent(\n remainingVolume <= 0\n ? 0\n : Math.floor(((remainingVolume || 1) / (maxVolume || 1)) * 100)\n );\n setHasFuelGuage(hasMaxVolume && hasRemainingVolume);\n });\n\n return () => {\n disposer();\n };\n }, [holder]);\n\n return { maxVolume, remainingVolume, fillPercent, hasFuelGuage };\n};\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport {\n CoreExtensionManager,\n DataLoader,\n DataMapper,\n EXTENSION_FEATURE_FLAG_RESOLVER,\n ExtensionManager,\n IndexExtension,\n PropertyMapper,\n type FlagResolver,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport { ExtensionType } from \"../constants\";\nimport { AssemblyTypes, type AssemblyModel } from \"../models\";\nimport type { HolderResponse } from \"../models/holder/services\";\nimport type { HolderModel } from \"../models/holder/types\";\nimport type { IngredientResponse } from \"../models/ingredient/services\";\nimport type { BeverageResponse } from \"../models/nozzle/services\";\nimport type { SelectedPourable } from \"../models/nozzle/types\";\n\nexport type IngredientDataMapper<\n AdditionalData extends object = Record<string, any>\n> = DataMapper<IngredientResponse, AdditionalData, any>;\n\n/**\n * Mapping function that maps an ingredient response into the type property of\n * the {@link IngredientModel}.\n */\nexport type IngredientTypeMapper<\n T extends IngredientResponse = IngredientResponse\n> = PropertyMapper<T, string>;\n\n/**\n * Mapping function that maps additional data from holder service response\n * into the {@link HolderModel} data.\n */\nexport type HolderTypeMapper<T extends HolderResponse = HolderResponse> =\n PropertyMapper<T, string>;\n\n/**\n * Mapping function that maps additional data from holder service response\n * into the {@link HolderModel} data.\n */\nexport type HolderDataMapper<\n AdditionalData extends object = Record<string, any>,\n HolderData extends HolderResponse = HolderResponse\n> = DataMapper<HolderData, AdditionalData, any>;\n\nexport type GroupBeverageResponse = BeverageResponse & { groupId: string };\nexport type AvailabilityDataMapper<\n AdditionalData extends object = Record<string, any>,\n AvailabilityData extends GroupBeverageResponse = GroupBeverageResponse\n> = DataMapper<AvailabilityData, AdditionalData, any>;\n\nexport type SelectedPourableMapper = DataMapper<SelectedPourable, any>;\n\nexport type BoardDataMapper<\n AdditionalData extends object = Record<string, any>,\n BoardData extends AssemblyTypes.AssemblyBoard<any> = AssemblyTypes.AssemblyBoard<any>\n> = DataMapper<BoardData, AdditionalData, any>;\n\nexport type AssemblyMapper<\n AdditionalData extends object = Record<string, any>,\n AssemblyResponseData extends AssemblyTypes.AssemblyResponse<any> = AssemblyTypes.AssemblyResponse<any>\n> = DataMapper<AssemblyResponseData, AdditionalData, any>;\n/**\n * The DispenseExtensionManager is responsible for managing the extension points that are specific to the Dispense application.\n */\nexport class DispenseExtensionManager {\n core: CoreExtensionManager = new CoreExtensionManager();\n /**\n * Maps data into the {@link IngredientModel}\n *\n * It is common for the ingredient data provided by the ingredient service to be augmented with additional properties that are\n * not provided by the base KOS Ingredient model. The {@link IngredientMapper} extension point allows for the data to be mapped\n * into the {@link IngredientModel} and the {@link IngredientModel.data} property to be augmented with additional properties.\n *\n * @example\n * The following example shows how to map the data from the service response into the {@link IngredientModel}.\n * The context is provided by the {@link IngredientLoader} extension point with its data being used to optionally augment the\n * ingredient data.\n *\n * The result of the mapping will be available in the `data` property of the {@link IngredientModel}.\n *\n * In this case the `IngedientReponseData` interface represents the data being returned by the ingredient service and the\n * `IngredientData` interface represents the data that will be available in the {@link IngredientModel.data} property. The `ingredientDataMapper`\n * is responsible for mapping from one format to the other.\n *\n * ```typescript\n *\n * interface IngredientResponseData extends NozzleServices.IngredientResponse {\n * chilled: boolean;\n * carbonated: boolean;\n * highYield: boolean;\n * }\n *\n * interface IngredientData {\n * chilled: boolean;\n * carbonated: boolean;\n * highYield: boolean;\n * }\n *\n * export const ingredientDataMapper = async (\n * data: IngredientResponseData,\n * context: IngredientContext\n * ): Promise<IngredientData> => {\n * return {\n * chilled: data.chilled,\n * carbonated: data.carbonated,\n * highYield: data.highYield,\n * }\n * }\n * ```\n * */\n registerIngredientDataMapper(ingredientDataMapper: IngredientDataMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.IngredientMapper,\n ingredientDataMapper\n );\n\n return this;\n }\n\n /**\n * Loads data that will be provided as context into the {@link IngredientMapper}\n *\n * @example\n * The following example shows how to load the brandset data, normalize it into a map and then provide it back to the framework\n * where it can be used by the other extension points.\n *\n * In the ingredient container model, the data is provided to the {@link IngredientMapper} extension point in order to augment ingredient data\n * and also loaded into the ingredient container model context in order to make the data available throughout the code.\n *\n * ```typescript\n * export const ingredientContextLoader = async (): Promise<BeverageContext> => {\n * const response = await kosFetch('kos:/system/some/ingredient/endpoint.json');\n *\n * if (response.status !== 200) {\n * KosLog.error('Failed to load ingredient data');\n * return {};\n * }\n * const json = await response.json();\n * return json;\n * };\n * ```\n * */\n registerIngredientLoader(ingredientLoader: DataLoader) {\n ExtensionManager.loader.registerLoader(\n ExtensionType.IngredientLoader,\n ingredientLoader\n );\n return this;\n }\n\n registerIngredientIndex(ingredientIndex: IndexExtension) {\n ExtensionManager.indexExtension.registerIndexExtension(\n ExtensionType.IngredientIndex,\n ingredientIndex\n );\n return this;\n }\n\n /**\n * Registers a data mapper for the {@link IngredientModel}\n * */\n registerIngredientTypeMapper(ingredientTypeMapper: IngredientTypeMapper) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.IngredientTypeMapper,\n ingredientTypeMapper\n );\n return this;\n }\n\n /**\n * Registers a data mapper for the {@link HolderModel} model.\n * @param holderDataMapper - Mapping function that maps additional data from holder service response\n * @returns\n */\n registerHolderDataMapper(holderDataMapper: HolderDataMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.HolderMapper,\n holderDataMapper\n );\n return this;\n }\n\n registerHolderTypeMapper(holderTypeMapper: HolderTypeMapper) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.HolderTypeMapper,\n holderTypeMapper\n );\n return this;\n }\n\n /**\n * Maps the ingredientId property of the holder into the {@link HolderModel}.\n * If not provided, the ingredientId will assume that the value is mapped from the\n * ingredientId property of the service response.\n * */\n registerHolderIngredientMapper(holderTypeMapper: HolderTypeMapper) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.HolderTypeMapper,\n holderTypeMapper\n );\n return this;\n }\n\n registerHolderIndex<T extends HolderModel = HolderModel>(\n holderIndex: IndexExtension<T>\n ) {\n ExtensionManager.indexExtension.registerIndexExtension(\n ExtensionType.HolderIndex,\n holderIndex\n );\n return this;\n }\n\n /**\n * Maps data into the {@link AvailabilityModel}\n *\n * @example\n * The following example shows how to map the data from the service response into the {@link AvailabilityModel}.\n * The context is provided by the {@link AvailabilityLoader} extension point with its data being used to augment the\n * availability data.\n *\n * The result of the mapping will be available in the `data` property of the {@link AvailabilityModel}.\n *\n * ```typescript\n * export const beverageDataMapper = async (\n * data: NozzleServices.BeverageResponse,\n * context: BeverageContext\n * ): Promise<BeverageData> => {\n * const id = data.altId;\n * const iconUrl = encodeURI(\n * `http://localhost:8081/system/brandset/${context?.[id]?.icon}`\n * );\n * const cuiColorCode = context?.[id]?.cuiColorCode\n * ? context?.[id]?.cuiColorCode\n * : '';\n * return { iconUrl, cuiColorCode };\n * };\n * ```\n * */\n registerAvailabilityDataMapper(availabilityMapper: AvailabilityDataMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.AvailabilityMapper,\n availabilityMapper\n );\n return this;\n }\n\n /**\n * Loads data that will be provided as context into the {@link AvailabilityMapper}\n *\n * @example\n * A common use case is to load brandset data that is UI specific and not provided directly by the Java service.\n *\n * The following example shows how to load the brandset data, normalize it into a map and then provide it back to the framework\n * where it can be used by the other extension points.\n *\n * In the nozzle model, the data is provided to the {@link AvailabilityMapper} extension point in order to augment availability data\n * and also loaded into the nozzle model context in order to make the data available throughout the code.\n *\n * ```typescript\n * export const beverageContextLoader = async (): Promise<BeverageContext> => {\n * const response = await kosFetch('kos:/system/brandset/brandset.json');\n *\n * if (response.status !== 200) {\n * KosLog.error('Failed to load beverage data');\n * return {};\n * }\n * const json: BrandsetResponse | null = await response.json();\n * const initialBeverages: Record<string, BrandsetIngredient> = {};\n * const beverages = json?.ingredients?.reduce((acc, beverage) => {\n * acc[beverage.ingredientId] = beverage;\n * return acc;\n * }, initialBeverages);\n * return beverages;\n * };\n * ```\n * */\n registerAvailabilityLoader(availabilityLoader: DataLoader) {\n ExtensionManager.loader.registerLoader(\n ExtensionType.AvailabilityLoader,\n availabilityLoader\n );\n return this;\n }\n\n /**\n * Maps the abstract {@link SelectedPourable} data into a format that is specific to the nozzle.\n * */\n registerSelectedPourableDataMapper(\n selectedPourableMapper: SelectedPourableMapper\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.SelectedPourableMapper,\n selectedPourableMapper\n );\n return this;\n }\n\n /**\n * Maps data into the {@link AssemblyModel} data.\n * Used in cases where the base assembly has been extended with additional properties in the backend. This extension\n * point allows for the data to be mapped into the {@link AssemblyModel} and augmented with additional properties.\n *\n * @example\n *\n * In this example of an implementation of a {@link AssemblyMapper}, the {@link AssemblyResponse} data is mapped into\n * a {@link FreestyleAssembly} object.\n *\n * The {@link FreestyleAssemblyResponse} interface represents the additional data being returned by the assembly service and is\n * merged into the {@link AssemblyResponse} interface.\n *\n * The {@link FreestyleAssembly} interface represents the additional data, beyond the base data set, that will be merged into the {@link AssemblyModel}.\n *\n * The mapper is responsible for mapping from the {@link FreestyleAssemblyResponse} format to the {@link FreestyleAssembly} format.\n * ```typescript\n * import { AssemblyTypes } from \"@kosdev-code/kos-dispense-sdk\";\n * import { DataMapper } from \"@kosdev-code/kos-ui-sdk\";\n *\n * // define the additional data being returned by the assembly service\n * export interface FreestyleAssemblyResponse {\n * iceAgitator?: {\n * name: \"iceAgitator\";\n * path: string;\n * };\n * }\n *\n * // define the additional data structure that will be merged into the assembly model\n * export interface FreestyleAssembly {\n * iceAgitator: {\n * path: string;\n * };\n * carbAgitator: {\n * path: string;\n * };\n * }\n *\n *\n * // define the mapper that will map the data from the service response into the additional data structure\n * // that will be merged into the assembly model.\n * // In this case the mapper is responsible for mapping from the {@link FreestyleAssemblyResponse} format to the {@link FreestyleAssembly} format.\n * export const assemblyDataMapper: DataMapper<\n * AssemblyTypes.AssemblyResponse<FreestyleAssemblyResponse>,\n * FreestyleAssembly\n * > = async (data) => {\n * const response = data.assemblies.reduce((acc, assembly) => {\n * const agitatorKeys = [\"iceAgitator\", \"carbAgitator\"];\n * agitatorKeys.forEach((key) => {\n * const agitator = assembly[key];\n * if (agitator) {\n * acc[key] = agitator;\n * }\n * });\n *\n * return acc;\n * }, {} as FreestyleAssembly);\n * return response;\n * };\n *```\n */\n registerAssemblyDataMapper(assemblyDataMapper: AssemblyMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.AssemblyMapper,\n assemblyDataMapper\n );\n return this;\n }\n\n registerBoardIndex(boardIndex: IndexExtension) {\n ExtensionManager.indexExtension.registerIndexExtension(\n ExtensionType.BoardIndex,\n boardIndex\n );\n return this;\n }\n\n registerBoardDataMapper(boardDataMapper: BoardDataMapper<any, any>) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.BoardMapper,\n boardDataMapper\n );\n return this;\n }\n\n registerAssemblyFeatureFlagResolver(\n assemblyFeatureFlagResolver: FlagResolver<AssemblyModel>\n ) {\n ExtensionManager[EXTENSION_FEATURE_FLAG_RESOLVER]?.register(\n ExtensionType.AssemblyFeatureFlags,\n assemblyFeatureFlagResolver\n );\n return this;\n }\n}\n\n/**\n * The KosExtensionManager provides access to the extension points that are provided in the SDK for Dispense applications.\n *\n * The extension points are divided into two categories:\n *\n * @param core - The core extension {@link CoreExtensionManager} points are used to extend the base models that are provided by the SDK.\n * @param dispense - The dispense extension {@link DispenseExtensionManager} points are used to extend the models that are specific to the Dispense SDK.\n */\nexport class KosExtensionManager {\n dispense: DispenseExtensionManager;\n core: CoreExtensionManager;\n constructor() {\n this.dispense = new DispenseExtensionManager();\n this.core = new CoreExtensionManager();\n }\n}\n"],"names":["getFuelGaugeValue","holder","maxVolume","setMaxVolume","useState","_a","remainingVolume","setRemainingVolume","_b","hasMaxVolume","setHasMaxVolume","_c","hasRemainingVolume","setHasRemainingVolume","_d","fillPercent","setFillPercent","hasFuelGuage","setHasFuelGuage","useEffect","disposer","kosAutoEffect","DispenseExtensionManager","__publicField","CoreExtensionManager","ingredientDataMapper","ExtensionManager","ExtensionType","ingredientLoader","ingredientIndex","ingredientTypeMapper","holderDataMapper","holderTypeMapper","holderIndex","availabilityMapper","availabilityLoader","selectedPourableMapper","assemblyDataMapper","boardIndex","boardDataMapper","assemblyFeatureFlagResolver","EXTENSION_FEATURE_FLAG_RESOLVER","KosExtensionManager"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8CAIaA,KAAoB,CAACC,MAAwB;;AAClD,QAAA,CAACC,GAAWC,CAAY,IAAIC;AAAA,MAChCC,IAAAJ,KAAA,gBAAAA,EAAQ,UAAR,gBAAAI,E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AEA,mBAAmBC,GAA4B;AAC7C,WAAAZ,EAAiB,eAAe;AAAA,MAC9BC,EAAc;AAAA,MACdW;AAAA,IAAA,GAEK;AAAA,EACT;AAAA,EAEA,wBAAwBC,GAA4C;AAClE,WAAAb,EAAiB,WAAW;AAAA,MAC1BC,EAAc;AAAA,MACdY;AAAA,IAAA,GAEK;AAAA,EACT;AAAA,EAEA,oCACEC,GACA;;AACA,YAAAnC,IAAAqB,EAAiBe,CAA+B,MAAhD,QAAApC,EAAmD;AAAA,MACjDsB,EAAc;AAAA,MACda;AAAA,OAEK;AAAA,EACT;AACF;AAUO,MAAME,GAAoB;AAAA,EAG/B,cAAc;AAFd,IAAAnB,EAAA;AACA,IAAAA,EAAA;AAEO,SAAA,WAAW,IAAID,KACf,KAAA,OAAO,IAAIE;EAClB;AACF;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
//# sourceMappingURL=extension-utils-
|
|
1
|
+
"use strict";var V=Object.defineProperty;var v=(t,e,a)=>e in t?V(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var o=(t,e,a)=>(v(t,typeof e!="symbol"?e+"":e,a),a);const n=require("./dispense-registration-manager-BZeOXyYn.cjs"),r=require("@kosdev-code/kos-ui-sdk"),s=require("react"),O=Object.freeze(Object.defineProperty({__proto__:null,getIngredients:n.getIngredients},Symbol.toStringTag,{value:"Module"})),H=Object.freeze(Object.defineProperty({__proto__:null,addAssignment:n.addAssignment,assignHolderIngredient:n.assignHolderIngredient,deleteAssignment:n.deleteAssignment,getAssignments:n.getAssignments,getHolders:n.getHolders,replaceLine:n.replaceLine,sendRfidOverride:n.sendRfidOverride,unassignHolderIngredient:n.unassignHolderIngredient},Symbol.toStringTag,{value:"Module"})),j=Object.freeze(Object.defineProperty({__proto__:null,getAssembly:n.getAssembly},Symbol.toStringTag,{value:"Module"})),D=Object.freeze(Object.defineProperty({__proto__:null,getIntentVolume:n.getIntentVolume,sendIntent:n.sendIntent},Symbol.toStringTag,{value:"Module"})),F=Object.freeze(Object.defineProperty({__proto__:null,clearPourable:n.clearPourable,getAvailability:n.getAvailability,pourNamedPourable:n.pourNamedPourable,pourPourable:n.pourPourable,selectPourable:n.selectPourable},Symbol.toStringTag,{value:"Module"})),R=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),L=Object.freeze(Object.defineProperty({__proto__:null,pourOnTarget:n.pourOnTarget},Symbol.toStringTag,{value:"Module"})),$=t=>{var l,u,M,x;const[e,a]=s.useState(((l=t==null?void 0:t.slice)==null?void 0:l.maxVolMl)??0),[i,m]=s.useState(((u=t==null?void 0:t.slice)==null?void 0:u.currentVolMl)??0),[p,T]=s.useState(((M=t==null?void 0:t.slice)==null?void 0:M.maxVolMl)!==void 0),[g,_]=s.useState(((x=t==null?void 0:t.slice)==null?void 0:x.currentVolMl)!==void 0),[I,S]=s.useState(i<=0?0:Math.floor((i||1)/(e||1)*100)),[f,P]=s.useState(p&&g);return s.useEffect(()=>{const A=r.kosAutoEffect(()=>{var d,c,y,E;a(((d=t==null?void 0:t.slice)==null?void 0:d.maxVolMl)??0),m(((c=t==null?void 0:t.slice)==null?void 0:c.currentVolMl)??0),T(((y=t==null?void 0:t.slice)==null?void 0:y.maxVolMl)!==void 0),_(((E=t==null?void 0:t.slice)==null?void 0:E.currentVolMl)!==void 0),S(i<=0?0:Math.floor((i||1)/(e||1)*100)),P(p&&g)});return()=>{A()}},[t]),{maxVolume:e,remainingVolume:i,fillPercent:I,hasFuelGuage:f}};class b{constructor(){o(this,"core",new r.CoreExtensionManager)}registerIngredientDataMapper(e){return r.ExtensionManager.dataMapper.registerDataMapper(n.ExtensionType.IngredientMapper,e),this}registerIngredientLoader(e){return r.ExtensionManager.loader.registerLoader(n.ExtensionType.IngredientLoader,e),this}registerIngredientIndex(e){return r.ExtensionManager.indexExtension.registerIndexExtension(n.ExtensionType.IngredientIndex,e),this}registerIngredientTypeMapper(e){return r.ExtensionManager.propertyMapper.registerPropertyMapper(n.ExtensionType.IngredientTypeMapper,e),this}registerHolderDataMapper(e){return r.ExtensionManager.dataMapper.registerDataMapper(n.ExtensionType.HolderMapper,e),this}registerHolderTypeMapper(e){return r.ExtensionManager.propertyMapper.registerPropertyMapper(n.ExtensionType.HolderTypeMapper,e),this}registerHolderIngredientMapper(e){return r.ExtensionManager.propertyMapper.registerPropertyMapper(n.ExtensionType.HolderTypeMapper,e),this}registerHolderIndex(e){return r.ExtensionManager.indexExtension.registerIndexExtension(n.ExtensionType.HolderIndex,e),this}registerAvailabilityDataMapper(e){return r.ExtensionManager.dataMapper.registerDataMapper(n.ExtensionType.AvailabilityMapper,e),this}registerAvailabilityLoader(e){return r.ExtensionManager.loader.registerLoader(n.ExtensionType.AvailabilityLoader,e),this}registerSelectedPourableDataMapper(e){return r.ExtensionManager.dataMapper.registerDataMapper(n.ExtensionType.SelectedPourableMapper,e),this}registerAssemblyDataMapper(e){return r.ExtensionManager.dataMapper.registerDataMapper(n.ExtensionType.AssemblyMapper,e),this}registerBoardIndex(e){return r.ExtensionManager.indexExtension.registerIndexExtension(n.ExtensionType.BoardIndex,e),this}registerBoardDataMapper(e){return r.ExtensionManager.dataMapper.registerDataMapper(n.ExtensionType.BoardMapper,e),this}registerAssemblyFeatureFlagResolver(e){var a;return(a=r.ExtensionManager[r.EXTENSION_FEATURE_FLAG_RESOLVER])==null||a.register(n.ExtensionType.AssemblyFeatureFlags,e),this}}class z{constructor(){o(this,"dispense");o(this,"core");this.dispense=new b,this.core=new r.CoreExtensionManager}}exports.DispenseExtensionManager=b;exports.KosExtensionManager=z;exports.assembly=R;exports.getFuelGaugeValue=$;exports.index=j;exports.index$1=L;exports.index$2=H;exports.index$3=O;exports.index$4=F;exports.index$5=D;
|
|
2
|
+
//# sourceMappingURL=extension-utils-DcOOx69a.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-utils-DcOOx69a.cjs","sources":["../../../../packages/sdk/kos-dispense-sdk/src/models/models/holder/utils/holder-utils.ts","../../../../packages/sdk/kos-dispense-sdk/src/models/utils/extension-utils.ts"],"sourcesContent":["import { kosAutoEffect } from \"@kosdev-code/kos-ui-sdk\";\nimport { useEffect, useState } from \"react\";\nimport type { HolderModel } from \"../types\";\n\nexport const getFuelGaugeValue = (holder: HolderModel) => {\n const [maxVolume, setMaxVolume] = useState<number>(\n holder?.slice?.maxVolMl ?? 0\n );\n const [remainingVolume, setRemainingVolume] = useState<number>(\n holder?.slice?.currentVolMl ?? 0\n );\n\n const [hasMaxVolume, setHasMaxVolume] = useState<boolean>(\n holder?.slice?.maxVolMl !== undefined\n );\n\n const [hasRemainingVolume, setHasRemainingVolume] = useState<boolean>(\n holder?.slice?.currentVolMl !== undefined\n );\n\n const [fillPercent, setFillPercent] = useState<number>(\n remainingVolume <= 0\n ? 0\n : Math.floor(((remainingVolume || 1) / (maxVolume || 1)) * 100)\n );\n\n const [hasFuelGuage, setHasFuelGuage] = useState<boolean>(\n hasMaxVolume && hasRemainingVolume\n );\n\n useEffect(() => {\n const disposer = kosAutoEffect(() => {\n setMaxVolume(holder?.slice?.maxVolMl ?? 0);\n setRemainingVolume(holder?.slice?.currentVolMl ?? 0);\n setHasMaxVolume(holder?.slice?.maxVolMl !== undefined);\n setHasRemainingVolume(holder?.slice?.currentVolMl !== undefined);\n setFillPercent(\n remainingVolume <= 0\n ? 0\n : Math.floor(((remainingVolume || 1) / (maxVolume || 1)) * 100)\n );\n setHasFuelGuage(hasMaxVolume && hasRemainingVolume);\n });\n\n return () => {\n disposer();\n };\n }, [holder]);\n\n return { maxVolume, remainingVolume, fillPercent, hasFuelGuage };\n};\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport {\n CoreExtensionManager,\n DataLoader,\n DataMapper,\n EXTENSION_FEATURE_FLAG_RESOLVER,\n ExtensionManager,\n IndexExtension,\n PropertyMapper,\n type FlagResolver,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport { ExtensionType } from \"../constants\";\nimport { AssemblyTypes, type AssemblyModel } from \"../models\";\nimport type { HolderResponse } from \"../models/holder/services\";\nimport type { HolderModel } from \"../models/holder/types\";\nimport type { IngredientResponse } from \"../models/ingredient/services\";\nimport type { BeverageResponse } from \"../models/nozzle/services\";\nimport type { SelectedPourable } from \"../models/nozzle/types\";\n\nexport type IngredientDataMapper<\n AdditionalData extends object = Record<string, any>\n> = DataMapper<IngredientResponse, AdditionalData, any>;\n\n/**\n * Mapping function that maps an ingredient response into the type property of\n * the {@link IngredientModel}.\n */\nexport type IngredientTypeMapper<\n T extends IngredientResponse = IngredientResponse\n> = PropertyMapper<T, string>;\n\n/**\n * Mapping function that maps additional data from holder service response\n * into the {@link HolderModel} data.\n */\nexport type HolderTypeMapper<T extends HolderResponse = HolderResponse> =\n PropertyMapper<T, string>;\n\n/**\n * Mapping function that maps additional data from holder service response\n * into the {@link HolderModel} data.\n */\nexport type HolderDataMapper<\n AdditionalData extends object = Record<string, any>,\n HolderData extends HolderResponse = HolderResponse\n> = DataMapper<HolderData, AdditionalData, any>;\n\nexport type GroupBeverageResponse = BeverageResponse & { groupId: string };\nexport type AvailabilityDataMapper<\n AdditionalData extends object = Record<string, any>,\n AvailabilityData extends GroupBeverageResponse = GroupBeverageResponse\n> = DataMapper<AvailabilityData, AdditionalData, any>;\n\nexport type SelectedPourableMapper = DataMapper<SelectedPourable, any>;\n\nexport type BoardDataMapper<\n AdditionalData extends object = Record<string, any>,\n BoardData extends AssemblyTypes.AssemblyBoard<any> = AssemblyTypes.AssemblyBoard<any>\n> = DataMapper<BoardData, AdditionalData, any>;\n\nexport type AssemblyMapper<\n AdditionalData extends object = Record<string, any>,\n AssemblyResponseData extends AssemblyTypes.AssemblyResponse<any> = AssemblyTypes.AssemblyResponse<any>\n> = DataMapper<AssemblyResponseData, AdditionalData, any>;\n/**\n * The DispenseExtensionManager is responsible for managing the extension points that are specific to the Dispense application.\n */\nexport class DispenseExtensionManager {\n core: CoreExtensionManager = new CoreExtensionManager();\n /**\n * Maps data into the {@link IngredientModel}\n *\n * It is common for the ingredient data provided by the ingredient service to be augmented with additional properties that are\n * not provided by the base KOS Ingredient model. The {@link IngredientMapper} extension point allows for the data to be mapped\n * into the {@link IngredientModel} and the {@link IngredientModel.data} property to be augmented with additional properties.\n *\n * @example\n * The following example shows how to map the data from the service response into the {@link IngredientModel}.\n * The context is provided by the {@link IngredientLoader} extension point with its data being used to optionally augment the\n * ingredient data.\n *\n * The result of the mapping will be available in the `data` property of the {@link IngredientModel}.\n *\n * In this case the `IngedientReponseData` interface represents the data being returned by the ingredient service and the\n * `IngredientData` interface represents the data that will be available in the {@link IngredientModel.data} property. The `ingredientDataMapper`\n * is responsible for mapping from one format to the other.\n *\n * ```typescript\n *\n * interface IngredientResponseData extends NozzleServices.IngredientResponse {\n * chilled: boolean;\n * carbonated: boolean;\n * highYield: boolean;\n * }\n *\n * interface IngredientData {\n * chilled: boolean;\n * carbonated: boolean;\n * highYield: boolean;\n * }\n *\n * export const ingredientDataMapper = async (\n * data: IngredientResponseData,\n * context: IngredientContext\n * ): Promise<IngredientData> => {\n * return {\n * chilled: data.chilled,\n * carbonated: data.carbonated,\n * highYield: data.highYield,\n * }\n * }\n * ```\n * */\n registerIngredientDataMapper(ingredientDataMapper: IngredientDataMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.IngredientMapper,\n ingredientDataMapper\n );\n\n return this;\n }\n\n /**\n * Loads data that will be provided as context into the {@link IngredientMapper}\n *\n * @example\n * The following example shows how to load the brandset data, normalize it into a map and then provide it back to the framework\n * where it can be used by the other extension points.\n *\n * In the ingredient container model, the data is provided to the {@link IngredientMapper} extension point in order to augment ingredient data\n * and also loaded into the ingredient container model context in order to make the data available throughout the code.\n *\n * ```typescript\n * export const ingredientContextLoader = async (): Promise<BeverageContext> => {\n * const response = await kosFetch('kos:/system/some/ingredient/endpoint.json');\n *\n * if (response.status !== 200) {\n * KosLog.error('Failed to load ingredient data');\n * return {};\n * }\n * const json = await response.json();\n * return json;\n * };\n * ```\n * */\n registerIngredientLoader(ingredientLoader: DataLoader) {\n ExtensionManager.loader.registerLoader(\n ExtensionType.IngredientLoader,\n ingredientLoader\n );\n return this;\n }\n\n registerIngredientIndex(ingredientIndex: IndexExtension) {\n ExtensionManager.indexExtension.registerIndexExtension(\n ExtensionType.IngredientIndex,\n ingredientIndex\n );\n return this;\n }\n\n /**\n * Registers a data mapper for the {@link IngredientModel}\n * */\n registerIngredientTypeMapper(ingredientTypeMapper: IngredientTypeMapper) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.IngredientTypeMapper,\n ingredientTypeMapper\n );\n return this;\n }\n\n /**\n * Registers a data mapper for the {@link HolderModel} model.\n * @param holderDataMapper - Mapping function that maps additional data from holder service response\n * @returns\n */\n registerHolderDataMapper(holderDataMapper: HolderDataMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.HolderMapper,\n holderDataMapper\n );\n return this;\n }\n\n registerHolderTypeMapper(holderTypeMapper: HolderTypeMapper) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.HolderTypeMapper,\n holderTypeMapper\n );\n return this;\n }\n\n /**\n * Maps the ingredientId property of the holder into the {@link HolderModel}.\n * If not provided, the ingredientId will assume that the value is mapped from the\n * ingredientId property of the service response.\n * */\n registerHolderIngredientMapper(holderTypeMapper: HolderTypeMapper) {\n ExtensionManager.propertyMapper.registerPropertyMapper(\n ExtensionType.HolderTypeMapper,\n holderTypeMapper\n );\n return this;\n }\n\n registerHolderIndex<T extends HolderModel = HolderModel>(\n holderIndex: IndexExtension<T>\n ) {\n ExtensionManager.indexExtension.registerIndexExtension(\n ExtensionType.HolderIndex,\n holderIndex\n );\n return this;\n }\n\n /**\n * Maps data into the {@link AvailabilityModel}\n *\n * @example\n * The following example shows how to map the data from the service response into the {@link AvailabilityModel}.\n * The context is provided by the {@link AvailabilityLoader} extension point with its data being used to augment the\n * availability data.\n *\n * The result of the mapping will be available in the `data` property of the {@link AvailabilityModel}.\n *\n * ```typescript\n * export const beverageDataMapper = async (\n * data: NozzleServices.BeverageResponse,\n * context: BeverageContext\n * ): Promise<BeverageData> => {\n * const id = data.altId;\n * const iconUrl = encodeURI(\n * `http://localhost:8081/system/brandset/${context?.[id]?.icon}`\n * );\n * const cuiColorCode = context?.[id]?.cuiColorCode\n * ? context?.[id]?.cuiColorCode\n * : '';\n * return { iconUrl, cuiColorCode };\n * };\n * ```\n * */\n registerAvailabilityDataMapper(availabilityMapper: AvailabilityDataMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.AvailabilityMapper,\n availabilityMapper\n );\n return this;\n }\n\n /**\n * Loads data that will be provided as context into the {@link AvailabilityMapper}\n *\n * @example\n * A common use case is to load brandset data that is UI specific and not provided directly by the Java service.\n *\n * The following example shows how to load the brandset data, normalize it into a map and then provide it back to the framework\n * where it can be used by the other extension points.\n *\n * In the nozzle model, the data is provided to the {@link AvailabilityMapper} extension point in order to augment availability data\n * and also loaded into the nozzle model context in order to make the data available throughout the code.\n *\n * ```typescript\n * export const beverageContextLoader = async (): Promise<BeverageContext> => {\n * const response = await kosFetch('kos:/system/brandset/brandset.json');\n *\n * if (response.status !== 200) {\n * KosLog.error('Failed to load beverage data');\n * return {};\n * }\n * const json: BrandsetResponse | null = await response.json();\n * const initialBeverages: Record<string, BrandsetIngredient> = {};\n * const beverages = json?.ingredients?.reduce((acc, beverage) => {\n * acc[beverage.ingredientId] = beverage;\n * return acc;\n * }, initialBeverages);\n * return beverages;\n * };\n * ```\n * */\n registerAvailabilityLoader(availabilityLoader: DataLoader) {\n ExtensionManager.loader.registerLoader(\n ExtensionType.AvailabilityLoader,\n availabilityLoader\n );\n return this;\n }\n\n /**\n * Maps the abstract {@link SelectedPourable} data into a format that is specific to the nozzle.\n * */\n registerSelectedPourableDataMapper(\n selectedPourableMapper: SelectedPourableMapper\n ) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.SelectedPourableMapper,\n selectedPourableMapper\n );\n return this;\n }\n\n /**\n * Maps data into the {@link AssemblyModel} data.\n * Used in cases where the base assembly has been extended with additional properties in the backend. This extension\n * point allows for the data to be mapped into the {@link AssemblyModel} and augmented with additional properties.\n *\n * @example\n *\n * In this example of an implementation of a {@link AssemblyMapper}, the {@link AssemblyResponse} data is mapped into\n * a {@link FreestyleAssembly} object.\n *\n * The {@link FreestyleAssemblyResponse} interface represents the additional data being returned by the assembly service and is\n * merged into the {@link AssemblyResponse} interface.\n *\n * The {@link FreestyleAssembly} interface represents the additional data, beyond the base data set, that will be merged into the {@link AssemblyModel}.\n *\n * The mapper is responsible for mapping from the {@link FreestyleAssemblyResponse} format to the {@link FreestyleAssembly} format.\n * ```typescript\n * import { AssemblyTypes } from \"@kosdev-code/kos-dispense-sdk\";\n * import { DataMapper } from \"@kosdev-code/kos-ui-sdk\";\n *\n * // define the additional data being returned by the assembly service\n * export interface FreestyleAssemblyResponse {\n * iceAgitator?: {\n * name: \"iceAgitator\";\n * path: string;\n * };\n * }\n *\n * // define the additional data structure that will be merged into the assembly model\n * export interface FreestyleAssembly {\n * iceAgitator: {\n * path: string;\n * };\n * carbAgitator: {\n * path: string;\n * };\n * }\n *\n *\n * // define the mapper that will map the data from the service response into the additional data structure\n * // that will be merged into the assembly model.\n * // In this case the mapper is responsible for mapping from the {@link FreestyleAssemblyResponse} format to the {@link FreestyleAssembly} format.\n * export const assemblyDataMapper: DataMapper<\n * AssemblyTypes.AssemblyResponse<FreestyleAssemblyResponse>,\n * FreestyleAssembly\n * > = async (data) => {\n * const response = data.assemblies.reduce((acc, assembly) => {\n * const agitatorKeys = [\"iceAgitator\", \"carbAgitator\"];\n * agitatorKeys.forEach((key) => {\n * const agitator = assembly[key];\n * if (agitator) {\n * acc[key] = agitator;\n * }\n * });\n *\n * return acc;\n * }, {} as FreestyleAssembly);\n * return response;\n * };\n *```\n */\n registerAssemblyDataMapper(assemblyDataMapper: AssemblyMapper) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.AssemblyMapper,\n assemblyDataMapper\n );\n return this;\n }\n\n registerBoardIndex(boardIndex: IndexExtension) {\n ExtensionManager.indexExtension.registerIndexExtension(\n ExtensionType.BoardIndex,\n boardIndex\n );\n return this;\n }\n\n registerBoardDataMapper(boardDataMapper: BoardDataMapper<any, any>) {\n ExtensionManager.dataMapper.registerDataMapper(\n ExtensionType.BoardMapper,\n boardDataMapper\n );\n return this;\n }\n\n registerAssemblyFeatureFlagResolver(\n assemblyFeatureFlagResolver: FlagResolver<AssemblyModel>\n ) {\n ExtensionManager[EXTENSION_FEATURE_FLAG_RESOLVER]?.register(\n ExtensionType.AssemblyFeatureFlags,\n assemblyFeatureFlagResolver\n );\n return this;\n }\n}\n\n/**\n * The KosExtensionManager provides access to the extension points that are provided in the SDK for Dispense applications.\n *\n * The extension points are divided into two categories:\n *\n * @param core - The core extension {@link CoreExtensionManager} points are used to extend the base models that are provided by the SDK.\n * @param dispense - The dispense extension {@link DispenseExtensionManager} points are used to extend the models that are specific to the Dispense SDK.\n */\nexport class KosExtensionManager {\n dispense: DispenseExtensionManager;\n core: CoreExtensionManager;\n constructor() {\n this.dispense = new DispenseExtensionManager();\n this.core = new CoreExtensionManager();\n }\n}\n"],"names":["getFuelGaugeValue","holder","maxVolume","setMaxVolume","useState","_a","remainingVolume","setRemainingVolume","_b","hasMaxVolume","setHasMaxVolume","_c","hasRemainingVolume","setHasRemainingVolume","_d","fillPercent","setFillPercent","hasFuelGuage","setHasFuelGuage","useEffect","disposer","kosAutoEffect","DispenseExtensionManager","__publicField","CoreExtensionManager","ingredientDataMapper","ExtensionManager","ExtensionType","ingredientLoader","ingredientIndex","ingredientTypeMapper","holderDataMapper","holderTypeMapper","holderIndex","availabilityMapper","availabilityLoader","selectedPourableMapper","assemblyDataMapper","boardIndex","boardDataMapper","assemblyFeatureFlagResolver","EXTENSION_FEATURE_FLAG_RESOLVER","KosExtensionManager"],"mappings":"sgDAIaA,EAAqBC,GAAwB,aAClD,KAA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C,EAAoC,CAC7DX,OAAAA,EAAA,iBAAiB,WAAW,mBAC1BC,EAAAA,cAAc,eACdU,CAAA,EAEK,IACT,CAEA,mBAAmBC,EAA4B,CAC7CZ,OAAAA,EAAA,iBAAiB,eAAe,uBAC9BC,EAAAA,cAAc,WACdW,CAAA,EAEK,IACT,CAEA,wBAAwBC,EAA4C,CAClEb,OAAAA,EAAA,iBAAiB,WAAW,mBAC1BC,EAAAA,cAAc,YACdY,CAAA,EAEK,IACT,CAEA,oCACEC,EACA,OACAd,OAAAA,EAAAA,EAAA,iBAAiBe,EAA+B,+BAAA,IAAhDf,MAAAA,EAAmD,SACjDC,EAAAA,cAAc,qBACda,GAEK,IACT,CACF,CAUO,MAAME,CAAoB,CAG/B,aAAc,CAFdnB,EAAA,iBACAA,EAAA,aAEO,KAAA,SAAW,IAAID,EACf,KAAA,KAAO,IAAIE,EAAAA,oBAClB,CACF"}
|
package/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./dispense-registration-manager-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./dispense-registration-manager-BZeOXyYn.cjs"),i=require("./extension-utils-DcOOx69a.cjs"),e=require("./pump-provider-BkfgOMJx.cjs");require("@kosdev-code/kos-ui-sdk");require("react");require("@emotion/react/jsx-runtime");exports.Assembly=r.Assembly;exports.Availability=r.Availability;exports.Board=r.Board;exports.BoardContainer=r.BoardContainer;Object.defineProperty(exports,"BoardContainerModel",{enumerable:!0,get:()=>r.BoardContainerModel});exports.CONTEXT_ASSEMBLY_DATA=r.CONTEXT_ASSEMBLY_DATA;exports.CONTEXT_ASSEMBLY_RAW_DATA=r.CONTEXT_ASSEMBLY_RAW_DATA;exports.DeviceAssembly=r.DeviceAssembly;exports.DispenseModelType=r.DispenseModelType;exports.DispenserModels=r.kosModels;exports.ExtensionType=r.ExtensionType;exports.GenericPour=r.GenericPour;exports.Holder=r.Holder;exports.HolderContainer=r.HolderContainer;exports.Ingredient=r.Ingredient;exports.IngredientContainer=r.IngredientContainer;exports.KosModelRegistry=r.KosModelRegistry;exports.Nozzle=r.Nozzle;exports.PourState=r.PourState;exports.Pump=r.Pump;exports.PumpContainer=r.PumpContainer;exports.PumpIndex=r.PumpIndex;exports.TOPIC_BOARD_LINKED=r.TOPIC_BOARD_LINKED;exports.TOPIC_BOARD_UNLINKED=r.TOPIC_BOARD_UNLINKED;exports.kosModels=r.kosModels;exports.registerDispenseModels=r.registerDispenseModels;exports.AssemblyServices=i.index;exports.AssemblyTypes=i.assembly;exports.DispenseExtensionManager=i.DispenseExtensionManager;exports.GenericPourServices=i.index$1;exports.HolderServices=i.index$2;exports.IngredientServices=i.index$3;exports.KosExtensionManager=i.KosExtensionManager;exports.NozzleServices=i.index$4;exports.PumpServices=i.index$5;exports.getFuelGaugeValue=i.getFuelGaugeValue;exports.AssemblyProvider=e.AssemblyProvider;exports.AvailabilityProvider=e.AvailabilityProvider;exports.BoardContainerProvider=e.BoardContainerProvider;exports.BoardProvider=e.BoardProvider;exports.CuiKit=e.CuiKit;exports.CuiKitWrapper=e.CuiKitWrapper;exports.DISPENSE_GROUP_BEVERAGE=e.DISPENSE_GROUP_BEVERAGE;exports.DISPENSE_GROUP_BRAND=e.DISPENSE_GROUP_BRAND;exports.DISPENSE_GROUP_FLAVOR=e.DISPENSE_GROUP_FLAVOR;exports.DeviceAssemblyProvider=e.DeviceAssemblyProvider;exports.HoldToPourIntentStrategy=e.HoldToPourIntentStrategy;exports.HoldToPourStrategy=e.HoldToPourStrategy;exports.HolderContainerProvider=e.HolderContainerProvider;exports.HolderProvider=e.HolderProvider;exports.IngredientContainerProvider=e.IngredientContainerProvider;exports.IngredientProvider=e.IngredientProvider;exports.NozzleProvider=e.NozzleProvider;exports.PumpProvider=e.PumpProvider;exports.TapOrHoldIntentStrategy=e.TapOrHoldIntentStrategy;exports.TapToPourIntentStrategy=e.TapToPourIntentStrategy;exports.TapToPourStrategy=e.TapToPourStrategy;exports.initializeCuiKit=e.initializeCuiKit;exports.useAssembly=e.useAssembly;exports.useAssemblyContext=e.useAssemblyContext;exports.useAvailability=e.useAvailability;exports.useAvailabilityContext=e.useAvailabilityContext;exports.useBeverages=e.useBeverages;exports.useBoard=e.useBoard;exports.useBoardContainer=e.useBoardContainer;exports.useBoardContainerContext=e.useBoardContainerContext;exports.useBoardContext=e.useBoardContext;exports.useBrands=e.useBrands;exports.useCuiKit=e.useCuiKit;exports.useCuiKitTimers=e.useCuiKitTimers;exports.useDefaultCuiKitLifecycle=e.useDefaultCuiKitLifecycle;exports.useDeviceAssembly=e.useDeviceAssembly;exports.useDeviceAssemblyContext=e.useDeviceAssemblyContext;exports.useDispenseLifecycle=e.useDispenseLifecycle;exports.useFlavors=e.useFlavors;exports.useGenericPour=e.useGenericPour;exports.useHolder=e.useHolder;exports.useHolderContainer=e.useHolderContainer;exports.useHolderContainerContext=e.useHolderContainerContext;exports.useHolderContext=e.useHolderContext;exports.useIngredient=e.useIngredient;exports.useIngredientContainer=e.useIngredientContainer;exports.useIngredientContainerContext=e.useIngredientContainerContext;exports.useIngredientContext=e.useIngredientContext;exports.useIngredientPour=e.useIngredientPour;exports.useNozzle=e.useNozzle;exports.useNozzleContext=e.useNozzleContext;exports.useNozzlePour=e.useNozzlePour;exports.usePourTarget=e.usePourTarget;exports.usePumpContext=e.usePumpContext;exports.withAssembly=e.withAssembly;exports.withBeverage=e.withBeverage;exports.withBoard=e.withBoard;exports.withBoardContainer=e.withBoardContainer;exports.withDeviceAssembly=e.withDeviceAssembly;exports.withGenericPour=e.withGenericPour;exports.withHolder=e.withHolder;exports.withHolderContainer=e.withHolderContainer;exports.withIngredient=e.withIngredient;exports.withIngredientContainer=e.withIngredientContainer;exports.withNozzle=e.withNozzle;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/index.js
CHANGED
|
@@ -1,108 +1,110 @@
|
|
|
1
|
-
import { A as o,
|
|
2
|
-
import { i as
|
|
3
|
-
import { A as
|
|
1
|
+
import { A as o, b as t, e as n, d as u, B as d, C as l, a as C, f as P, D as v, k as A, E as g, G as y, H as m, g as p, I, h as D, K as S, N as c, l as B, P as T, i as E, j as b, T as x, c as N, k as z, r as H } from "./dispense-registration-manager-eOOE05xT.js";
|
|
2
|
+
import { i as h, f as K, D as w, a as O, b as G, c as M, K as R, d as f, e as L, g as U } from "./extension-utils-B9gziKDQ.js";
|
|
3
|
+
import { A as F, a as V, d as W, B as X, f as Y, C as j, G as q, F as J, J as Q, D as Z, a4 as $, a5 as ee, j as se, H as ae, m as re, I as ie, N as oe, P as te, a6 as ne, a7 as ue, a8 as de, i as le, q as Ce, u as Pe, r as ve, b as Ae, z as ge, t as ye, x as me, e as pe, c as Ie, E as De, K as Se, O as ce, L as Be, R as Te, g as Ee, M as be, Q as xe, a9 as Ne, T as ze, V as He, k as _e, h as he, X as Ke, _ as we, n as Oe, l as Ge, Y as Me, a0 as Re, o as fe, a2 as Le, a3 as Ue, p as ke, w as Fe, s as Ve, v as We, y as Xe, S as Ye, aa as je, U as qe, W as Je, Z as Qe, $ as Ze, a1 as $e } from "./pump-provider-BgSHNZEC.js";
|
|
4
4
|
import "@kosdev-code/kos-ui-sdk";
|
|
5
5
|
import "react";
|
|
6
6
|
import "@emotion/react/jsx-runtime";
|
|
7
7
|
export {
|
|
8
8
|
o as Assembly,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
F as AssemblyProvider,
|
|
10
|
+
h as AssemblyServices,
|
|
11
|
+
K as AssemblyTypes,
|
|
12
12
|
t as Availability,
|
|
13
|
-
|
|
13
|
+
V as AvailabilityProvider,
|
|
14
14
|
n as Board,
|
|
15
15
|
u as BoardContainer,
|
|
16
16
|
d as BoardContainerModel,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
W as BoardContainerProvider,
|
|
18
|
+
X as BoardProvider,
|
|
19
|
+
l as CONTEXT_ASSEMBLY_DATA,
|
|
20
|
+
C as CONTEXT_ASSEMBLY_RAW_DATA,
|
|
21
|
+
Y as CuiKit,
|
|
22
|
+
j as CuiKitWrapper,
|
|
21
23
|
q as DISPENSE_GROUP_BEVERAGE,
|
|
22
24
|
J as DISPENSE_GROUP_BRAND,
|
|
23
25
|
Q as DISPENSE_GROUP_FLAVOR,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
26
|
+
P as DeviceAssembly,
|
|
27
|
+
Z as DeviceAssemblyProvider,
|
|
28
|
+
w as DispenseExtensionManager,
|
|
29
|
+
v as DispenseModelType,
|
|
30
|
+
A as DispenserModels,
|
|
31
|
+
g as ExtensionType,
|
|
32
|
+
y as GenericPour,
|
|
33
|
+
O as GenericPourServices,
|
|
34
|
+
$ as HoldToPourIntentStrategy,
|
|
35
|
+
ee as HoldToPourStrategy,
|
|
36
|
+
m as Holder,
|
|
37
|
+
p as HolderContainer,
|
|
38
|
+
se as HolderContainerProvider,
|
|
39
|
+
ae as HolderProvider,
|
|
38
40
|
G as HolderServices,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
I as Ingredient,
|
|
42
|
+
D as IngredientContainer,
|
|
43
|
+
re as IngredientContainerProvider,
|
|
44
|
+
ie as IngredientProvider,
|
|
45
|
+
M as IngredientServices,
|
|
46
|
+
R as KosExtensionManager,
|
|
47
|
+
S as KosModelRegistry,
|
|
46
48
|
c as Nozzle,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
49
|
+
oe as NozzleProvider,
|
|
50
|
+
f as NozzleServices,
|
|
51
|
+
B as PourState,
|
|
52
|
+
T as Pump,
|
|
53
|
+
E as PumpContainer,
|
|
54
|
+
b as PumpIndex,
|
|
55
|
+
te as PumpProvider,
|
|
56
|
+
L as PumpServices,
|
|
57
|
+
x as TOPIC_BOARD_LINKED,
|
|
58
|
+
N as TOPIC_BOARD_UNLINKED,
|
|
59
|
+
ne as TapOrHoldIntentStrategy,
|
|
60
|
+
ue as TapToPourIntentStrategy,
|
|
61
|
+
de as TapToPourStrategy,
|
|
62
|
+
U as getFuelGaugeValue,
|
|
63
|
+
le as initializeCuiKit,
|
|
64
|
+
z as kosModels,
|
|
63
65
|
H as registerDispenseModels,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
66
|
+
Ce as useAssembly,
|
|
67
|
+
Pe as useAssemblyContext,
|
|
68
|
+
ve as useAvailability,
|
|
69
|
+
Ae as useAvailabilityContext,
|
|
70
|
+
ge as useBeverages,
|
|
71
|
+
ye as useBoard,
|
|
72
|
+
me as useBoardContainer,
|
|
73
|
+
pe as useBoardContainerContext,
|
|
74
|
+
Ie as useBoardContext,
|
|
75
|
+
De as useBrands,
|
|
76
|
+
Se as useCuiKit,
|
|
75
77
|
ce as useCuiKitTimers,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
Be as useDefaultCuiKitLifecycle,
|
|
79
|
+
Te as useDeviceAssembly,
|
|
80
|
+
Ee as useDeviceAssemblyContext,
|
|
81
|
+
be as useDispenseLifecycle,
|
|
82
|
+
xe as useFlavors,
|
|
83
|
+
Ne as useGenericPour,
|
|
84
|
+
ze as useHolder,
|
|
83
85
|
He as useHolderContainer,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
_e as useHolderContainerContext,
|
|
87
|
+
he as useHolderContext,
|
|
88
|
+
Ke as useIngredient,
|
|
89
|
+
we as useIngredientContainer,
|
|
90
|
+
Oe as useIngredientContainerContext,
|
|
89
91
|
Ge as useIngredientContext,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
92
|
+
Me as useIngredientPour,
|
|
93
|
+
Re as useNozzle,
|
|
94
|
+
fe as useNozzleContext,
|
|
95
|
+
Le as useNozzlePour,
|
|
96
|
+
Ue as usePourTarget,
|
|
97
|
+
ke as usePumpContext,
|
|
98
|
+
Fe as withAssembly,
|
|
99
|
+
Ve as withBeverage,
|
|
100
|
+
We as withBoard,
|
|
101
|
+
Xe as withBoardContainer,
|
|
102
|
+
Ye as withDeviceAssembly,
|
|
103
|
+
je as withGenericPour,
|
|
102
104
|
qe as withHolder,
|
|
103
105
|
Je as withHolderContainer,
|
|
104
106
|
Qe as withIngredient,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
Ze as withIngredientContainer,
|
|
108
|
+
$e as withNozzle
|
|
107
109
|
};
|
|
108
110
|
//# sourceMappingURL=index.js.map
|
|
@@ -214,7 +214,8 @@ export declare enum ExtensionType {
|
|
|
214
214
|
AssemblyMapper = "kos.assembly.mapper",
|
|
215
215
|
BoardMapper = "kos.board.mapper",
|
|
216
216
|
BoardIndex = "kos.board.index",
|
|
217
|
-
PumpIndex = "kos.pump.index"
|
|
217
|
+
PumpIndex = "kos.pump.index",
|
|
218
|
+
AssemblyFeatureFlags = "kos.assembly.feature.flags"
|
|
218
219
|
}
|
|
219
220
|
export declare enum DispenseModelType {
|
|
220
221
|
Nozzle = "nozzle-model",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-dispense-sdk/src/models/constants/constants.ts"],"names":[],"mappings":"AAAA;;KAEK;AACL,oBAAY,aAAa;IACvB;;;;;;;;;;;;;;;;;;;;;;SAsBK;IACL,gBAAgB,0BAA0B;IAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SA2CK;IACL,gBAAgB,0BAA0B;IAE1C,eAAe,yBAAyB;IACxC;;SAEK;IACL,oBAAoB,+BAA+B;IAEnD;;SAEK;IACL,gBAAgB,2BAA2B;IAE3C,YAAY,sBAAsB;IAElC,WAAW,qBAAqB;IAChC;;;;SAIK;IACL,sBAAsB,iCAAiC;IAEvD;;;;;;;;;;;;;;;;;;;;;;;;;SAyBK;IACL,kBAAkB,4BAA4B;IAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SA6BK;IACL,kBAAkB,4BAA4B;IAE9C;;SAEK;IACL,sBAAsB,iCAAiC;IAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4DG;IACH,cAAc,wBAAwB;IACtC,WAAW,qBAAqB;IAChC,UAAU,oBAAoB;IAC9B,SAAS,mBAAmB;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-dispense-sdk/src/models/constants/constants.ts"],"names":[],"mappings":"AAAA;;KAEK;AACL,oBAAY,aAAa;IACvB;;;;;;;;;;;;;;;;;;;;;;SAsBK;IACL,gBAAgB,0BAA0B;IAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SA2CK;IACL,gBAAgB,0BAA0B;IAE1C,eAAe,yBAAyB;IACxC;;SAEK;IACL,oBAAoB,+BAA+B;IAEnD;;SAEK;IACL,gBAAgB,2BAA2B;IAE3C,YAAY,sBAAsB;IAElC,WAAW,qBAAqB;IAChC;;;;SAIK;IACL,sBAAsB,iCAAiC;IAEvD;;;;;;;;;;;;;;;;;;;;;;;;;SAyBK;IACL,kBAAkB,4BAA4B;IAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SA6BK;IACL,kBAAkB,4BAA4B;IAE9C;;SAEK;IACL,sBAAsB,iCAAiC;IAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4DG;IACH,cAAc,wBAAwB;IACtC,WAAW,qBAAqB;IAChC,UAAU,oBAAoB;IAC9B,SAAS,mBAAmB;IAC5B,oBAAoB,+BAA+B;CACpD;AAED,oBAAY,iBAAiB;IAC3B,MAAM,iBAAiB;IACvB,YAAY,uBAAuB;IACnC,MAAM,iBAAiB;IACvB,eAAe,2BAA2B;IAC1C,mBAAmB,+BAA+B;IAClD,UAAU,qBAAqB;IAC/B,IAAI,eAAe;IACnB,aAAa,yBAAyB;CACvC"}
|