@pisell/pisellos 0.0.568 → 0.0.569

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 (413) hide show
  1. package/dist/model/strategy/adapter/promotion/evaluator.js +3 -2
  2. package/dist/model/strategy/adapter/walletPass/utils.js +7 -4
  3. package/dist/modules/BaseModule.d.ts +2 -2
  4. package/dist/modules/BaseModule.js +4 -4
  5. package/dist/modules/BookingContext/index.d.ts +48 -0
  6. package/dist/modules/BookingContext/index.js +566 -0
  7. package/dist/modules/BookingContext/types.d.ts +102 -0
  8. package/dist/modules/BookingContext/types.js +51 -0
  9. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  10. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +302 -0
  11. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  12. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +149 -0
  13. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  14. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +249 -0
  15. package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
  16. package/dist/modules/BookingContext/utils/flexible.js +56 -0
  17. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  18. package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
  19. package/dist/modules/BookingContext/utils/index.d.ts +11 -0
  20. package/dist/modules/BookingContext/utils/index.js +11 -0
  21. package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
  22. package/dist/modules/BookingContext/utils/noResource.js +77 -0
  23. package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  24. package/dist/modules/BookingContext/utils/orderLineDisplay.js +36 -0
  25. package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
  26. package/dist/modules/BookingContext/utils/productExtend.js +339 -0
  27. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  28. package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
  29. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  30. package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
  31. package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
  32. package/dist/modules/BookingContext/utils/resources.js +486 -0
  33. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  34. package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
  35. package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  36. package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
  37. package/dist/modules/Cart/utils/cartProduct.js +26 -5
  38. package/dist/modules/Cart/utils/changePrice.js +27 -20
  39. package/dist/modules/Customer/index.d.ts +20 -0
  40. package/dist/modules/Customer/index.js +172 -83
  41. package/dist/modules/Customer/types.d.ts +2 -0
  42. package/dist/modules/Discount/index.d.ts +2 -1
  43. package/dist/modules/Discount/index.js +37 -9
  44. package/dist/modules/Discount/types.d.ts +1 -0
  45. package/dist/modules/OpenData/index.d.ts +8 -0
  46. package/dist/modules/OpenData/index.js +36 -16
  47. package/dist/modules/Order/index.d.ts +448 -23
  48. package/dist/modules/Order/index.js +5417 -561
  49. package/dist/modules/Order/types.d.ts +693 -88
  50. package/dist/modules/Order/types.js +68 -1
  51. package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
  52. package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
  53. package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  54. package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
  55. package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
  56. package/dist/modules/Order/utils/orderCollectionIdentity.js +405 -0
  57. package/dist/modules/Order/utils.d.ts +167 -18
  58. package/dist/modules/Order/utils.js +960 -165
  59. package/dist/modules/Payment/index.d.ts +10 -9
  60. package/dist/modules/Payment/index.js +465 -703
  61. package/dist/modules/Payment/types.d.ts +40 -16
  62. package/dist/modules/Payment/utils.d.ts +1 -1
  63. package/dist/modules/Payment/utils.js +4 -3
  64. package/dist/modules/Payment/walletpass.js +44 -29
  65. package/dist/modules/Product/types.d.ts +29 -7
  66. package/dist/modules/ProductList/index.d.ts +17 -13
  67. package/dist/modules/ProductList/index.js +184 -74
  68. package/dist/modules/ProductList/types.d.ts +17 -0
  69. package/dist/modules/Quotation/index.d.ts +22 -2
  70. package/dist/modules/Quotation/index.js +108 -42
  71. package/dist/modules/Quotation/types.d.ts +19 -0
  72. package/dist/modules/ResourcePlanner/index.d.ts +24 -0
  73. package/dist/modules/ResourcePlanner/index.js +181 -0
  74. package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
  75. package/dist/modules/ResourcePlanner/planner.js +1069 -0
  76. package/dist/modules/ResourcePlanner/types.d.ts +227 -0
  77. package/dist/modules/ResourcePlanner/types.js +1 -0
  78. package/dist/modules/Rules/index.d.ts +8 -10
  79. package/dist/modules/Rules/index.js +221 -109
  80. package/dist/modules/Rules/types.d.ts +14 -3
  81. package/dist/modules/SalesSummary/index.d.ts +23 -26
  82. package/dist/modules/SalesSummary/index.js +152 -46
  83. package/dist/modules/SalesSummary/types.d.ts +9 -1
  84. package/dist/modules/SalesSummary/utils.d.ts +3 -22
  85. package/dist/modules/SalesSummary/utils.js +803 -163
  86. package/dist/modules/Schedule/getDateIsInSchedule.js +14 -7
  87. package/dist/modules/Schedule/index.d.ts +18 -5
  88. package/dist/modules/Schedule/index.js +78 -24
  89. package/dist/modules/Schedule/types.d.ts +2 -0
  90. package/dist/modules/Summary/index.js +4 -3
  91. package/dist/modules/SurchargeList/index.d.ts +18 -0
  92. package/dist/modules/SurchargeList/index.js +185 -0
  93. package/dist/modules/SurchargeList/types.d.ts +15 -0
  94. package/dist/modules/SurchargeList/types.js +1 -0
  95. package/dist/modules/index.d.ts +3 -0
  96. package/dist/modules/index.js +4 -1
  97. package/dist/plugins/app.d.ts +2 -0
  98. package/dist/plugins/request.d.ts +1 -0
  99. package/dist/server/index.d.ts +462 -8
  100. package/dist/server/index.js +6112 -656
  101. package/dist/server/modules/floor-plan/index.d.ts +39 -0
  102. package/dist/server/modules/floor-plan/index.js +595 -0
  103. package/dist/server/modules/floor-plan/types.d.ts +43 -0
  104. package/dist/server/modules/floor-plan/types.js +13 -0
  105. package/dist/server/modules/index.d.ts +7 -2
  106. package/dist/server/modules/index.js +6 -0
  107. package/dist/server/modules/order/index.d.ts +207 -14
  108. package/dist/server/modules/order/index.js +2326 -379
  109. package/dist/server/modules/order/types.d.ts +76 -5
  110. package/dist/server/modules/order/types.js +14 -1
  111. package/dist/server/modules/order/utils/filterBookings.d.ts +7 -1
  112. package/dist/server/modules/order/utils/filterBookings.js +118 -11
  113. package/dist/server/modules/order/utils/filterOrders.js +242 -14
  114. package/dist/server/modules/payment/index.d.ts +28 -0
  115. package/dist/server/modules/payment/index.js +305 -0
  116. package/dist/server/modules/payment/types.d.ts +9 -0
  117. package/dist/server/modules/payment/types.js +1 -0
  118. package/dist/server/modules/products/index.d.ts +105 -14
  119. package/dist/server/modules/products/index.js +1393 -516
  120. package/dist/server/modules/products/types.d.ts +34 -1
  121. package/dist/server/modules/products/types.js +4 -0
  122. package/dist/server/modules/quotation/index.d.ts +39 -0
  123. package/dist/server/modules/quotation/index.js +278 -66
  124. package/dist/server/modules/resource/index.d.ts +2 -3
  125. package/dist/server/modules/resource/index.js +108 -86
  126. package/dist/server/modules/schedule/index.d.ts +6 -4
  127. package/dist/server/modules/schedule/index.js +116 -85
  128. package/dist/server/test.json +713 -0
  129. package/dist/server/types.d.ts +2 -0
  130. package/dist/server/utils/product.js +2 -2
  131. package/dist/server/utils/small-ticket.d.ts +71 -0
  132. package/dist/server/utils/small-ticket.js +963 -0
  133. package/dist/solution/BaseSales/index.d.ts +378 -0
  134. package/dist/solution/BaseSales/index.js +4006 -0
  135. package/dist/solution/BaseSales/types.d.ts +394 -0
  136. package/dist/solution/BaseSales/types.js +40 -0
  137. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
  138. package/dist/solution/BaseSales/utils/cartPromotion.js +1450 -0
  139. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
  140. package/dist/solution/BaseSales/utils/parseSalesResponse.js +157 -0
  141. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
  142. package/dist/solution/BaseSales/utils/quotationPrice.js +250 -0
  143. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
  144. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +218 -0
  145. package/dist/solution/BaseSales/utils.d.ts +40 -0
  146. package/dist/solution/BaseSales/utils.js +263 -0
  147. package/dist/solution/BookingByStep/index.d.ts +1 -1
  148. package/dist/solution/BookingTicket/index.d.ts +394 -25
  149. package/dist/solution/BookingTicket/index.js +2506 -443
  150. package/dist/solution/BookingTicket/types.d.ts +191 -6
  151. package/dist/solution/BookingTicket/types.js +83 -10
  152. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
  153. package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
  154. package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  155. package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
  156. package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
  157. package/dist/solution/BookingTicket/utils/bookingStatus.js +136 -0
  158. package/dist/solution/BookingTicket/utils/cartView.d.ts +29 -0
  159. package/dist/solution/BookingTicket/utils/cartView.js +209 -0
  160. package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  161. package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
  162. package/dist/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
  163. package/dist/solution/BookingTicket/utils/orderCustomer.js +31 -0
  164. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  165. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +438 -0
  166. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
  167. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +400 -0
  168. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
  169. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +41 -1
  170. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
  171. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +56 -0
  172. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  173. package/dist/solution/BookingTicket/utils/scan/handleScan.js +11 -3
  174. package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  175. package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
  176. package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  177. package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +150 -0
  178. package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
  179. package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +78 -0
  180. package/dist/solution/Checkout/index.d.ts +1 -0
  181. package/dist/solution/Checkout/index.js +25 -34
  182. package/dist/solution/Checkout/utils/index.js +4 -4
  183. package/dist/solution/RegisterAndLogin/config.js +2 -10
  184. package/dist/solution/Sales/index.d.ts +50 -5
  185. package/dist/solution/Sales/index.js +484 -92
  186. package/dist/solution/Sales/types.d.ts +26 -2
  187. package/dist/solution/ScanOrder/index.d.ts +27 -21
  188. package/dist/solution/ScanOrder/index.js +499 -434
  189. package/dist/solution/ScanOrder/types.d.ts +33 -11
  190. package/dist/solution/ScanOrder/types.js +4 -5
  191. package/dist/solution/ScanOrder/utils.d.ts +4 -1
  192. package/dist/solution/ScanOrder/utils.js +109 -34
  193. package/dist/solution/ShopDiscount/index.js +4 -4
  194. package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
  195. package/dist/solution/UnifiedBookingSales/index.js +1871 -0
  196. package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
  197. package/dist/solution/UnifiedBookingSales/types.js +11 -0
  198. package/dist/solution/VenueBooking/index.d.ts +29 -20
  199. package/dist/solution/VenueBooking/index.js +301 -213
  200. package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  201. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
  202. package/dist/solution/VenueBooking/utils/slotMerge.js +9 -3
  203. package/dist/solution/index.d.ts +2 -0
  204. package/dist/solution/index.js +3 -1
  205. package/dist/types/index.d.ts +11 -1
  206. package/lib/model/strategy/adapter/promotion/evaluator.js +3 -2
  207. package/lib/model/strategy/adapter/walletPass/utils.js +6 -4
  208. package/lib/modules/BaseModule.d.ts +2 -2
  209. package/lib/modules/BaseModule.js +4 -4
  210. package/lib/modules/BookingContext/index.d.ts +48 -0
  211. package/lib/modules/BookingContext/index.js +390 -0
  212. package/lib/modules/BookingContext/types.d.ts +102 -0
  213. package/lib/modules/BookingContext/types.js +48 -0
  214. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  215. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +286 -0
  216. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  217. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +148 -0
  218. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  219. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +242 -0
  220. package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
  221. package/lib/modules/BookingContext/utils/flexible.js +63 -0
  222. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  223. package/lib/modules/BookingContext/utils/formatResourceList.js +35 -0
  224. package/lib/modules/BookingContext/utils/index.d.ts +11 -0
  225. package/lib/modules/BookingContext/utils/index.js +126 -0
  226. package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
  227. package/lib/modules/BookingContext/utils/noResource.js +78 -0
  228. package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  229. package/lib/modules/BookingContext/utils/orderLineDisplay.js +29 -0
  230. package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
  231. package/lib/modules/BookingContext/utils/productExtend.js +330 -0
  232. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  233. package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
  234. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  235. package/lib/modules/BookingContext/utils/resourceSelection.js +24 -0
  236. package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
  237. package/lib/modules/BookingContext/utils/resources.js +419 -0
  238. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  239. package/lib/modules/BookingContext/utils/serviceTimes.js +161 -0
  240. package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  241. package/lib/modules/BookingContext/utils/timeSlices.js +114 -0
  242. package/lib/modules/Cart/utils/cartProduct.js +27 -5
  243. package/lib/modules/Cart/utils/changePrice.js +20 -14
  244. package/lib/modules/Customer/index.d.ts +20 -0
  245. package/lib/modules/Customer/index.js +63 -10
  246. package/lib/modules/Customer/types.d.ts +2 -0
  247. package/lib/modules/Discount/index.d.ts +2 -1
  248. package/lib/modules/Discount/index.js +18 -2
  249. package/lib/modules/Discount/types.d.ts +1 -0
  250. package/lib/modules/OpenData/index.d.ts +8 -0
  251. package/lib/modules/OpenData/index.js +21 -3
  252. package/lib/modules/Order/index.d.ts +448 -23
  253. package/lib/modules/Order/index.js +3641 -308
  254. package/lib/modules/Order/types.d.ts +693 -88
  255. package/lib/modules/Order/types.js +55 -1
  256. package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
  257. package/lib/modules/Order/utils/bundleDiscountHydration.js +106 -0
  258. package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  259. package/lib/modules/Order/utils/manualProductDiscount.js +207 -0
  260. package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
  261. package/lib/modules/Order/utils/orderCollectionIdentity.js +353 -0
  262. package/lib/modules/Order/utils.d.ts +167 -18
  263. package/lib/modules/Order/utils.js +974 -138
  264. package/lib/modules/Payment/index.d.ts +10 -9
  265. package/lib/modules/Payment/index.js +30 -124
  266. package/lib/modules/Payment/types.d.ts +40 -16
  267. package/lib/modules/Payment/utils.d.ts +1 -1
  268. package/lib/modules/Payment/utils.js +4 -3
  269. package/lib/modules/Payment/walletpass.js +16 -6
  270. package/lib/modules/Product/types.d.ts +29 -7
  271. package/lib/modules/ProductList/index.d.ts +17 -13
  272. package/lib/modules/ProductList/index.js +92 -51
  273. package/lib/modules/ProductList/types.d.ts +17 -0
  274. package/lib/modules/Quotation/index.d.ts +22 -2
  275. package/lib/modules/Quotation/index.js +76 -20
  276. package/lib/modules/Quotation/types.d.ts +19 -0
  277. package/lib/modules/ResourcePlanner/index.d.ts +24 -0
  278. package/lib/modules/ResourcePlanner/index.js +147 -0
  279. package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
  280. package/lib/modules/ResourcePlanner/planner.js +895 -0
  281. package/lib/modules/ResourcePlanner/types.d.ts +227 -0
  282. package/lib/modules/ResourcePlanner/types.js +5 -0
  283. package/lib/modules/Rules/index.d.ts +8 -10
  284. package/lib/modules/Rules/index.js +152 -60
  285. package/lib/modules/Rules/types.d.ts +14 -3
  286. package/lib/modules/SalesSummary/index.d.ts +23 -26
  287. package/lib/modules/SalesSummary/index.js +84 -16
  288. package/lib/modules/SalesSummary/types.d.ts +9 -1
  289. package/lib/modules/SalesSummary/utils.d.ts +3 -22
  290. package/lib/modules/SalesSummary/utils.js +616 -111
  291. package/lib/modules/Schedule/getDateIsInSchedule.js +14 -7
  292. package/lib/modules/Schedule/index.d.ts +18 -5
  293. package/lib/modules/Schedule/index.js +49 -14
  294. package/lib/modules/Schedule/types.d.ts +2 -0
  295. package/lib/modules/Summary/index.js +2 -2
  296. package/lib/modules/SurchargeList/index.d.ts +18 -0
  297. package/lib/modules/SurchargeList/index.js +95 -0
  298. package/lib/modules/SurchargeList/types.d.ts +15 -0
  299. package/lib/modules/SurchargeList/types.js +5 -0
  300. package/lib/modules/index.d.ts +3 -0
  301. package/lib/modules/index.js +33 -0
  302. package/lib/plugins/app.d.ts +2 -0
  303. package/lib/plugins/request.d.ts +1 -0
  304. package/lib/server/index.d.ts +462 -8
  305. package/lib/server/index.js +3901 -205
  306. package/lib/server/modules/floor-plan/index.d.ts +39 -0
  307. package/lib/server/modules/floor-plan/index.js +306 -0
  308. package/lib/server/modules/floor-plan/types.d.ts +43 -0
  309. package/lib/server/modules/floor-plan/types.js +19 -0
  310. package/lib/server/modules/index.d.ts +7 -2
  311. package/lib/server/modules/index.js +21 -0
  312. package/lib/server/modules/order/index.d.ts +207 -14
  313. package/lib/server/modules/order/index.js +1324 -141
  314. package/lib/server/modules/order/types.d.ts +76 -5
  315. package/lib/server/modules/order/types.js +11 -1
  316. package/lib/server/modules/order/utils/filterBookings.d.ts +7 -1
  317. package/lib/server/modules/order/utils/filterBookings.js +119 -11
  318. package/lib/server/modules/order/utils/filterOrders.js +238 -13
  319. package/lib/server/modules/payment/index.d.ts +28 -0
  320. package/lib/server/modules/payment/index.js +168 -0
  321. package/lib/server/modules/payment/types.d.ts +9 -0
  322. package/lib/server/modules/payment/types.js +5 -0
  323. package/lib/server/modules/products/index.d.ts +105 -14
  324. package/lib/server/modules/products/index.js +588 -97
  325. package/lib/server/modules/products/types.d.ts +34 -1
  326. package/lib/server/modules/products/types.js +3 -0
  327. package/lib/server/modules/quotation/index.d.ts +39 -0
  328. package/lib/server/modules/quotation/index.js +145 -1
  329. package/lib/server/modules/resource/index.d.ts +2 -3
  330. package/lib/server/modules/resource/index.js +71 -45
  331. package/lib/server/modules/schedule/index.d.ts +6 -4
  332. package/lib/server/modules/schedule/index.js +55 -44
  333. package/lib/server/test.json +713 -0
  334. package/lib/server/types.d.ts +2 -0
  335. package/lib/server/utils/product.js +2 -2
  336. package/lib/server/utils/small-ticket.d.ts +71 -0
  337. package/lib/server/utils/small-ticket.js +926 -0
  338. package/lib/solution/BaseSales/index.d.ts +378 -0
  339. package/lib/solution/BaseSales/index.js +2367 -0
  340. package/lib/solution/BaseSales/types.d.ts +394 -0
  341. package/lib/solution/BaseSales/types.js +47 -0
  342. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
  343. package/lib/solution/BaseSales/utils/cartPromotion.js +1155 -0
  344. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
  345. package/lib/solution/BaseSales/utils/parseSalesResponse.js +140 -0
  346. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
  347. package/lib/solution/BaseSales/utils/quotationPrice.js +231 -0
  348. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
  349. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +215 -0
  350. package/lib/solution/BaseSales/utils.d.ts +40 -0
  351. package/lib/solution/BaseSales/utils.js +259 -0
  352. package/lib/solution/BookingByStep/index.d.ts +1 -1
  353. package/lib/solution/BookingTicket/index.d.ts +394 -25
  354. package/lib/solution/BookingTicket/index.js +1350 -76
  355. package/lib/solution/BookingTicket/types.d.ts +191 -6
  356. package/lib/solution/BookingTicket/types.js +71 -10
  357. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
  358. package/lib/solution/BookingTicket/utils/addProductDecision.js +353 -0
  359. package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  360. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +94 -0
  361. package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
  362. package/lib/solution/BookingTicket/utils/bookingStatus.js +136 -0
  363. package/lib/solution/BookingTicket/utils/cartView.d.ts +29 -0
  364. package/lib/solution/BookingTicket/utils/cartView.js +200 -0
  365. package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  366. package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
  367. package/lib/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
  368. package/lib/solution/BookingTicket/utils/orderCustomer.js +35 -0
  369. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  370. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +387 -0
  371. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
  372. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +220 -0
  373. package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
  374. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +24 -3
  375. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
  376. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +64 -0
  377. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  378. package/lib/solution/BookingTicket/utils/scan/handleScan.js +4 -2
  379. package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  380. package/lib/solution/BookingTicket/utils/scan/index.js +14 -2
  381. package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  382. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +115 -0
  383. package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
  384. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +83 -0
  385. package/lib/solution/Checkout/index.d.ts +1 -0
  386. package/lib/solution/Checkout/index.js +18 -19
  387. package/lib/solution/Checkout/utils/index.js +4 -4
  388. package/lib/solution/RegisterAndLogin/config.js +2 -10
  389. package/lib/solution/Sales/index.d.ts +50 -5
  390. package/lib/solution/Sales/index.js +296 -39
  391. package/lib/solution/Sales/types.d.ts +26 -2
  392. package/lib/solution/ScanOrder/index.d.ts +27 -21
  393. package/lib/solution/ScanOrder/index.js +144 -103
  394. package/lib/solution/ScanOrder/types.d.ts +33 -11
  395. package/lib/solution/ScanOrder/types.js +4 -5
  396. package/lib/solution/ScanOrder/utils.d.ts +4 -1
  397. package/lib/solution/ScanOrder/utils.js +98 -26
  398. package/lib/solution/ShopDiscount/index.js +3 -3
  399. package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
  400. package/lib/solution/UnifiedBookingSales/index.js +1050 -0
  401. package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
  402. package/lib/solution/UnifiedBookingSales/types.js +14 -0
  403. package/lib/solution/VenueBooking/index.d.ts +29 -20
  404. package/lib/solution/VenueBooking/index.js +169 -94
  405. package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  406. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
  407. package/lib/solution/VenueBooking/utils/slotMerge.js +9 -3
  408. package/lib/solution/index.d.ts +2 -0
  409. package/lib/solution/index.js +22 -0
  410. package/lib/types/index.d.ts +11 -1
  411. package/package.json +1 -1
  412. package/dist/solution/Checkout/appointmentDemo.json +0 -1
  413. package/lib/solution/Checkout/appointmentDemo.json +0 -1
@@ -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";
@@ -46,7 +48,7 @@ import { buildTimeSlotGrid, isBusinessHoursCrossDay, generateTimeLabels } from "
46
48
  import { buildDateRangeSummary } from "./utils/dateSummary";
47
49
  import { mergeConsecutiveSlots, expandMergedSlotToIndividual, buildVenueIdentityKey, buildVenueBookingEntry, buildVenueResourceMetadata, buildPriceBreakdown } from "./utils/slotMerge";
48
50
  import { buildSlotPriceMapByScheduleSegments, formatProductsWithDataVariant, getPriceForProductAtDatetime, getSlotPriceFromMap } from "./utils/smartPricing";
49
- import { composeLinePrice, createUuidV4, sumOptionUnitPrice } from "../../modules/Order/utils";
51
+ import { composeLinePrice, createUuidV4, getProductSkuOptions, sumOptionUnitPrice } from "../../modules/Order/utils";
50
52
  import { OrderModule } from "../../modules/Order";
51
53
  import { RegisterAndLoginHooks } from "../RegisterAndLogin/types";
52
54
  import Decimal from 'decimal.js';
@@ -62,8 +64,8 @@ function cloneCustomDepositData(customDepositData) {
62
64
  deposit_policy_data: Array.isArray(customDepositData.deposit_policy_data) ? _toConsumableArray(customDepositData.deposit_policy_data) : []
63
65
  });
64
66
  }
65
- export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
66
- _inherits(VenueBookingImpl, _BaseModule);
67
+ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
68
+ _inherits(VenueBookingImpl, _BaseSalesImpl);
67
69
  var _super = _createSuper(VenueBookingImpl);
68
70
  function VenueBookingImpl(name, version) {
69
71
  var _this;
@@ -273,6 +275,76 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
273
275
  }
274
276
  return addLog;
275
277
  }()
278
+ }, {
279
+ key: "getRegisteredModuleNames",
280
+ value: function getRegisteredModuleNames() {
281
+ return ['scanOrderLogger', 'products', 'order', 'salesSummary', 'venueProducts', 'addonProducts', 'date', 'schedule', 'quotation', 'openData'];
282
+ }
283
+ }, {
284
+ key: "createSubModule",
285
+ value: function createSubModule(moduleName) {
286
+ switch (moduleName) {
287
+ case 'scanOrderLogger':
288
+ return createModule('scanOrderLogger', this.name);
289
+ case 'venueProducts':
290
+ return new ProductList("".concat(this.name, "_venueProducts"));
291
+ case 'addonProducts':
292
+ return new ProductList("".concat(this.name, "_addonProducts"));
293
+ case 'date':
294
+ return new DateModule("".concat(this.name, "_date"));
295
+ case 'openData':
296
+ return new OpenDataModule("".concat(this.name, "_openData"));
297
+ default:
298
+ return _get(_getPrototypeOf(VenueBookingImpl.prototype), "createSubModule", this).call(this, moduleName);
299
+ }
300
+ }
301
+ }, {
302
+ key: "attachProductOriginToTempOrder",
303
+ value: function attachProductOriginToTempOrder(tempOrder, productUid, origin) {
304
+ var _tempOrder$_extend, _tempOrder$_extend2;
305
+ if (!productUid || !origin) return;
306
+ tempOrder._extend = _objectSpread(_objectSpread({}, tempOrder._extend || {}), {}, {
307
+ 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]) || {}), {}, {
308
+ origin: origin
309
+ })))
310
+ });
311
+ }
312
+ }, {
313
+ key: "readProductOriginFromTempOrder",
314
+ value: function readProductOriginFromTempOrder(tempOrder, product) {
315
+ var _product$metadata, _tempOrder$_extend3;
316
+ var uid = ((_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.unique_identification_number) || product.identity_key;
317
+ 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) {
318
+ return tempOrder._extend.productsByUid[uid].origin;
319
+ }
320
+ return product._origin;
321
+ }
322
+ }, {
323
+ key: "normalizeVenueProductTitle",
324
+ value: function normalizeVenueProductTitle(value) {
325
+ if (typeof value === 'string') {
326
+ var text = value.trim();
327
+ return text ? {
328
+ auto: text
329
+ } : undefined;
330
+ }
331
+ if (!value || _typeof(value) !== 'object' || Array.isArray(value)) return undefined;
332
+ var source = value;
333
+ var normalized = {};
334
+ Object.entries(source).forEach(function (_ref) {
335
+ var _ref2 = _slicedToArray(_ref, 2),
336
+ key = _ref2[0],
337
+ text = _ref2[1];
338
+ if (typeof text === 'string') normalized[key] = text;
339
+ });
340
+ if (!normalized.auto) {
341
+ var fallback = normalized.original || normalized.en || normalized['zh-CN'] || normalized['zh-HK'];
342
+ if (fallback) normalized.auto = fallback;
343
+ }
344
+ return Object.values(normalized).some(function (text) {
345
+ return String(text || '').trim();
346
+ }) ? normalized : undefined;
347
+ }
276
348
  }, {
277
349
  key: "normalizeCustomerId",
278
350
  value: function normalizeCustomerId(value) {
@@ -424,7 +496,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
424
496
  this.clearLoginEffectListeners();
425
497
  var createHandleLogin = function createHandleLogin() {
426
498
  return /*#__PURE__*/function () {
427
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(payload) {
499
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(payload) {
428
500
  var customerId;
429
501
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
430
502
  while (1) switch (_context4.prev = _context4.next) {
@@ -447,7 +519,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
447
519
  }, _callee4);
448
520
  }));
449
521
  return function (_x4) {
450
- return _ref.apply(this, arguments);
522
+ return _ref3.apply(this, arguments);
451
523
  };
452
524
  }();
453
525
  };
@@ -583,12 +655,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
583
655
  _this$otherParams2,
584
656
  _this$otherParams3,
585
657
  _this4 = this,
586
- _this$otherParams4,
587
- _this$otherParams5,
588
658
  _this$otherParams6,
589
659
  _this$otherParams7,
590
- _this$otherParams8;
660
+ _this$otherParams8,
661
+ _this$otherParams9,
662
+ _this$otherParams10;
591
663
  var options,
664
+ _this$otherParams4,
665
+ _this$otherParams5,
592
666
  baseModules,
593
667
  venueProductsModule,
594
668
  addonProductsModule,
@@ -609,8 +683,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
609
683
  case 0:
610
684
  options = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
611
685
  this.logMethodStart('initialize');
612
- this.core = core;
613
- this.initializeOptions = options || {};
614
686
  this.store = _objectSpread(_objectSpread({}, this.store), options.store);
615
687
  this.smartPricingCustomerId = undefined;
616
688
  this.store.entryContext = ((_options$otherParams = options.otherParams) === null || _options$otherParams === void 0 ? void 0 : _options$otherParams.entryContext) || this.store.entryContext;
@@ -630,22 +702,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
630
702
  passed: null,
631
703
  failures: []
632
704
  };
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;
705
+ _context7.next = 20;
706
+ return _get(_getPrototypeOf(VenueBookingImpl.prototype), "initialize", this).call(this, core, options);
707
+ case 20:
708
+ if (this.store.scanOrderLogger) {
709
+ this.store.scanOrderLogger.setProvider(((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.loggerProvider) || 'feishu');
710
+ this.store.scanOrderLogger.setProviderConfig(((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.loggerConfig) || {
711
+ feishu: {
712
+ webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/8f069b14-9d39-4728-8f78-b56f393bfde8',
713
+ errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/bdefae5e-f233-4705-8688-946887d9543d'
714
+ }
715
+ });
716
+ this.store.scanOrderLogger.setContext(this.getLoggerContext());
645
717
  }
646
- this.logMethodError('initialize', 'request plugin missing');
647
- throw new Error('venueBooking解决方案需要 request 插件支持');
648
- case 28:
649
718
  // 注册基础模块(order, salesSummary, products, logger)
650
719
  baseModules = ['scanOrderLogger', 'products', 'order', 'salesSummary'];
651
720
  baseModules.forEach(function (step) {
@@ -658,10 +727,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
658
727
  } : {};
659
728
  var loggerProvider = ((_this4$otherParams = _this4.otherParams) === null || _this4$otherParams === void 0 ? void 0 : _this4$otherParams.loggerProvider) || 'feishu';
660
729
  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
- }
730
+ // feishu: {
731
+ // webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/8f069b14-9d39-4728-8f78-b56f393bfde8',
732
+ // errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/bdefae5e-f233-4705-8688-946887d9543d',
733
+ // },
665
734
  };
666
735
  _this4.core.registerModule(targetModule, {
667
736
  initialState: initialState,
@@ -733,11 +802,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
733
802
  this.core.registerModule(openDataModule, {
734
803
  otherParams: _objectSpread(_objectSpread({}, this.otherParams), {}, {
735
804
  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
805
+ openCache: !!((_this$otherParams6 = this.otherParams) !== null && _this$otherParams6 !== void 0 && _this$otherParams6.cacheId),
806
+ cacheId: (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.cacheId
738
807
  })
739
808
  });
740
- if ((_this$otherParams6 = this.otherParams) !== null && _this$otherParams6 !== void 0 && _this$otherParams6.cacheId) {
809
+ if ((_this$otherParams8 = this.otherParams) !== null && _this$otherParams8 !== void 0 && _this$otherParams8.cacheId) {
741
810
  sessionData = this.window.sessionStorage.getItem(this.name);
742
811
  if (sessionData) {
743
812
  try {
@@ -754,48 +823,45 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
754
823
  initialState: holderCacheState,
755
824
  otherParams: _objectSpread(_objectSpread({}, this.otherParams), {}, {
756
825
  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
826
+ openCache: !!((_this$otherParams9 = this.otherParams) !== null && _this$otherParams9 !== void 0 && _this$otherParams9.cacheId),
827
+ cacheId: (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.cacheId
759
828
  })
760
829
  });
761
- if (this.store.scanOrderLogger) {
762
- this.store.scanOrderLogger.setContext(this.getLoggerContext());
763
- }
764
830
  this.registerCustomerLoginListeners();
765
- _context7.prev = 54;
766
- _context7.next = 57;
831
+ _context7.prev = 46;
832
+ _context7.next = 49;
767
833
  return (_this$store$order = this.store.order) === null || _this$store$order === void 0 ? void 0 : _this$store$order.recalculateSummary({
768
834
  createIfMissing: false
769
835
  });
770
- case 57:
836
+ case 49:
771
837
  (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || _this$store$order2.persistTempOrder();
772
- _context7.next = 60;
838
+ _context7.next = 52;
773
839
  return this.loadRuntimeConfigs();
774
- case 60:
840
+ case 52:
775
841
  if (!this.store.schedule) {
776
- _context7.next = 63;
842
+ _context7.next = 55;
777
843
  break;
778
844
  }
779
- _context7.next = 63;
845
+ _context7.next = 55;
780
846
  return this.store.schedule.loadAllSchedule();
781
- case 63:
782
- _context7.next = 65;
847
+ case 55:
848
+ _context7.next = 57;
783
849
  return this.refreshItemRuleQuantityLimits();
784
- case 65:
850
+ case 57:
785
851
  this.store.status = 'ready';
786
- _context7.next = 68;
852
+ _context7.next = 60;
787
853
  return this.core.effects.emit(VenueBookingHooks.onInited, {
788
854
  status: this.store.status
789
855
  });
790
- case 68:
856
+ case 60:
791
857
  this.logMethodSuccess('initialize', {
792
858
  status: this.store.status
793
859
  });
794
- _context7.next = 78;
860
+ _context7.next = 70;
795
861
  break;
796
- case 71:
797
- _context7.prev = 71;
798
- _context7.t0 = _context7["catch"](54);
862
+ case 63:
863
+ _context7.prev = 63;
864
+ _context7.t0 = _context7["catch"](46);
799
865
  this.store.status = 'error';
800
866
  this.store.error = _context7.t0 instanceof Error ? _context7.t0.message : '初始化失败';
801
867
  console.error('[VenueBooking] 初始化失败', _context7.t0);
@@ -803,11 +869,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
803
869
  status: this.store.status
804
870
  });
805
871
  throw _context7.t0;
806
- case 78:
872
+ case 70:
807
873
  case "end":
808
874
  return _context7.stop();
809
875
  }
810
- }, _callee7, this, [[54, 71]]);
876
+ }, _callee7, this, [[46, 63]]);
811
877
  }));
812
878
  function initialize(_x6) {
813
879
  return _initialize.apply(this, arguments);
@@ -969,9 +1035,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
969
1035
  }, {
970
1036
  key: "resolveAvailableWalletIdsForSmartPricing",
971
1037
  value: function resolveAvailableWalletIdsForSmartPricing() {
972
- var _this$store$order3, _this$store$order3$ge, _this$otherParams9, _this$otherParams10, _this$otherParams11, _this$otherParams12;
1038
+ var _this$store$order3, _this$store$order3$ge, _this$otherParams11, _this$otherParams12, _this$otherParams13, _this$otherParams14;
973
1039
  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);
1040
+ var fallbackWalletIds = ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.available_wallet_ids) || ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.availableWalletIds) || ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 || (_this$otherParams13 = _this$otherParams13.strategy_context) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.available_wallet_ids) || ((_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 || (_this$otherParams14 = _this$otherParams14.strategy_context) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.availableWalletIds);
975
1041
  var source = Array.isArray(orderWalletIds) && orderWalletIds.length ? orderWalletIds : fallbackWalletIds;
976
1042
  if (!Array.isArray(source)) return [];
977
1043
  var ids = source.map(function (item) {
@@ -996,18 +1062,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
996
1062
  }, {
997
1063
  key: "buildSmartPricingContext",
998
1064
  value: function buildSmartPricingContext(customerId) {
999
- var _this$core3, _this$otherParams13, _this$otherParams14, _this$otherParams15, _this$otherParams16, _this$otherParams17, _this$otherParams18, _this$otherParams19;
1065
+ var _this$core3, _this$otherParams15, _this$otherParams16, _this$otherParams17, _this$otherParams18, _this$otherParams19, _this$otherParams20, _this$otherParams21;
1000
1066
  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
1067
  return {
1002
1068
  evaluator: evaluator,
1003
1069
  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) || [],
1070
+ menuList: ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.menuList) || ((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 || (_this$otherParams16 = _this$otherParams16.openData) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.menuList) || [],
1005
1071
  customerId: customerId !== null && customerId !== void 0 ? customerId : this.resolveCustomerIdForSmartPricing(),
1006
1072
  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
1073
+ channel: (_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.channel,
1074
+ businessCode: (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode,
1075
+ orderType: ((_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.orderType) || ((_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.type),
1076
+ strategy_context: (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.strategy_context
1011
1077
  };
1012
1078
  }
1013
1079
 
@@ -1086,7 +1152,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1086
1152
  key: "_doLoadAllProducts",
1087
1153
  value: function () {
1088
1154
  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;
1155
+ var _this$otherParams22, _this$store$venueProd, associatedMenus, menuListIds, allProducts, rawList, list, venueList, addonList, venueStore, _this$store$order4, _this$store$order4$ge, products;
1090
1156
  return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1091
1157
  while (1) switch (_context12.prev = _context12.next) {
1092
1158
  case 0:
@@ -1107,7 +1173,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1107
1173
  _context12.next = 8;
1108
1174
  return this.loadOpenDataConfig();
1109
1175
  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']) || [];
1176
+ associatedMenus = ((_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 || (_this$otherParams22 = _this$otherParams22.openData) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22['menu.associated_menus']) || [];
1111
1177
  if (associatedMenus.length) {
1112
1178
  _context12.next = 12;
1113
1179
  break;
@@ -1792,9 +1858,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1792
1858
  _step10;
1793
1859
  try {
1794
1860
  var _loop2 = function _loop2() {
1795
- var _product$metadata;
1861
+ var _product$metadata2;
1796
1862
  var product = _step10.value;
1797
- var resourceId = (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.resource_id;
1863
+ var resourceId = (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.resource_id;
1798
1864
  if (resourceId == null) return 1; // continue
1799
1865
  var productId = Number(product.product_id);
1800
1866
  var existing = result.get(resourceId) || [];
@@ -1842,7 +1908,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1842
1908
  value: (function () {
1843
1909
  var _reconcileOrderForResourceProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(resourceId, productId, slots) {
1844
1910
  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;
1911
+ 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
1912
  return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1847
1913
  while (1) switch (_context18.prev = _context18.next) {
1848
1914
  case 0:
@@ -1907,6 +1973,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1907
1973
  endMoment = dayjs(group.endTime, 'YYYY-MM-DD HH:mm');
1908
1974
  duration = endMoment.diff(startMoment, 'minute');
1909
1975
  customDepositData = cloneCustomDepositData(venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.custom_deposit_data);
1976
+ 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
1977
  resourceEntry = {
1911
1978
  relation_type: 'form',
1912
1979
  like_status: 'common',
@@ -1935,7 +2002,45 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1935
2002
  };
1936
2003
  });
1937
2004
  }
1938
- tempOrder.products.push(normalizeOrderProduct({
2005
+ venueProductOrigin = {
2006
+ name: mapping.productTitle,
2007
+ product_title: productTitle,
2008
+ cover: (venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.cover) || '',
2009
+ custom_deposit_data: customDepositData,
2010
+ id: 0,
2011
+ number: 1,
2012
+ registration_type: 'all',
2013
+ relation_products: [],
2014
+ is_all: false,
2015
+ product: {
2016
+ product_id: mapping.productId,
2017
+ product_variant_id: 0,
2018
+ num: 1,
2019
+ product_bundle: [],
2020
+ product_sku: {
2021
+ option: []
2022
+ },
2023
+ discount_list: [],
2024
+ custom_deposit_data: customDepositData,
2025
+ metadata: {}
2026
+ },
2027
+ sub_type: 'minutes',
2028
+ duration: duration,
2029
+ like_status: 'common',
2030
+ resources: [resourceEntry],
2031
+ schedule_id: 0,
2032
+ select_date: startMoment.format('YYYY-MM-DD'),
2033
+ start_date: startMoment.format('YYYY-MM-DD'),
2034
+ start_time: startMoment.format('HH:mm'),
2035
+ end_date: endMoment.format('YYYY-MM-DD'),
2036
+ end_time: endMoment.format('HH:mm'),
2037
+ metadata: {
2038
+ venue_booking: true,
2039
+ slot_count: group.slotCount
2040
+ },
2041
+ holder: null
2042
+ };
2043
+ normalizedVenueOrderProduct = normalizeOrderProduct({
1939
2044
  product_id: mapping.productId,
1940
2045
  product_variant_id: 0,
1941
2046
  identity_key: identityKey,
@@ -1943,8 +2048,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1943
2048
  selling_price: group.totalPrice,
1944
2049
  original_price: group.totalPrice,
1945
2050
  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,
2051
+ metadata: _objectSpread(_objectSpread({
2052
+ venue_booking: true
2053
+ }, productTitle ? {
2054
+ product_title: productTitle
2055
+ } : {}), {}, {
1948
2056
  resource_id: resourceId,
1949
2057
  resource_form_id: mapping.formId,
1950
2058
  resource_name: mapping.resourceName,
@@ -1954,48 +2062,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1954
2062
  booking_uid: bookingUuid,
1955
2063
  price_breakdown: buildPriceBreakdown({
1956
2064
  group: group,
1957
- productId: mapping.productId
2065
+ productId: mapping.productId,
2066
+ quotation: this.store.quotation
1958
2067
  })
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
- }));
2068
+ }),
2069
+ _origin: venueProductOrigin
2070
+ });
2071
+ venueOrderProduct = productTitle ? _objectSpread(_objectSpread({}, normalizedVenueOrderProduct), {}, {
2072
+ product_title: productTitle
2073
+ }) : normalizedVenueOrderProduct;
2074
+ this.attachProductOriginToTempOrder(tempOrder, identityKey, venueProductOrigin);
2075
+ tempOrder.products.push(venueOrderProduct);
1999
2076
  booking = buildVenueBookingEntry({
2000
2077
  group: group,
2001
2078
  resourceId: resourceId,
@@ -2131,8 +2208,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2131
2208
  }, {
2132
2209
  key: "updateTempOrderNote",
2133
2210
  value: function updateTempOrderNote(note) {
2211
+ var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2134
2212
  if (!this.store.order) throw new Error('order 模块未初始化');
2135
- return this.store.order.updateTempOrderNote(note);
2213
+ return this.store.order.updateTempOrderNote(note, sync);
2136
2214
  }
2137
2215
  }, {
2138
2216
  key: "updateTempOrderContactsInfo",
@@ -2141,8 +2219,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2141
2219
  return this.store.order.updateTempOrderContactsInfo(contactsInfo);
2142
2220
  }
2143
2221
  }, {
2144
- key: "ensureTempOrder",
2145
- value: function ensureTempOrder() {
2222
+ key: "ensureVenueTempOrder",
2223
+ value: function ensureVenueTempOrder() {
2146
2224
  if (!this.store.order) throw new Error('order 模块未初始化');
2147
2225
  return this.store.order.ensureTempOrder();
2148
2226
  }
@@ -2198,9 +2276,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2198
2276
  _step13;
2199
2277
  try {
2200
2278
  var _loop4 = function _loop4() {
2201
- var _product$metadata2;
2279
+ var _product$metadata3;
2202
2280
  var product = _step13.value;
2203
- if ((_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.venue_booking) {
2281
+ if ((_product$metadata3 = product.metadata) !== null && _product$metadata3 !== void 0 && _product$metadata3.venue_booking) {
2204
2282
  var mappings = _this9.resourceProductMap.get(product.metadata.resource_id);
2205
2283
  if (!mappings || !mappings.length) return 0; // continue
2206
2284
  var mapping = mappings.find(function (m) {
@@ -2334,7 +2412,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2334
2412
  key: "setDiscountSelected",
2335
2413
  value: (function () {
2336
2414
  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;
2415
+ 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$metadata$sou, _product$metadata4, _product$metadata5, _product$original_pri, product, origin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, afterApplyTarget, finalSummary, finalProduct, finalTarget;
2338
2416
  return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2339
2417
  while (1) switch (_context22.prev = _context22.next) {
2340
2418
  case 0:
@@ -2423,16 +2501,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2423
2501
  _iterator16.s();
2424
2502
  case 21:
2425
2503
  if ((_step16 = _iterator16.n()).done) {
2426
- _context22.next = 35;
2504
+ _context22.next = 36;
2427
2505
  break;
2428
2506
  }
2429
2507
  product = _step16.value;
2430
- if (!((_product$_origin = product._origin) !== null && _product$_origin !== void 0 && _product$_origin.isManualDiscount)) {
2431
- _context22.next = 25;
2508
+ origin = this.readProductOriginFromTempOrder(tempOrder, product);
2509
+ if (!(origin !== null && origin !== void 0 && origin.isManualDiscount)) {
2510
+ _context22.next = 26;
2432
2511
  break;
2433
2512
  }
2434
- return _context22.abrupt("continue", 33);
2435
- case 25:
2513
+ return _context22.abrupt("continue", 34);
2514
+ case 26:
2436
2515
  // 1. 把 product.discount_list 和当前选中的 discount 对齐(剔除已取消的券)
2437
2516
  product.discount_list = (product.discount_list || []).filter(function (pd) {
2438
2517
  var _pd$discount$resource, _pd$discount;
@@ -2445,8 +2524,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2445
2524
  totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
2446
2525
  return sum + (pd.amount || 0);
2447
2526
  }, 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';
2527
+ optionSum = sumOptionUnitPrice(getProductSkuOptions(product));
2528
+ 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
2529
  newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
2451
2530
  newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
2452
2531
  if (product.metadata) {
@@ -2457,36 +2536,36 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2457
2536
  mainPrice: newMainSellingPrice,
2458
2537
  bundle: product.product_bundle
2459
2538
  });
2460
- case 33:
2539
+ case 34:
2461
2540
  _context22.next = 21;
2462
2541
  break;
2463
- case 35:
2464
- _context22.next = 40;
2542
+ case 36:
2543
+ _context22.next = 41;
2465
2544
  break;
2466
- case 37:
2467
- _context22.prev = 37;
2545
+ case 38:
2546
+ _context22.prev = 38;
2468
2547
  _context22.t0 = _context22["catch"](19);
2469
2548
  _iterator16.e(_context22.t0);
2470
- case 40:
2471
- _context22.prev = 40;
2549
+ case 41:
2550
+ _context22.prev = 41;
2472
2551
  _iterator16.f();
2473
- return _context22.finish(40);
2474
- case 43:
2552
+ return _context22.finish(41);
2553
+ case 44:
2475
2554
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
2476
- _context22.next = 46;
2555
+ _context22.next = 47;
2477
2556
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
2478
- case 46:
2557
+ case 47:
2479
2558
  tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
2480
2559
  return d.isSelected;
2481
2560
  });
2482
2561
  afterApplyTarget = this.store.order.getDiscountList().find(function (d) {
2483
2562
  return d.id === params.discountId;
2484
2563
  }) || null;
2485
- _context22.next = 50;
2564
+ _context22.next = 51;
2486
2565
  return this.store.order.recalculateSummary({
2487
2566
  createIfMissing: true
2488
2567
  });
2489
- case 50:
2568
+ case 51:
2490
2569
  this.store.order.persistTempOrder();
2491
2570
  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
2571
  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 +2574,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2495
2574
  return d.id === params.discountId;
2496
2575
  }) || null;
2497
2576
  return _context22.abrupt("return", this.store.order.getDiscountList());
2498
- case 58:
2499
- _context22.prev = 58;
2577
+ case 59:
2578
+ _context22.prev = 59;
2500
2579
  _context22.t1 = _context22["catch"](1);
2501
2580
  this.logMethodError('setDiscountSelected', _context22.t1);
2502
2581
  throw _context22.t1;
2503
- case 62:
2582
+ case 63:
2504
2583
  case "end":
2505
2584
  return _context22.stop();
2506
2585
  }
2507
- }, _callee22, this, [[1, 58], [19, 37, 40, 43]]);
2586
+ }, _callee22, this, [[1, 59], [19, 38, 41, 44]]);
2508
2587
  }));
2509
2588
  function setDiscountSelected(_x16) {
2510
2589
  return _setDiscountSelected.apply(this, arguments);
@@ -2555,7 +2634,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2555
2634
  key: "getOrderProducts",
2556
2635
  value: function getOrderProducts() {
2557
2636
  if (!this.store.order) throw new Error('order 模块未初始化');
2558
- return this.store.order.getOrderProducts();
2637
+ var products = this.store.order.getOrderProducts();
2638
+ return products;
2559
2639
  }
2560
2640
  }, {
2561
2641
  key: "getSummary",
@@ -2574,7 +2654,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2574
2654
  throw new Error('order 模块未初始化');
2575
2655
  case 4:
2576
2656
  _context24.next = 6;
2577
- return this.store.order.getScanOrderSummary();
2657
+ return this.store.order.getOrderSummary();
2578
2658
  case 6:
2579
2659
  summary = _context24.sent;
2580
2660
  this.logMethodSuccess('getSummary', {
@@ -2601,7 +2681,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2601
2681
  key: "submitOrder",
2602
2682
  value: function () {
2603
2683
  var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
2604
- var _this$otherParams21, _this$otherParams22, _this$otherParams23, _this$otherParams24, _tempOrder$products2, result, tempOrder;
2684
+ var _this$otherParams23, _this$otherParams24, _this$otherParams25, _this$otherParams26, _tempOrder$products2, result, tempOrder;
2605
2685
  return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2606
2686
  while (1) switch (_context25.prev = _context25.next) {
2607
2687
  case 0:
@@ -2619,10 +2699,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2619
2699
  _context25.next = 8;
2620
2700
  return this.store.order.submitTempOrder({
2621
2701
  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
2702
+ platform: (_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.platform,
2703
+ businessCode: (_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.businessCode,
2704
+ channel: (_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.channel,
2705
+ type: (_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.type
2626
2706
  });
2627
2707
  case 8:
2628
2708
  result = _context25.sent;
@@ -2698,7 +2778,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2698
2778
  key: "addProductToOrder",
2699
2779
  value: function () {
2700
2780
  var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(product) {
2701
- var _product$metadata5, _product$metadata6, smartPrice, products;
2781
+ var _product$metadata6, _product$metadata7, smartPrice, products;
2702
2782
  return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2703
2783
  while (1) switch (_context27.prev = _context27.next) {
2704
2784
  case 0:
@@ -2713,7 +2793,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2713
2793
  }
2714
2794
  throw new Error('order 模块未初始化');
2715
2795
  case 4:
2716
- if (!((_product$metadata5 = product.metadata) !== null && _product$metadata5 !== void 0 && _product$metadata5.venue_booking) && product.product_id != null) {
2796
+ if (!((_product$metadata6 = product.metadata) !== null && _product$metadata6 !== void 0 && _product$metadata6.venue_booking) && product.product_id != null) {
2717
2797
  smartPrice = getPriceForProductAtDatetime({
2718
2798
  products: this.getAllProductsForSmartPricing(),
2719
2799
  context: this.buildSmartPricingContext(),
@@ -2723,7 +2803,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2723
2803
  });
2724
2804
  product.selling_price = smartPrice;
2725
2805
  product.original_price = smartPrice;
2726
- } else if (product.selling_price != null && !((_product$metadata6 = product.metadata) !== null && _product$metadata6 !== void 0 && _product$metadata6.venue_booking)) {
2806
+ } else if (product.selling_price != null && !((_product$metadata7 = product.metadata) !== null && _product$metadata7 !== void 0 && _product$metadata7.venue_booking)) {
2727
2807
  product.original_price = product.selling_price;
2728
2808
  }
2729
2809
  _context27.next = 7;
@@ -2757,14 +2837,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2757
2837
  return addProductToOrder;
2758
2838
  }()
2759
2839
  }, {
2760
- key: "updateProductInOrder",
2840
+ key: "updateOrderProduct",
2761
2841
  value: function () {
2762
- var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
2842
+ var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
2763
2843
  var products;
2764
2844
  return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2765
2845
  while (1) switch (_context28.prev = _context28.next) {
2766
2846
  case 0:
2767
- this.logMethodStart('updateProductInOrder', {
2847
+ this.logMethodStart('updateOrderProduct', {
2768
2848
  product_id: params.product_id,
2769
2849
  product_variant_id: params.product_variant_id
2770
2850
  });
@@ -2776,7 +2856,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2776
2856
  throw new Error('order 模块未初始化');
2777
2857
  case 4:
2778
2858
  _context28.next = 6;
2779
- return this.store.order.updateProductInOrder(params);
2859
+ return this.store.order.updateOrderProduct(params);
2780
2860
  case 6:
2781
2861
  products = _context28.sent;
2782
2862
  _context28.next = 9;
@@ -2785,14 +2865,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2785
2865
  _context28.next = 11;
2786
2866
  return this.refreshCartValidationPassed();
2787
2867
  case 11:
2788
- this.logMethodSuccess('updateProductInOrder', {
2868
+ this.logMethodSuccess('updateOrderProduct', {
2789
2869
  productCount: products.length
2790
2870
  });
2791
2871
  return _context28.abrupt("return", products);
2792
2872
  case 15:
2793
2873
  _context28.prev = 15;
2794
2874
  _context28.t0 = _context28["catch"](1);
2795
- this.logMethodError('updateProductInOrder', _context28.t0);
2875
+ this.logMethodError('updateOrderProduct', _context28.t0);
2796
2876
  throw _context28.t0;
2797
2877
  case 19:
2798
2878
  case "end":
@@ -2800,16 +2880,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2800
2880
  }
2801
2881
  }, _callee28, this, [[1, 15]]);
2802
2882
  }));
2803
- function updateProductInOrder(_x19) {
2804
- return _updateProductInOrder.apply(this, arguments);
2883
+ function updateOrderProduct(_x19) {
2884
+ return _updateOrderProduct.apply(this, arguments);
2805
2885
  }
2806
- return updateProductInOrder;
2886
+ return updateOrderProduct;
2807
2887
  }()
2808
2888
  }, {
2809
2889
  key: "removeProductFromOrder",
2810
2890
  value: function () {
2811
2891
  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;
2892
+ 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$metadata8, _product$metadata9, product, beforeBookingCount, _this$store$order$per, _this$store$order11;
2813
2893
  return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2814
2894
  while (1) switch (_context29.prev = _context29.next) {
2815
2895
  case 0:
@@ -2844,14 +2924,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2844
2924
  break;
2845
2925
  }
2846
2926
  product = _step17.value;
2847
- if (product !== null && product !== void 0 && (_product$metadata7 = product.metadata) !== null && _product$metadata7 !== void 0 && _product$metadata7.venue_booking) {
2927
+ if (product !== null && product !== void 0 && (_product$metadata8 = product.metadata) !== null && _product$metadata8 !== void 0 && _product$metadata8.venue_booking) {
2848
2928
  _context29.next = 18;
2849
2929
  break;
2850
2930
  }
2851
2931
  return _context29.abrupt("continue", 20);
2852
2932
  case 18:
2853
2933
  if (product.identity_key) venueProductUids.add(String(product.identity_key));
2854
- if ((_product$metadata8 = product.metadata) !== null && _product$metadata8 !== void 0 && _product$metadata8.booking_uid) {
2934
+ if ((_product$metadata9 = product.metadata) !== null && _product$metadata9 !== void 0 && _product$metadata9.booking_uid) {
2855
2935
  venueBookingUids.add(String(product.metadata.booking_uid));
2856
2936
  }
2857
2937
  case 20:
@@ -3132,8 +3212,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3132
3212
  var rawProductId = (_node$product_id = node.product_id) !== null && _node$product_id !== void 0 ? _node$product_id : node.id;
3133
3213
  var productId = Number(rawProductId);
3134
3214
  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);
3215
+ var _ref5, _node$product_variant;
3216
+ 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
3217
  var normalizedVariantId = Number.isNaN(productVariantId) ? 0 : productVariantId;
3138
3218
  var key = buildProductKey(productId, normalizedVariantId);
3139
3219
  if (!sourceMap.has(key)) sourceMap.set(key, node);
@@ -3248,7 +3328,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3248
3328
  return _context37.abrupt("return", []);
3249
3329
  case 7:
3250
3330
  businessData = buildItemRuleBusinessData({
3251
- tempOrder: this.ensureTempOrder(),
3331
+ tempOrder: this.ensureVenueTempOrder(),
3252
3332
  runtimeConfig: this.getItemRuleRuntimeConfig(),
3253
3333
  itemRuleConfigs: this.itemRuleConfigs
3254
3334
  });
@@ -3279,7 +3359,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3279
3359
  key: "applyPrefillByItemRule",
3280
3360
  value: function () {
3281
3361
  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;
3362
+ var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator19, _step19, _prefillItem$product_, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, _product$metadata10, sellingPrice, origin, product, productUid, targetProduct, previousOrigin, nextOrigin, existedQuantity, delta, nextProduct, _nextProduct$metadata, _productUid;
3283
3363
  return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3284
3364
  while (1) switch (_context38.prev = _context38.next) {
3285
3365
  case 0:
@@ -3306,7 +3386,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3306
3386
  return _context38.abrupt("return");
3307
3387
  case 9:
3308
3388
  businessData = buildItemRuleBusinessData({
3309
- tempOrder: this.ensureTempOrder(),
3389
+ tempOrder: this.ensureVenueTempOrder(),
3310
3390
  runtimeConfig: this.getItemRuleRuntimeConfig(),
3311
3391
  itemRuleConfigs: this.itemRuleConfigs
3312
3392
  });
@@ -3322,14 +3402,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3322
3402
  return this.buildPrefillProductSourceMap();
3323
3403
  case 16:
3324
3404
  productSourceMap = _context38.sent;
3325
- tempOrder = this.ensureTempOrder();
3405
+ tempOrder = this.ensureVenueTempOrder();
3326
3406
  hasChanges = false;
3327
3407
  _iterator19 = _createForOfIteratorHelper(prefillItems);
3328
3408
  _context38.prev = 20;
3329
3409
  _iterator19.s();
3330
3410
  case 22:
3331
3411
  if ((_step19 = _iterator19.n()).done) {
3332
- _context38.next = 45;
3412
+ _context38.next = 51;
3333
3413
  break;
3334
3414
  }
3335
3415
  prefillItem = _step19.value;
@@ -3340,13 +3420,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3340
3420
  _context38.next = 29;
3341
3421
  break;
3342
3422
  }
3343
- return _context38.abrupt("continue", 43);
3423
+ return _context38.abrupt("continue", 49);
3344
3424
  case 29:
3345
3425
  if (!Number.isNaN(productVariantId)) {
3346
3426
  _context38.next = 31;
3347
3427
  break;
3348
3428
  }
3349
- return _context38.abrupt("continue", 43);
3429
+ return _context38.abrupt("continue", 49);
3350
3430
  case 31:
3351
3431
  sourceItem = productSourceMap.get(buildProductKey(productId, productVariantId)) || productSourceMap.get(buildProductKey(productId, 0)) || null;
3352
3432
  productIndex = getProductIdentityIndex(tempOrder.products, {
@@ -3354,11 +3434,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3354
3434
  product_variant_id: productVariantId
3355
3435
  });
3356
3436
  if (!(productIndex === -1)) {
3357
- _context38.next = 38;
3437
+ _context38.next = 42;
3358
3438
  break;
3359
3439
  }
3360
3440
  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({
3441
+ origin = _objectSpread(_objectSpread({}, sourceItem || {}), {}, {
3442
+ item_rule_prefill: true,
3443
+ item_rule_id: prefillItem.ruleId
3444
+ });
3445
+ product = normalizeOrderProduct({
3362
3446
  product_id: productId,
3363
3447
  product_variant_id: productVariantId,
3364
3448
  num: targetQuantity,
@@ -3368,15 +3452,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3368
3452
  item_rule_prefill: true,
3369
3453
  item_rule_id: prefillItem.ruleId
3370
3454
  },
3371
- _origin: _objectSpread(_objectSpread({}, sourceItem || {}), {}, {
3372
- item_rule_prefill: true,
3373
- item_rule_id: prefillItem.ruleId
3374
- })
3375
- }));
3455
+ _origin: origin
3456
+ });
3457
+ productUid = String(((_product$metadata10 = product.metadata) === null || _product$metadata10 === void 0 ? void 0 : _product$metadata10.unique_identification_number) || '');
3458
+ this.attachProductOriginToTempOrder(tempOrder, productUid, origin);
3459
+ tempOrder.products.push(product);
3376
3460
  hasChanges = true;
3377
- return _context38.abrupt("continue", 43);
3378
- case 38:
3461
+ return _context38.abrupt("continue", 49);
3462
+ case 42:
3379
3463
  targetProduct = tempOrder.products[productIndex];
3464
+ previousOrigin = this.readProductOriginFromTempOrder(tempOrder, targetProduct);
3465
+ nextOrigin = sourceItem ? _objectSpread(_objectSpread({}, previousOrigin || {}), sourceItem) : previousOrigin;
3380
3466
  existedQuantity = toNonNegativeInt(targetProduct.num);
3381
3467
  delta = targetQuantity - existedQuantity;
3382
3468
  nextProduct = _objectSpread(_objectSpread(_objectSpread({}, targetProduct), delta > 0 ? {
@@ -3385,54 +3471,55 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3385
3471
  metadata: _objectSpread(_objectSpread({}, targetProduct.metadata || {}), {}, {
3386
3472
  item_rule_prefill: true,
3387
3473
  item_rule_id: prefillItem.ruleId
3388
- }),
3389
- _origin: sourceItem ? _objectSpread(_objectSpread({}, targetProduct._origin || {}), sourceItem) : targetProduct._origin
3474
+ })
3390
3475
  });
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)))) {
3476
+ if (delta > 0 || Boolean(sourceItem && (!previousOrigin || (previousOrigin === null || previousOrigin === void 0 ? void 0 : previousOrigin.price) !== (sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price)))) {
3477
+ _productUid = String(((_nextProduct$metadata = nextProduct.metadata) === null || _nextProduct$metadata === void 0 ? void 0 : _nextProduct$metadata.unique_identification_number) || '');
3478
+ this.attachProductOriginToTempOrder(tempOrder, _productUid, nextOrigin);
3392
3479
  tempOrder.products[productIndex] = nextProduct;
3393
3480
  hasChanges = true;
3394
3481
  }
3395
- case 43:
3482
+ case 49:
3396
3483
  _context38.next = 22;
3397
3484
  break;
3398
- case 45:
3399
- _context38.next = 50;
3485
+ case 51:
3486
+ _context38.next = 56;
3400
3487
  break;
3401
- case 47:
3402
- _context38.prev = 47;
3488
+ case 53:
3489
+ _context38.prev = 53;
3403
3490
  _context38.t0 = _context38["catch"](20);
3404
3491
  _iterator19.e(_context38.t0);
3405
- case 50:
3406
- _context38.prev = 50;
3492
+ case 56:
3493
+ _context38.prev = 56;
3407
3494
  _iterator19.f();
3408
- return _context38.finish(50);
3409
- case 53:
3495
+ return _context38.finish(56);
3496
+ case 59:
3410
3497
  if (!hasChanges) {
3411
- _context38.next = 58;
3498
+ _context38.next = 64;
3412
3499
  break;
3413
3500
  }
3414
3501
  // Prefill 属于 products CRUD 的一种形式:新增后让 Rules 重算,以支持自动应用可用优惠券。
3415
3502
  this.store.order.applyDiscount();
3416
- _context38.next = 57;
3503
+ _context38.next = 63;
3417
3504
  return this.store.order.recalculateSummary({
3418
3505
  createIfMissing: true
3419
3506
  });
3420
- case 57:
3507
+ case 63:
3421
3508
  this.store.order.persistTempOrder();
3422
- case 58:
3423
- _context38.next = 60;
3509
+ case 64:
3510
+ _context38.next = 66;
3424
3511
  return this.refreshItemRuleQuantityLimits();
3425
- case 60:
3512
+ case 66:
3426
3513
  this.itemRulePrefillApplied = true;
3427
3514
  this.logMethodSuccess('applyPrefillByItemRule', {
3428
3515
  prefillCount: prefillItems.length,
3429
3516
  hasChanges: hasChanges
3430
3517
  });
3431
- case 62:
3518
+ case 68:
3432
3519
  case "end":
3433
3520
  return _context38.stop();
3434
3521
  }
3435
- }, _callee38, this, [[20, 47, 50, 53]]);
3522
+ }, _callee38, this, [[20, 53, 56, 59]]);
3436
3523
  }));
3437
3524
  function applyPrefillByItemRule() {
3438
3525
  return _applyPrefillByItemRule.apply(this, arguments);
@@ -3488,7 +3575,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3488
3575
  });
3489
3576
  case 5:
3490
3577
  businessData = buildItemRuleBusinessData({
3491
- tempOrder: this.ensureTempOrder(),
3578
+ tempOrder: this.ensureVenueTempOrder(),
3492
3579
  runtimeConfig: this.getItemRuleRuntimeConfig(),
3493
3580
  itemRuleConfigs: this.itemRuleConfigs
3494
3581
  });
@@ -3720,13 +3807,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3720
3807
  _step20;
3721
3808
  try {
3722
3809
  for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
3723
- var _product$metadata$boo, _product$metadata9, _product$_origin2;
3810
+ var _runtimeProduct$metad, _runtimeProduct$metad2, _runtimeProduct$_orig;
3724
3811
  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;
3812
+ var runtimeProduct = product;
3813
+ 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
3814
  if (String(productBookingUid) !== String(bookingUid)) continue;
3727
- var origin = product._origin && _typeof(product._origin) === 'object' ? product._origin : {};
3815
+ var origin = runtimeProduct._origin && _typeof(runtimeProduct._origin) === 'object' ? runtimeProduct._origin : {};
3728
3816
  origin.holder = holder;
3729
- product._origin = origin;
3817
+ runtimeProduct._origin = origin;
3730
3818
  }
3731
3819
  } catch (err) {
3732
3820
  _iterator20.e(err);
@@ -3824,14 +3912,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3824
3912
  key: "setOtherParams",
3825
3913
  value: function () {
3826
3914
  var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
3827
- var _ref5,
3828
- _ref5$cover,
3915
+ var _ref7,
3916
+ _ref7$cover,
3829
3917
  cover,
3830
3918
  _args46 = arguments;
3831
3919
  return _regeneratorRuntime().wrap(function _callee46$(_context46) {
3832
3920
  while (1) switch (_context46.prev = _context46.next) {
3833
3921
  case 0:
3834
- _ref5 = _args46.length > 1 && _args46[1] !== undefined ? _args46[1] : {}, _ref5$cover = _ref5.cover, cover = _ref5$cover === void 0 ? false : _ref5$cover;
3922
+ _ref7 = _args46.length > 1 && _args46[1] !== undefined ? _args46[1] : {}, _ref7$cover = _ref7.cover, cover = _ref7$cover === void 0 ? false : _ref7$cover;
3835
3923
  if (cover) {
3836
3924
  this.otherParams = params;
3837
3925
  } else {
@@ -3850,7 +3938,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3850
3938
  }()
3851
3939
  }]);
3852
3940
  return VenueBookingImpl;
3853
- }(BaseModule);
3941
+ }(BaseSalesImpl);
3854
3942
  _defineProperty(VenueBookingImpl, "OPEN_DATA_CACHE_TTL", 5 * 60 * 1000);
3855
3943
  _defineProperty(VenueBookingImpl, "PISELL1_LOGIN_SUCCESS", 'pisell1.login.success');
3856
3944
  _defineProperty(VenueBookingImpl, "UI_STATE_KEY_PREFIX", 'pisell.venueBooking.uiState:');