@kosdev-code/kos-freestyle-sdk 2.0.33 → 2.0.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/{extension-utils-ua-l7F5-.js → extension-utils-B4aRuLqC.js} +2 -2
- package/{extension-utils-ua-l7F5-.js.map → extension-utils-B4aRuLqC.js.map} +1 -1
- package/{extension-utils-VVeh-q52.cjs → extension-utils-BY9yhVLb.cjs} +2 -2
- package/{extension-utils-VVeh-q52.cjs.map → extension-utils-BY9yhVLb.cjs.map} +1 -1
- package/freestyle-registration-manager-CI8el36E.js +1111 -0
- package/freestyle-registration-manager-CI8el36E.js.map +1 -0
- package/freestyle-registration-manager-Dbdeo0JU.cjs +2 -0
- package/freestyle-registration-manager-Dbdeo0JU.cjs.map +1 -0
- package/index.cjs +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +20 -18
- package/models/models/freestyle-assembly/freestyle-assembly-model.d.ts +6 -1
- package/models/models/freestyle-assembly/freestyle-assembly-model.d.ts.map +1 -1
- package/models/models/freestyle-holder/freestyle-holder-model.d.ts +2 -0
- package/models/models/freestyle-holder/freestyle-holder-model.d.ts.map +1 -1
- package/models/models/remote-tray/index.d.ts +6 -0
- package/models/models/remote-tray/index.d.ts.map +1 -0
- package/models/models/remote-tray/remote-tray-container-model.d.ts +21 -0
- package/models/models/remote-tray/remote-tray-container-model.d.ts.map +1 -0
- package/models/models/remote-tray/remote-tray-container-registration.d.ts +87 -0
- package/models/models/remote-tray/remote-tray-container-registration.d.ts.map +1 -0
- package/models/models/remote-tray/remote-tray-model.d.ts +175 -0
- package/models/models/remote-tray/remote-tray-model.d.ts.map +1 -0
- package/models/models/remote-tray/remote-tray-registration.d.ts +90 -0
- package/models/models/remote-tray/remote-tray-registration.d.ts.map +1 -0
- package/models/models/remote-tray/types/index.d.ts +10 -0
- package/models/models/types/assembly.d.ts +5 -0
- package/models/models/types/assembly.d.ts.map +1 -1
- package/models/utils/extensions/assembly/assembly-data-mapper.d.ts.map +1 -1
- package/models/utils/extensions/assembly/types.d.ts +5 -0
- package/models/utils/extensions/assembly/types.d.ts.map +1 -1
- package/models/utils/freestyle-registration-manager.d.ts.map +1 -1
- package/models.cjs +1 -1
- package/models.js +3 -3
- package/package.json +4 -4
- package/ui.cjs +1 -1
- package/ui.js +2 -2
- package/{use-nutrition-info-CnB4QbnQ.cjs → use-nutrition-info-BqyF2EOl.cjs} +2 -2
- package/{use-nutrition-info-CnB4QbnQ.cjs.map → use-nutrition-info-BqyF2EOl.cjs.map} +1 -1
- package/{use-nutrition-info-i7otBVPd.js → use-nutrition-info-uacoD9lS.js} +2 -2
- package/{use-nutrition-info-i7otBVPd.js.map → use-nutrition-info-uacoD9lS.js.map} +1 -1
- package/freestyle-registration-manager-BNSA2Xyl.cjs +0 -2
- package/freestyle-registration-manager-BNSA2Xyl.cjs.map +0 -1
- package/freestyle-registration-manager-CBMdfM3_.js +0 -920
- package/freestyle-registration-manager-CBMdfM3_.js.map +0 -1
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { RemoteTrayOptions } from './types';
|
|
2
|
+
import { ActiveAware } from '../types/assembly';
|
|
3
|
+
import { HolderModel } from '@kosdev-code/kos-dispense-sdk';
|
|
4
|
+
import { IKosDataModel, IKosIdentifiable, KosConfigProperty, KosCreationContext, PublicModelInterface, TroubleAware, TroubleModel } from '@kosdev-code/kos-ui-sdk';
|
|
5
|
+
|
|
6
|
+
export declare const MODEL_TYPE = "remote-tray-model";
|
|
7
|
+
/**
|
|
8
|
+
* Model for managing remote tray configurations in the KOS Freestyle system.
|
|
9
|
+
*
|
|
10
|
+
* A remote tray represents a physical or virtual tray that can be enabled/disabled
|
|
11
|
+
* remotely and is associated with a holder in the dispensing system. This model
|
|
12
|
+
* manages the tray's configuration, activation state, and trouble propagation
|
|
13
|
+
* from its associated holder.
|
|
14
|
+
*
|
|
15
|
+
* ## Key Features
|
|
16
|
+
* - Remote enable/disable capability through configuration properties
|
|
17
|
+
* - Automatic trouble propagation from associated holder
|
|
18
|
+
* - Active state management based on configuration
|
|
19
|
+
* - Integration with the KOS dispensing system through holder references
|
|
20
|
+
*
|
|
21
|
+
* ## Properties
|
|
22
|
+
* - `id` - Unique identifier for the remote tray
|
|
23
|
+
* - `name` - Display name of the tray
|
|
24
|
+
* - `holderPath` - Path reference to the associated holder model
|
|
25
|
+
* - `configPath` - Configuration path for tray settings
|
|
26
|
+
* - `remoteTrayEnabled` - Configuration property controlling tray activation
|
|
27
|
+
* - `active` - Computed property indicating if the tray is currently active
|
|
28
|
+
* - `holder` - Reference to the associated holder model
|
|
29
|
+
* - `troubles` - Propagated troubles from the associated holder
|
|
30
|
+
*
|
|
31
|
+
* ## Methods
|
|
32
|
+
* - `updateModel(options)` - Updates the model with new configuration options
|
|
33
|
+
* - `init()` - Initializes the remote tray model
|
|
34
|
+
* - `load()` - Loads the remote tray configuration and data
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* // Create a new remote tray instance
|
|
39
|
+
* const remoteTray = RemoteTray.instance('tray-1')
|
|
40
|
+
* .options({
|
|
41
|
+
* name: 'Remote Tray 1',
|
|
42
|
+
* holderPath: '/holders/holder-1',
|
|
43
|
+
* configPath: '/config/trays/tray-1'
|
|
44
|
+
* })
|
|
45
|
+
* .build();
|
|
46
|
+
*
|
|
47
|
+
* // Check if tray is active
|
|
48
|
+
* if (remoteTray.active) {
|
|
49
|
+
* console.log(`${remoteTray.name} is enabled`);
|
|
50
|
+
* }
|
|
51
|
+
*
|
|
52
|
+
* // Access associated holder
|
|
53
|
+
* const holder = remoteTray.holder;
|
|
54
|
+
* console.log(`Holder status: ${holder?.status}`);
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* // Monitor trouble states
|
|
60
|
+
* const TrayStatus = ({ tray }: { tray: RemoteTrayModel }) => {
|
|
61
|
+
* const troubles = tray.troubles;
|
|
62
|
+
* const isEnabled = tray.remoteTrayEnabled.value;
|
|
63
|
+
*
|
|
64
|
+
* return (
|
|
65
|
+
* <div>
|
|
66
|
+
* <h3>{tray.name}</h3>
|
|
67
|
+
* <p>Status: {isEnabled ? 'Enabled' : 'Disabled'}</p>
|
|
68
|
+
* {troubles.length > 0 && (
|
|
69
|
+
* <Alert severity="warning">
|
|
70
|
+
* {troubles.length} issue(s) detected
|
|
71
|
+
* </Alert>
|
|
72
|
+
* )}
|
|
73
|
+
* </div>
|
|
74
|
+
* );
|
|
75
|
+
* };
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```typescript
|
|
80
|
+
* // Programmatically enable/disable tray
|
|
81
|
+
* async function toggleRemoteTray(tray: RemoteTrayModel) {
|
|
82
|
+
* const currentState = tray.remoteTrayEnabled.value;
|
|
83
|
+
* await tray.remoteTrayEnabled.setValue(!currentState);
|
|
84
|
+
*
|
|
85
|
+
* console.log(`Tray ${tray.name} is now ${!currentState ? 'enabled' : 'disabled'}`);
|
|
86
|
+
* }
|
|
87
|
+
* ```
|
|
88
|
+
*
|
|
89
|
+
* @category KOS Model
|
|
90
|
+
* @subcategory Freestyle Models
|
|
91
|
+
*
|
|
92
|
+
* @see {@link HolderModel} - The associated holder model
|
|
93
|
+
* @see {@link ActiveAware} - Interface for active state management
|
|
94
|
+
* @see {@link TroubleAware} - Interface for trouble tracking
|
|
95
|
+
*/
|
|
96
|
+
export type RemoteTrayModel = PublicModelInterface<RemoteTrayModelImpl>;
|
|
97
|
+
/**
|
|
98
|
+
* Implementation class for RemoteTrayModel.
|
|
99
|
+
*
|
|
100
|
+
* @internal
|
|
101
|
+
* @category KOS Model
|
|
102
|
+
* @subcategory Freestyle Models
|
|
103
|
+
*/
|
|
104
|
+
export declare class RemoteTrayModelImpl implements IKosDataModel, IKosIdentifiable, ActiveAware, TroubleAware {
|
|
105
|
+
/** Unique identifier for the remote tray instance */
|
|
106
|
+
id: string;
|
|
107
|
+
private logger;
|
|
108
|
+
/** Path reference to the associated holder model */
|
|
109
|
+
holderPath: string;
|
|
110
|
+
/** Configuration path for tray-specific settings */
|
|
111
|
+
configPath: string;
|
|
112
|
+
/** Display name of the remote tray */
|
|
113
|
+
name: string;
|
|
114
|
+
/** Configuration property that controls whether the tray is enabled remotely */
|
|
115
|
+
remoteTrayEnabled: KosConfigProperty<boolean>;
|
|
116
|
+
constructor(modelId: string, options: RemoteTrayOptions, context: KosCreationContext);
|
|
117
|
+
/**
|
|
118
|
+
* Gets the troubles from the associated holder model.
|
|
119
|
+
* Propagates trouble states from the holder to this remote tray.
|
|
120
|
+
*
|
|
121
|
+
* @returns Array of trouble models from the holder, or empty array if no holder
|
|
122
|
+
*/
|
|
123
|
+
get troubles(): TroubleModel<any>[];
|
|
124
|
+
/**
|
|
125
|
+
* Gets the highest priority trouble status.
|
|
126
|
+
* Currently returns empty string as troubles are managed by the holder.
|
|
127
|
+
*
|
|
128
|
+
* @returns Empty string (trouble status handled by holder)
|
|
129
|
+
*/
|
|
130
|
+
get troubleStatus(): string;
|
|
131
|
+
/**
|
|
132
|
+
* Gets troubles grouped by type from the associated holder.
|
|
133
|
+
*
|
|
134
|
+
* @returns Record of troubles grouped by type from the holder, or empty object if no holder
|
|
135
|
+
*/
|
|
136
|
+
get troublesByType(): Record<string, TroubleModel<any>[]>;
|
|
137
|
+
/**
|
|
138
|
+
* Updates the model with new configuration options.
|
|
139
|
+
* Can be used to modify the holder path, config path, or name after initialization.
|
|
140
|
+
*
|
|
141
|
+
* @param _options - New configuration options for the remote tray
|
|
142
|
+
*/
|
|
143
|
+
updateModel(_options: RemoteTrayOptions): void;
|
|
144
|
+
/**
|
|
145
|
+
* Gets the associated holder model for this remote tray.
|
|
146
|
+
* Uses synchronous model lookup to retrieve the holder by path.
|
|
147
|
+
*
|
|
148
|
+
* @returns The HolderModel instance referenced by holderPath, or undefined if not found
|
|
149
|
+
*/
|
|
150
|
+
get holder(): HolderModel<any>;
|
|
151
|
+
/**
|
|
152
|
+
* Determines if the remote tray is currently active.
|
|
153
|
+
* Active state is based on the remoteTrayEnabled configuration property.
|
|
154
|
+
*
|
|
155
|
+
* @returns true if the tray is enabled, false otherwise
|
|
156
|
+
*/
|
|
157
|
+
get active(): boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Initializes the remote tray model.
|
|
160
|
+
* Called during the model lifecycle initialization phase.
|
|
161
|
+
* Sets up initial state and prepares the model for use.
|
|
162
|
+
*
|
|
163
|
+
* @returns Promise that resolves when initialization is complete
|
|
164
|
+
*/
|
|
165
|
+
init(): Promise<void>;
|
|
166
|
+
/**
|
|
167
|
+
* Loads the remote tray configuration and associated data.
|
|
168
|
+
* Called during the model lifecycle load phase.
|
|
169
|
+
* Typically loads configuration settings and establishes holder references.
|
|
170
|
+
*
|
|
171
|
+
* @returns Promise that resolves when loading is complete
|
|
172
|
+
*/
|
|
173
|
+
load(): Promise<void>;
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=remote-tray-model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-tray-model.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-freestyle-sdk/src/models/models/remote-tray/remote-tray-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EAEjB,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,EACZ,YAAY,EACb,MAAM,yBAAyB,CAAC;AAQjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,eAAO,MAAM,UAAU,sBAAsB,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwFG;AACH,MAAM,MAAM,eAAe,GAAG,oBAAoB,CAAC,mBAAmB,CAAC,CAAC;AAKxE;;;;;;GAMG;AACH,qBACa,mBACX,YAAW,aAAa,EAAE,gBAAgB,EAAE,WAAW,EAAE,YAAY;IAErE,qDAAqD;IACrD,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,MAAM,CAAmB;IAEjC,oDAAoD;IACpD,UAAU,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,UAAU,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,gFAAgF;IAKhF,iBAAiB,EAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;gBAG7C,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,kBAAkB;IAU7B;;;;;OAKG;IACH,IAAI,QAAQ,IAAI,YAAY,CAAC,GAAG,CAAC,EAAE,CAElC;IAED;;;;;OAKG;IACH,IAAI,aAAa,WAEhB;IAED;;;;OAIG;IACH,IAAI,cAAc,wCAEjB;IAED;;;;;OAKG;IACH,WAAW,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI;IAI9C;;;;;OAKG;IACH,IAAI,MAAM,qBAET;IAED;;;;;OAKG;IACH,IAAI,MAAM,IAAI,OAAO,CAEpB;IAID;;;;;;OAMG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B;;;;;;OAMG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAG5B"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { RemoteTrayModel } from './remote-tray-model';
|
|
2
|
+
import { RemoteTrayOptions } from './types';
|
|
3
|
+
import { KosModelRegistrationFactory } from '@kosdev-code/kos-ui-sdk';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* # RemoteTray
|
|
7
|
+
*
|
|
8
|
+
* The registration bean includes convenience methods for creating and working with RemoteTrayModel instances.
|
|
9
|
+
|
|
10
|
+
*
|
|
11
|
+
* ## type
|
|
12
|
+
* The type property is a string that identifies the model type.
|
|
13
|
+
* The type is used to identify the model type in the model registry and to narrow down the model type in type predicates. It's most frequently
|
|
14
|
+
* used when declaring dependencies on models.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
*
|
|
19
|
+
* @kosDependency({modelType: RemoteTray.type, id: "remoteTrayId"})
|
|
20
|
+
* private remoteTrayModel: RemoteTrayModel;
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
*
|
|
24
|
+
* ## factory
|
|
25
|
+
*
|
|
26
|
+
* The factory method creates a factory function that can be used to create new RemoteTrayModel instances.
|
|
27
|
+
*
|
|
28
|
+
|
|
29
|
+
* The factory function is a curried function that takes the model id as the first argument and the options as the second argument.
|
|
30
|
+
*
|
|
31
|
+
* If a model with the specified id already exists, the factory function will return the existing model. The options will be ignored
|
|
32
|
+
* in this case and the existing model will be returned in its current state.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* const model = RemoteTray.factory("remoteTrayId")({
|
|
37
|
+
* // Add option data
|
|
38
|
+
* });
|
|
39
|
+
|
|
40
|
+
* ```
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
*
|
|
44
|
+
* ## predicate
|
|
45
|
+
*
|
|
46
|
+
* [Typescript type predicate](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates) function that will identify and narrow down a model to a RemoteTrayModel.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
*
|
|
51
|
+
* const model: IKosDataModel = ...; // some model
|
|
52
|
+
*
|
|
53
|
+
* if (RemoteTray.predicate(model)) {
|
|
54
|
+
* // if the function evaluates to true, the model is narrowed down to RemoteTrayModel
|
|
55
|
+
* // and the compiler will know that the model has the RemoteTrayModel interface
|
|
56
|
+
* model.updateAvailability(false);
|
|
57
|
+
|
|
58
|
+
* }
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* ## registration
|
|
62
|
+
*
|
|
63
|
+
* The registration property is an object that can be used to simplify registration of the model with the model registry. The registration object
|
|
64
|
+
* can be spread into the model registration and provides all of the required information to register the model implementation class against the model type.
|
|
65
|
+
*
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
*
|
|
69
|
+
* In an application registration file you can declare the model registration as follows:
|
|
70
|
+
*
|
|
71
|
+
* **registration.ts**
|
|
72
|
+
* ```typescript
|
|
73
|
+
* import { RemoteTray } from "@kos-ui/project-models";
|
|
74
|
+
* import { KosModelRegistry } from "@kosdev-code/kos-dispense-sdk";
|
|
75
|
+
*
|
|
76
|
+
* import { initKosProvider } from "@kosdev-code/kos-ui-sdk";
|
|
77
|
+
*
|
|
78
|
+
* KosModelRegistry.dispense
|
|
79
|
+
* .models()
|
|
80
|
+
* .model(RemoteTray);
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* ## registration.singleton
|
|
84
|
+
|
|
85
|
+
* The remoteTray model is NOT a singleton model. This means that each time the factory function is called with a unique ID, a new model instance will be created.
|
|
86
|
+
* If the factory function is called with an ID that already exists, the existing model will be returned.
|
|
87
|
+
|
|
88
|
+
* */
|
|
89
|
+
export declare const RemoteTray: KosModelRegistrationFactory<RemoteTrayModel, RemoteTrayOptions>;
|
|
90
|
+
//# sourceMappingURL=remote-tray-registration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-tray-registration.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-freestyle-sdk/src/models/models/remote-tray/remote-tray-registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAGL,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAmFK;AACL,eAAO,MAAM,UAAU,iEAMrB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RemoteTrayContainerModel } from '../remote-tray';
|
|
1
2
|
import { IceAgitatorModel } from '../ice-agitator';
|
|
2
3
|
import { CartridgeAgitatorContainerModel } from '../cartridge-agitator';
|
|
3
4
|
import { CarbAgitatorModel } from '../carb-agitator';
|
|
@@ -9,8 +10,12 @@ export interface FreestyleModelAssemblyExt {
|
|
|
9
10
|
iceAgitator: IceAgitatorModel;
|
|
10
11
|
carbAgitator: CarbAgitatorModel;
|
|
11
12
|
cartridgeAgitators: CartridgeAgitatorContainerModel;
|
|
13
|
+
remoteTrays: RemoteTrayContainerModel;
|
|
12
14
|
supportsIce: boolean;
|
|
13
15
|
supportsCarb: boolean;
|
|
14
16
|
}
|
|
15
17
|
export type Agitator = IceAgitatorModel | CarbAgitatorModel;
|
|
18
|
+
export interface ActiveAware {
|
|
19
|
+
active: boolean;
|
|
20
|
+
}
|
|
16
21
|
//# sourceMappingURL=assembly.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assembly.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-freestyle-sdk/src/models/models/types/assembly.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"assembly.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-freestyle-sdk/src/models/models/types/assembly.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE/D,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,gBAAgB,CAAC;IAC9B,YAAY,EAAE,iBAAiB,CAAC;IAChC,kBAAkB,EAAE,+BAA+B,CAAC;IACpD,WAAW,EAAE,wBAAwB,CAAC;IACtC,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,MAAM,QAAQ,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;AAE5D,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,OAAO,CAAC;CACjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assembly-data-mapper.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/assembly/assembly-data-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"assembly-data-mapper.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/assembly/assembly-data-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,8BAA8B,CAAC;AAOtC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAGzD,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG,cAAc,CAAC;AAC3D,eAAO,MAAM,aAAa,EAAE,aAAa,EAAoC,CAAC;AAC9E,eAAO,MAAM,oBAAoB;;;CAGhC,CAAC;AACF,eAAO,MAAM,iBAAiB;;;;CAI7B,CAAC;AAIF,eAAO,MAAM,2BAA2B,EAAE,UAAU,CAClD,yBAAyB,EACzB,yBAAyB,CA8D1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/assembly/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,gBAAgB,CAAC;AACjE,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG,cAAc,CAAC;AAC3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,WAAW,oBAAoB;IACnC,WAAW,CAAC,EAAE;QACZ,IAAI,EAAE,aAAa,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE;YACN,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;KACH,CAAC;IACF,YAAY,CAAC,EAAE;QACb,IAAI,EAAE,cAAc,CAAC;QACrB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE;YACN,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;KACH,CAAC;IAEF,kBAAkB,CAAC,EAAE;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE;YACL,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;KACH,EAAE,CAAC;CACL;AAGD,MAAM,WAAW,kBAAkB;CAAG;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsDK;AACL,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;CAAG;AAErC,MAAM,WAAW,gBAAgB;CAAG;AAEpC,MAAM,MAAM,yBAAyB,GAAG,aAAa,CAAC,gBAAgB,CAAC;IACrE,WAAW,EAAE,oBAAoB,CAAC;IAClC,SAAS,EAAE,kBAAkB,CAAC;IAC9B,SAAS,EAAE,kBAAkB,CAAC;IAC9B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,OAAO,EAAE,gBAAgB,CAAC;CAC3B,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/extensions/assembly/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,gBAAgB,CAAC;AACjE,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG,cAAc,CAAC;AAC3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,WAAW,oBAAoB;IACnC,WAAW,CAAC,EAAE;QACZ,IAAI,EAAE,aAAa,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE;YACN,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;KACH,CAAC;IACF,YAAY,CAAC,EAAE;QACb,IAAI,EAAE,cAAc,CAAC;QACrB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE;YACN,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;KACH,CAAC;IAEF,kBAAkB,CAAC,EAAE;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE;YACL,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;KACH,EAAE,CAAC;IAEJ,WAAW,CAAC,EAAE;QACZ,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,EAAE,CAAC;CACL;AAGD,MAAM,WAAW,kBAAkB;CAAG;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsDK;AACL,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;CAAG;AAErC,MAAM,WAAW,gBAAgB;CAAG;AAEpC,MAAM,MAAM,yBAAyB,GAAG,aAAa,CAAC,gBAAgB,CAAC;IACrE,WAAW,EAAE,oBAAoB,CAAC;IAClC,SAAS,EAAE,kBAAkB,CAAC;IAC9B,SAAS,EAAE,kBAAkB,CAAC;IAC9B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,OAAO,EAAE,gBAAgB,CAAC;CAC3B,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"freestyle-registration-manager.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/freestyle-registration-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,IAAI,yBAAyB,EAU9C,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAKL,mBAAmB,EAEnB,KAAK,kBAAkB,EAExB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"freestyle-registration-manager.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/freestyle-registration-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,IAAI,yBAAyB,EAU9C,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAKL,mBAAmB,EAEnB,KAAK,kBAAkB,EAExB,MAAM,yBAAyB,CAAC;AAYjC,eAAO,MAAM,uBAAuB,YACxB,CAAC;;;;;CA2GV,CAAC;AAEJ,KAAK,aAAa,CAAC,CAAC,IAAI,OAAO,yBAAyB,GAAG;IACzD,SAAS,EAAE;QAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC,CAAC,CAAC,CAAA;KAAE,CAAC;IACnD,OAAO,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACnE,KAAK,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC7D,SAAS,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;CACtE,CAAC;AAEF,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;CAEtB,CAAC;AAcF,KAAK,oBAAoB,GAAG,aAAa,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEpE,QAAA,MAAM,gBAAgB,EAAE,oBAA+C,CAAC;AAExE,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
package/models.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./freestyle-registration-manager-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./freestyle-registration-manager-Dbdeo0JU.cjs"),r=require("./extension-utils-BY9yhVLb.cjs");require("@kosdev-code/kos-ui-sdk");require("@kosdev-code/kos-dispense-sdk");exports.AGITATION_REQUIRED_TROUBLE=e.AGITATION_REQUIRED_TROUBLE;exports.AgitationRequiredTrouble=e.AgitationRequiredTrouble;exports.CarbAgitator=e.CarbAgitator;exports.CartridgeAgitator=e.CartridgeAgitator;exports.CartridgeAgitatorContainer=e.CartridgeAgitatorContainer;exports.CartridgeAgitatorEvents=e.CartridgeAgitatorEvents;exports.FreestyleAssembly=e.FreestyleAssembly;exports.FreestyleHolder=e.FreestyleHolder;exports.FreestyleNozzle=e.FreestyleNozzle;exports.FreestylePump=e.FreestylePump;exports.IceAgitator=e.IceAgitator;exports.IceAgitatorEvents=e.IceAgitatorEvents;exports.KosModelRegistry=e.KosModelRegistry;exports.registerFreestyleModels=e.registerFreestyleModels;exports.EXTENSION_PLUGIN_VISIBILITY=r.EXTENSION_PLUGIN_VISIBILITY;exports.FreestyleExtensionManager=r.FreestyleExtensionManager;exports.FreestyleNozzleServices=r.index;exports.FreestylePumpServices=r.index$1;exports.KosExtensionManager=r.KosExtensionManager;
|
|
2
2
|
//# sourceMappingURL=models.cjs.map
|
package/models.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { A as t, h as o, C as i, c as g, a as l, b as I, F as n, d as A, e as y, f as E, g as F, I as d, K as m, r as p } from "./freestyle-registration-manager-
|
|
2
|
-
import { E as N, F as T, i as c, a as R, K as b } from "./extension-utils-
|
|
3
|
-
import "@kosdev-code/kos-dispense-sdk";
|
|
1
|
+
import { A as t, h as o, C as i, c as g, a as l, b as I, F as n, d as A, e as y, f as E, g as F, I as d, K as m, r as p } from "./freestyle-registration-manager-CI8el36E.js";
|
|
2
|
+
import { E as N, F as T, i as c, a as R, K as b } from "./extension-utils-B4aRuLqC.js";
|
|
4
3
|
import "@kosdev-code/kos-ui-sdk";
|
|
4
|
+
import "@kosdev-code/kos-dispense-sdk";
|
|
5
5
|
export {
|
|
6
6
|
t as AGITATION_REQUIRED_TROUBLE,
|
|
7
7
|
o as AgitationRequiredTrouble,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kosdev-code/kos-freestyle-sdk",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.34",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./index.d.ts",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -23,15 +23,15 @@
|
|
|
23
23
|
"./package.json": "./package.json"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@kosdev-code/kos-ui-sdk": "~2.0.
|
|
27
|
-
"@kosdev-code/kos-dispense-sdk": "~2.0.
|
|
26
|
+
"@kosdev-code/kos-ui-sdk": "~2.0.34",
|
|
27
|
+
"@kosdev-code/kos-dispense-sdk": "~2.0.34"
|
|
28
28
|
},
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"registry": "https://registry.npmjs.org/"
|
|
31
31
|
},
|
|
32
32
|
"kos": {
|
|
33
33
|
"build": {
|
|
34
|
-
"gitHash": "
|
|
34
|
+
"gitHash": "abc125566178e7aa50012d17d649f46b4b511cc4"
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
package/ui.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./use-nutrition-info-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./use-nutrition-info-BqyF2EOl.cjs");require("@kosdev-code/kos-dispense-sdk");require("@kosdev-code/kos-ui-sdk");require("./freestyle-registration-manager-Dbdeo0JU.cjs");require("@emotion/react/jsx-runtime");require("react");exports.useFreestyleAssemblyContext=e.useFreestyleAssemblyContext;exports.useFreestyleNozzleContext=e.useFreestyleNozzleContext;exports.useIceAgitator=e.useIceAgitator;exports.useNutritionInfo=e.useNutritionInfo;exports.withIceAgitator=e.withIceAgitator;
|
|
2
2
|
//# sourceMappingURL=ui.cjs.map
|
package/ui.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { u as m, a as p, b as u, c as l, w as n } from "./use-nutrition-info-
|
|
1
|
+
import { u as m, a as p, b as u, c as l, w as n } from "./use-nutrition-info-uacoD9lS.js";
|
|
2
2
|
import "@kosdev-code/kos-dispense-sdk";
|
|
3
3
|
import "@kosdev-code/kos-ui-sdk";
|
|
4
|
-
import "./freestyle-registration-manager-
|
|
4
|
+
import "./freestyle-registration-manager-CI8el36E.js";
|
|
5
5
|
import "@emotion/react/jsx-runtime";
|
|
6
6
|
import "react";
|
|
7
7
|
export {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const f=require("@kosdev-code/kos-dispense-sdk"),r=require("@kosdev-code/kos-ui-sdk"),i=require("./freestyle-registration-manager-
|
|
2
|
-
//# sourceMappingURL=use-nutrition-info-
|
|
1
|
+
"use strict";const f=require("@kosdev-code/kos-dispense-sdk"),r=require("@kosdev-code/kos-ui-sdk"),i=require("./freestyle-registration-manager-Dbdeo0JU.cjs"),c=require("@emotion/react/jsx-runtime"),u=require("react"),d=()=>{const{model:e}=f.useAssemblyContext();return e?r.getKosCompanionModel(e,i.FreestyleAssembly.type):null},y=()=>{const{model:e}=f.useNozzleContext();return e?r.getKosCompanionModel(e,i.FreestyleNozzle.type):null},a=e=>{const t=e;return r.useKosModel({modelId:t,modelType:i.IceAgitator.type,options:{}})};function m(e){return t=>s=>{const{model:n,status:o,KosModelLoader:l}=a(t);return c.jsx(l,{...o,children:c.jsx(e,{...s,iceAgitator:n})})}}const g=(e,t)=>{if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!==t[s])return!1;return!0},z=e=>{const t=y(),[s,n]=u.useState(),o=u.useRef([]);return u.useEffect(()=>{t&&!g(e,o.current)&&(t.cupSizes=e,o.current=e);const l=r.kosAutoEffect(()=>{t&&n(t.nutritionInfo)});return()=>{l()}},[e,t]),s};exports.useFreestyleAssemblyContext=d;exports.useFreestyleNozzleContext=y;exports.useIceAgitator=a;exports.useNutritionInfo=z;exports.withIceAgitator=m;
|
|
2
|
+
//# sourceMappingURL=use-nutrition-info-BqyF2EOl.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-nutrition-info-
|
|
1
|
+
{"version":3,"file":"use-nutrition-info-BqyF2EOl.cjs","sources":["../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/freestyle-assembly/use-freestyle-assembly.ts","../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/freestyle-nozzle/use-freestyle-nozzle.ts","../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/ice-agitator/use-ice-agitator.ts","../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/ice-agitator/with-ice-agitator.tsx","../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/nutrition/use-nutrition-info.ts"],"sourcesContent":["import { useAssemblyContext } from \"@kosdev-code/kos-dispense-sdk\";\nimport { getKosCompanionModel } from \"@kosdev-code/kos-ui-sdk\";\nimport {\n FreestyleAssembly,\n type FreestyleAssemblyModel,\n} from \"../../../models\";\n\nexport const useFreestyleAssemblyContext =\n (): FreestyleAssemblyModel | null => {\n const { model } = useAssemblyContext();\n\n const freestyleAssembly = model\n ? getKosCompanionModel<FreestyleAssemblyModel>(\n model,\n FreestyleAssembly.type\n )\n : null;\n\n return freestyleAssembly;\n };\n","import { useNozzleContext } from \"@kosdev-code/kos-dispense-sdk\";\nimport { getKosCompanionModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { FreestyleNozzle, type FreestyleNozzleModel } from \"../../../models\";\n\nexport const useFreestyleNozzleContext = (): FreestyleNozzleModel | null => {\n const { model } = useNozzleContext();\n\n const freestyleNozzle = model\n ? getKosCompanionModel<FreestyleNozzleModel>(model, FreestyleNozzle.type)\n : null;\n\n return freestyleNozzle;\n};\n","import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { IceAgitator, type IceAgitatorModel } from \"../../../models\";\n\nexport const useIceAgitator = (id: string) => {\n const modelId = id;\n const result = useKosModel<IceAgitatorModel>({\n modelId,\n modelType: IceAgitator.type,\n options: {},\n });\n\n return result;\n};\n","import { IceAgitatorModel } from \"../../../models\";\nimport { useIceAgitator } from \"./use-ice-agitator\";\n\nexport interface IceAgitatorProps {\n iceAgitator: IceAgitatorModel;\n}\n\nexport function withIceAgitator<T extends IceAgitatorProps = IceAgitatorProps>(\n WrappedComponent: React.ComponentType<T>\n) {\n return (id: string) => (props: Omit<T, keyof IceAgitatorProps>) => {\n const { model, status, KosModelLoader } = useIceAgitator(id);\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} iceAgitator={model} />\n </KosModelLoader>\n );\n };\n}\n","import { kosAutoEffect } from \"@kosdev-code/kos-ui-sdk\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport type { FreestyleNozzleServices } from \"../../../models\";\nimport { useFreestyleNozzleContext } from \"../freestyle-nozzle\";\n\n// Custom function to check deep equality of two arrays\nconst arraysEqual = (a: number[], b: number[]): boolean => {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n};\n\nexport const useNutritionInfo = (cupSizes: number[]) => {\n const freestyleNozzle = useFreestyleNozzleContext();\n const [nutritionInfo, setNutritionInfo] =\n useState<FreestyleNozzleServices.FreestyleNutritionInfoResponse>();\n\n // Use a ref to keep track of the previous cupSizes value\n const prevCupSizesRef = useRef<number[]>([]);\n\n useEffect(() => {\n if (freestyleNozzle && !arraysEqual(cupSizes, prevCupSizesRef.current)) {\n freestyleNozzle.cupSizes = cupSizes;\n prevCupSizesRef.current = cupSizes;\n }\n const disposer = kosAutoEffect(() => {\n if (freestyleNozzle) {\n setNutritionInfo(freestyleNozzle.nutritionInfo);\n }\n });\n\n return () => {\n disposer();\n };\n }, [cupSizes, freestyleNozzle]);\n\n return nutritionInfo;\n};\n"],"names":["useFreestyleAssemblyContext","model","useAssemblyContext","getKosCompanionModel","FreestyleAssembly","useFreestyleNozzleContext","useNozzleContext","FreestyleNozzle","useIceAgitator","id","modelId","useKosModel","IceAgitator","withIceAgitator","WrappedComponent","props","status","KosModelLoader","jsx","arraysEqual","a","b","i","useNutritionInfo","cupSizes","freestyleNozzle","nutritionInfo","setNutritionInfo","useState","prevCupSizesRef","useRef","useEffect","disposer","kosAutoEffect"],"mappings":"yNAOaA,EACX,IAAqC,CAC7B,KAAA,CAAE,MAAAC,GAAUC,EAAAA,qBASX,OAPmBD,EACtBE,EAAA,qBACEF,EACAG,EAAAA,kBAAkB,IAEpB,EAAA,IAGN,ECfWC,EAA4B,IAAmC,CACpE,KAAA,CAAE,MAAAJ,GAAUK,EAAAA,mBAMX,OAJiBL,EACpBE,EAAA,qBAA2CF,EAAOM,kBAAgB,IAAI,EACtE,IAGN,ECTaC,EAAkBC,GAAe,CAC5C,MAAMC,EAAUD,EAOT,OANQE,EAAAA,YAA8B,CAC3C,QAAAD,EACA,UAAWE,EAAY,YAAA,KACvB,QAAS,CAAC,CAAA,CACX,CAGH,ECLO,SAASC,EACdC,EACA,CACO,OAACL,GAAgBM,GAA2C,CACjE,KAAM,CAAE,MAAAd,EAAO,OAAAe,EAAQ,eAAAC,CAAe,EAAIT,EAAeC,CAAE,EAGzD,OAAAS,EAAA,IAACD,EAAgB,CAAA,GAAGD,EAClB,SAAAE,EAAA,IAACJ,GAAkB,GAAIC,EAAa,YAAad,CAAO,CAAA,CAC1D,CAAA,CAAA,CAGN,CCZA,MAAMkB,EAAc,CAACC,EAAaC,IAAyB,CACrD,GAAAD,EAAE,SAAWC,EAAE,OAAe,MAAA,GAClC,QAASC,EAAI,EAAGA,EAAIF,EAAE,OAAQE,IAC5B,GAAIF,EAAEE,CAAC,IAAMD,EAAEC,CAAC,EAAU,MAAA,GAErB,MAAA,EACT,EAEaC,EAAoBC,GAAuB,CACtD,MAAMC,EAAkBpB,IAClB,CAACqB,EAAeC,CAAgB,EACpCC,EAAiE,SAAA,EAG7DC,EAAkBC,SAAiB,CAAA,CAAE,EAE3CC,OAAAA,EAAAA,UAAU,IAAM,CACVN,GAAmB,CAACN,EAAYK,EAAUK,EAAgB,OAAO,IACnEJ,EAAgB,SAAWD,EAC3BK,EAAgB,QAAUL,GAEtB,MAAAQ,EAAWC,EAAAA,cAAc,IAAM,CAC/BR,GACFE,EAAiBF,EAAgB,aAAa,CAChD,CACD,EAED,MAAO,IAAM,CACFO,GAAA,CACX,EACC,CAACR,EAAUC,CAAe,CAAC,EAEvBC,CACT"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useAssemblyContext as f, useNozzleContext as i } from "@kosdev-code/kos-dispense-sdk";
|
|
2
2
|
import { getKosCompanionModel as u, useKosModel as c, kosAutoEffect as m } from "@kosdev-code/kos-ui-sdk";
|
|
3
|
-
import { F as a, e as y, g as d } from "./freestyle-registration-manager-
|
|
3
|
+
import { F as a, e as y, g as d } from "./freestyle-registration-manager-CI8el36E.js";
|
|
4
4
|
import { jsx as l } from "@emotion/react/jsx-runtime";
|
|
5
5
|
import { useState as p, useRef as z, useEffect as A } from "react";
|
|
6
6
|
const E = () => {
|
|
@@ -49,4 +49,4 @@ export {
|
|
|
49
49
|
E as u,
|
|
50
50
|
K as w
|
|
51
51
|
};
|
|
52
|
-
//# sourceMappingURL=use-nutrition-info-
|
|
52
|
+
//# sourceMappingURL=use-nutrition-info-uacoD9lS.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-nutrition-info-
|
|
1
|
+
{"version":3,"file":"use-nutrition-info-uacoD9lS.js","sources":["../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/freestyle-assembly/use-freestyle-assembly.ts","../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/freestyle-nozzle/use-freestyle-nozzle.ts","../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/ice-agitator/use-ice-agitator.ts","../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/ice-agitator/with-ice-agitator.tsx","../../../../packages/sdk/kos-freestyle-sdk/src/ui/hooks/nutrition/use-nutrition-info.ts"],"sourcesContent":["import { useAssemblyContext } from \"@kosdev-code/kos-dispense-sdk\";\nimport { getKosCompanionModel } from \"@kosdev-code/kos-ui-sdk\";\nimport {\n FreestyleAssembly,\n type FreestyleAssemblyModel,\n} from \"../../../models\";\n\nexport const useFreestyleAssemblyContext =\n (): FreestyleAssemblyModel | null => {\n const { model } = useAssemblyContext();\n\n const freestyleAssembly = model\n ? getKosCompanionModel<FreestyleAssemblyModel>(\n model,\n FreestyleAssembly.type\n )\n : null;\n\n return freestyleAssembly;\n };\n","import { useNozzleContext } from \"@kosdev-code/kos-dispense-sdk\";\nimport { getKosCompanionModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { FreestyleNozzle, type FreestyleNozzleModel } from \"../../../models\";\n\nexport const useFreestyleNozzleContext = (): FreestyleNozzleModel | null => {\n const { model } = useNozzleContext();\n\n const freestyleNozzle = model\n ? getKosCompanionModel<FreestyleNozzleModel>(model, FreestyleNozzle.type)\n : null;\n\n return freestyleNozzle;\n};\n","import { useKosModel } from \"@kosdev-code/kos-ui-sdk\";\nimport { IceAgitator, type IceAgitatorModel } from \"../../../models\";\n\nexport const useIceAgitator = (id: string) => {\n const modelId = id;\n const result = useKosModel<IceAgitatorModel>({\n modelId,\n modelType: IceAgitator.type,\n options: {},\n });\n\n return result;\n};\n","import { IceAgitatorModel } from \"../../../models\";\nimport { useIceAgitator } from \"./use-ice-agitator\";\n\nexport interface IceAgitatorProps {\n iceAgitator: IceAgitatorModel;\n}\n\nexport function withIceAgitator<T extends IceAgitatorProps = IceAgitatorProps>(\n WrappedComponent: React.ComponentType<T>\n) {\n return (id: string) => (props: Omit<T, keyof IceAgitatorProps>) => {\n const { model, status, KosModelLoader } = useIceAgitator(id);\n\n return (\n <KosModelLoader {...status}>\n <WrappedComponent {...(props as T)} iceAgitator={model} />\n </KosModelLoader>\n );\n };\n}\n","import { kosAutoEffect } from \"@kosdev-code/kos-ui-sdk\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport type { FreestyleNozzleServices } from \"../../../models\";\nimport { useFreestyleNozzleContext } from \"../freestyle-nozzle\";\n\n// Custom function to check deep equality of two arrays\nconst arraysEqual = (a: number[], b: number[]): boolean => {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n};\n\nexport const useNutritionInfo = (cupSizes: number[]) => {\n const freestyleNozzle = useFreestyleNozzleContext();\n const [nutritionInfo, setNutritionInfo] =\n useState<FreestyleNozzleServices.FreestyleNutritionInfoResponse>();\n\n // Use a ref to keep track of the previous cupSizes value\n const prevCupSizesRef = useRef<number[]>([]);\n\n useEffect(() => {\n if (freestyleNozzle && !arraysEqual(cupSizes, prevCupSizesRef.current)) {\n freestyleNozzle.cupSizes = cupSizes;\n prevCupSizesRef.current = cupSizes;\n }\n const disposer = kosAutoEffect(() => {\n if (freestyleNozzle) {\n setNutritionInfo(freestyleNozzle.nutritionInfo);\n }\n });\n\n return () => {\n disposer();\n };\n }, [cupSizes, freestyleNozzle]);\n\n return nutritionInfo;\n};\n"],"names":["useFreestyleAssemblyContext","model","useAssemblyContext","getKosCompanionModel","FreestyleAssembly","useFreestyleNozzleContext","useNozzleContext","FreestyleNozzle","useIceAgitator","id","useKosModel","IceAgitator","withIceAgitator","WrappedComponent","props","status","KosModelLoader","jsx","arraysEqual","a","b","i","useNutritionInfo","cupSizes","freestyleNozzle","nutritionInfo","setNutritionInfo","useState","prevCupSizesRef","useRef","useEffect","disposer","kosAutoEffect"],"mappings":";;;;;AAOO,MAAMA,IACX,MAAqC;AAC7B,QAAA,EAAE,OAAAC,MAAUC;AASX,SAPmBD,IACtBE;AAAA,IACEF;AAAA,IACAG,EAAkB;AAAA,EAEpB,IAAA;AAGN,GCfWC,IAA4B,MAAmC;AACpE,QAAA,EAAE,OAAAJ,MAAUK;AAMX,SAJiBL,IACpBE,EAA2CF,GAAOM,EAAgB,IAAI,IACtE;AAGN,GCTaC,IAAiB,CAACC,MAEdC,EAA8B;AAAA,EAC3C,SAFcD;AAAA,EAGd,WAAWE,EAAY;AAAA,EACvB,SAAS,CAAC;AAAA,CACX;ACFI,SAASC,EACdC,GACA;AACO,SAAA,CAACJ,MAAe,CAACK,MAA2C;AACjE,UAAM,EAAE,OAAAb,GAAO,QAAAc,GAAQ,gBAAAC,EAAe,IAAIR,EAAeC,CAAE;AAGzD,WAAA,gBAAAQ,EAACD,GAAgB,EAAA,GAAGD,GAClB,UAAA,gBAAAE,EAACJ,KAAkB,GAAIC,GAAa,aAAab,EAAO,CAAA,EAC1D,CAAA;AAAA,EAAA;AAGN;ACZA,MAAMiB,IAAc,CAACC,GAAaC,MAAyB;AACrD,MAAAD,EAAE,WAAWC,EAAE;AAAe,WAAA;AAClC,WAASC,IAAI,GAAGA,IAAIF,EAAE,QAAQE;AAC5B,QAAIF,EAAEE,CAAC,MAAMD,EAAEC,CAAC;AAAU,aAAA;AAErB,SAAA;AACT,GAEaC,IAAmB,CAACC,MAAuB;AACtD,QAAMC,IAAkBnB,KAClB,CAACoB,GAAeC,CAAgB,IACpCC,EAAiE,GAG7DC,IAAkBC,EAAiB,CAAA,CAAE;AAE3C,SAAAC,EAAU,MAAM;AACd,IAAIN,KAAmB,CAACN,EAAYK,GAAUK,EAAgB,OAAO,MACnEJ,EAAgB,WAAWD,GAC3BK,EAAgB,UAAUL;AAEtB,UAAAQ,IAAWC,EAAc,MAAM;AACnC,MAAIR,KACFE,EAAiBF,EAAgB,aAAa;AAAA,IAChD,CACD;AAED,WAAO,MAAM;AACF,MAAAO;IAAA;AAAA,EACX,GACC,CAACR,GAAUC,CAAe,CAAC,GAEvBC;AACT;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var de=Object.defineProperty;var ce=(e,t,r)=>t in e?de(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var i=(e,t,r)=>(ce(e,typeof t!="symbol"?t+"":t,r),r);const g=require("@kosdev-code/kos-dispense-sdk"),o=require("@kosdev-code/kos-ui-sdk");var pe=Object.defineProperty,he=Object.getOwnPropertyDescriptor,ye=(e,t,r,s)=>{for(var a=s>1?void 0:s?he(t,r):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(a=(s?l(t,r,a):l(a))||a);return s&&a&&pe(t,r,a),a};const H="carb-agitator-model";let T=class{constructor(e,t,r){i(this,"id");i(this,"name");i(this,"path");i(this,"logger");this.id=e,this.name=t.name,this.path=t.path,this.logger=r.logger}async init(){this.logger.debug(`initializing carb-agitator ${this.id}`)}async load(){this.logger.debug(`loading carb-agitator ${this.id}`)}};T=ye([o.kosModel(H)],T);const N=new o.KosModelRegistrationFactory({class:T,type:H});var fe=Object.defineProperty,Pe=Object.getOwnPropertyDescriptor,x=(e,t,r,s)=>{for(var a=s>1?void 0:s?Pe(t,r):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(a=(s?l(t,r,a):l(a))||a);return s&&a&&fe(t,r,a),a};const q="cartridge-agitator-container-model";let E=class{constructor(e,t,r){i(this,"id");i(this,"logger");i(this,"_models");this.id=e,this.logger=r.logger,this._models=new o.KosModelContainer({parentId:e})}getModel(e){return this._models.getModel(e)}get models(){return this._models}get data(){return this._models.data}addModel(e){this._models.addModel(e)}removeModel(e){this._models.removeModel(e)}async init(){this.logger.debug(`initializing cartridge-agitator-container container ${this.id}`)}async load(){this.logger.debug(`loading cartridge-agitator-container container ${this.id}`)}};x([o.kosChild],E.prototype,"_models",2);E=x([o.kosModel(q)],E);const{URL:Y}=o.resolveServiceUrl("CARTRIDGE_AGITATOR_SERVICE"),{postModel:_e}=o.ServiceFactory.build({basePath:`${Y}/api/ext/freestyle/freestyle/ice`}),me=async(e,t)=>{const r=await _e({model:{},tracker:t,urlOverride:`${Y}/api/handle/${e}/test`});if(!(r!=null&&r.data))throw new Error("No response from server");return r.data};var ve=Object.defineProperty,be=Object.getOwnPropertyDescriptor,K=(e,t,r,s)=>{for(var a=s>1?void 0:s?be(t,r):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(a=(s?l(t,r,a):l(a))||a);return s&&a&&ve(t,r,a),a};const k="cartridge-agitator-model";class _{}i(_,"TOPIC_AGITATION_STARTED","/kos/events/ddk/agitation-started"),i(_,"TOPIC_AGITATION_ENDED","/kos/events/ddk/agitation-ended");const Ie=o.createPropKey("statePath");let m=class{constructor(e,t,r){i(this,"id");i(this,"futureHandler");i(this,"logger");i(this,"disposer");i(this,"agitating");i(this,"path");i(this,"statePath");i(this,"name");this.id=e,this.logger=r.logger,this.path=t.path,this.name=t.name,this.statePath=t.statePath,o.setupMinimalFutureSupport(this)}get isAgitating(){return!!this.agitating.value}async testAgitate(e){if(!e)throw new Error("No tracker provided");return this.logger.info(`agitating cartridge-agitator ${this.id}`),me(this.path,e)}async init(){this.logger.debug(`initializing cartridge-agitator ${this.id}`)}unload(){var e;(e=this.disposer)==null||e.call(this)}async load(){this.logger.debug(`loading cartridge-agitator ${this.id}`),this.disposer=o.kosEffect(()=>this.isAgitating,()=>{var e;this.isAgitating?(this.logger.info(`agitating cartridge-agitator ${this.id}`),o.EventBus.publish(_.TOPIC_AGITATION_STARTED,{path:this.path,futureId:(e=this.futureHandler.future)==null?void 0:e.futureId})):o.EventBus.publish(_.TOPIC_AGITATION_ENDED,{path:this.path})},{})}};K([o.kosStateProp({path:Ie,attribute:"agitating"})],m.prototype,"agitating",2);K([o.kosFuture()],m.prototype,"testAgitate",1);m=K([o.kosModel(k)],m);const U=new o.KosModelRegistrationFactory({class:m,type:k}),A=new o.SingletonKosModelRegistrationFactory({class:E,type:q});A.addRelatedModel(U);var Ee=Object.defineProperty,Oe=Object.getOwnPropertyDescriptor,Ae=(e,t,r,s)=>{for(var a=s>1?void 0:s?Oe(t,r):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(a=(s?l(t,r,a):l(a))||a);return s&&a&&Ee(t,r,a),a};const V="freestyle-assembly-model",W="iceAgitator",Me="carbAgitator";let C=class{constructor(e,t,r){i(this,"id");i(this,"logger");i(this,"assembly");this.id=e,this.logger=r.logger,this.assembly=t.companionParent}get holderGroups(){return this.assembly.holderGroups}get nozzlePaths(){return this.assembly.nozzlePaths}get allHolders(){return this.assembly.allHolders}getHoldersByGroup(e){return this.assembly.getHoldersByGroup(e)}getHoldersByNozzle(e){return this.assembly.getHoldersByNozzle(e)}get pumpsByNozzle(){return this.assembly.pumpsByNozzle}get pumpPaths(){return this.assembly.pumpPaths}get boards(){return this.assembly.boards}updateModel(e){return this.assembly.updateModel(e)}get iceAgitator(){return this.assembly.iceAgitator}get carbAgitator(){return this.assembly.carbAgitator}get cartridgeAgitators(){return this.assembly.cartridgeAgitators}get defaultCartridgeAgitator(){return this.assembly.cartridgeAgitators.data[0]}get cartridgeAgitatorModels(){return this.assembly.cartridgeAgitators.data}get hasCartridgeAgitators(){return this.assembly.cartridgeAgitators.data.length>0}get supportsIce(){return o.KosFeatureFlags.isFeatureEnabled(W)}get supportsCarb(){return o.KosFeatureFlags.isFeatureEnabled(Me)}async init(){this.logger.debug(`initializing freestyle-assembly ${this.id}`)}async load(){this.logger.debug(`loading freestyle-assembly ${this.id}`)}};C=Ae([o.kosModel(V)],C);const O=new o.SingletonKosModelRegistrationFactory({class:C,type:V});var Se=Object.defineProperty,Te=Object.getOwnPropertyDescriptor,Ce=(e,t,r,s)=>{for(var a=s>1?void 0:s?Te(t,r):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(a=(s?l(t,r,a):l(a))||a);return s&&a&&Se(t,r,a),a};const X="freestyle-holder-model";function $e(e){const t=o.KosContextManager.getContext(e),r=t==null?void 0:t.get(O.type);if(!r){o.KosLog.error("Freestyle assembly not found");return}return r}async function Re(e,t){if(!e||!t)return;const r=await e[t]();if(r!=null&&r.tracker)return o.FutureManager.getFuture(r.tracker)}let $=class{constructor(e,t,r){i(this,"id");i(this,"logger");i(this,"holder");i(this,"future");this.id=e,this.logger=r.logger,this.holder=t.companionParent}get agitated(){return this.holder.data.agitated}async agitate(){if(!this.holder.data.agitated)return;this.future=void 0;const e=$e(this.id);if(!e)return;if(!e.defaultCartridgeAgitator){this.logger.error("Agitator not found");return}return this.future=await Re(e.defaultCartridgeAgitator,"testAgitate"),this.future}async init(){this.logger.debug(`initializing freestyle-holder ${this.id}`)}async load(){this.logger.debug(`loading freestyle-holder ${this.id}`)}};$=Ce([o.kosModel(X)],$);const R=new o.KosModelRegistrationFactory({class:$,type:X}),{URL:De}=o.resolveServiceUrl("FREESTYLE-NOZZLE_SERVICE"),{getOne:we}=o.ServiceFactory.build({basePath:`${De}/api/freestyle-nozzle`}),I=o.KosLog.createLogger({name:"freestyle-nozzle-service",group:"Services"});class Q extends Error{constructor(t){super(t),this.name="NutritionInfoError"}}class D extends Error{constructor(t){super(t),this.name="InvalidRequestError"}}const Z=async(e,t,r,s="http://localhost:8081")=>{if(I.debug("sending GET for freestyle-nozzle"),!t)throw I.error("Invalid freestyle-nozzle request: beverageId is required"),new D("No beverageId provided");if(!r||r.length===0)throw I.error("Invalid freestyle-nozzle request: volumes are required"),new D("No volumes provided");const a=await we({urlOverride:`${s}${e}/pipeline/beverage/engine/nutrition/${t}?volumes=${r.join(",")}`});if(!(a!=null&&a.data))throw I.error("Failed to retrieve freestyle-nozzle data"),new Error("Failed to retrieve freestyle-nozzle data");if(a.data.error)throw new Q(a.data.error);return a.data};var ze=Object.defineProperty,Fe=Object.getOwnPropertyDescriptor,Le=(e,t,r,s)=>{for(var a=s>1?void 0:s?Fe(t,r):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(a=(s?l(t,r,a):l(a))||a);return s&&a&&ze(t,r,a),a};const J="freestyle-nozzle-model";let w=class{constructor(e,t,r){i(this,"id");i(this,"logger");i(this,"nozzleModel");i(this,"_cupSizes");i(this,"_nutritionInfo");i(this,"_disposer",null);this.id=e,this.logger=r.logger,this.nozzleModel=t.companionParent,this._cupSizes=[100]}set cupSizes(e){this._cupSizes=e}get nutritionInfo(){return this._nutritionInfo}async init(){this.logger.debug(`initializing freestyle-nozzle ${this.id}`),this._disposer=o.kosAutoEffect(async()=>{if(this.nozzleModel.selectedPourable.beverage&&this._cupSizes.length){this.logger.debug(`selected beverage: ${this.nozzleModel.selectedPourable.beverage.rawId}. Volume: ${this._cupSizes.join(", ")}`);const e=this.nozzleModel.selectedPourable.beverage.rawId,t=this.nozzleModel.urlPrefix;try{const r=await Z(t,e,this._cupSizes);o.kosAction(()=>{this._nutritionInfo=r})}catch(r){this.logger.error(`Error fetching nutrition info: ${r}`)}}})}unload(){this.logger.debug(`unloading freestyle-nozzle ${this.id}`),this._disposer&&this._disposer()}async load(){this.logger.debug(`loading freestyle-nozzle ${this.id}`)}};w=Le([o.kosParentAware(),o.kosModel(J)],w);const z=new o.KosModelRegistrationFactory({class:w,type:J}),{URL:ee}=o.resolveServiceUrl("PUMP_SERVICE"),{postModel:Ne}=o.ServiceFactory.build({basePath:`${ee}/api/ext/freestyle/microCalibration`}),S=o.KosLog.createLogger({name:"freestyle-pump-service",group:"Services"}),te=async(e,t)=>{var r,s,a,n,l;S.debug(`replacePump - sending POST request to /api/ext/freestyle/microCalibration/cal/${e}/code/${t}`);try{const u=await Ne({model:{},urlOverride:`${ee}/api/ext/freestyle/microCalibration/cal/${e}/code/${t}`});return S.debug("replacePump - response:",u),((u==null?void 0:u.status)===200||(u==null?void 0:u.status)===499)&&((r=u.data)!=null&&r.error)?[u.data.error||"unknownError",u.data]:[void 0,u==null?void 0:u.data]}catch(u){if(S.error(`replacePump - sending POST request to /api/cal/${e}/code/${t}`,u),u instanceof o.FetchError){const p=((a=(s=u.payload)==null?void 0:s.data)==null?void 0:a.error)||((n=u.payload)==null?void 0:n.error)||"unknownError";return[p,((l=u.payload)==null?void 0:l.data)||{error:p}]}}return["unknownError",{error:"unknownError"}]};var Ke=Object.defineProperty,Ue=Object.getOwnPropertyDescriptor,Ge=(e,t,r,s)=>{for(var a=s>1?void 0:s?Ue(t,r):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(a=(s?l(t,r,a):l(a))||a);return s&&a&&Ke(t,r,a),a};const re="freestyle-pump-model";let F=class{constructor(e,t,r){i(this,"id");i(this,"logger");i(this,"pump");this.id=e,this.logger=r.logger,this.pump=t.companionParent}async replacePump(e){const[t,r]=await te(this.pump.path,e);return t&&this.logger.error(`Failed to replace the pump, ${this.pump.id}`,t),[t,r]}};F=Ge([o.kosModel(re)],F);const L=new o.KosModelRegistrationFactory({class:F,type:re}),{URL:f}=o.resolveServiceUrl("ICE_AGITATOR_SERVICE"),{getAll:oe,postModel:M}=o.ServiceFactory.build({basePath:`${f}/api/ext/freestyle/ice`}),ae=o.KosLog.createLogger({name:"ice-agitator-service",group:"Services"}),Be=async e=>(ae.debug("sending GET for ice types"),await oe({urlOverride:`${f}/api/handle/${e}/types`})),je=async(e,t)=>(ae.debug("sending POST for ice types"),await M({urlOverride:`${f}/api/handle/${e}/type/${t}`,model:{}})),He=async e=>await oe({urlOverride:`${f}/api/kos/config/details/${e}/4`}),xe=async(e,t)=>{const r=await M({model:{},tracker:t,urlOverride:`${f}/api/handle/${e}/pour`});if(!(r!=null&&r.data))throw new Error("No response from server");return r==null?void 0:r.data},qe=async(e,t)=>{const r=await M({model:{},tracker:t,urlOverride:`${f}/api/handle/${e}/test/agitation`});if(!(r!=null&&r.data))throw new Error("No response from server");return r==null?void 0:r.data},Ye=async(e,t)=>{const r=await M({model:{},tracker:t,urlOverride:`${f}/api/handle/${e}/test/gate`});if(!(r!=null&&r.data))throw new Error("No response from server");return r==null?void 0:r.data};var ke=Object.defineProperty,Ve=Object.getOwnPropertyDescriptor,c=(e,t,r,s)=>{for(var a=s>1?void 0:s?Ve(t,r):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(a=(s?l(t,r,a):l(a))||a);return s&&a&&ke(t,r,a),a};class v{}i(v,"TOPIC_AGITATION_STARTED","/kos/events/ddk/ice-agitation-started"),i(v,"TOPIC_AGITATION_ENDED","/kos/events/ddk/ice-agitation-ended");const ie="ice-agitator-model",se=o.createPropKey("statePath");let d=class{constructor(e,t,r){i(this,"id");i(this,"name");i(this,"path");i(this,"futureHandler");i(this,"volWithoutIceMl");i(this,"durationSec");i(this,"enableIceChuteClear");i(this,"iceChuteClearDurationMs");i(this,"iceChuteClearIntervalSec");i(this,"iceChuteClearRetryIntervalSec");i(this,"maxDispenseSec");i(this,"type");i(this,"dilutionOffset");i(this,"inactivitySec");i(this,"agitating");i(this,"iceChuteOpen");i(this,"statePath");i(this,"_allIceTypes");i(this,"logger");i(this,"currentState",g.PourState.IDLE);i(this,"resetDefaultValues",async()=>await He(this.path));this.id=e,this.name=t.name,this.path=t.path,this.statePath=t.statePath,this._allIceTypes=[],this.logger=r.logger,this.futureHandler=new o.MultipleFutureHandler(this)}get iceTypes(){return this._allIceTypes}get isAgitating(){return!!this.agitating.value}get isIceChuteOpen(){return!!this.iceChuteOpen.value}get future(){return this.futureHandler.future}get pourFuture(){return this.futureHandler.futureMap.get("pour")}get agitateFuture(){return this.futureHandler.futureMap.get("agitate")}get gateFuture(){return this.futureHandler.futureMap.get("gate")}get isPouring(){var e;return!!(this.pourFuture&&!((e=this.pourFuture)!=null&&e.endState))||this.currentState===g.PourState.POUR_STARTING||this.currentState===g.PourState.POURING||this.currentState===g.PourState.POUR_CANCELING}get canPour(){return this.currentState===g.PourState.IDLE}updateIfCurrent(e,t){this.currentState===e&&o.kosAction(()=>{this.currentState=t})}async pourIce(e){try{if(this.currentState===g.PourState.IDLE){if(this.updateIfCurrent(g.PourState.IDLE,g.PourState.POUR_STARTING),!e)throw new Error("No tracker provided");const t=await xe(this.path,e);return this.updateIfCurrent(g.PourState.POUR_STARTING,g.PourState.POURING),t!=null&&t.endState&&this.updateIfCurrent(g.PourState.POURING,g.PourState.IDLE),t}else throw new Error(`Cannot pour in state ${this.currentState}`)}catch(t){throw this.logger.error(t),this.currentState=g.PourState.IDLE,t}}async cancelIceDispense(){var e;this.currentState===g.PourState.POURING||this.currentState===g.PourState.POUR_STARTING?(this.currentState=g.PourState.POUR_CANCELING,await((e=this.pourFuture)==null?void 0:e.cancelFuture()),o.kosAction(()=>{this.currentState=g.PourState.IDLE})):this.logger.warn(`Cannot cancel ice dispense in state ${this.currentState}`)}async testAgitate(e){if(!e)throw new Error("No tracker provided");return this.logger.info(`agitating ice-agitator ${this.id}`),qe(this.path,e)}async testGate(e){if(!e)throw new Error("No tracker provided");return this.logger.info(`testing ice gate: ${this.id}`),Ye(this.path,e)}handleAgitationChange(){var e;this.isAgitating?(this.logger.info(`agitating ice-agitator ${this.id}`),o.EventBus.publish(v.TOPIC_AGITATION_STARTED,{path:this.path,futureId:(e=this.futureHandler.future)==null?void 0:e.futureId})):o.EventBus.publish(v.TOPIC_AGITATION_ENDED,{path:this.path})}async updateIceType(e){await je(this.path,e)}async init(){this.logger.debug(`initializing ice-agitator ${this.id}`)}async load(){this.logger.debug(`loading ice-agitator ${this.id}`);const e=await Be(this.path);(e==null?void 0:e.status)===200&&o.kosAction(()=>{this._allIceTypes=e.data||[]})}};c([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"settings.volWithoutIceMl"})],d.prototype,"volWithoutIceMl",2);c([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"settings.durationSec",converter:{to:"second"}})],d.prototype,"durationSec",2);c([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"enableIceChuteClear"})],d.prototype,"enableIceChuteClear",2);c([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"iceChuteClearDurationMs"})],d.prototype,"iceChuteClearDurationMs",2);c([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"iceChuteClearIntervalSec"})],d.prototype,"iceChuteClearIntervalSec",2);c([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"iceChuteClearRetryIntervalSec"})],d.prototype,"iceChuteClearRetryIntervalSec",2);c([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"maxDispenseSec"})],d.prototype,"maxDispenseSec",2);c([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"type"})],d.prototype,"type",2);c([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"settings.dilutionOffset"})],d.prototype,"dilutionOffset",2);c([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"settings.inactivitySec",converter:{to:"minute"}})],d.prototype,"inactivitySec",2);c([o.kosStateProp({path:se,attribute:"agitating"})],d.prototype,"agitating",2);c([o.kosStateProp({path:se,attribute:"iceChuteOpen"})],d.prototype,"iceChuteOpen",2);c([o.kosFuture({alias:"pour"})],d.prototype,"pourIce",1);c([o.kosFuture({alias:"agitate"})],d.prototype,"testAgitate",1);c([o.kosFuture({alias:"gate"})],d.prototype,"testGate",1);c([o.kosModelEffect({dependencies:e=>[e.isAgitating]})],d.prototype,"handleAgitationChange",1);d=c([o.kosModel(ie)],d);const G=new o.KosModelRegistrationFactory({class:d,type:ie});var We=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,B=(e,t,r,s)=>{for(var a=s>1?void 0:s?Xe(t,r):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(a=(s?l(t,r,a):l(a))||a);return s&&a&&We(t,r,a),a};const j="agitation-required-trouble-model",Qe=e=>{if(e.data.agitationRequired)return j},ne="InsufficientAgitationTrouble";let b=class{constructor(e,t,r){i(this,"id");i(this,"logger");i(this,"trouble");i(this,"_deferred");i(this,"_holdersLoaded",!1);i(this,"agitateBeforePour");this.id=e,this.logger=r.logger,this._deferred=!1,this.trouble=t.companionParent}async resolve(){return this.trouble.resolve()}get holder(){const e=this.trouble.data.holderPaths[0],t=o.getKosModelSync(e);if(!(!this._holdersLoaded&&!t.model))return t==null?void 0:t.model}updateHolder(){if(!this._holdersLoaded){const e=this.trouble.data.holderPaths[0];o.getKosModelSync(e).model&&(this._holdersLoaded=!0)}}get shouldDefer(){var s,a;if(!this.holder)return!0;const t=(((s=this.holder)==null?void 0:s.troublesByType[ne])||[]).length>0;return!!((a=this.agitateBeforePour)!=null&&a.value)&&t}get deferred(){return this._deferred}defer(){this._deferred=!0}clearDefer(){this._deferred=!1}};B([o.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.agitateBeforePour"})],b.prototype,"agitateBeforePour",2);B([o.kosTopicHandler({topic:o.modelTypeEventTopicFactory(g.Assembly.type),lifecycle:o.DependencyLifecycle.INIT})],b.prototype,"updateHolder",1);b=B([o.kosModel(j)],b);const le=new o.KosModelRegistrationFactory({class:b,type:j}),Ze=["iceAgitator","carbAgitator"],Je={iceAgitator:G.factory,carbAgitator:N.factory},et=async e=>{const t=A.instance().options({}).build(),r=e.assemblies.reduce((n,l)=>{var u;return Ze.forEach(p=>{var P;const y=l[p];if(y){const ue=Je[p](y.path);n[p]=ue({name:y.name,path:y.path,statePath:((P=y.state)==null?void 0:P.path)||""})}}),(u=l.cartridgeAgitators)==null||u.forEach(p=>{var P;const y=U.instance(p.path).options({name:p.name,path:p.path,statePath:((P=p.state)==null?void 0:P.path)||""}).build();t.addModel(y)}),n},{}),s=!!r.iceAgitator,a=!!r.carbAgitator;return{...r,cartridgeAgitators:t,supportsCarb:a,supportsIce:s}},ge=e=>()=>(o.registerCoreModels(e)(),g.registerDispenseModels(e)(),z.register(),O.register(),G.register(),N.register(),A.register(),L.register(),R.register(),o.RegistrationManager.companion.register(e)(g.Nozzle.type,z.type),o.RegistrationManager.companion.register(e)(g.Assembly.type,O.type),le.register(),o.RegistrationManager.companion.register(e)(o.Trouble.type,Qe),o.RegistrationManager.companion.register(e)(g.Pump.type,L.type),o.RegistrationManager.companion.register(e)(g.Holder.type,R.type),o.ExtensionManager[o.EXTENSION_TROUBLE_DATA_MAPPER].register("EnjoyByTrouble",async t=>{if(t.data.enjoyByDate){const r=new Date(t.data.enjoyByDate);return{enjoyByDays:Math.floor((new Date().getTime()-r.getTime())/(1e3*60*60*24))||""}}return{}}),o.ExtensionManager[o.EXTENSION_TROUBLE_DATA_MAPPER].register("SuperPumpRequiredTrouble",async t=>{const{model:r}=o.getKosModelSync(g.PumpContainer.type);return r?{superPumps:r.models.getIndexByKey(g.PumpIndex.byType,"microSuper").map(n=>n.name).join(", ")}:{}}),o.ExtensionManager[o.EXTENSION_TROUBLE_DATA_MAPPER].register("MicroPumpAirDetectTrouble",async t=>{if(t.ifaces.includes("container"))return{};if(t.data.pumpPath){const{model:r}=o.getKosModelSync(t.data.pumpPath);if(r){const s=r.ingredientId?o.getKosModelSync(r.ingredientId).model:void 0;return{ingredientId:r.ingredientId,ingredientName:(s==null?void 0:s.name)||""}}}return{}}),{preload:o.RegistrationManager.model.preloadModel(e),model:o.RegistrationManager.model.register(e),companion:o.RegistrationManager.companion.register(e),legacy:o.RegistrationManager.model.registerLegacyModel(e)}),h={...g.KosModelRegistry};h.freestyle={models:ge(h)};h.preload=o.RegistrationManager.model.preloadModel(h);h.model=o.RegistrationManager.model.register(h);h.companion=o.RegistrationManager.companion.register(h);h.legacy=o.RegistrationManager.model.registerLegacyModel(h);const tt=h;exports.AGITATION_REQUIRED_TROUBLE=ne;exports.AgitationRequiredTrouble=le;exports.CarbAgitator=N;exports.CartridgeAgitator=U;exports.CartridgeAgitatorContainer=A;exports.CartridgeAgitatorEvents=_;exports.FEATURE_SUPPORTS_ICE=W;exports.FreestyleAssembly=O;exports.FreestyleHolder=R;exports.FreestyleNozzle=z;exports.FreestylePump=L;exports.IceAgitator=G;exports.IceAgitatorEvents=v;exports.InvalidRequestError=D;exports.KosModelRegistry=tt;exports.NutritionInfoError=Q;exports.freestyleAssemblyDataMapper=et;exports.getFreestyleNutritionInfo=Z;exports.registerFreestyleModels=ge;exports.replacePump=te;
|
|
2
|
-
//# sourceMappingURL=freestyle-registration-manager-BNSA2Xyl.cjs.map
|