@pisell/private-materials 6.12.168 → 6.12.170
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/components/common/HDLKioskSkuOptionsSelection/index.less +1 -1
- package/es/components/HDLKiosk/components/overlays/HDLKioskModal/index.less +1 -1
- package/es/components/HDLKiosk/components/shell/HDLKioskBottomBarHost/index.js +4 -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/02-Host/351/200/202/351/205/215/344/270/216/344/270/232/345/212/241/346/225/260/346/215/256.md +20 -19
- 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 +32 -30
- package/es/components/HDLKiosk/index.less +8 -3
- 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/Screen/index.less +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/Screen/index.less +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 +68 -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/collaborationStatus.js +11 -0
- 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/templates/HDLKiosk/README.md +43 -0
- package/es/components/bigSale/templates/HDLKiosk/adapter/createHost.js +7 -7
- package/es/components/bigSale/templates/HDLKiosk/adapter/{devices.js → devices/devicePort.js} +10 -38
- package/es/components/bigSale/templates/HDLKiosk/adapter/{capabilities.js → host/capabilities.js} +2 -2
- package/es/components/bigSale/templates/HDLKiosk/adapter/{fulfillment.js → host/fulfillmentWriter.js} +3 -3
- package/es/components/bigSale/templates/HDLKiosk/adapter/{projection.js → host/projection.js} +24 -14
- package/es/components/bigSale/templates/HDLKiosk/adapter/{telemetry.js → host/telemetry.js} +1 -1
- package/es/components/bigSale/templates/HDLKiosk/adapter/sales/cart.js +187 -0
- package/es/components/bigSale/templates/HDLKiosk/adapter/sales/catalog.js +160 -0
- package/es/components/bigSale/templates/HDLKiosk/adapter/{customizationProduct.js → sales/customizationProduct.js} +3 -3
- package/es/components/bigSale/templates/HDLKiosk/adapter/sales/fulfillment.js +31 -0
- package/es/components/bigSale/templates/HDLKiosk/adapter/sales/identity.js +57 -0
- package/es/components/bigSale/templates/HDLKiosk/adapter/sales/index.js +18 -0
- package/es/components/bigSale/templates/HDLKiosk/adapter/sales/payment.js +123 -0
- package/es/components/bigSale/templates/HDLKiosk/adapter/sales/session.js +71 -0
- package/es/components/bigSale/templates/HDLKiosk/adapter/sales/weightedOperations.js +124 -0
- package/es/components/bigSale/templates/HDLKiosk/adapter/{weightedProduct.js → sales/weightedProduct.js} +2 -2
- package/es/components/bigSale/templates/HDLKiosk/adapter/useBigSaleHDLKioskAdapter.js +41 -0
- package/es/components/bigSale/templates/HDLKiosk/adapter/useBigSaleHDLKioskHost.js +10 -7
- package/es/components/bigSale/templates/HDLKiosk/cart/useBigSaleHDLKioskCart.js +122 -0
- package/es/components/bigSale/templates/HDLKiosk/{adapter → hooks}/useHDLKioskEntryPreparationToast.js +2 -1
- package/es/components/bigSale/templates/HDLKiosk/index.js +42 -148
- package/es/components/bigSale/templates/HDLKiosk/{adapter/scaleTrigger.js → runtime/BigSaleScaleRuntimeOwner.js} +33 -62
- package/es/components/bigSale/templates/HDLKiosk/{adapter → runtime}/HDLKioskPaymentRuntime.js +4 -3
- package/es/components/bigSale/templates/HDLKiosk/runtime/scaleBridge.js +44 -0
- 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/components/common/HDLKioskSkuOptionsSelection/index.less +1 -1
- package/lib/components/HDLKiosk/components/overlays/HDLKioskModal/index.less +1 -1
- package/lib/components/HDLKiosk/components/shell/HDLKioskBottomBarHost/index.js +4 -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/02-Host/351/200/202/351/205/215/344/270/216/344/270/232/345/212/241/346/225/260/346/215/256.md +20 -19
- 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 +35 -33
- package/lib/components/HDLKiosk/index.less +8 -3
- 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/Screen/index.less +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/Screen/index.less +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 +69 -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/collaborationStatus.js +11 -0
- 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/README.md +43 -0
- package/lib/components/bigSale/templates/HDLKiosk/adapter/createHost.js +9 -9
- package/lib/components/bigSale/templates/HDLKiosk/adapter/{devices.js → devices/devicePort.js} +10 -38
- package/lib/components/bigSale/templates/HDLKiosk/adapter/{capabilities.js → host/capabilities.js} +2 -2
- package/lib/components/bigSale/templates/HDLKiosk/adapter/{fulfillment.js → host/fulfillmentWriter.js} +3 -3
- package/lib/components/bigSale/templates/HDLKiosk/adapter/{projection.js → host/projection.js} +25 -14
- package/lib/components/bigSale/templates/HDLKiosk/adapter/{telemetry.js → host/telemetry.js} +1 -1
- package/lib/components/bigSale/templates/HDLKiosk/adapter/sales/cart.js +189 -0
- package/lib/components/bigSale/templates/HDLKiosk/adapter/sales/catalog.js +162 -0
- package/lib/components/bigSale/templates/HDLKiosk/adapter/{customizationProduct.js → sales/customizationProduct.js} +4 -4
- package/lib/components/bigSale/templates/HDLKiosk/adapter/sales/fulfillment.js +31 -0
- package/lib/components/bigSale/templates/HDLKiosk/adapter/sales/identity.js +57 -0
- package/lib/components/bigSale/templates/HDLKiosk/adapter/sales/index.js +18 -0
- package/lib/components/bigSale/templates/HDLKiosk/adapter/sales/payment.js +123 -0
- package/lib/components/bigSale/templates/HDLKiosk/adapter/sales/session.js +71 -0
- package/lib/components/bigSale/templates/HDLKiosk/adapter/sales/weightedOperations.js +126 -0
- package/lib/components/bigSale/templates/HDLKiosk/adapter/{weightedProduct.js → sales/weightedProduct.js} +3 -3
- package/lib/components/bigSale/templates/HDLKiosk/adapter/useBigSaleHDLKioskAdapter.js +42 -0
- package/lib/components/bigSale/templates/HDLKiosk/adapter/useBigSaleHDLKioskHost.js +10 -7
- package/lib/components/bigSale/templates/HDLKiosk/cart/useBigSaleHDLKioskCart.js +124 -0
- package/lib/components/bigSale/templates/HDLKiosk/{adapter → hooks}/useHDLKioskEntryPreparationToast.js +2 -1
- package/lib/components/bigSale/templates/HDLKiosk/index.js +43 -149
- package/lib/components/bigSale/templates/HDLKiosk/{adapter/scaleTrigger.js → runtime/BigSaleScaleRuntimeOwner.js} +31 -61
- package/lib/components/bigSale/templates/HDLKiosk/{adapter → runtime}/HDLKioskPaymentRuntime.js +4 -3
- package/lib/components/bigSale/templates/HDLKiosk/runtime/scaleBridge.js +44 -0
- package/package.json +2 -2
- 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/components/bigSale/templates/HDLKiosk/adapter/sales.js +0 -692
- 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/lib/components/bigSale/templates/HDLKiosk/adapter/sales.js +0 -694
- /package/es/components/HDLKiosk/{app → ui}/entry/Screen/index.less +0 -0
- /package/lib/components/HDLKiosk/{app → ui}/entry/Screen/index.less +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { _objectSpread2 } from "../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
2
2
|
import { _asyncToGenerator } from "../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
3
|
-
import { useHDLScaleSnapshot } from "../../../devices/scale/runtime.js";
|
|
4
3
|
import { useHDLKioskBottomBar, useHDLKioskBottomBarController } from "../../../components/shell/HDLKioskBottomBarHost/index.js";
|
|
5
4
|
import { HDLKioskOrderSummary } from "../../../components/shell/HDLKioskOrderSummary/index.js";
|
|
6
5
|
import { createHDLKioskSkuValue, readHDLKioskProductOptionGroups, readHDLKioskProductOptionItems } from "../../../components/common/HDLKioskSkuOptionsSelection/model.js";
|
|
7
6
|
import HDLKioskSkuOptionsSelection from "../../../components/common/HDLKioskSkuOptionsSelection/index.js";
|
|
8
7
|
import { resolveHDLWeightedProduct } from "../../../product.js";
|
|
8
|
+
import { useHDLScaleRuntime, useHDLScaleSnapshot } from "../../../ui/scale.js";
|
|
9
9
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
10
10
|
import { STANDARD_WEIGHT_UNIT, formatAmount, getWeightUnitSymbol, locales } from "@pisell/utils";
|
|
11
11
|
import Decimal from "decimal.js";
|
|
@@ -27,13 +27,10 @@ function getScaleStatusText(scale) {
|
|
|
27
27
|
if (scale.error) return locales.getText("pisell2.hdl-kiosk.scale-reading-error");
|
|
28
28
|
if (scale.connectionState === "disconnected") return locales.getText("pisell2.hdl-kiosk.scale-disconnected");
|
|
29
29
|
if (scale.connectionState !== "connected" || !scale.isListening) return locales.getText("pisell2.hdl-kiosk.scale-connecting");
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
case "unstable":
|
|
35
|
-
case null: return locales.getText("pisell2.hdl-kiosk.scale-unstable");
|
|
36
|
-
}
|
|
30
|
+
if (scale.status === "overload") return locales.getText("pisell2.hdl-kiosk.scale-overload");
|
|
31
|
+
if (scale.status === "negative") return locales.getText("pisell2.hdl-kiosk.scale-negative");
|
|
32
|
+
if (!scale.hasLiveSample) return locales.getText("pisell2.hdl-kiosk.scale-connecting");
|
|
33
|
+
return locales.getText(scale.status === "stable" ? "pisell2.hdl-kiosk.scale-stable" : "pisell2.hdl-kiosk.scale-unstable");
|
|
37
34
|
}
|
|
38
35
|
function initialSelections(product) {
|
|
39
36
|
if (!product) return [];
|
|
@@ -71,6 +68,19 @@ function formatMoney(value, currencySymbol) {
|
|
|
71
68
|
const amount = value.toDecimalPlaces(2).toNumber();
|
|
72
69
|
return String(formatAmount(amount, 2, currencySymbol || ""));
|
|
73
70
|
}
|
|
71
|
+
function resolveScaleMeasurement(scale, productFacts, minimumWeightKg) {
|
|
72
|
+
var _scale$grossWeightKg, _productFacts$fixedTa, _productFacts$fixedTa2;
|
|
73
|
+
const gross = new Decimal((_scale$grossWeightKg = scale.grossWeightKg) !== null && _scale$grossWeightKg !== void 0 ? _scale$grossWeightKg : NaN);
|
|
74
|
+
const tare = (_productFacts$fixedTa = productFacts === null || productFacts === void 0 || (_productFacts$fixedTa2 = productFacts.fixedTare) === null || _productFacts$fixedTa2 === void 0 ? void 0 : _productFacts$fixedTa2.valueKg) !== null && _productFacts$fixedTa !== void 0 ? _productFacts$fixedTa : new Decimal(0);
|
|
75
|
+
const numbersValid = gross.isFinite() && tare.isFinite() && !gross.isNegative() && !tare.isNegative();
|
|
76
|
+
const net = numbersValid ? Decimal.max(gross.minus(tare), 0) : new Decimal(0);
|
|
77
|
+
return {
|
|
78
|
+
gross,
|
|
79
|
+
tare,
|
|
80
|
+
net,
|
|
81
|
+
valid: numbersValid && scale.active && scale.hasLiveSample && scale.isListening && scale.connectionState === "connected" && scale.status === "stable" && !scale.error && net.greaterThanOrEqualTo(minimumWeightKg) && (productFacts === null || productFacts === void 0 ? void 0 : productFacts.available) === true
|
|
82
|
+
};
|
|
83
|
+
}
|
|
74
84
|
function BackIcon() {
|
|
75
85
|
return /* @__PURE__ */ React.createElement("svg", {
|
|
76
86
|
viewBox: "0 0 24 24",
|
|
@@ -159,6 +169,7 @@ function ProductFallback() {
|
|
|
159
169
|
}
|
|
160
170
|
function CustomizationScreen({ product, loading, errorReference, errorMessage, busy, syncing, canGoBack, minimumWeightKg, orderBar, send }) {
|
|
161
171
|
var _productFacts$product, _orderBar$primaryLine, _orderBar$primaryLine2, _orderBar$primaryLine3, _orderBar$primaryLine4, _orderBar$primaryLine7, _productFacts$unitPri, _orderBar$primaryLine9, _orderBar$primaryLine11;
|
|
172
|
+
const scaleRuntime = useHDLScaleRuntime();
|
|
162
173
|
const scale = useHDLScaleSnapshot();
|
|
163
174
|
const skuOptionsRef = useRef(null);
|
|
164
175
|
const hydratedDraftKeyRef = useRef();
|
|
@@ -179,30 +190,21 @@ function CustomizationScreen({ product, loading, errorReference, errorMessage, b
|
|
|
179
190
|
(_orderBar$primaryLine7 = orderBar.primaryLine) === null || _orderBar$primaryLine7 === void 0 ? void 0 : _orderBar$primaryLine7.skuValue,
|
|
180
191
|
product
|
|
181
192
|
]);
|
|
182
|
-
const measurement = useMemo(() =>
|
|
183
|
-
var _scale$grossWeightKg, _productFacts$fixedTa, _productFacts$fixedTa2;
|
|
184
|
-
const gross = new Decimal((_scale$grossWeightKg = scale.grossWeightKg) !== null && _scale$grossWeightKg !== void 0 ? _scale$grossWeightKg : NaN);
|
|
185
|
-
const tare = (_productFacts$fixedTa = productFacts === null || productFacts === void 0 || (_productFacts$fixedTa2 = productFacts.fixedTare) === null || _productFacts$fixedTa2 === void 0 ? void 0 : _productFacts$fixedTa2.valueKg) !== null && _productFacts$fixedTa !== void 0 ? _productFacts$fixedTa : new Decimal(0);
|
|
186
|
-
const numbersValid = gross.isFinite() && tare.isFinite() && !gross.isNegative() && !tare.isNegative();
|
|
187
|
-
const net = numbersValid ? Decimal.max(gross.minus(tare), 0) : new Decimal(0);
|
|
188
|
-
return {
|
|
189
|
-
gross,
|
|
190
|
-
tare,
|
|
191
|
-
net,
|
|
192
|
-
valid: numbersValid && scale.active && scale.isListening && scale.connectionState === "connected" && scale.status === "stable" && !scale.error && net.greaterThanOrEqualTo(minimumWeightKg) && (productFacts === null || productFacts === void 0 ? void 0 : productFacts.available) === true
|
|
193
|
-
};
|
|
194
|
-
}, [
|
|
193
|
+
const measurement = useMemo(() => resolveScaleMeasurement(scale, productFacts, minimumWeightKg), [
|
|
195
194
|
minimumWeightKg,
|
|
196
195
|
productFacts,
|
|
197
196
|
scale
|
|
198
197
|
]);
|
|
199
198
|
const statusText = getScaleStatusText(scale);
|
|
200
|
-
const
|
|
199
|
+
const readingInvalid = scale.status === "overload" || scale.status === "negative";
|
|
200
|
+
const stable = scale.status === "stable" && scale.hasLiveSample && scale.connectionState === "connected" && scale.isListening && !scale.error;
|
|
201
201
|
const unitPricePerStandardWeight = (_productFacts$unitPri = productFacts === null || productFacts === void 0 ? void 0 : productFacts.unitPricePerKg) !== null && _productFacts$unitPri !== void 0 ? _productFacts$unitPri : new Decimal(0);
|
|
202
202
|
const amountText = orderBar.confirmedAmount !== void 0 ? formatMoney(new Decimal(orderBar.confirmedAmount), orderBar.currencySymbol) : "—";
|
|
203
203
|
const submit = useCallback(_asyncToGenerator(function* () {
|
|
204
|
-
var _skuOptionsRef$curren2, _skuOptionsRef$curren3, _orderBar$primaryLine8,
|
|
205
|
-
|
|
204
|
+
var _skuOptionsRef$curren2, _skuOptionsRef$curren3, _orderBar$primaryLine8, _currentScale$updated;
|
|
205
|
+
const currentScale = scaleRuntime.getSnapshot();
|
|
206
|
+
const currentMeasurement = resolveScaleMeasurement(currentScale, productFacts, minimumWeightKg);
|
|
207
|
+
if (!productFacts || !currentMeasurement.valid || busy || syncing) return;
|
|
206
208
|
try {
|
|
207
209
|
var _skuOptionsRef$curren;
|
|
208
210
|
yield (_skuOptionsRef$curren = skuOptionsRef.current) === null || _skuOptionsRef$curren === void 0 ? void 0 : _skuOptionsRef$curren.validate();
|
|
@@ -219,24 +221,21 @@ function CustomizationScreen({ product, loading, errorReference, errorMessage, b
|
|
|
219
221
|
existingLineId: (_orderBar$primaryLine8 = orderBar.primaryLine) === null || _orderBar$primaryLine8 === void 0 ? void 0 : _orderBar$primaryLine8.lineId,
|
|
220
222
|
skuValue: submittedSkuValue,
|
|
221
223
|
measurement: {
|
|
222
|
-
grossWeightKg: formatWeight(
|
|
223
|
-
tareWeightKg: formatWeight(
|
|
224
|
-
netWeightKg: formatWeight(
|
|
224
|
+
grossWeightKg: formatWeight(currentMeasurement.gross),
|
|
225
|
+
tareWeightKg: formatWeight(currentMeasurement.tare),
|
|
226
|
+
netWeightKg: formatWeight(currentMeasurement.net),
|
|
225
227
|
source: "auto",
|
|
226
228
|
status: "stable",
|
|
227
|
-
measuredAt: (
|
|
229
|
+
measuredAt: (_currentScale$updated = currentScale.updatedAt) !== null && _currentScale$updated !== void 0 ? _currentScale$updated : Date.now()
|
|
228
230
|
}
|
|
229
231
|
}
|
|
230
232
|
});
|
|
231
233
|
}), [
|
|
232
234
|
busy,
|
|
233
|
-
|
|
234
|
-
measurement.gross,
|
|
235
|
-
measurement.net,
|
|
236
|
-
measurement.tare,
|
|
235
|
+
minimumWeightKg,
|
|
237
236
|
(_orderBar$primaryLine9 = orderBar.primaryLine) === null || _orderBar$primaryLine9 === void 0 ? void 0 : _orderBar$primaryLine9.lineId,
|
|
238
237
|
productFacts,
|
|
239
|
-
|
|
238
|
+
scaleRuntime,
|
|
240
239
|
skuValue,
|
|
241
240
|
send,
|
|
242
241
|
syncing
|
|
@@ -314,9 +313,9 @@ function CustomizationScreen({ product, loading, errorReference, errorMessage, b
|
|
|
314
313
|
src: productFacts.imageUrl,
|
|
315
314
|
alt: ""
|
|
316
315
|
}) : /* @__PURE__ */ React.createElement(ProductFallback, null)), /* @__PURE__ */ React.createElement("div", { className: "hdl-customization-product__copy" }, /* @__PURE__ */ React.createElement("p", null, locales.getText("pisell2.hdl-kiosk.customization-product-eyebrow")), /* @__PURE__ */ React.createElement("h1", { id: "hdl-customization-title" }, (productFacts === null || productFacts === void 0 ? void 0 : productFacts.name) || locales.getText("pisell2.hdl-kiosk.weighted-product-loading")), /* @__PURE__ */ React.createElement("strong", null, productFacts ? formatMoney(unitPricePerStandardWeight, orderBar.currencySymbol) : "—", " ", /* @__PURE__ */ React.createElement("small", null, "/", STANDARD_WEIGHT_UNIT_LABEL)))), /* @__PURE__ */ React.createElement("aside", { className: "hdl-customization-weight" }, /* @__PURE__ */ React.createElement("div", { className: "hdl-customization-weight__status" }, /* @__PURE__ */ React.createElement("span", {
|
|
317
|
-
className: `hdl-customization-weight__dot${stable ? " is-stable" : ""}`,
|
|
316
|
+
className: `hdl-customization-weight__dot${readingInvalid ? " is-error" : stable ? " is-stable" : ""}`,
|
|
318
317
|
"aria-hidden": "true"
|
|
319
|
-
}), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("strong", null, locales.getText("pisell2.hdl-kiosk.customization-weighing")), /* @__PURE__ */ React.createElement("small", null, statusText)), /* @__PURE__ */ React.createElement(ScaleIcon, null)), /* @__PURE__ */ React.createElement("dl", null, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("dt", null, locales.getText("pisell2.hdl-kiosk.customization-unit-price")), /* @__PURE__ */ React.createElement("dd", null, productFacts ? formatMoney(unitPricePerStandardWeight, orderBar.currencySymbol) : "—", " ", /* @__PURE__ */ React.createElement("small", null, "/", STANDARD_WEIGHT_UNIT_LABEL))), /* @__PURE__ */ React.createElement("div", { className: "is-featured" }, /* @__PURE__ */ React.createElement("dt", null, locales.getText("pisell2.hdl-kiosk.gross-weight")), /* @__PURE__ */ React.createElement("dd", null, measurement.gross.isFinite() ? formatWeight(measurement.gross) : "—"
|
|
318
|
+
}), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("strong", null, locales.getText("pisell2.hdl-kiosk.customization-weighing")), /* @__PURE__ */ React.createElement("small", null, statusText)), /* @__PURE__ */ React.createElement(ScaleIcon, null)), /* @__PURE__ */ React.createElement("dl", null, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("dt", null, locales.getText("pisell2.hdl-kiosk.customization-unit-price")), /* @__PURE__ */ React.createElement("dd", null, productFacts ? formatMoney(unitPricePerStandardWeight, orderBar.currencySymbol) : "—", " ", /* @__PURE__ */ React.createElement("small", null, "/", STANDARD_WEIGHT_UNIT_LABEL))), /* @__PURE__ */ React.createElement("div", { className: "is-featured" }, /* @__PURE__ */ React.createElement("dt", null, locales.getText("pisell2.hdl-kiosk.gross-weight")), /* @__PURE__ */ React.createElement("dd", null, readingInvalid ? "Err." : `${measurement.gross.isFinite() ? formatWeight(measurement.gross) : "—"} kg`)), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("dt", null, locales.getText("pisell2.hdl-kiosk.tare-weight")), /* @__PURE__ */ React.createElement("dd", null, formatWeight(measurement.tare), " kg")), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("dt", null, locales.getText("pisell2.hdl-kiosk.net-weight")), /* @__PURE__ */ React.createElement("dd", null, readingInvalid ? "Err." : `${formatWeight(measurement.net)} kg`))))), /* @__PURE__ */ React.createElement("div", { className: "hdl-customization-options" }, product && productFacts ? /* @__PURE__ */ React.createElement(HDLKioskSkuOptionsSelection, {
|
|
320
319
|
ref: skuOptionsRef,
|
|
321
320
|
product,
|
|
322
321
|
value: skuValue,
|
|
@@ -122,6 +122,11 @@
|
|
|
122
122
|
box-shadow: 0 0 0 5px rgba(18, 183, 106, 0.16);
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
.hdl-customization-weight__dot.is-error {
|
|
126
|
+
background: #f04438;
|
|
127
|
+
box-shadow: 0 0 0 5px rgba(240, 68, 56, 0.16);
|
|
128
|
+
}
|
|
129
|
+
|
|
125
130
|
.hdl-customization-weight__status > div {
|
|
126
131
|
min-width: 0;
|
|
127
132
|
flex: 1;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { defineSlice, effect } from "../../kernel/application/defineSlice.js";
|
|
2
|
-
import { cartRemoveLineOperation } from "../../app/operations
|
|
3
|
-
import { productRemovePrimaryProductOperation, productSyncPrimaryWeightedProductOperation } from "./operation.js";
|
|
2
|
+
import { cartRemoveLineOperation, productRemovePrimaryProductOperation, productSyncPrimaryWeightedProductOperation } from "../../app/operations.js";
|
|
4
3
|
//#region src/components/HDLKiosk/slices/customization/slice.ts
|
|
5
4
|
/** Customization Slice:Next 时才提交本地称重草稿;加购成功后才离开。 */
|
|
6
5
|
const customizationSlice = defineSlice({
|
|
7
6
|
id: "customization",
|
|
8
|
-
|
|
7
|
+
surface: { id: "customization" },
|
|
9
8
|
commands: { removePrimaryProduct: cartRemoveLineOperation },
|
|
10
9
|
intents: {
|
|
11
10
|
complete: effect(productSyncPrimaryWeightedProductOperation, { navigate: "next" }),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { defineSlice, effect } from "../../kernel/application/defineSlice.js";
|
|
2
|
-
import { setFulfillmentOperation } from "../../app/operations
|
|
2
|
+
import { setFulfillmentOperation } from "../../app/operations.js";
|
|
3
3
|
//#region src/components/HDLKiosk/slices/fulfillment/slice.ts
|
|
4
4
|
/** Fulfillment Slice:声明就餐方式完成条件与回退语义;不依赖 React 或 Host 实现。 */
|
|
5
5
|
const fulfillmentSlice = defineSlice({
|
|
6
6
|
id: "fulfillment",
|
|
7
|
-
|
|
7
|
+
surface: { id: "fulfillment" },
|
|
8
8
|
intents: { complete: effect(setFulfillmentOperation, {
|
|
9
9
|
precondition: "fulfillment.selected",
|
|
10
10
|
navigate: "next"
|
|
@@ -4,7 +4,7 @@ import React from "react";
|
|
|
4
4
|
//#region src/components/HDLKiosk/slices/fulfillment/view.tsx
|
|
5
5
|
/** Fulfillment 展示装配:组合页面、订单摘要与购物车投影;不执行订单写入。 */
|
|
6
6
|
const renderFulfillment = ({ node, viewSnapshot, sales, businessMode, send }) => /* @__PURE__ */ React.createElement(FulfillmentScreen, {
|
|
7
|
-
model: createActivityScreenModel(node.
|
|
7
|
+
model: createActivityScreenModel(node.surfaceId, viewSnapshot, node, sales, businessMode),
|
|
8
8
|
orderBar: createOrderBarModel(sales),
|
|
9
9
|
send
|
|
10
10
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { defineSlice, effect } from "../../kernel/application/defineSlice.js";
|
|
2
|
-
import { identitySyncOperation } from "
|
|
2
|
+
import { identitySyncOperation } from "../../app/operations.js";
|
|
3
3
|
//#region src/components/HDLKiosk/slices/identity/slice.ts
|
|
4
4
|
/** Identity Slice:声明身份节点的 Intent 与客户同步 Effect;不依赖 React 或 Host 实现。 */
|
|
5
5
|
const identitySlice = defineSlice({
|
|
6
6
|
id: "identity",
|
|
7
|
-
|
|
7
|
+
surface: { id: "identity" },
|
|
8
8
|
intents: {
|
|
9
9
|
complete: effect(identitySyncOperation, { navigate: "next" }),
|
|
10
10
|
omit: effect(identitySyncOperation, { navigate: "next" })
|
|
@@ -4,7 +4,7 @@ import React from "react";
|
|
|
4
4
|
//#region src/components/HDLKiosk/slices/identity/view.tsx
|
|
5
5
|
/** Identity 展示装配:把统一 View Context 转为本 Slice Screen props;不决定流程目标。 */
|
|
6
6
|
const renderIdentity = ({ node, viewSnapshot, sales, businessMode, renderIdentityAuth, send }) => /* @__PURE__ */ React.createElement(IdentityScreen, {
|
|
7
|
-
model: createActivityScreenModel(node.
|
|
7
|
+
model: createActivityScreenModel(node.surfaceId, viewSnapshot, node, sales, businessMode),
|
|
8
8
|
orderBar: createOrderBarModel(sales),
|
|
9
9
|
send,
|
|
10
10
|
renderIdentityAuth
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { defineSlice, intentPrecondition } from "../../kernel/application/defineSlice.js";
|
|
2
|
-
import { checkoutPayEftposOperation, checkoutRequestStaffPaymentApprovalOperation } from "../../app/operations
|
|
2
|
+
import { checkoutPayEftposOperation, checkoutRequestStaffPaymentApprovalOperation } from "../../app/operations.js";
|
|
3
3
|
//#region src/components/HDLKiosk/slices/payment/slice.ts
|
|
4
4
|
/** Payment Slice:声明卡/现金选择、支付派发与 Host 成功确认;支付不确定不作成功处理。 */
|
|
5
5
|
const paymentMethodSlice = defineSlice({
|
|
6
6
|
id: "paymentMethod",
|
|
7
|
-
|
|
7
|
+
surface: { id: "checkout" },
|
|
8
8
|
commands: {
|
|
9
9
|
payEftpos: checkoutPayEftposOperation,
|
|
10
10
|
requestStaffPaymentApproval: checkoutRequestStaffPaymentApprovalOperation
|
|
@@ -14,7 +14,7 @@ const paymentMethodSlice = defineSlice({
|
|
|
14
14
|
/** 支付完成仍复用 Checkout Screen,仅作为 Workflow 的成功终态。 */
|
|
15
15
|
const paymentCompletedSlice = defineSlice({
|
|
16
16
|
id: "paymentCompleted",
|
|
17
|
-
|
|
17
|
+
surface: { id: "checkout" },
|
|
18
18
|
intents: {}
|
|
19
19
|
});
|
|
20
20
|
//#endregion
|
|
@@ -3,7 +3,7 @@ import { defineSlice, intentPrecondition } from "../../kernel/application/define
|
|
|
3
3
|
/** 主商品询问 Slice:只表达是否进入称重定制,不承担 Catalog 页面职责。 */
|
|
4
4
|
const primaryProductPromptSlice = defineSlice({
|
|
5
5
|
id: "primaryProductPrompt",
|
|
6
|
-
|
|
6
|
+
surface: { id: "primaryProductPrompt" },
|
|
7
7
|
presentation: "modal",
|
|
8
8
|
intents: {
|
|
9
9
|
complete: intentPrecondition("cart.notEmpty", { navigate: "next" }),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { _asyncToGenerator } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
2
1
|
import { useHDLKioskCustomerController } from "./controllers/useHDLKioskCustomerController.js";
|
|
2
|
+
import { useHDLKioskActionDispatcher } from "./controllers/useHDLKioskActionDispatcher.js";
|
|
3
|
+
import { useHDLKioskExitController } from "./controllers/useHDLKioskExitController.js";
|
|
3
4
|
import { useHDLKioskScreenData } from "./controllers/useHDLKioskScreenData.js";
|
|
4
5
|
import { canReopenWorkflowStep } from "../kernel/workflow/selectors.js";
|
|
5
6
|
import { EndOrderDialog } from "../components/overlays/EndOrderDialog/index.js";
|
|
@@ -10,12 +11,12 @@ import { HDLKioskShell } from "../components/shell/HDLKioskShell/index.js";
|
|
|
10
11
|
import { HDLKioskBottomBarHost, useHDLKioskCartDrawerController } from "../components/shell/HDLKioskBottomBarHost/index.js";
|
|
11
12
|
import { BlockingNotice } from "../components/common/BlockingNotice/index.js";
|
|
12
13
|
import { createCartDrawerModel } from "../utils.js";
|
|
13
|
-
import { ScreenRenderer } from "
|
|
14
|
-
import { useWorkflowSnapshot } from "./
|
|
15
|
-
import {
|
|
14
|
+
import { ScreenRenderer } from "./ScreenRenderer.js";
|
|
15
|
+
import { useWorkflowSnapshot } from "./snapshots.js";
|
|
16
|
+
import { resolveHDLKioskCollaborationStatus } from "./collaborationStatus.js";
|
|
16
17
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
17
18
|
import { locales } from "@pisell/utils";
|
|
18
|
-
//#region src/components/HDLKiosk/
|
|
19
|
+
//#region src/components/HDLKiosk/ui/HDLKioskWorkflowView.tsx
|
|
19
20
|
/**
|
|
20
21
|
* 文件角色:承载一个活跃 HDLKiosk 会话的 React 组合视图。
|
|
21
22
|
* 运行机制:组合 Customer/ScreenData Controller,订阅 Host 与 Actor
|
|
@@ -40,52 +41,65 @@ function HDLKioskWorkflowCartOverlay({ model, busy, memberAction, send, renderCa
|
|
|
40
41
|
} : void 0
|
|
41
42
|
});
|
|
42
43
|
}
|
|
44
|
+
function HDLKioskWorkflowBlockingSurface({ snapshot, title, description, reference, hideBottomBar = false }) {
|
|
45
|
+
return /* @__PURE__ */ React.createElement(HDLKioskShell, { snapshot }, /* @__PURE__ */ React.createElement(HDLKioskBottomBarHost, { mode: hideBottomBar ? "hidden" : void 0 }, /* @__PURE__ */ React.createElement(HDLKioskHeader, null), /* @__PURE__ */ React.createElement("main", { className: "hdl-shell__main" }, /* @__PURE__ */ React.createElement(BlockingNotice, {
|
|
46
|
+
title,
|
|
47
|
+
description,
|
|
48
|
+
reference
|
|
49
|
+
}))));
|
|
50
|
+
}
|
|
43
51
|
/**
|
|
44
52
|
* 活跃点餐会话的 UI 编排层。
|
|
45
53
|
*
|
|
46
54
|
* 它把运行时控制器投影为 Screen/Dialog 所需的 props;具体页面不直接接触
|
|
47
55
|
* Host、Workflow Actor 或会话计时器。
|
|
48
56
|
*/
|
|
49
|
-
function HDLKioskWorkflowView({ session, host, sales, config, isActive, renderIdentityAuth, renderCartContent, cartOverlayActions, returnToEntry }) {
|
|
50
|
-
var
|
|
57
|
+
function HDLKioskWorkflowView({ session, host, sales, config, isActive, returning, returnError, renderIdentityAuth, renderCartContent, cartOverlayActions, onCollaborationStatusChange, returnToEntry }) {
|
|
58
|
+
var _session$definition$n2, _customer$error, _activeNode$presentat;
|
|
51
59
|
const snapshot = useWorkflowSnapshot(session.actor);
|
|
52
|
-
const
|
|
53
|
-
const resetInFlight = useRef(false);
|
|
54
|
-
const [resetting, setResetting] = useState(false);
|
|
55
|
-
const [resetError, setResetError] = useState();
|
|
60
|
+
const navigationSequence = useRef(0);
|
|
56
61
|
const [memberLoginOpen, setMemberLoginOpen] = useState(false);
|
|
57
|
-
const [commandState, setCommandState] = useState({ busy: false });
|
|
58
|
-
const commandGeneration = useRef(0);
|
|
59
|
-
const pendingCommands = useRef(0);
|
|
60
62
|
const activeNode = session.definition.nodes[snapshot.nodeId];
|
|
61
|
-
const pendingEndOrderNavigation = ((_snapshot$pendingNavi = snapshot.pendingNavigation) === null || _snapshot$pendingNavi === void 0 ? void 0 : _snapshot$pendingNavi.request.kind) === "confirmEndOrder" ? snapshot.pendingNavigation : void 0;
|
|
62
|
-
const pendingAutomaticExitNavigation = ((_snapshot$pendingNavi2 = snapshot.pendingNavigation) === null || _snapshot$pendingNavi2 === void 0 ? void 0 : _snapshot$pendingNavi2.request.kind) === "performSessionExit" ? snapshot.pendingNavigation : void 0;
|
|
63
|
-
const endOrderConfirmationOpen = Boolean(pendingEndOrderNavigation);
|
|
64
|
-
const currentScreenId = activeNode.screenId;
|
|
65
63
|
const customizationStepId = session.definition.stepOrder.find((stepId) => {
|
|
66
64
|
var _session$definition$n;
|
|
67
65
|
return ((_session$definition$n = session.definition.nodes[stepId]) === null || _session$definition$n === void 0 ? void 0 : _session$definition$n.activity) === "customization";
|
|
68
66
|
});
|
|
69
67
|
const screenDataNode = (_session$definition$n2 = session.definition.nodes[snapshot.surface.pageStepId]) !== null && _session$definition$n2 !== void 0 ? _session$definition$n2 : activeNode;
|
|
70
68
|
const paymentSafeForReset = sales.payment.status === "idle" || sales.payment.status === "failed";
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
69
|
+
const screenCollaborationStatus = resolveHDLKioskCollaborationStatus(screenDataNode.surfaceId);
|
|
70
|
+
const currentCollaborationStatus = useRef("home");
|
|
71
|
+
const statusBeforeCartOpen = useRef("home");
|
|
72
|
+
const cartOpenRef = useRef(false);
|
|
73
|
+
const publishCollaborationStatus = useCallback((status) => {
|
|
74
|
+
if (isActive) onCollaborationStatusChange === null || onCollaborationStatusChange === void 0 || onCollaborationStatusChange(status);
|
|
75
|
+
}, [isActive, onCollaborationStatusChange]);
|
|
76
|
+
const handleCartOpenChange = useCallback((open) => {
|
|
77
|
+
if (open) {
|
|
78
|
+
if (!cartOpenRef.current) statusBeforeCartOpen.current = currentCollaborationStatus.current;
|
|
79
|
+
cartOpenRef.current = true;
|
|
80
|
+
publishCollaborationStatus("cart");
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (!cartOpenRef.current) return;
|
|
84
|
+
cartOpenRef.current = false;
|
|
85
|
+
publishCollaborationStatus(statusBeforeCartOpen.current);
|
|
86
|
+
}, [publishCollaborationStatus]);
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
if (!screenCollaborationStatus) return;
|
|
89
|
+
currentCollaborationStatus.current = screenCollaborationStatus;
|
|
90
|
+
if (!cartOpenRef.current) publishCollaborationStatus(screenCollaborationStatus);
|
|
91
|
+
}, [publishCollaborationStatus, screenCollaborationStatus]);
|
|
92
|
+
const { endOrderConfirmationOpen, resetSession, requestEndOrder, cancelEndOrder, confirmEndOrder } = useHDLKioskExitController({
|
|
93
|
+
session,
|
|
94
|
+
snapshot,
|
|
95
|
+
returnToEntry
|
|
96
|
+
});
|
|
97
|
+
const { send, commandState } = useHDLKioskActionDispatcher({
|
|
98
|
+
session,
|
|
99
|
+
snapshot,
|
|
100
|
+
activityId: activeNode.activity,
|
|
101
|
+
resetSession
|
|
102
|
+
});
|
|
89
103
|
const customer = useHDLKioskCustomerController({
|
|
90
104
|
session,
|
|
91
105
|
snapshot,
|
|
@@ -93,7 +107,7 @@ function HDLKioskWorkflowView({ session, host, sales, config, isActive, renderId
|
|
|
93
107
|
activityId: activeNode.activity,
|
|
94
108
|
isActive,
|
|
95
109
|
loginAvailable: Boolean(renderIdentityAuth),
|
|
96
|
-
interactionBlocked:
|
|
110
|
+
interactionBlocked: returning || commandState.busy
|
|
97
111
|
});
|
|
98
112
|
const requestMemberLogin = useCallback(() => {
|
|
99
113
|
if (customer.canLogin && renderIdentityAuth) setMemberLoginOpen(true);
|
|
@@ -102,106 +116,27 @@ function HDLKioskWorkflowView({ session, host, sales, config, isActive, renderId
|
|
|
102
116
|
setMemberLoginOpen(false);
|
|
103
117
|
customer.applyAuthenticatedCustomer(customerId);
|
|
104
118
|
}, [customer.applyAuthenticatedCustomer]);
|
|
105
|
-
const requestEndOrder = useCallback(() => {
|
|
106
|
-
sequence.current += 1;
|
|
107
|
-
session.actor.navigate({
|
|
108
|
-
kind: "sessionExit",
|
|
109
|
-
reason: "userRequest"
|
|
110
|
-
}, `ui:${snapshot.sessionEpoch}:${sequence.current}`);
|
|
111
|
-
}, [session, snapshot.sessionEpoch]);
|
|
112
119
|
const editPrimaryProduct = useCallback(() => {
|
|
113
120
|
if (!customizationStepId || customizationStepId === snapshot.nodeId) return;
|
|
114
|
-
|
|
121
|
+
navigationSequence.current += 1;
|
|
115
122
|
session.actor.navigate({
|
|
116
123
|
kind: "step",
|
|
117
124
|
stepId: customizationStepId
|
|
118
|
-
}, `ui:edit-primary-product:${snapshot.sessionEpoch}:${
|
|
125
|
+
}, `ui:edit-primary-product:${snapshot.sessionEpoch}:${navigationSequence.current}`);
|
|
119
126
|
}, [
|
|
120
127
|
customizationStepId,
|
|
121
128
|
session.actor,
|
|
122
129
|
snapshot.nodeId,
|
|
123
130
|
snapshot.sessionEpoch
|
|
124
131
|
]);
|
|
125
|
-
const cancelEndOrder = useCallback(() => {
|
|
126
|
-
if (!pendingEndOrderNavigation) return;
|
|
127
|
-
session.actor.resolvePendingNavigation(pendingEndOrderNavigation.navigationId, "cancel");
|
|
128
|
-
}, [pendingEndOrderNavigation, session.actor]);
|
|
129
|
-
const confirmEndOrder = useCallback(() => {
|
|
130
|
-
if (!pendingEndOrderNavigation || !session.actor.resolvePendingNavigation(pendingEndOrderNavigation.navigationId, "allow")) return;
|
|
131
|
-
resetSession();
|
|
132
|
-
}, [
|
|
133
|
-
pendingEndOrderNavigation,
|
|
134
|
-
resetSession,
|
|
135
|
-
session.actor
|
|
136
|
-
]);
|
|
137
|
-
useEffect(() => {
|
|
138
|
-
if (!pendingAutomaticExitNavigation || !session.actor.resolvePendingNavigation(pendingAutomaticExitNavigation.navigationId, "allow")) return;
|
|
139
|
-
resetSession();
|
|
140
|
-
}, [
|
|
141
|
-
pendingAutomaticExitNavigation,
|
|
142
|
-
resetSession,
|
|
143
|
-
session.actor
|
|
144
|
-
]);
|
|
145
132
|
const { catalog, customization, payment } = useHDLKioskScreenData({
|
|
146
133
|
host,
|
|
147
|
-
currentScreenId: screenDataNode.
|
|
134
|
+
currentScreenId: screenDataNode.surfaceId,
|
|
148
135
|
activity: screenDataNode.activity,
|
|
149
136
|
isActive,
|
|
150
137
|
primaryWeightedProductId: config.primaryWeightedProductId
|
|
151
138
|
});
|
|
152
|
-
useEffect(() =>
|
|
153
|
-
commandGeneration.current += 1;
|
|
154
|
-
pendingCommands.current = 0;
|
|
155
|
-
setCommandState({ busy: false });
|
|
156
|
-
setMemberLoginOpen(false);
|
|
157
|
-
}, [session]);
|
|
158
|
-
const send = useCallback((action) => {
|
|
159
|
-
if (action.kind === "session") {
|
|
160
|
-
resetSession();
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
sequence.current += 1;
|
|
164
|
-
const intentId = `ui:${snapshot.sessionEpoch}:${sequence.current}`;
|
|
165
|
-
if (action.kind === "intent" || action.kind === "navigation") {
|
|
166
|
-
const event = createWorkflowEvent(action, activeNode.activity, snapshot.nodeId, intentId);
|
|
167
|
-
if (event) session.actor.send(event);
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
const generation = commandGeneration.current;
|
|
171
|
-
pendingCommands.current += 1;
|
|
172
|
-
setCommandState({
|
|
173
|
-
busy: true,
|
|
174
|
-
commandId: action.command
|
|
175
|
-
});
|
|
176
|
-
session.executeCommand(action.command, action.input, intentId).then((result) => {
|
|
177
|
-
if (generation !== commandGeneration.current) return;
|
|
178
|
-
pendingCommands.current = Math.max(0, pendingCommands.current - 1);
|
|
179
|
-
setCommandState({
|
|
180
|
-
busy: pendingCommands.current > 0,
|
|
181
|
-
commandId: pendingCommands.current > 0 ? action.command : void 0,
|
|
182
|
-
error: result.status === "failed" ? result.error : void 0
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
}, [
|
|
186
|
-
activeNode.activity,
|
|
187
|
-
resetSession,
|
|
188
|
-
session,
|
|
189
|
-
snapshot.nodeId,
|
|
190
|
-
snapshot.sessionEpoch
|
|
191
|
-
]);
|
|
192
|
-
useEffect(() => {
|
|
193
|
-
if (activeNode.activity !== "paymentMethod" || snapshot.status !== "idle" || sales.payment.status !== "succeeded") return;
|
|
194
|
-
send({
|
|
195
|
-
kind: "intent",
|
|
196
|
-
activityId: "paymentMethod",
|
|
197
|
-
intent: "complete"
|
|
198
|
-
});
|
|
199
|
-
}, [
|
|
200
|
-
activeNode.activity,
|
|
201
|
-
sales.payment.status,
|
|
202
|
-
send,
|
|
203
|
-
snapshot.status
|
|
204
|
-
]);
|
|
139
|
+
useEffect(() => setMemberLoginOpen(false), [session, snapshot.nodeId]);
|
|
205
140
|
const memberAction = customer.visible ? {
|
|
206
141
|
member: customer.member,
|
|
207
142
|
memberName: customer.memberName,
|
|
@@ -211,7 +146,7 @@ function HDLKioskWorkflowView({ session, host, sales, config, isActive, renderId
|
|
|
211
146
|
errorReference: (_customer$error = customer.error) === null || _customer$error === void 0 ? void 0 : _customer$error.traceId,
|
|
212
147
|
onLogin: requestMemberLogin
|
|
213
148
|
} : void 0;
|
|
214
|
-
const canEndOrder = snapshot.status === "idle" && !
|
|
149
|
+
const canEndOrder = snapshot.status === "idle" && !returning && !snapshot.pendingNavigation && !commandState.busy && !customer.busy && paymentSafeForReset;
|
|
215
150
|
const cartDrawerModel = useMemo(() => createCartDrawerModel(sales, snapshot.context.primaryWeightedProductId), [sales, snapshot.context.primaryWeightedProductId]);
|
|
216
151
|
const endOrderBottomBar = activeNode.activity === "paymentCompleted" ? void 0 : {
|
|
217
152
|
ariaLabel: locales.getText("pisell2.hdl-kiosk.exit-order"),
|
|
@@ -226,24 +161,28 @@ function HDLKioskWorkflowView({ session, host, sales, config, isActive, renderId
|
|
|
226
161
|
"aria-hidden": "true"
|
|
227
162
|
}, /* @__PURE__ */ React.createElement("path", { d: "m15 5-7 7 7 7M8 12h10" })), /* @__PURE__ */ React.createElement("span", null, locales.getText("pisell2.hdl-kiosk.back")))
|
|
228
163
|
};
|
|
229
|
-
if (
|
|
164
|
+
if (returnError) return /* @__PURE__ */ React.createElement(HDLKioskWorkflowBlockingSurface, {
|
|
165
|
+
snapshot,
|
|
230
166
|
title: locales.getText("pisell2.hdl-kiosk.reset-failed-title"),
|
|
231
167
|
description: locales.getText("pisell2.hdl-kiosk.reset-failed-description"),
|
|
232
|
-
reference:
|
|
233
|
-
})
|
|
168
|
+
reference: returnError.traceId
|
|
169
|
+
});
|
|
234
170
|
if (snapshot.status === "blocked") {
|
|
235
171
|
var _snapshot$lastError;
|
|
236
|
-
return /* @__PURE__ */ React.createElement(
|
|
172
|
+
return /* @__PURE__ */ React.createElement(HDLKioskWorkflowBlockingSurface, {
|
|
173
|
+
snapshot,
|
|
237
174
|
title: locales.getText("pisell2.hdl-kiosk.blocked-title"),
|
|
238
175
|
description: locales.getText("pisell2.hdl-kiosk.blocked-description"),
|
|
239
|
-
reference: (_snapshot$lastError = snapshot.lastError) === null || _snapshot$lastError === void 0 ? void 0 : _snapshot$lastError.traceId
|
|
240
|
-
|
|
176
|
+
reference: (_snapshot$lastError = snapshot.lastError) === null || _snapshot$lastError === void 0 ? void 0 : _snapshot$lastError.traceId,
|
|
177
|
+
hideBottomBar: true
|
|
178
|
+
});
|
|
241
179
|
}
|
|
242
180
|
return /* @__PURE__ */ React.createElement(HDLKioskShell, {
|
|
243
181
|
snapshot,
|
|
244
182
|
memberAction,
|
|
245
|
-
variant:
|
|
183
|
+
variant: screenDataNode.surfaceId === "identity" ? "identityGate" : "default"
|
|
246
184
|
}, /* @__PURE__ */ React.createElement(HDLKioskBottomBarHost, {
|
|
185
|
+
onCartOpenChange: handleCartOpenChange,
|
|
247
186
|
mode: ((_activeNode$presentat = activeNode.presentation) === null || _activeNode$presentat === void 0 ? void 0 : _activeNode$presentat.mode) === "modal" || endOrderConfirmationOpen || memberLoginOpen ? "masked" : "visible",
|
|
248
187
|
fallback: endOrderBottomBar,
|
|
249
188
|
cartOverlayActions,
|
|
@@ -257,7 +196,7 @@ function HDLKioskWorkflowView({ session, host, sales, config, isActive, renderId
|
|
|
257
196
|
sales,
|
|
258
197
|
send,
|
|
259
198
|
commandState,
|
|
260
|
-
resetting,
|
|
199
|
+
resetting: returning,
|
|
261
200
|
capabilities: host.capabilities,
|
|
262
201
|
businessMode: config.businessMode,
|
|
263
202
|
scaleMinimumWeightKg: config.scaleTriggerMinimumWeightKg,
|