@kosdev-code/kos-dispense-sdk 2.1.33 → 2.1.34
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/{dispense-registration-manager-CcFUS_KM.js → dispense-registration-manager-Cl2UbU1m.js} +161 -158
- package/{dispense-registration-manager-CcFUS_KM.js.map → dispense-registration-manager-Cl2UbU1m.js.map} +1 -1
- package/dispense-registration-manager-DK1ePXkY.cjs +2 -0
- package/{dispense-registration-manager-BkJ1ggtS.cjs.map → dispense-registration-manager-DK1ePXkY.cjs.map} +1 -1
- package/extension-utils-CAqmOmVh.cjs +2 -0
- package/extension-utils-CAqmOmVh.cjs.map +1 -0
- package/{extension-utils-DeLiIgFH.js → extension-utils-CECRZtAt.js} +149 -66
- package/extension-utils-CECRZtAt.js.map +1 -0
- package/index.cjs +1 -1
- package/index.js +3 -3
- package/models/models/nozzle/nozzle-model.d.ts +2 -2
- package/models/models/nozzle/nozzle-model.d.ts.map +1 -1
- package/models/utils/extension-utils.d.ts +90 -18
- package/models/utils/extension-utils.d.ts.map +1 -1
- package/models/utils/service.d.ts +8 -8
- package/models/utils/services/dispense/1.6.5/service.d.ts +8 -8
- package/models/utils/services/dispense/1.8.1/service.d.ts +8 -8
- package/models/utils/services/dispense/daily/service.d.ts +8 -8
- package/models.cjs +1 -1
- package/models.js +2 -2
- package/package.json +2 -2
- package/pump-provider-C-6CuGgY.cjs +2 -0
- package/pump-provider-C-6CuGgY.cjs.map +1 -0
- package/{pump-provider-BTnIydH2.js → pump-provider-DoK4li3d.js} +247 -241
- package/pump-provider-DoK4li3d.js.map +1 -0
- package/ui/hooks/cui-kit/use-beverages.d.ts +1 -1
- package/ui/hooks/cui-kit/use-beverages.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-brands.d.ts +1 -1
- package/ui/hooks/cui-kit/use-brands.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-cui-kit.d.ts +1 -1
- package/ui/hooks/cui-kit/use-cui-kit.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-flavors.d.ts +1 -1
- package/ui/hooks/cui-kit/use-flavors.d.ts.map +1 -1
- package/ui.cjs +1 -1
- package/ui.js +2 -2
- package/dispense-registration-manager-BkJ1ggtS.cjs +0 -2
- package/extension-utils-DUV7OQR1.cjs +0 -2
- package/extension-utils-DUV7OQR1.cjs.map +0 -1
- package/extension-utils-DeLiIgFH.js.map +0 -1
- package/pump-provider-BTnIydH2.js.map +0 -1
- package/pump-provider-BUfMtaXv.cjs +0 -2
- package/pump-provider-BUfMtaXv.cjs.map +0 -1
|
@@ -4,7 +4,7 @@ import { IngredientResponse } from '../models/ingredient/services';
|
|
|
4
4
|
import { HolderModel } from '../models/holder/types';
|
|
5
5
|
import { HolderResponse } from '../models/holder/services';
|
|
6
6
|
import { AssemblyTypes, AssemblyModel } from '../models';
|
|
7
|
-
import { CoreExtensionManager, DataLoader, DataMapper, IndexExtension, PropertyMapper, FlagResolver } from '@kosdev-code/kos-ui-sdk';
|
|
7
|
+
import { CoreExtensionManager, DataLoader, DataMapper, ExtensionOptions, IndexExtension, PropertyMapper, FlagResolver } from '@kosdev-code/kos-ui-sdk';
|
|
8
8
|
|
|
9
9
|
export type IngredientDataMapper<AdditionalData extends object = Record<string, any>> = DataMapper<IngredientResponse, AdditionalData, any>;
|
|
10
10
|
/**
|
|
@@ -41,6 +41,12 @@ export declare class DispenseExtensionManager {
|
|
|
41
41
|
* not provided by the base KOS Ingredient model. The {@link IngredientMapper} extension point allows for the data to be mapped
|
|
42
42
|
* into the {@link IngredientModel} and the {@link IngredientModel.data} property to be augmented with additional properties.
|
|
43
43
|
*
|
|
44
|
+
* @param ingredientDataMapper - Mapping function that maps an {@link IngredientResponse} into additional model data
|
|
45
|
+
* @param options - Optional {@link ExtensionOptions} to control failure behavior.
|
|
46
|
+
* Defaults to `failurePolicy: "throw"`, which throws an {@link ExtensionException} on mapper failure.
|
|
47
|
+
* Set to `"continue"` to log the error and continue processing remaining mappers.
|
|
48
|
+
* @returns this instance for chaining
|
|
49
|
+
*
|
|
44
50
|
* @example
|
|
45
51
|
* The following example shows how to map the data from the service response into the {@link IngredientModel}.
|
|
46
52
|
* The context is provided by the {@link IngredientLoader} extension point with its data being used to optionally augment the
|
|
@@ -78,9 +84,15 @@ export declare class DispenseExtensionManager {
|
|
|
78
84
|
* }
|
|
79
85
|
* ```
|
|
80
86
|
* */
|
|
81
|
-
registerIngredientDataMapper(ingredientDataMapper: IngredientDataMapper): this;
|
|
87
|
+
registerIngredientDataMapper(ingredientDataMapper: IngredientDataMapper, options?: ExtensionOptions): this;
|
|
82
88
|
/**
|
|
83
|
-
* Loads data that will be provided as context into the {@link IngredientMapper}
|
|
89
|
+
* Loads data that will be provided as context into the {@link IngredientMapper}.
|
|
90
|
+
*
|
|
91
|
+
* @param ingredientLoader - Async function that loads and returns ingredient context data
|
|
92
|
+
* @param options - Optional {@link ExtensionOptions} to control failure behavior.
|
|
93
|
+
* Defaults to `failurePolicy: "throw"`, which throws an {@link ExtensionException} on loader failure.
|
|
94
|
+
* Set to `"continue"` to log the error and return `undefined` instead.
|
|
95
|
+
* @returns this instance for chaining
|
|
84
96
|
*
|
|
85
97
|
* @example
|
|
86
98
|
* The following example shows how to load the brandset data, normalize it into a map and then provide it back to the framework
|
|
@@ -102,28 +114,61 @@ export declare class DispenseExtensionManager {
|
|
|
102
114
|
* };
|
|
103
115
|
* ```
|
|
104
116
|
* */
|
|
105
|
-
registerIngredientLoader(ingredientLoader: DataLoader): this;
|
|
117
|
+
registerIngredientLoader(ingredientLoader: DataLoader, options?: ExtensionOptions): this;
|
|
106
118
|
registerIngredientIndex(ingredientIndex: IndexExtension): this;
|
|
107
119
|
/**
|
|
108
|
-
* Registers a
|
|
120
|
+
* Registers a property mapper that derives the `type` property of the {@link IngredientModel}
|
|
121
|
+
* from an {@link IngredientResponse}.
|
|
122
|
+
*
|
|
123
|
+
* @param ingredientTypeMapper - Mapping function that extracts a type string from an {@link IngredientResponse}
|
|
124
|
+
* @param options - Optional {@link ExtensionOptions} to control failure behavior.
|
|
125
|
+
* Defaults to `failurePolicy: "throw"`, which throws an {@link ExtensionException} on mapper failure.
|
|
126
|
+
* Set to `"continue"` to log the error and return a fallback value instead.
|
|
127
|
+
* @returns this instance for chaining
|
|
109
128
|
* */
|
|
110
|
-
registerIngredientTypeMapper(ingredientTypeMapper: IngredientTypeMapper): this;
|
|
129
|
+
registerIngredientTypeMapper(ingredientTypeMapper: IngredientTypeMapper, options?: ExtensionOptions): this;
|
|
111
130
|
/**
|
|
112
131
|
* Registers a data mapper for the {@link HolderModel} model.
|
|
113
|
-
*
|
|
114
|
-
* @
|
|
132
|
+
*
|
|
133
|
+
* @param holderDataMapper - Mapping function that maps additional data from a {@link HolderResponse}
|
|
134
|
+
* @param options - Optional {@link ExtensionOptions} to control failure behavior.
|
|
135
|
+
* Defaults to `failurePolicy: "throw"`, which throws an {@link ExtensionException} on mapper failure.
|
|
136
|
+
* Set to `"continue"` to log the error and continue processing remaining mappers.
|
|
137
|
+
* @returns this instance for chaining
|
|
115
138
|
*/
|
|
116
|
-
registerHolderDataMapper(holderDataMapper: HolderDataMapper): this;
|
|
117
|
-
|
|
139
|
+
registerHolderDataMapper(holderDataMapper: HolderDataMapper, options?: ExtensionOptions): this;
|
|
140
|
+
/**
|
|
141
|
+
* Registers a property mapper that derives the `type` property of the {@link HolderModel}
|
|
142
|
+
* from a {@link HolderResponse}.
|
|
143
|
+
*
|
|
144
|
+
* @param holderTypeMapper - Mapping function that extracts a type string from a {@link HolderResponse}
|
|
145
|
+
* @param options - Optional {@link ExtensionOptions} to control failure behavior.
|
|
146
|
+
* Defaults to `failurePolicy: "throw"`, which throws an {@link ExtensionException} on mapper failure.
|
|
147
|
+
* Set to `"continue"` to log the error and return a fallback value instead.
|
|
148
|
+
* @returns this instance for chaining
|
|
149
|
+
*/
|
|
150
|
+
registerHolderTypeMapper(holderTypeMapper: HolderTypeMapper, options?: ExtensionOptions): this;
|
|
118
151
|
/**
|
|
119
152
|
* Maps the ingredientId property of the holder into the {@link HolderModel}.
|
|
120
153
|
* If not provided, the ingredientId will assume that the value is mapped from the
|
|
121
154
|
* ingredientId property of the service response.
|
|
155
|
+
*
|
|
156
|
+
* @param holderTypeMapper - Mapping function that extracts the ingredientId from a {@link HolderResponse}
|
|
157
|
+
* @param options - Optional {@link ExtensionOptions} to control failure behavior.
|
|
158
|
+
* Defaults to `failurePolicy: "throw"`, which throws an {@link ExtensionException} on mapper failure.
|
|
159
|
+
* Set to `"continue"` to log the error and return a fallback value instead.
|
|
160
|
+
* @returns this instance for chaining
|
|
122
161
|
* */
|
|
123
|
-
registerHolderIngredientMapper(holderTypeMapper: HolderTypeMapper): this;
|
|
162
|
+
registerHolderIngredientMapper(holderTypeMapper: HolderTypeMapper, options?: ExtensionOptions): this;
|
|
124
163
|
registerHolderIndex<T extends HolderModel = HolderModel>(holderIndex: IndexExtension<T>): this;
|
|
125
164
|
/**
|
|
126
|
-
* Maps data into the {@link AvailabilityModel}
|
|
165
|
+
* Maps data into the {@link AvailabilityModel}.
|
|
166
|
+
*
|
|
167
|
+
* @param availabilityMapper - Mapping function that maps a {@link GroupBeverageResponse} into additional availability data
|
|
168
|
+
* @param options - Optional {@link ExtensionOptions} to control failure behavior.
|
|
169
|
+
* Defaults to `failurePolicy: "throw"`, which throws an {@link ExtensionException} on mapper failure.
|
|
170
|
+
* Set to `"continue"` to log the error and continue processing remaining mappers.
|
|
171
|
+
* @returns this instance for chaining
|
|
127
172
|
*
|
|
128
173
|
* @example
|
|
129
174
|
* The following example shows how to map the data from the service response into the {@link AvailabilityModel}.
|
|
@@ -148,9 +193,15 @@ export declare class DispenseExtensionManager {
|
|
|
148
193
|
* };
|
|
149
194
|
* ```
|
|
150
195
|
* */
|
|
151
|
-
registerAvailabilityDataMapper(availabilityMapper: AvailabilityDataMapper): this;
|
|
196
|
+
registerAvailabilityDataMapper(availabilityMapper: AvailabilityDataMapper, options?: ExtensionOptions): this;
|
|
152
197
|
/**
|
|
153
|
-
* Loads data that will be provided as context into the {@link AvailabilityMapper}
|
|
198
|
+
* Loads data that will be provided as context into the {@link AvailabilityMapper}.
|
|
199
|
+
*
|
|
200
|
+
* @param availabilityLoader - Async function that loads and returns availability context data
|
|
201
|
+
* @param options - Optional {@link ExtensionOptions} to control failure behavior.
|
|
202
|
+
* Defaults to `failurePolicy: "throw"`, which throws an {@link ExtensionException} on loader failure.
|
|
203
|
+
* Set to `"continue"` to log the error and return `undefined` instead.
|
|
204
|
+
* @returns this instance for chaining
|
|
154
205
|
*
|
|
155
206
|
* @example
|
|
156
207
|
* A common use case is to load brandset data that is UI specific and not provided directly by the Java service.
|
|
@@ -179,16 +230,28 @@ export declare class DispenseExtensionManager {
|
|
|
179
230
|
* };
|
|
180
231
|
* ```
|
|
181
232
|
* */
|
|
182
|
-
registerAvailabilityLoader(availabilityLoader: DataLoader): this;
|
|
233
|
+
registerAvailabilityLoader(availabilityLoader: DataLoader, options?: ExtensionOptions): this;
|
|
183
234
|
/**
|
|
184
235
|
* Maps the abstract {@link SelectedPourable} data into a format that is specific to the nozzle.
|
|
236
|
+
*
|
|
237
|
+
* @param selectedPourableMapper - Mapping function that transforms {@link SelectedPourable} data
|
|
238
|
+
* @param options - Optional {@link ExtensionOptions} to control failure behavior.
|
|
239
|
+
* Defaults to `failurePolicy: "throw"`, which throws an {@link ExtensionException} on mapper failure.
|
|
240
|
+
* Set to `"continue"` to log the error and continue processing remaining mappers.
|
|
241
|
+
* @returns this instance for chaining
|
|
185
242
|
* */
|
|
186
|
-
registerSelectedPourableDataMapper(selectedPourableMapper: SelectedPourableMapper): this;
|
|
243
|
+
registerSelectedPourableDataMapper(selectedPourableMapper: SelectedPourableMapper, options?: ExtensionOptions): this;
|
|
187
244
|
/**
|
|
188
245
|
* Maps data into the {@link AssemblyModel} data.
|
|
189
246
|
* Used in cases where the base assembly has been extended with additional properties in the backend. This extension
|
|
190
247
|
* point allows for the data to be mapped into the {@link AssemblyModel} and augmented with additional properties.
|
|
191
248
|
*
|
|
249
|
+
* @param assemblyDataMapper - Mapping function that maps an {@link AssemblyTypes.AssemblyResponse} into additional assembly data
|
|
250
|
+
* @param options - Optional {@link ExtensionOptions} to control failure behavior.
|
|
251
|
+
* Defaults to `failurePolicy: "throw"`, which throws an {@link ExtensionException} on mapper failure.
|
|
252
|
+
* Set to `"continue"` to log the error and continue processing remaining mappers.
|
|
253
|
+
* @returns this instance for chaining
|
|
254
|
+
*
|
|
192
255
|
* @example
|
|
193
256
|
*
|
|
194
257
|
* In this example of an implementation of a {@link AssemblyMapper}, the {@link AssemblyResponse} data is mapped into
|
|
@@ -245,9 +308,18 @@ export declare class DispenseExtensionManager {
|
|
|
245
308
|
* };
|
|
246
309
|
*```
|
|
247
310
|
*/
|
|
248
|
-
registerAssemblyDataMapper(assemblyDataMapper: AssemblyMapper): this;
|
|
311
|
+
registerAssemblyDataMapper(assemblyDataMapper: AssemblyMapper, options?: ExtensionOptions): this;
|
|
249
312
|
registerBoardIndex(boardIndex: IndexExtension): this;
|
|
250
|
-
|
|
313
|
+
/**
|
|
314
|
+
* Registers a data mapper for the board model within an assembly.
|
|
315
|
+
*
|
|
316
|
+
* @param boardDataMapper - Mapping function that maps an {@link AssemblyTypes.AssemblyBoard} into additional board data
|
|
317
|
+
* @param options - Optional {@link ExtensionOptions} to control failure behavior.
|
|
318
|
+
* Defaults to `failurePolicy: "throw"`, which throws an {@link ExtensionException} on mapper failure.
|
|
319
|
+
* Set to `"continue"` to log the error and continue processing remaining mappers.
|
|
320
|
+
* @returns this instance for chaining
|
|
321
|
+
*/
|
|
322
|
+
registerBoardDataMapper(boardDataMapper: BoardDataMapper<any, any>, options?: ExtensionOptions): this;
|
|
251
323
|
registerAssemblyFeatureFlagResolver(assemblyFeatureFlagResolver: FlagResolver<AssemblyModel>): this;
|
|
252
324
|
}
|
|
253
325
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension-utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-dispense-sdk/src/models/utils/extension-utils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EACpB,UAAU,EACV,UAAU,EAGV,cAAc,EACd,cAAc,EACd,KAAK,YAAY,EAClB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,MAAM,MAAM,oBAAoB,CAC9B,cAAc,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IACjD,UAAU,CAAC,kBAAkB,EAAE,cAAc,EAAE,GAAG,CAAC,CAAC;AAExD;;;GAGG;AACH,MAAM,MAAM,oBAAoB,CAC9B,CAAC,SAAS,kBAAkB,GAAG,kBAAkB,IAC/C,cAAc,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AAE9B;;;GAGG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,IACpE,cAAc,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AAE5B;;;GAGG;AACH,MAAM,MAAM,gBAAgB,CAC1B,cAAc,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACnD,UAAU,SAAS,cAAc,GAAG,cAAc,IAChD,UAAU,CAAC,UAAU,EAAE,cAAc,EAAE,GAAG,CAAC,CAAC;AAEhD,MAAM,MAAM,qBAAqB,GAAG,gBAAgB,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAC3E,MAAM,MAAM,sBAAsB,CAChC,cAAc,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACnD,gBAAgB,SAAS,qBAAqB,GAAG,qBAAqB,IACpE,UAAU,CAAC,gBAAgB,EAAE,cAAc,EAAE,GAAG,CAAC,CAAC;AAEtD,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC;AAEvE,MAAM,MAAM,eAAe,CACzB,cAAc,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACnD,SAAS,SAAS,aAAa,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,aAAa,CAAC,GAAG,CAAC,IACnF,UAAU,CAAC,SAAS,EAAE,cAAc,EAAE,GAAG,CAAC,CAAC;AAE/C,MAAM,MAAM,cAAc,CACxB,cAAc,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACnD,oBAAoB,SAAS,aAAa,CAAC,gBAAgB,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,gBAAgB,CAAC,GAAG,CAAC,IACpG,UAAU,CAAC,oBAAoB,EAAE,cAAc,EAAE,GAAG,CAAC,CAAC;AAC1D;;GAEG;AACH,qBAAa,wBAAwB;IACnC,IAAI,EAAE,oBAAoB,CAA8B;IACxD
|
|
1
|
+
{"version":3,"file":"extension-utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-dispense-sdk/src/models/utils/extension-utils.ts"],"names":[],"mappings":"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"}
|
|
@@ -8,10 +8,10 @@ export declare const api: {
|
|
|
8
8
|
ordered?: boolean | undefined;
|
|
9
9
|
tracker?: string | undefined;
|
|
10
10
|
timeout?: number | undefined;
|
|
11
|
+
destinationAddress?: string | undefined;
|
|
12
|
+
bridge?: boolean | undefined;
|
|
11
13
|
headers?: Record<string, string> | undefined;
|
|
12
14
|
fos?: boolean | undefined;
|
|
13
|
-
bridge?: boolean | undefined;
|
|
14
|
-
destinationAddress?: string | undefined;
|
|
15
15
|
studio?: boolean | undefined;
|
|
16
16
|
signal?: AbortSignal | undefined;
|
|
17
17
|
stream?: boolean | undefined;
|
|
@@ -27,10 +27,10 @@ export declare const api: {
|
|
|
27
27
|
ordered?: boolean | undefined;
|
|
28
28
|
tracker?: string | undefined;
|
|
29
29
|
timeout?: number | undefined;
|
|
30
|
+
destinationAddress?: string | undefined;
|
|
31
|
+
bridge?: boolean | undefined;
|
|
30
32
|
headers?: Record<string, string> | undefined;
|
|
31
33
|
fos?: boolean | undefined;
|
|
32
|
-
bridge?: boolean | undefined;
|
|
33
|
-
destinationAddress?: string | undefined;
|
|
34
34
|
studio?: boolean | undefined;
|
|
35
35
|
signal?: AbortSignal | undefined;
|
|
36
36
|
stream?: boolean | undefined;
|
|
@@ -46,10 +46,10 @@ export declare const api: {
|
|
|
46
46
|
ordered?: boolean | undefined;
|
|
47
47
|
tracker?: string | undefined;
|
|
48
48
|
timeout?: number | undefined;
|
|
49
|
+
destinationAddress?: string | undefined;
|
|
50
|
+
bridge?: boolean | undefined;
|
|
49
51
|
headers?: Record<string, string> | undefined;
|
|
50
52
|
fos?: boolean | undefined;
|
|
51
|
-
bridge?: boolean | undefined;
|
|
52
|
-
destinationAddress?: string | undefined;
|
|
53
53
|
studio?: boolean | undefined;
|
|
54
54
|
signal?: AbortSignal | undefined;
|
|
55
55
|
stream?: boolean | undefined;
|
|
@@ -65,10 +65,10 @@ export declare const api: {
|
|
|
65
65
|
ordered?: boolean | undefined;
|
|
66
66
|
tracker?: string | undefined;
|
|
67
67
|
timeout?: number | undefined;
|
|
68
|
+
destinationAddress?: string | undefined;
|
|
69
|
+
bridge?: boolean | undefined;
|
|
68
70
|
headers?: Record<string, string> | undefined;
|
|
69
71
|
fos?: boolean | undefined;
|
|
70
|
-
bridge?: boolean | undefined;
|
|
71
|
-
destinationAddress?: string | undefined;
|
|
72
72
|
studio?: boolean | undefined;
|
|
73
73
|
signal?: AbortSignal | undefined;
|
|
74
74
|
stream?: boolean | undefined;
|
|
@@ -47,10 +47,10 @@ export declare const api: {
|
|
|
47
47
|
ordered?: boolean | undefined;
|
|
48
48
|
tracker?: string | undefined;
|
|
49
49
|
timeout?: number | undefined;
|
|
50
|
+
destinationAddress?: string | undefined;
|
|
51
|
+
bridge?: boolean | undefined;
|
|
50
52
|
headers?: Record<string, string> | undefined;
|
|
51
53
|
fos?: boolean | undefined;
|
|
52
|
-
bridge?: boolean | undefined;
|
|
53
|
-
destinationAddress?: string | undefined;
|
|
54
54
|
studio?: boolean | undefined;
|
|
55
55
|
signal?: AbortSignal | undefined;
|
|
56
56
|
stream?: boolean | undefined;
|
|
@@ -66,10 +66,10 @@ export declare const api: {
|
|
|
66
66
|
ordered?: boolean | undefined;
|
|
67
67
|
tracker?: string | undefined;
|
|
68
68
|
timeout?: number | undefined;
|
|
69
|
+
destinationAddress?: string | undefined;
|
|
70
|
+
bridge?: boolean | undefined;
|
|
69
71
|
headers?: Record<string, string> | undefined;
|
|
70
72
|
fos?: boolean | undefined;
|
|
71
|
-
bridge?: boolean | undefined;
|
|
72
|
-
destinationAddress?: string | undefined;
|
|
73
73
|
studio?: boolean | undefined;
|
|
74
74
|
signal?: AbortSignal | undefined;
|
|
75
75
|
stream?: boolean | undefined;
|
|
@@ -85,10 +85,10 @@ export declare const api: {
|
|
|
85
85
|
ordered?: boolean | undefined;
|
|
86
86
|
tracker?: string | undefined;
|
|
87
87
|
timeout?: number | undefined;
|
|
88
|
+
destinationAddress?: string | undefined;
|
|
89
|
+
bridge?: boolean | undefined;
|
|
88
90
|
headers?: Record<string, string> | undefined;
|
|
89
91
|
fos?: boolean | undefined;
|
|
90
|
-
bridge?: boolean | undefined;
|
|
91
|
-
destinationAddress?: string | undefined;
|
|
92
92
|
studio?: boolean | undefined;
|
|
93
93
|
signal?: AbortSignal | undefined;
|
|
94
94
|
stream?: boolean | undefined;
|
|
@@ -104,10 +104,10 @@ export declare const api: {
|
|
|
104
104
|
ordered?: boolean | undefined;
|
|
105
105
|
tracker?: string | undefined;
|
|
106
106
|
timeout?: number | undefined;
|
|
107
|
+
destinationAddress?: string | undefined;
|
|
108
|
+
bridge?: boolean | undefined;
|
|
107
109
|
headers?: Record<string, string> | undefined;
|
|
108
110
|
fos?: boolean | undefined;
|
|
109
|
-
bridge?: boolean | undefined;
|
|
110
|
-
destinationAddress?: string | undefined;
|
|
111
111
|
studio?: boolean | undefined;
|
|
112
112
|
signal?: AbortSignal | undefined;
|
|
113
113
|
stream?: boolean | undefined;
|
|
@@ -47,10 +47,10 @@ export declare const api: {
|
|
|
47
47
|
ordered?: boolean | undefined;
|
|
48
48
|
tracker?: string | undefined;
|
|
49
49
|
timeout?: number | undefined;
|
|
50
|
+
destinationAddress?: string | undefined;
|
|
51
|
+
bridge?: boolean | undefined;
|
|
50
52
|
headers?: Record<string, string> | undefined;
|
|
51
53
|
fos?: boolean | undefined;
|
|
52
|
-
bridge?: boolean | undefined;
|
|
53
|
-
destinationAddress?: string | undefined;
|
|
54
54
|
studio?: boolean | undefined;
|
|
55
55
|
signal?: AbortSignal | undefined;
|
|
56
56
|
stream?: boolean | undefined;
|
|
@@ -66,10 +66,10 @@ export declare const api: {
|
|
|
66
66
|
ordered?: boolean | undefined;
|
|
67
67
|
tracker?: string | undefined;
|
|
68
68
|
timeout?: number | undefined;
|
|
69
|
+
destinationAddress?: string | undefined;
|
|
70
|
+
bridge?: boolean | undefined;
|
|
69
71
|
headers?: Record<string, string> | undefined;
|
|
70
72
|
fos?: boolean | undefined;
|
|
71
|
-
bridge?: boolean | undefined;
|
|
72
|
-
destinationAddress?: string | undefined;
|
|
73
73
|
studio?: boolean | undefined;
|
|
74
74
|
signal?: AbortSignal | undefined;
|
|
75
75
|
stream?: boolean | undefined;
|
|
@@ -85,10 +85,10 @@ export declare const api: {
|
|
|
85
85
|
ordered?: boolean | undefined;
|
|
86
86
|
tracker?: string | undefined;
|
|
87
87
|
timeout?: number | undefined;
|
|
88
|
+
destinationAddress?: string | undefined;
|
|
89
|
+
bridge?: boolean | undefined;
|
|
88
90
|
headers?: Record<string, string> | undefined;
|
|
89
91
|
fos?: boolean | undefined;
|
|
90
|
-
bridge?: boolean | undefined;
|
|
91
|
-
destinationAddress?: string | undefined;
|
|
92
92
|
studio?: boolean | undefined;
|
|
93
93
|
signal?: AbortSignal | undefined;
|
|
94
94
|
stream?: boolean | undefined;
|
|
@@ -104,10 +104,10 @@ export declare const api: {
|
|
|
104
104
|
ordered?: boolean | undefined;
|
|
105
105
|
tracker?: string | undefined;
|
|
106
106
|
timeout?: number | undefined;
|
|
107
|
+
destinationAddress?: string | undefined;
|
|
108
|
+
bridge?: boolean | undefined;
|
|
107
109
|
headers?: Record<string, string> | undefined;
|
|
108
110
|
fos?: boolean | undefined;
|
|
109
|
-
bridge?: boolean | undefined;
|
|
110
|
-
destinationAddress?: string | undefined;
|
|
111
111
|
studio?: boolean | undefined;
|
|
112
112
|
signal?: AbortSignal | undefined;
|
|
113
113
|
stream?: boolean | undefined;
|
|
@@ -47,10 +47,10 @@ export declare const api: {
|
|
|
47
47
|
ordered?: boolean | undefined;
|
|
48
48
|
tracker?: string | undefined;
|
|
49
49
|
timeout?: number | undefined;
|
|
50
|
+
destinationAddress?: string | undefined;
|
|
51
|
+
bridge?: boolean | undefined;
|
|
50
52
|
headers?: Record<string, string> | undefined;
|
|
51
53
|
fos?: boolean | undefined;
|
|
52
|
-
bridge?: boolean | undefined;
|
|
53
|
-
destinationAddress?: string | undefined;
|
|
54
54
|
studio?: boolean | undefined;
|
|
55
55
|
signal?: AbortSignal | undefined;
|
|
56
56
|
stream?: boolean | undefined;
|
|
@@ -66,10 +66,10 @@ export declare const api: {
|
|
|
66
66
|
ordered?: boolean | undefined;
|
|
67
67
|
tracker?: string | undefined;
|
|
68
68
|
timeout?: number | undefined;
|
|
69
|
+
destinationAddress?: string | undefined;
|
|
70
|
+
bridge?: boolean | undefined;
|
|
69
71
|
headers?: Record<string, string> | undefined;
|
|
70
72
|
fos?: boolean | undefined;
|
|
71
|
-
bridge?: boolean | undefined;
|
|
72
|
-
destinationAddress?: string | undefined;
|
|
73
73
|
studio?: boolean | undefined;
|
|
74
74
|
signal?: AbortSignal | undefined;
|
|
75
75
|
stream?: boolean | undefined;
|
|
@@ -85,10 +85,10 @@ export declare const api: {
|
|
|
85
85
|
ordered?: boolean | undefined;
|
|
86
86
|
tracker?: string | undefined;
|
|
87
87
|
timeout?: number | undefined;
|
|
88
|
+
destinationAddress?: string | undefined;
|
|
89
|
+
bridge?: boolean | undefined;
|
|
88
90
|
headers?: Record<string, string> | undefined;
|
|
89
91
|
fos?: boolean | undefined;
|
|
90
|
-
bridge?: boolean | undefined;
|
|
91
|
-
destinationAddress?: string | undefined;
|
|
92
92
|
studio?: boolean | undefined;
|
|
93
93
|
signal?: AbortSignal | undefined;
|
|
94
94
|
stream?: boolean | undefined;
|
|
@@ -104,10 +104,10 @@ export declare const api: {
|
|
|
104
104
|
ordered?: boolean | undefined;
|
|
105
105
|
tracker?: string | undefined;
|
|
106
106
|
timeout?: number | undefined;
|
|
107
|
+
destinationAddress?: string | undefined;
|
|
108
|
+
bridge?: boolean | undefined;
|
|
107
109
|
headers?: Record<string, string> | undefined;
|
|
108
110
|
fos?: boolean | undefined;
|
|
109
|
-
bridge?: boolean | undefined;
|
|
110
|
-
destinationAddress?: string | undefined;
|
|
111
111
|
studio?: boolean | undefined;
|
|
112
112
|
signal?: AbortSignal | undefined;
|
|
113
113
|
stream?: boolean | undefined;
|
package/models.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./dispense-registration-manager-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./dispense-registration-manager-DK1ePXkY.cjs"),n=require("./extension-utils-CAqmOmVh.cjs");require("@kosdev-code/kos-ui-sdk");require("react");exports.Assembly=e.Assembly;exports.Availability=e.Availability;exports.Board=e.Board;exports.BoardContainer=e.BoardContainer;Object.defineProperty(exports,"BoardContainerModel",{enumerable:!0,get:()=>e.BoardContainerModel});exports.CONTEXT_ASSEMBLY_DATA=e.CONTEXT_ASSEMBLY_DATA;exports.CONTEXT_ASSEMBLY_RAW_DATA=e.CONTEXT_ASSEMBLY_RAW_DATA;exports.DeviceAssembly=e.DeviceAssembly;exports.DispenseModelType=e.DispenseModelType;exports.ExtensionType=e.ExtensionType;exports.GenericPour=e.GenericPour;exports.Holder=e.Holder;exports.HolderContainer=e.HolderContainer;exports.Ingredient=e.Ingredient;exports.IngredientContainer=e.IngredientContainer;exports.KosModelRegistry=e.KosModelRegistry;exports.Nozzle=e.Nozzle;exports.PourState=e.PourState;exports.Pump=e.Pump;exports.PumpContainer=e.PumpContainer;exports.PumpIndex=e.PumpIndex;exports.TOPIC_BOARD_LINKED=e.TOPIC_BOARD_LINKED;exports.TOPIC_BOARD_UNLINKED=e.TOPIC_BOARD_UNLINKED;exports.TOPIC_GENERIC_POUR_CANCEL=e.TOPIC_GENERIC_POUR_CANCEL;exports.TOPIC_GENERIC_POUR_PROGRESS=e.TOPIC_GENERIC_POUR_PROGRESS;exports.TOPIC_GENERIC_POUR_STARTED=e.TOPIC_GENERIC_POUR_STARTED;exports.kosModels=e.kosModels;exports.registerDispenseModels=e.registerDispenseModels;exports.AssemblyServices=n.index;exports.AssemblyTypes=n.assembly;exports.DispenseExtensionManager=n.DispenseExtensionManager;exports.GenericPourServices=n.index$1;exports.HolderServices=n.index$2;exports.IngredientServices=n.index$3;exports.KosExtensionManager=n.KosExtensionManager;exports.NozzleServices=n.index$4;exports.PumpServices=n.index$5;exports.getFuelGaugeValue=n.getFuelGaugeValue;
|
|
2
2
|
//# sourceMappingURL=models.cjs.map
|
package/models.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as o, b as i, e as n, d as t, B as l, C as E, a as C, f as _, D as d, E as A, G as P, H as T, j as I, I as p, k as S, K as m, N as D, n as O, P as R, l as N, m as c, T as g, c as u, g as y, h as M, i as v, o as B, r as G } from "./dispense-registration-manager-
|
|
2
|
-
import { i as x, f as K, D as L, a as f, b as z, c as H, K as U, d as k, e as X, g as Y } from "./extension-utils-
|
|
1
|
+
import { A as o, b as i, e as n, d as t, B as l, C as E, a as C, f as _, D as d, E as A, G as P, H as T, j as I, I as p, k as S, K as m, N as D, n as O, P as R, l as N, m as c, T as g, c as u, g as y, h as M, i as v, o as B, r as G } from "./dispense-registration-manager-Cl2UbU1m.js";
|
|
2
|
+
import { i as x, f as K, D as L, a as f, b as z, c as H, K as U, d as k, e as X, g as Y } from "./extension-utils-CECRZtAt.js";
|
|
3
3
|
import "@kosdev-code/kos-ui-sdk";
|
|
4
4
|
import "react";
|
|
5
5
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kosdev-code/kos-dispense-sdk",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.34",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./index.d.ts",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"kos": {
|
|
35
35
|
"build": {
|
|
36
|
-
"gitHash": "
|
|
36
|
+
"gitHash": "009439d0e2ae59f61a2144470b35aa46cfc002ed"
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var et=Object.defineProperty;var tt=(e,t,r)=>t in e?et(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Y=(e,t,r)=>(tt(e,typeof t!="symbol"?t+"":t,r),r);const b=require("@emotion/react/jsx-runtime"),u=require("@kosdev-code/kos-ui-sdk"),g=require("./dispense-registration-manager-DK1ePXkY.cjs"),o=require("react"),fe=()=>{const e=g.Assembly.type;return u.useKosModel({modelId:e,modelType:g.Assembly.type,options:{}})};function st(e){return t=>{const{model:r,status:n,KosModelLoader:s}=fe();return b.jsx(s,{...n,children:b.jsx(e,{...t,assembly:r})})}}const pe=()=>{const e=g.Availability.type;return u.useKosModel({modelId:e,modelType:g.Availability.type,options:{}})};function rt(e){return t=>{const{model:r,status:n,KosModelLoader:s}=pe();return b.jsx(s,{...n,children:b.jsx(e,{...t,beverage:r})})}}const Ce=e=>{const t=e;return u.useKosModel({modelId:t,modelType:g.Board.type,options:{}})};function nt(e){return t=>r=>{const{model:n,status:s,KosModelLoader:i}=Ce(t);return b.jsx(i,{...s,children:b.jsx(e,{...r,board:n})})}}const ve=()=>{const e=g.BoardContainer.type;return u.useKosModel({modelId:e,modelType:g.BoardContainer.type,options:{}})};function ot(e){return t=>{const{model:r,status:n,KosModelLoader:s}=ve();return b.jsx(s,{...n,children:b.jsx(e,{...t,boardContainer:r})})}}const xe=e=>{const t=e;return u.useKosModel({modelId:t,modelType:g.Nozzle.type,options:{path:e}})},Se=o.createContext(void 0),ye=({children:e,path:t})=>{const{model:r,ready:n}=xe(t),s=o.useMemo(()=>n&&r?{model:r}:{},[n,r]);return b.jsx(Se.Provider,{value:s,children:e})},$=()=>{const e=o.useContext(Se);if(!e)throw new Error("useNozzleContext must be used within a NozzleProvider");return e},Be=({onBeverageSelected:e,onBeverageListUpdated:t,onClearBeverage:r,companionType:n})=>{const{model:s}=$(),[i,a]=o.useState([]),[l,x]=o.useState(null),f=o.useMemo(()=>n?i.map(p=>u.getKosCompanionModel(p,n)):[],[i,n]),c=o.useCallback(async(p,v,C)=>{x(p),await(s==null?void 0:s.setSelectedPourable({beverage:p,context:v},C)),e==null||e(p)},[s,e]),h=o.useCallback(async()=>{x(null),await(s==null?void 0:s.setSelectedPourable({beverage:void 0})),r==null||r()},[s,r]);return o.useEffect(()=>{const p=u.kosAutoEffect(()=>{if(!s)return;const v=s.selectedBrand;if(!v){const d=s.getGroupAvailabilityItems("beverages").filter(P=>P.visible);a(d??[]),t==null||t(d);return}const C=s.getAvailabilityByParent(v.id).filter(d=>d.visible);a(C??[]),t==null||t(C)});return()=>{p()}},[s]),{beverages:i,beverageCompanions:f,selectBeverage:c,selectedBeverage:l,clearBeverage:h}},Me=({onBrandSelected:e,onBrandCleared:t,companionType:r})=>{const{model:n}=$(),[s,i]=o.useState(null),[a,l]=o.useState([]),x=o.useMemo(()=>r?a.map(h=>u.getKosCompanionModel(h,r)):[],[a,r]),f=o.useCallback(async(h,p,v)=>{i(h),v&&u.KosLog.warn("forceUpdate is not currently supported when setting brand"),n==null||n.setSelectedBrand(h,p),e==null||e(h)},[n,e]),c=o.useCallback(()=>{i(null),n==null||n.setSelectedBrand(void 0),t==null||t()},[n,t]);return o.useEffect(()=>{const h=u.kosAutoEffect(()=>{n&&l(n.visibleBrands)});return()=>{h()}},[n]),{brands:a,brandCompanions:x,selectedBrand:s,selectBrand:f,clearBrand:c}};class ge{constructor(){Y(this,"_data",new Map)}get(t){return this._data.get(t)}set(t,r){this._data.set(t,r)}remove(t){this._data.delete(t)}has(t){return this._data.has(t)}}const at=u.KosLog.createLogger({name:"HoldToPourStrategy",group:"kos-hooks"}),Pe={name:"HoldToPourStrategy",async initiate(e){if(!(e!=null&&e.canPour)){at.debug(`Nozzle ${e==null?void 0:e.id} cannot pour. Returning early.`);return}await(e==null?void 0:e.pour())},async initiateEnded(e){await(e==null?void 0:e.cancelPour())}},re=u.KosLog.createLogger({name:"useNozzlePour",group:"kos-hooks"}),Ne=({onPour:e,onPourCancel:t,onBeforePour:r,onBeforePourRejected:n,pourContext:s,strategy:i=Pe})=>{const{model:a}=$(),[l,x]=o.useState(s||new ge),f=o.useCallback(async()=>{(r?await(r==null?void 0:r(l)):!0)?(re.debug(`[${i==null?void 0:i.name}] - Pour initiated for nozzle ${a==null?void 0:a.id}.`),i==null||i.initiate(a),e==null||e()):(re.debug(`[${i==null?void 0:i.name}] - Did not pass onBeforePour gate for nozzle ${a==null?void 0:a.id}. Cancelling pour.`),n==null||n())},[e,a,i,r,t,l,n]),c=o.useCallback(()=>{var d;re.debug(`[${i==null?void 0:i.name}] - Pour initiate ended called for nozzle ${a==null?void 0:a.id}.`),(d=i==null?void 0:i.initiateEnded)==null||d.call(i,a),t==null||t()},[t,a,i]),h=o.useCallback(()=>{re.debug(`Force cancelling pour for nozzle ${a==null?void 0:a.id}.`),a==null||a.cancelPour(),t==null||t()},[t,a]),p=o.useCallback((d,P)=>{l.set(d,P)},[l]),v=o.useCallback(d=>{l.remove(d)},[l]);return{handlers:u.usePressGesture({onPressed:f,onRelease:c}).dom,cancel:h,updatePourContext:p,removeFromPourContext:v,status:a}},He=({onFlavorSelected:e,onFlavorCleared:t,companionType:r})=>{const{model:n}=$(),s=o.useMemo(()=>(n==null?void 0:n.getGroupAvailabilityItems("flavors").filter(c=>c.visible))??[],[n]),i=o.useMemo(()=>r?s.map(c=>u.getKosCompanionModel(c,r)):[],[s,r]),[a,l]=o.useState([]),x=o.useCallback(async(c,h,p)=>{if(l(v=>v!=null&&v.includes(c)?[...v.filter(C=>C!==c)]:[...v??[],c]),n!=null&&n.selectedPourable){const{beverage:v}=n.selectedPourable;await n.setSelectedPourable({beverage:v,additional:a??[],context:h},p)}e==null||e(c,a??[])},[n,e,a]),f=o.useCallback(async()=>{if(l([]),n!=null&&n.selectedPourable){const{beverage:c}=n.selectedPourable;n.setSelectedPourable({beverage:c}),t==null||t()}},[n,t]);return{flavors:s,flavorCompanions:i,selectFlavor:x,selectedFlavors:a,clearFlavors:f}},V="brands",z="beverages",q="flavors",L=u.KosLog.createLogger({name:"use-cui-kit"}),Re=({initialGroup:e=V,options:t={}})=>{var ee,te,se;const[r,n]=o.useState(e),{model:s}=$(),i=o.useRef([]),a=o.useRef(),l=o.useRef(),x=o.useCallback(m=>{n(q);const T=`/kos/dispense/${s==null?void 0:s.path}/brand/selected/`;u.EventBus.publish(T,m)},[s==null?void 0:s.path]),f=o.useCallback(()=>{const m=`/kos/dispense/${s==null?void 0:s.path}/brand/cleared/`;u.EventBus.publish(m,{})},[s==null?void 0:s.path]),c=o.useCallback(m=>{const T=`/kos/dispense/${s==null?void 0:s.path}/beverage/list/updated/`;u.EventBus.publish(T,m)},[s==null?void 0:s.path]),h=o.useCallback(m=>{var Q;n(q),(Q=a.current)==null||Q.call(a,"selectedBeverage",m);const T=`/kos/dispense/${s==null?void 0:s.path}/beverage/selected/`;u.EventBus.publish(T,m)},[s==null?void 0:s.path]),p=o.useCallback(()=>{var T;const m=`/kos/dispense/${s==null?void 0:s.path}/beverage/cleared/`;(T=l.current)==null||T.call(l,"selectedBeverage"),u.EventBus.publish(m,{})},[s==null?void 0:s.path]),v=o.useCallback(m=>{const T=`/kos/dispense/${s==null?void 0:s.path}/flavor/selected/`;u.EventBus.publish(T,m)},[s==null?void 0:s.path]),C=o.useCallback(()=>{const m=`/kos/dispense/${s==null?void 0:s.path}/flavor/cleared/`;u.EventBus.publish(m,{})},[s==null?void 0:s.path]),d=o.useCallback(()=>{const m=`/kos/dispense/${s==null?void 0:s.path}/pour/`;u.EventBus.publish(m,{})},[s==null?void 0:s.path]),P=o.useCallback(async m=>{const T=`/kos/dispense/${s==null?void 0:s.path}/pre/pour/`;return u.EventBus.publish(T,{}),await(j==null?void 0:j(m))||!0},[s==null?void 0:s.path]),K=o.useCallback(async()=>{const m=`/kos/dispense/${s==null?void 0:s.path}/pre/pour/rejected/`;u.EventBus.publish(m,{})},[s==null?void 0:s.path]),N=o.useCallback(()=>{const m=`/kos/dispense/${s==null?void 0:s.path}/pour/cancel/`;u.EventBus.publish(m,{})},[s==null?void 0:s.path]),{brands:H,selectBrand:S,selectedBrand:U,clearBrand:R,brandCompanions:oe}=Me({companionType:(ee=t.companionTypes)==null?void 0:ee.brand,onBrandSelected:x,onBrandCleared:f}),{beverages:E,selectBeverage:y,selectedBeverage:W,clearBeverage:B,beverageCompanions:O}=Be({companionType:(te=t.companionTypes)==null?void 0:te.beverage,onBeverageSelected:h,onClearBeverage:p,onBeverageListUpdated:c}),{clearFlavors:k,flavors:A,selectFlavor:G,selectedFlavors:w,flavorCompanions:D}=He({companionType:(se=t.companionTypes)==null?void 0:se.flavor,onFlavorSelected:v,onFlavorCleared:C}),[j,F]=o.useState(),ae=o.useCallback(m=>{F(()=>m)},[]),J=Ne({onPour:d,onPourCancel:N,onBeforePour:P,onBeforePourRejected:K});a.current=J.updatePourContext,l.current=J.removeFromPourContext;const ie=o.useCallback(()=>{switch(L.debug(`Navigating back from group: ${r}`),r){case V:B(),R();break;case z:case q:n(e),B(),R();break}},[B,R,r,e]),ue=o.useCallback(()=>{const m=`/kos/dispense/${s==null?void 0:s.path}/home/`;u.EventBus.publish(m,{}),n(e),e===V&&(B(),R()),e===z&&B()},[B,R,e]),ce=o.useCallback(()=>{if(i.current.length===0){L.debug("No timers to pause.");return}L.debug(`Pausing ${i.current.length} timers.`),i.current.forEach(m=>{L.debug(`Pausing timer with id ${m.id}.`),m.pause()})},[]),le=o.useCallback(()=>{if(i.current.length===0){L.debug("No timers to restart.");return}L.debug(`Restarting ${i.current.length} timers.`),i.current.forEach(m=>{L.debug(`Restarting timer with id ${m.id}.`),m.restart()})},[]);return{timers:{add:o.useCallback(m=>{if(m){if(i.current.some(T=>T.id===m.id)){L.debug(`Timer with id ${m.id} already exists.`);return}i.current.push(m)}},[]),pause:ce,restart:le},nav:{currentGroup:r,back:ie,home:ue},pour:J,updateOnBeforePour:ae,selections:{[V]:U,[z]:W,[q]:w},[V]:{models:H,companions:oe,clear:R,handlers:{onSelected:S}},[z]:{models:E,companions:O,clear:B,handlers:{onSelected:y}},[q]:{models:A,companions:D,clear:k,handlers:{onSelected:G}}}},it=e=>{const{model:t}=$(),[r,n]=o.useState(null),{onAmbientTimer:s,onAttractTimer:i,onResetAttractTimer:a,onResumeAttractTimer:l,defaultAttractTime:x,defaultAmbientTime:f}=e,c=o.useCallback(()=>{s&&(u.KosLog.info("Ambient timer expired. Calling callback"),s==null||s())},[s]),h=o.useCallback(()=>{i&&(u.KosLog.info("Attract timer expired. Calling callback"),i==null||i())},[i]),p=o.useCallback(()=>{r&&(r.restart(),a==null||a())},[r,a]),v=o.useCallback(()=>{r&&(r.reset(),a==null||a())},[r,a]),C=o.useCallback(()=>{r&&(r.pause(),l==null||l())},[r,l]);return o.useEffect(()=>{if(t&&x){u.KosLog.info("Nozzle is available. Creating timers");const d=u.TimerManager.createTimer("attract-timer-"+t.path,x);return x&&(d==null||d.addTimeoutAction({name:"attract-timer",remainingTime:0,action:h})),f&&(d==null||d.addTimeoutAction({name:"ambient-timer",remainingTime:f,action:c})),x&&(d==null||d.start()),n(d??null),()=>{d==null||d.reset(),n(null)}}return()=>{u.KosLog.info("Nozzle is not available. No timers to clear")}},[f,x,c,h,t]),{attractTimer:r,restart:p,pause:v,resume:C}},ut=[{path:"brand/selected",callbackKey:"onBrandSelected"},{path:"brand/cleared",callbackKey:"onBrandCleared"},{path:"beverage/list/updated",callbackKey:"onBeverageListUpdated"},{path:"beverage/selected",callbackKey:"onBeverageSelected"},{path:"beverage/cleared",callbackKey:"onBeverageCleared"},{path:"flavor/selected",callbackKey:"onFlavorSelected"},{path:"flavor/cleared",callbackKey:"onFlavorCleared"},{path:"pour",callbackKey:"onPour"},{path:"pour/cancel",callbackKey:"onPourCancel"},{path:"pre/pour/rejected",callbackKey:"onBeforePourRejected"},{path:"ambient/start",callbackKey:"onAmbientTimer"},{path:"attract/start",callbackKey:"onAttractTimer"},{path:"attract/resume",callbackKey:"onResumeAttractTimer"},{path:"idle/timeout",callbackKey:"onIdleTimeout"},{path:"are-you-there/timeout",callbackKey:"onAreYouThereTimeout"},{path:"init",callbackKey:"onInit"},{path:"home",callbackKey:"onReturnToHome"}];function ct(e,t){return e?ut.filter(r=>t[r.callbackKey]!==void 0).map(r=>({topic:`/kos/dispense/${e}/${r.path}/`,callback:t[r.callbackKey]})):[]}const lt=(e,t)=>{if(t){const r=s=>{s&&s.body&&t(s.body)};return u.EventBus.subscribe(e,r).unsubscribe}},je=({onInit:e,onBrandSelected:t,onBrandCleared:r,onBeverageCleared:n,onBeverageSelected:s,onBeverageListUpdated:i,onFlavorCleared:a,onFlavorSelected:l,onReturnToHome:x,onPour:f,onPourCancel:c,onBeforePourRejected:h,onAmbientTimer:p,onAttractTimer:v,onResumeAttractTimer:C,onIdleTimeout:d,onAreYouThereTimeout:P})=>{const{model:K}=$();o.useEffect(()=>{const H=ct(K==null?void 0:K.path,{onBrandSelected:t,onBrandCleared:r,onBeverageListUpdated:i,onBeverageSelected:s,onBeverageCleared:n,onFlavorSelected:l,onFlavorCleared:a,onPour:f,onPourCancel:c,onBeforePourRejected:h,onAmbientTimer:p,onAttractTimer:v,onResumeAttractTimer:C,onIdleTimeout:d,onAreYouThereTimeout:P,onInit:e,onReturnToHome:x}).map(({topic:S,callback:U})=>lt(S,U));return()=>{H.forEach(S=>S==null?void 0:S())}},[K==null?void 0:K.path,p,v,n,s,i,r,t,a,l,f,c,h,C,d,P,e,x])},M=u.KosLog.createLogger({name:"useCuiKitTimers"}),he=e=>{const{model:t}=$(),[r,n]=o.useState(null),{onAreYouThereTimer:s,onIdleTimer:i,onResetIdleTimer:a,defaultAreYouThereTime:l=10,defaultIdleTime:x=20}=e,f=o.useRef(!1),c=o.useCallback(()=>{!f.current&&s&&(u.KosLog.info("Are you there timer expired. Calling callback"),f.current=!0,s==null||s())},[s]),h=o.useCallback(()=>{M.debug("handleIdleTimer called in useCuiKitTimers, onIdleTimer exists:",!!i),i?(M.debug("Idle timer expired. Calling callback"),i==null||i()):M.debug("No onIdleTimer callback provided!")},[i]),p=o.useCallback(()=>{M.debug(`TIMER RESTART called for ${e.prefix??""}timer`),r&&(r.restart(),f.current=!1,a==null||a())},[r,a,e.prefix]),v=o.useCallback(()=>{M.debug(`TIMER PAUSE/RESET called for ${e.prefix??""}timer`),r&&(r.reset(),f.current=!1,a==null||a())},[r,a,e.prefix]);return o.useEffect(()=>{if(M.debug(`useCuiKitTimers effect triggered - nozzle: ${!!t}, path: ${t==null?void 0:t.path}, callbacks: handleIdle=${!!h}, handleAreYouThere=${!!c}`),t){M.info("Nozzle is available. Creating timers");const C=u.TimerManager.createTimer(`${e.prefix??""}idle-timer-${t.path}`,x);return M.debug(`Adding idle timer action for ${e.prefix??""}idle-timer-${t.path} with callback:`,!!h),C==null||C.addTimeoutAction({name:"idle-timer",remainingTime:0,action:h}),C==null||C.addTimeoutAction({name:"are-you-there-timer",remainingTime:l,action:c}),n(C??null),()=>{C==null||C.reset(),n(null)}}return()=>{M.info("Nozzle is not available. No timers to clear")}},[l,x,c,h,t,e.prefix]),{idleTimer:r,restart:p,pause:v}},_=u.KosLog.createLogger({name:"useDefaultCuiKitLifecycle"}),dt=({kit:e,inactivity:t,pour:r,screens:n,onBeforeAreYouThereTimer:s,areYouThereRejectionPolicy:i="pause"})=>{var m,T,Q,Ee;const[a,l]=o.useState(!1),[x,f]=o.useState(!1),{model:c}=$(),[h,p]=o.useState(!1),v=(t==null?void 0:t.idleTimeout)??15,C=(t==null?void 0:t.areYouThereTimeoutOffset)??10,d=(r==null?void 0:r.idleTimeout)??(t==null?void 0:t.idleTimeout)??10,P=(r==null?void 0:r.areYouThereTimeoutOffset)??(t==null?void 0:t.areYouThereTimeoutOffset)??5,K=n==null?void 0:n.ambientTimeoutOffset,N=n==null?void 0:n.attractTimeout,H=o.useCallback(()=>{if(_.info("handleIdleTimeout called - navigating home and publishing event"),O(!1),e==null||e.nav.home(),c){const I=`/kos/dispense/${c.path}/idle/timeout/`;u.EventBus.publish(I,{})}},[(m=e==null?void 0:e.nav)==null?void 0:m.home,c]),S=o.useCallback(()=>{_.info("handleResetIdleTimer called - resetting idle timer"),O(!1)},[]),U=o.useCallback(()=>{if(K&&(l(!0),f(!1),c)){const I=`/kos/dispense/${c.path}/ambient/start/`;u.EventBus.publish(I,{})}},[K,c]),R=o.useCallback(()=>{if(N&&(f(!0),l(!1),c)){const I=`/kos/dispense/${c.path}/attract/start/`;u.EventBus.publish(I,{})}},[N,c]),oe=o.useCallback(()=>{if(N&&(f(!1),l(!1),e==null||e.nav.home(),c)){const I=`/kos/dispense/${c.path}/attract/resume/`;u.EventBus.publish(I,{})}},[e==null?void 0:e.nav,N,c]),{pause:E,restart:y,attractTimer:W}=it({defaultAmbientTime:K,defaultAttractTime:N,onAmbientTimer:U,onAttractTimer:R,onResumeAttractTimer:oe});(T=e==null?void 0:e.timers)==null||T.add(W);const[B,O]=o.useState(!1);_.info("Creating idle timer with timeout:",v,"seconds and callback:",!!H);const{pause:k,restart:A,idleTimer:G}=he({defaultAreYouThereTime:C,defaultIdleTime:v,onIdleTimer:H,onResetIdleTimer:S});_.info(`Creating pour timer with timeout: ${d} seconds and callback: ${!!H}`);const{pause:w,restart:D,idleTimer:j}=he({defaultAreYouThereTime:P,defaultIdleTime:d,onIdleTimer:H,prefix:"pour-"}),F=o.useCallback(async()=>{let I=!0;if(s)try{I=await s()}catch(de){_.error(`onBeforeAreYouThereTimer callback failed: ${de}`),I=!1}if(I){if(c){const de=`/kos/dispense/${c.path}/are-you-there/timeout/`;u.EventBus.publish(de,{})}O(!0),h?w():k()}else switch(i){case"pause":h?w():k();break;case"restart":h?D():A();break}},[s,c,i,h]),ae=o.useCallback(()=>{O(!1),E(),h?(D(),k()):(A(),w())},[h,k,w,A,D]);o.useEffect(()=>{G&&G.addTimeoutAction({name:"are-you-there-timer",remainingTime:C,action:F})},[G,C,F]),o.useEffect(()=>{j&&j.addTimeoutAction({name:"pour-are-you-there-timer",remainingTime:P,action:F})},[j,P,F]),(Q=e==null?void 0:e.timers)==null||Q.add(G),(Ee=e==null?void 0:e.timers)==null||Ee.add(j);const J=o.useCallback(()=>{p(!1),w(),k(),E()},[k,w]),ie=o.useCallback(()=>{p(!0),_.info("restarting pour timer"),D(),E(),k()},[k,D]),ue=o.useCallback(()=>{p(!1),_.info("restarting pour timer on before pour rejected"),w(),A()},[]),ce=o.useCallback(()=>{E(),f(!1),l(!1),A()},[E,A]),le=o.useCallback(()=>{f(!1),l(!1),p(!1),w(),y()},[y,w]),Ae=o.useCallback(()=>{f(!1),l(!1),p(!1),E(),A()},[E,A]),ee=o.useCallback(()=>{f(!1),l(!1),p(!1),y(),k(),w()},[y,k,w]),te=o.useCallback(()=>{f(!1),l(!1),y(),k()},[y,k]);je({onBrandSelected:ce,onBrandCleared:le,onBeverageSelected:Ae,onBeverageCleared:ee,onPour:J,onPourCancel:ie,onBeforePourRejected:ue,onInit:te});const se=h?P:C;return o.useEffect(()=>{if(c&&W){const I=`/kos/dispense/${c==null?void 0:c.path}/init/`;u.EventBus.publish(I,{})}},[c,W]),{showAreYouThere:B,clearAreYouThere:ae,pauseIdleTimer:k,restartIdleTimer:A,areYouThereCountdown:se,showAmbientScreen:a,showAttractScreen:x,pauseScreenTimer:E,restartScreenTimer:y}},Te=()=>{const e=g.DeviceAssembly.type;return u.useKosModel({modelId:e,modelType:g.DeviceAssembly.type,options:{}})};function mt(e){return t=>{const{model:r,status:n,KosModelLoader:s}=Te();return b.jsx(s,{...n,children:b.jsx(e,{...t,deviceAssembly:r})})}}const ke=e=>{const t=e;return u.useKosModel({modelId:t,modelType:g.Holder.type,options:{}})};function bt(e,t){return r=>{const{model:n,status:s,KosModelLoader:i}=ke(e);return b.jsx(i,{...s,children:b.jsx(t,{...r,holder:n})})}}const we=()=>{const e=g.HolderContainer.type;return u.useKosModel({modelId:e,modelType:g.HolderContainer.type,options:{}})};function ht(e){return t=>{const{model:r,status:n,KosModelLoader:s}=we();return b.jsx(s,{...n,children:b.jsx(e,{...t,holderContainer:r})})}}const Ie=()=>{const e=g.Ingredient.type;return u.useKosModel({modelId:e,modelType:g.Ingredient.type,options:{}})},me=u.KosLog.createLogger({name:"HoldToPourIntentStrategy",group:"kos-hooks"}),Le={name:"HoldToPourIntentStrategy",async initiate(e,t){if(!(e!=null&&e.canPour)){me.debug(`${e==null?void 0:e.id} cannot pour. Returning early.`);return}t?(me.debug(`performing intent: ${t}`),await(e==null?void 0:e.performIntent(t))):me.debug("no intent provided. Returning early.")},async initiateEnded(e){await(e==null?void 0:e.cancelPour())}},be=u.KosLog.createLogger({name:"useNozzlePour",group:"kos-hooks"}),ft=({onPour:e,onPourCancel:t,intentContainer:r,strategy:n=Le})=>{const s=o.useCallback(()=>{be.debug(`[${n==null?void 0:n.name}] - Pour initiated for model ${r==null?void 0:r.id}.`),n==null||n.initiate(r),e==null||e()},[e,r,n]),i=o.useCallback(()=>{var x;be.debug(`[${n==null?void 0:n.name}] - Pour initiate ended called for nozzle ${r==null?void 0:r.id}.`),(x=n==null?void 0:n.initiateEnded)==null||x.call(n,r),t==null||t()},[t,r,n]),a=o.useCallback(()=>{be.debug(`Force cancelling pour for nozzle ${r==null?void 0:r.id}.`),r==null||r.cancelPour(),t==null||t()},[t,r]);return{handlers:u.usePressGesture({onPressed:s,onRelease:i}).dom,cancel:a,status:r}};function pt(e){return t=>{const{model:r,status:n,KosModelLoader:s}=Ie();return b.jsx(s,{...n,children:b.jsx(e,{...t,ingredient:r})})}}const Ke=()=>{const e=g.IngredientContainer.type;return u.useKosModel({modelId:e,modelType:g.IngredientContainer.type,options:{}})};function Ct(e){return t=>{const{model:r,status:n,KosModelLoader:s}=Ke();return b.jsx(s,{...n,children:b.jsx(e,{...t,ingredientContainer:r})})}}function vt(e,t){return r=>{const{model:n,status:s,KosModelLoader:i}=xe(e);return b.jsx(i,{...s,children:b.jsx(t,{...r,nozzle:n})})}}const X=u.KosLog.createLogger({name:"usePour",group:"kos-hooks"}),xt=({onBeforePour:e,onPour:t,onPourCancel:r,onPourAbort:n,pourTarget:s,pourContext:i,strategy:a=Pe})=>{const[l,x]=o.useState(i||new ge),f=o.useCallback(async()=>{X.debug(`[${a==null?void 0:a.name}] - calling before pour for pour target ${s==null?void 0:s.id}.`),(e?await(e==null?void 0:e(l)):!0)?(X.debug(`[${a==null?void 0:a.name}] - Pour initiated for pour target ${s==null?void 0:s.id}.`),await(a==null?void 0:a.initiate(s)),t==null||t(),s!=null&&s.isPouring||n==null||n()):(X.debug(`[${a==null?void 0:a.name}] - Pour cancelled for pour target ${s==null?void 0:s.id}.`),r==null||r())},[t,e,n,s,a,l]),c=o.useCallback(async()=>{var P;X.debug(`[${a==null?void 0:a.name}] - Pour initiate ended called for pour target ${s==null?void 0:s.id}.`),await((P=a==null?void 0:a.initiateEnded)==null?void 0:P.call(a,s))||r==null||r()},[r,s,a]),h=o.useCallback(async()=>{X.debug(`Force cancelling pour for pour target ${s==null?void 0:s.id}.`),await(s==null?void 0:s.cancelPour()),r==null||r()},[r,s]),p=o.useCallback((d,P)=>{l.set(d,P)},[l]),v=o.useCallback(d=>{l.remove(d)},[l]);return{handlers:u.usePressGesture({onPressed:f,onRelease:c}).dom,cancel:h,updatePourContext:p,removeFromPourContext:v,status:s}},Z=u.KosLog.createLogger({name:"TapOrHoldIntentStrategy",group:"kos-hooks"});class gt{constructor(t){Y(this,"intent");Y(this,"name","TapOrHoldIntentStrategy");Y(this,"isHold",!1);Y(this,"disposer",null);this.intent=t}async initiate(t,r){if(this.disposer=setTimeout(()=>{this.isHold=!0},250),t!=null&&t.isPouring&&!this.isHold){Z.debug("additional tap detected. cancelling pour"),await t.cancelPour();return}if(!(t!=null&&t.canPour)){Z.debug(`${t==null?void 0:t.id} cannot pour. Returning early.`);return}r?(Z.debug(`performing intent: ${r}`),await(t==null?void 0:t.performIntent(r))):Z.debug("no intent provided. Returning early.")}async initiateEnded(t){return this.disposer&&clearTimeout(this.disposer),this.disposer=null,this.isHold?(await(t==null?void 0:t.cancelPour()),!1):(Z.debug("Tap detected. don't cancel and return."),!0)}}const ne=u.KosLog.createLogger({name:"TapToPourIntentStrategy",group:"kos-hooks"}),Pt={name:"TapToPourIntentStrategy",async initiate(e,t){if(e!=null&&e.isPouring){ne.debug(`Nozzle ${e==null?void 0:e.id} is already pouring. cancelling pour`),await e.cancelPour();return}if(!(e!=null&&e.canPour)){ne.debug(`Nozzle ${e==null?void 0:e.id} cannot pour. Returning early.`);return}t?(ne.debug(`performing intent: ${t}`),await(e==null?void 0:e.performIntent(t))):ne.debug("no intent provided. Returning early.")},async initiateEnded(e){return!0}},$e=u.KosLog.createLogger({name:"HoldToPourStrategy",group:"kos-hooks"}),Tt={name:"TapToPourStrategy",async initiate(e){if(e!=null&&e.isPouring){$e.debug(`Nozzle ${e==null?void 0:e.id} is already pouring. cancelling pour`),await e.cancelPour();return}if(!(e!=null&&e.canPour)){$e.debug(`Nozzle ${e==null?void 0:e.id} cannot pour. Returning early.`);return}await(e==null?void 0:e.pour())},async initiateEnded(e){return!0}},De=(e,t,r,n)=>{const s=e;return u.useKosModel({modelId:s,modelType:g.GenericPour.type,forceUpdate:!0,options:{servicePathFactory:t,selectedId:r,initialData:n}})};function kt(e){return t=>{const{model:r,status:n,KosModelLoader:s}=De(t.id,t.servicePathFactory,t.itemId);return b.jsx(s,{...n,children:b.jsx(e,{...t,genericPour:r})})}}const _e=o.createContext(void 0),wt=({children:e})=>{const{model:t,ready:r}=fe(),n=o.useMemo(()=>r&&t?{model:t}:{},[r,t]);return b.jsx(_e.Provider,{value:n,children:e})},It=()=>{const e=o.useContext(_e);if(!e)throw new Error("useAssemblyContext must be used within a AssemblyProvider");return e},Oe=o.createContext(void 0),Kt=({children:e})=>{const{model:t,ready:r}=pe(),n=o.useMemo(()=>r&&t?{model:t}:{},[r,t]);return b.jsx(Oe.Provider,{value:n,children:e})},At=()=>{const e=o.useContext(Oe);if(!e)throw new Error("useAvailabilityContext must be used within a AvailabilityProvider");return e},Ge=o.createContext(void 0),Et=({children:e,id:t})=>{const{model:r,ready:n}=Ce(t),s=o.useMemo(()=>n&&r?{model:r}:{},[n,r]);return b.jsx(Ge.Provider,{value:s,children:e})},$t=()=>{const e=o.useContext(Ge);if(!e)throw new Error("useBoardContext must be used within a BoardProvider");return e},Fe=o.createContext(void 0),St=({children:e})=>{const{model:t,ready:r}=ve(),n=o.useMemo(()=>r&&t?{model:t}:{},[r,t]);return b.jsx(Fe.Provider,{value:n,children:e})},yt=()=>{const e=o.useContext(Fe);if(!e)throw new Error("useBoardContainerContext must be used within a BoardContainerProvider");return e},Ye=o.createContext(void 0),Ve=({children:e})=>{const{model:t,ready:r}=Te(),n=o.useMemo(()=>{if(r&&t){const i=t.nozzlePaths;return{model:t,nozzlePaths:i}}return{}},[r,t]),s=r&&t?e:null;return b.jsx(Ye.Provider,{value:n,children:s})},qe=()=>{const e=o.useContext(Ye);if(!e)throw new Error("useDeviceAssemblyContext must be used within a DeviceAssemblyProvider");return e};function Bt(){const e=o.createContext(null);return[()=>{const r=o.useContext(e);if(r===void 0)throw new Error("useDispenseKitContext must be used within a Provider");return r},e.Provider]}function Ue({children:e,provider:t,props:r,nozzleProps:n}){const s=Re(r);return b.jsx(t,{value:s,children:e(n||{})})}function Mt({children:e,provider:t,props:r}){const{nozzlePaths:n}=qe(),s=(n==null?void 0:n.length)||0;return(n==null?void 0:n.map((a,l)=>b.jsx(ye,{path:a,children:b.jsx(Ue,{provider:t,props:r,nozzleProps:{nozzleIndex:l,nozzlePath:a,totalNozzles:s,isFirstNozzle:l===0,isLastNozzle:l===s-1},children:e})},a)))||[]}function We({provider:e,props:t}){return({children:r})=>e?b.jsx(Ve,{children:b.jsx(Mt,{provider:e,props:t,children:r})}):null}function Nt(e){const[t,r]=Bt();return[t,We({provider:r,props:e})]}const Je=o.createContext(void 0),Ht=({children:e,id:t})=>{const{model:r,ready:n}=ke(t||""),s=o.useMemo(()=>n&&r?{model:r}:{},[n,r]);return b.jsx(Je.Provider,{value:s,children:e})},Rt=()=>{const e=o.useContext(Je);if(!e)throw new Error("useHolderContext must be used within a HolderProvider");return e},Qe=o.createContext(void 0),jt=({children:e})=>{const{model:t,ready:r}=we(),n=o.useMemo(()=>r&&t?{model:t}:{},[r,t]);return b.jsx(Qe.Provider,{value:n,children:e})},Lt=()=>{const e=o.useContext(Qe);if(!e)throw new Error("useHolderContainerContext must be used within a HolderContainerProvider");return e},Xe=o.createContext(void 0),Dt=({children:e})=>{const{model:t,ready:r}=Ie(),n=o.useMemo(()=>r&&t?{model:t}:{},[r,t]);return b.jsx(Xe.Provider,{value:n,children:e})},_t=()=>{const e=o.useContext(Xe);if(!e)throw new Error("useIngredientContext must be used within a IngredientProvider");return e},Ze=o.createContext(void 0),Ot=({children:e})=>{const{model:t,ready:r}=Ke(),n=o.useMemo(()=>r&&t?{model:t}:{},[r,t]);return b.jsx(Ze.Provider,{value:n,children:e})},Gt=()=>{const e=o.useContext(Ze);if(!e)throw new Error("useIngredientContainerContext must be used within a IngredientContainerProvider");return e},Ft=()=>{const e=g.Pump.type;return u.useKosModel({modelId:e,modelType:g.Pump.type,options:{}})},ze=o.createContext(void 0),Yt=({children:e})=>{const{model:t,ready:r}=Ft(),n=o.useMemo(()=>r&&t?{model:t}:{},[r,t]);return b.jsx(ze.Provider,{value:n,children:e})},Vt=()=>{const e=o.useContext(ze);if(!e)throw new Error("usePumpContext must be used within a PumpProvider");return e};exports.AssemblyProvider=wt;exports.AvailabilityProvider=Kt;exports.BoardContainerProvider=St;exports.BoardProvider=Et;exports.CuiKit=We;exports.CuiKitWrapper=Ue;exports.DISPENSE_GROUP_BEVERAGE=z;exports.DISPENSE_GROUP_BRAND=V;exports.DISPENSE_GROUP_FLAVOR=q;exports.DeviceAssemblyProvider=Ve;exports.HoldToPourIntentStrategy=Le;exports.HoldToPourStrategy=Pe;exports.HolderContainerProvider=jt;exports.HolderProvider=Ht;exports.IngredientContainerProvider=Ot;exports.IngredientProvider=Dt;exports.NozzleProvider=ye;exports.PourContext=ge;exports.PumpProvider=Yt;exports.TapOrHoldIntentStrategy=gt;exports.TapToPourIntentStrategy=Pt;exports.TapToPourStrategy=Tt;exports.initializeCuiKit=Nt;exports.useAssembly=fe;exports.useAssemblyContext=It;exports.useAvailability=pe;exports.useAvailabilityContext=At;exports.useBeverages=Be;exports.useBoard=Ce;exports.useBoardContainer=ve;exports.useBoardContainerContext=yt;exports.useBoardContext=$t;exports.useBrands=Me;exports.useCuiKit=Re;exports.useCuiKitTimers=he;exports.useDefaultCuiKitLifecycle=dt;exports.useDeviceAssembly=Te;exports.useDeviceAssemblyContext=qe;exports.useDispenseLifecycle=je;exports.useFlavors=He;exports.useGenericPour=De;exports.useHolder=ke;exports.useHolderContainer=we;exports.useHolderContainerContext=Lt;exports.useHolderContext=Rt;exports.useIngredient=Ie;exports.useIngredientContainer=Ke;exports.useIngredientContainerContext=Gt;exports.useIngredientContext=_t;exports.useIngredientPour=ft;exports.useNozzle=xe;exports.useNozzleContext=$;exports.useNozzlePour=Ne;exports.usePourTarget=xt;exports.usePumpContext=Vt;exports.withAssembly=st;exports.withBeverage=rt;exports.withBoard=nt;exports.withBoardContainer=ot;exports.withDeviceAssembly=mt;exports.withGenericPour=kt;exports.withHolder=bt;exports.withHolderContainer=ht;exports.withIngredient=pt;exports.withIngredientContainer=Ct;exports.withNozzle=vt;
|
|
2
|
+
//# sourceMappingURL=pump-provider-C-6CuGgY.cjs.map
|