@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,694 +0,0 @@
1
- const require_runtime = require("../../../../../_virtual/_rolldown/runtime.js");
2
- const require_objectSpread2 = require("../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
3
- const require_asyncToGenerator = require("../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
4
- const require_pricePresentation = require("../../../../../plus/productSelect/pricing/pricePresentation.js");
5
- const require_productSkuOptions = require("../../../../../plus/salesSdk/utils/productSkuOptions.js");
6
- const require_identity = require("../../../../../plus/salesSdk/utils/identity.js");
7
- const require_buildProductLineUpdates = require("../../../../../plus/salesSdk/utils/buildProductLineUpdates.js");
8
- const require_product = require("../../../../HDLKiosk/product.js");
9
- const require_projection = require("./projection.js");
10
- const require_normalize = require("./normalize.js");
11
- const require_customizationProduct = require("./customizationProduct.js");
12
- let decimal_js = require("decimal.js");
13
- decimal_js = require_runtime.__toESM(decimal_js);
14
- //#region src/components/bigSale/templates/HDLKiosk/adapter/sales.ts
15
- /**
16
- * 文件角色:实现 HDLSalesPort 到 BigSale/SalesSDK 的全部命令和商品查询映射。
17
- * 运行机制:对接 queryProducts、OS add flow、购物车、客户、Summary、Checkout、
18
- * reset,并把 writer 返回投影成最小 receipt 供 Core 写后验证。
19
- * 边界:复杂 OS 对象止于本文件;模糊 callback、缺 writer 或不可表达商品必须 fail closed。
20
- */
21
- function cancelled(reason) {
22
- return {
23
- status: "cancelled",
24
- reason
25
- };
26
- }
27
- function findCartLine(context, lineId) {
28
- var _context$cart$display;
29
- return ((_context$cart$display = context.cart.displayLines) !== null && _context$cart$display !== void 0 ? _context$cart$display : context.cart.items).find((line) => require_projection.resolveBigSaleLineId(line) === lineId);
30
- }
31
- function resolveCartProduct(line) {
32
- var _line$_extend;
33
- return "product_id" in line ? line : (_line$_extend = line._extend) === null || _line$_extend === void 0 ? void 0 : _line$_extend.product;
34
- }
35
- function hasRequestedWeight(product, requestedWeightKg) {
36
- var _product$product_sku$, _product$product_sku;
37
- const actual = new decimal_js.default((_product$product_sku$ = (_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.net_weight) !== null && _product$product_sku$ !== void 0 ? _product$product_sku$ : NaN);
38
- const expected = new decimal_js.default(requestedWeightKg || NaN);
39
- return actual.isFinite() && expected.isFinite() && actual.equals(expected);
40
- }
41
- function findConfirmedMutationLine(products, productId, requestedWeightKg, uniqueId) {
42
- return [...products].reverse().find((candidate) => {
43
- var _candidate$product_id, _candidate$metadata$u, _candidate$metadata;
44
- if (String((_candidate$product_id = candidate.product_id) !== null && _candidate$product_id !== void 0 ? _candidate$product_id : "") !== productId) return false;
45
- if (!hasRequestedWeight(candidate, requestedWeightKg)) return false;
46
- if (uniqueId == null || uniqueId === "") return true;
47
- return String((_candidate$metadata$u = (_candidate$metadata = candidate.metadata) === null || _candidate$metadata === void 0 ? void 0 : _candidate$metadata.unique_identification_number) !== null && _candidate$metadata$u !== void 0 ? _candidate$metadata$u : "") === String(uniqueId);
48
- });
49
- }
50
- function projectConfirmedMutationLine(product) {
51
- var _projectBigSaleCartLi;
52
- return product ? (_projectBigSaleCartLi = require_projection.projectBigSaleCartLine(product)) !== null && _projectBigSaleCartLi !== void 0 ? _projectBigSaleCartLi : void 0 : void 0;
53
- }
54
- function projectConfirmedCartLineById(products, lineId) {
55
- return projectConfirmedMutationLine(products.find((candidate) => require_projection.resolveBigSaleLineId(candidate) === lineId));
56
- }
57
- function projectConfirmedCustomer(customer) {
58
- var _customer$id;
59
- if (!customer || [
60
- "0",
61
- "1",
62
- ""
63
- ].includes(String((_customer$id = customer.id) !== null && _customer$id !== void 0 ? _customer$id : ""))) return;
64
- return Object.freeze(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({
65
- customerId: String(customer.id),
66
- displayName: typeof customer.name === "string" ? customer.name : void 0
67
- }, typeof customer.avatar === "string" && customer.avatar.trim() ? { avatarUrl: customer.avatar.trim() } : {}), {}, { member: true }));
68
- }
69
- function findOrderProduct(context, product) {
70
- var _product$_identity, _context$sales$tempOr, _products$find;
71
- const uniqueId = ((_product$_identity = product._identity) !== null && _product$_identity !== void 0 ? _product$_identity : require_identity.pickIdentity(product)).unique_identification_number;
72
- return (_products$find = (((_context$sales$tempOr = context.sales.tempOrder) === null || _context$sales$tempOr === void 0 ? void 0 : _context$sales$tempOr.products) || []).find((candidate) => {
73
- var _candidate$metadata$u2, _candidate$metadata2;
74
- return uniqueId != null && String((_candidate$metadata$u2 = (_candidate$metadata2 = candidate.metadata) === null || _candidate$metadata2 === void 0 ? void 0 : _candidate$metadata2.unique_identification_number) !== null && _candidate$metadata$u2 !== void 0 ? _candidate$metadata$u2 : "") === String(uniqueId);
75
- })) !== null && _products$find !== void 0 ? _products$find : product;
76
- }
77
- function findCatalogProduct(context, productId) {
78
- return context.products.products.find((product) => String(product.id) === productId);
79
- }
80
- function resolveProductQuery(context) {
81
- var _bookingTicket$store;
82
- if (typeof context.products.queryProducts === "function") return function() {
83
- var _ref = require_asyncToGenerator._asyncToGenerator(function* (params) {
84
- return (yield context.products.queryProducts.call(context.products, params)) || [];
85
- });
86
- return function(_x) {
87
- return _ref.apply(this, arguments);
88
- };
89
- }();
90
- const bookingTicket = context.sales.bookingTicket;
91
- if (typeof (bookingTicket === null || bookingTicket === void 0 ? void 0 : bookingTicket.queryProducts) === "function") return function() {
92
- var _ref2 = require_asyncToGenerator._asyncToGenerator(function* (params) {
93
- return (yield bookingTicket.queryProducts(params)) || [];
94
- });
95
- return function(_x2) {
96
- return _ref2.apply(this, arguments);
97
- };
98
- }();
99
- const productListStore = bookingTicket === null || bookingTicket === void 0 || (_bookingTicket$store = bookingTicket.store) === null || _bookingTicket$store === void 0 ? void 0 : _bookingTicket$store.products;
100
- if (typeof (productListStore === null || productListStore === void 0 ? void 0 : productListStore.queryProducts) === "function") return function() {
101
- var _ref3 = require_asyncToGenerator._asyncToGenerator(function* (params) {
102
- return (yield productListStore.queryProducts.call(productListStore, params)) || [];
103
- });
104
- return function(_x3) {
105
- return _ref3.apply(this, arguments);
106
- };
107
- }();
108
- }
109
- function queryPrimaryProduct(_x4, _x5, _x6) {
110
- return _queryPrimaryProduct.apply(this, arguments);
111
- }
112
- function _queryPrimaryProduct() {
113
- _queryPrimaryProduct = require_asyncToGenerator._asyncToGenerator(function* (context, productId, signal) {
114
- if (signal.aborted) return { status: "cancelled" };
115
- const queryProducts = resolveProductQuery(context);
116
- if (typeof queryProducts !== "function") return require_normalize.failed("primaryProductQueryUnavailable", "staff");
117
- try {
118
- let products = yield queryProducts({ includeIds: [productId] });
119
- if (signal.aborted) return { status: "cancelled" };
120
- let product = products.find((candidate) => String(candidate.id) === productId);
121
- const numericProductId = Number(productId);
122
- if (!product && Number.isSafeInteger(numericProductId) && numericProductId > 0 && typeof context.products.findByIds === "function") {
123
- yield context.products.findByIds([numericProductId], {
124
- loadMissing: true,
125
- refreshCatalog: false
126
- });
127
- if (signal.aborted) return { status: "cancelled" };
128
- products = yield queryProducts({ includeIds: [productId] });
129
- if (signal.aborted) return { status: "cancelled" };
130
- product = products.find((candidate) => String(candidate.id) === productId);
131
- }
132
- return product ? {
133
- status: "succeeded",
134
- data: product
135
- } : require_normalize.failed("primaryProductNotFound", "staff");
136
- } catch (error) {
137
- return require_normalize.partialFailure("primaryProductQueryFailed", error);
138
- }
139
- });
140
- return _queryPrimaryProduct.apply(this, arguments);
141
- }
142
- function readProductName(product) {
143
- const rawName = product.title;
144
- if (typeof rawName === "string") return rawName || void 0;
145
- if (!rawName || typeof rawName !== "object") return void 0;
146
- return Object.values(rawName).find((value) => typeof value === "string" && value.length > 0);
147
- }
148
- function readLocalizedText(value) {
149
- if (typeof value === "string") return value || void 0;
150
- if (!value || typeof value !== "object") return void 0;
151
- return Object.values(value).find((item) => typeof item === "string" && item.length > 0);
152
- }
153
- function projectProductCategories(product) {
154
- const directCategories = Array.isArray(product.category) ? product.category : [];
155
- const categories = /* @__PURE__ */ new Map();
156
- const visit = (category, direct) => {
157
- var _category$name, _ref4, _category$parent_id;
158
- if (!category || category.id === void 0 || category.id === null) return;
159
- const parent = category.parent_category;
160
- visit(parent, false);
161
- const categoryId = String(category.id);
162
- const name = readLocalizedText((_category$name = category.name) !== null && _category$name !== void 0 ? _category$name : category.title);
163
- if (!name) return;
164
- const parentId = (_ref4 = (_category$parent_id = category.parent_id) !== null && _category$parent_id !== void 0 ? _category$parent_id : parent === null || parent === void 0 ? void 0 : parent.id) !== null && _ref4 !== void 0 ? _ref4 : void 0;
165
- const previous = categories.get(categoryId);
166
- categories.set(categoryId, Object.freeze({
167
- categoryId,
168
- name,
169
- parentId: parentId === void 0 || parentId === null || parentId === 0 ? void 0 : String(parentId),
170
- sort: Number.isFinite(Number(category.sort)) ? Number(category.sort) : void 0,
171
- direct: direct || (previous === null || previous === void 0 ? void 0 : previous.direct) === true
172
- }));
173
- };
174
- directCategories.forEach((category) => visit(category, true));
175
- return Object.freeze(Array.from(categories.values()));
176
- }
177
- function projectCatalogProduct(product, currency, currencySymbol) {
178
- var _ref5, _ref6, _product$price, _product$variants, _product$variants2;
179
- const name = readProductName(product);
180
- if (!name) return void 0;
181
- const rawPrice = (_ref5 = (_ref6 = (_product$price = product.price) !== null && _product$price !== void 0 ? _product$price : product.selling_price) !== null && _ref6 !== void 0 ? _ref6 : (_product$variants = product.variants) === null || _product$variants === void 0 || (_product$variants = _product$variants[0]) === null || _product$variants === void 0 ? void 0 : _product$variants.selling_price) !== null && _ref5 !== void 0 ? _ref5 : (_product$variants2 = product.variants) === null || _product$variants2 === void 0 || (_product$variants2 = _product$variants2[0]) === null || _product$variants2 === void 0 ? void 0 : _product$variants2.price;
182
- const pricePresentation = require_pricePresentation.resolveProductPricePresentation(product, rawPrice === void 0 || rawPrice === null ? void 0 : { price: rawPrice });
183
- const categories = projectProductCategories(product);
184
- return Object.freeze(require_objectSpread2._objectSpread2({
185
- productId: String(product.id),
186
- name,
187
- imageUrl: product.cover || void 0,
188
- currency: currency || void 0,
189
- currencySymbol: currencySymbol || void 0,
190
- pricePresentation: pricePresentation ? Object.freeze({
191
- amount: String(pricePresentation.amount),
192
- originalAmount: pricePresentation.originalAmount === void 0 ? void 0 : String(pricePresentation.originalAmount),
193
- qualifier: pricePresentation.qualifier,
194
- unit: pricePresentation.unit,
195
- precision: pricePresentation.precision
196
- }) : void 0,
197
- available: product.status !== "disabled" && product.status !== "sold_out" && product.is_sold_out !== true
198
- }, categories.length ? { categories } : {}));
199
- }
200
- function normalizeCheckoutResult(result, snapshot) {
201
- var _readPath;
202
- const status = require_normalize.isRecord(result) ? result.status : void 0;
203
- const reason = require_normalize.isRecord(result) ? result.reason : void 0;
204
- const type = require_normalize.isRecord(result) ? result.type : void 0;
205
- if (status === "cancelled" || reason === "back" || reason === "cancel") return {
206
- status: "cancelled",
207
- reason: String(reason !== null && reason !== void 0 ? reason : "cancelled")
208
- };
209
- const paymentStatus = (_readPath = require_normalize.readPath(result, [
210
- "payload",
211
- "paymentResult",
212
- "paymentResultViewModel",
213
- "status"
214
- ])) !== null && _readPath !== void 0 ? _readPath : require_normalize.readPath(result, [
215
- "data",
216
- "paymentResult",
217
- "paymentResultViewModel",
218
- "status"
219
- ]);
220
- if (paymentStatus === "failed" || paymentStatus === "wallet-pass-failed") return require_normalize.failed("checkoutFailed", "retry");
221
- if (type === "error" || status === "failed") return require_normalize.failed("checkoutFailed", "retry");
222
- if (paymentStatus === "success" || paymentStatus === "paid" || paymentStatus === "deposit-paid" || status === "success" || status === "paid") {
223
- var _result$orderId, _snapshot$orderId, _snapshot$customer;
224
- const resultOrderId = require_normalize.isRecord(result) && ((_result$orderId = result.orderId) !== null && _result$orderId !== void 0 ? _result$orderId : result.order_id) || require_normalize.readPath(result, ["payload", "order_id"]) || require_normalize.readPath(result, ["payload", "orderId"]);
225
- const orderId = (_snapshot$orderId = snapshot.orderId) !== null && _snapshot$orderId !== void 0 ? _snapshot$orderId : resultOrderId;
226
- if (!orderId || snapshot.summary.status !== "ready") return require_normalize.unknown("checkoutSuccessMissingOrderFacts");
227
- return {
228
- status: "succeeded",
229
- data: {
230
- orderId: String(orderId),
231
- amount: snapshot.summary.due,
232
- member: ((_snapshot$customer = snapshot.customer) === null || _snapshot$customer === void 0 ? void 0 : _snapshot$customer.member) === true
233
- }
234
- };
235
- }
236
- return require_normalize.unknown("checkoutResultAmbiguous");
237
- }
238
- function refreshCheckoutOrderProjection(_x7, _x8, _x9) {
239
- return _refreshCheckoutOrderProjection.apply(this, arguments);
240
- }
241
- function _refreshCheckoutOrderProjection() {
242
- _refreshCheckoutOrderProjection = require_asyncToGenerator._asyncToGenerator(function* (getContext, getSnapshot, result) {
243
- if (result.status !== "succeeded" || getSnapshot().pickupNumber) return;
244
- const loadDetail = getContext().sales.loadDetail;
245
- if (typeof loadDetail !== "function") return;
246
- try {
247
- yield loadDetail({
248
- orderId: result.data.orderId,
249
- forceRemote: true
250
- });
251
- } catch (_unused) {}
252
- });
253
- return _refreshCheckoutOrderProjection.apply(this, arguments);
254
- }
255
- function createBigSaleSalesPort({ getContext, getSnapshot, executeScan, writeFulfillment, getWriteFulfillment, getAuthenticatedCustomer, allowSimulatedFulfillment = false, onSimulatedFulfillment, subscribeProjection, getPaymentController }) {
256
- return {
257
- getObservedSnapshot: getSnapshot,
258
- getCatalogSnapshot: () => {
259
- var _context$sales$tempOr2, _context$sales$tempOr3, _context$sales$tempOr4, _context$sales$tempOr5;
260
- const context = getContext();
261
- const currency = String((_context$sales$tempOr2 = (_context$sales$tempOr3 = context.sales.tempOrder) === null || _context$sales$tempOr3 === void 0 ? void 0 : _context$sales$tempOr3.currency_code) !== null && _context$sales$tempOr2 !== void 0 ? _context$sales$tempOr2 : "");
262
- const currencySymbol = String((_context$sales$tempOr4 = (_context$sales$tempOr5 = context.sales.tempOrder) === null || _context$sales$tempOr5 === void 0 ? void 0 : _context$sales$tempOr5.currency_symbol) !== null && _context$sales$tempOr4 !== void 0 ? _context$sales$tempOr4 : "");
263
- const products = context.products.products.map((product) => projectCatalogProduct(product, currency, currencySymbol)).filter((product) => product !== void 0);
264
- return Object.freeze({
265
- status: context.products.error ? "error" : context.products.loading || context.sales.catalogState === "pending" ? "loading" : "ready",
266
- products: Object.freeze(products)
267
- });
268
- },
269
- subscribe: (listener) => {
270
- var _subscribeProjection;
271
- return (_subscribeProjection = subscribeProjection === null || subscribeProjection === void 0 ? void 0 : subscribeProjection(listener)) !== null && _subscribeProjection !== void 0 ? _subscribeProjection : (() => void 0);
272
- },
273
- ensureSession: function() {
274
- var _ref7 = require_asyncToGenerator._asyncToGenerator(function* (signal) {
275
- if (signal.aborted) return { status: "cancelled" };
276
- const context = getContext();
277
- if (context.sales.tempOrder) return {
278
- status: "succeeded",
279
- data: void 0
280
- };
281
- try {
282
- yield context.sales.createNew();
283
- if (signal.aborted) return require_normalize.unknown("ensureSessionAbortedAfterDispatch");
284
- return {
285
- status: "succeeded",
286
- data: void 0
287
- };
288
- } catch (error) {
289
- return require_normalize.partialFailure("ensureSessionFailed", error);
290
- }
291
- });
292
- return function ensureSession(_x10) {
293
- return _ref7.apply(this, arguments);
294
- };
295
- }(),
296
- loadPrimaryProduct: function() {
297
- var _ref8 = require_asyncToGenerator._asyncToGenerator(function* (rawProductId, signal) {
298
- if (signal.aborted) return { status: "cancelled" };
299
- const productId = Number(rawProductId);
300
- if (!Number.isFinite(productId)) return require_normalize.failed("primaryProductIdInvalid", "staff");
301
- try {
302
- const productResult = yield queryPrimaryProduct(getContext(), String(productId), signal);
303
- if (productResult.status !== "succeeded") return productResult;
304
- return {
305
- status: "succeeded",
306
- data: productResult.data
307
- };
308
- } catch (error) {
309
- return require_normalize.partialFailure("primaryProductLoadFailed", error);
310
- }
311
- });
312
- return function loadPrimaryProduct(_x11, _x12) {
313
- return _ref8.apply(this, arguments);
314
- };
315
- }(),
316
- selectIdentity: function() {
317
- var _ref9 = require_asyncToGenerator._asyncToGenerator(function* (input, signal) {
318
- if (signal.aborted) return { status: "cancelled" };
319
- try {
320
- var _input$customerId, _currentCustomer$id, _selected$id;
321
- const context = getContext();
322
- const customerId = (_input$customerId = input.customerId) === null || _input$customerId === void 0 ? void 0 : _input$customerId.trim();
323
- if (!customerId) {
324
- context.customer.select(null);
325
- if (signal.aborted) return require_normalize.unknown("identityAbortedAfterDispatch");
326
- return {
327
- status: "succeeded",
328
- data: {}
329
- };
330
- }
331
- const authenticatedCustomer = getAuthenticatedCustomer === null || getAuthenticatedCustomer === void 0 ? void 0 : getAuthenticatedCustomer(customerId);
332
- const currentCustomer = context.customer.selected;
333
- const selected = authenticatedCustomer !== null && authenticatedCustomer !== void 0 ? authenticatedCustomer : String((_currentCustomer$id = currentCustomer === null || currentCustomer === void 0 ? void 0 : currentCustomer.id) !== null && _currentCustomer$id !== void 0 ? _currentCustomer$id : "") === customerId ? currentCustomer : void 0;
334
- if (!selected || String(selected.id) !== customerId || [
335
- "0",
336
- "1",
337
- ""
338
- ].includes(String((_selected$id = selected.id) !== null && _selected$id !== void 0 ? _selected$id : ""))) return require_normalize.failed("authenticatedCustomerUnavailable", "back");
339
- context.customer.select(selected);
340
- if (signal.aborted) return require_normalize.unknown("identityAbortedAfterDispatch");
341
- return {
342
- status: "succeeded",
343
- data: { customer: projectConfirmedCustomer(selected) }
344
- };
345
- } catch (error) {
346
- return require_normalize.partialFailure("identitySelectionFailed", error);
347
- }
348
- });
349
- return function selectIdentity(_x13, _x14) {
350
- return _ref9.apply(this, arguments);
351
- };
352
- }(),
353
- setFulfillment: function() {
354
- var _ref10 = require_asyncToGenerator._asyncToGenerator(function* (input, signal) {
355
- if (signal.aborted) return { status: "cancelled" };
356
- const currentWriteFulfillment = getWriteFulfillment ? getWriteFulfillment() : writeFulfillment;
357
- if (!currentWriteFulfillment) {
358
- if (allowSimulatedFulfillment) {
359
- onSimulatedFulfillment === null || onSimulatedFulfillment === void 0 || onSimulatedFulfillment(input);
360
- return {
361
- status: "succeeded",
362
- data: void 0
363
- };
364
- }
365
- return require_normalize.failed("fulfillmentHostWriterUnavailable", "staff");
366
- }
367
- try {
368
- return yield currentWriteFulfillment(input, signal);
369
- } catch (error) {
370
- return require_normalize.partialFailure("fulfillmentWriteFailed", error);
371
- }
372
- });
373
- return function setFulfillment(_x15, _x16) {
374
- return _ref10.apply(this, arguments);
375
- };
376
- }(),
377
- syncPrimaryWeightedProduct: function() {
378
- var _ref12 = require_asyncToGenerator._asyncToGenerator(function* (input, signal) {
379
- if (signal.aborted) return { status: "cancelled" };
380
- const productId = Number(input.productId);
381
- if (!Number.isFinite(productId)) return require_normalize.failed("primaryWeightedProductInputInvalid", "staff");
382
- try {
383
- const context = getContext();
384
- const productResult = yield queryPrimaryProduct(context, String(productId), signal);
385
- if (productResult.status !== "succeeded") return productResult;
386
- const product = productResult.data;
387
- const resolved = require_product.resolveHDLWeightedProduct(product);
388
- if (!resolved) return require_normalize.failed("primaryWeightedProductConfigInvalid", "staff");
389
- const prepared = require_customizationProduct.createHDLPrimaryWeightedPreparedProduct(resolved, input);
390
- if (!prepared) return require_normalize.failed("primaryWeightedProductSelectionInvalid", "retry");
391
- if (input.existingLineId) {
392
- var _cartProduct$_identit, _identity$product_var, _ref11, _productPatch$product;
393
- const displayLine = findCartLine(context, input.existingLineId);
394
- const cartProduct = displayLine ? resolveCartProduct(displayLine) : void 0;
395
- const bookingTicket = context.sales.bookingTicket;
396
- if (!cartProduct) return require_normalize.failed("primaryWeightedProductLineNotFound", "back");
397
- if (typeof context.cart.updateItem !== "function" || typeof (bookingTicket === null || bookingTicket === void 0 ? void 0 : bookingTicket.transformDetailToProductAndBooking) !== "function") return require_normalize.failed("primaryWeightedProductUpdateUnavailable", "staff");
398
- const orderLine = findOrderProduct(context, cartProduct);
399
- const identity = (_cartProduct$_identit = cartProduct._identity) !== null && _cartProduct$_identit !== void 0 ? _cartProduct$_identit : require_identity.pickIdentity(orderLine);
400
- const preparedForUpdate = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, prepared), {}, { _extend: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, prepared._extend || {}), identity.unique_identification_number != null ? { unique_identification_number: identity.unique_identification_number } : {}) });
401
- const transformed = bookingTicket.transformDetailToProductAndBooking({
402
- item: resolved.product,
403
- cacheItem: preparedForUpdate
404
- });
405
- const productPatch = transformed === null || transformed === void 0 ? void 0 : transformed.product;
406
- if (!productPatch) return require_normalize.failed("primaryWeightedProductUpdateInvalid", "retry");
407
- const patchVariantId = Number(productPatch.product_variant_id);
408
- const nextVariantId = Number.isFinite(patchVariantId) && patchVariantId > 0 ? patchVariantId : Number((_identity$product_var = identity.product_variant_id) !== null && _identity$product_var !== void 0 ? _identity$product_var : 0);
409
- const nextOptions = require_productSkuOptions.resolvePatchProductOptions(orderLine, productPatch);
410
- const lineUpdates = require_buildProductLineUpdates.buildProductLineUpdates(orderLine, productPatch);
411
- lineUpdates.metadata = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, lineUpdates.metadata || {}), identity.unique_identification_number != null ? { unique_identification_number: identity.unique_identification_number } : {});
412
- const updatedProducts = yield context.cart.updateItem({
413
- product_id: identity.product_id,
414
- product_variant_id: nextVariantId,
415
- unique_identification_number: identity.unique_identification_number,
416
- identity_key: identity.identity_key,
417
- product_sku: require_productSkuOptions.buildProductSkuPatch(orderLine, nextOptions, productPatch.product_sku),
418
- product_option_item: nextOptions,
419
- product_bundle: (_ref11 = (_productPatch$product = productPatch.product_bundle) !== null && _productPatch$product !== void 0 ? _productPatch$product : identity.product_bundle) !== null && _ref11 !== void 0 ? _ref11 : [],
420
- updates: lineUpdates
421
- });
422
- if (signal.aborted) return require_normalize.unknown("primaryProductUpdateAbortedAfterDispatch");
423
- const confirmedLine = projectConfirmedMutationLine(findConfirmedMutationLine(updatedProducts, input.productId, input.measurement.netWeightKg, identity.unique_identification_number));
424
- return {
425
- status: "succeeded",
426
- data: require_objectSpread2._objectSpread2({ affectedLineId: input.existingLineId }, confirmedLine ? { confirmedLine } : {})
427
- };
428
- }
429
- const result = yield context.cart.addProductWithFlow(product, {
430
- quantity: 1,
431
- debounceMs: 0,
432
- notShowToast: true,
433
- preparedCacheItem: prepared
434
- });
435
- if (signal.aborted) return require_normalize.unknown("primaryProductAddAbortedAfterDispatch");
436
- if (result.status === "cancelled") return cancelled("userCancelled");
437
- if (result.status !== "added") return require_normalize.unknown("primaryProductAddAmbiguous");
438
- const confirmedLine = projectConfirmedMutationLine(findConfirmedMutationLine(result.products, input.productId, input.measurement.netWeightKg));
439
- return {
440
- status: "succeeded",
441
- data: confirmedLine ? {
442
- affectedLineId: confirmedLine.lineId,
443
- confirmedLine
444
- } : {}
445
- };
446
- } catch (error) {
447
- return require_normalize.partialFailure("primaryWeightedProductSyncFailed", error);
448
- }
449
- });
450
- return function syncPrimaryWeightedProduct(_x17, _x18) {
451
- return _ref12.apply(this, arguments);
452
- };
453
- }(),
454
- consumeBarcode: function() {
455
- var _ref13 = require_asyncToGenerator._asyncToGenerator(function* (code, signal) {
456
- if (signal.aborted) return { status: "cancelled" };
457
- if (!code.trim()) return require_normalize.failed("barcodeEmpty", "back");
458
- try {
459
- var _scanResult$meta$coun, _scanResult$meta;
460
- const execution = yield executeScan(code);
461
- if (signal.aborted) return require_normalize.unknown("barcodeAbortedAfterDispatch");
462
- const scanResult = execution.scanResult;
463
- if (!scanResult) return require_normalize.failed("barcodeUnavailable", "staff");
464
- if (scanResult.status === "cancelled") return {
465
- status: "cancelled",
466
- reason: scanResult.reason
467
- };
468
- if (scanResult.status === "failed") return require_normalize.failed("barcodeNotResolved", "retry");
469
- return {
470
- status: "succeeded",
471
- data: {
472
- code: scanResult.status === "pending" ? "requiresSelection" : "added",
473
- cartChangeConfirmed: scanResult.status === "success" && Number((_scanResult$meta$coun = (_scanResult$meta = scanResult.meta) === null || _scanResult$meta === void 0 ? void 0 : _scanResult$meta.count) !== null && _scanResult$meta$coun !== void 0 ? _scanResult$meta$coun : 0) > 0
474
- }
475
- };
476
- } catch (error) {
477
- return require_normalize.partialFailure("barcodeDispatchFailed", error);
478
- }
479
- });
480
- return function consumeBarcode(_x19, _x20) {
481
- return _ref13.apply(this, arguments);
482
- };
483
- }(),
484
- addProduct: function() {
485
- var _ref14 = require_asyncToGenerator._asyncToGenerator(function* (input, signal) {
486
- if (signal.aborted) return { status: "cancelled" };
487
- const productId = Number(input.productId);
488
- const quantity = Number(input.quantity);
489
- if (!Number.isFinite(productId) || !Number.isFinite(quantity) || quantity <= 0) return require_normalize.failed("productInputInvalid", "back");
490
- try {
491
- const context = getContext();
492
- const product = findCatalogProduct(context, String(productId));
493
- if (!product) return require_normalize.failed("productNotFound", "back");
494
- const result = yield context.cart.addProductWithFlow(product, {
495
- quantity,
496
- notShowToast: true
497
- });
498
- if (signal.aborted) return require_normalize.unknown("addProductAbortedAfterDispatch");
499
- if (result.status === "cancelled") return cancelled("userCancelled");
500
- if (result.status !== "added") return require_normalize.failed("productRequiresUnsupportedSelection", "back");
501
- const confirmedLine = projectConfirmedMutationLine([...Array.isArray(result.products) ? result.products : []].reverse().find((candidate) => {
502
- var _candidate$product_id2;
503
- return String((_candidate$product_id2 = candidate.product_id) !== null && _candidate$product_id2 !== void 0 ? _candidate$product_id2 : "") === input.productId;
504
- }));
505
- return {
506
- status: "succeeded",
507
- data: confirmedLine ? {
508
- affectedLineId: confirmedLine.lineId,
509
- confirmedLine
510
- } : {}
511
- };
512
- } catch (error) {
513
- return require_normalize.partialFailure("addProductFailed", error);
514
- }
515
- });
516
- return function addProduct(_x21, _x22) {
517
- return _ref14.apply(this, arguments);
518
- };
519
- }(),
520
- updateQuantity: function() {
521
- var _ref15 = require_asyncToGenerator._asyncToGenerator(function* (input, signal) {
522
- if (signal.aborted) return { status: "cancelled" };
523
- const quantity = Number(input.quantity);
524
- if (!Number.isFinite(quantity) || quantity <= 0) return require_normalize.failed("quantityInvalid", "back");
525
- const context = getContext();
526
- const line = findCartLine(context, input.lineId);
527
- if (!line) return require_normalize.failed("cartLineNotFound", "back");
528
- try {
529
- const updatedProducts = yield context.cart.updateItemQuantity(line, quantity);
530
- if (signal.aborted) return require_normalize.unknown("updateQuantityAbortedAfterDispatch");
531
- const confirmedLine = projectConfirmedCartLineById(Array.isArray(updatedProducts) ? updatedProducts : [], input.lineId);
532
- return {
533
- status: "succeeded",
534
- data: require_objectSpread2._objectSpread2({ affectedLineId: input.lineId }, confirmedLine ? { confirmedLine } : {})
535
- };
536
- } catch (error) {
537
- return require_normalize.partialFailure("updateQuantityFailed", error);
538
- }
539
- });
540
- return function updateQuantity(_x23, _x24) {
541
- return _ref15.apply(this, arguments);
542
- };
543
- }(),
544
- removeLine: function() {
545
- var _ref16 = require_asyncToGenerator._asyncToGenerator(function* (input, signal) {
546
- if (signal.aborted) return { status: "cancelled" };
547
- const context = getContext();
548
- const line = findCartLine(context, input.lineId);
549
- if (!line) return require_normalize.failed("cartLineNotFound", "back");
550
- try {
551
- const remainingProducts = yield context.cart.removeItem(line);
552
- if (signal.aborted) return require_normalize.unknown("removeLineAbortedAfterDispatch");
553
- return {
554
- status: "succeeded",
555
- data: require_objectSpread2._objectSpread2({ affectedLineId: input.lineId }, Array.isArray(remainingProducts) && !remainingProducts.some((candidate) => require_projection.resolveBigSaleLineId(candidate) === input.lineId) ? { removedLineId: input.lineId } : {})
556
- };
557
- } catch (error) {
558
- return require_normalize.partialFailure("removeLineFailed", error);
559
- }
560
- });
561
- return function removeLine(_x25, _x26) {
562
- return _ref16.apply(this, arguments);
563
- };
564
- }(),
565
- waitForCartConsistency: function() {
566
- var _ref17 = require_asyncToGenerator._asyncToGenerator(function* (signal) {
567
- if (signal.aborted) return { status: "cancelled" };
568
- try {
569
- yield getContext().cart.waitForCartConsistency();
570
- if (signal.aborted) return require_normalize.unknown("consistencyAbortedAfterWait");
571
- return {
572
- status: "succeeded",
573
- data: { observationId: getSnapshot().observationId }
574
- };
575
- } catch (error) {
576
- return require_normalize.failed("cartConsistencyFailed", "retry", error);
577
- }
578
- });
579
- return function waitForCartConsistency(_x27) {
580
- return _ref17.apply(this, arguments);
581
- };
582
- }(),
583
- recalculateSummary: function() {
584
- var _ref18 = require_asyncToGenerator._asyncToGenerator(function* (signal) {
585
- if (signal.aborted) return { status: "cancelled" };
586
- try {
587
- var _getContext$sales$tem, _getContext$sales$tem2, _getContext$sales$tem3, _getContext$sales$tem4;
588
- const summary = yield getContext().cart.recalcSummary();
589
- if (signal.aborted) return require_normalize.unknown("summaryAbortedAfterDispatch");
590
- if (!summary) return require_normalize.failed("summaryMissing", "retry");
591
- return {
592
- status: "succeeded",
593
- data: {
594
- observationId: getSnapshot().observationId,
595
- confirmedSummary: {
596
- status: "ready",
597
- currency: String((_getContext$sales$tem = (_getContext$sales$tem2 = getContext().sales.tempOrder) === null || _getContext$sales$tem2 === void 0 ? void 0 : _getContext$sales$tem2.currency_code) !== null && _getContext$sales$tem !== void 0 ? _getContext$sales$tem : ""),
598
- currencySymbol: String((_getContext$sales$tem3 = (_getContext$sales$tem4 = getContext().sales.tempOrder) === null || _getContext$sales$tem4 === void 0 ? void 0 : _getContext$sales$tem4.currency_symbol) !== null && _getContext$sales$tem3 !== void 0 ? _getContext$sales$tem3 : ""),
599
- total: String(summary.total_amount),
600
- due: String(summary.expect_amount)
601
- }
602
- }
603
- };
604
- } catch (error) {
605
- return require_normalize.failed("summaryRecalculationFailed", "retry", error);
606
- }
607
- });
608
- return function recalculateSummary(_x28) {
609
- return _ref18.apply(this, arguments);
610
- };
611
- }(),
612
- loadPaymentMethods: function() {
613
- var _ref19 = require_asyncToGenerator._asyncToGenerator(function* (signal) {
614
- if (signal.aborted) return cancelled("paymentMethodsAborted");
615
- const controller = getPaymentController === null || getPaymentController === void 0 ? void 0 : getPaymentController();
616
- if (!controller) return require_normalize.failed("paymentRuntimeUnavailable", "staff");
617
- return controller.loadPaymentMethods();
618
- });
619
- return function loadPaymentMethods(_x29) {
620
- return _ref19.apply(this, arguments);
621
- };
622
- }(),
623
- payEftpos: function() {
624
- var _ref20 = require_asyncToGenerator._asyncToGenerator(function* (input, signal) {
625
- if (signal.aborted) return cancelled("eftposAborted");
626
- const controller = getPaymentController === null || getPaymentController === void 0 ? void 0 : getPaymentController();
627
- if (!controller) return require_normalize.failed("paymentRuntimeUnavailable", "staff");
628
- return controller.payEftpos(input);
629
- });
630
- return function payEftpos(_x30, _x31) {
631
- return _ref20.apply(this, arguments);
632
- };
633
- }(),
634
- requestStaffPaymentApproval: function() {
635
- var _ref21 = require_asyncToGenerator._asyncToGenerator(function* (input, signal) {
636
- if (signal.aborted) return cancelled("staffPaymentApprovalAborted");
637
- const controller = getPaymentController === null || getPaymentController === void 0 ? void 0 : getPaymentController();
638
- if (!controller) return require_normalize.failed("paymentRuntimeUnavailable", "staff");
639
- return controller.requestStaffPaymentApproval(input);
640
- });
641
- return function requestStaffPaymentApproval(_x32, _x33) {
642
- return _ref21.apply(this, arguments);
643
- };
644
- }(),
645
- subscribeStaffPaymentAuthorizationResult: (listener) => {
646
- var _controller$subscribe;
647
- const controller = getPaymentController === null || getPaymentController === void 0 ? void 0 : getPaymentController();
648
- return (_controller$subscribe = controller === null || controller === void 0 ? void 0 : controller.subscribeStaffPaymentAuthorizationResult(listener)) !== null && _controller$subscribe !== void 0 ? _controller$subscribe : (() => void 0);
649
- },
650
- openCheckout: function() {
651
- var _ref22 = require_asyncToGenerator._asyncToGenerator(function* (signal) {
652
- if (signal.aborted) return { status: "cancelled" };
653
- try {
654
- const snapshotBeforeCheckout = getSnapshot();
655
- const result = yield getContext().sales.openCheckout({
656
- paymentResultDisplayMode: "page",
657
- walletPassMode: "shared"
658
- });
659
- if (signal.aborted) return require_normalize.unknown("checkoutAbortedAfterDispatch");
660
- const checkoutResult = normalizeCheckoutResult(result, snapshotBeforeCheckout);
661
- yield refreshCheckoutOrderProjection(getContext, getSnapshot, checkoutResult);
662
- return checkoutResult;
663
- } catch (error) {
664
- return require_normalize.unknown("checkoutInvocationFailed", error);
665
- }
666
- });
667
- return function openCheckout(_x34) {
668
- return _ref22.apply(this, arguments);
669
- };
670
- }(),
671
- clearAndReset: function() {
672
- var _ref23 = require_asyncToGenerator._asyncToGenerator(function* (signal) {
673
- if (signal.aborted) return { status: "cancelled" };
674
- try {
675
- var _resetOrder$products$, _resetOrder$products, _resetOrder$bookings$, _resetOrder$bookings;
676
- const resetOrder = yield getContext().sales.clearCartAndReset();
677
- if (signal.aborted) return require_normalize.unknown("resetAbortedAfterDispatch");
678
- if (!(((_resetOrder$products$ = (_resetOrder$products = resetOrder.products) === null || _resetOrder$products === void 0 ? void 0 : _resetOrder$products.length) !== null && _resetOrder$products$ !== void 0 ? _resetOrder$products$ : 0) === 0 && ((_resetOrder$bookings$ = (_resetOrder$bookings = resetOrder.bookings) === null || _resetOrder$bookings === void 0 ? void 0 : _resetOrder$bookings.length) !== null && _resetOrder$bookings$ !== void 0 ? _resetOrder$bookings$ : 0) === 0)) return require_normalize.unknown("resetHostResultNotEmpty");
679
- return {
680
- status: "succeeded",
681
- data: { cartEmpty: true }
682
- };
683
- } catch (error) {
684
- return require_normalize.partialFailure("resetFailed", error);
685
- }
686
- });
687
- return function clearAndReset(_x35) {
688
- return _ref23.apply(this, arguments);
689
- };
690
- }()
691
- };
692
- }
693
- //#endregion
694
- exports.createBigSaleSalesPort = createBigSaleSalesPort;