@pisell/private-materials 6.12.168 → 6.12.170

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