@pisell/pisellos 2.2.310 → 2.2.312-vm.0

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 (314) hide show
  1. package/dist/apis/picoding.d.ts.map +1 -0
  2. package/dist/core/index.d.ts.map +1 -0
  3. package/dist/effects/index.d.ts.map +1 -0
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.js +1 -0
  7. package/dist/inventory/index.d.ts +92 -0
  8. package/dist/inventory/index.d.ts.map +1 -0
  9. package/dist/inventory/index.js +509 -0
  10. package/dist/model/index.d.ts.map +1 -0
  11. package/dist/model/strategy/adapter/dataVariant/adapter.d.ts.map +1 -0
  12. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts.map +1 -0
  13. package/dist/model/strategy/adapter/dataVariant/examples.d.ts.map +1 -0
  14. package/dist/model/strategy/adapter/dataVariant/index.d.ts.map +1 -0
  15. package/dist/model/strategy/adapter/dataVariant/type.d.ts.map +1 -0
  16. package/dist/model/strategy/adapter/index.d.ts.map +1 -0
  17. package/dist/model/strategy/adapter/itemRule/adapter.d.ts.map +1 -0
  18. package/dist/model/strategy/adapter/itemRule/evaluator.d.ts.map +1 -0
  19. package/dist/model/strategy/adapter/itemRule/examples.d.ts.map +1 -0
  20. package/dist/model/strategy/adapter/itemRule/index.d.ts.map +1 -0
  21. package/dist/model/strategy/adapter/itemRule/type.d.ts.map +1 -0
  22. package/dist/model/strategy/adapter/promotion/adapter.d.ts.map +1 -0
  23. package/dist/model/strategy/adapter/promotion/evaluator.d.ts.map +1 -0
  24. package/dist/model/strategy/adapter/promotion/examples.d.ts.map +1 -0
  25. package/dist/model/strategy/adapter/promotion/index.d.ts.map +1 -0
  26. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  27. package/dist/model/strategy/adapter/promotion/type.d.ts.map +1 -0
  28. package/dist/model/strategy/adapter/type.d.ts.map +1 -0
  29. package/dist/model/strategy/adapter/walletPass/evaluator.d.ts.map +1 -0
  30. package/dist/model/strategy/adapter/walletPass/example.d.ts.map +1 -0
  31. package/dist/model/strategy/adapter/walletPass/index.d.ts.map +1 -0
  32. package/dist/model/strategy/adapter/walletPass/locales.d.ts.map +1 -0
  33. package/dist/model/strategy/adapter/walletPass/type.d.ts.map +1 -0
  34. package/dist/model/strategy/adapter/walletPass/utils.d.ts.map +1 -0
  35. package/dist/model/strategy/engine.d.ts.map +1 -0
  36. package/dist/model/strategy/index.d.ts.map +1 -0
  37. package/dist/model/strategy/strategy-example.d.ts.map +1 -0
  38. package/dist/model/strategy/type.d.ts.map +1 -0
  39. package/dist/modules/Account/index.d.ts.map +1 -0
  40. package/dist/modules/Account/types.d.ts.map +1 -0
  41. package/dist/modules/AccountList/index.d.ts.map +1 -0
  42. package/dist/modules/AccountList/types.d.ts.map +1 -0
  43. package/dist/modules/AccountList/utils.d.ts.map +1 -0
  44. package/dist/modules/BaseModule.d.ts.map +1 -0
  45. package/dist/modules/BookingContext/index.d.ts.map +1 -0
  46. package/dist/modules/BookingContext/types.d.ts.map +1 -0
  47. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts.map +1 -0
  48. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts.map +1 -0
  49. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts.map +1 -0
  50. package/dist/modules/BookingContext/utils/flexible.d.ts.map +1 -0
  51. package/dist/modules/BookingContext/utils/formatResourceList.d.ts.map +1 -0
  52. package/dist/modules/BookingContext/utils/index.d.ts.map +1 -0
  53. package/dist/modules/BookingContext/utils/noResource.d.ts.map +1 -0
  54. package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts.map +1 -0
  55. package/dist/modules/BookingContext/utils/productExtend.d.ts.map +1 -0
  56. package/dist/modules/BookingContext/utils/resourceErrors.d.ts.map +1 -0
  57. package/dist/modules/BookingContext/utils/resourceSelection.d.ts.map +1 -0
  58. package/dist/modules/BookingContext/utils/resources.d.ts.map +1 -0
  59. package/dist/modules/BookingContext/utils/serviceTimes.d.ts.map +1 -0
  60. package/dist/modules/BookingContext/utils/timeSlices.d.ts.map +1 -0
  61. package/dist/modules/Cart/index.d.ts.map +1 -0
  62. package/dist/modules/Cart/types.d.ts.map +1 -0
  63. package/dist/modules/Cart/utils/cartAccount.d.ts.map +1 -0
  64. package/dist/modules/Cart/utils/cartDate.d.ts.map +1 -0
  65. package/dist/modules/Cart/utils/cartDiscount.d.ts.map +1 -0
  66. package/dist/modules/Cart/utils/cartNote.d.ts.map +1 -0
  67. package/dist/modules/Cart/utils/cartProduct.d.ts.map +1 -0
  68. package/dist/modules/Cart/utils/cartRelationForms.d.ts.map +1 -0
  69. package/dist/modules/Cart/utils/cartResource.d.ts.map +1 -0
  70. package/dist/modules/Cart/utils/changePrice.d.ts.map +1 -0
  71. package/dist/modules/Cart/utils/index.d.ts.map +1 -0
  72. package/dist/modules/Customer/constants.d.ts.map +1 -0
  73. package/dist/modules/Customer/index.d.ts.map +1 -0
  74. package/dist/modules/Customer/types.d.ts.map +1 -0
  75. package/dist/modules/Date/index.d.ts.map +1 -0
  76. package/dist/modules/Date/types.d.ts.map +1 -0
  77. package/dist/modules/Date/utils.d.ts.map +1 -0
  78. package/dist/modules/Discount/availability.d.ts.map +1 -0
  79. package/dist/modules/Discount/entitlementPass.d.ts.map +1 -0
  80. package/dist/modules/Discount/index.d.ts.map +1 -0
  81. package/dist/modules/Discount/index.js +1 -0
  82. package/dist/modules/Discount/types.d.ts.map +1 -0
  83. package/dist/modules/Guests/index.d.ts.map +1 -0
  84. package/dist/modules/Guests/types.d.ts.map +1 -0
  85. package/dist/modules/Holder/index.d.ts.map +1 -0
  86. package/dist/modules/Holder/types.d.ts.map +1 -0
  87. package/dist/modules/Holder/utils.d.ts.map +1 -0
  88. package/dist/modules/OpenData/index.d.ts.map +1 -0
  89. package/dist/modules/OpenData/types.d.ts.map +1 -0
  90. package/dist/modules/OpenData/utils.d.ts.map +1 -0
  91. package/dist/modules/Order/index.d.ts +25 -3
  92. package/dist/modules/Order/index.d.ts.map +1 -0
  93. package/dist/modules/Order/index.js +1647 -1211
  94. package/dist/modules/Order/payment-utils.d.ts.map +1 -0
  95. package/dist/modules/Order/salesNotes.d.ts.map +1 -0
  96. package/dist/modules/Order/types.d.ts +7 -0
  97. package/dist/modules/Order/types.d.ts.map +1 -0
  98. package/dist/modules/Order/utils/bundleDiscountHydration.d.ts.map +1 -0
  99. package/dist/modules/Order/utils/discountProductLineIdentity.d.ts.map +1 -0
  100. package/dist/modules/Order/utils/discountProductLineIdentity.js +2 -2
  101. package/dist/modules/Order/utils/manualProductDiscount.d.ts.map +1 -0
  102. package/dist/modules/Order/utils/orderCollectionIdentity.d.ts.map +1 -0
  103. package/dist/modules/Order/utils/productVoucherGroups.d.ts +15 -0
  104. package/dist/modules/Order/utils/productVoucherGroups.d.ts.map +1 -0
  105. package/dist/modules/Order/utils/productVoucherGroups.js +115 -0
  106. package/dist/modules/Order/utils/virtualSettlement.d.ts.map +1 -0
  107. package/dist/modules/Order/utils/weighedProduct.d.ts.map +1 -0
  108. package/dist/modules/Order/utils.d.ts +5 -3
  109. package/dist/modules/Order/utils.d.ts.map +1 -0
  110. package/dist/modules/Order/utils.js +32 -11
  111. package/dist/modules/Payment/cash.d.ts.map +1 -0
  112. package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts.map +1 -0
  113. package/dist/modules/Payment/eftpos.d.ts.map +1 -0
  114. package/dist/modules/Payment/index.d.ts.map +1 -0
  115. package/dist/modules/Payment/mx51.d.ts.map +1 -0
  116. package/dist/modules/Payment/types.d.ts.map +1 -0
  117. package/dist/modules/Payment/utils.d.ts.map +1 -0
  118. package/dist/modules/Payment/walletpass.d.ts.map +1 -0
  119. package/dist/modules/Product/index.d.ts.map +1 -0
  120. package/dist/modules/Product/types.d.ts.map +1 -0
  121. package/dist/modules/Product/utils.d.ts.map +1 -0
  122. package/dist/modules/ProductList/clientDataVariants.d.ts.map +1 -0
  123. package/dist/modules/ProductList/index.d.ts.map +1 -0
  124. package/dist/modules/ProductList/index.js +33 -12
  125. package/dist/modules/ProductList/types.d.ts.map +1 -0
  126. package/dist/modules/Quotation/index.d.ts.map +1 -0
  127. package/dist/modules/Quotation/types.d.ts.map +1 -0
  128. package/dist/modules/Resource/index.d.ts.map +1 -0
  129. package/dist/modules/Resource/types.d.ts.map +1 -0
  130. package/dist/modules/Resource/utils.d.ts.map +1 -0
  131. package/dist/modules/ResourcePlanner/index.d.ts.map +1 -0
  132. package/dist/modules/ResourcePlanner/localClock.d.ts.map +1 -0
  133. package/dist/modules/ResourcePlanner/planner.d.ts.map +1 -0
  134. package/dist/modules/ResourcePlanner/types.d.ts.map +1 -0
  135. package/dist/modules/Rules/index.d.ts +2 -0
  136. package/dist/modules/Rules/index.d.ts.map +1 -0
  137. package/dist/modules/Rules/index.js +29 -21
  138. package/dist/modules/Rules/types.d.ts.map +1 -0
  139. package/dist/modules/SalesSummary/index.d.ts.map +1 -0
  140. package/dist/modules/SalesSummary/types.d.ts.map +1 -0
  141. package/dist/modules/SalesSummary/utils.d.ts.map +1 -0
  142. package/dist/modules/ScanOrderLogger/index.d.ts.map +1 -0
  143. package/dist/modules/ScanOrderLogger/providers/feishu.d.ts.map +1 -0
  144. package/dist/modules/ScanOrderLogger/providers/grafana.d.ts.map +1 -0
  145. package/dist/modules/ScanOrderLogger/types.d.ts.map +1 -0
  146. package/dist/modules/Schedule/getDateIsInSchedule.d.ts.map +1 -0
  147. package/dist/modules/Schedule/index.d.ts.map +1 -0
  148. package/dist/modules/Schedule/type.d.ts.map +1 -0
  149. package/dist/modules/Schedule/types.d.ts.map +1 -0
  150. package/dist/modules/Schedule/utils.d.ts.map +1 -0
  151. package/dist/modules/Step/index.d.ts.map +1 -0
  152. package/dist/modules/Step/tyeps.d.ts.map +1 -0
  153. package/dist/modules/Summary/index.d.ts.map +1 -0
  154. package/dist/modules/Summary/types.d.ts.map +1 -0
  155. package/dist/modules/Summary/utils.d.ts.map +1 -0
  156. package/dist/modules/SurchargeList/index.d.ts.map +1 -0
  157. package/dist/modules/SurchargeList/types.d.ts.map +1 -0
  158. package/dist/modules/index.d.ts.map +1 -0
  159. package/dist/plugins/app.d.ts.map +1 -0
  160. package/dist/plugins/index.d.ts.map +1 -0
  161. package/dist/plugins/request.d.ts.map +1 -0
  162. package/dist/plugins/shopStore.d.ts.map +1 -0
  163. package/dist/plugins/user.d.ts.map +1 -0
  164. package/dist/plugins/window.d.ts.map +1 -0
  165. package/dist/server/index.d.ts.map +1 -0
  166. package/dist/server/modules/floor-plan/index.d.ts.map +1 -0
  167. package/dist/server/modules/floor-plan/index.js +34 -3
  168. package/dist/server/modules/floor-plan/types.d.ts.map +1 -0
  169. package/dist/server/modules/index.d.ts.map +1 -0
  170. package/dist/server/modules/menu/index.d.ts.map +1 -0
  171. package/dist/server/modules/menu/types.d.ts.map +1 -0
  172. package/dist/server/modules/order/index.d.ts.map +1 -0
  173. package/dist/server/modules/order/types.d.ts.map +1 -0
  174. package/dist/server/modules/order/utils/filterBookings.d.ts.map +1 -0
  175. package/dist/server/modules/order/utils/filterOrders.d.ts.map +1 -0
  176. package/dist/server/modules/payment/index.d.ts.map +1 -0
  177. package/dist/server/modules/payment/types.d.ts.map +1 -0
  178. package/dist/server/modules/products/index.d.ts.map +1 -0
  179. package/dist/server/modules/products/types.d.ts.map +1 -0
  180. package/dist/server/modules/quotation/index.d.ts.map +1 -0
  181. package/dist/server/modules/quotation/types.d.ts.map +1 -0
  182. package/dist/server/modules/resource/index.d.ts.map +1 -0
  183. package/dist/server/modules/resource/types.d.ts.map +1 -0
  184. package/dist/server/modules/schedule/index.d.ts.map +1 -0
  185. package/dist/server/modules/schedule/types.d.ts.map +1 -0
  186. package/dist/server/modules/schedule/utils.d.ts.map +1 -0
  187. package/dist/server/types.d.ts.map +1 -0
  188. package/dist/server/utils/index.d.ts.map +1 -0
  189. package/dist/server/utils/product.d.ts.map +1 -0
  190. package/dist/server/utils/schedule.d.ts.map +1 -0
  191. package/dist/server/utils/small-ticket.d.ts.map +1 -0
  192. package/dist/server/utils/time.d.ts.map +1 -0
  193. package/dist/solution/BaseSales/index.d.ts +16 -1
  194. package/dist/solution/BaseSales/index.d.ts.map +1 -0
  195. package/dist/solution/BaseSales/index.js +1363 -1176
  196. package/dist/solution/BaseSales/types.d.ts.map +1 -0
  197. package/dist/solution/BaseSales/utils/cartPromotion.d.ts.map +1 -0
  198. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts.map +1 -0
  199. package/dist/solution/BaseSales/utils/quotationPrice.d.ts.map +1 -0
  200. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts.map +1 -0
  201. package/dist/solution/BaseSales/utils.d.ts.map +1 -0
  202. package/dist/solution/BookingByStep/index.d.ts +1 -1
  203. package/dist/solution/BookingByStep/index.d.ts.map +1 -0
  204. package/dist/solution/BookingByStep/types.d.ts.map +1 -0
  205. package/dist/solution/BookingByStep/utils/capacity.d.ts.map +1 -0
  206. package/dist/solution/BookingByStep/utils/products.d.ts.map +1 -0
  207. package/dist/solution/BookingByStep/utils/resources.d.ts.map +1 -0
  208. package/dist/solution/BookingByStep/utils/stock.d.ts.map +1 -0
  209. package/dist/solution/BookingByStep/utils/timeslots.d.ts.map +1 -0
  210. package/dist/solution/BookingTicket/index.d.ts +1 -1
  211. package/dist/solution/BookingTicket/index.d.ts.map +1 -0
  212. package/dist/solution/BookingTicket/index.js +198 -108
  213. package/dist/solution/BookingTicket/types.d.ts +14 -2
  214. package/dist/solution/BookingTicket/types.d.ts.map +1 -0
  215. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +1 -1
  216. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts.map +1 -0
  217. package/dist/solution/BookingTicket/utils/addProductDecision.js +4 -3
  218. package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts.map +1 -0
  219. package/dist/solution/BookingTicket/utils/bookingStatus.d.ts.map +1 -0
  220. package/dist/solution/BookingTicket/utils/cartView.d.ts.map +1 -0
  221. package/dist/solution/BookingTicket/utils/exampleData.d.ts.map +1 -0
  222. package/dist/solution/BookingTicket/utils/orderCustomer.d.ts.map +1 -0
  223. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts.map +1 -0
  224. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts.map +1 -0
  225. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +94 -58
  226. package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +10 -0
  227. package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts.map +1 -0
  228. package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +117 -0
  229. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts.map +1 -0
  230. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
  231. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts.map +1 -0
  232. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts.map +1 -0
  233. package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -1
  234. package/dist/solution/BookingTicket/utils/scan/index.d.ts.map +1 -0
  235. package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts.map +1 -0
  236. package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts.map +1 -0
  237. package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts.map +1 -0
  238. package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts.map +1 -0
  239. package/dist/solution/BuyTickets/index.d.ts.map +1 -0
  240. package/dist/solution/BuyTickets/types.d.ts.map +1 -0
  241. package/dist/solution/Checkout/index.d.ts.map +1 -0
  242. package/dist/solution/Checkout/types.d.ts.map +1 -0
  243. package/dist/solution/Checkout/utils/index.d.ts.map +1 -0
  244. package/dist/solution/PlaceOrder/index.d.ts.map +1 -0
  245. package/dist/solution/RegisterAndLogin/config.d.ts.map +1 -0
  246. package/dist/solution/RegisterAndLogin/index.d.ts.map +1 -0
  247. package/dist/solution/RegisterAndLogin/types.d.ts.map +1 -0
  248. package/dist/solution/RegisterAndLogin/utils.d.ts.map +1 -0
  249. package/dist/solution/Sales/index.d.ts.map +1 -0
  250. package/dist/solution/Sales/types.d.ts.map +1 -0
  251. package/dist/solution/ScanOrder/index.d.ts.map +1 -0
  252. package/dist/solution/ScanOrder/types.d.ts.map +1 -0
  253. package/dist/solution/ScanOrder/utils.d.ts.map +1 -0
  254. package/dist/solution/ShopDiscount/index.d.ts.map +1 -0
  255. package/dist/solution/ShopDiscount/types.d.ts.map +1 -0
  256. package/dist/solution/ShopDiscount/utils.d.ts.map +1 -0
  257. package/dist/solution/UnifiedBookingSales/index.d.ts +1 -1
  258. package/dist/solution/UnifiedBookingSales/index.d.ts.map +1 -0
  259. package/dist/solution/UnifiedBookingSales/index.js +63 -43
  260. package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts.map +1 -0
  261. package/dist/solution/UnifiedBookingSales/types.d.ts.map +1 -0
  262. package/dist/solution/VenueBooking/index.d.ts.map +1 -0
  263. package/dist/solution/VenueBooking/types.d.ts.map +1 -0
  264. package/dist/solution/VenueBooking/utils/dateSummary.d.ts.map +1 -0
  265. package/dist/solution/VenueBooking/utils/resource.d.ts.map +1 -0
  266. package/dist/solution/VenueBooking/utils/slotMerge.d.ts.map +1 -0
  267. package/dist/solution/VenueBooking/utils/timeSlot.d.ts.map +1 -0
  268. package/dist/solution/VenueBooking/utils.d.ts.map +1 -0
  269. package/dist/solution/index.d.ts.map +1 -0
  270. package/dist/store/createStore.d.ts.map +1 -0
  271. package/dist/types/index.d.ts.map +1 -0
  272. package/dist/utils/os-private-payload.d.ts.map +1 -0
  273. package/dist/utils/payment-number.d.ts.map +1 -0
  274. package/dist/utils/platform.d.ts +2 -0
  275. package/dist/utils/platform.d.ts.map +1 -0
  276. package/dist/utils/platform.js +6 -0
  277. package/dist/utils/task.d.ts.map +1 -0
  278. package/dist/utils/watch.d.ts.map +1 -0
  279. package/lib/index.d.ts +1 -0
  280. package/lib/index.js +12 -0
  281. package/lib/inventory/index.d.ts +92 -0
  282. package/lib/inventory/index.js +287 -0
  283. package/lib/model/strategy/adapter/promotion/index.js +46 -1
  284. package/lib/modules/Discount/index.js +1 -0
  285. package/lib/modules/Order/index.d.ts +25 -3
  286. package/lib/modules/Order/index.js +145 -11
  287. package/lib/modules/Order/types.d.ts +7 -0
  288. package/lib/modules/Order/utils/discountProductLineIdentity.js +1 -1
  289. package/lib/modules/Order/utils/productVoucherGroups.d.ts +15 -0
  290. package/lib/modules/Order/utils/productVoucherGroups.js +64 -0
  291. package/lib/modules/Order/utils.d.ts +5 -3
  292. package/lib/modules/Order/utils.js +29 -10
  293. package/lib/modules/ProductList/index.js +15 -0
  294. package/lib/modules/Rules/index.d.ts +2 -0
  295. package/lib/modules/Rules/index.js +6 -0
  296. package/lib/server/modules/floor-plan/index.js +29 -1
  297. package/lib/solution/BaseSales/index.d.ts +16 -1
  298. package/lib/solution/BaseSales/index.js +89 -9
  299. package/lib/solution/BookingByStep/index.d.ts +1 -1
  300. package/lib/solution/BookingTicket/index.d.ts +1 -1
  301. package/lib/solution/BookingTicket/index.js +36 -2
  302. package/lib/solution/BookingTicket/types.d.ts +14 -2
  303. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +1 -1
  304. package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -3
  305. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +14 -2
  306. package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +10 -0
  307. package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +71 -0
  308. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
  309. package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -1
  310. package/lib/solution/UnifiedBookingSales/index.d.ts +1 -1
  311. package/lib/solution/UnifiedBookingSales/index.js +14 -3
  312. package/lib/utils/platform.d.ts +2 -0
  313. package/lib/utils/platform.js +7 -0
  314. package/package.json +4 -2
@@ -20,6 +20,10 @@ class RulesModule extends _BaseModule.BaseModule {
20
20
  store;
21
21
  window; // WindowPlugin 实例
22
22
  hooks;
23
+ discountScope;
24
+ setDiscountScope(scope) {
25
+ this.discountScope = scope;
26
+ }
23
27
  constructor(name, version) {
24
28
  super(name, version);
25
29
  this.hooks = {};
@@ -722,6 +726,7 @@ class RulesModule extends _BaseModule.BaseModule {
722
726
 
723
727
  // 辅助函数:检查商品是否对某个折扣卡可用
724
728
  const checkItemApplicableForDiscount = (flatItem, discount) => {
729
+ if (this.discountScope && !this.discountScope(flatItem.originProduct, discount)) return false;
725
730
  if (discount.config?.isAvailable === false) return false;
726
731
  let product;
727
732
  if (flatItem.type === 'main') {
@@ -1093,6 +1098,7 @@ class RulesModule extends _BaseModule.BaseModule {
1093
1098
 
1094
1099
  // 找到适用于此商品的所有优惠券,仅考虑isSelected不为false的优惠券
1095
1100
  const applicableDiscounts = sortedDiscountList.filter(discount => {
1101
+ if (this.discountScope && !this.discountScope(originProduct, discount)) return false;
1096
1102
  if (this.isItemRewardProductDiscount(product)) return false;
1097
1103
  // 🔥 检查策略可用性(针对全额抵扣卡和折扣卡)
1098
1104
  const discountType = discount.tag || discount.type;
@@ -9,6 +9,30 @@ var _types = require("./types");
9
9
  const FLOOR_PLAN_SYNC_DEBOUNCE_MS = 3000;
10
10
  const FLOOR_PLAN_STORE_NAME = 'floor_plans';
11
11
 
12
+ /**
13
+ * Request failures can be plain response objects (rather than Error instances).
14
+ * Keep diagnostics useful without allowing the UI bridge to stringify them as
15
+ * "[object Object]".
16
+ */
17
+ function getRequestErrorInfo(error) {
18
+ if (error instanceof Error && error.message) return {
19
+ message: error.message
20
+ };
21
+ if (typeof error === 'string' && error) return {
22
+ message: error
23
+ };
24
+ const value = error;
25
+ const response = value?.resData?.res ?? value?.response?.data ?? value?.data ?? value;
26
+ const candidates = [value?.message, value?.error, response?.message, response?.error];
27
+ const message = candidates.find(candidate => typeof candidate === 'string' && candidate.trim() !== '');
28
+ return {
29
+ message: message || '平面图加载失败(未提供错误详情)',
30
+ code: response?.code ?? value?.code,
31
+ status: response?.status ?? value?.status,
32
+ httpStatus: value?.response?.status
33
+ };
34
+ }
35
+
12
36
  /**
13
37
  * 平面图模块:预加载列表、pubsub 同步、供 OS Server 路由读本地 store
14
38
  */
@@ -144,8 +168,12 @@ class FloorPlanModule extends _BaseModule.BaseModule {
144
168
  const list = Array.isArray(raw) ? raw : [];
145
169
  return list;
146
170
  } catch (e) {
171
+ const errorInfo = getRequestErrorInfo(e);
147
172
  this.logWarning('loadListFromServer 失败', {
148
- error: e instanceof Error ? e.message : String(e)
173
+ error: errorInfo.message,
174
+ code: errorInfo.code,
175
+ status: errorInfo.status,
176
+ httpStatus: errorInfo.httpStatus
149
177
  });
150
178
  return [];
151
179
  }
@@ -1,3 +1,4 @@
1
+ import { InventoryController, type CheckoutRuntimeSnapshot } from '../../inventory';
1
2
  import { Module, ModuleOptions, PisellCore } from '../../types';
2
3
  import { BaseModule } from '../../modules/BaseModule';
3
4
  import { BaseSalesOrderProduct, BaseSalesOrderProductIdentity, BaseSalesPaymentStatus, BaseSalesUpdateOrderProductQuantityParams, BaseSalesCalculateProductBookingPriceParams, BaseSalesPriceRecalculationContextChange, BaseSalesProductBookingPriceResult, BaseSalesQuotationCustomerScopeInfo, BaseSalesScanCodeResult, BaseSalesCashPaymentOptions, BaseSalesCashPaymentConfig, BaseSalesPayCashParams, BaseSalesPayCashResult, BaseSalesCommitPaymentMethodParams, BaseSalesCommitPaymentMethodResult, BaseSalesConfirmWalletPaymentResult } from './types';
@@ -47,6 +48,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
47
48
  protected appPlugin: AppPlugin;
48
49
  protected store: BaseSalesState;
49
50
  protected otherParams: Record<string, any>;
51
+ getInventory(): InventoryController | undefined;
52
+ prepareCheckout(signal?: AbortSignal): Promise<CheckoutRuntimeSnapshot | undefined>;
50
53
  protected cacheId: string | undefined;
51
54
  /**
52
55
  * 由已在初始化阶段解析过设备短号的业务解决方案写入。
@@ -166,6 +169,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
166
169
  * 可覆盖此方法并把未识别的 name 委托给 `super.createSubModule(name)`。
167
170
  */
168
171
  protected createSubModule(moduleName: string): Module | null;
172
+ private inventoryOrderHooks?;
169
173
  protected getSubModuleHooks(moduleName: string): any;
170
174
  /**
171
175
  * 构造传给 BaseSales 子模块的完整运行态参数,保证初始化和后续同步语义一致。
@@ -203,7 +207,11 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
203
207
  private isActiveVirtualSettlementOrder;
204
208
  private isHistoricalVirtualSettlementOrder;
205
209
  private syncAppDataToTempOrder;
210
+ private initialization?;
211
+ /** Hosts can await readiness without changing Core's synchronous registration API. */
212
+ whenInitialized(): Promise<void>;
206
213
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
214
+ private initializeSalesRuntime;
207
215
  destroy(): Promise<void>;
208
216
  /**
209
217
  * 加载销售订单到统一 tempOrder 工作区。
@@ -306,7 +314,9 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
306
314
  discountList: Discount[];
307
315
  originalDiscountList?: Discount[];
308
316
  }): Promise<void>;
309
- scanPromotionCode(code: string, customerId?: number): Promise<BaseSalesScanCodeResult>;
317
+ scanPromotionCode(code: string, customerId?: number, options?: {
318
+ productVouchersOnly?: boolean;
319
+ }): Promise<BaseSalesScanCodeResult>;
310
320
  setDiscountSelected(params: {
311
321
  discountId: number;
312
322
  isSelected: boolean;
@@ -498,6 +508,11 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
498
508
  private hasSmartPricingStrategies;
499
509
  shouldRecalculateProductBookingPricesForContextChange(params: BaseSalesPriceRecalculationContextChange): boolean;
500
510
  calculateProductBookingPrices(paramsList: BaseSalesCalculateProductBookingPriceParams[]): Promise<BaseSalesProductBookingPriceResult[]>;
511
+ setProductVoucherGroups(groups: Array<{
512
+ key: string;
513
+ discountIds: Array<number | string>;
514
+ }>): void;
515
+ validateProductVoucherSelection(): void;
501
516
  addProductToOrder(product: Partial<BaseSalesOrderProduct> & BaseSalesOrderProductIdentity, booking?: AddProductBookingInput, options?: AddProductToOrderOptions): Promise<import("../../modules/Order/types").OrderProduct[]>;
502
517
  updateOrderProduct(params: UpdateOrderProductParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
503
518
  updateOrderProducts(paramsList: UpdateOrderProductParams[]): Promise<import("../../modules/Order/types").OrderProduct[]>;
@@ -7,6 +7,7 @@ var _exportNames = {
7
7
  BaseSalesImpl: true
8
8
  };
9
9
  exports.BaseSalesImpl = void 0;
10
+ var _inventory = require("../../inventory");
10
11
  var _BaseModule = require("../../modules/BaseModule");
11
12
  var _types = require("./types");
12
13
  Object.keys(_types).forEach(function (key) {
@@ -468,6 +469,40 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
468
469
  order: undefined
469
470
  };
470
471
  otherParams = {};
472
+ getInventory() {
473
+ return this.otherParams.inventory;
474
+ }
475
+ async prepareCheckout(signal) {
476
+ const inventory = this.getInventory();
477
+ const hooks = this.otherParams.checkoutHooks;
478
+ if (!inventory && !hooks?.beforeCheckout) return undefined;
479
+ if (!this.store.order) throw new Error('Order module is not ready');
480
+ return this.store.order.prepareCheckout(async items => {
481
+ const assertCurrent = () => {
482
+ if (signal?.aborted) throw Object.assign(new Error('Checkout cancelled'), {
483
+ name: 'AbortError'
484
+ });
485
+ if (inventory !== this.getInventory() || hooks !== this.otherParams.checkoutHooks) throw (0, _inventory.salesGuardError)('The sales context changed. Please try again.');
486
+ };
487
+ assertCurrent();
488
+ try {
489
+ await hooks?.beforeCheckout?.({
490
+ items,
491
+ signal
492
+ });
493
+ if (inventory) await inventory.refresh({
494
+ reason: 'checkout',
495
+ force: true,
496
+ signal
497
+ });
498
+ assertCurrent();
499
+ return inventory?.freezeCheckout(items);
500
+ } catch (error) {
501
+ if (error?.name === 'AbortError') throw error;
502
+ throw (0, _inventory.salesGuardError)(error instanceof Error ? error.message : String(error));
503
+ }
504
+ });
505
+ }
471
506
  cacheId;
472
507
  /**
473
508
  * 由已在初始化阶段解析过设备短号的业务解决方案写入。
@@ -1235,12 +1270,35 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
1235
1270
  }
1236
1271
  return (0, _types2.createModule)(moduleName, this.name);
1237
1272
  }
1273
+ inventoryOrderHooks;
1238
1274
  getSubModuleHooks(moduleName) {
1239
1275
  const optionHooks = this.initializeOptions.hooks || {};
1240
1276
  const otherHooks = this.otherParams.hooks || {};
1241
1277
  if (moduleName === 'order') {
1242
1278
  const directOrderHooks = optionHooks;
1243
- return optionHooks.order || this.otherParams.order?.hooks || otherHooks.order || (directOrderHooks.onBeforeMergeProductToOrder ? directOrderHooks : undefined);
1279
+ const hooks = optionHooks.order || this.otherParams.order?.hooks || otherHooks.order || (directOrderHooks.onBeforeMergeProductToOrder || directOrderHooks.onBeforeCartCommit ? directOrderHooks : undefined);
1280
+ const inventory = this.getInventory();
1281
+ if (!inventory) {
1282
+ this.inventoryOrderHooks = undefined;
1283
+ return hooks;
1284
+ }
1285
+ if (this.inventoryOrderHooks?.inventory === inventory && this.inventoryOrderHooks.base === hooks) {
1286
+ return this.inventoryOrderHooks.hooks;
1287
+ }
1288
+ const combined = {
1289
+ ...hooks,
1290
+ onBeforeCartCommit: async context => {
1291
+ await hooks?.onBeforeCartCommit?.(context);
1292
+ if (inventory !== this.getInventory()) throw (0, _inventory.salesGuardError)('The sales context changed. Please try again.');
1293
+ inventory.validate(context.proposedItems, context.currentItems);
1294
+ }
1295
+ };
1296
+ this.inventoryOrderHooks = {
1297
+ inventory,
1298
+ base: hooks,
1299
+ hooks: combined
1300
+ };
1301
+ return combined;
1244
1302
  }
1245
1303
  return optionHooks[moduleName] || this.otherParams[moduleName]?.hooks || otherHooks[moduleName];
1246
1304
  }
@@ -1288,7 +1346,10 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
1288
1346
  const nextSubModuleOtherParams = this.buildSubModuleOtherParams(moduleName);
1289
1347
  await targetModule.updateOtherParams(nextSubModuleOtherParams, {
1290
1348
  changedParams,
1291
- cover
1349
+ cover,
1350
+ ...(moduleName === 'order' ? {
1351
+ hooks: this.getSubModuleHooks(moduleName)
1352
+ } : {})
1292
1353
  });
1293
1354
  }));
1294
1355
  }
@@ -1437,7 +1498,17 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
1437
1498
  }
1438
1499
  return isChanged;
1439
1500
  }
1440
- async initialize(core, options = {}) {
1501
+ initialization;
1502
+
1503
+ /** Hosts can await readiness without changing Core's synchronous registration API. */
1504
+ whenInitialized() {
1505
+ return this.initialization || Promise.reject(new Error('Sales module is not registered'));
1506
+ }
1507
+ initialize(core, options = {}) {
1508
+ this.initialization = this.initializeSalesRuntime(core, options);
1509
+ return this.initialization;
1510
+ }
1511
+ async initializeSalesRuntime(core, options = {}) {
1441
1512
  this.core = core;
1442
1513
  this.initializeOptions = options || {};
1443
1514
  this.paymentNumberDevicePrefix = null;
@@ -1494,17 +1565,19 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
1494
1565
  this.serverOrderChangeUnsubscribe = null;
1495
1566
  this.paymentMethodsChangedUnsubscribe?.();
1496
1567
  this.paymentMethodsChangedUnsubscribe = null;
1497
- Object.keys(this.store).forEach(key => {
1498
- if (this.reusedSharedSubModuleNames.has(key)) return;
1568
+ for (const key of Object.keys(this.store)) {
1569
+ if (this.reusedSharedSubModuleNames.has(key)) continue;
1499
1570
  const sub = this.store[key];
1500
1571
  if (sub && typeof sub.destroy === 'function') {
1501
1572
  try {
1502
- sub.destroy();
1573
+ // A host may register a replacement after destroy resolves. Wait for
1574
+ // nested modules so their cleanup cannot unregister the replacement.
1575
+ await sub.destroy();
1503
1576
  } catch (error) {
1504
1577
  console.warn(`[BaseSales] 子模块 ${key} 销毁失败`, error);
1505
1578
  }
1506
1579
  }
1507
- });
1580
+ }
1508
1581
  this.currentSalesDetail = null;
1509
1582
  this.paymentNumberDevicePrefix = null;
1510
1583
  this.queuedServerOrderChanges = [];
@@ -2218,10 +2291,10 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
2218
2291
  }
2219
2292
  await discountModule.setDiscountList(params.discountList);
2220
2293
  }
2221
- async scanPromotionCode(code, customerId) {
2294
+ async scanPromotionCode(code, customerId, options) {
2222
2295
  try {
2223
2296
  if (!this.store.order) throw new Error('order 模块未初始化');
2224
- const raw = await this.store.order.scanCode(code, customerId);
2297
+ const raw = await this.store.order.scanCode(code, customerId, options);
2225
2298
  if (raw.isAvailable) {
2226
2299
  await this.store.order.recalculateSummary({
2227
2300
  createIfMissing: true
@@ -3884,6 +3957,13 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
3884
3957
  });
3885
3958
  });
3886
3959
  }
3960
+ setProductVoucherGroups(groups) {
3961
+ if (!this.store.order) throw new Error('order 模块未初始化');
3962
+ this.store.order.setProductVoucherGroups(groups);
3963
+ }
3964
+ validateProductVoucherSelection() {
3965
+ this.store.order?.validateProductVoucherSelection();
3966
+ }
3887
3967
  async addProductToOrder(product, booking, options) {
3888
3968
  try {
3889
3969
  if (!this.store.order) throw new Error('order 模块未初始化');
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 2 | 1 | 6 | 4 | 5 | 3;
329
+ weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -346,7 +346,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
346
346
  * 获取当前的客户搜索条件
347
347
  * @returns 当前搜索条件
348
348
  */
349
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
349
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
350
350
  /**
351
351
  * 获取客户列表状态(包含滚动加载相关状态)
352
352
  * @returns 客户状态
@@ -30,6 +30,7 @@ var _handleScan = require("./utils/scan/handleScan");
30
30
  var _scanCache = _interopRequireDefault(require("./utils/scan/scanCache"));
31
31
  var _formatGlobalScan = require("./utils/scan/formatGlobalScan");
32
32
  var _applyGlobalScan = require("./utils/scan/applyGlobalScan");
33
+ var _applyProductVoucherCollectionScan = require("./utils/scan/applyProductVoucherCollectionScan");
33
34
  var _cartView = require("./utils/cartView");
34
35
  var _addProductDecision = require("./utils/addProductDecision");
35
36
  var _buildCacheItemFromOrderLine = require("../../modules/BookingContext/utils/buildCacheItemFromOrderLine");
@@ -1672,6 +1673,20 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
1672
1673
  };
1673
1674
  }
1674
1675
  try {
1676
+ if (bridge?.scanScope === 'product-voucher') {
1677
+ if (!bridge.applyPromotionCode) return {
1678
+ status: 'failed',
1679
+ reason: 'no_bridge'
1680
+ };
1681
+ const promotion = await bridge.applyPromotionCode(trimmed);
1682
+ return promotion.isAccepted ?? promotion.isAvailable ? {
1683
+ status: 'success',
1684
+ kind: 'promotion'
1685
+ } : {
1686
+ status: 'failed',
1687
+ reason: 'not_found'
1688
+ };
1689
+ }
1675
1690
  const localSearch = v => this.store.products.findProductsByCodeOrBarcode(v);
1676
1691
  const scanCallback = (0, _handleScan.handleGlobalScan)(this.request, localSearch, this.getSubmitOrderSalesChannel());
1677
1692
  const raw = await scanCallback({
@@ -1686,7 +1701,7 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
1686
1701
  reason: 'not_found'
1687
1702
  };
1688
1703
  }
1689
- const result = await (0, _applyGlobalScan.applyGlobalScan)({
1704
+ const host = {
1690
1705
  setOrderCustomer: customer => this.setOrderCustomer(customer),
1691
1706
  getOrderCustomerSnapshot: () => this.getOrderCustomerSnapshot(),
1692
1707
  resolveCustomerById: customerId => this.resolveCustomerById(customerId),
@@ -1698,10 +1713,29 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
1698
1713
  addProductToOrder: (product, booking) => this.addProductToOrder(product, booking),
1699
1714
  refreshWalletAssets: params => this.refreshWalletAssets(params),
1700
1715
  scanWalletAsset: scanCode => this.scanWalletAsset(scanCode)
1701
- }, formatted, bridge);
1716
+ };
1717
+ const result = bridge?.scanScope === 'product-voucher-collection' ? await (0, _applyProductVoucherCollectionScan.applyProductVoucherCollectionScan)({
1718
+ ...host,
1719
+ waitForCustomerDiscounts: () => this.orderCustomerDiscountRefreshInFlight || Promise.resolve(),
1720
+ loadCustomerDiscounts: async () => {
1721
+ const customerId = Number(this.getOrderCustomer()?.customer_id || 0);
1722
+ if (customerId <= 1) return [];
1723
+ await this.refreshDiscountConfigAfterOrderCustomerChange(customerId);
1724
+ return this.getDiscountList();
1725
+ }
1726
+ }, formatted, bridge) : await (0, _applyGlobalScan.applyGlobalScan)(host, formatted, bridge);
1702
1727
  bridge?.refresh?.();
1703
1728
  return result;
1704
1729
  } catch (error) {
1730
+ if (bridge?.scanScope === 'product-voucher-collection') {
1731
+ if (bridge.isCurrent?.() === false) return {
1732
+ status: 'cancelled'
1733
+ };
1734
+ return {
1735
+ status: 'failed',
1736
+ reason: 'entry_resolution_failed'
1737
+ };
1738
+ }
1705
1739
  console.error('[BookingTicket] handleGlobalScanCode failed', error);
1706
1740
  bridge?.onNotify?.('fail', 'pisell2.text.scan-global-failed');
1707
1741
  return {
@@ -208,6 +208,10 @@ export interface AddAddTimeProductsToBookingInput {
208
208
  }
209
209
  /** 扫码宿主桥接:SalesSdk 在 pubsub 订阅回调里注入,OS 需要 UI 时直接调用 */
210
210
  export interface GlobalScanHostBridge {
211
+ /** product-voucher handles voucher codes only; product-voucher-collection also resolves wallet customer vouchers. */
212
+ scanScope?: 'all' | 'product-voucher' | 'product-voucher-collection';
213
+ /** A one-shot entry may outlive its page while requests are in flight. */
214
+ isCurrent?: () => boolean;
211
215
  openProductDetail?: (payload: Record<string, any>) => Promise<any | null>;
212
216
  openBookingEdit?: (payload: Record<string, any>) => Promise<any | null>;
213
217
  confirmDetail?: (input: {
@@ -232,11 +236,13 @@ export interface GlobalScanHostBridge {
232
236
  */
233
237
  applyPromotionCode?: (code: string, customerId?: number, options?: {
234
238
  suppressFailureNotification?: boolean;
239
+ productVouchersOnly?: boolean;
235
240
  }) => Promise<{
236
241
  isAvailable?: boolean;
237
242
  isAccepted?: boolean;
238
243
  type?: string;
239
244
  unavailableReason?: string;
245
+ scannedDiscountList?: Record<string, any>[];
240
246
  }>;
241
247
  /** 当前订单已有其他客户时,由宿主复用客户组件完成确认及切换。 */
242
248
  requestCustomerSwitch?: (customer: ICustomer) => Promise<boolean | null>;
@@ -244,7 +250,7 @@ export interface GlobalScanHostBridge {
244
250
  refresh?: () => void;
245
251
  }
246
252
  /** handleGlobalScanCode 结构化返回 */
247
- export type GlobalScanHandleResult = {
253
+ export type GlobalScanHandleResult = ({
248
254
  status: 'success';
249
255
  kind: 'customer' | 'products' | 'promotion';
250
256
  meta?: {
@@ -257,5 +263,11 @@ export type GlobalScanHandleResult = {
257
263
  status: 'cancelled';
258
264
  } | {
259
265
  status: 'failed';
260
- reason: 'empty_code' | 'not_found' | 'invalid_data' | 'no_bridge';
266
+ reason: 'empty_code' | 'not_found' | 'invalid_data' | 'no_bridge' | 'entry_resolution_failed';
267
+ }) & {
268
+ /** product-voucher-collection returns voucher candidates; the caller decides how to use them. */
269
+ redemption?: {
270
+ source: 'wallet' | 'scan';
271
+ vouchers: Record<string, any>[];
272
+ };
261
273
  };
@@ -5,7 +5,7 @@ import type { OrderProduct, OrderProductIdentity, AddProductBookingInput } from
5
5
  * cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
6
6
  *
7
7
  * 1. `requiresDetail`:规格 / SKU / 套餐 / Session / 称重弹窗(门禁:`isOpenDetailModal` / `cartDetailValue` / `open_sold_weight`)
8
- * 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(kiosk 强制进入;其他渠道由 `getIsAutoClose` 决定)
8
+ * 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(自助终端强制进入;其他渠道由 `getIsAutoClose` 决定)
9
9
  * 3. `add`:两关均通过,直接 transform + 加车
10
10
  */
11
11
  export type AddProductDecision = {
@@ -17,12 +17,13 @@ var _dayjs = _interopRequireDefault(require("dayjs"));
17
17
  var _BookingContext = require("../../../modules/BookingContext");
18
18
  var _transformBaseProductToOrderProduct = require("../../BaseSales/utils/transformBaseProductToOrderProduct");
19
19
  var _weighingProductSku = require("./weighingProductSku");
20
+ var _platform = require("../../../utils/platform");
20
21
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
22
  /**
22
23
  * cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
23
24
  *
24
25
  * 1. `requiresDetail`:规格 / SKU / 套餐 / Session / 称重弹窗(门禁:`isOpenDetailModal` / `cartDetailValue` / `open_sold_weight`)
25
- * 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(kiosk 强制进入;其他渠道由 `getIsAutoClose` 决定)
26
+ * 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(自助终端强制进入;其他渠道由 `getIsAutoClose` 决定)
26
27
  * 3. `add`:两关均通过,直接 transform + 加车
27
28
  */
28
29
 
@@ -39,11 +40,11 @@ function needsSpecDetailModal(item) {
39
40
  }
40
41
 
41
42
  /**
42
- * 第二段:预约商品是否仍需打开资源 / 时间编辑(kiosk 强制打开,其他渠道与 info2 `cacheItem.autoClose` 等价)。
43
+ * 第二段:预约商品是否仍需打开资源 / 时间编辑(自助终端强制打开,其他渠道与 info2 `cacheItem.autoClose` 等价)。
43
44
  */
44
45
  function needsBookingEdit(cacheItem, ctx) {
45
46
  if (isNormalBookingProduct(cacheItem)) return false;
46
- if (ctx?.channel === 'kiosk') return true;
47
+ if ((0, _platform.isSelfServicePlatform)(ctx?.channel)) return true;
47
48
  const isAutoAllocationOn = ctx?.isAutoAllocationOn || (() => true);
48
49
  return !(0, _BookingContext.getIsAutoClose)(cacheItem, isAutoAllocationOn);
49
50
  }
@@ -283,6 +283,18 @@ async function applyGlobalScan(host, formatted, bridge) {
283
283
  // batch-search 可能返回来源门店客户;先映射到当前门店,确保 Wallet
284
284
  // 支付资产查询使用本店客户上下文。
285
285
  const bindResult = await bindWalletPassCustomer();
286
+ // Voucher collection prioritizes goods coupons resolved from the wristband/order.
287
+ // Only this opt-in flow checks them before selecting a payment wallet asset.
288
+ const collectionPromotion = bridge?.scanScope === 'product-voucher-collection' && bridge.applyPromotionCode ? await bridge.applyPromotionCode(scanCode, getRealCustomerId(activeCustomer), {
289
+ suppressFailureNotification: true,
290
+ productVouchersOnly: true
291
+ }) : undefined;
292
+ if (collectionPromotion?.isAccepted ?? collectionPromotion?.isAvailable) {
293
+ return {
294
+ status: 'success',
295
+ kind: 'promotion'
296
+ };
297
+ }
286
298
  const walletSelection = await trySelectWalletAsset();
287
299
  if (walletSelection) return walletSelection;
288
300
  if (!bridge?.applyPromotionCode) {
@@ -292,9 +304,9 @@ async function applyGlobalScan(host, formatted, bridge) {
292
304
  };
293
305
  }
294
306
  const promotionCustomerId = getRealCustomerId(activeCustomer);
295
- const promotionResult = bindResult.customerBound ? await bridge.applyPromotionCode(scanCode, promotionCustomerId, {
307
+ const promotionResult = collectionPromotion ?? (bindResult.customerBound ? await bridge.applyPromotionCode(scanCode, promotionCustomerId, {
296
308
  suppressFailureNotification: true
297
- }) : await bridge.applyPromotionCode(scanCode, promotionCustomerId);
309
+ }) : await bridge.applyPromotionCode(scanCode, promotionCustomerId));
298
310
  if (promotionResult?.isAccepted ?? promotionResult?.isAvailable) {
299
311
  return {
300
312
  status: 'success',
@@ -0,0 +1,10 @@
1
+ import type { GlobalScanHandleResult, GlobalScanHostBridge } from '../../types';
2
+ import { type GlobalScanApplyHost } from './applyGlobalScan';
3
+ import type { GlobalScanFormattedResult } from './formatGlobalScan';
4
+ export interface ProductVoucherCollectionScanHost extends GlobalScanApplyHost {
5
+ waitForCustomerDiscounts(): Promise<void>;
6
+ loadCustomerDiscounts(): Promise<Record<string, any>[]>;
7
+ }
8
+ /** Collect voucher candidates after customer binding and coupon loading finish.
9
+ * Never expand a wristband's result to other orders of the same customer. */
10
+ export declare function applyProductVoucherCollectionScan(host: ProductVoucherCollectionScanHost, formatted: GlobalScanFormattedResult, bridge: GlobalScanHostBridge): Promise<GlobalScanHandleResult>;
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.applyProductVoucherCollectionScan = applyProductVoucherCollectionScan;
7
+ var _applyGlobalScan = require("./applyGlobalScan");
8
+ /** Collect voucher candidates after customer binding and coupon loading finish.
9
+ * Never expand a wristband's result to other orders of the same customer. */
10
+ async function applyProductVoucherCollectionScan(host, formatted, bridge) {
11
+ const assertCurrent = () => {
12
+ if (bridge.isCurrent?.() === false) {
13
+ throw new DOMException('Scan session ended', 'AbortError');
14
+ }
15
+ };
16
+ let vouchers = [];
17
+ assertCurrent();
18
+ const result = await (0, _applyGlobalScan.applyGlobalScan)({
19
+ ...host,
20
+ setOrderCustomer: customer => {
21
+ assertCurrent();
22
+ host.setOrderCustomer(customer);
23
+ },
24
+ addProductToOrder: (product, booking) => {
25
+ assertCurrent();
26
+ return host.addProductToOrder(product, booking);
27
+ }
28
+ }, formatted, {
29
+ ...bridge,
30
+ applyPromotionCode: bridge.applyPromotionCode && (async (code, customerId, options) => {
31
+ // Customer binding starts prepare/config in the background. Let it finish
32
+ // before adding scanned coupons so its response cannot overwrite them.
33
+ await host.waitForCustomerDiscounts();
34
+ assertCurrent();
35
+ const promotion = await bridge.applyPromotionCode(code, customerId, {
36
+ ...options,
37
+ productVouchersOnly: true,
38
+ suppressFailureNotification: true
39
+ });
40
+ assertCurrent();
41
+ // An empty successful search is different from a swallowed request error.
42
+ if (!Array.isArray(promotion.scannedDiscountList)) {
43
+ throw new Error('Could not resolve scanned vouchers');
44
+ }
45
+ vouchers = promotion.scannedDiscountList;
46
+ return promotion;
47
+ })
48
+ });
49
+ assertCurrent();
50
+ if (formatted.searchType === 'wallet' && result.status === 'success') {
51
+ vouchers = await host.loadCustomerDiscounts();
52
+ assertCurrent();
53
+ return {
54
+ ...result,
55
+ redemption: {
56
+ source: 'wallet',
57
+ vouchers
58
+ }
59
+ };
60
+ }
61
+ if (formatted.searchType === 'walletPass') {
62
+ return {
63
+ ...result,
64
+ redemption: {
65
+ source: 'scan',
66
+ vouchers
67
+ }
68
+ };
69
+ }
70
+ return result;
71
+ }
@@ -10,6 +10,7 @@ exports.searchWalletPass = exports.searchWallet = exports.searchProduct = export
10
10
  const searchWalletPass = async (request, code) => {
11
11
  const params = {
12
12
  code,
13
+ resolve_ticket_order: 1,
13
14
  translate_flag: 1,
14
15
  // 翻译识别码名称 0:不翻译 1:翻译
15
16
  relation_product: 1,
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.handleUniversalScan = exports.handleGlobalScan = exports.handleCustomerScan = void 0;
7
7
  var _cloudSearch = require("./cloudSearch");
8
8
  var _scanCache = _interopRequireDefault(require("./scanCache"));
9
+ var _platform = require("../../../../utils/platform");
9
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
11
  /**
11
12
  * Promise.any 的替代实现
@@ -107,7 +108,7 @@ const handleGlobalScan = (request, localSearch, channel) => {
107
108
  if (value.startsWith('WL')) {
108
109
  requestList = [(0, _cloudSearch.searchWallet)(request, value)];
109
110
  } else {
110
- requestList = [...(channel === 'kiosk' ? [] : [(0, _cloudSearch.searchOrder)(request, value)]), (0, _cloudSearch.searchWalletPass)(request, value), (0, _cloudSearch.searchWallet)(request, value), (0, _cloudSearch.searchProduct)(request, value)];
111
+ requestList = [...((0, _platform.isSelfServicePlatform)(channel) ? [] : [(0, _cloudSearch.searchOrder)(request, value)]), (0, _cloudSearch.searchWalletPass)(request, value), (0, _cloudSearch.searchWallet)(request, value), (0, _cloudSearch.searchProduct)(request, value)];
111
112
  }
112
113
  return requestList;
113
114
  };
@@ -127,7 +127,7 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
127
127
  */
128
128
  clearSessionStorageOrderSnapshot(): void;
129
129
  /**
130
- * PC/H5/Kiosk 结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
130
+ * PC/H5 及自助终端结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
131
131
  * 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
132
132
  */
133
133
  protected shouldUseCheckoutSyncTask(): boolean;