@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,186 +0,0 @@
|
|
|
1
|
-
require("../../../../_virtual/_rolldown/runtime.js");
|
|
2
|
-
const require_asyncToGenerator = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
|
|
3
|
-
const require_entryArbiter = require("../../devices/entryArbiter.js");
|
|
4
|
-
const require_scaleIngress = require("../../devices/scaleIngress.js");
|
|
5
|
-
const require_scannerIngress = require("../../devices/scannerIngress.js");
|
|
6
|
-
const require_registry = require("../../app/workflow/registry.js");
|
|
7
|
-
const require_createWorkflowSession = require("../createWorkflowSession.js");
|
|
8
|
-
let react = require("react");
|
|
9
|
-
//#region src/components/HDLKiosk/runtime/controllers/useHDLKioskSessionController.ts
|
|
10
|
-
/**
|
|
11
|
-
* 文件角色:拥有 Entry、会话创建/销毁和回首页的顶层生命周期。
|
|
12
|
-
* 运行机制:结合 Capabilities 和入口 claim 决定 start;reset 成功后 dispose Actor
|
|
13
|
-
* 并推进 session epoch。当前应用不恢复跨刷新会话。
|
|
14
|
-
* 边界:不会仅靠页面导航开始下一单,也不消费具体 Screen 的局部交互。
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Barcode 的首次扫码只需要建立可写 Session 并消费条码;秤和称重主商品
|
|
18
|
-
* 是后续业务分支能力,不得阻断 Barcode Session 入口。
|
|
19
|
-
*/
|
|
20
|
-
function resolveHDLKioskEntryCapabilityBlockReason({ entry, capabilities, primaryWeightedProductId }) {
|
|
21
|
-
if (!capabilities.session.ensure) return "sessionEnsureUnavailable";
|
|
22
|
-
if (entry === "barcode") return capabilities.scanner.available ? void 0 : "scannerUnavailable";
|
|
23
|
-
if (!capabilities.products.primaryWeightedProductQuery || !primaryWeightedProductId) return "primaryProductUnavailable";
|
|
24
|
-
if (require_registry.builtInWorkflowHasActivity(entry, "customization") && (!capabilities.customization.weightedProduct || !capabilities.scale.available)) return "customizationUnavailable";
|
|
25
|
-
if (entry === "scale" && (!capabilities.scale.available || !capabilities.scale.weightChangeTrigger)) return "scaleTriggerUnavailable";
|
|
26
|
-
}
|
|
27
|
-
function useHDLKioskSessionController({ host, config, isActive }) {
|
|
28
|
-
const [session, setSession] = (0, react.useState)();
|
|
29
|
-
const [starting, setStarting] = (0, react.useState)(false);
|
|
30
|
-
const [startErrorReference, setStartErrorReference] = (0, react.useState)();
|
|
31
|
-
const sessionRef = (0, react.useRef)(session);
|
|
32
|
-
const startingSessionRef = (0, react.useRef)();
|
|
33
|
-
const startPromiseRef = (0, react.useRef)();
|
|
34
|
-
const startAttemptSequence = (0, react.useRef)(0);
|
|
35
|
-
const returnAttemptSequence = (0, react.useRef)(0);
|
|
36
|
-
const returnPromiseRef = (0, react.useRef)();
|
|
37
|
-
const activeRef = (0, react.useRef)(isActive);
|
|
38
|
-
const mountedHostRef = (0, react.useRef)(host);
|
|
39
|
-
const entryArbiter = (0, react.useMemo)(() => require_entryArbiter.createEntryArbiter(), [host]);
|
|
40
|
-
const scannerIngress = (0, react.useMemo)(() => require_scannerIngress.createScannerIngress({ maxPendingEvents: 5 }), [host]);
|
|
41
|
-
const scaleIngress = (0, react.useMemo)(() => require_scaleIngress.createScaleIngress(), [host]);
|
|
42
|
-
sessionRef.current = session;
|
|
43
|
-
activeRef.current = isActive;
|
|
44
|
-
(0, react.useEffect)(() => () => {
|
|
45
|
-
var _sessionRef$current, _startingSessionRef$c;
|
|
46
|
-
(_sessionRef$current = sessionRef.current) === null || _sessionRef$current === void 0 || _sessionRef$current.actor.dispose();
|
|
47
|
-
(_startingSessionRef$c = startingSessionRef.current) === null || _startingSessionRef$c === void 0 || _startingSessionRef$c.actor.dispose();
|
|
48
|
-
}, []);
|
|
49
|
-
(0, react.useEffect)(() => {
|
|
50
|
-
var _sessionRef$current2, _startingSessionRef$c2;
|
|
51
|
-
if (mountedHostRef.current === host) return;
|
|
52
|
-
(_sessionRef$current2 = sessionRef.current) === null || _sessionRef$current2 === void 0 || _sessionRef$current2.actor.dispose();
|
|
53
|
-
(_startingSessionRef$c2 = startingSessionRef.current) === null || _startingSessionRef$c2 === void 0 || _startingSessionRef$c2.actor.dispose();
|
|
54
|
-
startingSessionRef.current = void 0;
|
|
55
|
-
startPromiseRef.current = void 0;
|
|
56
|
-
startAttemptSequence.current += 1;
|
|
57
|
-
sessionRef.current = void 0;
|
|
58
|
-
entryArbiter.reset();
|
|
59
|
-
scannerIngress.reset();
|
|
60
|
-
scaleIngress.reset();
|
|
61
|
-
mountedHostRef.current = host;
|
|
62
|
-
setSession(void 0);
|
|
63
|
-
setStarting(false);
|
|
64
|
-
setStartErrorReference(void 0);
|
|
65
|
-
}, [
|
|
66
|
-
entryArbiter,
|
|
67
|
-
host,
|
|
68
|
-
scaleIngress,
|
|
69
|
-
scannerIngress
|
|
70
|
-
]);
|
|
71
|
-
const start = (0, react.useCallback)((request) => {
|
|
72
|
-
const { entry } = request;
|
|
73
|
-
if (!activeRef.current || !config.enabledEntries.includes(entry)) return Promise.resolve(void 0);
|
|
74
|
-
if (config.businessMode === "production" && !require_registry.isBuiltInWorkflowProductionReady(entry)) {
|
|
75
|
-
setStartErrorReference(`workflow-placeholder-blocked-${Date.now()}`);
|
|
76
|
-
return Promise.resolve(void 0);
|
|
77
|
-
}
|
|
78
|
-
const capabilityBlockReason = resolveHDLKioskEntryCapabilityBlockReason({
|
|
79
|
-
entry,
|
|
80
|
-
capabilities: host.capabilities,
|
|
81
|
-
primaryWeightedProductId: config.primaryWeightedProductId
|
|
82
|
-
});
|
|
83
|
-
if (capabilityBlockReason) {
|
|
84
|
-
if (capabilityBlockReason === "sessionEnsureUnavailable") setStartErrorReference(`session-ensure-unavailable-${Date.now()}`);
|
|
85
|
-
return Promise.resolve(void 0);
|
|
86
|
-
}
|
|
87
|
-
const current = sessionRef.current;
|
|
88
|
-
if (current) return Promise.resolve(current.entry === entry ? current : void 0);
|
|
89
|
-
const pending = startPromiseRef.current;
|
|
90
|
-
if (pending) return pending.entry === entry ? pending.promise : Promise.resolve(void 0);
|
|
91
|
-
if (entryArbiter.claim(entry).status !== "accepted") return Promise.resolve(void 0);
|
|
92
|
-
const next = require_createWorkflowSession.createHDLKioskWorkflowSession(entry, host, { primaryWeightedProductId: config.primaryWeightedProductId });
|
|
93
|
-
startingSessionRef.current = next;
|
|
94
|
-
startAttemptSequence.current += 1;
|
|
95
|
-
const attempt = startAttemptSequence.current;
|
|
96
|
-
setStarting(true);
|
|
97
|
-
setStartErrorReference(void 0);
|
|
98
|
-
const promise = next.ensure(`entry:${entry}:ensure:${attempt}`).then(function() {
|
|
99
|
-
var _ref = require_asyncToGenerator._asyncToGenerator(function* (result) {
|
|
100
|
-
if (attempt !== startAttemptSequence.current || mountedHostRef.current !== host || !activeRef.current) {
|
|
101
|
-
next.actor.dispose();
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
if (result.status !== "succeeded") {
|
|
105
|
-
next.actor.dispose();
|
|
106
|
-
entryArbiter.reset();
|
|
107
|
-
setStartErrorReference(result.status === "failed" || result.status === "partialFailure" || result.status === "unknown" ? result.error.traceId : `session-start-cancelled-${Date.now()}`);
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
sessionRef.current = next;
|
|
111
|
-
setSession(next);
|
|
112
|
-
return next;
|
|
113
|
-
});
|
|
114
|
-
return function(_x) {
|
|
115
|
-
return _ref.apply(this, arguments);
|
|
116
|
-
};
|
|
117
|
-
}()).finally(() => {
|
|
118
|
-
if (attempt !== startAttemptSequence.current) return;
|
|
119
|
-
startingSessionRef.current = void 0;
|
|
120
|
-
startPromiseRef.current = void 0;
|
|
121
|
-
setStarting(false);
|
|
122
|
-
});
|
|
123
|
-
startPromiseRef.current = {
|
|
124
|
-
entry,
|
|
125
|
-
promise
|
|
126
|
-
};
|
|
127
|
-
return promise;
|
|
128
|
-
}, [
|
|
129
|
-
config.enabledEntries,
|
|
130
|
-
config.primaryWeightedProductId,
|
|
131
|
-
entryArbiter,
|
|
132
|
-
host
|
|
133
|
-
]);
|
|
134
|
-
const waitForReadySession = (0, react.useCallback)(() => {
|
|
135
|
-
var _startPromiseRef$curr, _startPromiseRef$curr2;
|
|
136
|
-
const current = sessionRef.current;
|
|
137
|
-
if (current) return Promise.resolve(current);
|
|
138
|
-
return (_startPromiseRef$curr = (_startPromiseRef$curr2 = startPromiseRef.current) === null || _startPromiseRef$curr2 === void 0 ? void 0 : _startPromiseRef$curr2.promise) !== null && _startPromiseRef$curr !== void 0 ? _startPromiseRef$curr : Promise.resolve(void 0);
|
|
139
|
-
}, []);
|
|
140
|
-
const completeReset = (0, react.useCallback)((completedSession) => {
|
|
141
|
-
if (sessionRef.current !== completedSession) return;
|
|
142
|
-
completedSession.actor.dispose();
|
|
143
|
-
entryArbiter.reset();
|
|
144
|
-
scannerIngress.reset();
|
|
145
|
-
scaleIngress.reset();
|
|
146
|
-
sessionRef.current = void 0;
|
|
147
|
-
setSession(void 0);
|
|
148
|
-
}, [
|
|
149
|
-
entryArbiter,
|
|
150
|
-
scaleIngress,
|
|
151
|
-
scannerIngress
|
|
152
|
-
]);
|
|
153
|
-
return {
|
|
154
|
-
session,
|
|
155
|
-
starting,
|
|
156
|
-
startErrorReference,
|
|
157
|
-
sessionRef,
|
|
158
|
-
activeRef,
|
|
159
|
-
entryArbiter,
|
|
160
|
-
scannerIngress,
|
|
161
|
-
scaleIngress,
|
|
162
|
-
start,
|
|
163
|
-
waitForReadySession,
|
|
164
|
-
completeReset,
|
|
165
|
-
returnToEntry: (0, react.useCallback)((reason = "application") => {
|
|
166
|
-
if (returnPromiseRef.current) return returnPromiseRef.current;
|
|
167
|
-
const current = sessionRef.current;
|
|
168
|
-
if (!current) return Promise.resolve({
|
|
169
|
-
status: "succeeded",
|
|
170
|
-
data: void 0
|
|
171
|
-
});
|
|
172
|
-
returnAttemptSequence.current += 1;
|
|
173
|
-
const attempt = returnAttemptSequence.current;
|
|
174
|
-
const promise = current.reset(`return:${reason}:${attempt}`).then((result) => {
|
|
175
|
-
if (result.status === "succeeded") completeReset(current);
|
|
176
|
-
return result;
|
|
177
|
-
}).finally(() => {
|
|
178
|
-
if (returnPromiseRef.current === promise) returnPromiseRef.current = void 0;
|
|
179
|
-
});
|
|
180
|
-
returnPromiseRef.current = promise;
|
|
181
|
-
return promise;
|
|
182
|
-
}, [completeReset])
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
//#endregion
|
|
186
|
-
exports.useHDLKioskSessionController = useHDLKioskSessionController;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
require("../../../_virtual/_rolldown/runtime.js");
|
|
2
|
-
let react = require("react");
|
|
3
|
-
//#region src/components/HDLKiosk/runtime/useWorkflowSnapshot.ts
|
|
4
|
-
/**
|
|
5
|
-
* 文件角色:将纯 Workflow Actor 的 Snapshot 接入 React 渲染。
|
|
6
|
-
* 运行机制:useSyncExternalStore 订阅 Actor,组件始终消费 Actor 发布的不可变快照。
|
|
7
|
-
* 边界:不发送事件、不派生业务事实,也不维护第二份当前节点状态。
|
|
8
|
-
*/
|
|
9
|
-
function useWorkflowSnapshot(actor) {
|
|
10
|
-
return (0, react.useSyncExternalStore)(actor.subscribe, actor.getSnapshot, actor.getSnapshot);
|
|
11
|
-
}
|
|
12
|
-
//#endregion
|
|
13
|
-
exports.useWorkflowSnapshot = useWorkflowSnapshot;
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
|
|
2
|
-
const require_asyncToGenerator = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
|
|
3
|
-
const require_canonicalSkuValue = require("../../../../plus/skuOptionsSelection/utils/canonicalSkuValue.js");
|
|
4
|
-
const require_errors = require("../../app/operations/errors.js");
|
|
5
|
-
const require_cartConsistency = require("../../app/operations/cartConsistency.js");
|
|
6
|
-
const require_types = require("../../app/operations/types.js");
|
|
7
|
-
let decimal_js = require("decimal.js");
|
|
8
|
-
decimal_js = require_runtime.__toESM(decimal_js);
|
|
9
|
-
//#region src/components/HDLKiosk/slices/customization/operation.ts
|
|
10
|
-
/**
|
|
11
|
-
* 文件角色:在 Customization Next 边界提交称重主商品本地草稿。
|
|
12
|
-
* 运行机制:校验稳定净重/必选项,调用 Host/OS 主商品 writer,再验证目标行、重量、
|
|
13
|
-
* SkuValue 和“新增或原行发生变化”的最小 receipt/Projection 事实。
|
|
14
|
-
* 边界:页面输入变化不调用本 Operation;OS 内部的加购弹窗与业务判断不属于 HDLKiosk。
|
|
15
|
-
*/
|
|
16
|
-
const productRemovePrimaryProductOperation = require_types.defineOperation({
|
|
17
|
-
id: "product.removePrimaryProduct",
|
|
18
|
-
conflictScope: "cart",
|
|
19
|
-
timeoutMs: 15e3,
|
|
20
|
-
retry: "explicit-user",
|
|
21
|
-
execute: function() {
|
|
22
|
-
var _ref = require_asyncToGenerator._asyncToGenerator(function* (context, input, signal) {
|
|
23
|
-
if (!input.lineId) return {
|
|
24
|
-
status: "succeeded",
|
|
25
|
-
data: {}
|
|
26
|
-
};
|
|
27
|
-
const mutation = yield context.host.sales.removeLine({ lineId: input.lineId }, signal);
|
|
28
|
-
return require_cartConsistency.finalizeCartMutation(context, mutation, signal, () => mutation.status === "succeeded" && mutation.data.removedLineId === input.lineId || !context.host.sales.getObservedSnapshot().cart.lines.some((item) => item.lineId === input.lineId));
|
|
29
|
-
});
|
|
30
|
-
return function execute(_x, _x2, _x3) {
|
|
31
|
-
return _ref.apply(this, arguments);
|
|
32
|
-
};
|
|
33
|
-
}()
|
|
34
|
-
});
|
|
35
|
-
function hasValidSkuValue(input) {
|
|
36
|
-
const canonical = require_canonicalSkuValue.canonicalizeSkuValue(input.skuValue);
|
|
37
|
-
return Boolean(input.productId && canonical && canonical.productId === input.productId);
|
|
38
|
-
}
|
|
39
|
-
function sameSkuValue(expected, actual) {
|
|
40
|
-
const expectedFingerprint = require_canonicalSkuValue.createSkuValueFingerprint(expected);
|
|
41
|
-
return Boolean(expectedFingerprint && expectedFingerprint === require_canonicalSkuValue.createSkuValueFingerprint(actual));
|
|
42
|
-
}
|
|
43
|
-
function sameWeight(actual, expected) {
|
|
44
|
-
const actualValue = new decimal_js.default(actual || NaN);
|
|
45
|
-
const expectedValue = new decimal_js.default(expected || NaN);
|
|
46
|
-
return actualValue.isFinite() && expectedValue.isFinite() && actualValue.equals(expectedValue);
|
|
47
|
-
}
|
|
48
|
-
const productSyncPrimaryWeightedProductOperation = require_types.defineOperation({
|
|
49
|
-
id: "product.syncPrimaryWeightedProduct",
|
|
50
|
-
conflictScope: "cart",
|
|
51
|
-
retry: "explicit-user",
|
|
52
|
-
execute: function() {
|
|
53
|
-
var _ref2 = require_asyncToGenerator._asyncToGenerator(function* (context, input, signal) {
|
|
54
|
-
if (!hasValidSkuValue(input)) return require_errors.operationFailed("customizationInputInvalid", "back");
|
|
55
|
-
const beforeLines = new Map(context.host.sales.getObservedSnapshot().cart.lines.map((line) => [line.lineId, line.quantity]));
|
|
56
|
-
const before = context.host.sales.getObservedSnapshot();
|
|
57
|
-
const previousPrimary = input.existingLineId ? before.cart.lines.find((line) => line.lineId === input.existingLineId) : void 0;
|
|
58
|
-
if (input.existingLineId && (!previousPrimary || previousPrimary.productId !== input.productId)) return require_errors.operationFailed("customizationExistingLineInvalid", "back");
|
|
59
|
-
const mutation = yield context.host.sales.syncPrimaryWeightedProduct(input, signal);
|
|
60
|
-
return require_cartConsistency.finalizeCartMutation(context, mutation, signal, () => {
|
|
61
|
-
const after = context.host.sales.getObservedSnapshot();
|
|
62
|
-
const projectionMatches = after.cart.lines.some((line) => {
|
|
63
|
-
if (mutation.status === "succeeded" && mutation.data.affectedLineId && line.lineId !== mutation.data.affectedLineId) return false;
|
|
64
|
-
if (line.productId !== input.productId) return false;
|
|
65
|
-
const skuMatches = sameSkuValue(input.skuValue, line.skuValue);
|
|
66
|
-
const weightMatches = sameWeight(line.quantity, input.measurement.netWeightKg);
|
|
67
|
-
const previousQuantity = beforeLines.get(line.lineId);
|
|
68
|
-
if (input.existingLineId) return line.lineId === input.existingLineId && skuMatches && weightMatches && mutation.status === "succeeded" && mutation.data.affectedLineId === input.existingLineId && after.observationId > before.observationId;
|
|
69
|
-
return skuMatches && weightMatches && (previousQuantity === void 0 || previousQuantity !== line.quantity);
|
|
70
|
-
});
|
|
71
|
-
const successfulOutcome = mutation.status === "succeeded" ? mutation.data : void 0;
|
|
72
|
-
const confirmedLine = successfulOutcome === null || successfulOutcome === void 0 ? void 0 : successfulOutcome.confirmedLine;
|
|
73
|
-
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;
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
return function execute(_x4, _x5, _x6) {
|
|
77
|
-
return _ref2.apply(this, arguments);
|
|
78
|
-
};
|
|
79
|
-
}()
|
|
80
|
-
});
|
|
81
|
-
//#endregion
|
|
82
|
-
exports.productRemovePrimaryProductOperation = productRemovePrimaryProductOperation;
|
|
83
|
-
exports.productSyncPrimaryWeightedProductOperation = productSyncPrimaryWeightedProductOperation;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
const require_asyncToGenerator = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
|
|
2
|
-
const require_errors = require("../../app/operations/errors.js");
|
|
3
|
-
const require_types = require("../../app/operations/types.js");
|
|
4
|
-
//#region src/components/HDLKiosk/slices/identity/operation.ts
|
|
5
|
-
function partialFailure(code, cause) {
|
|
6
|
-
return {
|
|
7
|
-
status: "partialFailure",
|
|
8
|
-
error: require_errors.createOperationError(code, "staff", cause)
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
function identityMatches(customerId, customer) {
|
|
12
|
-
if (!customerId) return (customer === null || customer === void 0 ? void 0 : customer.member) !== true;
|
|
13
|
-
if ((customer === null || customer === void 0 ? void 0 : customer.member) !== true) return false;
|
|
14
|
-
return customer.customerId === customerId;
|
|
15
|
-
}
|
|
16
|
-
const identitySyncOperation = require_types.defineOperation({
|
|
17
|
-
id: "identity.sync",
|
|
18
|
-
conflictScope: "customer",
|
|
19
|
-
timeoutMs: 15e3,
|
|
20
|
-
retry: "explicit-user",
|
|
21
|
-
execute: function() {
|
|
22
|
-
var _ref = require_asyncToGenerator._asyncToGenerator(function* (context, input, signal) {
|
|
23
|
-
var _input$customerId;
|
|
24
|
-
if (!input || input.customerId !== void 0 && !input.customerId.trim()) return require_errors.operationFailed("identityInputInvalid", "back");
|
|
25
|
-
const customerId = (_input$customerId = input.customerId) === null || _input$customerId === void 0 ? void 0 : _input$customerId.trim();
|
|
26
|
-
const beforeSelection = context.host.sales.getObservedSnapshot();
|
|
27
|
-
const selected = yield context.host.sales.selectIdentity(customerId ? { customerId } : {}, signal);
|
|
28
|
-
if (selected.status !== "succeeded") return selected;
|
|
29
|
-
if (signal.aborted) return require_errors.operationUnknown("identityAbortedAfterWrite");
|
|
30
|
-
const afterSelection = context.host.sales.getObservedSnapshot();
|
|
31
|
-
const hasOrderLines = beforeSelection.cart.lineCount > 0 || afterSelection.cart.lineCount > 0;
|
|
32
|
-
let summaryConfirmed = false;
|
|
33
|
-
if (hasOrderLines) {
|
|
34
|
-
const consistency = yield context.host.sales.waitForCartConsistency(signal);
|
|
35
|
-
if (consistency.status !== "succeeded") {
|
|
36
|
-
if (consistency.status === "unknown") return consistency;
|
|
37
|
-
return partialFailure("identityConsistencyFailed", consistency);
|
|
38
|
-
}
|
|
39
|
-
const summary = yield context.host.sales.recalculateSummary(signal);
|
|
40
|
-
if (summary.status !== "succeeded") {
|
|
41
|
-
if (summary.status === "unknown") return summary;
|
|
42
|
-
return partialFailure("identitySummaryRecalculationFailed", summary);
|
|
43
|
-
}
|
|
44
|
-
summaryConfirmed = Boolean(summary.data.confirmedSummary);
|
|
45
|
-
}
|
|
46
|
-
const observed = context.host.sales.getObservedSnapshot();
|
|
47
|
-
if (hasOrderLines && !summaryConfirmed && observed.summary.status !== "ready") return partialFailure("identitySummaryProjectionMissing");
|
|
48
|
-
if (!(customerId ? identityMatches(customerId, selected.data.customer) : selected.data.customer === void 0) && !identityMatches(customerId, observed.customer)) return require_errors.operationUnknown("identitySelectionNotObserved");
|
|
49
|
-
return {
|
|
50
|
-
status: "succeeded",
|
|
51
|
-
data: void 0
|
|
52
|
-
};
|
|
53
|
-
});
|
|
54
|
-
return function execute(_x, _x2, _x3) {
|
|
55
|
-
return _ref.apply(this, arguments);
|
|
56
|
-
};
|
|
57
|
-
}()
|
|
58
|
-
});
|
|
59
|
-
//#endregion
|
|
60
|
-
exports.identitySyncOperation = identitySyncOperation;
|
|
File without changes
|
|
File without changes
|