@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
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { _asyncToGenerator } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
2
|
+
import { createScannerIngress } from "./scannerIngress.js";
|
|
3
|
+
//#region src/components/HDLKiosk/runtime/devices/scannerSessionRouter.ts
|
|
4
|
+
function createScannerSessionRouter({ host, entrySupported, maxPendingEvents = 5 }) {
|
|
5
|
+
const ingress = createScannerIngress({ maxPendingEvents });
|
|
6
|
+
let phase = "idle";
|
|
7
|
+
let activeStartId;
|
|
8
|
+
let listening = false;
|
|
9
|
+
let session;
|
|
10
|
+
let queue = [];
|
|
11
|
+
let currentTask;
|
|
12
|
+
let processing = false;
|
|
13
|
+
let generation = 0;
|
|
14
|
+
let rejectionSequence = 0;
|
|
15
|
+
const emitRejected = (task, reason) => {
|
|
16
|
+
rejectionSequence += 1;
|
|
17
|
+
try {
|
|
18
|
+
host.telemetry.emit({
|
|
19
|
+
name: "hdlKiosk.device.eventRejected",
|
|
20
|
+
traceId: `hdl-scanner-rejected-${rejectionSequence}`,
|
|
21
|
+
occurredAt: Date.now(),
|
|
22
|
+
attributes: {
|
|
23
|
+
eventType: task.event.type,
|
|
24
|
+
eventId: task.event.eventId,
|
|
25
|
+
reason
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
} catch (_unused) {}
|
|
29
|
+
};
|
|
30
|
+
const rejectQueue = (reason) => {
|
|
31
|
+
const rejected = queue;
|
|
32
|
+
queue = [];
|
|
33
|
+
rejected.forEach((task) => emitRejected(task, reason));
|
|
34
|
+
};
|
|
35
|
+
const emitCompleted = (task, target, result, stale) => {
|
|
36
|
+
try {
|
|
37
|
+
host.telemetry.emit({
|
|
38
|
+
name: "hdlKiosk.scanner.taskFinished",
|
|
39
|
+
traceId: `hdl-scan:${target.sessionEpoch()}:${task.event.eventId}`,
|
|
40
|
+
occurredAt: Date.now(),
|
|
41
|
+
attributes: {
|
|
42
|
+
eventId: task.event.eventId,
|
|
43
|
+
sessionEpoch: target.sessionEpoch(),
|
|
44
|
+
status: result.operationStatus,
|
|
45
|
+
stale
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
} catch (_unused2) {}
|
|
49
|
+
};
|
|
50
|
+
const processQueue = function() {
|
|
51
|
+
var _ref = _asyncToGenerator(function* () {
|
|
52
|
+
if (processing || phase !== "active" || !listening || !session) return;
|
|
53
|
+
processing = true;
|
|
54
|
+
const processGeneration = generation;
|
|
55
|
+
try {
|
|
56
|
+
while (phase === "active" && listening && generation === processGeneration && session && queue.length > 0) {
|
|
57
|
+
const target = session;
|
|
58
|
+
const task = queue.shift();
|
|
59
|
+
if (!task) continue;
|
|
60
|
+
const decision = target.decideConsume();
|
|
61
|
+
if (decision.status === "rejected") {
|
|
62
|
+
emitRejected(task, decision.reason);
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
let result;
|
|
66
|
+
try {
|
|
67
|
+
var _target$beforeConsume;
|
|
68
|
+
(_target$beforeConsume = target.beforeConsume) === null || _target$beforeConsume === void 0 || _target$beforeConsume.call(target);
|
|
69
|
+
currentTask = task;
|
|
70
|
+
result = yield target.consume({
|
|
71
|
+
eventId: task.event.eventId,
|
|
72
|
+
code: task.code
|
|
73
|
+
});
|
|
74
|
+
} catch (_unused3) {
|
|
75
|
+
currentTask = void 0;
|
|
76
|
+
emitRejected(task, "scanExecutionFailed");
|
|
77
|
+
rejectQueue("previousScanExecutionFailed");
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
currentTask = void 0;
|
|
81
|
+
const stale = generation !== processGeneration || phase !== "active" || !listening || session !== target;
|
|
82
|
+
emitCompleted(task, target, result, stale);
|
|
83
|
+
if (stale) break;
|
|
84
|
+
if (result.queueDirective === "pauseForSelection") {
|
|
85
|
+
rejectQueue("barcodeSelectionPending");
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
if (result.queueDirective === "stopUncertain") {
|
|
89
|
+
rejectQueue("previousScanResultUncertain");
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
} finally {
|
|
94
|
+
currentTask = void 0;
|
|
95
|
+
processing = false;
|
|
96
|
+
if (phase === "active" && listening && queue.length > 0) processQueue();
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
return function processQueue() {
|
|
100
|
+
return _ref.apply(this, arguments);
|
|
101
|
+
};
|
|
102
|
+
}();
|
|
103
|
+
const beginSessionStart = (startId) => {
|
|
104
|
+
if (!startId.trim() || phase === "disposed" || phase === "active") return false;
|
|
105
|
+
if (phase === "starting") return activeStartId === startId;
|
|
106
|
+
phase = "starting";
|
|
107
|
+
activeStartId = startId;
|
|
108
|
+
return true;
|
|
109
|
+
};
|
|
110
|
+
const failSessionStart = (startId, reason = "sessionStartFailed") => {
|
|
111
|
+
if (phase !== "starting" || activeStartId !== startId) return false;
|
|
112
|
+
generation += 1;
|
|
113
|
+
rejectQueue(reason);
|
|
114
|
+
activeStartId = void 0;
|
|
115
|
+
session = void 0;
|
|
116
|
+
phase = "idle";
|
|
117
|
+
return true;
|
|
118
|
+
};
|
|
119
|
+
const triggerAdapter = Object.freeze({
|
|
120
|
+
trigger: "onScan",
|
|
121
|
+
activate: ({ emit }) => {
|
|
122
|
+
if (phase === "disposed") return void 0;
|
|
123
|
+
listening = true;
|
|
124
|
+
const unsubscribe = host.devices.subscribe((event) => {
|
|
125
|
+
if (!listening || phase === "disposed" || event.type !== "barcode") return;
|
|
126
|
+
const target = session;
|
|
127
|
+
const decision = target === null || target === void 0 ? void 0 : target.decideConsume();
|
|
128
|
+
const rejectedReason = (decision === null || decision === void 0 ? void 0 : decision.status) === "rejected" ? decision.reason : void 0;
|
|
129
|
+
const result = ingress.accept(event, {
|
|
130
|
+
active: listening,
|
|
131
|
+
supported: host.capabilities.scanner.available && (phase !== "idle" || entrySupported),
|
|
132
|
+
workflowLocked: false,
|
|
133
|
+
nodeAcceptsEvent: phase !== "active" || (decision === null || decision === void 0 ? void 0 : decision.status) === "accepted" || rejectedReason === "paymentFrozen",
|
|
134
|
+
paymentFrozen: phase === "active" && rejectedReason === "paymentFrozen",
|
|
135
|
+
pendingEventCount: queue.length + (currentTask ? 1 : 0)
|
|
136
|
+
});
|
|
137
|
+
if (result.status === "rejected") {
|
|
138
|
+
emitRejected({
|
|
139
|
+
event,
|
|
140
|
+
code: event.code
|
|
141
|
+
}, result.reason);
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const task = {
|
|
145
|
+
event: result.event,
|
|
146
|
+
code: result.code
|
|
147
|
+
};
|
|
148
|
+
queue.push(task);
|
|
149
|
+
if (phase === "active") {
|
|
150
|
+
processQueue();
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (phase === "starting") return;
|
|
154
|
+
const startId = `device:scanner:${result.event.eventId}`;
|
|
155
|
+
if (!beginSessionStart(startId)) {
|
|
156
|
+
queue.pop();
|
|
157
|
+
emitRejected(task, "sessionStartConflict");
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
emit({
|
|
161
|
+
channel: "product",
|
|
162
|
+
occurrenceId: result.event.eventId,
|
|
163
|
+
correlationId: startId
|
|
164
|
+
}).then((startResult) => {
|
|
165
|
+
if (startResult.status === "rejected") failSessionStart(startId, startResult.reason);
|
|
166
|
+
}).catch(() => failSessionStart(startId, "sessionStartFailed"));
|
|
167
|
+
}, { sources: ["scanner"] });
|
|
168
|
+
return () => {
|
|
169
|
+
listening = false;
|
|
170
|
+
generation += 1;
|
|
171
|
+
rejectQueue("inactive");
|
|
172
|
+
if (phase === "starting" && activeStartId) failSessionStart(activeStartId, "inactive");
|
|
173
|
+
unsubscribe();
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
return Object.freeze({
|
|
178
|
+
triggerAdapter,
|
|
179
|
+
beginSessionStart,
|
|
180
|
+
bindSession: (startId, nextSession) => {
|
|
181
|
+
if (phase !== "starting" || activeStartId !== startId) return false;
|
|
182
|
+
activeStartId = void 0;
|
|
183
|
+
session = nextSession;
|
|
184
|
+
phase = "active";
|
|
185
|
+
processQueue();
|
|
186
|
+
return true;
|
|
187
|
+
},
|
|
188
|
+
failSessionStart,
|
|
189
|
+
releaseSession: (sessionId) => {
|
|
190
|
+
if ((session === null || session === void 0 ? void 0 : session.id) !== sessionId) return false;
|
|
191
|
+
generation += 1;
|
|
192
|
+
rejectQueue("sessionDisposed");
|
|
193
|
+
activeStartId = void 0;
|
|
194
|
+
session = void 0;
|
|
195
|
+
phase = "idle";
|
|
196
|
+
ingress.reset();
|
|
197
|
+
return true;
|
|
198
|
+
},
|
|
199
|
+
dispose: () => {
|
|
200
|
+
if (phase === "disposed") return;
|
|
201
|
+
generation += 1;
|
|
202
|
+
rejectQueue("inactive");
|
|
203
|
+
activeStartId = void 0;
|
|
204
|
+
session = void 0;
|
|
205
|
+
listening = false;
|
|
206
|
+
phase = "disposed";
|
|
207
|
+
ingress.reset();
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
//#endregion
|
|
212
|
+
export { createScannerSessionRouter };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { _asyncToGenerator } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
2
|
+
import { barcodeConsumeOperation } from "../../app/operations.js";
|
|
3
|
+
import { finalizeCartMutation } from "./cartConsistency.js";
|
|
4
|
+
import { bindOperation } from "./types.js";
|
|
5
|
+
//#region src/components/HDLKiosk/runtime/operations/barcode.ts
|
|
6
|
+
const barcodeConsumeOperationBinding = bindOperation(barcodeConsumeOperation, { execute: function() {
|
|
7
|
+
var _ref = _asyncToGenerator(function* (context, input, signal) {
|
|
8
|
+
const beforeFingerprint = context.host.sales.getObservedSnapshot().fingerprint.value;
|
|
9
|
+
const mutation = yield context.host.sales.consumeBarcode(input.code, signal);
|
|
10
|
+
if (mutation.status === "succeeded" && mutation.data.code === "requiresSelection") return mutation;
|
|
11
|
+
return finalizeCartMutation(context, mutation, signal, () => mutation.status === "succeeded" && mutation.data.code === "added" && mutation.data.cartChangeConfirmed === true || context.host.sales.getObservedSnapshot().fingerprint.value !== beforeFingerprint);
|
|
12
|
+
});
|
|
13
|
+
return function execute(_x, _x2, _x3) {
|
|
14
|
+
return _ref.apply(this, arguments);
|
|
15
|
+
};
|
|
16
|
+
}() });
|
|
17
|
+
//#endregion
|
|
18
|
+
export { barcodeConsumeOperationBinding };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { _asyncToGenerator } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
2
|
+
import { cartAddProductOperation, cartRemoveLineOperation, cartUpdateQuantityOperation } from "../../app/operations.js";
|
|
3
|
+
import { finalizeCartMutation } from "./cartConsistency.js";
|
|
4
|
+
import { bindOperation } from "./types.js";
|
|
5
|
+
//#region src/components/HDLKiosk/runtime/operations/cart.ts
|
|
6
|
+
const cartAddProductOperationBinding = bindOperation(cartAddProductOperation, { execute: function() {
|
|
7
|
+
var _ref = _asyncToGenerator(function* (context, input, signal) {
|
|
8
|
+
return finalizeCartMutation(context, yield context.host.sales.addProduct(input, signal), signal);
|
|
9
|
+
});
|
|
10
|
+
return function execute(_x, _x2, _x3) {
|
|
11
|
+
return _ref.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
}() });
|
|
14
|
+
const cartUpdateQuantityOperationBinding = bindOperation(cartUpdateQuantityOperation, { execute: function() {
|
|
15
|
+
var _ref2 = _asyncToGenerator(function* (context, input, signal) {
|
|
16
|
+
const mutation = yield context.host.sales.updateQuantity(input, signal);
|
|
17
|
+
return finalizeCartMutation(context, mutation, signal, () => {
|
|
18
|
+
var _mutation$data$confir;
|
|
19
|
+
if (mutation.status === "succeeded" && mutation.data.affectedLineId === input.lineId && ((_mutation$data$confir = mutation.data.confirmedLine) === null || _mutation$data$confir === void 0 ? void 0 : _mutation$data$confir.lineId) === input.lineId && decimalValuesEqual(mutation.data.confirmedLine.quantity, input.quantity)) return true;
|
|
20
|
+
const line = context.host.sales.getObservedSnapshot().cart.lines.find((item) => item.lineId === input.lineId);
|
|
21
|
+
return decimalValuesEqual(line === null || line === void 0 ? void 0 : line.quantity, input.quantity);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
return function execute(_x4, _x5, _x6) {
|
|
25
|
+
return _ref2.apply(this, arguments);
|
|
26
|
+
};
|
|
27
|
+
}() });
|
|
28
|
+
function decimalValuesEqual(left, right) {
|
|
29
|
+
if (left === void 0) return false;
|
|
30
|
+
const leftNumber = Number(left);
|
|
31
|
+
const rightNumber = Number(right);
|
|
32
|
+
return Number.isFinite(leftNumber) && Number.isFinite(rightNumber) && leftNumber === rightNumber;
|
|
33
|
+
}
|
|
34
|
+
const cartRemoveLineOperationBinding = bindOperation(cartRemoveLineOperation, { execute: function() {
|
|
35
|
+
var _ref3 = _asyncToGenerator(function* (context, input, signal) {
|
|
36
|
+
const mutation = yield context.host.sales.removeLine(input, signal);
|
|
37
|
+
return finalizeCartMutation(context, mutation, signal, () => mutation.status === "succeeded" && mutation.data.removedLineId === input.lineId || !context.host.sales.getObservedSnapshot().cart.lines.some((item) => item.lineId === input.lineId));
|
|
38
|
+
});
|
|
39
|
+
return function execute(_x7, _x8, _x9) {
|
|
40
|
+
return _ref3.apply(this, arguments);
|
|
41
|
+
};
|
|
42
|
+
}() });
|
|
43
|
+
//#endregion
|
|
44
|
+
export { cartAddProductOperationBinding, cartRemoveLineOperationBinding, cartUpdateQuantityOperationBinding };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _asyncToGenerator } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
2
2
|
import { createOperationError, operationUnknown } from "./errors.js";
|
|
3
|
-
//#region src/components/HDLKiosk/
|
|
3
|
+
//#region src/components/HDLKiosk/runtime/operations/cartConsistency.ts
|
|
4
4
|
function finalizeCartMutation(_x, _x2, _x3, _x4) {
|
|
5
5
|
return _finalizeCartMutation.apply(this, arguments);
|
|
6
6
|
}
|
|
@@ -1,11 +1,23 @@
|
|
|
1
|
+
import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
1
2
|
import { _asyncToGenerator } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
3
|
+
import { checkoutOpenOperation, checkoutPayEftposOperation, checkoutPrepareOperation, checkoutRequestStaffPaymentApprovalOperation } from "../../app/operations.js";
|
|
2
4
|
import { operationFailed, operationUnknown } from "./errors.js";
|
|
3
|
-
import {
|
|
5
|
+
import { bindOperation } from "./types.js";
|
|
4
6
|
import { defaultCheckoutRequirementRegistry } from "./checkoutRequirements.js";
|
|
5
|
-
//#region src/components/HDLKiosk/
|
|
7
|
+
//#region src/components/HDLKiosk/runtime/operations/checkout.ts
|
|
6
8
|
function forwardFailure(result) {
|
|
7
9
|
return result;
|
|
8
10
|
}
|
|
11
|
+
const PAYMENT_ALREADY_STARTED_ERRORS = new Set([
|
|
12
|
+
"checkoutPaymentAlreadySettled",
|
|
13
|
+
"checkoutPaymentAlreadyStarted",
|
|
14
|
+
"checkoutAlreadyStarted"
|
|
15
|
+
]);
|
|
16
|
+
/** 标记当前支付命令尚未进入 Host dispatch,供硬阻断策略安全放行。 */
|
|
17
|
+
function forwardPreDispatchFailure(result) {
|
|
18
|
+
if ((result.status === "partialFailure" || result.status === "unknown") && !PAYMENT_ALREADY_STARTED_ERRORS.has(result.error.code)) return _objectSpread2(_objectSpread2({}, result), {}, { error: _objectSpread2(_objectSpread2({}, result.error), {}, { details: _objectSpread2(_objectSpread2({}, result.error.details), {}, { checkoutDispatched: false }) }) });
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
9
21
|
function evaluateCheckoutRequirements(context, sales) {
|
|
10
22
|
return defaultCheckoutRequirementRegistry.evaluate(context.checkoutRequirementIds, {
|
|
11
23
|
workflow: context.workflowContext,
|
|
@@ -98,123 +110,96 @@ function _ensureCheckoutPrepared() {
|
|
|
98
110
|
});
|
|
99
111
|
return _ensureCheckoutPrepared.apply(this, arguments);
|
|
100
112
|
}
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
if (preparation.status !== "succeeded") return forwardFailure(preparation);
|
|
122
|
-
const snapshot = host.sales.getObservedSnapshot();
|
|
123
|
-
const requirements = evaluateCheckoutRequirements(context, snapshot);
|
|
124
|
-
const validationFailure = requirementFailure(requirements);
|
|
125
|
-
if (validationFailure) return validationFailure;
|
|
126
|
-
const decision = checkoutSafety.beginOpen(snapshot, sessionEpoch, requirements.requirementIds);
|
|
127
|
-
if (decision.status === "rejected") return decision.reason === "checkoutAlreadyStarted" ? operationUnknown(decision.reason) : operationFailed(decision.reason, "back");
|
|
128
|
-
if (signal.aborted) {
|
|
129
|
-
const result = {
|
|
130
|
-
status: "cancelled",
|
|
131
|
-
reason: "checkoutAbortedBeforeDispatch"
|
|
132
|
-
};
|
|
133
|
-
checkoutSafety.settle(result);
|
|
134
|
-
return result;
|
|
135
|
-
}
|
|
136
|
-
let result;
|
|
137
|
-
try {
|
|
138
|
-
result = yield host.sales.openCheckout(signal);
|
|
139
|
-
} catch (error) {
|
|
140
|
-
result = operationUnknown("checkoutInvocationUnhandled", error);
|
|
141
|
-
}
|
|
113
|
+
const checkoutPrepareOperationBinding = bindOperation(checkoutPrepareOperation, { execute: (context, _input, signal) => {
|
|
114
|
+
const fulfillment = context.workflowContext.fulfillment;
|
|
115
|
+
return prepareCheckout(context, signal, fulfillment ? { mode: fulfillment } : void 0);
|
|
116
|
+
} });
|
|
117
|
+
const checkoutOpenOperationBinding = bindOperation(checkoutOpenOperation, { execute: function() {
|
|
118
|
+
var _ref = _asyncToGenerator(function* (context, _input, signal) {
|
|
119
|
+
const { host, checkoutSafety, sessionEpoch } = context;
|
|
120
|
+
const preparation = yield ensureCheckoutPrepared(context, signal);
|
|
121
|
+
if (preparation.status !== "succeeded") return forwardPreDispatchFailure(preparation);
|
|
122
|
+
const snapshot = host.sales.getObservedSnapshot();
|
|
123
|
+
const requirements = evaluateCheckoutRequirements(context, snapshot);
|
|
124
|
+
const validationFailure = requirementFailure(requirements);
|
|
125
|
+
if (validationFailure) return validationFailure;
|
|
126
|
+
const decision = checkoutSafety.beginOpen(snapshot, sessionEpoch, requirements.requirementIds);
|
|
127
|
+
if (decision.status === "rejected") return decision.reason === "checkoutAlreadyStarted" ? operationUnknown(decision.reason) : operationFailed(decision.reason, "back");
|
|
128
|
+
if (signal.aborted) {
|
|
129
|
+
const result = {
|
|
130
|
+
status: "cancelled",
|
|
131
|
+
reason: "checkoutAbortedBeforeDispatch"
|
|
132
|
+
};
|
|
142
133
|
checkoutSafety.settle(result);
|
|
143
134
|
return result;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
135
|
+
}
|
|
136
|
+
let result;
|
|
137
|
+
try {
|
|
138
|
+
result = yield host.sales.openCheckout(signal);
|
|
139
|
+
} catch (error) {
|
|
140
|
+
result = operationUnknown("checkoutInvocationUnhandled", error);
|
|
141
|
+
}
|
|
142
|
+
checkoutSafety.settle(result);
|
|
143
|
+
return result;
|
|
144
|
+
});
|
|
145
|
+
return function execute(_x8, _x9, _x10) {
|
|
146
|
+
return _ref.apply(this, arguments);
|
|
147
|
+
};
|
|
148
|
+
}() });
|
|
150
149
|
/** Kiosk EFTPOS 直连入口:Host 只能调用嵌入式 PaymentMethodRuntime。 */
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
if (decision.status === "rejected") return decision.reason === "checkoutAlreadyStarted" ? operationUnknown(decision.reason) : operationFailed(decision.reason, "back");
|
|
168
|
-
if (signal.aborted) {
|
|
169
|
-
const result = {
|
|
170
|
-
status: "cancelled",
|
|
171
|
-
reason: "checkoutAbortedBeforeDispatch"
|
|
172
|
-
};
|
|
173
|
-
checkoutSafety.settle(result);
|
|
174
|
-
return result;
|
|
175
|
-
}
|
|
176
|
-
let result;
|
|
177
|
-
try {
|
|
178
|
-
result = yield host.sales.payEftpos(input, signal);
|
|
179
|
-
} catch (error) {
|
|
180
|
-
result = operationUnknown("checkoutInvocationUnhandled", error);
|
|
181
|
-
}
|
|
182
|
-
if (result.status === "succeeded" && !(yield waitForPaymentProjection(context, signal))) result = operationUnknown("checkoutPaymentProjectionNotConfirmed");
|
|
150
|
+
const checkoutPayEftposOperationBinding = bindOperation(checkoutPayEftposOperation, { execute: function() {
|
|
151
|
+
var _ref2 = _asyncToGenerator(function* (context, input, signal) {
|
|
152
|
+
const { host, checkoutSafety, sessionEpoch } = context;
|
|
153
|
+
const preparation = yield ensureCheckoutPrepared(context, signal);
|
|
154
|
+
if (preparation.status !== "succeeded") return forwardPreDispatchFailure(preparation);
|
|
155
|
+
const snapshot = host.sales.getObservedSnapshot();
|
|
156
|
+
const requirements = evaluateCheckoutRequirements(context, snapshot);
|
|
157
|
+
const validationFailure = requirementFailure(requirements);
|
|
158
|
+
if (validationFailure) return validationFailure;
|
|
159
|
+
const decision = checkoutSafety.beginOpen(snapshot, sessionEpoch, requirements.requirementIds);
|
|
160
|
+
if (decision.status === "rejected") return decision.reason === "checkoutAlreadyStarted" ? operationUnknown(decision.reason) : operationFailed(decision.reason, "back");
|
|
161
|
+
if (signal.aborted) {
|
|
162
|
+
const result = {
|
|
163
|
+
status: "cancelled",
|
|
164
|
+
reason: "checkoutAbortedBeforeDispatch"
|
|
165
|
+
};
|
|
183
166
|
checkoutSafety.settle(result);
|
|
184
167
|
return result;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
168
|
+
}
|
|
169
|
+
let result;
|
|
170
|
+
try {
|
|
171
|
+
result = yield host.sales.payEftpos(input, signal);
|
|
172
|
+
} catch (error) {
|
|
173
|
+
result = operationUnknown("checkoutInvocationUnhandled", error);
|
|
174
|
+
}
|
|
175
|
+
if (result.status === "succeeded" && !(yield waitForPaymentProjection(context, signal))) result = operationUnknown("checkoutPaymentProjectionNotConfirmed");
|
|
176
|
+
checkoutSafety.settle(result);
|
|
177
|
+
return result;
|
|
178
|
+
});
|
|
179
|
+
return function execute(_x11, _x12, _x13) {
|
|
180
|
+
return _ref2.apply(this, arguments);
|
|
181
|
+
};
|
|
182
|
+
}() });
|
|
191
183
|
/** 店员付款只请求主屏授权;授权派发绝不视作付款成功。 */
|
|
192
|
-
const
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
if (preparation.status !== "succeeded") return forwardFailure(preparation);
|
|
202
|
-
const validationFailure = requirementFailure(evaluateCheckoutRequirements(context, context.host.sales.getObservedSnapshot()));
|
|
203
|
-
if (validationFailure) return validationFailure;
|
|
204
|
-
if (signal.aborted) return {
|
|
205
|
-
status: "cancelled",
|
|
206
|
-
reason: "authorizationAborted"
|
|
207
|
-
};
|
|
208
|
-
return context.host.sales.requestStaffPaymentApproval(input, signal);
|
|
209
|
-
});
|
|
210
|
-
return function execute(_x14, _x15, _x16) {
|
|
211
|
-
return _ref3.apply(this, arguments);
|
|
184
|
+
const checkoutRequestStaffPaymentApprovalOperationBinding = bindOperation(checkoutRequestStaffPaymentApprovalOperation, { execute: function() {
|
|
185
|
+
var _ref3 = _asyncToGenerator(function* (context, input, signal) {
|
|
186
|
+
const preparation = yield ensureCheckoutPrepared(context, signal);
|
|
187
|
+
if (preparation.status !== "succeeded") return forwardFailure(preparation);
|
|
188
|
+
const validationFailure = requirementFailure(evaluateCheckoutRequirements(context, context.host.sales.getObservedSnapshot()));
|
|
189
|
+
if (validationFailure) return validationFailure;
|
|
190
|
+
if (signal.aborted) return {
|
|
191
|
+
status: "cancelled",
|
|
192
|
+
reason: "authorizationAborted"
|
|
212
193
|
};
|
|
213
|
-
|
|
214
|
-
});
|
|
194
|
+
return context.host.sales.requestStaffPaymentApproval(input, signal);
|
|
195
|
+
});
|
|
196
|
+
return function execute(_x14, _x15, _x16) {
|
|
197
|
+
return _ref3.apply(this, arguments);
|
|
198
|
+
};
|
|
199
|
+
}() });
|
|
215
200
|
const MONEY = /^(?:0|[1-9]\d*)(?:\.\d+)?$/;
|
|
216
201
|
function isSafeMoney(value) {
|
|
217
202
|
return MONEY.test(value) && Number.isFinite(Number(value));
|
|
218
203
|
}
|
|
219
204
|
//#endregion
|
|
220
|
-
export {
|
|
205
|
+
export { checkoutOpenOperationBinding, checkoutPayEftposOperationBinding, checkoutPrepareOperationBinding, checkoutRequestStaffPaymentApprovalOperationBinding };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
2
|
-
//#region src/components/HDLKiosk/
|
|
2
|
+
//#region src/components/HDLKiosk/runtime/operations/checkoutRequirements.ts
|
|
3
3
|
function createCheckoutRequirementRegistry(definitions) {
|
|
4
4
|
const byId = /* @__PURE__ */ new Map();
|
|
5
5
|
definitions.forEach((definition) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
2
|
-
//#region src/components/HDLKiosk/
|
|
2
|
+
//#region src/components/HDLKiosk/runtime/operations/checkoutSafety.ts
|
|
3
3
|
const DEFAULT_TOKEN_TTL_MS = 3e4;
|
|
4
4
|
function createCheckoutSafetyController({ tokenTtlMs = DEFAULT_TOKEN_TTL_MS, now = Date.now } = {}) {
|
|
5
5
|
if (!Number.isFinite(tokenTtlMs) || tokenTtlMs <= 0) throw new Error("HDLKiosk checkout token TTL must be positive");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
2
|
-
import { operationFailed, operationUnknown } from "./errors.js";
|
|
3
2
|
import { createKernelOperationCoordinator } from "../../kernel/operations/coordinator.js";
|
|
3
|
+
import { operationFailed, operationUnknown } from "./errors.js";
|
|
4
4
|
import { createCheckoutSafetyController } from "./checkoutSafety.js";
|
|
5
|
-
//#region src/components/HDLKiosk/
|
|
5
|
+
//#region src/components/HDLKiosk/runtime/operations/coordinator.ts
|
|
6
6
|
function conflicts(left, right) {
|
|
7
7
|
if (left === "none" || right === "none") return false;
|
|
8
8
|
if (left === "session" || right === "session") return true;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { _asyncToGenerator } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
2
|
+
import { canonicalizeSkuValue, createSkuValueFingerprint } from "../../../../plus/skuOptionsSelection/utils/canonicalSkuValue.js";
|
|
3
|
+
import { productRemovePrimaryProductOperation, productSyncPrimaryWeightedProductOperation } from "../../app/operations.js";
|
|
4
|
+
import { operationFailed } from "./errors.js";
|
|
5
|
+
import { finalizeCartMutation } from "./cartConsistency.js";
|
|
6
|
+
import { bindOperation } from "./types.js";
|
|
7
|
+
import Decimal from "decimal.js";
|
|
8
|
+
//#region src/components/HDLKiosk/runtime/operations/customization.ts
|
|
9
|
+
/**
|
|
10
|
+
* 文件角色:在 Customization Next 边界提交称重主商品本地草稿。
|
|
11
|
+
* 运行机制:校验稳定净重/必选项,调用 Host/OS 主商品 writer,再验证目标行、重量、
|
|
12
|
+
* SkuValue 和“新增或原行发生变化”的最小 receipt/Projection 事实。
|
|
13
|
+
* 边界:页面输入变化不调用本 Operation;OS 内部的加购弹窗与业务判断不属于 HDLKiosk。
|
|
14
|
+
*/
|
|
15
|
+
const productRemovePrimaryProductOperationBinding = bindOperation(productRemovePrimaryProductOperation, { execute: function() {
|
|
16
|
+
var _ref = _asyncToGenerator(function* (context, input, signal) {
|
|
17
|
+
if (!input.lineId) return {
|
|
18
|
+
status: "succeeded",
|
|
19
|
+
data: {}
|
|
20
|
+
};
|
|
21
|
+
const mutation = yield context.host.sales.removeLine({ lineId: input.lineId }, signal);
|
|
22
|
+
return finalizeCartMutation(context, mutation, signal, () => mutation.status === "succeeded" && mutation.data.removedLineId === input.lineId || !context.host.sales.getObservedSnapshot().cart.lines.some((item) => item.lineId === input.lineId));
|
|
23
|
+
});
|
|
24
|
+
return function execute(_x, _x2, _x3) {
|
|
25
|
+
return _ref.apply(this, arguments);
|
|
26
|
+
};
|
|
27
|
+
}() });
|
|
28
|
+
function hasValidSkuValue(input) {
|
|
29
|
+
const canonical = canonicalizeSkuValue(input.skuValue);
|
|
30
|
+
return Boolean(input.productId && canonical && canonical.productId === input.productId);
|
|
31
|
+
}
|
|
32
|
+
function sameSkuValue(expected, actual) {
|
|
33
|
+
const expectedFingerprint = createSkuValueFingerprint(expected);
|
|
34
|
+
return Boolean(expectedFingerprint && expectedFingerprint === createSkuValueFingerprint(actual));
|
|
35
|
+
}
|
|
36
|
+
function sameWeight(actual, expected) {
|
|
37
|
+
const actualValue = new Decimal(actual || NaN);
|
|
38
|
+
const expectedValue = new Decimal(expected || NaN);
|
|
39
|
+
return actualValue.isFinite() && expectedValue.isFinite() && actualValue.equals(expectedValue);
|
|
40
|
+
}
|
|
41
|
+
const productSyncPrimaryWeightedProductOperationBinding = bindOperation(productSyncPrimaryWeightedProductOperation, { execute: function() {
|
|
42
|
+
var _ref2 = _asyncToGenerator(function* (context, input, signal) {
|
|
43
|
+
if (!hasValidSkuValue(input)) return operationFailed("customizationInputInvalid", "back");
|
|
44
|
+
const beforeLines = new Map(context.host.sales.getObservedSnapshot().cart.lines.map((line) => [line.lineId, line.quantity]));
|
|
45
|
+
const before = context.host.sales.getObservedSnapshot();
|
|
46
|
+
const previousPrimary = input.existingLineId ? before.cart.lines.find((line) => line.lineId === input.existingLineId) : void 0;
|
|
47
|
+
if (input.existingLineId && (!previousPrimary || previousPrimary.productId !== input.productId)) return operationFailed("customizationExistingLineInvalid", "back");
|
|
48
|
+
const mutation = yield context.host.sales.syncPrimaryWeightedProduct(input, signal);
|
|
49
|
+
return finalizeCartMutation(context, mutation, signal, () => {
|
|
50
|
+
const after = context.host.sales.getObservedSnapshot();
|
|
51
|
+
const projectionMatches = after.cart.lines.some((line) => {
|
|
52
|
+
if (mutation.status === "succeeded" && mutation.data.affectedLineId && line.lineId !== mutation.data.affectedLineId) return false;
|
|
53
|
+
if (line.productId !== input.productId) return false;
|
|
54
|
+
const skuMatches = sameSkuValue(input.skuValue, line.skuValue);
|
|
55
|
+
const weightMatches = sameWeight(line.quantity, input.measurement.netWeightKg);
|
|
56
|
+
const previousQuantity = beforeLines.get(line.lineId);
|
|
57
|
+
if (input.existingLineId) return line.lineId === input.existingLineId && skuMatches && weightMatches && mutation.status === "succeeded" && mutation.data.affectedLineId === input.existingLineId && after.observationId > before.observationId;
|
|
58
|
+
return skuMatches && weightMatches && (previousQuantity === void 0 || previousQuantity !== line.quantity);
|
|
59
|
+
});
|
|
60
|
+
const successfulOutcome = mutation.status === "succeeded" ? mutation.data : void 0;
|
|
61
|
+
const confirmedLine = successfulOutcome === null || successfulOutcome === void 0 ? void 0 : successfulOutcome.confirmedLine;
|
|
62
|
+
return Boolean(confirmedLine && confirmedLine.productId === input.productId && (!(successfulOutcome === null || successfulOutcome === void 0 ? void 0 : successfulOutcome.affectedLineId) || confirmedLine.lineId === successfulOutcome.affectedLineId) && (!input.existingLineId || (successfulOutcome === null || successfulOutcome === void 0 ? void 0 : successfulOutcome.affectedLineId) === input.existingLineId && confirmedLine.lineId === input.existingLineId) && sameWeight(confirmedLine.quantity, input.measurement.netWeightKg) && sameSkuValue(input.skuValue, confirmedLine.skuValue) && (Boolean(input.existingLineId) || !beforeLines.has(confirmedLine.lineId) || beforeLines.get(confirmedLine.lineId) !== confirmedLine.quantity)) || projectionMatches;
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
return function execute(_x4, _x5, _x6) {
|
|
66
|
+
return _ref2.apply(this, arguments);
|
|
67
|
+
};
|
|
68
|
+
}() });
|
|
69
|
+
//#endregion
|
|
70
|
+
export { productRemovePrimaryProductOperationBinding, productSyncPrimaryWeightedProductOperationBinding };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { setFulfillmentOperation } from "../../app/operations.js";
|
|
2
|
+
import { bindOperation } from "./types.js";
|
|
3
|
+
//#region src/components/HDLKiosk/runtime/operations/fulfillment.ts
|
|
4
|
+
const setFulfillmentOperationBinding = bindOperation(setFulfillmentOperation, { execute: (context, input, signal) => context.host.sales.setFulfillment(input, signal) });
|
|
5
|
+
//#endregion
|
|
6
|
+
export { setFulfillmentOperationBinding };
|