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