@kosdev-code/kos-dispense-sdk 0.1.0-dev.5880 → 0.1.0-next.1000
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.kos.json +129 -0
- package/{dispense-registration-manager-ukk4OBeX.cjs → dispense-registration-manager-CfWgJqfq.cjs} +807 -445
- package/dispense-registration-manager-CfWgJqfq.cjs.map +1 -0
- package/{dispense-registration-manager-C4XZ_c3x.js → dispense-registration-manager-DtN0T_JG.js} +846 -484
- package/dispense-registration-manager-DtN0T_JG.js.map +1 -0
- package/{extension-utils-CMVLCSA8.cjs → extension-utils-BWYG2dYG.cjs} +52 -194
- package/extension-utils-BWYG2dYG.cjs.map +1 -0
- package/{extension-utils-FxS68Xu9.js → extension-utils-BoXtjU5_.js} +58 -200
- package/extension-utils-BoXtjU5_.js.map +1 -0
- package/extensions/control-pour-extension.d.ts +8 -9
- package/extensions/control-pour-extension.d.ts.map +1 -1
- package/extensions/index.d.ts.map +1 -1
- package/index.cjs +31 -11
- package/index.cjs.map +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +118 -98
- package/index.js.map +1 -1
- package/models/constants/constants.d.ts +14 -178
- package/models/constants/constants.d.ts.map +1 -1
- package/models/constants/index.d.ts.map +1 -1
- package/models/index.d.ts.map +1 -1
- package/models/models/assembly/assembly-model.d.ts +12 -5
- package/models/models/assembly/assembly-model.d.ts.map +1 -1
- package/models/models/assembly/assembly-registration.d.ts +12 -71
- package/models/models/assembly/assembly-registration.d.ts.map +1 -1
- package/models/models/assembly/board-utils.d.ts +1 -2
- package/models/models/assembly/board-utils.d.ts.map +1 -1
- package/models/models/assembly/holder-utils.d.ts +1 -2
- package/models/models/assembly/holder-utils.d.ts.map +1 -1
- package/models/models/assembly/index.d.ts.map +1 -1
- package/models/models/assembly/nozzle-utils.d.ts +1 -2
- package/models/models/assembly/nozzle-utils.d.ts.map +1 -1
- package/models/models/assembly/pump-utils.d.ts +2 -3
- package/models/models/assembly/pump-utils.d.ts.map +1 -1
- package/models/models/assembly/services/assembly-services.d.ts +0 -1
- package/models/models/assembly/services/assembly-services.d.ts.map +1 -1
- package/models/models/assembly/services/index.d.ts.map +1 -1
- package/models/models/assembly/types/index.d.ts +8 -3
- package/models/models/availability/availability-model.d.ts +13 -78
- package/models/models/availability/availability-model.d.ts.map +1 -1
- package/models/models/availability/index.d.ts.map +1 -1
- package/models/models/availability/types/index.d.ts +7 -13
- package/models/models/board/board-container-model.d.ts +10 -3
- package/models/models/board/board-container-model.d.ts.map +1 -1
- package/models/models/board/board-container-registration.d.ts +13 -77
- package/models/models/board/board-container-registration.d.ts.map +1 -1
- package/models/models/board/board-model.d.ts +1 -2
- package/models/models/board/board-model.d.ts.map +1 -1
- package/models/models/board/board-registration.d.ts +12 -74
- package/models/models/board/board-registration.d.ts.map +1 -1
- package/models/models/board/index.d.ts.map +1 -1
- package/models/models/board/types/index.d.ts +12 -2
- package/models/models/board/types/services.d.ts.map +1 -1
- package/models/models/board/utils/board-trouble-data-mapper.d.ts +1 -2
- package/models/models/board/utils/board-trouble-data-mapper.d.ts.map +1 -1
- package/models/models/board/utils/board-trouble-resolver.d.ts +0 -1
- package/models/models/board/utils/board-trouble-resolver.d.ts.map +1 -1
- package/models/models/cui-kit-state/cui-kit-state-model.d.ts +133 -0
- package/models/models/cui-kit-state/cui-kit-state-model.d.ts.map +1 -0
- package/models/models/cui-kit-state/index.d.ts +4 -0
- package/models/models/cui-kit-state/index.d.ts.map +1 -0
- package/models/models/cui-kit-state/types/index.d.ts +82 -0
- package/models/models/device-assembly/device-assembly-model.d.ts +6 -3
- package/models/models/device-assembly/device-assembly-model.d.ts.map +1 -1
- package/models/models/device-assembly/device-assembly-registration.d.ts +14 -79
- package/models/models/device-assembly/device-assembly-registration.d.ts.map +1 -1
- package/models/models/device-assembly/index.d.ts.map +1 -1
- package/models/models/device-assembly/types/index.d.ts +4 -0
- package/models/models/generic-pour/generic-pour-model.d.ts +19 -4
- package/models/models/generic-pour/generic-pour-model.d.ts.map +1 -1
- package/models/models/generic-pour/generic-pour-registration.d.ts +13 -75
- package/models/models/generic-pour/generic-pour-registration.d.ts.map +1 -1
- package/models/models/generic-pour/index.d.ts.map +1 -1
- package/models/models/generic-pour/services/generic-pour-services.d.ts.map +1 -1
- package/models/models/generic-pour/services/index.d.ts.map +1 -1
- package/models/models/generic-pour/types/index.d.ts +4 -0
- package/models/models/holder/holder-model.d.ts +16 -75
- package/models/models/holder/holder-model.d.ts.map +1 -1
- package/models/models/holder/index.d.ts.map +1 -1
- package/models/models/holder/services/assignment-services.d.ts.map +1 -1
- package/models/models/holder/services/holder-services.d.ts.map +1 -1
- package/models/models/holder/services/index.d.ts.map +1 -1
- package/models/models/holder/types/index.d.ts +11 -7
- package/models/models/holder/utils/holder-utils.d.ts +0 -1
- package/models/models/holder/utils/holder-utils.d.ts.map +1 -1
- package/models/models/holder-container/holder-container-model.d.ts +12 -70
- package/models/models/holder-container/holder-container-model.d.ts.map +1 -1
- package/models/models/holder-container/index.d.ts.map +1 -1
- package/models/models/holder-container/types/index.d.ts +16 -5
- package/models/models/index.d.ts +1 -0
- package/models/models/index.d.ts.map +1 -1
- package/models/models/ingredient/index.d.ts.map +1 -1
- package/models/models/ingredient/ingredient-model.d.ts +12 -76
- package/models/models/ingredient/ingredient-model.d.ts.map +1 -1
- package/models/models/ingredient/services/index.d.ts.map +1 -1
- package/models/models/ingredient/services/ingredient-services.d.ts.map +1 -1
- package/models/models/ingredient/types/index.d.ts +7 -13
- package/models/models/ingredient-container/index.d.ts.map +1 -1
- package/models/models/ingredient-container/ingredient-container-model.d.ts +12 -70
- package/models/models/ingredient-container/ingredient-container-model.d.ts.map +1 -1
- package/models/models/ingredient-container/types/index.d.ts +7 -3
- package/models/models/nozzle/index.d.ts.map +1 -1
- package/models/models/nozzle/nozzle-model.d.ts +20 -81
- package/models/models/nozzle/nozzle-model.d.ts.map +1 -1
- package/models/models/nozzle/services/index.d.ts.map +1 -1
- package/models/models/nozzle/services/nozzle-services.d.ts +11 -65
- package/models/models/nozzle/services/nozzle-services.d.ts.map +1 -1
- package/models/models/nozzle/types/index.d.ts +7 -3
- package/models/models/pump/index.d.ts.map +1 -1
- package/models/models/pump/pump-model.d.ts +12 -81
- package/models/models/pump/pump-model.d.ts.map +1 -1
- package/models/models/pump/services/index.d.ts.map +1 -1
- package/models/models/pump/services/pump-services.d.ts +3 -5
- package/models/models/pump/services/pump-services.d.ts.map +1 -1
- package/models/models/pump/types/index.d.ts +7 -3
- package/models/models/pump/utils/pump-trouble-resolver.d.ts +0 -1
- package/models/models/pump/utils/pump-trouble-resolver.d.ts.map +1 -1
- package/models/models/pump-container/index.d.ts.map +1 -1
- package/models/models/pump-container/pump-container-model.d.ts +16 -70
- package/models/models/pump-container/pump-container-model.d.ts.map +1 -1
- package/models/models/pump-container/types/index.d.ts +7 -3
- package/models/models/types/assembly.d.ts.map +1 -1
- package/models/models/types/index.d.ts.map +1 -1
- package/models/models/types/intent.d.ts +11 -79
- package/models/models/types/intent.d.ts.map +1 -1
- package/models/models/types/pouring.d.ts.map +1 -1
- package/models/utils/dispense-registration-manager.d.ts +34 -10
- package/models/utils/dispense-registration-manager.d.ts.map +1 -1
- package/models/utils/extension-utils.d.ts +66 -173
- package/models/utils/extension-utils.d.ts.map +1 -1
- package/models/utils/openapi-index.d.ts +1 -1
- package/models/utils/openapi-index.d.ts.map +1 -1
- package/models/utils/pour-context.d.ts +8 -0
- package/models/utils/pour-context.d.ts.map +1 -0
- package/models/utils/registration.d.ts +0 -1
- package/models/utils/registration.d.ts.map +1 -1
- package/models/utils/service.d.ts +34 -35
- package/models/utils/service.d.ts.map +1 -1
- package/models/utils/services/dispense/1.6.5/service.d.ts +34 -35
- package/models/utils/services/dispense/1.6.5/service.d.ts.map +1 -1
- package/models/utils/services/dispense/1.8.1/service.d.ts +34 -35
- package/models/utils/services/dispense/1.8.1/service.d.ts.map +1 -1
- package/models/utils/services/dispense/daily/openapi.d.ts +1941 -1812
- package/models/utils/services/dispense/daily/service.d.ts +127 -37
- package/models/utils/services/dispense/daily/service.d.ts.map +1 -1
- package/models/utils/services-index.d.ts +1 -1
- package/models/utils/services-index.d.ts.map +1 -1
- package/models.cjs +4 -5
- package/models.cjs.map +1 -1
- package/models.d.ts +1 -0
- package/models.js +29 -30
- package/models.js.map +1 -1
- package/package.json +11 -12
- package/{pump-provider-BAQXIUuP.cjs → pump-provider-B4WR3LiY.cjs} +480 -544
- package/pump-provider-B4WR3LiY.cjs.map +1 -0
- package/{pump-provider-9rUgev7q.js → pump-provider-CPUsLke5.js} +541 -605
- package/pump-provider-CPUsLke5.js.map +1 -0
- package/ui/contexts/assembly/assembly-provider.d.ts +9 -2
- package/ui/contexts/assembly/assembly-provider.d.ts.map +1 -1
- package/ui/contexts/assembly/index.d.ts.map +1 -1
- package/ui/contexts/availability/availability-provider.d.ts +9 -2
- package/ui/contexts/availability/availability-provider.d.ts.map +1 -1
- package/ui/contexts/availability/index.d.ts.map +1 -1
- package/ui/contexts/board/board-provider.d.ts +9 -2
- package/ui/contexts/board/board-provider.d.ts.map +1 -1
- package/ui/contexts/board/index.d.ts.map +1 -1
- package/ui/contexts/board-container/board-container-provider.d.ts +9 -2
- package/ui/contexts/board-container/board-container-provider.d.ts.map +1 -1
- package/ui/contexts/board-container/index.d.ts.map +1 -1
- package/ui/contexts/cui-kit/cui-kit.d.ts +17 -3
- package/ui/contexts/cui-kit/cui-kit.d.ts.map +1 -1
- package/ui/contexts/cui-kit/index.d.ts.map +1 -1
- package/ui/contexts/device-assembly/device-assembly-provider.d.ts +9 -2
- package/ui/contexts/device-assembly/device-assembly-provider.d.ts.map +1 -1
- package/ui/contexts/device-assembly/index.d.ts.map +1 -1
- package/ui/contexts/holder/holder-provider.d.ts +9 -2
- package/ui/contexts/holder/holder-provider.d.ts.map +1 -1
- package/ui/contexts/holder/index.d.ts.map +1 -1
- package/ui/contexts/holder-container/holder-container-provider.d.ts +9 -2
- package/ui/contexts/holder-container/holder-container-provider.d.ts.map +1 -1
- package/ui/contexts/holder-container/index.d.ts.map +1 -1
- package/ui/contexts/index.d.ts.map +1 -1
- package/ui/contexts/ingredient/index.d.ts.map +1 -1
- package/ui/contexts/ingredient/ingredient-provider.d.ts +9 -2
- package/ui/contexts/ingredient/ingredient-provider.d.ts.map +1 -1
- package/ui/contexts/ingredient-container/index.d.ts.map +1 -1
- package/ui/contexts/ingredient-container/ingredient-container-provider.d.ts +9 -2
- package/ui/contexts/ingredient-container/ingredient-container-provider.d.ts.map +1 -1
- package/ui/contexts/nozzle/index.d.ts.map +1 -1
- package/ui/contexts/nozzle/nozzle-provider.d.ts +9 -2
- package/ui/contexts/nozzle/nozzle-provider.d.ts.map +1 -1
- package/ui/contexts/pump/index.d.ts.map +1 -1
- package/ui/contexts/pump/pump-provider.d.ts +9 -2
- package/ui/contexts/pump/pump-provider.d.ts.map +1 -1
- package/ui/hooks/assembly/index.d.ts.map +1 -1
- package/ui/hooks/assembly/use-assembly.d.ts +5 -2
- package/ui/hooks/assembly/use-assembly.d.ts.map +1 -1
- package/ui/hooks/assembly/with-assembly.d.ts +4 -1
- package/ui/hooks/assembly/with-assembly.d.ts.map +1 -1
- package/ui/hooks/availability/index.d.ts.map +1 -1
- package/ui/hooks/availability/use-availability.d.ts +5 -2
- package/ui/hooks/availability/use-availability.d.ts.map +1 -1
- package/ui/hooks/availability/with-availability.d.ts +0 -1
- package/ui/hooks/availability/with-availability.d.ts.map +1 -1
- package/ui/hooks/board/index.d.ts.map +1 -1
- package/ui/hooks/board/use-board.d.ts +5 -2
- package/ui/hooks/board/use-board.d.ts.map +1 -1
- package/ui/hooks/board/with-board.d.ts +4 -1
- package/ui/hooks/board/with-board.d.ts.map +1 -1
- package/ui/hooks/board-container/index.d.ts.map +1 -1
- package/ui/hooks/board-container/use-board-container.d.ts +5 -2
- package/ui/hooks/board-container/use-board-container.d.ts.map +1 -1
- package/ui/hooks/board-container/with-board-container.d.ts +4 -1
- package/ui/hooks/board-container/with-board-container.d.ts.map +1 -1
- package/ui/hooks/cui-kit/dispense-topics.d.ts +0 -1
- package/ui/hooks/cui-kit/dispense-topics.d.ts.map +1 -1
- package/ui/hooks/cui-kit/index.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-ambient-attract-timers.d.ts +0 -1
- package/ui/hooks/cui-kit/use-ambient-attract-timers.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-beverages.d.ts +1 -2
- package/ui/hooks/cui-kit/use-beverages.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-brands.d.ts +1 -2
- package/ui/hooks/cui-kit/use-brands.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-cui-kit.d.ts +51 -7
- package/ui/hooks/cui-kit/use-cui-kit.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-default-cui-kit-lifecycle.d.ts +16 -44
- package/ui/hooks/cui-kit/use-default-cui-kit-lifecycle.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-dispense-lifecycle.d.ts +0 -1
- package/ui/hooks/cui-kit/use-dispense-lifecycle.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-dispense-timers.d.ts +0 -1
- package/ui/hooks/cui-kit/use-dispense-timers.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-flavors.d.ts +1 -2
- package/ui/hooks/cui-kit/use-flavors.d.ts.map +1 -1
- package/ui/hooks/device-assembly/index.d.ts.map +1 -1
- package/ui/hooks/device-assembly/use-device-assembly.d.ts +5 -2
- package/ui/hooks/device-assembly/use-device-assembly.d.ts.map +1 -1
- package/ui/hooks/device-assembly/with-device-assembly.d.ts +4 -1
- package/ui/hooks/device-assembly/with-device-assembly.d.ts.map +1 -1
- package/ui/hooks/generic-pour/index.d.ts.map +1 -1
- package/ui/hooks/generic-pour/use-generic-pour.d.ts +6 -3
- package/ui/hooks/generic-pour/use-generic-pour.d.ts.map +1 -1
- package/ui/hooks/generic-pour/with-generic-pour.d.ts +5 -2
- package/ui/hooks/generic-pour/with-generic-pour.d.ts.map +1 -1
- package/ui/hooks/holder/index.d.ts.map +1 -1
- package/ui/hooks/holder/use-holder.d.ts +5 -2
- package/ui/hooks/holder/use-holder.d.ts.map +1 -1
- package/ui/hooks/holder/with-holder.d.ts +4 -1
- package/ui/hooks/holder/with-holder.d.ts.map +1 -1
- package/ui/hooks/holder-container/index.d.ts.map +1 -1
- package/ui/hooks/holder-container/use-holder-container.d.ts +7 -4
- package/ui/hooks/holder-container/use-holder-container.d.ts.map +1 -1
- package/ui/hooks/holder-container/with-holder-container.d.ts +4 -1
- package/ui/hooks/holder-container/with-holder-container.d.ts.map +1 -1
- package/ui/hooks/index.d.ts.map +1 -1
- package/ui/hooks/ingredient/index.d.ts.map +1 -1
- package/ui/hooks/ingredient/use-ingredient-pour.d.ts +16 -22
- package/ui/hooks/ingredient/use-ingredient-pour.d.ts.map +1 -1
- package/ui/hooks/ingredient/use-ingredient.d.ts +5 -2
- package/ui/hooks/ingredient/use-ingredient.d.ts.map +1 -1
- package/ui/hooks/ingredient/with-ingredient.d.ts +4 -1
- package/ui/hooks/ingredient/with-ingredient.d.ts.map +1 -1
- package/ui/hooks/ingredient-container/index.d.ts.map +1 -1
- package/ui/hooks/ingredient-container/use-ingredient-container.d.ts +5 -2
- package/ui/hooks/ingredient-container/use-ingredient-container.d.ts.map +1 -1
- package/ui/hooks/ingredient-container/with-ingredient-container.d.ts +4 -1
- package/ui/hooks/ingredient-container/with-ingredient-container.d.ts.map +1 -1
- package/ui/hooks/nozzle/index.d.ts.map +1 -1
- package/ui/hooks/nozzle/use-dispense-kit.d.ts +0 -1
- package/ui/hooks/nozzle/use-dispense-kit.d.ts.map +1 -1
- package/ui/hooks/nozzle/use-nozzle.d.ts +5 -2
- package/ui/hooks/nozzle/use-nozzle.d.ts.map +1 -1
- package/ui/hooks/nozzle/with-nozzle.d.ts +4 -1
- package/ui/hooks/nozzle/with-nozzle.d.ts.map +1 -1
- package/ui/hooks/nozzle-pour/index.d.ts.map +1 -1
- package/ui/hooks/nozzle-pour/use-nozzle-pour.d.ts +16 -22
- package/ui/hooks/nozzle-pour/use-nozzle-pour.d.ts.map +1 -1
- package/ui/hooks/pour/index.d.ts.map +1 -1
- package/ui/hooks/pour/use-pour.d.ts +11 -23
- package/ui/hooks/pour/use-pour.d.ts.map +1 -1
- package/ui/hooks/pump/index.d.ts.map +1 -1
- package/ui/hooks/pump/use-pump.d.ts +1 -2
- package/ui/hooks/pump/use-pump.d.ts.map +1 -1
- package/ui/hooks/pump/with-pump.d.ts +0 -1
- package/ui/hooks/pump/with-pump.d.ts.map +1 -1
- package/ui/hooks/utils/pour-strategy/hold-to-pour-intent-strategy.d.ts +5 -2
- package/ui/hooks/utils/pour-strategy/hold-to-pour-intent-strategy.d.ts.map +1 -1
- package/ui/hooks/utils/pour-strategy/hold-to-pour-strategy.d.ts +4 -1
- package/ui/hooks/utils/pour-strategy/hold-to-pour-strategy.d.ts.map +1 -1
- package/ui/hooks/utils/pour-strategy/index.d.ts.map +1 -1
- package/ui/hooks/utils/pour-strategy/pour-strategy.d.ts +11 -2
- package/ui/hooks/utils/pour-strategy/pour-strategy.d.ts.map +1 -1
- package/ui/hooks/utils/pour-strategy/tap-or-hold-to-pour-intent-strategy.d.ts +5 -2
- package/ui/hooks/utils/pour-strategy/tap-or-hold-to-pour-intent-strategy.d.ts.map +1 -1
- package/ui/hooks/utils/pour-strategy/tap-to-pour-intent-strategy.d.ts +5 -2
- package/ui/hooks/utils/pour-strategy/tap-to-pour-intent-strategy.d.ts.map +1 -1
- package/ui/hooks/utils/pour-strategy/tap-to-pour-strategy.d.ts +4 -1
- package/ui/hooks/utils/pour-strategy/tap-to-pour-strategy.d.ts.map +1 -1
- package/ui/index.d.ts.map +1 -1
- package/ui/utils/pour-context.d.ts +1 -7
- package/ui/utils/pour-context.d.ts.map +1 -1
- package/ui.cjs +3 -7
- package/ui.cjs.map +1 -1
- package/ui.d.ts +1 -0
- package/ui.js +64 -68
- package/ui.js.map +1 -1
- package/dispense-registration-manager-C4XZ_c3x.js.map +0 -1
- package/dispense-registration-manager-ukk4OBeX.cjs.map +0 -1
- package/extension-utils-CMVLCSA8.cjs.map +0 -1
- package/extension-utils-FxS68Xu9.js.map +0 -1
- package/kos-models.json +0 -180
- package/pump-provider-9rUgev7q.js.map +0 -1
- package/pump-provider-BAQXIUuP.cjs.map +0 -1
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => {
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
7
1
|
import { jsx } from "@emotion/react/jsx-runtime";
|
|
8
|
-
import { useKosModel, getKosCompanionModel, kosAutoEffect, KosLog,
|
|
9
|
-
import { A as Assembly$1, b as Availability$1, e as Board$1, d as BoardContainer$1, N as Nozzle$1, f as DeviceAssembly, H as Holder$1, j as HolderContainer$1, I as Ingredient$1, k as IngredientContainer$1, G as GenericPour, P as Pump$1 } from "./dispense-registration-manager-C4XZ_c3x.js";
|
|
2
|
+
import { useKosModel, getKosCompanionModel, kosAutoEffect, KosLog, LogGroup, whenReady, usePressGesture, TimerManager, EventBus } from "@kosdev-code/kos-ui-sdk";
|
|
10
3
|
import React, { createContext, useMemo, useContext, useState, useCallback, useEffect, useRef } from "react";
|
|
4
|
+
import { A as Assembly$1, a as Availability$1, B as Board$1, b as BoardContainer$1, N as Nozzle$1, e as CuiKitState, X as cuiKitId, D as DeviceAssembly, H as Holder$1, g as HolderContainer$1, I as Ingredient$1, h as IngredientContainer$1, P as PourContext, G as GenericPour, j as Pump$1 } from "./dispense-registration-manager-DtN0T_JG.js";
|
|
11
5
|
const useAssembly = () => {
|
|
12
6
|
const modelId = Assembly$1.type;
|
|
13
7
|
const result = useKosModel({
|
|
@@ -107,8 +101,7 @@ const useBeverages = ({
|
|
|
107
101
|
const [beverages, setBeverages] = useState([]);
|
|
108
102
|
const [selectedBeverage, setSelectedBeverage] = useState(null);
|
|
109
103
|
const companions = useMemo(() => {
|
|
110
|
-
if (!companionType)
|
|
111
|
-
return [];
|
|
104
|
+
if (!companionType) return [];
|
|
112
105
|
return beverages.map(
|
|
113
106
|
(brand) => getKosCompanionModel(brand, companionType)
|
|
114
107
|
);
|
|
@@ -116,30 +109,29 @@ const useBeverages = ({
|
|
|
116
109
|
const selectBeverage = useCallback(
|
|
117
110
|
async (beverage, context, forceUpdate) => {
|
|
118
111
|
setSelectedBeverage(beverage);
|
|
119
|
-
await
|
|
120
|
-
onBeverageSelected
|
|
112
|
+
await nozzle?.setSelectedPourable({ beverage, context }, forceUpdate);
|
|
113
|
+
onBeverageSelected?.(beverage);
|
|
121
114
|
},
|
|
122
115
|
[nozzle, onBeverageSelected]
|
|
123
116
|
);
|
|
124
117
|
const clearBeverage = useCallback(async () => {
|
|
125
118
|
setSelectedBeverage(null);
|
|
126
|
-
await
|
|
127
|
-
onClearBeverage
|
|
119
|
+
await nozzle?.setSelectedPourable({ beverage: void 0 });
|
|
120
|
+
onClearBeverage?.();
|
|
128
121
|
}, [nozzle, onClearBeverage]);
|
|
129
122
|
useEffect(() => {
|
|
130
123
|
const disposer = kosAutoEffect(() => {
|
|
131
|
-
if (!nozzle)
|
|
132
|
-
return;
|
|
124
|
+
if (!nozzle) return;
|
|
133
125
|
const selectedBrand = nozzle.selectedBrand;
|
|
134
126
|
if (!selectedBrand) {
|
|
135
127
|
const allBeverages = nozzle.getGroupAvailabilityItems("beverages").filter((beverage) => beverage.visible);
|
|
136
128
|
setBeverages(allBeverages ?? []);
|
|
137
|
-
onBeverageListUpdated
|
|
129
|
+
onBeverageListUpdated?.(allBeverages);
|
|
138
130
|
return;
|
|
139
131
|
}
|
|
140
132
|
const beverages2 = nozzle.getAvailabilityByParent(selectedBrand.id).filter((b) => b.visible);
|
|
141
133
|
setBeverages(beverages2 ?? []);
|
|
142
|
-
onBeverageListUpdated
|
|
134
|
+
onBeverageListUpdated?.(beverages2);
|
|
143
135
|
});
|
|
144
136
|
return () => {
|
|
145
137
|
disposer();
|
|
@@ -153,6 +145,7 @@ const useBeverages = ({
|
|
|
153
145
|
clearBeverage
|
|
154
146
|
};
|
|
155
147
|
};
|
|
148
|
+
const log$4 = KosLog.createLogger({ group: LogGroup.ui, name: "use-brands" });
|
|
156
149
|
const useBrands = ({
|
|
157
150
|
onBrandSelected,
|
|
158
151
|
onBrandCleared,
|
|
@@ -162,32 +155,28 @@ const useBrands = ({
|
|
|
162
155
|
const [selectedBrand, setSelectedBrand] = useState(null);
|
|
163
156
|
const [brands, setBrands] = useState([]);
|
|
164
157
|
const companions = useMemo(() => {
|
|
165
|
-
if (!companionType)
|
|
166
|
-
return [];
|
|
158
|
+
if (!companionType) return [];
|
|
167
159
|
return brands.map((brand) => getKosCompanionModel(brand, companionType));
|
|
168
160
|
}, [brands, companionType]);
|
|
169
161
|
const selectBrand = useCallback(
|
|
170
162
|
async (brand, context, forceUpdate) => {
|
|
171
163
|
setSelectedBrand(brand);
|
|
172
164
|
if (forceUpdate) {
|
|
173
|
-
|
|
174
|
-
`forceUpdate is not currently supported when setting brand`
|
|
175
|
-
);
|
|
165
|
+
log$4.warn(`forceUpdate is not currently supported when setting brand`);
|
|
176
166
|
}
|
|
177
|
-
nozzle
|
|
178
|
-
onBrandSelected
|
|
167
|
+
nozzle?.setSelectedBrand(brand, context);
|
|
168
|
+
onBrandSelected?.(brand);
|
|
179
169
|
},
|
|
180
170
|
[nozzle, onBrandSelected]
|
|
181
171
|
);
|
|
182
172
|
const clearBrand = useCallback(() => {
|
|
183
173
|
setSelectedBrand(null);
|
|
184
|
-
nozzle
|
|
185
|
-
onBrandCleared
|
|
174
|
+
nozzle?.setSelectedBrand(void 0);
|
|
175
|
+
onBrandCleared?.();
|
|
186
176
|
}, [nozzle, onBrandCleared]);
|
|
187
177
|
useEffect(() => {
|
|
188
178
|
const disposer = kosAutoEffect(() => {
|
|
189
|
-
if (!nozzle)
|
|
190
|
-
return;
|
|
179
|
+
if (!nozzle) return;
|
|
191
180
|
setBrands(nozzle.visibleBrands);
|
|
192
181
|
});
|
|
193
182
|
return () => {
|
|
@@ -202,336 +191,232 @@ const useBrands = ({
|
|
|
202
191
|
clearBrand
|
|
203
192
|
};
|
|
204
193
|
};
|
|
205
|
-
class PourContext {
|
|
206
|
-
constructor() {
|
|
207
|
-
__publicField(this, "_data", /* @__PURE__ */ new Map());
|
|
208
|
-
}
|
|
209
|
-
get(key) {
|
|
210
|
-
return this._data.get(key);
|
|
211
|
-
}
|
|
212
|
-
set(key, value) {
|
|
213
|
-
this._data.set(key, value);
|
|
214
|
-
}
|
|
215
|
-
remove(key) {
|
|
216
|
-
this._data.delete(key);
|
|
217
|
-
}
|
|
218
|
-
has(key) {
|
|
219
|
-
return this._data.has(key);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
194
|
const logger$7 = KosLog.createLogger({
|
|
223
|
-
|
|
224
|
-
|
|
195
|
+
group: LogGroup.ui,
|
|
196
|
+
name: "HoldToPourIntentStrategy"
|
|
197
|
+
});
|
|
198
|
+
const HoldToPourIntentStrategy = {
|
|
199
|
+
name: "HoldToPourIntentStrategy",
|
|
200
|
+
requiresHold: true,
|
|
201
|
+
async initiate(model, intent) {
|
|
202
|
+
if (!model?.canPour) {
|
|
203
|
+
logger$7.debug(`${model?.id} cannot pour. Returning early.`);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (intent) {
|
|
207
|
+
logger$7.debug(`performing intent: ${intent}`);
|
|
208
|
+
await model?.performIntent(intent);
|
|
209
|
+
} else {
|
|
210
|
+
logger$7.debug("no intent provided. Returning early.");
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
async initiateEnded(nozzle) {
|
|
214
|
+
await nozzle?.cancelPour();
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
const logger$6 = KosLog.createLogger({
|
|
218
|
+
group: LogGroup.ui,
|
|
219
|
+
name: "HoldToPourStrategy"
|
|
225
220
|
});
|
|
226
221
|
const HoldToPourStrategy = {
|
|
227
222
|
name: "HoldToPourStrategy",
|
|
223
|
+
requiresHold: true,
|
|
228
224
|
async initiate(nozzle) {
|
|
229
|
-
if (!
|
|
230
|
-
logger$
|
|
225
|
+
if (!nozzle?.canPour) {
|
|
226
|
+
logger$6.debug(`Nozzle ${nozzle?.id} cannot pour. Returning early.`);
|
|
231
227
|
return;
|
|
232
228
|
}
|
|
233
|
-
await
|
|
229
|
+
await nozzle?.pour();
|
|
234
230
|
},
|
|
235
231
|
async initiateEnded(nozzle) {
|
|
236
|
-
await
|
|
232
|
+
await nozzle?.cancelPour();
|
|
237
233
|
}
|
|
238
234
|
};
|
|
239
|
-
const logger$
|
|
240
|
-
|
|
241
|
-
|
|
235
|
+
const logger$5 = KosLog.createLogger({
|
|
236
|
+
group: LogGroup.ui,
|
|
237
|
+
name: "TapOrHoldIntentStrategy"
|
|
242
238
|
});
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
239
|
+
class TapOrHoldIntentStrategy {
|
|
240
|
+
intent;
|
|
241
|
+
name = "TapOrHoldIntentStrategy";
|
|
242
|
+
isHold = false;
|
|
243
|
+
disposer = null;
|
|
244
|
+
constructor(intent) {
|
|
245
|
+
this.intent = intent;
|
|
246
|
+
}
|
|
247
|
+
async initiate(model, intent = this.intent) {
|
|
248
|
+
this.isHold = false;
|
|
249
|
+
this.disposer = setTimeout(() => {
|
|
250
|
+
this.isHold = true;
|
|
251
|
+
}, 250);
|
|
252
|
+
if (model?.isPouring && !this.isHold) {
|
|
253
|
+
logger$5.debug(`additional tap detected. cancelling pour`);
|
|
254
|
+
await model.cancelPour();
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
if (!model?.canPour) {
|
|
258
|
+
logger$5.debug(`${model?.id} cannot pour. Returning early.`);
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
if (intent) {
|
|
262
|
+
logger$5.debug(`performing intent: ${intent}`);
|
|
263
|
+
await model?.performIntent(intent);
|
|
263
264
|
} else {
|
|
264
|
-
logger$
|
|
265
|
-
`[${strategy == null ? void 0 : strategy.name}] - Did not pass onBeforePour gate for nozzle ${nozzle == null ? void 0 : nozzle.id}. Cancelling pour.`
|
|
266
|
-
);
|
|
267
|
-
onBeforePourRejected == null ? void 0 : onBeforePourRejected();
|
|
265
|
+
logger$5.debug("no intent provided. Returning early.");
|
|
268
266
|
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
}
|
|
307
|
-
return {
|
|
308
|
-
handlers: handlers.dom,
|
|
309
|
-
cancel: forceCancelPour,
|
|
310
|
-
updatePourContext: handleUpdateContext,
|
|
311
|
-
removeFromPourContext: handleRemoveFromContext,
|
|
312
|
-
status: nozzle
|
|
313
|
-
};
|
|
267
|
+
}
|
|
268
|
+
async initiateEnded(nozzle) {
|
|
269
|
+
if (this.disposer) clearTimeout(this.disposer);
|
|
270
|
+
this.disposer = null;
|
|
271
|
+
if (!this.isHold) {
|
|
272
|
+
logger$5.debug("Tap detected. don't cancel and return.");
|
|
273
|
+
return true;
|
|
274
|
+
}
|
|
275
|
+
await nozzle?.cancelPour();
|
|
276
|
+
return false;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
const logger$4 = KosLog.createLogger({
|
|
280
|
+
group: LogGroup.ui,
|
|
281
|
+
name: "TapToPourIntentStrategy"
|
|
282
|
+
});
|
|
283
|
+
const TapToPourIntentStrategy = {
|
|
284
|
+
name: "TapToPourIntentStrategy",
|
|
285
|
+
async initiate(model, intent) {
|
|
286
|
+
if (model?.isPouring) {
|
|
287
|
+
logger$4.debug(`Nozzle ${model?.id} is already pouring. cancelling pour`);
|
|
288
|
+
await model.cancelPour();
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
if (!model?.canPour) {
|
|
292
|
+
logger$4.debug(`Nozzle ${model?.id} cannot pour. Returning early.`);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
if (intent) {
|
|
296
|
+
logger$4.debug(`performing intent: ${intent}`);
|
|
297
|
+
await model?.performIntent(intent);
|
|
298
|
+
} else {
|
|
299
|
+
logger$4.debug("no intent provided. Returning early.");
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
async initiateEnded(_nozzle) {
|
|
303
|
+
return true;
|
|
304
|
+
}
|
|
314
305
|
};
|
|
315
|
-
const
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
if (!companionType)
|
|
327
|
-
return [];
|
|
328
|
-
return flavors.map(
|
|
329
|
-
(flavor) => getKosCompanionModel(flavor, companionType)
|
|
330
|
-
);
|
|
331
|
-
}, [flavors, companionType]);
|
|
332
|
-
const [selectedFlavors, setSelectedFlavors] = useState([]);
|
|
333
|
-
const selectFlavor = useCallback(
|
|
334
|
-
async (flavor, context, forceUpdate) => {
|
|
335
|
-
setSelectedFlavors(
|
|
336
|
-
(previous) => (previous == null ? void 0 : previous.includes(flavor)) ? [...previous.filter((p) => p !== flavor)] : [...previous ?? [], flavor]
|
|
337
|
-
);
|
|
338
|
-
if (nozzle == null ? void 0 : nozzle.selectedPourable) {
|
|
339
|
-
const { beverage } = nozzle.selectedPourable;
|
|
340
|
-
await nozzle.setSelectedPourable(
|
|
341
|
-
{
|
|
342
|
-
beverage,
|
|
343
|
-
additional: selectedFlavors ?? [],
|
|
344
|
-
context
|
|
345
|
-
},
|
|
346
|
-
forceUpdate
|
|
347
|
-
);
|
|
348
|
-
}
|
|
349
|
-
onFlavorSelected == null ? void 0 : onFlavorSelected(flavor, selectedFlavors ?? []);
|
|
350
|
-
},
|
|
351
|
-
[nozzle, onFlavorSelected, selectedFlavors]
|
|
352
|
-
);
|
|
353
|
-
const clear = useCallback(async () => {
|
|
354
|
-
setSelectedFlavors([]);
|
|
355
|
-
if (nozzle == null ? void 0 : nozzle.selectedPourable) {
|
|
356
|
-
const { beverage } = nozzle.selectedPourable;
|
|
357
|
-
nozzle.setSelectedPourable({ beverage });
|
|
358
|
-
onFlavorCleared == null ? void 0 : onFlavorCleared();
|
|
306
|
+
const logger$3 = KosLog.createLogger({
|
|
307
|
+
group: LogGroup.ui,
|
|
308
|
+
name: "HoldToPourStrategy"
|
|
309
|
+
});
|
|
310
|
+
const TapToPourStrategy = {
|
|
311
|
+
name: "TapToPourStrategy",
|
|
312
|
+
async initiate(nozzle) {
|
|
313
|
+
if (nozzle?.isPouring) {
|
|
314
|
+
logger$3.debug(`Nozzle ${nozzle?.id} is already pouring. cancelling pour`);
|
|
315
|
+
await nozzle.cancelPour();
|
|
316
|
+
return;
|
|
359
317
|
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
318
|
+
if (!nozzle?.canPour) {
|
|
319
|
+
logger$3.debug(`Nozzle ${nozzle?.id} cannot pour. Returning early.`);
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
await nozzle?.pour();
|
|
323
|
+
},
|
|
324
|
+
async initiateEnded(_nozzle) {
|
|
325
|
+
return true;
|
|
326
|
+
}
|
|
368
327
|
};
|
|
369
328
|
const DISPENSE_GROUP_BRAND = "brands";
|
|
370
329
|
const DISPENSE_GROUP_BEVERAGE = "beverages";
|
|
371
330
|
const DISPENSE_GROUP_FLAVOR = "flavors";
|
|
372
|
-
const log$
|
|
331
|
+
const log$3 = KosLog.createLogger({ group: LogGroup.ui, name: "use-cui-kit" });
|
|
373
332
|
const useCuiKit = ({
|
|
374
|
-
initialGroup
|
|
333
|
+
initialGroup,
|
|
334
|
+
steps,
|
|
375
335
|
options = {}
|
|
376
336
|
}) => {
|
|
377
|
-
var _a, _b, _c;
|
|
378
|
-
const [currentGroup, setCurrentGroup] = useState(initialGroup);
|
|
379
337
|
const { model: nozzle } = useNozzleContext();
|
|
380
338
|
const timersRef = useRef([]);
|
|
381
|
-
const
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
(
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
const topic = `/kos/dispense/${nozzle == null ? void 0 : nozzle.path}/flavor/cleared/`;
|
|
427
|
-
EventBus.publish(topic, {});
|
|
428
|
-
}, [nozzle == null ? void 0 : nozzle.path]);
|
|
429
|
-
const onPour = useCallback(() => {
|
|
430
|
-
const topic = `/kos/dispense/${nozzle == null ? void 0 : nozzle.path}/pour/`;
|
|
431
|
-
EventBus.publish(topic, {});
|
|
432
|
-
}, [nozzle == null ? void 0 : nozzle.path]);
|
|
433
|
-
const handleBeforePour = useCallback(
|
|
434
|
-
async (context) => {
|
|
435
|
-
const topic = `/kos/dispense/${nozzle == null ? void 0 : nozzle.path}/pre/pour/`;
|
|
436
|
-
EventBus.publish(topic, {});
|
|
437
|
-
return await (onBeforePour == null ? void 0 : onBeforePour(context)) || true;
|
|
339
|
+
const kit = useMemo(() => {
|
|
340
|
+
if (!nozzle) return void 0;
|
|
341
|
+
try {
|
|
342
|
+
return CuiKitState.instance(cuiKitId(nozzle.path)).options({
|
|
343
|
+
nozzlePath: nozzle.path,
|
|
344
|
+
initialGroup: steps ? initialGroup : initialGroup ?? DISPENSE_GROUP_BRAND,
|
|
345
|
+
steps,
|
|
346
|
+
companionTypes: options.companionTypes,
|
|
347
|
+
pour: { strategy: options.pour?.strategy ?? HoldToPourStrategy },
|
|
348
|
+
onPourComplete: options.onPourComplete
|
|
349
|
+
}).build();
|
|
350
|
+
} catch (error) {
|
|
351
|
+
throw new Error(
|
|
352
|
+
`The CUI Kit models are not registered: call KosModelRegistry.cuiKit.models() in the app's registration chain (${error.message})`
|
|
353
|
+
);
|
|
354
|
+
}
|
|
355
|
+
}, [nozzle]);
|
|
356
|
+
const [ready, setReady] = useState(false);
|
|
357
|
+
const [, setVersion] = useState(0);
|
|
358
|
+
useEffect(() => {
|
|
359
|
+
if (!kit) return void 0;
|
|
360
|
+
let dispose;
|
|
361
|
+
let cancelled = false;
|
|
362
|
+
let attached = false;
|
|
363
|
+
whenReady(kit).then(() => {
|
|
364
|
+
if (cancelled) return;
|
|
365
|
+
attached = true;
|
|
366
|
+
if (kit.attach()) {
|
|
367
|
+
kit.reset();
|
|
368
|
+
}
|
|
369
|
+
setReady(true);
|
|
370
|
+
dispose = kosAutoEffect(() => {
|
|
371
|
+
readKitState(kit);
|
|
372
|
+
setVersion((version) => version + 1);
|
|
373
|
+
});
|
|
374
|
+
});
|
|
375
|
+
return () => {
|
|
376
|
+
cancelled = true;
|
|
377
|
+
dispose?.();
|
|
378
|
+
if (attached) kit.detach();
|
|
379
|
+
};
|
|
380
|
+
}, [kit]);
|
|
381
|
+
const updateOnBeforePour = useCallback(
|
|
382
|
+
(callback) => {
|
|
383
|
+
kit?.setBeforePour(callback);
|
|
438
384
|
},
|
|
439
|
-
[
|
|
385
|
+
[kit]
|
|
440
386
|
);
|
|
441
|
-
const
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
}, [nozzle == null ? void 0 : nozzle.path]);
|
|
445
|
-
const onPourCancel = useCallback(() => {
|
|
446
|
-
const topic = `/kos/dispense/${nozzle == null ? void 0 : nozzle.path}/pour/cancel/`;
|
|
447
|
-
EventBus.publish(topic, {});
|
|
448
|
-
}, [nozzle == null ? void 0 : nozzle.path]);
|
|
449
|
-
const { brands, selectBrand, selectedBrand, clearBrand, brandCompanions } = useBrands({
|
|
450
|
-
companionType: (_a = options.companionTypes) == null ? void 0 : _a.brand,
|
|
451
|
-
onBrandSelected,
|
|
452
|
-
onBrandCleared
|
|
453
|
-
});
|
|
454
|
-
const {
|
|
455
|
-
beverages,
|
|
456
|
-
selectBeverage,
|
|
457
|
-
selectedBeverage,
|
|
458
|
-
clearBeverage,
|
|
459
|
-
beverageCompanions
|
|
460
|
-
} = useBeverages({
|
|
461
|
-
companionType: (_b = options.companionTypes) == null ? void 0 : _b.beverage,
|
|
462
|
-
onBeverageSelected,
|
|
463
|
-
onClearBeverage: onBeverageCleared,
|
|
464
|
-
onBeverageListUpdated
|
|
387
|
+
const gesture = usePressGesture({
|
|
388
|
+
onPressed: () => void kit?.pressPour(),
|
|
389
|
+
onRelease: () => kit?.releasePour()
|
|
465
390
|
});
|
|
466
|
-
const {
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
});
|
|
477
|
-
const [onBeforePour, setOnBeforePour] = useState();
|
|
478
|
-
const updateOnBeforePour = useCallback((callback) => {
|
|
479
|
-
setOnBeforePour(() => callback);
|
|
480
|
-
}, []);
|
|
481
|
-
const pour = useNozzlePour({
|
|
482
|
-
onPour,
|
|
483
|
-
onPourCancel,
|
|
484
|
-
onBeforePour: handleBeforePour,
|
|
485
|
-
onBeforePourRejected: handleBeforePourRejected
|
|
486
|
-
});
|
|
487
|
-
updatePourContext.current = pour.updatePourContext;
|
|
488
|
-
removeFromPourContext.current = pour.removeFromPourContext;
|
|
489
|
-
const back = useCallback(() => {
|
|
490
|
-
log$2.debug(`Navigating back from group: ${currentGroup}`);
|
|
491
|
-
switch (currentGroup) {
|
|
492
|
-
case DISPENSE_GROUP_BRAND:
|
|
493
|
-
clearBeverage();
|
|
494
|
-
clearBrand();
|
|
495
|
-
break;
|
|
496
|
-
case DISPENSE_GROUP_BEVERAGE:
|
|
497
|
-
case DISPENSE_GROUP_FLAVOR:
|
|
498
|
-
setCurrentGroup(initialGroup);
|
|
499
|
-
clearBeverage();
|
|
500
|
-
clearBrand();
|
|
501
|
-
break;
|
|
502
|
-
}
|
|
503
|
-
}, [clearBeverage, clearBrand, currentGroup, initialGroup]);
|
|
504
|
-
const home = useCallback(() => {
|
|
505
|
-
const topic = `/kos/dispense/${nozzle == null ? void 0 : nozzle.path}/home/`;
|
|
506
|
-
EventBus.publish(topic, {});
|
|
507
|
-
setCurrentGroup(initialGroup);
|
|
508
|
-
if (initialGroup === DISPENSE_GROUP_BRAND) {
|
|
509
|
-
clearBeverage();
|
|
510
|
-
clearBrand();
|
|
511
|
-
}
|
|
512
|
-
if (initialGroup === DISPENSE_GROUP_BEVERAGE) {
|
|
513
|
-
clearBeverage();
|
|
514
|
-
}
|
|
515
|
-
}, [clearBeverage, clearBrand, initialGroup]);
|
|
391
|
+
const pour = {
|
|
392
|
+
handlers: gesture.dom,
|
|
393
|
+
cancel: () => void kit?.cancelPour(),
|
|
394
|
+
start: async (pourOptions) => await kit?.startPour(pourOptions) ?? false,
|
|
395
|
+
press: async (pourOptions) => await kit?.pressPour(pourOptions) ?? false,
|
|
396
|
+
release: (pourOptions) => kit?.releasePour(pourOptions),
|
|
397
|
+
updatePourContext: (key, value) => kit?.pourContext.set(key, value),
|
|
398
|
+
removeFromPourContext: (key) => kit?.pourContext.remove(key),
|
|
399
|
+
status: nozzle
|
|
400
|
+
};
|
|
516
401
|
const pauseTimers = useCallback(() => {
|
|
517
402
|
if (timersRef.current.length === 0) {
|
|
518
|
-
log$
|
|
403
|
+
log$3.debug("No timers to pause.");
|
|
519
404
|
return;
|
|
520
405
|
}
|
|
521
|
-
log$
|
|
406
|
+
log$3.debug(`Pausing ${timersRef.current.length} timers.`);
|
|
522
407
|
timersRef.current.forEach((timer) => {
|
|
523
|
-
log$
|
|
408
|
+
log$3.debug(`Pausing timer with id ${timer.id}.`);
|
|
524
409
|
timer.pause();
|
|
525
410
|
});
|
|
526
411
|
}, []);
|
|
527
412
|
const restartTimers = useCallback(() => {
|
|
528
413
|
if (timersRef.current.length === 0) {
|
|
529
|
-
log$
|
|
414
|
+
log$3.debug("No timers to restart.");
|
|
530
415
|
return;
|
|
531
416
|
}
|
|
532
|
-
log$
|
|
417
|
+
log$3.debug(`Restarting ${timersRef.current.length} timers.`);
|
|
533
418
|
timersRef.current.forEach((timer) => {
|
|
534
|
-
log$
|
|
419
|
+
log$3.debug(`Restarting timer with id ${timer.id}.`);
|
|
535
420
|
timer.restart();
|
|
536
421
|
});
|
|
537
422
|
}, []);
|
|
@@ -540,11 +425,12 @@ const useCuiKit = ({
|
|
|
540
425
|
return;
|
|
541
426
|
}
|
|
542
427
|
if (timersRef.current.some((t) => t.id === timer.id)) {
|
|
543
|
-
log$
|
|
428
|
+
log$3.debug(`Timer with id ${timer.id} already exists.`);
|
|
544
429
|
return;
|
|
545
430
|
}
|
|
546
431
|
timersRef.current.push(timer);
|
|
547
432
|
}, []);
|
|
433
|
+
const active = ready ? kit : void 0;
|
|
548
434
|
return {
|
|
549
435
|
timers: {
|
|
550
436
|
add: addTimer,
|
|
@@ -552,43 +438,70 @@ const useCuiKit = ({
|
|
|
552
438
|
restart: restartTimers
|
|
553
439
|
},
|
|
554
440
|
nav: {
|
|
555
|
-
currentGroup,
|
|
556
|
-
back,
|
|
557
|
-
home
|
|
441
|
+
currentGroup: active?.currentGroup ?? (steps ? steps.brands ? DISPENSE_GROUP_BRAND : DISPENSE_GROUP_BEVERAGE : initialGroup ?? DISPENSE_GROUP_BRAND),
|
|
442
|
+
back: () => active?.back(),
|
|
443
|
+
home: () => active?.home(),
|
|
444
|
+
steps: active?.enabledSteps,
|
|
445
|
+
canBack: active?.canBack ?? false,
|
|
446
|
+
toPour: (pourOptions) => active?.toPour(pourOptions)
|
|
558
447
|
},
|
|
559
448
|
pour,
|
|
560
449
|
updateOnBeforePour,
|
|
561
450
|
selections: {
|
|
562
|
-
[DISPENSE_GROUP_BRAND]: selectedBrand,
|
|
563
|
-
[DISPENSE_GROUP_BEVERAGE]: selectedBeverage,
|
|
564
|
-
[DISPENSE_GROUP_FLAVOR]: selectedFlavors
|
|
451
|
+
[DISPENSE_GROUP_BRAND]: active?.selectedBrand ?? null,
|
|
452
|
+
[DISPENSE_GROUP_BEVERAGE]: active?.selectedBeverage ?? null,
|
|
453
|
+
[DISPENSE_GROUP_FLAVOR]: active?.selectedFlavors ?? []
|
|
565
454
|
},
|
|
566
455
|
[DISPENSE_GROUP_BRAND]: {
|
|
567
|
-
models: brands,
|
|
568
|
-
companions: brandCompanions,
|
|
569
|
-
clear: clearBrand,
|
|
456
|
+
models: active?.brands ?? [],
|
|
457
|
+
companions: active?.brandCompanions ?? [],
|
|
458
|
+
clear: () => active?.clearBrand(),
|
|
570
459
|
handlers: {
|
|
571
|
-
onSelected:
|
|
460
|
+
onSelected: async (model, context, forceUpdate) => {
|
|
461
|
+
if (forceUpdate) {
|
|
462
|
+
log$3.warn(
|
|
463
|
+
`forceUpdate is not currently supported when setting brand`
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
active?.selectBrand(model, context);
|
|
467
|
+
}
|
|
572
468
|
}
|
|
573
469
|
},
|
|
574
470
|
[DISPENSE_GROUP_BEVERAGE]: {
|
|
575
|
-
models: beverages,
|
|
576
|
-
companions: beverageCompanions,
|
|
577
|
-
clear: clearBeverage,
|
|
471
|
+
models: active?.beverages ?? [],
|
|
472
|
+
companions: active?.beverageCompanions ?? [],
|
|
473
|
+
clear: () => void active?.clearBeverage(),
|
|
578
474
|
handlers: {
|
|
579
|
-
onSelected: selectBeverage
|
|
475
|
+
onSelected: async (model, context, forceUpdate) => active?.selectBeverage(model, context, forceUpdate)
|
|
580
476
|
}
|
|
581
477
|
},
|
|
582
478
|
[DISPENSE_GROUP_FLAVOR]: {
|
|
583
|
-
models: flavors,
|
|
584
|
-
companions: flavorCompanions,
|
|
585
|
-
clear: clearFlavors,
|
|
479
|
+
models: active?.flavors ?? [],
|
|
480
|
+
companions: active?.flavorCompanions ?? [],
|
|
481
|
+
clear: () => void active?.clearFlavors(),
|
|
586
482
|
handlers: {
|
|
587
|
-
onSelected: selectFlavor
|
|
483
|
+
onSelected: async (model, context, forceUpdate) => active?.selectFlavor(model, context, forceUpdate)
|
|
588
484
|
}
|
|
589
485
|
}
|
|
590
486
|
};
|
|
591
487
|
};
|
|
488
|
+
const readKitState = (kit) => [
|
|
489
|
+
kit.currentGroup,
|
|
490
|
+
kit.canBack,
|
|
491
|
+
kit.selectedBrand,
|
|
492
|
+
kit.selectedBeverage,
|
|
493
|
+
...kit.selectedFlavors,
|
|
494
|
+
...kit.brands,
|
|
495
|
+
...kit.beverages,
|
|
496
|
+
...kit.flavors,
|
|
497
|
+
...kit.brandCompanions,
|
|
498
|
+
...kit.beverageCompanions,
|
|
499
|
+
...kit.flavorCompanions
|
|
500
|
+
];
|
|
501
|
+
const log$2 = KosLog.createLogger({
|
|
502
|
+
group: LogGroup.ui,
|
|
503
|
+
name: "use-ambient-attract-timers"
|
|
504
|
+
});
|
|
592
505
|
const useAmbientAttractTimers = (props) => {
|
|
593
506
|
const { model: nozzle } = useNozzleContext();
|
|
594
507
|
const [attractTimer, setAttractTimer] = useState(null);
|
|
@@ -602,66 +515,66 @@ const useAmbientAttractTimers = (props) => {
|
|
|
602
515
|
} = props;
|
|
603
516
|
const handleAmbientTimer = useCallback(() => {
|
|
604
517
|
if (onAmbientTimer) {
|
|
605
|
-
|
|
606
|
-
onAmbientTimer
|
|
518
|
+
log$2.info("Ambient timer expired. Calling callback");
|
|
519
|
+
onAmbientTimer?.();
|
|
607
520
|
}
|
|
608
521
|
}, [onAmbientTimer]);
|
|
609
522
|
const handleAttractTimer = useCallback(() => {
|
|
610
523
|
if (onAttractTimer) {
|
|
611
|
-
|
|
612
|
-
onAttractTimer
|
|
524
|
+
log$2.info("Attract timer expired. Calling callback");
|
|
525
|
+
onAttractTimer?.();
|
|
613
526
|
}
|
|
614
527
|
}, [onAttractTimer]);
|
|
615
528
|
const handleResetAttractTimer = useCallback(() => {
|
|
616
529
|
if (attractTimer) {
|
|
617
530
|
attractTimer.restart();
|
|
618
|
-
onResetAttractTimer
|
|
531
|
+
onResetAttractTimer?.();
|
|
619
532
|
}
|
|
620
533
|
}, [attractTimer, onResetAttractTimer]);
|
|
621
534
|
const handlePauseAttractTimer = useCallback(() => {
|
|
622
535
|
if (attractTimer) {
|
|
623
536
|
attractTimer.reset();
|
|
624
|
-
onResetAttractTimer
|
|
537
|
+
onResetAttractTimer?.();
|
|
625
538
|
}
|
|
626
539
|
}, [attractTimer, onResetAttractTimer]);
|
|
627
540
|
const handleResume = useCallback(() => {
|
|
628
541
|
if (attractTimer) {
|
|
629
542
|
attractTimer.pause();
|
|
630
|
-
onResumeAttractTimer
|
|
543
|
+
onResumeAttractTimer?.();
|
|
631
544
|
}
|
|
632
545
|
}, [attractTimer, onResumeAttractTimer]);
|
|
633
546
|
useEffect(() => {
|
|
634
547
|
if (nozzle && defaultAttractTime) {
|
|
635
|
-
|
|
548
|
+
log$2.info("Nozzle is available. Creating timers");
|
|
636
549
|
const timer = TimerManager.createTimer(
|
|
637
550
|
"attract-timer-" + nozzle.path,
|
|
638
551
|
defaultAttractTime
|
|
639
552
|
);
|
|
640
553
|
if (defaultAttractTime) {
|
|
641
|
-
timer
|
|
554
|
+
timer?.addTimeoutAction({
|
|
642
555
|
name: "attract-timer",
|
|
643
556
|
remainingTime: 0,
|
|
644
557
|
action: handleAttractTimer
|
|
645
558
|
});
|
|
646
559
|
}
|
|
647
560
|
if (defaultAmbientTime) {
|
|
648
|
-
timer
|
|
561
|
+
timer?.addTimeoutAction({
|
|
649
562
|
name: "ambient-timer",
|
|
650
563
|
remainingTime: defaultAmbientTime,
|
|
651
564
|
action: handleAmbientTimer
|
|
652
565
|
});
|
|
653
566
|
}
|
|
654
567
|
if (defaultAttractTime) {
|
|
655
|
-
timer
|
|
568
|
+
timer?.start();
|
|
656
569
|
}
|
|
657
570
|
setAttractTimer(timer ?? null);
|
|
658
571
|
return () => {
|
|
659
|
-
timer
|
|
572
|
+
timer?.reset();
|
|
660
573
|
setAttractTimer(null);
|
|
661
574
|
};
|
|
662
575
|
}
|
|
663
576
|
return () => {
|
|
664
|
-
|
|
577
|
+
log$2.info("Nozzle is not available. No timers to clear");
|
|
665
578
|
};
|
|
666
579
|
}, [
|
|
667
580
|
defaultAmbientTime,
|
|
@@ -742,7 +655,7 @@ const useDispenseLifecycle = ({
|
|
|
742
655
|
}) => {
|
|
743
656
|
const { model: nozzle } = useNozzleContext();
|
|
744
657
|
useEffect(() => {
|
|
745
|
-
const topics = buildDispenseTopics(nozzle
|
|
658
|
+
const topics = buildDispenseTopics(nozzle?.path, {
|
|
746
659
|
onBrandSelected,
|
|
747
660
|
onBrandCleared,
|
|
748
661
|
onBeverageListUpdated,
|
|
@@ -765,10 +678,10 @@ const useDispenseLifecycle = ({
|
|
|
765
678
|
({ topic, callback }) => subscribe(topic, callback)
|
|
766
679
|
);
|
|
767
680
|
return () => {
|
|
768
|
-
disposers.forEach((disposer) => disposer
|
|
681
|
+
disposers.forEach((disposer) => disposer?.());
|
|
769
682
|
};
|
|
770
683
|
}, [
|
|
771
|
-
nozzle
|
|
684
|
+
nozzle?.path,
|
|
772
685
|
onAmbientTimer,
|
|
773
686
|
onAttractTimer,
|
|
774
687
|
onBeverageCleared,
|
|
@@ -788,7 +701,10 @@ const useDispenseLifecycle = ({
|
|
|
788
701
|
onReturnToHome
|
|
789
702
|
]);
|
|
790
703
|
};
|
|
791
|
-
const log$1 = KosLog.createLogger({
|
|
704
|
+
const log$1 = KosLog.createLogger({
|
|
705
|
+
group: LogGroup.ui,
|
|
706
|
+
name: "useCuiKitTimers"
|
|
707
|
+
});
|
|
792
708
|
const useCuiKitTimers = (props) => {
|
|
793
709
|
const { model: nozzle } = useNozzleContext();
|
|
794
710
|
const [idleTimer, setIdleTimer] = useState(null);
|
|
@@ -802,9 +718,9 @@ const useCuiKitTimers = (props) => {
|
|
|
802
718
|
const hasAreYouThereFiredRef = useRef(false);
|
|
803
719
|
const handleAreYouThereTimer = useCallback(() => {
|
|
804
720
|
if (!hasAreYouThereFiredRef.current && onAreYouThereTimer) {
|
|
805
|
-
|
|
721
|
+
log$1.info("Are you there timer expired. Calling callback");
|
|
806
722
|
hasAreYouThereFiredRef.current = true;
|
|
807
|
-
onAreYouThereTimer
|
|
723
|
+
onAreYouThereTimer?.();
|
|
808
724
|
}
|
|
809
725
|
}, [onAreYouThereTimer]);
|
|
810
726
|
const handleIdleTimer = useCallback(() => {
|
|
@@ -814,7 +730,7 @@ const useCuiKitTimers = (props) => {
|
|
|
814
730
|
);
|
|
815
731
|
if (onIdleTimer) {
|
|
816
732
|
log$1.debug("Idle timer expired. Calling callback");
|
|
817
|
-
onIdleTimer
|
|
733
|
+
onIdleTimer?.();
|
|
818
734
|
} else {
|
|
819
735
|
log$1.debug("No onIdleTimer callback provided!");
|
|
820
736
|
}
|
|
@@ -824,7 +740,7 @@ const useCuiKitTimers = (props) => {
|
|
|
824
740
|
if (idleTimer) {
|
|
825
741
|
idleTimer.restart();
|
|
826
742
|
hasAreYouThereFiredRef.current = false;
|
|
827
|
-
onResetIdleTimer
|
|
743
|
+
onResetIdleTimer?.();
|
|
828
744
|
}
|
|
829
745
|
}, [idleTimer, onResetIdleTimer, props.prefix]);
|
|
830
746
|
const handlePauseIdleTimer = useCallback(() => {
|
|
@@ -832,12 +748,12 @@ const useCuiKitTimers = (props) => {
|
|
|
832
748
|
if (idleTimer) {
|
|
833
749
|
idleTimer.reset();
|
|
834
750
|
hasAreYouThereFiredRef.current = false;
|
|
835
|
-
onResetIdleTimer
|
|
751
|
+
onResetIdleTimer?.();
|
|
836
752
|
}
|
|
837
753
|
}, [idleTimer, onResetIdleTimer, props.prefix]);
|
|
838
754
|
useEffect(() => {
|
|
839
755
|
log$1.debug(
|
|
840
|
-
`useCuiKitTimers effect triggered - nozzle: ${!!nozzle}, path: ${nozzle
|
|
756
|
+
`useCuiKitTimers effect triggered - nozzle: ${!!nozzle}, path: ${nozzle?.path}, callbacks: handleIdle=${!!handleIdleTimer}, handleAreYouThere=${!!handleAreYouThereTimer}`
|
|
841
757
|
);
|
|
842
758
|
if (nozzle) {
|
|
843
759
|
log$1.info("Nozzle is available. Creating timers");
|
|
@@ -849,19 +765,19 @@ const useCuiKitTimers = (props) => {
|
|
|
849
765
|
`Adding idle timer action for ${props.prefix ?? ""}idle-timer-${nozzle.path} with callback:`,
|
|
850
766
|
!!handleIdleTimer
|
|
851
767
|
);
|
|
852
|
-
timer
|
|
768
|
+
timer?.addTimeoutAction({
|
|
853
769
|
name: "idle-timer",
|
|
854
770
|
remainingTime: 0,
|
|
855
771
|
action: handleIdleTimer
|
|
856
772
|
});
|
|
857
|
-
timer
|
|
773
|
+
timer?.addTimeoutAction({
|
|
858
774
|
name: "are-you-there-timer",
|
|
859
775
|
remainingTime: defaultAreYouThereTime,
|
|
860
776
|
action: handleAreYouThereTimer
|
|
861
777
|
});
|
|
862
778
|
setIdleTimer(timer ?? null);
|
|
863
779
|
return () => {
|
|
864
|
-
timer
|
|
780
|
+
timer?.reset();
|
|
865
781
|
setIdleTimer(null);
|
|
866
782
|
};
|
|
867
783
|
}
|
|
@@ -882,7 +798,10 @@ const useCuiKitTimers = (props) => {
|
|
|
882
798
|
pause: handlePauseIdleTimer
|
|
883
799
|
};
|
|
884
800
|
};
|
|
885
|
-
const log = KosLog.createLogger({
|
|
801
|
+
const log = KosLog.createLogger({
|
|
802
|
+
group: LogGroup.ui,
|
|
803
|
+
name: "useDefaultCuiKitLifecycle"
|
|
804
|
+
});
|
|
886
805
|
const useDefaultCuiKitLifecycle = ({
|
|
887
806
|
kit,
|
|
888
807
|
inactivity,
|
|
@@ -891,26 +810,25 @@ const useDefaultCuiKitLifecycle = ({
|
|
|
891
810
|
onBeforeAreYouThereTimer,
|
|
892
811
|
areYouThereRejectionPolicy = "pause"
|
|
893
812
|
}) => {
|
|
894
|
-
var _a, _b, _c, _d;
|
|
895
813
|
const [showAmbientScreen, setShowAmbientScreen] = useState(false);
|
|
896
814
|
const [showAttractScreen, setShowAttractScreen] = useState(false);
|
|
897
815
|
const { model: nozzle } = useNozzleContext();
|
|
898
816
|
const [hasPoured, setHasPoured] = useState(false);
|
|
899
|
-
const idleTimeout =
|
|
900
|
-
const areYouThereTimeout =
|
|
901
|
-
const idlePourTimeout =
|
|
902
|
-
const areYouTherePourTimeout =
|
|
903
|
-
const ambientTimeout = screens
|
|
904
|
-
const attractTimeout = screens
|
|
817
|
+
const idleTimeout = inactivity?.idleTimeout ?? 15;
|
|
818
|
+
const areYouThereTimeout = inactivity?.areYouThereTimeoutOffset ?? 10;
|
|
819
|
+
const idlePourTimeout = pour?.idleTimeout ?? inactivity?.idleTimeout ?? 10;
|
|
820
|
+
const areYouTherePourTimeout = pour?.areYouThereTimeoutOffset ?? inactivity?.areYouThereTimeoutOffset ?? 5;
|
|
821
|
+
const ambientTimeout = screens?.ambientTimeoutOffset;
|
|
822
|
+
const attractTimeout = screens?.attractTimeout;
|
|
905
823
|
const handleIdleTimeout = useCallback(() => {
|
|
906
824
|
log.info("handleIdleTimeout called - navigating home and publishing event");
|
|
907
825
|
setShowAreYouThere(false);
|
|
908
|
-
kit
|
|
826
|
+
kit?.nav.home();
|
|
909
827
|
if (nozzle) {
|
|
910
828
|
const topic = `/kos/dispense/${nozzle.path}/idle/timeout/`;
|
|
911
829
|
EventBus.publish(topic, {});
|
|
912
830
|
}
|
|
913
|
-
}, [
|
|
831
|
+
}, [kit?.nav?.home, nozzle]);
|
|
914
832
|
const handleResetIdleTimer = useCallback(() => {
|
|
915
833
|
log.info("handleResetIdleTimer called - resetting idle timer");
|
|
916
834
|
setShowAreYouThere(false);
|
|
@@ -939,13 +857,13 @@ const useDefaultCuiKitLifecycle = ({
|
|
|
939
857
|
if (attractTimeout) {
|
|
940
858
|
setShowAttractScreen(false);
|
|
941
859
|
setShowAmbientScreen(false);
|
|
942
|
-
kit
|
|
860
|
+
kit?.nav.home();
|
|
943
861
|
if (nozzle) {
|
|
944
862
|
const topic = `/kos/dispense/${nozzle.path}/attract/resume/`;
|
|
945
863
|
EventBus.publish(topic, {});
|
|
946
864
|
}
|
|
947
865
|
}
|
|
948
|
-
}, [kit
|
|
866
|
+
}, [kit?.nav, attractTimeout, nozzle]);
|
|
949
867
|
const {
|
|
950
868
|
pause: ambientPause,
|
|
951
869
|
restart: ambientRestart,
|
|
@@ -957,7 +875,7 @@ const useDefaultCuiKitLifecycle = ({
|
|
|
957
875
|
onAttractTimer: handleAttractTimer,
|
|
958
876
|
onResumeAttractTimer: handleAttractResume
|
|
959
877
|
});
|
|
960
|
-
|
|
878
|
+
kit?.timers?.add(attractTimer);
|
|
961
879
|
const [showAreYouThere, setShowAreYouThere] = useState(false);
|
|
962
880
|
log.info(
|
|
963
881
|
"Creating idle timer with timeout:",
|
|
@@ -1053,8 +971,8 @@ const useDefaultCuiKitLifecycle = ({
|
|
|
1053
971
|
});
|
|
1054
972
|
}
|
|
1055
973
|
}, [pourIdleTimer, areYouTherePourTimeout, handleAreYouThereTimer]);
|
|
1056
|
-
|
|
1057
|
-
|
|
974
|
+
kit?.timers?.add(idleTimer);
|
|
975
|
+
kit?.timers?.add(pourIdleTimer);
|
|
1058
976
|
const handlePour = useCallback(() => {
|
|
1059
977
|
setHasPoured(false);
|
|
1060
978
|
pausePourTimer();
|
|
@@ -1117,15 +1035,13 @@ const useDefaultCuiKitLifecycle = ({
|
|
|
1117
1035
|
onPourCancel: handlePourCancel,
|
|
1118
1036
|
onBeforePourRejected: handleBeforePourRejected,
|
|
1119
1037
|
onInit: handleInit
|
|
1120
|
-
//
|
|
1121
|
-
//
|
|
1122
|
-
// component's own timer hooks call those handlers directly. Including them would
|
|
1123
|
-
// create circular event loops.
|
|
1038
|
+
// The timer handlers are left out because this hook's own timers call them directly;
|
|
1039
|
+
// subscribing to their events as well would create an event loop.
|
|
1124
1040
|
});
|
|
1125
1041
|
const areYouThereCountdown = hasPoured ? areYouTherePourTimeout : areYouThereTimeout;
|
|
1126
1042
|
useEffect(() => {
|
|
1127
1043
|
if (nozzle && attractTimer) {
|
|
1128
|
-
const topic = `/kos/dispense/${nozzle
|
|
1044
|
+
const topic = `/kos/dispense/${nozzle?.path}/init/`;
|
|
1129
1045
|
EventBus.publish(topic, {});
|
|
1130
1046
|
}
|
|
1131
1047
|
}, [nozzle, attractTimer]);
|
|
@@ -1141,6 +1057,59 @@ const useDefaultCuiKitLifecycle = ({
|
|
|
1141
1057
|
restartScreenTimer: ambientRestart
|
|
1142
1058
|
};
|
|
1143
1059
|
};
|
|
1060
|
+
const useFlavors = ({
|
|
1061
|
+
onFlavorSelected,
|
|
1062
|
+
onFlavorCleared,
|
|
1063
|
+
companionType
|
|
1064
|
+
}) => {
|
|
1065
|
+
const { model: nozzle } = useNozzleContext();
|
|
1066
|
+
const flavors = useMemo(
|
|
1067
|
+
() => nozzle?.getGroupAvailabilityItems("flavors").filter((f) => f.visible) ?? [],
|
|
1068
|
+
[nozzle]
|
|
1069
|
+
);
|
|
1070
|
+
const companions = useMemo(() => {
|
|
1071
|
+
if (!companionType) return [];
|
|
1072
|
+
return flavors.map(
|
|
1073
|
+
(flavor) => getKosCompanionModel(flavor, companionType)
|
|
1074
|
+
);
|
|
1075
|
+
}, [flavors, companionType]);
|
|
1076
|
+
const [selectedFlavors, setSelectedFlavors] = useState([]);
|
|
1077
|
+
const selectFlavor = useCallback(
|
|
1078
|
+
async (flavor, context, forceUpdate) => {
|
|
1079
|
+
setSelectedFlavors(
|
|
1080
|
+
(previous) => previous?.includes(flavor) ? [...previous.filter((p) => p !== flavor)] : [...previous ?? [], flavor]
|
|
1081
|
+
);
|
|
1082
|
+
if (nozzle?.selectedPourable) {
|
|
1083
|
+
const { beverage } = nozzle.selectedPourable;
|
|
1084
|
+
await nozzle.setSelectedPourable(
|
|
1085
|
+
{
|
|
1086
|
+
beverage,
|
|
1087
|
+
additional: selectedFlavors ?? [],
|
|
1088
|
+
context
|
|
1089
|
+
},
|
|
1090
|
+
forceUpdate
|
|
1091
|
+
);
|
|
1092
|
+
}
|
|
1093
|
+
onFlavorSelected?.(flavor, selectedFlavors ?? []);
|
|
1094
|
+
},
|
|
1095
|
+
[nozzle, onFlavorSelected, selectedFlavors]
|
|
1096
|
+
);
|
|
1097
|
+
const clear = useCallback(async () => {
|
|
1098
|
+
setSelectedFlavors([]);
|
|
1099
|
+
if (nozzle?.selectedPourable) {
|
|
1100
|
+
const { beverage } = nozzle.selectedPourable;
|
|
1101
|
+
nozzle.setSelectedPourable({ beverage });
|
|
1102
|
+
onFlavorCleared?.();
|
|
1103
|
+
}
|
|
1104
|
+
}, [nozzle, onFlavorCleared]);
|
|
1105
|
+
return {
|
|
1106
|
+
flavors,
|
|
1107
|
+
flavorCompanions: companions,
|
|
1108
|
+
selectFlavor,
|
|
1109
|
+
selectedFlavors,
|
|
1110
|
+
clearFlavors: clear
|
|
1111
|
+
};
|
|
1112
|
+
};
|
|
1144
1113
|
const useDeviceAssembly = () => {
|
|
1145
1114
|
const modelId = DeviceAssembly.type;
|
|
1146
1115
|
const result = useKosModel({
|
|
@@ -1195,31 +1164,9 @@ const useIngredient = () => {
|
|
|
1195
1164
|
});
|
|
1196
1165
|
return result;
|
|
1197
1166
|
};
|
|
1198
|
-
const logger$
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
});
|
|
1202
|
-
const HoldToPourIntentStrategy = {
|
|
1203
|
-
name: "HoldToPourIntentStrategy",
|
|
1204
|
-
async initiate(model, intent) {
|
|
1205
|
-
if (!(model == null ? void 0 : model.canPour)) {
|
|
1206
|
-
logger$5.debug(`${model == null ? void 0 : model.id} cannot pour. Returning early.`);
|
|
1207
|
-
return;
|
|
1208
|
-
}
|
|
1209
|
-
if (intent) {
|
|
1210
|
-
logger$5.debug(`performing intent: ${intent}`);
|
|
1211
|
-
await (model == null ? void 0 : model.performIntent(intent));
|
|
1212
|
-
} else {
|
|
1213
|
-
logger$5.debug("no intent provided. Returning early.");
|
|
1214
|
-
}
|
|
1215
|
-
},
|
|
1216
|
-
async initiateEnded(nozzle) {
|
|
1217
|
-
await (nozzle == null ? void 0 : nozzle.cancelPour());
|
|
1218
|
-
}
|
|
1219
|
-
};
|
|
1220
|
-
const logger$4 = KosLog.createLogger({
|
|
1221
|
-
name: "useNozzlePour",
|
|
1222
|
-
group: "kos-hooks"
|
|
1167
|
+
const logger$2 = KosLog.createLogger({
|
|
1168
|
+
group: LogGroup.ui,
|
|
1169
|
+
name: "useNozzlePour"
|
|
1223
1170
|
});
|
|
1224
1171
|
const useIngredientPour = ({
|
|
1225
1172
|
onPour,
|
|
@@ -1228,24 +1175,23 @@ const useIngredientPour = ({
|
|
|
1228
1175
|
strategy = HoldToPourIntentStrategy
|
|
1229
1176
|
}) => {
|
|
1230
1177
|
const handlePour = useCallback(() => {
|
|
1231
|
-
logger$
|
|
1232
|
-
`[${strategy
|
|
1178
|
+
logger$2.debug(
|
|
1179
|
+
`[${strategy?.name}] - Pour initiated for model ${intentContainer?.id}.`
|
|
1233
1180
|
);
|
|
1234
|
-
strategy
|
|
1235
|
-
onPour
|
|
1181
|
+
strategy?.initiate(intentContainer);
|
|
1182
|
+
onPour?.();
|
|
1236
1183
|
}, [onPour, intentContainer, strategy]);
|
|
1237
1184
|
const handleCancelPour = useCallback(() => {
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
`[${strategy == null ? void 0 : strategy.name}] - Pour initiate ended called for nozzle ${intentContainer == null ? void 0 : intentContainer.id}.`
|
|
1185
|
+
logger$2.debug(
|
|
1186
|
+
`[${strategy?.name}] - Pour initiate ended called for nozzle ${intentContainer?.id}.`
|
|
1241
1187
|
);
|
|
1242
|
-
|
|
1243
|
-
onPourCancel
|
|
1188
|
+
strategy?.initiateEnded?.(intentContainer);
|
|
1189
|
+
onPourCancel?.();
|
|
1244
1190
|
}, [onPourCancel, intentContainer, strategy]);
|
|
1245
1191
|
const forceCancelPour = useCallback(() => {
|
|
1246
|
-
logger$
|
|
1247
|
-
intentContainer
|
|
1248
|
-
onPourCancel
|
|
1192
|
+
logger$2.debug(`Force cancelling pour for nozzle ${intentContainer?.id}.`);
|
|
1193
|
+
intentContainer?.cancelPour();
|
|
1194
|
+
onPourCancel?.();
|
|
1249
1195
|
}, [onPourCancel, intentContainer]);
|
|
1250
1196
|
const handlers = usePressGesture({
|
|
1251
1197
|
onPressed: handlePour,
|
|
@@ -1284,10 +1230,82 @@ function withNozzle(path, WrappedComponent) {
|
|
|
1284
1230
|
return /* @__PURE__ */ jsx(KosModelLoader, { ...status, children: /* @__PURE__ */ jsx(WrappedComponent, { ...props, nozzle: model }) });
|
|
1285
1231
|
};
|
|
1286
1232
|
}
|
|
1287
|
-
const logger$
|
|
1288
|
-
|
|
1289
|
-
|
|
1233
|
+
const logger$1 = KosLog.createLogger({
|
|
1234
|
+
group: LogGroup.ui,
|
|
1235
|
+
name: "useNozzlePour"
|
|
1290
1236
|
});
|
|
1237
|
+
const useNozzlePour = ({
|
|
1238
|
+
onPour,
|
|
1239
|
+
onPourCancel,
|
|
1240
|
+
onBeforePour,
|
|
1241
|
+
onBeforePourRejected,
|
|
1242
|
+
pourContext,
|
|
1243
|
+
strategy = HoldToPourStrategy
|
|
1244
|
+
}) => {
|
|
1245
|
+
const { model: nozzle } = useNozzleContext();
|
|
1246
|
+
const [context, _setContext] = useState(
|
|
1247
|
+
pourContext || new PourContext()
|
|
1248
|
+
);
|
|
1249
|
+
const handlePour = useCallback(async () => {
|
|
1250
|
+
const canPour = onBeforePour ? await onBeforePour?.(context) : true;
|
|
1251
|
+
if (canPour) {
|
|
1252
|
+
logger$1.debug(
|
|
1253
|
+
`[${strategy?.name}] - Pour initiated for nozzle ${nozzle?.id}.`
|
|
1254
|
+
);
|
|
1255
|
+
strategy?.initiate(nozzle);
|
|
1256
|
+
onPour?.();
|
|
1257
|
+
} else {
|
|
1258
|
+
logger$1.debug(
|
|
1259
|
+
`[${strategy?.name}] - Did not pass onBeforePour gate for nozzle ${nozzle?.id}. Cancelling pour.`
|
|
1260
|
+
);
|
|
1261
|
+
onBeforePourRejected?.();
|
|
1262
|
+
}
|
|
1263
|
+
}, [
|
|
1264
|
+
onPour,
|
|
1265
|
+
nozzle,
|
|
1266
|
+
strategy,
|
|
1267
|
+
onBeforePour,
|
|
1268
|
+
onPourCancel,
|
|
1269
|
+
context,
|
|
1270
|
+
onBeforePourRejected
|
|
1271
|
+
]);
|
|
1272
|
+
const handleCancelPour = useCallback(() => {
|
|
1273
|
+
logger$1.debug(
|
|
1274
|
+
`[${strategy?.name}] - Pour initiate ended called for nozzle ${nozzle?.id}.`
|
|
1275
|
+
);
|
|
1276
|
+
strategy?.initiateEnded?.(nozzle);
|
|
1277
|
+
onPourCancel?.();
|
|
1278
|
+
}, [onPourCancel, nozzle, strategy]);
|
|
1279
|
+
const forceCancelPour = useCallback(() => {
|
|
1280
|
+
logger$1.debug(`Force cancelling pour for nozzle ${nozzle?.id}.`);
|
|
1281
|
+
nozzle?.cancelPour();
|
|
1282
|
+
onPourCancel?.();
|
|
1283
|
+
}, [onPourCancel, nozzle]);
|
|
1284
|
+
const handleUpdateContext = useCallback(
|
|
1285
|
+
(key, value) => {
|
|
1286
|
+
context.set(key, value);
|
|
1287
|
+
},
|
|
1288
|
+
[context]
|
|
1289
|
+
);
|
|
1290
|
+
const handleRemoveFromContext = useCallback(
|
|
1291
|
+
(key) => {
|
|
1292
|
+
context.remove(key);
|
|
1293
|
+
},
|
|
1294
|
+
[context]
|
|
1295
|
+
);
|
|
1296
|
+
const handlers = usePressGesture({
|
|
1297
|
+
onPressed: handlePour,
|
|
1298
|
+
onRelease: handleCancelPour
|
|
1299
|
+
});
|
|
1300
|
+
return {
|
|
1301
|
+
handlers: handlers.dom,
|
|
1302
|
+
cancel: forceCancelPour,
|
|
1303
|
+
updatePourContext: handleUpdateContext,
|
|
1304
|
+
removeFromPourContext: handleRemoveFromContext,
|
|
1305
|
+
status: nozzle
|
|
1306
|
+
};
|
|
1307
|
+
};
|
|
1308
|
+
const logger = KosLog.createLogger({ group: LogGroup.ui, name: "usePour" });
|
|
1291
1309
|
const usePourTarget = ({
|
|
1292
1310
|
onBeforePour,
|
|
1293
1311
|
onPour,
|
|
@@ -1301,40 +1319,39 @@ const usePourTarget = ({
|
|
|
1301
1319
|
pourContext || new PourContext()
|
|
1302
1320
|
);
|
|
1303
1321
|
const handlePour = useCallback(async () => {
|
|
1304
|
-
logger
|
|
1305
|
-
`[${strategy
|
|
1322
|
+
logger.debug(
|
|
1323
|
+
`[${strategy?.name}] - calling before pour for pour target ${pourTarget?.id}.`
|
|
1306
1324
|
);
|
|
1307
|
-
const canPour = onBeforePour ? await
|
|
1325
|
+
const canPour = onBeforePour ? await onBeforePour?.(context) : true;
|
|
1308
1326
|
if (canPour) {
|
|
1309
|
-
logger
|
|
1310
|
-
`[${strategy
|
|
1327
|
+
logger.debug(
|
|
1328
|
+
`[${strategy?.name}] - Pour initiated for pour target ${pourTarget?.id}.`
|
|
1311
1329
|
);
|
|
1312
|
-
await
|
|
1313
|
-
onPour
|
|
1314
|
-
if (!
|
|
1315
|
-
onPourAbort
|
|
1330
|
+
await strategy?.initiate(pourTarget);
|
|
1331
|
+
onPour?.();
|
|
1332
|
+
if (!pourTarget?.isPouring) {
|
|
1333
|
+
onPourAbort?.();
|
|
1316
1334
|
}
|
|
1317
1335
|
} else {
|
|
1318
|
-
logger
|
|
1319
|
-
`[${strategy
|
|
1336
|
+
logger.debug(
|
|
1337
|
+
`[${strategy?.name}] - Pour cancelled for pour target ${pourTarget?.id}.`
|
|
1320
1338
|
);
|
|
1321
|
-
onPourCancel
|
|
1339
|
+
onPourCancel?.();
|
|
1322
1340
|
}
|
|
1323
1341
|
}, [onPour, onBeforePour, onPourAbort, pourTarget, strategy, context]);
|
|
1324
1342
|
const handleCancelPour = useCallback(async () => {
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
`[${strategy == null ? void 0 : strategy.name}] - Pour initiate ended called for pour target ${pourTarget == null ? void 0 : pourTarget.id}.`
|
|
1343
|
+
logger.debug(
|
|
1344
|
+
`[${strategy?.name}] - Pour initiate ended called for pour target ${pourTarget?.id}.`
|
|
1328
1345
|
);
|
|
1329
|
-
const ignore = await
|
|
1346
|
+
const ignore = await strategy?.initiateEnded?.(pourTarget);
|
|
1330
1347
|
if (!ignore) {
|
|
1331
|
-
onPourCancel
|
|
1348
|
+
onPourCancel?.();
|
|
1332
1349
|
}
|
|
1333
1350
|
}, [onPourCancel, pourTarget, strategy]);
|
|
1334
1351
|
const forceCancelPour = useCallback(async () => {
|
|
1335
|
-
logger
|
|
1336
|
-
await
|
|
1337
|
-
onPourCancel
|
|
1352
|
+
logger.debug(`Force cancelling pour for pour target ${pourTarget?.id}.`);
|
|
1353
|
+
await pourTarget?.cancelPour();
|
|
1354
|
+
onPourCancel?.();
|
|
1338
1355
|
}, [onPourCancel, pourTarget]);
|
|
1339
1356
|
const handleUpdateContext = useCallback(
|
|
1340
1357
|
(key, value) => {
|
|
@@ -1360,99 +1377,6 @@ const usePourTarget = ({
|
|
|
1360
1377
|
status: pourTarget
|
|
1361
1378
|
};
|
|
1362
1379
|
};
|
|
1363
|
-
const logger$2 = KosLog.createLogger({
|
|
1364
|
-
name: "TapOrHoldIntentStrategy",
|
|
1365
|
-
group: "kos-hooks"
|
|
1366
|
-
});
|
|
1367
|
-
class TapOrHoldIntentStrategy {
|
|
1368
|
-
constructor(intent) {
|
|
1369
|
-
__publicField(this, "intent");
|
|
1370
|
-
__publicField(this, "name", "TapOrHoldIntentStrategy");
|
|
1371
|
-
__publicField(this, "isHold", false);
|
|
1372
|
-
__publicField(this, "disposer", null);
|
|
1373
|
-
this.intent = intent;
|
|
1374
|
-
}
|
|
1375
|
-
async initiate(model, intent) {
|
|
1376
|
-
this.disposer = setTimeout(() => {
|
|
1377
|
-
this.isHold = true;
|
|
1378
|
-
}, 250);
|
|
1379
|
-
if ((model == null ? void 0 : model.isPouring) && !this.isHold) {
|
|
1380
|
-
logger$2.debug(`additional tap detected. cancelling pour`);
|
|
1381
|
-
await model.cancelPour();
|
|
1382
|
-
return;
|
|
1383
|
-
}
|
|
1384
|
-
if (!(model == null ? void 0 : model.canPour)) {
|
|
1385
|
-
logger$2.debug(`${model == null ? void 0 : model.id} cannot pour. Returning early.`);
|
|
1386
|
-
return;
|
|
1387
|
-
}
|
|
1388
|
-
if (intent) {
|
|
1389
|
-
logger$2.debug(`performing intent: ${intent}`);
|
|
1390
|
-
await (model == null ? void 0 : model.performIntent(intent));
|
|
1391
|
-
} else {
|
|
1392
|
-
logger$2.debug("no intent provided. Returning early.");
|
|
1393
|
-
}
|
|
1394
|
-
}
|
|
1395
|
-
async initiateEnded(nozzle) {
|
|
1396
|
-
if (this.disposer)
|
|
1397
|
-
clearTimeout(this.disposer);
|
|
1398
|
-
this.disposer = null;
|
|
1399
|
-
if (!this.isHold) {
|
|
1400
|
-
logger$2.debug("Tap detected. don't cancel and return.");
|
|
1401
|
-
return true;
|
|
1402
|
-
}
|
|
1403
|
-
await (nozzle == null ? void 0 : nozzle.cancelPour());
|
|
1404
|
-
return false;
|
|
1405
|
-
}
|
|
1406
|
-
}
|
|
1407
|
-
const logger$1 = KosLog.createLogger({
|
|
1408
|
-
name: "TapToPourIntentStrategy",
|
|
1409
|
-
group: "kos-hooks"
|
|
1410
|
-
});
|
|
1411
|
-
const TapToPourIntentStrategy = {
|
|
1412
|
-
name: "TapToPourIntentStrategy",
|
|
1413
|
-
async initiate(model, intent) {
|
|
1414
|
-
if (model == null ? void 0 : model.isPouring) {
|
|
1415
|
-
logger$1.debug(`Nozzle ${model == null ? void 0 : model.id} is already pouring. cancelling pour`);
|
|
1416
|
-
await model.cancelPour();
|
|
1417
|
-
return;
|
|
1418
|
-
}
|
|
1419
|
-
if (!(model == null ? void 0 : model.canPour)) {
|
|
1420
|
-
logger$1.debug(`Nozzle ${model == null ? void 0 : model.id} cannot pour. Returning early.`);
|
|
1421
|
-
return;
|
|
1422
|
-
}
|
|
1423
|
-
if (intent) {
|
|
1424
|
-
logger$1.debug(`performing intent: ${intent}`);
|
|
1425
|
-
await (model == null ? void 0 : model.performIntent(intent));
|
|
1426
|
-
} else {
|
|
1427
|
-
logger$1.debug("no intent provided. Returning early.");
|
|
1428
|
-
}
|
|
1429
|
-
},
|
|
1430
|
-
async initiateEnded(_nozzle) {
|
|
1431
|
-
return true;
|
|
1432
|
-
}
|
|
1433
|
-
};
|
|
1434
|
-
const logger = KosLog.createLogger({
|
|
1435
|
-
name: "HoldToPourStrategy",
|
|
1436
|
-
group: "kos-hooks"
|
|
1437
|
-
});
|
|
1438
|
-
const TapToPourStrategy = {
|
|
1439
|
-
name: "TapToPourStrategy",
|
|
1440
|
-
async initiate(nozzle) {
|
|
1441
|
-
if (nozzle == null ? void 0 : nozzle.isPouring) {
|
|
1442
|
-
logger.debug(`Nozzle ${nozzle == null ? void 0 : nozzle.id} is already pouring. cancelling pour`);
|
|
1443
|
-
await nozzle.cancelPour();
|
|
1444
|
-
return;
|
|
1445
|
-
}
|
|
1446
|
-
if (!(nozzle == null ? void 0 : nozzle.canPour)) {
|
|
1447
|
-
logger.debug(`Nozzle ${nozzle == null ? void 0 : nozzle.id} cannot pour. Returning early.`);
|
|
1448
|
-
return;
|
|
1449
|
-
}
|
|
1450
|
-
await (nozzle == null ? void 0 : nozzle.pour());
|
|
1451
|
-
},
|
|
1452
|
-
async initiateEnded(_nozzle) {
|
|
1453
|
-
return true;
|
|
1454
|
-
}
|
|
1455
|
-
};
|
|
1456
1380
|
const useGenericPour = (id, servicePathFactory, itemId, data) => {
|
|
1457
1381
|
const modelId = id;
|
|
1458
1382
|
const result = useKosModel({
|
|
@@ -1590,7 +1514,19 @@ function createDispenseKitContext() {
|
|
|
1590
1514
|
}
|
|
1591
1515
|
return ctx;
|
|
1592
1516
|
};
|
|
1593
|
-
|
|
1517
|
+
const useCuiPour = (options = {}) => {
|
|
1518
|
+
const kit = useContext(CuiKitContext);
|
|
1519
|
+
const gesture = usePressGesture({
|
|
1520
|
+
onPressed: () => void kit?.pour.press(options),
|
|
1521
|
+
onRelease: () => kit?.pour.release(options)
|
|
1522
|
+
});
|
|
1523
|
+
return {
|
|
1524
|
+
handlers: gesture.dom,
|
|
1525
|
+
start: async () => await kit?.pour.start(options) ?? false,
|
|
1526
|
+
cancel: () => kit?.pour.cancel()
|
|
1527
|
+
};
|
|
1528
|
+
};
|
|
1529
|
+
return [useCuiKitContext, CuiKitContext.Provider, useCuiPour];
|
|
1594
1530
|
}
|
|
1595
1531
|
function CuiKitWrapper({
|
|
1596
1532
|
children,
|
|
@@ -1607,8 +1543,8 @@ function DispenseView({
|
|
|
1607
1543
|
props
|
|
1608
1544
|
}) {
|
|
1609
1545
|
const { nozzlePaths } = useDeviceAssemblyContext();
|
|
1610
|
-
const totalNozzles =
|
|
1611
|
-
const nozzles =
|
|
1546
|
+
const totalNozzles = nozzlePaths?.length || 0;
|
|
1547
|
+
const nozzles = nozzlePaths?.map((path, index) => /* @__PURE__ */ jsx(NozzleProvider, { path, children: /* @__PURE__ */ jsx(
|
|
1612
1548
|
CuiKitWrapper,
|
|
1613
1549
|
{
|
|
1614
1550
|
provider,
|
|
@@ -1622,7 +1558,7 @@ function DispenseView({
|
|
|
1622
1558
|
},
|
|
1623
1559
|
children
|
|
1624
1560
|
}
|
|
1625
|
-
) }, path))
|
|
1561
|
+
) }, path)) || [];
|
|
1626
1562
|
return nozzles;
|
|
1627
1563
|
}
|
|
1628
1564
|
function CuiKit({
|
|
@@ -1639,10 +1575,11 @@ function CuiKit({
|
|
|
1639
1575
|
) }) : null;
|
|
1640
1576
|
}
|
|
1641
1577
|
function initializeCuiKit(props) {
|
|
1642
|
-
const [useCuiKitContext, DispenseKitProvider] = createDispenseKitContext();
|
|
1578
|
+
const [useCuiKitContext, DispenseKitProvider, useCuiPour] = createDispenseKitContext();
|
|
1643
1579
|
return [
|
|
1644
1580
|
useCuiKitContext,
|
|
1645
|
-
CuiKit({ provider: DispenseKitProvider, props })
|
|
1581
|
+
CuiKit({ provider: DispenseKitProvider, props }),
|
|
1582
|
+
useCuiPour
|
|
1646
1583
|
];
|
|
1647
1584
|
}
|
|
1648
1585
|
const Holder = createContext(void 0);
|
|
@@ -1755,71 +1692,70 @@ const usePumpContext = () => {
|
|
|
1755
1692
|
return context;
|
|
1756
1693
|
};
|
|
1757
1694
|
export {
|
|
1758
|
-
|
|
1695
|
+
usePumpContext as $,
|
|
1759
1696
|
AssemblyProvider as A,
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1697
|
+
BoardContainerProvider as B,
|
|
1698
|
+
CuiKit as C,
|
|
1699
|
+
DISPENSE_GROUP_BEVERAGE as D,
|
|
1700
|
+
useDeviceAssembly as E,
|
|
1701
|
+
useDeviceAssemblyContext as F,
|
|
1702
|
+
useDispenseLifecycle as G,
|
|
1703
|
+
HoldToPourIntentStrategy as H,
|
|
1704
|
+
IngredientContainerProvider as I,
|
|
1705
|
+
useFlavors as J,
|
|
1706
|
+
useGenericPour as K,
|
|
1707
|
+
useHolder as L,
|
|
1708
|
+
useHolderContainer as M,
|
|
1772
1709
|
NozzleProvider as N,
|
|
1773
|
-
|
|
1710
|
+
useHolderContainerContext as O,
|
|
1774
1711
|
PumpProvider as P,
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1712
|
+
useHolderContext as Q,
|
|
1713
|
+
useIngredient as R,
|
|
1714
|
+
useIngredientContainer as S,
|
|
1715
|
+
TapOrHoldIntentStrategy as T,
|
|
1716
|
+
useIngredientContainerContext as U,
|
|
1717
|
+
useIngredientContext as V,
|
|
1718
|
+
useIngredientPour as W,
|
|
1719
|
+
useNozzle as X,
|
|
1720
|
+
useNozzleContext as Y,
|
|
1721
|
+
useNozzlePour as Z,
|
|
1722
|
+
usePourTarget as _,
|
|
1786
1723
|
AvailabilityProvider as a,
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
useBeverages as z
|
|
1724
|
+
withAssembly as a0,
|
|
1725
|
+
withBeverage as a1,
|
|
1726
|
+
withBoard as a2,
|
|
1727
|
+
withBoardContainer as a3,
|
|
1728
|
+
withDeviceAssembly as a4,
|
|
1729
|
+
withGenericPour as a5,
|
|
1730
|
+
withHolder as a6,
|
|
1731
|
+
withHolderContainer as a7,
|
|
1732
|
+
withIngredient as a8,
|
|
1733
|
+
withIngredientContainer as a9,
|
|
1734
|
+
withNozzle as aa,
|
|
1735
|
+
BoardProvider as b,
|
|
1736
|
+
CuiKitWrapper as c,
|
|
1737
|
+
DISPENSE_GROUP_BRAND as d,
|
|
1738
|
+
DISPENSE_GROUP_FLAVOR as e,
|
|
1739
|
+
DeviceAssemblyProvider as f,
|
|
1740
|
+
HoldToPourStrategy as g,
|
|
1741
|
+
HolderContainerProvider as h,
|
|
1742
|
+
HolderProvider as i,
|
|
1743
|
+
IngredientProvider as j,
|
|
1744
|
+
TapToPourIntentStrategy as k,
|
|
1745
|
+
TapToPourStrategy as l,
|
|
1746
|
+
initializeCuiKit as m,
|
|
1747
|
+
useAssemblyContext as n,
|
|
1748
|
+
useAvailability as o,
|
|
1749
|
+
useAvailabilityContext as p,
|
|
1750
|
+
useBeverages as q,
|
|
1751
|
+
useBoard as r,
|
|
1752
|
+
useBoardContainer as s,
|
|
1753
|
+
useBoardContainerContext as t,
|
|
1754
|
+
useAssembly as u,
|
|
1755
|
+
useBoardContext as v,
|
|
1756
|
+
useBrands as w,
|
|
1757
|
+
useCuiKit as x,
|
|
1758
|
+
useCuiKitTimers as y,
|
|
1759
|
+
useDefaultCuiKitLifecycle as z
|
|
1824
1760
|
};
|
|
1825
|
-
//# sourceMappingURL=pump-provider-
|
|
1761
|
+
//# sourceMappingURL=pump-provider-CPUsLke5.js.map
|