@kosdev-code/kos-dispense-sdk 2.0.3 → 2.0.5

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.
Files changed (39) hide show
  1. package/{dispense-registration-manager-DxIbOft8.js → dispense-registration-manager-DfKHzcrZ.js} +2 -1
  2. package/{dispense-registration-manager-DxIbOft8.js.map → dispense-registration-manager-DfKHzcrZ.js.map} +1 -1
  3. package/{dispense-registration-manager-aM9RAFHn.cjs → dispense-registration-manager-f0b1L6Mt.cjs} +2 -2
  4. package/{dispense-registration-manager-aM9RAFHn.cjs.map → dispense-registration-manager-f0b1L6Mt.cjs.map} +1 -1
  5. package/{extension-utils-hWIrDMX4.cjs → extension-utils-Bz00r5LT.cjs} +2 -2
  6. package/{extension-utils-hWIrDMX4.cjs.map → extension-utils-Bz00r5LT.cjs.map} +1 -1
  7. package/{extension-utils-qcU_4sXo.js → extension-utils-bU6yk7dw.js} +3 -3
  8. package/{extension-utils-qcU_4sXo.js.map → extension-utils-bU6yk7dw.js.map} +1 -1
  9. package/index.cjs +1 -1
  10. package/index.js +3 -3
  11. package/models/constants/constants.d.ts +2 -2
  12. package/models/models/ingredient-container/types/index.d.ts +1 -1
  13. package/models/models/nozzle/index.d.ts +1 -1
  14. package/models/models/nozzle/nozzle-model.d.ts +1 -1
  15. package/models/models/nozzle/nozzle-model.d.ts.map +1 -1
  16. package/models/models/nozzle/services/nozzle-services.d.ts +5 -5
  17. package/models/utils/extension-utils.d.ts +1 -1
  18. package/models/utils/openapi.d.ts +1 -1
  19. package/models/utils/service.d.ts +3 -3
  20. package/models.cjs +1 -1
  21. package/models.js +2 -2
  22. package/package.json +3 -3
  23. package/pump-provider-BsCVHaj9.js +1016 -0
  24. package/pump-provider-BsCVHaj9.js.map +1 -0
  25. package/pump-provider-DX58hw88.cjs +2 -0
  26. package/pump-provider-DX58hw88.cjs.map +1 -0
  27. package/ui/hooks/cui-kit/use-beverages.d.ts.map +1 -1
  28. package/ui/hooks/cui-kit/use-brands.d.ts.map +1 -1
  29. package/ui/hooks/cui-kit/use-cui-kit.d.ts +47 -5
  30. package/ui/hooks/cui-kit/use-cui-kit.d.ts.map +1 -1
  31. package/ui/hooks/cui-kit/use-default-cui-kit-lifecycle.d.ts.map +1 -1
  32. package/ui/hooks/cui-kit/use-dispense-timers.d.ts.map +1 -1
  33. package/ui/hooks/cui-kit/use-flavors.d.ts.map +1 -1
  34. package/ui.cjs +1 -1
  35. package/ui.js +2 -2
  36. package/pump-provider-COTqsOH-.js +0 -1013
  37. package/pump-provider-COTqsOH-.js.map +0 -1
  38. package/pump-provider-D2HzZ2Bj.cjs +0 -2
  39. package/pump-provider-D2HzZ2Bj.cjs.map +0 -1
@@ -1,1013 +0,0 @@
1
- var Ge = Object.defineProperty;
2
- var Ue = (e, t, s) => t in e ? Ge(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
- var M = (e, t, s) => (Ue(e, typeof t != "symbol" ? t + "" : t, s), s);
4
- import { jsx as c } from "@emotion/react/jsx-runtime";
5
- import { useKosModel as A, getKosCompanionModel as te, kosAutoEffect as Ve, KosLog as g, usePressGesture as me, EventBus as y, TimerManager as fe } from "@kosdev-code/kos-ui-sdk";
6
- import je, { createContext as $, useMemo as T, useContext as P, useState as I, useCallback as a, useEffect as _ } from "react";
7
- import { A as se, a as re, d as Fe, c as oe, N as We, e as ne, H as qe, f as ae, I as ie, g as ce, P as ue } from "./dispense-registration-manager-DxIbOft8.js";
8
- const he = () => {
9
- const e = se.type;
10
- return A({
11
- modelId: e,
12
- modelType: se.type,
13
- options: {}
14
- });
15
- };
16
- function vt(e) {
17
- return (t) => {
18
- const { model: s, status: r, KosModelLoader: o } = he();
19
- return /* @__PURE__ */ c(o, { ...r, children: /* @__PURE__ */ c(e, { ...t, assembly: s }) });
20
- };
21
- }
22
- const be = () => {
23
- const e = re.type;
24
- return A({
25
- modelId: e,
26
- modelType: re.type,
27
- options: {}
28
- });
29
- };
30
- function Pt(e) {
31
- return (t) => {
32
- const { model: s, status: r, KosModelLoader: o } = be();
33
- return /* @__PURE__ */ c(o, { ...r, children: /* @__PURE__ */ c(e, { ...t, beverage: s }) });
34
- };
35
- }
36
- const Te = (e) => A({
37
- modelId: e,
38
- modelType: Fe.type,
39
- options: {}
40
- });
41
- function It(e) {
42
- return (t) => (s) => {
43
- const { model: r, status: o, KosModelLoader: i } = Te(t);
44
- return /* @__PURE__ */ c(i, { ...o, children: /* @__PURE__ */ c(e, { ...s, board: r }) });
45
- };
46
- }
47
- const ge = () => {
48
- const e = oe.type;
49
- return A({
50
- modelId: e,
51
- modelType: oe.type,
52
- options: {}
53
- });
54
- };
55
- function At(e) {
56
- return (t) => {
57
- const { model: s, status: r, KosModelLoader: o } = ge();
58
- return /* @__PURE__ */ c(o, { ...r, children: /* @__PURE__ */ c(e, { ...t, boardContainer: s }) });
59
- };
60
- }
61
- const ve = (e) => A({
62
- modelId: e,
63
- modelType: We.type,
64
- options: {
65
- path: e
66
- }
67
- }), Pe = $(void 0), Je = ({ children: e, path: t }) => {
68
- const { model: s, ready: r } = ve(t), o = T(() => r && s ? { model: s } : {}, [r, s]);
69
- return /* @__PURE__ */ c(Pe.Provider, { value: o, children: e });
70
- }, B = () => {
71
- const e = P(Pe);
72
- if (!e)
73
- throw new Error("useNozzleContext must be used within a NozzleProvider");
74
- return e;
75
- }, Qe = ({
76
- onBeverageSelected: e,
77
- onClearBeverage: t,
78
- companionType: s
79
- }) => {
80
- const { model: r } = B(), [o, i] = I([]), [u, l] = I(null), m = T(() => s ? o.map(
81
- (p) => te(p, s)
82
- ) : [], [o, s]), f = a(
83
- async (p) => {
84
- l(p), await (r == null ? void 0 : r.setSelectedPourable({ beverage: p })), e == null || e(p);
85
- },
86
- [r, e]
87
- ), d = a(async () => {
88
- l(null), await (r == null ? void 0 : r.setSelectedPourable({ beverage: void 0 })), t == null || t();
89
- }, [r, t]);
90
- return _(() => {
91
- const p = Ve(() => {
92
- if (!r)
93
- return;
94
- const n = r.selectedBrand;
95
- if (!n) {
96
- const w = r.getGroupAvailabilityItems("beverages").filter((h) => h.visible);
97
- i(w ?? []);
98
- return;
99
- }
100
- const E = r.getAvailabilityByParent(n.id);
101
- i(E ?? []);
102
- });
103
- return () => {
104
- p();
105
- };
106
- }, [r]), {
107
- beverages: o,
108
- beverageCompanions: m,
109
- selectBeverage: f,
110
- selectedBeverage: u,
111
- clearBeverage: d
112
- };
113
- }, Xe = ({
114
- onBrandSelected: e,
115
- onBrandCleared: t,
116
- companionType: s
117
- }) => {
118
- const { model: r } = B(), [o, i] = I(null), u = T(
119
- () => (r == null ? void 0 : r.getGroupAvailabilityItems("brands")) ?? [],
120
- [r]
121
- ), l = T(() => s ? u.map((d) => te(d, s)) : [], [u, s]), m = a(
122
- async (d) => {
123
- i(d), r == null || r.setSelectedBrand(d), e == null || e(d);
124
- },
125
- [r, e]
126
- ), f = a(() => {
127
- i(null), r == null || r.setSelectedBrand(void 0), t == null || t();
128
- }, [r, t]);
129
- return {
130
- brands: u,
131
- brandCompanions: l,
132
- selectedBrand: o,
133
- selectBrand: m,
134
- clearBrand: f
135
- };
136
- }, Ze = g.createLogger({
137
- name: "HoldToPourStrategy",
138
- group: "kos-hooks"
139
- }), ze = {
140
- name: "HoldToPourStrategy",
141
- initiate(e) {
142
- if (!(e != null && e.canPour)) {
143
- Ze.debug(`Nozzle ${e == null ? void 0 : e.id} cannot pour. Returning early.`);
144
- return;
145
- }
146
- e == null || e.pour();
147
- },
148
- initiateEnded(e) {
149
- e == null || e.cancelPour();
150
- }
151
- }, Z = g.createLogger({
152
- name: "useNozzlePour",
153
- group: "kos-hooks"
154
- }), et = ({
155
- onPour: e,
156
- onPourCancel: t,
157
- strategy: s = ze
158
- }) => {
159
- const { model: r } = B(), o = a(() => {
160
- Z.debug(
161
- `[${s == null ? void 0 : s.name}] - Pour initiated for nozzle ${r == null ? void 0 : r.id}.`
162
- ), s == null || s.initiate(r), e == null || e();
163
- }, [e, r, s]), i = a(() => {
164
- var m;
165
- Z.debug(
166
- `[${s == null ? void 0 : s.name}] - Pour initiate ended called for nozzle ${r == null ? void 0 : r.id}.`
167
- ), (m = s == null ? void 0 : s.initiateEnded) == null || m.call(s, r), t == null || t();
168
- }, [t, r, s]), u = a(() => {
169
- Z.debug(`Force cancelling pour for nozzle ${r == null ? void 0 : r.id}.`), r == null || r.cancelPour(), t == null || t();
170
- }, [t, r]);
171
- return {
172
- handlers: me({
173
- onPressed: o,
174
- onRelease: i
175
- }).dom,
176
- cancel: u,
177
- status: r
178
- };
179
- }, tt = ({
180
- onFlavorSelected: e,
181
- onFlavorCleared: t,
182
- companionType: s
183
- }) => {
184
- const { model: r } = B(), o = T(
185
- () => (r == null ? void 0 : r.getGroupAvailabilityItems("flavors")) ?? [],
186
- [r]
187
- ), i = T(() => s ? o.map(
188
- (d) => te(d, s)
189
- ) : [], [o, s]), [u, l] = I([]), m = a(
190
- async (d) => {
191
- if (l(
192
- (p) => p != null && p.includes(d) ? [...p.filter((n) => n !== d)] : [...p ?? [], d]
193
- ), r != null && r.selectedPourable) {
194
- const { beverage: p } = r.selectedPourable;
195
- await r.setSelectedPourable({
196
- beverage: p,
197
- additional: u ?? []
198
- });
199
- }
200
- e == null || e(d, u ?? []);
201
- },
202
- [r, e, u]
203
- ), f = a(async () => {
204
- if (l([]), r != null && r.selectedPourable) {
205
- const { beverage: d } = r.selectedPourable;
206
- r.setSelectedPourable({ beverage: d }), t == null || t();
207
- }
208
- }, [r, t]);
209
- return {
210
- flavors: o,
211
- flavorCompanions: i,
212
- selectFlavor: m,
213
- selectedFlavors: u,
214
- clearFlavors: f
215
- };
216
- }, D = "brands", W = "beverages", de = "flavors", st = ({
217
- initialGroup: e = D,
218
- options: t = {}
219
- }) => {
220
- var N, j, F;
221
- const [s, r] = I(e), { model: o } = B(), i = a(
222
- (b) => {
223
- const K = `/kos/dispense/${o == null ? void 0 : o.path}/brand/selected/`;
224
- y.publish(K, b);
225
- },
226
- [o == null ? void 0 : o.path]
227
- ), u = a(() => {
228
- const b = `/kos/dispense/${o == null ? void 0 : o.path}/brand/cleared/`;
229
- y.publish(b, {});
230
- }, [o == null ? void 0 : o.path]), l = a(
231
- (b) => {
232
- const K = `/kos/dispense/${o == null ? void 0 : o.path}/beverage/selected/`;
233
- y.publish(K, b);
234
- },
235
- [o == null ? void 0 : o.path]
236
- ), m = a(() => {
237
- const b = `/kos/dispense/${o == null ? void 0 : o.path}/beverage/cleared/`;
238
- y.publish(b, {});
239
- }, [o == null ? void 0 : o.path]), f = a(
240
- (b) => {
241
- const K = `/kos/dispense/${o == null ? void 0 : o.path}/flavor/selected/`;
242
- y.publish(K, b);
243
- },
244
- [o == null ? void 0 : o.path]
245
- ), d = a(() => {
246
- const b = `/kos/dispense/${o == null ? void 0 : o.path}/flavor/cleared/`;
247
- y.publish(b, {});
248
- }, [o == null ? void 0 : o.path]), p = a(() => {
249
- const b = `/kos/dispense/${o == null ? void 0 : o.path}/pour/`;
250
- y.publish(b, {});
251
- }, [o == null ? void 0 : o.path]), n = a(() => {
252
- const b = `/kos/dispense/${o == null ? void 0 : o.path}/pour/cancel/`;
253
- y.publish(b, {});
254
- }, [o == null ? void 0 : o.path]), { brands: E, selectBrand: w, selectedBrand: h, clearBrand: x, brandCompanions: Y } = Xe({
255
- companionType: (N = t.companionTypes) == null ? void 0 : N.brand,
256
- onBrandSelected: i,
257
- onBrandCleared: u
258
- }), {
259
- beverages: S,
260
- selectBeverage: G,
261
- selectedBeverage: U,
262
- clearBeverage: C,
263
- beverageCompanions: J
264
- } = Qe({
265
- companionType: (j = t.companionTypes) == null ? void 0 : j.beverage,
266
- onBeverageSelected: l,
267
- onClearBeverage: m
268
- }), {
269
- clearFlavors: Q,
270
- flavors: L,
271
- selectFlavor: H,
272
- selectedFlavors: X,
273
- flavorCompanions: V
274
- } = tt({
275
- companionType: (F = t.companionTypes) == null ? void 0 : F.flavor,
276
- onFlavorSelected: f,
277
- onFlavorCleared: d
278
- }), v = et({
279
- onPour: p,
280
- onPourCancel: n
281
- }), R = a(() => {
282
- switch (s) {
283
- case D:
284
- C(), x();
285
- break;
286
- case W:
287
- r(D), C();
288
- break;
289
- }
290
- }, [C, x, s]), k = a(() => {
291
- r(e), e === D && (C(), x()), e === W && C();
292
- }, [C, x, e]);
293
- return {
294
- nav: {
295
- currentGroup: s,
296
- back: R,
297
- home: k
298
- },
299
- pour: v,
300
- selections: {
301
- [D]: h,
302
- [W]: U,
303
- [de]: X
304
- },
305
- [D]: {
306
- models: E,
307
- companions: Y,
308
- clear: x,
309
- handlers: {
310
- onSelected: w
311
- }
312
- },
313
- [W]: {
314
- models: S,
315
- companions: J,
316
- clear: C,
317
- handlers: {
318
- onSelected: G
319
- }
320
- },
321
- [de]: {
322
- models: L,
323
- companions: V,
324
- clear: Q,
325
- handlers: {
326
- onSelected: H
327
- }
328
- }
329
- };
330
- }, rt = (e) => {
331
- const { model: t } = B(), [s, r] = I(null), {
332
- onAmbientTimer: o,
333
- onAttractTimer: i,
334
- onResetAttractTimer: u,
335
- onResumeAttractTimer: l,
336
- defaultAttractTime: m,
337
- defaultAmbientTime: f
338
- } = e, d = a(() => {
339
- o && (g.info("Ambient timer expired. Calling callback"), o == null || o());
340
- }, [o]), p = a(() => {
341
- i && (g.info("Attract timer expired. Calling callback"), i == null || i());
342
- }, [i]), n = a(() => {
343
- s && (s.restart(), u == null || u());
344
- }, [s, u]), E = a(() => {
345
- s && (s.reset(), u == null || u());
346
- }, [s, u]), w = a(() => {
347
- s && (s.pause(), l == null || l());
348
- }, [s, l]);
349
- return _(() => {
350
- if (t && m) {
351
- g.info("Nozzle is available. Creating timers");
352
- const h = fe.createTimer(
353
- "attract-timer-" + t.path,
354
- m
355
- );
356
- return m && (h == null || h.addTimeoutAction({
357
- name: "attract-timer",
358
- remainingTime: 0,
359
- action: p
360
- })), f && (h == null || h.addTimeoutAction({
361
- name: "ambient-timer",
362
- remainingTime: f,
363
- action: d
364
- })), m && (h == null || h.start()), r(h ?? null), () => {
365
- h == null || h.reset(), r(null);
366
- };
367
- }
368
- return () => {
369
- g.info("Nozzle is not available. No timers to clear");
370
- };
371
- }, [
372
- f,
373
- m,
374
- d,
375
- p,
376
- t
377
- ]), {
378
- attractTimer: s,
379
- restart: n,
380
- pause: E,
381
- resume: w
382
- };
383
- }, ot = (e, t) => {
384
- if (t)
385
- return y.subscribe(e, t).unsubscribe;
386
- }, nt = ({
387
- onInit: e,
388
- onBrandSelected: t,
389
- onBrandCleared: s,
390
- onBeverageCleared: r,
391
- onBeverageSelected: o,
392
- onFlavorCleared: i,
393
- onFlavorSelected: u,
394
- onPour: l,
395
- onPourCancel: m,
396
- onAmbientTimer: f,
397
- onAttractTimer: d,
398
- onResumeAttractTimer: p
399
- }) => {
400
- const { model: n } = B();
401
- _(() => {
402
- const w = [
403
- {
404
- topic: `/kos/dispense/${n == null ? void 0 : n.path}/brand/selected/`,
405
- callback: t
406
- },
407
- {
408
- topic: `/kos/dispense/${n == null ? void 0 : n.path}/brand/cleared/`,
409
- callback: s
410
- },
411
- {
412
- topic: `/kos/dispense/${n == null ? void 0 : n.path}/beverage/selected/`,
413
- callback: o
414
- },
415
- {
416
- topic: `/kos/dispense/${n == null ? void 0 : n.path}/beverage/cleared/`,
417
- callback: r
418
- },
419
- {
420
- topic: `/kos/dispense/${n == null ? void 0 : n.path}/flavor/selected/`,
421
- callback: u
422
- },
423
- {
424
- topic: `/kos/dispense/${n == null ? void 0 : n.path}/flavor/cleared/`,
425
- callback: i
426
- },
427
- { topic: `/kos/dispense/${n == null ? void 0 : n.path}/pour/`, callback: l },
428
- {
429
- topic: `/kos/dispense/${n == null ? void 0 : n.path}/pour/cancel/`,
430
- callback: m
431
- },
432
- {
433
- topic: `/kos/dispense/${n == null ? void 0 : n.path}/ambient/start/`,
434
- callback: f
435
- },
436
- {
437
- topic: `/kos/dispense/${n == null ? void 0 : n.path}/attract/start/`,
438
- callback: d
439
- },
440
- {
441
- topic: `/kos/dispense/${n == null ? void 0 : n.path}/attract/resume/`,
442
- callback: p
443
- },
444
- {
445
- topic: `/kos/dispense/${n == null ? void 0 : n.path}/init/`,
446
- callback: e
447
- }
448
- ].map(
449
- ({ topic: h, callback: x }) => ot(h, x)
450
- );
451
- return () => {
452
- w.forEach((h) => h == null ? void 0 : h());
453
- };
454
- }, [
455
- n == null ? void 0 : n.path,
456
- f,
457
- d,
458
- r,
459
- o,
460
- s,
461
- t,
462
- i,
463
- u,
464
- l,
465
- m,
466
- p,
467
- e
468
- ]);
469
- }, le = (e) => {
470
- const { model: t } = B(), [s, r] = I(null), {
471
- onAreYouThereTimer: o,
472
- onIdleTimer: i,
473
- defaultAreYouThereTime: u = 10,
474
- defaultIdleTime: l = 20
475
- } = e, m = a(() => {
476
- o && (g.info("Are you there timer expired. Calling callback"), o == null || o());
477
- }, [o]), f = a(() => {
478
- i && (g.info("Idle timer expired. Calling callback"), i == null || i());
479
- }, [i]), d = a(() => {
480
- var n;
481
- s && (s.restart(), (n = e.onResetIdleTimer) == null || n.call(e));
482
- }, [s, e]), p = a(() => {
483
- var n;
484
- s && (s.reset(), (n = e.onResetIdleTimer) == null || n.call(e));
485
- }, [s, e]);
486
- return _(() => {
487
- if (t) {
488
- g.info("Nozzle is available. Creating timers");
489
- const n = fe.createTimer(
490
- `${e.prefix ?? ""}idle-timer-${t.path}`,
491
- l
492
- );
493
- return n == null || n.addTimeoutAction({
494
- name: "idle-timer",
495
- remainingTime: 0,
496
- action: f
497
- }), n == null || n.addTimeoutAction({
498
- name: "are-you-there-timer",
499
- remainingTime: u,
500
- action: m
501
- }), r(n ?? null), () => {
502
- n == null || n.reset(), r(null);
503
- };
504
- }
505
- return () => {
506
- g.info("Nozzle is not available. No timers to clear");
507
- };
508
- }, [
509
- u,
510
- l,
511
- m,
512
- f,
513
- t,
514
- e.prefix
515
- ]), {
516
- idleTimer: s,
517
- restart: d,
518
- pause: p
519
- };
520
- }, $t = ({
521
- kit: e,
522
- inactivity: t,
523
- pour: s,
524
- screens: r
525
- }) => {
526
- const [o, i] = I(!1), [u, l] = I(!1), [m, f] = I(!1), { model: d } = B(), [p, n] = I(!1), E = (t == null ? void 0 : t.idleTimeout) ?? 15, w = (t == null ? void 0 : t.areYouThereTimeoutOffset) ?? 10, h = (s == null ? void 0 : s.idleTimeout) ?? (t == null ? void 0 : t.idleTimeout) ?? 10, x = (s == null ? void 0 : s.areYouThereTimeoutOffset) ?? (t == null ? void 0 : t.areYouThereTimeoutOffset) ?? 5, Y = r == null ? void 0 : r.ambientTimeoutOffset, S = r == null ? void 0 : r.attractTimeout, G = a(() => {
527
- i(!0);
528
- }, []), U = a(() => {
529
- i(!1), e == null || e.nav.home();
530
- }, [e == null ? void 0 : e.nav]), C = a(() => {
531
- Y && (l(!0), f(!1));
532
- }, [Y]), J = a(() => {
533
- S && (f(!0), l(!1));
534
- }, [S]), Q = a(() => {
535
- S && (f(!1), l(!1), e == null || e.nav.home());
536
- }, [e == null ? void 0 : e.nav, S]), {
537
- pause: L,
538
- restart: H,
539
- resume: X,
540
- attractTimer: V
541
- } = rt({
542
- defaultAmbientTime: Y,
543
- defaultAttractTime: S,
544
- onAmbientTimer: C,
545
- onAttractTimer: J,
546
- onResumeAttractTimer: Q
547
- }), { pause: v, restart: R } = le({
548
- defaultAreYouThereTime: w,
549
- defaultIdleTime: E,
550
- onAreYouThereTimer: G,
551
- onIdleTimer: U
552
- }), { pause: k, restart: N } = le({
553
- defaultAreYouThereTime: x,
554
- defaultIdleTime: h,
555
- onAreYouThereTimer: G,
556
- onIdleTimer: U,
557
- prefix: "pour-"
558
- }), j = a(() => {
559
- n(!1), k(), v();
560
- }, [v, k]), F = a(() => {
561
- n(!0), console.log("restarting pour timer"), N(), v();
562
- }, [v, N]), b = a(() => {
563
- i(!1), p ? (N(), v()) : (R(), k());
564
- }, [p, v, k, R, N]), K = a(() => {
565
- L(), f(!1), l(!1);
566
- }, [L]), Re = a(() => {
567
- f(!1), l(!1), n(!1), k(), H();
568
- }, [H, k]), De = a(() => {
569
- f(!1), l(!1), n(!1), L(), R();
570
- }, [L, R]), Ye = a(() => {
571
- f(!1), l(!1), n(!1), H(), v(), k();
572
- }, [H, v, k]), Me = a(() => {
573
- f(!1), l(!1), H(), v();
574
- }, [H, v]);
575
- nt({
576
- onBrandSelected: K,
577
- onBrandCleared: Re,
578
- onBeverageSelected: De,
579
- onBeverageCleared: Ye,
580
- onPour: j,
581
- onPourCancel: F,
582
- onInit: Me
583
- });
584
- const Oe = p ? x : w;
585
- return _(() => {
586
- if (d && V) {
587
- const _e = `/kos/dispense/${d == null ? void 0 : d.path}/init/`;
588
- y.publish(_e, {});
589
- }
590
- }, [d, V]), {
591
- showAreYouThere: o,
592
- clearAreYouThere: b,
593
- areYouThereCountdown: Oe,
594
- showAmbientScreen: u,
595
- showAttractScreen: m,
596
- pauseScreenTimer: X
597
- };
598
- }, Ie = () => {
599
- const e = ne.type;
600
- return A({
601
- modelId: e,
602
- modelType: ne.type,
603
- options: {}
604
- });
605
- };
606
- function wt(e) {
607
- return (t) => {
608
- const { model: s, status: r, KosModelLoader: o } = Ie();
609
- return /* @__PURE__ */ c(o, { ...r, children: /* @__PURE__ */ c(e, { ...t, deviceAssembly: s }) });
610
- };
611
- }
612
- const Ae = (e) => A({
613
- modelId: e,
614
- modelType: qe.type,
615
- options: {}
616
- });
617
- function xt(e, t) {
618
- return (s) => {
619
- const { model: r, status: o, KosModelLoader: i } = Ae(e);
620
- return /* @__PURE__ */ c(i, { ...o, children: /* @__PURE__ */ c(t, { ...s, holder: r }) });
621
- };
622
- }
623
- const $e = () => {
624
- const e = ae.type;
625
- return A({
626
- modelId: e,
627
- modelType: ae.type,
628
- options: {}
629
- });
630
- };
631
- function kt(e) {
632
- return (t) => {
633
- const { model: s, status: r, KosModelLoader: o } = $e();
634
- return /* @__PURE__ */ c(o, { ...r, children: /* @__PURE__ */ c(e, { ...t, holderContainer: s }) });
635
- };
636
- }
637
- const we = () => {
638
- const e = ie.type;
639
- return A({
640
- modelId: e,
641
- modelType: ie.type,
642
- options: {}
643
- });
644
- }, z = g.createLogger({
645
- name: "HoldToPourIntentStrategy",
646
- group: "kos-hooks"
647
- }), at = {
648
- name: "HoldToPourIntentStrategy",
649
- initiate(e, t) {
650
- if (!(e != null && e.canPour)) {
651
- z.debug(`${e == null ? void 0 : e.id} cannot pour. Returning early.`);
652
- return;
653
- }
654
- t ? (z.debug(`performing intent: ${t}`), e == null || e.performIntent(t)) : z.debug("no intent provided. Returning early.");
655
- },
656
- initiateEnded(e) {
657
- e == null || e.cancelPour();
658
- }
659
- }, ee = g.createLogger({
660
- name: "useNozzlePour",
661
- group: "kos-hooks"
662
- }), yt = ({
663
- onPour: e,
664
- onPourCancel: t,
665
- intentContainer: s,
666
- strategy: r = at
667
- }) => {
668
- const o = a(() => {
669
- ee.debug(
670
- `[${r == null ? void 0 : r.name}] - Pour initiated for model ${s == null ? void 0 : s.id}.`
671
- ), r == null || r.initiate(s), e == null || e();
672
- }, [e, s, r]), i = a(() => {
673
- var m;
674
- ee.debug(
675
- `[${r == null ? void 0 : r.name}] - Pour initiate ended called for nozzle ${s == null ? void 0 : s.id}.`
676
- ), (m = r == null ? void 0 : r.initiateEnded) == null || m.call(r, s), t == null || t();
677
- }, [t, s, r]), u = a(() => {
678
- ee.debug(`Force cancelling pour for nozzle ${s == null ? void 0 : s.id}.`), s == null || s.cancelPour(), t == null || t();
679
- }, [t, s]);
680
- return {
681
- handlers: me({
682
- onPressed: o,
683
- onRelease: i
684
- }).dom,
685
- cancel: u,
686
- status: s
687
- };
688
- };
689
- function Ct(e) {
690
- return (t) => {
691
- const { model: s, status: r, KosModelLoader: o } = we();
692
- return /* @__PURE__ */ c(o, { ...r, children: /* @__PURE__ */ c(e, { ...t, ingredient: s }) });
693
- };
694
- }
695
- const xe = () => {
696
- const e = ce.type;
697
- return A({
698
- modelId: e,
699
- modelType: ce.type,
700
- options: {}
701
- });
702
- };
703
- function Bt(e) {
704
- return (t) => {
705
- const { model: s, status: r, KosModelLoader: o } = xe();
706
- return /* @__PURE__ */ c(o, { ...r, children: /* @__PURE__ */ c(e, { ...t, ingredientContainer: s }) });
707
- };
708
- }
709
- function Et(e, t) {
710
- return (s) => {
711
- const { model: r, status: o, KosModelLoader: i } = ve(e);
712
- return /* @__PURE__ */ c(i, { ...o, children: /* @__PURE__ */ c(t, { ...s, nozzle: r }) });
713
- };
714
- }
715
- const O = g.createLogger({
716
- name: "TapOrHoldIntentStrategy",
717
- group: "kos-hooks"
718
- });
719
- class Ht {
720
- constructor(t) {
721
- M(this, "intent");
722
- M(this, "name", "TapOrHoldIntentStrategy");
723
- M(this, "isHold", !1);
724
- M(this, "disposer", null);
725
- this.intent = t;
726
- }
727
- initiate(t, s) {
728
- if (this.disposer = setTimeout(() => {
729
- this.isHold = !0;
730
- }, 250), t != null && t.isPouring && !this.isHold) {
731
- O.debug("additional tap detected. cancelling pour"), t.cancelPour();
732
- return;
733
- }
734
- if (!(t != null && t.canPour)) {
735
- O.debug(`${t == null ? void 0 : t.id} cannot pour. Returning early.`);
736
- return;
737
- }
738
- s ? (O.debug(`performing intent: ${s}`), t == null || t.performIntent(s)) : O.debug("no intent provided. Returning early.");
739
- }
740
- initiateEnded(t) {
741
- if (this.disposer && clearTimeout(this.disposer), this.disposer = null, !this.isHold) {
742
- O.debug("Tap detected. don't cancel and return.");
743
- return;
744
- }
745
- t == null || t.cancelPour();
746
- }
747
- }
748
- const q = g.createLogger({
749
- name: "TapToPourIntentStrategy",
750
- group: "kos-hooks"
751
- }), St = {
752
- name: "TapToPourIntentStrategy",
753
- initiate(e, t) {
754
- if (e != null && e.isPouring) {
755
- q.debug(`Nozzle ${e == null ? void 0 : e.id} is already pouring. cancelling pour`), e.cancelPour();
756
- return;
757
- }
758
- if (!(e != null && e.canPour)) {
759
- q.debug(`Nozzle ${e == null ? void 0 : e.id} cannot pour. Returning early.`);
760
- return;
761
- }
762
- t ? (q.debug(`performing intent: ${t}`), e == null || e.performIntent(t)) : q.debug("no intent provided. Returning early.");
763
- },
764
- initiateEnded(e) {
765
- }
766
- }, pe = g.createLogger({
767
- name: "HoldToPourStrategy",
768
- group: "kos-hooks"
769
- }), Nt = {
770
- name: "TapToPourStrategy",
771
- initiate(e) {
772
- if (e != null && e.isPouring) {
773
- pe.debug(`Nozzle ${e == null ? void 0 : e.id} is already pouring. cancelling pour`), e.cancelPour();
774
- return;
775
- }
776
- if (!(e != null && e.canPour)) {
777
- pe.debug(`Nozzle ${e == null ? void 0 : e.id} cannot pour. Returning early.`);
778
- return;
779
- }
780
- e == null || e.pour();
781
- },
782
- initiateEnded(e) {
783
- }
784
- }, ke = $(void 0), Kt = ({ children: e }) => {
785
- const { model: t, ready: s } = he(), r = T(() => s && t ? { model: t } : {}, [s, t]);
786
- return /* @__PURE__ */ c(ke.Provider, { value: r, children: e });
787
- }, Lt = () => {
788
- const e = P(
789
- ke
790
- );
791
- if (!e)
792
- throw new Error(
793
- "useAssemblyContext must be used within a AssemblyProvider"
794
- );
795
- return e;
796
- }, ye = $(void 0), Rt = ({ children: e }) => {
797
- const { model: t, ready: s } = be(), r = T(() => s && t ? { model: t } : {}, [s, t]);
798
- return /* @__PURE__ */ c(ye.Provider, { value: r, children: e });
799
- }, Dt = () => {
800
- const e = P(ye);
801
- if (!e)
802
- throw new Error(
803
- "useAvailabilityContext must be used within a AvailabilityProvider"
804
- );
805
- return e;
806
- }, Ce = $(void 0), Yt = ({ children: e, id: t }) => {
807
- const { model: s, ready: r } = Te(t), o = T(() => r && s ? { model: s } : {}, [r, s]);
808
- return /* @__PURE__ */ c(Ce.Provider, { value: o, children: e });
809
- }, Mt = () => {
810
- const e = P(Ce);
811
- if (!e)
812
- throw new Error("useBoardContext must be used within a BoardProvider");
813
- return e;
814
- }, Be = $(void 0), Ot = ({ children: e }) => {
815
- const { model: t, ready: s } = ge(), r = T(() => s && t ? { model: t } : {}, [s, t]);
816
- return /* @__PURE__ */ c(Be.Provider, { value: r, children: e });
817
- }, _t = () => {
818
- const e = P(Be);
819
- if (!e)
820
- throw new Error(
821
- "useBoardContainerContext must be used within a BoardContainerProvider"
822
- );
823
- return e;
824
- }, Ee = $(
825
- void 0
826
- ), it = ({ children: e }) => {
827
- const { model: t, ready: s } = Ie(), r = T(() => {
828
- if (s && t) {
829
- const i = t.nozzlePaths;
830
- return { model: t, nozzlePaths: i };
831
- }
832
- return {};
833
- }, [s, t]), o = s && t ? e : null;
834
- return /* @__PURE__ */ c(Ee.Provider, { value: r, children: o });
835
- }, ct = () => {
836
- const e = P(Ee);
837
- if (!e)
838
- throw new Error(
839
- "useDeviceAssemblyContext must be used within a DeviceAssemblyProvider"
840
- );
841
- return e;
842
- };
843
- function ut() {
844
- const e = je.createContext(null);
845
- return [() => {
846
- const s = P(e);
847
- if (s === void 0)
848
- throw new Error("useDispenseKitContext must be used within a Provider");
849
- return s;
850
- }, e.Provider];
851
- }
852
- function dt({ children: e, provider: t, props: s }) {
853
- const r = st(s);
854
- return /* @__PURE__ */ c(t, { value: r, children: e({}) });
855
- }
856
- function lt({
857
- children: e,
858
- provider: t,
859
- props: s
860
- }) {
861
- const { nozzlePaths: r } = ct();
862
- return (r == null ? void 0 : r.map((i) => /* @__PURE__ */ c(Je, { path: i, children: /* @__PURE__ */ c(
863
- dt,
864
- {
865
- provider: t,
866
- props: s,
867
- children: e
868
- }
869
- ) }, i))) || [];
870
- }
871
- function pt({
872
- provider: e,
873
- props: t
874
- }) {
875
- return ({ children: s }) => e ? /* @__PURE__ */ c(it, { children: /* @__PURE__ */ c(
876
- lt,
877
- {
878
- provider: e,
879
- props: t,
880
- children: s
881
- }
882
- ) }) : null;
883
- }
884
- function Gt(e) {
885
- const [t, s] = ut();
886
- return [
887
- t,
888
- pt({ provider: s, props: e })
889
- ];
890
- }
891
- const He = $(void 0), Ut = ({ children: e, id: t }) => {
892
- const { model: s, ready: r } = Ae(t || ""), o = T(() => r && s ? { model: s } : {}, [r, s]);
893
- return /* @__PURE__ */ c(He.Provider, { value: o, children: e });
894
- }, Vt = () => {
895
- const e = P(He);
896
- if (!e)
897
- throw new Error("useHolderContext must be used within a HolderProvider");
898
- return e;
899
- }, Se = $(
900
- void 0
901
- ), jt = ({ children: e }) => {
902
- const { model: t, ready: s } = $e(), r = T(() => s && t ? { model: t } : {}, [s, t]);
903
- return /* @__PURE__ */ c(Se.Provider, { value: r, children: e });
904
- }, Ft = () => {
905
- const e = P(Se);
906
- if (!e)
907
- throw new Error(
908
- "useHolderContainerContext must be used within a HolderContainerProvider"
909
- );
910
- return e;
911
- }, Ne = $(void 0), Wt = ({ children: e }) => {
912
- const { model: t, ready: s } = we(), r = T(() => s && t ? { model: t } : {}, [s, t]);
913
- return /* @__PURE__ */ c(Ne.Provider, { value: r, children: e });
914
- }, qt = () => {
915
- const e = P(Ne);
916
- if (!e)
917
- throw new Error(
918
- "useIngredientContext must be used within a IngredientProvider"
919
- );
920
- return e;
921
- }, Ke = $(
922
- void 0
923
- ), Jt = ({ children: e }) => {
924
- const { model: t, ready: s } = xe(), r = T(() => s && t ? { model: t } : {}, [s, t]);
925
- return /* @__PURE__ */ c(Ke.Provider, { value: r, children: e });
926
- }, Qt = () => {
927
- const e = P(Ke);
928
- if (!e)
929
- throw new Error(
930
- "useIngredientContainerContext must be used within a IngredientContainerProvider"
931
- );
932
- return e;
933
- }, mt = () => {
934
- const e = ue.type;
935
- return A({
936
- modelId: e,
937
- modelType: ue.type,
938
- options: {}
939
- });
940
- }, Le = $(void 0), Xt = ({ children: e }) => {
941
- const { model: t, ready: s } = mt(), r = T(() => s && t ? { model: t } : {}, [s, t]);
942
- return /* @__PURE__ */ c(Le.Provider, { value: r, children: e });
943
- }, Zt = () => {
944
- const e = P(Le);
945
- if (!e)
946
- throw new Error("usePumpContext must be used within a PumpProvider");
947
- return e;
948
- };
949
- export {
950
- Bt as $,
951
- Kt as A,
952
- Yt as B,
953
- dt as C,
954
- it as D,
955
- Xe as E,
956
- D as F,
957
- W as G,
958
- Ut as H,
959
- Wt as I,
960
- de as J,
961
- st as K,
962
- $t as L,
963
- nt as M,
964
- Je as N,
965
- le as O,
966
- Xt as P,
967
- tt as Q,
968
- Ie as R,
969
- wt as S,
970
- Ae as T,
971
- xt as U,
972
- $e as V,
973
- kt as W,
974
- we as X,
975
- yt as Y,
976
- Ct as Z,
977
- xe as _,
978
- Rt as a,
979
- ve as a0,
980
- Et as a1,
981
- et as a2,
982
- at as a3,
983
- ze as a4,
984
- Ht as a5,
985
- St as a6,
986
- Nt as a7,
987
- Dt as b,
988
- Mt as c,
989
- Ot as d,
990
- _t as e,
991
- pt as f,
992
- ct as g,
993
- Vt as h,
994
- Gt as i,
995
- jt as j,
996
- Ft as k,
997
- qt as l,
998
- Jt as m,
999
- Qt as n,
1000
- B as o,
1001
- Zt as p,
1002
- he as q,
1003
- be as r,
1004
- Pt as s,
1005
- Te as t,
1006
- Lt as u,
1007
- It as v,
1008
- vt as w,
1009
- ge as x,
1010
- At as y,
1011
- Qe as z
1012
- };
1013
- //# sourceMappingURL=pump-provider-COTqsOH-.js.map