@kosdev-code/kos-ddk-model-components 3.0.5 → 3.0.7
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/components/holders/holder-card.d.ts.map +1 -1
- package/components/holders/macro-holder-card.d.ts.map +1 -1
- package/components/remote-nns-modal/remote-nns-modal.d.ts.map +1 -1
- package/components/replace-pump/replace-pump.d.ts.map +1 -1
- package/components/setup-sidebar/setup-sidebar.d.ts.map +1 -1
- package/components/spm-field-calibration/input-step/index.d.ts +2 -0
- package/components/spm-field-calibration/input-step/index.d.ts.map +1 -0
- package/components/spm-field-calibration/input-step/input-step.d.ts +11 -0
- package/components/spm-field-calibration/input-step/input-step.d.ts.map +1 -0
- package/components/spm-field-calibration/spm-field-calibration-modal.d.ts.map +1 -1
- package/index.cjs +231 -137
- package/index.cjs.map +1 -1
- package/index.js +232 -138
- package/index.js.map +1 -1
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FutureManager, kosComponent, useKosTranslation, useKosModel, kosAutoEffect, FutureEndState, KosLog, useConfigProperty, useKosRegions, useRegionTimeProps, useDateProps, getKosCompanionModel, registerExtensionPoint, CoreExtensionManager, ExtensionManager, Device, KosFeatureFlags, TroubleContainer, registerLegacyModel, initKosProvider, troubleDataFactory, isTroubleAware, useTroubleContainerModel, withDevice, useFormattedDate, useKosTranslationContext, useSoftwareInfo, useKosTime } from "@kosdev-code/kos-ui-sdk";
|
|
2
2
|
import { jsx, jsxs, Fragment } from "@emotion/react/jsx-runtime";
|
|
3
3
|
import styled from "@emotion/styled";
|
|
4
|
-
import { useComponentConfigurationContext, Modal, Header, BackButton, Content as Content$1, InfoCard, Footer as Footer$6, Button, CloseButton, ProgressBar, LabelInformation, BodyMediumInformation, InputCard, WorkflowModal, StatusIndicator, InputRangeCard, ToggleCard, PickerCard, Card, SwitchCard, MultiPickerCard, LabelDate, Table, LabelInformationExtraSmall, getItemData, TapAndHoldButton, ComponentConfigurationProvider, useAbbreviation, getFillColor, HolderDashboardCard, FuelGauge, UtilityModalHeading, FrameContainer, FrameBody, TabContainer, SettingsSubheading, StatusCard, NotificationCard, TabViewLayout, TabRouter, Tabs, CompactCloseButton, QuestionIconStyle, CancelProceedFooter, ErrorInputCard, StatusBar, InfoContainer, FailureCard, useNavigate, Sidebar, SwitchPickerCard } from "@kosdev-code/kos-ddk-components";
|
|
4
|
+
import { useComponentConfigurationContext, Modal, Header, BackButton, Content as Content$1, InfoCard, Footer as Footer$6, Button, CloseButton, ProgressBar, LabelInformation, BodyMediumInformation, InputCard, WorkflowModal, StatusIndicator, InputRangeCard, ToggleCard, PickerCard, Card, SwitchCard, MultiPickerCard, LabelDate, Table, LabelInformationExtraSmall, getItemData, TapAndHoldButton, ComponentConfigurationProvider, useAbbreviation, getFillColor, HolderDashboardCard, FuelGauge, UtilityModalHeading, FrameContainer, FrameBody, TabContainer, SettingsSubheading, StatusCard, NotificationCard, TabViewLayout, TabRouter, Tabs, CompactCloseButton, QuestionIconStyle, CancelProceedFooter, ErrorInputCard, StatusBar, ModalContainer, InfoContainer, FailureCard, useNavigate, Sidebar, HeadingExtraLarge, InfoMessage, InstructionCard, SwitchPickerCard } from "@kosdev-code/kos-ddk-components";
|
|
5
5
|
import React, { useState, useEffect, useCallback, useMemo, createContext, useContext, useRef, useLayoutEffect, Suspense } from "react";
|
|
6
6
|
import { AgitationControl, toTimeComponents, toSeconds, Animation, Application, CarbWater, CopyLogs, DashboardOperations, DispenserInfo, Door, IngredientSummary, MacroAssignment, NetworkTest, NetworkTestContainer, NutritiveSweetener, PlainWater, Lockout, TroubleActionManager, DDKModels, Reboot, Settings, SetupStep, SetupStepContainer, Start, Utilities, UtilitiesContainer, troubleVisibilityFilter } from "@kosdev-code/kos-ddk-models";
|
|
7
7
|
import { SuccessIcon, MessageErrorIcon, TimeIcon, CalendarIcon, MessageInformationIconWithBackground } from "@kosdev-code/kos-ddk-styles";
|
|
@@ -213,7 +213,7 @@ class GenericTroubleAction extends TroubleAction {
|
|
|
213
213
|
}
|
|
214
214
|
const TROUBLE_PRIME = "PrimeTrouble";
|
|
215
215
|
const TROUBLE_PURGE = "PurgeTrouble";
|
|
216
|
-
const Container$
|
|
216
|
+
const Container$3 = styled.div`
|
|
217
217
|
display: flex;
|
|
218
218
|
flex-direction: column;
|
|
219
219
|
overflow-y: auto;
|
|
@@ -233,7 +233,7 @@ const AgitatorModal = kosComponent(
|
|
|
233
233
|
contain: componentModeOverride !== "compact",
|
|
234
234
|
onClosed: onComplete,
|
|
235
235
|
show: !closing,
|
|
236
|
-
children: /* @__PURE__ */ jsxs(Container$
|
|
236
|
+
children: /* @__PURE__ */ jsxs(Container$3, { children: [
|
|
237
237
|
/* @__PURE__ */ jsx(
|
|
238
238
|
Header,
|
|
239
239
|
{
|
|
@@ -558,7 +558,7 @@ const CalibrateModal = kosComponent(
|
|
|
558
558
|
setState("failure");
|
|
559
559
|
break;
|
|
560
560
|
}
|
|
561
|
-
}, [future?.endState, future?.reason, state]);
|
|
561
|
+
}, [future, future?.endState, future?.reason, state]);
|
|
562
562
|
const workflow = useMemo(() => {
|
|
563
563
|
return {
|
|
564
564
|
"high-flow-test-idle": {
|
|
@@ -709,7 +709,7 @@ const CalibrateModal = kosComponent(
|
|
|
709
709
|
failure: {
|
|
710
710
|
information: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
711
711
|
/* @__PURE__ */ jsx(LabelInformation, { children: t("calibration-failed") }),
|
|
712
|
-
/* @__PURE__ */ jsx(BodyMediumInformation, { children: t(`error.${error
|
|
712
|
+
/* @__PURE__ */ jsx(BodyMediumInformation, { children: t(`error.${error}`) })
|
|
713
713
|
] }),
|
|
714
714
|
footer: /* @__PURE__ */ jsx(Button, { onPointerDown: onComplete, children: t("exit-calibration") }),
|
|
715
715
|
status: "error"
|
|
@@ -6946,8 +6946,8 @@ const HolderCard = kosComponent(
|
|
|
6946
6946
|
const data = useTroubleData(troubleModel);
|
|
6947
6947
|
const hasFuelGuage = holder.hasFuelGuage;
|
|
6948
6948
|
const fillPercent = holder.fillPercent;
|
|
6949
|
-
const holderColor = holder.removed ? "var(--ddk-component-dashboard-card-background-color-
|
|
6950
|
-
const holderHeaderColor = holder.removed ? "var(--ddk-component-dashboard-card-header-background-color)" : void 0;
|
|
6949
|
+
const holderColor = holder.removed ? "var(--ddk-component-dashboard-card-background-color-removed)" : disabled ? "var(--ddk-component-dashboard-card-background-color-disabled)" : hasTroubles ? `${troubleModel?.color}` : holder.unassigned ? "var(--ddk-component-dashboard-card-background-color-unassigned)" : void 0;
|
|
6950
|
+
const holderHeaderColor = !isCompact && holder.removed ? "var(--ddk-component-dashboard-card-header-background-color-removed)" : void 0;
|
|
6951
6951
|
const isLight = isLightColor$1(holderColor);
|
|
6952
6952
|
const fontColor = disabled ? "white" : holder.unassigned ? "var(--ddk-generic-color-grey-30)" : hasTroubles ? getFontColor$1(isLight) : assigned ? void 0 : "var(--ddk-component-dashboard-card-color-unassigned)";
|
|
6953
6953
|
const footerFontColor = disabled ? "white" : hasTroubles ? getFooterFontColor(isLight, holder) : assigned ? void 0 : "var(--ddk-component-dashboard-card-color-unassigned)";
|
|
@@ -7132,7 +7132,7 @@ const HolderGroupView = kosComponent(
|
|
|
7132
7132
|
const log$1 = KosLog.createLogger({ name: "holder-group-view" });
|
|
7133
7133
|
log$1.debug("holder-group-view component loaded");
|
|
7134
7134
|
const EXCLUDE_MACROS = ["water", "carb", "ns", "nns"];
|
|
7135
|
-
const Container$
|
|
7135
|
+
const Container$2 = styled.div`
|
|
7136
7136
|
display: flex;
|
|
7137
7137
|
flex-direction: column;
|
|
7138
7138
|
overflow-y: auto;
|
|
@@ -7206,9 +7206,10 @@ const MacroHolderCard = kosComponent(
|
|
|
7206
7206
|
const troubleCount = visibleTroubles?.length ?? 0;
|
|
7207
7207
|
const troubleModel = visibleTroubles?.[0];
|
|
7208
7208
|
const hasTroubles = visibleTroubles ? visibleTroubles.length > 0 : false;
|
|
7209
|
-
const holderColor = hasTroubles ? `${troubleModel?.color}` : void 0;
|
|
7209
|
+
const holderColor = holder.removed ? "var(--ddk-component-dashboard-card-background-color-removed)" : hasTroubles ? `${troubleModel?.color}` : holder.unassigned ? "var(--ddk-component-dashboard-card-background-color-unassigned)" : void 0;
|
|
7210
|
+
const holderHeaderColor = !isCompact && holder.removed ? "var(--ddk-component-dashboard-card-header-background-color-removed)" : void 0;
|
|
7210
7211
|
const isLight = isLightColor(holderColor);
|
|
7211
|
-
const fontColor = hasTroubles ? getFontColor(isLight) : assigned ? void 0 : "var(--ddk-component-dashboard-card-color-unassigned)";
|
|
7212
|
+
const fontColor = holder.unassigned ? "var(--ddk-generic-color-grey-30)" : hasTroubles ? getFontColor(isLight) : assigned ? void 0 : "var(--ddk-component-dashboard-card-color-unassigned)";
|
|
7212
7213
|
const abbreviatedName = useAbbreviation(
|
|
7213
7214
|
holder.name,
|
|
7214
7215
|
componentModeOverride === "compact"
|
|
@@ -7225,8 +7226,8 @@ const MacroHolderCard = kosComponent(
|
|
|
7225
7226
|
const key = ExtensionManager.executeDashboardKeyFactory(holder) || "";
|
|
7226
7227
|
const exts = getExtensions(DashboardPumpDetailExtension.id);
|
|
7227
7228
|
const details = exts.filter((ext) => !!ext.data).reduce((acc, ext) => {
|
|
7228
|
-
const
|
|
7229
|
-
acc[
|
|
7229
|
+
const data2 = ext.data;
|
|
7230
|
+
acc[data2.dashboardKey] = ext.data;
|
|
7230
7231
|
return acc;
|
|
7231
7232
|
}, {});
|
|
7232
7233
|
const hasExtension = !!details[key];
|
|
@@ -7244,7 +7245,11 @@ const MacroHolderCard = kosComponent(
|
|
|
7244
7245
|
);
|
|
7245
7246
|
const MainContent = HolderContent ? /* @__PURE__ */ jsx(HolderContent, { holder, onComplete: () => setShowModal(false) }) : hasExtension && DashboardPumpDetailComponent ? /* @__PURE__ */ jsx(DashboardPumpDetailComponent, { module: details[key]?.id, holder }) : null;
|
|
7246
7247
|
const troubleLabels = troubleLabelFactory(troubleModel);
|
|
7247
|
-
const
|
|
7248
|
+
const data = useTroubleData(troubleModel);
|
|
7249
|
+
const footer = hasTroubles ? /* @__PURE__ */ jsx(Footer$2, { color: fontColor, children: t(troubleLabels.summary, {
|
|
7250
|
+
context: troubleModel?.deferred ? "queued" : void 0,
|
|
7251
|
+
data
|
|
7252
|
+
}) }) : null;
|
|
7248
7253
|
const handleCardSelect = useCallback(() => {
|
|
7249
7254
|
if (holder.sortedPumps.length > 0) {
|
|
7250
7255
|
if (role === "technician") {
|
|
@@ -7261,6 +7266,7 @@ const MacroHolderCard = kosComponent(
|
|
|
7261
7266
|
HolderDashboardCard,
|
|
7262
7267
|
{
|
|
7263
7268
|
avatar,
|
|
7269
|
+
headerBackgroundColor: holderHeaderColor,
|
|
7264
7270
|
backgroundColor: holderColor,
|
|
7265
7271
|
body: hasTroubles ? null : macroSummaryContent,
|
|
7266
7272
|
footer,
|
|
@@ -7279,7 +7285,7 @@ const MacroHolderCard = kosComponent(
|
|
|
7279
7285
|
...modalOptions,
|
|
7280
7286
|
show: showModal,
|
|
7281
7287
|
onClose: () => setShowModal(false),
|
|
7282
|
-
children: /* @__PURE__ */ jsxs(Container$
|
|
7288
|
+
children: /* @__PURE__ */ jsxs(Container$2, { children: [
|
|
7283
7289
|
/* @__PURE__ */ jsx(
|
|
7284
7290
|
Header,
|
|
7285
7291
|
{
|
|
@@ -8281,7 +8287,7 @@ const WaterPumpCard = kosComponent(
|
|
|
8281
8287
|
] });
|
|
8282
8288
|
}
|
|
8283
8289
|
);
|
|
8284
|
-
const Container$
|
|
8290
|
+
const Container$1 = styled.section`
|
|
8285
8291
|
align-items: center;
|
|
8286
8292
|
display: flex;
|
|
8287
8293
|
flex-direction: column;
|
|
@@ -8324,7 +8330,7 @@ const RebootView = ({ onComplete }) => {
|
|
|
8324
8330
|
CloseButton: CompactCloseButton
|
|
8325
8331
|
}
|
|
8326
8332
|
),
|
|
8327
|
-
/* @__PURE__ */ jsxs(Container$
|
|
8333
|
+
/* @__PURE__ */ jsxs(Container$1, { children: [
|
|
8328
8334
|
/* @__PURE__ */ jsxs(Content, { children: [
|
|
8329
8335
|
/* @__PURE__ */ jsx(QuestionIconStyle, {}),
|
|
8330
8336
|
/* @__PURE__ */ jsx(TextContainer, { children: /* @__PURE__ */ jsx(UtilityModalHeading, { children: t("modal-heading", "Are you sure you want to reboot dispenser?") }) })
|
|
@@ -8355,10 +8361,13 @@ const RemoteNNSModal = kosComponent(
|
|
|
8355
8361
|
const holder = remoteTray.holder;
|
|
8356
8362
|
const pumps = holder.pumps.data.filter((pump) => pump.childPump);
|
|
8357
8363
|
const disabling = remoteTray.remoteTrayEnabled.value === true;
|
|
8358
|
-
const readyToSubmit = (
|
|
8359
|
-
|
|
8360
|
-
|
|
8361
|
-
|
|
8364
|
+
const readyToSubmit = useCallback(
|
|
8365
|
+
() => pumps.every((pump) => {
|
|
8366
|
+
const value = pumpCodes[pump.name];
|
|
8367
|
+
return value !== void 0 && value !== null && value !== "";
|
|
8368
|
+
}),
|
|
8369
|
+
[pumpCodes, pumps]
|
|
8370
|
+
);
|
|
8362
8371
|
const changePumpCode = useCallback((pumpName, pumpCode) => {
|
|
8363
8372
|
setPumpCodes((pumpCodes2) => {
|
|
8364
8373
|
return { ...pumpCodes2, [pumpName]: pumpCode };
|
|
@@ -8408,13 +8417,7 @@ const RemoteNNSModal = kosComponent(
|
|
|
8408
8417
|
} else {
|
|
8409
8418
|
setState("pump");
|
|
8410
8419
|
}
|
|
8411
|
-
}, [
|
|
8412
|
-
disabling,
|
|
8413
|
-
pumpCodes,
|
|
8414
|
-
pumps,
|
|
8415
|
-
remoteTray.remoteTrayEnabled,
|
|
8416
|
-
toggleRemoteTray
|
|
8417
|
-
]);
|
|
8420
|
+
}, [pumpCodes, pumps, toggleRemoteTray]);
|
|
8418
8421
|
const workflow = useMemo(() => {
|
|
8419
8422
|
return {
|
|
8420
8423
|
idle: {
|
|
@@ -8473,14 +8476,16 @@ const RemoteNNSModal = kosComponent(
|
|
|
8473
8476
|
}
|
|
8474
8477
|
};
|
|
8475
8478
|
}, [
|
|
8476
|
-
changePumpCode,
|
|
8477
8479
|
disabling,
|
|
8480
|
+
handlePumpCodeChange,
|
|
8478
8481
|
onComplete,
|
|
8479
8482
|
pumpCodes,
|
|
8480
8483
|
pumpErrors,
|
|
8481
8484
|
pumps,
|
|
8485
|
+
readyToSubmit,
|
|
8482
8486
|
submit,
|
|
8483
|
-
t
|
|
8487
|
+
t,
|
|
8488
|
+
toggleRemoteTray
|
|
8484
8489
|
]);
|
|
8485
8490
|
return /* @__PURE__ */ jsx(WorkflowModal, { ...workflow[state], onClose: () => onComplete() });
|
|
8486
8491
|
}
|
|
@@ -8528,14 +8533,6 @@ const ReplaceLine = kosComponent(
|
|
|
8528
8533
|
return /* @__PURE__ */ jsx(StatusBar, { show: status !== void 0, onClose: close, children: status === "failure" ? /* @__PURE__ */ jsx(FailureMessage, { children: t(error || "unknownError") }) : status === "success" ? /* @__PURE__ */ jsx(SuccessMessage, { children: t("success") }) : null });
|
|
8529
8534
|
}
|
|
8530
8535
|
);
|
|
8531
|
-
const Container$1 = styled.div`
|
|
8532
|
-
display: flex;
|
|
8533
|
-
flex-direction: column;
|
|
8534
|
-
overflow-y: auto;
|
|
8535
|
-
overflow-x: hidden;
|
|
8536
|
-
gap: 32px;
|
|
8537
|
-
height: 100%;
|
|
8538
|
-
`;
|
|
8539
8536
|
const ReplacePump = kosComponent(
|
|
8540
8537
|
({ pump, onComplete }) => {
|
|
8541
8538
|
const [closing, setClosing] = useState(false);
|
|
@@ -8581,7 +8578,7 @@ const ReplacePump = kosComponent(
|
|
|
8581
8578
|
contain: componentModeOverride !== "compact",
|
|
8582
8579
|
onClosed: onComplete,
|
|
8583
8580
|
show: !closing,
|
|
8584
|
-
children: /* @__PURE__ */ jsxs(
|
|
8581
|
+
children: /* @__PURE__ */ jsxs(ModalContainer, { children: [
|
|
8585
8582
|
/* @__PURE__ */ jsx(
|
|
8586
8583
|
Header,
|
|
8587
8584
|
{
|
|
@@ -8786,15 +8783,16 @@ const StepItem = styled.div`
|
|
|
8786
8783
|
display: flex;
|
|
8787
8784
|
gap: 8px;
|
|
8788
8785
|
align-items: center;
|
|
8786
|
+
padding: var(--ddk-component-setup-sidebar-step-item-padding);
|
|
8789
8787
|
`;
|
|
8790
8788
|
const StepTitle = styled.div`
|
|
8791
|
-
color: var(--ddk-
|
|
8792
|
-
font-size: var(--ddk-component-
|
|
8793
|
-
font-style:
|
|
8794
|
-
font-weight:
|
|
8795
|
-
line-height:
|
|
8796
|
-
letter-spacing:
|
|
8797
|
-
white-space:
|
|
8789
|
+
color: var(--ddk-component-step-title-color);
|
|
8790
|
+
font-size: var(--ddk-component-step-title-font-weight);
|
|
8791
|
+
font-style: var(--ddk-component-step-title-font-weight);
|
|
8792
|
+
font-weight: var(--ddk-component-step-title-font-weight);
|
|
8793
|
+
line-height: var(--ddk-component-step-title-line-height);
|
|
8794
|
+
letter-spacing: var(--ddk-component-step-title-letter-spacing);
|
|
8795
|
+
white-space: var(--ddk-component-step-title-white-space);
|
|
8798
8796
|
overflow: hidden;
|
|
8799
8797
|
`;
|
|
8800
8798
|
const SetupSidebarComp = kosComponent(({ setupStepContainer, onStepSelected, ...props }) => {
|
|
@@ -8849,9 +8847,55 @@ const Software = kosComponent(() => {
|
|
|
8849
8847
|
) }, index2))
|
|
8850
8848
|
] }, index));
|
|
8851
8849
|
});
|
|
8852
|
-
const
|
|
8853
|
-
|
|
8850
|
+
const InputStepContainer = styled.div`
|
|
8851
|
+
align-items: center;
|
|
8852
|
+
display: flex;
|
|
8853
|
+
gap: 32px;
|
|
8854
|
+
width: 100%;
|
|
8855
|
+
`;
|
|
8856
|
+
const ValueContainer = styled(HeadingExtraLarge)`
|
|
8857
|
+
border-bottom: 1px solid var(--ddk-semantic-control-border-color-default);
|
|
8858
|
+
border-top: 1px solid var(--ddk-semantic-control-border-color-default);
|
|
8859
|
+
color: var(--ddk-semantic-control-color-default);
|
|
8860
|
+
display: flex;
|
|
8861
|
+
flex: 1;
|
|
8862
|
+
justify-content: center;
|
|
8863
|
+
padding: 24px 0;
|
|
8864
|
+
`;
|
|
8865
|
+
const IconButton = styled(Button)`
|
|
8866
|
+
font-size: var(--ddk-component-input-step-font-size);
|
|
8867
|
+
font-weight: var(--ddk-component-input-step-font-weight);
|
|
8868
|
+
width: var(--ddk-component-input-step-button-width);
|
|
8869
|
+
height: var(--ddk-component-input-step-button-height);
|
|
8870
|
+
min-width: var(--ddk-component-input-step-button-width);
|
|
8871
|
+
min-height: var(--ddk-component-input-step-button-height);
|
|
8872
|
+
border-radius: var(--ddk-component-input-step-button-border-radius);
|
|
8854
8873
|
`;
|
|
8874
|
+
const InputStep = ({
|
|
8875
|
+
fixed = 1,
|
|
8876
|
+
step = 0.1,
|
|
8877
|
+
min = 0,
|
|
8878
|
+
max = 100,
|
|
8879
|
+
value,
|
|
8880
|
+
onChange
|
|
8881
|
+
}) => {
|
|
8882
|
+
const increase = useCallback(() => {
|
|
8883
|
+
let nextValue = value + step;
|
|
8884
|
+
if (nextValue > max) nextValue = max;
|
|
8885
|
+
onChange(nextValue);
|
|
8886
|
+
}, [max, onChange, step, value]);
|
|
8887
|
+
const decrease = useCallback(() => {
|
|
8888
|
+
let nextValue = value - step;
|
|
8889
|
+
if (nextValue < min) nextValue = min;
|
|
8890
|
+
onChange(nextValue);
|
|
8891
|
+
}, [min, onChange, step, value]);
|
|
8892
|
+
return /* @__PURE__ */ jsxs(InputStepContainer, { children: [
|
|
8893
|
+
/* @__PURE__ */ jsx(IconButton, { onPointerDown: decrease, children: "-" }),
|
|
8894
|
+
/* @__PURE__ */ jsx(ValueContainer, { children: value.toFixed(fixed) }),
|
|
8895
|
+
/* @__PURE__ */ jsx(IconButton, { onPointerDown: increase, children: "+" })
|
|
8896
|
+
] });
|
|
8897
|
+
};
|
|
8898
|
+
const DEFAULT_CALIBRATION_VALUE = 8;
|
|
8855
8899
|
const SPMFieldCalibrationModal = kosComponent(
|
|
8856
8900
|
({ pump, onComplete }) => {
|
|
8857
8901
|
const { t } = useKosTranslation("common", {
|
|
@@ -8861,6 +8905,12 @@ const SPMFieldCalibrationModal = kosComponent(
|
|
|
8861
8905
|
const [error, setError] = useState();
|
|
8862
8906
|
const [volume1, setVolume1] = useState();
|
|
8863
8907
|
const [volume2, setVolume2] = useState();
|
|
8908
|
+
const { calibrateVolume } = usePumpCalibration(pump);
|
|
8909
|
+
useEffect(() => {
|
|
8910
|
+
if (!calibrateVolume) return;
|
|
8911
|
+
if (volume1 === void 0) setVolume1(calibrateVolume.toString());
|
|
8912
|
+
if (volume2 === void 0) setVolume2(calibrateVolume.toString());
|
|
8913
|
+
}, [calibrateVolume, volume1, volume2]);
|
|
8864
8914
|
const { clearFuture, future } = useFutureContainer(pump);
|
|
8865
8915
|
useEffect(() => {
|
|
8866
8916
|
switch (future?.endState) {
|
|
@@ -8897,19 +8947,28 @@ const SPMFieldCalibrationModal = kosComponent(
|
|
|
8897
8947
|
const workflow = useMemo(() => {
|
|
8898
8948
|
return {
|
|
8899
8949
|
"preparation-idle": {
|
|
8900
|
-
information: /* @__PURE__ */
|
|
8901
|
-
|
|
8902
|
-
|
|
8903
|
-
{
|
|
8904
|
-
|
|
8905
|
-
|
|
8906
|
-
|
|
8907
|
-
|
|
8908
|
-
|
|
8909
|
-
|
|
8910
|
-
|
|
8911
|
-
|
|
8912
|
-
|
|
8950
|
+
information: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8951
|
+
/* @__PURE__ */ jsx(LabelInformation, { children: t("preparation-idle-step") }),
|
|
8952
|
+
/* @__PURE__ */ jsx(InfoMessage, { children: t("preparation-idle-alert") }),
|
|
8953
|
+
/* @__PURE__ */ jsx(InstructionCard, { children: /* @__PURE__ */ jsxs("ol", { children: [
|
|
8954
|
+
/* @__PURE__ */ jsx("li", { children: t("preparation-idle-info-1") }),
|
|
8955
|
+
/* @__PURE__ */ jsx("li", { children: t("preparation-idle-info-2") })
|
|
8956
|
+
] }) })
|
|
8957
|
+
] }),
|
|
8958
|
+
footer: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8959
|
+
/* @__PURE__ */ jsx(Button, { onPointerDown: onComplete, children: t("cancel") }),
|
|
8960
|
+
/* @__PURE__ */ jsx(
|
|
8961
|
+
Button,
|
|
8962
|
+
{
|
|
8963
|
+
onPointerDown: () => {
|
|
8964
|
+
clearFuture();
|
|
8965
|
+
pump.performPreCalibrate();
|
|
8966
|
+
setState("preparation-in-progress");
|
|
8967
|
+
},
|
|
8968
|
+
children: t("preparation-action")
|
|
8969
|
+
}
|
|
8970
|
+
)
|
|
8971
|
+
] })
|
|
8913
8972
|
},
|
|
8914
8973
|
"preparation-in-progress": {
|
|
8915
8974
|
information: /* @__PURE__ */ jsx(LabelInformation, { children: t("preparation-progress-info") }),
|
|
@@ -8923,19 +8982,25 @@ const SPMFieldCalibrationModal = kosComponent(
|
|
|
8923
8982
|
},
|
|
8924
8983
|
"preparation-failed": {},
|
|
8925
8984
|
"calibration-idle": {
|
|
8926
|
-
information: /* @__PURE__ */
|
|
8927
|
-
|
|
8928
|
-
|
|
8929
|
-
{
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
|
|
8934
|
-
|
|
8935
|
-
|
|
8936
|
-
|
|
8937
|
-
|
|
8938
|
-
|
|
8985
|
+
information: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8986
|
+
/* @__PURE__ */ jsx(LabelInformation, { children: t("calibration-idle-step") }),
|
|
8987
|
+
/* @__PURE__ */ jsx(InfoMessage, { children: t("calibration-idle-alert") }),
|
|
8988
|
+
/* @__PURE__ */ jsx(InstructionCard, { children: t("calibration-idle-info-1") })
|
|
8989
|
+
] }),
|
|
8990
|
+
footer: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8991
|
+
/* @__PURE__ */ jsx(Button, { onPointerDown: onComplete, children: t("cancel") }),
|
|
8992
|
+
/* @__PURE__ */ jsx(
|
|
8993
|
+
Button,
|
|
8994
|
+
{
|
|
8995
|
+
onPointerDown: () => {
|
|
8996
|
+
clearFuture();
|
|
8997
|
+
pump.performCalibrate();
|
|
8998
|
+
setState("calibration-in-progress");
|
|
8999
|
+
},
|
|
9000
|
+
children: t("calibrate")
|
|
9001
|
+
}
|
|
9002
|
+
)
|
|
9003
|
+
] })
|
|
8939
9004
|
},
|
|
8940
9005
|
"calibration-in-progress": {
|
|
8941
9006
|
information: /* @__PURE__ */ jsx(LabelInformation, { children: t("calibration-progress-info") }),
|
|
@@ -8945,49 +9010,64 @@ const SPMFieldCalibrationModal = kosComponent(
|
|
|
8945
9010
|
information: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8946
9011
|
/* @__PURE__ */ jsx(LabelInformation, { children: t("calibration-input-info") }),
|
|
8947
9012
|
/* @__PURE__ */ jsx(
|
|
8948
|
-
|
|
9013
|
+
InputStep,
|
|
8949
9014
|
{
|
|
8950
|
-
label: "Volume",
|
|
8951
|
-
unitValue: "ml",
|
|
8952
|
-
layout: "num",
|
|
8953
9015
|
onChange: (value) => {
|
|
8954
|
-
|
|
8955
|
-
setVolume1(value);
|
|
9016
|
+
setVolume1(value.toString());
|
|
8956
9017
|
},
|
|
8957
|
-
value: volume1 !== void 0 ? volume1 :
|
|
9018
|
+
value: volume1 !== void 0 ? Number(volume1) : DEFAULT_CALIBRATION_VALUE
|
|
8958
9019
|
}
|
|
8959
9020
|
)
|
|
8960
9021
|
] }),
|
|
8961
|
-
footer: /* @__PURE__ */
|
|
8962
|
-
Button,
|
|
8963
|
-
|
|
8964
|
-
|
|
8965
|
-
|
|
8966
|
-
|
|
8967
|
-
|
|
8968
|
-
|
|
8969
|
-
|
|
8970
|
-
|
|
8971
|
-
|
|
9022
|
+
footer: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9023
|
+
/* @__PURE__ */ jsx(Button, { onPointerDown: onComplete, children: t("cancel") }),
|
|
9024
|
+
/* @__PURE__ */ jsx(
|
|
9025
|
+
Button,
|
|
9026
|
+
{
|
|
9027
|
+
disabled: volume1 === void 0,
|
|
9028
|
+
onPointerDown: () => {
|
|
9029
|
+
if (volume1 === void 0) return;
|
|
9030
|
+
setState("calibration-input-confirmation");
|
|
9031
|
+
},
|
|
9032
|
+
children: t("proceed")
|
|
9033
|
+
}
|
|
9034
|
+
)
|
|
9035
|
+
] })
|
|
9036
|
+
},
|
|
9037
|
+
"calibration-input-confirmation": {
|
|
9038
|
+
information: /* @__PURE__ */ jsx(LabelInformation, { children: t("calibration-confirm-info", {
|
|
9039
|
+
data: { volume: Number(volume1).toFixed(1) }
|
|
9040
|
+
}) }),
|
|
9041
|
+
footer: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9042
|
+
/* @__PURE__ */ jsx(Button, { onPointerDown: () => setState("calibration-input"), children: t("go-back") }),
|
|
9043
|
+
/* @__PURE__ */ jsx(Button, { onPointerDown: () => setState("verification-idle"), children: t("confirm-and-proceed") })
|
|
9044
|
+
] }),
|
|
8972
9045
|
status: "information"
|
|
8973
9046
|
},
|
|
8974
|
-
// Todo: calibration-input-confirmation if necessary...
|
|
8975
|
-
"calibration-input-confirmation": {},
|
|
8976
9047
|
"verification-idle": {
|
|
8977
|
-
information: /* @__PURE__ */
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
{
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
|
|
8986
|
-
|
|
8987
|
-
|
|
8988
|
-
|
|
8989
|
-
|
|
8990
|
-
|
|
9048
|
+
information: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9049
|
+
/* @__PURE__ */ jsx(LabelInformation, { children: t("verification-idle-step") }),
|
|
9050
|
+
/* @__PURE__ */ jsx(InfoMessage, { children: t("verification-idle-alert") }),
|
|
9051
|
+
/* @__PURE__ */ jsx(InstructionCard, { children: /* @__PURE__ */ jsxs("ol", { children: [
|
|
9052
|
+
/* @__PURE__ */ jsx("li", { children: t("verification-idle-info-1") }),
|
|
9053
|
+
/* @__PURE__ */ jsx("li", { children: t("verification-idle-info-2") })
|
|
9054
|
+
] }) })
|
|
9055
|
+
] }),
|
|
9056
|
+
footer: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9057
|
+
/* @__PURE__ */ jsx(Button, { onPointerDown: onComplete, children: t("cancel") }),
|
|
9058
|
+
/* @__PURE__ */ jsx(
|
|
9059
|
+
Button,
|
|
9060
|
+
{
|
|
9061
|
+
onPointerDown: async () => {
|
|
9062
|
+
if (volume1 === void 0) return;
|
|
9063
|
+
clearFuture();
|
|
9064
|
+
pump.performVerify(volume1, future?.clientData);
|
|
9065
|
+
setState("verification-in-progress");
|
|
9066
|
+
},
|
|
9067
|
+
children: t("initiate-verification-pour")
|
|
9068
|
+
}
|
|
9069
|
+
)
|
|
9070
|
+
] })
|
|
8991
9071
|
},
|
|
8992
9072
|
"verification-in-progress": {
|
|
8993
9073
|
information: /* @__PURE__ */ jsx(LabelInformation, { children: t("verification-progress-info") }),
|
|
@@ -8998,45 +9078,59 @@ const SPMFieldCalibrationModal = kosComponent(
|
|
|
8998
9078
|
information: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8999
9079
|
/* @__PURE__ */ jsx(LabelInformation, { children: t("verification-input-info") }),
|
|
9000
9080
|
/* @__PURE__ */ jsx(
|
|
9001
|
-
|
|
9081
|
+
InputStep,
|
|
9002
9082
|
{
|
|
9003
|
-
label: "Volume",
|
|
9004
|
-
unitValue: "ml",
|
|
9005
|
-
layout: "num",
|
|
9006
9083
|
onChange: (value) => {
|
|
9007
|
-
|
|
9008
|
-
setVolume2(value);
|
|
9084
|
+
setVolume2(value.toString());
|
|
9009
9085
|
},
|
|
9010
|
-
value: volume2 !== void 0 ? volume2 :
|
|
9086
|
+
value: volume2 !== void 0 ? Number(volume2) : DEFAULT_CALIBRATION_VALUE
|
|
9087
|
+
}
|
|
9088
|
+
)
|
|
9089
|
+
] }),
|
|
9090
|
+
footer: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9091
|
+
/* @__PURE__ */ jsx(Button, { onPointerDown: onComplete, children: t("cancel") }),
|
|
9092
|
+
/* @__PURE__ */ jsx(
|
|
9093
|
+
Button,
|
|
9094
|
+
{
|
|
9095
|
+
disabled: volume2 === void 0,
|
|
9096
|
+
onPointerDown: async () => {
|
|
9097
|
+
setState("verification-input-confirmation");
|
|
9098
|
+
},
|
|
9099
|
+
children: t("proceed")
|
|
9100
|
+
}
|
|
9101
|
+
)
|
|
9102
|
+
] })
|
|
9103
|
+
},
|
|
9104
|
+
"verification-input-confirmation": {
|
|
9105
|
+
information: /* @__PURE__ */ jsx(LabelInformation, { children: t("calibration-confirm-info", {
|
|
9106
|
+
data: { volume: Number(volume2).toFixed(1) }
|
|
9107
|
+
}) }),
|
|
9108
|
+
footer: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9109
|
+
/* @__PURE__ */ jsx(Button, { onPointerDown: () => setState("verification-input"), children: t("go-back") }),
|
|
9110
|
+
/* @__PURE__ */ jsx(
|
|
9111
|
+
Button,
|
|
9112
|
+
{
|
|
9113
|
+
onPointerDown: async () => {
|
|
9114
|
+
if (volume1 === void 0 || volume2 === void 0) return;
|
|
9115
|
+
clearFuture();
|
|
9116
|
+
const [error2, data] = await pump.performComplete(
|
|
9117
|
+
volume1,
|
|
9118
|
+
volume2,
|
|
9119
|
+
future?.clientData
|
|
9120
|
+
);
|
|
9121
|
+
if (error2) {
|
|
9122
|
+
setError(error2);
|
|
9123
|
+
setState("failure");
|
|
9124
|
+
} else {
|
|
9125
|
+
setState("verification-success");
|
|
9126
|
+
}
|
|
9127
|
+
},
|
|
9128
|
+
children: t("confirm-and-proceed")
|
|
9011
9129
|
}
|
|
9012
9130
|
)
|
|
9013
9131
|
] }),
|
|
9014
|
-
footer: /* @__PURE__ */ jsx(
|
|
9015
|
-
Button,
|
|
9016
|
-
{
|
|
9017
|
-
disabled: volume2 === void 0,
|
|
9018
|
-
onPointerDown: async () => {
|
|
9019
|
-
if (volume1 === void 0 || volume2 === void 0) return;
|
|
9020
|
-
clearFuture();
|
|
9021
|
-
const [error2, data] = await pump.performComplete(
|
|
9022
|
-
volume1,
|
|
9023
|
-
volume2,
|
|
9024
|
-
future?.clientData
|
|
9025
|
-
);
|
|
9026
|
-
if (error2) {
|
|
9027
|
-
setError(error2);
|
|
9028
|
-
setState("failure");
|
|
9029
|
-
} else {
|
|
9030
|
-
setState("verification-success");
|
|
9031
|
-
}
|
|
9032
|
-
},
|
|
9033
|
-
children: t("proceed")
|
|
9034
|
-
}
|
|
9035
|
-
),
|
|
9036
9132
|
status: "information"
|
|
9037
9133
|
},
|
|
9038
|
-
// Todo: verification-input-confirmation if necessary...
|
|
9039
|
-
"verification-input-confirmation": {},
|
|
9040
9134
|
"verification-success": {
|
|
9041
9135
|
information: /* @__PURE__ */ jsx(LabelInformation, { children: t("verification-success-info") }),
|
|
9042
9136
|
footer: /* @__PURE__ */ jsx(Button, { onPointerDown: onComplete, children: t("exit-calibration") }),
|