@pisell/private-materials 6.12.167 → 6.12.169

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) 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 +11 -13
  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 +105 -101
  20. package/es/components/HDLKiosk/docs/03-/344/270/232/345/212/241/346/265/201/347/250/213/344/270/216/344/272/244/344/272/222/350/247/204/345/210/231.md +2 -2
  21. package/es/components/HDLKiosk/docs/04-/350/256/276/345/244/207/344/270/216/347/247/260/351/207/215.md +43 -26
  22. package/es/components/HDLKiosk/docs/05-/344/272/244/346/230/223/345/256/211/345/205/250.md +2 -0
  23. package/es/components/HDLKiosk/docs/07-/345/220/216/347/273/255/345/267/245/344/275/234.md +1 -1
  24. 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
  25. 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
  26. package/es/components/HDLKiosk/docs/README.md +6 -2
  27. package/es/components/HDLKiosk/docs//345/256/236/346/226/275/350/277/233/345/272/246.md +8 -7
  28. package/es/components/HDLKiosk/docs//346/236/266/346/236/204/350/256/276/350/256/241.md +16 -18
  29. package/es/components/HDLKiosk/index.js +22 -28
  30. package/es/components/HDLKiosk/index.less +1 -1
  31. package/es/components/HDLKiosk/kernel/README.md +14 -13
  32. package/es/components/HDLKiosk/kernel/application/defineApplication.js +63 -24
  33. package/es/components/HDLKiosk/kernel/application/defineSlice.js +6 -6
  34. package/es/components/HDLKiosk/kernel/application/runtime.js +237 -0
  35. package/es/components/HDLKiosk/kernel/operations/coordinator.js +1 -1
  36. package/es/components/HDLKiosk/kernel/operations/registry.js +3 -3
  37. package/es/components/HDLKiosk/kernel/operations/sessionEpoch.js +1 -1
  38. package/es/components/HDLKiosk/kernel/operations/types.js +7 -3
  39. package/es/components/HDLKiosk/kernel/workflow/actor.js +51 -22
  40. package/es/components/HDLKiosk/kernel/workflow/compiler.js +23 -30
  41. package/es/components/HDLKiosk/runtime/createRuntime.js +238 -0
  42. package/es/components/HDLKiosk/{devices → runtime/devices}/dedupeStore.js +1 -1
  43. package/es/components/HDLKiosk/{devices → runtime/devices}/scaleIngress.js +1 -1
  44. package/es/components/HDLKiosk/{devices/scale/runtime.js → runtime/devices/scaleStore.js} +18 -24
  45. package/es/components/HDLKiosk/{devices → runtime/devices}/scannerIngress.js +1 -1
  46. package/es/components/HDLKiosk/runtime/devices/scannerSessionPort.js +60 -0
  47. package/es/components/HDLKiosk/runtime/devices/scannerSessionRouter.js +212 -0
  48. package/es/components/HDLKiosk/runtime/operations/barcode.js +18 -0
  49. package/es/components/HDLKiosk/runtime/operations/cart.js +44 -0
  50. package/es/components/HDLKiosk/{app → runtime}/operations/cartConsistency.js +1 -1
  51. package/es/components/HDLKiosk/{app → runtime}/operations/checkout.js +95 -110
  52. package/es/components/HDLKiosk/{app → runtime}/operations/checkoutRequirements.js +1 -1
  53. package/es/components/HDLKiosk/{app → runtime}/operations/checkoutSafety.js +1 -1
  54. package/es/components/HDLKiosk/{app → runtime}/operations/coordinator.js +2 -2
  55. package/es/components/HDLKiosk/runtime/operations/customization.js +70 -0
  56. package/es/components/HDLKiosk/{app → runtime}/operations/errors.js +1 -1
  57. package/es/components/HDLKiosk/runtime/operations/fulfillment.js +6 -0
  58. package/es/components/HDLKiosk/runtime/operations/identity.js +55 -0
  59. package/es/components/HDLKiosk/runtime/operations/registry.js +34 -0
  60. package/es/components/HDLKiosk/runtime/operations/session.js +29 -0
  61. package/es/components/HDLKiosk/runtime/operations/types.js +13 -0
  62. package/es/components/HDLKiosk/runtime/session/blockPolicy.js +14 -0
  63. package/es/components/HDLKiosk/runtime/{createWorkflowSession.js → session/createSession.js} +67 -17
  64. package/es/components/HDLKiosk/runtime/{domainTransitionRunner.js → session/transitionRunner.js} +10 -5
  65. package/es/components/HDLKiosk/runtime/{workflowContext.js → session/workflowContext.js} +2 -2
  66. package/es/components/HDLKiosk/runtime/{workflowLifecycle.js → session/workflowLifecycle.js} +2 -2
  67. package/es/components/HDLKiosk/runtime/triggers.js +28 -0
  68. package/es/components/HDLKiosk/slices/catalog/Screen/index.js +15 -8
  69. package/es/components/HDLKiosk/slices/catalog/Screen/index.less +74 -13
  70. package/es/components/HDLKiosk/slices/catalog/slice.js +2 -2
  71. package/es/components/HDLKiosk/slices/customization/Screen/index.js +37 -38
  72. package/es/components/HDLKiosk/slices/customization/Screen/index.less +5 -0
  73. package/es/components/HDLKiosk/slices/customization/slice.js +3 -4
  74. package/es/components/HDLKiosk/slices/fulfillment/slice.js +2 -2
  75. package/es/components/HDLKiosk/slices/fulfillment/view.js +1 -1
  76. package/es/components/HDLKiosk/slices/identity/Screen/index.js +2 -2
  77. package/es/components/HDLKiosk/slices/identity/slice.js +3 -3
  78. package/es/components/HDLKiosk/slices/identity/view.js +1 -1
  79. package/es/components/HDLKiosk/slices/payment/slice.js +3 -3
  80. package/es/components/HDLKiosk/slices/primaryProductPrompt/slice.js +2 -2
  81. package/es/components/HDLKiosk/slices/primaryProductPrompt/view.js +2 -2
  82. package/es/components/HDLKiosk/{runtime → ui}/HDLKioskWorkflowView.js +45 -131
  83. package/es/components/HDLKiosk/ui/ScaleSimulatorConsole/index.js +387 -0
  84. package/es/components/HDLKiosk/ui/ScaleSimulatorConsole/index.less +621 -0
  85. package/es/components/HDLKiosk/{app → ui}/ScreenRenderer.js +7 -7
  86. package/es/components/HDLKiosk/ui/controllers/useHDLKioskActionDispatcher.js +66 -0
  87. package/es/components/HDLKiosk/{runtime → ui}/controllers/useHDLKioskCustomerController.js +1 -1
  88. package/es/components/HDLKiosk/ui/controllers/useHDLKioskDeviceController.js +25 -0
  89. package/es/components/HDLKiosk/ui/controllers/useHDLKioskExitController.js +53 -0
  90. package/es/components/HDLKiosk/{runtime → ui}/controllers/useHDLKioskScreenData.js +1 -1
  91. package/es/components/HDLKiosk/ui/controllers/useHDLKioskSessionController.js +39 -0
  92. package/es/components/HDLKiosk/{app → ui}/entry/Screen/index.js +8 -6
  93. package/es/components/HDLKiosk/{app → ui}/entry/model.js +2 -2
  94. package/es/components/HDLKiosk/ui/scale.js +20 -0
  95. package/es/components/HDLKiosk/{runtime/useHostSnapshot.js → ui/snapshots.js} +6 -8
  96. package/es/components/HDLKiosk/{app → ui}/views.js +1 -1
  97. package/es/components/HDLKiosk/{runtime → ui}/workflowEvent.js +1 -1
  98. package/es/components/HDLKiosk/utils.js +4 -4
  99. package/es/components/bigSale/templates/HDLKiosk/adapter/HDLKioskPaymentRuntime.js +2 -1
  100. package/es/components/bigSale/templates/HDLKiosk/adapter/capabilities.js +1 -1
  101. package/es/components/bigSale/templates/HDLKiosk/adapter/projection.js +21 -11
  102. package/es/components/bigSale/templates/HDLKiosk/adapter/sales.js +21 -3
  103. package/es/components/bigSale/templates/HDLKiosk/adapter/scaleTrigger.js +20 -5
  104. package/es/components/bigSale/templates/HDLKiosk/adapter/useBigSaleHDLKioskHost.js +3 -0
  105. package/es/components/bigSale/templates/HDLKiosk/index.js +3 -3
  106. package/lib/components/HDLKiosk/{contracts → app/contracts}/config.js +1 -1
  107. package/lib/components/HDLKiosk/app/manifest.js +18 -19
  108. package/lib/components/HDLKiosk/app/operations.js +105 -0
  109. package/lib/components/HDLKiosk/app/workflow/barcode.js +11 -13
  110. package/lib/components/HDLKiosk/app/workflow/index.js +16 -0
  111. package/lib/components/HDLKiosk/app/workflow/predicates.js +1 -0
  112. package/lib/components/HDLKiosk/app/workflow/quick.js +1 -1
  113. package/lib/components/HDLKiosk/app/workflow/registry.js +3 -3
  114. package/lib/components/HDLKiosk/app/workflow/scale.js +5 -1
  115. package/lib/components/HDLKiosk/docs/00-/346/226/207/344/273/266/345/257/274/350/210/252.md +104 -167
  116. package/lib/components/HDLKiosk/docs/01-/346/240/270/345/277/203/350/277/220/350/241/214/346/234/272/345/210/266.md +105 -101
  117. package/lib/components/HDLKiosk/docs/03-/344/270/232/345/212/241/346/265/201/347/250/213/344/270/216/344/272/244/344/272/222/350/247/204/345/210/231.md +2 -2
  118. package/lib/components/HDLKiosk/docs/04-/350/256/276/345/244/207/344/270/216/347/247/260/351/207/215.md +43 -26
  119. package/lib/components/HDLKiosk/docs/05-/344/272/244/346/230/223/345/256/211/345/205/250.md +2 -0
  120. package/lib/components/HDLKiosk/docs/07-/345/220/216/347/273/255/345/267/245/344/275/234.md +1 -1
  121. 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
  122. 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
  123. package/lib/components/HDLKiosk/docs/README.md +6 -2
  124. package/lib/components/HDLKiosk/docs//345/256/236/346/226/275/350/277/233/345/272/246.md +8 -7
  125. package/lib/components/HDLKiosk/docs//346/236/266/346/236/204/350/256/276/350/256/241.md +16 -18
  126. package/lib/components/HDLKiosk/index.js +25 -31
  127. package/lib/components/HDLKiosk/index.less +1 -1
  128. package/lib/components/HDLKiosk/kernel/README.md +14 -13
  129. package/lib/components/HDLKiosk/kernel/application/defineApplication.js +65 -25
  130. package/lib/components/HDLKiosk/kernel/application/defineSlice.js +6 -6
  131. package/lib/components/HDLKiosk/kernel/application/runtime.js +237 -0
  132. package/lib/components/HDLKiosk/kernel/operations/coordinator.js +1 -1
  133. package/lib/components/HDLKiosk/kernel/operations/registry.js +3 -3
  134. package/lib/components/HDLKiosk/kernel/operations/sessionEpoch.js +1 -1
  135. package/lib/components/HDLKiosk/kernel/operations/types.js +8 -3
  136. package/lib/components/HDLKiosk/kernel/workflow/actor.js +51 -22
  137. package/lib/components/HDLKiosk/kernel/workflow/compiler.js +23 -30
  138. package/lib/components/HDLKiosk/runtime/createRuntime.js +239 -0
  139. package/lib/components/HDLKiosk/{devices → runtime/devices}/dedupeStore.js +1 -1
  140. package/lib/components/HDLKiosk/{devices → runtime/devices}/scaleIngress.js +1 -1
  141. package/lib/components/HDLKiosk/{devices/scale/runtime.js → runtime/devices/scaleStore.js} +17 -27
  142. package/lib/components/HDLKiosk/{devices → runtime/devices}/scannerIngress.js +1 -1
  143. package/lib/components/HDLKiosk/runtime/devices/scannerSessionPort.js +60 -0
  144. package/lib/components/HDLKiosk/runtime/devices/scannerSessionRouter.js +212 -0
  145. package/lib/components/HDLKiosk/runtime/operations/barcode.js +17 -0
  146. package/lib/components/HDLKiosk/runtime/operations/cart.js +46 -0
  147. package/lib/components/HDLKiosk/{app → runtime}/operations/cartConsistency.js +1 -1
  148. package/lib/components/HDLKiosk/{app → runtime}/operations/checkout.js +97 -112
  149. package/lib/components/HDLKiosk/{app → runtime}/operations/checkoutRequirements.js +1 -1
  150. package/lib/components/HDLKiosk/{app → runtime}/operations/checkoutSafety.js +1 -1
  151. package/lib/components/HDLKiosk/{app → runtime}/operations/coordinator.js +2 -2
  152. package/lib/components/HDLKiosk/runtime/operations/customization.js +73 -0
  153. package/lib/components/HDLKiosk/{app → runtime}/operations/errors.js +1 -1
  154. package/lib/components/HDLKiosk/runtime/operations/fulfillment.js +5 -0
  155. package/lib/components/HDLKiosk/runtime/operations/identity.js +55 -0
  156. package/lib/components/HDLKiosk/runtime/operations/registry.js +34 -0
  157. package/lib/components/HDLKiosk/runtime/operations/session.js +30 -0
  158. package/lib/components/HDLKiosk/runtime/operations/types.js +14 -0
  159. package/lib/components/HDLKiosk/runtime/session/blockPolicy.js +14 -0
  160. package/lib/components/HDLKiosk/runtime/{createWorkflowSession.js → session/createSession.js} +71 -21
  161. package/lib/components/HDLKiosk/runtime/{domainTransitionRunner.js → session/transitionRunner.js} +10 -5
  162. package/lib/components/HDLKiosk/runtime/{workflowContext.js → session/workflowContext.js} +2 -2
  163. package/lib/components/HDLKiosk/runtime/{workflowLifecycle.js → session/workflowLifecycle.js} +2 -2
  164. package/lib/components/HDLKiosk/runtime/triggers.js +28 -0
  165. package/lib/components/HDLKiosk/slices/catalog/Screen/index.js +15 -8
  166. package/lib/components/HDLKiosk/slices/catalog/Screen/index.less +74 -13
  167. package/lib/components/HDLKiosk/slices/catalog/slice.js +3 -3
  168. package/lib/components/HDLKiosk/slices/customization/Screen/index.js +38 -39
  169. package/lib/components/HDLKiosk/slices/customization/Screen/index.less +5 -0
  170. package/lib/components/HDLKiosk/slices/customization/slice.js +5 -6
  171. package/lib/components/HDLKiosk/slices/fulfillment/slice.js +3 -3
  172. package/lib/components/HDLKiosk/slices/fulfillment/view.js +1 -1
  173. package/lib/components/HDLKiosk/slices/identity/Screen/index.js +2 -2
  174. package/lib/components/HDLKiosk/slices/identity/slice.js +4 -4
  175. package/lib/components/HDLKiosk/slices/identity/view.js +1 -1
  176. package/lib/components/HDLKiosk/slices/payment/slice.js +5 -5
  177. package/lib/components/HDLKiosk/slices/primaryProductPrompt/slice.js +2 -2
  178. package/lib/components/HDLKiosk/slices/primaryProductPrompt/view.js +2 -2
  179. package/lib/components/HDLKiosk/{runtime → ui}/HDLKioskWorkflowView.js +46 -132
  180. package/lib/components/HDLKiosk/ui/ScaleSimulatorConsole/index.js +390 -0
  181. package/lib/components/HDLKiosk/ui/ScaleSimulatorConsole/index.less +621 -0
  182. package/lib/components/HDLKiosk/{app → ui}/ScreenRenderer.js +7 -7
  183. package/lib/components/HDLKiosk/ui/controllers/useHDLKioskActionDispatcher.js +67 -0
  184. package/lib/components/HDLKiosk/{runtime → ui}/controllers/useHDLKioskCustomerController.js +1 -1
  185. package/lib/components/HDLKiosk/ui/controllers/useHDLKioskDeviceController.js +26 -0
  186. package/lib/components/HDLKiosk/ui/controllers/useHDLKioskExitController.js +54 -0
  187. package/lib/components/HDLKiosk/{runtime → ui}/controllers/useHDLKioskScreenData.js +1 -1
  188. package/lib/components/HDLKiosk/ui/controllers/useHDLKioskSessionController.js +40 -0
  189. package/lib/components/HDLKiosk/{app → ui}/entry/Screen/index.js +8 -6
  190. package/lib/components/HDLKiosk/{app → ui}/entry/model.js +2 -2
  191. package/lib/components/HDLKiosk/ui/scale.js +24 -0
  192. package/lib/components/HDLKiosk/{runtime/useHostSnapshot.js → ui/snapshots.js} +6 -7
  193. package/lib/components/HDLKiosk/{app → ui}/views.js +1 -1
  194. package/lib/components/HDLKiosk/{runtime → ui}/workflowEvent.js +1 -1
  195. package/lib/components/HDLKiosk/utils.js +4 -4
  196. package/lib/components/bigSale/templates/HDLKiosk/adapter/HDLKioskPaymentRuntime.js +2 -1
  197. package/lib/components/bigSale/templates/HDLKiosk/adapter/capabilities.js +1 -1
  198. package/lib/components/bigSale/templates/HDLKiosk/adapter/projection.js +21 -10
  199. package/lib/components/bigSale/templates/HDLKiosk/adapter/sales.js +20 -2
  200. package/lib/components/bigSale/templates/HDLKiosk/adapter/scaleTrigger.js +19 -4
  201. package/lib/components/bigSale/templates/HDLKiosk/adapter/useBigSaleHDLKioskHost.js +3 -0
  202. package/lib/components/bigSale/templates/HDLKiosk/index.js +4 -4
  203. package/package.json +2 -2
  204. package/es/components/HDLKiosk/app/constants.js +0 -9
  205. package/es/components/HDLKiosk/app/operations/barcode.js +0 -22
  206. package/es/components/HDLKiosk/app/operations/cart.js +0 -60
  207. package/es/components/HDLKiosk/app/operations/fulfillment.js +0 -11
  208. package/es/components/HDLKiosk/app/operations/session.js +0 -41
  209. package/es/components/HDLKiosk/app/operations/types.js +0 -11
  210. package/es/components/HDLKiosk/devices/entryArbiter.js +0 -33
  211. package/es/components/HDLKiosk/runtime/controllers/useHDLKioskDeviceController.js +0 -75
  212. package/es/components/HDLKiosk/runtime/controllers/useHDLKioskScannerController.js +0 -160
  213. package/es/components/HDLKiosk/runtime/controllers/useHDLKioskSessionController.js +0 -185
  214. package/es/components/HDLKiosk/runtime/useWorkflowSnapshot.js +0 -12
  215. package/es/components/HDLKiosk/slices/customization/operation.js +0 -80
  216. package/es/components/HDLKiosk/slices/identity/operation.js +0 -60
  217. package/lib/components/HDLKiosk/app/constants.js +0 -9
  218. package/lib/components/HDLKiosk/app/operations/barcode.js +0 -21
  219. package/lib/components/HDLKiosk/app/operations/cart.js +0 -62
  220. package/lib/components/HDLKiosk/app/operations/fulfillment.js +0 -10
  221. package/lib/components/HDLKiosk/app/operations/session.js +0 -42
  222. package/lib/components/HDLKiosk/app/operations/types.js +0 -12
  223. package/lib/components/HDLKiosk/devices/entryArbiter.js +0 -33
  224. package/lib/components/HDLKiosk/runtime/controllers/useHDLKioskDeviceController.js +0 -76
  225. package/lib/components/HDLKiosk/runtime/controllers/useHDLKioskScannerController.js +0 -161
  226. package/lib/components/HDLKiosk/runtime/controllers/useHDLKioskSessionController.js +0 -186
  227. package/lib/components/HDLKiosk/runtime/useWorkflowSnapshot.js +0 -13
  228. package/lib/components/HDLKiosk/slices/customization/operation.js +0 -83
  229. package/lib/components/HDLKiosk/slices/identity/operation.js +0 -60
  230. /package/es/components/HDLKiosk/{app → ui}/entry/Screen/index.less +0 -0
  231. /package/lib/components/HDLKiosk/{app → ui}/entry/Screen/index.less +0 -0
@@ -1,186 +0,0 @@
1
- require("../../../../_virtual/_rolldown/runtime.js");
2
- const require_asyncToGenerator = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
3
- const require_entryArbiter = require("../../devices/entryArbiter.js");
4
- const require_scaleIngress = require("../../devices/scaleIngress.js");
5
- const require_scannerIngress = require("../../devices/scannerIngress.js");
6
- const require_registry = require("../../app/workflow/registry.js");
7
- const require_createWorkflowSession = require("../createWorkflowSession.js");
8
- let react = require("react");
9
- //#region src/components/HDLKiosk/runtime/controllers/useHDLKioskSessionController.ts
10
- /**
11
- * 文件角色:拥有 Entry、会话创建/销毁和回首页的顶层生命周期。
12
- * 运行机制:结合 Capabilities 和入口 claim 决定 start;reset 成功后 dispose Actor
13
- * 并推进 session epoch。当前应用不恢复跨刷新会话。
14
- * 边界:不会仅靠页面导航开始下一单,也不消费具体 Screen 的局部交互。
15
- */
16
- /**
17
- * Barcode 的首次扫码只需要建立可写 Session 并消费条码;秤和称重主商品
18
- * 是后续业务分支能力,不得阻断 Barcode Session 入口。
19
- */
20
- function resolveHDLKioskEntryCapabilityBlockReason({ entry, capabilities, primaryWeightedProductId }) {
21
- if (!capabilities.session.ensure) return "sessionEnsureUnavailable";
22
- if (entry === "barcode") return capabilities.scanner.available ? void 0 : "scannerUnavailable";
23
- if (!capabilities.products.primaryWeightedProductQuery || !primaryWeightedProductId) return "primaryProductUnavailable";
24
- if (require_registry.builtInWorkflowHasActivity(entry, "customization") && (!capabilities.customization.weightedProduct || !capabilities.scale.available)) return "customizationUnavailable";
25
- if (entry === "scale" && (!capabilities.scale.available || !capabilities.scale.weightChangeTrigger)) return "scaleTriggerUnavailable";
26
- }
27
- function useHDLKioskSessionController({ host, config, isActive }) {
28
- const [session, setSession] = (0, react.useState)();
29
- const [starting, setStarting] = (0, react.useState)(false);
30
- const [startErrorReference, setStartErrorReference] = (0, react.useState)();
31
- const sessionRef = (0, react.useRef)(session);
32
- const startingSessionRef = (0, react.useRef)();
33
- const startPromiseRef = (0, react.useRef)();
34
- const startAttemptSequence = (0, react.useRef)(0);
35
- const returnAttemptSequence = (0, react.useRef)(0);
36
- const returnPromiseRef = (0, react.useRef)();
37
- const activeRef = (0, react.useRef)(isActive);
38
- const mountedHostRef = (0, react.useRef)(host);
39
- const entryArbiter = (0, react.useMemo)(() => require_entryArbiter.createEntryArbiter(), [host]);
40
- const scannerIngress = (0, react.useMemo)(() => require_scannerIngress.createScannerIngress({ maxPendingEvents: 5 }), [host]);
41
- const scaleIngress = (0, react.useMemo)(() => require_scaleIngress.createScaleIngress(), [host]);
42
- sessionRef.current = session;
43
- activeRef.current = isActive;
44
- (0, react.useEffect)(() => () => {
45
- var _sessionRef$current, _startingSessionRef$c;
46
- (_sessionRef$current = sessionRef.current) === null || _sessionRef$current === void 0 || _sessionRef$current.actor.dispose();
47
- (_startingSessionRef$c = startingSessionRef.current) === null || _startingSessionRef$c === void 0 || _startingSessionRef$c.actor.dispose();
48
- }, []);
49
- (0, react.useEffect)(() => {
50
- var _sessionRef$current2, _startingSessionRef$c2;
51
- if (mountedHostRef.current === host) return;
52
- (_sessionRef$current2 = sessionRef.current) === null || _sessionRef$current2 === void 0 || _sessionRef$current2.actor.dispose();
53
- (_startingSessionRef$c2 = startingSessionRef.current) === null || _startingSessionRef$c2 === void 0 || _startingSessionRef$c2.actor.dispose();
54
- startingSessionRef.current = void 0;
55
- startPromiseRef.current = void 0;
56
- startAttemptSequence.current += 1;
57
- sessionRef.current = void 0;
58
- entryArbiter.reset();
59
- scannerIngress.reset();
60
- scaleIngress.reset();
61
- mountedHostRef.current = host;
62
- setSession(void 0);
63
- setStarting(false);
64
- setStartErrorReference(void 0);
65
- }, [
66
- entryArbiter,
67
- host,
68
- scaleIngress,
69
- scannerIngress
70
- ]);
71
- const start = (0, react.useCallback)((request) => {
72
- const { entry } = request;
73
- if (!activeRef.current || !config.enabledEntries.includes(entry)) return Promise.resolve(void 0);
74
- if (config.businessMode === "production" && !require_registry.isBuiltInWorkflowProductionReady(entry)) {
75
- setStartErrorReference(`workflow-placeholder-blocked-${Date.now()}`);
76
- return Promise.resolve(void 0);
77
- }
78
- const capabilityBlockReason = resolveHDLKioskEntryCapabilityBlockReason({
79
- entry,
80
- capabilities: host.capabilities,
81
- primaryWeightedProductId: config.primaryWeightedProductId
82
- });
83
- if (capabilityBlockReason) {
84
- if (capabilityBlockReason === "sessionEnsureUnavailable") setStartErrorReference(`session-ensure-unavailable-${Date.now()}`);
85
- return Promise.resolve(void 0);
86
- }
87
- const current = sessionRef.current;
88
- if (current) return Promise.resolve(current.entry === entry ? current : void 0);
89
- const pending = startPromiseRef.current;
90
- if (pending) return pending.entry === entry ? pending.promise : Promise.resolve(void 0);
91
- if (entryArbiter.claim(entry).status !== "accepted") return Promise.resolve(void 0);
92
- const next = require_createWorkflowSession.createHDLKioskWorkflowSession(entry, host, { primaryWeightedProductId: config.primaryWeightedProductId });
93
- startingSessionRef.current = next;
94
- startAttemptSequence.current += 1;
95
- const attempt = startAttemptSequence.current;
96
- setStarting(true);
97
- setStartErrorReference(void 0);
98
- const promise = next.ensure(`entry:${entry}:ensure:${attempt}`).then(function() {
99
- var _ref = require_asyncToGenerator._asyncToGenerator(function* (result) {
100
- if (attempt !== startAttemptSequence.current || mountedHostRef.current !== host || !activeRef.current) {
101
- next.actor.dispose();
102
- return;
103
- }
104
- if (result.status !== "succeeded") {
105
- next.actor.dispose();
106
- entryArbiter.reset();
107
- setStartErrorReference(result.status === "failed" || result.status === "partialFailure" || result.status === "unknown" ? result.error.traceId : `session-start-cancelled-${Date.now()}`);
108
- return;
109
- }
110
- sessionRef.current = next;
111
- setSession(next);
112
- return next;
113
- });
114
- return function(_x) {
115
- return _ref.apply(this, arguments);
116
- };
117
- }()).finally(() => {
118
- if (attempt !== startAttemptSequence.current) return;
119
- startingSessionRef.current = void 0;
120
- startPromiseRef.current = void 0;
121
- setStarting(false);
122
- });
123
- startPromiseRef.current = {
124
- entry,
125
- promise
126
- };
127
- return promise;
128
- }, [
129
- config.enabledEntries,
130
- config.primaryWeightedProductId,
131
- entryArbiter,
132
- host
133
- ]);
134
- const waitForReadySession = (0, react.useCallback)(() => {
135
- var _startPromiseRef$curr, _startPromiseRef$curr2;
136
- const current = sessionRef.current;
137
- if (current) return Promise.resolve(current);
138
- return (_startPromiseRef$curr = (_startPromiseRef$curr2 = startPromiseRef.current) === null || _startPromiseRef$curr2 === void 0 ? void 0 : _startPromiseRef$curr2.promise) !== null && _startPromiseRef$curr !== void 0 ? _startPromiseRef$curr : Promise.resolve(void 0);
139
- }, []);
140
- const completeReset = (0, react.useCallback)((completedSession) => {
141
- if (sessionRef.current !== completedSession) return;
142
- completedSession.actor.dispose();
143
- entryArbiter.reset();
144
- scannerIngress.reset();
145
- scaleIngress.reset();
146
- sessionRef.current = void 0;
147
- setSession(void 0);
148
- }, [
149
- entryArbiter,
150
- scaleIngress,
151
- scannerIngress
152
- ]);
153
- return {
154
- session,
155
- starting,
156
- startErrorReference,
157
- sessionRef,
158
- activeRef,
159
- entryArbiter,
160
- scannerIngress,
161
- scaleIngress,
162
- start,
163
- waitForReadySession,
164
- completeReset,
165
- returnToEntry: (0, react.useCallback)((reason = "application") => {
166
- if (returnPromiseRef.current) return returnPromiseRef.current;
167
- const current = sessionRef.current;
168
- if (!current) return Promise.resolve({
169
- status: "succeeded",
170
- data: void 0
171
- });
172
- returnAttemptSequence.current += 1;
173
- const attempt = returnAttemptSequence.current;
174
- const promise = current.reset(`return:${reason}:${attempt}`).then((result) => {
175
- if (result.status === "succeeded") completeReset(current);
176
- return result;
177
- }).finally(() => {
178
- if (returnPromiseRef.current === promise) returnPromiseRef.current = void 0;
179
- });
180
- returnPromiseRef.current = promise;
181
- return promise;
182
- }, [completeReset])
183
- };
184
- }
185
- //#endregion
186
- exports.useHDLKioskSessionController = useHDLKioskSessionController;
@@ -1,13 +0,0 @@
1
- require("../../../_virtual/_rolldown/runtime.js");
2
- let react = require("react");
3
- //#region src/components/HDLKiosk/runtime/useWorkflowSnapshot.ts
4
- /**
5
- * 文件角色:将纯 Workflow Actor 的 Snapshot 接入 React 渲染。
6
- * 运行机制:useSyncExternalStore 订阅 Actor,组件始终消费 Actor 发布的不可变快照。
7
- * 边界:不发送事件、不派生业务事实,也不维护第二份当前节点状态。
8
- */
9
- function useWorkflowSnapshot(actor) {
10
- return (0, react.useSyncExternalStore)(actor.subscribe, actor.getSnapshot, actor.getSnapshot);
11
- }
12
- //#endregion
13
- exports.useWorkflowSnapshot = useWorkflowSnapshot;
@@ -1,83 +0,0 @@
1
- const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
2
- const require_asyncToGenerator = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
3
- const require_canonicalSkuValue = require("../../../../plus/skuOptionsSelection/utils/canonicalSkuValue.js");
4
- const require_errors = require("../../app/operations/errors.js");
5
- const require_cartConsistency = require("../../app/operations/cartConsistency.js");
6
- const require_types = require("../../app/operations/types.js");
7
- let decimal_js = require("decimal.js");
8
- decimal_js = require_runtime.__toESM(decimal_js);
9
- //#region src/components/HDLKiosk/slices/customization/operation.ts
10
- /**
11
- * 文件角色:在 Customization Next 边界提交称重主商品本地草稿。
12
- * 运行机制:校验稳定净重/必选项,调用 Host/OS 主商品 writer,再验证目标行、重量、
13
- * SkuValue 和“新增或原行发生变化”的最小 receipt/Projection 事实。
14
- * 边界:页面输入变化不调用本 Operation;OS 内部的加购弹窗与业务判断不属于 HDLKiosk。
15
- */
16
- const productRemovePrimaryProductOperation = require_types.defineOperation({
17
- id: "product.removePrimaryProduct",
18
- conflictScope: "cart",
19
- timeoutMs: 15e3,
20
- retry: "explicit-user",
21
- execute: function() {
22
- var _ref = require_asyncToGenerator._asyncToGenerator(function* (context, input, signal) {
23
- if (!input.lineId) return {
24
- status: "succeeded",
25
- data: {}
26
- };
27
- const mutation = yield context.host.sales.removeLine({ lineId: input.lineId }, signal);
28
- return require_cartConsistency.finalizeCartMutation(context, mutation, signal, () => mutation.status === "succeeded" && mutation.data.removedLineId === input.lineId || !context.host.sales.getObservedSnapshot().cart.lines.some((item) => item.lineId === input.lineId));
29
- });
30
- return function execute(_x, _x2, _x3) {
31
- return _ref.apply(this, arguments);
32
- };
33
- }()
34
- });
35
- function hasValidSkuValue(input) {
36
- const canonical = require_canonicalSkuValue.canonicalizeSkuValue(input.skuValue);
37
- return Boolean(input.productId && canonical && canonical.productId === input.productId);
38
- }
39
- function sameSkuValue(expected, actual) {
40
- const expectedFingerprint = require_canonicalSkuValue.createSkuValueFingerprint(expected);
41
- return Boolean(expectedFingerprint && expectedFingerprint === require_canonicalSkuValue.createSkuValueFingerprint(actual));
42
- }
43
- function sameWeight(actual, expected) {
44
- const actualValue = new decimal_js.default(actual || NaN);
45
- const expectedValue = new decimal_js.default(expected || NaN);
46
- return actualValue.isFinite() && expectedValue.isFinite() && actualValue.equals(expectedValue);
47
- }
48
- const productSyncPrimaryWeightedProductOperation = require_types.defineOperation({
49
- id: "product.syncPrimaryWeightedProduct",
50
- conflictScope: "cart",
51
- retry: "explicit-user",
52
- execute: function() {
53
- var _ref2 = require_asyncToGenerator._asyncToGenerator(function* (context, input, signal) {
54
- if (!hasValidSkuValue(input)) return require_errors.operationFailed("customizationInputInvalid", "back");
55
- const beforeLines = new Map(context.host.sales.getObservedSnapshot().cart.lines.map((line) => [line.lineId, line.quantity]));
56
- const before = context.host.sales.getObservedSnapshot();
57
- const previousPrimary = input.existingLineId ? before.cart.lines.find((line) => line.lineId === input.existingLineId) : void 0;
58
- if (input.existingLineId && (!previousPrimary || previousPrimary.productId !== input.productId)) return require_errors.operationFailed("customizationExistingLineInvalid", "back");
59
- const mutation = yield context.host.sales.syncPrimaryWeightedProduct(input, signal);
60
- return require_cartConsistency.finalizeCartMutation(context, mutation, signal, () => {
61
- const after = context.host.sales.getObservedSnapshot();
62
- const projectionMatches = after.cart.lines.some((line) => {
63
- if (mutation.status === "succeeded" && mutation.data.affectedLineId && line.lineId !== mutation.data.affectedLineId) return false;
64
- if (line.productId !== input.productId) return false;
65
- const skuMatches = sameSkuValue(input.skuValue, line.skuValue);
66
- const weightMatches = sameWeight(line.quantity, input.measurement.netWeightKg);
67
- const previousQuantity = beforeLines.get(line.lineId);
68
- if (input.existingLineId) return line.lineId === input.existingLineId && skuMatches && weightMatches && mutation.status === "succeeded" && mutation.data.affectedLineId === input.existingLineId && after.observationId > before.observationId;
69
- return skuMatches && weightMatches && (previousQuantity === void 0 || previousQuantity !== line.quantity);
70
- });
71
- const successfulOutcome = mutation.status === "succeeded" ? mutation.data : void 0;
72
- const confirmedLine = successfulOutcome === null || successfulOutcome === void 0 ? void 0 : successfulOutcome.confirmedLine;
73
- return Boolean(confirmedLine && confirmedLine.productId === input.productId && (!(successfulOutcome === null || successfulOutcome === void 0 ? void 0 : successfulOutcome.affectedLineId) || confirmedLine.lineId === successfulOutcome.affectedLineId) && (!input.existingLineId || (successfulOutcome === null || successfulOutcome === void 0 ? void 0 : successfulOutcome.affectedLineId) === input.existingLineId && confirmedLine.lineId === input.existingLineId) && sameWeight(confirmedLine.quantity, input.measurement.netWeightKg) && sameSkuValue(input.skuValue, confirmedLine.skuValue) && (Boolean(input.existingLineId) || !beforeLines.has(confirmedLine.lineId) || beforeLines.get(confirmedLine.lineId) !== confirmedLine.quantity)) || projectionMatches;
74
- });
75
- });
76
- return function execute(_x4, _x5, _x6) {
77
- return _ref2.apply(this, arguments);
78
- };
79
- }()
80
- });
81
- //#endregion
82
- exports.productRemovePrimaryProductOperation = productRemovePrimaryProductOperation;
83
- exports.productSyncPrimaryWeightedProductOperation = productSyncPrimaryWeightedProductOperation;
@@ -1,60 +0,0 @@
1
- const require_asyncToGenerator = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
2
- const require_errors = require("../../app/operations/errors.js");
3
- const require_types = require("../../app/operations/types.js");
4
- //#region src/components/HDLKiosk/slices/identity/operation.ts
5
- function partialFailure(code, cause) {
6
- return {
7
- status: "partialFailure",
8
- error: require_errors.createOperationError(code, "staff", cause)
9
- };
10
- }
11
- function identityMatches(customerId, customer) {
12
- if (!customerId) return (customer === null || customer === void 0 ? void 0 : customer.member) !== true;
13
- if ((customer === null || customer === void 0 ? void 0 : customer.member) !== true) return false;
14
- return customer.customerId === customerId;
15
- }
16
- const identitySyncOperation = require_types.defineOperation({
17
- id: "identity.sync",
18
- conflictScope: "customer",
19
- timeoutMs: 15e3,
20
- retry: "explicit-user",
21
- execute: function() {
22
- var _ref = require_asyncToGenerator._asyncToGenerator(function* (context, input, signal) {
23
- var _input$customerId;
24
- if (!input || input.customerId !== void 0 && !input.customerId.trim()) return require_errors.operationFailed("identityInputInvalid", "back");
25
- const customerId = (_input$customerId = input.customerId) === null || _input$customerId === void 0 ? void 0 : _input$customerId.trim();
26
- const beforeSelection = context.host.sales.getObservedSnapshot();
27
- const selected = yield context.host.sales.selectIdentity(customerId ? { customerId } : {}, signal);
28
- if (selected.status !== "succeeded") return selected;
29
- if (signal.aborted) return require_errors.operationUnknown("identityAbortedAfterWrite");
30
- const afterSelection = context.host.sales.getObservedSnapshot();
31
- const hasOrderLines = beforeSelection.cart.lineCount > 0 || afterSelection.cart.lineCount > 0;
32
- let summaryConfirmed = false;
33
- if (hasOrderLines) {
34
- const consistency = yield context.host.sales.waitForCartConsistency(signal);
35
- if (consistency.status !== "succeeded") {
36
- if (consistency.status === "unknown") return consistency;
37
- return partialFailure("identityConsistencyFailed", consistency);
38
- }
39
- const summary = yield context.host.sales.recalculateSummary(signal);
40
- if (summary.status !== "succeeded") {
41
- if (summary.status === "unknown") return summary;
42
- return partialFailure("identitySummaryRecalculationFailed", summary);
43
- }
44
- summaryConfirmed = Boolean(summary.data.confirmedSummary);
45
- }
46
- const observed = context.host.sales.getObservedSnapshot();
47
- if (hasOrderLines && !summaryConfirmed && observed.summary.status !== "ready") return partialFailure("identitySummaryProjectionMissing");
48
- if (!(customerId ? identityMatches(customerId, selected.data.customer) : selected.data.customer === void 0) && !identityMatches(customerId, observed.customer)) return require_errors.operationUnknown("identitySelectionNotObserved");
49
- return {
50
- status: "succeeded",
51
- data: void 0
52
- };
53
- });
54
- return function execute(_x, _x2, _x3) {
55
- return _ref.apply(this, arguments);
56
- };
57
- }()
58
- });
59
- //#endregion
60
- exports.identitySyncOperation = identitySyncOperation;