@pisell/pisellos 2.2.242 → 2.2.244

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (314) hide show
  1. package/dist/model/strategy/adapter/promotion/evaluator.js +2 -3
  2. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  3. package/dist/model/strategy/adapter/walletPass/utils.js +4 -7
  4. package/dist/modules/Cart/utils/cartProduct.js +3 -24
  5. package/dist/modules/Cart/utils/changePrice.js +11 -11
  6. package/dist/modules/Customer/index.d.ts +0 -20
  7. package/dist/modules/Customer/index.js +83 -172
  8. package/dist/modules/Customer/types.d.ts +0 -2
  9. package/dist/modules/Discount/index.js +3 -4
  10. package/dist/modules/Discount/types.d.ts +0 -1
  11. package/dist/modules/OpenData/index.d.ts +0 -8
  12. package/dist/modules/OpenData/index.js +17 -37
  13. package/dist/modules/Order/index.d.ts +18 -268
  14. package/dist/modules/Order/index.js +757 -3306
  15. package/dist/modules/Order/types.d.ts +31 -279
  16. package/dist/modules/Order/types.js +0 -38
  17. package/dist/modules/Order/utils.d.ts +5 -147
  18. package/dist/modules/Order/utils.js +103 -746
  19. package/dist/modules/Payment/index.d.ts +13 -10
  20. package/dist/modules/Payment/index.js +837 -467
  21. package/dist/modules/Payment/types.d.ts +0 -2
  22. package/dist/modules/Payment/utils.js +1 -2
  23. package/dist/modules/Payment/walletpass.js +7 -14
  24. package/dist/modules/ProductList/index.d.ts +12 -16
  25. package/dist/modules/ProductList/index.js +59 -133
  26. package/dist/modules/ProductList/types.d.ts +0 -14
  27. package/dist/modules/Quotation/index.d.ts +1 -0
  28. package/dist/modules/Quotation/index.js +22 -25
  29. package/dist/modules/Rules/index.d.ts +0 -4
  30. package/dist/modules/Rules/index.js +69 -93
  31. package/dist/modules/Rules/types.d.ts +0 -1
  32. package/dist/modules/SalesSummary/index.d.ts +25 -8
  33. package/dist/modules/SalesSummary/index.js +35 -86
  34. package/dist/modules/SalesSummary/types.d.ts +1 -4
  35. package/dist/modules/SalesSummary/utils.d.ts +25 -2
  36. package/dist/modules/SalesSummary/utils.js +162 -794
  37. package/dist/modules/Schedule/index.d.ts +0 -7
  38. package/dist/modules/Schedule/index.js +2 -24
  39. package/dist/modules/Summary/index.js +3 -4
  40. package/dist/modules/index.d.ts +0 -2
  41. package/dist/modules/index.js +1 -3
  42. package/dist/plugins/request.d.ts +0 -1
  43. package/dist/server/index.d.ts +1 -204
  44. package/dist/server/index.js +928 -3659
  45. package/dist/server/modules/index.d.ts +0 -2
  46. package/dist/server/modules/index.js +0 -2
  47. package/dist/server/modules/order/index.d.ts +4 -120
  48. package/dist/server/modules/order/index.js +483 -1779
  49. package/dist/server/modules/order/types.d.ts +3 -32
  50. package/dist/server/modules/order/types.js +0 -8
  51. package/dist/server/modules/order/utils/filterBookings.js +3 -26
  52. package/dist/server/modules/order/utils/filterOrders.js +8 -23
  53. package/dist/server/modules/products/index.d.ts +7 -34
  54. package/dist/server/modules/products/index.js +317 -631
  55. package/dist/server/modules/resource/index.d.ts +0 -2
  56. package/dist/server/modules/resource/index.js +3 -29
  57. package/dist/server/modules/schedule/index.d.ts +4 -4
  58. package/dist/server/modules/schedule/index.js +88 -111
  59. package/dist/solution/BaseSales/index.d.ts +9 -131
  60. package/dist/solution/BaseSales/index.js +447 -1944
  61. package/dist/solution/BaseSales/types.d.ts +6 -76
  62. package/dist/solution/BaseSales/types.js +4 -5
  63. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +0 -1
  64. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +24 -105
  65. package/dist/solution/BaseSales/utils.d.ts +1 -1
  66. package/dist/solution/BaseSales/utils.js +21 -62
  67. package/dist/solution/BookingByStep/index.d.ts +1 -1
  68. package/dist/solution/BookingTicket/index.d.ts +10 -270
  69. package/dist/solution/BookingTicket/index.js +237 -1772
  70. package/dist/solution/BookingTicket/types.d.ts +1 -118
  71. package/dist/solution/BookingTicket/types.js +2 -41
  72. package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +0 -40
  73. package/dist/solution/BookingTicket/utils/bookingStatus.js +0 -70
  74. package/dist/solution/BookingTicket/utils/cartView.d.ts +1 -9
  75. package/dist/solution/BookingTicket/utils/cartView.js +7 -94
  76. package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -5
  77. package/dist/solution/BookingTicket/utils/scan/index.js +8 -20
  78. package/dist/solution/Checkout/appointmentDemo.json +1 -0
  79. package/dist/solution/Checkout/index.d.ts +0 -1
  80. package/dist/solution/Checkout/index.js +9 -10
  81. package/dist/solution/RegisterAndLogin/config.js +10 -2
  82. package/dist/solution/ScanOrder/index.d.ts +3 -9
  83. package/dist/solution/ScanOrder/index.js +134 -241
  84. package/dist/solution/ScanOrder/types.d.ts +5 -9
  85. package/dist/solution/ScanOrder/types.js +3 -2
  86. package/dist/solution/ScanOrder/utils.d.ts +1 -1
  87. package/dist/solution/ScanOrder/utils.js +22 -84
  88. package/dist/solution/VenueBooking/index.d.ts +2 -5
  89. package/dist/solution/VenueBooking/index.js +59 -110
  90. package/dist/solution/VenueBooking/sales-section-4-annotated.json +2 -0
  91. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
  92. package/dist/solution/VenueBooking/utils/slotMerge.js +0 -10
  93. package/dist/types/index.d.ts +0 -10
  94. package/lib/model/strategy/adapter/promotion/evaluator.js +1 -2
  95. package/lib/model/strategy/adapter/walletPass/utils.js +2 -3
  96. package/lib/modules/Cart/utils/cartProduct.js +3 -20
  97. package/lib/modules/Cart/utils/changePrice.js +20 -12
  98. package/lib/modules/Customer/index.d.ts +0 -20
  99. package/lib/modules/Customer/index.js +11 -64
  100. package/lib/modules/Customer/types.d.ts +0 -2
  101. package/lib/modules/Discount/index.js +1 -5
  102. package/lib/modules/Discount/types.d.ts +0 -1
  103. package/lib/modules/OpenData/index.d.ts +0 -8
  104. package/lib/modules/OpenData/index.js +5 -19
  105. package/lib/modules/Order/index.d.ts +18 -268
  106. package/lib/modules/Order/index.js +344 -2149
  107. package/lib/modules/Order/types.d.ts +31 -279
  108. package/lib/modules/Order/types.js +0 -1
  109. package/lib/modules/Order/utils.d.ts +5 -147
  110. package/lib/modules/Order/utils.js +46 -614
  111. package/lib/modules/Payment/index.d.ts +13 -10
  112. package/lib/modules/Payment/index.js +150 -18
  113. package/lib/modules/Payment/types.d.ts +0 -2
  114. package/lib/modules/Payment/utils.js +1 -2
  115. package/lib/modules/Payment/walletpass.js +3 -7
  116. package/lib/modules/ProductList/index.d.ts +12 -16
  117. package/lib/modules/ProductList/index.js +4 -41
  118. package/lib/modules/ProductList/types.d.ts +0 -14
  119. package/lib/modules/Quotation/index.d.ts +1 -0
  120. package/lib/modules/Quotation/index.js +16 -19
  121. package/lib/modules/Rules/index.d.ts +0 -4
  122. package/lib/modules/Rules/index.js +120 -136
  123. package/lib/modules/Rules/types.d.ts +0 -1
  124. package/lib/modules/SalesSummary/index.d.ts +25 -8
  125. package/lib/modules/SalesSummary/index.js +4 -30
  126. package/lib/modules/SalesSummary/types.d.ts +1 -4
  127. package/lib/modules/SalesSummary/utils.d.ts +25 -2
  128. package/lib/modules/SalesSummary/utils.js +91 -645
  129. package/lib/modules/Schedule/index.d.ts +0 -7
  130. package/lib/modules/Schedule/index.js +1 -17
  131. package/lib/modules/Summary/index.js +4 -5
  132. package/lib/modules/index.d.ts +0 -2
  133. package/lib/modules/index.js +1 -5
  134. package/lib/plugins/request.d.ts +0 -1
  135. package/lib/server/index.d.ts +1 -204
  136. package/lib/server/index.js +57 -1889
  137. package/lib/server/modules/index.d.ts +0 -2
  138. package/lib/server/modules/index.js +0 -3
  139. package/lib/server/modules/order/index.d.ts +4 -120
  140. package/lib/server/modules/order/index.js +142 -919
  141. package/lib/server/modules/order/types.d.ts +3 -32
  142. package/lib/server/modules/order/utils/filterBookings.js +5 -24
  143. package/lib/server/modules/order/utils/filterOrders.js +6 -15
  144. package/lib/server/modules/products/index.d.ts +7 -34
  145. package/lib/server/modules/products/index.js +54 -189
  146. package/lib/server/modules/resource/index.d.ts +0 -2
  147. package/lib/server/modules/resource/index.js +3 -27
  148. package/lib/server/modules/schedule/index.d.ts +4 -4
  149. package/lib/server/modules/schedule/index.js +40 -47
  150. package/lib/solution/BaseSales/index.d.ts +9 -131
  151. package/lib/solution/BaseSales/index.js +63 -1106
  152. package/lib/solution/BaseSales/types.d.ts +6 -76
  153. package/lib/solution/BaseSales/types.js +1 -3
  154. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +0 -1
  155. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +18 -106
  156. package/lib/solution/BaseSales/utils.d.ts +1 -1
  157. package/lib/solution/BaseSales/utils.js +10 -54
  158. package/lib/solution/BookingByStep/index.d.ts +1 -1
  159. package/lib/solution/BookingTicket/index.d.ts +10 -270
  160. package/lib/solution/BookingTicket/index.js +29 -922
  161. package/lib/solution/BookingTicket/types.d.ts +1 -118
  162. package/lib/solution/BookingTicket/types.js +0 -11
  163. package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +0 -40
  164. package/lib/solution/BookingTicket/utils/bookingStatus.js +2 -44
  165. package/lib/solution/BookingTicket/utils/cartView.d.ts +1 -9
  166. package/lib/solution/BookingTicket/utils/cartView.js +6 -61
  167. package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -5
  168. package/lib/solution/BookingTicket/utils/scan/index.js +3 -17
  169. package/lib/solution/Checkout/appointmentDemo.json +1 -0
  170. package/lib/solution/Checkout/index.d.ts +0 -1
  171. package/lib/solution/Checkout/index.js +2 -1
  172. package/lib/solution/RegisterAndLogin/config.js +10 -2
  173. package/lib/solution/ScanOrder/index.d.ts +3 -9
  174. package/lib/solution/ScanOrder/index.js +70 -153
  175. package/lib/solution/ScanOrder/types.d.ts +5 -9
  176. package/lib/solution/ScanOrder/utils.d.ts +1 -1
  177. package/lib/solution/ScanOrder/utils.js +17 -83
  178. package/lib/solution/VenueBooking/index.d.ts +2 -5
  179. package/lib/solution/VenueBooking/index.js +17 -54
  180. package/lib/solution/VenueBooking/sales-section-4-annotated.json +2 -0
  181. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
  182. package/lib/solution/VenueBooking/utils/slotMerge.js +0 -10
  183. package/lib/types/index.d.ts +0 -10
  184. package/package.json +1 -1
  185. package/dist/modules/BookingContext/index.d.ts +0 -48
  186. package/dist/modules/BookingContext/index.js +0 -566
  187. package/dist/modules/BookingContext/types.d.ts +0 -102
  188. package/dist/modules/BookingContext/types.js +0 -51
  189. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
  190. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -284
  191. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
  192. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -145
  193. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -76
  194. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -218
  195. package/dist/modules/BookingContext/utils/flexible.d.ts +0 -28
  196. package/dist/modules/BookingContext/utils/flexible.js +0 -56
  197. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
  198. package/dist/modules/BookingContext/utils/formatResourceList.js +0 -38
  199. package/dist/modules/BookingContext/utils/index.d.ts +0 -11
  200. package/dist/modules/BookingContext/utils/index.js +0 -11
  201. package/dist/modules/BookingContext/utils/noResource.d.ts +0 -13
  202. package/dist/modules/BookingContext/utils/noResource.js +0 -77
  203. package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +0 -1
  204. package/dist/modules/BookingContext/utils/orderLineDisplay.js +0 -36
  205. package/dist/modules/BookingContext/utils/productExtend.d.ts +0 -72
  206. package/dist/modules/BookingContext/utils/productExtend.js +0 -339
  207. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
  208. package/dist/modules/BookingContext/utils/resourceErrors.js +0 -74
  209. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
  210. package/dist/modules/BookingContext/utils/resourceSelection.js +0 -24
  211. package/dist/modules/BookingContext/utils/resources.d.ts +0 -80
  212. package/dist/modules/BookingContext/utils/resources.js +0 -486
  213. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
  214. package/dist/modules/BookingContext/utils/serviceTimes.js +0 -151
  215. package/dist/modules/BookingContext/utils/timeSlices.d.ts +0 -42
  216. package/dist/modules/BookingContext/utils/timeSlices.js +0 -100
  217. package/dist/modules/Order/utils/manualProductDiscount.d.ts +0 -106
  218. package/dist/modules/Order/utils/manualProductDiscount.js +0 -210
  219. package/dist/modules/SurchargeList/index.d.ts +0 -16
  220. package/dist/modules/SurchargeList/index.js +0 -162
  221. package/dist/modules/SurchargeList/types.d.ts +0 -11
  222. package/dist/modules/SurchargeList/types.js +0 -1
  223. package/dist/server/modules/payment/index.d.ts +0 -28
  224. package/dist/server/modules/payment/index.js +0 -305
  225. package/dist/server/modules/payment/types.d.ts +0 -9
  226. package/dist/server/modules/payment/types.js +0 -1
  227. package/dist/server/test.json +0 -713
  228. package/dist/server/utils/small-ticket.d.ts +0 -71
  229. package/dist/server/utils/small-ticket.js +0 -830
  230. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +0 -287
  231. package/dist/solution/BaseSales/utils/cartPromotion.js +0 -1438
  232. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
  233. package/dist/solution/BaseSales/utils/quotationPrice.js +0 -237
  234. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -117
  235. package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -346
  236. package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +0 -35
  237. package/dist/solution/BookingTicket/utils/addTimeAvailability.js +0 -95
  238. package/dist/solution/BookingTicket/utils/exampleData.d.ts +0 -123
  239. package/dist/solution/BookingTicket/utils/exampleData.js +0 -183
  240. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +0 -185
  241. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +0 -438
  242. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -36
  243. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +0 -399
  244. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -32
  245. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +0 -56
  246. package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +0 -21
  247. package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +0 -150
  248. package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +0 -23
  249. package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +0 -78
  250. package/lib/modules/BookingContext/index.d.ts +0 -48
  251. package/lib/modules/BookingContext/index.js +0 -368
  252. package/lib/modules/BookingContext/types.d.ts +0 -102
  253. package/lib/modules/BookingContext/types.js +0 -34
  254. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
  255. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -276
  256. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
  257. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -151
  258. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -76
  259. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -201
  260. package/lib/modules/BookingContext/utils/flexible.d.ts +0 -28
  261. package/lib/modules/BookingContext/utils/flexible.js +0 -80
  262. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
  263. package/lib/modules/BookingContext/utils/formatResourceList.js +0 -50
  264. package/lib/modules/BookingContext/utils/index.d.ts +0 -11
  265. package/lib/modules/BookingContext/utils/index.js +0 -43
  266. package/lib/modules/BookingContext/utils/noResource.d.ts +0 -13
  267. package/lib/modules/BookingContext/utils/noResource.js +0 -90
  268. package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +0 -1
  269. package/lib/modules/BookingContext/utils/orderLineDisplay.js +0 -56
  270. package/lib/modules/BookingContext/utils/productExtend.d.ts +0 -72
  271. package/lib/modules/BookingContext/utils/productExtend.js +0 -283
  272. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
  273. package/lib/modules/BookingContext/utils/resourceErrors.js +0 -80
  274. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
  275. package/lib/modules/BookingContext/utils/resourceSelection.js +0 -46
  276. package/lib/modules/BookingContext/utils/resources.d.ts +0 -80
  277. package/lib/modules/BookingContext/utils/resources.js +0 -377
  278. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
  279. package/lib/modules/BookingContext/utils/serviceTimes.js +0 -162
  280. package/lib/modules/BookingContext/utils/timeSlices.d.ts +0 -42
  281. package/lib/modules/BookingContext/utils/timeSlices.js +0 -124
  282. package/lib/modules/Order/utils/manualProductDiscount.d.ts +0 -106
  283. package/lib/modules/Order/utils/manualProductDiscount.js +0 -206
  284. package/lib/modules/SurchargeList/index.d.ts +0 -16
  285. package/lib/modules/SurchargeList/index.js +0 -89
  286. package/lib/modules/SurchargeList/types.d.ts +0 -11
  287. package/lib/modules/SurchargeList/types.js +0 -17
  288. package/lib/server/modules/payment/index.d.ts +0 -28
  289. package/lib/server/modules/payment/index.js +0 -192
  290. package/lib/server/modules/payment/types.d.ts +0 -9
  291. package/lib/server/modules/payment/types.js +0 -17
  292. package/lib/server/test.json +0 -713
  293. package/lib/server/utils/small-ticket.d.ts +0 -71
  294. package/lib/server/utils/small-ticket.js +0 -781
  295. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +0 -287
  296. package/lib/solution/BaseSales/utils/cartPromotion.js +0 -992
  297. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
  298. package/lib/solution/BaseSales/utils/quotationPrice.js +0 -277
  299. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -117
  300. package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -318
  301. package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +0 -35
  302. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +0 -125
  303. package/lib/solution/BookingTicket/utils/exampleData.d.ts +0 -123
  304. package/lib/solution/BookingTicket/utils/exampleData.js +0 -0
  305. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +0 -185
  306. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +0 -254
  307. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -36
  308. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +0 -168
  309. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -32
  310. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +0 -51
  311. package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +0 -21
  312. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +0 -127
  313. package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +0 -23
  314. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +0 -85
@@ -44,8 +44,8 @@ import { ItemRuleEvaluator } from "../../model/strategy/adapter/itemRule";
44
44
  import { extractResourceIds, buildResourceProductMap } from "./utils/resource";
45
45
  import { buildTimeSlotGrid, isBusinessHoursCrossDay, generateTimeLabels } from "./utils/timeSlot";
46
46
  import { buildDateRangeSummary } from "./utils/dateSummary";
47
- import { mergeConsecutiveSlots, expandMergedSlotToIndividual, buildVenueIdentityKey, buildVenueBookingEntry, buildVenueResourceMetadata, buildPriceBreakdown } from "./utils/slotMerge";
48
- import { composeLinePrice, createUuidV4, getProductSkuOptions, sumOptionUnitPrice } from "../../modules/Order/utils";
47
+ import { mergeConsecutiveSlots, expandMergedSlotToIndividual, buildVenueIdentityKey, buildVenueBookingEntry, buildPriceBreakdown } from "./utils/slotMerge";
48
+ import { composeLinePrice, createUuidV4, sumOptionUnitPrice } from "../../modules/Order/utils";
49
49
  import { OrderModule } from "../../modules/Order";
50
50
  import { RegisterAndLoginHooks } from "../RegisterAndLogin/types";
51
51
  import Decimal from 'decimal.js';
@@ -112,26 +112,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
112
112
  moduleName: 'venueBooking'
113
113
  };
114
114
  }
115
- }, {
116
- key: "safeStringify",
117
- value: function safeStringify(value) {
118
- try {
119
- return JSON.stringify(value);
120
- } catch (_unused) {
121
- return undefined;
122
- }
123
- }
124
- }, {
125
- key: "pickErrorMessage",
126
- value: function pickErrorMessage(error) {
127
- var _error$data, _error$response, _error$error;
128
- var candidates = [error.message, (_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.message, (_error$response = error.response) === null || _error$response === void 0 || (_error$response = _error$response.data) === null || _error$response === void 0 ? void 0 : _error$response.message, (_error$error = error.error) === null || _error$error === void 0 ? void 0 : _error$error.message];
129
- for (var _i = 0, _candidates = candidates; _i < _candidates.length; _i++) {
130
- var candidate = _candidates[_i];
131
- if (typeof candidate === 'string' && candidate.trim()) return candidate;
132
- }
133
- return undefined;
134
- }
135
115
  }, {
136
116
  key: "serializeError",
137
117
  value: function serializeError(error) {
@@ -142,21 +122,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
142
122
  stack: error.stack
143
123
  };
144
124
  }
145
- if (error && _typeof(error) === 'object') {
146
- var raw = error;
147
- var message = this.pickErrorMessage(raw) || this.safeStringify(raw) || String(error);
148
- return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, typeof raw.name === 'string' ? {
149
- name: raw.name
150
- } : {}), {}, {
151
- message: message
152
- }, 'code' in raw ? {
153
- code: raw.code
154
- } : {}), 'status' in raw ? {
155
- status: raw.status
156
- } : {}), this.safeStringify(raw) ? {
157
- raw: this.safeStringify(raw)
158
- } : {});
159
- }
160
125
  return {
161
126
  message: String(error)
162
127
  };
@@ -281,8 +246,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
281
246
  value: function resolveCustomerIdFromLoginPayload(payload) {
282
247
  var _payload$user, _payload$user2, _payload$user3, _payload$user4, _payload$account, _payload$account2, _payload$account3, _payload$_origin;
283
248
  var candidates = [payload === null || payload === void 0 ? void 0 : payload.customerId, payload === null || payload === void 0 ? void 0 : payload.customer_id, payload === null || payload === void 0 ? void 0 : payload.id, payload === null || payload === void 0 || (_payload$user = payload.user) === null || _payload$user === void 0 ? void 0 : _payload$user.customerId, payload === null || payload === void 0 || (_payload$user2 = payload.user) === null || _payload$user2 === void 0 ? void 0 : _payload$user2.customer_id, payload === null || payload === void 0 || (_payload$user3 = payload.user) === null || _payload$user3 === void 0 ? void 0 : _payload$user3.id, payload === null || payload === void 0 || (_payload$user4 = payload.user) === null || _payload$user4 === void 0 || (_payload$user4 = _payload$user4._origin) === null || _payload$user4 === void 0 ? void 0 : _payload$user4.customer_id, payload === null || payload === void 0 || (_payload$account = payload.account) === null || _payload$account === void 0 ? void 0 : _payload$account.customerId, payload === null || payload === void 0 || (_payload$account2 = payload.account) === null || _payload$account2 === void 0 ? void 0 : _payload$account2.customer_id, payload === null || payload === void 0 || (_payload$account3 = payload.account) === null || _payload$account3 === void 0 ? void 0 : _payload$account3.id, payload === null || payload === void 0 || (_payload$_origin = payload._origin) === null || _payload$_origin === void 0 ? void 0 : _payload$_origin.customer_id];
284
- for (var _i2 = 0, _candidates2 = candidates; _i2 < _candidates2.length; _i2++) {
285
- var candidate = _candidates2[_i2];
249
+ for (var _i = 0, _candidates = candidates; _i < _candidates.length; _i++) {
250
+ var candidate = _candidates[_i];
286
251
  var customerId = this.normalizeCustomerId(candidate);
287
252
  if (customerId) return customerId;
288
253
  }
@@ -534,14 +499,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
534
499
  var _this4$store$order, _this4$otherParams, _this4$otherParams2, _this4$otherParams3, _this4$otherParams4;
535
500
  _this4.store[step] = targetModule;
536
501
  var initialState = step === 'salesSummary' ? {
502
+ // TODO(Order types): VenueBooking should read OrderState.summary instead of tempOrder.summary.
537
503
  summary: ((_this4$store$order = _this4.store.order) === null || _this4$store$order === void 0 || (_this4$store$order = _this4$store$order.getTempOrder()) === null || _this4$store$order === void 0 ? void 0 : _this4$store$order.summary) || createEmptySummary()
538
504
  } : {};
539
505
  var loggerProvider = ((_this4$otherParams = _this4.otherParams) === null || _this4$otherParams === void 0 ? void 0 : _this4$otherParams.loggerProvider) || 'feishu';
540
506
  var loggerConfig = ((_this4$otherParams2 = _this4.otherParams) === null || _this4$otherParams2 === void 0 ? void 0 : _this4$otherParams2.loggerConfig) || {
541
- feishu: {
542
- webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/8f069b14-9d39-4728-8f78-b56f393bfde8',
543
- errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/bdefae5e-f233-4705-8688-946887d9543d'
544
- }
507
+ feishu: {}
545
508
  };
546
509
  _this4.core.registerModule(targetModule, {
547
510
  initialState: initialState,
@@ -866,28 +829,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
866
829
  }
867
830
  throw new Error('addonProducts 模块未初始化');
868
831
  case 6:
869
- _context11.next = 8;
870
- return this.loadOpenDataConfig();
871
- case 8:
872
832
  associatedMenus = ((_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 || (_this$otherParams7 = _this$otherParams7.openData) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7['menu.associated_menus']) || [];
873
833
  if (associatedMenus.length) {
874
- _context11.next = 12;
834
+ _context11.next = 9;
875
835
  break;
876
836
  }
877
- this.logMethodError('loadAllProducts', new Error('未获取到餐牌配置(menu.associated_menus),请检查 OpenData 配置'));
878
837
  throw new Error('未获取到餐牌配置(menu.associated_menus),请检查 OpenData 配置');
879
- case 12:
838
+ case 9:
880
839
  menuListIds = associatedMenus.map(function (n) {
881
840
  return Number(n.value);
882
841
  });
883
- _context11.next = 15;
842
+ _context11.next = 12;
884
843
  return this.store.venueProducts.loadProducts({
885
844
  menu_list_ids: menuListIds,
886
845
  cacheId: this.cacheId,
887
846
  schedule_date: dayjs().format('YYYY-MM-DD'),
888
847
  schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
889
848
  });
890
- case 15:
849
+ case 12:
891
850
  allProducts = _context11.sent;
892
851
  list = Array.isArray(allProducts) ? allProducts : [];
893
852
  venueList = list.filter(function (p) {
@@ -915,16 +874,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
915
874
  venueProducts: venueList,
916
875
  addonProducts: addonList
917
876
  });
918
- case 28:
919
- _context11.prev = 28;
877
+ case 25:
878
+ _context11.prev = 25;
920
879
  _context11.t0 = _context11["catch"](1);
921
880
  this.logMethodError('loadAllProducts', _context11.t0);
922
881
  throw _context11.t0;
923
- case 32:
882
+ case 29:
924
883
  case "end":
925
884
  return _context11.stop();
926
885
  }
927
- }, _callee11, this, [[1, 28]]);
886
+ }, _callee11, this, [[1, 25]]);
928
887
  }));
929
888
  function _doLoadAllProducts() {
930
889
  return _doLoadAllProducts2.apply(this, arguments);
@@ -1036,7 +995,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1036
995
  key: "fetchResourceAvailability",
1037
996
  value: function () {
1038
997
  var _fetchResourceAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
1039
- var venueProducts, resourceIds, config, crossDay, effectiveEndDate, res, rawData, _iterator2, _step2, item, _i3, _rawData, _item, mappings, _iterator3, _step3, mapping;
998
+ var venueProducts, resourceIds, config, crossDay, effectiveEndDate, res, rawData, _iterator2, _step2, item, _i2, _rawData, _item, mappings, _iterator3, _step3, mapping;
1040
999
  return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1041
1000
  while (1) switch (_context15.prev = _context15.next) {
1042
1001
  case 0:
@@ -1104,13 +1063,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1104
1063
  }
1105
1064
  }
1106
1065
  this.store.rawResourceData = rawData;
1107
- _i3 = 0, _rawData = rawData;
1066
+ _i2 = 0, _rawData = rawData;
1108
1067
  case 24:
1109
- if (!(_i3 < _rawData.length)) {
1068
+ if (!(_i2 < _rawData.length)) {
1110
1069
  _context15.next = 34;
1111
1070
  break;
1112
1071
  }
1113
- _item = _rawData[_i3];
1072
+ _item = _rawData[_i2];
1114
1073
  mappings = this.resourceProductMap.get(_item.resourceId);
1115
1074
  if (mappings) {
1116
1075
  _context15.next = 29;
@@ -1131,7 +1090,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1131
1090
  _iterator3.f();
1132
1091
  }
1133
1092
  case 31:
1134
- _i3++;
1093
+ _i2++;
1135
1094
  _context15.next = 24;
1136
1095
  break;
1137
1096
  case 34:
@@ -1669,10 +1628,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1669
1628
  form_id: (_rawResource$form_id = rawResource === null || rawResource === void 0 ? void 0 : rawResource.form_id) !== null && _rawResource$form_id !== void 0 ? _rawResource$form_id : mapping.formId,
1670
1629
  relation_id: resourceId,
1671
1630
  capacity: 1,
1672
- metadata: buildVenueResourceMetadata({
1673
- mapping: mapping,
1674
- rawResource: rawResource
1675
- })
1631
+ metadata: {}
1676
1632
  };
1677
1633
  if (childRawResources && childRawResources.length) {
1678
1634
  resourceEntry.children = childRawResources.map(function (child) {
@@ -1726,9 +1682,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1726
1682
  product_variant_id: 0,
1727
1683
  num: 1,
1728
1684
  product_bundle: [],
1729
- product_sku: {
1730
- option: []
1731
- },
1685
+ product_option_item: [],
1732
1686
  discount_list: [],
1733
1687
  custom_deposit_data: customDepositData,
1734
1688
  metadata: {}
@@ -2185,7 +2139,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2185
2139
  totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
2186
2140
  return sum + (pd.amount || 0);
2187
2141
  }, 0);
2188
- optionSum = sumOptionUnitPrice(getProductSkuOptions(product));
2142
+ optionSum = sumOptionUnitPrice(product.product_option_item);
2189
2143
  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';
2190
2144
  newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
2191
2145
  newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
@@ -2228,6 +2182,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2228
2182
  });
2229
2183
  case 50:
2230
2184
  this.store.order.persistTempOrder();
2185
+ // TODO(Order types): VenueBooking should read OrderState.summary instead of tempOrder.summary.
2231
2186
  finalSummary = ((_this$store$order$get = this.store.order.getTempOrder()) === null || _this$store$order$get === void 0 ? void 0 : _this$store$order$get.summary) || null;
2232
2187
  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;
2233
2188
  this.logMethodSuccess('setDiscountSelected', params);
@@ -2295,8 +2250,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2295
2250
  key: "getOrderProducts",
2296
2251
  value: function getOrderProducts() {
2297
2252
  if (!this.store.order) throw new Error('order 模块未初始化');
2298
- var products = this.store.order.getOrderProducts();
2299
- return products;
2253
+ return this.store.order.getOrderProducts();
2300
2254
  }
2301
2255
  }, {
2302
2256
  key: "getSummary",
@@ -2451,14 +2405,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2451
2405
  return addProductToOrder;
2452
2406
  }()
2453
2407
  }, {
2454
- key: "updateOrderProduct",
2408
+ key: "updateProductInOrder",
2455
2409
  value: function () {
2456
- var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
2410
+ var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
2457
2411
  var products;
2458
2412
  return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2459
2413
  while (1) switch (_context26.prev = _context26.next) {
2460
2414
  case 0:
2461
- this.logMethodStart('updateOrderProduct', {
2415
+ this.logMethodStart('updateProductInOrder', {
2462
2416
  product_id: params.product_id,
2463
2417
  product_variant_id: params.product_variant_id
2464
2418
  });
@@ -2470,7 +2424,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2470
2424
  throw new Error('order 模块未初始化');
2471
2425
  case 4:
2472
2426
  _context26.next = 6;
2473
- return this.store.order.updateOrderProduct(params);
2427
+ return this.store.order.updateProductInOrder(params);
2474
2428
  case 6:
2475
2429
  products = _context26.sent;
2476
2430
  _context26.next = 9;
@@ -2479,14 +2433,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2479
2433
  _context26.next = 11;
2480
2434
  return this.refreshCartValidationPassed();
2481
2435
  case 11:
2482
- this.logMethodSuccess('updateOrderProduct', {
2436
+ this.logMethodSuccess('updateProductInOrder', {
2483
2437
  productCount: products.length
2484
2438
  });
2485
2439
  return _context26.abrupt("return", products);
2486
2440
  case 15:
2487
2441
  _context26.prev = 15;
2488
2442
  _context26.t0 = _context26["catch"](1);
2489
- this.logMethodError('updateOrderProduct', _context26.t0);
2443
+ this.logMethodError('updateProductInOrder', _context26.t0);
2490
2444
  throw _context26.t0;
2491
2445
  case 19:
2492
2446
  case "end":
@@ -2494,10 +2448,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2494
2448
  }
2495
2449
  }, _callee26, this, [[1, 15]]);
2496
2450
  }));
2497
- function updateOrderProduct(_x17) {
2498
- return _updateOrderProduct.apply(this, arguments);
2451
+ function updateProductInOrder(_x17) {
2452
+ return _updateProductInOrder.apply(this, arguments);
2499
2453
  }
2500
- return updateOrderProduct;
2454
+ return updateProductInOrder;
2501
2455
  }()
2502
2456
  }, {
2503
2457
  key: "removeProductFromOrder",
@@ -2544,6 +2498,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2544
2498
  }
2545
2499
  return _context27.abrupt("continue", 20);
2546
2500
  case 18:
2501
+ // TODO(Order types): VenueBooking should use metadata.unique_identification_number only.
2547
2502
  if (product.identity_key) venueProductUids.add(String(product.identity_key));
2548
2503
  if ((_product$metadata7 = product.metadata) !== null && _product$metadata7 !== void 0 && _product$metadata7.booking_uid) {
2549
2504
  venueBookingUids.add(String(product.metadata.booking_uid));
@@ -2638,7 +2593,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2638
2593
  key: "loadOpenDataConfig",
2639
2594
  value: function () {
2640
2595
  var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2641
- var lastFetchedAt, cachedData, openDataConfig;
2596
+ var _this11 = this;
2597
+ var lastFetchedAt, cachedData;
2642
2598
  return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2643
2599
  while (1) switch (_context29.prev = _context29.next) {
2644
2600
  case 0:
@@ -2658,35 +2614,27 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2658
2614
  return _context29.abrupt("return", cachedData);
2659
2615
  case 7:
2660
2616
  if (!this.loadOpenDataConfigInFlight) {
2661
- _context29.next = 11;
2617
+ _context29.next = 9;
2662
2618
  break;
2663
2619
  }
2664
- _context29.next = 10;
2665
- return this.loadOpenDataConfigInFlight;
2666
- case 10:
2667
- return _context29.abrupt("return", _context29.sent);
2668
- case 11:
2620
+ return _context29.abrupt("return", this.loadOpenDataConfigInFlight);
2621
+ case 9:
2669
2622
  this.loadOpenDataConfigInFlight = this.store.openData.fetchOpenData({
2670
2623
  scope: 'board',
2671
2624
  target: 'venue_booking+online_store',
2672
2625
  section_code: [].concat(OPEN_DATA_SECTION_CODES)
2626
+ }).then(function (openDataConfig) {
2627
+ _this11.otherParams.openData = openDataConfig;
2628
+ return openDataConfig;
2629
+ }).finally(function () {
2630
+ _this11.loadOpenDataConfigInFlight = null;
2673
2631
  });
2674
- _context29.prev = 12;
2675
- _context29.next = 15;
2676
- return this.loadOpenDataConfigInFlight;
2677
- case 15:
2678
- openDataConfig = _context29.sent;
2679
- this.otherParams.openData = openDataConfig;
2680
- return _context29.abrupt("return", openDataConfig);
2681
- case 18:
2682
- _context29.prev = 18;
2683
- this.loadOpenDataConfigInFlight = null;
2684
- return _context29.finish(18);
2685
- case 21:
2632
+ return _context29.abrupt("return", this.loadOpenDataConfigInFlight);
2633
+ case 11:
2686
2634
  case "end":
2687
2635
  return _context29.stop();
2688
2636
  }
2689
- }, _callee29, this, [[12,, 18, 21]]);
2637
+ }, _callee29, this);
2690
2638
  }));
2691
2639
  function loadOpenDataConfig() {
2692
2640
  return _loadOpenDataConfig.apply(this, arguments);
@@ -2832,8 +2780,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2832
2780
  var key = buildProductKey(productId, normalizedVariantId);
2833
2781
  if (!sourceMap.has(key)) sourceMap.set(key, node);
2834
2782
  }
2835
- for (var _i4 = 0, _Object$values = Object.values(node); _i4 < _Object$values.length; _i4++) {
2836
- var childValue = _Object$values[_i4];
2783
+ for (var _i3 = 0, _Object$values = Object.values(node); _i3 < _Object$values.length; _i3++) {
2784
+ var childValue = _Object$values[_i3];
2837
2785
  if (childValue && _typeof(childValue) === 'object') collectFromValue(childValue);
2838
2786
  }
2839
2787
  };
@@ -2866,7 +2814,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2866
2814
  key: "ensureItemRuleConfigsLoaded",
2867
2815
  value: function () {
2868
2816
  var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
2869
- var _this11 = this;
2817
+ var _this12 = this;
2870
2818
  return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2871
2819
  while (1) switch (_context34.prev = _context34.next) {
2872
2820
  case 0:
@@ -2887,19 +2835,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2887
2835
  return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2888
2836
  while (1) switch (_context33.prev = _context33.next) {
2889
2837
  case 0:
2890
- runtimeConfig = _this11.getItemRuleRuntimeConfig();
2838
+ runtimeConfig = _this12.getItemRuleRuntimeConfig();
2891
2839
  staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
2892
2840
  if (!(staticConfigs.length > 0)) {
2893
2841
  _context33.next = 6;
2894
2842
  break;
2895
2843
  }
2896
- _this11.itemRuleConfigs = staticConfigs;
2897
- _this11.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
2898
- return _context33.abrupt("return", _this11.itemRuleConfigs);
2844
+ _this12.itemRuleConfigs = staticConfigs;
2845
+ _this12.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
2846
+ return _context33.abrupt("return", _this12.itemRuleConfigs);
2899
2847
  case 6:
2900
- _this11.itemRuleConfigs = [];
2901
- _this11.itemRuleEvaluator.setStrategyConfigs([]);
2902
- return _context33.abrupt("return", _this11.itemRuleConfigs);
2848
+ _this12.itemRuleConfigs = [];
2849
+ _this12.itemRuleEvaluator.setStrategyConfigs([]);
2850
+ return _context33.abrupt("return", _this12.itemRuleConfigs);
2903
2851
  case 9:
2904
2852
  case "end":
2905
2853
  return _context33.stop();
@@ -3080,6 +3028,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3080
3028
  item_rule_prefill: true,
3081
3029
  item_rule_id: prefillItem.ruleId
3082
3030
  }),
3031
+ // TODO(Order types): migrate VenueBooking prefill origin runtime into tempOrder._extend.
3083
3032
  _origin: sourceItem ? _objectSpread(_objectSpread({}, targetProduct._origin || {}), sourceItem) : targetProduct._origin
3084
3033
  });
3085
3034
  if (delta > 0 || Boolean(sourceItem && (!targetProduct._origin || ((_origin2 = targetProduct._origin) === null || _origin2 === void 0 ? void 0 : _origin2.price) !== (sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price)))) {
@@ -3360,7 +3309,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3360
3309
  var raw = this.window.sessionStorage.getItem(key) || '{}';
3361
3310
  var parsed = JSON.parse(raw);
3362
3311
  return parsed && _typeof(parsed) === 'object' ? parsed : {};
3363
- } catch (_unused3) {
3312
+ } catch (_unused2) {
3364
3313
  return {};
3365
3314
  }
3366
3315
  }
@@ -71,6 +71,8 @@
71
71
  "num__comment": "数量;int;↕;必填。统一使用 num,不再使用 product_quantity。",
72
72
  "product_variant_id": 0,
73
73
  "product_variant_id__comment": "多规格 ID;int;↕;可选。",
74
+ "product_option_item": [],
75
+ "product_option_item__comment": "选项配置;array;↕;可选。",
74
76
  "selling_price": "50.00",
75
77
  "selling_price__comment": "销售单价(交易快照);string;←;服务端返回,不能依赖基准数据回填。",
76
78
  "original_price": "60.00",
@@ -12,10 +12,6 @@ export declare function buildPriceBreakdown(params: {
12
12
  }) => number;
13
13
  };
14
14
  }): PriceBreakdownEntry[];
15
- export declare function buildVenueResourceMetadata(params: {
16
- mapping: ResourceProductMapping;
17
- rawResource: VenueResourceRawData | undefined;
18
- }): Record<string, any>;
19
15
  export interface BuildVenueBookingParams {
20
16
  group: MergedSlotGroup;
21
17
  resourceId: number | string;
@@ -89,16 +89,6 @@ export function buildPriceBreakdown(params) {
89
89
  }
90
90
  return entries;
91
91
  }
92
- export function buildVenueResourceMetadata(params) {
93
- var _rawResource$form_nam, _ref, _rawResource$main_fie, _rawResource$combined;
94
- var mapping = params.mapping,
95
- rawResource = params.rawResource;
96
- return {
97
- form_name: (_rawResource$form_nam = rawResource === null || rawResource === void 0 ? void 0 : rawResource.form_name) !== null && _rawResource$form_nam !== void 0 ? _rawResource$form_nam : '',
98
- resource_name: (_ref = (_rawResource$main_fie = rawResource === null || rawResource === void 0 ? void 0 : rawResource.main_field) !== null && _rawResource$main_fie !== void 0 ? _rawResource$main_fie : mapping.resourceName) !== null && _ref !== void 0 ? _ref : '',
99
- combined_resource: (_rawResource$combined = rawResource === null || rawResource === void 0 ? void 0 : rawResource.combined_resource) !== null && _rawResource$combined !== void 0 ? _rawResource$combined : null
100
- };
101
- }
102
92
  export function buildVenueBookingEntry(params) {
103
93
  var _rawResource$form_id;
104
94
  var group = params.group,
@@ -14,16 +14,6 @@ export interface Module {
14
14
  name: string;
15
15
  version: string;
16
16
  initialize: (core: PisellCore, options: ModuleOptions) => Promise<void> | void;
17
- /**
18
- * 父级解决方案运行时更新 otherParams 后,显式通知子模块刷新自己的运行态参数。
19
- *
20
- * @example
21
- * await module.updateOtherParams?.({ channel: 'pos' }, { changedParams: { channel: 'pos' } });
22
- */
23
- updateOtherParams?: (params: Record<string, any>, meta?: {
24
- changedParams?: Record<string, any>;
25
- cover?: boolean;
26
- }) => Promise<void> | void;
27
17
  destroy?: () => Promise<void> | void;
28
18
  exports?: Record<string, any>;
29
19
  isSolution?: boolean;
@@ -528,8 +528,7 @@ var PromotionEvaluator = class {
528
528
  return b.price - a.price;
529
529
  });
530
530
  const totalUnits = unitProducts.length;
531
- const isCumulative = cumulative !== false;
532
- const groupCount = isCumulative ? Math.floor(totalUnits / x) : totalUnits >= x ? 1 : 0;
531
+ const groupCount = cumulative ? Math.floor(totalUnits / x) : totalUnits >= x ? 1 : 0;
533
532
  const promotionUnits = groupCount * x;
534
533
  const inPromotionUnits = unitProducts.slice(0, promotionUnits);
535
534
  const notInPromotionUnits = unitProducts.slice(promotionUnits);
@@ -346,8 +346,7 @@ function processVouchers(applicableVouchers, orderTotalAmount, products) {
346
346
  );
347
347
  const maxDeduction = import_decimal.default.min(
348
348
  new import_decimal.default(usageAmount),
349
- new import_decimal.default(maxDeductionAmount),
350
- remainingOrderAmount
349
+ new import_decimal.default(maxDeductionAmount)
351
350
  );
352
351
  let deductionLeft = maxDeduction;
353
352
  const deductionDetails = [];
@@ -489,7 +488,7 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
489
488
  });
490
489
  return;
491
490
  }
492
- const usageAmount = typeof selectedVoucher.edit_current_amount === "number" ? selectedVoucher.edit_current_amount : selectedVoucher._available_max_amount ?? getRecommendedAmount(selectedVoucher);
491
+ const usageAmount = typeof selectedVoucher.edit_current_amount === "number" ? selectedVoucher.edit_current_amount : getRecommendedAmount(selectedVoucher);
493
492
  const maxDeduction = import_decimal.default.min(
494
493
  new import_decimal.default(usageAmount),
495
494
  new import_decimal.default(maxDeductionAmount),
@@ -46,7 +46,6 @@ var import_decimal = __toESM(require("decimal.js"));
46
46
  var import_utils = require("../../Product/utils");
47
47
  var import_utils2 = require("../../../solution/ShopDiscount/utils");
48
48
  var import_utils3 = require("../../Summary/utils");
49
- var import_utils4 = require("../../Order/utils");
50
49
  var toDiscountPayload = (discountItem) => {
51
50
  var _a, _b;
52
51
  return {
@@ -186,7 +185,7 @@ var formatProductToCartItemOrigin = (params) => {
186
185
  product_id: product.id,
187
186
  product_variant_id: product_variant_id || 0,
188
187
  product_bundle: ((_b = origin.product) == null ? void 0 : _b.product_bundle) || [],
189
- product_sku: ((_c = origin.product) == null ? void 0 : _c.product_sku) || { option: [] },
188
+ product_option_item: ((_c = origin.product) == null ? void 0 : _c.product_option_item) || [],
190
189
  metadata: {
191
190
  product_discount_difference
192
191
  }
@@ -197,14 +196,7 @@ var formatProductToCartItemOrigin = (params) => {
197
196
  origin.product.product_bundle = formatBundleToOrigin(bundle);
198
197
  }
199
198
  if (options == null ? void 0 : options.length) {
200
- origin.product.product_sku = {
201
- ...origin.product.product_sku || {},
202
- option: formatOptionsToOrigin(options).map((option) => {
203
- const next = { ...option, add_price: option.add_price ?? option.price };
204
- delete next.price;
205
- return next;
206
- })
207
- };
199
+ origin.product.product_option_item = formatOptionsToOrigin(options);
208
200
  }
209
201
  }
210
202
  return origin;
@@ -338,15 +330,6 @@ var formatBundleToOrigin = (bundle) => {
338
330
  var _a;
339
331
  return pre + (((_a = cur == null ? void 0 : cur.metadata) == null ? void 0 : _a.product_discount_difference) || 0);
340
332
  }, 0);
341
- const normalizedBundle = {
342
- ...d,
343
- // 计算 markdown 净额时只传真实毛价;若仅有 bundle_selling_price,则由 helper 当历史净额兜底。
344
- price: (d == null ? void 0 : d.price) ?? (d == null ? void 0 : d.custom_price),
345
- bundle_selling_price: d == null ? void 0 : d.bundle_selling_price,
346
- price_type: (d == null ? void 0 : d.price_type) ?? (d == null ? void 0 : d.custom_price_type),
347
- price_type_ext: (d == null ? void 0 : d.price_type_ext) ?? (d == null ? void 0 : d.custom_price_type_ext),
348
- option: getBundleValueByKey("option")
349
- };
350
333
  return {
351
334
  bundle_group_id: getBundleValueByKey("group_id"),
352
335
  bundle_id: d.id,
@@ -357,7 +340,7 @@ var formatBundleToOrigin = (bundle) => {
357
340
  extension_type: getBundleValueByKey("extension_type"),
358
341
  option: formatOptionsToOrigin(getBundleValueByKey("option")),
359
342
  discount_list: d.discount_list,
360
- "bundle_selling_price": (0, import_utils4.getBundleSellingMagnitude)(normalizedBundle).toFixed(2),
343
+ "bundle_selling_price": d == null ? void 0 : d.price,
361
344
  "custom_price": d == null ? void 0 : d.price,
362
345
  metadata: {
363
346
  custom_product_bundle_map_id: d._id,
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all)
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
14
16
  }
15
17
  return to;
16
18
  };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
17
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
28
 
19
29
  // src/modules/Cart/utils/changePrice.ts
@@ -22,7 +32,7 @@ __export(changePrice_exports, {
22
32
  updateAllCartItemPrice: () => updateAllCartItemPrice
23
33
  });
24
34
  module.exports = __toCommonJS(changePrice_exports);
25
- var import_utils = require("../../Order/utils");
35
+ var import_decimal = __toESM(require("decimal.js"));
26
36
  async function updateAllCartItemPrice(cartItems, priceData, getProduct, updateCart, updateItemInitInfo) {
27
37
  var _a, _b;
28
38
  for (const item of cartItems) {
@@ -47,20 +57,18 @@ async function updateAllCartItemPrice(cartItems, priceData, getProduct, updateCa
47
57
  const targetBundleItem = targetBundle.bundle_item.find(
48
58
  (m) => m.id === n.id
49
59
  );
60
+ if (targetBundleItem.price_type === "markdown") {
61
+ targetBundleItem.price = new import_decimal.default(targetBundleItem.price || 0).mul(-1).toNumber();
62
+ }
63
+ if (n.option) {
64
+ targetBundleItem.price = new import_decimal.default(targetBundleItem.price || 0).add(n.option.reduce((pre, cur) => {
65
+ return pre + new import_decimal.default(cur.price || 0).mul(cur.num || 1).toNumber();
66
+ }, 0)).toNumber();
67
+ }
50
68
  if (targetBundleItem) {
51
- const normalizedBundle = {
52
- ...n,
53
- price: targetBundleItem.price,
54
- custom_price: targetBundleItem.price,
55
- price_type: targetBundleItem.price_type,
56
- price_type_ext: targetBundleItem.price_type_ext
57
- };
58
- const bundleSellingPrice = (0, import_utils.getBundleSellingMagnitude)(normalizedBundle).toFixed(2);
59
69
  return {
60
70
  ...n,
61
- custom_price: targetBundleItem.price,
62
- price: targetBundleItem.price_type === "markdown" ? bundleSellingPrice : targetBundleItem.price,
63
- bundle_selling_price: bundleSellingPrice,
71
+ price: targetBundleItem.price,
64
72
  base_price: targetBundleItem.base_price
65
73
  };
66
74
  }