@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
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
require("../../../../_virtual/_rolldown/runtime.js");
|
|
2
|
+
const require_workflowEvent = require("../workflowEvent.js");
|
|
3
|
+
let react = require("react");
|
|
4
|
+
//#region src/components/HDLKiosk/ui/controllers/useHDLKioskActionDispatcher.ts
|
|
5
|
+
/**
|
|
6
|
+
* 文件角色:把 Slice UI Action 适配为当前 Workflow Session 的 Event 或 Command。
|
|
7
|
+
* 运行机制:统一生成 intent ID,并只投影当前节点发起的 Screen Command 状态。
|
|
8
|
+
* 边界:不决定业务跳转、不解释 Operation 结果,也不拥有 Session 生命周期。
|
|
9
|
+
*/
|
|
10
|
+
function useHDLKioskActionDispatcher({ session, snapshot, activityId, resetSession }) {
|
|
11
|
+
const intentSequence = (0, react.useRef)(0);
|
|
12
|
+
const commandSequence = (0, react.useRef)(0);
|
|
13
|
+
const commandGeneration = (0, react.useRef)(0);
|
|
14
|
+
const pendingCommands = (0, react.useRef)(/* @__PURE__ */ new Map());
|
|
15
|
+
const [commandState, setCommandState] = (0, react.useState)({ busy: false });
|
|
16
|
+
(0, react.useEffect)(() => {
|
|
17
|
+
commandGeneration.current += 1;
|
|
18
|
+
pendingCommands.current.clear();
|
|
19
|
+
setCommandState({ busy: false });
|
|
20
|
+
return () => {
|
|
21
|
+
commandGeneration.current += 1;
|
|
22
|
+
pendingCommands.current.clear();
|
|
23
|
+
};
|
|
24
|
+
}, [session, snapshot.nodeId]);
|
|
25
|
+
return {
|
|
26
|
+
send: (0, react.useCallback)((action) => {
|
|
27
|
+
if (action.kind === "session") {
|
|
28
|
+
resetSession();
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
intentSequence.current += 1;
|
|
32
|
+
const intentId = `ui:${snapshot.sessionEpoch}:${intentSequence.current}`;
|
|
33
|
+
if (action.kind === "intent" || action.kind === "navigation") {
|
|
34
|
+
const event = require_workflowEvent.createWorkflowEvent(action, activityId, snapshot.nodeId, intentId);
|
|
35
|
+
if (event) session.dispatch(event);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
commandSequence.current += 1;
|
|
39
|
+
const execution = commandSequence.current;
|
|
40
|
+
const generation = commandGeneration.current;
|
|
41
|
+
pendingCommands.current.set(execution, action.command);
|
|
42
|
+
setCommandState({
|
|
43
|
+
busy: true,
|
|
44
|
+
commandId: action.command
|
|
45
|
+
});
|
|
46
|
+
session.executeCommand(action.command, action.input, intentId).then((result) => {
|
|
47
|
+
if (generation !== commandGeneration.current) return;
|
|
48
|
+
pendingCommands.current.delete(execution);
|
|
49
|
+
const remaining = [...pendingCommands.current.values()];
|
|
50
|
+
setCommandState({
|
|
51
|
+
busy: remaining.length > 0,
|
|
52
|
+
commandId: remaining[remaining.length - 1],
|
|
53
|
+
error: result.status === "failed" || result.status === "partialFailure" || result.status === "unknown" ? result.error : void 0
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
}, [
|
|
57
|
+
activityId,
|
|
58
|
+
resetSession,
|
|
59
|
+
session,
|
|
60
|
+
snapshot.nodeId,
|
|
61
|
+
snapshot.sessionEpoch
|
|
62
|
+
]),
|
|
63
|
+
commandState
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
exports.useHDLKioskActionDispatcher = useHDLKioskActionDispatcher;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require("../../../../_virtual/_rolldown/runtime.js");
|
|
2
2
|
const require_asyncToGenerator = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
|
|
3
3
|
let react = require("react");
|
|
4
|
-
//#region src/components/HDLKiosk/
|
|
4
|
+
//#region src/components/HDLKiosk/ui/controllers/useHDLKioskCustomerController.ts
|
|
5
5
|
/**
|
|
6
6
|
* 文件角色:协调 Shell 全程可用的会员入口与插入式身份同步。
|
|
7
7
|
* 运行机制:登录成功后通过 identity.sync 写入客户并触发订单一致性/重报价;再根据最新
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require("../../../../_virtual/_rolldown/runtime.js");
|
|
2
|
+
let react = require("react");
|
|
3
|
+
//#region src/components/HDLKiosk/ui/controllers/useHDLKioskDeviceController.ts
|
|
4
|
+
/**
|
|
5
|
+
* 文件角色:把 Scale 连接状态投影给 React Entry。
|
|
6
|
+
* 运行机制:只观察 connectionChanged;称重启动完全由 Runtime 的 onWeight Adapter 持有。
|
|
7
|
+
* 边界:不消费重量、不创建 Session,也不参与 Trigger 路由。
|
|
8
|
+
*/
|
|
9
|
+
function useHDLKioskDeviceController({ host, isActive }) {
|
|
10
|
+
const [scaleConnectionState, setScaleConnectionState] = (0, react.useState)();
|
|
11
|
+
(0, react.useEffect)(() => {
|
|
12
|
+
setScaleConnectionState(void 0);
|
|
13
|
+
}, [host]);
|
|
14
|
+
(0, react.useEffect)(() => {
|
|
15
|
+
if (!isActive || !host.capabilities.scale.available) return void 0;
|
|
16
|
+
return host.devices.subscribe((event) => {
|
|
17
|
+
if (event.type === "connectionChanged" && event.device === "scale") {
|
|
18
|
+
var _event$state;
|
|
19
|
+
setScaleConnectionState((_event$state = event.state) !== null && _event$state !== void 0 ? _event$state : event.connected ? "connected" : "disconnected");
|
|
20
|
+
}
|
|
21
|
+
}, { sources: ["scale"] });
|
|
22
|
+
}, [host, isActive]);
|
|
23
|
+
return { scaleConnectionState };
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
exports.useHDLKioskDeviceController = useHDLKioskDeviceController;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
require("../../../../_virtual/_rolldown/runtime.js");
|
|
2
|
+
let react = require("react");
|
|
3
|
+
//#region src/components/HDLKiosk/ui/controllers/useHDLKioskExitController.ts
|
|
4
|
+
/**
|
|
5
|
+
* 文件角色:适配 Session Exit Navigation 与验证式订单重置。
|
|
6
|
+
* 运行机制:用户退出先经过 Actor Guard/确认;自动退出直接解析既有 Pending Navigation,
|
|
7
|
+
* 两者最终都调用 Runtime 提供的 returnToEntry。
|
|
8
|
+
* 边界:不拥有 reset pending/error,也不渲染确认弹层。
|
|
9
|
+
*/
|
|
10
|
+
function useHDLKioskExitController({ session, snapshot, returnToEntry }) {
|
|
11
|
+
var _snapshot$pendingNavi, _snapshot$pendingNavi2;
|
|
12
|
+
const sequence = (0, react.useRef)(0);
|
|
13
|
+
const pendingConfirmation = ((_snapshot$pendingNavi = snapshot.pendingNavigation) === null || _snapshot$pendingNavi === void 0 ? void 0 : _snapshot$pendingNavi.request.kind) === "confirmEndOrder" ? snapshot.pendingNavigation : void 0;
|
|
14
|
+
const pendingAutomaticExit = ((_snapshot$pendingNavi2 = snapshot.pendingNavigation) === null || _snapshot$pendingNavi2 === void 0 ? void 0 : _snapshot$pendingNavi2.request.kind) === "performSessionExit" ? snapshot.pendingNavigation : void 0;
|
|
15
|
+
const resetSession = (0, react.useCallback)(() => {
|
|
16
|
+
returnToEntry("ui");
|
|
17
|
+
}, [returnToEntry]);
|
|
18
|
+
const requestEndOrder = (0, react.useCallback)(() => {
|
|
19
|
+
sequence.current += 1;
|
|
20
|
+
session.actor.navigate({
|
|
21
|
+
kind: "sessionExit",
|
|
22
|
+
reason: "userRequest"
|
|
23
|
+
}, `ui:${snapshot.sessionEpoch}:exit:${sequence.current}`);
|
|
24
|
+
}, [session.actor, snapshot.sessionEpoch]);
|
|
25
|
+
const cancelEndOrder = (0, react.useCallback)(() => {
|
|
26
|
+
if (!pendingConfirmation) return;
|
|
27
|
+
session.actor.resolvePendingNavigation(pendingConfirmation.navigationId, "cancel");
|
|
28
|
+
}, [pendingConfirmation, session.actor]);
|
|
29
|
+
const confirmEndOrder = (0, react.useCallback)(() => {
|
|
30
|
+
if (!pendingConfirmation || !session.actor.resolvePendingNavigation(pendingConfirmation.navigationId, "allow")) return;
|
|
31
|
+
resetSession();
|
|
32
|
+
}, [
|
|
33
|
+
pendingConfirmation,
|
|
34
|
+
resetSession,
|
|
35
|
+
session.actor
|
|
36
|
+
]);
|
|
37
|
+
(0, react.useEffect)(() => {
|
|
38
|
+
if (!pendingAutomaticExit || !session.actor.resolvePendingNavigation(pendingAutomaticExit.navigationId, "allow")) return;
|
|
39
|
+
resetSession();
|
|
40
|
+
}, [
|
|
41
|
+
pendingAutomaticExit,
|
|
42
|
+
resetSession,
|
|
43
|
+
session.actor
|
|
44
|
+
]);
|
|
45
|
+
return {
|
|
46
|
+
endOrderConfirmationOpen: Boolean(pendingConfirmation),
|
|
47
|
+
resetSession,
|
|
48
|
+
requestEndOrder,
|
|
49
|
+
cancelEndOrder,
|
|
50
|
+
confirmEndOrder
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
exports.useHDLKioskExitController = useHDLKioskExitController;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require("../../../../_virtual/_rolldown/runtime.js");
|
|
2
2
|
let react = require("react");
|
|
3
|
-
//#region src/components/HDLKiosk/
|
|
3
|
+
//#region src/components/HDLKiosk/ui/controllers/useHDLKioskScreenData.ts
|
|
4
4
|
/**
|
|
5
5
|
* 文件角色:按当前 Screen 集中加载页面所需的 Catalog/称重/定制商品数据。
|
|
6
6
|
* 运行机制:观察当前节点,调用 Host read/query 能力并输出 loading/ready/error 数据,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
require("../../../../_virtual/_rolldown/runtime.js");
|
|
2
|
+
const require_createRuntime = require("../../runtime/createRuntime.js");
|
|
3
|
+
let react = require("react");
|
|
4
|
+
//#region src/components/HDLKiosk/ui/controllers/useHDLKioskSessionController.ts
|
|
5
|
+
/**
|
|
6
|
+
* 文件角色:把 React Entry 状态适配到无头 Application Runtime。
|
|
7
|
+
* 运行机制:Controller 只处理能力/可见性和 UI pending;Trigger 路由、Session 创建、
|
|
8
|
+
* ensure、单会话准入与销毁均由 Runtime 持有。
|
|
9
|
+
* 边界:不直接创建 Actor,也不消费具体 Screen 的局部交互。
|
|
10
|
+
*/
|
|
11
|
+
function useHDLKioskSessionController({ host, config, isActive }) {
|
|
12
|
+
const applicationRuntime = (0, react.useMemo)(() => require_createRuntime.createHDLKioskApplicationRuntime(host, { config }), [config, host]);
|
|
13
|
+
const snapshot = (0, react.useSyncExternalStore)(applicationRuntime.subscribe, applicationRuntime.getSnapshot, applicationRuntime.getSnapshot);
|
|
14
|
+
(0, react.useEffect)(() => {
|
|
15
|
+
return () => applicationRuntime.dispose();
|
|
16
|
+
}, [applicationRuntime]);
|
|
17
|
+
(0, react.useEffect)(() => {
|
|
18
|
+
if (!isActive) {
|
|
19
|
+
applicationRuntime.deactivate();
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
applicationRuntime.activate();
|
|
23
|
+
return () => applicationRuntime.deactivate();
|
|
24
|
+
}, [applicationRuntime, isActive]);
|
|
25
|
+
const start = (0, react.useCallback)(({ entry }) => applicationRuntime.start(entry), [applicationRuntime]);
|
|
26
|
+
const completeReset = (0, react.useCallback)((completedSession) => applicationRuntime.completeReset(completedSession), [applicationRuntime]);
|
|
27
|
+
const returnToEntry = (0, react.useCallback)((reason = "application") => applicationRuntime.returnToEntry(reason), [applicationRuntime]);
|
|
28
|
+
return {
|
|
29
|
+
session: snapshot.session,
|
|
30
|
+
starting: snapshot.starting,
|
|
31
|
+
startErrorReference: snapshot.startErrorReference,
|
|
32
|
+
returning: snapshot.returning,
|
|
33
|
+
returnError: snapshot.returnError,
|
|
34
|
+
start,
|
|
35
|
+
completeReset,
|
|
36
|
+
returnToEntry
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
exports.useHDLKioskSessionController = useHDLKioskSessionController;
|
|
@@ -2,7 +2,7 @@ const require_runtime = require("../../../../../_virtual/_rolldown/runtime.js");
|
|
|
2
2
|
let react = require("react");
|
|
3
3
|
react = require_runtime.__toESM(react);
|
|
4
4
|
let _pisell_utils = require("@pisell/utils");
|
|
5
|
-
//#region src/components/HDLKiosk/
|
|
5
|
+
//#region src/components/HDLKiosk/ui/entry/Screen/index.tsx
|
|
6
6
|
const LANGUAGE_OPTIONS = Object.freeze([
|
|
7
7
|
{
|
|
8
8
|
value: "en",
|
|
@@ -25,10 +25,12 @@ const LANGUAGE_OPTIONS = Object.freeze([
|
|
|
25
25
|
label: "Português"
|
|
26
26
|
}
|
|
27
27
|
]);
|
|
28
|
-
function BrandMark() {
|
|
29
|
-
return /* @__PURE__ */ react.default.createElement("
|
|
28
|
+
function BrandMark({ onClick }) {
|
|
29
|
+
return /* @__PURE__ */ react.default.createElement("button", {
|
|
30
30
|
className: "hdl-entry-brand-mark",
|
|
31
|
-
|
|
31
|
+
type: "button",
|
|
32
|
+
"aria-label": "打开称重模拟器",
|
|
33
|
+
onClick
|
|
32
34
|
}, "Hi");
|
|
33
35
|
}
|
|
34
36
|
function GlobeIcon() {
|
|
@@ -178,7 +180,7 @@ function EntryGraphic({ entry }) {
|
|
|
178
180
|
if (entry === "barcode") return /* @__PURE__ */ react.default.createElement(BarcodeGraphic, null);
|
|
179
181
|
return /* @__PURE__ */ react.default.createElement(ScaleGraphic, null);
|
|
180
182
|
}
|
|
181
|
-
function EntryScreen({ locale, model, onLocaleChange, onTechnicalSupportClick, onSelect, busy = false, errorReference, errorMessage = "Unable to start a safe order session." }) {
|
|
183
|
+
function EntryScreen({ locale, model, onLocaleChange, onTechnicalSupportClick, onScaleSimulatorRequest, onSelect, busy = false, errorReference, errorMessage = "Unable to start a safe order session." }) {
|
|
182
184
|
const [reachMode, setReachMode] = (0, react.useState)(false);
|
|
183
185
|
const entryLocale = locale || "en";
|
|
184
186
|
return /* @__PURE__ */ react.default.createElement("section", {
|
|
@@ -204,7 +206,7 @@ function EntryScreen({ locale, model, onLocaleChange, onTechnicalSupportClick, o
|
|
|
204
206
|
}, /* @__PURE__ */ react.default.createElement("path", { d: "M112 248c-52-38-43-88-5-118 33-26 40-71 3-116" })), /* @__PURE__ */ react.default.createElement("svg", {
|
|
205
207
|
className: "hdl-entry-steam hdl-entry-steam--two",
|
|
206
208
|
viewBox: "0 0 180 260"
|
|
207
|
-
}, /* @__PURE__ */ react.default.createElement("path", { d: "M71 250c38-41 22-78-6-111-31-37-19-78 16-125" })), /* @__PURE__ */ react.default.createElement("span", null), /* @__PURE__ */ react.default.createElement("span", null), /* @__PURE__ */ react.default.createElement("span", null), /* @__PURE__ */ react.default.createElement("span", null), /* @__PURE__ */ react.default.createElement("span", null), /* @__PURE__ */ react.default.createElement("span", null)), /* @__PURE__ */ react.default.createElement("header", { className: "hdl-entry-screen__header" }, /* @__PURE__ */ react.default.createElement("div", { className: "hdl-entry-brand" }, /* @__PURE__ */ react.default.createElement(BrandMark,
|
|
209
|
+
}, /* @__PURE__ */ react.default.createElement("path", { d: "M71 250c38-41 22-78-6-111-31-37-19-78 16-125" })), /* @__PURE__ */ react.default.createElement("span", null), /* @__PURE__ */ react.default.createElement("span", null), /* @__PURE__ */ react.default.createElement("span", null), /* @__PURE__ */ react.default.createElement("span", null), /* @__PURE__ */ react.default.createElement("span", null), /* @__PURE__ */ react.default.createElement("span", null)), /* @__PURE__ */ react.default.createElement("header", { className: "hdl-entry-screen__header" }, /* @__PURE__ */ react.default.createElement("div", { className: "hdl-entry-brand" }, /* @__PURE__ */ react.default.createElement(BrandMark, { onClick: onScaleSimulatorRequest }), /* @__PURE__ */ react.default.createElement("span", { className: "hdl-entry-brand__copy" }, /* @__PURE__ */ react.default.createElement("strong", null, _pisell_utils.locales.getText("pisell2.hdl-kiosk.brand")), /* @__PURE__ */ react.default.createElement("small", null, "MALA · TANG"))), /* @__PURE__ */ react.default.createElement("label", { className: "hdl-entry-language" }, /* @__PURE__ */ react.default.createElement(GlobeIcon, null), /* @__PURE__ */ react.default.createElement("select", {
|
|
208
210
|
"aria-label": _pisell_utils.locales.getText("pisell2.hdl-kiosk.entry-language-label"),
|
|
209
211
|
value: entryLocale,
|
|
210
212
|
onChange: (event) => onLocaleChange === null || onLocaleChange === void 0 ? void 0 : onLocaleChange(event.target.value)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require("../../../../_virtual/_rolldown/runtime.js");
|
|
2
|
-
const require_registry = require("
|
|
2
|
+
const require_registry = require("../../app/workflow/registry.js");
|
|
3
3
|
let _pisell_utils = require("@pisell/utils");
|
|
4
|
-
//#region src/components/HDLKiosk/
|
|
4
|
+
//#region src/components/HDLKiosk/ui/entry/model.ts
|
|
5
5
|
function createEntryScreenModel(config, capabilities, scaleConnectionState, hostStatus, entryDataPreparing = false) {
|
|
6
6
|
const dataPreparing = entryDataPreparing || hostStatus === "loading";
|
|
7
7
|
const hostUnavailable = hostStatus === "error";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
|
|
2
|
+
const require_scaleStore = require("../runtime/devices/scaleStore.js");
|
|
3
|
+
let react = require("react");
|
|
4
|
+
react = require_runtime.__toESM(react);
|
|
5
|
+
//#region src/components/HDLKiosk/ui/scale.tsx
|
|
6
|
+
const HDLScaleRuntimeContext = (0, react.createContext)(require_scaleStore.createHDLScaleRuntime());
|
|
7
|
+
function HDLScaleRuntimeProvider({ runtime, children }) {
|
|
8
|
+
return react.default.createElement(HDLScaleRuntimeContext.Provider, {
|
|
9
|
+
value: runtime,
|
|
10
|
+
children
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function useHDLScaleSnapshot() {
|
|
14
|
+
const runtime = (0, react.useContext)(HDLScaleRuntimeContext);
|
|
15
|
+
return (0, react.useSyncExternalStore)(runtime.subscribe, runtime.getSnapshot, runtime.getSnapshot);
|
|
16
|
+
}
|
|
17
|
+
/** 仅供提交边界同步读取点击当下的最新设备快照。 */
|
|
18
|
+
function useHDLScaleRuntime() {
|
|
19
|
+
return (0, react.useContext)(HDLScaleRuntimeContext);
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.HDLScaleRuntimeProvider = HDLScaleRuntimeProvider;
|
|
23
|
+
exports.useHDLScaleRuntime = useHDLScaleRuntime;
|
|
24
|
+
exports.useHDLScaleSnapshot = useHDLScaleSnapshot;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
require("../../../_virtual/_rolldown/runtime.js");
|
|
2
2
|
let react = require("react");
|
|
3
|
-
//#region src/components/HDLKiosk/
|
|
4
|
-
/**
|
|
5
|
-
* 文件角色:将 Host Sales Projection 安全接入 React。
|
|
6
|
-
* 运行机制:通过 useSyncExternalStore 订阅统一快照,确保同一次 render 读取一致事实并
|
|
7
|
-
* 兼容 Host 对象身份稳定、内部来源变化的情况。
|
|
8
|
-
* 边界:只读,不触发 load/recalc,也不复制一份 React 订单状态。
|
|
9
|
-
*/
|
|
3
|
+
//#region src/components/HDLKiosk/ui/snapshots.ts
|
|
4
|
+
/** 将纯 Host 与 Workflow 快照安全接入 React,不发送命令或派生业务事实。 */
|
|
10
5
|
function useHostSnapshot(host) {
|
|
11
6
|
const cacheRef = (0, react.useRef)();
|
|
12
7
|
const getSnapshot = (0, react.useCallback)(() => {
|
|
@@ -21,5 +16,9 @@ function useHostSnapshot(host) {
|
|
|
21
16
|
}, [host]);
|
|
22
17
|
return (0, react.useSyncExternalStore)(host.sales.subscribe, getSnapshot, getSnapshot);
|
|
23
18
|
}
|
|
19
|
+
function useWorkflowSnapshot(actor) {
|
|
20
|
+
return (0, react.useSyncExternalStore)(actor.subscribe, actor.getSnapshot, actor.getSnapshot);
|
|
21
|
+
}
|
|
24
22
|
//#endregion
|
|
25
23
|
exports.useHostSnapshot = useHostSnapshot;
|
|
24
|
+
exports.useWorkflowSnapshot = useWorkflowSnapshot;
|
|
@@ -4,7 +4,7 @@ const require_view$2 = require("../slices/fulfillment/view.js");
|
|
|
4
4
|
const require_view$3 = require("../slices/identity/view.js");
|
|
5
5
|
const require_view$4 = require("../slices/payment/view.js");
|
|
6
6
|
const require_view$5 = require("../slices/primaryProductPrompt/view.js");
|
|
7
|
-
//#region src/components/HDLKiosk/
|
|
7
|
+
//#region src/components/HDLKiosk/ui/views.ts
|
|
8
8
|
const hdlKioskViews = Object.freeze({
|
|
9
9
|
identity: require_view$3.renderIdentity,
|
|
10
10
|
fulfillment: require_view$2.renderFulfillment,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_objectSpread2 = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
|
|
2
2
|
const require_objectWithoutProperties = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js");
|
|
3
|
-
//#region src/components/HDLKiosk/
|
|
3
|
+
//#region src/components/HDLKiosk/ui/workflowEvent.ts
|
|
4
4
|
const _excluded = ["kind"];
|
|
5
5
|
function createWorkflowEvent(action, currentActivity, stepId, intentId) {
|
|
6
6
|
if (action.activityId !== currentActivity) return void 0;
|
|
@@ -57,10 +57,10 @@ function createCartDrawerModel(sales, primaryWeightedProductId) {
|
|
|
57
57
|
totalLabel: totalText ? _pisell_utils.locales.getText("pisell2.hdl-kiosk.total") : _pisell_utils.locales.getText("pisell2.hdl-kiosk.total-calculating")
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
function createActivityScreenModel(
|
|
60
|
+
function createActivityScreenModel(surfaceId, snapshot, node, sales, businessMode = "prototype") {
|
|
61
61
|
let title;
|
|
62
62
|
let description;
|
|
63
|
-
switch (
|
|
63
|
+
switch (surfaceId) {
|
|
64
64
|
case "entry":
|
|
65
65
|
title = _pisell_utils.locales.getText("pisell2.hdl-kiosk.entry-title");
|
|
66
66
|
description = _pisell_utils.locales.getText("pisell2.hdl-kiosk.entry-supporting");
|
|
@@ -86,12 +86,12 @@ function createActivityScreenModel(screenId, snapshot, node, sales, businessMode
|
|
|
86
86
|
description = _pisell_utils.locales.getText("pisell2.hdl-kiosk.checkout-title");
|
|
87
87
|
break;
|
|
88
88
|
}
|
|
89
|
-
const canReviewCatalog =
|
|
89
|
+
const canReviewCatalog = surfaceId !== "catalog" || sales.cart.lineCount > 0;
|
|
90
90
|
const placeholder = node.readiness === "placeholder";
|
|
91
91
|
const placeholderBlocked = placeholder && businessMode === "production";
|
|
92
92
|
const error = resolveHDLKioskErrorPresentation({ error: snapshot.lastError });
|
|
93
93
|
return Object.freeze({
|
|
94
|
-
|
|
94
|
+
surfaceId,
|
|
95
95
|
activity: node.activity,
|
|
96
96
|
title,
|
|
97
97
|
description,
|
|
@@ -107,7 +107,7 @@ function HDLKioskPaymentRuntime({ context, controllerRef }) {
|
|
|
107
107
|
const amount = currentAmount(context);
|
|
108
108
|
if (amount <= 0) return require_normalize.failed("paymentAmountInvalid", "back");
|
|
109
109
|
const runtime = runtimeRef.current;
|
|
110
|
-
if (!runtime) return require_normalize.
|
|
110
|
+
if (!runtime) return require_normalize.failed("paymentRuntimeUnavailable", "retry");
|
|
111
111
|
const piProvider = require_constants.resolvePiPaymentProvider(method.code, Boolean((_engineContext$appHel2 = engineContext.appHelper) === null || _engineContext$appHel2 === void 0 || (_engineContext$appHel2 = _engineContext$appHel2.utils) === null || _engineContext$appHel2 === void 0 || (_engineContext$appHel2 = _engineContext$appHel2.businessUtils) === null || _engineContext$appHel2 === void 0 || (_engineContext$appHel3 = _engineContext$appHel2.isPiPaymentEnabled) === null || _engineContext$appHel3 === void 0 ? void 0 : _engineContext$appHel3.call(_engineContext$appHel2)));
|
|
112
112
|
let prepared;
|
|
113
113
|
let shouldDiscardPrepared = false;
|
|
@@ -184,6 +184,7 @@ function HDLKioskPaymentRuntime({ context, controllerRef }) {
|
|
|
184
184
|
} catch (discardError) {
|
|
185
185
|
return require_normalize.unknown("eftposPendingRollbackFailed", discardError);
|
|
186
186
|
}
|
|
187
|
+
if (prepared && !shouldDiscardPrepared) return require_normalize.unknown("eftposPaymentFinalizationUnresolved", error);
|
|
187
188
|
return require_normalize.failed("eftposPaymentFailed", "retry", error);
|
|
188
189
|
}
|
|
189
190
|
});
|
|
@@ -6,7 +6,7 @@ function resolveBigSaleHDLKioskCapabilities(context, options = {}) {
|
|
|
6
6
|
const canUpdateCustomizedProduct = typeof context.cart.updateItem === "function" && typeof (bookingTicket === null || bookingTicket === void 0 ? void 0 : bookingTicket.transformDetailToProductAndBooking) === "function";
|
|
7
7
|
return {
|
|
8
8
|
session: {
|
|
9
|
-
ensure: typeof context.sales.createNew === "function",
|
|
9
|
+
ensure: typeof context.sales.createNew === "function" && typeof context.sales.clearCartAndReset === "function",
|
|
10
10
|
reset: typeof context.sales.clearCartAndReset === "function"
|
|
11
11
|
},
|
|
12
12
|
cart: {
|
|
@@ -10,6 +10,15 @@ decimal_js = require_runtime.__toESM(decimal_js);
|
|
|
10
10
|
* 仅在语义变化时推进 observationId。
|
|
11
11
|
* 边界:Projection 只读且不是第二个 Store;不得在这里执行 load、写入或前端定价。
|
|
12
12
|
*/
|
|
13
|
+
/**
|
|
14
|
+
* 交易门禁必须优先读取 OS 同步真源。SalesSDK reset 已完成但 React RootSnapshot
|
|
15
|
+
* 尚未提交时,context.tempOrder 可能仍是上一笔 paid 订单。
|
|
16
|
+
*/
|
|
17
|
+
function resolveBigSaleLiveTempOrder(context) {
|
|
18
|
+
const bookingTicket = context.sales.bookingTicket;
|
|
19
|
+
if (typeof (bookingTicket === null || bookingTicket === void 0 ? void 0 : bookingTicket.getTempOrder) === "function") return bookingTicket.getTempOrder();
|
|
20
|
+
return context.sales.tempOrder;
|
|
21
|
+
}
|
|
13
22
|
function getProduct(line) {
|
|
14
23
|
return "product_id" in line ? line : line._extend.product;
|
|
15
24
|
}
|
|
@@ -95,9 +104,10 @@ function projectBigSaleCartLine(line) {
|
|
|
95
104
|
});
|
|
96
105
|
}
|
|
97
106
|
function normalizePayment(context, cartLineCount) {
|
|
98
|
-
var
|
|
99
|
-
const
|
|
100
|
-
const
|
|
107
|
+
var _tempOrder$payment_st, _context$summary$summ;
|
|
108
|
+
const tempOrder = resolveBigSaleLiveTempOrder(context);
|
|
109
|
+
const paymentStatus = String((_tempOrder$payment_st = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.payment_status) !== null && _tempOrder$payment_st !== void 0 ? _tempOrder$payment_st : "").toLowerCase();
|
|
110
|
+
const orderId = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id;
|
|
101
111
|
const amount = (_context$summary$summ = context.summary.summary) === null || _context$summary$summ === void 0 ? void 0 : _context$summary$summ.total_amount;
|
|
102
112
|
if (paymentStatus === "paid" && orderId != null && amount != null) return Object.freeze({
|
|
103
113
|
status: "succeeded",
|
|
@@ -120,19 +130,19 @@ function resolveHDLKioskPickupReferenceMode(openData) {
|
|
|
120
130
|
return (openData === null || openData === void 0 ? void 0 : openData["fulfillment.fulfillment_ref_mode"]) === "sale_number" ? "sale_number" : "short_number";
|
|
121
131
|
}
|
|
122
132
|
function resolvePickupNumber(context, mode) {
|
|
123
|
-
var _context$sales$
|
|
133
|
+
var _context$sales$tempOr;
|
|
124
134
|
const field = mode === "sale_number" ? "shop_order_number" : "shop_full_order_number";
|
|
125
|
-
return ((_context$sales$
|
|
135
|
+
return ((_context$sales$tempOr = context.sales.tempOrder) === null || _context$sales$tempOr === void 0 ? void 0 : _context$sales$tempOr[field]) || void 0;
|
|
126
136
|
}
|
|
127
137
|
function buildSnapshot(context, observationId, pickupReferenceMode) {
|
|
128
|
-
var _context$cart$display, _context$sales$
|
|
138
|
+
var _context$cart$display, _context$sales$tempOr2, _context$sales$tempOr3, _context$sales$tempOr4, _context$sales$tempOr5, _context$customer$sel, _context$customer$sel2, _context$sales$tempOr6, _context$sales$tempOr7, _customer$customerId, _context$sales$tempOr8;
|
|
129
139
|
const rawLines = (_context$cart$display = context.cart.displayLines) !== null && _context$cart$display !== void 0 ? _context$cart$display : context.cart.items;
|
|
130
140
|
const lines = Object.freeze(rawLines.map(projectBigSaleCartLine).filter((line) => line !== null));
|
|
131
141
|
const summary = context.summary.summary;
|
|
132
142
|
const normalizedSummary = summary ? Object.freeze({
|
|
133
143
|
status: "ready",
|
|
134
|
-
currency: String((_context$sales$
|
|
135
|
-
currencySymbol: String((_context$sales$
|
|
144
|
+
currency: String((_context$sales$tempOr2 = (_context$sales$tempOr3 = context.sales.tempOrder) === null || _context$sales$tempOr3 === void 0 ? void 0 : _context$sales$tempOr3.currency_code) !== null && _context$sales$tempOr2 !== void 0 ? _context$sales$tempOr2 : ""),
|
|
145
|
+
currencySymbol: String((_context$sales$tempOr4 = (_context$sales$tempOr5 = context.sales.tempOrder) === null || _context$sales$tempOr5 === void 0 ? void 0 : _context$sales$tempOr5.currency_symbol) !== null && _context$sales$tempOr4 !== void 0 ? _context$sales$tempOr4 : ""),
|
|
136
146
|
total: String(summary.total_amount),
|
|
137
147
|
due: String(summary.expect_amount)
|
|
138
148
|
}) : context.sales.status === "loading" ? Object.freeze({ status: "calculating" }) : Object.freeze({ status: "missing" });
|
|
@@ -146,7 +156,7 @@ function buildSnapshot(context, observationId, pickupReferenceMode) {
|
|
|
146
156
|
""
|
|
147
157
|
].includes(String((_context$customer$sel2 = context.customer.selected.id) !== null && _context$customer$sel2 !== void 0 ? _context$customer$sel2 : "")) })) : void 0;
|
|
148
158
|
const fingerprintValue = [
|
|
149
|
-
(_context$sales$
|
|
159
|
+
(_context$sales$tempOr6 = (_context$sales$tempOr7 = context.sales.tempOrder) === null || _context$sales$tempOr7 === void 0 ? void 0 : _context$sales$tempOr7.order_id) !== null && _context$sales$tempOr6 !== void 0 ? _context$sales$tempOr6 : "",
|
|
150
160
|
...lines.map((line) => `${line.lineId}:${line.quantity}`),
|
|
151
161
|
normalizedSummary.status === "ready" ? normalizedSummary.due : "",
|
|
152
162
|
(_customer$customerId = customer === null || customer === void 0 ? void 0 : customer.customerId) !== null && _customer$customerId !== void 0 ? _customer$customerId : ""
|
|
@@ -154,7 +164,7 @@ function buildSnapshot(context, observationId, pickupReferenceMode) {
|
|
|
154
164
|
return Object.freeze({
|
|
155
165
|
observationId,
|
|
156
166
|
hostStatus: context.sales.status,
|
|
157
|
-
orderId: ((_context$sales$
|
|
167
|
+
orderId: ((_context$sales$tempOr8 = context.sales.tempOrder) === null || _context$sales$tempOr8 === void 0 ? void 0 : _context$sales$tempOr8.order_id) == null ? void 0 : String(context.sales.tempOrder.order_id),
|
|
158
168
|
pickupNumber: resolvePickupNumber(context, pickupReferenceMode),
|
|
159
169
|
cart: Object.freeze({
|
|
160
170
|
lines,
|
|
@@ -188,4 +198,5 @@ function createBigSaleProjectionReader(getContext, getPickupReferenceMode = () =
|
|
|
188
198
|
exports.createBigSaleProjectionReader = createBigSaleProjectionReader;
|
|
189
199
|
exports.projectBigSaleCartLine = projectBigSaleCartLine;
|
|
190
200
|
exports.resolveBigSaleLineId = resolveBigSaleLineId;
|
|
201
|
+
exports.resolveBigSaleLiveTempOrder = resolveBigSaleLiveTempOrder;
|
|
191
202
|
exports.resolveHDLKioskPickupReferenceMode = resolveHDLKioskPickupReferenceMode;
|
|
@@ -24,6 +24,18 @@ function cancelled(reason) {
|
|
|
24
24
|
reason
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
+
const PAYMENT_WRITE_FROZEN_STATUSES = new Set(["payment_pending", "processing"]);
|
|
28
|
+
function readPaymentStatus(order) {
|
|
29
|
+
var _order$payment_status;
|
|
30
|
+
return String((_order$payment_status = order === null || order === void 0 ? void 0 : order.payment_status) !== null && _order$payment_status !== void 0 ? _order$payment_status : "").trim().toLowerCase();
|
|
31
|
+
}
|
|
32
|
+
function hasCommittedOrderIdentity(order) {
|
|
33
|
+
const orderId = order === null || order === void 0 ? void 0 : order.order_id;
|
|
34
|
+
return orderId !== null && orderId !== void 0 && String(orderId).trim() !== "";
|
|
35
|
+
}
|
|
36
|
+
function isCommittedPaidOrder(order) {
|
|
37
|
+
return readPaymentStatus(order) === "paid" && hasCommittedOrderIdentity(order);
|
|
38
|
+
}
|
|
27
39
|
function findCartLine(context, lineId) {
|
|
28
40
|
var _context$cart$display;
|
|
29
41
|
return ((_context$cart$display = context.cart.displayLines) !== null && _context$cart$display !== void 0 ? _context$cart$display : context.cart.items).find((line) => require_projection.resolveBigSaleLineId(line) === lineId);
|
|
@@ -274,13 +286,19 @@ function createBigSaleSalesPort({ getContext, getSnapshot, executeScan, writeFul
|
|
|
274
286
|
var _ref7 = require_asyncToGenerator._asyncToGenerator(function* (signal) {
|
|
275
287
|
if (signal.aborted) return { status: "cancelled" };
|
|
276
288
|
const context = getContext();
|
|
277
|
-
|
|
289
|
+
const currentOrder = require_projection.resolveBigSaleLiveTempOrder(context);
|
|
290
|
+
const currentPaymentStatus = readPaymentStatus(currentOrder);
|
|
291
|
+
if (PAYMENT_WRITE_FROZEN_STATUSES.has(currentPaymentStatus)) return require_normalize.unknown("ensureSessionPaymentInProgress");
|
|
292
|
+
if (currentOrder && !isCommittedPaidOrder(currentOrder)) return {
|
|
278
293
|
status: "succeeded",
|
|
279
294
|
data: void 0
|
|
280
295
|
};
|
|
281
296
|
try {
|
|
282
|
-
yield context.sales.createNew();
|
|
297
|
+
const createdOrder = isCommittedPaidOrder(currentOrder) ? yield context.sales.clearCartAndReset() : yield context.sales.createNew();
|
|
283
298
|
if (signal.aborted) return require_normalize.unknown("ensureSessionAbortedAfterDispatch");
|
|
299
|
+
const liveCreatedOrder = require_projection.resolveBigSaleLiveTempOrder(getContext());
|
|
300
|
+
const createdPaymentStatus = readPaymentStatus(liveCreatedOrder !== null && liveCreatedOrder !== void 0 ? liveCreatedOrder : createdOrder);
|
|
301
|
+
if (isCommittedPaidOrder(liveCreatedOrder !== null && liveCreatedOrder !== void 0 ? liveCreatedOrder : createdOrder) || PAYMENT_WRITE_FROZEN_STATUSES.has(createdPaymentStatus)) return require_normalize.unknown("ensureSessionNotWritable");
|
|
284
302
|
return {
|
|
285
303
|
status: "succeeded",
|
|
286
304
|
data: void 0
|
|
@@ -88,11 +88,21 @@ function ActiveScaleRuntimeOwner({ active, hub, minimumWeightKg, ownerId, runtim
|
|
|
88
88
|
const consumedReadingRef = (0, react.useRef)(false);
|
|
89
89
|
const lastConnectionStateRef = (0, react.useRef)();
|
|
90
90
|
const eventSequenceRef = (0, react.useRef)(0);
|
|
91
|
+
const [sample, setSample] = (0, react.useState)({
|
|
92
|
+
sequence: 0,
|
|
93
|
+
receivedAt: 0
|
|
94
|
+
});
|
|
91
95
|
const scale = useNativeScale({
|
|
92
96
|
unit: "KILOGRAMS",
|
|
93
97
|
precision: 3,
|
|
94
98
|
tareWeight: 0,
|
|
95
|
-
autoStart: active
|
|
99
|
+
autoStart: active,
|
|
100
|
+
onChange: (0, react.useCallback)(() => {
|
|
101
|
+
setSample((current) => ({
|
|
102
|
+
sequence: current.sequence + 1,
|
|
103
|
+
receivedAt: Date.now()
|
|
104
|
+
}));
|
|
105
|
+
}, [])
|
|
96
106
|
});
|
|
97
107
|
const inspection = inspectScaleEntrySnapshot(scale, minimumWeightKg);
|
|
98
108
|
(0, react.useEffect)(() => {
|
|
@@ -111,7 +121,8 @@ function ActiveScaleRuntimeOwner({ active, hub, minimumWeightKg, ownerId, runtim
|
|
|
111
121
|
connectionState: scale.connectionState,
|
|
112
122
|
rawData: scale.rawData,
|
|
113
123
|
isListening: scale.isListening,
|
|
114
|
-
error: scale.error
|
|
124
|
+
error: scale.error,
|
|
125
|
+
sampleSequence: sample.sequence
|
|
115
126
|
});
|
|
116
127
|
}, [
|
|
117
128
|
active,
|
|
@@ -122,7 +133,8 @@ function ActiveScaleRuntimeOwner({ active, hub, minimumWeightKg, ownerId, runtim
|
|
|
122
133
|
scale.grossWeight,
|
|
123
134
|
scale.isListening,
|
|
124
135
|
scale.rawData,
|
|
125
|
-
scale.status
|
|
136
|
+
scale.status,
|
|
137
|
+
sample.sequence
|
|
126
138
|
]);
|
|
127
139
|
(0, react.useEffect)(() => {
|
|
128
140
|
if (!active) {
|
|
@@ -150,11 +162,12 @@ function ActiveScaleRuntimeOwner({ active, hub, minimumWeightKg, ownerId, runtim
|
|
|
150
162
|
return;
|
|
151
163
|
}
|
|
152
164
|
if (consumedReadingRef.current) return;
|
|
165
|
+
if (!runtime.getSnapshot().hasLiveSample) return;
|
|
153
166
|
const grossWeight = inspection.validGrossWeightKg;
|
|
154
167
|
if (grossWeight === void 0) return;
|
|
155
168
|
consumedReadingRef.current = true;
|
|
156
169
|
eventSequenceRef.current += 1;
|
|
157
|
-
const occurredAt = Date.now();
|
|
170
|
+
const occurredAt = sample.receivedAt || Date.now();
|
|
158
171
|
hub.publishWeightChange({
|
|
159
172
|
eventId: `native-scale-change:${occurredAt}:${eventSequenceRef.current}`,
|
|
160
173
|
occurredAt,
|
|
@@ -170,6 +183,8 @@ function ActiveScaleRuntimeOwner({ active, hub, minimumWeightKg, ownerId, runtim
|
|
|
170
183
|
hub,
|
|
171
184
|
inspection.belowTriggerThreshold,
|
|
172
185
|
inspection.validGrossWeightKg,
|
|
186
|
+
runtime,
|
|
187
|
+
sample.receivedAt,
|
|
173
188
|
scale.status
|
|
174
189
|
]);
|
|
175
190
|
return null;
|
|
@@ -7,9 +7,9 @@ const require_adapters = require("../../../../plus/saleDetail/components/Promoti
|
|
|
7
7
|
const require_useSaleWalletAssets = require("../../../../plus/saleDetail/components/PromotionWalletPanels/useSaleWalletAssets.js");
|
|
8
8
|
const require_Base = require("../../../../plus/saleDetail/Base.js");
|
|
9
9
|
const require_locales = require("../../../HDLKiosk/locales.js");
|
|
10
|
-
const
|
|
10
|
+
const require_scaleStore = require("../../../HDLKiosk/runtime/devices/scaleStore.js");
|
|
11
11
|
const require_index = require("../../../HDLKiosk/index.js");
|
|
12
|
-
const require_config = require("../../../HDLKiosk/contracts/config.js");
|
|
12
|
+
const require_config = require("../../../HDLKiosk/app/contracts/config.js");
|
|
13
13
|
const require_useBigSaleHDLKioskHost = require("./adapter/useBigSaleHDLKioskHost.js");
|
|
14
14
|
const require_useHDLKioskEntryPreparationToast = require("./adapter/useHDLKioskEntryPreparationToast.js");
|
|
15
15
|
const require_HDLKioskPaymentRuntime = require("./adapter/HDLKioskPaymentRuntime.js");
|
|
@@ -94,7 +94,7 @@ function HDLKioskBigSaleTemplate({ isActive = true, context, businessCode, local
|
|
|
94
94
|
}, [engineContext === null || engineContext === void 0 || (_engineContext$appHel4 = engineContext.appHelper) === null || _engineContext$appHel4 === void 0 ? void 0 : _engineContext$appHel4.utils]);
|
|
95
95
|
const h5AuthModuleName = require_useHDLKioskH5AuthModule.useHDLKioskH5AuthModule(engineContext, context.sales);
|
|
96
96
|
const scaleTriggerHub = (0, react.useMemo)(() => require_scaleTrigger.createScaleTriggerHub(), []);
|
|
97
|
-
const scaleRuntime = (0, react.useMemo)(
|
|
97
|
+
const scaleRuntime = (0, react.useMemo)(require_scaleStore.createHDLScaleRuntime, []);
|
|
98
98
|
const authenticatedCustomerRef = (0, react.useRef)(void 0);
|
|
99
99
|
const paymentControllerRef = (0, react.useRef)();
|
|
100
100
|
const walletAssetsCleanupCoordinatorRef = (0, react.useRef)(require_useSaleWalletAssets.createSaleWalletAssetsCleanupCoordinator());
|
|
@@ -221,7 +221,7 @@ function HDLKioskBigSaleTemplate({ isActive = true, context, businessCode, local
|
|
|
221
221
|
skipsCatalogLoad
|
|
222
222
|
]);
|
|
223
223
|
return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement(require_scaleTrigger.BigSaleScaleRuntimeOwner, {
|
|
224
|
-
active: isActive && (config.enabledEntries.includes("scale") || config.enabledEntries.includes("quick")) && Boolean(config.primaryWeightedProductId),
|
|
224
|
+
active: isActive && (config.enabledEntries.includes("scale") || config.enabledEntries.includes("quick") || config.enabledEntries.includes("barcode")) && Boolean(config.primaryWeightedProductId),
|
|
225
225
|
hub: scaleTriggerHub,
|
|
226
226
|
nativeScaleTools,
|
|
227
227
|
minimumWeightKg: config.scaleTriggerMinimumWeightKg,
|