@kosdev-code/kos-dispense-sdk 3.0.28 → 3.0.29
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/.kos.json +7 -0
- package/{dispense-registration-manager-Dtb31fcI.cjs → dispense-registration-manager-CfWgJqfq.cjs} +590 -172
- package/dispense-registration-manager-CfWgJqfq.cjs.map +1 -0
- package/{dispense-registration-manager-Da9CW_cN.js → dispense-registration-manager-DtN0T_JG.js} +623 -205
- package/dispense-registration-manager-DtN0T_JG.js.map +1 -0
- package/{extension-utils-Cfhe358W.cjs → extension-utils-BWYG2dYG.cjs} +2 -2
- package/extension-utils-BWYG2dYG.cjs.map +1 -0
- package/{extension-utils-D_dnBLH6.js → extension-utils-BoXtjU5_.js} +2 -2
- package/extension-utils-BoXtjU5_.js.map +1 -0
- package/index.cjs +7 -5
- package/index.cjs.map +1 -1
- package/index.js +67 -65
- package/index.js.map +1 -1
- package/models/models/assembly/assembly-model.d.ts +8 -0
- package/models/models/assembly/assembly-model.d.ts.map +1 -1
- package/models/models/assembly/assembly-registration.d.ts +2 -0
- package/models/models/assembly/assembly-registration.d.ts.map +1 -1
- package/models/models/assembly/board-utils.d.ts.map +1 -1
- package/models/models/assembly/nozzle-utils.d.ts.map +1 -1
- package/models/models/assembly/pump-utils.d.ts.map +1 -1
- package/models/models/assembly/services/assembly-services.d.ts.map +1 -1
- package/models/models/assembly/types/index.d.ts +6 -0
- package/models/models/availability/availability-model.d.ts +2 -0
- package/models/models/availability/availability-model.d.ts.map +1 -1
- package/models/models/availability/types/index.d.ts +4 -0
- package/models/models/board/board-container-model.d.ts +8 -0
- package/models/models/board/board-container-model.d.ts.map +1 -1
- package/models/models/board/board-container-registration.d.ts +2 -0
- package/models/models/board/board-container-registration.d.ts.map +1 -1
- package/models/models/board/board-registration.d.ts +2 -0
- package/models/models/board/board-registration.d.ts.map +1 -1
- package/models/models/board/types/index.d.ts +12 -0
- package/models/models/cui-kit-state/cui-kit-state-model.d.ts +133 -0
- package/models/models/cui-kit-state/cui-kit-state-model.d.ts.map +1 -0
- package/models/models/cui-kit-state/index.d.ts +4 -0
- package/models/models/cui-kit-state/index.d.ts.map +1 -0
- package/models/models/cui-kit-state/types/index.d.ts +82 -0
- package/models/models/device-assembly/device-assembly-model.d.ts +4 -0
- package/models/models/device-assembly/device-assembly-model.d.ts.map +1 -1
- package/models/models/device-assembly/device-assembly-registration.d.ts +2 -0
- package/models/models/device-assembly/device-assembly-registration.d.ts.map +1 -1
- package/models/models/device-assembly/types/index.d.ts +4 -0
- package/models/models/generic-pour/generic-pour-model.d.ts +16 -0
- package/models/models/generic-pour/generic-pour-model.d.ts.map +1 -1
- package/models/models/generic-pour/generic-pour-registration.d.ts +2 -0
- package/models/models/generic-pour/generic-pour-registration.d.ts.map +1 -1
- package/models/models/generic-pour/types/index.d.ts +4 -0
- package/models/models/holder/holder-model.d.ts +6 -0
- package/models/models/holder/holder-model.d.ts.map +1 -1
- package/models/models/holder/services/holder-services.d.ts.map +1 -1
- package/models/models/holder/types/index.d.ts +6 -0
- package/models/models/holder-container/holder-container-model.d.ts +2 -0
- package/models/models/holder-container/holder-container-model.d.ts.map +1 -1
- package/models/models/holder-container/types/index.d.ts +14 -0
- package/models/models/index.d.ts +1 -0
- package/models/models/index.d.ts.map +1 -1
- package/models/models/ingredient/ingredient-model.d.ts +2 -0
- package/models/models/ingredient/ingredient-model.d.ts.map +1 -1
- package/models/models/ingredient/types/index.d.ts +4 -1
- package/models/models/ingredient-container/ingredient-container-model.d.ts +2 -0
- package/models/models/ingredient-container/ingredient-container-model.d.ts.map +1 -1
- package/models/models/ingredient-container/types/index.d.ts +6 -0
- package/models/models/nozzle/nozzle-model.d.ts +4 -2
- package/models/models/nozzle/nozzle-model.d.ts.map +1 -1
- package/models/models/nozzle/types/index.d.ts +6 -0
- package/models/models/pump/pump-model.d.ts +2 -0
- package/models/models/pump/pump-model.d.ts.map +1 -1
- package/models/models/pump/types/index.d.ts +6 -0
- package/models/models/pump-container/pump-container-model.d.ts +6 -0
- package/models/models/pump-container/pump-container-model.d.ts.map +1 -1
- package/models/models/pump-container/types/index.d.ts +6 -0
- package/models/utils/dispense-registration-manager.d.ts +29 -4
- package/models/utils/dispense-registration-manager.d.ts.map +1 -1
- package/models/utils/extension-utils.d.ts +22 -0
- package/models/utils/extension-utils.d.ts.map +1 -1
- package/models/utils/pour-context.d.ts +8 -0
- package/models/utils/pour-context.d.ts.map +1 -0
- package/models/utils/service.d.ts +1 -1
- package/models/utils/services/dispense/1.6.5/service.d.ts +1 -1
- package/models/utils/services/dispense/1.8.1/service.d.ts +1 -1
- package/models/utils/services/dispense/daily/service.d.ts +1 -1
- package/models.cjs +4 -2
- package/models.cjs.map +1 -1
- package/models.js +17 -15
- package/package.json +2 -2
- package/{pump-provider-uNNMh9uh.cjs → pump-provider-B4WR3LiY.cjs} +402 -443
- package/pump-provider-B4WR3LiY.cjs.map +1 -0
- package/{pump-provider-BQmCKz7S.js → pump-provider-CPUsLke5.js} +448 -489
- package/pump-provider-CPUsLke5.js.map +1 -0
- package/ui/contexts/assembly/assembly-provider.d.ts +8 -0
- package/ui/contexts/assembly/assembly-provider.d.ts.map +1 -1
- package/ui/contexts/availability/availability-provider.d.ts +8 -0
- package/ui/contexts/availability/availability-provider.d.ts.map +1 -1
- package/ui/contexts/board/board-provider.d.ts +8 -0
- package/ui/contexts/board/board-provider.d.ts.map +1 -1
- package/ui/contexts/board-container/board-container-provider.d.ts +8 -0
- package/ui/contexts/board-container/board-container-provider.d.ts.map +1 -1
- package/ui/contexts/cui-kit/cui-kit.d.ts +16 -1
- package/ui/contexts/cui-kit/cui-kit.d.ts.map +1 -1
- package/ui/contexts/device-assembly/device-assembly-provider.d.ts +8 -0
- package/ui/contexts/device-assembly/device-assembly-provider.d.ts.map +1 -1
- package/ui/contexts/holder/holder-provider.d.ts +8 -0
- package/ui/contexts/holder/holder-provider.d.ts.map +1 -1
- package/ui/contexts/holder-container/holder-container-provider.d.ts +8 -0
- package/ui/contexts/holder-container/holder-container-provider.d.ts.map +1 -1
- package/ui/contexts/ingredient/ingredient-provider.d.ts +8 -0
- package/ui/contexts/ingredient/ingredient-provider.d.ts.map +1 -1
- package/ui/contexts/ingredient-container/ingredient-container-provider.d.ts +8 -0
- package/ui/contexts/ingredient-container/ingredient-container-provider.d.ts.map +1 -1
- package/ui/contexts/nozzle/nozzle-provider.d.ts +8 -0
- package/ui/contexts/nozzle/nozzle-provider.d.ts.map +1 -1
- package/ui/contexts/pump/pump-provider.d.ts +8 -0
- package/ui/contexts/pump/pump-provider.d.ts.map +1 -1
- package/ui/hooks/assembly/use-assembly.d.ts +4 -0
- package/ui/hooks/assembly/use-assembly.d.ts.map +1 -1
- package/ui/hooks/assembly/with-assembly.d.ts +4 -0
- package/ui/hooks/assembly/with-assembly.d.ts.map +1 -1
- package/ui/hooks/availability/use-availability.d.ts +4 -0
- package/ui/hooks/availability/use-availability.d.ts.map +1 -1
- package/ui/hooks/board/use-board.d.ts +4 -0
- package/ui/hooks/board/use-board.d.ts.map +1 -1
- package/ui/hooks/board/with-board.d.ts +4 -0
- package/ui/hooks/board/with-board.d.ts.map +1 -1
- package/ui/hooks/board-container/use-board-container.d.ts +4 -0
- package/ui/hooks/board-container/use-board-container.d.ts.map +1 -1
- package/ui/hooks/board-container/with-board-container.d.ts +4 -0
- package/ui/hooks/board-container/with-board-container.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-ambient-attract-timers.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-brands.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-cui-kit.d.ts +50 -5
- package/ui/hooks/cui-kit/use-cui-kit.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-default-cui-kit-lifecycle.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-dispense-timers.d.ts.map +1 -1
- package/ui/hooks/device-assembly/use-device-assembly.d.ts +4 -0
- package/ui/hooks/device-assembly/use-device-assembly.d.ts.map +1 -1
- package/ui/hooks/device-assembly/with-device-assembly.d.ts +4 -0
- package/ui/hooks/device-assembly/with-device-assembly.d.ts.map +1 -1
- package/ui/hooks/generic-pour/use-generic-pour.d.ts +4 -0
- package/ui/hooks/generic-pour/use-generic-pour.d.ts.map +1 -1
- package/ui/hooks/generic-pour/with-generic-pour.d.ts +4 -0
- package/ui/hooks/generic-pour/with-generic-pour.d.ts.map +1 -1
- package/ui/hooks/holder/use-holder.d.ts +4 -0
- package/ui/hooks/holder/use-holder.d.ts.map +1 -1
- package/ui/hooks/holder/with-holder.d.ts +4 -0
- package/ui/hooks/holder/with-holder.d.ts.map +1 -1
- package/ui/hooks/holder-container/use-holder-container.d.ts +4 -0
- package/ui/hooks/holder-container/use-holder-container.d.ts.map +1 -1
- package/ui/hooks/holder-container/with-holder-container.d.ts +4 -0
- package/ui/hooks/holder-container/with-holder-container.d.ts.map +1 -1
- package/ui/hooks/ingredient/use-ingredient-pour.d.ts +7 -1
- package/ui/hooks/ingredient/use-ingredient-pour.d.ts.map +1 -1
- package/ui/hooks/ingredient/use-ingredient.d.ts +4 -0
- package/ui/hooks/ingredient/use-ingredient.d.ts.map +1 -1
- package/ui/hooks/ingredient/with-ingredient.d.ts +4 -0
- package/ui/hooks/ingredient/with-ingredient.d.ts.map +1 -1
- package/ui/hooks/ingredient-container/use-ingredient-container.d.ts +4 -0
- package/ui/hooks/ingredient-container/use-ingredient-container.d.ts.map +1 -1
- package/ui/hooks/ingredient-container/with-ingredient-container.d.ts +4 -0
- package/ui/hooks/ingredient-container/with-ingredient-container.d.ts.map +1 -1
- package/ui/hooks/nozzle/use-nozzle.d.ts +4 -0
- package/ui/hooks/nozzle/use-nozzle.d.ts.map +1 -1
- package/ui/hooks/nozzle/with-nozzle.d.ts +4 -0
- package/ui/hooks/nozzle/with-nozzle.d.ts.map +1 -1
- package/ui/hooks/nozzle-pour/use-nozzle-pour.d.ts +7 -1
- package/ui/hooks/nozzle-pour/use-nozzle-pour.d.ts.map +1 -1
- package/ui/hooks/pour/use-pour.d.ts.map +1 -1
- package/ui/hooks/utils/pour-strategy/hold-to-pour-intent-strategy.d.ts +4 -0
- package/ui/hooks/utils/pour-strategy/hold-to-pour-intent-strategy.d.ts.map +1 -1
- package/ui/hooks/utils/pour-strategy/hold-to-pour-strategy.d.ts +4 -0
- package/ui/hooks/utils/pour-strategy/hold-to-pour-strategy.d.ts.map +1 -1
- package/ui/hooks/utils/pour-strategy/pour-strategy.d.ts +10 -0
- package/ui/hooks/utils/pour-strategy/pour-strategy.d.ts.map +1 -1
- package/ui/hooks/utils/pour-strategy/tap-or-hold-to-pour-intent-strategy.d.ts +4 -0
- package/ui/hooks/utils/pour-strategy/tap-or-hold-to-pour-intent-strategy.d.ts.map +1 -1
- package/ui/hooks/utils/pour-strategy/tap-to-pour-intent-strategy.d.ts +4 -0
- package/ui/hooks/utils/pour-strategy/tap-to-pour-intent-strategy.d.ts.map +1 -1
- package/ui/hooks/utils/pour-strategy/tap-to-pour-strategy.d.ts +4 -0
- package/ui/hooks/utils/pour-strategy/tap-to-pour-strategy.d.ts.map +1 -1
- package/ui/utils/pour-context.d.ts +1 -7
- package/ui/utils/pour-context.d.ts.map +1 -1
- package/ui.cjs +3 -2
- package/ui.cjs.map +1 -1
- package/ui.js +49 -48
- package/ui.js.map +1 -1
- package/dispense-registration-manager-Da9CW_cN.js.map +0 -1
- package/dispense-registration-manager-Dtb31fcI.cjs.map +0 -1
- package/extension-utils-Cfhe358W.cjs.map +0 -1
- package/extension-utils-D_dnBLH6.js.map +0 -1
- package/pump-provider-BQmCKz7S.js.map +0 -1
- package/pump-provider-uNNMh9uh.cjs.map +0 -1
package/{dispense-registration-manager-Dtb31fcI.cjs → dispense-registration-manager-CfWgJqfq.cjs}
RENAMED
|
@@ -31,15 +31,15 @@ var DispenseModelType = /* @__PURE__ */ ((DispenseModelType2) => {
|
|
|
31
31
|
DispenseModelType2["PumpContainer"] = "pump-container-model";
|
|
32
32
|
return DispenseModelType2;
|
|
33
33
|
})(DispenseModelType || {});
|
|
34
|
-
var __getOwnPropDesc$
|
|
35
|
-
var __decorateClass$
|
|
36
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
34
|
+
var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
|
|
35
|
+
var __decorateClass$d = (decorators, target, key, kind) => {
|
|
36
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target;
|
|
37
37
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
38
38
|
if (decorator = decorators[i])
|
|
39
39
|
result = decorator(result) || result;
|
|
40
40
|
return result;
|
|
41
41
|
};
|
|
42
|
-
const MODEL_TYPE$
|
|
42
|
+
const MODEL_TYPE$d = "ingredient-model";
|
|
43
43
|
let IngredientModelImpl = class {
|
|
44
44
|
id;
|
|
45
45
|
ingredientId;
|
|
@@ -76,19 +76,19 @@ let IngredientModelImpl = class {
|
|
|
76
76
|
// -------------------LIFECYCLE----------------------------
|
|
77
77
|
// -------------------ENTITY----------------------------
|
|
78
78
|
};
|
|
79
|
-
IngredientModelImpl = __decorateClass$
|
|
80
|
-
kosUiSdk.kosModel(MODEL_TYPE$
|
|
79
|
+
IngredientModelImpl = __decorateClass$d([
|
|
80
|
+
kosUiSdk.kosModel(MODEL_TYPE$d)
|
|
81
81
|
], IngredientModelImpl);
|
|
82
82
|
const Ingredient = {
|
|
83
83
|
registration: {
|
|
84
|
-
[MODEL_TYPE$
|
|
84
|
+
[MODEL_TYPE$d]: {
|
|
85
85
|
class: IngredientModelImpl,
|
|
86
86
|
singleton: false
|
|
87
87
|
}
|
|
88
88
|
},
|
|
89
|
-
type: MODEL_TYPE$
|
|
90
|
-
predicate: kosUiSdk.isKosModel(MODEL_TYPE$
|
|
91
|
-
factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$
|
|
89
|
+
type: MODEL_TYPE$d,
|
|
90
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$d),
|
|
91
|
+
factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$d)
|
|
92
92
|
};
|
|
93
93
|
const { URL: URL$6 } = kosUiSdk.resolveServiceUrl("INGREDIENT_SERVICE");
|
|
94
94
|
const { getOne: getOne$3 } = kosUiSdk.ServiceFactory.build({
|
|
@@ -100,18 +100,21 @@ const getIngredients = async () => {
|
|
|
100
100
|
});
|
|
101
101
|
return response;
|
|
102
102
|
};
|
|
103
|
-
var __defProp$
|
|
104
|
-
var __getOwnPropDesc$
|
|
105
|
-
var __decorateClass$
|
|
106
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
103
|
+
var __defProp$a = Object.defineProperty;
|
|
104
|
+
var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
|
|
105
|
+
var __decorateClass$c = (decorators, target, key, kind) => {
|
|
106
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
|
|
107
107
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
108
108
|
if (decorator = decorators[i])
|
|
109
109
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
110
|
-
if (kind && result) __defProp$
|
|
110
|
+
if (kind && result) __defProp$a(target, key, result);
|
|
111
111
|
return result;
|
|
112
112
|
};
|
|
113
|
-
const MODEL_TYPE$
|
|
114
|
-
const log$
|
|
113
|
+
const MODEL_TYPE$c = "ingredient-container-model";
|
|
114
|
+
const log$4 = kosUiSdk.KosLog.createLogger({
|
|
115
|
+
group: kosUiSdk.LogGroup.model,
|
|
116
|
+
name: "ingredient-container-model"
|
|
117
|
+
});
|
|
115
118
|
let IngredientContainerModelImpl = class {
|
|
116
119
|
id;
|
|
117
120
|
ingredients;
|
|
@@ -132,7 +135,7 @@ let IngredientContainerModelImpl = class {
|
|
|
132
135
|
return this.ingredients.getIndexByKey("ingredientType", type);
|
|
133
136
|
}
|
|
134
137
|
async load(context) {
|
|
135
|
-
log$
|
|
138
|
+
log$4.debug(`loading ingredient container ${this.id}`);
|
|
136
139
|
const allIngredients = await getIngredients();
|
|
137
140
|
if (allIngredients?.status !== 200) {
|
|
138
141
|
throw new Error("Failed to load ingredients");
|
|
@@ -169,30 +172,30 @@ let IngredientContainerModelImpl = class {
|
|
|
169
172
|
}
|
|
170
173
|
// -------------------ENTITY----------------------------
|
|
171
174
|
};
|
|
172
|
-
__decorateClass$
|
|
175
|
+
__decorateClass$c([
|
|
173
176
|
kosUiSdk.kosChild
|
|
174
177
|
], IngredientContainerModelImpl.prototype, "ingredients", 2);
|
|
175
|
-
IngredientContainerModelImpl = __decorateClass$
|
|
176
|
-
kosUiSdk.kosModel(MODEL_TYPE$
|
|
178
|
+
IngredientContainerModelImpl = __decorateClass$c([
|
|
179
|
+
kosUiSdk.kosModel(MODEL_TYPE$c)
|
|
177
180
|
], IngredientContainerModelImpl);
|
|
178
181
|
const IngredientContainer = {
|
|
179
182
|
registration: {
|
|
180
|
-
[MODEL_TYPE$
|
|
183
|
+
[MODEL_TYPE$c]: {
|
|
181
184
|
class: IngredientContainerModelImpl,
|
|
182
185
|
singleton: true
|
|
183
186
|
}
|
|
184
187
|
},
|
|
185
|
-
type: MODEL_TYPE$
|
|
186
|
-
predicate: kosUiSdk.isKosModel(MODEL_TYPE$
|
|
187
|
-
factory: kosUiSdk.Kos.Singleton.create(MODEL_TYPE$
|
|
188
|
+
type: MODEL_TYPE$c,
|
|
189
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$c),
|
|
190
|
+
factory: kosUiSdk.Kos.Singleton.create(MODEL_TYPE$c)
|
|
188
191
|
};
|
|
189
192
|
const { URL: URL$5 } = kosUiSdk.resolveServiceUrl("HOLDER_SERVICE");
|
|
190
193
|
const { getAll: getAll$1, postModel: postModel$4, deleteModel: deleteModel$2 } = kosUiSdk.ServiceFactory.build({
|
|
191
194
|
basePath: `${URL$5}/api/kos/holders`
|
|
192
195
|
});
|
|
193
|
-
const log$
|
|
194
|
-
|
|
195
|
-
|
|
196
|
+
const log$3 = kosUiSdk.KosLog.createLogger({
|
|
197
|
+
group: kosUiSdk.LogGroup.service,
|
|
198
|
+
name: "holder-service"
|
|
196
199
|
});
|
|
197
200
|
const getHolders = async () => {
|
|
198
201
|
const response = await getAll$1({});
|
|
@@ -220,7 +223,7 @@ const unassignHolderIngredient = async (holderPath) => {
|
|
|
220
223
|
};
|
|
221
224
|
const replaceLine = async (holderPath) => {
|
|
222
225
|
if (!holderPath) throw new Error("Missing holderPath");
|
|
223
|
-
log$
|
|
226
|
+
log$3.debug(
|
|
224
227
|
`sending POST request to /api/ext/dispense/pumpEvents/replaceLine/${holderPath}`
|
|
225
228
|
);
|
|
226
229
|
const response = await postModel$4({
|
|
@@ -274,18 +277,21 @@ const deleteAssignment = async (id) => {
|
|
|
274
277
|
const response = await deleteModel$1({ id, fos: useFos });
|
|
275
278
|
return response;
|
|
276
279
|
};
|
|
277
|
-
var __defProp$
|
|
278
|
-
var __getOwnPropDesc$
|
|
279
|
-
var __decorateClass$
|
|
280
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
280
|
+
var __defProp$9 = Object.defineProperty;
|
|
281
|
+
var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
|
|
282
|
+
var __decorateClass$b = (decorators, target, key, kind) => {
|
|
283
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
|
|
281
284
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
282
285
|
if (decorator = decorators[i])
|
|
283
286
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
284
|
-
if (kind && result) __defProp$
|
|
287
|
+
if (kind && result) __defProp$9(target, key, result);
|
|
285
288
|
return result;
|
|
286
289
|
};
|
|
287
|
-
const MODEL_TYPE$
|
|
288
|
-
const log$
|
|
290
|
+
const MODEL_TYPE$b = DispenseModelType.Holder;
|
|
291
|
+
const log$2 = kosUiSdk.KosLog.createLogger({
|
|
292
|
+
group: kosUiSdk.LogGroup.model,
|
|
293
|
+
name: "holder-model"
|
|
294
|
+
});
|
|
289
295
|
kosUiSdk.ExtensionManager[kosUiSdk.EXTENSION_TROUBLE_MAPPER].register(
|
|
290
296
|
"holder",
|
|
291
297
|
async (trouble) => {
|
|
@@ -562,7 +568,7 @@ let HolderModelImpl = class {
|
|
|
562
568
|
});
|
|
563
569
|
return result;
|
|
564
570
|
} catch (e) {
|
|
565
|
-
log$
|
|
571
|
+
log$2.error(`Failed to perform rfid override on holder ${this.id}`, e);
|
|
566
572
|
throw e;
|
|
567
573
|
}
|
|
568
574
|
}
|
|
@@ -577,7 +583,7 @@ let HolderModelImpl = class {
|
|
|
577
583
|
this.ingredientId = ingredientId;
|
|
578
584
|
});
|
|
579
585
|
} catch (e) {
|
|
580
|
-
log$
|
|
586
|
+
log$2.error(`Failed to perform assign ingredient to holder ${this.id}`, e);
|
|
581
587
|
throw e;
|
|
582
588
|
}
|
|
583
589
|
}
|
|
@@ -611,26 +617,26 @@ let HolderModelImpl = class {
|
|
|
611
617
|
// }
|
|
612
618
|
// -------------------ENTITY----------------------------
|
|
613
619
|
};
|
|
614
|
-
__decorateClass$
|
|
620
|
+
__decorateClass$b([
|
|
615
621
|
kosUiSdk.kosChild
|
|
616
622
|
], HolderModelImpl.prototype, "pumps", 2);
|
|
617
|
-
__decorateClass$
|
|
623
|
+
__decorateClass$b([
|
|
618
624
|
kosUiSdk.kosDependency({ modelType: IngredientContainer.type })
|
|
619
625
|
], HolderModelImpl.prototype, "ingredientContainer", 2);
|
|
620
|
-
HolderModelImpl = __decorateClass$
|
|
621
|
-
kosUiSdk.kosModel(MODEL_TYPE$
|
|
626
|
+
HolderModelImpl = __decorateClass$b([
|
|
627
|
+
kosUiSdk.kosModel(MODEL_TYPE$b),
|
|
622
628
|
kosUiSdk.kosTroubleAware()
|
|
623
629
|
], HolderModelImpl);
|
|
624
630
|
const Holder = {
|
|
625
631
|
registration: {
|
|
626
|
-
[MODEL_TYPE$
|
|
632
|
+
[MODEL_TYPE$b]: {
|
|
627
633
|
class: HolderModelImpl,
|
|
628
634
|
singleton: false
|
|
629
635
|
}
|
|
630
636
|
},
|
|
631
|
-
type: MODEL_TYPE$
|
|
632
|
-
predicate: kosUiSdk.isKosModel(MODEL_TYPE$
|
|
633
|
-
factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$
|
|
637
|
+
type: MODEL_TYPE$b,
|
|
638
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$b),
|
|
639
|
+
factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$b)
|
|
634
640
|
};
|
|
635
641
|
const mapAssemblyHolderToModel = async (group, holderData) => {
|
|
636
642
|
const _ingredientId = kosUiSdk.ExtensionManager.propertyMapper.executeMapper(
|
|
@@ -677,26 +683,26 @@ const { URL: URL$3 } = kosUiSdk.resolveServiceUrl("ASSEMBLY_SERVICE");
|
|
|
677
683
|
const { getOne: getOne$2 } = kosUiSdk.ServiceFactory.build({
|
|
678
684
|
basePath: `${URL$3}/api/kos/device/assemblies`
|
|
679
685
|
});
|
|
680
|
-
const log = kosUiSdk.KosLog.createLogger({
|
|
681
|
-
|
|
682
|
-
|
|
686
|
+
const log$1 = kosUiSdk.KosLog.createLogger({
|
|
687
|
+
group: kosUiSdk.LogGroup.service,
|
|
688
|
+
name: "assembly-service"
|
|
683
689
|
});
|
|
684
690
|
const getAssembly = async () => {
|
|
685
|
-
log.debug("sending GET for assembly");
|
|
691
|
+
log$1.debug("sending GET for assembly");
|
|
686
692
|
const response = await getOne$2({});
|
|
687
693
|
return response;
|
|
688
694
|
};
|
|
689
|
-
var __defProp$
|
|
690
|
-
var __getOwnPropDesc$
|
|
691
|
-
var __decorateClass$
|
|
692
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
695
|
+
var __defProp$8 = Object.defineProperty;
|
|
696
|
+
var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
|
|
697
|
+
var __decorateClass$a = (decorators, target, key, kind) => {
|
|
698
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
|
|
693
699
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
694
700
|
if (decorator = decorators[i])
|
|
695
701
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
696
|
-
if (kind && result) __defProp$
|
|
702
|
+
if (kind && result) __defProp$8(target, key, result);
|
|
697
703
|
return result;
|
|
698
704
|
};
|
|
699
|
-
const MODEL_TYPE$
|
|
705
|
+
const MODEL_TYPE$a = "board-container-model";
|
|
700
706
|
const TOPIC_BOARD_LINKED = "/kos/hardware/board/linked";
|
|
701
707
|
const TOPIC_BOARD_UNLINKED = "/kos/hardware/board/unlinked";
|
|
702
708
|
exports.BoardContainerModel = class BoardContainerModel {
|
|
@@ -750,25 +756,25 @@ exports.BoardContainerModel = class BoardContainerModel {
|
|
|
750
756
|
}
|
|
751
757
|
}
|
|
752
758
|
};
|
|
753
|
-
__decorateClass$
|
|
759
|
+
__decorateClass$a([
|
|
754
760
|
kosUiSdk.kosChild
|
|
755
761
|
], exports.BoardContainerModel.prototype, "models", 2);
|
|
756
|
-
__decorateClass$
|
|
762
|
+
__decorateClass$a([
|
|
757
763
|
kosUiSdk.kosTopicHandler({
|
|
758
764
|
lifecycle: kosUiSdk.DependencyLifecycle.INIT,
|
|
759
765
|
topic: TOPIC_BOARD_LINKED,
|
|
760
766
|
websocket: true
|
|
761
767
|
})
|
|
762
768
|
], exports.BoardContainerModel.prototype, "handleBoardLinkEvent", 1);
|
|
763
|
-
__decorateClass$
|
|
769
|
+
__decorateClass$a([
|
|
764
770
|
kosUiSdk.kosTopicHandler({
|
|
765
771
|
lifecycle: kosUiSdk.DependencyLifecycle.INIT,
|
|
766
772
|
topic: TOPIC_BOARD_UNLINKED,
|
|
767
773
|
websocket: true
|
|
768
774
|
})
|
|
769
775
|
], exports.BoardContainerModel.prototype, "handleBoardUnlinkEvent", 1);
|
|
770
|
-
exports.BoardContainerModel = __decorateClass$
|
|
771
|
-
kosUiSdk.kosModel(MODEL_TYPE$
|
|
776
|
+
exports.BoardContainerModel = __decorateClass$a([
|
|
777
|
+
kosUiSdk.kosModel(MODEL_TYPE$a)
|
|
772
778
|
], exports.BoardContainerModel);
|
|
773
779
|
const boardTroubleDataMapper = async (trouble) => {
|
|
774
780
|
const boardPath = trouble.data.boardPath;
|
|
@@ -777,17 +783,17 @@ const boardTroubleDataMapper = async (trouble) => {
|
|
|
777
783
|
boardName: model?.name || ""
|
|
778
784
|
};
|
|
779
785
|
};
|
|
780
|
-
var __defProp$
|
|
781
|
-
var __getOwnPropDesc$
|
|
782
|
-
var __decorateClass$
|
|
783
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
786
|
+
var __defProp$7 = Object.defineProperty;
|
|
787
|
+
var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
|
|
788
|
+
var __decorateClass$9 = (decorators, target, key, kind) => {
|
|
789
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
|
|
784
790
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
785
791
|
if (decorator = decorators[i])
|
|
786
792
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
787
|
-
if (kind && result) __defProp$
|
|
793
|
+
if (kind && result) __defProp$7(target, key, result);
|
|
788
794
|
return result;
|
|
789
795
|
};
|
|
790
|
-
const MODEL_TYPE$
|
|
796
|
+
const MODEL_TYPE$9 = DispenseModelType.PumpContainer;
|
|
791
797
|
var PumpIndex = /* @__PURE__ */ ((PumpIndex2) => {
|
|
792
798
|
PumpIndex2["byBoard"] = "byBoard";
|
|
793
799
|
PumpIndex2["byType"] = "byType";
|
|
@@ -843,23 +849,23 @@ let PumpContainerModelImpl = class {
|
|
|
843
849
|
}
|
|
844
850
|
// -------------------ENTITY----------------------------
|
|
845
851
|
};
|
|
846
|
-
__decorateClass$
|
|
852
|
+
__decorateClass$9([
|
|
847
853
|
kosUiSdk.kosChild
|
|
848
854
|
], PumpContainerModelImpl.prototype, "pumps", 2);
|
|
849
|
-
PumpContainerModelImpl = __decorateClass$
|
|
850
|
-
kosUiSdk.kosModel(MODEL_TYPE$
|
|
855
|
+
PumpContainerModelImpl = __decorateClass$9([
|
|
856
|
+
kosUiSdk.kosModel(MODEL_TYPE$9)
|
|
851
857
|
], PumpContainerModelImpl);
|
|
852
858
|
const PumpContainer = {
|
|
853
859
|
registration: {
|
|
854
|
-
[MODEL_TYPE$
|
|
860
|
+
[MODEL_TYPE$9]: {
|
|
855
861
|
class: PumpContainerModelImpl,
|
|
856
862
|
singleton: true
|
|
857
863
|
}
|
|
858
864
|
},
|
|
859
|
-
type: MODEL_TYPE$
|
|
860
|
-
predicate: kosUiSdk.isKosModel(MODEL_TYPE$
|
|
865
|
+
type: MODEL_TYPE$9,
|
|
866
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$9),
|
|
861
867
|
factory: kosUiSdk.Kos.Singleton.create(
|
|
862
|
-
MODEL_TYPE$
|
|
868
|
+
MODEL_TYPE$9
|
|
863
869
|
)
|
|
864
870
|
};
|
|
865
871
|
const getPumpRelatedPaths = async (pumpPath) => {
|
|
@@ -903,15 +909,15 @@ const boardTroubleResolver = async (trouble) => {
|
|
|
903
909
|
}
|
|
904
910
|
return Array.from(new Set(result));
|
|
905
911
|
};
|
|
906
|
-
var __getOwnPropDesc$
|
|
907
|
-
var __decorateClass$
|
|
908
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
912
|
+
var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
|
|
913
|
+
var __decorateClass$8 = (decorators, target, key, kind) => {
|
|
914
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
|
|
909
915
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
910
916
|
if (decorator = decorators[i])
|
|
911
917
|
result = decorator(result) || result;
|
|
912
918
|
return result;
|
|
913
919
|
};
|
|
914
|
-
const MODEL_TYPE$
|
|
920
|
+
const MODEL_TYPE$8 = "board-model";
|
|
915
921
|
const mapOptionsToModel = (options, model) => {
|
|
916
922
|
const { type, name, path, linked, instanceId, link, ...rest } = options;
|
|
917
923
|
model.type = type;
|
|
@@ -954,45 +960,45 @@ let BoardModelImpl = class {
|
|
|
954
960
|
this.logger.debug(`loading board ${this.id}`);
|
|
955
961
|
}
|
|
956
962
|
};
|
|
957
|
-
BoardModelImpl = __decorateClass$
|
|
958
|
-
kosUiSdk.kosModel(MODEL_TYPE$
|
|
963
|
+
BoardModelImpl = __decorateClass$8([
|
|
964
|
+
kosUiSdk.kosModel(MODEL_TYPE$8)
|
|
959
965
|
], BoardModelImpl);
|
|
960
966
|
const Board = {
|
|
961
967
|
registration: {
|
|
962
|
-
[MODEL_TYPE$
|
|
968
|
+
[MODEL_TYPE$8]: {
|
|
963
969
|
class: BoardModelImpl,
|
|
964
970
|
singleton: false
|
|
965
971
|
}
|
|
966
972
|
},
|
|
967
|
-
type: MODEL_TYPE$
|
|
968
|
-
predicate: kosUiSdk.isKosModel(MODEL_TYPE$
|
|
969
|
-
factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$
|
|
973
|
+
type: MODEL_TYPE$8,
|
|
974
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$8),
|
|
975
|
+
factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$8)
|
|
970
976
|
};
|
|
971
977
|
const BoardContainer = {
|
|
972
978
|
registration: {
|
|
973
|
-
[MODEL_TYPE$
|
|
979
|
+
[MODEL_TYPE$a]: {
|
|
974
980
|
class: exports.BoardContainerModel,
|
|
975
981
|
singleton: true
|
|
976
982
|
},
|
|
977
983
|
...Board.registration
|
|
978
984
|
},
|
|
979
|
-
type: MODEL_TYPE$
|
|
980
|
-
predicate: kosUiSdk.isKosModel(MODEL_TYPE$
|
|
985
|
+
type: MODEL_TYPE$a,
|
|
986
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$a),
|
|
981
987
|
factory: kosUiSdk.Kos.Singleton.create(
|
|
982
|
-
MODEL_TYPE$
|
|
988
|
+
MODEL_TYPE$a
|
|
983
989
|
)
|
|
984
990
|
};
|
|
985
|
-
var __defProp$
|
|
986
|
-
var __getOwnPropDesc$
|
|
987
|
-
var __decorateClass$
|
|
988
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
991
|
+
var __defProp$6 = Object.defineProperty;
|
|
992
|
+
var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
|
|
993
|
+
var __decorateClass$7 = (decorators, target, key, kind) => {
|
|
994
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
|
|
989
995
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
990
996
|
if (decorator = decorators[i])
|
|
991
997
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
992
|
-
if (kind && result) __defProp$
|
|
998
|
+
if (kind && result) __defProp$6(target, key, result);
|
|
993
999
|
return result;
|
|
994
1000
|
};
|
|
995
|
-
const MODEL_TYPE$
|
|
1001
|
+
const MODEL_TYPE$7 = DispenseModelType.HolderContainer;
|
|
996
1002
|
const TOPIC_INSERT_START = "/kos/insertion/insert/start";
|
|
997
1003
|
const TOPIC_INSERT_COMPLETE = "/kos/insertion/insert/complete";
|
|
998
1004
|
const TOPIC_INSERT_UPDATE = "/kos/insertion/insert/update";
|
|
@@ -1019,7 +1025,11 @@ let HolderContainerModelImpl = class {
|
|
|
1019
1025
|
}
|
|
1020
1026
|
handleHolderEvents(event) {
|
|
1021
1027
|
kosUiSdk.KosLog.ifDebug(
|
|
1022
|
-
() => this.logger.debug(
|
|
1028
|
+
() => this.logger.debug(
|
|
1029
|
+
"Received holder change event",
|
|
1030
|
+
JSON.stringify(event)
|
|
1031
|
+
),
|
|
1032
|
+
this.logger
|
|
1023
1033
|
);
|
|
1024
1034
|
const holder = this.holders.getModel(event.path);
|
|
1025
1035
|
if (holder) {
|
|
@@ -1037,7 +1047,8 @@ let HolderContainerModelImpl = class {
|
|
|
1037
1047
|
}
|
|
1038
1048
|
handleInsertion(data) {
|
|
1039
1049
|
kosUiSdk.KosLog.ifDebug(
|
|
1040
|
-
() => this.logger.debug("Received insertion event", JSON.stringify(data))
|
|
1050
|
+
() => this.logger.debug("Received insertion event", JSON.stringify(data)),
|
|
1051
|
+
this.logger
|
|
1041
1052
|
);
|
|
1042
1053
|
const wrappedData = Array.isArray(data) ? data : [data];
|
|
1043
1054
|
wrappedData.forEach((event) => {
|
|
@@ -1072,17 +1083,17 @@ let HolderContainerModelImpl = class {
|
|
|
1072
1083
|
}
|
|
1073
1084
|
// -------------------ENTITY----------------------------
|
|
1074
1085
|
};
|
|
1075
|
-
__decorateClass$
|
|
1086
|
+
__decorateClass$7([
|
|
1076
1087
|
kosUiSdk.kosChild
|
|
1077
1088
|
], HolderContainerModelImpl.prototype, "holders", 2);
|
|
1078
|
-
__decorateClass$
|
|
1089
|
+
__decorateClass$7([
|
|
1079
1090
|
kosUiSdk.kosTopicHandler({
|
|
1080
1091
|
topic: TOPIC_HOLDER_CHANGED,
|
|
1081
1092
|
websocket: true,
|
|
1082
1093
|
condition: (event, model) => model.holders.getModel(event.path) !== void 0
|
|
1083
1094
|
})
|
|
1084
1095
|
], HolderContainerModelImpl.prototype, "handleHolderEvents", 1);
|
|
1085
|
-
__decorateClass$
|
|
1096
|
+
__decorateClass$7([
|
|
1086
1097
|
kosUiSdk.kosTopicHandler({
|
|
1087
1098
|
topic: [
|
|
1088
1099
|
TOPIC_INSERT_START,
|
|
@@ -1094,23 +1105,26 @@ __decorateClass$6([
|
|
|
1094
1105
|
websocket: true
|
|
1095
1106
|
})
|
|
1096
1107
|
], HolderContainerModelImpl.prototype, "handleInsertion", 1);
|
|
1097
|
-
HolderContainerModelImpl = __decorateClass$
|
|
1098
|
-
kosUiSdk.kosModel(MODEL_TYPE$
|
|
1108
|
+
HolderContainerModelImpl = __decorateClass$7([
|
|
1109
|
+
kosUiSdk.kosModel(MODEL_TYPE$7)
|
|
1099
1110
|
], HolderContainerModelImpl);
|
|
1100
1111
|
const HolderContainer = {
|
|
1101
1112
|
registration: {
|
|
1102
|
-
[MODEL_TYPE$
|
|
1113
|
+
[MODEL_TYPE$7]: {
|
|
1103
1114
|
class: HolderContainerModelImpl,
|
|
1104
1115
|
singleton: true
|
|
1105
1116
|
}
|
|
1106
1117
|
},
|
|
1107
|
-
type: MODEL_TYPE$
|
|
1108
|
-
predicate: kosUiSdk.isKosModel(MODEL_TYPE$
|
|
1118
|
+
type: MODEL_TYPE$7,
|
|
1119
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$7),
|
|
1109
1120
|
factory: kosUiSdk.Kos.Singleton.create(
|
|
1110
|
-
MODEL_TYPE$
|
|
1121
|
+
MODEL_TYPE$7
|
|
1111
1122
|
)
|
|
1112
1123
|
};
|
|
1113
|
-
const Logger$1 = kosUiSdk.KosLog.createLogger({
|
|
1124
|
+
const Logger$1 = kosUiSdk.KosLog.createLogger({
|
|
1125
|
+
group: kosUiSdk.LogGroup.model,
|
|
1126
|
+
name: "board-utils"
|
|
1127
|
+
});
|
|
1114
1128
|
const mapAssemblyBoardToModel = async (board) => {
|
|
1115
1129
|
const boardExtData = await kosUiSdk.KosExtensionUtils.executeDataMapperExtension({
|
|
1116
1130
|
extension: ExtensionType.BoardMapper,
|
|
@@ -1167,17 +1181,18 @@ const getIntentVolume = async (pumpId, intent) => {
|
|
|
1167
1181
|
}
|
|
1168
1182
|
return response.data;
|
|
1169
1183
|
};
|
|
1170
|
-
var __defProp$
|
|
1171
|
-
var __getOwnPropDesc$
|
|
1172
|
-
var __decorateClass$
|
|
1173
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
1184
|
+
var __defProp$5 = Object.defineProperty;
|
|
1185
|
+
var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
|
|
1186
|
+
var __decorateClass$6 = (decorators, target, key, kind) => {
|
|
1187
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
|
|
1174
1188
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1175
1189
|
if (decorator = decorators[i])
|
|
1176
1190
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1177
|
-
if (kind && result) __defProp$
|
|
1191
|
+
if (kind && result) __defProp$5(target, key, result);
|
|
1178
1192
|
return result;
|
|
1179
1193
|
};
|
|
1180
|
-
const
|
|
1194
|
+
const log = kosUiSdk.KosLog.createLogger({ group: kosUiSdk.LogGroup.model, name: "pump-model" });
|
|
1195
|
+
const MODEL_TYPE$6 = DispenseModelType.Pump;
|
|
1181
1196
|
kosUiSdk.ExtensionManager[kosUiSdk.EXTENSION_TROUBLE_MAPPER].register(
|
|
1182
1197
|
"pump",
|
|
1183
1198
|
pumpTroubleResolver
|
|
@@ -1279,7 +1294,7 @@ let PumpModelImpl = class {
|
|
|
1279
1294
|
this.currentState = PourState.IDLE;
|
|
1280
1295
|
});
|
|
1281
1296
|
} else {
|
|
1282
|
-
|
|
1297
|
+
log.warn(`Cannot cancel pour in state ${this.currentState}`);
|
|
1283
1298
|
}
|
|
1284
1299
|
}
|
|
1285
1300
|
get future() {
|
|
@@ -1314,31 +1329,34 @@ let PumpModelImpl = class {
|
|
|
1314
1329
|
throw new Error(`Cannot pour in state ${this.currentState}`);
|
|
1315
1330
|
}
|
|
1316
1331
|
} catch (e) {
|
|
1317
|
-
|
|
1332
|
+
log.error(e);
|
|
1318
1333
|
this.currentState = PourState.IDLE;
|
|
1319
1334
|
throw e;
|
|
1320
1335
|
}
|
|
1321
1336
|
}
|
|
1322
1337
|
// -------------------ENTITY----------------------------
|
|
1323
1338
|
};
|
|
1324
|
-
__decorateClass$
|
|
1339
|
+
__decorateClass$6([
|
|
1325
1340
|
kosUiSdk.kosFuture()
|
|
1326
1341
|
], PumpModelImpl.prototype, "performIntent", 1);
|
|
1327
|
-
PumpModelImpl = __decorateClass$
|
|
1328
|
-
kosUiSdk.kosModel(MODEL_TYPE$
|
|
1342
|
+
PumpModelImpl = __decorateClass$6([
|
|
1343
|
+
kosUiSdk.kosModel(MODEL_TYPE$6)
|
|
1329
1344
|
], PumpModelImpl);
|
|
1330
1345
|
const Pump = {
|
|
1331
1346
|
registration: {
|
|
1332
|
-
[MODEL_TYPE$
|
|
1347
|
+
[MODEL_TYPE$6]: {
|
|
1333
1348
|
class: PumpModelImpl,
|
|
1334
1349
|
singleton: false
|
|
1335
1350
|
}
|
|
1336
1351
|
},
|
|
1337
|
-
type: MODEL_TYPE$
|
|
1338
|
-
predicate: kosUiSdk.isKosModel(MODEL_TYPE$
|
|
1339
|
-
factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$
|
|
1352
|
+
type: MODEL_TYPE$6,
|
|
1353
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$6),
|
|
1354
|
+
factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$6)
|
|
1340
1355
|
};
|
|
1341
|
-
const Logger = kosUiSdk.KosLog.createLogger({
|
|
1356
|
+
const Logger = kosUiSdk.KosLog.createLogger({
|
|
1357
|
+
group: kosUiSdk.LogGroup.model,
|
|
1358
|
+
name: "pump-utils"
|
|
1359
|
+
});
|
|
1342
1360
|
const mapAssemblyPumpToModel = (nozzlePath, pump) => {
|
|
1343
1361
|
const virtual = (pump.pumps ?? []).length > 1;
|
|
1344
1362
|
const options = {
|
|
@@ -1385,17 +1403,17 @@ const assemblyPumpMap = (pumpContainer) => (holderContainer) => (nozzle) => (ass
|
|
|
1385
1403
|
throw error;
|
|
1386
1404
|
}
|
|
1387
1405
|
};
|
|
1388
|
-
var __defProp$
|
|
1389
|
-
var __getOwnPropDesc$
|
|
1390
|
-
var __decorateClass$
|
|
1391
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
1406
|
+
var __defProp$4 = Object.defineProperty;
|
|
1407
|
+
var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
|
|
1408
|
+
var __decorateClass$5 = (decorators, target, key, kind) => {
|
|
1409
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
|
|
1392
1410
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1393
1411
|
if (decorator = decorators[i])
|
|
1394
1412
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1395
|
-
if (kind && result) __defProp$
|
|
1413
|
+
if (kind && result) __defProp$4(target, key, result);
|
|
1396
1414
|
return result;
|
|
1397
1415
|
};
|
|
1398
|
-
const MODEL_TYPE$
|
|
1416
|
+
const MODEL_TYPE$5 = "assembly-model";
|
|
1399
1417
|
const CONTEXT_ASSEMBLY_DATA = "assembly-data";
|
|
1400
1418
|
const CONTEXT_ASSEMBLY_RAW_DATA = "assembly-raw-data";
|
|
1401
1419
|
let AssemblyModelImpl = class {
|
|
@@ -1525,43 +1543,43 @@ let AssemblyModelImpl = class {
|
|
|
1525
1543
|
}
|
|
1526
1544
|
}
|
|
1527
1545
|
};
|
|
1528
|
-
__decorateClass$
|
|
1546
|
+
__decorateClass$5([
|
|
1529
1547
|
kosUiSdk.kosDependency({
|
|
1530
1548
|
modelType: "trouble-container-model"
|
|
1531
1549
|
})
|
|
1532
1550
|
], AssemblyModelImpl.prototype, "troubleContainer", 2);
|
|
1533
|
-
__decorateClass$
|
|
1551
|
+
__decorateClass$5([
|
|
1534
1552
|
kosUiSdk.kosChild
|
|
1535
1553
|
], AssemblyModelImpl.prototype, "holderContainer", 2);
|
|
1536
|
-
__decorateClass$
|
|
1554
|
+
__decorateClass$5([
|
|
1537
1555
|
kosUiSdk.kosChild
|
|
1538
1556
|
], AssemblyModelImpl.prototype, "boardContainer", 2);
|
|
1539
|
-
__decorateClass$
|
|
1557
|
+
__decorateClass$5([
|
|
1540
1558
|
kosUiSdk.kosChild
|
|
1541
1559
|
], AssemblyModelImpl.prototype, "pumpContainer", 2);
|
|
1542
|
-
AssemblyModelImpl = __decorateClass$
|
|
1543
|
-
kosUiSdk.kosModel(MODEL_TYPE$
|
|
1560
|
+
AssemblyModelImpl = __decorateClass$5([
|
|
1561
|
+
kosUiSdk.kosModel(MODEL_TYPE$5)
|
|
1544
1562
|
], AssemblyModelImpl);
|
|
1545
1563
|
const Assembly = {
|
|
1546
1564
|
registration: {
|
|
1547
|
-
[MODEL_TYPE$
|
|
1565
|
+
[MODEL_TYPE$5]: {
|
|
1548
1566
|
class: AssemblyModelImpl,
|
|
1549
1567
|
singleton: true
|
|
1550
1568
|
}
|
|
1551
1569
|
},
|
|
1552
|
-
type: MODEL_TYPE$
|
|
1553
|
-
predicate: kosUiSdk.isKosModel(MODEL_TYPE$
|
|
1554
|
-
factory: kosUiSdk.Kos.Singleton.create(MODEL_TYPE$
|
|
1570
|
+
type: MODEL_TYPE$5,
|
|
1571
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$5),
|
|
1572
|
+
factory: kosUiSdk.Kos.Singleton.create(MODEL_TYPE$5)
|
|
1555
1573
|
};
|
|
1556
|
-
var __getOwnPropDesc$
|
|
1557
|
-
var __decorateClass$
|
|
1558
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
1574
|
+
var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
|
|
1575
|
+
var __decorateClass$4 = (decorators, target, key, kind) => {
|
|
1576
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
|
|
1559
1577
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1560
1578
|
if (decorator = decorators[i])
|
|
1561
1579
|
result = decorator(result) || result;
|
|
1562
1580
|
return result;
|
|
1563
1581
|
};
|
|
1564
|
-
const MODEL_TYPE$
|
|
1582
|
+
const MODEL_TYPE$4 = DispenseModelType.Availability;
|
|
1565
1583
|
let AvailabilityModelImpl = class {
|
|
1566
1584
|
id;
|
|
1567
1585
|
data;
|
|
@@ -1607,23 +1625,38 @@ let AvailabilityModelImpl = class {
|
|
|
1607
1625
|
// -------------------LIFECYCLE----------------------------
|
|
1608
1626
|
// -------------------ENTITY----------------------------
|
|
1609
1627
|
};
|
|
1610
|
-
AvailabilityModelImpl = __decorateClass$
|
|
1628
|
+
AvailabilityModelImpl = __decorateClass$4([
|
|
1611
1629
|
kosUiSdk.kosParentAware(),
|
|
1612
|
-
kosUiSdk.kosModel(MODEL_TYPE$
|
|
1630
|
+
kosUiSdk.kosModel(MODEL_TYPE$4)
|
|
1613
1631
|
], AvailabilityModelImpl);
|
|
1614
1632
|
const Availability = {
|
|
1615
1633
|
registration: {
|
|
1616
|
-
[MODEL_TYPE$
|
|
1634
|
+
[MODEL_TYPE$4]: {
|
|
1617
1635
|
class: AvailabilityModelImpl,
|
|
1618
1636
|
singleton: false
|
|
1619
1637
|
}
|
|
1620
1638
|
},
|
|
1621
|
-
type: MODEL_TYPE$
|
|
1622
|
-
predicate: kosUiSdk.isKosModel(MODEL_TYPE$
|
|
1639
|
+
type: MODEL_TYPE$4,
|
|
1640
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$4),
|
|
1623
1641
|
factory: kosUiSdk.Kos.Factory.create(
|
|
1624
|
-
MODEL_TYPE$
|
|
1642
|
+
MODEL_TYPE$4
|
|
1625
1643
|
)
|
|
1626
1644
|
};
|
|
1645
|
+
class PourContext {
|
|
1646
|
+
_data = /* @__PURE__ */ new Map();
|
|
1647
|
+
get(key) {
|
|
1648
|
+
return this._data.get(key);
|
|
1649
|
+
}
|
|
1650
|
+
set(key, value) {
|
|
1651
|
+
this._data.set(key, value);
|
|
1652
|
+
}
|
|
1653
|
+
remove(key) {
|
|
1654
|
+
this._data.delete(key);
|
|
1655
|
+
}
|
|
1656
|
+
has(key) {
|
|
1657
|
+
return this._data.has(key);
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1627
1660
|
const { URL: URL$1 } = kosUiSdk.resolveServiceUrl("NOZZLE_SERVICE");
|
|
1628
1661
|
const { postModel: postModel$1, deleteModel, getOne } = kosUiSdk.ServiceFactory.build({
|
|
1629
1662
|
basePath: `${URL$1}/api/nozzle`
|
|
@@ -1672,17 +1705,17 @@ const clearPourable = async (nozzleId) => {
|
|
|
1672
1705
|
});
|
|
1673
1706
|
return response;
|
|
1674
1707
|
};
|
|
1675
|
-
var __defProp$
|
|
1676
|
-
var __getOwnPropDesc$
|
|
1677
|
-
var __decorateClass$
|
|
1678
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
1708
|
+
var __defProp$3 = Object.defineProperty;
|
|
1709
|
+
var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
|
|
1710
|
+
var __decorateClass$3 = (decorators, target, key, kind) => {
|
|
1711
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
|
|
1679
1712
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1680
1713
|
if (decorator = decorators[i])
|
|
1681
1714
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1682
|
-
if (kind && result) __defProp$
|
|
1715
|
+
if (kind && result) __defProp$3(target, key, result);
|
|
1683
1716
|
return result;
|
|
1684
1717
|
};
|
|
1685
|
-
const MODEL_TYPE$
|
|
1718
|
+
const MODEL_TYPE$3 = DispenseModelType.Nozzle;
|
|
1686
1719
|
const PROP_BEVERAGE_TOPIC_PREFIX = kosUiSdk.createPropKey(
|
|
1687
1720
|
"beverageTopicPrefix"
|
|
1688
1721
|
);
|
|
@@ -2152,42 +2185,42 @@ let NozzleModelImpl = class {
|
|
|
2152
2185
|
}
|
|
2153
2186
|
// -------------------ENTITY----------------------------
|
|
2154
2187
|
};
|
|
2155
|
-
__decorateClass$
|
|
2188
|
+
__decorateClass$3([
|
|
2156
2189
|
kosUiSdk.kosChild
|
|
2157
2190
|
], NozzleModelImpl.prototype, "_availabilityItems", 2);
|
|
2158
|
-
__decorateClass$
|
|
2191
|
+
__decorateClass$3([
|
|
2159
2192
|
kosUiSdk.kosStateEntry(PourState.POURING)
|
|
2160
2193
|
], NozzleModelImpl.prototype, "handlePouringStart", 1);
|
|
2161
|
-
__decorateClass$
|
|
2194
|
+
__decorateClass$3([
|
|
2162
2195
|
kosUiSdk.kosStateExit(PourState.POURING)
|
|
2163
2196
|
], NozzleModelImpl.prototype, "handlePouringEnd", 1);
|
|
2164
|
-
__decorateClass$
|
|
2197
|
+
__decorateClass$3([
|
|
2165
2198
|
kosUiSdk.kosStateEntry(PourState.POUR_CANCELING)
|
|
2166
2199
|
], NozzleModelImpl.prototype, "handleCancelStart", 1);
|
|
2167
|
-
__decorateClass$
|
|
2200
|
+
__decorateClass$3([
|
|
2168
2201
|
kosUiSdk.kosStateExit(PourState.POUR_CANCELING)
|
|
2169
2202
|
], NozzleModelImpl.prototype, "handleCanceled", 1);
|
|
2170
|
-
__decorateClass$
|
|
2203
|
+
__decorateClass$3([
|
|
2171
2204
|
kosUiSdk.kosFuture(),
|
|
2172
2205
|
kosUiSdk.kosStateGuard({ allowedStates: [PourState.IDLE] })
|
|
2173
2206
|
], NozzleModelImpl.prototype, "pour", 1);
|
|
2174
|
-
__decorateClass$
|
|
2207
|
+
__decorateClass$3([
|
|
2175
2208
|
kosUiSdk.kosFuture(),
|
|
2176
2209
|
kosUiSdk.kosStateGuard({ allowedStates: [PourState.IDLE] })
|
|
2177
2210
|
], NozzleModelImpl.prototype, "fixedPour", 1);
|
|
2178
|
-
__decorateClass$
|
|
2211
|
+
__decorateClass$3([
|
|
2179
2212
|
kosUiSdk.kosStateGuard({
|
|
2180
2213
|
allowedStates: [PourState.POUR_STARTING, PourState.POURING]
|
|
2181
2214
|
})
|
|
2182
2215
|
], NozzleModelImpl.prototype, "cancelPour", 1);
|
|
2183
|
-
__decorateClass$
|
|
2216
|
+
__decorateClass$3([
|
|
2184
2217
|
kosUiSdk.kosTopicHandler({
|
|
2185
2218
|
topic: `${PROP_BEVERAGE_TOPIC_PREFIX}/availability`,
|
|
2186
2219
|
websocket: true
|
|
2187
2220
|
})
|
|
2188
2221
|
], NozzleModelImpl.prototype, "updateAvailability", 1);
|
|
2189
|
-
NozzleModelImpl = __decorateClass$
|
|
2190
|
-
kosUiSdk.kosModel({ modelTypeId: MODEL_TYPE$
|
|
2222
|
+
NozzleModelImpl = __decorateClass$3([
|
|
2223
|
+
kosUiSdk.kosModel({ modelTypeId: MODEL_TYPE$3, singleton: false }),
|
|
2191
2224
|
kosUiSdk.kosLoggerAware(),
|
|
2192
2225
|
kosUiSdk.kosStateMachine(
|
|
2193
2226
|
{
|
|
@@ -2228,15 +2261,391 @@ NozzleModelImpl = __decorateClass$2([
|
|
|
2228
2261
|
], NozzleModelImpl);
|
|
2229
2262
|
const Nozzle = {
|
|
2230
2263
|
registration: {
|
|
2231
|
-
[MODEL_TYPE$
|
|
2264
|
+
[MODEL_TYPE$3]: {
|
|
2232
2265
|
class: NozzleModelImpl,
|
|
2233
2266
|
singleton: false
|
|
2234
2267
|
}
|
|
2235
2268
|
},
|
|
2236
|
-
type: MODEL_TYPE$
|
|
2237
|
-
predicate: kosUiSdk.isKosModel(MODEL_TYPE$
|
|
2238
|
-
factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$
|
|
2269
|
+
type: MODEL_TYPE$3,
|
|
2270
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$3),
|
|
2271
|
+
factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$3)
|
|
2239
2272
|
};
|
|
2273
|
+
var __defProp$2 = Object.defineProperty;
|
|
2274
|
+
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
2275
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2276
|
+
var __decorateClass$2 = (decorators, target, key, kind) => {
|
|
2277
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
|
|
2278
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2279
|
+
if (decorator = decorators[i])
|
|
2280
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2281
|
+
if (kind && result) __defProp$2(target, key, result);
|
|
2282
|
+
return result;
|
|
2283
|
+
};
|
|
2284
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
|
|
2285
|
+
const MODEL_TYPE$2 = "cui-kit-state-model";
|
|
2286
|
+
const MODEL_CONFIG = {
|
|
2287
|
+
modelTypeId: MODEL_TYPE$2,
|
|
2288
|
+
singleton: false
|
|
2289
|
+
};
|
|
2290
|
+
const cuiKitId = (nozzlePath) => `cui-kit:${nozzlePath}`;
|
|
2291
|
+
let CuiKitStateModelImpl = class {
|
|
2292
|
+
id;
|
|
2293
|
+
nozzlePath;
|
|
2294
|
+
initialGroup;
|
|
2295
|
+
steps;
|
|
2296
|
+
companionTypes;
|
|
2297
|
+
currentGroup;
|
|
2298
|
+
selectedBrand = null;
|
|
2299
|
+
selectedBeverage = null;
|
|
2300
|
+
selectedFlavors = [];
|
|
2301
|
+
pourStrategy;
|
|
2302
|
+
onPourComplete;
|
|
2303
|
+
/** Data passed to the before-pour gate; carries `selectedBeverage`. */
|
|
2304
|
+
pourContext = new PourContext();
|
|
2305
|
+
/** The target of the last pour the kit started. */
|
|
2306
|
+
activeTarget;
|
|
2307
|
+
beforePour;
|
|
2308
|
+
pressCount = 0;
|
|
2309
|
+
released = true;
|
|
2310
|
+
lastPourState;
|
|
2311
|
+
lastPourError;
|
|
2312
|
+
nozzle;
|
|
2313
|
+
constructor(modelId, options) {
|
|
2314
|
+
this.id = modelId;
|
|
2315
|
+
this.nozzlePath = options.nozzlePath;
|
|
2316
|
+
this.initialGroup = options.initialGroup ?? "brands";
|
|
2317
|
+
this.steps = options.steps;
|
|
2318
|
+
this.companionTypes = options.companionTypes ?? {};
|
|
2319
|
+
this.pourStrategy = options.pour?.strategy;
|
|
2320
|
+
this.onPourComplete = options.onPourComplete;
|
|
2321
|
+
this.currentGroup = this.firstGroup;
|
|
2322
|
+
if (options.steps && options.initialGroup) {
|
|
2323
|
+
throw new Error(
|
|
2324
|
+
"CUI Kit: pass steps or initialGroup, not both (initialGroup is replaced by steps.brands)"
|
|
2325
|
+
);
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2328
|
+
updateModel(options) {
|
|
2329
|
+
this.companionTypes = options.companionTypes ?? {};
|
|
2330
|
+
}
|
|
2331
|
+
// -------------------STEPS----------------------------
|
|
2332
|
+
/** The steps shown, in order. */
|
|
2333
|
+
get enabledSteps() {
|
|
2334
|
+
if (!this.steps) {
|
|
2335
|
+
return this.initialGroup === "brands" ? ["brands", "beverages", "flavors"] : ["beverages", "flavors"];
|
|
2336
|
+
}
|
|
2337
|
+
return [
|
|
2338
|
+
...this.steps.brands ? ["brands"] : [],
|
|
2339
|
+
"beverages",
|
|
2340
|
+
...this.steps.flavors ? ["flavors"] : [],
|
|
2341
|
+
...this.steps.pour ? ["pour"] : []
|
|
2342
|
+
];
|
|
2343
|
+
}
|
|
2344
|
+
/** The step navigation starts at and `home()` returns to. */
|
|
2345
|
+
get firstGroup() {
|
|
2346
|
+
if (!this.steps) return this.initialGroup;
|
|
2347
|
+
return this.steps.brands ? "brands" : "beverages";
|
|
2348
|
+
}
|
|
2349
|
+
/** The step `back()` moves to, or undefined when there is none. */
|
|
2350
|
+
get previousGroup() {
|
|
2351
|
+
if (!this.steps) {
|
|
2352
|
+
return this.currentGroup === "brands" ? void 0 : this.initialGroup;
|
|
2353
|
+
}
|
|
2354
|
+
const steps = this.enabledSteps;
|
|
2355
|
+
const index = steps.indexOf(this.currentGroup);
|
|
2356
|
+
return index > 0 ? steps[index - 1] : void 0;
|
|
2357
|
+
}
|
|
2358
|
+
get canBack() {
|
|
2359
|
+
return this.previousGroup !== void 0;
|
|
2360
|
+
}
|
|
2361
|
+
// -------------------LISTS----------------------------
|
|
2362
|
+
get brands() {
|
|
2363
|
+
return this.nozzle?.visibleBrands ?? [];
|
|
2364
|
+
}
|
|
2365
|
+
/** Whether the kit shows a brands step; without `steps` it follows `initialGroup`. */
|
|
2366
|
+
get hasBrands() {
|
|
2367
|
+
return this.enabledSteps.includes("brands");
|
|
2368
|
+
}
|
|
2369
|
+
get beverages() {
|
|
2370
|
+
if (!this.nozzle) return [];
|
|
2371
|
+
const brand = this.steps && !this.hasBrands ? void 0 : this.nozzle.selectedBrand;
|
|
2372
|
+
const items = brand ? this.nozzle.getAvailabilityByParent(brand.id) : this.nozzle.getGroupAvailabilityItems("beverages");
|
|
2373
|
+
return items.filter((item) => item.visible);
|
|
2374
|
+
}
|
|
2375
|
+
get flavors() {
|
|
2376
|
+
return this.nozzle?.getGroupAvailabilityItems("flavors").filter((flavor) => flavor.visible) ?? [];
|
|
2377
|
+
}
|
|
2378
|
+
get brandCompanions() {
|
|
2379
|
+
return this.companionsOf(this.brands, this.companionTypes.brand);
|
|
2380
|
+
}
|
|
2381
|
+
get beverageCompanions() {
|
|
2382
|
+
return this.companionsOf(this.beverages, this.companionTypes.beverage);
|
|
2383
|
+
}
|
|
2384
|
+
get flavorCompanions() {
|
|
2385
|
+
return this.companionsOf(this.flavors, this.companionTypes.flavor);
|
|
2386
|
+
}
|
|
2387
|
+
companionsOf(models, type) {
|
|
2388
|
+
if (!type) return [];
|
|
2389
|
+
return models.map((model) => kosUiSdk.getKosCompanionModel(model, type));
|
|
2390
|
+
}
|
|
2391
|
+
// -------------------SELECTION----------------------------
|
|
2392
|
+
selectBrand(brand, context) {
|
|
2393
|
+
this.selectedBrand = brand;
|
|
2394
|
+
this.nozzle?.setSelectedBrand(brand, context);
|
|
2395
|
+
this.currentGroup = "beverages";
|
|
2396
|
+
this.publish("brand/selected", brand);
|
|
2397
|
+
}
|
|
2398
|
+
clearBrand() {
|
|
2399
|
+
this.selectedBrand = null;
|
|
2400
|
+
this.nozzle?.setSelectedBrand(void 0);
|
|
2401
|
+
this.publish("brand/cleared", {});
|
|
2402
|
+
}
|
|
2403
|
+
async selectBeverage(beverage, context, forceUpdate) {
|
|
2404
|
+
this.selectedBeverage = beverage;
|
|
2405
|
+
this.pourContext.set("selectedBeverage", beverage);
|
|
2406
|
+
await this.nozzle?.setSelectedPourable({ beverage, context }, forceUpdate);
|
|
2407
|
+
if (!this.steps || this.steps.flavors) {
|
|
2408
|
+
this.currentGroup = "flavors";
|
|
2409
|
+
}
|
|
2410
|
+
this.publish("beverage/selected", beverage);
|
|
2411
|
+
}
|
|
2412
|
+
async clearBeverage() {
|
|
2413
|
+
this.selectedBeverage = null;
|
|
2414
|
+
this.pourContext.remove("selectedBeverage");
|
|
2415
|
+
await this.nozzle?.setSelectedPourable({ beverage: void 0 });
|
|
2416
|
+
this.publish("beverage/cleared", {});
|
|
2417
|
+
}
|
|
2418
|
+
/** Toggles a flavor and sends the beverage with the resulting flavors to the nozzle. */
|
|
2419
|
+
async selectFlavor(flavor, context, forceUpdate) {
|
|
2420
|
+
const flavors = this.selectedFlavors.includes(flavor) ? this.selectedFlavors.filter((selected) => selected !== flavor) : [...this.selectedFlavors, flavor];
|
|
2421
|
+
this.selectedFlavors = flavors;
|
|
2422
|
+
const beverage = this.nozzle?.selectedPourable.beverage;
|
|
2423
|
+
if (beverage) {
|
|
2424
|
+
await this.nozzle.setSelectedPourable(
|
|
2425
|
+
{ beverage, additional: flavors, context },
|
|
2426
|
+
forceUpdate
|
|
2427
|
+
);
|
|
2428
|
+
}
|
|
2429
|
+
this.publish("flavor/selected", flavor);
|
|
2430
|
+
}
|
|
2431
|
+
async clearFlavors() {
|
|
2432
|
+
this.selectedFlavors = [];
|
|
2433
|
+
const beverage = this.nozzle?.selectedPourable.beverage;
|
|
2434
|
+
if (beverage) {
|
|
2435
|
+
await this.nozzle.setSelectedPourable({ beverage });
|
|
2436
|
+
this.publish("flavor/cleared", {});
|
|
2437
|
+
}
|
|
2438
|
+
}
|
|
2439
|
+
// -------------------NAVIGATION----------------------------
|
|
2440
|
+
/** Moves to the previous step. Without `steps`, returns to the start and clears brand and beverage. */
|
|
2441
|
+
back() {
|
|
2442
|
+
if (!this.steps) {
|
|
2443
|
+
if (this.currentGroup !== "brands") {
|
|
2444
|
+
this.currentGroup = this.initialGroup;
|
|
2445
|
+
}
|
|
2446
|
+
void this.clearBeverage();
|
|
2447
|
+
this.clearBrand();
|
|
2448
|
+
return;
|
|
2449
|
+
}
|
|
2450
|
+
const previous = this.previousGroup;
|
|
2451
|
+
if (previous) {
|
|
2452
|
+
this.currentGroup = previous;
|
|
2453
|
+
}
|
|
2454
|
+
}
|
|
2455
|
+
/** Returns to the first step and clears the selections. */
|
|
2456
|
+
home() {
|
|
2457
|
+
this.publish("home", {});
|
|
2458
|
+
this.currentGroup = this.firstGroup;
|
|
2459
|
+
if (this.steps) {
|
|
2460
|
+
void this.clearFlavors();
|
|
2461
|
+
void this.clearBeverage();
|
|
2462
|
+
if (this.steps.brands) this.clearBrand();
|
|
2463
|
+
return;
|
|
2464
|
+
}
|
|
2465
|
+
void this.clearBeverage();
|
|
2466
|
+
if (this.initialGroup === "brands") {
|
|
2467
|
+
this.clearBrand();
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
/** Number of `useCuiKit` hooks attached to this kit. */
|
|
2471
|
+
attached = 0;
|
|
2472
|
+
/**
|
|
2473
|
+
* Attaches a `useCuiKit` hook. A nozzle has one kit hook; components read it through
|
|
2474
|
+
* the kit's context. Returns false, and logs an error, for a second hook.
|
|
2475
|
+
*/
|
|
2476
|
+
attach() {
|
|
2477
|
+
this.attached += 1;
|
|
2478
|
+
if (this.attached > 1) {
|
|
2479
|
+
this.logger.error(
|
|
2480
|
+
`useCuiKit is mounted ${this.attached} times for nozzle ${this.nozzlePath}; read the kit with the useCuiKitContext hook returned by initializeCuiKit`
|
|
2481
|
+
);
|
|
2482
|
+
return false;
|
|
2483
|
+
}
|
|
2484
|
+
return true;
|
|
2485
|
+
}
|
|
2486
|
+
detach() {
|
|
2487
|
+
this.attached = Math.max(0, this.attached - 1);
|
|
2488
|
+
}
|
|
2489
|
+
/**
|
|
2490
|
+
* Returns the kit to the first step with nothing selected, as a newly mounted kit
|
|
2491
|
+
* starts. The nozzle's own selection is left as it is.
|
|
2492
|
+
*/
|
|
2493
|
+
reset() {
|
|
2494
|
+
this.currentGroup = this.firstGroup;
|
|
2495
|
+
this.selectedBrand = null;
|
|
2496
|
+
this.selectedBeverage = null;
|
|
2497
|
+
this.selectedFlavors = [];
|
|
2498
|
+
this.pourContext.remove("selectedBeverage");
|
|
2499
|
+
}
|
|
2500
|
+
/**
|
|
2501
|
+
* Moves to the pour step. Only available when `steps.pour` is on. With `start`, also
|
|
2502
|
+
* starts a pour; ignored, with a warning, when the pour needs a held button.
|
|
2503
|
+
*/
|
|
2504
|
+
toPour(options = {}) {
|
|
2505
|
+
if (!this.steps?.pour) {
|
|
2506
|
+
this.logger.warn("toPour() ignored: the pour step is not enabled");
|
|
2507
|
+
return;
|
|
2508
|
+
}
|
|
2509
|
+
this.currentGroup = "pour";
|
|
2510
|
+
if (!options.start) return;
|
|
2511
|
+
if (!options.fixedPourName && this.strategyFor(options)?.requiresHold) {
|
|
2512
|
+
this.logger.warn(
|
|
2513
|
+
"toPour({ start: true }) ignored: the pour strategy needs a held button"
|
|
2514
|
+
);
|
|
2515
|
+
return;
|
|
2516
|
+
}
|
|
2517
|
+
void this.startPour(options);
|
|
2518
|
+
}
|
|
2519
|
+
// -------------------POUR----------------------------
|
|
2520
|
+
/** Sets the before-pour gate the kit calls before every pour. */
|
|
2521
|
+
setBeforePour(callback) {
|
|
2522
|
+
this.beforePour = callback;
|
|
2523
|
+
}
|
|
2524
|
+
/** Starts a pour without a gesture (a click-to-pour button or an automated pour). */
|
|
2525
|
+
startPour(options = {}) {
|
|
2526
|
+
return this.runPour(options, false);
|
|
2527
|
+
}
|
|
2528
|
+
/** The press half of a pour gesture; `releasePour` is the release. */
|
|
2529
|
+
pressPour(options = {}) {
|
|
2530
|
+
return this.runPour(options, true);
|
|
2531
|
+
}
|
|
2532
|
+
/** The release half of a pour gesture. */
|
|
2533
|
+
releasePour(options = {}) {
|
|
2534
|
+
this.released = true;
|
|
2535
|
+
const target = options.target ?? this.nozzle;
|
|
2536
|
+
const ended = this.strategyFor(options)?.initiateEnded?.(target);
|
|
2537
|
+
void Promise.resolve(ended).then((keepPouring) => {
|
|
2538
|
+
if (keepPouring !== true) {
|
|
2539
|
+
this.publish("pour/cancel", {});
|
|
2540
|
+
}
|
|
2541
|
+
});
|
|
2542
|
+
}
|
|
2543
|
+
/** Cancels the pour the kit started last. */
|
|
2544
|
+
async cancelPour() {
|
|
2545
|
+
await (this.activeTarget ?? this.nozzle)?.cancelPour();
|
|
2546
|
+
this.publish("pour/cancel", {});
|
|
2547
|
+
}
|
|
2548
|
+
/** The pour target whose state the kit reports: the last one poured, else the nozzle. */
|
|
2549
|
+
get pourTarget() {
|
|
2550
|
+
return this.activeTarget ?? this.nozzle;
|
|
2551
|
+
}
|
|
2552
|
+
strategyFor(options) {
|
|
2553
|
+
return options.strategy ?? this.pourStrategy;
|
|
2554
|
+
}
|
|
2555
|
+
/**
|
|
2556
|
+
* select → prepare → before-pour gate → pour. While the target is pouring nothing is
|
|
2557
|
+
* selected; for a gesture, a release before the pour starts stops the sequence.
|
|
2558
|
+
*/
|
|
2559
|
+
async runPour(options, gesture) {
|
|
2560
|
+
const press = ++this.pressCount;
|
|
2561
|
+
this.released = false;
|
|
2562
|
+
const target = options.target ?? this.nozzle;
|
|
2563
|
+
const strategy = this.strategyFor(options);
|
|
2564
|
+
if (!target || !strategy && !options.fixedPourName) {
|
|
2565
|
+
this.logger.error("pour ignored: no pour target or strategy");
|
|
2566
|
+
return false;
|
|
2567
|
+
}
|
|
2568
|
+
const releasedEarly = () => gesture && (this.released || press !== this.pressCount);
|
|
2569
|
+
if (options.select && !target.isPouring) {
|
|
2570
|
+
await this.selectForPour(options.select);
|
|
2571
|
+
}
|
|
2572
|
+
if (releasedEarly()) return false;
|
|
2573
|
+
await options.prepare?.(this.pourContext);
|
|
2574
|
+
if (releasedEarly()) return false;
|
|
2575
|
+
this.publish("pre/pour", {});
|
|
2576
|
+
await this.beforePour?.(this.pourContext) || true;
|
|
2577
|
+
if (releasedEarly()) return false;
|
|
2578
|
+
this.activeTarget = target;
|
|
2579
|
+
this.lastPourError = void 0;
|
|
2580
|
+
const started = options.fixedPourName ? this.nozzle.fixedPour(options.fixedPourName) : strategy?.initiate(target);
|
|
2581
|
+
void Promise.resolve(started).catch((error) => {
|
|
2582
|
+
this.lastPourError = error;
|
|
2583
|
+
this.logger.error(`pour failed: ${error}`);
|
|
2584
|
+
});
|
|
2585
|
+
this.publish("pour", {});
|
|
2586
|
+
return true;
|
|
2587
|
+
}
|
|
2588
|
+
/**
|
|
2589
|
+
* Selects a beverage, and its brand first when the kit has a brands step, and waits
|
|
2590
|
+
* for the nozzle.
|
|
2591
|
+
*/
|
|
2592
|
+
async selectForPour(beverage) {
|
|
2593
|
+
const brand = this.hasBrands ? this.nozzle?.brands.find((b) => b.id === beverage.parentId) : void 0;
|
|
2594
|
+
if (brand && this.selectedBrand !== brand) {
|
|
2595
|
+
this.selectBrand(brand);
|
|
2596
|
+
}
|
|
2597
|
+
if (this.selectedBeverage !== beverage) {
|
|
2598
|
+
await this.selectBeverage(beverage);
|
|
2599
|
+
}
|
|
2600
|
+
}
|
|
2601
|
+
trackPourCompletion() {
|
|
2602
|
+
const state = this.pourTarget?.currentState;
|
|
2603
|
+
const previous = this.lastPourState;
|
|
2604
|
+
this.lastPourState = state;
|
|
2605
|
+
const completed = state === PourState.IDLE && (previous === PourState.POURING || previous === PourState.POUR_STARTING);
|
|
2606
|
+
if (!completed || !this.onPourComplete) return;
|
|
2607
|
+
const target = this.pourTarget;
|
|
2608
|
+
const endState = target?.future?.endState;
|
|
2609
|
+
setTimeout(() => {
|
|
2610
|
+
this.onPourComplete?.({ endState, error: this.lastPourError });
|
|
2611
|
+
}, 0);
|
|
2612
|
+
}
|
|
2613
|
+
publishBeverageList() {
|
|
2614
|
+
this.publish("beverage/list/updated", this.beverages);
|
|
2615
|
+
}
|
|
2616
|
+
publish(path, body) {
|
|
2617
|
+
kosUiSdk.EventBus.publish(`/kos/dispense/${this.nozzlePath}/${path}/`, body);
|
|
2618
|
+
}
|
|
2619
|
+
// -------------------LIFECYCLE----------------------------
|
|
2620
|
+
async init() {
|
|
2621
|
+
this.logger.debug(`initializing cui-kit-state ${this.id}`);
|
|
2622
|
+
}
|
|
2623
|
+
};
|
|
2624
|
+
__publicField(CuiKitStateModelImpl, "Registration");
|
|
2625
|
+
__decorateClass$2([
|
|
2626
|
+
kosUiSdk.kosDependency({
|
|
2627
|
+
modelType: Nozzle.type,
|
|
2628
|
+
id: kosUiSdk.createPropKey("nozzlePath")
|
|
2629
|
+
})
|
|
2630
|
+
], CuiKitStateModelImpl.prototype, "nozzle", 2);
|
|
2631
|
+
__decorateClass$2([
|
|
2632
|
+
kosUiSdk.kosModelEffect({
|
|
2633
|
+
dependencies: (model) => [
|
|
2634
|
+
model.pourTarget?.currentState
|
|
2635
|
+
]
|
|
2636
|
+
})
|
|
2637
|
+
], CuiKitStateModelImpl.prototype, "trackPourCompletion", 1);
|
|
2638
|
+
__decorateClass$2([
|
|
2639
|
+
kosUiSdk.kosModelEffect({
|
|
2640
|
+
dependencies: (model) => [model.beverages],
|
|
2641
|
+
options: { fireImmediately: true }
|
|
2642
|
+
})
|
|
2643
|
+
], CuiKitStateModelImpl.prototype, "publishBeverageList", 1);
|
|
2644
|
+
CuiKitStateModelImpl = __decorateClass$2([
|
|
2645
|
+
kosUiSdk.kosModel(MODEL_CONFIG),
|
|
2646
|
+
kosUiSdk.kosLoggerAware()
|
|
2647
|
+
], CuiKitStateModelImpl);
|
|
2648
|
+
const CuiKitState = CuiKitStateModelImpl.Registration;
|
|
2240
2649
|
var __defProp$1 = Object.defineProperty;
|
|
2241
2650
|
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
2242
2651
|
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
@@ -2574,9 +2983,10 @@ const kosModels = {
|
|
|
2574
2983
|
...Assembly.registration,
|
|
2575
2984
|
...BoardContainer.registration
|
|
2576
2985
|
};
|
|
2577
|
-
const registerDispenseModels = (root) => () => {
|
|
2578
|
-
kosUiSdk.registerCoreModels(root)();
|
|
2986
|
+
const registerDispenseModels = (root) => (options) => {
|
|
2987
|
+
kosUiSdk.registerCoreModels(root)(options);
|
|
2579
2988
|
DeviceAssembly.register();
|
|
2989
|
+
CuiKitState.register();
|
|
2580
2990
|
Object.keys(kosModels).forEach((key) => {
|
|
2581
2991
|
const model = kosModels[key];
|
|
2582
2992
|
kosUiSdk.registerLegacyModel(root)(key, model);
|
|
@@ -2607,12 +3017,16 @@ const registerDispenseModels = (root) => () => {
|
|
|
2607
3017
|
legacy: kosUiSdk.RegistrationManager.model.registerLegacyModel(root)
|
|
2608
3018
|
};
|
|
2609
3019
|
};
|
|
3020
|
+
const registerCuiKitModels = (root) => (options) => registerDispenseModels(root)(options);
|
|
2610
3021
|
const _KosModelRegistry = {
|
|
2611
3022
|
...kosUiSdk.KosModelRegistry
|
|
2612
3023
|
};
|
|
2613
3024
|
_KosModelRegistry.dispense = {
|
|
2614
3025
|
models: registerDispenseModels(_KosModelRegistry)
|
|
2615
3026
|
};
|
|
3027
|
+
_KosModelRegistry.cuiKit = {
|
|
3028
|
+
models: registerCuiKitModels(_KosModelRegistry)
|
|
3029
|
+
};
|
|
2616
3030
|
_KosModelRegistry.preload = kosUiSdk.RegistrationManager.model.preloadModel(_KosModelRegistry);
|
|
2617
3031
|
_KosModelRegistry.model = kosUiSdk.RegistrationManager.model.register(_KosModelRegistry);
|
|
2618
3032
|
_KosModelRegistry.companion = kosUiSdk.RegistrationManager.companion.register(_KosModelRegistry);
|
|
@@ -2624,6 +3038,7 @@ exports.Board = Board;
|
|
|
2624
3038
|
exports.BoardContainer = BoardContainer;
|
|
2625
3039
|
exports.CONTEXT_ASSEMBLY_DATA = CONTEXT_ASSEMBLY_DATA;
|
|
2626
3040
|
exports.CONTEXT_ASSEMBLY_RAW_DATA = CONTEXT_ASSEMBLY_RAW_DATA;
|
|
3041
|
+
exports.CuiKitState = CuiKitState;
|
|
2627
3042
|
exports.DeviceAssembly = DeviceAssembly;
|
|
2628
3043
|
exports.DispenseModelType = DispenseModelType;
|
|
2629
3044
|
exports.ExtensionType = ExtensionType;
|
|
@@ -2634,6 +3049,7 @@ exports.Ingredient = Ingredient;
|
|
|
2634
3049
|
exports.IngredientContainer = IngredientContainer;
|
|
2635
3050
|
exports.KosModelRegistry = KosModelRegistry;
|
|
2636
3051
|
exports.Nozzle = Nozzle;
|
|
3052
|
+
exports.PourContext = PourContext;
|
|
2637
3053
|
exports.PourState = PourState;
|
|
2638
3054
|
exports.Pump = Pump;
|
|
2639
3055
|
exports.PumpContainer = PumpContainer;
|
|
@@ -2646,6 +3062,7 @@ exports.TOPIC_GENERIC_POUR_STARTED = TOPIC_GENERIC_POUR_STARTED;
|
|
|
2646
3062
|
exports.addAssignment = addAssignment;
|
|
2647
3063
|
exports.assignHolderIngredient = assignHolderIngredient;
|
|
2648
3064
|
exports.clearPourable = clearPourable;
|
|
3065
|
+
exports.cuiKitId = cuiKitId;
|
|
2649
3066
|
exports.deleteAssignment = deleteAssignment;
|
|
2650
3067
|
exports.getAssembly = getAssembly;
|
|
2651
3068
|
exports.getAssignments = getAssignments;
|
|
@@ -2657,10 +3074,11 @@ exports.kosModels = kosModels;
|
|
|
2657
3074
|
exports.pourNamedPourable = pourNamedPourable;
|
|
2658
3075
|
exports.pourOnTarget = pourOnTarget;
|
|
2659
3076
|
exports.pourPourable = pourPourable;
|
|
3077
|
+
exports.registerCuiKitModels = registerCuiKitModels;
|
|
2660
3078
|
exports.registerDispenseModels = registerDispenseModels;
|
|
2661
3079
|
exports.replaceLine = replaceLine;
|
|
2662
3080
|
exports.selectPourable = selectPourable;
|
|
2663
3081
|
exports.sendIntent = sendIntent;
|
|
2664
3082
|
exports.sendRfidOverride = sendRfidOverride;
|
|
2665
3083
|
exports.unassignHolderIngredient = unassignHolderIngredient;
|
|
2666
|
-
//# sourceMappingURL=dispense-registration-manager-
|
|
3084
|
+
//# sourceMappingURL=dispense-registration-manager-CfWgJqfq.cjs.map
|