@pisell/private-materials 6.12.167 → 6.12.169
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +10 -10
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +10 -10
- package/es/components/HDLKiosk/{contracts → app/contracts}/config.js +1 -1
- package/es/components/HDLKiosk/app/manifest.js +11 -11
- package/es/components/HDLKiosk/app/operations.js +92 -0
- package/es/components/HDLKiosk/app/workflow/barcode.js +11 -13
- package/es/components/HDLKiosk/app/workflow/index.js +16 -0
- package/es/components/HDLKiosk/app/workflow/predicates.js +1 -1
- package/es/components/HDLKiosk/app/workflow/quick.js +1 -1
- package/es/components/HDLKiosk/app/workflow/registry.js +4 -4
- package/es/components/HDLKiosk/app/workflow/scale.js +5 -1
- package/es/components/HDLKiosk/docs/00-/346/226/207/344/273/266/345/257/274/350/210/252.md +104 -167
- package/es/components/HDLKiosk/docs/01-/346/240/270/345/277/203/350/277/220/350/241/214/346/234/272/345/210/266.md +105 -101
- package/es/components/HDLKiosk/docs/03-/344/270/232/345/212/241/346/265/201/347/250/213/344/270/216/344/272/244/344/272/222/350/247/204/345/210/231.md +2 -2
- 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/07-/345/220/216/347/273/255/345/267/245/344/275/234.md +1 -1
- package/es/components/HDLKiosk/docs/08-/346/227/240/345/244/264Application/350/277/220/350/241/214/346/227/266/351/207/215/346/236/204/350/256/276/350/256/241.md +719 -0
- package/es/components/HDLKiosk/docs/09-Entry/350/256/276/345/244/207/344/272/213/344/273/266/351/207/215/346/236/204/344/277/256/345/244/215/346/212/245/345/221/212.md +187 -0
- package/es/components/HDLKiosk/docs/README.md +6 -2
- package/es/components/HDLKiosk/docs//345/256/236/346/226/275/350/277/233/345/272/246.md +8 -7
- package/es/components/HDLKiosk/docs//346/236/266/346/236/204/350/256/276/350/256/241.md +16 -18
- package/es/components/HDLKiosk/index.js +22 -28
- package/es/components/HDLKiosk/index.less +1 -1
- package/es/components/HDLKiosk/kernel/README.md +14 -13
- 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 +51 -22
- package/es/components/HDLKiosk/kernel/workflow/compiler.js +23 -30
- 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 +37 -38
- package/es/components/HDLKiosk/slices/customization/Screen/index.less +5 -0
- package/es/components/HDLKiosk/slices/customization/slice.js +3 -4
- 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.js +2 -2
- package/es/components/HDLKiosk/slices/identity/slice.js +3 -3
- package/es/components/HDLKiosk/slices/identity/view.js +1 -1
- package/es/components/HDLKiosk/slices/payment/slice.js +3 -3
- package/es/components/HDLKiosk/slices/primaryProductPrompt/slice.js +2 -2
- package/es/components/HDLKiosk/slices/primaryProductPrompt/view.js +2 -2
- package/es/components/HDLKiosk/{runtime → ui}/HDLKioskWorkflowView.js +45 -131
- 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 +7 -7
- 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/adapter/HDLKioskPaymentRuntime.js +2 -1
- package/es/components/bigSale/templates/HDLKiosk/adapter/capabilities.js +1 -1
- package/es/components/bigSale/templates/HDLKiosk/adapter/projection.js +21 -11
- package/es/components/bigSale/templates/HDLKiosk/adapter/sales.js +21 -3
- package/es/components/bigSale/templates/HDLKiosk/adapter/scaleTrigger.js +20 -5
- package/es/components/bigSale/templates/HDLKiosk/adapter/useBigSaleHDLKioskHost.js +3 -0
- package/es/components/bigSale/templates/HDLKiosk/index.js +3 -3
- package/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 +11 -13
- package/lib/components/HDLKiosk/app/workflow/index.js +16 -0
- package/lib/components/HDLKiosk/app/workflow/predicates.js +1 -0
- package/lib/components/HDLKiosk/app/workflow/quick.js +1 -1
- package/lib/components/HDLKiosk/app/workflow/registry.js +3 -3
- package/lib/components/HDLKiosk/app/workflow/scale.js +5 -1
- package/lib/components/HDLKiosk/docs/00-/346/226/207/344/273/266/345/257/274/350/210/252.md +104 -167
- package/lib/components/HDLKiosk/docs/01-/346/240/270/345/277/203/350/277/220/350/241/214/346/234/272/345/210/266.md +105 -101
- package/lib/components/HDLKiosk/docs/03-/344/270/232/345/212/241/346/265/201/347/250/213/344/270/216/344/272/244/344/272/222/350/247/204/345/210/231.md +2 -2
- 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/07-/345/220/216/347/273/255/345/267/245/344/275/234.md +1 -1
- package/lib/components/HDLKiosk/docs/08-/346/227/240/345/244/264Application/350/277/220/350/241/214/346/227/266/351/207/215/346/236/204/350/256/276/350/256/241.md +719 -0
- package/lib/components/HDLKiosk/docs/09-Entry/350/256/276/345/244/207/344/272/213/344/273/266/351/207/215/346/236/204/344/277/256/345/244/215/346/212/245/345/221/212.md +187 -0
- package/lib/components/HDLKiosk/docs/README.md +6 -2
- package/lib/components/HDLKiosk/docs//345/256/236/346/226/275/350/277/233/345/272/246.md +8 -7
- package/lib/components/HDLKiosk/docs//346/236/266/346/236/204/350/256/276/350/256/241.md +16 -18
- package/lib/components/HDLKiosk/index.js +25 -31
- package/lib/components/HDLKiosk/index.less +1 -1
- package/lib/components/HDLKiosk/kernel/README.md +14 -13
- 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 +51 -22
- package/lib/components/HDLKiosk/kernel/workflow/compiler.js +23 -30
- 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 +38 -39
- 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.js +2 -2
- package/lib/components/HDLKiosk/slices/identity/slice.js +4 -4
- package/lib/components/HDLKiosk/slices/identity/view.js +1 -1
- package/lib/components/HDLKiosk/slices/payment/slice.js +5 -5
- package/lib/components/HDLKiosk/slices/primaryProductPrompt/slice.js +2 -2
- package/lib/components/HDLKiosk/slices/primaryProductPrompt/view.js +2 -2
- package/lib/components/HDLKiosk/{runtime → ui}/HDLKioskWorkflowView.js +46 -132
- 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 +7 -7
- package/lib/components/HDLKiosk/ui/controllers/useHDLKioskActionDispatcher.js +67 -0
- package/lib/components/HDLKiosk/{runtime → ui}/controllers/useHDLKioskCustomerController.js +1 -1
- package/lib/components/HDLKiosk/ui/controllers/useHDLKioskDeviceController.js +26 -0
- package/lib/components/HDLKiosk/ui/controllers/useHDLKioskExitController.js +54 -0
- package/lib/components/HDLKiosk/{runtime → ui}/controllers/useHDLKioskScreenData.js +1 -1
- package/lib/components/HDLKiosk/ui/controllers/useHDLKioskSessionController.js +40 -0
- package/lib/components/HDLKiosk/{app → ui}/entry/Screen/index.js +8 -6
- package/lib/components/HDLKiosk/{app → ui}/entry/model.js +2 -2
- package/lib/components/HDLKiosk/ui/scale.js +24 -0
- package/lib/components/HDLKiosk/{runtime/useHostSnapshot.js → ui/snapshots.js} +6 -7
- package/lib/components/HDLKiosk/{app → ui}/views.js +1 -1
- package/lib/components/HDLKiosk/{runtime → ui}/workflowEvent.js +1 -1
- package/lib/components/HDLKiosk/utils.js +4 -4
- package/lib/components/bigSale/templates/HDLKiosk/adapter/HDLKioskPaymentRuntime.js +2 -1
- package/lib/components/bigSale/templates/HDLKiosk/adapter/capabilities.js +1 -1
- package/lib/components/bigSale/templates/HDLKiosk/adapter/projection.js +21 -10
- package/lib/components/bigSale/templates/HDLKiosk/adapter/sales.js +20 -2
- package/lib/components/bigSale/templates/HDLKiosk/adapter/scaleTrigger.js +19 -4
- package/lib/components/bigSale/templates/HDLKiosk/adapter/useBigSaleHDLKioskHost.js +3 -0
- package/lib/components/bigSale/templates/HDLKiosk/index.js +4 -4
- package/package.json +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/lib/components/HDLKiosk/app/constants.js +0 -9
- package/lib/components/HDLKiosk/app/operations/barcode.js +0 -21
- package/lib/components/HDLKiosk/app/operations/cart.js +0 -62
- package/lib/components/HDLKiosk/app/operations/fulfillment.js +0 -10
- package/lib/components/HDLKiosk/app/operations/session.js +0 -42
- package/lib/components/HDLKiosk/app/operations/types.js +0 -12
- package/lib/components/HDLKiosk/devices/entryArbiter.js +0 -33
- package/lib/components/HDLKiosk/runtime/controllers/useHDLKioskDeviceController.js +0 -76
- package/lib/components/HDLKiosk/runtime/controllers/useHDLKioskScannerController.js +0 -161
- package/lib/components/HDLKiosk/runtime/controllers/useHDLKioskSessionController.js +0 -186
- package/lib/components/HDLKiosk/runtime/useWorkflowSnapshot.js +0 -13
- package/lib/components/HDLKiosk/slices/customization/operation.js +0 -83
- package/lib/components/HDLKiosk/slices/identity/operation.js +0 -60
- /package/es/components/HDLKiosk/{app → ui}/entry/Screen/index.less +0 -0
- /package/lib/components/HDLKiosk/{app → ui}/entry/Screen/index.less +0 -0
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
const require_defineApplication = require("../kernel/application/defineApplication.js");
|
|
2
|
-
const
|
|
3
|
-
const require_barcode = require("./operations/barcode.js");
|
|
4
|
-
const require_cart = require("./operations/cart.js");
|
|
5
|
-
const require_checkout = require("./operations/checkout.js");
|
|
6
|
-
const require_session = require("./operations/session.js");
|
|
2
|
+
const require_operations = require("./operations.js");
|
|
7
3
|
const require_index = require("../slices/index.js");
|
|
8
|
-
const require_barcode
|
|
4
|
+
const require_barcode = require("./workflow/barcode.js");
|
|
9
5
|
const require_quick = require("./workflow/quick.js");
|
|
10
6
|
const require_scale = require("./workflow/scale.js");
|
|
11
7
|
//#region src/components/HDLKiosk/app/manifest.ts
|
|
@@ -15,27 +11,30 @@ const require_scale = require("./workflow/scale.js");
|
|
|
15
11
|
* session/device 等不归属于具体 Slice 的 Operation,并绑定三条 Workflow。
|
|
16
12
|
* 边界:Runtime 只消费 Manifest,不再分别创建 Activity/Operation/Workflow 注册表。
|
|
17
13
|
*/
|
|
18
|
-
const hdlKioskApplication = require_defineApplication.
|
|
14
|
+
const hdlKioskApplication = require_defineApplication.defineApplication({
|
|
19
15
|
id: "hdl-kiosk",
|
|
20
16
|
slices: require_index.hdlKioskSlices,
|
|
21
17
|
workflows: {
|
|
22
18
|
quick: require_quick.quickOrderWorkflow,
|
|
23
|
-
barcode: require_barcode
|
|
19
|
+
barcode: require_barcode.barcodeWorkflow,
|
|
24
20
|
scale: require_scale.scaleWorkflow
|
|
25
21
|
},
|
|
22
|
+
triggers: [require_defineApplication.defineTrigger({
|
|
23
|
+
id: "onScan",
|
|
24
|
+
mode: "automatic"
|
|
25
|
+
}), require_defineApplication.defineTrigger({
|
|
26
|
+
id: "onWeight",
|
|
27
|
+
mode: "automatic"
|
|
28
|
+
})],
|
|
26
29
|
operations: [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
require_operations.sessionEnsureOperation,
|
|
31
|
+
require_operations.sessionResetOperation,
|
|
32
|
+
require_operations.barcodeConsumeOperation,
|
|
33
|
+
require_operations.cartUpdateQuantityOperation,
|
|
34
|
+
require_operations.cartRemoveLineOperation,
|
|
35
|
+
require_operations.checkoutOpenOperation,
|
|
36
|
+
require_operations.checkoutPrepareOperation
|
|
34
37
|
]
|
|
35
38
|
});
|
|
36
|
-
function createHDLKioskOperationRegistry() {
|
|
37
|
-
return require_types.createOperationRegistry([...hdlKioskApplication.operations.values()]);
|
|
38
|
-
}
|
|
39
39
|
//#endregion
|
|
40
|
-
exports.createHDLKioskOperationRegistry = createHDLKioskOperationRegistry;
|
|
41
40
|
exports.hdlKioskApplication = hdlKioskApplication;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
const require_types = require("../kernel/operations/types.js");
|
|
2
|
+
//#region src/components/HDLKiosk/app/operations.ts
|
|
3
|
+
function defineOperationContract(contract) {
|
|
4
|
+
return require_types.defineKernelOperationContract(contract);
|
|
5
|
+
}
|
|
6
|
+
const identitySyncOperation = defineOperationContract({
|
|
7
|
+
id: "identity.sync",
|
|
8
|
+
conflictScope: "customer",
|
|
9
|
+
timeoutMs: 15e3,
|
|
10
|
+
retry: "explicit-user"
|
|
11
|
+
});
|
|
12
|
+
const productRemovePrimaryProductOperation = defineOperationContract({
|
|
13
|
+
id: "product.removePrimaryProduct",
|
|
14
|
+
conflictScope: "cart",
|
|
15
|
+
timeoutMs: 15e3,
|
|
16
|
+
retry: "explicit-user"
|
|
17
|
+
});
|
|
18
|
+
const productSyncPrimaryWeightedProductOperation = defineOperationContract({
|
|
19
|
+
id: "product.syncPrimaryWeightedProduct",
|
|
20
|
+
conflictScope: "cart",
|
|
21
|
+
retry: "explicit-user"
|
|
22
|
+
});
|
|
23
|
+
const barcodeConsumeOperation = defineOperationContract({
|
|
24
|
+
id: "barcode.consume",
|
|
25
|
+
conflictScope: "cart",
|
|
26
|
+
retry: "explicit-user"
|
|
27
|
+
});
|
|
28
|
+
const cartAddProductOperation = defineOperationContract({
|
|
29
|
+
id: "cart.addProduct",
|
|
30
|
+
conflictScope: "cart",
|
|
31
|
+
retry: "explicit-user"
|
|
32
|
+
});
|
|
33
|
+
const cartUpdateQuantityOperation = defineOperationContract({
|
|
34
|
+
id: "cart.updateQuantity",
|
|
35
|
+
conflictScope: "cart",
|
|
36
|
+
timeoutMs: 15e3,
|
|
37
|
+
retry: "explicit-user"
|
|
38
|
+
});
|
|
39
|
+
const cartRemoveLineOperation = defineOperationContract({
|
|
40
|
+
id: "cart.removeLine",
|
|
41
|
+
conflictScope: "cart",
|
|
42
|
+
timeoutMs: 15e3,
|
|
43
|
+
retry: "explicit-user"
|
|
44
|
+
});
|
|
45
|
+
const setFulfillmentOperation = defineOperationContract({
|
|
46
|
+
id: "fulfillment.set",
|
|
47
|
+
conflictScope: "cart",
|
|
48
|
+
timeoutMs: 2e4,
|
|
49
|
+
retry: "explicit-user"
|
|
50
|
+
});
|
|
51
|
+
const sessionEnsureOperation = defineOperationContract({
|
|
52
|
+
id: "session.ensure",
|
|
53
|
+
conflictScope: "session",
|
|
54
|
+
timeoutMs: 15e3,
|
|
55
|
+
retry: "explicit-user"
|
|
56
|
+
});
|
|
57
|
+
const sessionResetOperation = defineOperationContract({
|
|
58
|
+
id: "session.reset",
|
|
59
|
+
tags: ["session-reset"],
|
|
60
|
+
conflictScope: "session",
|
|
61
|
+
timeoutMs: 15e3,
|
|
62
|
+
retry: "never"
|
|
63
|
+
});
|
|
64
|
+
const checkoutPrepareOperation = defineOperationContract({
|
|
65
|
+
id: "checkout.prepare",
|
|
66
|
+
conflictScope: "checkout",
|
|
67
|
+
timeoutMs: 2e4,
|
|
68
|
+
retry: "explicit-user"
|
|
69
|
+
});
|
|
70
|
+
const checkoutOpenOperation = defineOperationContract({
|
|
71
|
+
id: "checkout.open",
|
|
72
|
+
tags: ["checkout-dispatch"],
|
|
73
|
+
conflictScope: "checkout",
|
|
74
|
+
timeoutMs: 12e4,
|
|
75
|
+
retry: "never"
|
|
76
|
+
});
|
|
77
|
+
const checkoutPayEftposOperation = defineOperationContract({
|
|
78
|
+
id: "checkout.payEftpos",
|
|
79
|
+
tags: ["checkout-dispatch"],
|
|
80
|
+
conflictScope: "checkout",
|
|
81
|
+
timeoutMs: 12e4,
|
|
82
|
+
retry: "never"
|
|
83
|
+
});
|
|
84
|
+
const checkoutRequestStaffPaymentApprovalOperation = defineOperationContract({
|
|
85
|
+
id: "checkout.requestStaffPaymentApproval",
|
|
86
|
+
tags: ["checkout-authorization"],
|
|
87
|
+
conflictScope: "checkout",
|
|
88
|
+
timeoutMs: 2e4,
|
|
89
|
+
retry: "explicit-user"
|
|
90
|
+
});
|
|
91
|
+
//#endregion
|
|
92
|
+
exports.barcodeConsumeOperation = barcodeConsumeOperation;
|
|
93
|
+
exports.cartAddProductOperation = cartAddProductOperation;
|
|
94
|
+
exports.cartRemoveLineOperation = cartRemoveLineOperation;
|
|
95
|
+
exports.cartUpdateQuantityOperation = cartUpdateQuantityOperation;
|
|
96
|
+
exports.checkoutOpenOperation = checkoutOpenOperation;
|
|
97
|
+
exports.checkoutPayEftposOperation = checkoutPayEftposOperation;
|
|
98
|
+
exports.checkoutPrepareOperation = checkoutPrepareOperation;
|
|
99
|
+
exports.checkoutRequestStaffPaymentApprovalOperation = checkoutRequestStaffPaymentApprovalOperation;
|
|
100
|
+
exports.identitySyncOperation = identitySyncOperation;
|
|
101
|
+
exports.productRemovePrimaryProductOperation = productRemovePrimaryProductOperation;
|
|
102
|
+
exports.productSyncPrimaryWeightedProductOperation = productSyncPrimaryWeightedProductOperation;
|
|
103
|
+
exports.sessionEnsureOperation = sessionEnsureOperation;
|
|
104
|
+
exports.sessionResetOperation = sessionResetOperation;
|
|
105
|
+
exports.setFulfillmentOperation = setFulfillmentOperation;
|
|
@@ -7,34 +7,32 @@ const require_slice$4 = require("../../slices/primaryProductPrompt/slice.js");
|
|
|
7
7
|
//#region src/components/HDLKiosk/app/workflow/barcode.ts
|
|
8
8
|
/**
|
|
9
9
|
* 文件角色:声明 Barcode 入口的有序业务步骤。
|
|
10
|
-
* 运行机制:
|
|
11
|
-
*
|
|
10
|
+
* 运行机制:onScan Trigger 创建并发布 Session,再在 readyForCommands 后消费首码。
|
|
11
|
+
* Workflow 从 Catalog 开始,完成补充购物后进入独立的主商品询问 Modal,需要时进入
|
|
12
12
|
* Customization;无论选择或拒绝,最终都直接进入 Fulfillment。
|
|
13
13
|
* 边界:设备扫码属于 Session 输入,不是可前进/后退的 Activity;支付 prepare 由支付
|
|
14
14
|
* Operation 在 dispatch 前统一保证,不绑定 Catalog transition。
|
|
15
15
|
*/
|
|
16
16
|
const barcodeWorkflow = require_defineApplication.defineWorkflow({
|
|
17
17
|
id: "hdl.barcode",
|
|
18
|
+
start: {
|
|
19
|
+
trigger: "onScan",
|
|
20
|
+
channel: "product"
|
|
21
|
+
},
|
|
18
22
|
steps: [
|
|
19
23
|
require_slice.catalogSlice,
|
|
20
24
|
{
|
|
21
25
|
slice: require_slice$4.primaryProductPromptSlice,
|
|
22
|
-
presentation: {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
visitPolicy: "reuseResolution",
|
|
27
|
-
on: { skip: "fulfillment" }
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
slice: require_slice$1.customizationSlice,
|
|
31
|
-
visitPolicy: "reuseResolution"
|
|
26
|
+
presentation: { mode: "modal" },
|
|
27
|
+
visitPolicy: "once",
|
|
28
|
+
on: { omit: "fulfillment" }
|
|
32
29
|
},
|
|
30
|
+
require_slice$1.customizationSlice,
|
|
33
31
|
require_slice$2.fulfillmentSlice,
|
|
34
32
|
require_slice$3.paymentMethodSlice,
|
|
35
33
|
{
|
|
36
34
|
slice: require_slice$3.paymentCompletedSlice,
|
|
37
|
-
|
|
35
|
+
isTerminal: true
|
|
38
36
|
}
|
|
39
37
|
]
|
|
40
38
|
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require("./barcode.js");
|
|
2
|
+
require("./quick.js");
|
|
3
|
+
require("./scale.js");
|
|
4
|
+
require("./registry.js");
|
|
5
|
+
require("./predicates.js");
|
|
6
|
+
require("./navigationGuards.js");
|
|
7
|
+
require("./policy.js");
|
|
8
|
+
//#region src/components/HDLKiosk/app/workflow/index.ts
|
|
9
|
+
/** 允许注册到本应用的内建 Workflow ID。 */
|
|
10
|
+
const HDL_WORKFLOW_IDS = Object.freeze([
|
|
11
|
+
"hdl.quick",
|
|
12
|
+
"hdl.barcode",
|
|
13
|
+
"hdl.scale"
|
|
14
|
+
]);
|
|
15
|
+
//#endregion
|
|
16
|
+
exports.HDL_WORKFLOW_IDS = HDL_WORKFLOW_IDS;
|
|
@@ -10,9 +10,9 @@ const defaultActivityRegistry = Object.freeze({
|
|
|
10
10
|
accepts: (id, intent) => manifestRegistry.require(id).intents.some((availableIntent) => availableIntent === intent)
|
|
11
11
|
});
|
|
12
12
|
const BUILT_IN_WORKFLOW_DEFINITIONS = Object.freeze({
|
|
13
|
-
quick: require_defineApplication.
|
|
14
|
-
barcode: require_defineApplication.
|
|
15
|
-
scale: require_defineApplication.
|
|
13
|
+
quick: require_defineApplication.normalizeApplicationWorkflow(require_manifest.hdlKioskApplication.workflows.quick),
|
|
14
|
+
barcode: require_defineApplication.normalizeApplicationWorkflow(require_manifest.hdlKioskApplication.workflows.barcode),
|
|
15
|
+
scale: require_defineApplication.normalizeApplicationWorkflow(require_manifest.hdlKioskApplication.workflows.scale)
|
|
16
16
|
});
|
|
17
17
|
function getBuiltInWorkflowDefinition(entry) {
|
|
18
18
|
return BUILT_IN_WORKFLOW_DEFINITIONS[entry];
|
|
@@ -13,6 +13,10 @@ const require_slice$3 = require("../../slices/payment/slice.js");
|
|
|
13
13
|
*/
|
|
14
14
|
const scaleWorkflow = require_defineApplication.defineWorkflow({
|
|
15
15
|
id: "hdl.scale",
|
|
16
|
+
start: {
|
|
17
|
+
trigger: "onWeight",
|
|
18
|
+
channel: "weighing-product"
|
|
19
|
+
},
|
|
16
20
|
steps: [
|
|
17
21
|
require_slice$1.customizationSlice,
|
|
18
22
|
require_slice.catalogSlice,
|
|
@@ -20,7 +24,7 @@ const scaleWorkflow = require_defineApplication.defineWorkflow({
|
|
|
20
24
|
require_slice$3.paymentMethodSlice,
|
|
21
25
|
{
|
|
22
26
|
slice: require_slice$3.paymentCompletedSlice,
|
|
23
|
-
|
|
27
|
+
isTerminal: true
|
|
24
28
|
}
|
|
25
29
|
]
|
|
26
30
|
});
|
|
@@ -1,199 +1,136 @@
|
|
|
1
1
|
# HDLKiosk 文件导航
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
本文按当前代码事实说明所有权和依赖边界。详细运行模型见《01-核心运行机制》和《08-无头 Application Runtime 重构设计》。
|
|
4
4
|
|
|
5
|
-
## 1.
|
|
5
|
+
## 1. 固定依赖方向
|
|
6
6
|
|
|
7
7
|
```text
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
→ kernel workflow actor + operation coordinator
|
|
12
|
-
→ slices slice/view
|
|
13
|
-
→ components shell/overlay/common
|
|
14
|
-
→ contracts host ports
|
|
15
|
-
→ BigSale template adapter
|
|
8
|
+
kernel ← app ← runtime ← ui
|
|
9
|
+
↑ ↑
|
|
10
|
+
slices ───────────┘
|
|
16
11
|
```
|
|
17
12
|
|
|
18
|
-
|
|
13
|
+
- `kernel/` 是通用基础包,不认识 HDLKiosk、Host、商品、设备或 React。
|
|
14
|
+
- `app/` 是 HDLKiosk 业务 Application,只包含协议、流程和静态策略,可脱离 UI。
|
|
15
|
+
- `runtime/` 绑定 Host Port、Operation Handler 和 Trigger Adapter,产出可执行 Runtime。
|
|
16
|
+
- `slices/` 按 feature 并置协议定义和 React View;`app` 只允许读取其 `slice.ts` 协议出口。
|
|
17
|
+
- `ui/` 是 Runtime 的可选 React 适配层;`components/` 只保留跨 Slice 的共享视觉组件。
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
`architectureBoundary.test.ts` 会阻止 `app → runtime/UI` 和 `runtime → React/UI` 的反向依赖。
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
HDLKiosk/
|
|
24
|
-
├── app/ # 应用清单、流程、共享 Operation 入口、Entry 与节点渲染装配
|
|
25
|
-
├── slices/ # 纵向业务切片
|
|
26
|
-
├── components/ # 跨切片共享 UI 与样式
|
|
27
|
-
├── runtime/ # React 生命周期、会话与 Actor 连接层
|
|
28
|
-
├── contracts/ # Host、订单、设备、流程和 Operation 协议
|
|
29
|
-
├── kernel/ # 与商家无关的 Workflow/Application/Operation 内核
|
|
30
|
-
├── devices/ # 扫码、称重入口治理与 Scale Runtime
|
|
31
|
-
├── testing/ # FakeHost、fixture 和测试工具
|
|
32
|
-
├── docs/ # 常驻设计与维护文档
|
|
33
|
-
├── types.ts # 公共 Props、Action、ViewModel 与 Slice View Context
|
|
34
|
-
├── utils.ts # 跨 Slice 纯方法与安全错误呈现
|
|
35
|
-
├── index.tsx # 独立物料根组件
|
|
36
|
-
├── index.less # 全局样式聚合
|
|
37
|
-
├── locales.ts # 文案
|
|
38
|
-
└── product.ts # 标准 ProductData 的轻量读取辅助
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
顶层目录只表达稳定职责,业务能力、共享组件、流程和副作用分别从 `slices`、`components` 与 `app` 进入。
|
|
42
|
-
|
|
43
|
-
## 3. `app/`:一套 Kiosk 如何被装配
|
|
44
|
-
|
|
45
|
-
| 文件/目录 | 角色 |
|
|
46
|
-
| --- | --- |
|
|
47
|
-
| `manifest.ts` | 唯一应用清单;收集 Slice 提供的 Activity/Operation,并绑定三条 Workflow |
|
|
48
|
-
| `constants.ts` | `HDL_WORKFLOW_IDS` 等应用常量 |
|
|
49
|
-
| `events.ts` | HDLKiosk Activity Intent 与 Back Navigation 的强类型事件联合 |
|
|
50
|
-
| `operations.ts` | 共享 Operation 的唯一公共导入入口 |
|
|
51
|
-
| `operations/` | `operations.ts` 背后的私有实现、Coordinator 策略和测试;外部代码不要逐文件跨层引用 |
|
|
52
|
-
| `views.ts` | 应用层 Activity → React View 的完整同步注册表;不进入 Slice/Workflow/Kernel |
|
|
53
|
-
| `workflow/quick.ts` | Quick 的有序 Activity 列表与特殊转移 |
|
|
54
|
-
| `workflow/barcode.ts` | Barcode 的有序 Activity 列表与特殊转移 |
|
|
55
|
-
| `workflow/scale.ts` | Scale 的有序 Activity 列表与特殊转移 |
|
|
56
|
-
| `workflow/registry.ts` | 从 Manifest 派生 Activity Registry,并提供内置流程查询 |
|
|
57
|
-
| `workflow/predicates.ts` | HDLKiosk 本地 Predicate Registry |
|
|
58
|
-
| `workflow/policy.ts` | 支付门禁等商家应用策略校验;结构编译仍属于 Kernel |
|
|
59
|
-
| `ScreenRenderer.tsx` | 按当前 Activity 从 `views.ts` 取 View;处理 modal base 叠加和缺失 View 的阻断呈现 |
|
|
60
|
-
| `entry/model.ts` | 派生 Workflow 之外三个入口的可用性和展示模型 |
|
|
61
|
-
| `entry/Screen/` | Workflow 之外的三个入口页面 |
|
|
62
|
-
|
|
63
|
-
`compileWorkflowDefinition` 没有独立包装文件。会话启动处直接调用 Kernel 的 `compileWorkflowStructure`,随后执行 HDLKiosk policy 校验;测试在自身消费处声明小型 helper。
|
|
64
|
-
|
|
65
|
-
## 4. `slices/`:纵向业务能力
|
|
66
|
-
|
|
67
|
-
每个 Slice 把一个业务能力的定义和私有界面放在同一处:
|
|
21
|
+
## 2. 顶层结构
|
|
68
22
|
|
|
69
23
|
```text
|
|
70
|
-
|
|
71
|
-
├──
|
|
72
|
-
├──
|
|
73
|
-
├──
|
|
74
|
-
├──
|
|
75
|
-
|
|
24
|
+
HDLKiosk/
|
|
25
|
+
├── kernel/ # 通用 Application、Workflow 和 Operation 原语
|
|
26
|
+
├── app/ # HDLKiosk Contracts、Manifest、Workflow、Operation Contract
|
|
27
|
+
├── slices/ # 各 Activity 的协议定义、View、Screen 和局部模型
|
|
28
|
+
├── runtime/ # Host Binding、设备入口、Trigger、Operation、Session Factory
|
|
29
|
+
├── ui/ # React Entry、Controller、Renderer 和 Runtime hooks
|
|
30
|
+
├── components/ # 跨 Slice 共享的 common/shell/overlay UI
|
|
31
|
+
├── testing/ # FakeHost、fixture 和测试辅助
|
|
32
|
+
├── docs/
|
|
33
|
+
├── types.ts # React 展示层公共类型
|
|
34
|
+
├── utils.ts # 跨 View 纯方法
|
|
35
|
+
├── index.tsx
|
|
36
|
+
└── index.less
|
|
76
37
|
```
|
|
77
38
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
- `slices/index.ts` 只汇总各目录导出的 `defineSlice` 结果,并统一约束 `screen.id` 必须是 HDLKiosk `ScreenId`;
|
|
81
|
-
- 每个 `slice.ts` 只通过 `screen: { id }` 声明页面类别;实际 View 在 `app/views.ts` 中按 Activity 单独、完整地注册,使用同步本地组件引用;
|
|
82
|
-
- Slice 专属 Operation 与 Slice 同置,例如 `identity/operation.ts`;
|
|
83
|
-
- Cart、Checkout、Session、Barcode 等跨 Slice Operation 从 `app/operations.ts` 导入。
|
|
84
|
-
|
|
85
|
-
`Slice` 是作者侧唯一业务能力概念:`defineSlice` 定义能力,`application.slices` 收集能力,Workflow 的 `slice` 字段引用能力;运行期再编译为 Activity Contract。
|
|
86
|
-
|
|
87
|
-
命名关系必须保持单向:Slice `id` 是业务 Activity;`screen.id` 是页面类别;`app/views.ts` 按 Activity 注册实际 UI。`catalog` 负责商品浏览,`primaryProductPrompt` 负责主商品询问,两者通过 Modal base 组合。支付派发和店员支付授权是 `paymentMethod` 页面内 Command,不创建流程 Intent。
|
|
88
|
-
|
|
89
|
-
## 5. `components/`:共享展示能力
|
|
39
|
+
## 3. 各层所有权
|
|
90
40
|
|
|
91
|
-
|
|
92
|
-
| --- | --- |
|
|
93
|
-
| `shell/` | Header、BottomBarHost、FloatingBar、会员区、订单摘要和错误边界 |
|
|
94
|
-
| `overlays/` | CartDrawer、统一 `HDLKioskModal`、主动结束订单确认 |
|
|
95
|
-
| `common/` | SkuOptionsSelection 适配、BlockingNotice 等跨 Slice 控件 |
|
|
41
|
+
### `kernel/`:通用基础包
|
|
96
42
|
|
|
97
|
-
|
|
43
|
+
| 位置 | 职责 |
|
|
44
|
+
| -------------- | ------------------------------------------------------------------------------- |
|
|
45
|
+
| `application/` | `defineSlice`、`defineApplication`、Trigger 路由、Admission 和 Session Registry |
|
|
46
|
+
| `workflow/` | Compiler、Actor、Transition 原语 |
|
|
47
|
+
| `operations/` | 排队、冲突域、timeout 和 epoch 原语 |
|
|
98
48
|
|
|
99
|
-
|
|
49
|
+
`kernel/application` 是可提取的通用 API,不是 HDLKiosk 业务 App。
|
|
100
50
|
|
|
101
|
-
|
|
102
|
-
| --- | --- |
|
|
103
|
-
| `createWorkflowSession.ts` | 读取内置 Definition,直接编译、校验并创建 Actor/Coordinator |
|
|
104
|
-
| `HDLKioskWorkflowView.tsx` | 活跃会话的 React 组合层;连接 Shell、Renderer 和 Controllers |
|
|
105
|
-
| `domainTransitionRunner.ts` | 将 Actor 的 exit effect 交给 Operation Coordinator |
|
|
106
|
-
| `workflowContext.ts` | 只归并经过 Activity Intent 成功提交的流程上下文 |
|
|
107
|
-
| `workflowLifecycle.ts` | Actor blocked/finished 的 Host 遥测与生命周期钩子 |
|
|
108
|
-
| `useHostSnapshot.ts` | 订阅 Host Projection |
|
|
109
|
-
| `useWorkflowSnapshot.ts` | 订阅 Actor Snapshot |
|
|
51
|
+
### `app/`:HDLKiosk 业务 Application
|
|
110
52
|
|
|
111
|
-
|
|
53
|
+
| 位置 | 职责 |
|
|
54
|
+
| --------------- | ------------------------------------------------------ |
|
|
55
|
+
| `manifest.ts` | 产出 `hdlKioskApplication` Definition |
|
|
56
|
+
| `contracts/` | Application 与 Host/Runtime 之间的稳定业务端口 |
|
|
57
|
+
| `operations.ts` | Operation ID、输入输出、冲突域和重试语义;不含 Handler |
|
|
58
|
+
| `workflow/` | Quick、Barcode、Scale 拓扑与业务策略 |
|
|
112
59
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
| `useHDLKioskSessionController` | 创建/销毁会话、入口互斥、session epoch,以及 `returnToEntry(reason?)` 安全清单接口 |
|
|
116
|
-
| `useHDLKioskDeviceController` | 顶层注册 scanner/scale 输入,只有当前入口状态允许时才消费 |
|
|
117
|
-
| `useHDLKioskCustomerController` | Shell 中途登录、身份同步与重新报价 |
|
|
118
|
-
| `useHDLKioskScreenData` | 按当前 Activity 加载 Catalog 或主称重商品,离开后丢弃迟到结果 |
|
|
60
|
+
Activity、Command、Intent、Surface 和 Exit Effect 协议位于平级的
|
|
61
|
+
`slices/*/slice.ts`。协议与 UI 同 feature 并置,但 Application 不能导入其中的 React 文件。
|
|
119
62
|
|
|
120
|
-
|
|
63
|
+
`app/` 不可导入 Host 实现、设备订阅、Runtime Handler 或 React。
|
|
121
64
|
|
|
122
|
-
|
|
65
|
+
### `runtime/`:具体依赖与无头运行时
|
|
123
66
|
|
|
124
|
-
|
|
67
|
+
| 位置 | 职责 |
|
|
68
|
+
| ------------------ | -------------------------------------------------------------------------- |
|
|
69
|
+
| `createRuntime.ts` | 将 Application Definition 和 Host 组合为可执行 Runtime |
|
|
70
|
+
| `triggers.ts` | 直接订阅 Scanner/Scale Port,提交 Trigger Occurrence |
|
|
71
|
+
| `devices/` | Scanner/Scale Ingress、去重和无 UI Scale Store |
|
|
72
|
+
| `operations/` | 购物车、支付、身份、履约和会话的 Host Handler |
|
|
73
|
+
| `session/` | Session Factory、Actor、Coordinator、Context、Projection 和 Lifecycle 组合 |
|
|
125
74
|
|
|
126
|
-
|
|
127
|
-
| --- | --- |
|
|
128
|
-
| `application/` | `defineSlice`、`defineKioskApplication`、Slice 收集和 authoring normalization |
|
|
129
|
-
| `workflow/compiler.ts` | 编译有序 Step 数组,校验 ID、Intent、可达性、modal base 和有界循环 |
|
|
130
|
-
| `workflow/actor.ts` | 单会话串行状态机,拒绝迟到 Activity/Step 事件 |
|
|
131
|
-
| `workflow/transition.ts` | advance/stay/blocked 等转移结果原语 |
|
|
132
|
-
| `operations/coordinator.ts` | 通用排队、去重、timeout、dispose 和 epoch 协调 |
|
|
133
|
-
| `operations/registry.ts` | 与业务无关的 Operation 注册表 |
|
|
134
|
-
|
|
135
|
-
Kernel 只能依赖自身类型。它不包含 HDLKiosk Activity ID、支付语义、React 或 BigSale。
|
|
136
|
-
|
|
137
|
-
## 8. `app/operations.ts` 与 Operation 私有实现
|
|
138
|
-
|
|
139
|
-
公共消费统一写成:
|
|
75
|
+
纯 JavaScript 可直接运行:
|
|
140
76
|
|
|
141
77
|
```ts
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
} from '../../app/operations';
|
|
78
|
+
const runtime = createHDLKioskApplicationRuntime(host, { config });
|
|
79
|
+
runtime.subscribe(() => consume(runtime.getSnapshot()));
|
|
80
|
+
runtime.activate();
|
|
81
|
+
const quick = await runtime.start('quick');
|
|
147
82
|
```
|
|
148
83
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
- `cart.ts` / `cartConsistency.ts`:购物车写入与写后一致性;
|
|
152
|
-
- `checkout.ts` / `checkoutSafety.ts` / `checkoutRequirements.ts`:prepare、支付派发和支付前事实门禁;
|
|
153
|
-
- `barcode.ts`:消费标准化扫码输入;
|
|
154
|
-
- `session.ts`:ensure 与验证式 reset;
|
|
155
|
-
- `coordinator.ts`:把 Kernel Coordinator 绑定到 HDLKiosk Host、冲突矩阵和支付冻结;
|
|
156
|
-
- `errors.ts` / `types.ts`:业务错误和 Kernel 类型绑定。
|
|
157
|
-
|
|
158
|
-
履约方式由通用 `checkout.prepare` 在支付派发前写入和验证,不绑定具体 Screen 事件。
|
|
159
|
-
|
|
160
|
-
## 9. `contracts/` 与 BigSale Adapter
|
|
161
|
-
|
|
162
|
-
`contracts/` 是独立物料和宿主的边界:
|
|
84
|
+
### `ui/` 与 `components/`:可选 React 消费层
|
|
163
85
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
86
|
+
| 位置 | 职责 |
|
|
87
|
+
| ------------------------------------------------ | -------------------------------------------------------------- |
|
|
88
|
+
| `ui/controllers/useHDLKioskSessionController.ts` | 创建 Runtime、用 `useSyncExternalStore` 投影 snapshot |
|
|
89
|
+
| `ui/controllers/useHDLKioskActionDispatcher.ts` | 将 UI Intent/Navigation/Command 适配到当前 Session |
|
|
90
|
+
| `ui/controllers/useHDLKioskExitController.ts` | 处理 Exit Navigation 确认与验证式 returnToEntry |
|
|
91
|
+
| `runtime/devices/scannerSessionRouter.ts` | 唯一持有 Scanner;统一路由 Entry、启动中和 Flow 扫码 |
|
|
92
|
+
| `runtime/devices/scannerSessionPort.ts` | 将当前 Workflow Session 的可写策略与扫码 Command 适配给 Router |
|
|
93
|
+
| `ui/controllers/useHDLKioskDeviceController.ts` | 仅投影秤连接状态,不启动 Workflow |
|
|
94
|
+
| `ui/views.ts` / `ui/ScreenRenderer.tsx` | Activity → View 注册和渲染 |
|
|
95
|
+
| `ui/entry/` | Workflow 外手动入口 UI |
|
|
96
|
+
| `slices/<name>/` | 同一 feature 内的 `slice.ts` 协议与 View/Screen/Dialog |
|
|
97
|
+
| `components/` | 跨 feature 的 common、shell 和 overlays |
|
|
170
98
|
|
|
171
|
-
|
|
99
|
+
Slice 协议和 UI 分层,但保持相同 feature 名字和局部目录形状,降低定义与展示间的定位成本。
|
|
172
100
|
|
|
173
|
-
##
|
|
101
|
+
## 4. Trigger 所有权
|
|
174
102
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
| --- | --- | --- |
|
|
186
|
-
| 调整三条流程顺序 | `app/workflow/*.ts` | Definition/Actor 测试、03 文档 |
|
|
187
|
-
| 新增业务能力 | `slices/<name>/slice.ts` + `view.tsx` | `slices/index.ts`、Workflow |
|
|
188
|
-
| 新增 Slice 私有写入 | `slices/<name>/operation.ts` | Slice exit effect、Host contract、测试 |
|
|
189
|
-
| 新增跨 Slice 写入 | `app/operations/` + `app/operations.ts` | Manifest、OperationInputMap、Coordinator 测试 |
|
|
190
|
-
| 修改 Slice 私有展示投影 | `slices/<name>/view.tsx` | 只信 Sales Projection,不本地报价 |
|
|
191
|
-
| 修改跨 Slice 购物车/金额映射 | 根 `utils.ts` | 根 `types.ts`、使用这些方法的 Slice View |
|
|
192
|
-
| 修改共享 BottomBar/Modal | `components/shell` 或 `components/overlays` | z-index、portal、各 Slice 局部样式 |
|
|
193
|
-
| 修改扫码/称重入口 | `devices/` + Device Controller | event ID、入口互斥、session epoch |
|
|
194
|
-
| 修改回首页 | Session Controller 的 `returnToEntry` | reset receipt、支付安全、epoch |
|
|
195
|
-
| 修改 BigSale/OS 对接 | BigSale `adapter/` | capabilities、Projection、FakeHost |
|
|
196
|
-
|
|
197
|
-
## 12. 文件头注释
|
|
103
|
+
```text
|
|
104
|
+
Host device event
|
|
105
|
+
→ runtime/triggers.ts
|
|
106
|
+
→ Kernel Runtime occurrence
|
|
107
|
+
→ trigger + channel 唯一匹配 Workflow
|
|
108
|
+
→ Admission / idempotency
|
|
109
|
+
→ Session Factory
|
|
110
|
+
→ Session Registry started event
|
|
111
|
+
→ React 或纯 JS 消费者
|
|
112
|
+
```
|
|
198
113
|
|
|
199
|
-
|
|
114
|
+
- Quick 未声明 `start`,因此默认 manual。
|
|
115
|
+
- Barcode/Scale 只能由 automatic Trigger 启动,手动调用 Workflow Handle 会被拒绝。
|
|
116
|
+
- 当前一个 automatic Trigger 只能绑定一个 Workflow,重复绑定 fail-closed。
|
|
117
|
+
- Channel 由 Runtime Adapter 赋予,不要求物理秤事件自带 Channel。
|
|
118
|
+
- 流程内扫码是 Session Command,不再进入 Workflow 启动 API。
|
|
119
|
+
- 当前不实现多 Workflow 广播和嵌套调用;`parentSessionId` 只保留因果关联字段。
|
|
120
|
+
|
|
121
|
+
## 5. 常见修改定位
|
|
122
|
+
|
|
123
|
+
| 需求 | 首要位置 |
|
|
124
|
+
| -------------------- | ---------------------------------------------------------- |
|
|
125
|
+
| 调整流程顺序 | `app/workflow/*.ts` |
|
|
126
|
+
| 新增 Activity 协议 | `slices/<name>/slice.ts` |
|
|
127
|
+
| 新增 Activity UI | `slices/<name>/` + `ui/views.ts` |
|
|
128
|
+
| 新增 Operation 协议 | `app/operations.ts` + Slice effect/command |
|
|
129
|
+
| 实现 Operation | `runtime/operations/registry.ts` + 对应 Handler |
|
|
130
|
+
| 新增自动入口 | `app/manifest.ts` + Workflow start + `runtime/triggers.ts` |
|
|
131
|
+
| 修改 React 消费方式 | `ui/` |
|
|
132
|
+
| 修改 BigSale/OS 对接 | `components/bigSale/templates/HDLKiosk/adapter/` |
|
|
133
|
+
|
|
134
|
+
## 6. 文件头注释
|
|
135
|
+
|
|
136
|
+
业务、运行时和适配层文件应说明文件角色、运行机制和边界。注释记录当前设计事实,不记录迁移历史。
|