@kosdev-code/kos-dispense-sdk 2.1.23 → 2.1.26
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/index.cjs +1 -1
- package/index.js +1 -1
- package/models/utils/openapi-index.d.ts +2 -0
- package/models/utils/openapi-index.d.ts.map +1 -0
- package/models/utils/services/dispense/daily/openapi.d.ts +1820 -0
- package/models/utils/services/dispense/daily/service.d.ts +118 -0
- package/models/utils/services/dispense/daily/service.d.ts.map +1 -0
- package/models/utils/services-index.d.ts +2 -0
- package/models/utils/services-index.d.ts.map +1 -0
- package/package.json +4 -4
- package/pump-provider-BTnIydH2.js +1302 -0
- package/pump-provider-BTnIydH2.js.map +1 -0
- package/pump-provider-BUfMtaXv.cjs +2 -0
- package/pump-provider-BUfMtaXv.cjs.map +1 -0
- package/ui/hooks/cui-kit/dispense-topics.d.ts +47 -0
- package/ui/hooks/cui-kit/dispense-topics.d.ts.map +1 -0
- package/ui/hooks/cui-kit/use-dispense-lifecycle.d.ts.map +1 -1
- package/ui.cjs +1 -1
- package/ui.js +1 -1
- package/pump-provider-BfSGayrQ.js +0 -1317
- package/pump-provider-BfSGayrQ.js.map +0 -1
- package/pump-provider-BjaBZfDP.cjs +0 -2
- package/pump-provider-BjaBZfDP.cjs.map +0 -1
|
@@ -0,0 +1,1302 @@
|
|
|
1
|
+
var ot = Object.defineProperty;
|
|
2
|
+
var it = (e, t, r) => t in e ? ot(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var X = (e, t, r) => (it(e, typeof t != "symbol" ? t + "" : t, r), r);
|
|
4
|
+
import { jsx as h } from "@emotion/react/jsx-runtime";
|
|
5
|
+
import { useKosModel as C, getKosCompanionModel as we, kosAutoEffect as De, KosLog as P, usePressGesture as Pe, EventBus as T, TimerManager as Be } from "@kosdev-code/kos-ui-sdk";
|
|
6
|
+
import { A as Ae, b as Ke, e as ct, d as Ee, N as dt, f as ye, H as ut, j as Ce, I as Se, k as ke, G as lt, P as Ne } from "./dispense-registration-manager-CcFUS_KM.js";
|
|
7
|
+
import mt, { createContext as N, useMemo as A, useContext as S, useState as x, useCallback as i, useEffect as V, useRef as le } from "react";
|
|
8
|
+
const Le = () => {
|
|
9
|
+
const e = Ae.type;
|
|
10
|
+
return C({
|
|
11
|
+
modelId: e,
|
|
12
|
+
modelType: Ae.type,
|
|
13
|
+
options: {}
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
function _t(e) {
|
|
17
|
+
return (t) => {
|
|
18
|
+
const { model: r, status: n, KosModelLoader: s } = Le();
|
|
19
|
+
return /* @__PURE__ */ h(s, { ...n, children: /* @__PURE__ */ h(e, { ...t, assembly: r }) });
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const Me = () => {
|
|
23
|
+
const e = Ke.type;
|
|
24
|
+
return C({
|
|
25
|
+
modelId: e,
|
|
26
|
+
modelType: Ke.type,
|
|
27
|
+
options: {}
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
function Ot(e) {
|
|
31
|
+
return (t) => {
|
|
32
|
+
const { model: r, status: n, KosModelLoader: s } = Me();
|
|
33
|
+
return /* @__PURE__ */ h(s, { ...n, children: /* @__PURE__ */ h(e, { ...t, beverage: r }) });
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
const _e = (e) => C({
|
|
37
|
+
modelId: e,
|
|
38
|
+
modelType: ct.type,
|
|
39
|
+
options: {}
|
|
40
|
+
});
|
|
41
|
+
function Yt(e) {
|
|
42
|
+
return (t) => (r) => {
|
|
43
|
+
const { model: n, status: s, KosModelLoader: o } = _e(t);
|
|
44
|
+
return /* @__PURE__ */ h(o, { ...s, children: /* @__PURE__ */ h(e, { ...r, board: n }) });
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const Oe = () => {
|
|
48
|
+
const e = Ee.type;
|
|
49
|
+
return C({
|
|
50
|
+
modelId: e,
|
|
51
|
+
modelType: Ee.type,
|
|
52
|
+
options: {}
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
function Ft(e) {
|
|
56
|
+
return (t) => {
|
|
57
|
+
const { model: r, status: n, KosModelLoader: s } = Oe();
|
|
58
|
+
return /* @__PURE__ */ h(s, { ...n, children: /* @__PURE__ */ h(e, { ...t, boardContainer: r }) });
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const Ye = (e) => C({
|
|
62
|
+
modelId: e,
|
|
63
|
+
modelType: dt.type,
|
|
64
|
+
options: {
|
|
65
|
+
path: e
|
|
66
|
+
}
|
|
67
|
+
}), Fe = N(void 0), ht = ({ children: e, path: t }) => {
|
|
68
|
+
const { model: r, ready: n } = Ye(t), s = A(() => n && r ? { model: r } : {}, [n, r]);
|
|
69
|
+
return /* @__PURE__ */ h(Fe.Provider, { value: s, children: e });
|
|
70
|
+
}, M = () => {
|
|
71
|
+
const e = S(Fe);
|
|
72
|
+
if (!e)
|
|
73
|
+
throw new Error("useNozzleContext must be used within a NozzleProvider");
|
|
74
|
+
return e;
|
|
75
|
+
}, ft = ({
|
|
76
|
+
onBeverageSelected: e,
|
|
77
|
+
onBeverageListUpdated: t,
|
|
78
|
+
onClearBeverage: r,
|
|
79
|
+
companionType: n
|
|
80
|
+
}) => {
|
|
81
|
+
const { model: s } = M(), [o, a] = x([]), [d, b] = x(null), f = A(() => n ? o.map(
|
|
82
|
+
(p) => we(p, n)
|
|
83
|
+
) : [], [o, n]), c = i(
|
|
84
|
+
async (p) => {
|
|
85
|
+
b(p), await (s == null ? void 0 : s.setSelectedPourable({ beverage: p })), e == null || e(p);
|
|
86
|
+
},
|
|
87
|
+
[s, e]
|
|
88
|
+
), u = i(async () => {
|
|
89
|
+
b(null), await (s == null ? void 0 : s.setSelectedPourable({ beverage: void 0 })), r == null || r();
|
|
90
|
+
}, [s, r]);
|
|
91
|
+
return V(() => {
|
|
92
|
+
const p = De(() => {
|
|
93
|
+
if (!s)
|
|
94
|
+
return;
|
|
95
|
+
const $ = s.selectedBrand;
|
|
96
|
+
if (!$) {
|
|
97
|
+
const l = s.getGroupAvailabilityItems("beverages").filter((g) => g.visible);
|
|
98
|
+
a(l ?? []), t == null || t(l);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const v = s.getAvailabilityByParent($.id).filter((l) => l.visible);
|
|
102
|
+
a(v ?? []), t == null || t(v);
|
|
103
|
+
});
|
|
104
|
+
return () => {
|
|
105
|
+
p();
|
|
106
|
+
};
|
|
107
|
+
}, [s]), {
|
|
108
|
+
beverages: o,
|
|
109
|
+
beverageCompanions: f,
|
|
110
|
+
selectBeverage: c,
|
|
111
|
+
selectedBeverage: d,
|
|
112
|
+
clearBeverage: u
|
|
113
|
+
};
|
|
114
|
+
}, pt = ({
|
|
115
|
+
onBrandSelected: e,
|
|
116
|
+
onBrandCleared: t,
|
|
117
|
+
companionType: r
|
|
118
|
+
}) => {
|
|
119
|
+
const { model: n } = M(), [s, o] = x(null), [a, d] = x([]), b = A(() => r ? a.map((u) => we(u, r)) : [], [a, r]), f = i(
|
|
120
|
+
async (u) => {
|
|
121
|
+
o(u), n == null || n.setSelectedBrand(u), e == null || e(u);
|
|
122
|
+
},
|
|
123
|
+
[n, e]
|
|
124
|
+
), c = i(() => {
|
|
125
|
+
o(null), n == null || n.setSelectedBrand(void 0), t == null || t();
|
|
126
|
+
}, [n, t]);
|
|
127
|
+
return V(() => {
|
|
128
|
+
const u = De(() => {
|
|
129
|
+
n && d(n.visibleBrands);
|
|
130
|
+
});
|
|
131
|
+
return () => {
|
|
132
|
+
u();
|
|
133
|
+
};
|
|
134
|
+
}, [n]), {
|
|
135
|
+
brands: a,
|
|
136
|
+
brandCompanions: b,
|
|
137
|
+
selectedBrand: s,
|
|
138
|
+
selectBrand: f,
|
|
139
|
+
clearBrand: c
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
class Ge {
|
|
143
|
+
constructor() {
|
|
144
|
+
X(this, "_data", /* @__PURE__ */ new Map());
|
|
145
|
+
}
|
|
146
|
+
get(t) {
|
|
147
|
+
return this._data.get(t);
|
|
148
|
+
}
|
|
149
|
+
set(t, r) {
|
|
150
|
+
this._data.set(t, r);
|
|
151
|
+
}
|
|
152
|
+
remove(t) {
|
|
153
|
+
this._data.delete(t);
|
|
154
|
+
}
|
|
155
|
+
has(t) {
|
|
156
|
+
return this._data.has(t);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
const bt = P.createLogger({
|
|
160
|
+
name: "HoldToPourStrategy",
|
|
161
|
+
group: "kos-hooks"
|
|
162
|
+
}), Ve = {
|
|
163
|
+
name: "HoldToPourStrategy",
|
|
164
|
+
async initiate(e) {
|
|
165
|
+
if (!(e != null && e.canPour)) {
|
|
166
|
+
bt.debug(`Nozzle ${e == null ? void 0 : e.id} cannot pour. Returning early.`);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
await (e == null ? void 0 : e.pour());
|
|
170
|
+
},
|
|
171
|
+
async initiateEnded(e) {
|
|
172
|
+
await (e == null ? void 0 : e.cancelPour());
|
|
173
|
+
}
|
|
174
|
+
}, ce = P.createLogger({
|
|
175
|
+
name: "useNozzlePour",
|
|
176
|
+
group: "kos-hooks"
|
|
177
|
+
}), vt = ({
|
|
178
|
+
onPour: e,
|
|
179
|
+
onPourCancel: t,
|
|
180
|
+
onBeforePour: r,
|
|
181
|
+
onBeforePourRejected: n,
|
|
182
|
+
pourContext: s,
|
|
183
|
+
strategy: o = Ve
|
|
184
|
+
}) => {
|
|
185
|
+
const { model: a } = M(), [d, b] = x(
|
|
186
|
+
s || new Ge()
|
|
187
|
+
), f = i(async () => {
|
|
188
|
+
(r ? await (r == null ? void 0 : r(d)) : !0) ? (ce.debug(
|
|
189
|
+
`[${o == null ? void 0 : o.name}] - Pour initiated for nozzle ${a == null ? void 0 : a.id}.`
|
|
190
|
+
), o == null || o.initiate(a), e == null || e()) : (ce.debug(
|
|
191
|
+
`[${o == null ? void 0 : o.name}] - Did not pass onBeforePour gate for nozzle ${a == null ? void 0 : a.id}. Cancelling pour.`
|
|
192
|
+
), n == null || n());
|
|
193
|
+
}, [
|
|
194
|
+
e,
|
|
195
|
+
a,
|
|
196
|
+
o,
|
|
197
|
+
r,
|
|
198
|
+
t,
|
|
199
|
+
d,
|
|
200
|
+
n
|
|
201
|
+
]), c = i(() => {
|
|
202
|
+
var l;
|
|
203
|
+
ce.debug(
|
|
204
|
+
`[${o == null ? void 0 : o.name}] - Pour initiate ended called for nozzle ${a == null ? void 0 : a.id}.`
|
|
205
|
+
), (l = o == null ? void 0 : o.initiateEnded) == null || l.call(o, a), t == null || t();
|
|
206
|
+
}, [t, a, o]), u = i(() => {
|
|
207
|
+
ce.debug(`Force cancelling pour for nozzle ${a == null ? void 0 : a.id}.`), a == null || a.cancelPour(), t == null || t();
|
|
208
|
+
}, [t, a]), p = i(
|
|
209
|
+
(l, g) => {
|
|
210
|
+
d.set(l, g);
|
|
211
|
+
},
|
|
212
|
+
[d]
|
|
213
|
+
), $ = i(
|
|
214
|
+
(l) => {
|
|
215
|
+
d.remove(l);
|
|
216
|
+
},
|
|
217
|
+
[d]
|
|
218
|
+
);
|
|
219
|
+
return {
|
|
220
|
+
handlers: Pe({
|
|
221
|
+
onPressed: f,
|
|
222
|
+
onRelease: c
|
|
223
|
+
}).dom,
|
|
224
|
+
cancel: u,
|
|
225
|
+
updatePourContext: p,
|
|
226
|
+
removeFromPourContext: $,
|
|
227
|
+
status: a
|
|
228
|
+
};
|
|
229
|
+
}, Tt = ({
|
|
230
|
+
onFlavorSelected: e,
|
|
231
|
+
onFlavorCleared: t,
|
|
232
|
+
companionType: r
|
|
233
|
+
}) => {
|
|
234
|
+
const { model: n } = M(), s = A(
|
|
235
|
+
() => (n == null ? void 0 : n.getGroupAvailabilityItems("flavors").filter((c) => c.visible)) ?? [],
|
|
236
|
+
[n]
|
|
237
|
+
), o = A(() => r ? s.map(
|
|
238
|
+
(c) => we(c, r)
|
|
239
|
+
) : [], [s, r]), [a, d] = x([]), b = i(
|
|
240
|
+
async (c) => {
|
|
241
|
+
if (d(
|
|
242
|
+
(u) => u != null && u.includes(c) ? [...u.filter((p) => p !== c)] : [...u ?? [], c]
|
|
243
|
+
), n != null && n.selectedPourable) {
|
|
244
|
+
const { beverage: u } = n.selectedPourable;
|
|
245
|
+
await n.setSelectedPourable({
|
|
246
|
+
beverage: u,
|
|
247
|
+
additional: a ?? []
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
e == null || e(c, a ?? []);
|
|
251
|
+
},
|
|
252
|
+
[n, e, a]
|
|
253
|
+
), f = i(async () => {
|
|
254
|
+
if (d([]), n != null && n.selectedPourable) {
|
|
255
|
+
const { beverage: c } = n.selectedPourable;
|
|
256
|
+
n.setSelectedPourable({ beverage: c }), t == null || t();
|
|
257
|
+
}
|
|
258
|
+
}, [n, t]);
|
|
259
|
+
return {
|
|
260
|
+
flavors: s,
|
|
261
|
+
flavorCompanions: o,
|
|
262
|
+
selectFlavor: b,
|
|
263
|
+
selectedFlavors: a,
|
|
264
|
+
clearFlavors: f
|
|
265
|
+
};
|
|
266
|
+
}, te = "brands", de = "beverages", se = "flavors", G = P.createLogger({ name: "use-cui-kit" }), $t = ({
|
|
267
|
+
initialGroup: e = te,
|
|
268
|
+
options: t = {}
|
|
269
|
+
}) => {
|
|
270
|
+
var ae, oe, ie;
|
|
271
|
+
const [r, n] = x(e), { model: s } = M(), o = le([]), a = le(), d = le(), b = i(
|
|
272
|
+
(m) => {
|
|
273
|
+
n(se);
|
|
274
|
+
const w = `/kos/dispense/${s == null ? void 0 : s.path}/brand/selected/`;
|
|
275
|
+
T.publish(w, m);
|
|
276
|
+
},
|
|
277
|
+
[s == null ? void 0 : s.path]
|
|
278
|
+
), f = i(() => {
|
|
279
|
+
const m = `/kos/dispense/${s == null ? void 0 : s.path}/brand/cleared/`;
|
|
280
|
+
T.publish(m, {});
|
|
281
|
+
}, [s == null ? void 0 : s.path]), c = i(
|
|
282
|
+
(m) => {
|
|
283
|
+
const w = `/kos/dispense/${s == null ? void 0 : s.path}/beverage/list/updated/`;
|
|
284
|
+
T.publish(w, m);
|
|
285
|
+
},
|
|
286
|
+
[s == null ? void 0 : s.path]
|
|
287
|
+
), u = i(
|
|
288
|
+
(m) => {
|
|
289
|
+
var ee;
|
|
290
|
+
n(se), (ee = a.current) == null || ee.call(a, "selectedBeverage", m);
|
|
291
|
+
const w = `/kos/dispense/${s == null ? void 0 : s.path}/beverage/selected/`;
|
|
292
|
+
T.publish(w, m);
|
|
293
|
+
},
|
|
294
|
+
[s == null ? void 0 : s.path]
|
|
295
|
+
), p = i(() => {
|
|
296
|
+
var w;
|
|
297
|
+
const m = `/kos/dispense/${s == null ? void 0 : s.path}/beverage/cleared/`;
|
|
298
|
+
(w = d.current) == null || w.call(d, "selectedBeverage"), T.publish(m, {});
|
|
299
|
+
}, [s == null ? void 0 : s.path]), $ = i(
|
|
300
|
+
(m) => {
|
|
301
|
+
const w = `/kos/dispense/${s == null ? void 0 : s.path}/flavor/selected/`;
|
|
302
|
+
T.publish(w, m);
|
|
303
|
+
},
|
|
304
|
+
[s == null ? void 0 : s.path]
|
|
305
|
+
), v = i(() => {
|
|
306
|
+
const m = `/kos/dispense/${s == null ? void 0 : s.path}/flavor/cleared/`;
|
|
307
|
+
T.publish(m, {});
|
|
308
|
+
}, [s == null ? void 0 : s.path]), l = i(() => {
|
|
309
|
+
const m = `/kos/dispense/${s == null ? void 0 : s.path}/pour/`;
|
|
310
|
+
T.publish(m, {});
|
|
311
|
+
}, [s == null ? void 0 : s.path]), g = i(
|
|
312
|
+
async (m) => {
|
|
313
|
+
const w = `/kos/dispense/${s == null ? void 0 : s.path}/pre/pour/`;
|
|
314
|
+
return T.publish(w, {}), await (F == null ? void 0 : F(m)) || !0;
|
|
315
|
+
},
|
|
316
|
+
[s == null ? void 0 : s.path]
|
|
317
|
+
), y = i(async () => {
|
|
318
|
+
const m = `/kos/dispense/${s == null ? void 0 : s.path}/pre/pour/rejected/`;
|
|
319
|
+
T.publish(m, {});
|
|
320
|
+
}, [s == null ? void 0 : s.path]), _ = i(() => {
|
|
321
|
+
const m = `/kos/dispense/${s == null ? void 0 : s.path}/pour/cancel/`;
|
|
322
|
+
T.publish(m, {});
|
|
323
|
+
}, [s == null ? void 0 : s.path]), { brands: O, selectBrand: R, selectedBrand: Z, clearBrand: Y, brandCompanions: me } = pt({
|
|
324
|
+
companionType: (ae = t.companionTypes) == null ? void 0 : ae.brand,
|
|
325
|
+
onBrandSelected: b,
|
|
326
|
+
onBrandCleared: f
|
|
327
|
+
}), {
|
|
328
|
+
beverages: H,
|
|
329
|
+
selectBeverage: D,
|
|
330
|
+
selectedBeverage: U,
|
|
331
|
+
clearBeverage: B,
|
|
332
|
+
beverageCompanions: q
|
|
333
|
+
} = ft({
|
|
334
|
+
companionType: (oe = t.companionTypes) == null ? void 0 : oe.beverage,
|
|
335
|
+
onBeverageSelected: u,
|
|
336
|
+
onClearBeverage: p,
|
|
337
|
+
onBeverageListUpdated: c
|
|
338
|
+
}), {
|
|
339
|
+
clearFlavors: I,
|
|
340
|
+
flavors: k,
|
|
341
|
+
selectFlavor: J,
|
|
342
|
+
selectedFlavors: K,
|
|
343
|
+
flavorCompanions: j
|
|
344
|
+
} = Tt({
|
|
345
|
+
companionType: (ie = t.companionTypes) == null ? void 0 : ie.flavor,
|
|
346
|
+
onFlavorSelected: $,
|
|
347
|
+
onFlavorCleared: v
|
|
348
|
+
}), [F, Q] = x(), he = i((m) => {
|
|
349
|
+
Q(() => m);
|
|
350
|
+
}, []), z = vt({
|
|
351
|
+
onPour: l,
|
|
352
|
+
onPourCancel: _,
|
|
353
|
+
onBeforePour: g,
|
|
354
|
+
onBeforePourRejected: y
|
|
355
|
+
});
|
|
356
|
+
a.current = z.updatePourContext, d.current = z.removeFromPourContext;
|
|
357
|
+
const fe = i(() => {
|
|
358
|
+
switch (G.debug(`Navigating back from group: ${r}`), r) {
|
|
359
|
+
case te:
|
|
360
|
+
B(), Y();
|
|
361
|
+
break;
|
|
362
|
+
case de:
|
|
363
|
+
case se:
|
|
364
|
+
n(e), B(), Y();
|
|
365
|
+
break;
|
|
366
|
+
}
|
|
367
|
+
}, [B, Y, r, e]), pe = i(() => {
|
|
368
|
+
const m = `/kos/dispense/${s == null ? void 0 : s.path}/home/`;
|
|
369
|
+
T.publish(m, {}), n(e), e === te && (B(), Y()), e === de && B();
|
|
370
|
+
}, [B, Y, e]), be = i(() => {
|
|
371
|
+
if (o.current.length === 0) {
|
|
372
|
+
G.debug("No timers to pause.");
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
G.debug(`Pausing ${o.current.length} timers.`), o.current.forEach((m) => {
|
|
376
|
+
G.debug(`Pausing timer with id ${m.id}.`), m.pause();
|
|
377
|
+
});
|
|
378
|
+
}, []), ve = i(() => {
|
|
379
|
+
if (o.current.length === 0) {
|
|
380
|
+
G.debug("No timers to restart.");
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
G.debug(`Restarting ${o.current.length} timers.`), o.current.forEach((m) => {
|
|
384
|
+
G.debug(`Restarting timer with id ${m.id}.`), m.restart();
|
|
385
|
+
});
|
|
386
|
+
}, []);
|
|
387
|
+
return {
|
|
388
|
+
timers: {
|
|
389
|
+
add: i((m) => {
|
|
390
|
+
if (m) {
|
|
391
|
+
if (o.current.some((w) => w.id === m.id)) {
|
|
392
|
+
G.debug(`Timer with id ${m.id} already exists.`);
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
o.current.push(m);
|
|
396
|
+
}
|
|
397
|
+
}, []),
|
|
398
|
+
pause: be,
|
|
399
|
+
restart: ve
|
|
400
|
+
},
|
|
401
|
+
nav: {
|
|
402
|
+
currentGroup: r,
|
|
403
|
+
back: fe,
|
|
404
|
+
home: pe
|
|
405
|
+
},
|
|
406
|
+
pour: z,
|
|
407
|
+
updateOnBeforePour: he,
|
|
408
|
+
selections: {
|
|
409
|
+
[te]: Z,
|
|
410
|
+
[de]: U,
|
|
411
|
+
[se]: K
|
|
412
|
+
},
|
|
413
|
+
[te]: {
|
|
414
|
+
models: O,
|
|
415
|
+
companions: me,
|
|
416
|
+
clear: Y,
|
|
417
|
+
handlers: {
|
|
418
|
+
onSelected: R
|
|
419
|
+
}
|
|
420
|
+
},
|
|
421
|
+
[de]: {
|
|
422
|
+
models: H,
|
|
423
|
+
companions: q,
|
|
424
|
+
clear: B,
|
|
425
|
+
handlers: {
|
|
426
|
+
onSelected: D
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
[se]: {
|
|
430
|
+
models: k,
|
|
431
|
+
companions: j,
|
|
432
|
+
clear: I,
|
|
433
|
+
handlers: {
|
|
434
|
+
onSelected: J
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
}, gt = (e) => {
|
|
439
|
+
const { model: t } = M(), [r, n] = x(null), {
|
|
440
|
+
onAmbientTimer: s,
|
|
441
|
+
onAttractTimer: o,
|
|
442
|
+
onResetAttractTimer: a,
|
|
443
|
+
onResumeAttractTimer: d,
|
|
444
|
+
defaultAttractTime: b,
|
|
445
|
+
defaultAmbientTime: f
|
|
446
|
+
} = e, c = i(() => {
|
|
447
|
+
s && (P.info("Ambient timer expired. Calling callback"), s == null || s());
|
|
448
|
+
}, [s]), u = i(() => {
|
|
449
|
+
o && (P.info("Attract timer expired. Calling callback"), o == null || o());
|
|
450
|
+
}, [o]), p = i(() => {
|
|
451
|
+
r && (r.restart(), a == null || a());
|
|
452
|
+
}, [r, a]), $ = i(() => {
|
|
453
|
+
r && (r.reset(), a == null || a());
|
|
454
|
+
}, [r, a]), v = i(() => {
|
|
455
|
+
r && (r.pause(), d == null || d());
|
|
456
|
+
}, [r, d]);
|
|
457
|
+
return V(() => {
|
|
458
|
+
if (t && b) {
|
|
459
|
+
P.info("Nozzle is available. Creating timers");
|
|
460
|
+
const l = Be.createTimer(
|
|
461
|
+
"attract-timer-" + t.path,
|
|
462
|
+
b
|
|
463
|
+
);
|
|
464
|
+
return b && (l == null || l.addTimeoutAction({
|
|
465
|
+
name: "attract-timer",
|
|
466
|
+
remainingTime: 0,
|
|
467
|
+
action: u
|
|
468
|
+
})), f && (l == null || l.addTimeoutAction({
|
|
469
|
+
name: "ambient-timer",
|
|
470
|
+
remainingTime: f,
|
|
471
|
+
action: c
|
|
472
|
+
})), b && (l == null || l.start()), n(l ?? null), () => {
|
|
473
|
+
l == null || l.reset(), n(null);
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
return () => {
|
|
477
|
+
P.info("Nozzle is not available. No timers to clear");
|
|
478
|
+
};
|
|
479
|
+
}, [
|
|
480
|
+
f,
|
|
481
|
+
b,
|
|
482
|
+
c,
|
|
483
|
+
u,
|
|
484
|
+
t
|
|
485
|
+
]), {
|
|
486
|
+
attractTimer: r,
|
|
487
|
+
restart: p,
|
|
488
|
+
pause: $,
|
|
489
|
+
resume: v
|
|
490
|
+
};
|
|
491
|
+
}, wt = [
|
|
492
|
+
{ path: "brand/selected", callbackKey: "onBrandSelected" },
|
|
493
|
+
{ path: "brand/cleared", callbackKey: "onBrandCleared" },
|
|
494
|
+
{ path: "beverage/list/updated", callbackKey: "onBeverageListUpdated" },
|
|
495
|
+
{ path: "beverage/selected", callbackKey: "onBeverageSelected" },
|
|
496
|
+
{ path: "beverage/cleared", callbackKey: "onBeverageCleared" },
|
|
497
|
+
{ path: "flavor/selected", callbackKey: "onFlavorSelected" },
|
|
498
|
+
{ path: "flavor/cleared", callbackKey: "onFlavorCleared" },
|
|
499
|
+
{ path: "pour", callbackKey: "onPour" },
|
|
500
|
+
{ path: "pour/cancel", callbackKey: "onPourCancel" },
|
|
501
|
+
{ path: "pre/pour/rejected", callbackKey: "onBeforePourRejected" },
|
|
502
|
+
{ path: "ambient/start", callbackKey: "onAmbientTimer" },
|
|
503
|
+
{ path: "attract/start", callbackKey: "onAttractTimer" },
|
|
504
|
+
{ path: "attract/resume", callbackKey: "onResumeAttractTimer" },
|
|
505
|
+
{ path: "idle/timeout", callbackKey: "onIdleTimeout" },
|
|
506
|
+
{ path: "are-you-there/timeout", callbackKey: "onAreYouThereTimeout" },
|
|
507
|
+
{ path: "init", callbackKey: "onInit" },
|
|
508
|
+
{ path: "home", callbackKey: "onReturnToHome" }
|
|
509
|
+
];
|
|
510
|
+
function Pt(e, t) {
|
|
511
|
+
return e ? wt.filter(
|
|
512
|
+
(r) => t[r.callbackKey] !== void 0
|
|
513
|
+
).map((r) => ({
|
|
514
|
+
topic: `/kos/dispense/${e}/${r.path}/`,
|
|
515
|
+
callback: t[r.callbackKey]
|
|
516
|
+
})) : [];
|
|
517
|
+
}
|
|
518
|
+
const It = (e, t) => {
|
|
519
|
+
if (t) {
|
|
520
|
+
const r = (s) => {
|
|
521
|
+
s && s.body && t(s.body);
|
|
522
|
+
};
|
|
523
|
+
return T.subscribe(e, r).unsubscribe;
|
|
524
|
+
}
|
|
525
|
+
}, xt = ({
|
|
526
|
+
onInit: e,
|
|
527
|
+
onBrandSelected: t,
|
|
528
|
+
onBrandCleared: r,
|
|
529
|
+
onBeverageCleared: n,
|
|
530
|
+
onBeverageSelected: s,
|
|
531
|
+
onBeverageListUpdated: o,
|
|
532
|
+
onFlavorCleared: a,
|
|
533
|
+
onFlavorSelected: d,
|
|
534
|
+
onReturnToHome: b,
|
|
535
|
+
onPour: f,
|
|
536
|
+
onPourCancel: c,
|
|
537
|
+
onBeforePourRejected: u,
|
|
538
|
+
onAmbientTimer: p,
|
|
539
|
+
onAttractTimer: $,
|
|
540
|
+
onResumeAttractTimer: v,
|
|
541
|
+
onIdleTimeout: l,
|
|
542
|
+
onAreYouThereTimeout: g
|
|
543
|
+
}) => {
|
|
544
|
+
const { model: y } = M();
|
|
545
|
+
V(() => {
|
|
546
|
+
const O = Pt(y == null ? void 0 : y.path, {
|
|
547
|
+
onBrandSelected: t,
|
|
548
|
+
onBrandCleared: r,
|
|
549
|
+
onBeverageListUpdated: o,
|
|
550
|
+
onBeverageSelected: s,
|
|
551
|
+
onBeverageCleared: n,
|
|
552
|
+
onFlavorSelected: d,
|
|
553
|
+
onFlavorCleared: a,
|
|
554
|
+
onPour: f,
|
|
555
|
+
onPourCancel: c,
|
|
556
|
+
onBeforePourRejected: u,
|
|
557
|
+
onAmbientTimer: p,
|
|
558
|
+
onAttractTimer: $,
|
|
559
|
+
onResumeAttractTimer: v,
|
|
560
|
+
onIdleTimeout: l,
|
|
561
|
+
onAreYouThereTimeout: g,
|
|
562
|
+
onInit: e,
|
|
563
|
+
onReturnToHome: b
|
|
564
|
+
}).map(
|
|
565
|
+
({ topic: R, callback: Z }) => It(R, Z)
|
|
566
|
+
);
|
|
567
|
+
return () => {
|
|
568
|
+
O.forEach((R) => R == null ? void 0 : R());
|
|
569
|
+
};
|
|
570
|
+
}, [
|
|
571
|
+
y == null ? void 0 : y.path,
|
|
572
|
+
p,
|
|
573
|
+
$,
|
|
574
|
+
n,
|
|
575
|
+
s,
|
|
576
|
+
o,
|
|
577
|
+
r,
|
|
578
|
+
t,
|
|
579
|
+
a,
|
|
580
|
+
d,
|
|
581
|
+
f,
|
|
582
|
+
c,
|
|
583
|
+
u,
|
|
584
|
+
v,
|
|
585
|
+
l,
|
|
586
|
+
g,
|
|
587
|
+
e,
|
|
588
|
+
b
|
|
589
|
+
]);
|
|
590
|
+
}, L = P.createLogger({ name: "useCuiKitTimers" }), He = (e) => {
|
|
591
|
+
const { model: t } = M(), [r, n] = x(null), {
|
|
592
|
+
onAreYouThereTimer: s,
|
|
593
|
+
onIdleTimer: o,
|
|
594
|
+
onResetIdleTimer: a,
|
|
595
|
+
defaultAreYouThereTime: d = 10,
|
|
596
|
+
defaultIdleTime: b = 20
|
|
597
|
+
} = e, f = le(!1), c = i(() => {
|
|
598
|
+
!f.current && s && (P.info("Are you there timer expired. Calling callback"), f.current = !0, s == null || s());
|
|
599
|
+
}, [s]), u = i(() => {
|
|
600
|
+
L.debug(
|
|
601
|
+
"handleIdleTimer called in useCuiKitTimers, onIdleTimer exists:",
|
|
602
|
+
!!o
|
|
603
|
+
), o ? (L.debug("Idle timer expired. Calling callback"), o == null || o()) : L.debug("No onIdleTimer callback provided!");
|
|
604
|
+
}, [o]), p = i(() => {
|
|
605
|
+
L.debug(`TIMER RESTART called for ${e.prefix ?? ""}timer`), r && (r.restart(), f.current = !1, a == null || a());
|
|
606
|
+
}, [r, a, e.prefix]), $ = i(() => {
|
|
607
|
+
L.debug(`TIMER PAUSE/RESET called for ${e.prefix ?? ""}timer`), r && (r.reset(), f.current = !1, a == null || a());
|
|
608
|
+
}, [r, a, e.prefix]);
|
|
609
|
+
return V(() => {
|
|
610
|
+
if (L.debug(
|
|
611
|
+
`useCuiKitTimers effect triggered - nozzle: ${!!t}, path: ${t == null ? void 0 : t.path}, callbacks: handleIdle=${!!u}, handleAreYouThere=${!!c}`
|
|
612
|
+
), t) {
|
|
613
|
+
L.info("Nozzle is available. Creating timers");
|
|
614
|
+
const v = Be.createTimer(
|
|
615
|
+
`${e.prefix ?? ""}idle-timer-${t.path}`,
|
|
616
|
+
b
|
|
617
|
+
);
|
|
618
|
+
return L.debug(
|
|
619
|
+
`Adding idle timer action for ${e.prefix ?? ""}idle-timer-${t.path} with callback:`,
|
|
620
|
+
!!u
|
|
621
|
+
), v == null || v.addTimeoutAction({
|
|
622
|
+
name: "idle-timer",
|
|
623
|
+
remainingTime: 0,
|
|
624
|
+
action: u
|
|
625
|
+
}), v == null || v.addTimeoutAction({
|
|
626
|
+
name: "are-you-there-timer",
|
|
627
|
+
remainingTime: d,
|
|
628
|
+
action: c
|
|
629
|
+
}), n(v ?? null), () => {
|
|
630
|
+
v == null || v.reset(), n(null);
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
return () => {
|
|
634
|
+
L.info("Nozzle is not available. No timers to clear");
|
|
635
|
+
};
|
|
636
|
+
}, [
|
|
637
|
+
d,
|
|
638
|
+
b,
|
|
639
|
+
c,
|
|
640
|
+
u,
|
|
641
|
+
t,
|
|
642
|
+
e.prefix
|
|
643
|
+
]), {
|
|
644
|
+
idleTimer: r,
|
|
645
|
+
restart: p,
|
|
646
|
+
pause: $
|
|
647
|
+
};
|
|
648
|
+
}, W = P.createLogger({ name: "useDefaultCuiKitLifecycle" }), Gt = ({
|
|
649
|
+
kit: e,
|
|
650
|
+
inactivity: t,
|
|
651
|
+
pour: r,
|
|
652
|
+
screens: n,
|
|
653
|
+
onBeforeAreYouThereTimer: s,
|
|
654
|
+
areYouThereRejectionPolicy: o = "pause"
|
|
655
|
+
}) => {
|
|
656
|
+
var m, w, ee, xe;
|
|
657
|
+
const [a, d] = x(!1), [b, f] = x(!1), { model: c } = M(), [u, p] = x(!1), $ = (t == null ? void 0 : t.idleTimeout) ?? 15, v = (t == null ? void 0 : t.areYouThereTimeoutOffset) ?? 10, l = (r == null ? void 0 : r.idleTimeout) ?? (t == null ? void 0 : t.idleTimeout) ?? 10, g = (r == null ? void 0 : r.areYouThereTimeoutOffset) ?? (t == null ? void 0 : t.areYouThereTimeoutOffset) ?? 5, y = n == null ? void 0 : n.ambientTimeoutOffset, _ = n == null ? void 0 : n.attractTimeout, O = i(() => {
|
|
658
|
+
if (W.info("handleIdleTimeout called - navigating home and publishing event"), q(!1), e == null || e.nav.home(), c) {
|
|
659
|
+
const E = `/kos/dispense/${c.path}/idle/timeout/`;
|
|
660
|
+
T.publish(E, {});
|
|
661
|
+
}
|
|
662
|
+
}, [(m = e == null ? void 0 : e.nav) == null ? void 0 : m.home, c]), R = i(() => {
|
|
663
|
+
W.info("handleResetIdleTimer called - resetting idle timer"), q(!1);
|
|
664
|
+
}, []), Z = i(() => {
|
|
665
|
+
if (y && (d(!0), f(!1), c)) {
|
|
666
|
+
const E = `/kos/dispense/${c.path}/ambient/start/`;
|
|
667
|
+
T.publish(E, {});
|
|
668
|
+
}
|
|
669
|
+
}, [y, c]), Y = i(() => {
|
|
670
|
+
if (_ && (f(!0), d(!1), c)) {
|
|
671
|
+
const E = `/kos/dispense/${c.path}/attract/start/`;
|
|
672
|
+
T.publish(E, {});
|
|
673
|
+
}
|
|
674
|
+
}, [_, c]), me = i(() => {
|
|
675
|
+
if (_ && (f(!1), d(!1), e == null || e.nav.home(), c)) {
|
|
676
|
+
const E = `/kos/dispense/${c.path}/attract/resume/`;
|
|
677
|
+
T.publish(E, {});
|
|
678
|
+
}
|
|
679
|
+
}, [e == null ? void 0 : e.nav, _, c]), {
|
|
680
|
+
pause: H,
|
|
681
|
+
restart: D,
|
|
682
|
+
attractTimer: U
|
|
683
|
+
} = gt({
|
|
684
|
+
defaultAmbientTime: y,
|
|
685
|
+
defaultAttractTime: _,
|
|
686
|
+
onAmbientTimer: Z,
|
|
687
|
+
onAttractTimer: Y,
|
|
688
|
+
onResumeAttractTimer: me
|
|
689
|
+
});
|
|
690
|
+
(w = e == null ? void 0 : e.timers) == null || w.add(U);
|
|
691
|
+
const [B, q] = x(!1);
|
|
692
|
+
W.info(
|
|
693
|
+
"Creating idle timer with timeout:",
|
|
694
|
+
$,
|
|
695
|
+
"seconds and callback:",
|
|
696
|
+
!!O
|
|
697
|
+
);
|
|
698
|
+
const { pause: I, restart: k, idleTimer: J } = He({
|
|
699
|
+
defaultAreYouThereTime: v,
|
|
700
|
+
defaultIdleTime: $,
|
|
701
|
+
onIdleTimer: O,
|
|
702
|
+
onResetIdleTimer: R
|
|
703
|
+
});
|
|
704
|
+
W.info(
|
|
705
|
+
`Creating pour timer with timeout: ${l} seconds and callback: ${!!O}`
|
|
706
|
+
);
|
|
707
|
+
const {
|
|
708
|
+
pause: K,
|
|
709
|
+
restart: j,
|
|
710
|
+
idleTimer: F
|
|
711
|
+
} = He({
|
|
712
|
+
defaultAreYouThereTime: g,
|
|
713
|
+
defaultIdleTime: l,
|
|
714
|
+
onIdleTimer: O,
|
|
715
|
+
prefix: "pour-"
|
|
716
|
+
}), Q = i(async () => {
|
|
717
|
+
let E = !0;
|
|
718
|
+
if (s)
|
|
719
|
+
try {
|
|
720
|
+
E = await s();
|
|
721
|
+
} catch (Te) {
|
|
722
|
+
W.error(`onBeforeAreYouThereTimer callback failed: ${Te}`), E = !1;
|
|
723
|
+
}
|
|
724
|
+
if (E) {
|
|
725
|
+
if (c) {
|
|
726
|
+
const Te = `/kos/dispense/${c.path}/are-you-there/timeout/`;
|
|
727
|
+
T.publish(Te, {});
|
|
728
|
+
}
|
|
729
|
+
q(!0), u ? K() : I();
|
|
730
|
+
} else
|
|
731
|
+
switch (o) {
|
|
732
|
+
case "pause":
|
|
733
|
+
u ? K() : I();
|
|
734
|
+
break;
|
|
735
|
+
case "restart":
|
|
736
|
+
u ? j() : k();
|
|
737
|
+
break;
|
|
738
|
+
}
|
|
739
|
+
}, [s, c, o, u]), he = i(() => {
|
|
740
|
+
q(!1), H(), u ? (j(), I()) : (k(), K());
|
|
741
|
+
}, [u, I, K, k, j]);
|
|
742
|
+
V(() => {
|
|
743
|
+
J && J.addTimeoutAction({
|
|
744
|
+
name: "are-you-there-timer",
|
|
745
|
+
remainingTime: v,
|
|
746
|
+
action: Q
|
|
747
|
+
});
|
|
748
|
+
}, [J, v, Q]), V(() => {
|
|
749
|
+
F && F.addTimeoutAction({
|
|
750
|
+
name: "pour-are-you-there-timer",
|
|
751
|
+
remainingTime: g,
|
|
752
|
+
action: Q
|
|
753
|
+
});
|
|
754
|
+
}, [F, g, Q]), (ee = e == null ? void 0 : e.timers) == null || ee.add(J), (xe = e == null ? void 0 : e.timers) == null || xe.add(F);
|
|
755
|
+
const z = i(() => {
|
|
756
|
+
p(!1), K(), I(), H();
|
|
757
|
+
}, [I, K]), fe = i(() => {
|
|
758
|
+
p(!0), W.info("restarting pour timer"), j(), H(), I();
|
|
759
|
+
}, [I, j]), pe = i(() => {
|
|
760
|
+
p(!1), W.info("restarting pour timer on before pour rejected"), K(), k();
|
|
761
|
+
}, []), be = i(() => {
|
|
762
|
+
H(), f(!1), d(!1), k();
|
|
763
|
+
}, [H, k]), ve = i(() => {
|
|
764
|
+
f(!1), d(!1), p(!1), K(), D();
|
|
765
|
+
}, [D, K]), Ie = i(() => {
|
|
766
|
+
f(!1), d(!1), p(!1), H(), k();
|
|
767
|
+
}, [H, k]), ae = i(() => {
|
|
768
|
+
f(!1), d(!1), p(!1), D(), I(), K();
|
|
769
|
+
}, [D, I, K]), oe = i(() => {
|
|
770
|
+
f(!1), d(!1), D(), I();
|
|
771
|
+
}, [D, I]);
|
|
772
|
+
xt({
|
|
773
|
+
onBrandSelected: be,
|
|
774
|
+
onBrandCleared: ve,
|
|
775
|
+
onBeverageSelected: Ie,
|
|
776
|
+
onBeverageCleared: ae,
|
|
777
|
+
onPour: z,
|
|
778
|
+
onPourCancel: fe,
|
|
779
|
+
onBeforePourRejected: pe,
|
|
780
|
+
onInit: oe
|
|
781
|
+
// Note: Timer-related handlers (onIdleTimeout, onAmbientTimer, onAttractTimer,
|
|
782
|
+
// onResumeAttractTimer, onAreYouThereTimeout) are NOT included here since this
|
|
783
|
+
// component's own timer hooks call those handlers directly. Including them would
|
|
784
|
+
// create circular event loops.
|
|
785
|
+
});
|
|
786
|
+
const ie = u ? g : v;
|
|
787
|
+
return V(() => {
|
|
788
|
+
if (c && U) {
|
|
789
|
+
const E = `/kos/dispense/${c == null ? void 0 : c.path}/init/`;
|
|
790
|
+
T.publish(E, {});
|
|
791
|
+
}
|
|
792
|
+
}, [c, U]), {
|
|
793
|
+
showAreYouThere: B,
|
|
794
|
+
clearAreYouThere: he,
|
|
795
|
+
pauseIdleTimer: I,
|
|
796
|
+
restartIdleTimer: k,
|
|
797
|
+
areYouThereCountdown: ie,
|
|
798
|
+
showAmbientScreen: a,
|
|
799
|
+
showAttractScreen: b,
|
|
800
|
+
pauseScreenTimer: H,
|
|
801
|
+
restartScreenTimer: D
|
|
802
|
+
};
|
|
803
|
+
}, je = () => {
|
|
804
|
+
const e = ye.type;
|
|
805
|
+
return C({
|
|
806
|
+
modelId: e,
|
|
807
|
+
modelType: ye.type,
|
|
808
|
+
options: {}
|
|
809
|
+
});
|
|
810
|
+
};
|
|
811
|
+
function Vt(e) {
|
|
812
|
+
return (t) => {
|
|
813
|
+
const { model: r, status: n, KosModelLoader: s } = je();
|
|
814
|
+
return /* @__PURE__ */ h(s, { ...n, children: /* @__PURE__ */ h(e, { ...t, deviceAssembly: r }) });
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
const We = (e) => C({
|
|
818
|
+
modelId: e,
|
|
819
|
+
modelType: ut.type,
|
|
820
|
+
options: {}
|
|
821
|
+
});
|
|
822
|
+
function jt(e, t) {
|
|
823
|
+
return (r) => {
|
|
824
|
+
const { model: n, status: s, KosModelLoader: o } = We(e);
|
|
825
|
+
return /* @__PURE__ */ h(o, { ...s, children: /* @__PURE__ */ h(t, { ...r, holder: n }) });
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
const qe = () => {
|
|
829
|
+
const e = Ce.type;
|
|
830
|
+
return C({
|
|
831
|
+
modelId: e,
|
|
832
|
+
modelType: Ce.type,
|
|
833
|
+
options: {}
|
|
834
|
+
});
|
|
835
|
+
};
|
|
836
|
+
function Wt(e) {
|
|
837
|
+
return (t) => {
|
|
838
|
+
const { model: r, status: n, KosModelLoader: s } = qe();
|
|
839
|
+
return /* @__PURE__ */ h(s, { ...n, children: /* @__PURE__ */ h(e, { ...t, holderContainer: r }) });
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
const Je = () => {
|
|
843
|
+
const e = Se.type;
|
|
844
|
+
return C({
|
|
845
|
+
modelId: e,
|
|
846
|
+
modelType: Se.type,
|
|
847
|
+
options: {}
|
|
848
|
+
});
|
|
849
|
+
}, $e = P.createLogger({
|
|
850
|
+
name: "HoldToPourIntentStrategy",
|
|
851
|
+
group: "kos-hooks"
|
|
852
|
+
}), At = {
|
|
853
|
+
name: "HoldToPourIntentStrategy",
|
|
854
|
+
async initiate(e, t) {
|
|
855
|
+
if (!(e != null && e.canPour)) {
|
|
856
|
+
$e.debug(`${e == null ? void 0 : e.id} cannot pour. Returning early.`);
|
|
857
|
+
return;
|
|
858
|
+
}
|
|
859
|
+
t ? ($e.debug(`performing intent: ${t}`), await (e == null ? void 0 : e.performIntent(t))) : $e.debug("no intent provided. Returning early.");
|
|
860
|
+
},
|
|
861
|
+
async initiateEnded(e) {
|
|
862
|
+
await (e == null ? void 0 : e.cancelPour());
|
|
863
|
+
}
|
|
864
|
+
}, ge = P.createLogger({
|
|
865
|
+
name: "useNozzlePour",
|
|
866
|
+
group: "kos-hooks"
|
|
867
|
+
}), qt = ({
|
|
868
|
+
onPour: e,
|
|
869
|
+
onPourCancel: t,
|
|
870
|
+
intentContainer: r,
|
|
871
|
+
strategy: n = At
|
|
872
|
+
}) => {
|
|
873
|
+
const s = i(() => {
|
|
874
|
+
ge.debug(
|
|
875
|
+
`[${n == null ? void 0 : n.name}] - Pour initiated for model ${r == null ? void 0 : r.id}.`
|
|
876
|
+
), n == null || n.initiate(r), e == null || e();
|
|
877
|
+
}, [e, r, n]), o = i(() => {
|
|
878
|
+
var b;
|
|
879
|
+
ge.debug(
|
|
880
|
+
`[${n == null ? void 0 : n.name}] - Pour initiate ended called for nozzle ${r == null ? void 0 : r.id}.`
|
|
881
|
+
), (b = n == null ? void 0 : n.initiateEnded) == null || b.call(n, r), t == null || t();
|
|
882
|
+
}, [t, r, n]), a = i(() => {
|
|
883
|
+
ge.debug(`Force cancelling pour for nozzle ${r == null ? void 0 : r.id}.`), r == null || r.cancelPour(), t == null || t();
|
|
884
|
+
}, [t, r]);
|
|
885
|
+
return {
|
|
886
|
+
handlers: Pe({
|
|
887
|
+
onPressed: s,
|
|
888
|
+
onRelease: o
|
|
889
|
+
}).dom,
|
|
890
|
+
cancel: a,
|
|
891
|
+
status: r
|
|
892
|
+
};
|
|
893
|
+
};
|
|
894
|
+
function Jt(e) {
|
|
895
|
+
return (t) => {
|
|
896
|
+
const { model: r, status: n, KosModelLoader: s } = Je();
|
|
897
|
+
return /* @__PURE__ */ h(s, { ...n, children: /* @__PURE__ */ h(e, { ...t, ingredient: r }) });
|
|
898
|
+
};
|
|
899
|
+
}
|
|
900
|
+
const Qe = () => {
|
|
901
|
+
const e = ke.type;
|
|
902
|
+
return C({
|
|
903
|
+
modelId: e,
|
|
904
|
+
modelType: ke.type,
|
|
905
|
+
options: {}
|
|
906
|
+
});
|
|
907
|
+
};
|
|
908
|
+
function Qt(e) {
|
|
909
|
+
return (t) => {
|
|
910
|
+
const { model: r, status: n, KosModelLoader: s } = Qe();
|
|
911
|
+
return /* @__PURE__ */ h(s, { ...n, children: /* @__PURE__ */ h(e, { ...t, ingredientContainer: r }) });
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
function Xt(e, t) {
|
|
915
|
+
return (r) => {
|
|
916
|
+
const { model: n, status: s, KosModelLoader: o } = Ye(e);
|
|
917
|
+
return /* @__PURE__ */ h(o, { ...s, children: /* @__PURE__ */ h(t, { ...r, nozzle: n }) });
|
|
918
|
+
};
|
|
919
|
+
}
|
|
920
|
+
const re = P.createLogger({
|
|
921
|
+
name: "usePour",
|
|
922
|
+
group: "kos-hooks"
|
|
923
|
+
}), Zt = ({
|
|
924
|
+
onBeforePour: e,
|
|
925
|
+
onPour: t,
|
|
926
|
+
onPourCancel: r,
|
|
927
|
+
onPourAbort: n,
|
|
928
|
+
pourTarget: s,
|
|
929
|
+
pourContext: o,
|
|
930
|
+
strategy: a = Ve
|
|
931
|
+
}) => {
|
|
932
|
+
const [d, b] = x(
|
|
933
|
+
o || new Ge()
|
|
934
|
+
), f = i(async () => {
|
|
935
|
+
re.debug(
|
|
936
|
+
`[${a == null ? void 0 : a.name}] - calling before pour for pour target ${s == null ? void 0 : s.id}.`
|
|
937
|
+
), (e ? await (e == null ? void 0 : e(d)) : !0) ? (re.debug(
|
|
938
|
+
`[${a == null ? void 0 : a.name}] - Pour initiated for pour target ${s == null ? void 0 : s.id}.`
|
|
939
|
+
), await (a == null ? void 0 : a.initiate(s)), t == null || t(), s != null && s.isPouring || n == null || n()) : (re.debug(
|
|
940
|
+
`[${a == null ? void 0 : a.name}] - Pour cancelled for pour target ${s == null ? void 0 : s.id}.`
|
|
941
|
+
), r == null || r());
|
|
942
|
+
}, [t, e, n, s, a, d]), c = i(async () => {
|
|
943
|
+
var g;
|
|
944
|
+
re.debug(
|
|
945
|
+
`[${a == null ? void 0 : a.name}] - Pour initiate ended called for pour target ${s == null ? void 0 : s.id}.`
|
|
946
|
+
), await ((g = a == null ? void 0 : a.initiateEnded) == null ? void 0 : g.call(a, s)) || r == null || r();
|
|
947
|
+
}, [r, s, a]), u = i(async () => {
|
|
948
|
+
re.debug(`Force cancelling pour for pour target ${s == null ? void 0 : s.id}.`), await (s == null ? void 0 : s.cancelPour()), r == null || r();
|
|
949
|
+
}, [r, s]), p = i(
|
|
950
|
+
(l, g) => {
|
|
951
|
+
d.set(l, g);
|
|
952
|
+
},
|
|
953
|
+
[d]
|
|
954
|
+
), $ = i(
|
|
955
|
+
(l) => {
|
|
956
|
+
d.remove(l);
|
|
957
|
+
},
|
|
958
|
+
[d]
|
|
959
|
+
);
|
|
960
|
+
return {
|
|
961
|
+
handlers: Pe({
|
|
962
|
+
onPressed: f,
|
|
963
|
+
onRelease: c
|
|
964
|
+
}).dom,
|
|
965
|
+
cancel: u,
|
|
966
|
+
updatePourContext: p,
|
|
967
|
+
removeFromPourContext: $,
|
|
968
|
+
status: s
|
|
969
|
+
};
|
|
970
|
+
}, ne = P.createLogger({
|
|
971
|
+
name: "TapOrHoldIntentStrategy",
|
|
972
|
+
group: "kos-hooks"
|
|
973
|
+
});
|
|
974
|
+
class Ut {
|
|
975
|
+
constructor(t) {
|
|
976
|
+
X(this, "intent");
|
|
977
|
+
X(this, "name", "TapOrHoldIntentStrategy");
|
|
978
|
+
X(this, "isHold", !1);
|
|
979
|
+
X(this, "disposer", null);
|
|
980
|
+
this.intent = t;
|
|
981
|
+
}
|
|
982
|
+
async initiate(t, r) {
|
|
983
|
+
if (this.disposer = setTimeout(() => {
|
|
984
|
+
this.isHold = !0;
|
|
985
|
+
}, 250), t != null && t.isPouring && !this.isHold) {
|
|
986
|
+
ne.debug("additional tap detected. cancelling pour"), await t.cancelPour();
|
|
987
|
+
return;
|
|
988
|
+
}
|
|
989
|
+
if (!(t != null && t.canPour)) {
|
|
990
|
+
ne.debug(`${t == null ? void 0 : t.id} cannot pour. Returning early.`);
|
|
991
|
+
return;
|
|
992
|
+
}
|
|
993
|
+
r ? (ne.debug(`performing intent: ${r}`), await (t == null ? void 0 : t.performIntent(r))) : ne.debug("no intent provided. Returning early.");
|
|
994
|
+
}
|
|
995
|
+
async initiateEnded(t) {
|
|
996
|
+
return this.disposer && clearTimeout(this.disposer), this.disposer = null, this.isHold ? (await (t == null ? void 0 : t.cancelPour()), !1) : (ne.debug("Tap detected. don't cancel and return."), !0);
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
const ue = P.createLogger({
|
|
1000
|
+
name: "TapToPourIntentStrategy",
|
|
1001
|
+
group: "kos-hooks"
|
|
1002
|
+
}), zt = {
|
|
1003
|
+
name: "TapToPourIntentStrategy",
|
|
1004
|
+
async initiate(e, t) {
|
|
1005
|
+
if (e != null && e.isPouring) {
|
|
1006
|
+
ue.debug(`Nozzle ${e == null ? void 0 : e.id} is already pouring. cancelling pour`), await e.cancelPour();
|
|
1007
|
+
return;
|
|
1008
|
+
}
|
|
1009
|
+
if (!(e != null && e.canPour)) {
|
|
1010
|
+
ue.debug(`Nozzle ${e == null ? void 0 : e.id} cannot pour. Returning early.`);
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
1013
|
+
t ? (ue.debug(`performing intent: ${t}`), await (e == null ? void 0 : e.performIntent(t))) : ue.debug("no intent provided. Returning early.");
|
|
1014
|
+
},
|
|
1015
|
+
async initiateEnded(e) {
|
|
1016
|
+
return !0;
|
|
1017
|
+
}
|
|
1018
|
+
}, Re = P.createLogger({
|
|
1019
|
+
name: "HoldToPourStrategy",
|
|
1020
|
+
group: "kos-hooks"
|
|
1021
|
+
}), es = {
|
|
1022
|
+
name: "TapToPourStrategy",
|
|
1023
|
+
async initiate(e) {
|
|
1024
|
+
if (e != null && e.isPouring) {
|
|
1025
|
+
Re.debug(`Nozzle ${e == null ? void 0 : e.id} is already pouring. cancelling pour`), await e.cancelPour();
|
|
1026
|
+
return;
|
|
1027
|
+
}
|
|
1028
|
+
if (!(e != null && e.canPour)) {
|
|
1029
|
+
Re.debug(`Nozzle ${e == null ? void 0 : e.id} cannot pour. Returning early.`);
|
|
1030
|
+
return;
|
|
1031
|
+
}
|
|
1032
|
+
await (e == null ? void 0 : e.pour());
|
|
1033
|
+
},
|
|
1034
|
+
async initiateEnded(e) {
|
|
1035
|
+
return !0;
|
|
1036
|
+
}
|
|
1037
|
+
}, Kt = (e, t, r, n) => C({
|
|
1038
|
+
modelId: e,
|
|
1039
|
+
modelType: lt.type,
|
|
1040
|
+
forceUpdate: !0,
|
|
1041
|
+
options: {
|
|
1042
|
+
servicePathFactory: t,
|
|
1043
|
+
selectedId: r,
|
|
1044
|
+
initialData: n
|
|
1045
|
+
}
|
|
1046
|
+
});
|
|
1047
|
+
function ts(e) {
|
|
1048
|
+
return (t) => {
|
|
1049
|
+
const { model: r, status: n, KosModelLoader: s } = Kt(
|
|
1050
|
+
t.id,
|
|
1051
|
+
t.servicePathFactory,
|
|
1052
|
+
t.itemId
|
|
1053
|
+
);
|
|
1054
|
+
return /* @__PURE__ */ h(s, { ...n, children: /* @__PURE__ */ h(e, { ...t, genericPour: r }) });
|
|
1055
|
+
};
|
|
1056
|
+
}
|
|
1057
|
+
const Xe = N(void 0), ss = ({ children: e }) => {
|
|
1058
|
+
const { model: t, ready: r } = Le(), n = A(() => r && t ? { model: t } : {}, [r, t]);
|
|
1059
|
+
return /* @__PURE__ */ h(Xe.Provider, { value: n, children: e });
|
|
1060
|
+
}, rs = () => {
|
|
1061
|
+
const e = S(
|
|
1062
|
+
Xe
|
|
1063
|
+
);
|
|
1064
|
+
if (!e)
|
|
1065
|
+
throw new Error(
|
|
1066
|
+
"useAssemblyContext must be used within a AssemblyProvider"
|
|
1067
|
+
);
|
|
1068
|
+
return e;
|
|
1069
|
+
}, Ze = N(void 0), ns = ({ children: e }) => {
|
|
1070
|
+
const { model: t, ready: r } = Me(), n = A(() => r && t ? { model: t } : {}, [r, t]);
|
|
1071
|
+
return /* @__PURE__ */ h(Ze.Provider, { value: n, children: e });
|
|
1072
|
+
}, as = () => {
|
|
1073
|
+
const e = S(Ze);
|
|
1074
|
+
if (!e)
|
|
1075
|
+
throw new Error(
|
|
1076
|
+
"useAvailabilityContext must be used within a AvailabilityProvider"
|
|
1077
|
+
);
|
|
1078
|
+
return e;
|
|
1079
|
+
}, Ue = N(void 0), os = ({ children: e, id: t }) => {
|
|
1080
|
+
const { model: r, ready: n } = _e(t), s = A(() => n && r ? { model: r } : {}, [n, r]);
|
|
1081
|
+
return /* @__PURE__ */ h(Ue.Provider, { value: s, children: e });
|
|
1082
|
+
}, is = () => {
|
|
1083
|
+
const e = S(Ue);
|
|
1084
|
+
if (!e)
|
|
1085
|
+
throw new Error("useBoardContext must be used within a BoardProvider");
|
|
1086
|
+
return e;
|
|
1087
|
+
}, ze = N(void 0), cs = ({ children: e }) => {
|
|
1088
|
+
const { model: t, ready: r } = Oe(), n = A(() => r && t ? { model: t } : {}, [r, t]);
|
|
1089
|
+
return /* @__PURE__ */ h(ze.Provider, { value: n, children: e });
|
|
1090
|
+
}, ds = () => {
|
|
1091
|
+
const e = S(ze);
|
|
1092
|
+
if (!e)
|
|
1093
|
+
throw new Error(
|
|
1094
|
+
"useBoardContainerContext must be used within a BoardContainerProvider"
|
|
1095
|
+
);
|
|
1096
|
+
return e;
|
|
1097
|
+
}, et = N(
|
|
1098
|
+
void 0
|
|
1099
|
+
), Et = ({ children: e }) => {
|
|
1100
|
+
const { model: t, ready: r } = je(), n = A(() => {
|
|
1101
|
+
if (r && t) {
|
|
1102
|
+
const o = t.nozzlePaths;
|
|
1103
|
+
return { model: t, nozzlePaths: o };
|
|
1104
|
+
}
|
|
1105
|
+
return {};
|
|
1106
|
+
}, [r, t]), s = r && t ? e : null;
|
|
1107
|
+
return /* @__PURE__ */ h(et.Provider, { value: n, children: s });
|
|
1108
|
+
}, yt = () => {
|
|
1109
|
+
const e = S(et);
|
|
1110
|
+
if (!e)
|
|
1111
|
+
throw new Error(
|
|
1112
|
+
"useDeviceAssemblyContext must be used within a DeviceAssemblyProvider"
|
|
1113
|
+
);
|
|
1114
|
+
return e;
|
|
1115
|
+
};
|
|
1116
|
+
function Ct() {
|
|
1117
|
+
const e = mt.createContext(null);
|
|
1118
|
+
return [() => {
|
|
1119
|
+
const r = S(e);
|
|
1120
|
+
if (r === void 0)
|
|
1121
|
+
throw new Error("useDispenseKitContext must be used within a Provider");
|
|
1122
|
+
return r;
|
|
1123
|
+
}, e.Provider];
|
|
1124
|
+
}
|
|
1125
|
+
function St({
|
|
1126
|
+
children: e,
|
|
1127
|
+
provider: t,
|
|
1128
|
+
props: r,
|
|
1129
|
+
nozzleProps: n
|
|
1130
|
+
}) {
|
|
1131
|
+
const s = $t(r);
|
|
1132
|
+
return /* @__PURE__ */ h(t, { value: s, children: e(n || {}) });
|
|
1133
|
+
}
|
|
1134
|
+
function kt({
|
|
1135
|
+
children: e,
|
|
1136
|
+
provider: t,
|
|
1137
|
+
props: r
|
|
1138
|
+
}) {
|
|
1139
|
+
const { nozzlePaths: n } = yt(), s = (n == null ? void 0 : n.length) || 0;
|
|
1140
|
+
return (n == null ? void 0 : n.map((a, d) => /* @__PURE__ */ h(ht, { path: a, children: /* @__PURE__ */ h(
|
|
1141
|
+
St,
|
|
1142
|
+
{
|
|
1143
|
+
provider: t,
|
|
1144
|
+
props: r,
|
|
1145
|
+
nozzleProps: {
|
|
1146
|
+
nozzleIndex: d,
|
|
1147
|
+
nozzlePath: a,
|
|
1148
|
+
totalNozzles: s,
|
|
1149
|
+
isFirstNozzle: d === 0,
|
|
1150
|
+
isLastNozzle: d === s - 1
|
|
1151
|
+
},
|
|
1152
|
+
children: e
|
|
1153
|
+
}
|
|
1154
|
+
) }, a))) || [];
|
|
1155
|
+
}
|
|
1156
|
+
function Nt({
|
|
1157
|
+
provider: e,
|
|
1158
|
+
props: t
|
|
1159
|
+
}) {
|
|
1160
|
+
return ({ children: r }) => e ? /* @__PURE__ */ h(Et, { children: /* @__PURE__ */ h(
|
|
1161
|
+
kt,
|
|
1162
|
+
{
|
|
1163
|
+
provider: e,
|
|
1164
|
+
props: t,
|
|
1165
|
+
children: r
|
|
1166
|
+
}
|
|
1167
|
+
) }) : null;
|
|
1168
|
+
}
|
|
1169
|
+
function us(e) {
|
|
1170
|
+
const [t, r] = Ct();
|
|
1171
|
+
return [
|
|
1172
|
+
t,
|
|
1173
|
+
Nt({ provider: r, props: e })
|
|
1174
|
+
];
|
|
1175
|
+
}
|
|
1176
|
+
const tt = N(void 0), ls = ({ children: e, id: t }) => {
|
|
1177
|
+
const { model: r, ready: n } = We(t || ""), s = A(() => n && r ? { model: r } : {}, [n, r]);
|
|
1178
|
+
return /* @__PURE__ */ h(tt.Provider, { value: s, children: e });
|
|
1179
|
+
}, ms = () => {
|
|
1180
|
+
const e = S(tt);
|
|
1181
|
+
if (!e)
|
|
1182
|
+
throw new Error("useHolderContext must be used within a HolderProvider");
|
|
1183
|
+
return e;
|
|
1184
|
+
}, st = N(
|
|
1185
|
+
void 0
|
|
1186
|
+
), hs = ({ children: e }) => {
|
|
1187
|
+
const { model: t, ready: r } = qe(), n = A(() => r && t ? { model: t } : {}, [r, t]);
|
|
1188
|
+
return /* @__PURE__ */ h(st.Provider, { value: n, children: e });
|
|
1189
|
+
}, fs = () => {
|
|
1190
|
+
const e = S(st);
|
|
1191
|
+
if (!e)
|
|
1192
|
+
throw new Error(
|
|
1193
|
+
"useHolderContainerContext must be used within a HolderContainerProvider"
|
|
1194
|
+
);
|
|
1195
|
+
return e;
|
|
1196
|
+
}, rt = N(void 0), ps = ({ children: e }) => {
|
|
1197
|
+
const { model: t, ready: r } = Je(), n = A(() => r && t ? { model: t } : {}, [r, t]);
|
|
1198
|
+
return /* @__PURE__ */ h(rt.Provider, { value: n, children: e });
|
|
1199
|
+
}, bs = () => {
|
|
1200
|
+
const e = S(rt);
|
|
1201
|
+
if (!e)
|
|
1202
|
+
throw new Error(
|
|
1203
|
+
"useIngredientContext must be used within a IngredientProvider"
|
|
1204
|
+
);
|
|
1205
|
+
return e;
|
|
1206
|
+
}, nt = N(
|
|
1207
|
+
void 0
|
|
1208
|
+
), vs = ({ children: e }) => {
|
|
1209
|
+
const { model: t, ready: r } = Qe(), n = A(() => r && t ? { model: t } : {}, [r, t]);
|
|
1210
|
+
return /* @__PURE__ */ h(nt.Provider, { value: n, children: e });
|
|
1211
|
+
}, Ts = () => {
|
|
1212
|
+
const e = S(nt);
|
|
1213
|
+
if (!e)
|
|
1214
|
+
throw new Error(
|
|
1215
|
+
"useIngredientContainerContext must be used within a IngredientContainerProvider"
|
|
1216
|
+
);
|
|
1217
|
+
return e;
|
|
1218
|
+
}, Ht = () => {
|
|
1219
|
+
const e = Ne.type;
|
|
1220
|
+
return C({
|
|
1221
|
+
modelId: e,
|
|
1222
|
+
modelType: Ne.type,
|
|
1223
|
+
options: {}
|
|
1224
|
+
});
|
|
1225
|
+
}, at = N(void 0), $s = ({ children: e }) => {
|
|
1226
|
+
const { model: t, ready: r } = Ht(), n = A(() => r && t ? { model: t } : {}, [r, t]);
|
|
1227
|
+
return /* @__PURE__ */ h(at.Provider, { value: n, children: e });
|
|
1228
|
+
}, gs = () => {
|
|
1229
|
+
const e = S(at);
|
|
1230
|
+
if (!e)
|
|
1231
|
+
throw new Error("usePumpContext must be used within a PumpProvider");
|
|
1232
|
+
return e;
|
|
1233
|
+
};
|
|
1234
|
+
export {
|
|
1235
|
+
Qt as $,
|
|
1236
|
+
ss as A,
|
|
1237
|
+
os as B,
|
|
1238
|
+
St as C,
|
|
1239
|
+
Et as D,
|
|
1240
|
+
pt as E,
|
|
1241
|
+
te as F,
|
|
1242
|
+
de as G,
|
|
1243
|
+
ls as H,
|
|
1244
|
+
ps as I,
|
|
1245
|
+
se as J,
|
|
1246
|
+
$t as K,
|
|
1247
|
+
Gt as L,
|
|
1248
|
+
xt as M,
|
|
1249
|
+
ht as N,
|
|
1250
|
+
He as O,
|
|
1251
|
+
$s as P,
|
|
1252
|
+
Tt as Q,
|
|
1253
|
+
je as R,
|
|
1254
|
+
Vt as S,
|
|
1255
|
+
We as T,
|
|
1256
|
+
jt as U,
|
|
1257
|
+
qe as V,
|
|
1258
|
+
Wt as W,
|
|
1259
|
+
Je as X,
|
|
1260
|
+
qt as Y,
|
|
1261
|
+
Jt as Z,
|
|
1262
|
+
Qe as _,
|
|
1263
|
+
ns as a,
|
|
1264
|
+
Ye as a0,
|
|
1265
|
+
Xt as a1,
|
|
1266
|
+
vt as a2,
|
|
1267
|
+
Zt as a3,
|
|
1268
|
+
At as a4,
|
|
1269
|
+
Ve as a5,
|
|
1270
|
+
Ut as a6,
|
|
1271
|
+
zt as a7,
|
|
1272
|
+
es as a8,
|
|
1273
|
+
Kt as a9,
|
|
1274
|
+
ts as aa,
|
|
1275
|
+
Ge as ab,
|
|
1276
|
+
as as b,
|
|
1277
|
+
is as c,
|
|
1278
|
+
cs as d,
|
|
1279
|
+
ds as e,
|
|
1280
|
+
Nt as f,
|
|
1281
|
+
yt as g,
|
|
1282
|
+
ms as h,
|
|
1283
|
+
us as i,
|
|
1284
|
+
hs as j,
|
|
1285
|
+
fs as k,
|
|
1286
|
+
bs as l,
|
|
1287
|
+
vs as m,
|
|
1288
|
+
Ts as n,
|
|
1289
|
+
M as o,
|
|
1290
|
+
gs as p,
|
|
1291
|
+
Le as q,
|
|
1292
|
+
Me as r,
|
|
1293
|
+
Ot as s,
|
|
1294
|
+
_e as t,
|
|
1295
|
+
rs as u,
|
|
1296
|
+
Yt as v,
|
|
1297
|
+
_t as w,
|
|
1298
|
+
Oe as x,
|
|
1299
|
+
Ft as y,
|
|
1300
|
+
ft as z
|
|
1301
|
+
};
|
|
1302
|
+
//# sourceMappingURL=pump-provider-BTnIydH2.js.map
|