@pisell/private-materials 6.12.168 → 6.12.169
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +10 -10
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +10 -10
- package/es/components/HDLKiosk/{contracts → app/contracts}/config.js +1 -1
- package/es/components/HDLKiosk/app/manifest.js +11 -11
- package/es/components/HDLKiosk/app/operations.js +92 -0
- package/es/components/HDLKiosk/app/workflow/barcode.js +7 -3
- package/es/components/HDLKiosk/app/workflow/index.js +16 -0
- package/es/components/HDLKiosk/app/workflow/predicates.js +1 -1
- package/es/components/HDLKiosk/app/workflow/quick.js +1 -1
- package/es/components/HDLKiosk/app/workflow/registry.js +4 -4
- package/es/components/HDLKiosk/app/workflow/scale.js +5 -1
- package/es/components/HDLKiosk/docs/00-/346/226/207/344/273/266/345/257/274/350/210/252.md +104 -167
- package/es/components/HDLKiosk/docs/01-/346/240/270/345/277/203/350/277/220/350/241/214/346/234/272/345/210/266.md +95 -89
- package/es/components/HDLKiosk/docs/04-/350/256/276/345/244/207/344/270/216/347/247/260/351/207/215.md +43 -26
- package/es/components/HDLKiosk/docs/05-/344/272/244/346/230/223/345/256/211/345/205/250.md +2 -0
- package/es/components/HDLKiosk/docs/08-/346/227/240/345/244/264Application/350/277/220/350/241/214/346/227/266/351/207/215/346/236/204/350/256/276/350/256/241.md +719 -0
- package/es/components/HDLKiosk/docs/09-Entry/350/256/276/345/244/207/344/272/213/344/273/266/351/207/215/346/236/204/344/277/256/345/244/215/346/212/245/345/221/212.md +187 -0
- package/es/components/HDLKiosk/docs/README.md +6 -2
- package/es/components/HDLKiosk/docs//345/256/236/346/226/275/350/277/233/345/272/246.md +8 -7
- package/es/components/HDLKiosk/docs//346/236/266/346/236/204/350/256/276/350/256/241.md +16 -18
- package/es/components/HDLKiosk/index.js +22 -28
- package/es/components/HDLKiosk/index.less +1 -1
- package/es/components/HDLKiosk/kernel/README.md +13 -12
- package/es/components/HDLKiosk/kernel/application/defineApplication.js +63 -24
- package/es/components/HDLKiosk/kernel/application/defineSlice.js +6 -6
- package/es/components/HDLKiosk/kernel/application/runtime.js +237 -0
- package/es/components/HDLKiosk/kernel/operations/coordinator.js +1 -1
- package/es/components/HDLKiosk/kernel/operations/registry.js +3 -3
- package/es/components/HDLKiosk/kernel/operations/sessionEpoch.js +1 -1
- package/es/components/HDLKiosk/kernel/operations/types.js +7 -3
- package/es/components/HDLKiosk/kernel/workflow/actor.js +16 -17
- package/es/components/HDLKiosk/kernel/workflow/compiler.js +14 -16
- package/es/components/HDLKiosk/runtime/createRuntime.js +238 -0
- package/es/components/HDLKiosk/{devices → runtime/devices}/dedupeStore.js +1 -1
- package/es/components/HDLKiosk/{devices → runtime/devices}/scaleIngress.js +1 -1
- package/es/components/HDLKiosk/{devices/scale/runtime.js → runtime/devices/scaleStore.js} +18 -24
- package/es/components/HDLKiosk/{devices → runtime/devices}/scannerIngress.js +1 -1
- package/es/components/HDLKiosk/runtime/devices/scannerSessionPort.js +60 -0
- package/es/components/HDLKiosk/runtime/devices/scannerSessionRouter.js +212 -0
- package/es/components/HDLKiosk/runtime/operations/barcode.js +18 -0
- package/es/components/HDLKiosk/runtime/operations/cart.js +44 -0
- package/es/components/HDLKiosk/{app → runtime}/operations/cartConsistency.js +1 -1
- package/es/components/HDLKiosk/{app → runtime}/operations/checkout.js +95 -110
- package/es/components/HDLKiosk/{app → runtime}/operations/checkoutRequirements.js +1 -1
- package/es/components/HDLKiosk/{app → runtime}/operations/checkoutSafety.js +1 -1
- package/es/components/HDLKiosk/{app → runtime}/operations/coordinator.js +2 -2
- package/es/components/HDLKiosk/runtime/operations/customization.js +70 -0
- package/es/components/HDLKiosk/{app → runtime}/operations/errors.js +1 -1
- package/es/components/HDLKiosk/runtime/operations/fulfillment.js +6 -0
- package/es/components/HDLKiosk/runtime/operations/identity.js +55 -0
- package/es/components/HDLKiosk/runtime/operations/registry.js +34 -0
- package/es/components/HDLKiosk/runtime/operations/session.js +29 -0
- package/es/components/HDLKiosk/runtime/operations/types.js +13 -0
- package/es/components/HDLKiosk/runtime/session/blockPolicy.js +14 -0
- package/es/components/HDLKiosk/runtime/{createWorkflowSession.js → session/createSession.js} +67 -17
- package/es/components/HDLKiosk/runtime/{domainTransitionRunner.js → session/transitionRunner.js} +10 -5
- package/es/components/HDLKiosk/runtime/{workflowContext.js → session/workflowContext.js} +2 -2
- package/es/components/HDLKiosk/runtime/{workflowLifecycle.js → session/workflowLifecycle.js} +2 -2
- package/es/components/HDLKiosk/runtime/triggers.js +28 -0
- package/es/components/HDLKiosk/slices/catalog/Screen/index.js +15 -8
- package/es/components/HDLKiosk/slices/catalog/Screen/index.less +74 -13
- package/es/components/HDLKiosk/slices/catalog/slice.js +2 -2
- package/es/components/HDLKiosk/slices/customization/Screen/index.js +34 -35
- package/es/components/HDLKiosk/slices/customization/Screen/index.less +5 -0
- package/es/components/HDLKiosk/slices/customization/slice.js +2 -3
- package/es/components/HDLKiosk/slices/fulfillment/slice.js +2 -2
- package/es/components/HDLKiosk/slices/fulfillment/view.js +1 -1
- package/es/components/HDLKiosk/slices/identity/slice.js +2 -2
- package/es/components/HDLKiosk/slices/identity/view.js +1 -1
- package/es/components/HDLKiosk/slices/payment/slice.js +3 -3
- package/es/components/HDLKiosk/slices/primaryProductPrompt/slice.js +1 -1
- package/es/components/HDLKiosk/{runtime → ui}/HDLKioskWorkflowView.js +43 -129
- package/es/components/HDLKiosk/ui/ScaleSimulatorConsole/index.js +387 -0
- package/es/components/HDLKiosk/ui/ScaleSimulatorConsole/index.less +621 -0
- package/es/components/HDLKiosk/{app → ui}/ScreenRenderer.js +1 -1
- package/es/components/HDLKiosk/ui/controllers/useHDLKioskActionDispatcher.js +66 -0
- package/es/components/HDLKiosk/{runtime → ui}/controllers/useHDLKioskCustomerController.js +1 -1
- package/es/components/HDLKiosk/ui/controllers/useHDLKioskDeviceController.js +25 -0
- package/es/components/HDLKiosk/ui/controllers/useHDLKioskExitController.js +53 -0
- package/es/components/HDLKiosk/{runtime → ui}/controllers/useHDLKioskScreenData.js +1 -1
- package/es/components/HDLKiosk/ui/controllers/useHDLKioskSessionController.js +39 -0
- package/es/components/HDLKiosk/{app → ui}/entry/Screen/index.js +8 -6
- package/es/components/HDLKiosk/{app → ui}/entry/model.js +2 -2
- package/es/components/HDLKiosk/ui/scale.js +20 -0
- package/es/components/HDLKiosk/{runtime/useHostSnapshot.js → ui/snapshots.js} +6 -8
- package/es/components/HDLKiosk/{app → ui}/views.js +1 -1
- package/es/components/HDLKiosk/{runtime → ui}/workflowEvent.js +1 -1
- package/es/components/HDLKiosk/utils.js +4 -4
- package/es/components/bigSale/components/BookingFloatingPanel/useBookingPanelController.js +1 -0
- package/es/components/bigSale/components/TimeBar/index.js +1 -0
- package/es/components/bigSale/dialog.js +1 -0
- package/es/components/bigSale/hooks/useBigSaleContext.js +1 -0
- package/es/components/bigSale/hooks/useSelectFloorMapResourceForBigSale.js +1 -0
- package/es/components/bigSale/index.js +1 -0
- package/es/components/bigSale/templates/HDLKiosk/adapter/HDLKioskPaymentRuntime.js +2 -1
- package/es/components/bigSale/templates/HDLKiosk/adapter/capabilities.js +1 -1
- package/es/components/bigSale/templates/HDLKiosk/adapter/projection.js +21 -11
- package/es/components/bigSale/templates/HDLKiosk/adapter/sales.js +21 -3
- package/es/components/bigSale/templates/HDLKiosk/adapter/scaleTrigger.js +20 -5
- package/es/components/bigSale/templates/HDLKiosk/adapter/useBigSaleHDLKioskHost.js +3 -0
- package/es/components/bigSale/templates/HDLKiosk/index.js +3 -3
- package/es/components/bigSale/templates/Kiosk/index.js +1 -0
- package/es/components/sharedSecondaryBigSale/SharedSecondaryBigSaleReceiver.js +1 -0
- package/es/index.js +2 -0
- package/es/plus/pisellReservation/data/bookingToReservationTables.js +1 -1
- package/es/plus/pisellReservation/floorMap/floorPlanApi.js +1 -1
- package/es/plus/pisellReservation/floorMap/reservationMock.js +1 -1
- package/es/plus/pisellReservation/index.js +17 -0
- package/es/plus/saleDetail/Base.js +1 -0
- package/es/plus/saleDetail/components/Client/hooks/useClientSelectorProps.js +1 -0
- package/es/plus/saleDetail/components/DetailActions/index.js +1 -0
- package/es/plus/saleDetail/components/SummaryFinancialSections/index.js +1 -0
- package/es/plus/saleDetail/index.js +1 -0
- package/es/plus/saleDetail/tmpl/B/components/Dish/index.js +1 -0
- package/es/plus/saleDetail/tmpl/B/index.js +1 -0
- package/es/plus/salesSdk/index.js +52 -0
- package/es/plus/salesSdk/utils/addProductWithFlowDebounced.js +1 -1
- package/es/plus/salesSdk/utils/bookingDate.js +1 -1
- package/es/plus/salesSdk/utils/customerAuthGate.js +1 -1
- package/es/plus/salesSdk/utils/enrichCartLineHolderDisplay.js +1 -1
- package/es/pro/Login2.0/AuthModal.d.ts +1 -1
- package/es/pro/Login2.0/index.d.ts +2 -1
- package/es/pro/Login2.0/shared/types.d.ts +1 -1
- package/lib/components/HDLKiosk/{contracts → app/contracts}/config.js +1 -1
- package/lib/components/HDLKiosk/app/manifest.js +18 -19
- package/lib/components/HDLKiosk/app/operations.js +105 -0
- package/lib/components/HDLKiosk/app/workflow/barcode.js +7 -3
- package/lib/components/HDLKiosk/app/workflow/index.js +16 -0
- package/lib/components/HDLKiosk/app/workflow/predicates.js +1 -0
- package/lib/components/HDLKiosk/app/workflow/quick.js +1 -1
- package/lib/components/HDLKiosk/app/workflow/registry.js +3 -3
- package/lib/components/HDLKiosk/app/workflow/scale.js +5 -1
- package/lib/components/HDLKiosk/docs/00-/346/226/207/344/273/266/345/257/274/350/210/252.md +104 -167
- package/lib/components/HDLKiosk/docs/01-/346/240/270/345/277/203/350/277/220/350/241/214/346/234/272/345/210/266.md +95 -89
- package/lib/components/HDLKiosk/docs/04-/350/256/276/345/244/207/344/270/216/347/247/260/351/207/215.md +43 -26
- package/lib/components/HDLKiosk/docs/05-/344/272/244/346/230/223/345/256/211/345/205/250.md +2 -0
- package/lib/components/HDLKiosk/docs/08-/346/227/240/345/244/264Application/350/277/220/350/241/214/346/227/266/351/207/215/346/236/204/350/256/276/350/256/241.md +719 -0
- package/lib/components/HDLKiosk/docs/09-Entry/350/256/276/345/244/207/344/272/213/344/273/266/351/207/215/346/236/204/344/277/256/345/244/215/346/212/245/345/221/212.md +187 -0
- package/lib/components/HDLKiosk/docs/README.md +6 -2
- package/lib/components/HDLKiosk/docs//345/256/236/346/226/275/350/277/233/345/272/246.md +8 -7
- package/lib/components/HDLKiosk/docs//346/236/266/346/236/204/350/256/276/350/256/241.md +16 -18
- package/lib/components/HDLKiosk/index.js +25 -31
- package/lib/components/HDLKiosk/index.less +1 -1
- package/lib/components/HDLKiosk/kernel/README.md +13 -12
- package/lib/components/HDLKiosk/kernel/application/defineApplication.js +65 -25
- package/lib/components/HDLKiosk/kernel/application/defineSlice.js +6 -6
- package/lib/components/HDLKiosk/kernel/application/runtime.js +237 -0
- package/lib/components/HDLKiosk/kernel/operations/coordinator.js +1 -1
- package/lib/components/HDLKiosk/kernel/operations/registry.js +3 -3
- package/lib/components/HDLKiosk/kernel/operations/sessionEpoch.js +1 -1
- package/lib/components/HDLKiosk/kernel/operations/types.js +8 -3
- package/lib/components/HDLKiosk/kernel/workflow/actor.js +16 -17
- package/lib/components/HDLKiosk/kernel/workflow/compiler.js +14 -16
- package/lib/components/HDLKiosk/runtime/createRuntime.js +239 -0
- package/lib/components/HDLKiosk/{devices → runtime/devices}/dedupeStore.js +1 -1
- package/lib/components/HDLKiosk/{devices → runtime/devices}/scaleIngress.js +1 -1
- package/lib/components/HDLKiosk/{devices/scale/runtime.js → runtime/devices/scaleStore.js} +17 -27
- package/lib/components/HDLKiosk/{devices → runtime/devices}/scannerIngress.js +1 -1
- package/lib/components/HDLKiosk/runtime/devices/scannerSessionPort.js +60 -0
- package/lib/components/HDLKiosk/runtime/devices/scannerSessionRouter.js +212 -0
- package/lib/components/HDLKiosk/runtime/operations/barcode.js +17 -0
- package/lib/components/HDLKiosk/runtime/operations/cart.js +46 -0
- package/lib/components/HDLKiosk/{app → runtime}/operations/cartConsistency.js +1 -1
- package/lib/components/HDLKiosk/{app → runtime}/operations/checkout.js +97 -112
- package/lib/components/HDLKiosk/{app → runtime}/operations/checkoutRequirements.js +1 -1
- package/lib/components/HDLKiosk/{app → runtime}/operations/checkoutSafety.js +1 -1
- package/lib/components/HDLKiosk/{app → runtime}/operations/coordinator.js +2 -2
- package/lib/components/HDLKiosk/runtime/operations/customization.js +73 -0
- package/lib/components/HDLKiosk/{app → runtime}/operations/errors.js +1 -1
- package/lib/components/HDLKiosk/runtime/operations/fulfillment.js +5 -0
- package/lib/components/HDLKiosk/runtime/operations/identity.js +55 -0
- package/lib/components/HDLKiosk/runtime/operations/registry.js +34 -0
- package/lib/components/HDLKiosk/runtime/operations/session.js +30 -0
- package/lib/components/HDLKiosk/runtime/operations/types.js +14 -0
- package/lib/components/HDLKiosk/runtime/session/blockPolicy.js +14 -0
- package/lib/components/HDLKiosk/runtime/{createWorkflowSession.js → session/createSession.js} +71 -21
- package/lib/components/HDLKiosk/runtime/{domainTransitionRunner.js → session/transitionRunner.js} +10 -5
- package/lib/components/HDLKiosk/runtime/{workflowContext.js → session/workflowContext.js} +2 -2
- package/lib/components/HDLKiosk/runtime/{workflowLifecycle.js → session/workflowLifecycle.js} +2 -2
- package/lib/components/HDLKiosk/runtime/triggers.js +28 -0
- package/lib/components/HDLKiosk/slices/catalog/Screen/index.js +15 -8
- package/lib/components/HDLKiosk/slices/catalog/Screen/index.less +74 -13
- package/lib/components/HDLKiosk/slices/catalog/slice.js +3 -3
- package/lib/components/HDLKiosk/slices/customization/Screen/index.js +35 -36
- package/lib/components/HDLKiosk/slices/customization/Screen/index.less +5 -0
- package/lib/components/HDLKiosk/slices/customization/slice.js +5 -6
- package/lib/components/HDLKiosk/slices/fulfillment/slice.js +3 -3
- package/lib/components/HDLKiosk/slices/fulfillment/view.js +1 -1
- package/lib/components/HDLKiosk/slices/identity/slice.js +4 -4
- package/lib/components/HDLKiosk/slices/identity/view.js +1 -1
- package/lib/components/HDLKiosk/slices/payment/slice.js +5 -5
- package/lib/components/HDLKiosk/slices/primaryProductPrompt/slice.js +1 -1
- package/lib/components/HDLKiosk/{runtime → ui}/HDLKioskWorkflowView.js +44 -130
- package/lib/components/HDLKiosk/ui/ScaleSimulatorConsole/index.js +390 -0
- package/lib/components/HDLKiosk/ui/ScaleSimulatorConsole/index.less +621 -0
- package/lib/components/HDLKiosk/{app → ui}/ScreenRenderer.js +1 -1
- package/lib/components/HDLKiosk/ui/controllers/useHDLKioskActionDispatcher.js +67 -0
- package/lib/components/HDLKiosk/{runtime → ui}/controllers/useHDLKioskCustomerController.js +1 -1
- package/lib/components/HDLKiosk/ui/controllers/useHDLKioskDeviceController.js +26 -0
- package/lib/components/HDLKiosk/ui/controllers/useHDLKioskExitController.js +54 -0
- package/lib/components/HDLKiosk/{runtime → ui}/controllers/useHDLKioskScreenData.js +1 -1
- package/lib/components/HDLKiosk/ui/controllers/useHDLKioskSessionController.js +40 -0
- package/lib/components/HDLKiosk/{app → ui}/entry/Screen/index.js +8 -6
- package/lib/components/HDLKiosk/{app → ui}/entry/model.js +2 -2
- package/lib/components/HDLKiosk/ui/scale.js +24 -0
- package/lib/components/HDLKiosk/{runtime/useHostSnapshot.js → ui/snapshots.js} +6 -7
- package/lib/components/HDLKiosk/{app → ui}/views.js +1 -1
- package/lib/components/HDLKiosk/{runtime → ui}/workflowEvent.js +1 -1
- package/lib/components/HDLKiosk/utils.js +4 -4
- package/lib/components/bigSale/templates/HDLKiosk/adapter/HDLKioskPaymentRuntime.js +2 -1
- package/lib/components/bigSale/templates/HDLKiosk/adapter/capabilities.js +1 -1
- package/lib/components/bigSale/templates/HDLKiosk/adapter/projection.js +21 -10
- package/lib/components/bigSale/templates/HDLKiosk/adapter/sales.js +20 -2
- package/lib/components/bigSale/templates/HDLKiosk/adapter/scaleTrigger.js +19 -4
- package/lib/components/bigSale/templates/HDLKiosk/adapter/useBigSaleHDLKioskHost.js +3 -0
- package/lib/components/bigSale/templates/HDLKiosk/index.js +4 -4
- package/package.json +3 -3
- package/es/components/HDLKiosk/app/constants.js +0 -9
- package/es/components/HDLKiosk/app/operations/barcode.js +0 -22
- package/es/components/HDLKiosk/app/operations/cart.js +0 -60
- package/es/components/HDLKiosk/app/operations/fulfillment.js +0 -11
- package/es/components/HDLKiosk/app/operations/session.js +0 -41
- package/es/components/HDLKiosk/app/operations/types.js +0 -11
- package/es/components/HDLKiosk/devices/entryArbiter.js +0 -33
- package/es/components/HDLKiosk/runtime/controllers/useHDLKioskDeviceController.js +0 -75
- package/es/components/HDLKiosk/runtime/controllers/useHDLKioskScannerController.js +0 -160
- package/es/components/HDLKiosk/runtime/controllers/useHDLKioskSessionController.js +0 -185
- package/es/components/HDLKiosk/runtime/useWorkflowSnapshot.js +0 -12
- package/es/components/HDLKiosk/slices/customization/operation.js +0 -80
- package/es/components/HDLKiosk/slices/identity/operation.js +0 -60
- package/es/private-materials/lowcode/authmodal/meta.d.ts +0 -1
- package/lib/components/HDLKiosk/app/constants.js +0 -9
- package/lib/components/HDLKiosk/app/operations/barcode.js +0 -21
- package/lib/components/HDLKiosk/app/operations/cart.js +0 -62
- package/lib/components/HDLKiosk/app/operations/fulfillment.js +0 -10
- package/lib/components/HDLKiosk/app/operations/session.js +0 -42
- package/lib/components/HDLKiosk/app/operations/types.js +0 -12
- package/lib/components/HDLKiosk/devices/entryArbiter.js +0 -33
- package/lib/components/HDLKiosk/runtime/controllers/useHDLKioskDeviceController.js +0 -76
- package/lib/components/HDLKiosk/runtime/controllers/useHDLKioskScannerController.js +0 -161
- package/lib/components/HDLKiosk/runtime/controllers/useHDLKioskSessionController.js +0 -186
- package/lib/components/HDLKiosk/runtime/useWorkflowSnapshot.js +0 -13
- package/lib/components/HDLKiosk/slices/customization/operation.js +0 -83
- package/lib/components/HDLKiosk/slices/identity/operation.js +0 -60
- /package/es/components/HDLKiosk/{app → ui}/entry/Screen/index.less +0 -0
- /package/lib/components/HDLKiosk/{app → ui}/entry/Screen/index.less +0 -0
|
@@ -30,7 +30,7 @@ function resolveRepeat(value, path, issues) {
|
|
|
30
30
|
exceeded: "blocked"
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function canReachTerminal(initial, nodes) {
|
|
34
34
|
const visited = /* @__PURE__ */ new Set();
|
|
35
35
|
const pending = [initial];
|
|
36
36
|
while (pending.length > 0) {
|
|
@@ -39,7 +39,7 @@ function canReachSuccess(initial, nodes) {
|
|
|
39
39
|
visited.add(stepId);
|
|
40
40
|
const node = nodes[stepId];
|
|
41
41
|
if (!node) continue;
|
|
42
|
-
if (node.
|
|
42
|
+
if (node.isTerminal) return true;
|
|
43
43
|
Object.values(node.on).forEach((transition) => {
|
|
44
44
|
if (transition) pending.push(transition.target);
|
|
45
45
|
});
|
|
@@ -123,10 +123,10 @@ function compileWorkflowStructure(input, options) {
|
|
|
123
123
|
"visitPolicy",
|
|
124
124
|
"useGuards",
|
|
125
125
|
"on",
|
|
126
|
-
"
|
|
127
|
-
"
|
|
126
|
+
"isTerminal",
|
|
127
|
+
"surface"
|
|
128
128
|
], stepPath, issues);
|
|
129
|
-
if (rawStep.
|
|
129
|
+
if (rawStep.surface !== void 0) addIssue(issues, "step.surface.forbidden", `${stepPath}.surface`, "Surface is resolved by the local Activity Contract");
|
|
130
130
|
if (rawStep.visitPolicy !== void 0 && rawStep.visitPolicy !== "always" && rawStep.visitPolicy !== "once") addIssue(issues, "step.visitPolicy.invalid", `${stepPath}.visitPolicy`, "Step visitPolicy must be always or once");
|
|
131
131
|
const activityValue = rawStep.activity;
|
|
132
132
|
if (typeof activityValue !== "string" || !activities.has(activityValue)) addIssue(issues, "activity.unknown", `${stepPath}.activity`, `Unknown activity: ${String(activityValue)}`);
|
|
@@ -168,7 +168,7 @@ function compileWorkflowStructure(input, options) {
|
|
|
168
168
|
else if (rawPresentation.mode === "modal") presentation = { mode: "modal" };
|
|
169
169
|
}
|
|
170
170
|
if (rawStep.readiness !== void 0 && rawStep.readiness !== "implemented" && rawStep.readiness !== "placeholder") addIssue(issues, "step.readiness.invalid", `${stepPath}.readiness`, "Step readiness must be implemented or placeholder");
|
|
171
|
-
if (rawStep.
|
|
171
|
+
if (rawStep.isTerminal !== void 0 && typeof rawStep.isTerminal !== "boolean") addIssue(issues, "step.isTerminal.invalid", `${stepPath}.isTerminal`, "Step isTerminal must be a boolean");
|
|
172
172
|
if (rawStep.on !== void 0 && !isRecord(rawStep.on)) addIssue(issues, "step.intents.invalid", `${stepPath}.on`, "Step intents must be an object");
|
|
173
173
|
const transitions = {};
|
|
174
174
|
const addTransition = (intent, rawTarget, path) => {
|
|
@@ -228,13 +228,13 @@ function compileWorkflowStructure(input, options) {
|
|
|
228
228
|
nodes[stepId] = Object.freeze({
|
|
229
229
|
id: stepId,
|
|
230
230
|
activity: activity.id,
|
|
231
|
-
|
|
231
|
+
surfaceId: activity.surfaceId,
|
|
232
232
|
presentation,
|
|
233
233
|
readiness: rawStep.readiness === "placeholder" ? "placeholder" : void 0,
|
|
234
234
|
visitPolicy: rawStep.visitPolicy === "once" ? "once" : "always",
|
|
235
235
|
guardPhases: Object.freeze([...guardPhases]),
|
|
236
236
|
on: Object.freeze(transitions),
|
|
237
|
-
|
|
237
|
+
isTerminal: rawStep.isTerminal === true ? true : void 0
|
|
238
238
|
});
|
|
239
239
|
});
|
|
240
240
|
if (transitionCount > maxTransitions) addIssue(issues, "workflow.transitions.limit", "steps", `Workflow cannot contain more than ${maxTransitions} transitions`);
|
|
@@ -248,8 +248,8 @@ function compileWorkflowStructure(input, options) {
|
|
|
248
248
|
var _nodes$transition$tar;
|
|
249
249
|
if (node.presentation.mode === "modal" && transition && ((_nodes$transition$tar = nodes[transition.target]) === null || _nodes$transition$tar === void 0 ? void 0 : _nodes$transition$tar.presentation.mode) === "modal") addIssue(issues, "transition.modal.nested", `${path}.on.${intent}`, "A modal step cannot navigate directly to another modal step");
|
|
250
250
|
});
|
|
251
|
-
if (!node.
|
|
252
|
-
if (node.
|
|
251
|
+
if (!node.isTerminal && transitions.length === 0) addIssue(issues, "step.deadEnd", path, "A step without outgoing transitions must declare isTerminal: true");
|
|
252
|
+
if (node.isTerminal && transitions.length > 0) addIssue(issues, "step.isTerminal.hasTransitions", path, "A terminal step cannot expose outgoing transitions");
|
|
253
253
|
transitions.forEach(([intent, transition]) => {
|
|
254
254
|
var _stepIndex$get2, _stepIndex$get3;
|
|
255
255
|
if (!transition) return;
|
|
@@ -267,15 +267,14 @@ function compileWorkflowStructure(input, options) {
|
|
|
267
267
|
const reachable = initial ? reachableSteps(initial, nodes) : /* @__PURE__ */ new Set();
|
|
268
268
|
const unreachable = Object.keys(nodes).filter((stepId) => !reachable.has(stepId));
|
|
269
269
|
if (unreachable.length > 0) addIssue(issues, "workflow.steps.unreachable", "steps", `Every step must be reachable from the first step: ${unreachable.join(", ")}`);
|
|
270
|
-
if (initial && nodes[initial] && !
|
|
270
|
+
if (initial && nodes[initial] && !canReachTerminal(initial, nodes)) addIssue(issues, "workflow.terminal.unreachable", "steps", "The first step cannot reach a terminal step");
|
|
271
271
|
if (issues.length > 0) return {
|
|
272
272
|
status: "invalid",
|
|
273
273
|
issues: Object.freeze(issues)
|
|
274
274
|
};
|
|
275
275
|
const requirements = Object.freeze([...new Set(Object.values(nodes).flatMap((node) => {
|
|
276
|
-
var
|
|
277
|
-
|
|
278
|
-
return (_ref = (_activity$requirement = activity.requirements) !== null && _activity$requirement !== void 0 ? _activity$requirement : activity.checkoutRequirements) !== null && _ref !== void 0 ? _ref : [];
|
|
276
|
+
var _activity$requirement;
|
|
277
|
+
return (_activity$requirement = activities.require(node.activity).requirements) !== null && _activity$requirement !== void 0 ? _activity$requirement : [];
|
|
279
278
|
}))]);
|
|
280
279
|
return {
|
|
281
280
|
status: "valid",
|
|
@@ -284,8 +283,7 @@ function compileWorkflowStructure(input, options) {
|
|
|
284
283
|
initial,
|
|
285
284
|
stepOrder: Object.freeze([...stepIds]),
|
|
286
285
|
nodes: Object.freeze(nodes),
|
|
287
|
-
requirements
|
|
288
|
-
checkoutRequirements: requirements
|
|
286
|
+
requirements
|
|
289
287
|
})
|
|
290
288
|
};
|
|
291
289
|
}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
const require_objectSpread2 = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
|
|
2
|
+
const require_asyncToGenerator = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
|
|
3
|
+
const require_runtime = require("../kernel/application/runtime.js");
|
|
4
|
+
const require_manifest = require("../app/manifest.js");
|
|
5
|
+
const require_registry = require("../app/workflow/registry.js");
|
|
6
|
+
const require_triggers = require("./triggers.js");
|
|
7
|
+
const require_scannerSessionRouter = require("./devices/scannerSessionRouter.js");
|
|
8
|
+
const require_scannerSessionPort = require("./devices/scannerSessionPort.js");
|
|
9
|
+
const require_createSession = require("./session/createSession.js");
|
|
10
|
+
//#region src/components/HDLKiosk/runtime/createRuntime.ts
|
|
11
|
+
function resolveHDLKioskEntryCapabilityBlockReason({ entry, capabilities, primaryWeightedProductId }) {
|
|
12
|
+
if (!capabilities.session.ensure) return "sessionEnsureUnavailable";
|
|
13
|
+
if (entry === "barcode") return capabilities.scanner.available ? void 0 : "scannerUnavailable";
|
|
14
|
+
if (!capabilities.products.primaryWeightedProductQuery || !primaryWeightedProductId) return "primaryProductUnavailable";
|
|
15
|
+
if (require_registry.builtInWorkflowHasActivity(entry, "customization") && (!capabilities.customization.weightedProduct || !capabilities.scale.available)) return "customizationUnavailable";
|
|
16
|
+
if (entry === "scale" && (!capabilities.scale.available || !capabilities.scale.weightChangeTrigger)) return "scaleTriggerUnavailable";
|
|
17
|
+
}
|
|
18
|
+
const ENTRY_BY_WORKFLOW_ID = Object.freeze({
|
|
19
|
+
"hdl.quick": "quick",
|
|
20
|
+
"hdl.barcode": "barcode",
|
|
21
|
+
"hdl.scale": "scale"
|
|
22
|
+
});
|
|
23
|
+
function readStartPayload(payload) {
|
|
24
|
+
if (!payload || typeof payload !== "object") return {};
|
|
25
|
+
return payload;
|
|
26
|
+
}
|
|
27
|
+
function createHDLKioskApplicationRuntime(host, options) {
|
|
28
|
+
let sessionSequence = 0;
|
|
29
|
+
let active = false;
|
|
30
|
+
let disposed = false;
|
|
31
|
+
let startPromise;
|
|
32
|
+
let returnPromise;
|
|
33
|
+
let returnSequence = 0;
|
|
34
|
+
let snapshot = Object.freeze({
|
|
35
|
+
starting: false,
|
|
36
|
+
returning: false
|
|
37
|
+
});
|
|
38
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
39
|
+
const { config } = options;
|
|
40
|
+
const scannerRouter = require_scannerSessionRouter.createScannerSessionRouter({
|
|
41
|
+
host,
|
|
42
|
+
entrySupported: config.enabledEntries.includes("barcode")
|
|
43
|
+
});
|
|
44
|
+
const runtime = require_runtime.createApplicationRuntime({
|
|
45
|
+
definition: require_manifest.hdlKioskApplication,
|
|
46
|
+
triggerAdapters: require_triggers.createHDLKioskEntryTriggerAdapters(host, config, scannerRouter.triggerAdapter),
|
|
47
|
+
maxActiveSessions: 1,
|
|
48
|
+
sessionFactory: {
|
|
49
|
+
create: function() {
|
|
50
|
+
var _ref = require_asyncToGenerator._asyncToGenerator(function* ({ workflowId, payload, cause }) {
|
|
51
|
+
if (!scannerRouter.beginSessionStart(cause.correlationId)) throw new Error(`Scanner Session start conflict: ${cause.correlationId}`);
|
|
52
|
+
try {
|
|
53
|
+
const entry = ENTRY_BY_WORKFLOW_ID[workflowId];
|
|
54
|
+
if (!entry) throw new Error(`Unknown HDLKiosk Workflow: ${workflowId}`);
|
|
55
|
+
const startPayload = readStartPayload(payload);
|
|
56
|
+
sessionSequence += 1;
|
|
57
|
+
const session = require_createSession.createHDLKioskWorkflowSession(entry, host, {
|
|
58
|
+
sessionId: `${require_manifest.hdlKioskApplication.id}:${sessionSequence}`,
|
|
59
|
+
initialContext: startPayload.initialContext,
|
|
60
|
+
primaryWeightedProductId: config.primaryWeightedProductId,
|
|
61
|
+
cause
|
|
62
|
+
});
|
|
63
|
+
const ensured = yield session.ensure(`start:${cause.trigger}:${cause.occurrenceId}`);
|
|
64
|
+
if (ensured.status !== "succeeded") {
|
|
65
|
+
session.dispose();
|
|
66
|
+
throw new Error(ensured.status === "failed" || ensured.status === "partialFailure" || ensured.status === "unknown" ? `HDLKiosk Session ensure failed: ${ensured.error.traceId}` : "HDLKiosk Session ensure cancelled");
|
|
67
|
+
}
|
|
68
|
+
return session;
|
|
69
|
+
} catch (error) {
|
|
70
|
+
scannerRouter.failSessionStart(cause.correlationId);
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
return function create(_x) {
|
|
75
|
+
return _ref.apply(this, arguments);
|
|
76
|
+
};
|
|
77
|
+
}(),
|
|
78
|
+
onStarted: ({ session, cause }) => {
|
|
79
|
+
if (!session.isActive()) {
|
|
80
|
+
scannerRouter.failSessionStart(cause.correlationId);
|
|
81
|
+
throw new Error(`Inactive HDLKiosk Session started: ${session.id}`);
|
|
82
|
+
}
|
|
83
|
+
if (!scannerRouter.bindSession(cause.correlationId, require_scannerSessionPort.createHDLKioskScannerSessionPort(host, session))) throw new Error(`Scanner Session bind conflict: ${cause.correlationId}`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
const updateSnapshot = (next) => {
|
|
88
|
+
const candidate = Object.freeze(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, snapshot), next));
|
|
89
|
+
if (candidate.session === snapshot.session && candidate.starting === snapshot.starting && candidate.startErrorReference === snapshot.startErrorReference && candidate.returning === snapshot.returning && candidate.returnError === snapshot.returnError) return;
|
|
90
|
+
snapshot = candidate;
|
|
91
|
+
listeners.forEach((listener) => listener());
|
|
92
|
+
};
|
|
93
|
+
const unsubscribeSessions = runtime.sessions.subscribe((event) => {
|
|
94
|
+
var _snapshot$session;
|
|
95
|
+
if (event.type === "started") {
|
|
96
|
+
updateSnapshot({
|
|
97
|
+
session: event.session,
|
|
98
|
+
starting: false,
|
|
99
|
+
startErrorReference: void 0,
|
|
100
|
+
returning: false,
|
|
101
|
+
returnError: void 0
|
|
102
|
+
});
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (((_snapshot$session = snapshot.session) === null || _snapshot$session === void 0 ? void 0 : _snapshot$session.id) === event.sessionId) updateSnapshot({ session: void 0 });
|
|
106
|
+
});
|
|
107
|
+
const disposeSession = (sessionId) => {
|
|
108
|
+
if (!runtime.disposeSession(sessionId)) return false;
|
|
109
|
+
scannerRouter.releaseSession(sessionId);
|
|
110
|
+
return true;
|
|
111
|
+
};
|
|
112
|
+
const completeReset = (session) => {
|
|
113
|
+
if (snapshot.session !== session) return;
|
|
114
|
+
disposeSession(session.id);
|
|
115
|
+
};
|
|
116
|
+
const applicationRuntime = {
|
|
117
|
+
id: runtime.id,
|
|
118
|
+
getSnapshot: () => snapshot,
|
|
119
|
+
subscribe: (listener) => {
|
|
120
|
+
listeners.add(listener);
|
|
121
|
+
return () => listeners.delete(listener);
|
|
122
|
+
},
|
|
123
|
+
activate: () => {
|
|
124
|
+
runtime.activate();
|
|
125
|
+
active = true;
|
|
126
|
+
},
|
|
127
|
+
deactivate: () => {
|
|
128
|
+
active = false;
|
|
129
|
+
runtime.deactivate();
|
|
130
|
+
},
|
|
131
|
+
start: (entry) => {
|
|
132
|
+
if (!active || !config.enabledEntries.includes(entry)) return Promise.resolve(void 0);
|
|
133
|
+
if (startPromise) return startPromise;
|
|
134
|
+
if (config.businessMode === "production" && !require_registry.isBuiltInWorkflowProductionReady(entry)) {
|
|
135
|
+
updateSnapshot({ startErrorReference: `workflow-placeholder-blocked-${Date.now()}` });
|
|
136
|
+
return Promise.resolve(void 0);
|
|
137
|
+
}
|
|
138
|
+
const capabilityBlockReason = resolveHDLKioskEntryCapabilityBlockReason({
|
|
139
|
+
entry,
|
|
140
|
+
capabilities: host.capabilities,
|
|
141
|
+
primaryWeightedProductId: config.primaryWeightedProductId
|
|
142
|
+
});
|
|
143
|
+
if (capabilityBlockReason) {
|
|
144
|
+
if (capabilityBlockReason === "sessionEnsureUnavailable") updateSnapshot({ startErrorReference: `session-ensure-unavailable-${Date.now()}` });
|
|
145
|
+
return Promise.resolve(void 0);
|
|
146
|
+
}
|
|
147
|
+
const current = snapshot.session;
|
|
148
|
+
if (current) return Promise.resolve(current.entry === entry ? current : void 0);
|
|
149
|
+
updateSnapshot({
|
|
150
|
+
starting: true,
|
|
151
|
+
startErrorReference: void 0
|
|
152
|
+
});
|
|
153
|
+
const launch = runtime.workflow("hdl.quick").start().then((session) => {
|
|
154
|
+
if (active && !disposed) return session;
|
|
155
|
+
disposeSession(session.id);
|
|
156
|
+
}).catch(() => {
|
|
157
|
+
if (!snapshot.session && active && !disposed) updateSnapshot({ startErrorReference: `session-start-failed-${Date.now()}` });
|
|
158
|
+
}).finally(() => {
|
|
159
|
+
if (startPromise === launch) {
|
|
160
|
+
startPromise = void 0;
|
|
161
|
+
updateSnapshot({ starting: false });
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
startPromise = launch;
|
|
165
|
+
return launch;
|
|
166
|
+
},
|
|
167
|
+
completeReset,
|
|
168
|
+
returnToEntry: (reason = "application") => {
|
|
169
|
+
if (returnPromise) return returnPromise;
|
|
170
|
+
const current = snapshot.session;
|
|
171
|
+
if (!current) return Promise.resolve({
|
|
172
|
+
status: "succeeded",
|
|
173
|
+
data: void 0
|
|
174
|
+
});
|
|
175
|
+
returnSequence += 1;
|
|
176
|
+
updateSnapshot({
|
|
177
|
+
returning: true,
|
|
178
|
+
returnError: void 0
|
|
179
|
+
});
|
|
180
|
+
const pending = current.reset(`return:${reason}:${returnSequence}`).then((result) => {
|
|
181
|
+
if (result.status === "succeeded") {
|
|
182
|
+
updateSnapshot({ returning: false });
|
|
183
|
+
completeReset(current);
|
|
184
|
+
return result;
|
|
185
|
+
}
|
|
186
|
+
updateSnapshot({
|
|
187
|
+
returning: false,
|
|
188
|
+
returnError: result.status === "failed" || result.status === "partialFailure" || result.status === "unknown" ? result.error : {
|
|
189
|
+
code: "resetCancelled",
|
|
190
|
+
source: "operation",
|
|
191
|
+
recovery: "staff",
|
|
192
|
+
safeMessageKey: "hdlKiosk.error.resetCancelled",
|
|
193
|
+
traceId: `hdl-reset-cancelled-${Date.now()}`
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
return result;
|
|
197
|
+
}).catch((cause) => {
|
|
198
|
+
const error = {
|
|
199
|
+
code: "resetUnhandled",
|
|
200
|
+
source: "operation",
|
|
201
|
+
recovery: "staff",
|
|
202
|
+
safeMessageKey: "hdlKiosk.error.resetUnhandled",
|
|
203
|
+
traceId: `hdl-reset-unhandled-${Date.now()}`,
|
|
204
|
+
cause
|
|
205
|
+
};
|
|
206
|
+
updateSnapshot({
|
|
207
|
+
returning: false,
|
|
208
|
+
returnError: error
|
|
209
|
+
});
|
|
210
|
+
return {
|
|
211
|
+
status: "failed",
|
|
212
|
+
error
|
|
213
|
+
};
|
|
214
|
+
}).finally(() => {
|
|
215
|
+
if (returnPromise === pending) returnPromise = void 0;
|
|
216
|
+
});
|
|
217
|
+
returnPromise = pending;
|
|
218
|
+
return pending;
|
|
219
|
+
},
|
|
220
|
+
dispose: () => {
|
|
221
|
+
if (disposed) return;
|
|
222
|
+
disposed = true;
|
|
223
|
+
active = false;
|
|
224
|
+
runtime.dispose();
|
|
225
|
+
scannerRouter.dispose();
|
|
226
|
+
unsubscribeSessions();
|
|
227
|
+
snapshot = Object.freeze({
|
|
228
|
+
starting: false,
|
|
229
|
+
returning: false
|
|
230
|
+
});
|
|
231
|
+
listeners.forEach((listener) => listener());
|
|
232
|
+
listeners.clear();
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
return Object.freeze(applicationRuntime);
|
|
236
|
+
}
|
|
237
|
+
//#endregion
|
|
238
|
+
exports.createHDLKioskApplicationRuntime = createHDLKioskApplicationRuntime;
|
|
239
|
+
exports.resolveHDLKioskEntryCapabilityBlockReason = resolveHDLKioskEntryCapabilityBlockReason;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region src/components/HDLKiosk/devices/dedupeStore.ts
|
|
1
|
+
//#region src/components/HDLKiosk/runtime/devices/dedupeStore.ts
|
|
2
2
|
const DEFAULT_MAX_ENTRIES = 256;
|
|
3
3
|
const DEFAULT_TTL_MS = 2 * 6e4;
|
|
4
4
|
function createDedupeStore({ maxEntries = DEFAULT_MAX_ENTRIES, ttlMs = DEFAULT_TTL_MS, now = Date.now } = {}) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_dedupeStore = require("./dedupeStore.js");
|
|
2
|
-
//#region src/components/HDLKiosk/devices/scaleIngress.ts
|
|
2
|
+
//#region src/components/HDLKiosk/runtime/devices/scaleIngress.ts
|
|
3
3
|
const NON_NEGATIVE_DECIMAL = /^(?:0|[1-9]\d*)(?:\.\d+)?$/;
|
|
4
4
|
function isValidWeightChange(weight) {
|
|
5
5
|
if (weight.unit !== "g" && weight.unit !== "kg") return false;
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
|
|
2
1
|
const require_objectSpread2 = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
|
|
3
|
-
|
|
4
|
-
react = require_runtime.__toESM(react);
|
|
5
|
-
//#region src/components/HDLKiosk/devices/scale/runtime.ts
|
|
6
|
-
/**
|
|
7
|
-
* 文件角色:提供 HDLKiosk 生命周期内唯一的电子秤 Snapshot Hub 和 React Provider。
|
|
8
|
-
* 运行机制:BigSale NativeScale owner 持续 publish 原始读数/连接状态,Entry 和称重详情
|
|
9
|
-
* 通过 useSyncExternalStore 共享读取;是否消费由当前 Screen/Ingress 决定。
|
|
10
|
-
* 边界:Runtime 不执行业务跳转,也不直接写购物车。
|
|
11
|
-
*/
|
|
2
|
+
//#region src/components/HDLKiosk/runtime/devices/scaleStore.ts
|
|
12
3
|
const EMPTY_SNAPSHOT = Object.freeze({
|
|
13
4
|
active: false,
|
|
14
5
|
revision: 0,
|
|
15
6
|
status: null,
|
|
16
7
|
connectionState: null,
|
|
17
|
-
isListening: false
|
|
8
|
+
isListening: false,
|
|
9
|
+
hasLiveSample: false,
|
|
10
|
+
sampleSequence: 0
|
|
18
11
|
});
|
|
19
12
|
/**
|
|
20
13
|
* HDLKiosk 生命周期内唯一的称重快照仓库。
|
|
@@ -23,6 +16,7 @@ const EMPTY_SNAPSHOT = Object.freeze({
|
|
|
23
16
|
function createHDLScaleRuntime() {
|
|
24
17
|
const listeners = /* @__PURE__ */ new Set();
|
|
25
18
|
let snapshot = EMPTY_SNAPSHOT;
|
|
19
|
+
let invalidatedAtSampleSequence = 0;
|
|
26
20
|
const emit = () => listeners.forEach((listener) => listener());
|
|
27
21
|
return {
|
|
28
22
|
getSnapshot: () => snapshot,
|
|
@@ -31,6 +25,7 @@ function createHDLScaleRuntime() {
|
|
|
31
25
|
return () => listeners.delete(listener);
|
|
32
26
|
},
|
|
33
27
|
activate: (ownerId) => {
|
|
28
|
+
invalidatedAtSampleSequence = 0;
|
|
34
29
|
snapshot = Object.freeze(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, EMPTY_SNAPSHOT), {}, {
|
|
35
30
|
active: true,
|
|
36
31
|
ownerId,
|
|
@@ -46,14 +41,22 @@ function createHDLScaleRuntime() {
|
|
|
46
41
|
publish: (ownerId, publication) => {
|
|
47
42
|
var _ref, _publication$status, _publication$rawData, _ref2, _publication$connecti, _publication$rawData2, _ref3, _publication$updatedA, _publication$rawData3;
|
|
48
43
|
if (!snapshot.active || snapshot.ownerId !== ownerId) return;
|
|
44
|
+
const sampleSequence = Number.isFinite(publication.sampleSequence) ? Math.max(snapshot.sampleSequence, Number(publication.sampleSequence)) : snapshot.sampleSequence;
|
|
45
|
+
const status = (_ref = (_publication$status = publication.status) !== null && _publication$status !== void 0 ? _publication$status : (_publication$rawData = publication.rawData) === null || _publication$rawData === void 0 ? void 0 : _publication$rawData.status) !== null && _ref !== void 0 ? _ref : null;
|
|
46
|
+
const connectionState = (_ref2 = (_publication$connecti = publication.connectionState) !== null && _publication$connecti !== void 0 ? _publication$connecti : (_publication$rawData2 = publication.rawData) === null || _publication$rawData2 === void 0 ? void 0 : _publication$rawData2.connectionState) !== null && _ref2 !== void 0 ? _ref2 : null;
|
|
47
|
+
const isListening = publication.isListening === true;
|
|
48
|
+
const healthy = connectionState === "connected" && isListening && !publication.error && status !== "overload" && status !== "negative";
|
|
49
|
+
if (!healthy) invalidatedAtSampleSequence = sampleSequence;
|
|
49
50
|
snapshot = Object.freeze({
|
|
50
51
|
active: true,
|
|
51
52
|
ownerId,
|
|
52
53
|
revision: snapshot.revision + 1,
|
|
53
54
|
grossWeightKg: publication.grossWeightKg,
|
|
54
|
-
status
|
|
55
|
-
connectionState
|
|
56
|
-
isListening
|
|
55
|
+
status,
|
|
56
|
+
connectionState,
|
|
57
|
+
isListening,
|
|
58
|
+
hasLiveSample: healthy && sampleSequence > invalidatedAtSampleSequence,
|
|
59
|
+
sampleSequence,
|
|
57
60
|
rawData: publication.rawData,
|
|
58
61
|
error: publication.error,
|
|
59
62
|
updatedAt: (_ref3 = (_publication$updatedA = publication.updatedAt) !== null && _publication$updatedA !== void 0 ? _publication$updatedA : (_publication$rawData3 = publication.rawData) === null || _publication$rawData3 === void 0 ? void 0 : _publication$rawData3.timestamp) !== null && _ref3 !== void 0 ? _ref3 : Date.now()
|
|
@@ -62,18 +65,5 @@ function createHDLScaleRuntime() {
|
|
|
62
65
|
}
|
|
63
66
|
};
|
|
64
67
|
}
|
|
65
|
-
const HDLScaleRuntimeContext = (0, react.createContext)(createHDLScaleRuntime());
|
|
66
|
-
function HDLScaleRuntimeProvider({ runtime, children }) {
|
|
67
|
-
return react.default.createElement(HDLScaleRuntimeContext.Provider, {
|
|
68
|
-
value: runtime,
|
|
69
|
-
children
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
function useHDLScaleSnapshot() {
|
|
73
|
-
const runtime = (0, react.useContext)(HDLScaleRuntimeContext);
|
|
74
|
-
return (0, react.useSyncExternalStore)(runtime.subscribe, runtime.getSnapshot, runtime.getSnapshot);
|
|
75
|
-
}
|
|
76
68
|
//#endregion
|
|
77
|
-
exports.HDLScaleRuntimeProvider = HDLScaleRuntimeProvider;
|
|
78
69
|
exports.createHDLScaleRuntime = createHDLScaleRuntime;
|
|
79
|
-
exports.useHDLScaleSnapshot = useHDLScaleSnapshot;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_dedupeStore = require("./dedupeStore.js");
|
|
2
|
-
//#region src/components/HDLKiosk/devices/scannerIngress.ts
|
|
2
|
+
//#region src/components/HDLKiosk/runtime/devices/scannerIngress.ts
|
|
3
3
|
function createScannerIngress({ maxPendingEvents = 20, dedupe = require_dedupeStore.createDedupeStore() } = {}) {
|
|
4
4
|
if (!Number.isInteger(maxPendingEvents) || maxPendingEvents < 1) throw new Error("HDLKiosk scanner queue limit must be a positive integer");
|
|
5
5
|
return {
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const require_asyncToGenerator = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
|
|
2
|
+
//#region src/components/HDLKiosk/runtime/devices/scannerSessionPort.ts
|
|
3
|
+
const NON_WRITABLE_ACTIVITIES = new Set(["paymentCompleted"]);
|
|
4
|
+
const PAYMENT_OPERATION_IDS = new Set([
|
|
5
|
+
"checkout.open",
|
|
6
|
+
"checkout.payEftpos",
|
|
7
|
+
"checkout.requestStaffPaymentApproval",
|
|
8
|
+
"session.reset"
|
|
9
|
+
]);
|
|
10
|
+
function isPaymentFrozen(host) {
|
|
11
|
+
const status = host.sales.getObservedSnapshot().payment.status;
|
|
12
|
+
return status === "pending" || status === "unknown" || status === "succeeded";
|
|
13
|
+
}
|
|
14
|
+
function isHDLKioskSessionCartWritable(session) {
|
|
15
|
+
var _session$definition$n;
|
|
16
|
+
const snapshot = session.actor.getSnapshot();
|
|
17
|
+
if (snapshot.status === "blocked" || snapshot.status === "finished") return false;
|
|
18
|
+
const activity = (_session$definition$n = session.definition.nodes[snapshot.nodeId]) === null || _session$definition$n === void 0 ? void 0 : _session$definition$n.activity;
|
|
19
|
+
if (!activity || NON_WRITABLE_ACTIVITIES.has(activity)) return false;
|
|
20
|
+
return !(snapshot.activeOperation && PAYMENT_OPERATION_IDS.has(snapshot.activeOperation.definitionId));
|
|
21
|
+
}
|
|
22
|
+
function createHDLKioskScannerSessionPort(host, session) {
|
|
23
|
+
return Object.freeze({
|
|
24
|
+
id: session.id,
|
|
25
|
+
sessionEpoch: () => session.actor.getSnapshot().sessionEpoch,
|
|
26
|
+
decideConsume: () => {
|
|
27
|
+
if (isPaymentFrozen(host)) return {
|
|
28
|
+
status: "rejected",
|
|
29
|
+
reason: "paymentFrozen"
|
|
30
|
+
};
|
|
31
|
+
return isHDLKioskSessionCartWritable(session) ? { status: "accepted" } : {
|
|
32
|
+
status: "rejected",
|
|
33
|
+
reason: "sessionNotCartWritable"
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
beforeConsume: () => {
|
|
37
|
+
const pendingNavigation = session.actor.getSnapshot().pendingNavigation;
|
|
38
|
+
if (pendingNavigation) session.actor.resolvePendingNavigation(pendingNavigation.navigationId, "cancel");
|
|
39
|
+
},
|
|
40
|
+
consume: function() {
|
|
41
|
+
var _ref = require_asyncToGenerator._asyncToGenerator(function* ({ code, eventId }) {
|
|
42
|
+
const sessionEpoch = session.actor.getSnapshot().sessionEpoch;
|
|
43
|
+
const result = yield session.executeCommand("barcode.consume", { code }, `scan:${sessionEpoch}:${eventId}`);
|
|
44
|
+
if (result.status === "succeeded") return {
|
|
45
|
+
operationStatus: result.status,
|
|
46
|
+
queueDirective: result.data.code === "requiresSelection" ? "pauseForSelection" : "continue"
|
|
47
|
+
};
|
|
48
|
+
return {
|
|
49
|
+
operationStatus: result.status,
|
|
50
|
+
queueDirective: result.status === "partialFailure" || result.status === "unknown" ? "stopUncertain" : "continue"
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
return function consume(_x) {
|
|
54
|
+
return _ref.apply(this, arguments);
|
|
55
|
+
};
|
|
56
|
+
}()
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
exports.createHDLKioskScannerSessionPort = createHDLKioskScannerSessionPort;
|