@kosdev-code/kos-dispense-sdk 2.0.12 → 2.0.15

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