@pisell/pisellos 0.0.568 → 0.10.1

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 (588) hide show
  1. package/dist/core/index.js +10 -6
  2. package/dist/index.d.ts +0 -1
  3. package/dist/index.js +0 -3
  4. package/dist/model/strategy/adapter/promotion/evaluator.js +3 -2
  5. package/dist/model/strategy/adapter/walletPass/evaluator.js +7 -5
  6. package/dist/model/strategy/adapter/walletPass/example.js +26 -3
  7. package/dist/model/strategy/adapter/walletPass/index.js +5 -5
  8. package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -3
  9. package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -26
  10. package/dist/model/strategy/adapter/walletPass/utils.js +24 -96
  11. package/dist/model/strategy/strategy-example.js +19 -5
  12. package/dist/modules/BaseModule.d.ts +2 -2
  13. package/dist/modules/BaseModule.js +12 -14
  14. package/dist/modules/BookingContext/index.d.ts +48 -0
  15. package/dist/modules/BookingContext/index.js +566 -0
  16. package/dist/modules/BookingContext/types.d.ts +102 -0
  17. package/dist/modules/BookingContext/types.js +51 -0
  18. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  19. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +302 -0
  20. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  21. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +149 -0
  22. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  23. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +249 -0
  24. package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
  25. package/dist/modules/BookingContext/utils/flexible.js +56 -0
  26. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  27. package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
  28. package/dist/modules/BookingContext/utils/index.d.ts +11 -0
  29. package/dist/modules/BookingContext/utils/index.js +11 -0
  30. package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
  31. package/dist/modules/BookingContext/utils/noResource.js +77 -0
  32. package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  33. package/dist/modules/BookingContext/utils/orderLineDisplay.js +36 -0
  34. package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
  35. package/dist/modules/BookingContext/utils/productExtend.js +339 -0
  36. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  37. package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
  38. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  39. package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
  40. package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
  41. package/dist/modules/BookingContext/utils/resources.js +486 -0
  42. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  43. package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
  44. package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  45. package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
  46. package/dist/modules/Cart/index.js +3 -0
  47. package/dist/modules/Cart/utils/cartProduct.js +27 -5
  48. package/dist/modules/Cart/utils/cartResource.js +0 -2
  49. package/dist/modules/Cart/utils/changePrice.js +11 -11
  50. package/dist/modules/Customer/index.d.ts +20 -0
  51. package/dist/modules/Customer/index.js +172 -83
  52. package/dist/modules/Customer/types.d.ts +2 -0
  53. package/dist/modules/Date/index.js +5 -1
  54. package/dist/modules/Discount/index.d.ts +2 -2
  55. package/dist/modules/Discount/index.js +43 -30
  56. package/dist/modules/Discount/types.d.ts +1 -1
  57. package/dist/modules/OpenData/index.d.ts +8 -0
  58. package/dist/modules/OpenData/index.js +38 -16
  59. package/dist/modules/Order/index.d.ts +449 -24
  60. package/dist/modules/Order/index.js +5460 -574
  61. package/dist/modules/Order/types.d.ts +693 -88
  62. package/dist/modules/Order/types.js +68 -1
  63. package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
  64. package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
  65. package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  66. package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
  67. package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
  68. package/dist/modules/Order/utils/orderCollectionIdentity.js +405 -0
  69. package/dist/modules/Order/utils.d.ts +167 -18
  70. package/dist/modules/Order/utils.js +960 -165
  71. package/dist/modules/Payment/index.d.ts +10 -9
  72. package/dist/modules/Payment/index.js +573 -746
  73. package/dist/modules/Payment/types.d.ts +44 -24
  74. package/dist/modules/Payment/utils.d.ts +1 -1
  75. package/dist/modules/Payment/utils.js +4 -3
  76. package/dist/modules/Payment/walletpass.d.ts +0 -2
  77. package/dist/modules/Payment/walletpass.js +49 -33
  78. package/dist/modules/Product/types.d.ts +29 -7
  79. package/dist/modules/ProductList/index.d.ts +17 -13
  80. package/dist/modules/ProductList/index.js +182 -81
  81. package/dist/modules/ProductList/types.d.ts +16 -0
  82. package/dist/modules/Quotation/index.d.ts +22 -2
  83. package/dist/modules/Quotation/index.js +108 -42
  84. package/dist/modules/Quotation/types.d.ts +19 -0
  85. package/dist/modules/ResourcePlanner/index.d.ts +24 -0
  86. package/dist/modules/ResourcePlanner/index.js +181 -0
  87. package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
  88. package/dist/modules/ResourcePlanner/planner.js +1069 -0
  89. package/dist/modules/ResourcePlanner/types.d.ts +227 -0
  90. package/dist/modules/ResourcePlanner/types.js +1 -0
  91. package/dist/modules/Rules/index.d.ts +8 -10
  92. package/dist/modules/Rules/index.js +324 -513
  93. package/dist/modules/Rules/types.d.ts +14 -3
  94. package/dist/modules/SalesSummary/index.d.ts +23 -26
  95. package/dist/modules/SalesSummary/index.js +152 -46
  96. package/dist/modules/SalesSummary/types.d.ts +9 -1
  97. package/dist/modules/SalesSummary/utils.d.ts +3 -22
  98. package/dist/modules/SalesSummary/utils.js +804 -165
  99. package/dist/modules/Schedule/getDateIsInSchedule.js +14 -12
  100. package/dist/modules/Schedule/index.d.ts +18 -5
  101. package/dist/modules/Schedule/index.js +79 -24
  102. package/dist/modules/Schedule/types.d.ts +2 -0
  103. package/dist/modules/Schedule/utils.js +1 -0
  104. package/dist/modules/Step/index.js +1 -0
  105. package/dist/modules/Summary/index.js +4 -3
  106. package/dist/modules/Summary/utils.js +22 -43
  107. package/dist/modules/SurchargeList/index.d.ts +18 -0
  108. package/dist/modules/SurchargeList/index.js +185 -0
  109. package/dist/modules/SurchargeList/types.d.ts +15 -0
  110. package/dist/modules/SurchargeList/types.js +1 -0
  111. package/dist/modules/index.d.ts +3 -0
  112. package/dist/modules/index.js +4 -1
  113. package/dist/plugins/app.d.ts +2 -0
  114. package/dist/plugins/request.d.ts +1 -0
  115. package/dist/plugins/request.js +4 -1
  116. package/dist/plugins/window.js +6 -2
  117. package/dist/server/index.d.ts +462 -8
  118. package/dist/server/index.js +6168 -680
  119. package/dist/server/modules/floor-plan/index.d.ts +39 -0
  120. package/dist/server/modules/floor-plan/index.js +595 -0
  121. package/dist/server/modules/floor-plan/types.d.ts +43 -0
  122. package/dist/server/modules/floor-plan/types.js +13 -0
  123. package/dist/server/modules/index.d.ts +7 -2
  124. package/dist/server/modules/index.js +6 -0
  125. package/dist/server/modules/menu/index.js +41 -32
  126. package/dist/server/modules/order/index.d.ts +207 -14
  127. package/dist/server/modules/order/index.js +2328 -379
  128. package/dist/server/modules/order/types.d.ts +76 -5
  129. package/dist/server/modules/order/types.js +14 -1
  130. package/dist/server/modules/order/utils/filterBookings.d.ts +7 -1
  131. package/dist/server/modules/order/utils/filterBookings.js +118 -11
  132. package/dist/server/modules/order/utils/filterOrders.js +242 -14
  133. package/dist/server/modules/payment/index.d.ts +28 -0
  134. package/dist/server/modules/payment/index.js +305 -0
  135. package/dist/server/modules/payment/types.d.ts +9 -0
  136. package/dist/server/modules/payment/types.js +1 -0
  137. package/dist/server/modules/products/index.d.ts +105 -14
  138. package/dist/server/modules/products/index.js +1416 -521
  139. package/dist/server/modules/products/types.d.ts +34 -1
  140. package/dist/server/modules/products/types.js +4 -0
  141. package/dist/server/modules/quotation/index.d.ts +39 -0
  142. package/dist/server/modules/quotation/index.js +298 -77
  143. package/dist/server/modules/resource/index.d.ts +2 -3
  144. package/dist/server/modules/resource/index.js +109 -86
  145. package/dist/server/modules/schedule/index.d.ts +6 -4
  146. package/dist/server/modules/schedule/index.js +145 -106
  147. package/dist/server/test.json +713 -0
  148. package/dist/server/types.d.ts +2 -0
  149. package/dist/server/utils/product.js +3 -2
  150. package/dist/server/utils/small-ticket.d.ts +71 -0
  151. package/dist/server/utils/small-ticket.js +963 -0
  152. package/dist/solution/BaseSales/index.d.ts +378 -0
  153. package/dist/solution/BaseSales/index.js +4009 -0
  154. package/dist/solution/BaseSales/types.d.ts +394 -0
  155. package/dist/solution/BaseSales/types.js +40 -0
  156. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
  157. package/dist/solution/BaseSales/utils/cartPromotion.js +1450 -0
  158. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
  159. package/dist/solution/BaseSales/utils/parseSalesResponse.js +157 -0
  160. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
  161. package/dist/solution/BaseSales/utils/quotationPrice.js +250 -0
  162. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
  163. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +218 -0
  164. package/dist/solution/BaseSales/utils.d.ts +40 -0
  165. package/dist/solution/BaseSales/utils.js +263 -0
  166. package/dist/solution/BookingByStep/index.d.ts +1 -1
  167. package/dist/solution/BookingByStep/index.js +60 -11
  168. package/dist/solution/BookingByStep/utils/capacity.js +11 -1
  169. package/dist/solution/BookingByStep/utils/resources.js +3 -1
  170. package/dist/solution/BookingByStep/utils/timeslots.js +43 -2
  171. package/dist/solution/BookingTicket/index.d.ts +393 -24
  172. package/dist/solution/BookingTicket/index.js +2508 -443
  173. package/dist/solution/BookingTicket/types.d.ts +191 -6
  174. package/dist/solution/BookingTicket/types.js +83 -10
  175. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
  176. package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
  177. package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  178. package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
  179. package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
  180. package/dist/solution/BookingTicket/utils/bookingStatus.js +136 -0
  181. package/dist/solution/BookingTicket/utils/cartView.d.ts +29 -0
  182. package/dist/solution/BookingTicket/utils/cartView.js +209 -0
  183. package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  184. package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
  185. package/dist/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
  186. package/dist/solution/BookingTicket/utils/orderCustomer.js +31 -0
  187. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  188. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +438 -0
  189. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
  190. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +400 -0
  191. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
  192. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +42 -1
  193. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
  194. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +56 -0
  195. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  196. package/dist/solution/BookingTicket/utils/scan/handleScan.js +42 -28
  197. package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  198. package/dist/solution/BookingTicket/utils/scan/index.js +30 -14
  199. package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  200. package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +150 -0
  201. package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
  202. package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +78 -0
  203. package/dist/solution/BuyTickets/index.js +12 -9
  204. package/dist/solution/Checkout/index.d.ts +1 -0
  205. package/dist/solution/Checkout/index.js +275 -209
  206. package/dist/solution/Checkout/utils/index.js +20 -8
  207. package/dist/solution/RegisterAndLogin/config.js +2 -10
  208. package/dist/solution/RegisterAndLogin/index.js +76 -30
  209. package/dist/solution/Sales/index.d.ts +50 -5
  210. package/dist/solution/Sales/index.js +484 -92
  211. package/dist/solution/Sales/types.d.ts +26 -2
  212. package/dist/solution/ScanOrder/index.d.ts +27 -21
  213. package/dist/solution/ScanOrder/index.js +519 -444
  214. package/dist/solution/ScanOrder/types.d.ts +33 -11
  215. package/dist/solution/ScanOrder/types.js +4 -5
  216. package/dist/solution/ScanOrder/utils.d.ts +4 -1
  217. package/dist/solution/ScanOrder/utils.js +109 -34
  218. package/dist/solution/ShopDiscount/index.js +18 -19
  219. package/dist/solution/ShopDiscount/types.d.ts +4 -5
  220. package/dist/solution/ShopDiscount/utils.d.ts +0 -9
  221. package/dist/solution/ShopDiscount/utils.js +0 -9
  222. package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
  223. package/dist/solution/UnifiedBookingSales/index.js +1871 -0
  224. package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
  225. package/dist/solution/UnifiedBookingSales/types.js +11 -0
  226. package/dist/solution/VenueBooking/index.d.ts +32 -51
  227. package/dist/solution/VenueBooking/index.js +741 -808
  228. package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  229. package/dist/solution/VenueBooking/types.d.ts +1 -3
  230. package/dist/solution/VenueBooking/types.js +0 -1
  231. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
  232. package/dist/solution/VenueBooking/utils/dateSummary.js +25 -12
  233. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
  234. package/dist/solution/VenueBooking/utils/slotMerge.js +9 -3
  235. package/dist/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
  236. package/dist/solution/VenueBooking/utils/timeSlot.js +4 -9
  237. package/dist/solution/index.d.ts +2 -0
  238. package/dist/solution/index.js +3 -1
  239. package/dist/types/index.d.ts +12 -2
  240. package/dist/utils/task.js +18 -15
  241. package/dist/utils/watch.js +1 -0
  242. package/lib/apis/picoding.js +0 -2
  243. package/lib/core/index.js +132 -130
  244. package/lib/effects/index.js +57 -46
  245. package/lib/index.d.ts +0 -1
  246. package/lib/index.js +50 -92
  247. package/lib/model/index.js +21 -14
  248. package/lib/model/strategy/adapter/dataVariant/adapter.js +50 -38
  249. package/lib/model/strategy/adapter/dataVariant/evaluator.js +236 -162
  250. package/lib/model/strategy/adapter/dataVariant/examples.js +237 -229
  251. package/lib/model/strategy/adapter/dataVariant/index.js +34 -39
  252. package/lib/model/strategy/adapter/dataVariant/type.js +28 -57
  253. package/lib/model/strategy/adapter/index.js +64 -100
  254. package/lib/model/strategy/adapter/itemRule/adapter.js +144 -156
  255. package/lib/model/strategy/adapter/itemRule/evaluator.js +48 -36
  256. package/lib/model/strategy/adapter/itemRule/examples.js +225 -295
  257. package/lib/model/strategy/adapter/itemRule/index.js +57 -83
  258. package/lib/model/strategy/adapter/itemRule/type.js +36 -97
  259. package/lib/model/strategy/adapter/promotion/adapter.js +63 -84
  260. package/lib/model/strategy/adapter/promotion/evaluator.js +233 -382
  261. package/lib/model/strategy/adapter/promotion/examples.js +159 -139
  262. package/lib/model/strategy/adapter/promotion/index.js +0 -1
  263. package/lib/model/strategy/adapter/promotion/type.js +35 -199
  264. package/lib/model/strategy/adapter/type.js +16 -4
  265. package/lib/model/strategy/adapter/walletPass/evaluator.js +152 -180
  266. package/lib/model/strategy/adapter/walletPass/example.js +190 -217
  267. package/lib/model/strategy/adapter/walletPass/index.js +51 -75
  268. package/lib/model/strategy/adapter/walletPass/locales.js +58 -36
  269. package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -3
  270. package/lib/model/strategy/adapter/walletPass/type.js +16 -4
  271. package/lib/model/strategy/adapter/walletPass/utils.d.ts +0 -26
  272. package/lib/model/strategy/adapter/walletPass/utils.js +383 -676
  273. package/lib/model/strategy/engine.js +168 -270
  274. package/lib/model/strategy/index.js +34 -49
  275. package/lib/model/strategy/strategy-example.js +239 -243
  276. package/lib/model/strategy/type.js +40 -100
  277. package/lib/modules/Account/index.js +53 -39
  278. package/lib/modules/Account/types.js +33 -20
  279. package/lib/modules/AccountList/index.js +154 -116
  280. package/lib/modules/AccountList/types.js +31 -30
  281. package/lib/modules/AccountList/utils.js +30 -18
  282. package/lib/modules/BaseModule.d.ts +2 -2
  283. package/lib/modules/BaseModule.js +50 -29
  284. package/lib/modules/BookingContext/index.d.ts +48 -0
  285. package/lib/modules/BookingContext/index.js +368 -0
  286. package/lib/modules/BookingContext/types.d.ts +102 -0
  287. package/lib/modules/BookingContext/types.js +34 -0
  288. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  289. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +298 -0
  290. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  291. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +155 -0
  292. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  293. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +222 -0
  294. package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
  295. package/lib/modules/BookingContext/utils/flexible.js +80 -0
  296. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  297. package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
  298. package/lib/modules/BookingContext/utils/index.d.ts +11 -0
  299. package/lib/modules/BookingContext/utils/index.js +43 -0
  300. package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
  301. package/lib/modules/BookingContext/utils/noResource.js +90 -0
  302. package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  303. package/lib/modules/BookingContext/utils/orderLineDisplay.js +56 -0
  304. package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
  305. package/lib/modules/BookingContext/utils/productExtend.js +283 -0
  306. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  307. package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
  308. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  309. package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
  310. package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
  311. package/lib/modules/BookingContext/utils/resources.js +377 -0
  312. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  313. package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
  314. package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  315. package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
  316. package/lib/modules/Cart/index.js +124 -170
  317. package/lib/modules/Cart/types.js +51 -46
  318. package/lib/modules/Cart/utils/cartAccount.js +39 -40
  319. package/lib/modules/Cart/utils/cartDate.js +61 -56
  320. package/lib/modules/Cart/utils/cartDiscount.js +33 -28
  321. package/lib/modules/Cart/utils/cartNote.js +32 -27
  322. package/lib/modules/Cart/utils/cartProduct.js +261 -309
  323. package/lib/modules/Cart/utils/cartRelationForms.js +35 -29
  324. package/lib/modules/Cart/utils/cartResource.js +78 -72
  325. package/lib/modules/Cart/utils/changePrice.js +59 -31
  326. package/lib/modules/Cart/utils/index.js +48 -106
  327. package/lib/modules/Customer/constants.js +34 -13
  328. package/lib/modules/Customer/index.d.ts +20 -0
  329. package/lib/modules/Customer/index.js +207 -217
  330. package/lib/modules/Customer/types.d.ts +2 -0
  331. package/lib/modules/Customer/types.js +35 -38
  332. package/lib/modules/Date/index.js +115 -116
  333. package/lib/modules/Date/types.js +28 -16
  334. package/lib/modules/Date/utils.js +123 -174
  335. package/lib/modules/Discount/index.d.ts +2 -2
  336. package/lib/modules/Discount/index.js +133 -119
  337. package/lib/modules/Discount/types.d.ts +1 -1
  338. package/lib/modules/Discount/types.js +31 -9
  339. package/lib/modules/Guests/index.js +56 -30
  340. package/lib/modules/Guests/types.js +33 -23
  341. package/lib/modules/Holder/index.js +189 -209
  342. package/lib/modules/Holder/types.js +16 -4
  343. package/lib/modules/Holder/utils.js +49 -20
  344. package/lib/modules/OpenData/index.d.ts +8 -0
  345. package/lib/modules/OpenData/index.js +88 -63
  346. package/lib/modules/OpenData/types.js +16 -4
  347. package/lib/modules/OpenData/utils.js +78 -44
  348. package/lib/modules/Order/index.d.ts +449 -24
  349. package/lib/modules/Order/index.js +4184 -514
  350. package/lib/modules/Order/types.d.ts +693 -88
  351. package/lib/modules/Order/types.js +35 -24
  352. package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
  353. package/lib/modules/Order/utils/bundleDiscountHydration.js +139 -0
  354. package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  355. package/lib/modules/Order/utils/manualProductDiscount.js +206 -0
  356. package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
  357. package/lib/modules/Order/utils/orderCollectionIdentity.js +415 -0
  358. package/lib/modules/Order/utils.d.ts +167 -18
  359. package/lib/modules/Order/utils.js +1085 -414
  360. package/lib/modules/Payment/cash.js +33 -20
  361. package/lib/modules/Payment/cashRecommendationAlgorithm.js +76 -145
  362. package/lib/modules/Payment/eftpos.js +30 -16
  363. package/lib/modules/Payment/index.d.ts +10 -9
  364. package/lib/modules/Payment/index.js +402 -636
  365. package/lib/modules/Payment/mx51.js +0 -1
  366. package/lib/modules/Payment/types.d.ts +44 -24
  367. package/lib/modules/Payment/types.js +107 -216
  368. package/lib/modules/Payment/utils.d.ts +1 -1
  369. package/lib/modules/Payment/utils.js +50 -52
  370. package/lib/modules/Payment/walletpass.d.ts +0 -2
  371. package/lib/modules/Payment/walletpass.js +216 -221
  372. package/lib/modules/Product/index.js +46 -51
  373. package/lib/modules/Product/types.d.ts +29 -7
  374. package/lib/modules/Product/types.js +16 -4
  375. package/lib/modules/Product/utils.js +33 -32
  376. package/lib/modules/ProductList/index.d.ts +17 -13
  377. package/lib/modules/ProductList/index.js +161 -120
  378. package/lib/modules/ProductList/types.d.ts +16 -0
  379. package/lib/modules/ProductList/types.js +31 -9
  380. package/lib/modules/Quotation/index.d.ts +22 -2
  381. package/lib/modules/Quotation/index.js +154 -64
  382. package/lib/modules/Quotation/types.d.ts +19 -0
  383. package/lib/modules/Quotation/types.js +16 -4
  384. package/lib/modules/Resource/index.js +59 -27
  385. package/lib/modules/Resource/types.js +32 -22
  386. package/lib/modules/Resource/utils.js +38 -30
  387. package/lib/modules/ResourcePlanner/index.d.ts +24 -0
  388. package/lib/modules/ResourcePlanner/index.js +148 -0
  389. package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
  390. package/lib/modules/ResourcePlanner/planner.js +933 -0
  391. package/lib/modules/ResourcePlanner/types.d.ts +227 -0
  392. package/lib/modules/ResourcePlanner/types.js +17 -0
  393. package/lib/modules/Rules/index.d.ts +8 -10
  394. package/lib/modules/Rules/index.js +960 -1440
  395. package/lib/modules/Rules/types.d.ts +14 -3
  396. package/lib/modules/Rules/types.js +40 -17
  397. package/lib/modules/SalesSummary/index.d.ts +23 -26
  398. package/lib/modules/SalesSummary/index.js +134 -61
  399. package/lib/modules/SalesSummary/types.d.ts +9 -1
  400. package/lib/modules/SalesSummary/types.js +16 -4
  401. package/lib/modules/SalesSummary/utils.d.ts +3 -22
  402. package/lib/modules/SalesSummary/utils.js +814 -233
  403. package/lib/modules/ScanOrderLogger/index.js +79 -59
  404. package/lib/modules/ScanOrderLogger/providers/feishu.js +78 -54
  405. package/lib/modules/ScanOrderLogger/providers/grafana.js +36 -13
  406. package/lib/modules/ScanOrderLogger/types.js +16 -4
  407. package/lib/modules/Schedule/getDateIsInSchedule.js +169 -338
  408. package/lib/modules/Schedule/index.d.ts +18 -5
  409. package/lib/modules/Schedule/index.js +153 -104
  410. package/lib/modules/Schedule/type.js +16 -4
  411. package/lib/modules/Schedule/types.d.ts +2 -0
  412. package/lib/modules/Schedule/types.js +16 -4
  413. package/lib/modules/Schedule/utils.js +291 -433
  414. package/lib/modules/Step/index.js +52 -40
  415. package/lib/modules/Step/tyeps.js +16 -4
  416. package/lib/modules/Summary/index.js +71 -66
  417. package/lib/modules/Summary/types.js +16 -4
  418. package/lib/modules/Summary/utils.js +418 -791
  419. package/lib/modules/SurchargeList/index.d.ts +18 -0
  420. package/lib/modules/SurchargeList/index.js +109 -0
  421. package/lib/modules/SurchargeList/types.d.ts +15 -0
  422. package/lib/modules/SurchargeList/types.js +17 -0
  423. package/lib/modules/index.d.ts +3 -0
  424. package/lib/modules/index.js +63 -212
  425. package/lib/plugins/app.d.ts +2 -0
  426. package/lib/plugins/app.js +16 -4
  427. package/lib/plugins/index.js +25 -36
  428. package/lib/plugins/request.d.ts +1 -0
  429. package/lib/plugins/request.js +126 -137
  430. package/lib/plugins/shopStore.js +16 -4
  431. package/lib/plugins/user.js +16 -4
  432. package/lib/plugins/window.js +179 -171
  433. package/lib/server/index.d.ts +462 -8
  434. package/lib/server/index.js +4520 -1162
  435. package/lib/server/modules/floor-plan/index.d.ts +39 -0
  436. package/lib/server/modules/floor-plan/index.js +327 -0
  437. package/lib/server/modules/floor-plan/types.d.ts +43 -0
  438. package/lib/server/modules/floor-plan/types.js +34 -0
  439. package/lib/server/modules/index.d.ts +7 -2
  440. package/lib/server/modules/index.js +67 -84
  441. package/lib/server/modules/menu/index.js +122 -146
  442. package/lib/server/modules/menu/types.js +31 -18
  443. package/lib/server/modules/order/index.d.ts +207 -14
  444. package/lib/server/modules/order/index.js +1543 -285
  445. package/lib/server/modules/order/types.d.ts +76 -5
  446. package/lib/server/modules/order/types.js +32 -107
  447. package/lib/server/modules/order/utils/filterBookings.d.ts +7 -1
  448. package/lib/server/modules/order/utils/filterBookings.js +259 -176
  449. package/lib/server/modules/order/utils/filterOrders.js +293 -94
  450. package/lib/server/modules/payment/index.d.ts +28 -0
  451. package/lib/server/modules/payment/index.js +192 -0
  452. package/lib/server/modules/payment/types.d.ts +9 -0
  453. package/lib/server/modules/payment/types.js +17 -0
  454. package/lib/server/modules/products/index.d.ts +105 -14
  455. package/lib/server/modules/products/index.js +850 -475
  456. package/lib/server/modules/products/types.d.ts +34 -1
  457. package/lib/server/modules/products/types.js +34 -41
  458. package/lib/server/modules/quotation/index.d.ts +39 -0
  459. package/lib/server/modules/quotation/index.js +254 -75
  460. package/lib/server/modules/quotation/types.js +31 -21
  461. package/lib/server/modules/resource/index.d.ts +2 -3
  462. package/lib/server/modules/resource/index.js +240 -243
  463. package/lib/server/modules/resource/types.js +33 -42
  464. package/lib/server/modules/schedule/index.d.ts +6 -4
  465. package/lib/server/modules/schedule/index.js +146 -147
  466. package/lib/server/modules/schedule/types.js +21 -14
  467. package/lib/server/modules/schedule/utils.js +163 -334
  468. package/lib/server/test.json +713 -0
  469. package/lib/server/types.d.ts +2 -0
  470. package/lib/server/types.js +16 -4
  471. package/lib/server/utils/index.js +23 -25
  472. package/lib/server/utils/product.js +140 -197
  473. package/lib/server/utils/schedule.js +41 -34
  474. package/lib/server/utils/small-ticket.d.ts +71 -0
  475. package/lib/server/utils/small-ticket.js +904 -0
  476. package/lib/server/utils/time.js +49 -40
  477. package/lib/solution/BaseSales/index.d.ts +378 -0
  478. package/lib/solution/BaseSales/index.js +2533 -0
  479. package/lib/solution/BaseSales/types.d.ts +394 -0
  480. package/lib/solution/BaseSales/types.js +43 -0
  481. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
  482. package/lib/solution/BaseSales/utils/cartPromotion.js +1004 -0
  483. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
  484. package/lib/solution/BaseSales/utils/parseSalesResponse.js +160 -0
  485. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
  486. package/lib/solution/BaseSales/utils/quotationPrice.js +289 -0
  487. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
  488. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +256 -0
  489. package/lib/solution/BaseSales/utils.d.ts +40 -0
  490. package/lib/solution/BaseSales/utils.js +244 -0
  491. package/lib/solution/BookingByStep/index.d.ts +1 -1
  492. package/lib/solution/BookingByStep/index.js +1340 -1530
  493. package/lib/solution/BookingByStep/types.js +99 -40
  494. package/lib/solution/BookingByStep/utils/capacity.js +160 -192
  495. package/lib/solution/BookingByStep/utils/products.js +52 -42
  496. package/lib/solution/BookingByStep/utils/resources.js +330 -527
  497. package/lib/solution/BookingByStep/utils/stock.js +44 -65
  498. package/lib/solution/BookingByStep/utils/timeslots.js +131 -129
  499. package/lib/solution/BookingTicket/index.d.ts +393 -24
  500. package/lib/solution/BookingTicket/index.js +1374 -184
  501. package/lib/solution/BookingTicket/types.d.ts +191 -6
  502. package/lib/solution/BookingTicket/types.js +79 -40
  503. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
  504. package/lib/solution/BookingTicket/utils/addProductDecision.js +318 -0
  505. package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  506. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +125 -0
  507. package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
  508. package/lib/solution/BookingTicket/utils/bookingStatus.js +107 -0
  509. package/lib/solution/BookingTicket/utils/cartView.d.ts +29 -0
  510. package/lib/solution/BookingTicket/utils/cartView.js +184 -0
  511. package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  512. package/lib/solution/BookingTicket/utils/exampleData.js +0 -0
  513. package/lib/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
  514. package/lib/solution/BookingTicket/utils/orderCustomer.js +58 -0
  515. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  516. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +254 -0
  517. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
  518. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +169 -0
  519. package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
  520. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +97 -64
  521. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
  522. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +51 -0
  523. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  524. package/lib/solution/BookingTicket/utils/scan/handleScan.js +81 -82
  525. package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  526. package/lib/solution/BookingTicket/utils/scan/index.js +109 -91
  527. package/lib/solution/BookingTicket/utils/scan/scanCache.js +43 -90
  528. package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  529. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +127 -0
  530. package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
  531. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +85 -0
  532. package/lib/solution/BuyTickets/index.js +70 -67
  533. package/lib/solution/BuyTickets/types.js +38 -22
  534. package/lib/solution/Checkout/index.d.ts +1 -0
  535. package/lib/solution/Checkout/index.js +1169 -1463
  536. package/lib/solution/Checkout/types.js +61 -91
  537. package/lib/solution/Checkout/utils/index.js +156 -228
  538. package/lib/solution/PlaceOrder/index.js +0 -55
  539. package/lib/solution/RegisterAndLogin/config.js +462 -503
  540. package/lib/solution/RegisterAndLogin/index.js +630 -633
  541. package/lib/solution/RegisterAndLogin/types.js +76 -189
  542. package/lib/solution/RegisterAndLogin/utils.js +125 -183
  543. package/lib/solution/Sales/index.d.ts +50 -5
  544. package/lib/solution/Sales/index.js +498 -238
  545. package/lib/solution/Sales/types.d.ts +26 -2
  546. package/lib/solution/Sales/types.js +33 -27
  547. package/lib/solution/ScanOrder/index.d.ts +27 -21
  548. package/lib/solution/ScanOrder/index.js +936 -864
  549. package/lib/solution/ScanOrder/types.d.ts +33 -11
  550. package/lib/solution/ScanOrder/types.js +34 -34
  551. package/lib/solution/ScanOrder/utils.d.ts +4 -1
  552. package/lib/solution/ScanOrder/utils.js +422 -385
  553. package/lib/solution/ShopDiscount/index.js +233 -235
  554. package/lib/solution/ShopDiscount/types.d.ts +4 -5
  555. package/lib/solution/ShopDiscount/types.js +37 -15
  556. package/lib/solution/ShopDiscount/utils.d.ts +0 -9
  557. package/lib/solution/ShopDiscount/utils.js +172 -309
  558. package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
  559. package/lib/solution/UnifiedBookingSales/index.js +1076 -0
  560. package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
  561. package/lib/solution/UnifiedBookingSales/types.js +33 -0
  562. package/lib/solution/VenueBooking/index.d.ts +32 -51
  563. package/lib/solution/VenueBooking/index.js +1008 -984
  564. package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  565. package/lib/solution/VenueBooking/types.d.ts +1 -3
  566. package/lib/solution/VenueBooking/types.js +39 -20
  567. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
  568. package/lib/solution/VenueBooking/utils/dateSummary.js +62 -25
  569. package/lib/solution/VenueBooking/utils/resource.js +54 -31
  570. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
  571. package/lib/solution/VenueBooking/utils/slotMerge.js +109 -90
  572. package/lib/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
  573. package/lib/solution/VenueBooking/utils/timeSlot.js +133 -138
  574. package/lib/solution/VenueBooking/utils.js +67 -130
  575. package/lib/solution/index.d.ts +2 -0
  576. package/lib/solution/index.js +41 -102
  577. package/lib/store/createStore.js +29 -32
  578. package/lib/types/index.d.ts +12 -2
  579. package/lib/types/index.js +16 -4
  580. package/lib/utils/task.js +36 -36
  581. package/lib/utils/watch.js +47 -81
  582. package/package.json +2 -4
  583. package/dist/solution/Checkout/appointmentDemo.json +0 -1
  584. package/dist/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
  585. package/dist/solution/VenueBooking/utils/smartPricing.js +0 -233
  586. package/lib/solution/Checkout/appointmentDemo.json +0 -1
  587. package/lib/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
  588. package/lib/solution/VenueBooking/utils/smartPricing.js +0 -192
@@ -1,14 +1,16 @@
1
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
1
2
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
3
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
4
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
4
5
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
5
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
6
6
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
7
7
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
8
8
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
9
9
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10
10
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
11
11
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
12
+ function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
13
+ function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
12
14
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
13
15
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
14
16
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
@@ -28,7 +30,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
28
30
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
29
31
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
30
32
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
31
- import { BaseModule } from "../../modules/BaseModule";
33
+ import { BaseSalesImpl } from "../BaseSales";
32
34
  import { DEFAULT_SLOT_CONFIG, VenueBookingHooks } from "./types";
33
35
  import { attachItemRuleLimitsToTopLevelProducts, buildProductKey, buildItemRuleBusinessData, createEmptySummary, getProductIdentityIndex, getSafeProductNum, normalizeOrderProduct, normalizeItemRuleStrategies, toNonNegativeInt, toPriceString } from "./utils";
34
36
  import { createModule } from "../BookingByStep/types";
@@ -45,8 +47,7 @@ import { extractResourceIds, buildResourceProductMap } from "./utils/resource";
45
47
  import { buildTimeSlotGrid, isBusinessHoursCrossDay, generateTimeLabels } from "./utils/timeSlot";
46
48
  import { buildDateRangeSummary } from "./utils/dateSummary";
47
49
  import { mergeConsecutiveSlots, expandMergedSlotToIndividual, buildVenueIdentityKey, buildVenueBookingEntry, buildVenueResourceMetadata, buildPriceBreakdown } from "./utils/slotMerge";
48
- import { buildSlotPriceMapByScheduleSegments, formatProductsWithDataVariant, getPriceForProductAtDatetime, getSlotPriceFromMap } from "./utils/smartPricing";
49
- import { composeLinePrice, createUuidV4, sumOptionUnitPrice } from "../../modules/Order/utils";
50
+ import { composeLinePrice, createUuidV4, getProductSkuOptions, sumOptionUnitPrice } from "../../modules/Order/utils";
50
51
  import { OrderModule } from "../../modules/Order";
51
52
  import { RegisterAndLoginHooks } from "../RegisterAndLogin/types";
52
53
  import Decimal from 'decimal.js';
@@ -62,8 +63,8 @@ function cloneCustomDepositData(customDepositData) {
62
63
  deposit_policy_data: Array.isArray(customDepositData.deposit_policy_data) ? _toConsumableArray(customDepositData.deposit_policy_data) : []
63
64
  });
64
65
  }
65
- export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
66
- _inherits(VenueBookingImpl, _BaseModule);
66
+ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
67
+ _inherits(VenueBookingImpl, _BaseSalesImpl);
67
68
  var _super = _createSuper(VenueBookingImpl);
68
69
  function VenueBookingImpl(name, version) {
69
70
  var _this;
@@ -101,15 +102,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
101
102
  _defineProperty(_assertThisInitialized(_this), "loginEffectDisposers", []);
102
103
  _defineProperty(_assertThisInitialized(_this), "customerLoginRefreshInFlight", null);
103
104
  _defineProperty(_assertThisInitialized(_this), "customerLoginRefreshIdInFlight", null);
104
- /** 最近一次确认登录的客户;登录事件与 user 插件更新之间可能存在时序差。 */
105
- _defineProperty(_assertThisInitialized(_this), "smartPricingCustomerId", void 0);
106
105
  _defineProperty(_assertThisInitialized(_this), "loadAllProductsInFlight", null);
107
106
  _defineProperty(_assertThisInitialized(_this), "productsLoaded", false);
108
107
  _defineProperty(_assertThisInitialized(_this), "loadOpenDataConfigInFlight", null);
109
- /** 按日期缓存 slot 智能定价 Map,避免同周重复 resolveProducts */
110
- _defineProperty(_assertThisInitialized(_this), "slotPriceMapCache", new Map());
111
- /** loadProducts 后缓存的全量商品(venue + addon),供分段算价复用 */
112
- _defineProperty(_assertThisInitialized(_this), "smartPricingProductCatalog", []);
113
108
  return _this;
114
109
  }
115
110
  _createClass(VenueBookingImpl, [{
@@ -192,7 +187,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
192
187
  payload: payload,
193
188
  extra: extra
194
189
  });
195
- } else {}
190
+ } else {
191
+ console.log('[VenueBooking][log-fallback]', params.title, {
192
+ payload: payload,
193
+ extra: extra
194
+ });
195
+ }
196
196
  return _context.abrupt("return");
197
197
  case 6:
198
198
  _context.next = 8;
@@ -273,6 +273,76 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
273
273
  }
274
274
  return addLog;
275
275
  }()
276
+ }, {
277
+ key: "getRegisteredModuleNames",
278
+ value: function getRegisteredModuleNames() {
279
+ return ['scanOrderLogger', 'products', 'order', 'salesSummary', 'venueProducts', 'addonProducts', 'date', 'schedule', 'quotation', 'openData'];
280
+ }
281
+ }, {
282
+ key: "createSubModule",
283
+ value: function createSubModule(moduleName) {
284
+ switch (moduleName) {
285
+ case 'scanOrderLogger':
286
+ return createModule('scanOrderLogger', this.name);
287
+ case 'venueProducts':
288
+ return new ProductList("".concat(this.name, "_venueProducts"));
289
+ case 'addonProducts':
290
+ return new ProductList("".concat(this.name, "_addonProducts"));
291
+ case 'date':
292
+ return new DateModule("".concat(this.name, "_date"));
293
+ case 'openData':
294
+ return new OpenDataModule("".concat(this.name, "_openData"));
295
+ default:
296
+ return _get(_getPrototypeOf(VenueBookingImpl.prototype), "createSubModule", this).call(this, moduleName);
297
+ }
298
+ }
299
+ }, {
300
+ key: "attachProductOriginToTempOrder",
301
+ value: function attachProductOriginToTempOrder(tempOrder, productUid, origin) {
302
+ var _tempOrder$_extend, _tempOrder$_extend2;
303
+ if (!productUid || !origin) return;
304
+ tempOrder._extend = _objectSpread(_objectSpread({}, tempOrder._extend || {}), {}, {
305
+ productsByUid: _objectSpread(_objectSpread({}, ((_tempOrder$_extend = tempOrder._extend) === null || _tempOrder$_extend === void 0 ? void 0 : _tempOrder$_extend.productsByUid) || {}), {}, _defineProperty({}, productUid, _objectSpread(_objectSpread({}, ((_tempOrder$_extend2 = tempOrder._extend) === null || _tempOrder$_extend2 === void 0 || (_tempOrder$_extend2 = _tempOrder$_extend2.productsByUid) === null || _tempOrder$_extend2 === void 0 ? void 0 : _tempOrder$_extend2[productUid]) || {}), {}, {
306
+ origin: origin
307
+ })))
308
+ });
309
+ }
310
+ }, {
311
+ key: "readProductOriginFromTempOrder",
312
+ value: function readProductOriginFromTempOrder(tempOrder, product) {
313
+ var _product$metadata, _tempOrder$_extend3;
314
+ var uid = ((_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.unique_identification_number) || product.identity_key;
315
+ if (uid && (_tempOrder$_extend3 = tempOrder._extend) !== null && _tempOrder$_extend3 !== void 0 && (_tempOrder$_extend3 = _tempOrder$_extend3.productsByUid) !== null && _tempOrder$_extend3 !== void 0 && (_tempOrder$_extend3 = _tempOrder$_extend3[uid]) !== null && _tempOrder$_extend3 !== void 0 && _tempOrder$_extend3.origin) {
316
+ return tempOrder._extend.productsByUid[uid].origin;
317
+ }
318
+ return product._origin;
319
+ }
320
+ }, {
321
+ key: "normalizeVenueProductTitle",
322
+ value: function normalizeVenueProductTitle(value) {
323
+ if (typeof value === 'string') {
324
+ var text = value.trim();
325
+ return text ? {
326
+ auto: text
327
+ } : undefined;
328
+ }
329
+ if (!value || _typeof(value) !== 'object' || Array.isArray(value)) return undefined;
330
+ var source = value;
331
+ var normalized = {};
332
+ Object.entries(source).forEach(function (_ref) {
333
+ var _ref2 = _slicedToArray(_ref, 2),
334
+ key = _ref2[0],
335
+ text = _ref2[1];
336
+ if (typeof text === 'string') normalized[key] = text;
337
+ });
338
+ if (!normalized.auto) {
339
+ var fallback = normalized.original || normalized.en || normalized['zh-CN'] || normalized['zh-HK'];
340
+ if (fallback) normalized.auto = fallback;
341
+ }
342
+ return Object.values(normalized).some(function (text) {
343
+ return String(text || '').trim();
344
+ }) ? normalized : undefined;
345
+ }
276
346
  }, {
277
347
  key: "normalizeCustomerId",
278
348
  value: function normalizeCustomerId(value) {
@@ -420,11 +490,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
420
490
  }, {
421
491
  key: "registerCustomerLoginListeners",
422
492
  value: function registerCustomerLoginListeners() {
423
- var _this2 = this;
493
+ var _this$core2,
494
+ _this$core3,
495
+ _accountModule$getCur,
496
+ _accountModule$getAcc,
497
+ _this2 = this;
424
498
  this.clearLoginEffectListeners();
425
- var createHandleLogin = function createHandleLogin() {
499
+ var accountModule = (_this$core2 = this.core) === null || _this$core2 === void 0 ? void 0 : _this$core2.getModule('account');
500
+ var registerAndLoginModule = (_this$core3 = this.core) === null || _this$core3 === void 0 ? void 0 : _this$core3.getModule('registerAndLogin');
501
+ var currentAccount = (accountModule === null || accountModule === void 0 || (_accountModule$getCur = accountModule.getCurrentAccount) === null || _accountModule$getCur === void 0 ? void 0 : _accountModule$getCur.call(accountModule)) || (accountModule === null || accountModule === void 0 || (_accountModule$getAcc = accountModule.getAccount) === null || _accountModule$getAcc === void 0 ? void 0 : _accountModule$getAcc.call(accountModule)) || null;
502
+ var createHandleLogin = function createHandleLogin(eventName) {
426
503
  return /*#__PURE__*/function () {
427
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(payload) {
504
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(payload) {
428
505
  var customerId;
429
506
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
430
507
  while (1) switch (_context4.prev = _context4.next) {
@@ -447,13 +524,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
447
524
  }, _callee4);
448
525
  }));
449
526
  return function (_x4) {
450
- return _ref.apply(this, arguments);
527
+ return _ref3.apply(this, arguments);
451
528
  };
452
529
  }();
453
530
  };
454
- this.registerLoginEffect(VenueBookingImpl.PISELL1_LOGIN_SUCCESS, createHandleLogin());
455
- this.registerLoginEffect(AccountHooks.OnLogin, createHandleLogin());
456
- this.registerLoginEffect(RegisterAndLoginHooks.onLoginSuccess, createHandleLogin());
531
+ this.registerLoginEffect(AccountHooks.OnLogin, createHandleLogin(AccountHooks.OnLogin));
532
+ this.registerLoginEffect(RegisterAndLoginHooks.onLoginSuccess, createHandleLogin(RegisterAndLoginHooks.onLoginSuccess));
457
533
  }
458
534
  }, {
459
535
  key: "refreshOrderMarketingAfterLogin",
@@ -488,57 +564,47 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
488
564
  case 9:
489
565
  this.customerLoginRefreshIdInFlight = params.customerId;
490
566
  refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
491
- var _this3$core, _this3$core$emit;
492
567
  var _this3$otherParams;
493
568
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
494
569
  while (1) switch (_context5.prev = _context5.next) {
495
570
  case 0:
496
- // 用户插件可能晚于登录 effect 更新;以已确认的登录 payload 作为本次及后续网格算价的身份来源。
497
- _this3.smartPricingCustomerId = params.customerId;
498
- _context5.next = 3;
499
- return _this3.store.order.loadDiscountConfig({
500
- customerId: params.customerId
501
- });
502
- case 3:
503
- _this3.clearSlotPriceMapCache();
504
- _this3.recalculateOrderPricesFromSmartPricing();
505
- // 刷新 holder 表单数据
506
571
  if (!_this3.store.holder) {
507
- _context5.next = 8;
572
+ _context5.next = 3;
508
573
  break;
509
574
  }
510
- _context5.next = 8;
575
+ _context5.next = 3;
511
576
  return _this3.store.holder.refreshAllFormRecords({
512
577
  customer_id: params.customerId,
513
578
  useCache: false
514
579
  });
515
- case 8:
580
+ case 3:
516
581
  if (!_this3.store.quotation) {
517
- _context5.next = 11;
582
+ _context5.next = 6;
518
583
  break;
519
584
  }
520
- _context5.next = 11;
585
+ _context5.next = 6;
521
586
  return _this3.store.quotation.loadQuotations({
522
587
  channel: (_this3$otherParams = _this3.otherParams) === null || _this3$otherParams === void 0 ? void 0 : _this3$otherParams.channel
523
588
  });
524
- case 11:
525
- _context5.next = 13;
589
+ case 6:
590
+ _this3.recalculateOrderPricesFromQuotation();
591
+ _context5.next = 9;
592
+ return _this3.store.order.loadDiscountConfig({
593
+ customerId: params.customerId
594
+ });
595
+ case 9:
596
+ _context5.next = 11;
526
597
  return _this3.store.order.recalculateSummary({
527
598
  createIfMissing: true
528
599
  });
529
- case 13:
600
+ case 11:
530
601
  _this3.store.order.persistTempOrder();
531
- _context5.next = 16;
602
+ _context5.next = 14;
532
603
  return _this3.refreshItemRuleQuantityLimits();
533
- case 16:
534
- _context5.next = 18;
604
+ case 14:
605
+ _context5.next = 16;
535
606
  return _this3.refreshCartValidationPassed();
536
- case 18:
537
- _context5.next = 20;
538
- return (_this3$core = _this3.core) === null || _this3$core === void 0 || (_this3$core = _this3$core.effects) === null || _this3$core === void 0 || (_this3$core$emit = _this3$core.emit) === null || _this3$core$emit === void 0 ? void 0 : _this3$core$emit.call(_this3$core, VenueBookingHooks.onSmartPricingUpdated, {
539
- customerId: params.customerId
540
- });
541
- case 20:
607
+ case 16:
542
608
  case "end":
543
609
  return _context5.stop();
544
610
  }
@@ -583,12 +649,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
583
649
  _this$otherParams2,
584
650
  _this$otherParams3,
585
651
  _this4 = this,
586
- _this$otherParams4,
587
- _this$otherParams5,
588
652
  _this$otherParams6,
589
653
  _this$otherParams7,
590
- _this$otherParams8;
654
+ _this$otherParams8,
655
+ _this$otherParams9,
656
+ _this$otherParams10;
591
657
  var options,
658
+ _this$otherParams4,
659
+ _this$otherParams5,
592
660
  baseModules,
593
661
  venueProductsModule,
594
662
  addonProductsModule,
@@ -603,16 +671,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
603
671
  holderModule,
604
672
  _this$store$order,
605
673
  _this$store$order2,
674
+ _this$store$quotation,
675
+ _this$otherParams11,
606
676
  _args7 = arguments;
607
677
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
608
678
  while (1) switch (_context7.prev = _context7.next) {
609
679
  case 0:
610
680
  options = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
611
681
  this.logMethodStart('initialize');
612
- this.core = core;
613
- this.initializeOptions = options || {};
614
682
  this.store = _objectSpread(_objectSpread({}, this.store), options.store);
615
- this.smartPricingCustomerId = undefined;
616
683
  this.store.entryContext = ((_options$otherParams = options.otherParams) === null || _options$otherParams === void 0 ? void 0 : _options$otherParams.entryContext) || this.store.entryContext;
617
684
  this.store.status = 'initializing';
618
685
  this.store.error = null;
@@ -630,22 +697,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
630
697
  passed: null,
631
698
  failures: []
632
699
  };
633
- this.window = core.getPlugin('window');
634
- this.request = core.getPlugin('request');
635
- if (this.window) {
636
- _context7.next = 25;
637
- break;
638
- }
639
- this.logMethodError('initialize', 'window plugin missing');
640
- throw new Error('venueBooking解决方案需要 window 插件支持');
641
- case 25:
642
- if (this.request) {
643
- _context7.next = 28;
644
- break;
700
+ _context7.next = 19;
701
+ return _get(_getPrototypeOf(VenueBookingImpl.prototype), "initialize", this).call(this, core, options);
702
+ case 19:
703
+ if (this.store.scanOrderLogger) {
704
+ this.store.scanOrderLogger.setProvider(((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.loggerProvider) || 'feishu');
705
+ this.store.scanOrderLogger.setProviderConfig(((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.loggerConfig) || {
706
+ feishu: {
707
+ webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/8f069b14-9d39-4728-8f78-b56f393bfde8',
708
+ errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/bdefae5e-f233-4705-8688-946887d9543d'
709
+ }
710
+ });
711
+ this.store.scanOrderLogger.setContext(this.getLoggerContext());
645
712
  }
646
- this.logMethodError('initialize', 'request plugin missing');
647
- throw new Error('venueBooking解决方案需要 request 插件支持');
648
- case 28:
649
713
  // 注册基础模块(order, salesSummary, products, logger)
650
714
  baseModules = ['scanOrderLogger', 'products', 'order', 'salesSummary'];
651
715
  baseModules.forEach(function (step) {
@@ -658,10 +722,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
658
722
  } : {};
659
723
  var loggerProvider = ((_this4$otherParams = _this4.otherParams) === null || _this4$otherParams === void 0 ? void 0 : _this4$otherParams.loggerProvider) || 'feishu';
660
724
  var loggerConfig = ((_this4$otherParams2 = _this4.otherParams) === null || _this4$otherParams2 === void 0 ? void 0 : _this4$otherParams2.loggerConfig) || {
661
- feishu: {
662
- webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/8f069b14-9d39-4728-8f78-b56f393bfde8',
663
- errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/bdefae5e-f233-4705-8688-946887d9543d'
664
- }
725
+ // feishu: {
726
+ // webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/8f069b14-9d39-4728-8f78-b56f393bfde8',
727
+ // errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/bdefae5e-f233-4705-8688-946887d9543d',
728
+ // },
665
729
  };
666
730
  _this4.core.registerModule(targetModule, {
667
731
  initialState: initialState,
@@ -733,11 +797,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
733
797
  this.core.registerModule(openDataModule, {
734
798
  otherParams: _objectSpread(_objectSpread({}, this.otherParams), {}, {
735
799
  fatherModule: this.name,
736
- openCache: !!((_this$otherParams4 = this.otherParams) !== null && _this$otherParams4 !== void 0 && _this$otherParams4.cacheId),
737
- cacheId: (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.cacheId
800
+ openCache: !!((_this$otherParams6 = this.otherParams) !== null && _this$otherParams6 !== void 0 && _this$otherParams6.cacheId),
801
+ cacheId: (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.cacheId
738
802
  })
739
803
  });
740
- if ((_this$otherParams6 = this.otherParams) !== null && _this$otherParams6 !== void 0 && _this$otherParams6.cacheId) {
804
+ if ((_this$otherParams8 = this.otherParams) !== null && _this$otherParams8 !== void 0 && _this$otherParams8.cacheId) {
741
805
  sessionData = this.window.sessionStorage.getItem(this.name);
742
806
  if (sessionData) {
743
807
  try {
@@ -754,48 +818,52 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
754
818
  initialState: holderCacheState,
755
819
  otherParams: _objectSpread(_objectSpread({}, this.otherParams), {}, {
756
820
  fatherModule: this.name,
757
- openCache: !!((_this$otherParams7 = this.otherParams) !== null && _this$otherParams7 !== void 0 && _this$otherParams7.cacheId),
758
- cacheId: (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.cacheId
821
+ openCache: !!((_this$otherParams9 = this.otherParams) !== null && _this$otherParams9 !== void 0 && _this$otherParams9.cacheId),
822
+ cacheId: (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.cacheId
759
823
  })
760
824
  });
761
- if (this.store.scanOrderLogger) {
762
- this.store.scanOrderLogger.setContext(this.getLoggerContext());
763
- }
764
825
  this.registerCustomerLoginListeners();
765
- _context7.prev = 54;
766
- _context7.next = 57;
826
+ console.log('[VenueBooking] 初始化开始');
827
+ _context7.prev = 46;
828
+ _context7.next = 49;
767
829
  return (_this$store$order = this.store.order) === null || _this$store$order === void 0 ? void 0 : _this$store$order.recalculateSummary({
768
830
  createIfMissing: false
769
831
  });
770
- case 57:
832
+ case 49:
771
833
  (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || _this$store$order2.persistTempOrder();
772
- _context7.next = 60;
834
+ _context7.next = 52;
773
835
  return this.loadRuntimeConfigs();
774
- case 60:
836
+ case 52:
775
837
  if (!this.store.schedule) {
776
- _context7.next = 63;
838
+ _context7.next = 57;
777
839
  break;
778
840
  }
779
- _context7.next = 63;
841
+ _context7.next = 55;
780
842
  return this.store.schedule.loadAllSchedule();
781
- case 63:
782
- _context7.next = 65;
843
+ case 55:
844
+ this.injectScheduleResolverToQuotation();
845
+ (_this$store$quotation = this.store.quotation) === null || _this$store$quotation === void 0 || _this$store$quotation.loadQuotations({
846
+ channel: (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.channel
847
+ });
848
+ case 57:
849
+ _context7.next = 59;
783
850
  return this.refreshItemRuleQuantityLimits();
784
- case 65:
851
+ case 59:
785
852
  this.store.status = 'ready';
786
- _context7.next = 68;
853
+ console.log('[VenueBooking] 初始化完成');
854
+ _context7.next = 63;
787
855
  return this.core.effects.emit(VenueBookingHooks.onInited, {
788
856
  status: this.store.status
789
857
  });
790
- case 68:
858
+ case 63:
791
859
  this.logMethodSuccess('initialize', {
792
860
  status: this.store.status
793
861
  });
794
- _context7.next = 78;
862
+ _context7.next = 73;
795
863
  break;
796
- case 71:
797
- _context7.prev = 71;
798
- _context7.t0 = _context7["catch"](54);
864
+ case 66:
865
+ _context7.prev = 66;
866
+ _context7.t0 = _context7["catch"](46);
799
867
  this.store.status = 'error';
800
868
  this.store.error = _context7.t0 instanceof Error ? _context7.t0.message : '初始化失败';
801
869
  console.error('[VenueBooking] 初始化失败', _context7.t0);
@@ -803,11 +871,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
803
871
  status: this.store.status
804
872
  });
805
873
  throw _context7.t0;
806
- case 78:
874
+ case 73:
807
875
  case "end":
808
876
  return _context7.stop();
809
877
  }
810
- }, _callee7, this, [[54, 71]]);
878
+ }, _callee7, this, [[46, 66]]);
811
879
  }));
812
880
  function initialize(_x6) {
813
881
  return _initialize.apply(this, arguments);
@@ -826,8 +894,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
826
894
  _context8.next = 4;
827
895
  return this.core.effects.emit(VenueBookingHooks.onDestroy, {});
828
896
  case 4:
897
+ console.log('[VenueBooking] 已销毁');
829
898
  this.logMethodSuccess('destroy');
830
- case 5:
899
+ case 6:
831
900
  case "end":
832
901
  return _context8.stop();
833
902
  }
@@ -846,26 +915,27 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
846
915
  while (1) switch (_context9.prev = _context9.next) {
847
916
  case 0:
848
917
  this.logMethodStart('retryInit');
849
- _context9.next = 3;
918
+ console.log('[VenueBooking] retryInit 调用');
919
+ _context9.next = 4;
850
920
  return this.core.effects.emit(VenueBookingHooks.onRetryInit, {});
851
- case 3:
852
- _context9.prev = 3;
853
- _context9.next = 6;
921
+ case 4:
922
+ _context9.prev = 4;
923
+ _context9.next = 7;
854
924
  return this.initialize(this.core, this.initializeOptions);
855
- case 6:
925
+ case 7:
856
926
  this.logMethodSuccess('retryInit');
857
- _context9.next = 13;
927
+ _context9.next = 14;
858
928
  break;
859
- case 9:
860
- _context9.prev = 9;
861
- _context9.t0 = _context9["catch"](3);
929
+ case 10:
930
+ _context9.prev = 10;
931
+ _context9.t0 = _context9["catch"](4);
862
932
  this.logMethodError('retryInit', _context9.t0);
863
933
  throw _context9.t0;
864
- case 13:
934
+ case 14:
865
935
  case "end":
866
936
  return _context9.stop();
867
937
  }
868
- }, _callee9, this, [[3, 9]]);
938
+ }, _callee9, this, [[4, 10]]);
869
939
  }));
870
940
  function retryInit() {
871
941
  return _retryInit.apply(this, arguments);
@@ -880,35 +950,36 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
880
950
  while (1) switch (_context10.prev = _context10.next) {
881
951
  case 0:
882
952
  this.logMethodStart('refresh');
883
- _context10.prev = 1;
953
+ console.log('[VenueBooking] refresh 调用');
954
+ _context10.prev = 2;
884
955
  this.store.status = 'initializing';
885
- _context10.next = 5;
956
+ _context10.next = 6;
886
957
  return this.loadRuntimeConfigs();
887
- case 5:
888
- _context10.next = 7;
958
+ case 6:
959
+ _context10.next = 8;
889
960
  return this.refreshItemRuleQuantityLimits();
890
- case 7:
961
+ case 8:
891
962
  this.store.status = 'ready';
892
- _context10.next = 10;
963
+ _context10.next = 11;
893
964
  return this.core.effects.emit(VenueBookingHooks.onRefresh, {
894
965
  status: this.store.status
895
966
  });
896
- case 10:
967
+ case 11:
897
968
  this.logMethodSuccess('refresh', {
898
969
  status: this.store.status
899
970
  });
900
- _context10.next = 17;
971
+ _context10.next = 18;
901
972
  break;
902
- case 13:
903
- _context10.prev = 13;
904
- _context10.t0 = _context10["catch"](1);
973
+ case 14:
974
+ _context10.prev = 14;
975
+ _context10.t0 = _context10["catch"](2);
905
976
  this.logMethodError('refresh', _context10.t0);
906
977
  throw _context10.t0;
907
- case 17:
978
+ case 18:
908
979
  case "end":
909
980
  return _context10.stop();
910
981
  }
911
- }, _callee10, this, [[1, 13]]);
982
+ }, _callee10, this, [[2, 14]]);
912
983
  }));
913
984
  function refresh() {
914
985
  return _refresh.apply(this, arguments);
@@ -945,113 +1016,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
945
1016
  };
946
1017
  }
947
1018
 
948
- /** 清除 slot 价格分段缓存(商品重载 / 登录后 customerId 变化时调用) */
949
- }, {
950
- key: "clearSlotPriceMapCache",
951
- value: function clearSlotPriceMapCache() {
952
- this.slotPriceMapCache.clear();
953
- }
954
-
955
- /** 读取当前登录 customerId */
956
- }, {
957
- key: "resolveCustomerIdForSmartPricing",
958
- value: function resolveCustomerIdForSmartPricing() {
959
- if (this.smartPricingCustomerId) return this.smartPricingCustomerId;
960
- try {
961
- var _this$core2, _userPlugin$get;
962
- var userPlugin = (_this$core2 = this.core) === null || _this$core2 === void 0 ? void 0 : _this$core2.getPlugin('user');
963
- var customerId = Number(userPlugin === null || userPlugin === void 0 || (_userPlugin$get = userPlugin.get) === null || _userPlugin$get === void 0 || (_userPlugin$get = _userPlugin$get.call(userPlugin)) === null || _userPlugin$get === void 0 ? void 0 : _userPlugin$get.id);
964
- return Number.isFinite(customerId) && customerId > 0 ? customerId : undefined;
965
- } catch (_unused3) {
966
- return undefined;
967
- }
968
- }
969
- }, {
970
- key: "resolveAvailableWalletIdsForSmartPricing",
971
- value: function resolveAvailableWalletIdsForSmartPricing() {
972
- var _this$store$order3, _this$store$order3$ge, _this$otherParams9, _this$otherParams10, _this$otherParams11, _this$otherParams12;
973
- var orderWalletIds = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || (_this$store$order3$ge = _this$store$order3.getAvailableWalletIds) === null || _this$store$order3$ge === void 0 ? void 0 : _this$store$order3$ge.call(_this$store$order3);
974
- var fallbackWalletIds = ((_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.available_wallet_ids) || ((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.availableWalletIds) || ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 || (_this$otherParams11 = _this$otherParams11.strategy_context) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.available_wallet_ids) || ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 || (_this$otherParams12 = _this$otherParams12.strategy_context) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.availableWalletIds);
975
- var source = Array.isArray(orderWalletIds) && orderWalletIds.length ? orderWalletIds : fallbackWalletIds;
976
- if (!Array.isArray(source)) return [];
977
- var ids = source.map(function (item) {
978
- return Number(item);
979
- }).filter(function (item) {
980
- return Number.isFinite(item) && item > 0;
981
- });
982
- return Array.from(new Set(ids));
983
- }
984
-
985
- /** 读取 schedule 全量列表,供智能定价 schedule_match 使用 */
986
- }, {
987
- key: "getScheduleListForSmartPricing",
988
- value: function getScheduleListForSmartPricing() {
989
- var _store;
990
- var scheduleModule = this.store.schedule;
991
- var list = scheduleModule === null || scheduleModule === void 0 || (_store = scheduleModule.store) === null || _store === void 0 ? void 0 : _store.scheduleList;
992
- return Array.isArray(list) ? list : [];
993
- }
994
-
995
- /** 构建智能定价上下文,对齐 OS Server buildProductFormatterContext */
996
- }, {
997
- key: "buildSmartPricingContext",
998
- value: function buildSmartPricingContext(customerId) {
999
- var _this$core3, _this$otherParams13, _this$otherParams14, _this$otherParams15, _this$otherParams16, _this$otherParams17, _this$otherParams18, _this$otherParams19;
1000
- var evaluator = (_this$core3 = this.core) === null || _this$core3 === void 0 || (_this$core3 = _this$core3.context) === null || _this$core3 === void 0 ? void 0 : _this$core3.dataVariantEvaluator;
1001
- return {
1002
- evaluator: evaluator,
1003
- scheduleList: this.getScheduleListForSmartPricing(),
1004
- menuList: ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.menuList) || ((_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 || (_this$otherParams14 = _this$otherParams14.openData) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.menuList) || [],
1005
- customerId: customerId !== null && customerId !== void 0 ? customerId : this.resolveCustomerIdForSmartPricing(),
1006
- availableWalletIds: this.resolveAvailableWalletIdsForSmartPricing(),
1007
- channel: (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.channel,
1008
- businessCode: (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.businessCode,
1009
- orderType: ((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.orderType) || ((_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.type),
1010
- strategy_context: (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.strategy_context
1011
- };
1012
- }
1013
-
1014
- /** venue + addon 全量商品,供智能定价评估 */
1015
- }, {
1016
- key: "getAllProductsForSmartPricing",
1017
- value: function getAllProductsForSmartPricing() {
1018
- if (this.smartPricingProductCatalog.length) {
1019
- return this.smartPricingProductCatalog;
1020
- }
1021
- var venueList = this.getVenueProducts();
1022
- var addonList = this.getAddonProductsList();
1023
- return [].concat(_toConsumableArray(venueList), _toConsumableArray(addonList));
1024
- }
1025
- }, {
1026
- key: "getSlotPriceMapCacheKey",
1027
- value: function getSlotPriceMapCacheKey(date, context) {
1028
- var _context$customerId, _context$channel, _context$businessCode;
1029
- return [date, (_context$customerId = context.customerId) !== null && _context$customerId !== void 0 ? _context$customerId : '', (context.availableWalletIds || []).join(','), (_context$channel = context.channel) !== null && _context$channel !== void 0 ? _context$channel : '', (_context$businessCode = context.businessCode) !== null && _context$businessCode !== void 0 ? _context$businessCode : ''].join('|');
1030
- }
1031
-
1032
- /**
1033
- * 按 schedule 分段构建 slot 价格 Map,带实例级缓存。
1034
- */
1035
- }, {
1036
- key: "buildSlotPriceMapForDate",
1037
- value: function buildSlotPriceMapForDate(date, config, productIds) {
1038
- var context = this.buildSmartPricingContext();
1039
- var cacheKey = this.getSlotPriceMapCacheKey(date, context);
1040
- var cached = this.slotPriceMapCache.get(cacheKey);
1041
- if (cached) return cached;
1042
- var timeLabels = generateTimeLabels(config);
1043
- var slotPriceMap = buildSlotPriceMapByScheduleSegments({
1044
- products: this.getAllProductsForSmartPricing(),
1045
- productIds: productIds,
1046
- date: date,
1047
- timeLabels: timeLabels,
1048
- config: config,
1049
- context: context
1050
- });
1051
- this.slotPriceMapCache.set(cacheKey, slotPriceMap);
1052
- return slotPriceMap;
1053
- }
1054
-
1055
1019
  // ─── 场地商品 & 附加商品 ───
1056
1020
  }, {
1057
1021
  key: "loadAllProducts",
@@ -1086,7 +1050,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1086
1050
  key: "_doLoadAllProducts",
1087
1051
  value: function () {
1088
1052
  var _doLoadAllProducts2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
1089
- var _this$otherParams20, _this$store$venueProd, associatedMenus, menuListIds, allProducts, rawList, list, venueList, addonList, venueStore, _this$store$order4, _this$store$order4$ge, products;
1053
+ var _this$otherParams12, _this$store$venueProd, associatedMenus, menuListIds, allProducts, list, venueList, addonList, venueStore, _this$store$order3, _this$store$order3$ge, products;
1090
1054
  return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1091
1055
  while (1) switch (_context12.prev = _context12.next) {
1092
1056
  case 0:
@@ -1107,7 +1071,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1107
1071
  _context12.next = 8;
1108
1072
  return this.loadOpenDataConfig();
1109
1073
  case 8:
1110
- associatedMenus = ((_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 || (_this$otherParams20 = _this$otherParams20.openData) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20['menu.associated_menus']) || [];
1074
+ associatedMenus = ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 || (_this$otherParams12 = _this$otherParams12.openData) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12['menu.associated_menus']) || [];
1111
1075
  if (associatedMenus.length) {
1112
1076
  _context12.next = 12;
1113
1077
  break;
@@ -1123,16 +1087,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1123
1087
  menu_list_ids: menuListIds,
1124
1088
  cacheId: this.cacheId,
1125
1089
  schedule_date: dayjs().format('YYYY-MM-DD'),
1126
- schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
1127
- with_extra: ['dataVariants']
1090
+ schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
1128
1091
  });
1129
1092
  case 15:
1130
1093
  allProducts = _context12.sent;
1131
- rawList = Array.isArray(allProducts) ? allProducts : [];
1132
- list = rawList;
1133
- this.smartPricingProductCatalog = rawList.slice();
1134
- list = formatProductsWithDataVariant(list, this.buildSmartPricingContext(), dayjs().format('YYYY-MM-DD HH:mm:ss'));
1135
- this.clearSlotPriceMapCache();
1094
+ list = Array.isArray(allProducts) ? allProducts : [];
1136
1095
  venueList = list.filter(function (p) {
1137
1096
  return p.duration != null;
1138
1097
  });
@@ -1150,13 +1109,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1150
1109
 
1151
1110
  // 加载 holder 表单
1152
1111
  if (!this.store.order) {
1153
- _context12.next = 31;
1112
+ _context12.next = 27;
1154
1113
  break;
1155
1114
  }
1156
- products = ((_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 || (_this$store$order4$ge = _this$store$order4.getOrderProducts) === null || _this$store$order4$ge === void 0 ? void 0 : _this$store$order4$ge.call(_this$store$order4)) || [];
1157
- _context12.next = 31;
1115
+ products = ((_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || (_this$store$order3$ge = _this$store$order3.getOrderProducts) === null || _this$store$order3$ge === void 0 ? void 0 : _this$store$order3$ge.call(_this$store$order3)) || [];
1116
+ _context12.next = 27;
1158
1117
  return this.preloadHolderForms(products);
1159
- case 31:
1118
+ case 27:
1160
1119
  this.productsLoaded = true;
1161
1120
  this.logMethodSuccess('loadAllProducts', {
1162
1121
  total: list.length,
@@ -1168,16 +1127,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1168
1127
  venueProducts: venueList,
1169
1128
  addonProducts: addonList
1170
1129
  });
1171
- case 36:
1172
- _context12.prev = 36;
1130
+ case 32:
1131
+ _context12.prev = 32;
1173
1132
  _context12.t0 = _context12["catch"](1);
1174
1133
  this.logMethodError('loadAllProducts', _context12.t0);
1175
1134
  throw _context12.t0;
1176
- case 40:
1135
+ case 36:
1177
1136
  case "end":
1178
1137
  return _context12.stop();
1179
1138
  }
1180
- }, _callee12, this, [[1, 36]]);
1139
+ }, _callee12, this, [[1, 32]]);
1181
1140
  }));
1182
1141
  function _doLoadAllProducts() {
1183
1142
  return _doLoadAllProducts2.apply(this, arguments);
@@ -1496,11 +1455,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1496
1455
  config: this.baseSlotConfig,
1497
1456
  rawResources: this.store.rawResourceData,
1498
1457
  resourceProductMap: this.resourceProductMap,
1458
+ quotationModule: this.store.quotation,
1499
1459
  resolveConfig: function resolveConfig(date) {
1500
1460
  return _this6.resolveSlotConfigForDate(date);
1501
- },
1502
- buildSlotPriceMap: function buildSlotPriceMap(date, config, productIds) {
1503
- return _this6.buildSlotPriceMapForDate(date, config, productIds);
1504
1461
  }
1505
1462
  });
1506
1463
  }
@@ -1508,16 +1465,26 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1508
1465
  key: "getTimeSlotGrid",
1509
1466
  value: function getTimeSlotGrid(date) {
1510
1467
  var resolvedSlotConfig = this.syncOperatingHoursToSlotConfig(date);
1511
- var productIds = _toConsumableArray(new Set(_toConsumableArray(this.resourceProductMap.values()).flat().map(function (m) {
1512
- return m.productId;
1513
- })));
1514
- var slotPriceMap = productIds.length ? this.buildSlotPriceMapForDate(date, resolvedSlotConfig, productIds) : undefined;
1468
+ var quotationPriceMap;
1469
+ if (this.store.quotation) {
1470
+ var productIds = _toConsumableArray(new Set(_toConsumableArray(this.resourceProductMap.values()).flat().map(function (m) {
1471
+ return m.productId;
1472
+ })));
1473
+ var timeLabels = generateTimeLabels(resolvedSlotConfig);
1474
+ var timePoints = timeLabels.map(function (label) {
1475
+ return "".concat(date, " ").concat(label);
1476
+ });
1477
+ quotationPriceMap = this.store.quotation.buildProductPriceMap({
1478
+ productIds: productIds,
1479
+ timePoints: timePoints
1480
+ });
1481
+ }
1515
1482
  return buildTimeSlotGrid({
1516
1483
  date: date,
1517
1484
  config: resolvedSlotConfig,
1518
1485
  rawResources: this.store.rawResourceData,
1519
1486
  resourceProductMap: this.resourceProductMap,
1520
- slotPriceMap: slotPriceMap
1487
+ quotationPriceMap: quotationPriceMap
1521
1488
  });
1522
1489
  }
1523
1490
 
@@ -1617,8 +1584,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1617
1584
  }, {
1618
1585
  key: "getSelectedSlotsForResource",
1619
1586
  value: function getSelectedSlotsForResource(resourceId, productId) {
1620
- var _this$store$order5;
1621
- var tempOrder = (_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 ? void 0 : _this$store$order5.getTempOrder();
1587
+ var _this$store$order4;
1588
+ var tempOrder = (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 ? void 0 : _this$store$order4.getTempOrder();
1622
1589
  if (!tempOrder) return [];
1623
1590
  var venueProducts = tempOrder.products.filter(function (p) {
1624
1591
  var _p$metadata, _p$metadata2;
@@ -1779,9 +1746,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1779
1746
  }, {
1780
1747
  key: "getAllSelectedSlots",
1781
1748
  value: function getAllSelectedSlots() {
1782
- var _this$store$order6;
1749
+ var _this$store$order5;
1783
1750
  var result = new Map();
1784
- var tempOrder = (_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 ? void 0 : _this$store$order6.getTempOrder();
1751
+ var tempOrder = (_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 ? void 0 : _this$store$order5.getTempOrder();
1785
1752
  if (!tempOrder) return result;
1786
1753
  var venueProducts = tempOrder.products.filter(function (p) {
1787
1754
  var _p$metadata3;
@@ -1792,9 +1759,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1792
1759
  _step10;
1793
1760
  try {
1794
1761
  var _loop2 = function _loop2() {
1795
- var _product$metadata;
1762
+ var _product$metadata2;
1796
1763
  var product = _step10.value;
1797
- var resourceId = (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.resource_id;
1764
+ var resourceId = (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.resource_id;
1798
1765
  if (resourceId == null) return 1; // continue
1799
1766
  var productId = Number(product.product_id);
1800
1767
  var existing = result.get(resourceId) || [];
@@ -1841,8 +1808,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1841
1808
  key: "reconcileOrderForResourceProduct",
1842
1809
  value: (function () {
1843
1810
  var _reconcileOrderForResourceProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(resourceId, productId, slots) {
1844
- var _this$store$order7, _this$store$order7$ge;
1845
- var mappings, mapping, tempOrder, matchesCurrent, merged, rawResource, childRawResources, venueProduct, i, _rawResource$form_id, _venueProduct$is_char, group, identityKey, bookingUuid, startMoment, endMoment, duration, customDepositData, resourceEntry, booking, products;
1811
+ var _this$store$order6, _this$store$order6$ge;
1812
+ var mappings, mapping, tempOrder, matchesCurrent, merged, rawResource, childRawResources, venueProduct, i, _rawResource$form_id, _venueProduct$is_char, group, identityKey, bookingUuid, startMoment, endMoment, duration, customDepositData, productTitle, resourceEntry, venueProductOrigin, normalizedVenueOrderProduct, venueOrderProduct, booking, products;
1846
1813
  return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1847
1814
  while (1) switch (_context18.prev = _context18.next) {
1848
1815
  case 0:
@@ -1907,6 +1874,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1907
1874
  endMoment = dayjs(group.endTime, 'YYYY-MM-DD HH:mm');
1908
1875
  duration = endMoment.diff(startMoment, 'minute');
1909
1876
  customDepositData = cloneCustomDepositData(venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.custom_deposit_data);
1877
+ productTitle = this.normalizeVenueProductTitle(venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.product_title) || this.normalizeVenueProductTitle(venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.title) || this.normalizeVenueProductTitle(mapping.productTitle);
1910
1878
  resourceEntry = {
1911
1879
  relation_type: 'form',
1912
1880
  like_status: 'common',
@@ -1935,7 +1903,45 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1935
1903
  };
1936
1904
  });
1937
1905
  }
1938
- tempOrder.products.push(normalizeOrderProduct({
1906
+ venueProductOrigin = {
1907
+ name: mapping.productTitle,
1908
+ product_title: productTitle,
1909
+ cover: (venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.cover) || '',
1910
+ custom_deposit_data: customDepositData,
1911
+ id: 0,
1912
+ number: 1,
1913
+ registration_type: 'all',
1914
+ relation_products: [],
1915
+ is_all: false,
1916
+ product: {
1917
+ product_id: mapping.productId,
1918
+ product_variant_id: 0,
1919
+ num: 1,
1920
+ product_bundle: [],
1921
+ product_sku: {
1922
+ option: []
1923
+ },
1924
+ discount_list: [],
1925
+ custom_deposit_data: customDepositData,
1926
+ metadata: {}
1927
+ },
1928
+ sub_type: 'minutes',
1929
+ duration: duration,
1930
+ like_status: 'common',
1931
+ resources: [resourceEntry],
1932
+ schedule_id: 0,
1933
+ select_date: startMoment.format('YYYY-MM-DD'),
1934
+ start_date: startMoment.format('YYYY-MM-DD'),
1935
+ start_time: startMoment.format('HH:mm'),
1936
+ end_date: endMoment.format('YYYY-MM-DD'),
1937
+ end_time: endMoment.format('HH:mm'),
1938
+ metadata: {
1939
+ venue_booking: true,
1940
+ slot_count: group.slotCount
1941
+ },
1942
+ holder: null
1943
+ };
1944
+ normalizedVenueOrderProduct = normalizeOrderProduct({
1939
1945
  product_id: mapping.productId,
1940
1946
  product_variant_id: 0,
1941
1947
  identity_key: identityKey,
@@ -1943,8 +1949,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1943
1949
  selling_price: group.totalPrice,
1944
1950
  original_price: group.totalPrice,
1945
1951
  is_charge_tax: (_venueProduct$is_char = venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.is_charge_tax) !== null && _venueProduct$is_char !== void 0 ? _venueProduct$is_char : 0,
1946
- metadata: {
1947
- venue_booking: true,
1952
+ metadata: _objectSpread(_objectSpread({
1953
+ venue_booking: true
1954
+ }, productTitle ? {
1955
+ product_title: productTitle
1956
+ } : {}), {}, {
1948
1957
  resource_id: resourceId,
1949
1958
  resource_form_id: mapping.formId,
1950
1959
  resource_name: mapping.resourceName,
@@ -1954,48 +1963,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1954
1963
  booking_uid: bookingUuid,
1955
1964
  price_breakdown: buildPriceBreakdown({
1956
1965
  group: group,
1957
- productId: mapping.productId
1966
+ productId: mapping.productId,
1967
+ quotation: this.store.quotation
1958
1968
  })
1959
- },
1960
- _origin: {
1961
- name: mapping.productTitle,
1962
- cover: (venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.cover) || '',
1963
- custom_deposit_data: customDepositData,
1964
- id: 0,
1965
- number: 1,
1966
- registration_type: 'all',
1967
- relation_products: [],
1968
- is_all: false,
1969
- product: {
1970
- product_id: mapping.productId,
1971
- product_variant_id: 0,
1972
- num: 1,
1973
- product_bundle: [],
1974
- product_option_item: [],
1975
- discount_list: [],
1976
- custom_deposit_data: customDepositData,
1977
- metadata: {},
1978
- holder_config: venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.holder_config,
1979
- bookingUuid: bookingUuid,
1980
- shop_id: (venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.shop_id) || 0
1981
- },
1982
- sub_type: 'minutes',
1983
- duration: duration,
1984
- like_status: 'common',
1985
- resources: [resourceEntry],
1986
- schedule_id: 0,
1987
- select_date: startMoment.format('YYYY-MM-DD'),
1988
- start_date: startMoment.format('YYYY-MM-DD'),
1989
- start_time: startMoment.format('HH:mm'),
1990
- end_date: endMoment.format('YYYY-MM-DD'),
1991
- end_time: endMoment.format('HH:mm'),
1992
- metadata: {
1993
- venue_booking: true,
1994
- slot_count: group.slotCount
1995
- },
1996
- holder: null
1997
- }
1998
- }));
1969
+ }),
1970
+ _origin: venueProductOrigin
1971
+ });
1972
+ venueOrderProduct = productTitle ? _objectSpread(_objectSpread({}, normalizedVenueOrderProduct), {}, {
1973
+ product_title: productTitle
1974
+ }) : normalizedVenueOrderProduct;
1975
+ this.attachProductOriginToTempOrder(tempOrder, identityKey, venueProductOrigin);
1976
+ tempOrder.products.push(venueOrderProduct);
1999
1977
  booking = buildVenueBookingEntry({
2000
1978
  group: group,
2001
1979
  resourceId: resourceId,
@@ -2009,7 +1987,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2009
1987
  }
2010
1988
 
2011
1989
  // 获取表单信息
2012
- products = ((_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 || (_this$store$order7$ge = _this$store$order7.getOrderProducts) === null || _this$store$order7$ge === void 0 ? void 0 : _this$store$order7$ge.call(_this$store$order7)) || [];
1990
+ products = ((_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 || (_this$store$order6$ge = _this$store$order6.getOrderProducts) === null || _this$store$order6$ge === void 0 ? void 0 : _this$store$order6$ge.call(_this$store$order6)) || [];
2013
1991
  _context18.next = 25;
2014
1992
  return this.preloadHolderForms(products);
2015
1993
  case 25:
@@ -2094,25 +2072,36 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2094
2072
  _context19.next = 6;
2095
2073
  return this.store.schedule.loadAllSchedule();
2096
2074
  case 6:
2075
+ this.injectScheduleResolverToQuotation();
2097
2076
  this.logMethodSuccess('loadSchedules');
2098
- _context19.next = 13;
2077
+ _context19.next = 14;
2099
2078
  break;
2100
- case 9:
2101
- _context19.prev = 9;
2079
+ case 10:
2080
+ _context19.prev = 10;
2102
2081
  _context19.t0 = _context19["catch"](1);
2103
2082
  this.logMethodError('loadSchedules', _context19.t0);
2104
2083
  throw _context19.t0;
2105
- case 13:
2084
+ case 14:
2106
2085
  case "end":
2107
2086
  return _context19.stop();
2108
2087
  }
2109
- }, _callee19, this, [[1, 9]]);
2088
+ }, _callee19, this, [[1, 10]]);
2110
2089
  }));
2111
2090
  function loadSchedules() {
2112
2091
  return _loadSchedules.apply(this, arguments);
2113
2092
  }
2114
2093
  return loadSchedules;
2115
2094
  }()
2095
+ }, {
2096
+ key: "injectScheduleResolverToQuotation",
2097
+ value: function injectScheduleResolverToQuotation() {
2098
+ var _this9 = this;
2099
+ if (this.store.quotation && this.store.schedule) {
2100
+ this.store.quotation.setScheduleResolver(function (id) {
2101
+ return _this9.store.schedule.getScheduleListByIds([id])[0];
2102
+ });
2103
+ }
2104
+ }
2116
2105
  }, {
2117
2106
  key: "getScheduleListByIds",
2118
2107
  value: function getScheduleListByIds(ids) {
@@ -2124,15 +2113,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2124
2113
  }, {
2125
2114
  key: "getTempOrder",
2126
2115
  value: function getTempOrder() {
2127
- var _this$store$order8;
2128
- var result = ((_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 ? void 0 : _this$store$order8.getTempOrder()) || null;
2116
+ var _this$store$order7;
2117
+ var result = ((_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 ? void 0 : _this$store$order7.getTempOrder()) || null;
2129
2118
  return result;
2130
2119
  }
2131
2120
  }, {
2132
2121
  key: "updateTempOrderNote",
2133
2122
  value: function updateTempOrderNote(note) {
2123
+ var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2134
2124
  if (!this.store.order) throw new Error('order 模块未初始化');
2135
- return this.store.order.updateTempOrderNote(note);
2125
+ return this.store.order.updateTempOrderNote(note, sync);
2136
2126
  }
2137
2127
  }, {
2138
2128
  key: "updateTempOrderContactsInfo",
@@ -2141,8 +2131,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2141
2131
  return this.store.order.updateTempOrderContactsInfo(contactsInfo);
2142
2132
  }
2143
2133
  }, {
2144
- key: "ensureTempOrder",
2145
- value: function ensureTempOrder() {
2134
+ key: "ensureVenueTempOrder",
2135
+ value: function ensureVenueTempOrder() {
2146
2136
  if (!this.store.order) throw new Error('order 模块未初始化');
2147
2137
  return this.store.order.ensureTempOrder();
2148
2138
  }
@@ -2184,57 +2174,36 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2184
2174
  return onCustomerLogin;
2185
2175
  }()
2186
2176
  }, {
2187
- key: "recalculateOrderPricesFromSmartPricing",
2188
- value: function recalculateOrderPricesFromSmartPricing() {
2177
+ key: "recalculateOrderPricesFromQuotation",
2178
+ value: function recalculateOrderPricesFromQuotation() {
2189
2179
  var _tempOrder$products,
2190
- _this9 = this;
2191
- if (!this.store.order) return;
2180
+ _this10 = this;
2181
+ if (!this.store.order || !this.store.quotation) return;
2192
2182
  var tempOrder = this.store.order.getTempOrder();
2193
2183
  if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return;
2194
2184
  var now = dayjs().format('YYYY-MM-DD HH:mm:ss');
2195
- var catalog = this.getAllProductsForSmartPricing();
2196
- var context = this.buildSmartPricingContext();
2197
2185
  var _iterator13 = _createForOfIteratorHelper(tempOrder.products),
2198
2186
  _step13;
2199
2187
  try {
2200
2188
  var _loop4 = function _loop4() {
2201
- var _product$metadata2;
2189
+ var _product$metadata3;
2202
2190
  var product = _step13.value;
2203
- if ((_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.venue_booking) {
2204
- var mappings = _this9.resourceProductMap.get(product.metadata.resource_id);
2191
+ if ((_product$metadata3 = product.metadata) !== null && _product$metadata3 !== void 0 && _product$metadata3.venue_booking) {
2192
+ var mappings = _this10.resourceProductMap.get(product.metadata.resource_id);
2205
2193
  if (!mappings || !mappings.length) return 0; // continue
2206
2194
  var mapping = mappings.find(function (m) {
2207
2195
  return Number(m.productId) === Number(product.product_id);
2208
2196
  }) || mappings[0];
2209
2197
  if (!mapping) return 0; // continue
2210
- var slots = expandMergedSlotToIndividual(product, _this9.store.slotConfig.slotDurationMinutes);
2211
- var uniqueDates = _toConsumableArray(new Set(slots.map(function (slot) {
2212
- return dayjs(slot.startTime).format('YYYY-MM-DD');
2213
- })));
2214
- var slotPriceMaps = new Map();
2215
- var _iterator14 = _createForOfIteratorHelper(uniqueDates),
2216
- _step14;
2217
- try {
2218
- for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
2219
- var slotDate = _step14.value;
2220
- slotPriceMaps.set(slotDate, _this9.buildSlotPriceMapForDate(slotDate, _this9.store.slotConfig, [mapping.productId]));
2221
- }
2222
- } catch (err) {
2223
- _iterator14.e(err);
2224
- } finally {
2225
- _iterator14.f();
2226
- }
2198
+ var slots = expandMergedSlotToIndividual(product, _this10.store.slotConfig.slotDurationMinutes);
2227
2199
  var updatedSlots = slots.map(function (slot) {
2228
- var slotDate = dayjs(slot.startTime).format('YYYY-MM-DD');
2229
- var slotPriceMap = slotPriceMaps.get(slotDate);
2200
+ var _getPriceForProduct;
2230
2201
  return _objectSpread(_objectSpread({}, slot), {}, {
2231
2202
  productId: mapping.productId,
2232
- price: slotPriceMap ? getSlotPriceFromMap({
2233
- slotPriceMap: slotPriceMap,
2203
+ price: (_getPriceForProduct = _this10.store.quotation.getPriceForProduct({
2234
2204
  productId: mapping.productId,
2235
- slotStartTime: slot.startTime,
2236
- fallbackPrice: mapping.price
2237
- }) : mapping.price
2205
+ datetime: slot.startTime
2206
+ })) !== null && _getPriceForProduct !== void 0 ? _getPriceForProduct : mapping.price
2238
2207
  });
2239
2208
  });
2240
2209
  var merged = mergeConsecutiveSlots(updatedSlots);
@@ -2243,19 +2212,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2243
2212
  product.original_price = merged[0].totalPrice;
2244
2213
  product.metadata.price_breakdown = buildPriceBreakdown({
2245
2214
  group: merged[0],
2246
- productId: mapping.productId
2215
+ productId: mapping.productId,
2216
+ quotation: _this10.store.quotation
2247
2217
  });
2248
2218
  }
2249
2219
  } else if (product.product_id != null) {
2250
- var smartPrice = getPriceForProductAtDatetime({
2251
- products: catalog,
2252
- context: context,
2253
- productId: Number(product.product_id),
2254
- datetime: now,
2255
- fallbackPrice: product.selling_price
2256
- });
2257
- product.selling_price = smartPrice;
2258
- product.original_price = smartPrice;
2220
+ var _product$product_vari;
2221
+ var quotationPrice = _this10.store.quotation.getPriceForProduct({
2222
+ productId: product.product_id,
2223
+ variantId: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : undefined,
2224
+ datetime: now
2225
+ });
2226
+ if (quotationPrice !== null) {
2227
+ product.selling_price = quotationPrice;
2228
+ product.original_price = quotationPrice;
2229
+ }
2259
2230
  }
2260
2231
  },
2261
2232
  _ret;
@@ -2334,7 +2305,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2334
2305
  key: "setDiscountSelected",
2335
2306
  value: (function () {
2336
2307
  var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
2337
- var _tempOrder$holder, _this$store$order$get, _this$store$order$get2, list, beforeTarget, updated, updatedTarget, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds, _iterator15, _step15, d, selectedResourceIds, _iterator16, _step16, _product$_origin, _product$metadata$sou, _product$metadata3, _product$metadata4, _product$original_pri, product, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, afterApplyTarget, finalSummary, finalProduct, finalTarget;
2308
+ var _tempOrder$holder, _this$store$order$get, _this$store$order$get2, list, beforeTarget, updated, updatedTarget, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds, _iterator14, _step14, d, selectedResourceIds, _iterator15, _step15, _product$metadata$sou, _product$metadata4, _product$metadata5, _product$original_pri, product, origin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, afterApplyTarget, finalSummary, finalProduct, finalTarget;
2338
2309
  return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2339
2310
  while (1) switch (_context22.prev = _context22.next) {
2340
2311
  case 0:
@@ -2394,18 +2365,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2394
2365
  }).map(function (d) {
2395
2366
  return d.id;
2396
2367
  }));
2397
- _iterator15 = _createForOfIteratorHelper(nextDiscountList);
2368
+ _iterator14 = _createForOfIteratorHelper(nextDiscountList);
2398
2369
  try {
2399
- for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
2400
- d = _step15.value;
2370
+ for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
2371
+ d = _step14.value;
2401
2372
  if (d.isSelected && !beforeSelectedIds.has(d.id)) {
2402
2373
  d.isSelected = false;
2403
2374
  }
2404
2375
  }
2405
2376
  } catch (err) {
2406
- _iterator15.e(err);
2377
+ _iterator14.e(err);
2407
2378
  } finally {
2408
- _iterator15.f();
2379
+ _iterator14.f();
2409
2380
  }
2410
2381
  }
2411
2382
  }
@@ -2418,21 +2389,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2418
2389
  // 都以 original_price - Σ (当前选中 discount_list.amount) 重算 selling_price。
2419
2390
  // 目的:避免 unselect 后 selling_price 残留、reselect 时把残留价带进下一轮 Rules 造成双折扣。
2420
2391
  // 手动改价商品(_origin.isManualDiscount=true)不参与券流程归一化,保留手工价。
2421
- _iterator16 = _createForOfIteratorHelper(tempOrder.products);
2392
+ _iterator15 = _createForOfIteratorHelper(tempOrder.products);
2422
2393
  _context22.prev = 19;
2423
- _iterator16.s();
2394
+ _iterator15.s();
2424
2395
  case 21:
2425
- if ((_step16 = _iterator16.n()).done) {
2426
- _context22.next = 35;
2396
+ if ((_step15 = _iterator15.n()).done) {
2397
+ _context22.next = 36;
2427
2398
  break;
2428
2399
  }
2429
- product = _step16.value;
2430
- if (!((_product$_origin = product._origin) !== null && _product$_origin !== void 0 && _product$_origin.isManualDiscount)) {
2431
- _context22.next = 25;
2400
+ product = _step15.value;
2401
+ origin = this.readProductOriginFromTempOrder(tempOrder, product);
2402
+ if (!(origin !== null && origin !== void 0 && origin.isManualDiscount)) {
2403
+ _context22.next = 26;
2432
2404
  break;
2433
2405
  }
2434
- return _context22.abrupt("continue", 33);
2435
- case 25:
2406
+ return _context22.abrupt("continue", 34);
2407
+ case 26:
2436
2408
  // 1. 把 product.discount_list 和当前选中的 discount 对齐(剔除已取消的券)
2437
2409
  product.discount_list = (product.discount_list || []).filter(function (pd) {
2438
2410
  var _pd$discount$resource, _pd$discount;
@@ -2445,8 +2417,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2445
2417
  totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
2446
2418
  return sum + (pd.amount || 0);
2447
2419
  }, 0);
2448
- optionSum = sumOptionUnitPrice(product.product_option_item);
2449
- sourcePrice = (_product$metadata$sou = (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.source_product_price) !== null && _product$metadata$sou !== void 0 ? _product$metadata$sou : ((_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.main_product_original_price) != null ? new Decimal(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : '0';
2420
+ optionSum = sumOptionUnitPrice(getProductSkuOptions(product));
2421
+ sourcePrice = (_product$metadata$sou = (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.source_product_price) !== null && _product$metadata$sou !== void 0 ? _product$metadata$sou : ((_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.main_product_original_price) != null ? new Decimal(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : '0';
2450
2422
  newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
2451
2423
  newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
2452
2424
  if (product.metadata) {
@@ -2457,36 +2429,36 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2457
2429
  mainPrice: newMainSellingPrice,
2458
2430
  bundle: product.product_bundle
2459
2431
  });
2460
- case 33:
2432
+ case 34:
2461
2433
  _context22.next = 21;
2462
2434
  break;
2463
- case 35:
2464
- _context22.next = 40;
2435
+ case 36:
2436
+ _context22.next = 41;
2465
2437
  break;
2466
- case 37:
2467
- _context22.prev = 37;
2438
+ case 38:
2439
+ _context22.prev = 38;
2468
2440
  _context22.t0 = _context22["catch"](19);
2469
- _iterator16.e(_context22.t0);
2470
- case 40:
2471
- _context22.prev = 40;
2472
- _iterator16.f();
2473
- return _context22.finish(40);
2474
- case 43:
2441
+ _iterator15.e(_context22.t0);
2442
+ case 41:
2443
+ _context22.prev = 41;
2444
+ _iterator15.f();
2445
+ return _context22.finish(41);
2446
+ case 44:
2475
2447
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
2476
- _context22.next = 46;
2448
+ _context22.next = 47;
2477
2449
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
2478
- case 46:
2450
+ case 47:
2479
2451
  tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
2480
2452
  return d.isSelected;
2481
2453
  });
2482
2454
  afterApplyTarget = this.store.order.getDiscountList().find(function (d) {
2483
2455
  return d.id === params.discountId;
2484
2456
  }) || null;
2485
- _context22.next = 50;
2457
+ _context22.next = 51;
2486
2458
  return this.store.order.recalculateSummary({
2487
2459
  createIfMissing: true
2488
2460
  });
2489
- case 50:
2461
+ case 51:
2490
2462
  this.store.order.persistTempOrder();
2491
2463
  finalSummary = ((_this$store$order$get = this.store.order.getTempOrder()) === null || _this$store$order$get === void 0 ? void 0 : _this$store$order$get.summary) || null;
2492
2464
  finalProduct = ((_this$store$order$get2 = this.store.order.getTempOrder()) === null || _this$store$order$get2 === void 0 || (_this$store$order$get2 = _this$store$order$get2.products) === null || _this$store$order$get2 === void 0 ? void 0 : _this$store$order$get2[0]) || null;
@@ -2495,16 +2467,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2495
2467
  return d.id === params.discountId;
2496
2468
  }) || null;
2497
2469
  return _context22.abrupt("return", this.store.order.getDiscountList());
2498
- case 58:
2499
- _context22.prev = 58;
2470
+ case 59:
2471
+ _context22.prev = 59;
2500
2472
  _context22.t1 = _context22["catch"](1);
2501
2473
  this.logMethodError('setDiscountSelected', _context22.t1);
2502
2474
  throw _context22.t1;
2503
- case 62:
2475
+ case 63:
2504
2476
  case "end":
2505
2477
  return _context22.stop();
2506
2478
  }
2507
- }, _callee22, this, [[1, 58], [19, 37, 40, 43]]);
2479
+ }, _callee22, this, [[1, 59], [19, 38, 41, 44]]);
2508
2480
  }));
2509
2481
  function setDiscountSelected(_x16) {
2510
2482
  return _setDiscountSelected.apply(this, arguments);
@@ -2555,7 +2527,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2555
2527
  key: "getOrderProducts",
2556
2528
  value: function getOrderProducts() {
2557
2529
  if (!this.store.order) throw new Error('order 模块未初始化');
2558
- return this.store.order.getOrderProducts();
2530
+ var products = this.store.order.getOrderProducts();
2531
+ return products;
2559
2532
  }
2560
2533
  }, {
2561
2534
  key: "getSummary",
@@ -2574,7 +2547,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2574
2547
  throw new Error('order 模块未初始化');
2575
2548
  case 4:
2576
2549
  _context24.next = 6;
2577
- return this.store.order.getScanOrderSummary();
2550
+ return this.store.order.getOrderSummary();
2578
2551
  case 6:
2579
2552
  summary = _context24.sent;
2580
2553
  this.logMethodSuccess('getSummary', {
@@ -2601,7 +2574,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2601
2574
  key: "submitOrder",
2602
2575
  value: function () {
2603
2576
  var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
2604
- var _this$otherParams21, _this$otherParams22, _this$otherParams23, _this$otherParams24, _tempOrder$products2, result, tempOrder;
2577
+ var _this$otherParams13, _this$otherParams14, _this$otherParams15, _this$otherParams16, _tempOrder$products2, result, tempOrder;
2605
2578
  return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2606
2579
  while (1) switch (_context25.prev = _context25.next) {
2607
2580
  case 0:
@@ -2619,10 +2592,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2619
2592
  _context25.next = 8;
2620
2593
  return this.store.order.submitTempOrder({
2621
2594
  cacheId: this.cacheId,
2622
- platform: (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.platform,
2623
- businessCode: (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.businessCode,
2624
- channel: (_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.channel,
2625
- type: (_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.type
2595
+ platform: (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.platform,
2596
+ businessCode: (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.businessCode,
2597
+ channel: (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.channel,
2598
+ type: (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.type
2626
2599
  });
2627
2600
  case 8:
2628
2601
  result = _context25.sent;
@@ -2647,227 +2620,180 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2647
2620
  }
2648
2621
  return submitOrder;
2649
2622
  }()
2650
- /**
2651
- * 0 元订单免费领取(非定金场景)
2652
- * 与 appointment getFreeProduct 同接口:POST /pay/order/free-pay/:id
2653
- */
2654
- }, {
2655
- key: "submitFreeOrder",
2656
- value: (function () {
2657
- var _submitFreeOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(id) {
2658
- var res;
2659
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2660
- while (1) switch (_context26.prev = _context26.next) {
2661
- case 0:
2662
- this.logMethodStart('submitFreeOrder', {
2663
- id: id
2664
- });
2665
- _context26.prev = 1;
2666
- if (id) {
2667
- _context26.next = 4;
2668
- break;
2669
- }
2670
- throw new Error('订单 ID 不能为空');
2671
- case 4:
2672
- _context26.next = 6;
2673
- return this.request.post("/pay/order/free-pay/".concat(id));
2674
- case 6:
2675
- res = _context26.sent;
2676
- this.logMethodSuccess('submitFreeOrder', {
2677
- id: id,
2678
- status: res === null || res === void 0 ? void 0 : res.status
2679
- });
2680
- return _context26.abrupt("return", res);
2681
- case 11:
2682
- _context26.prev = 11;
2683
- _context26.t0 = _context26["catch"](1);
2684
- this.logMethodError('submitFreeOrder', _context26.t0);
2685
- throw _context26.t0;
2686
- case 15:
2687
- case "end":
2688
- return _context26.stop();
2689
- }
2690
- }, _callee26, this, [[1, 11]]);
2691
- }));
2692
- function submitFreeOrder(_x17) {
2693
- return _submitFreeOrder.apply(this, arguments);
2694
- }
2695
- return submitFreeOrder;
2696
- }())
2697
2623
  }, {
2698
2624
  key: "addProductToOrder",
2699
2625
  value: function () {
2700
- var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(product) {
2701
- var _product$metadata5, _product$metadata6, smartPrice, products;
2702
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2703
- while (1) switch (_context27.prev = _context27.next) {
2626
+ var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(product) {
2627
+ var _product$metadata6, _product$product_vari2, quotationPrice, products;
2628
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2629
+ while (1) switch (_context26.prev = _context26.next) {
2704
2630
  case 0:
2705
2631
  this.logMethodStart('addProductToOrder', {
2706
2632
  product_id: product.product_id,
2707
2633
  product_variant_id: product.product_variant_id
2708
2634
  });
2709
- _context27.prev = 1;
2635
+ _context26.prev = 1;
2710
2636
  if (this.store.order) {
2711
- _context27.next = 4;
2637
+ _context26.next = 4;
2712
2638
  break;
2713
2639
  }
2714
2640
  throw new Error('order 模块未初始化');
2715
2641
  case 4:
2716
- if (!((_product$metadata5 = product.metadata) !== null && _product$metadata5 !== void 0 && _product$metadata5.venue_booking) && product.product_id != null) {
2717
- smartPrice = getPriceForProductAtDatetime({
2718
- products: this.getAllProductsForSmartPricing(),
2719
- context: this.buildSmartPricingContext(),
2720
- productId: Number(product.product_id),
2721
- datetime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
2722
- fallbackPrice: product.selling_price
2642
+ if (!((_product$metadata6 = product.metadata) !== null && _product$metadata6 !== void 0 && _product$metadata6.venue_booking) && this.store.quotation && product.product_id != null) {
2643
+ quotationPrice = this.store.quotation.getPriceForProduct({
2644
+ productId: product.product_id,
2645
+ variantId: (_product$product_vari2 = product.product_variant_id) !== null && _product$product_vari2 !== void 0 ? _product$product_vari2 : undefined,
2646
+ datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
2723
2647
  });
2724
- product.selling_price = smartPrice;
2725
- product.original_price = smartPrice;
2726
- } else if (product.selling_price != null && !((_product$metadata6 = product.metadata) !== null && _product$metadata6 !== void 0 && _product$metadata6.venue_booking)) {
2727
- product.original_price = product.selling_price;
2648
+ if (quotationPrice !== null) {
2649
+ product.selling_price = quotationPrice;
2650
+ product.original_price = quotationPrice;
2651
+ } else if (product.selling_price != null) {
2652
+ product.original_price = product.selling_price;
2653
+ }
2728
2654
  }
2729
- _context27.next = 7;
2655
+ _context26.next = 7;
2730
2656
  return this.store.order.addProductToOrder(product);
2731
2657
  case 7:
2732
- products = _context27.sent;
2733
- _context27.next = 10;
2658
+ products = _context26.sent;
2659
+ _context26.next = 10;
2734
2660
  return this.refreshItemRuleQuantityLimits();
2735
2661
  case 10:
2736
- _context27.next = 12;
2662
+ _context26.next = 12;
2737
2663
  return this.refreshCartValidationPassed();
2738
2664
  case 12:
2739
2665
  this.logMethodSuccess('addProductToOrder', {
2740
2666
  productCount: products.length
2741
2667
  });
2742
- return _context27.abrupt("return", products);
2668
+ return _context26.abrupt("return", products);
2743
2669
  case 16:
2744
- _context27.prev = 16;
2745
- _context27.t0 = _context27["catch"](1);
2746
- this.logMethodError('addProductToOrder', _context27.t0);
2747
- throw _context27.t0;
2670
+ _context26.prev = 16;
2671
+ _context26.t0 = _context26["catch"](1);
2672
+ this.logMethodError('addProductToOrder', _context26.t0);
2673
+ throw _context26.t0;
2748
2674
  case 20:
2749
2675
  case "end":
2750
- return _context27.stop();
2676
+ return _context26.stop();
2751
2677
  }
2752
- }, _callee27, this, [[1, 16]]);
2678
+ }, _callee26, this, [[1, 16]]);
2753
2679
  }));
2754
- function addProductToOrder(_x18) {
2680
+ function addProductToOrder(_x17) {
2755
2681
  return _addProductToOrder.apply(this, arguments);
2756
2682
  }
2757
2683
  return addProductToOrder;
2758
2684
  }()
2759
2685
  }, {
2760
- key: "updateProductInOrder",
2686
+ key: "updateOrderProduct",
2761
2687
  value: function () {
2762
- var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
2688
+ var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
2763
2689
  var products;
2764
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2765
- while (1) switch (_context28.prev = _context28.next) {
2690
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2691
+ while (1) switch (_context27.prev = _context27.next) {
2766
2692
  case 0:
2767
- this.logMethodStart('updateProductInOrder', {
2693
+ this.logMethodStart('updateOrderProduct', {
2768
2694
  product_id: params.product_id,
2769
2695
  product_variant_id: params.product_variant_id
2770
2696
  });
2771
- _context28.prev = 1;
2697
+ _context27.prev = 1;
2772
2698
  if (this.store.order) {
2773
- _context28.next = 4;
2699
+ _context27.next = 4;
2774
2700
  break;
2775
2701
  }
2776
2702
  throw new Error('order 模块未初始化');
2777
2703
  case 4:
2778
- _context28.next = 6;
2779
- return this.store.order.updateProductInOrder(params);
2704
+ _context27.next = 6;
2705
+ return this.store.order.updateOrderProduct(params);
2780
2706
  case 6:
2781
- products = _context28.sent;
2782
- _context28.next = 9;
2707
+ products = _context27.sent;
2708
+ _context27.next = 9;
2783
2709
  return this.refreshItemRuleQuantityLimits();
2784
2710
  case 9:
2785
- _context28.next = 11;
2711
+ _context27.next = 11;
2786
2712
  return this.refreshCartValidationPassed();
2787
2713
  case 11:
2788
- this.logMethodSuccess('updateProductInOrder', {
2714
+ this.logMethodSuccess('updateOrderProduct', {
2789
2715
  productCount: products.length
2790
2716
  });
2791
- return _context28.abrupt("return", products);
2717
+ return _context27.abrupt("return", products);
2792
2718
  case 15:
2793
- _context28.prev = 15;
2794
- _context28.t0 = _context28["catch"](1);
2795
- this.logMethodError('updateProductInOrder', _context28.t0);
2796
- throw _context28.t0;
2719
+ _context27.prev = 15;
2720
+ _context27.t0 = _context27["catch"](1);
2721
+ this.logMethodError('updateOrderProduct', _context27.t0);
2722
+ throw _context27.t0;
2797
2723
  case 19:
2798
2724
  case "end":
2799
- return _context28.stop();
2725
+ return _context27.stop();
2800
2726
  }
2801
- }, _callee28, this, [[1, 15]]);
2727
+ }, _callee27, this, [[1, 15]]);
2802
2728
  }));
2803
- function updateProductInOrder(_x19) {
2804
- return _updateProductInOrder.apply(this, arguments);
2729
+ function updateOrderProduct(_x18) {
2730
+ return _updateOrderProduct.apply(this, arguments);
2805
2731
  }
2806
- return updateProductInOrder;
2732
+ return updateOrderProduct;
2807
2733
  }()
2808
2734
  }, {
2809
2735
  key: "removeProductFromOrder",
2810
2736
  value: function () {
2811
- var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(identity) {
2812
- var _this$store$order$get3, _this$store$order9, _this$store$order$ens, _this$store$order10, _tempOrder$bookings, tempOrder, products, _tempOrder$bookings2, _tempOrder$bookings3, venueProductUids, venueBookingUids, _iterator17, _step17, _product$metadata7, _product$metadata8, product, beforeBookingCount, _this$store$order$per, _this$store$order11;
2813
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2814
- while (1) switch (_context29.prev = _context29.next) {
2737
+ var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(identity) {
2738
+ var _this$store$order$get3, _this$store$order8, _this$store$order$ens, _this$store$order9, _tempOrder$bookings, tempOrder, products, _tempOrder$bookings2, _tempOrder$bookings3, venueProductUids, venueBookingUids, _iterator16, _step16, _product$metadata7, _product$metadata8, product, beforeBookingCount, _this$store$order$per, _this$store$order10;
2739
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2740
+ while (1) switch (_context28.prev = _context28.next) {
2815
2741
  case 0:
2816
2742
  this.logMethodStart('removeProductFromOrder', {
2817
2743
  product_id: identity.product_id,
2818
2744
  product_variant_id: identity.product_variant_id
2819
2745
  });
2820
- _context29.prev = 1;
2746
+ _context28.prev = 1;
2821
2747
  if (this.store.order) {
2822
- _context29.next = 4;
2748
+ _context28.next = 4;
2823
2749
  break;
2824
2750
  }
2825
2751
  throw new Error('order 模块未初始化');
2826
2752
  case 4:
2827
- tempOrder = ((_this$store$order$get3 = (_this$store$order9 = this.store.order).getTempOrder) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order9)) || ((_this$store$order$ens = (_this$store$order10 = this.store.order).ensureTempOrder) === null || _this$store$order$ens === void 0 ? void 0 : _this$store$order$ens.call(_this$store$order10));
2828
- _context29.next = 7;
2753
+ tempOrder = ((_this$store$order$get3 = (_this$store$order8 = this.store.order).getTempOrder) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order8)) || ((_this$store$order$ens = (_this$store$order9 = this.store.order).ensureTempOrder) === null || _this$store$order$ens === void 0 ? void 0 : _this$store$order$ens.call(_this$store$order9));
2754
+ _context28.next = 7;
2829
2755
  return this.store.order.removeProductFromOrder(identity);
2830
2756
  case 7:
2831
- products = _context29.sent;
2757
+ products = _context28.sent;
2832
2758
  if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$bookings = tempOrder.bookings) !== null && _tempOrder$bookings !== void 0 && _tempOrder$bookings.length)) {
2833
- _context29.next = 33;
2759
+ _context28.next = 33;
2834
2760
  break;
2835
2761
  }
2836
2762
  venueProductUids = new Set();
2837
2763
  venueBookingUids = new Set();
2838
- _iterator17 = _createForOfIteratorHelper(tempOrder.products || []);
2839
- _context29.prev = 12;
2840
- _iterator17.s();
2764
+ _iterator16 = _createForOfIteratorHelper(tempOrder.products || []);
2765
+ _context28.prev = 12;
2766
+ _iterator16.s();
2841
2767
  case 14:
2842
- if ((_step17 = _iterator17.n()).done) {
2843
- _context29.next = 22;
2768
+ if ((_step16 = _iterator16.n()).done) {
2769
+ _context28.next = 22;
2844
2770
  break;
2845
2771
  }
2846
- product = _step17.value;
2772
+ product = _step16.value;
2847
2773
  if (product !== null && product !== void 0 && (_product$metadata7 = product.metadata) !== null && _product$metadata7 !== void 0 && _product$metadata7.venue_booking) {
2848
- _context29.next = 18;
2774
+ _context28.next = 18;
2849
2775
  break;
2850
2776
  }
2851
- return _context29.abrupt("continue", 20);
2777
+ return _context28.abrupt("continue", 20);
2852
2778
  case 18:
2853
2779
  if (product.identity_key) venueProductUids.add(String(product.identity_key));
2854
2780
  if ((_product$metadata8 = product.metadata) !== null && _product$metadata8 !== void 0 && _product$metadata8.booking_uid) {
2855
2781
  venueBookingUids.add(String(product.metadata.booking_uid));
2856
2782
  }
2857
2783
  case 20:
2858
- _context29.next = 14;
2784
+ _context28.next = 14;
2859
2785
  break;
2860
2786
  case 22:
2861
- _context29.next = 27;
2787
+ _context28.next = 27;
2862
2788
  break;
2863
2789
  case 24:
2864
- _context29.prev = 24;
2865
- _context29.t0 = _context29["catch"](12);
2866
- _iterator17.e(_context29.t0);
2790
+ _context28.prev = 24;
2791
+ _context28.t0 = _context28["catch"](12);
2792
+ _iterator16.e(_context28.t0);
2867
2793
  case 27:
2868
- _context29.prev = 27;
2869
- _iterator17.f();
2870
- return _context29.finish(27);
2794
+ _context28.prev = 27;
2795
+ _iterator16.f();
2796
+ return _context28.finish(27);
2871
2797
  case 30:
2872
2798
  beforeBookingCount = ((_tempOrder$bookings2 = tempOrder.bookings) === null || _tempOrder$bookings2 === void 0 ? void 0 : _tempOrder$bookings2.length) || 0;
2873
2799
  tempOrder.bookings = (tempOrder.bookings || []).filter(function (booking) {
@@ -2881,31 +2807,31 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2881
2807
  return true;
2882
2808
  });
2883
2809
  if ((((_tempOrder$bookings3 = tempOrder.bookings) === null || _tempOrder$bookings3 === void 0 ? void 0 : _tempOrder$bookings3.length) || 0) !== beforeBookingCount) {
2884
- (_this$store$order$per = (_this$store$order11 = this.store.order).persistTempOrder) === null || _this$store$order$per === void 0 || _this$store$order$per.call(_this$store$order11);
2810
+ (_this$store$order$per = (_this$store$order10 = this.store.order).persistTempOrder) === null || _this$store$order$per === void 0 || _this$store$order$per.call(_this$store$order10);
2885
2811
  }
2886
2812
  case 33:
2887
- _context29.next = 35;
2813
+ _context28.next = 35;
2888
2814
  return this.refreshItemRuleQuantityLimits();
2889
2815
  case 35:
2890
- _context29.next = 37;
2816
+ _context28.next = 37;
2891
2817
  return this.refreshCartValidationPassed();
2892
2818
  case 37:
2893
2819
  this.logMethodSuccess('removeProductFromOrder', {
2894
2820
  productCount: products.length
2895
2821
  });
2896
- return _context29.abrupt("return", products);
2822
+ return _context28.abrupt("return", products);
2897
2823
  case 41:
2898
- _context29.prev = 41;
2899
- _context29.t1 = _context29["catch"](1);
2900
- this.logMethodError('removeProductFromOrder', _context29.t1);
2901
- throw _context29.t1;
2824
+ _context28.prev = 41;
2825
+ _context28.t1 = _context28["catch"](1);
2826
+ this.logMethodError('removeProductFromOrder', _context28.t1);
2827
+ throw _context28.t1;
2902
2828
  case 45:
2903
2829
  case "end":
2904
- return _context29.stop();
2830
+ return _context28.stop();
2905
2831
  }
2906
- }, _callee29, this, [[1, 41], [12, 24, 27, 30]]);
2832
+ }, _callee28, this, [[1, 41], [12, 24, 27, 30]]);
2907
2833
  }));
2908
- function removeProductFromOrder(_x20) {
2834
+ function removeProductFromOrder(_x19) {
2909
2835
  return _removeProductFromOrder.apply(this, arguments);
2910
2836
  }
2911
2837
  return removeProductFromOrder;
@@ -2913,27 +2839,27 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2913
2839
  }, {
2914
2840
  key: "getProductList",
2915
2841
  value: function () {
2916
- var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
2842
+ var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2917
2843
  var result;
2918
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2919
- while (1) switch (_context30.prev = _context30.next) {
2844
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2845
+ while (1) switch (_context29.prev = _context29.next) {
2920
2846
  case 0:
2921
2847
  if (!this.productsLoaded) {
2922
- _context30.next = 2;
2848
+ _context29.next = 2;
2923
2849
  break;
2924
2850
  }
2925
- return _context30.abrupt("return", attachItemRuleLimitsToTopLevelProducts(this.getAddonProductsList(), this.store.itemRuleQuantityLimits || []));
2851
+ return _context29.abrupt("return", attachItemRuleLimitsToTopLevelProducts(this.getAddonProductsList(), this.store.itemRuleQuantityLimits || []));
2926
2852
  case 2:
2927
- _context30.next = 4;
2853
+ _context29.next = 4;
2928
2854
  return this.loadAllProducts();
2929
2855
  case 4:
2930
- result = _context30.sent;
2931
- return _context30.abrupt("return", attachItemRuleLimitsToTopLevelProducts(result.addonProducts, this.store.itemRuleQuantityLimits || []));
2856
+ result = _context29.sent;
2857
+ return _context29.abrupt("return", attachItemRuleLimitsToTopLevelProducts(result.addonProducts, this.store.itemRuleQuantityLimits || []));
2932
2858
  case 6:
2933
2859
  case "end":
2934
- return _context30.stop();
2860
+ return _context29.stop();
2935
2861
  }
2936
- }, _callee30, this);
2862
+ }, _callee29, this);
2937
2863
  }));
2938
2864
  function getProductList() {
2939
2865
  return _getProductList.apply(this, arguments);
@@ -2943,13 +2869,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2943
2869
  }, {
2944
2870
  key: "loadOpenDataConfig",
2945
2871
  value: function () {
2946
- var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
2872
+ var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
2947
2873
  var lastFetchedAt, cachedData, openDataConfig;
2948
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2949
- while (1) switch (_context31.prev = _context31.next) {
2874
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2875
+ while (1) switch (_context30.prev = _context30.next) {
2950
2876
  case 0:
2951
2877
  if (this.store.openData) {
2952
- _context31.next = 2;
2878
+ _context30.next = 2;
2953
2879
  break;
2954
2880
  }
2955
2881
  throw new Error('openData 模块未初始化');
@@ -2957,42 +2883,42 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2957
2883
  lastFetchedAt = this.store.openData.getLastFetchedAt();
2958
2884
  cachedData = this.store.openData.getOpenData();
2959
2885
  if (!(cachedData && lastFetchedAt && Date.now() - lastFetchedAt < VenueBookingImpl.OPEN_DATA_CACHE_TTL)) {
2960
- _context31.next = 7;
2886
+ _context30.next = 7;
2961
2887
  break;
2962
2888
  }
2963
2889
  this.otherParams.openData = cachedData;
2964
- return _context31.abrupt("return", cachedData);
2890
+ return _context30.abrupt("return", cachedData);
2965
2891
  case 7:
2966
2892
  if (!this.loadOpenDataConfigInFlight) {
2967
- _context31.next = 11;
2893
+ _context30.next = 11;
2968
2894
  break;
2969
2895
  }
2970
- _context31.next = 10;
2896
+ _context30.next = 10;
2971
2897
  return this.loadOpenDataConfigInFlight;
2972
2898
  case 10:
2973
- return _context31.abrupt("return", _context31.sent);
2899
+ return _context30.abrupt("return", _context30.sent);
2974
2900
  case 11:
2975
2901
  this.loadOpenDataConfigInFlight = this.store.openData.fetchOpenData({
2976
2902
  scope: 'board',
2977
2903
  target: 'venue_booking+online_store',
2978
2904
  section_code: [].concat(OPEN_DATA_SECTION_CODES)
2979
2905
  });
2980
- _context31.prev = 12;
2981
- _context31.next = 15;
2906
+ _context30.prev = 12;
2907
+ _context30.next = 15;
2982
2908
  return this.loadOpenDataConfigInFlight;
2983
2909
  case 15:
2984
- openDataConfig = _context31.sent;
2910
+ openDataConfig = _context30.sent;
2985
2911
  this.otherParams.openData = openDataConfig;
2986
- return _context31.abrupt("return", openDataConfig);
2912
+ return _context30.abrupt("return", openDataConfig);
2987
2913
  case 18:
2988
- _context31.prev = 18;
2914
+ _context30.prev = 18;
2989
2915
  this.loadOpenDataConfigInFlight = null;
2990
- return _context31.finish(18);
2916
+ return _context30.finish(18);
2991
2917
  case 21:
2992
2918
  case "end":
2993
- return _context31.stop();
2919
+ return _context30.stop();
2994
2920
  }
2995
- }, _callee31, this, [[12,, 18, 21]]);
2921
+ }, _callee30, this, [[12,, 18, 21]]);
2996
2922
  }));
2997
2923
  function loadOpenDataConfig() {
2998
2924
  return _loadOpenDataConfig.apply(this, arguments);
@@ -3002,29 +2928,29 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3002
2928
  }, {
3003
2929
  key: "loadRuntimeConfigs",
3004
2930
  value: function () {
3005
- var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
2931
+ var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
3006
2932
  var itemRuleConfigs;
3007
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3008
- while (1) switch (_context32.prev = _context32.next) {
2933
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2934
+ while (1) switch (_context31.prev = _context31.next) {
3009
2935
  case 0:
3010
- _context32.next = 2;
2936
+ _context31.next = 2;
3011
2937
  return this.loadOpenDataConfig();
3012
2938
  case 2:
3013
- _context32.next = 4;
2939
+ _context31.next = 4;
3014
2940
  return this.ensureItemRuleConfigsLoaded();
3015
2941
  case 4:
3016
- itemRuleConfigs = _context32.sent;
2942
+ itemRuleConfigs = _context31.sent;
3017
2943
  this.logMethodSuccess('loadRuntimeConfigs', {
3018
2944
  itemRuleCount: itemRuleConfigs.length
3019
2945
  });
3020
- return _context32.abrupt("return", {
2946
+ return _context31.abrupt("return", {
3021
2947
  itemRuleConfigs: itemRuleConfigs
3022
2948
  });
3023
2949
  case 7:
3024
2950
  case "end":
3025
- return _context32.stop();
2951
+ return _context31.stop();
3026
2952
  }
3027
- }, _callee32, this);
2953
+ }, _callee31, this);
3028
2954
  }));
3029
2955
  function loadRuntimeConfigs() {
3030
2956
  return _loadRuntimeConfigs.apply(this, arguments);
@@ -3034,22 +2960,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3034
2960
  }, {
3035
2961
  key: "fetchItemRuleConfigsByModelIds",
3036
2962
  value: function () {
3037
- var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(strategyModelIds) {
2963
+ var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(strategyModelIds) {
3038
2964
  var result, configs;
3039
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3040
- while (1) switch (_context33.prev = _context33.next) {
2965
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2966
+ while (1) switch (_context32.prev = _context32.next) {
3041
2967
  case 0:
3042
2968
  this.logMethodStart('fetchItemRuleConfigsByModelIds', {
3043
2969
  strategyModelIds: strategyModelIds
3044
2970
  });
3045
2971
  if (strategyModelIds.length) {
3046
- _context33.next = 3;
2972
+ _context32.next = 3;
3047
2973
  break;
3048
2974
  }
3049
- return _context33.abrupt("return", []);
2975
+ return _context32.abrupt("return", []);
3050
2976
  case 3:
3051
- _context33.prev = 3;
3052
- _context33.next = 6;
2977
+ _context32.prev = 3;
2978
+ _context32.next = 6;
3053
2979
  return this.request.get('/promotion', {
3054
2980
  skip: 1,
3055
2981
  num: 99,
@@ -3057,7 +2983,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3057
2983
  ids: strategyModelIds
3058
2984
  });
3059
2985
  case 6:
3060
- result = _context33.sent;
2986
+ result = _context32.sent;
3061
2987
  configs = [];
3062
2988
  if (result.code === 200) {
3063
2989
  configs = result.data.list.map(function (item) {
@@ -3068,21 +2994,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3068
2994
  strategyModelIds: strategyModelIds,
3069
2995
  strategyCount: configs.length
3070
2996
  });
3071
- return _context33.abrupt("return", configs);
2997
+ return _context32.abrupt("return", configs);
3072
2998
  case 13:
3073
- _context33.prev = 13;
3074
- _context33.t0 = _context33["catch"](3);
3075
- this.logMethodError('fetchItemRuleConfigsByModelIds', _context33.t0, {
2999
+ _context32.prev = 13;
3000
+ _context32.t0 = _context32["catch"](3);
3001
+ this.logMethodError('fetchItemRuleConfigsByModelIds', _context32.t0, {
3076
3002
  strategyModelIds: strategyModelIds
3077
3003
  });
3078
- return _context33.abrupt("return", []);
3004
+ return _context32.abrupt("return", []);
3079
3005
  case 17:
3080
3006
  case "end":
3081
- return _context33.stop();
3007
+ return _context32.stop();
3082
3008
  }
3083
- }, _callee33, this, [[3, 13]]);
3009
+ }, _callee32, this, [[3, 13]]);
3084
3010
  }));
3085
- function fetchItemRuleConfigsByModelIds(_x21) {
3011
+ function fetchItemRuleConfigsByModelIds(_x20) {
3086
3012
  return _fetchItemRuleConfigsByModelIds.apply(this, arguments);
3087
3013
  }
3088
3014
  return fetchItemRuleConfigsByModelIds;
@@ -3090,22 +3016,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3090
3016
  }, {
3091
3017
  key: "buildPrefillProductSourceMap",
3092
3018
  value: function () {
3093
- var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
3019
+ var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
3094
3020
  var sourceMap, productList, visited, collectFromValue;
3095
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3096
- while (1) switch (_context34.prev = _context34.next) {
3021
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3022
+ while (1) switch (_context33.prev = _context33.next) {
3097
3023
  case 0:
3098
3024
  sourceMap = new Map();
3099
- _context34.prev = 1;
3100
- _context34.next = 4;
3025
+ _context33.prev = 1;
3026
+ _context33.next = 4;
3101
3027
  return this.getProductList();
3102
3028
  case 4:
3103
- productList = _context34.sent;
3029
+ productList = _context33.sent;
3104
3030
  if (Array.isArray(productList)) {
3105
- _context34.next = 7;
3031
+ _context33.next = 7;
3106
3032
  break;
3107
3033
  }
3108
- return _context34.abrupt("return", sourceMap);
3034
+ return _context33.abrupt("return", sourceMap);
3109
3035
  case 7:
3110
3036
  visited = new Set();
3111
3037
  collectFromValue = function collectFromValue(value) {
@@ -3114,17 +3040,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3114
3040
  if (visited.has(value)) return;
3115
3041
  visited.add(value);
3116
3042
  if (Array.isArray(value)) {
3117
- var _iterator18 = _createForOfIteratorHelper(value),
3118
- _step18;
3043
+ var _iterator17 = _createForOfIteratorHelper(value),
3044
+ _step17;
3119
3045
  try {
3120
- for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
3121
- var item = _step18.value;
3046
+ for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
3047
+ var item = _step17.value;
3122
3048
  collectFromValue(item);
3123
3049
  }
3124
3050
  } catch (err) {
3125
- _iterator18.e(err);
3051
+ _iterator17.e(err);
3126
3052
  } finally {
3127
- _iterator18.f();
3053
+ _iterator17.f();
3128
3054
  }
3129
3055
  return;
3130
3056
  }
@@ -3132,8 +3058,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3132
3058
  var rawProductId = (_node$product_id = node.product_id) !== null && _node$product_id !== void 0 ? _node$product_id : node.id;
3133
3059
  var productId = Number(rawProductId);
3134
3060
  if (Number.isFinite(productId) && productId > 0) {
3135
- var _ref3, _node$product_variant;
3136
- var productVariantId = Number((_ref3 = (_node$product_variant = node.product_variant_id) !== null && _node$product_variant !== void 0 ? _node$product_variant : node.variant_id) !== null && _ref3 !== void 0 ? _ref3 : 0);
3061
+ var _ref5, _node$product_variant;
3062
+ var productVariantId = Number((_ref5 = (_node$product_variant = node.product_variant_id) !== null && _node$product_variant !== void 0 ? _node$product_variant : node.variant_id) !== null && _ref5 !== void 0 ? _ref5 : 0);
3137
3063
  var normalizedVariantId = Number.isNaN(productVariantId) ? 0 : productVariantId;
3138
3064
  var key = buildProductKey(productId, normalizedVariantId);
3139
3065
  if (!sourceMap.has(key)) sourceMap.set(key, node);
@@ -3144,19 +3070,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3144
3070
  }
3145
3071
  };
3146
3072
  collectFromValue(productList);
3147
- _context34.next = 15;
3073
+ _context33.next = 15;
3148
3074
  break;
3149
3075
  case 12:
3150
- _context34.prev = 12;
3151
- _context34.t0 = _context34["catch"](1);
3152
- this.logMethodError('buildPrefillProductSourceMap', _context34.t0);
3076
+ _context33.prev = 12;
3077
+ _context33.t0 = _context33["catch"](1);
3078
+ this.logMethodError('buildPrefillProductSourceMap', _context33.t0);
3153
3079
  case 15:
3154
- return _context34.abrupt("return", sourceMap);
3080
+ return _context33.abrupt("return", sourceMap);
3155
3081
  case 16:
3156
3082
  case "end":
3157
- return _context34.stop();
3083
+ return _context33.stop();
3158
3084
  }
3159
- }, _callee34, this, [[1, 12]]);
3085
+ }, _callee33, this, [[1, 12]]);
3160
3086
  }));
3161
3087
  function buildPrefillProductSourceMap() {
3162
3088
  return _buildPrefillProductSourceMap.apply(this, arguments);
@@ -3171,56 +3097,56 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3171
3097
  }, {
3172
3098
  key: "ensureItemRuleConfigsLoaded",
3173
3099
  value: function () {
3174
- var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
3175
- var _this10 = this;
3176
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
3177
- while (1) switch (_context36.prev = _context36.next) {
3100
+ var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
3101
+ var _this11 = this;
3102
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
3103
+ while (1) switch (_context35.prev = _context35.next) {
3178
3104
  case 0:
3179
3105
  if (!(this.itemRuleConfigs.length > 0)) {
3180
- _context36.next = 2;
3106
+ _context35.next = 2;
3181
3107
  break;
3182
3108
  }
3183
- return _context36.abrupt("return", this.itemRuleConfigs);
3109
+ return _context35.abrupt("return", this.itemRuleConfigs);
3184
3110
  case 2:
3185
3111
  if (!this.itemRuleConfigsPromise) {
3186
- _context36.next = 4;
3112
+ _context35.next = 4;
3187
3113
  break;
3188
3114
  }
3189
- return _context36.abrupt("return", this.itemRuleConfigsPromise);
3115
+ return _context35.abrupt("return", this.itemRuleConfigsPromise);
3190
3116
  case 4:
3191
- this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
3117
+ this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
3192
3118
  var runtimeConfig, staticConfigs;
3193
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
3194
- while (1) switch (_context35.prev = _context35.next) {
3119
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3120
+ while (1) switch (_context34.prev = _context34.next) {
3195
3121
  case 0:
3196
- runtimeConfig = _this10.getItemRuleRuntimeConfig();
3122
+ runtimeConfig = _this11.getItemRuleRuntimeConfig();
3197
3123
  staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
3198
3124
  if (!(staticConfigs.length > 0)) {
3199
- _context35.next = 6;
3125
+ _context34.next = 6;
3200
3126
  break;
3201
3127
  }
3202
- _this10.itemRuleConfigs = staticConfigs;
3203
- _this10.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
3204
- return _context35.abrupt("return", _this10.itemRuleConfigs);
3128
+ _this11.itemRuleConfigs = staticConfigs;
3129
+ _this11.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
3130
+ return _context34.abrupt("return", _this11.itemRuleConfigs);
3205
3131
  case 6:
3206
- _this10.itemRuleConfigs = [];
3207
- _this10.itemRuleEvaluator.setStrategyConfigs([]);
3208
- return _context35.abrupt("return", _this10.itemRuleConfigs);
3132
+ _this11.itemRuleConfigs = [];
3133
+ _this11.itemRuleEvaluator.setStrategyConfigs([]);
3134
+ return _context34.abrupt("return", _this11.itemRuleConfigs);
3209
3135
  case 9:
3210
3136
  case "end":
3211
- return _context35.stop();
3137
+ return _context34.stop();
3212
3138
  }
3213
- }, _callee35);
3139
+ }, _callee34);
3214
3140
  }))();
3215
- _context36.next = 7;
3141
+ _context35.next = 7;
3216
3142
  return this.itemRuleConfigsPromise;
3217
3143
  case 7:
3218
- return _context36.abrupt("return", _context36.sent);
3144
+ return _context35.abrupt("return", _context35.sent);
3219
3145
  case 8:
3220
3146
  case "end":
3221
- return _context36.stop();
3147
+ return _context35.stop();
3222
3148
  }
3223
- }, _callee36, this);
3149
+ }, _callee35, this);
3224
3150
  }));
3225
3151
  function ensureItemRuleConfigsLoaded() {
3226
3152
  return _ensureItemRuleConfigsLoaded.apply(this, arguments);
@@ -3230,25 +3156,25 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3230
3156
  }, {
3231
3157
  key: "refreshItemRuleQuantityLimits",
3232
3158
  value: function () {
3233
- var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
3159
+ var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
3234
3160
  var strategyConfigs, businessData, limits;
3235
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3236
- while (1) switch (_context37.prev = _context37.next) {
3161
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
3162
+ while (1) switch (_context36.prev = _context36.next) {
3237
3163
  case 0:
3238
- _context37.prev = 0;
3239
- _context37.next = 3;
3164
+ _context36.prev = 0;
3165
+ _context36.next = 3;
3240
3166
  return this.ensureItemRuleConfigsLoaded();
3241
3167
  case 3:
3242
- strategyConfigs = _context37.sent;
3168
+ strategyConfigs = _context36.sent;
3243
3169
  if (strategyConfigs.length) {
3244
- _context37.next = 7;
3170
+ _context36.next = 7;
3245
3171
  break;
3246
3172
  }
3247
3173
  this.store.itemRuleQuantityLimits = [];
3248
- return _context37.abrupt("return", []);
3174
+ return _context36.abrupt("return", []);
3249
3175
  case 7:
3250
3176
  businessData = buildItemRuleBusinessData({
3251
- tempOrder: this.ensureTempOrder(),
3177
+ tempOrder: this.ensureVenueTempOrder(),
3252
3178
  runtimeConfig: this.getItemRuleRuntimeConfig(),
3253
3179
  itemRuleConfigs: this.itemRuleConfigs
3254
3180
  });
@@ -3257,18 +3183,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3257
3183
  this.logMethodSuccess('refreshItemRuleQuantityLimits', {
3258
3184
  limitCount: limits.length
3259
3185
  });
3260
- return _context37.abrupt("return", limits);
3186
+ return _context36.abrupt("return", limits);
3261
3187
  case 14:
3262
- _context37.prev = 14;
3263
- _context37.t0 = _context37["catch"](0);
3188
+ _context36.prev = 14;
3189
+ _context36.t0 = _context36["catch"](0);
3264
3190
  this.store.itemRuleQuantityLimits = [];
3265
- this.logMethodError('refreshItemRuleQuantityLimits', _context37.t0);
3266
- return _context37.abrupt("return", []);
3191
+ this.logMethodError('refreshItemRuleQuantityLimits', _context36.t0);
3192
+ return _context36.abrupt("return", []);
3267
3193
  case 19:
3268
3194
  case "end":
3269
- return _context37.stop();
3195
+ return _context36.stop();
3270
3196
  }
3271
- }, _callee37, this, [[0, 14]]);
3197
+ }, _callee36, this, [[0, 14]]);
3272
3198
  }));
3273
3199
  function refreshItemRuleQuantityLimits() {
3274
3200
  return _refreshItemRuleQuantityLimits.apply(this, arguments);
@@ -3278,75 +3204,75 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3278
3204
  }, {
3279
3205
  key: "applyPrefillByItemRule",
3280
3206
  value: function () {
3281
- var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
3282
- var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator19, _step19, _prefillItem$product_, _targetProduct$_origi, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, sellingPrice, targetProduct, existedQuantity, delta, nextProduct;
3283
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3284
- while (1) switch (_context38.prev = _context38.next) {
3207
+ var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
3208
+ var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator18, _step18, _prefillItem$product_, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, _product$metadata9, sellingPrice, origin, product, productUid, targetProduct, previousOrigin, nextOrigin, existedQuantity, delta, nextProduct, _nextProduct$metadata, _productUid;
3209
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3210
+ while (1) switch (_context37.prev = _context37.next) {
3285
3211
  case 0:
3286
3212
  if (!this.itemRulePrefillApplied) {
3287
- _context38.next = 2;
3213
+ _context37.next = 2;
3288
3214
  break;
3289
3215
  }
3290
- return _context38.abrupt("return");
3216
+ return _context37.abrupt("return");
3291
3217
  case 2:
3292
3218
  if (this.store.order) {
3293
- _context38.next = 4;
3219
+ _context37.next = 4;
3294
3220
  break;
3295
3221
  }
3296
- return _context38.abrupt("return");
3222
+ return _context37.abrupt("return");
3297
3223
  case 4:
3298
- _context38.next = 6;
3224
+ _context37.next = 6;
3299
3225
  return this.ensureItemRuleConfigsLoaded();
3300
3226
  case 6:
3301
- strategyConfigs = _context38.sent;
3227
+ strategyConfigs = _context37.sent;
3302
3228
  if (strategyConfigs.length) {
3303
- _context38.next = 9;
3229
+ _context37.next = 9;
3304
3230
  break;
3305
3231
  }
3306
- return _context38.abrupt("return");
3232
+ return _context37.abrupt("return");
3307
3233
  case 9:
3308
3234
  businessData = buildItemRuleBusinessData({
3309
- tempOrder: this.ensureTempOrder(),
3235
+ tempOrder: this.ensureVenueTempOrder(),
3310
3236
  runtimeConfig: this.getItemRuleRuntimeConfig(),
3311
3237
  itemRuleConfigs: this.itemRuleConfigs
3312
3238
  });
3313
3239
  prefillItems = this.itemRuleEvaluator.getPrefillItems(businessData);
3314
3240
  if (prefillItems.length) {
3315
- _context38.next = 14;
3241
+ _context37.next = 14;
3316
3242
  break;
3317
3243
  }
3318
3244
  this.itemRulePrefillApplied = true;
3319
- return _context38.abrupt("return");
3245
+ return _context37.abrupt("return");
3320
3246
  case 14:
3321
- _context38.next = 16;
3247
+ _context37.next = 16;
3322
3248
  return this.buildPrefillProductSourceMap();
3323
3249
  case 16:
3324
- productSourceMap = _context38.sent;
3325
- tempOrder = this.ensureTempOrder();
3250
+ productSourceMap = _context37.sent;
3251
+ tempOrder = this.ensureVenueTempOrder();
3326
3252
  hasChanges = false;
3327
- _iterator19 = _createForOfIteratorHelper(prefillItems);
3328
- _context38.prev = 20;
3329
- _iterator19.s();
3253
+ _iterator18 = _createForOfIteratorHelper(prefillItems);
3254
+ _context37.prev = 20;
3255
+ _iterator18.s();
3330
3256
  case 22:
3331
- if ((_step19 = _iterator19.n()).done) {
3332
- _context38.next = 45;
3257
+ if ((_step18 = _iterator18.n()).done) {
3258
+ _context37.next = 51;
3333
3259
  break;
3334
3260
  }
3335
- prefillItem = _step19.value;
3261
+ prefillItem = _step18.value;
3336
3262
  productId = Number(prefillItem.product_id);
3337
3263
  productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
3338
3264
  targetQuantity = toNonNegativeInt(prefillItem.quantity);
3339
3265
  if (!(!Number.isFinite(productId) || targetQuantity <= 0)) {
3340
- _context38.next = 29;
3266
+ _context37.next = 29;
3341
3267
  break;
3342
3268
  }
3343
- return _context38.abrupt("continue", 43);
3269
+ return _context37.abrupt("continue", 49);
3344
3270
  case 29:
3345
3271
  if (!Number.isNaN(productVariantId)) {
3346
- _context38.next = 31;
3272
+ _context37.next = 31;
3347
3273
  break;
3348
3274
  }
3349
- return _context38.abrupt("continue", 43);
3275
+ return _context37.abrupt("continue", 49);
3350
3276
  case 31:
3351
3277
  sourceItem = productSourceMap.get(buildProductKey(productId, productVariantId)) || productSourceMap.get(buildProductKey(productId, 0)) || null;
3352
3278
  productIndex = getProductIdentityIndex(tempOrder.products, {
@@ -3354,11 +3280,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3354
3280
  product_variant_id: productVariantId
3355
3281
  });
3356
3282
  if (!(productIndex === -1)) {
3357
- _context38.next = 38;
3283
+ _context37.next = 42;
3358
3284
  break;
3359
3285
  }
3360
3286
  sellingPrice = toPriceString((_sourceItem$price = sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price) !== null && _sourceItem$price !== void 0 ? _sourceItem$price : sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.selling_price, '0.00');
3361
- tempOrder.products.push(normalizeOrderProduct({
3287
+ origin = _objectSpread(_objectSpread({}, sourceItem || {}), {}, {
3288
+ item_rule_prefill: true,
3289
+ item_rule_id: prefillItem.ruleId
3290
+ });
3291
+ product = normalizeOrderProduct({
3362
3292
  product_id: productId,
3363
3293
  product_variant_id: productVariantId,
3364
3294
  num: targetQuantity,
@@ -3368,15 +3298,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3368
3298
  item_rule_prefill: true,
3369
3299
  item_rule_id: prefillItem.ruleId
3370
3300
  },
3371
- _origin: _objectSpread(_objectSpread({}, sourceItem || {}), {}, {
3372
- item_rule_prefill: true,
3373
- item_rule_id: prefillItem.ruleId
3374
- })
3375
- }));
3301
+ _origin: origin
3302
+ });
3303
+ productUid = String(((_product$metadata9 = product.metadata) === null || _product$metadata9 === void 0 ? void 0 : _product$metadata9.unique_identification_number) || '');
3304
+ this.attachProductOriginToTempOrder(tempOrder, productUid, origin);
3305
+ tempOrder.products.push(product);
3376
3306
  hasChanges = true;
3377
- return _context38.abrupt("continue", 43);
3378
- case 38:
3307
+ return _context37.abrupt("continue", 49);
3308
+ case 42:
3379
3309
  targetProduct = tempOrder.products[productIndex];
3310
+ previousOrigin = this.readProductOriginFromTempOrder(tempOrder, targetProduct);
3311
+ nextOrigin = sourceItem ? _objectSpread(_objectSpread({}, previousOrigin || {}), sourceItem) : previousOrigin;
3380
3312
  existedQuantity = toNonNegativeInt(targetProduct.num);
3381
3313
  delta = targetQuantity - existedQuantity;
3382
3314
  nextProduct = _objectSpread(_objectSpread(_objectSpread({}, targetProduct), delta > 0 ? {
@@ -3385,54 +3317,55 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3385
3317
  metadata: _objectSpread(_objectSpread({}, targetProduct.metadata || {}), {}, {
3386
3318
  item_rule_prefill: true,
3387
3319
  item_rule_id: prefillItem.ruleId
3388
- }),
3389
- _origin: sourceItem ? _objectSpread(_objectSpread({}, targetProduct._origin || {}), sourceItem) : targetProduct._origin
3320
+ })
3390
3321
  });
3391
- if (delta > 0 || Boolean(sourceItem && (!targetProduct._origin || ((_targetProduct$_origi = targetProduct._origin) === null || _targetProduct$_origi === void 0 ? void 0 : _targetProduct$_origi.price) !== (sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price)))) {
3322
+ if (delta > 0 || Boolean(sourceItem && (!previousOrigin || (previousOrigin === null || previousOrigin === void 0 ? void 0 : previousOrigin.price) !== (sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price)))) {
3323
+ _productUid = String(((_nextProduct$metadata = nextProduct.metadata) === null || _nextProduct$metadata === void 0 ? void 0 : _nextProduct$metadata.unique_identification_number) || '');
3324
+ this.attachProductOriginToTempOrder(tempOrder, _productUid, nextOrigin);
3392
3325
  tempOrder.products[productIndex] = nextProduct;
3393
3326
  hasChanges = true;
3394
3327
  }
3395
- case 43:
3396
- _context38.next = 22;
3328
+ case 49:
3329
+ _context37.next = 22;
3397
3330
  break;
3398
- case 45:
3399
- _context38.next = 50;
3331
+ case 51:
3332
+ _context37.next = 56;
3400
3333
  break;
3401
- case 47:
3402
- _context38.prev = 47;
3403
- _context38.t0 = _context38["catch"](20);
3404
- _iterator19.e(_context38.t0);
3405
- case 50:
3406
- _context38.prev = 50;
3407
- _iterator19.f();
3408
- return _context38.finish(50);
3409
3334
  case 53:
3335
+ _context37.prev = 53;
3336
+ _context37.t0 = _context37["catch"](20);
3337
+ _iterator18.e(_context37.t0);
3338
+ case 56:
3339
+ _context37.prev = 56;
3340
+ _iterator18.f();
3341
+ return _context37.finish(56);
3342
+ case 59:
3410
3343
  if (!hasChanges) {
3411
- _context38.next = 58;
3344
+ _context37.next = 64;
3412
3345
  break;
3413
3346
  }
3414
3347
  // Prefill 属于 products CRUD 的一种形式:新增后让 Rules 重算,以支持自动应用可用优惠券。
3415
3348
  this.store.order.applyDiscount();
3416
- _context38.next = 57;
3349
+ _context37.next = 63;
3417
3350
  return this.store.order.recalculateSummary({
3418
3351
  createIfMissing: true
3419
3352
  });
3420
- case 57:
3353
+ case 63:
3421
3354
  this.store.order.persistTempOrder();
3422
- case 58:
3423
- _context38.next = 60;
3355
+ case 64:
3356
+ _context37.next = 66;
3424
3357
  return this.refreshItemRuleQuantityLimits();
3425
- case 60:
3358
+ case 66:
3426
3359
  this.itemRulePrefillApplied = true;
3427
3360
  this.logMethodSuccess('applyPrefillByItemRule', {
3428
3361
  prefillCount: prefillItems.length,
3429
3362
  hasChanges: hasChanges
3430
3363
  });
3431
- case 62:
3364
+ case 68:
3432
3365
  case "end":
3433
- return _context38.stop();
3366
+ return _context37.stop();
3434
3367
  }
3435
- }, _callee38, this, [[20, 47, 50, 53]]);
3368
+ }, _callee37, this, [[20, 53, 56, 59]]);
3436
3369
  }));
3437
3370
  function applyPrefillByItemRule() {
3438
3371
  return _applyPrefillByItemRule.apply(this, arguments);
@@ -3442,24 +3375,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3442
3375
  }, {
3443
3376
  key: "applyItemRulePrefill",
3444
3377
  value: function () {
3445
- var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
3446
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3447
- while (1) switch (_context39.prev = _context39.next) {
3378
+ var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
3379
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3380
+ while (1) switch (_context38.prev = _context38.next) {
3448
3381
  case 0:
3449
3382
  this.logMethodStart('applyItemRulePrefill');
3450
- _context39.next = 3;
3383
+ _context38.next = 3;
3451
3384
  return this.applyPrefillByItemRule();
3452
3385
  case 3:
3453
- _context39.next = 5;
3386
+ _context38.next = 5;
3454
3387
  return this.refreshItemRuleQuantityLimits();
3455
3388
  case 5:
3456
- _context39.next = 7;
3389
+ _context38.next = 7;
3457
3390
  return this.refreshCartValidationPassed();
3458
3391
  case 7:
3459
3392
  case "end":
3460
- return _context39.stop();
3393
+ return _context38.stop();
3461
3394
  }
3462
- }, _callee39, this);
3395
+ }, _callee38, this);
3463
3396
  }));
3464
3397
  function applyItemRulePrefill() {
3465
3398
  return _applyItemRulePrefill.apply(this, arguments);
@@ -3469,35 +3402,35 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3469
3402
  }, {
3470
3403
  key: "evaluateCartValidationByItemRule",
3471
3404
  value: function () {
3472
- var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
3405
+ var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
3473
3406
  var strategyConfigs, businessData;
3474
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3475
- while (1) switch (_context40.prev = _context40.next) {
3407
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3408
+ while (1) switch (_context39.prev = _context39.next) {
3476
3409
  case 0:
3477
- _context40.next = 2;
3410
+ _context39.next = 2;
3478
3411
  return this.ensureItemRuleConfigsLoaded();
3479
3412
  case 2:
3480
- strategyConfigs = _context40.sent;
3413
+ strategyConfigs = _context39.sent;
3481
3414
  if (strategyConfigs.length) {
3482
- _context40.next = 5;
3415
+ _context39.next = 5;
3483
3416
  break;
3484
3417
  }
3485
- return _context40.abrupt("return", {
3418
+ return _context39.abrupt("return", {
3486
3419
  passed: true,
3487
3420
  failures: []
3488
3421
  });
3489
3422
  case 5:
3490
3423
  businessData = buildItemRuleBusinessData({
3491
- tempOrder: this.ensureTempOrder(),
3424
+ tempOrder: this.ensureVenueTempOrder(),
3492
3425
  runtimeConfig: this.getItemRuleRuntimeConfig(),
3493
3426
  itemRuleConfigs: this.itemRuleConfigs
3494
3427
  });
3495
- return _context40.abrupt("return", this.itemRuleEvaluator.validateCart(businessData));
3428
+ return _context39.abrupt("return", this.itemRuleEvaluator.validateCart(businessData));
3496
3429
  case 7:
3497
3430
  case "end":
3498
- return _context40.stop();
3431
+ return _context39.stop();
3499
3432
  }
3500
- }, _callee40, this);
3433
+ }, _callee39, this);
3501
3434
  }));
3502
3435
  function evaluateCartValidationByItemRule() {
3503
3436
  return _evaluateCartValidationByItemRule.apply(this, arguments);
@@ -3507,20 +3440,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3507
3440
  }, {
3508
3441
  key: "validateBeforeSubmitByItemRule",
3509
3442
  value: function () {
3510
- var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
3443
+ var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
3511
3444
  var validationResult, firstFailure, errorMessage, error;
3512
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3513
- while (1) switch (_context41.prev = _context41.next) {
3445
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3446
+ while (1) switch (_context40.prev = _context40.next) {
3514
3447
  case 0:
3515
- _context41.next = 2;
3448
+ _context40.next = 2;
3516
3449
  return this.evaluateCartValidationByItemRule();
3517
3450
  case 2:
3518
- validationResult = _context41.sent;
3451
+ validationResult = _context40.sent;
3519
3452
  if (!validationResult.passed) {
3520
- _context41.next = 5;
3453
+ _context40.next = 5;
3521
3454
  break;
3522
3455
  }
3523
- return _context41.abrupt("return");
3456
+ return _context40.abrupt("return");
3524
3457
  case 5:
3525
3458
  firstFailure = validationResult.failures[0];
3526
3459
  errorMessage = (firstFailure === null || firstFailure === void 0 ? void 0 : firstFailure.validationMessage) || '当前购物车未满足商品规则,请调整后再提交';
@@ -3529,9 +3462,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3529
3462
  throw error;
3530
3463
  case 10:
3531
3464
  case "end":
3532
- return _context41.stop();
3465
+ return _context40.stop();
3533
3466
  }
3534
- }, _callee41, this);
3467
+ }, _callee40, this);
3535
3468
  }));
3536
3469
  function validateBeforeSubmitByItemRule() {
3537
3470
  return _validateBeforeSubmitByItemRule.apply(this, arguments);
@@ -3541,10 +3474,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3541
3474
  }, {
3542
3475
  key: "refreshCartValidationPassed",
3543
3476
  value: function () {
3544
- var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
3477
+ var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
3545
3478
  var previous, nextState, validationResult, changed;
3546
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
3547
- while (1) switch (_context42.prev = _context42.next) {
3479
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3480
+ while (1) switch (_context41.prev = _context41.next) {
3548
3481
  case 0:
3549
3482
  previous = this.store.cartValidation || {
3550
3483
  passed: null,
@@ -3554,20 +3487,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3554
3487
  passed: null,
3555
3488
  failures: []
3556
3489
  };
3557
- _context42.prev = 2;
3558
- _context42.next = 5;
3490
+ _context41.prev = 2;
3491
+ _context41.next = 5;
3559
3492
  return this.evaluateCartValidationByItemRule();
3560
3493
  case 5:
3561
- validationResult = _context42.sent;
3494
+ validationResult = _context41.sent;
3562
3495
  nextState = {
3563
3496
  passed: validationResult.passed,
3564
3497
  failures: validationResult.failures || []
3565
3498
  };
3566
- _context42.next = 12;
3499
+ _context41.next = 12;
3567
3500
  break;
3568
3501
  case 9:
3569
- _context42.prev = 9;
3570
- _context42.t0 = _context42["catch"](2);
3502
+ _context41.prev = 9;
3503
+ _context41.t0 = _context41["catch"](2);
3571
3504
  nextState = {
3572
3505
  passed: false,
3573
3506
  failures: []
@@ -3576,21 +3509,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3576
3509
  this.store.cartValidation = nextState;
3577
3510
  changed = previous.passed !== nextState.passed || previous.failures !== nextState.failures;
3578
3511
  if (!changed) {
3579
- _context42.next = 17;
3512
+ _context41.next = 17;
3580
3513
  break;
3581
3514
  }
3582
- _context42.next = 17;
3515
+ _context41.next = 17;
3583
3516
  return this.core.effects.emit(VenueBookingHooks.onCartValidationChanged, {
3584
3517
  cartValidation: nextState,
3585
3518
  cartValidationPassed: nextState.passed
3586
3519
  });
3587
3520
  case 17:
3588
- return _context42.abrupt("return", nextState.passed);
3521
+ return _context41.abrupt("return", nextState.passed);
3589
3522
  case 18:
3590
3523
  case "end":
3591
- return _context42.stop();
3524
+ return _context41.stop();
3592
3525
  }
3593
- }, _callee42, this, [[2, 9]]);
3526
+ }, _callee41, this, [[2, 9]]);
3594
3527
  }));
3595
3528
  function refreshCartValidationPassed() {
3596
3529
  return _refreshCartValidationPassed.apply(this, arguments);
@@ -3600,14 +3533,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3600
3533
  }, {
3601
3534
  key: "setItemRuleRuntimeConfig",
3602
3535
  value: function () {
3603
- var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43() {
3536
+ var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
3604
3537
  var _this$itemRuleRuntime, _this$itemRuleRuntime2;
3605
3538
  var config,
3606
- _args43 = arguments;
3607
- return _regeneratorRuntime().wrap(function _callee43$(_context43) {
3608
- while (1) switch (_context43.prev = _context43.next) {
3539
+ _args42 = arguments;
3540
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
3541
+ while (1) switch (_context42.prev = _context42.next) {
3609
3542
  case 0:
3610
- config = _args43.length > 0 && _args43[0] !== undefined ? _args43[0] : {};
3543
+ config = _args42.length > 0 && _args42[0] !== undefined ? _args42[0] : {};
3611
3544
  this.logMethodStart('setItemRuleRuntimeConfig');
3612
3545
  this.itemRuleRuntimeConfig = _objectSpread(_objectSpread(_objectSpread({}, this.itemRuleRuntimeConfig), config), {}, {
3613
3546
  pax: _objectSpread(_objectSpread({}, ((_this$itemRuleRuntime = this.itemRuleRuntimeConfig) === null || _this$itemRuleRuntime === void 0 ? void 0 : _this$itemRuleRuntime.pax) || {}), (config === null || config === void 0 ? void 0 : config.pax) || {}),
@@ -3619,10 +3552,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3619
3552
  this.itemRuleEvaluator.setStrategyConfigs([]);
3620
3553
  }
3621
3554
  this.itemRulePrefillApplied = false;
3622
- _context43.next = 7;
3555
+ _context42.next = 7;
3623
3556
  return this.refreshItemRuleQuantityLimits();
3624
3557
  case 7:
3625
- _context43.next = 9;
3558
+ _context42.next = 9;
3626
3559
  return this.refreshCartValidationPassed();
3627
3560
  case 9:
3628
3561
  this.logMethodSuccess('setItemRuleRuntimeConfig', {
@@ -3630,9 +3563,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3630
3563
  });
3631
3564
  case 10:
3632
3565
  case "end":
3633
- return _context43.stop();
3566
+ return _context42.stop();
3634
3567
  }
3635
- }, _callee43, this);
3568
+ }, _callee42, this);
3636
3569
  }));
3637
3570
  function setItemRuleRuntimeConfig() {
3638
3571
  return _setItemRuleRuntimeConfig.apply(this, arguments);
@@ -3666,7 +3599,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3666
3599
  var raw = this.window.sessionStorage.getItem(key) || '{}';
3667
3600
  var parsed = JSON.parse(raw);
3668
3601
  return parsed && _typeof(parsed) === 'object' ? parsed : {};
3669
- } catch (_unused5) {
3602
+ } catch (_unused4) {
3670
3603
  return {};
3671
3604
  }
3672
3605
  }
@@ -3716,22 +3649,23 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3716
3649
  if (booking) {
3717
3650
  booking.holder = holder;
3718
3651
  }
3719
- var _iterator20 = _createForOfIteratorHelper(tempOrder.products),
3720
- _step20;
3652
+ var _iterator19 = _createForOfIteratorHelper(tempOrder.products),
3653
+ _step19;
3721
3654
  try {
3722
- for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
3723
- var _product$metadata$boo, _product$metadata9, _product$_origin2;
3724
- var product = _step20.value;
3725
- var productBookingUid = (_product$metadata$boo = (_product$metadata9 = product.metadata) === null || _product$metadata9 === void 0 ? void 0 : _product$metadata9.booking_uid) !== null && _product$metadata$boo !== void 0 ? _product$metadata$boo : (_product$_origin2 = product._origin) === null || _product$_origin2 === void 0 || (_product$_origin2 = _product$_origin2.product) === null || _product$_origin2 === void 0 ? void 0 : _product$_origin2.bookingUuid;
3655
+ for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
3656
+ var _runtimeProduct$metad, _runtimeProduct$metad2, _runtimeProduct$_orig;
3657
+ var product = _step19.value;
3658
+ var runtimeProduct = product;
3659
+ var productBookingUid = (_runtimeProduct$metad = (_runtimeProduct$metad2 = runtimeProduct.metadata) === null || _runtimeProduct$metad2 === void 0 ? void 0 : _runtimeProduct$metad2.booking_uid) !== null && _runtimeProduct$metad !== void 0 ? _runtimeProduct$metad : (_runtimeProduct$_orig = runtimeProduct._origin) === null || _runtimeProduct$_orig === void 0 || (_runtimeProduct$_orig = _runtimeProduct$_orig.product) === null || _runtimeProduct$_orig === void 0 ? void 0 : _runtimeProduct$_orig.bookingUuid;
3726
3660
  if (String(productBookingUid) !== String(bookingUid)) continue;
3727
- var origin = product._origin && _typeof(product._origin) === 'object' ? product._origin : {};
3661
+ var origin = runtimeProduct._origin && _typeof(runtimeProduct._origin) === 'object' ? runtimeProduct._origin : {};
3728
3662
  origin.holder = holder;
3729
- product._origin = origin;
3663
+ runtimeProduct._origin = origin;
3730
3664
  }
3731
3665
  } catch (err) {
3732
- _iterator20.e(err);
3666
+ _iterator19.e(err);
3733
3667
  } finally {
3734
- _iterator20.f();
3668
+ _iterator19.f();
3735
3669
  }
3736
3670
  this.store.order.notifyTempOrderChanged();
3737
3671
  }
@@ -3752,30 +3686,30 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3752
3686
  }, {
3753
3687
  key: "refreshAllHolderFormRecords",
3754
3688
  value: (function () {
3755
- var _refreshAllHolderFormRecords = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
3689
+ var _refreshAllHolderFormRecords = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
3756
3690
  var _params$customer_id, _params$useCache;
3757
3691
  var customer_id;
3758
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
3759
- while (1) switch (_context44.prev = _context44.next) {
3692
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
3693
+ while (1) switch (_context43.prev = _context43.next) {
3760
3694
  case 0:
3761
3695
  if (this.store.holder) {
3762
- _context44.next = 2;
3696
+ _context43.next = 2;
3763
3697
  break;
3764
3698
  }
3765
3699
  throw new Error('[VenueBooking] holder 模块未初始化');
3766
3700
  case 2:
3767
3701
  customer_id = (_params$customer_id = params === null || params === void 0 ? void 0 : params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.resolveHolderCustomerId();
3768
- return _context44.abrupt("return", this.store.holder.refreshAllFormRecords(_objectSpread(_objectSpread({}, params), {}, {
3702
+ return _context43.abrupt("return", this.store.holder.refreshAllFormRecords(_objectSpread(_objectSpread({}, params), {}, {
3769
3703
  customer_id: customer_id,
3770
3704
  useCache: (_params$useCache = params === null || params === void 0 ? void 0 : params.useCache) !== null && _params$useCache !== void 0 ? _params$useCache : false
3771
3705
  })));
3772
3706
  case 4:
3773
3707
  case "end":
3774
- return _context44.stop();
3708
+ return _context43.stop();
3775
3709
  }
3776
- }, _callee44, this);
3710
+ }, _callee43, this);
3777
3711
  }));
3778
- function refreshAllHolderFormRecords(_x22) {
3712
+ function refreshAllHolderFormRecords(_x21) {
3779
3713
  return _refreshAllHolderFormRecords.apply(this, arguments);
3780
3714
  }
3781
3715
  return refreshAllHolderFormRecords;
@@ -3795,25 +3729,25 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3795
3729
  }, {
3796
3730
  key: "checkOpenDataAvailability",
3797
3731
  value: function () {
3798
- var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45() {
3799
- return _regeneratorRuntime().wrap(function _callee45$(_context45) {
3800
- while (1) switch (_context45.prev = _context45.next) {
3732
+ var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44() {
3733
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
3734
+ while (1) switch (_context44.prev = _context44.next) {
3801
3735
  case 0:
3802
3736
  if (this.store.openData) {
3803
- _context45.next = 2;
3737
+ _context44.next = 2;
3804
3738
  break;
3805
3739
  }
3806
3740
  throw new Error('openData 模块未初始化');
3807
3741
  case 2:
3808
- _context45.next = 4;
3742
+ _context44.next = 4;
3809
3743
  return this.loadOpenDataConfig();
3810
3744
  case 4:
3811
- return _context45.abrupt("return", this.store.openData.checkAvailability(this.store.schedule));
3745
+ return _context44.abrupt("return", this.store.openData.checkAvailability(this.store.schedule));
3812
3746
  case 5:
3813
3747
  case "end":
3814
- return _context45.stop();
3748
+ return _context44.stop();
3815
3749
  }
3816
- }, _callee45, this);
3750
+ }, _callee44, this);
3817
3751
  }));
3818
3752
  function checkOpenDataAvailability() {
3819
3753
  return _checkOpenDataAvailability.apply(this, arguments);
@@ -3823,15 +3757,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3823
3757
  }, {
3824
3758
  key: "setOtherParams",
3825
3759
  value: function () {
3826
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
3827
- var _ref5,
3828
- _ref5$cover,
3760
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
3761
+ var _ref7,
3762
+ _ref7$cover,
3829
3763
  cover,
3830
- _args46 = arguments;
3831
- return _regeneratorRuntime().wrap(function _callee46$(_context46) {
3832
- while (1) switch (_context46.prev = _context46.next) {
3764
+ _args45 = arguments;
3765
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
3766
+ while (1) switch (_context45.prev = _context45.next) {
3833
3767
  case 0:
3834
- _ref5 = _args46.length > 1 && _args46[1] !== undefined ? _args46[1] : {}, _ref5$cover = _ref5.cover, cover = _ref5$cover === void 0 ? false : _ref5$cover;
3768
+ _ref7 = _args45.length > 1 && _args45[1] !== undefined ? _args45[1] : {}, _ref7$cover = _ref7.cover, cover = _ref7$cover === void 0 ? false : _ref7$cover;
3835
3769
  if (cover) {
3836
3770
  this.otherParams = params;
3837
3771
  } else {
@@ -3839,18 +3773,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3839
3773
  }
3840
3774
  case 2:
3841
3775
  case "end":
3842
- return _context46.stop();
3776
+ return _context45.stop();
3843
3777
  }
3844
- }, _callee46, this);
3778
+ }, _callee45, this);
3845
3779
  }));
3846
- function setOtherParams(_x23) {
3780
+ function setOtherParams(_x22) {
3847
3781
  return _setOtherParams.apply(this, arguments);
3848
3782
  }
3849
3783
  return setOtherParams;
3850
3784
  }()
3851
3785
  }]);
3852
3786
  return VenueBookingImpl;
3853
- }(BaseModule);
3787
+ }(BaseSalesImpl);
3854
3788
  _defineProperty(VenueBookingImpl, "OPEN_DATA_CACHE_TTL", 5 * 60 * 1000);
3855
- _defineProperty(VenueBookingImpl, "PISELL1_LOGIN_SUCCESS", 'pisell1.login.success');
3856
3789
  _defineProperty(VenueBookingImpl, "UI_STATE_KEY_PREFIX", 'pisell.venueBooking.uiState:');