@kosdev-code/kos-dispense-sdk 2.0.36 → 2.0.38
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/package.json +3 -3
- package/{pump-provider-Dm4nQHtl.js → pump-provider--hQGuh_w.js} +134 -137
- package/pump-provider--hQGuh_w.js.map +1 -0
- package/pump-provider-5w04Zi8j.cjs +2 -0
- package/pump-provider-5w04Zi8j.cjs.map +1 -0
- package/ui.cjs +1 -1
- package/ui.js +1 -1
- package/pump-provider-Dm4nQHtl.js.map +0 -1
- package/pump-provider-Dw_WM4Zu.cjs +0 -2
- package/pump-provider-Dw_WM4Zu.cjs.map +0 -1
|
@@ -3,8 +3,8 @@ var ot = (e, t, r) => t in e ? at(e, t, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var J = (e, t, r) => (ot(e, typeof t != "symbol" ? t + "" : t, r), r);
|
|
4
4
|
import { jsx as m } from "@emotion/react/jsx-runtime";
|
|
5
5
|
import { A as Ie, b as Ae, e as ct, d as xe, N as dt, f as ke, H as ut, g as Ee, I as Se, h as Ne, G as lt, P as He } from "./dispense-registration-manager-eOOE05xT.js";
|
|
6
|
-
import { useKosModel as H, getKosCompanionModel as
|
|
7
|
-
import mt, { createContext as L, useMemo as
|
|
6
|
+
import { useKosModel as H, getKosCompanionModel as fe, kosAutoEffect as Re, KosLog as P, usePressGesture as be, EventBus as g, TimerManager as Be } from "@kosdev-code/kos-ui-sdk";
|
|
7
|
+
import mt, { createContext as L, useMemo as A, useContext as K, useState as N, useCallback as o, useEffect as O, useRef as Ce } from "react";
|
|
8
8
|
const ye = () => {
|
|
9
9
|
const e = Ie.type;
|
|
10
10
|
return H({
|
|
@@ -65,7 +65,7 @@ const Ye = (e) => H({
|
|
|
65
65
|
path: e
|
|
66
66
|
}
|
|
67
67
|
}), _e = L(void 0), pt = ({ children: e, path: t }) => {
|
|
68
|
-
const { model: r, ready: n } = Ye(t), s =
|
|
68
|
+
const { model: r, ready: n } = Ye(t), s = A(() => n && r ? { model: r } : {}, [n, r]);
|
|
69
69
|
return /* @__PURE__ */ m(_e.Provider, { value: s, children: e });
|
|
70
70
|
}, D = () => {
|
|
71
71
|
const e = K(_e);
|
|
@@ -77,8 +77,8 @@ const Ye = (e) => H({
|
|
|
77
77
|
onClearBeverage: t,
|
|
78
78
|
companionType: r
|
|
79
79
|
}) => {
|
|
80
|
-
const { model: n } = D(), [s, i] =
|
|
81
|
-
(d) =>
|
|
80
|
+
const { model: n } = D(), [s, i] = N([]), [u, l] = N(null), f = A(() => r ? s.map(
|
|
81
|
+
(d) => fe(d, r)
|
|
82
82
|
) : [], [s, r]), h = o(
|
|
83
83
|
async (d) => {
|
|
84
84
|
l(d), await (n == null ? void 0 : n.setSelectedPourable({ beverage: d })), e == null || e(d);
|
|
@@ -97,8 +97,8 @@ const Ye = (e) => H({
|
|
|
97
97
|
i(b ?? []);
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
|
-
const
|
|
101
|
-
i(
|
|
100
|
+
const x = n.getAvailabilityByParent($.id).filter((b) => b.visible);
|
|
101
|
+
i(x ?? []);
|
|
102
102
|
});
|
|
103
103
|
return () => {
|
|
104
104
|
d();
|
|
@@ -115,7 +115,7 @@ const Ye = (e) => H({
|
|
|
115
115
|
onBrandCleared: t,
|
|
116
116
|
companionType: r
|
|
117
117
|
}) => {
|
|
118
|
-
const { model: n } = D(), [s, i] =
|
|
118
|
+
const { model: n } = D(), [s, i] = N(null), [u, l] = N([]), f = A(() => r ? u.map((d) => fe(d, r)) : [], [u, r]), h = o(
|
|
119
119
|
async (d) => {
|
|
120
120
|
i(d), n == null || n.setSelectedBrand(d), e == null || e(d);
|
|
121
121
|
},
|
|
@@ -137,7 +137,7 @@ const Ye = (e) => H({
|
|
|
137
137
|
selectBrand: h,
|
|
138
138
|
clearBrand: c
|
|
139
139
|
};
|
|
140
|
-
}, bt =
|
|
140
|
+
}, bt = P.createLogger({
|
|
141
141
|
name: "HoldToPourStrategy",
|
|
142
142
|
group: "kos-hooks"
|
|
143
143
|
}), Ge = {
|
|
@@ -152,7 +152,7 @@ const Ye = (e) => H({
|
|
|
152
152
|
async initiateEnded(e) {
|
|
153
153
|
await (e == null ? void 0 : e.cancelPour());
|
|
154
154
|
}
|
|
155
|
-
}, re =
|
|
155
|
+
}, re = P.createLogger({
|
|
156
156
|
name: "useNozzlePour",
|
|
157
157
|
group: "kos-hooks"
|
|
158
158
|
}), vt = ({
|
|
@@ -177,7 +177,7 @@ const Ye = (e) => H({
|
|
|
177
177
|
re.debug(`Force cancelling pour for nozzle ${i == null ? void 0 : i.id}.`), i == null || i.cancelPour(), t == null || t();
|
|
178
178
|
}, [t, i]);
|
|
179
179
|
return {
|
|
180
|
-
handlers:
|
|
180
|
+
handlers: be({
|
|
181
181
|
onPressed: u,
|
|
182
182
|
onRelease: l
|
|
183
183
|
}).dom,
|
|
@@ -189,12 +189,12 @@ const Ye = (e) => H({
|
|
|
189
189
|
onFlavorCleared: t,
|
|
190
190
|
companionType: r
|
|
191
191
|
}) => {
|
|
192
|
-
const { model: n } = D(), s =
|
|
192
|
+
const { model: n } = D(), s = A(
|
|
193
193
|
() => (n == null ? void 0 : n.getGroupAvailabilityItems("flavors").filter((c) => c.visible)) ?? [],
|
|
194
194
|
[n]
|
|
195
|
-
), i =
|
|
196
|
-
(c) =>
|
|
197
|
-
) : [], [s, r]), [u, l] =
|
|
195
|
+
), i = A(() => r ? s.map(
|
|
196
|
+
(c) => fe(c, r)
|
|
197
|
+
) : [], [s, r]), [u, l] = N([]), f = o(
|
|
198
198
|
async (c) => {
|
|
199
199
|
if (l(
|
|
200
200
|
(d) => d != null && d.includes(c) ? [...d.filter(($) => $ !== c)] : [...d ?? [], c]
|
|
@@ -221,12 +221,12 @@ const Ye = (e) => H({
|
|
|
221
221
|
selectedFlavors: u,
|
|
222
222
|
clearFlavors: h
|
|
223
223
|
};
|
|
224
|
-
}, Q = "brands", ne = "beverages", X = "flavors", M =
|
|
224
|
+
}, Q = "brands", ne = "beverages", X = "flavors", M = P.createLogger({ name: "use-cui-kit" }), gt = ({
|
|
225
225
|
initialGroup: e = Q,
|
|
226
226
|
options: t = {}
|
|
227
227
|
}) => {
|
|
228
228
|
var ee, te, se;
|
|
229
|
-
const [r, n] =
|
|
229
|
+
const [r, n] = N(e), { model: s } = D(), i = Ce([]), u = o(
|
|
230
230
|
(p) => {
|
|
231
231
|
n(X);
|
|
232
232
|
const C = `/kos/dispense/${s == null ? void 0 : s.path}/brand/selected/`;
|
|
@@ -258,9 +258,9 @@ const Ye = (e) => H({
|
|
|
258
258
|
}, [s == null ? void 0 : s.path]), $ = o(() => {
|
|
259
259
|
const p = `/kos/dispense/${s == null ? void 0 : s.path}/pour/`;
|
|
260
260
|
g.publish(p, {});
|
|
261
|
-
}, [s == null ? void 0 : s.path]),
|
|
261
|
+
}, [s == null ? void 0 : s.path]), x = o(async () => {
|
|
262
262
|
const p = `/kos/dispense/${s == null ? void 0 : s.path}/pre/pour/`;
|
|
263
|
-
return g.publish(p, {}), await (
|
|
263
|
+
return g.publish(p, {}), await (k == null ? void 0 : k()) || !0;
|
|
264
264
|
}, [s == null ? void 0 : s.path]), b = o(async () => {
|
|
265
265
|
const p = `/kos/dispense/${s == null ? void 0 : s.path}/pre/pour/rejected/`;
|
|
266
266
|
g.publish(p, {});
|
|
@@ -275,43 +275,43 @@ const Ye = (e) => H({
|
|
|
275
275
|
beverages: ae,
|
|
276
276
|
selectBeverage: oe,
|
|
277
277
|
selectedBeverage: ce,
|
|
278
|
-
clearBeverage:
|
|
278
|
+
clearBeverage: T,
|
|
279
279
|
beverageCompanions: B
|
|
280
280
|
} = ht({
|
|
281
281
|
companionType: (te = t.companionTypes) == null ? void 0 : te.beverage,
|
|
282
282
|
onBeverageSelected: f,
|
|
283
283
|
onClearBeverage: h
|
|
284
284
|
}), {
|
|
285
|
-
clearFlavors:
|
|
285
|
+
clearFlavors: ve,
|
|
286
286
|
flavors: q,
|
|
287
|
-
selectFlavor:
|
|
287
|
+
selectFlavor: de,
|
|
288
288
|
selectedFlavors: F,
|
|
289
|
-
flavorCompanions:
|
|
289
|
+
flavorCompanions: I
|
|
290
290
|
} = $t({
|
|
291
291
|
companionType: (se = t.companionTypes) == null ? void 0 : se.flavor,
|
|
292
292
|
onFlavorSelected: c,
|
|
293
293
|
onFlavorCleared: d
|
|
294
|
-
}), [
|
|
294
|
+
}), [k, U] = N(), E = o((p) => {
|
|
295
295
|
U(() => p);
|
|
296
296
|
}, []), Y = vt({
|
|
297
297
|
onPour: $,
|
|
298
298
|
onPourCancel: v,
|
|
299
|
-
onBeforePour:
|
|
299
|
+
onBeforePour: x,
|
|
300
300
|
onBeforePourRejected: b
|
|
301
301
|
}), j = o(() => {
|
|
302
302
|
switch (M.debug(`Navigating back from group: ${r}`), r) {
|
|
303
303
|
case Q:
|
|
304
|
-
|
|
304
|
+
T(), w();
|
|
305
305
|
break;
|
|
306
306
|
case ne:
|
|
307
307
|
case X:
|
|
308
|
-
n(e),
|
|
308
|
+
n(e), T(), w();
|
|
309
309
|
break;
|
|
310
310
|
}
|
|
311
|
-
}, [
|
|
311
|
+
}, [T, w, r, e]), V = o(() => {
|
|
312
312
|
const p = `/kos/dispense/${s == null ? void 0 : s.path}/home/`;
|
|
313
|
-
g.publish(p, {}), n(e), e === Q && (
|
|
314
|
-
}, [
|
|
313
|
+
g.publish(p, {}), n(e), e === Q && (T(), w()), e === ne && T();
|
|
314
|
+
}, [T, w, e]), ue = o(() => {
|
|
315
315
|
if (i.current.length === 0) {
|
|
316
316
|
M.debug("No timers to pause.");
|
|
317
317
|
return;
|
|
@@ -319,7 +319,7 @@ const Ye = (e) => H({
|
|
|
319
319
|
M.debug(`Pausing ${i.current.length} timers.`), i.current.forEach((p) => {
|
|
320
320
|
M.debug(`Pausing timer with id ${p.id}.`), p.pause();
|
|
321
321
|
});
|
|
322
|
-
}, []),
|
|
322
|
+
}, []), le = o(() => {
|
|
323
323
|
if (i.current.length === 0) {
|
|
324
324
|
M.debug("No timers to restart.");
|
|
325
325
|
return;
|
|
@@ -339,8 +339,8 @@ const Ye = (e) => H({
|
|
|
339
339
|
i.current.push(p);
|
|
340
340
|
}
|
|
341
341
|
}, []),
|
|
342
|
-
pause:
|
|
343
|
-
restart:
|
|
342
|
+
pause: ue,
|
|
343
|
+
restart: le
|
|
344
344
|
},
|
|
345
345
|
nav: {
|
|
346
346
|
currentGroup: r,
|
|
@@ -348,7 +348,7 @@ const Ye = (e) => H({
|
|
|
348
348
|
home: V
|
|
349
349
|
},
|
|
350
350
|
pour: Y,
|
|
351
|
-
updateOnBeforePour:
|
|
351
|
+
updateOnBeforePour: E,
|
|
352
352
|
selections: {
|
|
353
353
|
[Q]: R,
|
|
354
354
|
[ne]: ce,
|
|
@@ -365,22 +365,22 @@ const Ye = (e) => H({
|
|
|
365
365
|
[ne]: {
|
|
366
366
|
models: ae,
|
|
367
367
|
companions: B,
|
|
368
|
-
clear:
|
|
368
|
+
clear: T,
|
|
369
369
|
handlers: {
|
|
370
370
|
onSelected: oe
|
|
371
371
|
}
|
|
372
372
|
},
|
|
373
373
|
[X]: {
|
|
374
374
|
models: q,
|
|
375
|
-
companions:
|
|
376
|
-
clear:
|
|
375
|
+
companions: I,
|
|
376
|
+
clear: ve,
|
|
377
377
|
handlers: {
|
|
378
|
-
onSelected:
|
|
378
|
+
onSelected: de
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
381
|
};
|
|
382
382
|
}, wt = (e) => {
|
|
383
|
-
const { model: t } = D(), [r, n] =
|
|
383
|
+
const { model: t } = D(), [r, n] = N(null), {
|
|
384
384
|
onAmbientTimer: s,
|
|
385
385
|
onAttractTimer: i,
|
|
386
386
|
onResetAttractTimer: u,
|
|
@@ -388,19 +388,19 @@ const Ye = (e) => H({
|
|
|
388
388
|
defaultAttractTime: f,
|
|
389
389
|
defaultAmbientTime: h
|
|
390
390
|
} = e, c = o(() => {
|
|
391
|
-
s && (
|
|
391
|
+
s && (P.info("Ambient timer expired. Calling callback"), s == null || s());
|
|
392
392
|
}, [s]), d = o(() => {
|
|
393
|
-
i && (
|
|
393
|
+
i && (P.info("Attract timer expired. Calling callback"), i == null || i());
|
|
394
394
|
}, [i]), $ = o(() => {
|
|
395
395
|
r && (r.restart(), u == null || u());
|
|
396
|
-
}, [r, u]),
|
|
396
|
+
}, [r, u]), x = o(() => {
|
|
397
397
|
r && (r.reset(), u == null || u());
|
|
398
398
|
}, [r, u]), b = o(() => {
|
|
399
399
|
r && (r.pause(), l == null || l());
|
|
400
400
|
}, [r, l]);
|
|
401
401
|
return O(() => {
|
|
402
402
|
if (t && f) {
|
|
403
|
-
|
|
403
|
+
P.info("Nozzle is available. Creating timers");
|
|
404
404
|
const v = Be.createTimer(
|
|
405
405
|
"attract-timer-" + t.path,
|
|
406
406
|
f
|
|
@@ -418,7 +418,7 @@ const Ye = (e) => H({
|
|
|
418
418
|
};
|
|
419
419
|
}
|
|
420
420
|
return () => {
|
|
421
|
-
|
|
421
|
+
P.info("Nozzle is not available. No timers to clear");
|
|
422
422
|
};
|
|
423
423
|
}, [
|
|
424
424
|
h,
|
|
@@ -429,7 +429,7 @@ const Ye = (e) => H({
|
|
|
429
429
|
]), {
|
|
430
430
|
attractTimer: r,
|
|
431
431
|
restart: $,
|
|
432
|
-
pause:
|
|
432
|
+
pause: x,
|
|
433
433
|
resume: b
|
|
434
434
|
};
|
|
435
435
|
}, Tt = (e, t) => {
|
|
@@ -449,7 +449,7 @@ const Ye = (e) => H({
|
|
|
449
449
|
onBeforePourRejected: c,
|
|
450
450
|
onAmbientTimer: d,
|
|
451
451
|
onAttractTimer: $,
|
|
452
|
-
onResumeAttractTimer:
|
|
452
|
+
onResumeAttractTimer: x,
|
|
453
453
|
onIdleTimeout: b,
|
|
454
454
|
onAreYouThereTimeout: v
|
|
455
455
|
}) => {
|
|
@@ -499,7 +499,7 @@ const Ye = (e) => H({
|
|
|
499
499
|
},
|
|
500
500
|
{
|
|
501
501
|
topic: `/kos/dispense/${a == null ? void 0 : a.path}/attract/resume/`,
|
|
502
|
-
callback:
|
|
502
|
+
callback: x
|
|
503
503
|
},
|
|
504
504
|
{
|
|
505
505
|
topic: `/kos/dispense/${a == null ? void 0 : a.path}/idle/timeout/`,
|
|
@@ -535,21 +535,21 @@ const Ye = (e) => H({
|
|
|
535
535
|
u,
|
|
536
536
|
f,
|
|
537
537
|
h,
|
|
538
|
-
|
|
538
|
+
x,
|
|
539
539
|
b,
|
|
540
540
|
v,
|
|
541
541
|
e,
|
|
542
542
|
l
|
|
543
543
|
]);
|
|
544
|
-
}, y =
|
|
545
|
-
const { model: t } = D(), [r, n] =
|
|
544
|
+
}, y = P.createLogger({ name: "useCuiKitTimers" }), Ke = (e) => {
|
|
545
|
+
const { model: t } = D(), [r, n] = N(null), {
|
|
546
546
|
onAreYouThereTimer: s,
|
|
547
547
|
onIdleTimer: i,
|
|
548
548
|
onResetIdleTimer: u,
|
|
549
549
|
defaultAreYouThereTime: l = 10,
|
|
550
550
|
defaultIdleTime: f = 20
|
|
551
551
|
} = e, h = Ce(!1), c = o(() => {
|
|
552
|
-
!h.current && s && (
|
|
552
|
+
!h.current && s && (P.info("Are you there timer expired. Calling callback"), h.current = !0, s == null || s());
|
|
553
553
|
}, [s]), d = o(() => {
|
|
554
554
|
y.debug(
|
|
555
555
|
"handleIdleTimer called in useCuiKitTimers, onIdleTimer exists:",
|
|
@@ -557,8 +557,8 @@ const Ye = (e) => H({
|
|
|
557
557
|
), i ? (y.debug("Idle timer expired. Calling callback"), i == null || i()) : y.debug("No onIdleTimer callback provided!");
|
|
558
558
|
}, [i]), $ = o(() => {
|
|
559
559
|
y.debug(`TIMER RESTART called for ${e.prefix ?? ""}timer`), r && (r.restart(), h.current = !1, u == null || u());
|
|
560
|
-
}, [r, u, e.prefix]),
|
|
561
|
-
y.debug(
|
|
560
|
+
}, [r, u, e.prefix]), x = o(() => {
|
|
561
|
+
y.debug(`TIMER PAUSE/RESET called for ${e.prefix ?? ""}timer`), r && (r.reset(), h.current = !1, u == null || u());
|
|
562
562
|
}, [r, u, e.prefix]);
|
|
563
563
|
return O(() => {
|
|
564
564
|
if (y.debug(
|
|
@@ -570,7 +570,7 @@ const Ye = (e) => H({
|
|
|
570
570
|
f
|
|
571
571
|
);
|
|
572
572
|
return y.debug(
|
|
573
|
-
|
|
573
|
+
`Adding idle timer action for ${e.prefix ?? ""}idle-timer-${t.path} with callback:`,
|
|
574
574
|
!!d
|
|
575
575
|
), b == null || b.addTimeoutAction({
|
|
576
576
|
name: "idle-timer",
|
|
@@ -597,9 +597,9 @@ const Ye = (e) => H({
|
|
|
597
597
|
]), {
|
|
598
598
|
idleTimer: r,
|
|
599
599
|
restart: $,
|
|
600
|
-
pause:
|
|
600
|
+
pause: x
|
|
601
601
|
};
|
|
602
|
-
}, _ =
|
|
602
|
+
}, _ = P.createLogger({ name: "useDefaultCuiKitLifecycle" }), _t = ({
|
|
603
603
|
kit: e,
|
|
604
604
|
inactivity: t,
|
|
605
605
|
pour: r,
|
|
@@ -608,32 +608,32 @@ const Ye = (e) => H({
|
|
|
608
608
|
areYouThereRejectionPolicy: i = "pause"
|
|
609
609
|
}) => {
|
|
610
610
|
var ge, we, Te, Pe;
|
|
611
|
-
const [u, l] =
|
|
611
|
+
const [u, l] = N(!1), [f, h] = N(!1), { model: c } = D(), [d, $] = N(!1), x = (t == null ? void 0 : t.idleTimeout) ?? 15, b = (t == null ? void 0 : t.areYouThereTimeoutOffset) ?? 10, v = (r == null ? void 0 : r.idleTimeout) ?? (t == null ? void 0 : t.idleTimeout) ?? 10, a = (r == null ? void 0 : r.areYouThereTimeoutOffset) ?? (t == null ? void 0 : t.areYouThereTimeoutOffset) ?? 5, G = n == null ? void 0 : n.ambientTimeoutOffset, R = n == null ? void 0 : n.attractTimeout, w = o(() => {
|
|
612
612
|
if (_.info("handleIdleTimeout called - navigating home and publishing event"), F(!1), e == null || e.nav.home(), c) {
|
|
613
|
-
const
|
|
614
|
-
g.publish(
|
|
613
|
+
const S = `/kos/dispense/${c.path}/idle/timeout/`;
|
|
614
|
+
g.publish(S, {});
|
|
615
615
|
}
|
|
616
616
|
}, [(ge = e == null ? void 0 : e.nav) == null ? void 0 : ge.home, c]), W = o(() => {
|
|
617
617
|
_.info("handleResetIdleTimer called - resetting idle timer"), F(!1);
|
|
618
618
|
}, []), ae = o(() => {
|
|
619
619
|
if (G && (l(!0), h(!1), c)) {
|
|
620
|
-
const
|
|
621
|
-
g.publish(
|
|
620
|
+
const S = `/kos/dispense/${c.path}/ambient/start/`;
|
|
621
|
+
g.publish(S, {});
|
|
622
622
|
}
|
|
623
623
|
}, [G, c]), oe = o(() => {
|
|
624
624
|
if (R && (h(!0), l(!1), c)) {
|
|
625
|
-
const
|
|
626
|
-
g.publish(
|
|
625
|
+
const S = `/kos/dispense/${c.path}/attract/start/`;
|
|
626
|
+
g.publish(S, {});
|
|
627
627
|
}
|
|
628
628
|
}, [R, c]), ce = o(() => {
|
|
629
629
|
if (R && (h(!1), l(!1), e == null || e.nav.home(), c)) {
|
|
630
|
-
const
|
|
631
|
-
g.publish(
|
|
630
|
+
const S = `/kos/dispense/${c.path}/attract/resume/`;
|
|
631
|
+
g.publish(S, {});
|
|
632
632
|
}
|
|
633
633
|
}, [e == null ? void 0 : e.nav, R, c]), {
|
|
634
|
-
pause:
|
|
634
|
+
pause: T,
|
|
635
635
|
restart: B,
|
|
636
|
-
resume:
|
|
636
|
+
resume: ve,
|
|
637
637
|
attractTimer: q
|
|
638
638
|
} = wt({
|
|
639
639
|
defaultAmbientTime: G,
|
|
@@ -643,27 +643,24 @@ const Ye = (e) => H({
|
|
|
643
643
|
onResumeAttractTimer: ce
|
|
644
644
|
});
|
|
645
645
|
(we = e == null ? void 0 : e.timers) == null || we.add(q);
|
|
646
|
-
const [
|
|
646
|
+
const [de, F] = N(!1);
|
|
647
647
|
_.info(
|
|
648
648
|
"Creating idle timer with timeout:",
|
|
649
|
-
|
|
649
|
+
x,
|
|
650
650
|
"seconds and callback:",
|
|
651
651
|
!!w
|
|
652
652
|
);
|
|
653
|
-
const { pause:
|
|
653
|
+
const { pause: I, restart: k, idleTimer: U } = Ke({
|
|
654
654
|
defaultAreYouThereTime: b,
|
|
655
|
-
defaultIdleTime:
|
|
655
|
+
defaultIdleTime: x,
|
|
656
656
|
onIdleTimer: w,
|
|
657
657
|
onResetIdleTimer: W
|
|
658
658
|
});
|
|
659
659
|
_.info(
|
|
660
|
-
|
|
661
|
-
v,
|
|
662
|
-
"seconds and callback:",
|
|
663
|
-
!!w
|
|
660
|
+
`Creating pour timer with timeout: ${v} seconds and callback: ${!!w}`
|
|
664
661
|
);
|
|
665
662
|
const {
|
|
666
|
-
pause:
|
|
663
|
+
pause: E,
|
|
667
664
|
restart: Y,
|
|
668
665
|
idleTimer: j
|
|
669
666
|
} = Ke({
|
|
@@ -672,31 +669,31 @@ const Ye = (e) => H({
|
|
|
672
669
|
onIdleTimer: w,
|
|
673
670
|
prefix: "pour-"
|
|
674
671
|
}), V = o(async () => {
|
|
675
|
-
let
|
|
672
|
+
let S = !0;
|
|
676
673
|
if (s)
|
|
677
674
|
try {
|
|
678
|
-
|
|
679
|
-
} catch (
|
|
680
|
-
_.error(`onBeforeAreYouThereTimer callback failed: ${
|
|
675
|
+
S = await s();
|
|
676
|
+
} catch (me) {
|
|
677
|
+
_.error(`onBeforeAreYouThereTimer callback failed: ${me}`), S = !1;
|
|
681
678
|
}
|
|
682
|
-
if (
|
|
679
|
+
if (S) {
|
|
683
680
|
if (c) {
|
|
684
|
-
const
|
|
685
|
-
g.publish(
|
|
681
|
+
const me = `/kos/dispense/${c.path}/are-you-there/timeout/`;
|
|
682
|
+
g.publish(me, {});
|
|
686
683
|
}
|
|
687
|
-
F(!0), d ?
|
|
684
|
+
F(!0), d ? E() : I();
|
|
688
685
|
} else
|
|
689
686
|
switch (i) {
|
|
690
687
|
case "pause":
|
|
691
|
-
d ?
|
|
688
|
+
d ? E() : I();
|
|
692
689
|
break;
|
|
693
690
|
case "restart":
|
|
694
|
-
d ? Y() :
|
|
691
|
+
d ? Y() : k();
|
|
695
692
|
break;
|
|
696
693
|
}
|
|
697
|
-
}, [s, c, i, d]),
|
|
698
|
-
F(!1), d ? (Y(),
|
|
699
|
-
}, [d,
|
|
694
|
+
}, [s, c, i, d]), ue = o(() => {
|
|
695
|
+
F(!1), T(), d ? (Y(), I()) : (k(), E());
|
|
696
|
+
}, [d, I, E, k, Y]);
|
|
700
697
|
O(() => {
|
|
701
698
|
U && U.addTimeoutAction({
|
|
702
699
|
name: "are-you-there-timer",
|
|
@@ -710,29 +707,29 @@ const Ye = (e) => H({
|
|
|
710
707
|
action: V
|
|
711
708
|
});
|
|
712
709
|
}, [j, a, V]), (Te = e == null ? void 0 : e.timers) == null || Te.add(U), (Pe = e == null ? void 0 : e.timers) == null || Pe.add(j);
|
|
713
|
-
const
|
|
714
|
-
$(!1),
|
|
715
|
-
}, [
|
|
716
|
-
$(!0), _.info("restarting pour timer"), Y(),
|
|
717
|
-
}, [
|
|
718
|
-
$(!1), _.info("restarting pour timer on before pour rejected"),
|
|
710
|
+
const le = o(() => {
|
|
711
|
+
$(!1), E(), I(), T();
|
|
712
|
+
}, [I, E]), $e = o(() => {
|
|
713
|
+
$(!0), _.info("restarting pour timer"), Y(), T(), I();
|
|
714
|
+
}, [I, Y]), ee = o(() => {
|
|
715
|
+
$(!1), _.info("restarting pour timer on before pour rejected"), E(), k();
|
|
719
716
|
}, []), te = o(() => {
|
|
720
|
-
|
|
721
|
-
}, [
|
|
722
|
-
h(!1), l(!1), $(!1),
|
|
723
|
-
}, [B,
|
|
724
|
-
h(!1), l(!1), $(!1),
|
|
725
|
-
}, [
|
|
726
|
-
h(!1), l(!1), $(!1), B(),
|
|
727
|
-
}, [B,
|
|
728
|
-
h(!1), l(!1), B(),
|
|
729
|
-
}, [B,
|
|
717
|
+
T(), h(!1), l(!1), k();
|
|
718
|
+
}, [T, k]), se = o(() => {
|
|
719
|
+
h(!1), l(!1), $(!1), E(), B();
|
|
720
|
+
}, [B, E]), p = o(() => {
|
|
721
|
+
h(!1), l(!1), $(!1), T(), k();
|
|
722
|
+
}, [T, k]), C = o(() => {
|
|
723
|
+
h(!1), l(!1), $(!1), B(), I(), E();
|
|
724
|
+
}, [B, I, E]), nt = o(() => {
|
|
725
|
+
h(!1), l(!1), B(), I();
|
|
726
|
+
}, [B, I]);
|
|
730
727
|
Pt({
|
|
731
728
|
onBrandSelected: te,
|
|
732
729
|
onBrandCleared: se,
|
|
733
730
|
onBeverageSelected: p,
|
|
734
731
|
onBeverageCleared: C,
|
|
735
|
-
onPour:
|
|
732
|
+
onPour: le,
|
|
736
733
|
onPourCancel: $e,
|
|
737
734
|
onBeforePourRejected: ee,
|
|
738
735
|
onInit: nt
|
|
@@ -744,18 +741,18 @@ const Ye = (e) => H({
|
|
|
744
741
|
const it = d ? a : b;
|
|
745
742
|
return O(() => {
|
|
746
743
|
if (c && q) {
|
|
747
|
-
const
|
|
748
|
-
g.publish(
|
|
744
|
+
const S = `/kos/dispense/${c == null ? void 0 : c.path}/init/`;
|
|
745
|
+
g.publish(S, {});
|
|
749
746
|
}
|
|
750
747
|
}, [c, q]), {
|
|
751
|
-
showAreYouThere:
|
|
752
|
-
clearAreYouThere:
|
|
753
|
-
pauseIdleTimer:
|
|
754
|
-
restartIdleTimer:
|
|
748
|
+
showAreYouThere: de,
|
|
749
|
+
clearAreYouThere: ue,
|
|
750
|
+
pauseIdleTimer: I,
|
|
751
|
+
restartIdleTimer: k,
|
|
755
752
|
areYouThereCountdown: it,
|
|
756
753
|
showAmbientScreen: u,
|
|
757
754
|
showAttractScreen: f,
|
|
758
|
-
pauseScreenTimer:
|
|
755
|
+
pauseScreenTimer: T,
|
|
759
756
|
restartScreenTimer: B
|
|
760
757
|
};
|
|
761
758
|
}, Fe = () => {
|
|
@@ -804,22 +801,22 @@ const Ve = () => {
|
|
|
804
801
|
modelType: Se.type,
|
|
805
802
|
options: {}
|
|
806
803
|
});
|
|
807
|
-
},
|
|
804
|
+
}, pe = P.createLogger({
|
|
808
805
|
name: "HoldToPourIntentStrategy",
|
|
809
806
|
group: "kos-hooks"
|
|
810
807
|
}), It = {
|
|
811
808
|
name: "HoldToPourIntentStrategy",
|
|
812
809
|
async initiate(e, t) {
|
|
813
810
|
if (!(e != null && e.canPour)) {
|
|
814
|
-
|
|
811
|
+
pe.debug(`${e == null ? void 0 : e.id} cannot pour. Returning early.`);
|
|
815
812
|
return;
|
|
816
813
|
}
|
|
817
|
-
t ? (
|
|
814
|
+
t ? (pe.debug(`performing intent: ${t}`), await (e == null ? void 0 : e.performIntent(t))) : pe.debug("no intent provided. Returning early.");
|
|
818
815
|
},
|
|
819
816
|
async initiateEnded(e) {
|
|
820
817
|
await (e == null ? void 0 : e.cancelPour());
|
|
821
818
|
}
|
|
822
|
-
},
|
|
819
|
+
}, he = P.createLogger({
|
|
823
820
|
name: "useNozzlePour",
|
|
824
821
|
group: "kos-hooks"
|
|
825
822
|
}), jt = ({
|
|
@@ -829,19 +826,19 @@ const Ve = () => {
|
|
|
829
826
|
strategy: n = It
|
|
830
827
|
}) => {
|
|
831
828
|
const s = o(() => {
|
|
832
|
-
|
|
829
|
+
he.debug(
|
|
833
830
|
`[${n == null ? void 0 : n.name}] - Pour initiated for model ${r == null ? void 0 : r.id}.`
|
|
834
831
|
), n == null || n.initiate(r), e == null || e();
|
|
835
832
|
}, [e, r, n]), i = o(() => {
|
|
836
833
|
var f;
|
|
837
|
-
|
|
834
|
+
he.debug(
|
|
838
835
|
`[${n == null ? void 0 : n.name}] - Pour initiate ended called for nozzle ${r == null ? void 0 : r.id}.`
|
|
839
836
|
), (f = n == null ? void 0 : n.initiateEnded) == null || f.call(n, r), t == null || t();
|
|
840
837
|
}, [t, r, n]), u = o(() => {
|
|
841
|
-
|
|
838
|
+
he.debug(`Force cancelling pour for nozzle ${r == null ? void 0 : r.id}.`), r == null || r.cancelPour(), t == null || t();
|
|
842
839
|
}, [t, r]);
|
|
843
840
|
return {
|
|
844
|
-
handlers:
|
|
841
|
+
handlers: be({
|
|
845
842
|
onPressed: s,
|
|
846
843
|
onRelease: i
|
|
847
844
|
}).dom,
|
|
@@ -875,7 +872,7 @@ function qt(e, t) {
|
|
|
875
872
|
return /* @__PURE__ */ m(i, { ...s, children: /* @__PURE__ */ m(t, { ...r, nozzle: n }) });
|
|
876
873
|
};
|
|
877
874
|
}
|
|
878
|
-
const Z =
|
|
875
|
+
const Z = P.createLogger({
|
|
879
876
|
name: "usePour",
|
|
880
877
|
group: "kos-hooks"
|
|
881
878
|
}), Jt = ({
|
|
@@ -903,14 +900,14 @@ const Z = T.createLogger({
|
|
|
903
900
|
Z.debug(`Force cancelling pour for pour target ${s == null ? void 0 : s.id}.`), await (s == null ? void 0 : s.cancelPour()), r == null || r();
|
|
904
901
|
}, [r, s]);
|
|
905
902
|
return {
|
|
906
|
-
handlers:
|
|
903
|
+
handlers: be({
|
|
907
904
|
onPressed: u,
|
|
908
905
|
onRelease: l
|
|
909
906
|
}).dom,
|
|
910
907
|
cancel: f,
|
|
911
908
|
status: s
|
|
912
909
|
};
|
|
913
|
-
}, z =
|
|
910
|
+
}, z = P.createLogger({
|
|
914
911
|
name: "TapOrHoldIntentStrategy",
|
|
915
912
|
group: "kos-hooks"
|
|
916
913
|
});
|
|
@@ -939,7 +936,7 @@ class Qt {
|
|
|
939
936
|
return this.disposer && clearTimeout(this.disposer), this.disposer = null, this.isHold ? (await (t == null ? void 0 : t.cancelPour()), !1) : (z.debug("Tap detected. don't cancel and return."), !0);
|
|
940
937
|
}
|
|
941
938
|
}
|
|
942
|
-
const ie =
|
|
939
|
+
const ie = P.createLogger({
|
|
943
940
|
name: "TapToPourIntentStrategy",
|
|
944
941
|
group: "kos-hooks"
|
|
945
942
|
}), Xt = {
|
|
@@ -958,7 +955,7 @@ const ie = T.createLogger({
|
|
|
958
955
|
async initiateEnded(e) {
|
|
959
956
|
return !0;
|
|
960
957
|
}
|
|
961
|
-
}, Le =
|
|
958
|
+
}, Le = P.createLogger({
|
|
962
959
|
name: "HoldToPourStrategy",
|
|
963
960
|
group: "kos-hooks"
|
|
964
961
|
}), Zt = {
|
|
@@ -996,7 +993,7 @@ function zt(e) {
|
|
|
996
993
|
};
|
|
997
994
|
}
|
|
998
995
|
const qe = L(void 0), es = ({ children: e }) => {
|
|
999
|
-
const { model: t, ready: r } = ye(), n =
|
|
996
|
+
const { model: t, ready: r } = ye(), n = A(() => r && t ? { model: t } : {}, [r, t]);
|
|
1000
997
|
return /* @__PURE__ */ m(qe.Provider, { value: n, children: e });
|
|
1001
998
|
}, ts = () => {
|
|
1002
999
|
const e = K(
|
|
@@ -1008,7 +1005,7 @@ const qe = L(void 0), es = ({ children: e }) => {
|
|
|
1008
1005
|
);
|
|
1009
1006
|
return e;
|
|
1010
1007
|
}, Je = L(void 0), ss = ({ children: e }) => {
|
|
1011
|
-
const { model: t, ready: r } = De(), n =
|
|
1008
|
+
const { model: t, ready: r } = De(), n = A(() => r && t ? { model: t } : {}, [r, t]);
|
|
1012
1009
|
return /* @__PURE__ */ m(Je.Provider, { value: n, children: e });
|
|
1013
1010
|
}, rs = () => {
|
|
1014
1011
|
const e = K(Je);
|
|
@@ -1018,7 +1015,7 @@ const qe = L(void 0), es = ({ children: e }) => {
|
|
|
1018
1015
|
);
|
|
1019
1016
|
return e;
|
|
1020
1017
|
}, Qe = L(void 0), ns = ({ children: e, id: t }) => {
|
|
1021
|
-
const { model: r, ready: n } = Me(t), s =
|
|
1018
|
+
const { model: r, ready: n } = Me(t), s = A(() => n && r ? { model: r } : {}, [n, r]);
|
|
1022
1019
|
return /* @__PURE__ */ m(Qe.Provider, { value: s, children: e });
|
|
1023
1020
|
}, is = () => {
|
|
1024
1021
|
const e = K(Qe);
|
|
@@ -1026,7 +1023,7 @@ const qe = L(void 0), es = ({ children: e }) => {
|
|
|
1026
1023
|
throw new Error("useBoardContext must be used within a BoardProvider");
|
|
1027
1024
|
return e;
|
|
1028
1025
|
}, Xe = L(void 0), as = ({ children: e }) => {
|
|
1029
|
-
const { model: t, ready: r } = Oe(), n =
|
|
1026
|
+
const { model: t, ready: r } = Oe(), n = A(() => r && t ? { model: t } : {}, [r, t]);
|
|
1030
1027
|
return /* @__PURE__ */ m(Xe.Provider, { value: n, children: e });
|
|
1031
1028
|
}, os = () => {
|
|
1032
1029
|
const e = K(Xe);
|
|
@@ -1038,7 +1035,7 @@ const qe = L(void 0), es = ({ children: e }) => {
|
|
|
1038
1035
|
}, Ze = L(
|
|
1039
1036
|
void 0
|
|
1040
1037
|
), xt = ({ children: e }) => {
|
|
1041
|
-
const { model: t, ready: r } = Fe(), n =
|
|
1038
|
+
const { model: t, ready: r } = Fe(), n = A(() => {
|
|
1042
1039
|
if (r && t) {
|
|
1043
1040
|
const i = t.nozzlePaths;
|
|
1044
1041
|
return { model: t, nozzlePaths: i };
|
|
@@ -1115,7 +1112,7 @@ function cs(e) {
|
|
|
1115
1112
|
];
|
|
1116
1113
|
}
|
|
1117
1114
|
const ze = L(void 0), ds = ({ children: e, id: t }) => {
|
|
1118
|
-
const { model: r, ready: n } = Ue(t || ""), s =
|
|
1115
|
+
const { model: r, ready: n } = Ue(t || ""), s = A(() => n && r ? { model: r } : {}, [n, r]);
|
|
1119
1116
|
return /* @__PURE__ */ m(ze.Provider, { value: s, children: e });
|
|
1120
1117
|
}, us = () => {
|
|
1121
1118
|
const e = K(ze);
|
|
@@ -1125,7 +1122,7 @@ const ze = L(void 0), ds = ({ children: e, id: t }) => {
|
|
|
1125
1122
|
}, et = L(
|
|
1126
1123
|
void 0
|
|
1127
1124
|
), ls = ({ children: e }) => {
|
|
1128
|
-
const { model: t, ready: r } = je(), n =
|
|
1125
|
+
const { model: t, ready: r } = je(), n = A(() => r && t ? { model: t } : {}, [r, t]);
|
|
1129
1126
|
return /* @__PURE__ */ m(et.Provider, { value: n, children: e });
|
|
1130
1127
|
}, ms = () => {
|
|
1131
1128
|
const e = K(et);
|
|
@@ -1135,7 +1132,7 @@ const ze = L(void 0), ds = ({ children: e, id: t }) => {
|
|
|
1135
1132
|
);
|
|
1136
1133
|
return e;
|
|
1137
1134
|
}, tt = L(void 0), ps = ({ children: e }) => {
|
|
1138
|
-
const { model: t, ready: r } = Ve(), n =
|
|
1135
|
+
const { model: t, ready: r } = Ve(), n = A(() => r && t ? { model: t } : {}, [r, t]);
|
|
1139
1136
|
return /* @__PURE__ */ m(tt.Provider, { value: n, children: e });
|
|
1140
1137
|
}, hs = () => {
|
|
1141
1138
|
const e = K(tt);
|
|
@@ -1147,7 +1144,7 @@ const ze = L(void 0), ds = ({ children: e, id: t }) => {
|
|
|
1147
1144
|
}, st = L(
|
|
1148
1145
|
void 0
|
|
1149
1146
|
), fs = ({ children: e }) => {
|
|
1150
|
-
const { model: t, ready: r } = We(), n =
|
|
1147
|
+
const { model: t, ready: r } = We(), n = A(() => r && t ? { model: t } : {}, [r, t]);
|
|
1151
1148
|
return /* @__PURE__ */ m(st.Provider, { value: n, children: e });
|
|
1152
1149
|
}, bs = () => {
|
|
1153
1150
|
const e = K(st);
|
|
@@ -1164,7 +1161,7 @@ const ze = L(void 0), ds = ({ children: e, id: t }) => {
|
|
|
1164
1161
|
options: {}
|
|
1165
1162
|
});
|
|
1166
1163
|
}, rt = L(void 0), vs = ({ children: e }) => {
|
|
1167
|
-
const { model: t, ready: r } = Kt(), n =
|
|
1164
|
+
const { model: t, ready: r } = Kt(), n = A(() => r && t ? { model: t } : {}, [r, t]);
|
|
1168
1165
|
return /* @__PURE__ */ m(rt.Provider, { value: n, children: e });
|
|
1169
1166
|
}, $s = () => {
|
|
1170
1167
|
const e = K(rt);
|
|
@@ -1239,4 +1236,4 @@ export {
|
|
|
1239
1236
|
Yt as y,
|
|
1240
1237
|
ht as z
|
|
1241
1238
|
};
|
|
1242
|
-
//# sourceMappingURL=pump-provider
|
|
1239
|
+
//# sourceMappingURL=pump-provider--hQGuh_w.js.map
|